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 _le=Object.defineProperty;var Sle=(e,t,n)=>t in e?_le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Me=(e,t,n)=>Sle(e,typeof t!="symbol"?t+"":t,n);function Cle(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in e)){const i=Object.getOwnPropertyDescriptor(s,r);i&&Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:()=>s[r]})}}}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 r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();var x2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function C4(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var dU={exports:{}},T4={};/**
 * @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 Tle=Symbol.for("react.transitional.element"),Ele=Symbol.for("react.fragment");function hU(e,t,n){var s=null;if(n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:Tle,type:e,key:s,ref:t!==void 0?t:null,props:n}}T4.Fragment=Ele;T4.jsx=hU;T4.jsxs=hU;dU.exports=T4;var l=dU.exports,fU={exports:{}},as={};/**
 * @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 L9=Symbol.for("react.transitional.element"),Ale=Symbol.for("react.portal"),Nle=Symbol.for("react.fragment"),jle=Symbol.for("react.strict_mode"),Mle=Symbol.for("react.profiler"),Ile=Symbol.for("react.consumer"),Rle=Symbol.for("react.context"),Dle=Symbol.for("react.forward_ref"),Lle=Symbol.for("react.suspense"),Ple=Symbol.for("react.memo"),mU=Symbol.for("react.lazy"),Ole=Symbol.for("react.activity"),ED=Symbol.iterator;function Ble(e){return e===null||typeof e!="object"?null:(e=ED&&e[ED]||e["@@iterator"],typeof e=="function"?e:null)}var pU={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},gU=Object.assign,bU={};function j1(e,t,n){this.props=e,this.context=t,this.refs=bU,this.updater=n||pU}j1.prototype.isReactComponent={};j1.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")};j1.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function yU(){}yU.prototype=j1.prototype;function P9(e,t,n){this.props=e,this.context=t,this.refs=bU,this.updater=n||pU}var O9=P9.prototype=new yU;O9.constructor=P9;gU(O9,j1.prototype);O9.isPureReactComponent=!0;var AD=Array.isArray;function P8(){}var Xr={H:null,A:null,T:null,S:null},xU=Object.prototype.hasOwnProperty;function B9(e,t,n){var s=n.ref;return{$$typeof:L9,type:e,key:t,ref:s!==void 0?s:null,props:n}}function $le(e,t){return B9(e.type,t,e.props)}function $9(e){return typeof e=="object"&&e!==null&&e.$$typeof===L9}function zle(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var ND=/\/+/g;function mT(e,t){return typeof e=="object"&&e!==null&&e.key!=null?zle(""+e.key):t.toString(36)}function Fle(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(P8,P8):(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 U0(e,t,n,s,r){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"bigint":case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case L9:case Ale:o=!0;break;case mU:return o=e._init,U0(o(e._payload),t,n,s,r)}}if(o)return r=r(e),o=s===""?"."+mT(e,0):s,AD(r)?(n="",o!=null&&(n=o.replace(ND,"$&/")+"/"),U0(r,t,n,"",function(u){return u})):r!=null&&($9(r)&&(r=$le(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(ND,"$&/")+"/")+o)),t.push(r)),1;o=0;var a=s===""?".":s+":";if(AD(e))for(var c=0;c<e.length;c++)s=e[c],i=a+mT(s,c),o+=U0(s,t,n,i,r);else if(c=Ble(e),typeof c=="function")for(e=c.call(e),c=0;!(s=e.next()).done;)s=s.value,i=a+mT(s,c++),o+=U0(s,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return U0(Fle(e),t,n,s,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return o}function Bw(e,t,n){if(e==null)return e;var s=[],r=0;return U0(e,s,"","",function(i){return t.call(n,i,r++)}),s}function Hle(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 jD=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)},qle={map:Bw,forEach:function(e,t,n){Bw(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Bw(e,function(){t++}),t},toArray:function(e){return Bw(e,function(t){return t})||[]},only:function(e){if(!$9(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};as.Activity=Ole;as.Children=qle;as.Component=j1;as.Fragment=Nle;as.Profiler=Mle;as.PureComponent=P9;as.StrictMode=jle;as.Suspense=Lle;as.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Xr;as.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Xr.H.useMemoCache(e)}};as.cache=function(e){return function(){return e.apply(null,arguments)}};as.cacheSignal=function(){return null};as.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var s=gU({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!xU.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(s[i]=t[i]);var i=arguments.length-2;if(i===1)s.children=n;else if(1<i){for(var o=Array(i),a=0;a<i;a++)o[a]=arguments[a+2];s.children=o}return B9(e.type,r,s)};as.createContext=function(e){return e={$$typeof:Rle,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Ile,_context:e},e};as.createElement=function(e,t,n){var s,r={},i=null;if(t!=null)for(s in t.key!==void 0&&(i=""+t.key),t)xU.call(t,s)&&s!=="key"&&s!=="__self"&&s!=="__source"&&(r[s]=t[s]);var o=arguments.length-2;if(o===1)r.children=n;else if(1<o){for(var a=Array(o),c=0;c<o;c++)a[c]=arguments[c+2];r.children=a}if(e&&e.defaultProps)for(s in o=e.defaultProps,o)r[s]===void 0&&(r[s]=o[s]);return B9(e,i,r)};as.createRef=function(){return{current:null}};as.forwardRef=function(e){return{$$typeof:Dle,render:e}};as.isValidElement=$9;as.lazy=function(e){return{$$typeof:mU,_payload:{_status:-1,_result:e},_init:Hle}};as.memo=function(e,t){return{$$typeof:Ple,type:e,compare:t===void 0?null:t}};as.startTransition=function(e){var t=Xr.T,n={};Xr.T=n;try{var s=e(),r=Xr.S;r!==null&&r(n,s),typeof s=="object"&&s!==null&&typeof s.then=="function"&&s.then(P8,jD)}catch(i){jD(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),Xr.T=t}};as.unstable_useCacheRefresh=function(){return Xr.H.useCacheRefresh()};as.use=function(e){return Xr.H.use(e)};as.useActionState=function(e,t,n){return Xr.H.useActionState(e,t,n)};as.useCallback=function(e,t){return Xr.H.useCallback(e,t)};as.useContext=function(e){return Xr.H.useContext(e)};as.useDebugValue=function(){};as.useDeferredValue=function(e,t){return Xr.H.useDeferredValue(e,t)};as.useEffect=function(e,t){return Xr.H.useEffect(e,t)};as.useEffectEvent=function(e){return Xr.H.useEffectEvent(e)};as.useId=function(){return Xr.H.useId()};as.useImperativeHandle=function(e,t,n){return Xr.H.useImperativeHandle(e,t,n)};as.useInsertionEffect=function(e,t){return Xr.H.useInsertionEffect(e,t)};as.useLayoutEffect=function(e,t){return Xr.H.useLayoutEffect(e,t)};as.useMemo=function(e,t){return Xr.H.useMemo(e,t)};as.useOptimistic=function(e,t){return Xr.H.useOptimistic(e,t)};as.useReducer=function(e,t,n){return Xr.H.useReducer(e,t,n)};as.useRef=function(e){return Xr.H.useRef(e)};as.useState=function(e){return Xr.H.useState(e)};as.useSyncExternalStore=function(e,t,n){return Xr.H.useSyncExternalStore(e,t,n)};as.useTransition=function(){return Xr.H.useTransition()};as.version="19.2.4";fU.exports=as;var f=fU.exports;const vU=C4(f),E4=Cle({__proto__:null,default:vU},[f]);var wU={exports:{}},A4={},kU={exports:{}},_U={};/**
 * @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(z,F){var B=z.length;z.push(F);e:for(;0<B;){var W=B-1>>>1,I=z[W];if(0<r(I,F))z[W]=F,z[B]=I,B=W;else break e}}function n(z){return z.length===0?null:z[0]}function s(z){if(z.length===0)return null;var F=z[0],B=z.pop();if(B!==F){z[0]=B;e:for(var W=0,I=z.length,Y=I>>>1;W<Y;){var V=2*(W+1)-1,j=z[V],ee=V+1,se=z[ee];if(0>r(j,B))ee<I&&0>r(se,j)?(z[W]=se,z[ee]=B,W=ee):(z[W]=j,z[V]=B,W=V);else if(ee<I&&0>r(se,B))z[W]=se,z[ee]=B,W=ee;else break e}}return F}function r(z,F){var B=z.sortIndex-F.sortIndex;return B!==0?B:z.id-F.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 c=[],u=[],d=1,h=null,m=3,p=!1,g=!1,b=!1,v=!1,x=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function k(z){for(var F=n(u);F!==null;){if(F.callback===null)s(u);else if(F.startTime<=z)s(u),F.sortIndex=F.expirationTime,t(c,F);else break;F=n(u)}}function T(z){if(b=!1,k(z),!g)if(n(c)!==null)g=!0,_||(_=!0,M());else{var F=n(u);F!==null&&O(T,F.startTime-z)}}var _=!1,C=-1,S=5,L=-1;function N(){return v?!0:!(e.unstable_now()-L<S)}function $(){if(v=!1,_){var z=e.unstable_now();L=z;var F=!0;try{e:{g=!1,b&&(b=!1,y(C),C=-1),p=!0;var B=m;try{t:{for(k(z),h=n(c);h!==null&&!(h.expirationTime>z&&N());){var W=h.callback;if(typeof W=="function"){h.callback=null,m=h.priorityLevel;var I=W(h.expirationTime<=z);if(z=e.unstable_now(),typeof I=="function"){h.callback=I,k(z),F=!0;break t}h===n(c)&&s(c),k(z)}else s(c);h=n(c)}if(h!==null)F=!0;else{var Y=n(u);Y!==null&&O(T,Y.startTime-z),F=!1}}break e}finally{h=null,m=B,p=!1}F=void 0}}finally{F?M():_=!1}}}var M;if(typeof w=="function")M=function(){w($)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,E=P.port2;P.port1.onmessage=$,M=function(){E.postMessage(null)}}else M=function(){x($,0)};function O(z,F){C=x(function(){z(e.unstable_now())},F)}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(z){z.callback=null},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):S=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(z){switch(m){case 1:case 2:case 3:var F=3;break;default:F=m}var B=m;m=F;try{return z()}finally{m=B}},e.unstable_requestPaint=function(){v=!0},e.unstable_runWithPriority=function(z,F){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var B=m;m=z;try{return F()}finally{m=B}},e.unstable_scheduleCallback=function(z,F,B){var W=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?W+B:W):B=W,z){case 1:var I=-1;break;case 2:I=250;break;case 5:I=1073741823;break;case 4:I=1e4;break;default:I=5e3}return I=B+I,z={id:d++,callback:F,priorityLevel:z,startTime:B,expirationTime:I,sortIndex:-1},B>W?(z.sortIndex=B,t(u,z),n(c)===null&&z===n(u)&&(b?(y(C),C=-1):b=!0,O(T,B-W))):(z.sortIndex=I,t(c,z),g||p||(g=!0,_||(_=!0,M()))),z},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(z){var F=m;return function(){var B=m;m=F;try{return z.apply(this,arguments)}finally{m=B}}}})(_U);kU.exports=_U;var Ule=kU.exports,SU={exports:{}},Ma={};/**
 * @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 Vle=f;function CU(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 Ah(){}var Ea={d:{f:Ah,r:function(){throw Error(CU(522))},D:Ah,C:Ah,L:Ah,m:Ah,X:Ah,S:Ah,M:Ah},p:0,findDOMNode:null},Wle=Symbol.for("react.portal");function Gle(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Wle,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}var My=Vle.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function N4(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Ma.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ea;Ma.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(CU(299));return Gle(e,t,null,n)};Ma.flushSync=function(e){var t=My.T,n=Ea.p;try{if(My.T=null,Ea.p=2,e)return e()}finally{My.T=t,Ea.p=n,Ea.d.f()}};Ma.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Ea.d.C(e,t))};Ma.prefetchDNS=function(e){typeof e=="string"&&Ea.d.D(e)};Ma.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,s=N4(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Ea.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:s,integrity:r,fetchPriority:i}):n==="script"&&Ea.d.X(e,{crossOrigin:s,integrity:r,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Ma.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=N4(t.as,t.crossOrigin);Ea.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&&Ea.d.M(e)};Ma.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,s=N4(n,t.crossOrigin);Ea.d.L(e,n,{crossOrigin:s,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};Ma.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=N4(t.as,t.crossOrigin);Ea.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 Ea.d.m(e)};Ma.requestFormReset=function(e){Ea.d.r(e)};Ma.unstable_batchedUpdates=function(e,t){return e(t)};Ma.useFormState=function(e,t,n){return My.H.useFormState(e,t,n)};Ma.useFormStatus=function(){return My.H.useHostTransitionStatus()};Ma.version="19.2.4";function TU(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(TU)}catch(e){console.error(e)}}TU(),SU.exports=Ma;var $u=SU.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 io=Ule,EU=f,Kle=$u;function et(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 AU(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function bv(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 NU(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 jU(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 MD(e){if(bv(e)!==e)throw Error(et(188))}function Yle(e){var t=e.alternate;if(!t){if(t=bv(e),t===null)throw Error(et(188));return t!==e?null:e}for(var n=e,s=t;;){var r=n.return;if(r===null)break;var i=r.alternate;if(i===null){if(s=r.return,s!==null){n=s;continue}break}if(r.child===i.child){for(i=r.child;i;){if(i===n)return MD(r),e;if(i===s)return MD(r),t;i=i.sibling}throw Error(et(188))}if(n.return!==s.return)n=r,s=i;else{for(var o=!1,a=r.child;a;){if(a===n){o=!0,n=r,s=i;break}if(a===s){o=!0,s=r,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,s=r;break}if(a===s){o=!0,s=i,n=r;break}a=a.sibling}if(!o)throw Error(et(189))}}if(n.alternate!==s)throw Error(et(190))}if(n.tag!==3)throw Error(et(188));return n.stateNode.current===n?e:t}function MU(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=MU(e),t!==null)return t;e=e.sibling}return null}var Qr=Object.assign,Xle=Symbol.for("react.element"),$w=Symbol.for("react.transitional.element"),dy=Symbol.for("react.portal"),eg=Symbol.for("react.fragment"),IU=Symbol.for("react.strict_mode"),O8=Symbol.for("react.profiler"),RU=Symbol.for("react.consumer"),_d=Symbol.for("react.context"),z9=Symbol.for("react.forward_ref"),B8=Symbol.for("react.suspense"),$8=Symbol.for("react.suspense_list"),F9=Symbol.for("react.memo"),zh=Symbol.for("react.lazy"),z8=Symbol.for("react.activity"),Qle=Symbol.for("react.memo_cache_sentinel"),ID=Symbol.iterator;function Lb(e){return e===null||typeof e!="object"?null:(e=ID&&e[ID]||e["@@iterator"],typeof e=="function"?e:null)}var Jle=Symbol.for("react.client.reference");function F8(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Jle?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case eg:return"Fragment";case O8:return"Profiler";case IU:return"StrictMode";case B8:return"Suspense";case $8:return"SuspenseList";case z8:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case dy:return"Portal";case _d:return e.displayName||"Context";case RU:return(e._context.displayName||"Context")+".Consumer";case z9:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case F9:return t=e.displayName||null,t!==null?t:F8(e.type)||"Memo";case zh:t=e._payload,e=e._init;try{return F8(e(t))}catch{}}return null}var hy=Array.isArray,Xn=EU.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,mr=Kle.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,gp={pending:!1,data:null,method:null,action:null},H8=[],tg=-1;function zu(e){return{current:e}}function So(e){0>tg||(e.current=H8[tg],H8[tg]=null,tg--)}function Ur(e,t){tg++,H8[tg]=e.current,e.current=t}var Iu=zu(null),hx=zu(null),pf=zu(null),v2=zu(null);function w2(e,t){switch(Ur(pf,t),Ur(hx,e),Ur(Iu,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?BL(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=BL(t),e=ZW(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}So(Iu),Ur(Iu,e)}function Wg(){So(Iu),So(hx),So(pf)}function q8(e){e.memoizedState!==null&&Ur(v2,e);var t=Iu.current,n=ZW(t,e.type);t!==n&&(Ur(hx,e),Ur(Iu,n))}function k2(e){hx.current===e&&(So(Iu),So(hx)),v2.current===e&&(So(v2),_x._currentValue=gp)}var pT,RD;function Wm(e){if(pT===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);pT=t&&t[1]||"",RD=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+pT+e+RD}var gT=!1;function bT(e,t){if(!e||gT)return"";gT=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var h=function(){throw Error()};if(Object.defineProperty(h.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(h,[])}catch(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]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=s.DetermineComponentFrameRoot(),o=i[0],a=i[1];if(o&&a){var c=o.split(`
`),u=a.split(`
`);for(r=s=0;s<c.length&&!c[s].includes("DetermineComponentFrameRoot");)s++;for(;r<u.length&&!u[r].includes("DetermineComponentFrameRoot");)r++;if(s===c.length||r===u.length)for(s=c.length-1,r=u.length-1;1<=s&&0<=r&&c[s]!==u[r];)r--;for(;1<=s&&0<=r;s--,r--)if(c[s]!==u[r]){if(s!==1||r!==1)do if(s--,r--,0>r||c[s]!==u[r]){var d=`
`+c[s].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),d}while(1<=s&&0<=r);break}}}finally{gT=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Wm(n):""}function Zle(e,t){switch(e.tag){case 26:case 27:case 5:return Wm(e.type);case 16:return Wm("Lazy");case 13:return e.child!==t&&t!==null?Wm("Suspense Fallback"):Wm("Suspense");case 19:return Wm("SuspenseList");case 0:case 15:return bT(e.type,!1);case 11:return bT(e.type.render,!1);case 1:return bT(e.type,!0);case 31:return Wm("Activity");default:return""}}function DD(e){try{var t="",n=null;do t+=Zle(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
Error generating stack: `+s.message+`
`+s.stack}}var U8=Object.prototype.hasOwnProperty,H9=io.unstable_scheduleCallback,yT=io.unstable_cancelCallback,ece=io.unstable_shouldYield,tce=io.unstable_requestPaint,_l=io.unstable_now,nce=io.unstable_getCurrentPriorityLevel,DU=io.unstable_ImmediatePriority,LU=io.unstable_UserBlockingPriority,_2=io.unstable_NormalPriority,sce=io.unstable_LowPriority,PU=io.unstable_IdlePriority,rce=io.log,ice=io.unstable_setDisableYieldValue,yv=null,Sl=null;function Jh(e){if(typeof rce=="function"&&ice(e),Sl&&typeof Sl.setStrictMode=="function")try{Sl.setStrictMode(yv,e)}catch{}}var Cl=Math.clz32?Math.clz32:lce,oce=Math.log,ace=Math.LN2;function lce(e){return e>>>=0,e===0?32:31-(oce(e)/ace|0)|0}var zw=256,Fw=262144,Hw=4194304;function Gm(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 j4(e,t,n){var s=e.pendingLanes;if(s===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var a=s&134217727;return a!==0?(s=a&~i,s!==0?r=Gm(s):(o&=a,o!==0?r=Gm(o):n||(n=a&~e,n!==0&&(r=Gm(n))))):(a=s&~i,a!==0?r=Gm(a):o!==0?r=Gm(o):n||(n=s&~e,n!==0&&(r=Gm(n)))),r===0?0:t!==0&&t!==r&&!(t&i)&&(i=r&-r,n=t&-t,i>=n||i===32&&(n&4194048)!==0)?t:r}function xv(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function cce(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 OU(){var e=Hw;return Hw<<=1,!(Hw&62914560)&&(Hw=4194304),e}function xT(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function vv(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function uce(e,t,n,s,r,i){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var a=e.entanglements,c=e.expirationTimes,u=e.hiddenUpdates;for(n=o&~n;0<n;){var d=31-Cl(n),h=1<<d;a[d]=0,c[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}s!==0&&BU(e,s,0),i!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=i&~(o&~t))}function BU(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-Cl(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function $U(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Cl(n),r=1<<s;r&t|e[s]&t&&(e[s]|=t),n&=~r}}function zU(e,t){var n=t&-t;return n=n&42?1:q9(n),n&(e.suspendedLanes|t)?0:n}function q9(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 U9(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function FU(){var e=mr.p;return e!==0?e:(e=window.event,e===void 0?32:uG(e.type))}function LD(e,t){var n=mr.p;try{return mr.p=e,t()}finally{mr.p=n}}var nm=Math.random().toString(36).slice(2),Lo="__reactFiber$"+nm,sl="__reactProps$"+nm,M1="__reactContainer$"+nm,V8="__reactEvents$"+nm,dce="__reactListeners$"+nm,hce="__reactHandles$"+nm,PD="__reactResources$"+nm,wv="__reactMarker$"+nm;function V9(e){delete e[Lo],delete e[sl],delete e[V8],delete e[dce],delete e[hce]}function ng(e){var t=e[Lo];if(t)return t;for(var n=e.parentNode;n;){if(t=n[M1]||n[Lo]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=qL(e);e!==null;){if(n=e[Lo])return n;e=qL(e)}return t}e=n,n=e.parentNode}return null}function I1(e){if(e=e[Lo]||e[M1]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function fy(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(et(33))}function wg(e){var t=e[PD];return t||(t=e[PD]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function wo(e){e[wv]=!0}var HU=new Set,qU={};function Yp(e,t){Gg(e,t),Gg(e+"Capture",t)}function Gg(e,t){for(qU[e]=t,e=0;e<t.length;e++)HU.add(t[e])}var fce=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]*$"),OD={},BD={};function mce(e){return U8.call(BD,e)?!0:U8.call(OD,e)?!1:fce.test(e)?BD[e]=!0:(OD[e]=!0,!1)}function k_(e,t,n){if(mce(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function qw(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 ad(e,t,n,s){if(s===null)e.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+s)}}function Zl(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function UU(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function pce(e,t,n){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var r=s.get,i=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(o){n=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function W8(e){if(!e._valueTracker){var t=UU(e)?"checked":"value";e._valueTracker=pce(e,t,""+e[t])}}function VU(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=UU(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function S2(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 gce=/[\n"\\]/g;function ac(e){return e.replace(gce,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function G8(e,t,n,s,r,i,o,a){e.name="",o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.type=o:e.removeAttribute("type"),t!=null?o==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Zl(t)):e.value!==""+Zl(t)&&(e.value=""+Zl(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?K8(e,o,Zl(t)):n!=null?K8(e,o,Zl(n)):s!=null&&e.removeAttribute("value"),r==null&&i!=null&&(e.defaultChecked=!!i),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.name=""+Zl(a):e.removeAttribute("name")}function WU(e,t,n,s,r,i,o,a){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||n!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){W8(e);return}n=n!=null?""+Zl(n):"",t=t!=null?""+Zl(t):n,a||t===e.value||(e.value=t),e.defaultValue=t}s=s??r,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=a?e.checked:!!s,e.defaultChecked=!!s,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.name=o),W8(e)}function K8(e,t,n){t==="number"&&S2(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function kg(e,t,n,s){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&s&&(e[n].defaultSelected=!0)}else{for(n=""+Zl(n),t=null,r=0;r<e.length;r++){if(e[r].value===n){e[r].selected=!0,s&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function GU(e,t,n){if(t!=null&&(t=""+Zl(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Zl(n):""}function KU(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(et(92));if(hy(s)){if(1<s.length)throw Error(et(93));s=s[0]}n=s}n==null&&(n=""),t=n}n=Zl(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),W8(e)}function Kg(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var bce=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 $D(e,t,n){var s=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,n):typeof n!="number"||n===0||bce.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function YU(e,t,n){if(t!=null&&typeof t!="object")throw Error(et(62));if(e=e.style,n!=null){for(var s in n)!n.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var r in t)s=t[r],t.hasOwnProperty(r)&&n[r]!==s&&$D(e,r,s)}else for(var i in t)t.hasOwnProperty(i)&&$D(e,i,t[i])}function W9(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 yce=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"]]),xce=/^[\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 __(e){return xce.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Sd(){}var Y8=null;function G9(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var sg=null,_g=null;function zD(e){var t=I1(e);if(t&&(e=t.stateNode)){var n=e[sl]||null;e:switch(e=t.stateNode,t.type){case"input":if(G8(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="'+ac(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var r=s[sl]||null;if(!r)throw Error(et(90));G8(s,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<n.length;t++)s=n[t],s.form===e.form&&VU(s)}break e;case"textarea":GU(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&kg(e,!!n.multiple,t,!1)}}}var vT=!1;function XU(e,t,n){if(vT)return e(t,n);vT=!0;try{var s=e(t);return s}finally{if(vT=!1,(sg!==null||_g!==null)&&(H4(),sg&&(t=sg,e=_g,_g=sg=null,zD(t),e)))for(t=0;t<e.length;t++)zD(e[t])}}function fx(e,t){var n=e.stateNode;if(n===null)return null;var s=n[sl]||null;if(s===null)return null;n=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(et(231,t,typeof n));return n}var Wd=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),X8=!1;if(Wd)try{var Pb={};Object.defineProperty(Pb,"passive",{get:function(){X8=!0}}),window.addEventListener("test",Pb,Pb),window.removeEventListener("test",Pb,Pb)}catch{X8=!1}var Zh=null,K9=null,S_=null;function QU(){if(S_)return S_;var e,t=K9,n=t.length,s,r="value"in Zh?Zh.value:Zh.textContent,i=r.length;for(e=0;e<n&&t[e]===r[e];e++);var o=n-e;for(s=1;s<=o&&t[n-s]===r[i-s];s++);return S_=r.slice(e,1<s?1-s:void 0)}function C_(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 Uw(){return!0}function FD(){return!1}function il(e){function t(n,s,r,i,o){this._reactName=n,this._targetInst=r,this.type=s,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Uw:FD,this.isPropagationStopped=FD,this}return Qr(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=Uw)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Uw)},persist:function(){},isPersistent:Uw}),t}var Xp={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},M4=il(Xp),kv=Qr({},Xp,{view:0,detail:0}),vce=il(kv),wT,kT,Ob,I4=Qr({},kv,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Y9,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!==Ob&&(Ob&&e.type==="mousemove"?(wT=e.screenX-Ob.screenX,kT=e.screenY-Ob.screenY):kT=wT=0,Ob=e),wT)},movementY:function(e){return"movementY"in e?e.movementY:kT}}),HD=il(I4),wce=Qr({},I4,{dataTransfer:0}),kce=il(wce),_ce=Qr({},kv,{relatedTarget:0}),_T=il(_ce),Sce=Qr({},Xp,{animationName:0,elapsedTime:0,pseudoElement:0}),Cce=il(Sce),Tce=Qr({},Xp,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ece=il(Tce),Ace=Qr({},Xp,{data:0}),qD=il(Ace),Nce={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},jce={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"},Mce={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ice(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Mce[e])?!!t[e]:!1}function Y9(){return Ice}var Rce=Qr({},kv,{key:function(e){if(e.key){var t=Nce[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=C_(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?jce[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Y9,charCode:function(e){return e.type==="keypress"?C_(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?C_(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Dce=il(Rce),Lce=Qr({},I4,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),UD=il(Lce),Pce=Qr({},kv,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Y9}),Oce=il(Pce),Bce=Qr({},Xp,{propertyName:0,elapsedTime:0,pseudoElement:0}),$ce=il(Bce),zce=Qr({},I4,{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}),Fce=il(zce),Hce=Qr({},Xp,{newState:0,oldState:0}),qce=il(Hce),Uce=[9,13,27,32],X9=Wd&&"CompositionEvent"in window,Iy=null;Wd&&"documentMode"in document&&(Iy=document.documentMode);var Vce=Wd&&"TextEvent"in window&&!Iy,JU=Wd&&(!X9||Iy&&8<Iy&&11>=Iy),VD=" ",WD=!1;function ZU(e,t){switch(e){case"keyup":return Uce.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function eV(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var rg=!1;function Wce(e,t){switch(e){case"compositionend":return eV(t);case"keypress":return t.which!==32?null:(WD=!0,VD);case"textInput":return e=t.data,e===VD&&WD?null:e;default:return null}}function Gce(e,t){if(rg)return e==="compositionend"||!X9&&ZU(e,t)?(e=QU(),S_=K9=Zh=null,rg=!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 JU&&t.locale!=="ko"?null:t.data;default:return null}}var Kce={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 GD(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Kce[e.type]:t==="textarea"}function tV(e,t,n,s){sg?_g?_g.push(s):_g=[s]:sg=s,t=H2(t,"onChange"),0<t.length&&(n=new M4("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var Ry=null,mx=null;function Yce(e){XW(e,0)}function R4(e){var t=fy(e);if(VU(t))return e}function KD(e,t){if(e==="change")return t}var nV=!1;if(Wd){var ST;if(Wd){var CT="oninput"in document;if(!CT){var YD=document.createElement("div");YD.setAttribute("oninput","return;"),CT=typeof YD.oninput=="function"}ST=CT}else ST=!1;nV=ST&&(!document.documentMode||9<document.documentMode)}function XD(){Ry&&(Ry.detachEvent("onpropertychange",sV),mx=Ry=null)}function sV(e){if(e.propertyName==="value"&&R4(mx)){var t=[];tV(t,mx,e,G9(e)),XU(Yce,t)}}function Xce(e,t,n){e==="focusin"?(XD(),Ry=t,mx=n,Ry.attachEvent("onpropertychange",sV)):e==="focusout"&&XD()}function Qce(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return R4(mx)}function Jce(e,t){if(e==="click")return R4(t)}function Zce(e,t){if(e==="input"||e==="change")return R4(t)}function eue(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var jl=typeof Object.is=="function"?Object.is:eue;function px(e,t){if(jl(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var r=n[s];if(!U8.call(t,r)||!jl(e[r],t[r]))return!1}return!0}function QD(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function JD(e,t){var n=QD(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=QD(n)}}function rV(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?rV(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function iV(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=S2(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=S2(e.document)}return t}function Q9(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 tue=Wd&&"documentMode"in document&&11>=document.documentMode,ig=null,Q8=null,Dy=null,J8=!1;function ZD(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;J8||ig==null||ig!==S2(s)||(s=ig,"selectionStart"in s&&Q9(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Dy&&px(Dy,s)||(Dy=s,s=H2(Q8,"onSelect"),0<s.length&&(t=new M4("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=ig)))}function Dm(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var og={animationend:Dm("Animation","AnimationEnd"),animationiteration:Dm("Animation","AnimationIteration"),animationstart:Dm("Animation","AnimationStart"),transitionrun:Dm("Transition","TransitionRun"),transitionstart:Dm("Transition","TransitionStart"),transitioncancel:Dm("Transition","TransitionCancel"),transitionend:Dm("Transition","TransitionEnd")},TT={},oV={};Wd&&(oV=document.createElement("div").style,"AnimationEvent"in window||(delete og.animationend.animation,delete og.animationiteration.animation,delete og.animationstart.animation),"TransitionEvent"in window||delete og.transitionend.transition);function Qp(e){if(TT[e])return TT[e];if(!og[e])return e;var t=og[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in oV)return TT[e]=t[n];return e}var aV=Qp("animationend"),lV=Qp("animationiteration"),cV=Qp("animationstart"),nue=Qp("transitionrun"),sue=Qp("transitionstart"),rue=Qp("transitioncancel"),uV=Qp("transitionend"),dV=new Map,Z8="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(" ");Z8.push("scrollEnd");function Bc(e,t){dV.set(e,t),Yp(t,[e])}var C2=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)},Xl=[],ag=0,J9=0;function D4(){for(var e=ag,t=J9=ag=0;t<e;){var n=Xl[t];Xl[t++]=null;var s=Xl[t];Xl[t++]=null;var r=Xl[t];Xl[t++]=null;var i=Xl[t];if(Xl[t++]=null,s!==null&&r!==null){var o=s.pending;o===null?r.next=r:(r.next=o.next,o.next=r),s.pending=r}i!==0&&hV(n,r,i)}}function L4(e,t,n,s){Xl[ag++]=e,Xl[ag++]=t,Xl[ag++]=n,Xl[ag++]=s,J9|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Z9(e,t,n,s){return L4(e,t,n,s),T2(e)}function Jp(e,t){return L4(e,null,null,t),T2(e)}function hV(e,t,n){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n);for(var r=!1,i=e.return;i!==null;)i.childLanes|=n,s=i.alternate,s!==null&&(s.childLanes|=n),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(r=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,r&&t!==null&&(r=31-Cl(n),e=i.hiddenUpdates,s=e[r],s===null?e[r]=[t]:s.push(t),t.lane=n|536870912),i):null}function T2(e){if(50<qy)throw qy=0,v7=null,Error(et(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var lg={};function iue(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xl(e,t,n,s){return new iue(e,t,n,s)}function eN(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Md(e,t){var n=e.alternate;return n===null?(n=xl(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 fV(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 T_(e,t,n,s,r,i){var o=0;if(s=e,typeof e=="function")eN(e)&&(o=1);else if(typeof e=="string")o=ude(e,n,Iu.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case z8:return e=xl(31,n,t,r),e.elementType=z8,e.lanes=i,e;case eg:return bp(n.children,r,i,t);case IU:o=8,r|=24;break;case O8:return e=xl(12,n,t,r|2),e.elementType=O8,e.lanes=i,e;case B8:return e=xl(13,n,t,r),e.elementType=B8,e.lanes=i,e;case $8:return e=xl(19,n,t,r),e.elementType=$8,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case _d:o=10;break e;case RU:o=9;break e;case z9:o=11;break e;case F9:o=14;break e;case zh:o=16,s=null;break e}o=29,n=Error(et(130,e===null?"null":typeof e,"")),s=null}return t=xl(o,n,t,r),t.elementType=e,t.type=s,t.lanes=i,t}function bp(e,t,n,s){return e=xl(7,e,s,t),e.lanes=n,e}function ET(e,t,n){return e=xl(6,e,null,t),e.lanes=n,e}function mV(e){var t=xl(18,null,null,0);return t.stateNode=e,t}function AT(e,t,n){return t=xl(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var eL=new WeakMap;function lc(e,t){if(typeof e=="object"&&e!==null){var n=eL.get(e);return n!==void 0?n:(t={value:e,source:t,stack:DD(t)},eL.set(e,t),t)}return{value:e,source:t,stack:DD(t)}}var cg=[],ug=0,E2=null,gx=0,ec=[],tc=0,Nf=null,_u=1,Su="";function bd(e,t){cg[ug++]=gx,cg[ug++]=E2,E2=e,gx=t}function pV(e,t,n){ec[tc++]=_u,ec[tc++]=Su,ec[tc++]=Nf,Nf=e;var s=_u;e=Su;var r=32-Cl(s)-1;s&=~(1<<r),n+=1;var i=32-Cl(t)+r;if(30<i){var o=r-r%5;i=(s&(1<<o)-1).toString(32),s>>=o,r-=o,_u=1<<32-Cl(t)+r|n<<r|s,Su=i+e}else _u=1<<i|n<<r|s,Su=e}function tN(e){e.return!==null&&(bd(e,1),pV(e,1,0))}function nN(e){for(;e===E2;)E2=cg[--ug],cg[ug]=null,gx=cg[--ug],cg[ug]=null;for(;e===Nf;)Nf=ec[--tc],ec[tc]=null,Su=ec[--tc],ec[tc]=null,_u=ec[--tc],ec[tc]=null}function gV(e,t){ec[tc++]=_u,ec[tc++]=Su,ec[tc++]=Nf,_u=t.id,Su=t.overflow,Nf=e}var Po=null,Yr=null,Ys=!1,gf=null,cc=!1,e7=Error(et(519));function jf(e){var t=Error(et(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw bx(lc(t,e)),e7}function tL(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[Lo]=e,t[sl]=s,n){case"dialog":Ms("cancel",t),Ms("close",t);break;case"iframe":case"object":case"embed":Ms("load",t);break;case"video":case"audio":for(n=0;n<wx.length;n++)Ms(wx[n],t);break;case"source":Ms("error",t);break;case"img":case"image":case"link":Ms("error",t),Ms("load",t);break;case"details":Ms("toggle",t);break;case"input":Ms("invalid",t),WU(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Ms("invalid",t);break;case"textarea":Ms("invalid",t),KU(t,s.value,s.defaultValue,s.children)}n=s.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||s.suppressHydrationWarning===!0||JW(t.textContent,n)?(s.popover!=null&&(Ms("beforetoggle",t),Ms("toggle",t)),s.onScroll!=null&&Ms("scroll",t),s.onScrollEnd!=null&&Ms("scrollend",t),s.onClick!=null&&(t.onclick=Sd),t=!0):t=!1,t||jf(e,!0)}function nL(e){for(Po=e.return;Po;)switch(Po.tag){case 5:case 31:case 13:cc=!1;return;case 27:case 3:cc=!0;return;default:Po=Po.return}}function S0(e){if(e!==Po)return!1;if(!Ys)return nL(e),Ys=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||C7(e.type,e.memoizedProps)),n=!n),n&&Yr&&jf(e),nL(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(et(317));Yr=HL(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(et(317));Yr=HL(e)}else t===27?(t=Yr,sm(e.type)?(e=N7,N7=null,Yr=e):Yr=t):Yr=Po?pc(e.stateNode.nextSibling):null;return!0}function Ap(){Yr=Po=null,Ys=!1}function NT(){var e=gf;return e!==null&&(Ua===null?Ua=e:Ua.push.apply(Ua,e),gf=null),e}function bx(e){gf===null?gf=[e]:gf.push(e)}var t7=zu(null),Zp=null,Cd=null;function Wh(e,t,n){Ur(t7,t._currentValue),t._currentValue=n}function Id(e){e._currentValue=t7.current,So(t7)}function n7(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function s7(e,t,n,s){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var i=r.dependencies;if(i!==null){var o=r.child;i=i.firstContext;e:for(;i!==null;){var a=i;i=r;for(var c=0;c<t.length;c++)if(a.context===t[c]){i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),n7(i.return,n,e),s||(o=null);break e}i=a.next}}else if(r.tag===18){if(o=r.return,o===null)throw Error(et(341));o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),n7(o,n,e),o=null}else o=r.child;if(o!==null)o.return=r;else for(o=r;o!==null;){if(o===e){o=null;break}if(r=o.sibling,r!==null){r.return=o.return,o=r;break}o=o.return}r=o}}function R1(e,t,n,s){e=null;for(var r=t,i=!1;r!==null;){if(!i){if(r.flags&524288)i=!0;else if(r.flags&262144)break}if(r.tag===10){var o=r.alternate;if(o===null)throw Error(et(387));if(o=o.memoizedProps,o!==null){var a=r.type;jl(r.pendingProps.value,o.value)||(e!==null?e.push(a):e=[a])}}else if(r===v2.current){if(o=r.alternate,o===null)throw Error(et(387));o.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(_x):e=[_x])}r=r.return}e!==null&&s7(t,e,n,s),t.flags|=262144}function A2(e){for(e=e.firstContext;e!==null;){if(!jl(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Np(e){Zp=e,Cd=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Oo(e){return bV(Zp,e)}function Vw(e,t){return Zp===null&&Np(e),bV(e,t)}function bV(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Cd===null){if(e===null)throw Error(et(308));Cd=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Cd=Cd.next=t;return n}var oue=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},aue=io.unstable_scheduleCallback,lue=io.unstable_NormalPriority,zi={$$typeof:_d,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function sN(){return{controller:new oue,data:new Map,refCount:0}}function _v(e){e.refCount--,e.refCount===0&&aue(lue,function(){e.controller.abort()})}var Ly=null,r7=0,Yg=0,Sg=null;function cue(e,t){if(Ly===null){var n=Ly=[];r7=0,Yg=AN(),Sg={status:"pending",value:void 0,then:function(s){n.push(s)}}}return r7++,t.then(sL,sL),t}function sL(){if(--r7===0&&Ly!==null){Sg!==null&&(Sg.status="fulfilled");var e=Ly;Ly=null,Yg=0,Sg=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function uue(e,t){var n=[],s={status:"pending",value:null,reason:null,then:function(r){n.push(r)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var r=0;r<n.length;r++)(0,n[r])(t)},function(r){for(s.status="rejected",s.reason=r,r=0;r<n.length;r++)(0,n[r])(void 0)}),s}var rL=Xn.S;Xn.S=function(e,t){MW=_l(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&cue(e,t),rL!==null&&rL(e,t)};var yp=zu(null);function rN(){var e=yp.current;return e!==null?e:Dr.pooledCache}function E_(e,t){t===null?Ur(yp,yp.current):Ur(yp,t.pool)}function yV(){var e=rN();return e===null?null:{parent:zi._currentValue,pool:e}}var D1=Error(et(460)),iN=Error(et(474)),P4=Error(et(542)),N2={then:function(){}};function iL(e){return e=e.status,e==="fulfilled"||e==="rejected"}function xV(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Sd,Sd),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,aL(e),e;default:if(typeof t.status=="string")t.then(Sd,Sd);else{if(e=Dr,e!==null&&100<e.shellSuspendCounter)throw Error(et(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=s}},function(s){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,aL(e),e}throw xp=t,D1}}function Km(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(xp=n,D1):n}}var xp=null;function oL(){if(xp===null)throw Error(et(459));var e=xp;return xp=null,e}function aL(e){if(e===D1||e===P4)throw Error(et(483))}var Cg=null,yx=0;function Ww(e){var t=yx;return yx+=1,Cg===null&&(Cg=[]),xV(Cg,e,t)}function Bb(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Gw(e,t){throw t.$$typeof===Xle?Error(et(525)):(e=Object.prototype.toString.call(t),Error(et(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function vV(e){function t(x,y){if(e){var w=x.deletions;w===null?(x.deletions=[y],x.flags|=16):w.push(y)}}function n(x,y){if(!e)return null;for(;y!==null;)t(x,y),y=y.sibling;return null}function s(x){for(var y=new Map;x!==null;)x.key!==null?y.set(x.key,x):y.set(x.index,x),x=x.sibling;return y}function r(x,y){return x=Md(x,y),x.index=0,x.sibling=null,x}function i(x,y,w){return x.index=w,e?(w=x.alternate,w!==null?(w=w.index,w<y?(x.flags|=67108866,y):w):(x.flags|=67108866,y)):(x.flags|=1048576,y)}function o(x){return e&&x.alternate===null&&(x.flags|=67108866),x}function a(x,y,w,k){return y===null||y.tag!==6?(y=ET(w,x.mode,k),y.return=x,y):(y=r(y,w),y.return=x,y)}function c(x,y,w,k){var T=w.type;return T===eg?d(x,y,w.props.children,k,w.key):y!==null&&(y.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===zh&&Km(T)===y.type)?(y=r(y,w.props),Bb(y,w),y.return=x,y):(y=T_(w.type,w.key,w.props,null,x.mode,k),Bb(y,w),y.return=x,y)}function u(x,y,w,k){return y===null||y.tag!==4||y.stateNode.containerInfo!==w.containerInfo||y.stateNode.implementation!==w.implementation?(y=AT(w,x.mode,k),y.return=x,y):(y=r(y,w.children||[]),y.return=x,y)}function d(x,y,w,k,T){return y===null||y.tag!==7?(y=bp(w,x.mode,k,T),y.return=x,y):(y=r(y,w),y.return=x,y)}function h(x,y,w){if(typeof y=="string"&&y!==""||typeof y=="number"||typeof y=="bigint")return y=ET(""+y,x.mode,w),y.return=x,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case $w:return w=T_(y.type,y.key,y.props,null,x.mode,w),Bb(w,y),w.return=x,w;case dy:return y=AT(y,x.mode,w),y.return=x,y;case zh:return y=Km(y),h(x,y,w)}if(hy(y)||Lb(y))return y=bp(y,x.mode,w,null),y.return=x,y;if(typeof y.then=="function")return h(x,Ww(y),w);if(y.$$typeof===_d)return h(x,Vw(x,y),w);Gw(x,y)}return null}function m(x,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(x,y,""+w,k);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case $w:return w.key===T?c(x,y,w,k):null;case dy:return w.key===T?u(x,y,w,k):null;case zh:return w=Km(w),m(x,y,w,k)}if(hy(w)||Lb(w))return T!==null?null:d(x,y,w,k,null);if(typeof w.then=="function")return m(x,y,Ww(w),k);if(w.$$typeof===_d)return m(x,y,Vw(x,w),k);Gw(x,w)}return null}function p(x,y,w,k,T){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return x=x.get(w)||null,a(y,x,""+k,T);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case $w:return x=x.get(k.key===null?w:k.key)||null,c(y,x,k,T);case dy:return x=x.get(k.key===null?w:k.key)||null,u(y,x,k,T);case zh:return k=Km(k),p(x,y,w,k,T)}if(hy(k)||Lb(k))return x=x.get(w)||null,d(y,x,k,T,null);if(typeof k.then=="function")return p(x,y,w,Ww(k),T);if(k.$$typeof===_d)return p(x,y,w,Vw(y,k),T);Gw(y,k)}return null}function g(x,y,w,k){for(var T=null,_=null,C=y,S=y=0,L=null;C!==null&&S<w.length;S++){C.index>S?(L=C,C=null):L=C.sibling;var N=m(x,C,w[S],k);if(N===null){C===null&&(C=L);break}e&&C&&N.alternate===null&&t(x,C),y=i(N,y,S),_===null?T=N:_.sibling=N,_=N,C=L}if(S===w.length)return n(x,C),Ys&&bd(x,S),T;if(C===null){for(;S<w.length;S++)C=h(x,w[S],k),C!==null&&(y=i(C,y,S),_===null?T=C:_.sibling=C,_=C);return Ys&&bd(x,S),T}for(C=s(C);S<w.length;S++)L=p(C,x,S,w[S],k),L!==null&&(e&&L.alternate!==null&&C.delete(L.key===null?S:L.key),y=i(L,y,S),_===null?T=L:_.sibling=L,_=L);return e&&C.forEach(function($){return t(x,$)}),Ys&&bd(x,S),T}function b(x,y,w,k){if(w==null)throw Error(et(151));for(var T=null,_=null,C=y,S=y=0,L=null,N=w.next();C!==null&&!N.done;S++,N=w.next()){C.index>S?(L=C,C=null):L=C.sibling;var $=m(x,C,N.value,k);if($===null){C===null&&(C=L);break}e&&C&&$.alternate===null&&t(x,C),y=i($,y,S),_===null?T=$:_.sibling=$,_=$,C=L}if(N.done)return n(x,C),Ys&&bd(x,S),T;if(C===null){for(;!N.done;S++,N=w.next())N=h(x,N.value,k),N!==null&&(y=i(N,y,S),_===null?T=N:_.sibling=N,_=N);return Ys&&bd(x,S),T}for(C=s(C);!N.done;S++,N=w.next())N=p(C,x,S,N.value,k),N!==null&&(e&&N.alternate!==null&&C.delete(N.key===null?S:N.key),y=i(N,y,S),_===null?T=N:_.sibling=N,_=N);return e&&C.forEach(function(M){return t(x,M)}),Ys&&bd(x,S),T}function v(x,y,w,k){if(typeof w=="object"&&w!==null&&w.type===eg&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case $w:e:{for(var T=w.key;y!==null;){if(y.key===T){if(T=w.type,T===eg){if(y.tag===7){n(x,y.sibling),k=r(y,w.props.children),k.return=x,x=k;break e}}else if(y.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===zh&&Km(T)===y.type){n(x,y.sibling),k=r(y,w.props),Bb(k,w),k.return=x,x=k;break e}n(x,y);break}else t(x,y);y=y.sibling}w.type===eg?(k=bp(w.props.children,x.mode,k,w.key),k.return=x,x=k):(k=T_(w.type,w.key,w.props,null,x.mode,k),Bb(k,w),k.return=x,x=k)}return o(x);case dy: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(x,y.sibling),k=r(y,w.children||[]),k.return=x,x=k;break e}else{n(x,y);break}else t(x,y);y=y.sibling}k=AT(w,x.mode,k),k.return=x,x=k}return o(x);case zh:return w=Km(w),v(x,y,w,k)}if(hy(w))return g(x,y,w,k);if(Lb(w)){if(T=Lb(w),typeof T!="function")throw Error(et(150));return w=T.call(w),b(x,y,w,k)}if(typeof w.then=="function")return v(x,y,Ww(w),k);if(w.$$typeof===_d)return v(x,y,Vw(x,w),k);Gw(x,w)}return typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint"?(w=""+w,y!==null&&y.tag===6?(n(x,y.sibling),k=r(y,w),k.return=x,x=k):(n(x,y),k=ET(w,x.mode,k),k.return=x,x=k),o(x)):n(x,y)}return function(x,y,w,k){try{yx=0;var T=v(x,y,w,k);return Cg=null,T}catch(C){if(C===D1||C===P4)throw C;var _=xl(29,C,null,x.mode);return _.lanes=k,_.return=x,_}finally{}}}var jp=vV(!0),wV=vV(!1),Fh=!1;function oN(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function i7(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 bf(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function yf(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,hr&2){var r=s.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),s.pending=t,t=T2(e),hV(e,null,n),t}return L4(e,s,t,n),T2(e)}function Py(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,$U(e,n)}}function jT(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var r=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};i===null?r=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?r=i=t:i=i.next=t}else r=i=t;n={baseState:s.baseState,firstBaseUpdate:r,lastBaseUpdate:i,shared:s.shared,callbacks:s.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var o7=!1;function Oy(){if(o7){var e=Sg;if(e!==null)throw e}}function By(e,t,n,s){o7=!1;var r=e.updateQueue;Fh=!1;var i=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var c=a,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=c))}if(i!==null){var h=r.baseState;o=0,d=u=c=null,a=i;do{var m=a.lane&-536870913,p=m!==a.lane;if(p?(Fs&m)===m:(s&m)===m){m!==0&&m===Yg&&(o7=!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 v=n;switch(b.tag){case 1:if(g=b.payload,typeof g=="function"){h=g.call(v,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(v,h,m):g,m==null)break e;h=Qr({},h,m);break e;case 2:Fh=!0}}m=a.callback,m!==null&&(e.flags|=64,p&&(e.flags|=8192),p=r.callbacks,p===null?r.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,c=h):d=d.next=p,o|=m;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;p=a,a=p.next,p.next=null,r.lastBaseUpdate=p,r.shared.pending=null}}while(!0);d===null&&(c=h),r.baseState=c,r.firstBaseUpdate=u,r.lastBaseUpdate=d,i===null&&(r.shared.lanes=0),If|=o,e.lanes=o,e.memoizedState=h}}function kV(e,t){if(typeof e!="function")throw Error(et(191,e));e.call(t)}function _V(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)kV(n[e],t)}var Xg=zu(null),j2=zu(0);function lL(e,t){e=Xd,Ur(j2,e),Ur(Xg,t),Xd=e|t.baseLanes}function a7(){Ur(j2,Xd),Ur(Xg,Xg.current)}function aN(){Xd=j2.current,So(Xg),So(j2)}var Ml=zu(null),mc=null;function Gh(e){var t=e.alternate;Ur(ji,ji.current&1),Ur(Ml,e),mc===null&&(t===null||Xg.current!==null||t.memoizedState!==null)&&(mc=e)}function l7(e){Ur(ji,ji.current),Ur(Ml,e),mc===null&&(mc=e)}function SV(e){e.tag===22?(Ur(ji,ji.current),Ur(Ml,e),mc===null&&(mc=e)):Kh()}function Kh(){Ur(ji,ji.current),Ur(Ml,Ml.current)}function bl(e){So(Ml),mc===e&&(mc=null),So(ji)}var ji=zu(0);function M2(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||E7(n)||A7(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 Gd=0,ds=null,Tr=null,Bi=null,I2=!1,Tg=!1,Mp=!1,R2=0,xx=0,Eg=null,due=0;function xi(){throw Error(et(321))}function lN(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!jl(e[n],t[n]))return!1;return!0}function cN(e,t,n,s,r,i){return Gd=i,ds=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Xn.H=e===null||e.memoizedState===null?tW:vN,Mp=!1,i=n(s,r),Mp=!1,Tg&&(i=TV(t,n,s,r)),CV(e),i}function CV(e){Xn.H=vx;var t=Tr!==null&&Tr.next!==null;if(Gd=0,Bi=Tr=ds=null,I2=!1,xx=0,Eg=null,t)throw Error(et(300));e===null||Hi||(e=e.dependencies,e!==null&&A2(e)&&(Hi=!0))}function TV(e,t,n,s){ds=e;var r=0;do{if(Tg&&(Eg=null),xx=0,Tg=!1,25<=r)throw Error(et(301));if(r+=1,Bi=Tr=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}Xn.H=nW,i=t(n,s)}while(Tg);return i}function hue(){var e=Xn.H,t=e.useState()[0];return t=typeof t.then=="function"?Sv(t):t,e=e.useState()[0],(Tr!==null?Tr.memoizedState:null)!==e&&(ds.flags|=1024),t}function uN(){var e=R2!==0;return R2=0,e}function dN(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function hN(e){if(I2){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}I2=!1}Gd=0,Bi=Tr=ds=null,Tg=!1,xx=R2=0,Eg=null}function xa(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bi===null?ds.memoizedState=Bi=e:Bi=Bi.next=e,Bi}function Mi(){if(Tr===null){var e=ds.alternate;e=e!==null?e.memoizedState:null}else e=Tr.next;var t=Bi===null?ds.memoizedState:Bi.next;if(t!==null)Bi=t,Tr=e;else{if(e===null)throw ds.alternate===null?Error(et(467)):Error(et(310));Tr=e,e={memoizedState:Tr.memoizedState,baseState:Tr.baseState,baseQueue:Tr.baseQueue,queue:Tr.queue,next:null},Bi===null?ds.memoizedState=Bi=e:Bi=Bi.next=e}return Bi}function O4(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Sv(e){var t=xx;return xx+=1,Eg===null&&(Eg=[]),e=xV(Eg,e,t),t=ds,(Bi===null?t.memoizedState:Bi.next)===null&&(t=t.alternate,Xn.H=t===null||t.memoizedState===null?tW:vN),e}function B4(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Sv(e);if(e.$$typeof===_d)return Oo(e)}throw Error(et(438,String(e)))}function fN(e){var t=null,n=ds.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=ds.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=O4(),ds.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),s=0;s<e;s++)n[s]=Qle;return t.index++,n}function Kd(e,t){return typeof t=="function"?t(e):t}function A_(e){var t=Mi();return mN(t,Tr,e)}function mN(e,t,n){var s=e.queue;if(s===null)throw Error(et(311));s.lastRenderedReducer=n;var r=e.baseQueue,i=s.pending;if(i!==null){if(r!==null){var o=r.next;r.next=i.next,i.next=o}t.baseQueue=r=i,s.pending=null}if(i=e.baseState,r===null)e.memoizedState=i;else{t=r.next;var a=o=null,c=null,u=t,d=!1;do{var h=u.lane&-536870913;if(h!==u.lane?(Fs&h)===h:(Gd&h)===h){var m=u.revertLane;if(m===0)c!==null&&(c=c.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),h===Yg&&(d=!0);else if((Gd&m)===m){u=u.next,m===Yg&&(d=!0);continue}else h={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},c===null?(a=c=h,o=i):c=c.next=h,ds.lanes|=m,If|=m;h=u.action,Mp&&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},c===null?(a=c=m,o=i):c=c.next=m,ds.lanes|=h,If|=h;u=u.next}while(u!==null&&u!==t);if(c===null?o=i:c.next=a,!jl(i,e.memoizedState)&&(Hi=!0,d&&(n=Sg,n!==null)))throw n;e.memoizedState=i,e.baseState=o,e.baseQueue=c,s.lastRenderedState=i}return r===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function MT(e){var t=Mi(),n=t.queue;if(n===null)throw Error(et(311));n.lastRenderedReducer=e;var s=n.dispatch,r=n.pending,i=t.memoizedState;if(r!==null){n.pending=null;var o=r=r.next;do i=e(i,o.action),o=o.next;while(o!==r);jl(i,t.memoizedState)||(Hi=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,s]}function EV(e,t,n){var s=ds,r=Mi(),i=Ys;if(i){if(n===void 0)throw Error(et(407));n=n()}else n=t();var o=!jl((Tr||r).memoizedState,n);if(o&&(r.memoizedState=n,Hi=!0),r=r.queue,pN(jV.bind(null,s,r,e),[e]),r.getSnapshot!==t||o||Bi!==null&&Bi.memoizedState.tag&1){if(s.flags|=2048,Qg(9,{destroy:void 0},NV.bind(null,s,r,n,t),null),Dr===null)throw Error(et(349));i||Gd&127||AV(s,t,n)}return n}function AV(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ds.updateQueue,t===null?(t=O4(),ds.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function NV(e,t,n,s){t.value=n,t.getSnapshot=s,MV(t)&&IV(e)}function jV(e,t,n){return n(function(){MV(t)&&IV(e)})}function MV(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!jl(e,n)}catch{return!0}}function IV(e){var t=Jp(e,2);t!==null&&el(t,e,2)}function c7(e){var t=xa();if(typeof e=="function"){var n=e;if(e=n(),Mp){Jh(!0);try{n()}finally{Jh(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kd,lastRenderedState:e},t}function RV(e,t,n,s){return e.baseState=n,mN(e,Tr,typeof s=="function"?s:Kd)}function fue(e,t,n,s,r){if(z4(e))throw Error(et(485));if(e=t.action,e!==null){var i={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){i.listeners.push(o)}};Xn.T!==null?n(!0):i.isTransition=!1,s(i),n=t.pending,n===null?(i.next=t.pending=i,DV(t,i)):(i.next=n.next,t.pending=n.next=i)}}function DV(e,t){var n=t.action,s=t.payload,r=e.state;if(t.isTransition){var i=Xn.T,o={};Xn.T=o;try{var a=n(r,s),c=Xn.S;c!==null&&c(o,a),cL(e,t,a)}catch(u){u7(e,t,u)}finally{i!==null&&o.types!==null&&(i.types=o.types),Xn.T=i}}else try{i=n(r,s),cL(e,t,i)}catch(u){u7(e,t,u)}}function cL(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){uL(e,t,s)},function(s){return u7(e,t,s)}):uL(e,t,n)}function uL(e,t,n){t.status="fulfilled",t.value=n,LV(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,DV(e,n)))}function u7(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,LV(t),t=t.next;while(t!==s)}e.action=null}function LV(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function PV(e,t){return t}function dL(e,t){if(Ys){var n=Dr.formState;if(n!==null){e:{var s=ds;if(Ys){if(Yr){t:{for(var r=Yr,i=cc;r.nodeType!==8;){if(!i){r=null;break t}if(r=pc(r.nextSibling),r===null){r=null;break t}}i=r.data,r=i==="F!"||i==="F"?r:null}if(r){Yr=pc(r.nextSibling),s=r.data==="F!";break e}}jf(s)}s=!1}s&&(t=n[0])}}return n=xa(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:PV,lastRenderedState:t},n.queue=s,n=JV.bind(null,ds,s),s.dispatch=n,s=c7(!1),i=xN.bind(null,ds,!1,s.queue),s=xa(),r={state:t,dispatch:null,action:e,pending:null},s.queue=r,n=fue.bind(null,ds,r,i,n),r.dispatch=n,s.memoizedState=e,[t,n,!1]}function hL(e){var t=Mi();return OV(t,Tr,e)}function OV(e,t,n){if(t=mN(e,t,PV)[0],e=A_(Kd)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Sv(t)}catch(o){throw o===D1?P4:o}else s=t;t=Mi();var r=t.queue,i=r.dispatch;return n!==t.memoizedState&&(ds.flags|=2048,Qg(9,{destroy:void 0},mue.bind(null,r,n),null)),[s,i,e]}function mue(e,t){e.action=t}function fL(e){var t=Mi(),n=Tr;if(n!==null)return OV(t,n,e);Mi(),t=t.memoizedState,n=Mi();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function Qg(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=ds.updateQueue,t===null&&(t=O4(),ds.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e),e}function BV(){return Mi().memoizedState}function N_(e,t,n,s){var r=xa();ds.flags|=e,r.memoizedState=Qg(1|t,{destroy:void 0},n,s===void 0?null:s)}function $4(e,t,n,s){var r=Mi();s=s===void 0?null:s;var i=r.memoizedState.inst;Tr!==null&&s!==null&&lN(s,Tr.memoizedState.deps)?r.memoizedState=Qg(t,i,n,s):(ds.flags|=e,r.memoizedState=Qg(1|t,i,n,s))}function mL(e,t){N_(8390656,8,e,t)}function pN(e,t){$4(2048,8,e,t)}function pue(e){ds.flags|=4;var t=ds.updateQueue;if(t===null)t=O4(),ds.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function $V(e){var t=Mi().memoizedState;return pue({ref:t,nextImpl:e}),function(){if(hr&2)throw Error(et(440));return t.impl.apply(void 0,arguments)}}function zV(e,t){return $4(4,2,e,t)}function FV(e,t){return $4(4,4,e,t)}function HV(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 qV(e,t,n){n=n!=null?n.concat([e]):null,$4(4,4,HV.bind(null,t,e),n)}function gN(){}function UV(e,t){var n=Mi();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&lN(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function VV(e,t){var n=Mi();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&lN(t,s[1]))return s[0];if(s=e(),Mp){Jh(!0);try{e()}finally{Jh(!1)}}return n.memoizedState=[s,t],s}function bN(e,t,n){return n===void 0||Gd&1073741824&&!(Fs&261930)?e.memoizedState=t:(e.memoizedState=n,e=RW(),ds.lanes|=e,If|=e,n)}function WV(e,t,n,s){return jl(n,t)?n:Xg.current!==null?(e=bN(e,n,s),jl(e,t)||(Hi=!0),e):!(Gd&42)||Gd&1073741824&&!(Fs&261930)?(Hi=!0,e.memoizedState=n):(e=RW(),ds.lanes|=e,If|=e,t)}function GV(e,t,n,s,r){var i=mr.p;mr.p=i!==0&&8>i?i:8;var o=Xn.T,a={};Xn.T=a,xN(e,!1,t,n);try{var c=r(),u=Xn.S;if(u!==null&&u(a,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=uue(c,s);$y(e,t,d,Tl(e))}else $y(e,t,s,Tl(e))}catch(h){$y(e,t,{then:function(){},status:"rejected",reason:h},Tl())}finally{mr.p=i,o!==null&&a.types!==null&&(o.types=a.types),Xn.T=o}}function gue(){}function d7(e,t,n,s){if(e.tag!==5)throw Error(et(476));var r=KV(e).queue;GV(e,r,t,gp,n===null?gue:function(){return YV(e),n(s)})}function KV(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:gp,baseState:gp,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kd,lastRenderedState:gp},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kd,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function YV(e){var t=KV(e);t.next===null&&(t=e.alternate.memoizedState),$y(e,t.next.queue,{},Tl())}function yN(){return Oo(_x)}function XV(){return Mi().memoizedState}function QV(){return Mi().memoizedState}function bue(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Tl();e=bf(n);var s=yf(t,e,n);s!==null&&(el(s,t,n),Py(s,t,n)),t={cache:sN()},e.payload=t;return}t=t.return}}function yue(e,t,n){var s=Tl();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},z4(e)?ZV(t,n):(n=Z9(e,t,n,s),n!==null&&(el(n,e,s),eW(n,t,s)))}function JV(e,t,n){var s=Tl();$y(e,t,n,s)}function $y(e,t,n,s){var r={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(z4(e))ZV(t,r);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(r.hasEagerState=!0,r.eagerState=a,jl(a,o))return L4(e,t,r,0),Dr===null&&D4(),!1}catch{}finally{}if(n=Z9(e,t,r,s),n!==null)return el(n,e,s),eW(n,t,s),!0}return!1}function xN(e,t,n,s){if(s={lane:2,revertLane:AN(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},z4(e)){if(t)throw Error(et(479))}else t=Z9(e,n,s,2),t!==null&&el(t,e,2)}function z4(e){var t=e.alternate;return e===ds||t!==null&&t===ds}function ZV(e,t){Tg=I2=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function eW(e,t,n){if(n&4194048){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,$U(e,n)}}var vx={readContext:Oo,use:B4,useCallback:xi,useContext:xi,useEffect:xi,useImperativeHandle:xi,useLayoutEffect:xi,useInsertionEffect:xi,useMemo:xi,useReducer:xi,useRef:xi,useState:xi,useDebugValue:xi,useDeferredValue:xi,useTransition:xi,useSyncExternalStore:xi,useId:xi,useHostTransitionStatus:xi,useFormState:xi,useActionState:xi,useOptimistic:xi,useMemoCache:xi,useCacheRefresh:xi};vx.useEffectEvent=xi;var tW={readContext:Oo,use:B4,useCallback:function(e,t){return xa().memoizedState=[e,t===void 0?null:t],e},useContext:Oo,useEffect:mL,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,N_(4194308,4,HV.bind(null,t,e),n)},useLayoutEffect:function(e,t){return N_(4194308,4,e,t)},useInsertionEffect:function(e,t){N_(4,2,e,t)},useMemo:function(e,t){var n=xa();t=t===void 0?null:t;var s=e();if(Mp){Jh(!0);try{e()}finally{Jh(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=xa();if(n!==void 0){var r=n(t);if(Mp){Jh(!0);try{n(t)}finally{Jh(!1)}}}else r=t;return s.memoizedState=s.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},s.queue=e,e=e.dispatch=yue.bind(null,ds,e),[s.memoizedState,e]},useRef:function(e){var t=xa();return e={current:e},t.memoizedState=e},useState:function(e){e=c7(e);var t=e.queue,n=JV.bind(null,ds,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:gN,useDeferredValue:function(e,t){var n=xa();return bN(n,e,t)},useTransition:function(){var e=c7(!1);return e=GV.bind(null,ds,e.queue,!0,!1),xa().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=ds,r=xa();if(Ys){if(n===void 0)throw Error(et(407));n=n()}else{if(n=t(),Dr===null)throw Error(et(349));Fs&127||AV(s,t,n)}r.memoizedState=n;var i={value:n,getSnapshot:t};return r.queue=i,mL(jV.bind(null,s,i,e),[e]),s.flags|=2048,Qg(9,{destroy:void 0},NV.bind(null,s,i,n,t),null),n},useId:function(){var e=xa(),t=Dr.identifierPrefix;if(Ys){var n=Su,s=_u;n=(s&~(1<<32-Cl(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=R2++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=due++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:yN,useFormState:dL,useActionState:dL,useOptimistic:function(e){var t=xa();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=xN.bind(null,ds,!0,n),n.dispatch=t,[e,t]},useMemoCache:fN,useCacheRefresh:function(){return xa().memoizedState=bue.bind(null,ds)},useEffectEvent:function(e){var t=xa(),n={impl:e};return t.memoizedState=n,function(){if(hr&2)throw Error(et(440));return n.impl.apply(void 0,arguments)}}},vN={readContext:Oo,use:B4,useCallback:UV,useContext:Oo,useEffect:pN,useImperativeHandle:qV,useInsertionEffect:zV,useLayoutEffect:FV,useMemo:VV,useReducer:A_,useRef:BV,useState:function(){return A_(Kd)},useDebugValue:gN,useDeferredValue:function(e,t){var n=Mi();return WV(n,Tr.memoizedState,e,t)},useTransition:function(){var e=A_(Kd)[0],t=Mi().memoizedState;return[typeof e=="boolean"?e:Sv(e),t]},useSyncExternalStore:EV,useId:XV,useHostTransitionStatus:yN,useFormState:hL,useActionState:hL,useOptimistic:function(e,t){var n=Mi();return RV(n,Tr,e,t)},useMemoCache:fN,useCacheRefresh:QV};vN.useEffectEvent=$V;var nW={readContext:Oo,use:B4,useCallback:UV,useContext:Oo,useEffect:pN,useImperativeHandle:qV,useInsertionEffect:zV,useLayoutEffect:FV,useMemo:VV,useReducer:MT,useRef:BV,useState:function(){return MT(Kd)},useDebugValue:gN,useDeferredValue:function(e,t){var n=Mi();return Tr===null?bN(n,e,t):WV(n,Tr.memoizedState,e,t)},useTransition:function(){var e=MT(Kd)[0],t=Mi().memoizedState;return[typeof e=="boolean"?e:Sv(e),t]},useSyncExternalStore:EV,useId:XV,useHostTransitionStatus:yN,useFormState:fL,useActionState:fL,useOptimistic:function(e,t){var n=Mi();return Tr!==null?RV(n,Tr,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:fN,useCacheRefresh:QV};nW.useEffectEvent=$V;function IT(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:Qr({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var h7={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=Tl(),r=bf(s);r.payload=t,n!=null&&(r.callback=n),t=yf(e,r,s),t!==null&&(el(t,e,s),Py(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=Tl(),r=bf(s);r.tag=1,r.payload=t,n!=null&&(r.callback=n),t=yf(e,r,s),t!==null&&(el(t,e,s),Py(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Tl(),s=bf(n);s.tag=2,t!=null&&(s.callback=t),t=yf(e,s,n),t!==null&&(el(t,e,n),Py(t,e,n))}};function pL(e,t,n,s,r,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,i,o):t.prototype&&t.prototype.isPureReactComponent?!px(n,s)||!px(r,i):!0}function gL(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&h7.enqueueReplaceState(t,t.state,null)}function Ip(e,t){var n=t;if("ref"in t){n={};for(var s in t)s!=="ref"&&(n[s]=t[s])}if(e=e.defaultProps){n===t&&(n=Qr({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}function sW(e){C2(e)}function rW(e){console.error(e)}function iW(e){C2(e)}function D2(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function bL(e,t,n){try{var s=e.onCaughtError;s(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function f7(e,t,n){return n=bf(n),n.tag=3,n.payload={element:null},n.callback=function(){D2(e,t)},n}function oW(e){return e=bf(e),e.tag=3,e}function aW(e,t,n,s){var r=n.type.getDerivedStateFromError;if(typeof r=="function"){var i=s.value;e.payload=function(){return r(i)},e.callback=function(){bL(t,n,s)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){bL(t,n,s),typeof r!="function"&&(xf===null?xf=new Set([this]):xf.add(this));var a=s.stack;this.componentDidCatch(s.value,{componentStack:a!==null?a:""})})}function xue(e,t,n,s,r){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&R1(t,n,r,!0),n=Ml.current,n!==null){switch(n.tag){case 31:case 13:return mc===null?$2():n.alternate===null&&ki===0&&(ki=3),n.flags&=-257,n.flags|=65536,n.lanes=r,s===N2?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),qT(e,s,r)),!1;case 22:return n.flags|=65536,s===N2?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([s]):n.add(s)),qT(e,s,r)),!1}throw Error(et(435,n.tag))}return qT(e,s,r),$2(),!1}if(Ys)return t=Ml.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=r,s!==e7&&(e=Error(et(422),{cause:s}),bx(lc(e,n)))):(s!==e7&&(t=Error(et(423),{cause:s}),bx(lc(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,s=lc(s,n),r=f7(e.stateNode,s,r),jT(e,r),ki!==4&&(ki=2)),!1;var i=Error(et(520),{cause:s});if(i=lc(i,n),Hy===null?Hy=[i]:Hy.push(i),ki!==4&&(ki=2),t===null)return!0;s=lc(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=f7(n.stateNode,s,e),jT(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"&&(xf===null||!xf.has(i))))return n.flags|=65536,r&=-r,n.lanes|=r,r=oW(r),aW(r,e,n,s),jT(n,r),!1}n=n.return}while(n!==null);return!1}var wN=Error(et(461)),Hi=!1;function No(e,t,n,s){t.child=e===null?wV(t,null,n,s):jp(t,e.child,n,s)}function yL(e,t,n,s,r){n=n.render;var i=t.ref;if("ref"in s){var o={};for(var a in s)a!=="ref"&&(o[a]=s[a])}else o=s;return Np(t),s=cN(e,t,n,o,i,r),a=uN(),e!==null&&!Hi?(dN(e,t,r),Yd(e,t,r)):(Ys&&a&&tN(t),t.flags|=1,No(e,t,s,r),t.child)}function xL(e,t,n,s,r){if(e===null){var i=n.type;return typeof i=="function"&&!eN(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,lW(e,t,i,s,r)):(e=T_(n.type,null,s,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!kN(e,r)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:px,n(o,s)&&e.ref===t.ref)return Yd(e,t,r)}return t.flags|=1,e=Md(i,s),e.ref=t.ref,e.return=t,t.child=e}function lW(e,t,n,s,r){if(e!==null){var i=e.memoizedProps;if(px(i,s)&&e.ref===t.ref)if(Hi=!1,t.pendingProps=s=i,kN(e,r))e.flags&131072&&(Hi=!0);else return t.lanes=e.lanes,Yd(e,t,r)}return m7(e,t,n,s,r)}function cW(e,t,n,s){var r=s.children,i=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if(t.flags&128){if(i=i!==null?i.baseLanes|n:n,e!==null){for(s=t.child=e.child,r=0;s!==null;)r=r|s.lanes|s.childLanes,s=s.sibling;s=r&~i}else s=0,t.child=null;return vL(e,t,i,n,s)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&E_(t,i!==null?i.cachePool:null),i!==null?lL(t,i):a7(),SV(t);else return s=t.lanes=536870912,vL(e,t,i!==null?i.baseLanes|n:n,n,s)}else i!==null?(E_(t,i.cachePool),lL(t,i),Kh(),t.memoizedState=null):(e!==null&&E_(t,null),a7(),Kh());return No(e,t,r,n),t.child}function my(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function vL(e,t,n,s,r){var i=rN();return i=i===null?null:{parent:zi._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&E_(t,null),a7(),SV(t),e!==null&&R1(e,t,s,!0),t.childLanes=r,null}function j_(e,t){return t=L2({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function wL(e,t,n){return jp(t,e.child,null,n),e=j_(t,t.pendingProps),e.flags|=2,bl(t),t.memoizedState=null,e}function vue(e,t,n){var s=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ys){if(s.mode==="hidden")return e=j_(t,s),t.lanes=536870912,my(null,e);if(l7(t),(e=Yr)?(e=tG(e,cc),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Nf!==null?{id:_u,overflow:Su}:null,retryLane:536870912,hydrationErrors:null},n=mV(e),n.return=t,t.child=n,Po=t,Yr=null)):e=null,e===null)throw jf(t);return t.lanes=536870912,null}return j_(t,s)}var i=e.memoizedState;if(i!==null){var o=i.dehydrated;if(l7(t),r)if(t.flags&256)t.flags&=-257,t=wL(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(et(558));else if(Hi||R1(e,t,n,!1),r=(n&e.childLanes)!==0,Hi||r){if(s=Dr,s!==null&&(o=zU(s,n),o!==0&&o!==i.retryLane))throw i.retryLane=o,Jp(e,o),el(s,e,o),wN;$2(),t=wL(e,t,n)}else e=i.treeContext,Yr=pc(o.nextSibling),Po=t,Ys=!0,gf=null,cc=!1,e!==null&&gV(t,e),t=j_(t,s),t.flags|=4096;return t}return e=Md(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function M_(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(et(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function m7(e,t,n,s,r){return Np(t),n=cN(e,t,n,s,void 0,r),s=uN(),e!==null&&!Hi?(dN(e,t,r),Yd(e,t,r)):(Ys&&s&&tN(t),t.flags|=1,No(e,t,n,r),t.child)}function kL(e,t,n,s,r,i){return Np(t),t.updateQueue=null,n=TV(t,s,n,r),CV(e),s=uN(),e!==null&&!Hi?(dN(e,t,i),Yd(e,t,i)):(Ys&&s&&tN(t),t.flags|=1,No(e,t,n,i),t.child)}function _L(e,t,n,s,r){if(Np(t),t.stateNode===null){var i=lg,o=n.contextType;typeof o=="object"&&o!==null&&(i=Oo(o)),i=new n(s,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=h7,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=s,i.state=t.memoizedState,i.refs={},oN(t),o=n.contextType,i.context=typeof o=="object"&&o!==null?Oo(o):lg,i.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o=="function"&&(IT(t,n,o,s),i.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(o=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),o!==i.state&&h7.enqueueReplaceState(i,i.state,null),By(t,s,i,r),Oy(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){i=t.stateNode;var a=t.memoizedProps,c=Ip(n,a);i.props=c;var u=i.context,d=n.contextType;o=lg,typeof d=="object"&&d!==null&&(o=Oo(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)&&gL(t,i,s,o),Fh=!1;var m=t.memoizedState;i.state=m,By(t,s,i,r),Oy(),u=t.memoizedState,a||m!==u||Fh?(typeof h=="function"&&(IT(t,n,h,s),u=t.memoizedState),(c=Fh||pL(t,n,c,s,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=s,t.memoizedState=u),i.props=s,i.state=u,i.context=o,s=c):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{i=t.stateNode,i7(e,t),o=t.memoizedProps,d=Ip(n,o),i.props=d,h=t.pendingProps,m=i.context,u=n.contextType,c=lg,typeof u=="object"&&u!==null&&(c=Oo(u)),a=n.getDerivedStateFromProps,(u=typeof a=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o!==h||m!==c)&&gL(t,i,s,c),Fh=!1,m=t.memoizedState,i.state=m,By(t,s,i,r),Oy();var p=t.memoizedState;o!==h||m!==p||Fh||e!==null&&e.dependencies!==null&&A2(e.dependencies)?(typeof a=="function"&&(IT(t,n,a,s),p=t.memoizedState),(d=Fh||pL(t,n,d,s,m,p,c)||e!==null&&e.dependencies!==null&&A2(e.dependencies))?(u||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(s,p,c),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(s,p,c)),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=s,t.memoizedState=p),i.props=s,i.state=p,i.context=c,s=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),s=!1)}return i=s,M_(e,t),s=(t.flags&128)!==0,i||s?(i=t.stateNode,n=s&&typeof n.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&s?(t.child=jp(t,e.child,null,r),t.child=jp(t,null,n,r)):No(e,t,n,r),t.memoizedState=i.state,e=t.child):e=Yd(e,t,r),e}function SL(e,t,n,s){return Ap(),t.flags|=256,No(e,t,n,s),t.child}var RT={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function DT(e){return{baseLanes:e,cachePool:yV()}}function LT(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=vl),e}function uW(e,t,n){var s=t.pendingProps,r=!1,i=(t.flags&128)!==0,o;if((o=i)||(o=e!==null&&e.memoizedState===null?!1:(ji.current&2)!==0),o&&(r=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ys){if(r?Gh(t):Kh(),(e=Yr)?(e=tG(e,cc),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Nf!==null?{id:_u,overflow:Su}:null,retryLane:536870912,hydrationErrors:null},n=mV(e),n.return=t,t.child=n,Po=t,Yr=null)):e=null,e===null)throw jf(t);return A7(e)?t.lanes=32:t.lanes=536870912,null}var a=s.children;return s=s.fallback,r?(Kh(),r=t.mode,a=L2({mode:"hidden",children:a},r),s=bp(s,r,n,null),a.return=t,s.return=t,a.sibling=s,t.child=a,s=t.child,s.memoizedState=DT(n),s.childLanes=LT(e,o,n),t.memoizedState=RT,my(null,s)):(Gh(t),p7(t,a))}var c=e.memoizedState;if(c!==null&&(a=c.dehydrated,a!==null)){if(i)t.flags&256?(Gh(t),t.flags&=-257,t=PT(e,t,n)):t.memoizedState!==null?(Kh(),t.child=e.child,t.flags|=128,t=null):(Kh(),a=s.fallback,r=t.mode,s=L2({mode:"visible",children:s.children},r),a=bp(a,r,n,null),a.flags|=2,s.return=t,a.return=t,s.sibling=a,t.child=s,jp(t,e.child,null,n),s=t.child,s.memoizedState=DT(n),s.childLanes=LT(e,o,n),t.memoizedState=RT,t=my(null,s));else if(Gh(t),A7(a)){if(o=a.nextSibling&&a.nextSibling.dataset,o)var u=o.dgst;o=u,s=Error(et(419)),s.stack="",s.digest=o,bx({value:s,source:null,stack:null}),t=PT(e,t,n)}else if(Hi||R1(e,t,n,!1),o=(n&e.childLanes)!==0,Hi||o){if(o=Dr,o!==null&&(s=zU(o,n),s!==0&&s!==c.retryLane))throw c.retryLane=s,Jp(e,s),el(o,e,s),wN;E7(a)||$2(),t=PT(e,t,n)}else E7(a)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,Yr=pc(a.nextSibling),Po=t,Ys=!0,gf=null,cc=!1,e!==null&&gV(t,e),t=p7(t,s.children),t.flags|=4096);return t}return r?(Kh(),a=s.fallback,r=t.mode,c=e.child,u=c.sibling,s=Md(c,{mode:"hidden",children:s.children}),s.subtreeFlags=c.subtreeFlags&65011712,u!==null?a=Md(u,a):(a=bp(a,r,n,null),a.flags|=2),a.return=t,s.return=t,s.sibling=a,t.child=s,my(null,s),s=t.child,a=e.child.memoizedState,a===null?a=DT(n):(r=a.cachePool,r!==null?(c=zi._currentValue,r=r.parent!==c?{parent:c,pool:c}:r):r=yV(),a={baseLanes:a.baseLanes|n,cachePool:r}),s.memoizedState=a,s.childLanes=LT(e,o,n),t.memoizedState=RT,my(e.child,s)):(Gh(t),n=e.child,e=n.sibling,n=Md(n,{mode:"visible",children:s.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function p7(e,t){return t=L2({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function L2(e,t){return e=xl(22,e,null,t),e.lanes=0,e}function PT(e,t,n){return jp(t,e.child,null,n),e=p7(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function CL(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),n7(e.return,t,n)}function OT(e,t,n,s,r,i){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:r,treeForkCount:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=s,o.tail=n,o.tailMode=r,o.treeForkCount=i)}function dW(e,t,n){var s=t.pendingProps,r=s.revealOrder,i=s.tail;s=s.children;var o=ji.current,a=(o&2)!==0;if(a?(o=o&1|2,t.flags|=128):o&=1,Ur(ji,o),No(e,t,s,n),s=Ys?gx:0,!a&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&CL(e,n,t);else if(e.tag===19)CL(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(r){case"forwards":for(n=t.child,r=null;n!==null;)e=n.alternate,e!==null&&M2(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),OT(t,!1,r,n,i,s);break;case"backwards":case"unstable_legacy-backwards":for(n=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&M2(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}OT(t,!0,n,null,i,s);break;case"together":OT(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function Yd(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),If|=t.lanes,!(n&t.childLanes))if(e!==null){if(R1(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(et(153));if(t.child!==null){for(e=t.child,n=Md(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Md(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function kN(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&A2(e)))}function wue(e,t,n){switch(t.tag){case 3:w2(t,t.stateNode.containerInfo),Wh(t,zi,e.memoizedState.cache),Ap();break;case 27:case 5:q8(t);break;case 4:w2(t,t.stateNode.containerInfo);break;case 10:Wh(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,l7(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Gh(t),t.flags|=128,null):n&t.child.childLanes?uW(e,t,n):(Gh(t),e=Yd(e,t,n),e!==null?e.sibling:null);Gh(t);break;case 19:var r=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(R1(e,t,n,!1),s=(n&t.childLanes)!==0),r){if(s)return dW(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),Ur(ji,ji.current),s)break;return null;case 22:return t.lanes=0,cW(e,t,n,t.pendingProps);case 24:Wh(t,zi,e.memoizedState.cache)}return Yd(e,t,n)}function hW(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Hi=!0;else{if(!kN(e,n)&&!(t.flags&128))return Hi=!1,wue(e,t,n);Hi=!!(e.flags&131072)}else Hi=!1,Ys&&t.flags&1048576&&pV(t,gx,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=Km(t.elementType),t.type=e,typeof e=="function")eN(e)?(s=Ip(e,s),t.tag=1,t=_L(null,t,e,s,n)):(t.tag=0,t=m7(null,t,e,s,n));else{if(e!=null){var r=e.$$typeof;if(r===z9){t.tag=11,t=yL(null,t,e,s,n);break e}else if(r===F9){t.tag=14,t=xL(null,t,e,s,n);break e}}throw t=F8(e)||e,Error(et(306,t,""))}}return t;case 0:return m7(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,r=Ip(s,t.pendingProps),_L(e,t,s,r,n);case 3:e:{if(w2(t,t.stateNode.containerInfo),e===null)throw Error(et(387));s=t.pendingProps;var i=t.memoizedState;r=i.element,i7(e,t),By(t,s,null,n);var o=t.memoizedState;if(s=o.cache,Wh(t,zi,s),s!==i.cache&&s7(t,[zi],n,!0),Oy(),s=o.element,i.isDehydrated)if(i={element:s,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=SL(e,t,s,n);break e}else if(s!==r){r=lc(Error(et(424)),t),bx(r),t=SL(e,t,s,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Yr=pc(e.firstChild),Po=t,Ys=!0,gf=null,cc=!0,n=wV(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ap(),s===r){t=Yd(e,t,n);break e}No(e,t,s,n)}t=t.child}return t;case 26:return M_(e,t),e===null?(n=VL(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ys||(n=t.type,e=t.pendingProps,s=q2(pf.current).createElement(n),s[Lo]=t,s[sl]=e,zo(s,n,e),wo(s),t.stateNode=s):t.memoizedState=VL(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return q8(t),e===null&&Ys&&(s=t.stateNode=nG(t.type,t.pendingProps,pf.current),Po=t,cc=!0,r=Yr,sm(t.type)?(N7=r,Yr=pc(s.firstChild)):Yr=r),No(e,t,t.pendingProps.children,n),M_(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ys&&((r=s=Yr)&&(s=Que(s,t.type,t.pendingProps,cc),s!==null?(t.stateNode=s,Po=t,Yr=pc(s.firstChild),cc=!1,r=!0):r=!1),r||jf(t)),q8(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,C7(r,i)?s=null:o!==null&&C7(r,o)&&(t.flags|=32),t.memoizedState!==null&&(r=cN(e,t,hue,null,null,n),_x._currentValue=r),M_(e,t),No(e,t,s,n),t.child;case 6:return e===null&&Ys&&((e=n=Yr)&&(n=Jue(n,t.pendingProps,cc),n!==null?(t.stateNode=n,Po=t,Yr=null,e=!0):e=!1),e||jf(t)),null;case 13:return uW(e,t,n);case 4:return w2(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=jp(t,null,s,n):No(e,t,s,n),t.child;case 11:return yL(e,t,t.type,t.pendingProps,n);case 7:return No(e,t,t.pendingProps,n),t.child;case 8:return No(e,t,t.pendingProps.children,n),t.child;case 12:return No(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,Wh(t,t.type,s.value),No(e,t,s.children,n),t.child;case 9:return r=t.type._context,s=t.pendingProps.children,Np(t),r=Oo(r),s=s(r),t.flags|=1,No(e,t,s,n),t.child;case 14:return xL(e,t,t.type,t.pendingProps,n);case 15:return lW(e,t,t.type,t.pendingProps,n);case 19:return dW(e,t,n);case 31:return vue(e,t,n);case 22:return cW(e,t,n,t.pendingProps);case 24:return Np(t),s=Oo(zi),e===null?(r=rN(),r===null&&(r=Dr,i=sN(),r.pooledCache=i,i.refCount++,i!==null&&(r.pooledCacheLanes|=n),r=i),t.memoizedState={parent:s,cache:r},oN(t),Wh(t,zi,r)):(e.lanes&n&&(i7(e,t),By(t,null,null,n),Oy()),r=e.memoizedState,i=t.memoizedState,r.parent!==s?(r={parent:s,cache:s},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),Wh(t,zi,s)):(s=i.cache,Wh(t,zi,s),s!==r.cache&&s7(t,[zi],n,!0))),No(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(et(156,t.tag))}function ld(e){e.flags|=4}function BT(e,t,n,s,r){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(PW())e.flags|=8192;else throw xp=N2,iN}else e.flags&=-16777217}function TL(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!iG(t))if(PW())e.flags|=8192;else throw xp=N2,iN}function Kw(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?OU():536870912,e.lanes|=t,Jg|=t)}function $b(e,t){if(!Ys)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Kr(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var r=e.child;r!==null;)n|=r.lanes|r.childLanes,s|=r.subtreeFlags&65011712,s|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)n|=r.lanes|r.childLanes,s|=r.subtreeFlags,s|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function kue(e,t,n){var s=t.pendingProps;switch(nN(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kr(t),null;case 1:return Kr(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Id(zi),Wg(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(S0(t)?ld(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,NT())),Kr(t),null;case 26:var r=t.type,i=t.memoizedState;return e===null?(ld(t),i!==null?(Kr(t),TL(t,i)):(Kr(t),BT(t,r,null,s,n))):i?i!==e.memoizedState?(ld(t),Kr(t),TL(t,i)):(Kr(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&ld(t),Kr(t),BT(t,r,e,s,n)),null;case 27:if(k2(t),n=pf.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ld(t);else{if(!s){if(t.stateNode===null)throw Error(et(166));return Kr(t),null}e=Iu.current,S0(t)?tL(t):(e=nG(r,s,n),t.stateNode=e,ld(t))}return Kr(t),null;case 5:if(k2(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ld(t);else{if(!s){if(t.stateNode===null)throw Error(et(166));return Kr(t),null}if(i=Iu.current,S0(t))tL(t);else{var o=q2(pf.current);switch(i){case 1:i=o.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:i=o.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":i=o.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":i=o.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":i=o.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof s.is=="string"?o.createElement("select",{is:s.is}):o.createElement("select"),s.multiple?i.multiple=!0:s.size&&(i.size=s.size);break;default:i=typeof s.is=="string"?o.createElement(r,{is:s.is}):o.createElement(r)}}i[Lo]=t,i[sl]=s;e:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)i.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;o.sibling===null;){if(o.return===null||o.return===t)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=i;e:switch(zo(i,r,s),r){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&ld(t)}}return Kr(t),BT(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&ld(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(et(166));if(e=pf.current,S0(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,r=Po,r!==null)switch(r.tag){case 27:case 5:s=r.memoizedProps}e[Lo]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||JW(e.nodeValue,n)),e||jf(t,!0)}else e=q2(e).createTextNode(s),e[Lo]=t,t.stateNode=e}return Kr(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=S0(t),n!==null){if(e===null){if(!s)throw Error(et(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(et(557));e[Lo]=t}else Ap(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Kr(t),e=!1}else n=NT(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(bl(t),t):(bl(t),null);if(t.flags&128)throw Error(et(558))}return Kr(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=S0(t),s!==null&&s.dehydrated!==null){if(e===null){if(!r)throw Error(et(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(et(317));r[Lo]=t}else Ap(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Kr(t),r=!1}else r=NT(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(bl(t),t):(bl(t),null)}return bl(t),t.flags&128?(t.lanes=n,t):(n=s!==null,e=e!==null&&e.memoizedState!==null,n&&(s=t.child,r=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(r=s.alternate.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==r&&(s.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Kw(t,t.updateQueue),Kr(t),null);case 4:return Wg(),e===null&&NN(t.stateNode.containerInfo),Kr(t),null;case 10:return Id(t.type),Kr(t),null;case 19:if(So(ji),s=t.memoizedState,s===null)return Kr(t),null;if(r=(t.flags&128)!==0,i=s.rendering,i===null)if(r)$b(s,!1);else{if(ki!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=M2(e),i!==null){for(t.flags|=128,$b(s,!1),e=i.updateQueue,t.updateQueue=e,Kw(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)fV(n,e),n=n.sibling;return Ur(ji,ji.current&1|2),Ys&&bd(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&_l()>O2&&(t.flags|=128,r=!0,$b(s,!1),t.lanes=4194304)}else{if(!r)if(e=M2(i),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,Kw(t,e),$b(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!Ys)return Kr(t),null}else 2*_l()-s.renderingStartTime>O2&&n!==536870912&&(t.flags|=128,r=!0,$b(s,!1),t.lanes=4194304);s.isBackwards?(i.sibling=t.child,t.child=i):(e=s.last,e!==null?e.sibling=i:t.child=i,s.last=i)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=_l(),e.sibling=null,n=ji.current,Ur(ji,r?n&1|2:n&1),Ys&&bd(t,s.treeForkCount),e):(Kr(t),null);case 22:case 23:return bl(t),aN(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?n&536870912&&!(t.flags&128)&&(Kr(t),t.subtreeFlags&6&&(t.flags|=8192)):Kr(t),n=t.updateQueue,n!==null&&Kw(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==n&&(t.flags|=2048),e!==null&&So(yp),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Id(zi),Kr(t),null;case 25:return null;case 30:return null}throw Error(et(156,t.tag))}function _ue(e,t){switch(nN(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Id(zi),Wg(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return k2(t),null;case 31:if(t.memoizedState!==null){if(bl(t),t.alternate===null)throw Error(et(340));Ap()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(bl(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(et(340));Ap()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return So(ji),null;case 4:return Wg(),null;case 10:return Id(t.type),null;case 22:case 23:return bl(t),aN(),e!==null&&So(yp),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Id(zi),null;case 25:return null;default:return null}}function fW(e,t){switch(nN(t),t.tag){case 3:Id(zi),Wg();break;case 26:case 27:case 5:k2(t);break;case 4:Wg();break;case 31:t.memoizedState!==null&&bl(t);break;case 13:bl(t);break;case 19:So(ji);break;case 10:Id(t.type);break;case 22:case 23:bl(t),aN(),e!==null&&So(yp);break;case 24:Id(zi)}}function Cv(e,t){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var r=s.next;n=r;do{if((n.tag&e)===e){s=void 0;var i=n.create,o=n.inst;s=i(),o.destroy=s}n=n.next}while(n!==r)}}catch(a){wr(t,t.return,a)}}function Mf(e,t,n){try{var s=t.updateQueue,r=s!==null?s.lastEffect:null;if(r!==null){var i=r.next;s=i;do{if((s.tag&e)===e){var o=s.inst,a=o.destroy;if(a!==void 0){o.destroy=void 0,r=t;var c=n,u=a;try{u()}catch(d){wr(r,c,d)}}}s=s.next}while(s!==i)}}catch(d){wr(t,t.return,d)}}function mW(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{_V(t,n)}catch(s){wr(e,e.return,s)}}}function pW(e,t,n){n.props=Ip(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){wr(e,t,s)}}function zy(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof n=="function"?e.refCleanup=n(s):n.current=s}}catch(r){wr(e,t,r)}}function Cu(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(r){wr(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(r){wr(e,t,r)}else n.current=null}function gW(e){var t=e.type,n=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&s.focus();break e;case"img":n.src?s.src=n.src:n.srcSet&&(s.srcset=n.srcSet)}}catch(r){wr(e,e.return,r)}}function $T(e,t,n){try{var s=e.stateNode;Vue(s,e.type,n,t),s[sl]=t}catch(r){wr(e,e.return,r)}}function bW(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&sm(e.type)||e.tag===4}function zT(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||bW(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&&sm(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 g7(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Sd));else if(s!==4&&(s===27&&sm(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(g7(e,t,n),e=e.sibling;e!==null;)g7(e,t,n),e=e.sibling}function P2(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(s===27&&sm(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(P2(e,t,n),e=e.sibling;e!==null;)P2(e,t,n),e=e.sibling}function yW(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);zo(t,s,n),t[Lo]=e,t[sl]=n}catch(i){wr(e,e.return,i)}}var xd=!1,$i=!1,FT=!1,EL=typeof WeakSet=="function"?WeakSet:Set,xo=null;function Sue(e,t){if(e=e.containerInfo,_7=G2,e=iV(e),Q9(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var r=s.anchorOffset,i=s.focusNode;s=s.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,c=-1,u=0,d=0,h=e,m=null;t:for(;;){for(var p;h!==n||r!==0&&h.nodeType!==3||(a=o+r),h!==i||s!==0&&h.nodeType!==3||(c=o+s),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===r&&(a=o),m===i&&++d===s&&(c=o),(p=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=p}n=a===-1||c===-1?null:{start:a,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(S7={focusedElem:e,selectionRange:n},G2=!1,xo=t;xo!==null;)if(t=xo,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xo=e;else for(;xo!==null;){switch(t=xo,i=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)r=e[n],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&i!==null){e=void 0,n=t,r=i.memoizedProps,i=i.memoizedState,s=n.stateNode;try{var g=Ip(n.type,r);e=s.getSnapshotBeforeUpdate(g,i),s.__reactInternalSnapshotBeforeUpdate=e}catch(b){wr(n,n.return,b)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)T7(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":T7(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(et(163))}if(e=t.sibling,e!==null){e.return=t.return,xo=e;break}xo=t.return}}function xW(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:ud(e,n),s&4&&Cv(5,n);break;case 1:if(ud(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(o){wr(n,n.return,o)}else{var r=Ip(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){wr(n,n.return,o)}}s&64&&mW(n),s&512&&zy(n,n.return);break;case 3:if(ud(e,n),s&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{_V(e,t)}catch(o){wr(n,n.return,o)}}break;case 27:t===null&&s&4&&yW(n);case 26:case 5:ud(e,n),t===null&&s&4&&gW(n),s&512&&zy(n,n.return);break;case 12:ud(e,n);break;case 31:ud(e,n),s&4&&kW(e,n);break;case 13:ud(e,n),s&4&&_W(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Rue.bind(null,n),Zue(e,n))));break;case 22:if(s=n.memoizedState!==null||xd,!s){t=t!==null&&t.memoizedState!==null||$i,r=xd;var i=$i;xd=s,($i=t)&&!i?gd(e,n,(n.subtreeFlags&8772)!==0):ud(e,n),xd=r,$i=i}break;case 30:break;default:ud(e,n)}}function vW(e){var t=e.alternate;t!==null&&(e.alternate=null,vW(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&V9(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 ni=null,qa=!1;function cd(e,t,n){for(n=n.child;n!==null;)wW(e,t,n),n=n.sibling}function wW(e,t,n){if(Sl&&typeof Sl.onCommitFiberUnmount=="function")try{Sl.onCommitFiberUnmount(yv,n)}catch{}switch(n.tag){case 26:$i||Cu(n,t),cd(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:$i||Cu(n,t);var s=ni,r=qa;sm(n.type)&&(ni=n.stateNode,qa=!1),cd(e,t,n),Uy(n.stateNode),ni=s,qa=r;break;case 5:$i||Cu(n,t);case 6:if(s=ni,r=qa,ni=null,cd(e,t,n),ni=s,qa=r,ni!==null)if(qa)try{(ni.nodeType===9?ni.body:ni.nodeName==="HTML"?ni.ownerDocument.body:ni).removeChild(n.stateNode)}catch(i){wr(n,t,i)}else try{ni.removeChild(n.stateNode)}catch(i){wr(n,t,i)}break;case 18:ni!==null&&(qa?(e=ni,zL(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),n1(e)):zL(ni,n.stateNode));break;case 4:s=ni,r=qa,ni=n.stateNode.containerInfo,qa=!0,cd(e,t,n),ni=s,qa=r;break;case 0:case 11:case 14:case 15:Mf(2,n,t),$i||Mf(4,n,t),cd(e,t,n);break;case 1:$i||(Cu(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&pW(n,t,s)),cd(e,t,n);break;case 21:cd(e,t,n);break;case 22:$i=(s=$i)||n.memoizedState!==null,cd(e,t,n),$i=s;break;default:cd(e,t,n)}}function kW(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{n1(e)}catch(n){wr(t,t.return,n)}}}function _W(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{n1(e)}catch(n){wr(t,t.return,n)}}function Cue(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new EL),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new EL),t;default:throw Error(et(435,e.tag))}}function Yw(e,t){var n=Cue(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var r=Due.bind(null,e,s);s.then(r,r)}})}function Oa(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var r=n[s],i=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 27:if(sm(a.type)){ni=a.stateNode,qa=!1;break e}break;case 5:ni=a.stateNode,qa=!1;break e;case 3:case 4:ni=a.stateNode.containerInfo,qa=!0;break e}a=a.return}if(ni===null)throw Error(et(160));wW(i,o,r),ni=null,qa=!1,i=r.alternate,i!==null&&(i.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)SW(t,e),t=t.sibling}var jc=null;function SW(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Oa(t,e),Ba(e),s&4&&(Mf(3,e,e.return),Cv(3,e),Mf(5,e,e.return));break;case 1:Oa(t,e),Ba(e),s&512&&($i||n===null||Cu(n,n.return)),s&64&&xd&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?s:n.concat(s))));break;case 26:var r=jc;if(Oa(t,e),Ba(e),s&512&&($i||n===null||Cu(n,n.return)),s&4){var i=n!==null?n.memoizedState:null;if(s=e.memoizedState,n===null)if(s===null)if(e.stateNode===null){e:{s=e.type,n=e.memoizedProps,r=r.ownerDocument||r;t:switch(s){case"title":i=r.getElementsByTagName("title")[0],(!i||i[wv]||i[Lo]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=r.createElement(s),r.head.insertBefore(i,r.querySelector("head > title"))),zo(i,s,n),i[Lo]=e,wo(i),s=i;break e;case"link":var o=GL("link","href",r).get(s+(n.href||""));if(o){for(var a=0;a<o.length;a++)if(i=o[a],i.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&i.getAttribute("rel")===(n.rel==null?null:n.rel)&&i.getAttribute("title")===(n.title==null?null:n.title)&&i.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(a,1);break t}}i=r.createElement(s),zo(i,s,n),r.head.appendChild(i);break;case"meta":if(o=GL("meta","content",r).get(s+(n.content||""))){for(a=0;a<o.length;a++)if(i=o[a],i.getAttribute("content")===(n.content==null?null:""+n.content)&&i.getAttribute("name")===(n.name==null?null:n.name)&&i.getAttribute("property")===(n.property==null?null:n.property)&&i.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&i.getAttribute("charset")===(n.charSet==null?null:n.charSet)){o.splice(a,1);break t}}i=r.createElement(s),zo(i,s,n),r.head.appendChild(i);break;default:throw Error(et(468,s))}i[Lo]=e,wo(i),s=i}e.stateNode=s}else KL(r,e.type,e.stateNode);else e.stateNode=WL(r,s,e.memoizedProps);else i!==s?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,s===null?KL(r,e.type,e.stateNode):WL(r,s,e.memoizedProps)):s===null&&e.stateNode!==null&&$T(e,e.memoizedProps,n.memoizedProps)}break;case 27:Oa(t,e),Ba(e),s&512&&($i||n===null||Cu(n,n.return)),n!==null&&s&4&&$T(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Oa(t,e),Ba(e),s&512&&($i||n===null||Cu(n,n.return)),e.flags&32){r=e.stateNode;try{Kg(r,"")}catch(g){wr(e,e.return,g)}}s&4&&e.stateNode!=null&&(r=e.memoizedProps,$T(e,r,n!==null?n.memoizedProps:r)),s&1024&&(FT=!0);break;case 6:if(Oa(t,e),Ba(e),s&4){if(e.stateNode===null)throw Error(et(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(g){wr(e,e.return,g)}}break;case 3:if(D_=null,r=jc,jc=U2(t.containerInfo),Oa(t,e),jc=r,Ba(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{n1(t.containerInfo)}catch(g){wr(e,e.return,g)}FT&&(FT=!1,CW(e));break;case 4:s=jc,jc=U2(e.stateNode.containerInfo),Oa(t,e),Ba(e),jc=s;break;case 12:Oa(t,e),Ba(e);break;case 31:Oa(t,e),Ba(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Yw(e,s)));break;case 13:Oa(t,e),Ba(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(F4=_l()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Yw(e,s)));break;case 22:r=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,u=xd,d=$i;if(xd=u||r,$i=d||c,Oa(t,e),$i=d,xd=u,Ba(e),s&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(n===null||c||xd||$i||Ym(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){c=n=t;try{if(i=c.stateNode,r)o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{a=c.stateNode;var h=c.memoizedProps.style,m=h!=null&&h.hasOwnProperty("display")?h.display:null;a.style.display=m==null||typeof m=="boolean"?"":(""+m).trim()}}catch(g){wr(c,c.return,g)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=r?"":c.memoizedProps}catch(g){wr(c,c.return,g)}}}else if(t.tag===18){if(n===null){c=t;try{var p=c.stateNode;r?FL(p,!0):FL(c.stateNode,!1)}catch(g){wr(c,c.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}s&4&&(s=e.updateQueue,s!==null&&(n=s.retryQueue,n!==null&&(s.retryQueue=null,Yw(e,n))));break;case 19:Oa(t,e),Ba(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Yw(e,s)));break;case 30:break;case 21:break;default:Oa(t,e),Ba(e)}}function Ba(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(bW(s)){n=s;break}s=s.return}if(n==null)throw Error(et(160));switch(n.tag){case 27:var r=n.stateNode,i=zT(e);P2(e,i,r);break;case 5:var o=n.stateNode;n.flags&32&&(Kg(o,""),n.flags&=-33);var a=zT(e);P2(e,a,o);break;case 3:case 4:var c=n.stateNode.containerInfo,u=zT(e);g7(e,u,c);break;default:throw Error(et(161))}}catch(d){wr(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function CW(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;CW(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ud(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)xW(e,t.alternate,t),t=t.sibling}function Ym(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Mf(4,t,t.return),Ym(t);break;case 1:Cu(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&pW(t,t.return,n),Ym(t);break;case 27:Uy(t.stateNode);case 26:case 5:Cu(t,t.return),Ym(t);break;case 22:t.memoizedState===null&&Ym(t);break;case 30:Ym(t);break;default:Ym(t)}e=e.sibling}}function gd(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,r=e,i=t,o=i.flags;switch(i.tag){case 0:case 11:case 15:gd(r,i,n),Cv(4,i);break;case 1:if(gd(r,i,n),s=i,r=s.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(u){wr(s,s.return,u)}if(s=i,r=s.updateQueue,r!==null){var a=s.stateNode;try{var c=r.shared.hiddenCallbacks;if(c!==null)for(r.shared.hiddenCallbacks=null,r=0;r<c.length;r++)kV(c[r],a)}catch(u){wr(s,s.return,u)}}n&&o&64&&mW(i),zy(i,i.return);break;case 27:yW(i);case 26:case 5:gd(r,i,n),n&&s===null&&o&4&&gW(i),zy(i,i.return);break;case 12:gd(r,i,n);break;case 31:gd(r,i,n),n&&o&4&&kW(r,i);break;case 13:gd(r,i,n),n&&o&4&&_W(r,i);break;case 22:i.memoizedState===null&&gd(r,i,n),zy(i,i.return);break;case 30:break;default:gd(r,i,n)}t=t.sibling}}function _N(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&&_v(n))}function SN(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_v(e))}function Cc(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)TW(e,t,n,s),t=t.sibling}function TW(e,t,n,s){var r=t.flags;switch(t.tag){case 0:case 11:case 15:Cc(e,t,n,s),r&2048&&Cv(9,t);break;case 1:Cc(e,t,n,s);break;case 3:Cc(e,t,n,s),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_v(e)));break;case 12:if(r&2048){Cc(e,t,n,s),e=t.stateNode;try{var i=t.memoizedProps,o=i.id,a=i.onPostCommit;typeof a=="function"&&a(o,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){wr(t,t.return,c)}}else Cc(e,t,n,s);break;case 31:Cc(e,t,n,s);break;case 13:Cc(e,t,n,s);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,t.memoizedState!==null?i._visibility&2?Cc(e,t,n,s):Fy(e,t):i._visibility&2?Cc(e,t,n,s):(i._visibility|=2,V0(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),r&2048&&_N(o,t);break;case 24:Cc(e,t,n,s),r&2048&&SN(t.alternate,t);break;default:Cc(e,t,n,s)}}function V0(e,t,n,s,r){for(r=r&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,o=t,a=n,c=s,u=o.flags;switch(o.tag){case 0:case 11:case 15:V0(i,o,a,c,r),Cv(8,o);break;case 23:break;case 22:var d=o.stateNode;o.memoizedState!==null?d._visibility&2?V0(i,o,a,c,r):Fy(i,o):(d._visibility|=2,V0(i,o,a,c,r)),r&&u&2048&&_N(o.alternate,o);break;case 24:V0(i,o,a,c,r),r&&u&2048&&SN(o.alternate,o);break;default:V0(i,o,a,c,r)}t=t.sibling}}function Fy(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,s=t,r=s.flags;switch(s.tag){case 22:Fy(n,s),r&2048&&_N(s.alternate,s);break;case 24:Fy(n,s),r&2048&&SN(s.alternate,s);break;default:Fy(n,s)}t=t.sibling}}var py=8192;function C0(e,t,n){if(e.subtreeFlags&py)for(e=e.child;e!==null;)EW(e,t,n),e=e.sibling}function EW(e,t,n){switch(e.tag){case 26:C0(e,t,n),e.flags&py&&e.memoizedState!==null&&dde(n,jc,e.memoizedState,e.memoizedProps);break;case 5:C0(e,t,n);break;case 3:case 4:var s=jc;jc=U2(e.stateNode.containerInfo),C0(e,t,n),jc=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=py,py=16777216,C0(e,t,n),py=s):C0(e,t,n));break;default:C0(e,t,n)}}function AW(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 zb(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];xo=s,jW(s,e)}AW(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)NW(e),e=e.sibling}function NW(e){switch(e.tag){case 0:case 11:case 15:zb(e),e.flags&2048&&Mf(9,e,e.return);break;case 3:zb(e);break;case 12:zb(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,I_(e)):zb(e);break;default:zb(e)}}function I_(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];xo=s,jW(s,e)}AW(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Mf(8,t,t.return),I_(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,I_(t));break;default:I_(t)}e=e.sibling}}function jW(e,t){for(;xo!==null;){var n=xo;switch(n.tag){case 0:case 11:case 15:Mf(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var s=n.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:_v(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,xo=s;else e:for(n=e;xo!==null;){s=xo;var r=s.sibling,i=s.return;if(vW(s),s===n){xo=null;break e}if(r!==null){r.return=i,xo=r;break e}xo=i}}}var Tue={getCacheForType:function(e){var t=Oo(zi),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Oo(zi).controller.signal}},Eue=typeof WeakMap=="function"?WeakMap:Map,hr=0,Dr=null,Is=null,Fs=0,vr=0,pl=null,ef=!1,L1=!1,CN=!1,Xd=0,ki=0,If=0,vp=0,TN=0,vl=0,Jg=0,Hy=null,Ua=null,b7=!1,F4=0,MW=0,O2=1/0,B2=null,xf=null,no=0,vf=null,Zg=null,Rd=0,y7=0,x7=null,IW=null,qy=0,v7=null;function Tl(){return hr&2&&Fs!==0?Fs&-Fs:Xn.T!==null?AN():FU()}function RW(){if(vl===0)if(!(Fs&536870912)||Ys){var e=Fw;Fw<<=1,!(Fw&3932160)&&(Fw=262144),vl=e}else vl=536870912;return e=Ml.current,e!==null&&(e.flags|=32),vl}function el(e,t,n){(e===Dr&&(vr===2||vr===9)||e.cancelPendingCommit!==null)&&(e1(e,0),tf(e,Fs,vl,!1)),vv(e,n),(!(hr&2)||e!==Dr)&&(e===Dr&&(!(hr&2)&&(vp|=n),ki===4&&tf(e,Fs,vl,!1)),Fu(e))}function DW(e,t,n){if(hr&6)throw Error(et(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||xv(e,t),r=s?jue(e,t):HT(e,t,!0),i=s;do{if(r===0){L1&&!s&&tf(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!Aue(n)){r=HT(e,t,!1),i=!1;continue}if(r===2){if(i=t,e.errorRecoveryDisabledLanes&i)var o=0;else o=e.pendingLanes&-536870913,o=o!==0?o:o&536870912?536870912:0;if(o!==0){t=o;e:{var a=e;r=Hy;var c=a.current.memoizedState.isDehydrated;if(c&&(e1(a,o).flags|=256),o=HT(a,o,!1),o!==2){if(CN&&!c){a.errorRecoveryDisabledLanes|=i,vp|=i,r=4;break e}i=Ua,Ua=r,i!==null&&(Ua===null?Ua=i:Ua.push.apply(Ua,i))}r=o}if(i=!1,r!==2)continue}}if(r===1){e1(e,0),tf(e,t,0,!0);break}e:{switch(s=e,i=r,i){case 0:case 1:throw Error(et(345));case 4:if((t&4194048)!==t)break;case 6:tf(s,t,vl,!ef);break e;case 2:Ua=null;break;case 3:case 5:break;default:throw Error(et(329))}if((t&62914560)===t&&(r=F4+300-_l(),10<r)){if(tf(s,t,vl,!ef),j4(s,0,!0)!==0)break e;Rd=t,s.timeoutHandle=eG(AL.bind(null,s,n,Ua,B2,b7,t,vl,vp,Jg,ef,i,"Throttled",-0,0),r);break e}AL(s,n,Ua,B2,b7,t,vl,vp,Jg,ef,i,null,-0,0)}}break}while(!0);Fu(e)}function AL(e,t,n,s,r,i,o,a,c,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:Sd},EW(t,i,h);var g=(i&62914560)===i?F4-_l():(i&4194048)===i?MW-_l():0;if(g=hde(h,g),g!==null){Rd=i,e.cancelPendingCommit=g(jL.bind(null,e,t,i,n,s,r,o,a,c,d,h,null,m,p)),tf(e,i,o,!u);return}}jL(e,t,i,n,s,r,o,a,c)}function Aue(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var s=0;s<n.length;s++){var r=n[s],i=r.getSnapshot;r=r.value;try{if(!jl(i(),r))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function tf(e,t,n,s){t&=~TN,t&=~vp,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var r=t;0<r;){var i=31-Cl(r),o=1<<i;s[i]=-1,r&=~o}n!==0&&BU(e,n,t)}function H4(){return hr&6?!0:(Tv(0),!1)}function EN(){if(Is!==null){if(vr===0)var e=Is.return;else e=Is,Cd=Zp=null,hN(e),Cg=null,yx=0,e=Is;for(;e!==null;)fW(e.alternate,e),e=e.return;Is=null}}function e1(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Kue(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Rd=0,EN(),Dr=e,Is=n=Md(e.current,null),Fs=t,vr=0,pl=null,ef=!1,L1=xv(e,t),CN=!1,Jg=vl=TN=vp=If=ki=0,Ua=Hy=null,b7=!1,t&8&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var r=31-Cl(s),i=1<<r;t|=e[r],s&=~i}return Xd=t,D4(),n}function LW(e,t){ds=null,Xn.H=vx,t===D1||t===P4?(t=oL(),vr=3):t===iN?(t=oL(),vr=4):vr=t===wN?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,pl=t,Is===null&&(ki=1,D2(e,lc(t,e.current)))}function PW(){var e=Ml.current;return e===null?!0:(Fs&4194048)===Fs?mc===null:(Fs&62914560)===Fs||Fs&536870912?e===mc:!1}function OW(){var e=Xn.H;return Xn.H=vx,e===null?vx:e}function BW(){var e=Xn.A;return Xn.A=Tue,e}function $2(){ki=4,ef||(Fs&4194048)!==Fs&&Ml.current!==null||(L1=!0),!(If&134217727)&&!(vp&134217727)||Dr===null||tf(Dr,Fs,vl,!1)}function HT(e,t,n){var s=hr;hr|=2;var r=OW(),i=BW();(Dr!==e||Fs!==t)&&(B2=null,e1(e,t)),t=!1;var o=ki;e:do try{if(vr!==0&&Is!==null){var a=Is,c=pl;switch(vr){case 8:EN(),o=6;break e;case 3:case 2:case 9:case 6:Ml.current===null&&(t=!0);var u=vr;if(vr=0,pl=null,dg(e,a,c,u),n&&L1){o=0;break e}break;default:u=vr,vr=0,pl=null,dg(e,a,c,u)}}Nue(),o=ki;break}catch(d){LW(e,d)}while(!0);return t&&e.shellSuspendCounter++,Cd=Zp=null,hr=s,Xn.H=r,Xn.A=i,Is===null&&(Dr=null,Fs=0,D4()),o}function Nue(){for(;Is!==null;)$W(Is)}function jue(e,t){var n=hr;hr|=2;var s=OW(),r=BW();Dr!==e||Fs!==t?(B2=null,O2=_l()+500,e1(e,t)):L1=xv(e,t);e:do try{if(vr!==0&&Is!==null){t=Is;var i=pl;t:switch(vr){case 1:vr=0,pl=null,dg(e,t,i,1);break;case 2:case 9:if(iL(i)){vr=0,pl=null,NL(t);break}t=function(){vr!==2&&vr!==9||Dr!==e||(vr=7),Fu(e)},i.then(t,t);break e;case 3:vr=7;break e;case 4:vr=5;break e;case 7:iL(i)?(vr=0,pl=null,NL(t)):(vr=0,pl=null,dg(e,t,i,7));break;case 5:var o=null;switch(Is.tag){case 26:o=Is.memoizedState;case 5:case 27:var a=Is;if(o?iG(o):a.stateNode.complete){vr=0,pl=null;var c=a.sibling;if(c!==null)Is=c;else{var u=a.return;u!==null?(Is=u,q4(u)):Is=null}break t}}vr=0,pl=null,dg(e,t,i,5);break;case 6:vr=0,pl=null,dg(e,t,i,6);break;case 8:EN(),ki=6;break e;default:throw Error(et(462))}}Mue();break}catch(d){LW(e,d)}while(!0);return Cd=Zp=null,Xn.H=s,Xn.A=r,hr=n,Is!==null?0:(Dr=null,Fs=0,D4(),ki)}function Mue(){for(;Is!==null&&!ece();)$W(Is)}function $W(e){var t=hW(e.alternate,e,Xd);e.memoizedProps=e.pendingProps,t===null?q4(e):Is=t}function NL(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=kL(n,t,t.pendingProps,t.type,void 0,Fs);break;case 11:t=kL(n,t,t.pendingProps,t.type.render,t.ref,Fs);break;case 5:hN(t);default:fW(n,t),t=Is=fV(t,Xd),t=hW(n,t,Xd)}e.memoizedProps=e.pendingProps,t===null?q4(e):Is=t}function dg(e,t,n,s){Cd=Zp=null,hN(t),Cg=null,yx=0;var r=t.return;try{if(xue(e,r,t,n,Fs)){ki=1,D2(e,lc(n,e.current)),Is=null;return}}catch(i){if(r!==null)throw Is=r,i;ki=1,D2(e,lc(n,e.current)),Is=null;return}t.flags&32768?(Ys||s===1?e=!0:L1||Fs&536870912?e=!1:(ef=e=!0,(s===2||s===9||s===3||s===6)&&(s=Ml.current,s!==null&&s.tag===13&&(s.flags|=16384))),zW(t,e)):q4(t)}function q4(e){var t=e;do{if(t.flags&32768){zW(t,ef);return}e=t.return;var n=kue(t.alternate,t,Xd);if(n!==null){Is=n;return}if(t=t.sibling,t!==null){Is=t;return}Is=t=e}while(t!==null);ki===0&&(ki=5)}function zW(e,t){do{var n=_ue(e.alternate,e);if(n!==null){n.flags&=32767,Is=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Is=e;return}Is=e=n}while(e!==null);ki=6,Is=null}function jL(e,t,n,s,r,i,o,a,c){e.cancelPendingCommit=null;do U4();while(no!==0);if(hr&6)throw Error(et(327));if(t!==null){if(t===e.current)throw Error(et(177));if(i=t.lanes|t.childLanes,i|=J9,uce(e,n,i,o,a,c),e===Dr&&(Is=Dr=null,Fs=0),Zg=t,vf=e,Rd=n,y7=i,x7=r,IW=s,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Lue(_2,function(){return VW(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,t.subtreeFlags&13878||s){s=Xn.T,Xn.T=null,r=mr.p,mr.p=2,o=hr,hr|=4;try{Sue(e,t,n)}finally{hr=o,mr.p=r,Xn.T=s}}no=1,FW(),HW(),qW()}}function FW(){if(no===1){no=0;var e=vf,t=Zg,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=Xn.T,Xn.T=null;var s=mr.p;mr.p=2;var r=hr;hr|=4;try{SW(t,e);var i=S7,o=iV(e.containerInfo),a=i.focusedElem,c=i.selectionRange;if(o!==a&&a&&a.ownerDocument&&rV(a.ownerDocument.documentElement,a)){if(c!==null&&Q9(a)){var u=c.start,d=c.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(c.start,g),v=c.end===void 0?b:Math.min(c.end,g);!p.extend&&b>v&&(o=v,v=b,b=o);var x=JD(a,b),y=JD(a,v);if(x&&y&&(p.rangeCount!==1||p.anchorNode!==x.node||p.anchorOffset!==x.offset||p.focusNode!==y.node||p.focusOffset!==y.offset)){var w=h.createRange();w.setStart(x.node,x.offset),p.removeAllRanges(),b>v?(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}}G2=!!_7,S7=_7=null}finally{hr=r,mr.p=s,Xn.T=n}}e.current=t,no=2}}function HW(){if(no===2){no=0;var e=vf,t=Zg,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=Xn.T,Xn.T=null;var s=mr.p;mr.p=2;var r=hr;hr|=4;try{xW(e,t.alternate,t)}finally{hr=r,mr.p=s,Xn.T=n}}no=3}}function qW(){if(no===4||no===3){no=0,tce();var e=vf,t=Zg,n=Rd,s=IW;t.subtreeFlags&10256||t.flags&10256?no=5:(no=0,Zg=vf=null,UW(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(xf=null),U9(n),t=t.stateNode,Sl&&typeof Sl.onCommitFiberRoot=="function")try{Sl.onCommitFiberRoot(yv,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=Xn.T,r=mr.p,mr.p=2,Xn.T=null;try{for(var i=e.onRecoverableError,o=0;o<s.length;o++){var a=s[o];i(a.value,{componentStack:a.stack})}}finally{Xn.T=t,mr.p=r}}Rd&3&&U4(),Fu(e),r=e.pendingLanes,n&261930&&r&42?e===v7?qy++:(qy=0,v7=e):qy=0,Tv(0)}}function UW(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,_v(t)))}function U4(){return FW(),HW(),qW(),VW()}function VW(){if(no!==5)return!1;var e=vf,t=y7;y7=0;var n=U9(Rd),s=Xn.T,r=mr.p;try{mr.p=32>n?32:n,Xn.T=null,n=x7,x7=null;var i=vf,o=Rd;if(no=0,Zg=vf=null,Rd=0,hr&6)throw Error(et(331));var a=hr;if(hr|=4,NW(i.current),TW(i,i.current,o,n),hr=a,Tv(0,!1),Sl&&typeof Sl.onPostCommitFiberRoot=="function")try{Sl.onPostCommitFiberRoot(yv,i)}catch{}return!0}finally{mr.p=r,Xn.T=s,UW(e,t)}}function ML(e,t,n){t=lc(n,t),t=f7(e.stateNode,t,2),e=yf(e,t,2),e!==null&&(vv(e,2),Fu(e))}function wr(e,t,n){if(e.tag===3)ML(e,e,n);else for(;t!==null;){if(t.tag===3){ML(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(xf===null||!xf.has(s))){e=lc(n,e),n=oW(2),s=yf(t,n,2),s!==null&&(aW(n,s,t,e),vv(s,2),Fu(s));break}}t=t.return}}function qT(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new Eue;var r=new Set;s.set(t,r)}else r=s.get(t),r===void 0&&(r=new Set,s.set(t,r));r.has(n)||(CN=!0,r.add(n),e=Iue.bind(null,e,t,n),t.then(e,e))}function Iue(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Dr===e&&(Fs&n)===n&&(ki===4||ki===3&&(Fs&62914560)===Fs&&300>_l()-F4?!(hr&2)&&e1(e,0):TN|=n,Jg===Fs&&(Jg=0)),Fu(e)}function WW(e,t){t===0&&(t=OU()),e=Jp(e,t),e!==null&&(vv(e,t),Fu(e))}function Rue(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),WW(e,n)}function Due(e,t){var n=0;switch(e.tag){case 31:case 13:var s=e.stateNode,r=e.memoizedState;r!==null&&(n=r.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(et(314))}s!==null&&s.delete(t),WW(e,n)}function Lue(e,t){return H9(e,t)}var z2=null,W0=null,w7=!1,F2=!1,UT=!1,nf=0;function Fu(e){e!==W0&&e.next===null&&(W0===null?z2=W0=e:W0=W0.next=e),F2=!0,w7||(w7=!0,Oue())}function Tv(e,t){if(!UT&&F2){UT=!0;do for(var n=!1,s=z2;s!==null;){if(e!==0){var r=s.pendingLanes;if(r===0)var i=0;else{var o=s.suspendedLanes,a=s.pingedLanes;i=(1<<31-Cl(42|e)+1)-1,i&=r&~(o&~a),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,IL(s,i))}else i=Fs,i=j4(s,s===Dr?i:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),!(i&3)||xv(s,i)||(n=!0,IL(s,i));s=s.next}while(n);UT=!1}}function Pue(){GW()}function GW(){F2=w7=!1;var e=0;nf!==0&&Gue()&&(e=nf);for(var t=_l(),n=null,s=z2;s!==null;){var r=s.next,i=KW(s,t);i===0?(s.next=null,n===null?z2=r:n.next=r,r===null&&(W0=n)):(n=s,(e!==0||i&3)&&(F2=!0)),s=r}no!==0&&no!==5||Tv(e),nf!==0&&(nf=0)}function KW(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,r=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var o=31-Cl(i),a=1<<o,c=r[o];c===-1?(!(a&n)||a&s)&&(r[o]=cce(a,t)):c<=t&&(e.expiredLanes|=a),i&=~a}if(t=Dr,n=Fs,n=j4(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(vr===2||vr===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&yT(s),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||xv(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&yT(s),U9(n)){case 2:case 8:n=LU;break;case 32:n=_2;break;case 268435456:n=PU;break;default:n=_2}return s=YW.bind(null,e),n=H9(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&yT(s),e.callbackPriority=2,e.callbackNode=null,2}function YW(e,t){if(no!==0&&no!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(U4()&&e.callbackNode!==n)return null;var s=Fs;return s=j4(e,e===Dr?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(DW(e,s,t),KW(e,_l()),e.callbackNode!=null&&e.callbackNode===n?YW.bind(null,e):null)}function IL(e,t){if(U4())return null;DW(e,t,!0)}function Oue(){Yue(function(){hr&6?H9(DU,Pue):GW()})}function AN(){if(nf===0){var e=Yg;e===0&&(e=zw,zw<<=1,!(zw&261888)&&(zw=256)),nf=e}return nf}function RL(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:__(""+e)}function DL(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 Bue(e,t,n,s,r){if(t==="submit"&&n&&n.stateNode===r){var i=RL((r[sl]||null).action),o=s.submitter;o&&(t=(t=o[sl]||null)?RL(t.formAction):o.getAttribute("formAction"),t!==null&&(i=t,o=null));var a=new M4("action","action",null,s,r);e.push({event:a,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(nf!==0){var c=o?DL(r,o):new FormData(r);d7(n,{pending:!0,data:c,method:r.method,action:i},null,c)}}else typeof i=="function"&&(a.preventDefault(),c=o?DL(r,o):new FormData(r),d7(n,{pending:!0,data:c,method:r.method,action:i},i,c))},currentTarget:r}]})}}for(var VT=0;VT<Z8.length;VT++){var WT=Z8[VT],$ue=WT.toLowerCase(),zue=WT[0].toUpperCase()+WT.slice(1);Bc($ue,"on"+zue)}Bc(aV,"onAnimationEnd");Bc(lV,"onAnimationIteration");Bc(cV,"onAnimationStart");Bc("dblclick","onDoubleClick");Bc("focusin","onFocus");Bc("focusout","onBlur");Bc(nue,"onTransitionRun");Bc(sue,"onTransitionStart");Bc(rue,"onTransitionCancel");Bc(uV,"onTransitionEnd");Gg("onMouseEnter",["mouseout","mouseover"]);Gg("onMouseLeave",["mouseout","mouseover"]);Gg("onPointerEnter",["pointerout","pointerover"]);Gg("onPointerLeave",["pointerout","pointerover"]);Yp("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Yp("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Yp("onBeforeInput",["compositionend","keypress","textInput","paste"]);Yp("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Yp("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Yp("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wx="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(" "),Fue=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(wx));function XW(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],r=s.event;s=s.listeners;e:{var i=void 0;if(t)for(var o=s.length-1;0<=o;o--){var a=s[o],c=a.instance,u=a.currentTarget;if(a=a.listener,c!==i&&r.isPropagationStopped())break e;i=a,r.currentTarget=u;try{i(r)}catch(d){C2(d)}r.currentTarget=null,i=c}else for(o=0;o<s.length;o++){if(a=s[o],c=a.instance,u=a.currentTarget,a=a.listener,c!==i&&r.isPropagationStopped())break e;i=a,r.currentTarget=u;try{i(r)}catch(d){C2(d)}r.currentTarget=null,i=c}}}}function Ms(e,t){var n=t[V8];n===void 0&&(n=t[V8]=new Set);var s=e+"__bubble";n.has(s)||(QW(t,e,2,!1),n.add(s))}function GT(e,t,n){var s=0;t&&(s|=4),QW(n,e,s,t)}var Xw="_reactListening"+Math.random().toString(36).slice(2);function NN(e){if(!e[Xw]){e[Xw]=!0,HU.forEach(function(n){n!=="selectionchange"&&(Fue.has(n)||GT(n,!1,e),GT(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Xw]||(t[Xw]=!0,GT("selectionchange",!1,t))}}function QW(e,t,n,s){switch(uG(t)){case 2:var r=pde;break;case 8:r=gde;break;default:r=RN}n=r.bind(null,t,n,e),r=void 0,!X8||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),s?r!==void 0?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):r!==void 0?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function KT(e,t,n,s,r){var i=s;if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var o=s.tag;if(o===3||o===4){var a=s.stateNode.containerInfo;if(a===r)break;if(o===4)for(o=s.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===r)return;o=o.return}for(;a!==null;){if(o=ng(a),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){s=i=o;continue e}a=a.parentNode}}s=s.return}XU(function(){var u=i,d=G9(n),h=[];e:{var m=dV.get(e);if(m!==void 0){var p=M4,g=e;switch(e){case"keypress":if(C_(n)===0)break e;case"keydown":case"keyup":p=Dce;break;case"focusin":g="focus",p=_T;break;case"focusout":g="blur",p=_T;break;case"beforeblur":case"afterblur":p=_T;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=HD;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=kce;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Oce;break;case aV:case lV:case cV:p=Cce;break;case uV:p=$ce;break;case"scroll":case"scrollend":p=vce;break;case"wheel":p=Fce;break;case"copy":case"cut":case"paste":p=Ece;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=UD;break;case"toggle":case"beforetoggle":p=qce}var b=(t&4)!==0,v=!b&&(e==="scroll"||e==="scrollend"),x=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||x===null||(k=fx(y,x),k!=null&&b.push(kx(y,k,w))),v)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!==Y8&&(g=n.relatedTarget||n.fromElement)&&(ng(g)||g[M1]))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?ng(g):null,g!==null&&(v=bv(g),b=g.tag,g!==v||b!==5&&b!==27&&b!==6)&&(g=null)):(p=null,g=u),p!==g)){if(b=HD,k="onMouseLeave",x="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(b=UD,k="onPointerLeave",x="onPointerEnter",y="pointer"),v=p==null?m:fy(p),w=g==null?m:fy(g),m=new b(k,y+"leave",p,n,d),m.target=v,m.relatedTarget=w,k=null,ng(d)===u&&(b=new b(x,y+"enter",g,n,d),b.target=w,b.relatedTarget=v,k=b),v=k,p&&g)t:{for(b=Hue,x=p,y=g,w=0,k=x;k;k=b(k))w++;k=0;for(var T=y;T;T=b(T))k++;for(;0<w-k;)x=b(x),w--;for(;0<k-w;)y=b(y),k--;for(;w--;){if(x===y||y!==null&&x===y.alternate){b=x;break t}x=b(x),y=b(y)}b=null}else b=null;p!==null&&LL(h,m,p,b,!1),g!==null&&v!==null&&LL(h,v,g,b,!0)}}e:{if(m=u?fy(u):window,p=m.nodeName&&m.nodeName.toLowerCase(),p==="select"||p==="input"&&m.type==="file")var _=KD;else if(GD(m))if(nV)_=Zce;else{_=Qce;var C=Xce}else p=m.nodeName,!p||p.toLowerCase()!=="input"||m.type!=="checkbox"&&m.type!=="radio"?u&&W9(u.elementType)&&(_=KD):_=Jce;if(_&&(_=_(e,u))){tV(h,_,n,d);break e}C&&C(e,m,u),e==="focusout"&&u&&m.type==="number"&&u.memoizedProps.value!=null&&K8(m,"number",m.value)}switch(C=u?fy(u):window,e){case"focusin":(GD(C)||C.contentEditable==="true")&&(ig=C,Q8=u,Dy=null);break;case"focusout":Dy=Q8=ig=null;break;case"mousedown":J8=!0;break;case"contextmenu":case"mouseup":case"dragend":J8=!1,ZD(h,n,d);break;case"selectionchange":if(tue)break;case"keydown":case"keyup":ZD(h,n,d)}var S;if(X9)e:{switch(e){case"compositionstart":var L="onCompositionStart";break e;case"compositionend":L="onCompositionEnd";break e;case"compositionupdate":L="onCompositionUpdate";break e}L=void 0}else rg?ZU(e,n)&&(L="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(L="onCompositionStart");L&&(JU&&n.locale!=="ko"&&(rg||L!=="onCompositionStart"?L==="onCompositionEnd"&&rg&&(S=QU()):(Zh=d,K9="value"in Zh?Zh.value:Zh.textContent,rg=!0)),C=H2(u,L),0<C.length&&(L=new qD(L,e,null,n,d),h.push({event:L,listeners:C}),S?L.data=S:(S=eV(n),S!==null&&(L.data=S)))),(S=Vce?Wce(e,n):Gce(e,n))&&(L=H2(u,"onBeforeInput"),0<L.length&&(C=new qD("onBeforeInput","beforeinput",null,n,d),h.push({event:C,listeners:L}),C.data=S)),Bue(h,e,u,n,d)}XW(h,t)})}function kx(e,t,n){return{instance:e,listener:t,currentTarget:n}}function H2(e,t){for(var n=t+"Capture",s=[];e!==null;){var r=e,i=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||i===null||(r=fx(e,n),r!=null&&s.unshift(kx(e,r,i)),r=fx(e,t),r!=null&&s.push(kx(e,r,i))),e.tag===3)return s;e=e.return}return[]}function Hue(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function LL(e,t,n,s,r){for(var i=t._reactName,o=[];n!==null&&n!==s;){var a=n,c=a.alternate,u=a.stateNode;if(a=a.tag,c!==null&&c===s)break;a!==5&&a!==26&&a!==27||u===null||(c=u,r?(u=fx(n,i),u!=null&&o.unshift(kx(n,u,c))):r||(u=fx(n,i),u!=null&&o.push(kx(n,u,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var que=/\r\n?/g,Uue=/\u0000|\uFFFD/g;function PL(e){return(typeof e=="string"?e:""+e).replace(que,`
`).replace(Uue,"")}function JW(e,t){return t=PL(t),PL(e)===t}function Sr(e,t,n,s,r,i){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||Kg(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&Kg(e,""+s);break;case"className":qw(e,"class",s);break;case"tabIndex":qw(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":qw(e,n,s);break;case"style":YU(e,s,i);break;case"data":if(t!=="object"){qw(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=__(""+s),e.setAttribute(n,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof i=="function"&&(n==="formAction"?(t!=="input"&&Sr(e,t,"name",r.name,r,null),Sr(e,t,"formEncType",r.formEncType,r,null),Sr(e,t,"formMethod",r.formMethod,r,null),Sr(e,t,"formTarget",r.formTarget,r,null)):(Sr(e,t,"encType",r.encType,r,null),Sr(e,t,"method",r.method,r,null),Sr(e,t,"target",r.target,r,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=__(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=Sd);break;case"onScroll":s!=null&&Ms("scroll",e);break;case"onScrollEnd":s!=null&&Ms("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(et(61));if(n=s.__html,n!=null){if(r.children!=null)throw Error(et(60));e.innerHTML=n}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}n=__(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""+s):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":s===!0?e.setAttribute(n,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,s):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(n,s):e.removeAttribute(n);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(n):e.setAttribute(n,s);break;case"popover":Ms("beforetoggle",e),Ms("toggle",e),k_(e,"popover",s);break;case"xlinkActuate":ad(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":ad(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":ad(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":ad(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":ad(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":ad(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":ad(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":ad(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":ad(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":k_(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=yce.get(n)||n,k_(e,n,s))}}function k7(e,t,n,s,r,i){switch(n){case"style":YU(e,s,i);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(et(61));if(n=s.__html,n!=null){if(r.children!=null)throw Error(et(60));e.innerHTML=n}}break;case"children":typeof s=="string"?Kg(e,s):(typeof s=="number"||typeof s=="bigint")&&Kg(e,""+s);break;case"onScroll":s!=null&&Ms("scroll",e);break;case"onScrollEnd":s!=null&&Ms("scrollend",e);break;case"onClick":s!=null&&(e.onclick=Sd);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!qU.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(r=n.endsWith("Capture"),t=n.slice(2,r?n.length-7:void 0),i=e[sl]||null,i=i!=null?i[n]:null,typeof i=="function"&&e.removeEventListener(t,i,r),typeof s=="function")){typeof i!="function"&&i!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,s,r);break e}n in e?e[n]=s:s===!0?e.setAttribute(n,""):k_(e,n,s)}}}function zo(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ms("error",e),Ms("load",e);var s=!1,r=!1,i;for(i in n)if(n.hasOwnProperty(i)){var o=n[i];if(o!=null)switch(i){case"src":s=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(et(137,t));default:Sr(e,t,i,o,n,null)}}r&&Sr(e,t,"srcSet",n.srcSet,n,null),s&&Sr(e,t,"src",n.src,n,null);return;case"input":Ms("invalid",e);var a=i=o=r=null,c=null,u=null;for(s in n)if(n.hasOwnProperty(s)){var d=n[s];if(d!=null)switch(s){case"name":r=d;break;case"type":o=d;break;case"checked":c=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(et(137,t));break;default:Sr(e,t,s,d,n,null)}}WU(e,i,a,c,u,o,r,!1);return;case"select":Ms("invalid",e),s=o=i=null;for(r in n)if(n.hasOwnProperty(r)&&(a=n[r],a!=null))switch(r){case"value":i=a;break;case"defaultValue":o=a;break;case"multiple":s=a;default:Sr(e,t,r,a,n,null)}t=i,n=o,e.multiple=!!s,t!=null?kg(e,!!s,t,!1):n!=null&&kg(e,!!s,n,!0);return;case"textarea":Ms("invalid",e),i=r=s=null;for(o in n)if(n.hasOwnProperty(o)&&(a=n[o],a!=null))switch(o){case"value":s=a;break;case"defaultValue":r=a;break;case"children":i=a;break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(et(91));break;default:Sr(e,t,o,a,n,null)}KU(e,s,r,i);return;case"option":for(c in n)if(n.hasOwnProperty(c)&&(s=n[c],s!=null))switch(c){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:Sr(e,t,c,s,n,null)}return;case"dialog":Ms("beforetoggle",e),Ms("toggle",e),Ms("cancel",e),Ms("close",e);break;case"iframe":case"object":Ms("load",e);break;case"video":case"audio":for(s=0;s<wx.length;s++)Ms(wx[s],e);break;case"image":Ms("error",e),Ms("load",e);break;case"details":Ms("toggle",e);break;case"embed":case"source":case"link":Ms("error",e),Ms("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)&&(s=n[u],s!=null))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(et(137,t));default:Sr(e,t,u,s,n,null)}return;default:if(W9(t)){for(d in n)n.hasOwnProperty(d)&&(s=n[d],s!==void 0&&k7(e,t,d,s,n,void 0));return}}for(a in n)n.hasOwnProperty(a)&&(s=n[a],s!=null&&Sr(e,t,a,s,n,null))}function Vue(e,t,n,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,i=null,o=null,a=null,c=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":c=h;default:s.hasOwnProperty(p)||Sr(e,t,p,null,s,h)}}for(var m in s){var p=s[m];if(h=n[m],s.hasOwnProperty(m)&&(p!=null||h!=null))switch(m){case"type":i=p;break;case"name":r=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(et(137,t));break;default:p!==h&&Sr(e,t,m,p,s,h)}}G8(e,o,a,c,u,d,i,r);return;case"select":p=o=a=m=null;for(i in n)if(c=n[i],n.hasOwnProperty(i)&&c!=null)switch(i){case"value":break;case"multiple":p=c;default:s.hasOwnProperty(i)||Sr(e,t,i,null,s,c)}for(r in s)if(i=s[r],c=n[r],s.hasOwnProperty(r)&&(i!=null||c!=null))switch(r){case"value":m=i;break;case"defaultValue":a=i;break;case"multiple":o=i;default:i!==c&&Sr(e,t,r,i,s,c)}t=a,n=o,s=p,m!=null?kg(e,!!n,m,!1):!!s!=!!n&&(t!=null?kg(e,!!n,t,!0):kg(e,!!n,n?[]:"",!1));return;case"textarea":p=m=null;for(a in n)if(r=n[a],n.hasOwnProperty(a)&&r!=null&&!s.hasOwnProperty(a))switch(a){case"value":break;case"children":break;default:Sr(e,t,a,null,s,r)}for(o in s)if(r=s[o],i=n[o],s.hasOwnProperty(o)&&(r!=null||i!=null))switch(o){case"value":m=r;break;case"defaultValue":p=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(et(91));break;default:r!==i&&Sr(e,t,o,r,s,i)}GU(e,m,p);return;case"option":for(var g in n)if(m=n[g],n.hasOwnProperty(g)&&m!=null&&!s.hasOwnProperty(g))switch(g){case"selected":e.selected=!1;break;default:Sr(e,t,g,null,s,m)}for(c in s)if(m=s[c],p=n[c],s.hasOwnProperty(c)&&m!==p&&(m!=null||p!=null))switch(c){case"selected":e.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:Sr(e,t,c,m,s,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&&!s.hasOwnProperty(b)&&Sr(e,t,b,null,s,m);for(u in s)if(m=s[u],p=n[u],s.hasOwnProperty(u)&&m!==p&&(m!=null||p!=null))switch(u){case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(et(137,t));break;default:Sr(e,t,u,m,s,p)}return;default:if(W9(t)){for(var v in n)m=n[v],n.hasOwnProperty(v)&&m!==void 0&&!s.hasOwnProperty(v)&&k7(e,t,v,void 0,s,m);for(d in s)m=s[d],p=n[d],!s.hasOwnProperty(d)||m===p||m===void 0&&p===void 0||k7(e,t,d,m,s,p);return}}for(var x in n)m=n[x],n.hasOwnProperty(x)&&m!=null&&!s.hasOwnProperty(x)&&Sr(e,t,x,null,s,m);for(h in s)m=s[h],p=n[h],!s.hasOwnProperty(h)||m===p||m==null&&p==null||Sr(e,t,h,m,s,p)}function OL(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Wue(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),s=0;s<n.length;s++){var r=n[s],i=r.transferSize,o=r.initiatorType,a=r.duration;if(i&&a&&OL(o)){for(o=0,a=r.responseEnd,s+=1;s<n.length;s++){var c=n[s],u=c.startTime;if(u>a)break;var d=c.transferSize,h=c.initiatorType;d&&OL(h)&&(c=c.responseEnd,o+=d*(c<a?1:(a-u)/(c-u)))}if(--s,t+=8*(i+o)/(r.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var _7=null,S7=null;function q2(e){return e.nodeType===9?e:e.ownerDocument}function BL(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 ZW(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 C7(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 YT=null;function Gue(){var e=window.event;return e&&e.type==="popstate"?e===YT?!1:(YT=e,!0):(YT=null,!1)}var eG=typeof setTimeout=="function"?setTimeout:void 0,Kue=typeof clearTimeout=="function"?clearTimeout:void 0,$L=typeof Promise=="function"?Promise:void 0,Yue=typeof queueMicrotask=="function"?queueMicrotask:typeof $L<"u"?function(e){return $L.resolve(null).then(e).catch(Xue)}:eG;function Xue(e){setTimeout(function(){throw e})}function sm(e){return e==="head"}function zL(e,t){var n=t,s=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"||n==="/&"){if(s===0){e.removeChild(r),n1(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")Uy(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Uy(n);for(var i=n.firstChild;i;){var o=i.nextSibling,a=i.nodeName;i[wv]||a==="SCRIPT"||a==="STYLE"||a==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}else n==="body"&&Uy(e.ownerDocument.body);n=r}while(n);n1(t)}function FL(e,t){var n=e;e=0;do{var s=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=s}while(n)}function T7(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":T7(n),V9(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Que(e,t,n,s){for(;e.nodeType===1;){var r=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[wv])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(i=e.getAttribute("rel"),i==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(i!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=pc(e.nextSibling),e===null)break}return null}function Jue(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=pc(e.nextSibling),e===null))return null;return e}function tG(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=pc(e.nextSibling),e===null))return null;return e}function E7(e){return e.data==="$?"||e.data==="$~"}function A7(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Zue(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var s=function(){t(),n.removeEventListener("DOMContentLoaded",s)};n.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function pc(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 N7=null;function HL(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return pc(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function qL(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 nG(e,t,n){switch(t=q2(n),e){case"html":if(e=t.documentElement,!e)throw Error(et(452));return e;case"head":if(e=t.head,!e)throw Error(et(453));return e;case"body":if(e=t.body,!e)throw Error(et(454));return e;default:throw Error(et(451))}}function Uy(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);V9(e)}var bc=new Map,UL=new Set;function U2(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ih=mr.d;mr.d={f:ede,r:tde,D:nde,C:sde,L:rde,m:ide,X:ade,S:ode,M:lde};function ede(){var e=ih.f(),t=H4();return e||t}function tde(e){var t=I1(e);t!==null&&t.tag===5&&t.type==="form"?YV(t):ih.r(e)}var P1=typeof document>"u"?null:document;function sG(e,t,n){var s=P1;if(s&&typeof t=="string"&&t){var r=ac(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n=="string"&&(r+='[crossorigin="'+n+'"]'),UL.has(r)||(UL.add(r),e={rel:e,crossOrigin:n,href:t},s.querySelector(r)===null&&(t=s.createElement("link"),zo(t,"link",e),wo(t),s.head.appendChild(t)))}}function nde(e){ih.D(e),sG("dns-prefetch",e,null)}function sde(e,t){ih.C(e,t),sG("preconnect",e,t)}function rde(e,t,n){ih.L(e,t,n);var s=P1;if(s&&e&&t){var r='link[rel="preload"][as="'+ac(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+ac(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+ac(n.imageSizes)+'"]')):r+='[href="'+ac(e)+'"]';var i=r;switch(t){case"style":i=t1(e);break;case"script":i=O1(e)}bc.has(i)||(e=Qr({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),bc.set(i,e),s.querySelector(r)!==null||t==="style"&&s.querySelector(Ev(i))||t==="script"&&s.querySelector(Av(i))||(t=s.createElement("link"),zo(t,"link",e),wo(t),s.head.appendChild(t)))}}function ide(e,t){ih.m(e,t);var n=P1;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+ac(s)+'"][href="'+ac(e)+'"]',i=r;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=O1(e)}if(!bc.has(i)&&(e=Qr({rel:"modulepreload",href:e},t),bc.set(i,e),n.querySelector(r)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Av(i)))return}s=n.createElement("link"),zo(s,"link",e),wo(s),n.head.appendChild(s)}}}function ode(e,t,n){ih.S(e,t,n);var s=P1;if(s&&e){var r=wg(s).hoistableStyles,i=t1(e);t=t||"default";var o=r.get(i);if(!o){var a={loading:0,preload:null};if(o=s.querySelector(Ev(i)))a.loading=5;else{e=Qr({rel:"stylesheet",href:e,"data-precedence":t},n),(n=bc.get(i))&&jN(e,n);var c=o=s.createElement("link");wo(c),zo(c,"link",e),c._p=new Promise(function(u,d){c.onload=u,c.onerror=d}),c.addEventListener("load",function(){a.loading|=1}),c.addEventListener("error",function(){a.loading|=2}),a.loading|=4,R_(o,t,s)}o={type:"stylesheet",instance:o,count:1,state:a},r.set(i,o)}}}function ade(e,t){ih.X(e,t);var n=P1;if(n&&e){var s=wg(n).hoistableScripts,r=O1(e),i=s.get(r);i||(i=n.querySelector(Av(r)),i||(e=Qr({src:e,async:!0},t),(t=bc.get(r))&&MN(e,t),i=n.createElement("script"),wo(i),zo(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},s.set(r,i))}}function lde(e,t){ih.M(e,t);var n=P1;if(n&&e){var s=wg(n).hoistableScripts,r=O1(e),i=s.get(r);i||(i=n.querySelector(Av(r)),i||(e=Qr({src:e,async:!0,type:"module"},t),(t=bc.get(r))&&MN(e,t),i=n.createElement("script"),wo(i),zo(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},s.set(r,i))}}function VL(e,t,n,s){var r=(r=pf.current)?U2(r):null;if(!r)throw Error(et(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=t1(n.href),n=wg(r).hoistableStyles,s=n.get(t),s||(s={type:"style",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=t1(n.href);var i=wg(r).hoistableStyles,o=i.get(e);if(o||(r=r.ownerDocument||r,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,o),(i=r.querySelector(Ev(e)))&&!i._p&&(o.instance=i,o.state.loading=5),bc.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},bc.set(e,n),i||cde(r,e,n,o.state))),t&&s===null)throw Error(et(528,""));return o}if(t&&s!==null)throw Error(et(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=O1(n),n=wg(r).hoistableScripts,s=n.get(t),s||(s={type:"script",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(et(444,e))}}function t1(e){return'href="'+ac(e)+'"'}function Ev(e){return'link[rel="stylesheet"]['+e+"]"}function rG(e){return Qr({},e,{"data-precedence":e.precedence,precedence:null})}function cde(e,t,n,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),zo(t,"link",n),wo(t),e.head.appendChild(t))}function O1(e){return'[src="'+ac(e)+'"]'}function Av(e){return"script[async]"+e}function WL(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+ac(n.href)+'"]');if(s)return t.instance=s,wo(s),s;var r=Qr({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),wo(s),zo(s,"style",r),R_(s,n.precedence,e),t.instance=s;case"stylesheet":r=t1(n.href);var i=e.querySelector(Ev(r));if(i)return t.state.loading|=4,t.instance=i,wo(i),i;s=rG(n),(r=bc.get(r))&&jN(s,r),i=(e.ownerDocument||e).createElement("link"),wo(i);var o=i;return o._p=new Promise(function(a,c){o.onload=a,o.onerror=c}),zo(i,"link",s),t.state.loading|=4,R_(i,n.precedence,e),t.instance=i;case"script":return i=O1(n.src),(r=e.querySelector(Av(i)))?(t.instance=r,wo(r),r):(s=n,(r=bc.get(i))&&(s=Qr({},n),MN(s,r)),e=e.ownerDocument||e,r=e.createElement("script"),wo(r),zo(r,"link",s),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(et(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(s=t.instance,t.state.loading|=4,R_(s,n.precedence,e));return t.instance}function R_(e,t,n){for(var s=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=s.length?s[s.length-1]:null,i=r,o=0;o<s.length;o++){var a=s[o];if(a.dataset.precedence===t)i=a;else if(i!==r)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function jN(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function MN(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var D_=null;function GL(e,t,n){if(D_===null){var s=new Map,r=D_=new Map;r.set(n,s)}else r=D_,s=r.get(n),s||(s=new Map,r.set(n,s));if(s.has(e))return s;for(s.set(e,null),n=n.getElementsByTagName(e),r=0;r<n.length;r++){var i=n[r];if(!(i[wv]||i[Lo]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var o=i.getAttribute(t)||"";o=e+o;var a=s.get(o);a?a.push(i):s.set(o,[i])}}return s}function KL(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function ude(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 iG(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function dde(e,t,n,s){if(n.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var r=t1(s.href),i=t.querySelector(Ev(r));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=V2.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,wo(i);return}i=t.ownerDocument||t,s=rG(s),(r=bc.get(r))&&jN(s,r),i=i.createElement("link"),wo(i);var o=i;o._p=new Promise(function(a,c){o.onload=a,o.onerror=c}),zo(i,"link",s),n.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=V2.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var XT=0;function hde(e,t){return e.stylesheets&&e.count===0&&L_(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&L_(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&XT===0&&(XT=62500*Wue());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&L_(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>XT?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(r)}}:null}function V2(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)L_(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var W2=null;function L_(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,W2=new Map,t.forEach(fde,e),W2=null,V2.call(e))}function fde(e,t){if(!(t.state.loading&4)){var n=W2.get(e);if(n)var s=n.get(null);else{n=new Map,W2.set(e,n);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<r.length;i++){var o=r[i];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(n.set(o.dataset.precedence,o),s=o)}s&&n.set(null,s)}r=t.instance,o=r.getAttribute("data-precedence"),i=n.get(o)||s,i===s&&n.set(null,r),n.set(o,r),this.count++,s=V2.bind(this),r.addEventListener("load",s),r.addEventListener("error",s),i?i.parentNode.insertBefore(r,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var _x={$$typeof:_d,Provider:null,Consumer:null,_currentValue:gp,_currentValue2:gp,_threadCount:0};function mde(e,t,n,s,r,i,o,a,c){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=xT(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xT(0),this.hiddenUpdates=xT(null),this.identifierPrefix=s,this.onUncaughtError=r,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function oG(e,t,n,s,r,i,o,a,c,u,d,h){return e=new mde(e,t,n,o,c,u,d,h,a),t=1,i===!0&&(t|=24),i=xl(3,null,null,t),e.current=i,i.stateNode=e,t=sN(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:s,isDehydrated:n,cache:t},oN(i),e}function aG(e){return e?(e=lg,e):lg}function lG(e,t,n,s,r,i){r=aG(r),s.context===null?s.context=r:s.pendingContext=r,s=bf(t),s.payload={element:n},i=i===void 0?null:i,i!==null&&(s.callback=i),n=yf(e,s,t),n!==null&&(el(n,e,t),Py(n,e,t))}function YL(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function IN(e,t){YL(e,t),(e=e.alternate)&&YL(e,t)}function cG(e){if(e.tag===13||e.tag===31){var t=Jp(e,67108864);t!==null&&el(t,e,67108864),IN(e,67108864)}}function XL(e){if(e.tag===13||e.tag===31){var t=Tl();t=q9(t);var n=Jp(e,t);n!==null&&el(n,e,t),IN(e,t)}}var G2=!0;function pde(e,t,n,s){var r=Xn.T;Xn.T=null;var i=mr.p;try{mr.p=2,RN(e,t,n,s)}finally{mr.p=i,Xn.T=r}}function gde(e,t,n,s){var r=Xn.T;Xn.T=null;var i=mr.p;try{mr.p=8,RN(e,t,n,s)}finally{mr.p=i,Xn.T=r}}function RN(e,t,n,s){if(G2){var r=j7(s);if(r===null)KT(e,t,s,K2,n),QL(e,s);else if(yde(r,e,t,n,s))s.stopPropagation();else if(QL(e,s),t&4&&-1<bde.indexOf(e)){for(;r!==null;){var i=I1(r);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var o=Gm(i.pendingLanes);if(o!==0){var a=i;for(a.pendingLanes|=2,a.entangledLanes|=2;o;){var c=1<<31-Cl(o);a.entanglements[1]|=c,o&=~c}Fu(i),!(hr&6)&&(O2=_l()+500,Tv(0))}}break;case 31:case 13:a=Jp(i,2),a!==null&&el(a,i,2),H4(),IN(i,2)}if(i=j7(s),i===null&&KT(e,t,s,K2,n),i===r)break;r=i}r!==null&&s.stopPropagation()}else KT(e,t,s,null,n)}}function j7(e){return e=G9(e),DN(e)}var K2=null;function DN(e){if(K2=null,e=ng(e),e!==null){var t=bv(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=NU(t),e!==null)return e;e=null}else if(n===31){if(e=jU(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 K2=e,null}function uG(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(nce()){case DU:return 2;case LU:return 8;case _2:case sce:return 32;case PU:return 268435456;default:return 32}default:return 32}}var M7=!1,wf=null,kf=null,_f=null,Sx=new Map,Cx=new Map,Yh=[],bde="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 QL(e,t){switch(e){case"focusin":case"focusout":wf=null;break;case"dragenter":case"dragleave":kf=null;break;case"mouseover":case"mouseout":_f=null;break;case"pointerover":case"pointerout":Sx.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Cx.delete(t.pointerId)}}function Fb(e,t,n,s,r,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:i,targetContainers:[r]},t!==null&&(t=I1(t),t!==null&&cG(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function yde(e,t,n,s,r){switch(t){case"focusin":return wf=Fb(wf,e,t,n,s,r),!0;case"dragenter":return kf=Fb(kf,e,t,n,s,r),!0;case"mouseover":return _f=Fb(_f,e,t,n,s,r),!0;case"pointerover":var i=r.pointerId;return Sx.set(i,Fb(Sx.get(i)||null,e,t,n,s,r)),!0;case"gotpointercapture":return i=r.pointerId,Cx.set(i,Fb(Cx.get(i)||null,e,t,n,s,r)),!0}return!1}function dG(e){var t=ng(e.target);if(t!==null){var n=bv(t);if(n!==null){if(t=n.tag,t===13){if(t=NU(n),t!==null){e.blockedOn=t,LD(e.priority,function(){XL(n)});return}}else if(t===31){if(t=jU(n),t!==null){e.blockedOn=t,LD(e.priority,function(){XL(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 P_(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=j7(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);Y8=s,n.target.dispatchEvent(s),Y8=null}else return t=I1(n),t!==null&&cG(t),e.blockedOn=n,!1;t.shift()}return!0}function JL(e,t,n){P_(e)&&n.delete(t)}function xde(){M7=!1,wf!==null&&P_(wf)&&(wf=null),kf!==null&&P_(kf)&&(kf=null),_f!==null&&P_(_f)&&(_f=null),Sx.forEach(JL),Cx.forEach(JL)}function Qw(e,t){e.blockedOn===t&&(e.blockedOn=null,M7||(M7=!0,io.unstable_scheduleCallback(io.unstable_NormalPriority,xde)))}var Jw=null;function ZL(e){Jw!==e&&(Jw=e,io.unstable_scheduleCallback(io.unstable_NormalPriority,function(){Jw===e&&(Jw=null);for(var t=0;t<e.length;t+=3){var n=e[t],s=e[t+1],r=e[t+2];if(typeof s!="function"){if(DN(s||n)===null)continue;break}var i=I1(n);i!==null&&(e.splice(t,3),t-=3,d7(i,{pending:!0,data:r,method:n.method,action:s},s,r))}}))}function n1(e){function t(c){return Qw(c,e)}wf!==null&&Qw(wf,e),kf!==null&&Qw(kf,e),_f!==null&&Qw(_f,e),Sx.forEach(t),Cx.forEach(t);for(var n=0;n<Yh.length;n++){var s=Yh[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Yh.length&&(n=Yh[0],n.blockedOn===null);)dG(n),n.blockedOn===null&&Yh.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(s=0;s<n.length;s+=3){var r=n[s],i=n[s+1],o=r[sl]||null;if(typeof i=="function")o||ZL(n);else if(o){var a=null;if(i&&i.hasAttribute("formAction")){if(r=i,o=i[sl]||null)a=o.formAction;else if(DN(r)!==null)continue}else a=o.action;typeof a=="function"?n[s+1]=a:(n.splice(s,3),s-=3),ZL(n)}}}function hG(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(o){return r=o})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),s||setTimeout(n,20)}function n(){if(!s&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function LN(e){this._internalRoot=e}V4.prototype.render=LN.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(et(409));var n=t.current,s=Tl();lG(n,s,e,t,null,null)};V4.prototype.unmount=LN.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;lG(e.current,2,null,e,null,null),H4(),t[M1]=null}};function V4(e){this._internalRoot=e}V4.prototype.unstable_scheduleHydration=function(e){if(e){var t=FU();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Yh.length&&t!==0&&t<Yh[n].priority;n++);Yh.splice(n,0,e),n===0&&dG(e)}};var eP=EU.version;if(eP!=="19.2.4")throw Error(et(527,eP,"19.2.4"));mr.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(et(188)):(e=Object.keys(e).join(","),Error(et(268,e)));return e=Yle(t),e=e!==null?MU(e):null,e=e===null?null:e.stateNode,e};var vde={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Xn,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Zw=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zw.isDisabled&&Zw.supportsFiber)try{yv=Zw.inject(vde),Sl=Zw}catch{}}A4.createRoot=function(e,t){if(!AU(e))throw Error(et(299));var n=!1,s="",r=sW,i=rW,o=iW;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=oG(e,1,!1,null,null,n,s,null,r,i,o,hG),e[M1]=t.current,NN(e),new LN(t)};A4.hydrateRoot=function(e,t,n){if(!AU(e))throw Error(et(299));var s=!1,r="",i=sW,o=rW,a=iW,c=null;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(r=n.identifierPrefix),n.onUncaughtError!==void 0&&(i=n.onUncaughtError),n.onCaughtError!==void 0&&(o=n.onCaughtError),n.onRecoverableError!==void 0&&(a=n.onRecoverableError),n.formState!==void 0&&(c=n.formState)),t=oG(e,1,!0,t,n??null,s,r,c,i,o,a,hG),t.context=aG(null),n=t.current,s=Tl(),s=q9(s),r=bf(s),r.callback=null,yf(n,r,s),n=s,t.current.lanes=n,vv(t,n),Fu(t),e[M1]=t.current,NN(e),new V4(t)};A4.version="19.2.4";function fG(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(fG)}catch(e){console.error(e)}}fG(),wU.exports=A4;var I7=wU.exports;const wde=C4(I7);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const kde="agent";function _de(e){return e===kde}var Sde=3e4,Cde=new Set(["authorized","expired","error","cancelled"]),Tde=class{constructor(e){this.client=e}async start(e){let t=await this.client.startDeviceFlow(e),n=this.client;return{deviceFlowId:t.deviceFlowId,providerId:t.providerId,userCode:t.userCode,verificationUri:t.verificationUri,verificationUriComplete:t.verificationUriComplete,expiresAt:t.expiresAt,intervalMs:t.intervalMs,attached:t.attached,cancel:()=>n.cancelDeviceFlow(t.deviceFlowId,{clientId:e.clientId}),awaitCompletion:async(s={})=>await Ede(n,t,e.clientId,s)}}status(e,t){return this.client.getDeviceFlow(e,t)}cancel(e,t){return this.client.cancelDeviceFlow(e,t)}};async function Ede(e,t,n,s){return await Ade(e,t,n,s)}async function tP(e,t,n,s){try{return await e.getDeviceFlow(t.deviceFlowId,{clientId:n,signal:s})}catch(r){if(r instanceof yc&&r.status===404)return{deviceFlowId:t.deviceFlowId,providerId:t.providerId,status:"error",errorKind:"not_found_or_evicted",hint:"device-flow not found on daemon (evicted past terminal grace, daemon restart, or unknown deviceFlowId)",createdAt:Date.now()};throw r}}function nP(e,t={}){if(e!==void 0&&Number.isFinite(e)&&!(t.allowZero?e<0:e<=0))return e}async function Ade(e,t,n,s){var d;let r=s.signal,i=nP(s.timeoutMs,{allowZero:!0}),o=nP(s.pollOverrideMs),a=i!==void 0?Date.now()+i:t.expiresAt+Sde,c=Math.max(1e3,o??t.intervalMs??5e3),u=c;for(;;){if(r!=null&&r.aborted)throw R7(r);if(Date.now()>=a)return await tP(e,t,n,r);let h=await tP(e,t,n,r);if(h.intervalMs&&h.intervalMs!==u&&(u=h.intervalMs,c=h.intervalMs,(d=s.onThrottled)==null||d.call(s,h.intervalMs)),Cde.has(h.status))return h;await Nde(c,r)}}async function Nde(e,t){if(t!=null&&t.aborted)throw R7(t);await new Promise((n,s)=>{let r=setTimeout(()=>{o(),n()},e),i=()=>{o(),s(R7(t))};function o(){clearTimeout(r),t==null||t.removeEventListener("abort",i)}t&&t.addEventListener("abort",i,{once:!0})})}function R7(e){let t=e==null?void 0:e.reason;return t instanceof Error?t:typeof t=="string"?new Error(t):new Error("aborted")}var yc=class extends Error{constructor(t,n,s){super(s);Me(this,"status");Me(this,"body");this.name="DaemonHttpError",this.status=t,this.body=n}},sP=class extends Error{constructor(e){super(e??"Transport connection closed"),this.name="DaemonTransportClosedError"}},jde=class extends Error{constructor(e){super(e),this.name="SseFramingError"}},rP=16*1024*1024;async function*mG(e,t){let n=e.getReader(),s=new TextDecoder,r="",i;t&&(i=()=>{n.cancel().catch(()=>{})},t.aborted?i():t.addEventListener("abort",i,{once:!0}));try{for(;;){if(t!=null&&t.aborted)return;let o,a;try{({value:o,done:a}=await n.read())}catch(u){if(t!=null&&t.aborted)return;throw u}if(a){if(r+=s.decode(),r.length>0){let u=iP(r);for(let d of u.frames){let h=QT(d);h&&(yield h)}if(u.tail.length>0){let d=QT(u.tail);d&&(yield d)}}return}if(r+=s.decode(o,{stream:!0}),r.length>rP)throw new jde(`parseSseStream: unread buffer exceeded ${rP} UTF-16 code units without a frame separator — upstream likely not SSE`);let c=iP(r);if(c.frames.length>0)for(let u of c.frames){let d=QT(u);d&&(yield d)}r=c.tail}}finally{t&&i&&t.removeEventListener("abort",i);try{await n.cancel()}catch{}}}function iP(e){let t=[],n=0;for(;n<e.length;){let s=e.indexOf(`

`,n);if(s===-1){let i=e.indexOf(`\r
\r
`,n);if(i===-1)break;t.push(e.slice(n,i)),n=i+4;continue}let r=e.slice(n,s).indexOf(`\r
\r
`);if(r!==-1){let i=n+r;t.push(e.slice(n,i)),n=i+4}else t.push(e.slice(n,s)),n=s+2}return{frames:t,tail:e.slice(n)}}function QT(e){if(!e)return;let t=[];for(let s of e.split(/\r?\n/)){if(!s.startsWith("data:"))continue;let r=s.slice(5);t.push(r.startsWith(" ")?r.slice(1):r)}if(t.length===0)return;let n=t.join(`
`);try{let s=JSON.parse(n);if(typeof s!="object"||s===null||Array.isArray(s)||s.v!==1||typeof s.type!="string")return;let r=s.id;return r!==void 0&&(!Number.isSafeInteger(r)||r<1)?void 0:s}catch{return}}var Mde=class{constructor(e,t,n){Me(this,"baseUrl");Me(this,"token");Me(this,"_fetch");Me(this,"activeSseRequests",new Set);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 sP;return this._fetch(e,t)}async*subscribeEvents(e,t={}){var s;if(this._disposed)throw new sP;let n=new AbortController;this.activeSseRequests.add(n);try{let r={Accept:"text/event-stream"};this.token&&(r.Authorization=`Bearer ${this.token}`),t.lastEventId!==void 0&&(r["Last-Event-ID"]=String(t.lastEventId));let i=t.signal?Ide([t.signal,n.signal]):n.signal,o=`${this.baseUrl}/session/${encodeURIComponent(e)}/events`;t.maxQueued!==void 0&&(o+=`?maxQueued=${encodeURIComponent(String(t.maxQueued))}`);let a,c=t.connectTimeoutMs;c&&Number.isFinite(c)&&(a=setTimeout(()=>n.abort(new DOMException("Initial connect timed out","TimeoutError")),c),typeof a=="object"&&a&&"unref"in a&&a.unref());let u;try{u=await this._fetch(o,{headers:r,signal:i})}finally{a!==void 0&&clearTimeout(a)}if(!u.ok){let h;try{let p=await u.text();try{h=JSON.parse(p)}catch{h=p}}catch{}let m=h&&typeof h=="object"&&"error"in h?String(h.error):`HTTP ${u.status}`;throw new yc(u.status,h,`GET /session/:id/events: ${m}`)}let d=u.headers.get("content-type")??"";if(!d.toLowerCase().includes("text/event-stream")){try{await((s=u.body)==null?void 0:s.cancel())}catch{}throw new yc(u.status,d,`GET /session/:id/events: expected content-type text/event-stream, got "${d}"`)}if(!u.body)throw new Error("No SSE body");yield*mG(u.body,i)}finally{n.abort(),this.activeSseRequests.delete(n)}}dispose(){if(!this._disposed){this._disposed=!0;for(let e of this.activeSseRequests)e.abort();this.activeSseRequests.clear()}}};function Ide(e){let t=AbortSignal.any;if(typeof t=="function")return t.call(AbortSignal,e);let n=new AbortController,s=[],r=()=>{for(;s.length>0;){let i=s.pop();try{i==null||i()}catch{}}};for(let i of e){if(i.aborted)return n.abort(i.reason),r(),n.signal;let o=()=>{n.abort(i.reason),r()};i.addEventListener("abort",o,{once:!0}),s.push(()=>i.removeEventListener("abort",o))}return n.signal.addEventListener("abort",r,{once:!0}),n.signal}var Rde=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}},Dde=["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"],W4=["plan","default","auto-edit","auto","yolo"],ek="/workspace/memory/remember",tk="/workspace/memory/forget",nk="/workspace/memory/dream";function Lde(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,s=t.modelSource,r=typeof n=="string"&&n.length>0,i=s==="fast"||s==="main",o=a=>a===void 0||typeof a=="number"&&Number.isSafeInteger(a)&&a>=0;if(t.type==="started"){if(!r||typeof t.model!="string"||!i)return}else if(t.type==="thinking"){if(!r)return}else if(t.type==="delta"){if(!r||!Number.isSafeInteger(t.seq)||t.seq<0||typeof t.text!="string"||t.text.length===0)return}else if(t.type==="done"){if(!r||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 Y2=20,Pde=3e4,Ode=65e3,Bde=9e4,oP=2147483647,$de=5,G0=33e4,zde="X-Qwen-Client-Id",it=encodeURIComponent;function pG(e){let t=new URLSearchParams;e.cursor!==void 0&&t.set("cursor",e.cursor),e.beforeRecordId!==void 0&&t.set("beforeRecordId",e.beforeRecordId),e.limit!==void 0&&t.set("limit",String(e.limit));let n=t.toString();return n?`?${n}`:""}function aP(e){let t=e.trim();if(!t)throw new Error("rule must be a non-empty string");return t}function gG(e){if(e===void 0)return $de;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 Fde(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}function Hde(){var e,t;try{let n=(t=(e=globalThis.process)==null?void 0:e.env)==null?void 0:t.QWEN_SERVER_TOKEN;if(typeof n!="string")return;let s=n.trim();return s.length===0?void 0:s}catch{return}}var lP=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 bG(e){return typeof e=="object"&&e!==null&&e._daemonTurnError===!0}var D7=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=Fde(e.baseUrl),this.token=e.token??Hde(),this._fetch=e.fetch??((n=e.transport)==null?void 0:n.restFetch)??globalThis.fetch.bind(globalThis);let t=e.fetchTimeoutMs??Pde;this.fetchTimeoutMs=Number.isFinite(t)&&t>0?t:0,this.promptLimit=gG(e.maxPendingPromptsPerSession),this.transport=e.transport??new Mde(this.baseUrl,this.token,this._fetch)}get auth(){return this._authFlow||(this._authFlow=new Tde(this)),this._authFlow}get maxPendingPromptsPerSession(){return this.promptLimit}reservePromptSlot(e,t=this.promptLimit){if(t===1/0)return()=>{};let n=this.promptCounts,s=n[e]??0;if(s>=t)throw new lP(e,t,s);n[e]=s+1;let r;return()=>{r||(r=!0,(n[e]??0)<=1?delete n[e]:--n[e])}}async fetchWithTimeout(e,t={},n,s,r="transport"){let i=this.fetchTimeoutMs;if(s!==void 0&&Number.isFinite(s)&&s>=0&&(i=s),!i||!Number.isFinite(i)){let d=r==="rest"?await this._fetch(e,t):await this.transport.fetch(e,t);return n?n(d):d}let o=new AbortController,a=setTimeout(()=>{o.abort(new DOMException("timeout","TimeoutError"))},i);typeof a=="object"&&a&&"unref"in a&&a.unref();let c=t.signal??void 0,u=c?JT([c,o.signal]):o.signal;try{let d=r==="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[zde]=t),n}async failOnError(e,t,n){let s;try{let i=await e.text();if(i.length>0)try{s=JSON.parse(i)}catch{s=i}}catch{}let r=s&&typeof s=="object"&&"error"in s?String(s.error):`HTTP ${e.status}`;if(n&&e.status===503&&s&&typeof s=="object"){let i=s;if(i.code==="prompt_queue_full")return new lP(typeof i.sessionId=="string"?i.sessionId:n,typeof i.limit=="number"?i.limit:0,typeof i.pendingCount=="number"?i.pendingCount:0)}return new yc(e.status,s,`${t}: ${r}`)}async jsonRequest(e,t,n={}){let s=n.body!==void 0;return await this.fetchWithTimeout(`${this.baseUrl}${e}`,{...n.method?{method:n.method}:{},headers:this.headers(s?{"Content-Type":"application/json"}:{},n.clientId),...s?{body:JSON.stringify(n.body)}:{},...n.signal?{signal:n.signal}:{}},async r=>{if(!r.ok)throw await this.failOnError(r,t);return await r.json()},n.timeoutMs,n.mode)}async workspaceJsonRequest(e,t,n,s={}){return await this.jsonRequest(`/workspaces/${e}${t}`,n,s)}async sessionExportRequest(e,t,n={}){let s=n.format??"html",r=n.format?`?format=${it(n.format)}`:"";return await this.fetchWithTimeout(`${this.baseUrl}${e}${r}`,{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")??"",c=((u=/filename="([^"]+)"/i.exec(i.headers.get("content-disposition")??""))==null?void 0:u[1])??`export.${s}`;return{content:o,filename:c,mimeType:a,format:s}},void 0,"rest")}async workspaceNoContentRequest(e,t,n,s={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspaces/${e}${t}`,{...s.method?{method:s.method}:{},headers:this.headers({},s.clientId)},async r=>{var i,o;if(r.status===204){try{await((i=r.body)==null?void 0:i.cancel())}catch{}return}if(r.status===404&&s.okNotFoundCode){let a=await this.failOnError(r,n);if(((o=a.body)==null?void 0:o.code)===s.okNotFoundCode)return;throw a}throw await this.failOnError(r,n)},s.timeoutMs)}workspaceById(e){return new cP(this,it(e))}workspaceByCwd(e){return new cP(this,it(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 Rde(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 workspaceGitDiff(){return await this.jsonRequest("/workspace/git/diff","GET /workspace/git/diff",{mode:"rest"})}async workspaceGitDiffFile(e,t){let n=`/workspace/git/diff/file?path=${it(e)}`+(t!=null?`&oldPath=${it(t)}`:"");return await this.jsonRequest(n,"GET /workspace/git/diff/file",{mode:"rest"})}async workspaceGitLog(e,t){let n=new URLSearchParams;e!=null&&n.set("limit",String(e)),t!=null&&n.set("skip",String(t));let s=n.toString();return await this.jsonRequest(`/workspace/git/log${s?`?${s}`:""}`,"GET /workspace/git/log",{mode:"rest"})}async workspaceGitCommitDetail(e){return await this.jsonRequest(`/workspace/git/log/commit?sha=${it(e)}`,"GET /workspace/git/log/commit",{mode:"rest"})}async workspaceMcpTools(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${it(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/${it(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.jsonRequest(`/workspace/acp/preheat${n}`,"POST /workspace/acp/preheat",{method:"POST",timeoutMs:t+2e3,mode:"rest"})}async workspaceAcpStatus(){return await this.jsonRequest("/workspace/acp/status","GET /workspace/acp/status",{mode:"rest"})}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/${it(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/${it(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,s){return await this.jsonRequest(`/workspace/extensions/operations/${it(e)}/interactions/${it(t)}`,"POST /workspace/extensions/operations/:operationId/interactions/:interactionId",{method:"POST",body:n,clientId:s,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/${it(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/${it(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/${it(e)}/update`,"POST /workspace/extensions/:name/update",{method:"POST",body:{},clientId:t,mode:"rest"})}async uninstallExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${it(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/${it(e)}/update`,"POST /extensions/:extensionId/update",{method:"POST",body:{},clientId:t,mode:"rest"})}async uninstallUserExtension(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/extensions/${it(e)}`,{method:"DELETE",headers:this.headers({},t)},async n=>{var s;if(n.status===204){await((s=n.body)==null?void 0:s.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/${it(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/${it(e)}`,"GET /extensions/operations/:operationId",t?{signal:t,mode:"rest"}:{mode:"rest"})}async waitForExtensionOperation(e,t={}){var a;let n=t.pollIntervalMs??1e3,s=t.timeoutMs??10*6e4,r=s!==Number.POSITIVE_INFINITY,i=Date.now()+s,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 c=i-Date.now();if(c<=0||Number.isNaN(c))throw o();let u;if(!r)u=await this.extensionOperation(e.operationId,t.signal);else{let h=new AbortController,m=t.signal?JT([t.signal,h.signal]):h.signal,p,g=new Promise((b,v)=>{let x=()=>{let w=o();v(w),h.abort(w)},y=()=>{let w=i-Date.now();if(w<=0){x();return}p=setTimeout(()=>{Date.now()>=i?x():y()},Math.min(w,oP))};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,v;let p=setTimeout(()=>{var x;(x=t.signal)==null||x.removeEventListener("abort",g),h()},Math.min(n,d,oP)),g=()=>{var x,y;clearTimeout(p),(x=t.signal)==null||x.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}),(v=t.signal)!=null&&v.aborted&&g()})}}async readWorkspaceFile(e,t={},n){let s=new URL(`${this.baseUrl}/file`);return s.searchParams.set("path",e),t.maxBytes!==void 0&&s.searchParams.set("maxBytes",String(t.maxBytes)),t.line!==void 0&&s.searchParams.set("line",String(t.line)),t.limit!==void 0&&s.searchParams.set("limit",String(t.limit)),await this.fetchWithTimeout(s.toString(),{headers:this.headers({},n)},async r=>{if(!r.ok)throw await this.failOnError(r,"GET /file");return await r.json()})}async readWorkspaceFileBytes(e,t={},n){let s=new URL(`${this.baseUrl}/file/bytes`);return s.searchParams.set("path",e),t.offset!==void 0&&s.searchParams.set("offset",String(t.offset)),t.maxBytes!==void 0&&s.searchParams.set("maxBytes",String(t.maxBytes)),await this.fetchWithTimeout(s.toString(),{headers:this.headers({},n)},async r=>{if(!r.ok)throw await this.failOnError(r,"GET /file/bytes");return await r.json()})}async fileStat(e){let t=new URL(`${this.baseUrl}/stat`);return t.searchParams.set("path",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /stat");return await n.json()})}async dirList(e){let t=new URL(`${this.baseUrl}/list`);return t.searchParams.set("path",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /list");return await n.json()})}async workspacePathSuggestions(e){let t=new URL(`${this.baseUrl}/workspace-path-suggestions`);return t.searchParams.set("prefix",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /workspace-path-suggestions");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(ek,`POST ${ek}`,{method:"POST",body:{content:e,contextMode:t.contextMode??"workspace"},clientId:t.clientId})}async getWorkspaceMemoryRememberTask(e,t){return await this.jsonRequest(`${ek}/${it(e)}`,`GET ${ek}/:taskId`,{clientId:t==null?void 0:t.clientId})}async forgetWorkspaceMemory(e,t={}){return await this.jsonRequest(tk,`POST ${tk}`,{method:"POST",body:{query:e},clientId:t.clientId})}async getWorkspaceMemoryForgetTask(e,t){return await this.jsonRequest(`${tk}/${it(e)}`,`GET ${tk}/:taskId`,{clientId:t==null?void 0:t.clientId})}async dreamWorkspaceMemory(e={}){return await this.jsonRequest(nk,`POST ${nk}`,{method:"POST",body:{},clientId:e.clientId})}async getWorkspaceMemoryDreamTask(e,t){return await this.jsonRequest(`${nk}/${it(e)}`,`GET ${nk}/: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()},G0)}async getWorkspaceAgent(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents/${it(e)}`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/agents/:agentType");return await t.json()})}async updateWorkspaceAgent(e,t,n={},s){let r=n.scope?`${this.baseUrl}/workspace/agents/${it(e)}?scope=${it(n.scope)}`:`${this.baseUrl}/workspace/agents/${it(e)}`;return await this.fetchWithTimeout(r,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify(t)},async i=>{if(!i.ok)throw await this.failOnError(i,"POST /workspace/agents/:agentType");return await i.json()})}async deleteWorkspaceAgent(e,t={},n){let s=t.scope?`${this.baseUrl}/workspace/agents/${it(e)}?scope=${it(t.scope)}`:`${this.baseUrl}/workspace/agents/${it(e)}`;return await this.fetchWithTimeout(s,{method:"DELETE",headers:this.headers({},n)},async r=>{var i;if(r.status===204){try{await((i=r.body)==null?void 0:i.cancel())}catch{}return}if(r.status===404){let o=await this.failOnError(r,"DELETE /workspace/agents/:agentType"),a=o.body;if(a&&a.code==="agent_not_found")return;throw o}throw await this.failOnError(r,"DELETE /workspace/agents/:agentType")})}async workspaceEnv(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/env`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/env");return await e.json()})}async workspacePreflight(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/preflight`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/preflight");return await e.json()})}async workspaceTools(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/tools`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/tools");return await e.json()})}async createOrAttachSession(e,t){return(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}:{},...e.worktree!==void 0?{worktree:e.worktree}:{}})},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)??Y2,s=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(n)?n:Y2))),r=new URLSearchParams({size:String(s)});return(t==null?void 0:t.cursor)!==void 0&&r.set("cursor",t.cursor),(t==null?void 0:t.archiveState)!==void 0&&r.set("archiveState",t.archiveState),(t==null?void 0:t.view)!==void 0&&r.set("view",t.view),(t==null?void 0:t.group)!==void 0&&r.set("group",t.group),(t==null?void 0:t.parentSessionId)!==void 0&&r.set("parentSessionId",t.parentSessionId),(t==null?void 0:t.sourceType)!==void 0&&r.set("sourceType",t.sourceType),(t==null?void 0:t.sourceId)!==void 0&&r.set("sourceId",t.sourceId),await this.jsonRequest(`/workspace/${it(e)}/sessions?${r.toString()}`,"GET /workspace/sessions")}async listSessionGroups(e){return await this.jsonRequest(`/workspace/${it(e)}/session-groups`,"GET /workspace/session-groups")}async createSessionGroup(e,t){return(await this.jsonRequest(`/workspace/${it(e)}/session-groups`,"POST /workspace/session-groups",{method:"POST",body:t})).group}async updateSessionGroup(e,t,n){return(await this.jsonRequest(`/workspace/${it(e)}/session-groups/${it(t)}`,"PATCH /workspace/session-groups/:groupId",{method:"PATCH",body:n})).group}async deleteSessionGroup(e,t){return await this.jsonRequest(`/workspace/${it(e)}/session-groups/${it(t)}`,"DELETE /workspace/session-groups/:groupId",{method:"DELETE"})}async updateSessionOrganization(e,t,n){return await this.jsonRequest(`/session/${it(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/${it(e)}/export`,"GET /session/:id/export",t)}async getSessionTranscriptPage(e,t={}){return await this.jsonRequest(`/session/${it(e)}/transcript${pG(t)}`,"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/${it(e)}/branch`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({name:t.name})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/branch");return await s.json()})}async forkSession(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${it(e)}/fork`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({directive:t.directive})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/fork");return await s.json()})}async sessionContext(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${it(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/${it(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 s=new URLSearchParams;t.detail===!0&&s.set("detail","true");let r=s.toString();return await this.fetchWithTimeout(`${this.baseUrl}/session/${it(e)}/context-usage${r?`?${r}`:""}`,{headers:this.headers({},n)},async i=>{if(!i.ok)throw await this.failOnError(i,"GET /session/:id/context-usage");return await i.json()})}async sessionSupportedCommands(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${it(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/${it(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/${it(e)}/lsp`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/lsp");return await n.json()})}async sessionTaskCancel(e,t,n,s){return await this.fetchWithTimeout(`${this.baseUrl}/session/${it(e)}/tasks/${it(t)}/cancel`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify({kind:n})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/tasks/:taskId/cancel");return await r.json()})}async sessionGoalClear(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${it(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/${it(e)}/stats`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/stats");return await n.json()})}async restoreSession(e,t,n,s){return await this.fetchWithTimeout(`${this.baseUrl}/session/${it(t)}/${e}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify({cwd:n.workspaceCwd,...n.approvalMode!==void 0?{approvalMode:n.approvalMode}:{},...e==="load"&&n.historyPageSize!==void 0?{historyPageSize:n.historyPageSize}:{}})},async r=>{if(!r.ok)throw await this.failOnError(r,`POST /session/:id/${e}`);return await r.json()})}async setSessionApprovalMode(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${it(e)}/approval-mode`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({mode:t,...(n==null?void 0:n.persist)===!0?{persist:!0}:{}})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/approval-mode");return await s.json()})}async getRewindSnapshots(e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${it(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/${it(e)}/rewind`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({promptId:t,...(n==null?void 0:n.rewindFiles)!==void 0?{rewindFiles:n.rewindFiles}:{}})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/rewind");return await s.json()},void 0,"rest")}async recapSession(e,t){let n=await this.transport.fetch(`${this.baseUrl}/session/${it(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 s=await this.transport.fetch(`${this.baseUrl}/session/${it(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(!s.ok)throw await this.failOnError(s,"POST /session/:id/generate");if(!s.body)throw new Error("Generation response body is missing");for await(let r of mG(s.body,n==null?void 0:n.signal)){let i=Lde(r);i&&(yield i)}}async btwSession(e,t,n){let s=await this.transport.fetch(`${this.baseUrl}/session/${it(e)}/btw`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({question:t}),signal:n==null?void 0:n.signal});if(!s.ok)throw await this.failOnError(s,"POST /session/:id/btw");return await s.json()}async enqueueMidTurnMessage(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${it(e)}/mid-turn-message`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({message:t}),signal:n==null?void 0:n.signal},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/mid-turn-message");return await s.json()})}async getPendingPrompts(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${it(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/${it(e)}/pending-prompts/${it(t)}`,{method:"DELETE",headers:this.headers({},n==null?void 0:n.clientId)},async s=>{if(!s.ok)throw await this.failOnError(s,"DELETE /session/:id/pending-prompts/:promptId");return await s.json()})}async shellCommand(e,t,n){let s=await this.transport.fetch(`${this.baseUrl}/session/${it(e)}/shell`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({command:t}),signal:n==null?void 0:n.signal});if(!s.ok)throw await this.failOnError(s,"POST /session/:id/shell");return await s.json()}async setWorkspaceToolEnabled(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/tools/${it(e)}/enable`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({enabled:t})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/tools/:name/enable");return await s.json()})}async setWorkspaceSkillEnabled(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/skills/${it(e)}/enable`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({enabled:t})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/skills/:name/enable");return await s.json()})}installWorkspaceSkill(e){return this.jsonRequest("/workspace/skills/install","Skill",{method:"POST",body:e})}deleteWorkspaceSkill(e,t){return this.jsonRequest(`/workspace/skills/${it(e)}?scope=${t}`,"Skill",{method:"DELETE"})}async workspaceSettings(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/settings`,{method:"GET",headers:this.headers({},e==null?void 0:e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/settings");return await t.json()})}async setWorkspaceSetting(e,t,n,s){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/settings`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s==null?void 0:s.clientId),body:JSON.stringify({scope:e,key:t,value:n,...s!=null&&s.mcpServerMutation?{mcpServerMutation:s.mcpServerMutation}:{}})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/settings");return await r.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,s){let r=s.voiceModel?`?${new URLSearchParams({voiceModel:s.voiceModel}).toString()}`:"";return await this.fetchWithTimeout(`${this.baseUrl}${e}${r}`,{method:"POST",headers:this.headers({"Content-Type":s.mimeType},s.clientId),body:n},async i=>{if(!i.ok)throw await this.failOnError(i,t);return await i.json()},s.timeoutMs??Ode,"rest")}async workspaceTrust(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/trust`,{method:"GET",headers:this.headers({},e==null?void 0:e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/trust");return await t.json()})}async requestWorkspaceTrustChange(e,t){return await this.jsonRequest("/workspace/trust/request","POST /workspace/trust/request",{method:"POST",body:e,clientId:t})}async workspacePermissions(e){return await this.jsonRequest("/workspace/permissions","GET /workspace/permissions",{clientId:e==null?void 0:e.clientId})}async setWorkspacePermissionRules(e,t,n,s){return await this.jsonRequest("/workspace/permissions","POST /workspace/permissions",{method:"POST",body:{scope:e,ruleType:t,rules:[...n]},clientId:s==null?void 0:s.clientId})}async addWorkspacePermissionRule(e,t,n,s){let r=aP(n),i=await this.workspacePermissions(s),o=i[e].rules[t];return o.includes(r)?i:await this.setWorkspacePermissionRules(e,t,[...o,r],s)}async removeWorkspacePermissionRule(e,t,n,s){let r=aP(n),i=await this.workspacePermissions(s),o=i[e].rules[t];return o.includes(r)?await this.setWorkspacePermissionRules(e,t,o.filter(a=>a!==r),s):i}async restartMcpServer(e,t){let n=(t==null?void 0:t.entryIndex)===void 0?"":`?entryIndex=${it(String(t.entryIndex))}`;return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${it(e)}/restart${n}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:"{}"},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/mcp/:server/restart");return await s.json()},(t==null?void 0:t.timeoutMs)??G0)}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/${it(e)}/${it(t)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:"{}"},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/mcp/:server/:action");return await s.json()},(n==null?void 0:n.timeoutMs)??G0)}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)??G0)}async removeRuntimeMcpServer(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/servers/${it(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)??G0)}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:Bde})}async setSessionModel(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${it(e)}/model`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({modelId:t})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/model");return await s.json()})}async setSessionLanguage(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${it(e)}/language`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({language:t,syncOutputLanguage:(n==null?void 0:n.syncOutputLanguage)??!1})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/language");return await s.json()})}async prompt(e,t,n,s){n==null||n.throwIfAborted();let r=this.reservePromptSlot(e),i=!0;try{let o=await this.transport.fetch(`${this.baseUrl}/session/${it(e)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify(t),signal:n});if(o.status===202){let a=await o.json();i=!1;try{return await this._awaitTurnComplete(e,a.promptId,a.lastEventId,n,s)}finally{r()}}if(!o.ok)throw await this.failOnError(o,"POST /session/:id/prompt",e);return await o.json()}finally{i&&r()}}async promptNonBlocking(e,t,n,s){let r=await this.transport.fetch(`${this.baseUrl}/session/${it(e)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify(t),signal:n});if(r.status===202)return await r.json();if(!r.ok)throw await this.failOnError(r,"POST /session/:id/prompt",e);return await r.json()}async _awaitTurnComplete(e,t,n,s,r){let i=new AbortController,o=s?JT([s,i.signal]):i.signal;try{let a=this.subscribeEvents(e,{lastEventId:n,signal:o});for await(let c of a){let u=PN(c,t);if(u!==void 0)return u}throw new Error("SSE stream ended")}catch(a){throw s!=null&&s.aborted&&a instanceof DOMException&&a.name==="AbortError"&&this.cancel(e,r).catch(()=>{}),a}finally{i.signal.aborted||i.abort()}}async heartbeat(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${it(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/${it(e)}/cancel`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:"{}"},async n=>{var s;if(!n.ok&&n.status!==204)throw await this.failOnError(n,"POST /session/:id/cancel");try{await((s=n.body)==null?void 0:s.cancel())}catch{}})}async*subscribeEvents(e,t={}){yield*this.transport.subscribeEvents(e,{lastEventId:t.lastEventId,maxQueued:t.maxQueued,signal:t.signal,connectTimeoutMs:this.fetchTimeoutMs||void 0})}async respondToPermission(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/permission/${it(e)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify(t)},async s=>{var r,i;if(s.status===200){try{await((r=s.body)==null?void 0:r.cancel())}catch{}return!0}if(s.status===404){try{await((i=s.body)==null?void 0:i.cancel())}catch{}return!1}throw await this.failOnError(s,"POST /permission/:requestId")})}async respondToSessionPermission(e,t,n,s){return await this.fetchWithTimeout(`${this.baseUrl}/session/${it(e)}/permission/${it(t)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify(n)},async r=>{var i,o;if(r.status===200){try{await((i=r.body)==null?void 0:i.cancel())}catch{}return!0}if(r.status===404){try{await((o=r.body)==null?void 0:o.cancel())}catch{}return!1}throw await this.failOnError(r,"POST /session/:id/permission/:requestId")})}async closeSession(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${it(e)}`,{method:"DELETE",headers:this.headers({},t)},async n=>{var s;if(n.status===204||n.status===404){try{await((s=n.body)==null?void 0:s.cancel())}catch{}return}throw await this.failOnError(n,"DELETE /session/:id")})}async detachSession(e,t){if(t)return await this.fetchWithTimeout(`${this.baseUrl}/session/${it(e)}/detach`,{method:"POST",headers:this.headers({},t)},async n=>{var s;if(n.status===204||n.status===404){try{await((s=n.body)==null?void 0:s.cancel())}catch{}return}throw await this.failOnError(n,"POST /session/:id/detach")})}async deleteSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/delete`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/delete")})}async archiveSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/archive`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/archive")})}async unarchiveSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/unarchive`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/unarchive")})}async startDeviceFlow(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e.clientId),body:JSON.stringify({providerId:e.providerId})},async t=>{if(t.status!==200&&t.status!==201)throw await this.failOnError(t,"POST /workspace/auth/device-flow");return await t.json()})}async getDeviceFlow(e,t={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow/${it(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/${it(e)}`,{method:"DELETE",headers:this.headers({},t.clientId)},async n=>{var s;if(n.status===204||n.status===404){try{await((s=n.body)==null?void 0:s.cancel())}catch{}return}throw await this.failOnError(n,"DELETE /workspace/auth/device-flow/:id")})}async getAuthStatus(e={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/status`,{headers:this.headers({},e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/auth/status");return await t.json()})}async getAuthProviders(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/providers`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/auth/providers");return await e.json()})}async installAuthProvider(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/provider`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:JSON.stringify(e)},async t=>{if(!t.ok)throw await this.failOnError(t,"POST /workspace/auth/provider");return await t.json()})}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}:{},...t.displayName!==void 0?{displayName:t.displayName}:{}})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspaces");return await n.json()})}async updateWorkspace(e,t){return await this.workspaceJsonRequest(it(e),"","PATCH /workspaces/:workspace",{method:"PATCH",body:t,mode:"rest"})}dispose(){this.transport.dispose()}async listSessionArtifacts(e,t){return await this.jsonRequest(`/session/${it(e)}/artifacts`,"GET /session/:id/artifacts",{clientId:t})}async addSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${it(e)}/artifacts`,"POST /session/:id/artifacts",{method:"POST",body:t,clientId:n})}async removeSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${it(e)}/artifacts/${it(t)}`,"DELETE /session/:id/artifacts/:artifactId",{method:"DELETE",clientId:n})}async updateSessionMetadata(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${it(e)}/metadata`,{method:"PATCH",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify(t)},async s=>{if(s.status===200){let r=await s.json();return typeof r.displayName=="string"?{displayName:r.displayName}:{}}throw await this.failOnError(s,"PATCH /session/:id/metadata")})}},cP=class{constructor(e,t){this.client=e,this.workspaceSelector=t}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(e){return this.client.workspaceJsonRequest(this.workspaceSelector,"/voice","GET /workspaces/:workspace/voice",{clientId:e,mode:"rest"})}setWorkspaceVoice(e,t){return this.client.workspaceJsonRequest(this.workspaceSelector,"/voice","POST /workspaces/:workspace/voice",{method:"POST",body:e,clientId:t,mode:"rest"})}transcribeWorkspaceVoice(e,t){return this.client.workspaceVoiceTranscriptionRequest(this.workspaceSelector,e,t)}workspaceGit(e){let t=e?`/git?cwd=${encodeURIComponent(e)}`:"/git";return this.client.workspaceJsonRequest(this.workspaceSelector,t,"GET /workspaces/:workspace/git",{mode:"rest"})}workspaceGitDiff(){return this.client.workspaceJsonRequest(this.workspaceSelector,"/git/diff","GET /workspaces/:workspace/git/diff",{mode:"rest"})}workspaceGitDiffFile(e,t){let n=`/git/diff/file?path=${it(e)}`+(t!=null?`&oldPath=${it(t)}`:"");return this.client.workspaceJsonRequest(this.workspaceSelector,n,"GET /workspaces/:workspace/git/diff/file",{mode:"rest"})}workspaceGitLog(e,t){let n=new URLSearchParams;e!=null&&n.set("limit",String(e)),t!=null&&n.set("skip",String(t));let s=n.toString();return this.client.workspaceJsonRequest(this.workspaceSelector,`/git/log${s?`?${s}`:""}`,"GET /workspaces/:workspace/git/log",{mode:"rest"})}workspaceGitCommitDetail(e){return this.client.workspaceJsonRequest(this.workspaceSelector,`/git/log/commit?sha=${it(e)}`,"GET /workspaces/:workspace/git/log/commit",{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(e){let t=(e==null?void 0:e.force)===void 0?void 0:{force:e.force};return this.client.workspaceJsonRequest(this.workspaceSelector,"","DELETE /workspaces/:workspace",{method:"DELETE",...t?{body:t}:{},...(e==null?void 0:e.timeoutMs)!==void 0?{timeoutMs:e.timeoutMs}:{},mode:"rest"})}writeWorkspaceMemory(e,t){return this.post("/memory","POST /workspaces/:workspace/memory",{...e,scope:"workspace"},t)}listWorkspaceAgents(){return this.get("/agents","GET /workspaces/:workspace/agents")}createWorkspaceAgent(e,t){return this.post("/agents","POST /workspaces/:workspace/agents",{...e,scope:e.scope??"workspace"},t)}getWorkspaceAgent(e){return this.get(`/agents/${it(e)}`,"GET /workspaces/:workspace/agents/:agentType")}updateWorkspaceAgent(e,t,n={}){let s=n.scope?`?scope=${it(n.scope)}`:"";return this.post(`/agents/${it(e)}${s}`,"POST /workspaces/:workspace/agents/:agentType",t,n.clientId)}async deleteWorkspaceAgent(e,t={}){let n=t.scope?`?scope=${it(t.scope)}`:"";return await this.client.workspaceNoContentRequest(this.workspaceSelector,`/agents/${it(e)}${n}`,"DELETE /workspaces/:workspace/agents/:agentType",{method:"DELETE",clientId:t.clientId,okNotFoundCode:"agent_not_found"})}async listWorkspaceSessionsPage(e){((e==null?void 0:e.sourceType)!==void 0||(e==null?void 0:e.sourceId)!==void 0)&&await this.client.requireCapability("session_source_metadata");let t=(e==null?void 0:e.pageSize)??Y2,n=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(t)?t:Y2))),s=new URLSearchParams({size:String(n)});return(e==null?void 0:e.cursor)!==void 0&&s.set("cursor",e.cursor),(e==null?void 0:e.archiveState)!==void 0&&s.set("archiveState",e.archiveState),(e==null?void 0:e.view)!==void 0&&s.set("view",e.view),(e==null?void 0:e.group)!==void 0&&s.set("group",e.group),(e==null?void 0:e.parentSessionId)!==void 0&&s.set("parentSessionId",e.parentSessionId),(e==null?void 0:e.sourceType)!==void 0&&s.set("sourceType",e.sourceType),(e==null?void 0:e.sourceId)!==void 0&&s.set("sourceId",e.sourceId),await this.get(`/sessions?${s.toString()}`,"GET /workspaces/:workspace/sessions")}async listWorkspaceSessions(e){return(await this.listWorkspaceSessionsPage(e)).sessions}getWorkspaceSessionInfo(){return this.get("/session-info","GET /workspaces/:workspace/session-info")}getSessionTranscriptPage(e,t={}){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session/${it(e)}/transcript${pG(t)}`,"GET /workspaces/:workspace/session/:id/transcript",{clientId:t.clientId,mode:"rest"})}exportSession(e,t={}){return this.client.sessionExportRequest(`/workspaces/${this.workspaceSelector}/session/${it(e)}/export`,"GET /workspaces/:workspace/session/:id/export",t)}exportArchivedSession(e,t={}){return this.client.sessionExportRequest(`/workspaces/${this.workspaceSelector}/session/${it(e)}/archive/export`,"GET /workspaces/:workspace/session/:id/archive/export",t)}listSessionGroups(){return this.get("/session-groups","GET /workspaces/:workspace/session-groups")}async createSessionGroup(e){return(await this.post("/session-groups","POST /workspaces/:workspace/session-groups",e)).group}async updateSessionGroup(e,t){return(await this.client.workspaceJsonRequest(this.workspaceSelector,`/session-groups/${it(e)}`,"PATCH /workspaces/:workspace/session-groups/:groupId",{method:"PATCH",body:t})).group}deleteSessionGroup(e){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session-groups/${it(e)}`,"DELETE /workspaces/:workspace/session-groups/:groupId",{method:"DELETE"})}updateSessionOrganization(e,t,n){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session/${it(e)}/organization`,"PATCH /workspaces/:workspace/session/:id/organization",{method:"PATCH",body:t,clientId:n})}deleteSessionsData(e,t){return this.post("/sessions/delete","POST /workspaces/:workspace/sessions/delete",{sessionIds:e},t)}archiveSessionsData(e,t){return this.post("/sessions/archive","POST /workspaces/:workspace/sessions/archive",{sessionIds:e},t)}unarchiveSessionsData(e,t){return this.post("/sessions/unarchive","POST /workspaces/:workspace/sessions/unarchive",{sessionIds:e},t)}readWorkspaceFile(e,t={},n){let s=new URLSearchParams({path:e});return t.maxBytes!==void 0&&s.set("maxBytes",String(t.maxBytes)),t.line!==void 0&&s.set("line",String(t.line)),t.limit!==void 0&&s.set("limit",String(t.limit)),this.get(`/file?${s.toString()}`,"GET /workspaces/:workspace/file",n)}readWorkspaceFileBytes(e,t={},n){let s=new URLSearchParams({path:e});return t.offset!==void 0&&s.set("offset",String(t.offset)),t.maxBytes!==void 0&&s.set("maxBytes",String(t.maxBytes)),this.get(`/file/bytes?${s.toString()}`,"GET /workspaces/:workspace/file/bytes",n)}fileStat(e){let t=new URLSearchParams({path:e});return this.get(`/stat?${t.toString()}`,"GET /workspaces/:workspace/stat")}dirList(e){let t=new URLSearchParams({path:e});return this.get(`/list?${t.toString()}`,"GET /workspaces/:workspace/list")}glob(e,t={}){let n=new URLSearchParams({pattern:e});return t.maxResults!==void 0&&n.set("maxResults",String(t.maxResults)),this.client.workspaceJsonRequest(this.workspaceSelector,`/glob?${n.toString()}`,"GET /workspaces/:workspace/glob",{signal:t.signal})}writeWorkspaceFile(e,t){return this.post("/file/write","POST /workspaces/:workspace/file/write",e,t)}editWorkspaceFile(e,t){return this.post("/file/edit","POST /workspaces/:workspace/file/edit",e,t)}workspaceSettings(e){return this.get("/settings","GET /workspaces/:workspace/settings",e==null?void 0:e.clientId)}setWorkspaceSetting(e,t,n,s){return this.post("/settings","POST /workspaces/:workspace/settings",{scope:e,key:t,value:n,...s!=null&&s.mcpServerMutation?{mcpServerMutation:s.mcpServerMutation}:{}},s==null?void 0:s.clientId)}workspaceTrust(e){return this.get("/trust","GET /workspaces/:workspace/trust",e==null?void 0:e.clientId)}requestWorkspaceTrustChange(e,t){return this.post("/trust/request","POST /workspaces/:workspace/trust/request",e,t)}workspacePermissions(e){return this.get("/permissions","GET /workspaces/:workspace/permissions",e==null?void 0:e.clientId)}setWorkspacePermissionRules(e,t,n){return this.post("/permissions","POST /workspaces/:workspace/permissions",{scope:"workspace",ruleType:e,rules:[...t]},n==null?void 0:n.clientId)}setWorkspaceToolEnabled(e,t,n){return this.post(`/tools/${it(e)}/enable`,"POST /workspaces/:workspace/tools/:name/enable",{enabled:t},n==null?void 0:n.clientId)}setWorkspaceSkillEnabled(e,t,n){return this.post(`/skills/${it(e)}/enable`,"POST /workspaces/:workspace/skills/:name/enable",{enabled:t},n==null?void 0:n.clientId)}restartMcpServer(e,t){let n=(t==null?void 0:t.entryIndex)===void 0?"":`?entryIndex=${it(String(t.entryIndex))}`;return this.post(`/mcp/${it(e)}/restart${n}`,"POST /workspaces/:workspace/mcp/:server/restart",{},t==null?void 0:t.clientId,(t==null?void 0:t.timeoutMs)??G0)}reload(e){return this.post("/reload","POST /workspaces/:workspace/reload",{},e==null?void 0:e.clientId,e==null?void 0:e.timeoutMs)}initWorkspace(e){return this.post("/init","POST /workspaces/:workspace/init",(e==null?void 0:e.force)===!0?{force:!0}:{},e==null?void 0:e.clientId)}workspaceExtensions(){return this.client.workspaceJsonRequest(this.workspaceSelector,"/extensions","GET /workspaces/:workspace/extensions",{mode:"rest"})}setExtensionActivation(e,t,n){return this.client.workspaceJsonRequest(this.workspaceSelector,`/extensions/${it(e)}/activation`,"PUT /workspaces/:workspace/extensions/:extensionId/activation",{method:"PUT",body:{state:t},clientId:n,mode:"rest"})}clearExtensionActivation(e,t){return this.client.workspaceJsonRequest(this.workspaceSelector,`/extensions/${it(e)}/activation`,"DELETE /workspaces/:workspace/extensions/:extensionId/activation",{method:"DELETE",clientId:t,mode:"rest"})}refreshExtensionRuntime(e){return this.client.workspaceJsonRequest(this.workspaceSelector,"/extensions/refresh","POST /workspaces/:workspace/extensions/refresh",{method:"POST",body:{},clientId:e,mode:"rest"})}get(e,t,n){return this.client.workspaceJsonRequest(this.workspaceSelector,e,t,{clientId:n})}post(e,t,n,s,r){return this.client.workspaceJsonRequest(this.workspaceSelector,e,t,{method:"POST",body:n,clientId:s,timeoutMs:r})}};function JT(e){let t=AbortSignal.any;if(typeof t=="function")return t.call(AbortSignal,e);let n=new AbortController,s=[],r=()=>{for(;s.length>0;){let i=s.pop();try{i==null||i()}catch{}}};for(let i of e){if(i.aborted)return n.abort(i.reason),r(),n.signal;let o=()=>{n.abort(i.reason),r()};i.addEventListener("abort",o,{once:!0}),s.push(()=>i.removeEventListener("abort",o))}return n.signal.addEventListener("abort",r,{once:!0}),n.signal}function PN(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 yc(500,n.code??"turn_error",n.message??"Prompt failed"),{_daemonTurnError:!0})}}function uP(e){return"promptId"in e&&"lastEventId"in e}var Hb=class O_{constructor(t){Me(this,"client");Me(this,"session");Me(this,"state");Me(this,"replaySnapshot");Me(this,"hasActivePrompt");Me(this,"historyHasMore");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.historyHasMore=t.historyHasMore??!1,this.replaySnapshot=t.replaySnapshot??{compactedReplay:[],liveJournal:[]},this.lastSeenEventId=sk(t.lastEventId),this.promptLimit=t.maxPendingPromptsPerSession===void 0?t.client.maxPendingPromptsPerSession:gG(t.maxPendingPromptsPerSession)}static async createOrAttach(t,n={},s){let r=await t.createOrAttachSession(n,s),i=!r.attached||n.modelServiceId||n.approvalMode?0:void 0;return new O_({client:t,session:r,hasActivePrompt:r.hasActivePrompt,lastEventId:i})}static async load(t,n,s={},r){let{state:i,hasActivePrompt:o,compactedReplay:a,liveJournal:c,historyHasMore:u,lastEventId:d,...h}=await t.loadSession(n,s,r);return new O_({client:t,session:h,hasActivePrompt:o,state:i,lastEventId:d??0,replaySnapshot:{compactedReplay:a??[],liveJournal:c??[]},historyHasMore:u})}static async resume(t,n,s={},r){let{state:i,hasActivePrompt:o,lastEventId:a,...c}=await t.resumeSession(n,s,r);return new O_({client:t,session:c,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 worktree(){return this.session.worktree}get lastEventId(){return this.lastSeenEventId}setLastEventId(t){this.lastSeenEventId=sk(t)}async prompt(t,n){if(n==null||n.throwIfAborted(),!this.subscriptionActive)return await this.withClientIdSelfHeal(()=>this.client.prompt(this.sessionId,t,n,this.clientId));let s=this.client.reservePromptSlot(this.sessionId,this.promptLimit),r;try{if(r=await this.withClientIdSelfHeal(()=>this.client.promptNonBlocking(this.sessionId,t,n,this.clientId)),!uP(r))return s(),r;if(!this.subscriptionActive)throw Error("SSE stream ended")}catch(i){throw s(),i}return new Promise((i,o)=>{let a=()=>{let u=this._pendingPrompts.get(r.promptId);u&&this._pendingPrompts.delete(r.promptId)&&(this.client.cancel(this.sessionId,this.clientId).catch(()=>{}),u.reject(n.reason??new DOMException("Aborted","AbortError")))},c=()=>n==null?void 0:n.removeEventListener("abort",a);this._pendingPrompts.set(r.promptId,{resolve:u=>{c(),s(),i(u)},reject:u=>{c(),s(),o(u)}}),n!=null&&n.aborted?a():n==null||n.addEventListener("abort",a,{once:!0})})}async submitPrompt(t,n){n==null||n.throwIfAborted();let s=await this.withClientIdSelfHeal(()=>this.client.promptNonBlocking(this.sessionId,t,n,this.clientId));if(!uP(s))throw new Error("Expected non-blocking prompt acceptance");return s}async withClientIdSelfHeal(t){try{return await t()}catch(n){if(!qde(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=sk(t.lastEventId),s=!1,r=!1,i=()=>{r||(r=!0,this.subscriptionActive=!1)},o=()=>{if(!s){if(this.subscriptionActive)throw new Error("subscription active");this.subscriptionActive=!0,s=!0}},a=this.iterateEvents({...t,lastEventId:n},i);return{next:async c=>(r||o(),await a.next(c)),return:async()=>{try{return await a.return(void 0)}finally{i()}},throw:async c=>{try{return await a.throw(c)}finally{i()}},[Symbol.asyncIterator](){return this}}}async*iterateEvents(t,n){try{let{resume:s=!0,...r}=t,i=r.lastEventId??(s?this.lastSeenEventId:void 0);for await(let o of this.client.subscribeEvents(this.sessionId,{...r,lastEventId:i}))this._dispatchTurnEvent(o),yield o,o.id!==void 0&&(this.lastSeenEventId=Math.max(this.lastSeenEventId??0,sk(o.id)))}finally{this._rejectAllPending(new Error("SSE stream ended")),n()}}_dispatchTurnEvent(t){var r;if(t.type!=="turn_complete"&&t.type!=="turn_error")return;let n=(r=t.data)==null?void 0:r.promptId;if(!n)return;let s=this._pendingPrompts.get(n);if(s){this._pendingPrompts.delete(n);try{let i=PN(t,n);i!==void 0&&s.resolve(i)}catch(i){s.reject(i)}}}_rejectAllPending(t){for(let[,n]of this._pendingPrompts)n.reject(t);this._pendingPrompts.clear()}};function sk(e){if(e!==void 0){if(!Number.isInteger(e)||e<0)throw new TypeError("invalid lastEventId");return e}}function qde(e){return e instanceof yc&&e.status===400&&typeof e.body=="object"&&e.body!==null&&e.body.code==="invalid_client_id"}var yG="mid_turn_message_injected",ON="pending_prompt_added",BN="pending_prompt_started",$N="pending_prompt_completed",Ude=["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",yG,ON,BN,$N,"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(Ude);var L7="daemon-plan";function tn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ze(e,t){if(!tn(e))return;let n=e[t];return typeof n=="string"?n:void 0}function ur(e,t){if(tn(e))for(let n of t){let s=e[n];if(typeof s=="string"&&s.trim().length>0)return s}}function Rf(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 Qd(e){return Rf(Td(e))}function Td(e,t=0){return t>16?"[truncated]":Array.isArray(e)?e.map(n=>Td(n,t+1)):tn(e)?Object.fromEntries(Object.entries(e).map(([n,s])=>[n,xG(n)?"[redacted]":Td(s,t+1)])):e}function xG(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 ZT(e){if(typeof e=="string")return e;if(!tn(e))return"";let t=e.text;return typeof t=="string"?t:""}function Vde(e){if(typeof e=="string")return{kind:"text",text:e};if(!tn(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=tn(e.source)?e.source:void 0,s,r;return n&&(s=typeof n.url=="string"?n.url:void 0,r=typeof n.data=="string"?n.data:void 0),!s&&!r&&(r=typeof e.data=="string"?e.data:void 0,s=typeof e.url=="string"?e.url:void 0),!s&&!r?void 0:{kind:"image",mediaType:(typeof e.mediaType=="string"?e.mediaType:void 0)??(typeof e.mimeType=="string"?e.mimeType:void 0)??(typeof e.media_type=="string"?e.media_type:void 0)??(n&&typeof n.mediaType=="string"?n.mediaType:void 0)??"image/*",source:{...s?{url:s}:{},...r?{data:r}:{}}}}if(t==="audio"){let n=tn(e.source)?e.source:void 0;if(!n)return;let s=(typeof e.mediaType=="string"?e.mediaType:void 0)??"audio/*",r=typeof n.url=="string"?n.url:void 0,i=typeof n.data=="string"?n.data:void 0;return!r&&!i?void 0:{kind:"audio",mediaType:s,source:{...r?{url:r}:{},...i?{data:i}:{}}}}if(t==="resource"||t==="resource_link"){let n=typeof e.uri=="string"?e.uri:void 0;if(!n)return;let s=typeof e.mediaType=="string"?e.mediaType:void 0,r=typeof e.description=="string"?e.description:void 0;return{kind:"resource",uri:n,...s?{mediaType:s}:{},...r?{description:r}:{}}}}var Wde=64;function X2(e,t=0){if(t>Wde)return"[output truncated]";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(s=>X2(s,t+1)).filter(Boolean).join(`
`);if(!tn(e))return e===void 0?"":Rf(e);for(let s of["text","output","stdout","stderr","rawOutput"]){let r=e[s];if(typeof r=="string")return r}let n=e.content;if(n!==void 0){let s=X2(n,t+1);if(s)return s}return Rf(e)}var Gde=new Set(Dde),vG=new Set(["qwen","qwen-oauth"]),Kde=new Set(["in_flight","disabled","budget_would_exceed","authentication_required"]),dP="malformed memory_changed payload",hP=4096,fP="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 Yde(e,t={}){let n=she(e,t);switch(e.type){case"session_update":return rhe(e,n,t);case"shell_output":{let s=X2(e.data),r=O7(e.data),i=B7(e.data);return s?[{...n,type:i==="user-shell"?"user.shell.output":"shell.output",text:s,...r?{stream:r}:{}}]:[]}case"permission_request":return hhe(e,n);case"permission_resolved":case"permission_already_resolved":return fhe(e,n);case"model_switched":return[{...n,type:"model.changed",modelId:Ze(e.data,"modelId")??"unknown"}];case"model_switch_failed":return[{...n,type:"error",recoverable:!0,text:Ze(e.data,"error")??"Model switch failed (no details available)"}];case"session_died":{let s=e5(Ze(e.data,"errorKind"));return[{...n,type:"error",recoverable:!1,...s?{errorKind:s}:{},text:Ze(e.data,"reason")??"Session died (no details available)"}]}case"session_closed":return[{...n,type:"status",text:`Session closed: ${Ze(e.data,"reason")??"closed"}`}];case"session_recording_degraded":return!Ze(e.data,"sessionId")||Ze(e.data,"reason")!=="write_failed"?Hs(e,n,"malformed recording state"):[{...n,type:"error",recoverable:!0,code:"session_recording_degraded",text:fP}];case"session_snapshot":{if(!tn(e.data)||!Ze(e.data,"sessionId"))return Hs(e,n,"malformed recording snapshot");let s=e.data.recordingDegraded;return s!==void 0&&typeof s!="boolean"?Hs(e,n,"malformed recording snapshot"):s===!0?[{...n,type:"error",recoverable:!0,code:"session_recording_degraded",text:fP}]:[]}case"client_evicted":return[{...n,type:"error",recoverable:!0,text:Ze(e.data,"reason")??"SSE client evicted (no details available)"}];case"slow_client_warning":return[{...n,type:"status",text:"SSE stream is lagging"}];case"stream_error":{let s=e5(Ze(e.data,"errorKind"));return[{...n,type:"error",recoverable:!0,...s?{errorKind:s}:{},text:Ze(e.data,"error")??"SSE stream error (no details available)"}]}case"turn_error":{let s=Ze(e.data,"code"),r=e5(Ze(e.data,"errorKind")),i=Ze(e.data,"promptId");return[{...n,type:"error",source:"turn_error",recoverable:!0,...s?{code:s}:{},...r?{errorKind:r}:{},...i?{promptId:i}:{},text:Ze(e.data,"message")??"Prompt failed (no details available)"}]}case"state_resync_required":return Qde(e,n);case"history_truncated":return Jde(e,n);case"session_rewound":return Zde(e,n);case"session_branched":return ehe(e,n);case"prompt_cancelled":{let s=$he(e.data,"reason");return[{...n,type:"prompt.cancelled",...s?{reason:s}:{}}]}case"followup_suggestion":return the(e,n);case"mid_turn_message_injected":return nhe(e,n);case"pending_prompt_added":case"pending_prompt_started":case"pending_prompt_completed":return[];case"user_shell_command":{let s=Ze(e.data,"command"),r=Ze(e.data,"cwd");return s?[{...n,type:"user.shell.command",command:s,...r?{cwd:r}:{}},{...n,type:"user.text.delta",text:`$ ${s}`}]:[]}case"user_shell_result":{let s=Ir(e.data,"exitCode"),r=tn(e.data)&&e.data.aborted===!0?"Shell command was aborted":`Shell command exited with code ${s??"unknown"}`;return[{...n,type:"status",text:r}]}case"replay_complete":{let s=Ir(e.data,"replayedCount")??0,r=Ir(e.data,"lastReplayedEventId")??Ir(e.data,"lastEventId");return[{...n,type:"session.replay_complete",replayedCount:s,...r!==void 0?{lastReplayedEventId:r}:{}}]}case"session_metadata_updated":return bhe(e,n);case"approval_mode_changed":return xhe(e,n);case"git_branch_changed":return[];case"memory_changed":return vhe(e,n);case"agent_changed":return whe(e,n);case"tool_toggled":return khe(e,n);case"settings_changed":return _he(e,n);case"settings_reloaded":return She(e,n);case"trust_change_requested":return The(e,n);case"workspace_initialized":return Che(e,n);case"github_setup_completed":return Ehe(e,n);case"mcp_budget_warning":return Ahe(e,n);case"mcp_child_refused_batch":return Nhe(e,n);case"mcp_server_restarted":return jhe(e,n);case"mcp_server_restart_refused":return Mhe(e,n);case"mcp_server_added":return t5(e,n,"added");case"mcp_server_removed":return t5(e,n,"removed");case"mcp_server_changed":return t5(e,n);case"extensions_changed":return Ihe(e,n);case"artifact_changed":return yhe(e,n);case"auth_device_flow_started":return Rhe(e,n);case"auth_device_flow_throttled":return Dhe(e,n);case"auth_device_flow_authorized":return Lhe(e,n);case"auth_device_flow_failed":return Phe(e,n);case"auth_device_flow_cancelled":return Bhe(e,n);default:return Xde(e,n)}}function Xde(e,t){return[{...t,type:"debug",text:`${e.type} (unrecognized daemon event): ${Qd(e.data)}`}]}function Qde(e,t){let n=Ze(e.data,"reason"),s=Ir(e.data,"lastDeliveredId"),r=Ir(e.data,"earliestAvailableId");return!n||s===void 0||r===void 0?Hs(e,t,"malformed state_resync_required payload"):[{...t,type:"session.state_resync_required",reason:n,lastDeliveredId:s,earliestAvailableId:r}]}function Jde(e,t){let n=Ze(e.data,"reason"),s=Ir(e.data,"truncatedEvents"),r=Ir(e.data,"retainedEvents"),i=Ir(e.data,"maxBytes");return n!=="replay_window_exceeded"||s===void 0||r===void 0||i===void 0||!tn(e.data)||typeof e.data.fullTranscriptAvailable!="boolean"?Hs(e,t,"malformed history_truncated payload"):[{...t,type:"status",text:`History truncated: retained ${r}, dropped ${s} (window ${i} bytes).`,source:"history_truncated"}]}function Zde(e,t){let n=Ze(e.data,"promptId"),s=Ir(e.data,"targetTurnIndex");if(!n||s===void 0)return Hs(e,t,"malformed session_rewound payload");let r=Ze(e.data,"sessionId");return[{...t,type:"session.rewound",promptId:n,targetTurnIndex:s,...r?{sessionId:r}:{}}]}function ehe(e,t){let n=Ze(e.data,"sourceSessionId"),s=Ze(e.data,"newSessionId"),r=Ze(e.data,"displayName");return!n||!s||!r?Hs(e,t,"malformed session_branched payload"):[{...t,type:"session.branched",sourceSessionId:n,newSessionId:s,displayName:r}]}function the(e,t){let n=Ze(e.data,"sessionId"),s=Ze(e.data,"suggestion"),r=Ze(e.data,"promptId");return!n||!s||!r?Hs(e,t,"malformed followup_suggestion payload"):[{...t,type:"followup.suggestion",sessionId:n,suggestion:s,promptId:r}]}function nhe(e,t){if(!tn(e.data))return Hs(e,t,"malformed mid_turn_message_injected");let n=Array.isArray(e.data.messages)?e.data.messages.filter(s=>typeof s=="string"&&s.length>0):[];return n.length===0?Hs(e,t,"malformed mid_turn_message_injected"):[{...t,type:"status",text:`Inserted message: ${n.join(`
`)}`,source:"mid_turn_message_injected",data:e.data}]}function she(e,t){let n=wG(e),s=ihe(e);return{...e.id!==void 0?{eventId:e.id}:{},...n!==void 0?{serverTimestamp:n}:{},...s?{sourceRecordIds:s}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},...t.includeRawEvent?{rawEvent:{...e,data:Td(e.data)}}:{}}}function wG(e){let t=e.serverTimestamp;if(typeof t=="number"&&Number.isFinite(t))return t;let n=e._meta;if(tn(n)){let s=n.serverTimestamp;if(typeof s=="number"&&Number.isFinite(s))return s}if(tn(e.data)){let s=e.data._meta;if(tn(s)){let i=s.serverTimestamp;if(typeof i=="number"&&Number.isFinite(i))return i}let r=e.data.update;if(tn(r)){let i=r._meta;if(tn(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 rhe(e,t,n){let s=kG(e.data);if(!s)return[{...t,type:"debug",text:`session_update: ${Qd(e.data)}`}];let r=Ze(s,"sessionUpdate");switch(r){case"user_message_chunk":{if(n.suppressOwnUserEcho&&n.clientId&&e.originatorClientId===n.clientId)return[];let i=pP(s),o=s.content,a=Vde(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 c=ZT(o);return c?[{...t,type:"user.text.delta",text:c,...i?{meta:i}:{}}]:[]}case"agent_message_chunk":{let i=ZT(s.content),o=mP(s),a=pP(s),c=[];i&&c.push({...t,type:"assistant.text.delta",text:i,...o?{parentToolCallId:o}:{},...a?{meta:a}:{}});let u=ohe(s);return u&&c.push({...t,type:"assistant.usage",usage:u,...o?{parentToolCallId:o}:{}}),c}case"agent_thought_chunk":{let i=ZT(s.content);if(!i)return[];let o=mP(s);return[{...t,type:"thought.text.delta",text:i,...o?{parentToolCallId:o}:{}}]}case"tool_call":case"tool_call_update":{let i=tn(s._meta)?s._meta:void 0;return Ze(s,"status")==="in_progress"&&Ze(s,"kind")===void 0&&(i==null?void 0:i.shellProgress)!==void 0?[]:[ahe(s,t)]}case"shell_output":case"tool_output":{let i=X2(s),o=O7(s)??O7(e.data),a=B7(s)??B7(e.data);return i?[{...t,type:a==="user-shell"?"user.shell.output":"shell.output",text:i,...o?{stream:o}:{}}]:[]}case"available_commands_update":{let i=(Array.isArray(s.availableCommands)?s.availableCommands:[]).filter(tn);return[{...t,type:"session.available_commands",count:i.length,commands:i}]}case"plan":return[lhe(s,t)];case"current_mode_update":return[];default:return[{...t,type:"debug",text:`${r??"session_update"}: ${Qd(s)}`}]}}function mP(e){let t=tn(e._meta)?e._meta:void 0;return t?Ze(t,"parentToolCallId"):void 0}function pP(e){let t=tn(e._meta)?e._meta:void 0;if(!t)return;let{qwenTranscript:n,...s}=t;return Object.keys(s).length>0?s:void 0}function ihe(e){var i;if(!tn(e.data))return;let t=kG(e.data),n=t&&tn(t._meta)?t._meta:void 0,s=(i=n&&tn(n.qwenTranscript)?n.qwenTranscript:void 0)==null?void 0:i.sourceRecordIds;if(!Array.isArray(s))return;let r=[...new Set(s.filter(o=>typeof o=="string"))];return r.length>0?r:void 0}function ohe(e){let t=tn(e._meta)?e._meta:void 0,n=t&&tn(t.usage)?t.usage:void 0;if(!n)return;let s=Ir(n,"inputTokens"),r=Ir(n,"outputTokens");if(s===void 0&&r===void 0)return;let i=Ir(n,"cachedReadTokens");return{inputTokens:s??0,outputTokens:r??0,...i!==void 0?{cachedTokens:i}:{}}}function ahe(e,t){let n=tn(e._meta)?e._meta:void 0,s=Ze(e,"toolName")??Ze(e,"name")??(n?Ze(n,"toolName"):void 0)??(n?Ze(n,"name"):void 0),r=Ze(e,"kind"),i=Ze(e,"title")??s??r,o=e.rawInput??e.input??e.args,a=e.rawOutput??e.output??e.result,c=o!==void 0?Td(o):void 0,u=a!==void 0?Td(a):void 0,d=e.content!==void 0?Td(e.content):void 0,h=e.locations!==void 0?Td(e.locations):void 0,m=Ze(e,"toolCallId"),p=Ze(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}=dhe(e,s),v=Ze(e,"parentToolCallId")??(n?Ze(n,"parentToolCallId"):void 0),x=v&&v!==m?v:void 0,y=Ze(e,"subagentType")??(n?Ze(n,"subagentType"):void 0);return{...t,type:"tool.update",toolCallId:m,...p?{status:p}:{},...i?{title:i}:{},...s?{toolName:s}:{},...r?{toolKind:r}:{},...d!==void 0?{content:d}:{},...h!==void 0?{locations:h}:{},...g?{provenance:g}:{},...b?{serverId:b}:{},...x?{parentToolCallId:x}:{},...y?{subagentType:y}:{},...c!==void 0?{rawInput:c}:{},...u!==void 0?{rawOutput:u}:{},...c!==void 0?{details:P7(Qd(c))}:u!==void 0?{details:P7(Qd(u))}:{}}}function lhe(e,t){let n=Array.isArray(e.entries)?e.entries:[],s=P7(che(n)),r=tn(e._meta)?e._meta:void 0,i=r&&tn(r.qwenTranscript)?r.qwenTranscript:void 0,o=Ze(i,"planToolCallId")??(t.eventId!==void 0?`${L7}-${t.eventId}`:L7),a=r&&tn(r.stats)?r.stats:void 0;return{...t,type:"tool.update",toolCallId:o,title:"Updated Plan",status:"completed",toolName:"todo_write",toolKind:"updated_plan",content:[{type:"content",content:{type:"text",text:s}}],rawOutput:a?{entries:n,stats:a}:{entries:n}}}function che(e){return e.flatMap(t=>{if(!tn(t))return[];let n=Ze(t,"content");return n?[`- [${uhe(Ze(t,"status"))}] ${n}`]:[]}).join(`
`)}function uhe(e){switch(e){case"completed":return"x";case"in_progress":return"-";default:return" "}}function dhe(e,t){let n=Ze(e,"provenance"),s=Ze(e,"serverId");if(n==="builtin"||n==="mcp"||n==="subagent")return{provenance:n,...n==="mcp"&&s?{serverId:s}:{}};if(t&&t.startsWith("mcp__")){let r=t.slice(5),i=r.indexOf("__");if(i>0)return{provenance:"mcp",serverId:r.slice(0,i)}}return{}}function e5(e){if(e)return Gde.has(e)?e:void 0}function P7(e){return e.length<=hP?e:`${e.slice(0,hP)}... [truncated]`}function hhe(e,t){if(!tn(e.data))return[{...t,type:"debug",text:`permission_request: ${Qd(e.data)}`}];let n=Ze(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`permission_request: ${Qd(e.data)}`}];let s=e.data.toolCall!==void 0?Td(e.data.toolCall):void 0;return[{...t,type:"permission.request",requestId:n,sessionId:Ze(e.data,"sessionId"),title:ghe(s),options:mhe(e.data.options),toolCall:s}]}function fhe(e,t){let n=Ze(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`${e.type}: ${Qd(e.data)}`}];let s=Ze(e.data,"voterClientId")??t.originatorClientId;return[{...t,type:"permission.resolved",requestId:n,outcome:phe(e.data),...s?{voterClientId:s}:{}}]}function kG(e){if(!tn(e))return;let t=e.update;return tn(t)?t:e}function mhe(e){return Array.isArray(e)?e.flatMap(t=>{if(!tn(t))return[];let n=Ze(t,"optionId");return n?[{optionId:n,label:Ze(t,"label")??Ze(t,"title")??Ze(t,"name")??n,...Ze(t,"description")?{description:Ze(t,"description")}:{},raw:t}]:[]}):[]}function phe(e){if(!tn(e))return Rf(e);let t=e.outcome;if(typeof t=="string")return t;if(tn(t)){let n=Ze(t,"outcome")??"selected",s=Ze(t,"optionId");return s?`${n}:${s}`:n}return ur(e,["status","reason"])??Rf(e)}function ghe(e){return tn(e)?Ze(e,"title")??Ze(e,"name")??Ze(e,"kind")??Ze(e,"toolName")??"Tool permission":"Tool permission"}function O7(e){let t=Ze(e,"stream");return t==="stdout"||t==="stderr"?t:void 0}function B7(e){if(!tn(e))return;let t=Ze(e,"source");if(t)return t;let n=e._meta;return tn(n)?Ze(n,"source"):void 0}function Hs(e,t,n){return[{...t,type:"debug",text:`${e.type}: ${n}`}]}function bhe(e,t){let n=Ze(e.data,"sessionId");if(!n)return Hs(e,t,"missing sessionId");let s=Ze(e.data,"displayName");return[{...t,type:"session.metadata.changed",sessionId:n,...s!==void 0?{displayName:s}:{}}]}function yhe(e,t){let n=Ze(e.data,"sessionId"),s=tn(e.data)?e.data.change:void 0;if(!n||!tn(s))return Hs(e,t,"malformed artifact_changed payload");let r=Ze(s,"action"),i=Ze(s,"artifactId");return!r||!i?Hs(e,t,"missing action or artifactId"):[{...t,type:"session.artifact.changed",sessionId:n,change:s}]}function xhe(e,t){let n=Ze(e.data,"sessionId"),s=Ze(e.data,"previous"),r=Ze(e.data,"next");if(!n||!s||!r)return Hs(e,t,"missing sessionId / previous / next");let i=tn(e.data)&&typeof e.data.persisted=="boolean"?e.data.persisted:!1;return[{...t,type:"session.approval_mode.changed",sessionId:n,previous:s,next:r,persisted:i}]}function vhe(e,t){var o;let n=Ze(e.data,"scope");if(n==="managed"){let a=Ze(e.data,"source"),c=Ze(e.data,"taskId"),u=(o=e.data)==null?void 0:o.touchedScopes;return!(a&&c&&Array.isArray(u))||u.some(d=>d!=="user"&&d!=="project")?Hs(e,t,dP):[{...t,type:"workspace.memory.changed",scope:n,source:a,taskId:c,touchedScopes:u}]}let s=Ze(e.data,"filePath"),r=Ze(e.data,"mode"),i=Ir(tn(e.data)?e.data:void 0,"bytesWritten");return n!=="workspace"&&n!=="global"||!s||r!=="append"&&r!=="replace"||i===void 0?Hs(e,t,dP):[{...t,type:"workspace.memory.changed",scope:n,filePath:s,mode:r,bytesWritten:i}]}function whe(e,t){let n=Ze(e.data,"change"),s=Ze(e.data,"name"),r=Ze(e.data,"level");return n!=="created"&&n!=="updated"&&n!=="deleted"||!s||r!=="project"&&r!=="user"?Hs(e,t,"malformed agent_changed payload"):[{...t,type:"workspace.agent.changed",change:n,name:s,level:r}]}function khe(e,t){let n=Ze(e.data,"toolName"),s=tn(e.data)&&typeof e.data.enabled=="boolean"?e.data.enabled:void 0;return!n||s===void 0?Hs(e,t,"malformed tool_toggled payload"):[{...t,type:"workspace.tool.toggled",toolName:n,enabled:s}]}function _he(e,t){let n=Ze(e.data,"key"),s=Ze(e.data,"scope");return n?[{...t,type:"workspace.settings.changed",key:n,scope:s??"workspace",value:tn(e.data)?e.data.value:void 0}]:Hs(e,t,"malformed settings_changed payload")}function She(e,t){return tn(e.data)?[{...t,type:"workspace.settings.changed",key:"settings_reloaded",scope:"workspace",value:e.data}]:Hs(e,t,"malformed settings_reloaded payload")}function Che(e,t){let n=Ze(e.data,"path"),s=Ze(e.data,"action");return!n||s!=="created"&&s!=="overwrote"&&s!=="noop"?Hs(e,t,"malformed workspace_initialized payload"):[{...t,type:"workspace.initialized",path:n,action:s}]}function The(e,t){let n=Ze(e.data,"workspaceCwd"),s=Ze(e.data,"desiredState"),r=Ze(e.data,"reason");return!n||s!=="trusted"&&s!=="untrusted"?Hs(e,t,"bad trust_change_requested payload"):[{...t,type:"workspace.trust.change.requested",workspaceCwd:n,desiredState:s,...r!==void 0?{reason:r}:{}}]}function Ehe(e,t){let n=Ze(e.data,"releaseTag"),s=Ze(e.data,"readmeUrl");if(!n||!s||!tn(e.data))return Hs(e,t,"malformed github_setup_completed payload");let r=e.data.workflows,i=e.data.warnings;return[{...t,type:"workspace.github.setup.completed",releaseTag:n,readmeUrl:s,...typeof e.data.secretsUrl=="string"?{secretsUrl:e.data.secretsUrl}:{},workflows:Array.isArray(r)?r:[],gitignore:e.data.gitignore,warnings:Array.isArray(i)?i.filter(o=>typeof o=="string"):[]}]}function Ahe(e,t){if(!tn(e.data))return Hs(e,t,"non-object payload");let n=Ir(e.data,"liveCount"),s=Ir(e.data,"reservedCount"),r=Ir(e.data,"budget"),i=Ir(e.data,"thresholdRatio"),o=Ze(e.data,"mode");return n===void 0||s===void 0||r===void 0||i===void 0||o!=="warn"&&o!=="enforce"?Hs(e,t,"malformed mcp_budget_warning payload"):[{...t,type:"workspace.mcp.budget_warning",liveCount:n,reservedCount:s,budget:r,thresholdRatio:i,mode:o}]}function Nhe(e,t){if(!tn(e.data))return Hs(e,t,"non-object payload");let n=Array.isArray(e.data.refusedServers)?e.data.refusedServers.filter(tn).map(o=>{let a=Ze(o,"name"),c=Ze(o,"transport"),u=Ze(o,"reason");return!a||!c||u!=="budget_exhausted"?null:{name:a,transport:c,reason:"budget_exhausted"}}).filter(o=>o!==null):[],s=Ir(e.data,"budget"),r=Ir(e.data,"liveCount"),i=Ir(e.data,"reservedCount");return n.length===0||s===void 0||r===void 0||i===void 0?Hs(e,t,"malformed mcp_child_refused_batch payload"):[{...t,type:"workspace.mcp.child_refused",refusedServers:n,budget:s,liveCount:r,reservedCount:i}]}function jhe(e,t){let n=Ze(e.data,"serverName"),s=Ir(e.data,"durationMs");return!n||s===void 0?Hs(e,t,"malformed mcp_server_restarted payload"):[{...t,type:"workspace.mcp.server_restarted",serverName:n,durationMs:s}]}function Mhe(e,t){let n=Ze(e.data,"serverName"),s=Ze(e.data,"reason");return!n||!s||!Kde.has(s)?Hs(e,t,"malformed mcp_server_restart_refused payload"):[{...t,type:"workspace.mcp.server_restart_refused",serverName:n,reason:s}]}function t5(e,t,n){let s=Ze(e.data,n?"name":"serverName"),r=n??Ze(e.data,"action");return!s||!r||!["added","removed","approve","enable","disable","authenticate","clear-auth"].includes(r)?Hs(e,t,`malformed ${e.type} payload`):[{...t,type:"workspace.mcp.server_changed",serverName:s,action:r}]}function Ihe(e,t){let n=Ir(e.data,"refreshed"),s=Ir(e.data,"failed"),r=Ze(e.data,"status"),i=Ze(e.data,"source"),o=Ze(e.data,"name"),a=Ze(e.data,"version"),c=Ze(e.data,"error");return n===void 0||s===void 0||r!==void 0&&r!=="installed"&&r!=="enabled"&&r!=="disabled"&&r!=="updated"&&r!=="uninstalled"&&r!=="failed"?Hs(e,t,"malformed extensions_changed payload"):[{...t,type:"workspace.extensions.changed",refreshed:n,failed:s,...r?{status:r}:{},...i?{source:i}:{},...o?{name:o}:{},...a?{version:a}:{},...c?{error:c}:{}}]}function Rhe(e,t){let n=Ze(e.data,"deviceFlowId"),s=Ze(e.data,"providerId"),r=Ir(e.data,"expiresAt");return!n||!s||!vG.has(s)||r===void 0?Hs(e,t,"malformed auth_device_flow_started payload"):[{...t,type:"auth.device_flow.started",deviceFlowId:n,providerId:s,expiresAt:r}]}function Dhe(e,t){let n=Ze(e.data,"deviceFlowId"),s=Ir(e.data,"intervalMs");return!n||s===void 0?Hs(e,t,"malformed auth_device_flow_throttled payload"):[{...t,type:"auth.device_flow.throttled",deviceFlowId:n,intervalMs:s}]}function Lhe(e,t){let n=Ze(e.data,"deviceFlowId"),s=Ze(e.data,"providerId");if(!n||!s||!vG.has(s))return Hs(e,t,"malformed auth_device_flow_authorized payload");let r=Ir(e.data,"expiresAt"),i=Ze(e.data,"accountAlias");return[{...t,type:"auth.device_flow.authorized",deviceFlowId:n,providerId:s,...r!==void 0?{expiresAt:r}:{},...i?{accountAlias:i}:{}}]}function Phe(e,t){let n=Ze(e.data,"deviceFlowId"),s=Ze(e.data,"errorKind");if(!n||!Ohe(s))return Hs(e,t,"malformed auth_device_flow_failed payload");let r=Ze(e.data,"hint");return[{...t,type:"auth.device_flow.failed",deviceFlowId:n,errorKind:s,...r?{hint:r}:{}}]}function Ohe(e){return typeof e=="string"&&e.trim().length>0}function Bhe(e,t){let n=Ze(e.data,"deviceFlowId");return n?[{...t,type:"auth.device_flow.cancelled",deviceFlowId:n}]:Hs(e,t,"malformed auth_device_flow_cancelled payload")}function Ir(e,t){if(!tn(e))return;let n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function $he(e,t){if(!tn(e))return;let n=e[t];return typeof n=="string"&&n.length>0?n:void 0}var zhe=8;function Q2(e,t={},n=0){if(n>zhe){let g=t.title??t.toolName??t.toolKind;return{kind:"generic",...g?{summary:g}:{}}}if(tn(e)){let g=e.rawInput??e.input??e.args;if(g!==void 0&&g!==e){let b=Q2(g,{title:t.title??ur(e,["title"]),toolName:t.toolName??ur(e,["toolName","name"]),toolKind:t.toolKind??ur(e,["kind"])},n+1);if(b.kind!=="generic"||!b.summary)return b}}let s=Vhe(e);if(s.length>0)return{kind:"ask_user_question",questions:s};let r=Uhe(e,t);if(r)return r;let i=Yhe(e,t);if(i)return i;let o=Xhe(e,t);if(o)return o;let a=Qhe(e,t);if(a)return a;let c=Fhe(e,t);if(c)return c;let u=Hhe(e,t);if(u)return u;let d=qhe(e);if(d)return d;let h=Jhe(e,t);if(h)return h;let m=Zhe(e);if(m)return m;if(tn(e)){let g=ur(e,["command","cmd"]);if(g){let v=ur(e,["cwd","directory","workingDirectory"]);return{kind:"command",command:g,...v?{cwd:v}:{}}}let b=Ghe(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 Fhe(e,t={}){if(!tn(e))return;let n=ur(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let s=ur(e,["oldText","old_text","old_str","oldString"]),r=ur(e,["newText","new_text","new_str","newString"]),i=(t.toolName??"").toLowerCase(),o=/(?:^|[_-])(write|create|edit|replace|save|update|overwrite|modify|patch|generate)(?:$|[_-])/.test(i)||!!s,a=r===void 0&&o?ur(e,["content"]):void 0,c=r??a,u=ur(e,["patch","diff","unified_diff"]);if(!(!s&&!c&&!u))return{kind:"file_diff",path:n,...s?{oldText:s}:{},...c?{newText:c}:{},...u?{patch:u}:{}}}function Hhe(e,t){if(!tn(e))return;let n=ur(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let s=t.toolName??ur(e,["toolName","name"]),r=s!==void 0&&/read|view|cat/i.test(s),i=e.lineRange??e.line_range??e.range,o;if(Array.isArray(i)&&i.length===2&&typeof i[0]=="number"&&typeof i[1]=="number")o=[i[0],i[1]];else{let a=e.offset,c=e.limit;typeof a=="number"&&typeof c=="number"&&c>0&&(o=[a+1,a+c])}if(!(!r&&!o))return{kind:"file_read",path:n,...o?{range:o}:{}}}function qhe(e){if(!tn(e))return;let t=ur(e,["url","uri","href"]);if(!t||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t))return;let n=ur(e,["method","httpMethod"]);return{kind:"web_fetch",url:t,...n?{method:n}:{}}}function Uhe(e,t){let n=t.toolName??(tn(e)?ur(e,["toolName","name"]):void 0);if(!n||!n.startsWith("mcp__"))return;let s=n.slice(5),r=s.indexOf("__");if(r<=0)return;let i=s.slice(0,r),o=s.slice(r+2),a;if(tn(e)){let c=e.arguments??e.args??e;if(tn(c)){let u=Object.entries(c).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 Vhe(e){return!tn(e)||!Array.isArray(e.questions)?[]:e.questions.filter(tn).map(t=>{let n=ur(t,["header","title","label"]),s=ur(t,["question","prompt","text"])??"Question",r=Array.isArray(t.options)?t.options.filter(tn).map(Whe):[];return{...n?{header:n}:{},question:s,options:r,raw:t}})}function Whe(e){let t=ur(e,["label","title","value"])??"Option",n=ur(e,["description","detail","text"]);return{label:t,...n?{description:n}:{},raw:e}}function Ghe(e){let t=[],n=[["Path",["path","filePath","file_path","absolutePath"]],["Cwd",["cwd","directory","workingDirectory"]],["Query",["query","pattern","search"]],["Note",["description","reason"]]];for(let[s,r]of n){let i=ur(e,r);i&&t.push({label:s,value:i})}if(t.length>0)return t;for(let[s,r]of Object.entries(e).slice(0,4))r==null||Array.isArray(r)||tn(r)||t.push({label:s,value:xG(s)?"[redacted]":Qd(r)});return t}var gP=50,Khe=5;function Yhe(e,t){let n=t.toolName??"";if(!(/^task$/i.test(n)||/(?:^|_)(?:delegate|subagent|spawn[_-]?task)$/i.test(n)||/agent/i.test(t.toolKind??""))||!tn(e))return;let s=ur(e,["subagent_type","agent","agentName","agent_name","subagent"]),r=ur(e,["prompt","task","description","instruction","query"]);if(!s&&!r)return;let i=ur(e,["parentDelegationId","parent_delegation_id","parent_id"]);return{kind:"subagent_delegation",agentName:s??"subagent",task:r??"(no task description)",...i?{parentDelegationId:i}:{}}}function Xhe(e,t){if(!tn(e))return;let n=ur(e,["query","pattern","search","q"]);if(!n)return;let s=t.toolName??"";if(!(/(grep|search|find|ripgrep|rg|glob|lookup)/i.test(s)||typeof e.resultCount=="number"||Array.isArray(e.results)||Array.isArray(e.matches)))return;let r=typeof e.resultCount=="number"?e.resultCount:typeof e.total=="number"?e.total:Array.isArray(e.results)?e.results.length:Array.isArray(e.matches)?e.matches.length:void 0,i,o=e.results??e.matches;return Array.isArray(o)&&(i=o.slice(0,Khe).map(a=>typeof a=="string"?a:tn(a)?ur(a,["path","file","name","title","text"])??Rf(a).slice(0,120):String(a)).filter(Boolean),i.length===0&&(i=void 0)),{kind:"search",query:n,...r!==void 0?{resultCount:r}:{},...i?{top:i}:{}}}function Qhe(e,t){let n=t.toolName??"";if(!/(image[_-]?gen|generate[_-]?image|diffusion|dalle|imagen|flux|stable[_-]?diffusion|midjourney|sora)/i.test(n)||!tn(e))return;let s=ur(e,["prompt","description","query"]);if(!s)return;let r=ur(e,["thumbnailUrl","thumbnail","url","imageUrl","preview"]),i=ur(e,["model","modelId","model_name"]);return{kind:"image_generation",prompt:s,...r?{thumbnailUrl:r}:{},...i?{model:i}:{}}}function Jhe(e,t){if(!tn(e))return;let n=ur(e,["code","snippet","source"]);if(!n)return;let s=ur(e,["language","lang","codeLanguage","syntax"]),r=t.toolName??"",i=/(repl|format|prettier|eslint|tsc|compile|exec[_-]?code)/i.test(r);if(!s&&!i)return;let o=ur(e,["origin","source_location","path"]);return{kind:"code_block",code:n,...s?{language:s}:{},...o?{origin:o}:{}}}function Zhe(e){if(!tn(e))return;let t=e.columns,n=e.rows;if(Array.isArray(t)&&Array.isArray(n)){let r=t.filter(o=>typeof o=="string").slice(0,30);if(r.length===0)return;let i=n.slice(0,gP).map(o=>Array.isArray(o)?o.map(a=>typeof a=="string"?a:Rf(a).slice(0,80)):[]);return{kind:"tabular",columns:r,rows:i,...n.length>i.length?{totalRows:n.length}:{}}}let s=e.data??e.records;if(Array.isArray(s)&&s.length>0&&tn(s[0])){let r=Object.keys(s[0]).slice(0,30);if(r.length===0)return;let i=s.slice(0,gP).map(o=>{let a=o;return r.map(c=>{let u=a[c];return typeof u=="string"?u:Rf(u).slice(0,80)})});return{kind:"tabular",columns:r,rows:i,...s.length>i.length?{totalRows:s.length}:{}}}}var efe=1e3,wp="__trimmed_tool_block__",G4="__trimmed_permission_block__",$7=1e5,bP=`
[truncated]
`,tfe=16,Tx=new WeakMap;function nfe(e={}){let t={blocks:[],blockIndexById:Fi(),toolBlockByCallId:Fi(),trimmedToolNotificationByCallId:Fi(),permissionBlockByRequestId:Fi(),activeAssistantBlockByParent:Fi(),activeThoughtBlockByParent:Fi(),toolProgress:Fi(),awaitingResync:!1,resyncRequiredCount:0,nextOrdinal:1,now:e.now??Date.now(),maxBlocks:e.maxBlocks??efe};return e.onTruncation&&Tx.set(t,e.onTruncation),t}var zN=new Set(["pending","confirming","running","in_progress"]),sfe=new Set(["completed","success","failed","error","canceled","cancelled"]),rfe=new Set(["session.state_resync_required","assistant.done","status","debug","error"]);function ife(e,t,n={}){let s=TG(e,n);UN(s);let r=VN(s,"user",t,void 0,void 0,n.meta);return n.images&&n.images.length>0&&(r.images=[...n.images]),Hu(s,r),s.activeUserBlockId=r.id,EG(s)}function ofe(e,t,n={}){if(t.length===0)return e;let s=TG(e,n);for(let i of t)afe(s,i);return EG(s)}function FN(e){let t=Fi();return e.forEach((n,s)=>{t[n.id]=s}),t}function afe(e,t){var n;if(t.eventId!==void 0&&(e.lastEventId=Math.max(e.lastEventId??0,t.eventId)),e.awaitingResync&&!rfe.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),n5(e,"user","activeUserBlockId",t.text,t);break;case"user.image.delta":{let s=e.activeUserBlockId?e.blockIndexById[e.activeUserBlockId]:void 0,r=s!==void 0?e.blocks[s]:void 0;if((r==null?void 0:r.kind)!=="user"||!NG(r.sourceRecordIds,t.sourceRecordIds)){let i=VN(e,"user","",t.eventId,t.serverTimestamp,void 0,t.sourceRecordIds);i.images=[{data:t.data,mimeType:t.mimeType}],Hu(e,i),e.activeUserBlockId=i.id}else{let i=xc(e,e.activeUserBlockId);i&&i.kind==="user"&&(i.images=[...i.images??[],{data:t.data,mimeType:t.mimeType}])}break}case"assistant.text.delta":n5(e,"assistant","activeAssistantBlockId",t.text,t);break;case"assistant.done":UN(e,t),(t.reason==="cancelled"||t.reason==="error")&&z7(e);break;case"assistant.usage":ufe(e,t);break;case"thought.text.delta":n5(e,"thought","activeThoughtBlockId",t.text,t);break;case"tool.update":CG(e,t);break;case"shell.output":ffe(e,t);break;case"user.shell.output":mfe(e,t);break;case"permission.request":pfe(e,t);break;case"permission.resolved":gfe(e,t);break;case"model.changed":Vy(e,"status",`Model switched: ${t.modelId}`,t);break;case"status":case"debug":case"error":Vy(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":lfe(e,t);break;case"prompt.cancelled":z7(e),t.reason!=="forward_failed"&&bfe(e,t);break;case"followup.suggestion":e.lastFollowupSuggestion={suggestion:t.suggestion,promptId:t.promptId};break;case"session.replay_complete":break;case"session.rewound":xfe(e,t.targetTurnIndex);break;case"session.branched":Vy(e,"status",`Branched conversation "${t.displayName}". You are now in the branch.`,t);break}}function lfe(e,t){e.awaitingResync=!0,e.resyncRequiredCount+=1,e.lastResyncRequired={reason:t.reason,lastDeliveredId:t.lastDeliveredId,earliestAvailableId:t.earliestAvailableId},z7(e),Vy(e,"error",`State resync required: ${cfe(t.lastDeliveredId,t.earliestAvailableId)}.`,t)}function cfe(e,t){let n=e+1,s=t-1;return s<n?"no events lost (resync requested without gap)":s===n?`missed 1 daemon event (id ${n})`:`missed daemon events ${n}-${s}`}function K4(e,t,n){let s=xc(e,t);((s==null?void 0:s.kind)==="assistant"||(s==null?void 0:s.kind)==="thought")&&(s.streaming=!1,s.updatedAt=e.now,(n==null?void 0:n.eventId)!==void 0&&(s.eventId=n.eventId),s.serverTimestamp===void 0&&(n==null?void 0:n.serverTimestamp)!==void 0&&(s.serverTimestamp=n.serverTimestamp))}function _G(e,t){K4(e,e.activeAssistantBlockId,t),e.activeAssistantBlockId=void 0}function ufe(e,t){let n=xc(e,e.activeAssistantBlockId);if(!n||n.kind!=="assistant")return;let s=n.usage;n.usage={inputTokens:((s==null?void 0:s.inputTokens)??0)+t.usage.inputTokens,outputTokens:((s==null?void 0:s.outputTokens)??0)+t.usage.outputTokens,cachedTokens:((s==null?void 0:s.cachedTokens)??0)+(t.usage.cachedTokens??0)},n.updatedAt=e.now}function SG(e,t){K4(e,e.activeThoughtBlockId,t),e.activeThoughtBlockId=void 0}function HN(e,t,n){K4(e,e.activeAssistantBlockByParent[t],n),delete e.activeAssistantBlockByParent[t]}function qN(e,t,n){K4(e,e.activeThoughtBlockByParent[t],n),delete e.activeThoughtBlockByParent[t]}function n5(e,t,n,s,r){let i=t!=="user"&&"parentToolCallId"in r?r.parentToolCallId:void 0,o=i!=null?t==="assistant"?e.activeAssistantBlockByParent:t==="thought"?e.activeThoughtBlockByParent:void 0:void 0,a=o&&i!=null?o[i]:e[n],c=xc(e,a);if(c&&c.kind===t&&dfe(c,r)){c.text=GN(e,c,s),c.updatedAt=e.now,r.eventId!==void 0&&(c.eventId=r.eventId),r.serverTimestamp!==void 0&&(c.serverTimestamp=r.serverTimestamp),"meta"in r&&r.meta&&(c.meta={...c.meta,...r.meta}),t!=="user"&&(c.streaming=!0);return}(c==null?void 0:c.kind)===t&&t!=="user"&&(c.streaming=!1,c.updatedAt=e.now);let u=VN(e,t,s,r.eventId,r.serverTimestamp,"meta"in r?r.meta:void 0,r.sourceRecordIds);t!=="user"&&(u.streaming=!0),t==="thought"&&(u.collapsed=!0),i!=null&&(u.parentToolCallId=i),Hu(e,u),o&&i!=null?o[i]=u.id:e[n]=u.id,i!=null?(t==="assistant"&&qN(e,i),t==="thought"&&HN(e,i)):(t!=="user"&&(e.activeUserBlockId=void 0),t!=="assistant"&&_G(e),t!=="thought"&&SG(e))}function dfe(e,t){var n,s;return e.kind!=="user"&&e.kind!=="assistant"&&e.kind!=="thought"||((n=e.meta)==null?void 0:n.qwenDiscreteMessage)===!0||!NG(e.sourceRecordIds,t.sourceRecordIds)?!1:!("meta"in t)||((s=t.meta)==null?void 0:s.qwenDiscreteMessage)!==!0}function UN(e,t){_G(e,t);for(let n of Object.keys(e.activeAssistantBlockByParent))HN(e,n,t);for(let n of Object.keys(e.activeThoughtBlockByParent))qN(e,n,t);SG(e,t)}function CG(e,t){let n=e.toolBlockByCallId[t.toolCallId];if(n===wp){if(yfe(t))return delete e.toolBlockByCallId[t.toolCallId],delete e.trimmedToolNotificationByCallId[t.toolCallId],CG(e,t);e.trimmedToolNotificationByCallId[t.toolCallId]||(e.trimmedToolNotificationByCallId[t.toolCallId]=!0,Vy(e,"error",`Tool ${t.toolCallId} output trimmed (max blocks reached)`,t,{clearActiveText:!1}));return}let s=xc(e,n);if((s==null?void 0:s.kind)==="tool"){if(t.title!==void 0&&(s.title=t.title),t.status!==void 0&&(s.status=t.status),t.rawInput!==void 0&&(s.preview=Q2(t.rawInput,{title:t.title,toolName:t.toolName,toolKind:t.toolKind})),s.updatedAt=e.now,t.eventId!==void 0&&(s.eventId=t.eventId),t.details&&(s.details=t.details),t.content!==void 0&&(s.content=t.content),t.locations!==void 0&&(s.locations=t.locations),t.rawInput!==void 0&&(s.rawInput=t.rawInput),t.rawOutput!==void 0&&(s.rawOutput=t.rawOutput),s.sourceRecordIds=kfe(s.sourceRecordIds,t.sourceRecordIds),t.toolName&&(s.toolName=t.toolName),t.toolKind&&(s.toolKind=t.toolKind),t.parentToolCallId&&!s.parentToolCallId&&(s.parentToolCallId=t.parentToolCallId),s.parentToolCallId&&!s.parentBlockId){let o=e.toolBlockByCallId[s.parentToolCallId];o&&o!==wp&&(s.parentBlockId=o)}t.subagentType&&!s.subagentType&&(s.subagentType=t.subagentType),yP(e,t.toolCallId,t.status);return}let r=t.parentToolCallId&&e.toolBlockByCallId[t.parentToolCallId]!==wp?e.toolBlockByCallId[t.parentToolCallId]:void 0,i={id:rm(e,"tool"),kind:"tool",toolCallId:t.toolCallId,title:t.title??t.toolName??t.toolKind??"Tool",status:t.status??"pending",preview:Q2(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.sourceRecordIds?{sourceRecordIds:[...t.sourceRecordIds]}:{},...t.details?{details:t.details}:{},...t.content!==void 0?{content:t.content}:{},...t.locations!==void 0?{locations:t.locations}:{},...t.rawInput!==void 0?{rawInput:t.rawInput}:{},...t.rawOutput!==void 0?{rawOutput:t.rawOutput}:{},...t.toolName?{toolName:t.toolName}:{},...t.toolKind?{toolKind:t.toolKind}:{},...t.parentToolCallId?{parentToolCallId:t.parentToolCallId}:{},...t.subagentType?{subagentType:t.subagentType}:{},...r?{parentBlockId:r}:{}};Hu(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=xc(e,o.id);(a==null?void 0:a.kind)==="tool"&&(a.parentBlockId=i.id)}yP(e,t.toolCallId,t.status??"pending"),e0(e,t.parentToolCallId)}function yP(e,t,n){if(n!==void 0){if(zN.has(n)){e.currentToolCallId=t;return}if(sfe.has(n)){e.currentToolCallId===t&&(e.currentToolCallId=hfe(e));return}}}function hfe(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"&&zN.has(n.status))return n.toolCallId}}function z7(e){for(let t of Object.values(e.toolBlockByCallId)){if(t===wp)continue;let n=xc(e,t);!n||n.kind!=="tool"||zN.has(n.status)&&(n.status="cancelled",n.updatedAt=e.now)}e.currentToolCallId=void 0}function ffe(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 i=xc(e,n.id);(i==null?void 0:i.kind)==="shell"&&(i.text=GN(e,i,t.text),i.updatedAt=e.now,t.eventId!==void 0&&(i.eventId=t.eventId));return}let s=rm(e,"shell"),r={id:s,kind:"shell",text:Nv(e,s,void 0,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}:{}};Hu(e,r),e0(e)}function mfe(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 a=xc(e,n.id);(a==null?void 0:a.kind)==="user_shell"&&(a.text=GN(e,a,t.text),a.updatedAt=e.now,t.eventId!==void 0&&(a.eventId=t.eventId));return}let s=e.pendingUserShellCommand,r=(n==null?void 0:n.kind)==="user_shell"?n:void 0,i=rm(e,"user-shell"),o={id:i,kind:"user_shell",text:Nv(e,i,void 0,t.text),command:(s==null?void 0:s.command)??(r==null?void 0:r.command)??"",...s!=null&&s.cwd||r!=null&&r.cwd?{cwd:(s==null?void 0:s.cwd)??(r==null?void 0:r.cwd)}:{},clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{},...t.stream?{stream:t.stream}:{}};e.pendingUserShellCommand=void 0,Hu(e,o),e0(e)}function pfe(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===G4)return;let s=xc(e,n),r=Q2(t.toolCall,{title:t.title});if((s==null?void 0:s.kind)==="permission"){s.title=t.title,s.options=t.options.map(o=>({...o})),s.toolCall=t.toolCall,s.preview=r,s.updatedAt=e.now,t.eventId!==void 0&&(s.eventId=t.eventId);return}let i={id:rm(e,"permission"),kind:"permission",requestId:t.requestId,title:t.title,options:t.options.map(o=>({...o})),preview:r,clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{},...t.sessionId?{sessionId:t.sessionId}:{},...t.toolCall!==void 0?{toolCall:t.toolCall}:{}};Hu(e,i),e.permissionBlockByRequestId[t.requestId]=i.id,e0(e)}function gfe(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===void 0||n===G4)return;let s=xc(e,n);if((s==null?void 0:s.kind)==="permission"){s.resolved=t.outcome,s.updatedAt=e.now,t.eventId!==void 0&&(s.eventId=t.eventId);return}let r={id:rm(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}:{}};Hu(e,r),e.permissionBlockByRequestId[t.requestId]=r.id,e0(e)}function Vy(e,t,n,s,r={}){let i=rm(e,t),o={id:i,kind:t,text:Nv(e,i,void 0,n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...(s==null?void 0:s.eventId)!==void 0?{eventId:s.eventId}:{},...(s==null?void 0:s.serverTimestamp)!==void 0?{serverTimestamp:s.serverTimestamp}:{},...(s==null?void 0:s.type)==="error"&&s.code?{code:s.code}:{},...(s==null?void 0:s.type)==="error"&&s.promptId?{promptId:s.promptId}:{},...(s==null?void 0:s.type)==="error"&&s.errorKind?{errorKind:s.errorKind}:{},...(s==null?void 0:s.type)==="error"&&s.source?{source:s.source}:{},...((s==null?void 0:s.type)==="status"||(s==null?void 0:s.type)==="debug")&&s.source?{source:s.source}:{},...((s==null?void 0:s.type)==="status"||(s==null?void 0:s.type)==="debug")&&s.data!==void 0?{data:s.data}:{},...(s==null?void 0:s.type)==="session.branched"?{source:"session_branched",data:{sourceSessionId:s.sourceSessionId,newSessionId:s.newSessionId,displayName:s.displayName}}:{}};Hu(e,o),r.clearActiveText!==!1&&e0(e)}function bfe(e,t){let n={id:rm(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}:{}};Hu(e,n),e0(e)}function VN(e,t,n,s,r,i,o){let a=rm(e,t);return{id:a,kind:t,text:Nv(e,a,o,n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...s!==void 0?{eventId:s}:{},...r!==void 0?{serverTimestamp:r}:{},...o?{sourceRecordIds:[...o]}:{},...i?{meta:{...i}}:{}}}function TG(e,t){let n={...e,now:t.now??Date.now(),maxBlocks:t.maxBlocks??e.maxBlocks,blocks:e.blocks,blockIndexById:e.blockIndexById,toolBlockByCallId:Fi(e.toolBlockByCallId),activeAssistantBlockByParent:Fi(e.activeAssistantBlockByParent),activeThoughtBlockByParent:Fi(e.activeThoughtBlockByParent),trimmedToolNotificationByCallId:Fi(e.trimmedToolNotificationByCallId),permissionBlockByRequestId:Fi(e.permissionBlockByRequestId),toolProgress:Fi(Object.fromEntries(Object.entries(e.toolProgress).map(([r,i])=>[r,{...i}]))),lastResyncRequired:e.lastResyncRequired!==void 0?{...e.lastResyncRequired}:void 0,lastFollowupSuggestion:e.lastFollowupSuggestion},s=t.onTruncation??Tx.get(e);return s&&Tx.set(n,s),n}function EG(e){var s;if(e.blocks.length<=e.maxBlocks)return e;(s=Tx.get(e))==null||s({kind:"blocks"});let t=e.blocks.slice(-e.maxBlocks),n=new Set(t.map(r=>r.id));e.blocks=t,e.blockIndexById=FN(t),J2.set(e,e.blocks);for(let[r,i]of Object.entries(e.toolBlockByCallId))n.has(i)||(e.toolBlockByCallId[r]=wp);_fe(e);for(let[r]of Object.entries(e.trimmedToolNotificationByCallId))e.toolBlockByCallId[r]!==wp&&delete e.trimmedToolNotificationByCallId[r];for(let[r,i]of Object.entries(e.permissionBlockByRequestId))n.has(i)||(e.permissionBlockByRequestId[r]=G4);Sfe(e);for(let r of e.blocks)if(r.kind==="tool"&&r.parentBlockId&&!n.has(r.parentBlockId)){let i=xc(e,r.id);(i==null?void 0:i.kind)==="tool"&&(i.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,i]of Object.entries(e.activeAssistantBlockByParent))n.has(i)||delete e.activeAssistantBlockByParent[r];for(let[r,i]of Object.entries(e.activeThoughtBlockByParent))n.has(i)||delete e.activeThoughtBlockByParent[r];return e}function yfe(e){return e.toolCallId===L7||e.toolKind==="updated_plan"}var J2=new WeakMap;function WN(e){J2.get(e)!==e.blocks&&(e.blocks=[...e.blocks],e.blockIndexById=Fi(e.blockIndexById),J2.set(e,e.blocks))}function xfe(e,t){var r;let n=0,s=-1;for(let i=0;i<e.blocks.length;i+=1)if(((r=e.blocks[i])==null?void 0:r.kind)==="user"){if(s=i,n===t){xP(e,i);return}n+=1}s>=0&&t>=n&&xP(e,s)}function xP(e,t){WN(e),e.blocks=e.blocks.slice(0,t),J2.set(e,e.blocks),vfe(e)}function vfe(e){e.blockIndexById=FN(e.blocks),e.toolBlockByCallId=Fi(),e.permissionBlockByRequestId=Fi(),e.trimmedToolNotificationByCallId=Fi(),e.activeUserBlockId=void 0,e.activeAssistantBlockId=void 0,e.activeThoughtBlockId=void 0,e.activeAssistantBlockByParent=Fi(),e.activeThoughtBlockByParent=Fi(),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 Hu(e,t){WN(e),e.blockIndexById[t.id]=e.blocks.length,e.blocks.push(t)}function xc(e,t){if(!t)return;let n=e.blockIndexById[t];if(n===void 0)return;let s=e.blocks[n];if(!s||s.id!==t)return;let r=wfe(s);return WN(e),e.blocks[n]=r,r}function wfe(e){return e.kind==="permission"?{...e,options:e.options.map(t=>mu(t)),toolCall:mu(e.toolCall),preview:mu(e.preview)}:e.kind==="tool"?{...e,preview:mu(e.preview),content:mu(e.content),locations:mu(e.locations),rawInput:mu(e.rawInput),rawOutput:mu(e.rawOutput)}:{...e}}function rm(e,t){let n=`${t}-${e.nextOrdinal}`;return e.nextOrdinal+=1,n}function e0(e,t){t?(HN(e,t),qN(e,t)):(UN(e),e.activeUserBlockId=void 0)}function GN(e,t,n){let s="text"in t?t.text:"";return s.length>=$7?(n&&AG(e,t.id,t.sourceRecordIds),s):Nv(e,t.id,t.sourceRecordIds,s+n)}function Nv(e,t,n,s){if(s.length<=$7)return s;AG(e,t,n);let r=Math.max(0,$7-bP.length);return`${s.slice(0,r)}${bP}`}function AG(e,t,n){var s;(s=Tx.get(e))==null||s({kind:"text",blockId:t,sourceRecordIds:n})}function Fi(e){return Object.assign(Object.create(null),e)}function NG(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,s)=>n===t[s])}function kfe(e,t){if(!(!e&&!t))return[...new Set([...e??[],...t??[]])]}function _fe(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.toolBlockByCallId).filter(([,r])=>r===wp).map(([r])=>r),s=n.length-t;if(!(s<=0))for(let r of n.slice(0,s))delete e.toolBlockByCallId[r],delete e.trimmedToolNotificationByCallId[r]}function Sfe(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.permissionBlockByRequestId).filter(([,r])=>r===G4).map(([r])=>r),s=n.length-t;if(!(s<=0))for(let r of n.slice(0,s))delete e.permissionBlockByRequestId[r]}function mu(e,t=0){return t>tfe?e:Array.isArray(e)?e.map(n=>mu(n,t+1)):tn(e)?Object.fromEntries(Object.entries(e).map(([n,s])=>[n,mu(s,t+1)])):e}function F7(e={}){let t=vP(e),n=new Set,s=!1,r=()=>{for(let o of n)try{o()}catch(a){Cfe(a)}},i=()=>{s||(s=!0,queueMicrotask(()=>{s=!1,r()}))};return{getSnapshot(){return t},subscribe(o){return n.add(o),()=>{n.delete(o)}},dispatch(o){let a=Array.isArray(o)?o:[o];a.length!==0&&(t=ofe(t,a),i())},appendLocalUserMessage(o,a,c){t=ife(t,o,{images:a,meta:c}),i()},reset(o={}){t=vP({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 Cfe(e){var s;let t=globalThis.reportError;if(typeof t=="function"){t(e);return}let n=(s=globalThis.console)==null?void 0:s.error;typeof n=="function"&&n.call(globalThis.console,e)}function vP(e){let t=e.blocks?[...e.blocks]:[];return{...nfe({maxBlocks:e.maxBlocks,now:e.now}),...e,blocks:t,blockIndexById:FN(t),toolBlockByCallId:T0(e.toolBlockByCallId),trimmedToolNotificationByCallId:T0(e.trimmedToolNotificationByCallId),permissionBlockByRequestId:T0(e.permissionBlockByRequestId),toolProgress:T0(e.toolProgress),activeAssistantBlockByParent:T0(e.activeAssistantBlockByParent),activeThoughtBlockByParent:T0(e.activeThoughtBlockByParent),lastResyncRequired:e.lastResyncRequired!==void 0?{...e.lastResyncRequired}:void 0,lastFollowupSuggestion:e.lastFollowupSuggestion!==void 0?{...e.lastFollowupSuggestion}:void 0}}function T0(e){return Object.assign(Object.create(null),e)}var Tfe="web-shell:goal-status:v1:";/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function wP(e,t){var n;if(!e)return{models:[]};const s=new Set,r=[];let i=(n=e.current)==null?void 0:n.modelId;const o=e.approvalMode;let a;for(const c of e.providers)for(const u of c.models){!i&&u.isCurrent&&(i=u.modelId),a===void 0&&(i?u.modelId===i:u.isCurrent)&&(a=u.contextLimit);const d=[c.authType,u.modelId,u.baseUrl??"",u.envKey??""].join("\0");s.has(d)||(s.add(d),r.push({id:u.modelId,baseModelId:u.baseModelId,label:u.name||u.modelId,authType:c.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:r,currentModel:i,currentMode:o,contextWindow:a}}function Efe(e){var t;const n=Io((t=e==null?void 0:e.state)==null?void 0:t.models);if(!n)return;const s=wi(n,"currentModelId")??wi(n,"currentModel"),r=n.availableModels,i=[];let o;if(Array.isArray(r))for(const a of r){const c=Io(a),u=wi(c,"modelId")??wi(c,"id")??wi(c,"value");if(!u)continue;const d=Io(c==null?void 0:c._meta),h=gy(d,"contextLimit")??gy(d,"contextWindow")??gy(c,"contextLimit")??gy(c,"contextWindow");o===void 0&&s!==void 0&&u===s&&(o=h),i.push({id:u,baseModelId:wi(c,"baseModelId")??Ife(u),label:wi(c,"name")??wi(c,"label")??u,...h!==void 0?{contextWindow:h}:{}})}if(!(!s&&i.length===0))return{models:i,currentModel:s,contextWindow:o}}function jG(e){if(!e)return{commands:[],skills:[]};const t=e.availableCommands.map(s=>{var r;return{name:s.name,description:s.description||"",...(r=s.input)!=null&&r.hint?{argumentHint:s.input.hint}:{},...RG(s._meta),raw:s}}),n=e.availableSkills.map(s=>({name:s,description:"",raw:{name:s,description:"",input:null,_meta:{source:"skill"}}}));return{commands:MG(t,n),skills:e.availableSkills}}function kP(e){if(!e)return{commands:[],skills:[]};const t=e.skills.filter(s=>s.status==="ok");return{commands:t.map(s=>({name:s.name,description:s.description||"",...s.argumentHint?{argumentHint:s.argumentHint}:{},raw:{name:s.name,description:s.description||"",input:s.argumentHint?{hint:s.argumentHint}:null,_meta:{source:"skill"}}})),skills:t.map(s=>s.name)}}function MG(...e){const t=new Map;for(const n of e)for(const s of n){const r=t.get(s.name);r?t.set(s.name,{...r,...s,description:s.description||r.description,argumentHint:s.argumentHint??r.argumentHint,raw:s.raw}):t.set(s.name,s)}return[...t.values()]}function Afe(e,t){var n;if(e.type==="session_update"){const s=Io((n=Io(e.data))==null?void 0:n.update),r=IG(s);if(r&&t(i=>({...i,tokenUsage:r,tokenCount:KN(r)})),wi(s,"sessionUpdate")==="available_commands_update"){const{commands:i,skills:o}=Mfe(s);t(a=>({...a,commands:i,skills:o}))}return}switch(e.type){case"git_branch_changed":{const s=Io(e.data),r=wi(s,"workspaceCwd"),i=wi(s,"branch");t(o=>r&&r!==o.workspaceCwd?o:{...o,gitBranch:i});break}case"session_metadata_updated":{const s=Io(e.data);Object.prototype.hasOwnProperty.call(s??{},"displayName")&&t(r=>({...r,displayName:wi(s,"displayName")}));break}case"model_switched":{const s=wi(Io(e.data),"modelId");s&&t(r=>({...r,currentModel:s}));break}case"approval_mode_changed":{const s=Io(e.data),r=wi(s,"next")??wi(s,"mode");r&&t(i=>({...i,currentMode:r}));break}}}function _P(e){const t=wi(e,"displayName");return t!=null&&t.trim()?t:void 0}function Nfe(e){var t;const n=Io((t=e==null?void 0:e.state)==null?void 0:t.modes);return wi(n,"currentModeId")??wi(n,"currentMode")}function KN(e){const t=(e==null?void 0:e.inputTokens)??(e==null?void 0:e.totalTokens);if(t!==void 0&&t>0)return t;if(!e)return;const n=Object.values(e).reduce((s,r)=>s+(typeof r=="number"?r:0),0);return n>0?n:void 0}function jfe(e){var t;for(let n=e.length-1;n>=0;n--)try{const s=e[n];if(s.type!=="session_update")continue;const r=Io((t=Io(s.data))==null?void 0:t.update),i=IG(r);if(i)return i}catch{}}function IG(e){const t=Io(e==null?void 0:e._meta);if((t==null?void 0:t.parentToolCallId)!==void 0)return;const n=Io(t==null?void 0:t.usage),s={...qb(n,"inputTokens"),...qb(n,"outputTokens"),...qb(n,"totalTokens"),...qb(n,"thoughtTokens"),...qb(n,"cachedReadTokens")};return KN(s)!==void 0?s:void 0}function qb(e,t){const n=gy(e,t);return n!==void 0&&n>=0?{[t]:n}:{}}function Mfe(e){if(!e)return{commands:[],skills:[]};const n=(Array.isArray(e.availableCommands)?e.availableCommands:[]).flatMap(i=>{var o;const a=Io(i),c=wi(a,"name");if(!c)return[];const u=Io(a==null?void 0:a.input),d={name:c,description:wi(a,"description")??"",input:u?{hint:wi(u,"hint")??""}:null,_meta:Io(a==null?void 0:a._meta)??null};return[{name:c,description:d.description??"",...(o=d.input)!=null&&o.hint?{argumentHint:d.input.hint}:{},...RG(d._meta),raw:d}]}),s=Array.isArray(e.availableSkills)?e.availableSkills.filter(i=>typeof i=="string"):[],r=s.map(i=>({name:i,description:"",raw:{name:i,description:"",input:null,_meta:{source:"skill"}}}));return{commands:MG(n,r),skills:s}}function RG(e){const n=wi(e??void 0,"source");return{...n?{source:n}:{}}}function Io(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function wi(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function gy(e,t){const n=e==null?void 0:e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Ife(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 SP(e,t=[]){const n=[{type:"text",text:e}];for(const s of t){const r=s.mimeType??s.mediaType??s.media_type;r&&r!=="image/*"?n.push({type:"image",data:s.data,mimeType:r}):n.push({type:"image",data:s.data})}return n}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Rfe=3e4;function Dfe(e,t,n){const s=Number.isFinite(t)&&t>0?t:1e3,r=Number.isFinite(n)&&n>0?Math.max(s,n):s,i=s*2**Math.max(0,e-1),o=Math.min(i,r),a=.8+Math.random()*.4;return Math.min(r,Math.max(1,Math.round(o*a)))}async function ct(e,t,n=Rfe){let s;try{return await Promise.race([e,new Promise((r,i)=>{s=setTimeout(()=>{i(new Error(`${t} after ${n}ms`))},n)})])}finally{s!==void 0&&clearTimeout(s)}}function Lfe(e,t){return e<=0||t.aborted?Promise.resolve():new Promise(n=>{const s=setTimeout(r,e);function r(){clearTimeout(s),t.removeEventListener("abort",r),n()}t.addEventListener("abort",r,{once:!0})})}function Ei(e){e.current!==void 0&&(clearTimeout(e.current),e.current=void 0)}function Pfe(e,t,n="replay",s=80,r){Ei(t),t.current=setTimeout(()=>{t.current=void 0,e.getSnapshot().activeAssistantBlockId&&(e.dispatch({type:"assistant.done",reason:n}),r==null||r())},s)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Ofe="qwen-code-webui-client-id:session:";function s5(e,t){if(e)return e;if(typeof window>"u")return r5();try{if(t){const n=window.sessionStorage.getItem(DG(t));if(n)return n}return r5()}catch{return r5()}}function B_(e,t){if(!(!e||!t||typeof window>"u"))try{window.sessionStorage.setItem(DG(t),e)}catch{}}async function CP(e){if(!e.clientId)return;const t={"X-Qwen-Client-Id":e.clientId};e.token&&(t.Authorization=`Bearer ${e.token}`);const n=`${Bfe(e.baseUrl)}/session/${encodeURIComponent(e.sessionId)}/detach`,s=await fetch(n,{method:"POST",headers:t,keepalive:!0});if(!(s.status===204||s.status===404))throw new Error(`Detach client failed (${s.status})`)}function r5(){return`webui_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function DG(e){return`${Ofe}${encodeURIComponent(e)}`}function Bfe(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 $fe(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 zfe({store:e,sessionRef:t,activePromptsRef:n,settledPromptsRef:s,pendingSessionLoadRef:r,pendingSessionLoadIdRef:i,heartbeatSupportedRef:o,manualSessionClearRef:a,skipNextCleanupDetachSessionIdRef:c,passiveAssistantDoneTimerRef:u,getCreateSessionRequest:d,createDetachedSession:h,getConnection:m,hasSessionActivePrompt:p,resetCurrentSessionActivePrompt:g,restartEventStream:b,addNotice:v,setConnection:x,setPromptStatus:y,setRestoreSessionId:w,setRestoreWorkspaceCwd:k,setRestoreMode:T,setRestoreSessionNonce:_,setAttachSessionNonce:C,setNewSessionNonce:S}){function L(){for(const[,M]of n.current)M.controller.abort();n.current.clear(),s.current.clear(),y("idle"),Ei(u),r.current&&(c.current===r.current.sessionId&&(c.current=void 0),clearTimeout(r.current.timeout),r.current.reject(new DOMException("Session cleared","AbortError")),r.current=void 0),e.reset(),w(void 0),k(void 0)}function N(M,P){const E=i.current+1;return i.current=E,r.current&&(clearTimeout(r.current.timeout),r.current.reject(new DOMException(`Session ${P} superseded by a newer request`,"AbortError"))),new Promise((z,F)=>{const B=setTimeout(()=>{var W;((W=r.current)==null?void 0:W.id)===E&&(r.current=void 0,F(dr(v,`${Vfe(P)} session failed`,new Error(`Session ${P} timed out`),Wfe(P))))},3e4);r.current={id:E,sessionId:M,mode:P,timeout:B,resolve:z,reject:F}})}function $(M,P,E){var O;a.current=!1;const z=N(M,P),F=t.current,B=F==null?void 0:F.sessionId,W=B?n.current.get(B):void 0;return(O=W==null?void 0:W.reject)==null||O.call(W,new DOMException("Session switch interrupted prompt wait","AbortError")),B&&n.current.delete(B),g(),F&&F.detach().catch(I=>{console.warn("[DaemonSessionActions] detach before session switch failed:",I)}),t.current=void 0,x(I=>({...I,status:"connecting",sessionId:M,clientId:void 0,displayName:void 0,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0,catchingUp:void 0})),y("idle"),s.current.clear(),Ei(u),e.reset(),T(P),w(M),k(E??m().workspaceCwd),_(I=>I+1),z.catch(I=>{throw by(I)||x(Y=>({...Y,loadingTranscript:void 0,catchingUp:void 0})),I})}return{async sendPrompt(M,P){var E,O,z,F,B;const W=_r(v,t.current,"Prompt failed","send_prompt"),I=W.sessionId;if(n.current.has(I))throw dr(v,"Prompt failed","A prompt is already in progress","send_prompt");Ei(u),y("waiting");const Y=new AbortController;n.current.set(I,{controller:Y});try{const V=((P==null?void 0:P.images)??[]).map(X=>({data:X.data,mimeType:X.mimeType||X.mediaType||X.media_type||"image/*"})),j=P!=null&&P.inputAnnotations&&P.inputAnnotations.length>0?P.inputAnnotations:void 0;(P==null?void 0:P.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(M,V,j?{inputAnnotations:j}:void 0);const ee={prompt:SP(M,V)};j&&(ee._meta={inputAnnotations:j}),P!=null&&P.retry&&(ee.retry=!0);const se=await W.submitPrompt(ee,Y.signal);return((E=n.current.get(I))==null?void 0:E.controller)===Y&&b(I),(O=P==null?void 0:P.onAdmitted)==null||O.call(P),await Ffe(n.current,s.current,I,Y,se.promptId)}catch(V){if(by(V))return((z=t.current)==null?void 0:z.sessionId)===I&&e.dispatch({type:"assistant.done",reason:"cancelled"}),{stopReason:"cancelled"};throw bG(V)?V:(((F=t.current)==null?void 0:F.sessionId)===I&&e.dispatch({type:"assistant.done",reason:"error"}),dr(v,"Prompt failed",V,"send_prompt"))}finally{const V=n.current.get(I);(V==null?void 0:V.controller)===Y&&n.current.delete(I),((B=t.current)==null?void 0:B.sessionId)===I&&!p()&&y("idle")}},async submitPrompt(M,P){var E;const O=_r(v,t.current,"Prompt failed","send_prompt");if(P!=null&&P.sessionId&&O.sessionId!==P.sessionId)throw new Error("Session changed before prompt submission");const z=((P==null?void 0:P.images)??[]).map(I=>({data:I.data,mimeType:I.mimeType||I.mediaType||I.media_type||"image/*"})),F=P!=null&&P.inputAnnotations&&P.inputAnnotations.length>0?P.inputAnnotations:void 0;(P==null?void 0:P.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(M,z,F?{inputAnnotations:F}:void 0);const B={prompt:SP(M,z)};F&&(B._meta={inputAnnotations:F}),P!=null&&P.retry&&(B.retry=!0);const W=await O.submitPrompt(B);if((E=P==null?void 0:P.signal)!=null&&E.aborted)throw await O.removePendingPrompt(W.promptId).catch(I=>{console.warn("[submitPrompt] removePendingPrompt failed after abort",I),v({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:I instanceof Error?I.message:String(I),recoverable:!0})}),P.signal.reason??new DOMException("Aborted","AbortError");return{promptId:W.promptId}},async cancel(){var M,P;const E=_r(v,t.current,"Cancel failed","cancel_prompt"),O=n.current.get(E.sessionId);O==null||O.controller.abort(),Ei(u);const z=O?new AbortController:void 0;z&&n.current.set(E.sessionId,{controller:z});try{await ct(E.cancel(),"Cancel timed out")}catch(F){throw dr(v,"Cancel failed",F,"cancel_prompt")}finally{z&&((M=n.current.get(E.sessionId))==null?void 0:M.controller)===z&&n.current.delete(E.sessionId),((P=t.current)==null?void 0:P.sessionId)===E.sessionId&&!p()&&y("idle")}},async setModel(M){const P=_r(v,t.current,"Set model failed","switch_model");try{const E=await ct(P.setModel(M),"Set model timed out");return x(O=>({...O,currentModel:M})),E}catch(E){throw dr(v,"Set model failed",E,"switch_model")}},async setApprovalMode(M,P){const E=_r(v,t.current,"Set approval mode failed","set_approval_mode");try{const O=await ct(E.client.setSessionApprovalMode(E.sessionId,M,{persist:P==null?void 0:P.persist,clientId:E.clientId}),"Set approval mode timed out");return x(z=>({...z,currentMode:O.mode||M})),O}catch(O){throw dr(v,"Set approval mode failed",O,"set_approval_mode")}},async respondToPermission(M,P){const E=_r(v,t.current,"Permission response failed","submit_permission");try{return await ct(E.respondToSessionPermission(M,P),"Permission response timed out")}catch(O){throw dr(v,"Permission response failed",O,"submit_permission")}},async submitPermission(M,P,E){const O=_r(v,t.current,"Permission response failed","submit_permission"),z=P!==void 0&&P.length>0?{outcome:{outcome:"selected",optionId:P},...E?{answers:E}:{}}:{outcome:{outcome:"cancelled"},...E?{answers:E}:{}};try{return await ct(O.respondToSessionPermission(M,z),"Permission response timed out")}catch(F){throw dr(v,"Permission response failed",F,"submit_permission")}},async heartbeat(){const M=t.current;if(!(!M||!o.current))return ct(M.heartbeat(),"Heartbeat timed out")},async listSessions(M){const P=t.current;if(!P)return[];try{return await ct(P.client.listWorkspaceSessions(P.workspaceCwd,M),"List sessions timed out")}catch(E){throw dr(v,"List sessions failed",E,"list_sessions")}},async loadSession(M,P){return $(M,"load",P==null?void 0:P.workspaceCwd)},async resumeSession(M,P){return $(M,"resume",P==null?void 0:P.workspaceCwd)},async createSession(M){try{a.current=!1;const P={...(M==null?void 0:M.approvalMode)!==void 0?{approvalMode:M.approvalMode}:{},...(M==null?void 0:M.sourceType)!==void 0?{sourceType:M.sourceType}:{},...(M==null?void 0:M.worktree)!==void 0?{worktree:M.worktree}:{}},E=t.current,O=E&&m().sessionId===E.sessionId?E:void 0;if(O){const F=await ct(O.client.createOrAttachSession({...d(),...(M==null?void 0:M.workspaceCwd)!==void 0?{workspaceCwd:M.workspaceCwd}:{},...P}),"Create session timed out");return B_(F.clientId,F.sessionId),F}const z=await ct(h(M==null?void 0:M.workspaceCwd,P),"Create session timed out");if(a.current){try{await ct(z.detach(),"Detach cleared session timed out")}catch(F){console.warn("[DaemonSessionActions] detach after interrupted create failed:",F)}throw new DOMException("Session creation interrupted","AbortError")}return B_(z.clientId,z.sessionId),t.current=z,c.current=z.sessionId,x(F=>({...F,status:"connected",sessionId:z.sessionId,...z.clientId?{clientId:z.clientId}:{},workspaceCwd:z.workspaceCwd,error:void 0,errorStatus:void 0,missingSession:!1})),z}catch(P){throw dr(v,`Create session failed${M!=null&&M.workspaceCwd?` (workspace: ${M.workspaceCwd})`:""}`,P,"create_session")}},async attachSession(){const M=_r(v,t.current,"Attach session failed","attach_session"),P=N(M.sessionId,"attach");return C(E=>E+1),P},async clearSession(){const M=t.current;if(a.current=!0,L(),t.current=void 0,x(P=>$fe(P,M==null?void 0:M.sessionId)),M)try{await ct(M.detach(),"Clear session timed out")}catch(P){console.warn("[DaemonSessionActions] detach on clear failed:",P)}},async newSession(){a.current=!1,L(),x(M=>({...M,missingSession:!1,error:void 0,errorStatus:void 0})),S(M=>M+1)},async releaseSession(M){try{const P=_r(v,t.current,"Release session failed","release_session");await ct(P.client.closeSession(M),"Release session timed out")}catch(P){throw dr(v,"Release session failed",P,"release_session")}},async closeSession(){const M=_r(v,t.current,"Close session failed","close_session");try{await ct(M.close(),"Close session timed out")}catch(P){throw dr(v,"Close session failed",P,"close_session")}},async refreshCommands(){const M=_r(v,t.current,"Refresh commands failed","refresh_commands");try{const P=await ct(M.supportedCommands(),"Refresh commands timed out"),{commands:E,skills:O}=jG(P);x(z=>({...z,commands:E,skills:O,supportedCommands:P}))}catch(P){throw dr(v,"Refresh commands failed",P,"refresh_commands")}},async getContext(){const M=_r(v,t.current,"Load context failed","load_context");try{const P=await ct(M.context(),"Load context timed out");return x(E=>({...E,context:P,currentMode:Hfe(P)??E.currentMode,currentModel:qfe(P)??E.currentModel})),P}catch(P){throw dr(v,"Load context failed",P,"load_context")}},async getContextUsage(M){const P=_r(v,t.current,"Load context usage failed","load_context_usage");try{return await ct(P.contextUsage(M),"Load context usage timed out")}catch(E){throw dr(v,"Load context usage failed",E,"load_context_usage")}},async renameSession(M){const P=_r(v,t.current,"Rename session failed","rename_session");try{return await ct(P.updateMetadata({displayName:M}),"Rename session timed out")}catch(E){throw dr(v,"Rename session failed",E,"rename_session")}},async recapSession(){const M=_r(v,t.current,"Recap session failed","recap_session");try{return await ct(M.recap(),"Recap session timed out")}catch(P){throw dr(v,"Recap session failed",P,"recap_session")}},async*generateSessionContent(M,P){yield*_r(v,t.current,"Generate content failed","generate_session_content").generateContent(M,P)},async getRewindSnapshots(){const M=_r(v,t.current,"Load rewind snapshots failed","rewind_snapshots");try{return await ct(M.getRewindSnapshots(),"Load rewind snapshots timed out")}catch(P){throw dr(v,"Load rewind snapshots failed",P,"rewind_snapshots")}},async rewindSession(M,P){const E=_r(v,t.current,"Rewind session failed","rewind_session");try{return await ct(E.rewind(M,P),"Rewind session timed out")}catch(O){throw dr(v,"Rewind session failed",O,"rewind_session")}},async btwSession(M,P){var E;const O=_r(v,t.current,"Side question failed","btw_session");try{return await ct(O.btw(M,P),"Side question timed out")}catch(z){throw(E=P==null?void 0:P.signal)!=null&&E.aborted||by(z)?z:dr(v,"Side question failed",z,"btw_session")}},async enqueueMidTurnMessage(M,P){const E=t.current;if(!E)return{accepted:!1};try{return await E.enqueueMidTurnMessage(M,P)}catch(O){return O instanceof DOMException&&O.name==="AbortError"||console.debug("[enqueueMidTurnMessage] push failed; kept for next turn",O),{accepted:!1}}},async getPendingPrompts(M){const P=t.current;if(!P)return{pendingPrompts:[]};if(M!=null&&M.sessionId&&P.sessionId!==M.sessionId)throw new Error("Session changed before pending prompts refresh");return await P.getPendingPrompts()},async removePendingPrompt(M,P){const E=t.current;return E?P!=null&&P.sessionId&&E.sessionId!==P.sessionId?await E.client.removePendingPrompt(P.sessionId,M):await E.removePendingPrompt(M):{removed:!1}},async sendShellCommand(M){var P,E;const O=_r(v,t.current,"Shell command failed","send_shell_command"),z=`${O.sessionId}:shell`;y("waiting");const F=new AbortController;n.current.set(z,{controller:F});try{return await O.shellCommand(M,F.signal)}catch(B){throw dr(v,"Shell command failed",B,"send_shell_command")}finally{((P=n.current.get(z))==null?void 0:P.controller)===F&&n.current.delete(z),((E=t.current)==null?void 0:E.sessionId)===O.sessionId&&!p()&&y("idle")}},async getTasks(){const M=_r(v,t.current,"Get tasks failed","load_tasks");try{return await ct(M.tasks(),"Get tasks timed out")}catch(P){throw dr(v,"Get tasks failed",P,"load_tasks")}},async cancelTask(M,P){const E=_r(v,t.current,"Cancel task failed","cancel_task");try{return await ct(E.cancelTask(M,P),"Cancel task timed out")}catch(O){throw dr(v,"Cancel task failed",O,"cancel_task")}},async clearGoal(){const M=_r(v,t.current,"Clear goal failed","clear_goal");try{return await ct(M.clearGoal(),"Clear goal timed out")}catch(P){throw dr(v,"Clear goal failed",P,"clear_goal")}},async getStats(){const M=_r(v,t.current,"Load stats failed","load_stats");try{return await ct(M.stats(),"Load stats timed out")}catch(P){throw dr(v,"Load stats failed",P,"load_stats")}},async loadArtifacts(){const M=_r(v,t.current,"Load artifacts failed","load_artifacts");try{return await ct(M.artifacts(),"Load artifacts timed out")}catch(P){throw dr(v,"Load artifacts failed",P,"load_artifacts")}},async respondToGlobalPermission(M,P){const E=_r(v,t.current,"Global permission response failed","submit_permission");try{return await ct(E.client.respondToPermission(M,P),"Global permission response timed out")}catch(O){throw dr(v,"Global permission response failed",O,"submit_permission")}},async branchSession(M){const P=_r(v,t.current,"Branch session failed","branch_session");try{const E=await ct(P.client.branchSession(P.sessionId,{name:M},P.clientId),"Branch session timed out");return B_(E.clientId,E.sessionId),$(E.sessionId,"load").catch(O=>{by(O)||dr(v,"Branch session failed",O,"branch_session")}),{sessionId:E.sessionId,displayName:E.displayName}}catch(E){throw dr(v,"Branch session failed",E,"branch_session")}},async forkSession(M){const P=_r(v,t.current,"Fork session failed","fork_session");try{return await ct(P.fork(M),"Fork session timed out")}catch(E){throw dr(v,"Fork session failed",E,"fork_session")}}}}function Ffe(e,t,n,s,r){return new Promise((i,o)=>{const a=H7(n,r),c=t.get(a);if(c){t.delete(a),c.status==="resolved"?i(c.result):o(c.error);return}const u=e.get(n);if((u==null?void 0:u.controller)!==s){o(new DOMException("Aborted","AbortError"));return}if(u.promptId!==void 0&&u.promptId!==r){o(new Error(`Prompt accepted with unexpected id ${r}`));return}if(s.signal.aborted){e.delete(n),o(s.signal.reason??new DOMException("Aborted","AbortError"));return}const d=()=>{s.signal.removeEventListener("abort",h)},h=()=>{const m=e.get(n);(m==null?void 0:m.controller)===s&&e.delete(n),d(),o(s.signal.reason??new DOMException("Aborted","AbortError"))};e.set(n,{...u,promptId:r,resolve:m=>{d(),i(m)},reject:m=>{d(),o(m)}}),s.signal.addEventListener("abort",h,{once:!0})})}function H7(e,t){return JSON.stringify([e,t])}function Hfe(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 qfe(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 _r(e,t,n,s){if(!t)throw dr(e,n,"Daemon session is not connected",s);return t}function dr(e,t,n,s){if(by(n)){if(n instanceof Error)return n;const i=n instanceof DOMException?n.message:"Aborted",o=new Error(i);return o.name="AbortError",o}const r=n instanceof Error?n.message:String(n);return e({severity:"error",category:"user_action",operation:s,code:`daemon.${s}.failed`,message:`${t}: ${r}`,debugMessage:r,recoverable:!0}),Ufe(n instanceof Error?n:new Error(r))}function by(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function Ufe(e){return Object.assign(e,{_alreadyDispatched:!0})}function Vfe(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Wfe(e){return e==="resume"?"resume_session":e==="attach"?"attach_session":"load_session"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Gfe=33e4;function Kfe({getClient:e,getWorkspaceCwd:t,baseUrl:n,token:s}){return{async listSessions(r){const i=Ot(e,"List sessions failed"),o=t();return o?ct(i.listWorkspaceSessionsPage(o,r).then(a=>a.sessions),"List sessions timed out"):[]},async listSessionsPage(r){const i=Ot(e,"List sessions failed"),o=t();return o?ct(i.listWorkspaceSessionsPage(o,r),"List sessions timed out"):{sessions:[]}},async listSessionGroups(){const r=Ot(e,"List session groups failed"),i=t();return i?ct(r.listSessionGroups(i),"List session groups timed out"):{groups:[],colorOptions:[]}},async createSessionGroup(r){const i=Ot(e,"Create session group failed"),o=i5(t);return ct(i.createSessionGroup(o,r),"Create session group timed out")},async updateSessionGroup(r,i){const o=Ot(e,"Update session group failed"),a=i5(t);return ct(o.updateSessionGroup(a,r,i),"Update session group timed out")},async deleteSessionGroup(r){const i=Ot(e,"Delete session group failed"),o=i5(t);return ct(i.deleteSessionGroup(o,r),"Delete session group timed out")},async updateSessionOrganization(r,i){const o=Ot(e,"Update session organization failed");return ct(o.updateSessionOrganization(r,i),"Update session organization timed out")},async deleteSession(r){const i=Ot(e,"Delete session failed"),o=await ct(i.deleteSessionsData([r]),"Delete session timed out");if(o.errors.length>0)throw new Error(o.errors[0].error);return o.removed.length>0||o.notFound.length>0},async deleteSessions(r){const i=Ot(e,"Delete sessions failed");return ct(i.deleteSessionsData(r),"Delete sessions timed out")},async exportSession(r,i="html"){const o=Ot(e,"Export session failed");return ct(o.exportSession(r,{format:i}),"Export session timed out")},async archiveSession(r){const i=Ot(e,"Archive session failed"),o=await ct(i.archiveSessionsData([r]),"Archive session timed out");if(o.errors.length>0)throw new Error(o.errors[0].error);return o.archived.length>0||o.alreadyArchived.length>0},async unarchiveSession(r){const i=Ot(e,"Unarchive session failed"),o=await ct(i.unarchiveSessionsData([r]),"Unarchive session timed out");if(o.errors.length>0)throw new Error(o.errors[0].error);return o.unarchived.length>0||o.alreadyActive.length>0},async loadMcpStatus(){const r=Ot(e,"Load MCP status failed");return ct(r.workspaceMcp(),"Load MCP status timed out")},async initializeMcp(){const r=Ot(e,"Initialize MCP failed");return ct(r.initializeWorkspaceMcp(),"Initialize MCP timed out")},async reloadMcp(){const r=Ot(e,"Reload MCP failed");return ct(r.reloadWorkspaceMcp(),"Reload MCP timed out")},async loadMcpTools(r){const i=Ot(e,"Load MCP tools failed");try{return await ct(i.workspaceMcpTools(r),"Load MCP tools timed out")}catch{return{v:1,workspaceCwd:"",serverName:r,initialized:!1,acpChannelLive:!1,tools:[],errors:[{kind:"mcp_tools",status:"error",error:"The connected daemon does not expose MCP tool details."}]}}},async loadMcpResources(r){const i=Ot(e,"Load MCP resources failed");try{return await ct(i.workspaceMcpResources(r),"Load MCP resources timed out")}catch{return{v:1,workspaceCwd:"",serverName:r,initialized:!1,acpChannelLive:!1,resources:[],errors:[{kind:"mcp_resources",status:"error",error:"The connected daemon does not expose MCP resource details."}]}}},async restartMcpServer(r){const i=Ot(e,"Restart MCP server failed");return ct(i.restartMcpServer(r),"Restart MCP server timed out",5*6e4)},async manageMcpServer(r,i){const o=Ot(e,"Manage MCP server failed"),a=i==="authenticate"?10*6e4:5*6e4;return ct(o.manageMcpServer(r,i),"Manage MCP server timed out",a)},async addRuntimeMcpServer(r){const i=Ot(e,"Add MCP server failed");return ct(i.addRuntimeMcpServer(r),"Add MCP server timed out",5*6e4)},async removeRuntimeMcpServer(r){const i=Ot(e,"Remove MCP server failed");return ct(i.removeRuntimeMcpServer(r),"Remove MCP server timed out",5*6e4)},async loadDaemonStatus(r){const i=Ot(e,"Load daemon status failed");return ct(i.daemonStatus(r),"Load daemon status timed out")},async loadUsageDashboard(r){const i=Ot(e,"Load usage dashboard failed");return ct(i.usageDashboard(r),"Load usage dashboard timed out")},async loadSkillsStatus(){const r=Ot(e,"Load skills failed");return ct(r.workspaceSkills(),"Load skills timed out")},async setWorkspaceSkillEnabled(r,i){const o=Ot(e,"Set skill enabled failed");return ct(o.setWorkspaceSkillEnabled(r,i),"Set skill enabled timed out")},async installWorkspaceSkill(r){const i=Ot(e,"Install skill failed");return ct(i.installWorkspaceSkill(r),"Install skill timed out")},async deleteWorkspaceSkill(r,i){const o=Ot(e,"Delete skill failed");return ct(o.deleteWorkspaceSkill(r,i),"Delete skill timed out")},async loadExtensionsStatus(){const r=Ot(e,"Load extensions failed");return ct(r.workspaceExtensions(),"Load extensions timed out")},async loadToolsStatus(){const r=Ot(e,"Load tools failed");return ct(r.workspaceTools(),"Load tools timed out")},async setWorkspaceToolEnabled(r,i){const o=Ot(e,"Set tool enabled failed");return ct(o.setWorkspaceToolEnabled(r,i),"Set tool enabled timed out")},async loadSettingsStatus(){const r=Ot(e,"Load settings failed");return ct(r.workspaceSettings(),"Load settings timed out")},async setWorkspaceSetting(r,i,o,a){const c=Ot(e,"Set setting failed");return ct(c.setWorkspaceSetting(r,i,o,a),"Set setting timed out")},async loadMemoryStatus(){const r=Ot(e,"Load memory failed");return ct(r.workspaceMemory(),"Load memory timed out")},async readWorkspaceFile(r){const i=Ot(e,"Read workspace file failed");return ct(i.readWorkspaceFile(r),"Read workspace file timed out")},async writeMemory(r){const i=Ot(e,"Write memory failed");return ct(i.writeWorkspaceMemory(r),"Write memory timed out")},async listAgents(){const r=Ot(e,"List agents failed");return ct(r.listWorkspaceAgents(),"List agents timed out")},async getAgent(r){const i=Ot(e,"Get agent failed");return ct(i.getWorkspaceAgent(r),"Get agent timed out")},async createAgent(r){const i=Ot(e,"Create agent failed");return ct(i.createWorkspaceAgent(r),"Create agent timed out")},async generateAgent(r){const i=Ot(e,"Generate agent failed");return ct(i.generateWorkspaceAgent(r),"Generate agent timed out",Gfe)},async deleteAgent(r,i){const o=Ot(e,"Delete agent failed");return ct(o.deleteWorkspaceAgent(r,i?{scope:i}:{}),"Delete agent timed out")},async globWorkspace(r,i){Ot(e,"Glob workspace failed");const o=Zc(n,"/glob");o.searchParams.set("pattern",r),(i==null?void 0:i.maxResults)!==void 0&&o.searchParams.set("maxResults",String(i.maxResults)),(i==null?void 0:i.includeIgnored)!==void 0&&o.searchParams.set("includeIgnored",i.includeIgnored?"1":"0"),(i==null?void 0:i.cwd)!==void 0&&o.searchParams.set("cwd",i.cwd);const a=await ct(fetch(eu(o,n),{headers:E0(s)}),"Glob workspace timed out");if(!a.ok)throw new Error(await tu(a,"GET /glob"));const c=await a.json();return{matches:Array.isArray(c.matches)?c.matches.filter(u=>typeof u=="string"):[]}},async loadProviders(){const r=Ot(e,"Load providers failed");return ct(r.workspaceProviders(),"Load providers timed out")},async readFileBytes(r,i){const o=Ot(e,"Read file bytes failed");return ct(o.readWorkspaceFileBytes(r,i??{}),"Read file bytes timed out")},async writeFile(r){const i=Ot(e,"Write file failed");return ct(i.writeWorkspaceFile(r),"Write file timed out")},async editFile(r){const i=Ot(e,"Edit file failed");return ct(i.editWorkspaceFile(r),"Edit file timed out")},async stat(r){Ot(e,"Stat file failed");const i=Zc(n,"/stat");i.searchParams.set("path",r);const o=await ct(fetch(eu(i,n),{headers:E0(s)}),"Stat file timed out");if(!o.ok)throw new Error(await tu(o,"GET /stat"));return await o.json()},async listDirectory(r){Ot(e,"List directory failed");const i=Zc(n,"/list");i.searchParams.set("path",r);const o=await ct(fetch(eu(i,n),{headers:E0(s)}),"List directory timed out");if(!o.ok)throw new Error(await tu(o,"GET /list"));return await o.json()},async listScheduledTasks(r){Ot(e,"List scheduled tasks failed");const i=Ub(r),o=Zc(n,i),a=await ct(fetch(eu(o,n),{headers:E0(s)}),"List scheduled tasks timed out");if(!a.ok)throw new Error(await tu(a,`GET ${i}`));const c=await a.json();return Array.isArray(c.tasks)?c.tasks:[]},async createScheduledTask(r,i){Ot(e,"Create scheduled task failed");const o=Ub(i),a=Zc(n,o),c=await ct(fetch(eu(a,n),{method:"POST",headers:rk(s),body:JSON.stringify(r)}),"Create scheduled task timed out");if(!c.ok)throw new Error(await tu(c,`POST ${o}`));return await c.json()},async updateScheduledTask(r,i,o){Ot(e,"Update scheduled task failed");const a=Ub(o,`/${encodeURIComponent(r)}`),c=Zc(n,a),u=await ct(fetch(eu(c,n),{method:"PATCH",headers:rk(s),body:JSON.stringify(i)}),"Update scheduled task timed out");if(!u.ok)throw new Error(await tu(u,`PATCH ${a}`));return await u.json()},async runScheduledTask(r,i){Ot(e,"Run scheduled task failed");const o=Ub(i,`/${encodeURIComponent(r)}/run`),a=Zc(n,o),c=await ct(fetch(eu(a,n),{method:"POST",headers:rk(s)}),"Run scheduled task timed out");if(!c.ok)throw new Error(await tu(c,`POST ${o}`));return await c.json()},async deleteScheduledTask(r,i){Ot(e,"Delete scheduled task failed");const o=Ub(i,`/${encodeURIComponent(r)}`),a=Zc(n,o),c=await ct(fetch(eu(a,n),{method:"DELETE",headers:E0(s)}),"Delete scheduled task timed out");if(!c.ok)throw new Error(await tu(c,`DELETE ${o}`))},async listGoals(){Ot(e,"List goals failed");const r=Zc(n,"/goals"),i=await ct(fetch(eu(r,n),{headers:E0(s)}),"List goals timed out");if(!i.ok)throw new Error(await tu(i,"GET /goals"));const o=await i.json();return{goals:Array.isArray(o.goals)?o.goals:[],droppedCount:typeof o.droppedCount=="number"&&o.droppedCount>0?o.droppedCount:0}},async clearGoal(r){Ot(e,"Clear goal failed");const i=Zc(n,`/session/${encodeURIComponent(r)}/goal/clear`),o=await ct(fetch(eu(i,n),{method:"POST",headers:rk(s),body:"{}"}),"Clear goal timed out");if(!o.ok)throw new Error(await tu(o,`POST /session/${r}/goal/clear`));return await o.json()},async loadEnv(){const r=Ot(e,"Load env failed");return ct(r.workspaceEnv(),"Load env timed out")},async loadPreflight(){const r=Ot(e,"Load preflight failed");return ct(r.workspacePreflight(),"Load preflight timed out")},async initWorkspace(r){const i=Ot(e,"Init workspace failed");return ct(i.initWorkspace(r),"Init workspace timed out")},async updateAgent(r,i,o){const a=Ot(e,"Update agent failed");return ct(a.updateWorkspaceAgent(r,i,o?{scope:o}:{}),"Update agent timed out")},async installExtension(r,i){const o=Ot(e,"Install extension failed");return ct(o.installExtension(r,i),"Install extension timed out")},async extensionOperationStatus(r){const i=Ot(e,"Load extension operation failed");return ct(i.extensionOperationStatus(r),"Load extension operation timed out")},async activeExtensionOperations(){const r=Ot(e,"Load active extension operations failed");return ct(r.activeExtensionOperations(),"Load active extension operations timed out")},async respondToExtensionInteraction(r,i,o,a){const c=Ot(e,"Respond to extension interaction failed");return ct(c.respondToExtensionInteraction(r,i,o,a),"Respond to extension interaction timed out")},async checkExtensionUpdates(r){const i=Ot(e,"Check extension updates failed");return ct(i.checkExtensionUpdates(r),"Check extension updates timed out")},async refreshExtensions(r){const i=Ot(e,"Refresh extensions failed");return ct(i.refreshExtensions(r),"Refresh extensions timed out")},async enableExtension(r,i,o){const a=Ot(e,"Enable extension failed");return ct(a.enableExtension(r,i,o),"Enable extension timed out")},async disableExtension(r,i,o){const a=Ot(e,"Disable extension failed");return ct(a.disableExtension(r,i,o),"Disable extension timed out")},async updateExtension(r,i){const o=Ot(e,"Update extension failed");return ct(o.updateExtension(r,i),"Update extension timed out")},async uninstallExtension(r,i){const o=Ot(e,"Uninstall extension failed");return ct(o.uninstallExtension(r,i),"Uninstall extension timed out")},async startDeviceFlow(r){const i=Ot(e,"Start device flow failed");return ct(i.startDeviceFlow({providerId:r}),"Start device flow timed out")},async getDeviceFlow(r,i){const o=Ot(e,"Get device flow failed");return ct(o.getDeviceFlow(r,i),"Get device flow timed out")},async cancelDeviceFlow(r){const i=Ot(e,"Cancel device flow failed");return ct(i.cancelDeviceFlow(r),"Cancel device flow timed out")},async getAuthStatus(){const r=Ot(e,"Get auth status failed");return ct(r.getAuthStatus(),"Get auth status timed out")},async getAuthProviders(){const r=Ot(e,"Get auth providers failed");return ct(r.getAuthProviders(),"Get auth providers timed out")},async installAuthProvider(r){const i=Ot(e,"Install auth provider failed");return ct(i.installAuthProvider(r),"Install auth provider timed out")},async deleteModel(r){const i=Ot(e,"Delete model failed");return ct(i.deleteModel(r),"Delete model timed out")},async addWorkspace(r,i){const o=Ot(e,"Add workspace failed");return ct(o.addWorkspace(r,i),"Add workspace timed out")},async suggestWorkspacePaths(r){const i=Ot(e,"Suggest workspace paths failed");return await ct(i.workspacePathSuggestions(r),"Suggest workspace paths timed out")},async updateWorkspace(r,i){const o=Ot(e,"Update workspace failed");return ct(o.updateWorkspace(r,i),"Update workspace timed out")},async removeWorkspace(r,i){const a=Ot(e,"Remove workspace failed").workspaceById(r).remove(i);return(i==null?void 0:i.timeoutMs)===0?a:ct(a,"Remove workspace timed out",i==null?void 0:i.timeoutMs)}}}function Ot(e,t){const n=e();if(!n)throw new Error(`${t}: DaemonClient is not connected`);return n}function i5(e){const t=e();if(!t)throw new Error("Daemon workspace is not connected");return t}function Ub(e,t=""){return e?`/workspaces/${encodeURIComponent(e)}/scheduled-tasks${t}`:`/scheduled-tasks${t}`}function E0(e){const t={};return e&&(t.Authorization=`Bearer ${e}`),t}function rk(e){const t={"Content-Type":"application/json"};return e&&(t.Authorization=`Bearer ${e}`),t}function Zc(e,t){const n=LG(e),s=typeof window>"u"?"http://localhost":window.location.origin;return new URL(`${n}${t}`,s)}function eu(e,t){return LG(t)?e.toString():`${e.pathname}${e.search}`}function LG(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 tu(e,t){try{const n=await e.json(),s=typeof n.error=="string"?n.error:typeof n.message=="string"?n.message:void 0;return s?`${t}: ${s}`:`${t}: HTTP ${e.status}`}catch{return`${t}: HTTP ${e.status}`}}const YN=f.createContext(void 0);let Vb;function Yfe({baseUrl:e,token:t,workspaceCwd:n,autoConnect:s=!0,transport:r,children:i}){const o=f.useMemo(()=>s?new D7({baseUrl:e,token:t,transport:r}):void 0,[s,e,t,r]),a=f.useRef(o);a.current=o;const c=f.useRef(void 0),u=f.useRef(void 0),d=f.useRef(n),[h,m]=f.useState(void 0),[p,g]=f.useState(s?"connecting":"idle"),[b,v]=f.useState(void 0),x=f.useCallback(()=>{if(!o)return Promise.reject(new Error("Daemon workspace client unavailable"));if(c.current!==o&&(c.current=o,u.current=void 0),!u.current){const T=o.capabilities().catch(_=>{throw u.current===T&&(u.current=void 0),_});u.current=T}return u.current},[o]),y=f.useCallback(()=>{if(!o)return Promise.reject(new Error("Daemon workspace client unavailable"));c.current=o;const T=o.capabilities().catch(_=>{throw u.current===T&&(u.current=void 0,v(_ instanceof Error?_:new Error(String(_))),g("error")),_});return u.current=T,T.then(_=>(c.current===o&&u.current===T&&(m(_),g("connected"),v(void 0)),_))},[o]);f.useEffect(()=>{if(!o)return;g("connecting"),v(void 0),m(void 0),Vb===o&&(Vb=void 0);let T=!1;return x().then(_=>{T||(m(_),g("connected"))}).catch(_=>{T||(v(_ instanceof Error?_:new Error(String(_))),g("error"))}),()=>{T=!0,Vb=o,queueMicrotask(()=>{Vb===o&&(Vb=void 0,o.dispose())})}},[o,x]),d.current=(h==null?void 0:h.workspaceCwd)??n;const w=f.useMemo(()=>Kfe({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:x,refreshCapabilities:y,actions:w}},[o,t,e,n,p,b,h,x,y,w]);return l.jsx(YN.Provider,{value:k,children:i})}function ol(){const e=f.useContext(YN);if(!e)throw new Error("useDaemonWorkspace must be used within DaemonWorkspaceProvider");return e}function To(){return ol().actions}function PG(){return f.useContext(YN)}function Xfe(e){if(e.length===0)return"idle";const t=e[e.length-1];if((t==null?void 0:t.kind)==="thought"&&TP(t))return"thinking";if((t==null?void 0:t.kind)==="assistant"&&TP(t)||(t==null?void 0:t.kind)==="tool"&&EP(t))return"responding";for(let n=e.length-1;n>=0;n--){const s=e[n];if(s.kind==="user")break;if(s.kind==="tool"&&EP(s))return"responding"}return"idle"}function Qfe(e,t){const n=Xfe(e);return t==="idle"?"idle":n!=="idle"||t===void 0?n:t==="waiting"?"waiting":"responding"}function TP(e){return e.streaming===!0}function EP(e){return e.status==="running"||e.status==="in_progress"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const q7=new Set;let Z2;function AP(){return Z2}function Jfe(e){return q7.add(e),()=>{q7.delete(e)}}function Zfe(e){Z2={...e},OG()}function ik(){Z2!==void 0&&(Z2=void 0,OG())}function OG(){for(const e of q7)e()}function eme(e){if(!e||typeof e!="object")return;const t=e;if(t.type!=="followup_suggestion")return;const n=t.data;if(!n||typeof n!="object")return;const s=n,r=s.sessionId,i=s.suggestion,o=s.promptId;if(!(typeof r!="string"||typeof i!="string"||i.length===0||typeof o!="string"))return{sessionId:r,suggestion:i,promptId:o}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const U7=new Set,BG=Object.freeze([]),o5=64;let sf=BG;function NP(){return sf}function tme(e){return U7.add(e),()=>{U7.delete(e)}}function nme(e){const t=[...sf,{sessionId:e.sessionId,messages:[...e.messages],...e.originatorClientId?{originatorClientId:e.originatorClientId}:{}}];if(t.length>o5){const n=t.length-o5;console.debug(`[mid-turn] sidechannel buffer over ${o5}; evicting ${n} oldest batch(es)`),sf=t.slice(n)}else sf=t;$G()}function sme(e){if(e.length===0||sf.length===0)return;const t=new Set(e),n=sf.filter(s=>!t.has(s));n.length!==sf.length&&(sf=n.length===0?BG:n,$G())}function $G(){for(const e of U7)e()}function rme(e){if(!e||typeof e!="object")return;const t=e;if(t.type!==yG)return;const n=t.data;if(!n||typeof n!="object")return;const s=n,r=s.sessionId,i=s.messages;if(typeof r!="string"||!Array.isArray(i))return;const o=i.filter(c=>typeof c=="string"&&c.length>0);if(o.length===0)return;const a=t.originatorClientId;return{sessionId:r,messages:o,...typeof a=="string"?{originatorClientId:a}:{}}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const V7=new Set,W7=new Set;let zG=0,Ag=[];function ime(){return zG}function jP(){return Ag}function ome(e){return V7.add(e),()=>{V7.delete(e)}}function ame(e){return W7.add(e),()=>{W7.delete(e)}}function lme(){zG++;for(const e of V7)try{e()}catch(t){console.error("[pendingPromptVersion] listener error",t)}}function FG(){for(const e of W7)try{e()}catch(t){console.error("[pendingPromptEvents] listener error",t)}}function cme(e){if(e.length===0)return;const t=new Set(e),n=Ag.filter(s=>!t.has(s));n.length!==Ag.length&&(Ag=n,FG())}function ume(e){const t=HG(e);return t?(Ag=[...Ag,t].slice(-200),FG(),(t.type===ON||t.type===BN||t.type===$N)&&lme(),!0):!1}function dme(e){return HG(e)!==void 0}function HG(e){if(!e||typeof e!="object")return;const t=e,n=t.type,s=t.data;if(!s||typeof s!="object")return;const r=s;if(typeof r.sessionId=="string"&&((n===ON||n===BN||n===$N)&&typeof r.promptId=="string"||(n==="turn_complete"||n==="turn_error")&&typeof r.promptId=="string"))return e}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const qG=[404,410],hme=new Set(qG);function Wy(e){return e!==void 0&&hme.has(e)}function nu(e,t){return Wy(t)&&!Wy(e)?t:e}const MP="session_transcript_pagination",fme="workspace_acp_preheat",mme="workspace_acp_status";function Hh(e,t){const n=wG(e);return{type:"assistant.done",reason:t,eventId:e.id,...n!==void 0?{serverTimestamp:n}:{}}}function pme(e){if(e.type==="session_update")try{if(!ea(e.data))return;const t=e.data.update,n=ea(t)?t._meta:e.data._meta;return ea(n)?Rc(n,"qwen.session.recordId"):void 0}catch{return}}function gme(e,t,n){const s=e.getSnapshot(),r=F7({maxBlocks:Number.MAX_SAFE_INTEGER,nextOrdinal:s.nextOrdinal});r.dispatch(t);const i=r.getSnapshot();return i.blocks.length+s.blocks.length>n?!1:(e.reset({...s,blocks:[...i.blocks,...s.blocks],nextOrdinal:i.nextOrdinal,toolBlockByCallId:{...i.toolBlockByCallId,...s.toolBlockByCallId},permissionBlockByRequestId:{...i.permissionBlockByRequestId,...s.permissionBlockByRequestId}}),!0)}const UG=f.createContext(void 0),VG=f.createContext(void 0),XN=f.createContext(void 0),WG=f.createContext(void 0),GG=f.createContext(void 0),KG=f.createContext(void 0),YG=f.createContext(void 0),QN=new Set([401,403]),bme=new Set([...QN,...qG]),yme=2e5,xme={memoryVersion:0,agentsVersion:0,toolsVersion:0,settingsVersion:0,mcpVersion:0,extensionsVersion:0,artifactsVersion:0,initVersion:0,authVersion:0},vme=Symbol("unhandled session");function XG(e){const{baseUrl:t,token:n,workspaceCwd:s,sessionId:r,clientId:i,createSessionRequest:o,maxQueued:a=1024,maxBlocks:c=yme,historyPageSize:u,suppressOwnUserEcho:d=!0,includeRawEvent:h=!1,autoConnect:m=!0,autoReconnect:p=!0,restartEventStreamOnPrompt:g=!1,reconnectDelayMs:b=1e3,maxReconnectDelayMs:v=1e4,heartbeatIntervalMs:x=3e4,heartbeatFailureThreshold:y=3,loadWarnings:w,children:k}=e,T=PG(),_=t??(T==null?void 0:T.baseUrl),C=n??(T==null?void 0:T.token),S=s??(T==null?void 0:T.workspaceCwd),L=f.useRef(T==null?void 0:T.client);L.current=T==null?void 0:T.client;const N=f.useRef(T==null?void 0:T.capabilities);N.current=T==null?void 0:T.capabilities;const $=f.useRef(T==null?void 0:T.getCapabilities);$.current=T==null?void 0:T.getCapabilities;const M=f.useRef(!1),E=f.useRef(r).current,O=E===void 0,z=f.useRef(S);z.current=S;const F=f.useRef(S);S&&(F.current=S);const B=f.useMemo(()=>F7({maxBlocks:c}),[c]),W=f.useRef(void 0),I=f.useRef({hasMore:!1,loading:!1,capacityReached:!1}),[Y,V]=f.useState({hasMore:!1,loading:!1,capacityReached:!1}),j=f.useRef(void 0),ee=f.useRef(void 0),se=f.useRef(new Map),X=f.useRef(new Map),Q=f.useRef(void 0),ue=f.useRef(0),re=f.useRef(void 0),J=f.useRef(!1),q=f.useRef({consecutiveFailures:0}),Z=f.useRef(!1),he=f.useRef(void 0),ye=f.useRef(new WeakSet),oe=f.useRef({suppressOwnUserEcho:d,includeRawEvent:h}),we=f.useRef({reconnectDelayMs:b,maxReconnectDelayMs:v}),Ve=f.useRef(w),lt=f.useRef(u),Et=f.useRef(void 0);(!Et.current||i)&&(Et.current=s5(i)),oe.current={suppressOwnUserEcho:d,includeRawEvent:h},we.current={reconnectDelayMs:b,maxReconnectDelayMs:v},Ve.current=w,lt.current=u;const pt=o==null?void 0:o.modelServiceId,je=o==null?void 0:o.sessionScope,Ae=f.useRef(o);Ae.current=o;const[De,Ne]=f.useState("idle"),[tt,Se]=f.useState(E),[Be,le]=f.useState(void 0),[Le,sn]=f.useState("load"),[Cn,In]=f.useState(0),[_t,Te]=f.useState(0),[at,ke]=f.useState(0),[Pe,ve]=f.useState({status:m?"connecting":"idle",...E?{sessionId:E}:{}}),Ke=f.useRef(Pe);Ke.current=Pe,f.useEffect(()=>{T!=null&&T.capabilities&&ve(Ge=>Ge.capabilities===T.capabilities?Ge:{...Ge,capabilities:T.capabilities})},[T==null?void 0:T.capabilities]);const me=f.useRef(0),[qe,Mt]=f.useState([]),ln=f.useCallback(Ge=>{const dt={...Ge,id:Ge.id??`daemon-notice-${Date.now()}-${++me.current}`,createdAt:Ge.createdAt??Date.now()};return Mt(bn=>bn.some(Ht=>Ht.id===dt.id)?bn:[...bn.slice(-49),dt]),dt},[]),Ft=f.useCallback(Ge=>{Mt(dt=>dt.filter(bn=>bn.id!==Ge))},[]),st=f.useCallback(()=>{Mt([])},[]),Tn=f.useMemo(()=>({notices:qe,dismissNotice:Ft,clearNotices:st}),[st,Ft,qe]),[ne,gt]=f.useState(xme),bt=f.useRef(()=>!1),It=f.useRef(!1);f.useEffect(()=>(It.current=!0,()=>{It.current=!1}),[]),f.useEffect(()=>{if(!m)return;if(!L.current&&!_){ve({status:"error",error:"DaemonSessionProvider requires a baseUrl prop or an ancestor DaemonWorkspaceProvider."});return}const Ge=new AbortController;let dt=!1,bn=[],Ht;const Rn=()=>{if(Ht=void 0,bn.length===0)return;const Dn=bn;bn=[];try{B.dispatch(Dn)}catch(wn){console.error("[DaemonSessionProvider] batched transcript dispatch failed",{eventCount:Dn.length,error:wn})}},Gn=()=>{Ht!==void 0&&(clearTimeout(Ht),Ht=void 0)},Or=Dn=>{if(Dn.length!==0){for(const wn of Dn)bn.push(wn);Ht===void 0&&(Ht=setTimeout(Rn,0))}},Bn=()=>{Gn(),Rn()},_n=Dn=>{Bn(),B.dispatch(Dn)},gs=()=>{Gn(),bn=[]};return(async()=>{var Dn,wn,br,Qs,hs,cn,Jn,Wi,is,tr,kr,Br;const gr=L.current??new D7({baseUrl:_,token:C});let bs,ir,or=tt,pe=!tt&&at>0,Oe=0,rt=!1,Ut=()=>!1,fn=!1;for(;!dt&&!Ge.signal.aborted;){const un=rt;rt=!1;let _e=!1,Ue,zt;const Sn=()=>{zt==null||zt(),zt=void 0,j.current===Ue&&(j.current=void 0)};try{let kn=!1,Pn=!1,es=!1,jn=!1,$n,qs;if(!bs){const He=W.current;He&&!tt&&!or&&!pe&&(bs=He,or=He.sessionId,ee.current=He.sessionId,jn=!0)}if(!bs){ve(Li=>({...Li,status:"connecting",error:void 0,errorStatus:nu(void 0,Li.errorStatus)}));const He=$.current,pn=N.current??(He?await He():await gr.capabilities());if(dt||Ge.signal.aborted)return;ir=pn;const js=Array.isArray(pn.features)&&pn.features.includes(MP);J.current=Array.isArray(pn.features)&&pn.features.includes("client_heartbeat");const ls=Be??z.current??pn.workspaceCwd;F.current=ls;const Cs=Array.isArray(pn.features)?pn.features:[],Di=ls===pn.workspaceCwd&&Cs.includes(fme),lo=Di&&Cs.includes(mme);if((O||Z.current)&&!tt&&!or&&!pe){const[Li,di,$l,Uc]=await Promise.allSettled([gr.workspaceProviders(),gr.workspaceSkills(),lo?gr.workspaceAcpStatus():Promise.resolve(void 0),ls?gr.workspaceByCwd(ls).workspaceGit():gr.workspaceGit()]);Li.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceProviders failed in deferred connect:",Li.reason),di.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceSkills failed in deferred connect:",di.reason),lo&&$l.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceAcpStatus failed in deferred connect:",$l.reason);const Xu=Li.status==="fulfilled"?Li.value:void 0,zr=wP(Xu),{commands:Ra,skills:zl}=kP(di.status==="fulfilled"?di.value:void 0),Qu=di.status==="rejected"||Z.current&&Ra.length===0;ve(Uo=>({...Uo,status:"connected",workspaceCwd:ls,gitBranch:Uc.status==="fulfilled"?Uc.value.branch??void 0:void 0,models:zr.models,currentModel:zr.currentModel,currentMode:zr.currentMode,contextWindow:zr.contextWindow,providers:Xu,capabilities:pn,commands:Qu?Uo.commands:Ra,skills:Qu?Uo.skills:zl})),Di&&!($l.status==="fulfilled"&&((Dn=$l.value)==null?void 0:Dn.channelLive)===!0)&&!M.current&&(M.current=!0,(async()=>{try{const Uo=await gr.workspaceAcpPreheat(5e3);if(dt||Ge.signal.aborted||!Uo.ready||Ke.current.sessionId)return;const xm=await gr.workspaceSkills();if(dt||Ge.signal.aborted||Ke.current.sessionId)return;const{commands:ph,skills:ub}=kP(xm);ve(Sc=>Sc.sessionId?Sc:{...Sc,commands:ph,skills:ub})}catch(Uo){console.warn("[DaemonSessionProvider] ACP preheat for workspace skills failed:",Uo)}finally{M.current=!1}})());return}const Bs=tt&&Le==="resume"?Hb.resume:Hb.load,Si=tt??or,ui=i?Et.current:s5(void 0,Si);_e=!!tt,Si&&ve(Li=>({...Li,sessionId:Si,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0}));const Kn=tt?await Bs(gr,tt,{workspaceCwd:ls,...js&&Le==="load"&&lt.current!==void 0?{historyPageSize:lt.current}:{}},ui):or?await Hb.load(gr,or,{workspaceCwd:ls,...js&&lt.current!==void 0?{historyPageSize:lt.current}:{}},ui):await Hb.createOrAttach(gr,{...pt!==void 0?{modelServiceId:pt}:{},...pe?{sessionScope:"thread"}:je!==void 0?{sessionScope:je}:{},workspaceCwd:ls},ui);if(_e=!1,!i&&Kn.clientId&&(Et.current=Kn.clientId,B_(Kn.clientId,Kn.sessionId)),dt||Ge.signal.aborted){CP({baseUrl:_,token:C,sessionId:Kn.sessionId,clientId:Kn.clientId}).catch(Li=>console.warn("[DaemonSessionProvider] detach failed:",Li));return}const Ts=ee.current;Ts!==Kn.sessionId&&st(),Ts!==void 0&&Kn.sessionId!==Ts?(Ne("idle"),Ei(re),es=!0):Ts!==void 0&&(Kn.replaySnapshot.compactedReplay.length+Kn.replaySnapshot.liveJournal.length>0?(Ne("idle"),Ei(re),es=!0):(B.dispatch({type:"assistant.done",reason:"reconnected"}),B.getSnapshot().awaitingResync&&B.clearAwaitingResync())),kn=Ts!==void 0&&Ts===Kn.sessionId,Pn=Kn.replaySnapshot.compactedReplay.length>0||Kn.replaySnapshot.liveJournal.length>0;const Bl=[...Kn.replaySnapshot.compactedReplay,...Kn.replaySnapshot.liveJournal];$n=jfe(Bl),qs=KN($n),bs=Kn,or=bs.sessionId,pe=!1,ee.current=bs.sessionId,W.current=bs}const mn=bs,Ps=ye.current.has(mn);let ys=mn.hasActivePrompt===!0&&!Ps;const Re=()=>{ye.current.add(mn),ys=!1},Dt=()=>ys||se.current.has(mn.sessionId);Ut=Dt,bt.current=Dt,Ne(Dt()?"streaming":"idle");const zn=Q.current,xs=(zn==null?void 0:zn.sessionId)===mn.sessionId?zn:void 0,{compactedReplay:nr,liveJournal:Js}=mn.replaySnapshot,vs=[...nr,...Js],Jr=vs.map(pme).find(He=>He!==void 0),Gi=Array.isArray(ir==null?void 0:ir.features)&&ir.features.includes(MP)&&mn.historyHasMore&&Jr!==void 0;I.current={sessionId:mn.sessionId,...Jr!==void 0?{beforeRecordId:Jr}:{},hasMore:Gi,loading:!1,capacityReached:!1},V({hasMore:Gi,loading:!1,capacityReached:!1});const $r=Pn&&vs.length>0;if(es&&!$r&&B.reset(),$r){const He={...oe.current,suppressOwnUserEcho:!1},pn=[];for(const ls of vs)try{const Cs=a5(ls,mn.clientId,He,ve,{updateConnection:!1});if(pn.push(...l5(ls,Cs,ln,Ft)),ls.type==="turn_complete"){const Di=((wn=ls.data)==null?void 0:wn.stopReason)??"end_turn";pn.push(Hh(ls,Di))}else ls.type==="turn_error"&&pn.push(Hh(ls,"error"))}catch(Cs){const Di=Cs instanceof Error?Cs.message:String(Cs);ln({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed replay event",debugMessage:Di,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed replay event:",Cs)}let js=!1;if(es||B.getSnapshot().blocks.length===0){const ls=F7({maxBlocks:Number.MAX_SAFE_INTEGER});ls.dispatch(pn);const Cs=ls.getSnapshot();js=Cs.blocks.length>c,B.reset({...Cs,maxBlocks:Math.max(c,Cs.blocks.length)})}else pn.length>0&&B.dispatch(pn);pn.length>0&&DP(pn,gt),js&&Gi&&(I.current.hasMore=!1,I.current.capacityReached=!0,V({hasMore:!1,loading:!1,capacityReached:!0}));for(const ls of vs)IP(se.current,X.current,mn.sessionId,ls,B,Ne,re,{requireBoundPromptId:!0});ve(ls=>({...ls,catchingUp:void 0}))}ve(He=>({...He,status:"connected",sessionId:mn.sessionId,...mn.clientId?{clientId:mn.clientId}:{},workspaceCwd:mn.workspaceCwd,displayName:_P(mn.state)??(He.sessionId===mn.sessionId?He.displayName:void 0),tokenUsage:$n!==void 0?$n:He.sessionId===mn.sessionId?He.tokenUsage:void 0,tokenCount:qs!==void 0?qs:He.sessionId===mn.sessionId?He.tokenCount??0:0,loadingTranscript:void 0,catchingUp:$r?He.catchingUp:kn||mn.lastEventId!=null||void 0})),xs&&(Q.current=void 0,clearTimeout(xs.timeout),he.current===mn.sessionId&&(he.current=void 0),xs.resolve());const Ii=un||jn&&Ke.current.commands!==void 0&&Ke.current.skills!==void 0&&Ke.current.supportedCommands!==void 0&&Ke.current.context!==void 0,qo=un?Promise.resolve({branch:Ke.current.gitBranch}):mn.workspaceCwd?gr.workspaceByCwd(mn.workspaceCwd).workspaceGit():gr.workspaceGit(),[ci,Ri,ae,xe]=await Promise.allSettled([Ii?Promise.resolve(void 0):gr.workspaceProviders(),Ii?Promise.resolve(void 0):mn.supportedCommands(),Ii?Promise.resolve(void 0):mn.context(),qo]),ze=(ci==null?void 0:ci.status)==="fulfilled"?ci.value:void 0,Qe=(Ri==null?void 0:Ri.status)==="fulfilled"?Ri.value:void 0,Kt=(ae==null?void 0:ae.status)==="fulfilled"?ae.value:void 0,At=(xe==null?void 0:xe.status)==="fulfilled"?xe.value.branch??void 0:void 0,Un=[(ci==null?void 0:ci.status)==="rejected"?(br=Ve.current)==null?void 0:br.models:void 0,(Ri==null?void 0:Ri.status)==="rejected"?(Qs=Ve.current)==null?void 0:Qs.commands:void 0,(ae==null?void 0:ae.status)==="rejected"?(hs=Ve.current)==null?void 0:hs.context:void 0].filter(He=>!!He),Os=wP(ze),Ss=Efe(Kt),yr=Ss&&Ss.models.length>0?Ss.models:Os.models,Zr=(Ss==null?void 0:Ss.currentModel)??Os.currentModel,_c=Zr===Os.currentModel?Os.contextWindow:(cn=Os.models.find(He=>He.id===Zr))==null?void 0:cn.contextWindow,xr=(Ss==null?void 0:Ss.contextWindow)??((Jn=yr.find(He=>He.id===Zr))==null?void 0:Jn.contextWindow)??_c,{commands:ua,skills:Nr}=jG(Qe),gi=Nfe(Kt)??Os.currentMode;ve(He=>He.sessionId!==mn.sessionId?He:{...He,status:"connected",sessionId:mn.sessionId,...mn.clientId?{clientId:mn.clientId}:{},workspaceCwd:mn.workspaceCwd,commands:Qe!==void 0?ua:He.commands,skills:Qe!==void 0?Nr:He.skills,models:yr.length>0?yr:He.models,currentModel:Zr??He.currentModel,currentMode:gi??He.currentMode,displayName:_P(mn.state)??He.displayName,contextWindow:xr??He.contextWindow,providers:ze??He.providers,supportedCommands:Qe??He.supportedCommands,context:Kt??He.context,gitBranch:xe.status==="fulfilled"?At:He.gitBranch,capabilities:ir??He.capabilities,loadingTranscript:void 0,catchingUp:$r?He.catchingUp:kn||mn.lastEventId!=null||void 0}),Un.length>0&&B.dispatch(Un.map(He=>({type:"status",text:He})));let sr=!1,Je=!1;const Lt=()=>{const He=se.current.get(mn.sessionId);He==null||He.controller.abort(),se.current.delete(mn.sessionId),ys&&Re(),Ei(re),Ne("idle"),gs(),B.reset(),mn.setLastEventId(0),or=mn.sessionId,Je=!0,bs=void 0,W.current=void 0,bt.current=()=>!1,ve(pn=>({...pn,status:"connecting",error:void 0,errorStatus:nu(void 0,pn.errorStatus)}))},Yt=new AbortController;Ue={sessionId:mn.sessionId,controller:Yt,restartRequested:!1},j.current=Ue;const Nn=()=>Yt.abort(Ge.signal.reason);Ge.signal.addEventListener("abort",Nn,{once:!0}),zt=()=>Ge.signal.removeEventListener("abort",Nn);for await(const He of mn.events({signal:Yt.signal,maxQueued:a})){if(((Wi=W.current)==null?void 0:Wi.sessionId)!==mn.sessionId)break;sr||(sr=!0,Oe=0);try{const pn=eme(He);if(pn){Zfe(pn);continue}const js=rme(He);js&&nme(js),dme(He)&&(ume(He),He.type==="pending_prompt_started"&&(Ei(re),Ne("waiting")));const ls=a5(He,mn.clientId,oe.current,ve),Cs=l5(He,ls,ln,Ft);if(He.type==="state_resync_required"&&(typeof He.data=="object"&&He.data!==null?He.data.reason:void 0)==="epoch_reset"){Lt();break}if(DP(Cs,gt),Cs.length>0){const Kn=c5(Cs);Ne(Ts=>Ts==="waiting"||Ts==="idle"&&Kn?"streaming":Ts)}(He.type==="turn_complete"||He.type==="turn_error")&&Bn();const Di=IP(se.current,X.current,mn.sessionId,He,B,Ne,re);let lo=!1;if(!Di&&ys&&(He.type==="turn_complete"||He.type==="turn_error")){Re(),lo=!0,Ei(re);const Kn=He.type==="turn_complete"?((is=He.data)==null?void 0:is.stopReason)??"end_turn":"error";_n(Hh(He,Kn)),Dt()||Ne("idle")}!Dt()&&Cs.some(Kn=>Kn.type==="debug")&&Bn();const Si=!Dt()&&B.getSnapshot().activeAssistantBlockId!=null?Cs.filter(Kn=>Kn.type!=="debug"):Cs;Or(Si);for(const Kn of Cs)if(Kn.type==="prompt.cancelled"&&(ys||Kn.originatorClientId!==mn.clientId)){_n(Hh(He,"cancelled"));const Ts=ys;Re(),lo=!0,Ei(re),Ts||se.current.delete(mn.sessionId),Dt()||Ne("idle")}else Kn.type==="session.replay_complete"&&(Bn(),ve(Ts=>({...Ts,catchingUp:void 0})),B.getSnapshot().awaitingResync&&B.clearAwaitingResync(),Dt()||(Ei(re),_n({type:"assistant.done",reason:"replay_complete"}),Ne("idle")));const ui=!Di&&!lo&&!Dt();if(ui&&(Cs.some(Ts=>Ts.type==="user.text.delta")?Ne("waiting"):c5(Cs)&&Ne(Ts=>Ts==="idle"?"streaming":Ts)),ui&&He.type==="turn_complete"){Ei(re);const Kn=((tr=He.data)==null?void 0:tr.stopReason)??"end_turn";_n(Hh(He,Kn)),Ne("idle")}else ui&&He.type==="turn_error"?(Ei(re),_n(Hh(He,"error")),Ne("idle")):ui&&c5(Cs)&&Pfe(B,re,"passive_observer",3e3,()=>Ne("idle"));if(He.type==="state_resync_required"&&(typeof He.data=="object"&&He.data!==null?He.data.reason:void 0)!=="epoch_reset"){Dt()||(Ne("idle"),Ei(re)),gs(),B.reset(),console.warn("[DaemonSessionProvider] ring eviction detected, reloading session (sessionId=%s)",mn.sessionId),Je=!0,bs=void 0,W.current=void 0,bt.current=()=>!1,ve(Ts=>({...Ts,status:"connecting",error:void 0,errorStatus:nu(void 0,Ts.errorStatus)}));break}if(He.type==="session_closed"&&((kr=He.data)==null?void 0:kr.reason)==="client_close"){fn=!0;const Kn=mn.sessionId,Ts=se.current.get(Kn);Ts==null||Ts.controller.abort(),se.current.delete(Kn),bs=void 0,W.current=void 0;break}}catch(pn){const js=pn instanceof Error?pn.message:String(pn);ln({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.event_malformed",message:"Skipped malformed daemon event",debugMessage:js,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed daemon event:",pn)}}Bn();const Hn=Ue.restartRequested;if(Sn(),Hn){Oe=0,rt=!0;continue}if(fn){_n({type:"assistant.done",reason:"cancelled"}),Ne("idle"),Ei(re),ve(He=>({...He,status:"disconnected",sessionId:void 0,error:void 0,errorStatus:void 0,missingSession:!1}));return}if(Z.current){bs=void 0,W.current=void 0,bt.current=()=>!1;return}!dt&&!Ge.signal.aborted&&!Je&&(((Br=W.current)==null?void 0:Br.sessionId)===mn.sessionId&&(console.debug("[DaemonSessionProvider] SSE stream ended"),Dt()||(Ei(re),Ne("idle"),_n({type:"assistant.done",reason:"stream_ended"}))),ve(He=>({...He,status:He.status==="error"?"error":"disconnected",error:He.status==="error"?He.error:void 0,errorStatus:nu(void 0,He.errorStatus)})))}catch(kn){const Pn=(Ue==null?void 0:Ue.restartRequested)===!0;if(Sn(),Pn&&!dt&&!Ge.signal.aborted){Bn(),Oe=0,rt=!0;continue}if(dt||Ge.signal.aborted)return;Bn();const es=kn instanceof Error?kn.message:String(kn),jn=eS(kn),$n=bs==null?void 0:bs.sessionId,qs=Ime(kn),mn=Mme(kn);if($n&&(qs||mn)){const ys=se.current.get($n);ys==null||ys.controller.abort(),se.current.delete($n)}(qs||mn||!Ut())&&(Ei(re),Ne("idle"));const Ps=Q.current;if(Ps&&(Ps.sessionId===tt||Ps.sessionId===or)&&(he.current===Ps.sessionId&&(he.current=void 0),Q.current=void 0,clearTimeout(Ps.timeout),Ps.reject(kn)),qs||mn){if(bs=void 0,W.current=void 0,qs){ve(Re=>({...Re,status:"error",sessionId:void 0,error:es,errorStatus:nu(jn,Re.errorStatus),missingSession:!1,capabilities:ir??Re.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}const ys=_e&&Wy(jn);console.warn("[DaemonSessionProvider] terminal session error (sessionId=%s, status=%d, message=%s)",$n,jn,es),ve(Re=>({...Re,status:"disconnected",sessionId:void 0,error:es,errorStatus:nu(jn,Re.errorStatus),missingSession:ys||Re.missingSession===!0,capabilities:ir??Re.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}else console.debug("[DaemonSessionProvider] retriable SSE error, preserving session for delta resume (sessionId=%s)",bs==null?void 0:bs.sessionId);if(!p){bs=void 0,W.current=void 0,ve(ys=>({...ys,status:"error",error:es,errorStatus:nu(jn,ys.errorStatus),missingSession:!1}));return}ve(ys=>({...ys,status:"disconnected",error:es,errorStatus:nu(jn,ys.errorStatus),missingSession:!1,loadingTranscript:void 0}))}if(!p){W.current=void 0,ve(kn=>({...kn,status:"disconnected",loadingTranscript:void 0,catchingUp:void 0}));return}Oe+=1;const Gt=we.current,Ls=Dfe(Oe,Gt.reconnectDelayMs,Gt.maxReconnectDelayMs);ve(kn=>({...kn,status:"disconnected",error:`Reconnecting in ${Ls}ms`})),await Lfe(Ls,Ge.signal)}})(),()=>{const Dn=W.current;dt=!0,Ge.abort(),Bn(),bt.current=()=>!1,Ne("idle"),Ei(re);const wn=(Dn==null?void 0:Dn.sessionId)===he.current,br=!It.current;Q.current&&(!wn||br)&&(clearTimeout(Q.current.timeout),Q.current.reject(new DOMException("Session load interrupted by cleanup","AbortError")),Q.current=void 0),(!wn||br)&&(Dn!=null&&Dn.clientId)&&CP({baseUrl:_,token:C,sessionId:Dn.sessionId,clientId:Dn.clientId}).catch(Qs=>console.warn("[DaemonSessionProvider] detach failed:",Qs)),(!wn||br)&&(W.current=void 0)}},[m,p,_,C,s,pt,je,a,c,B,tt,Be,Le,Cn,_t,at,i,O,st,ln,Ft]),f.useEffect(()=>{if(!J.current||Pe.status!=="connected"||x<=0||y<=0||!Pe.sessionId)return;q.current.sessionId!==Pe.sessionId&&(q.current={sessionId:Pe.sessionId,consecutiveFailures:0});const Ge=q.current;let dt=!1;const bn=setInterval(()=>{const Ht=W.current;Ht&&Ht.heartbeat().then(()=>{dt||(Ge.consecutiveFailures>=y&&ve(Rn=>Rn.sessionId===Ht.sessionId?{...Rn,status:"connected",error:void 0,errorStatus:void 0}:Rn),Ge.consecutiveFailures=0,Ge.lastHttpError=void 0)}).catch(Rn=>{var Gn,Or,Bn,_n,gs;if(dt)return;Ge.consecutiveFailures+=1;const Qn=Rn instanceof Error?Rn.message:"Session heartbeat failed",Dn=eS(Rn);if(Dn!==void 0){const cn=(Gn=Ge.lastHttpError)==null?void 0:Gn.status;Ge.lastHttpError={status:nu(Dn,cn)??Dn,message:Wy(cn)?((Or=Ge.lastHttpError)==null?void 0:Or.message)??Qn:Qn}}if(Ge.consecutiveFailures<y)return;const wn=(Bn=Ge.lastHttpError)==null?void 0:Bn.status,br=((_n=Ge.lastHttpError)==null?void 0:_n.message)??Qn,Qs=wn!==void 0&&QN.has(wn),hs=Wy(wn);if(Qs||hs){const cn=Ht.sessionId;console.warn(hs?"[DaemonSessionProvider] heartbeat detected missing session (sessionId=%s, status=%d)":"[DaemonSessionProvider] heartbeat auth failure (sessionId=%s, status=%d)",cn,wn);const Jn=se.current.get(cn);Jn==null||Jn.controller.abort(),se.current.delete(cn),Ei(re),Ne("idle"),((gs=W.current)==null?void 0:gs.sessionId)===cn&&(hs&&(Z.current=!0),W.current=void 0)}ve(cn=>cn.sessionId===Ht.sessionId?{...cn,status:Qs?"error":"disconnected",error:br,errorStatus:nu(wn,cn.errorStatus),missingSession:hs,...Qs||hs?{sessionId:void 0,loadingTranscript:void 0,catchingUp:void 0}:{}}:cn)})},x);return()=>{dt=!0,clearInterval(bn)}},[Pe.sessionId,Pe.status,y,x]);const Rt=f.useMemo(()=>zfe({store:B,sessionRef:W,activePromptsRef:se,settledPromptsRef:X,pendingSessionLoadRef:Q,pendingSessionLoadIdRef:ue,heartbeatSupportedRef:J,manualSessionClearRef:Z,skipNextCleanupDetachSessionIdRef:he,passiveAssistantDoneTimerRef:re,hasSessionActivePrompt:()=>bt.current(),resetCurrentSessionActivePrompt:()=>{bt.current=()=>!1},restartEventStream:Ge=>{if(!g)return;const dt=j.current;(dt==null?void 0:dt.sessionId)===Ge&&(dt.restartRequested=!0,dt.controller.abort())},getCreateSessionRequest:()=>{var Ge;return{...Ae.current,sessionScope:"thread",workspaceCwd:F.current??((Ge=W.current)==null?void 0:Ge.workspaceCwd)}},createDetachedSession:(Ge,dt)=>{var bn;const Ht=L.current??new D7({baseUrl:_,token:C}),Rn={...Ae.current,sessionScope:"thread",workspaceCwd:Ge??F.current??((bn=W.current)==null?void 0:bn.workspaceCwd),...(dt==null?void 0:dt.approvalMode)!==void 0?{approvalMode:dt.approvalMode}:{},...(dt==null?void 0:dt.sourceType)!==void 0?{sourceType:dt.sourceType}:{},...(dt==null?void 0:dt.worktree)!==void 0?{worktree:dt.worktree}:{}},Gn=i?Et.current:s5(void 0);return Hb.createOrAttach(Ht,Rn,Gn)},getConnection:()=>Ke.current,addNotice:ln,setConnection:ve,setPromptStatus:Ne,setRestoreSessionId:Se,setRestoreWorkspaceCwd:le,setRestoreMode:sn,setRestoreSessionNonce:In,setAttachSessionNonce:Te,setNewSessionNonce:ke}),[ln,i,_,C,g,B]),We=f.useCallback(async()=>{const Ge=I.current,dt=W.current;if(!Ge.hasMore||Ge.loading||!dt||dt.sessionId!==Ge.sessionId)return;Ge.loading=!0,V({hasMore:!0,loading:!0,capacityReached:!1});let bn=!1;try{const Ht=await dt.client.getSessionTranscriptPage(dt.sessionId,{...Ge.cursor!==void 0?{cursor:Ge.cursor}:Ge.beforeRecordId!==void 0?{beforeRecordId:Ge.beforeRecordId}:{},limit:lt.current??100,clientId:dt.clientId});if(W.current!==dt||I.current!==Ge)return;if(Ht.partial||Ht.replayError)throw bn=!0,new Error(Ht.replayError??"Earlier session history was only partially read");const Rn={...oe.current,suppressOwnUserEcho:!1},Gn=[];for(const Bn of Ht.events)try{Gn.push(...l5(Bn,a5(Bn,dt.clientId,Rn,ve,{updateConnection:!1}),ln,Ft))}catch(_n){const gs=_n instanceof Error?_n.message:String(_n);ln({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed history event",debugMessage:gs,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed history event:",_n)}if(Gn.length>0&&!gme(B,Gn,c)){Ge.hasMore=!1,Ge.loading=!1,Ge.capacityReached=!0,V({hasMore:!1,loading:!1,capacityReached:!0});return}const Or=B.getSnapshot().blocks.length<c;Ge.capacityReached=Ht.hasMore&&!Or,Ge.cursor=Ht.nextCursor,Ge.beforeRecordId=void 0,Ge.hasMore=Ht.hasMore&&Or,Ge.loading=!1,V({hasMore:Ge.hasMore,loading:!1,capacityReached:Ge.capacityReached})}catch(Ht){if(W.current!==dt||I.current!==Ge)return;const Rn=!bn&&(!(Ht instanceof yc)||Ht.status>=500||Ht.status===408||Ht.status===429);throw Ge.hasMore=Rn,Ge.loading=!1,Ge.capacityReached=!1,V({hasMore:Rn,loading:!1,capacityReached:!1}),ln({severity:"warning",category:"user_action",operation:"load_session",code:"daemon.transcript_history.failed",message:"Failed to load earlier session history",debugMessage:Ht instanceof Error?Ht.message:String(Ht),recoverable:Rn}),Ht}},[ln,Ft,c,B]),Zn=f.useMemo(()=>{var Ge;const dt=Pe.sessionId===I.current.sessionId&&((Ge=W.current)==null?void 0:Ge.sessionId)===I.current.sessionId;return{hasMore:dt&&Y.hasMore,loading:dt&&Y.loading,capacityReached:dt&&Y.capacityReached,loadMore:We}},[Pe.sessionId,We,Y]),Ar=f.useRef(vme);return f.useEffect(()=>{if(Ar.current===r)return;Ar.current=r;const Ge=Ke.current.sessionId;if(r===Ge)return;const dt=r?Rt.loadSession(r):Ge?Rt.clearSession():void 0;dt&&dt.catch(bn=>{console.warn("[DaemonSessionProvider] controlled session transition failed:",bn)})},[Rt,r]),l.jsx(UG.Provider,{value:B,children:l.jsx(VG.Provider,{value:Pe,children:l.jsx(GG.Provider,{value:De,children:l.jsx(KG.Provider,{value:Tn,children:l.jsx(YG.Provider,{value:ne,children:l.jsx(XN.Provider,{value:Rt,children:l.jsx(WG.Provider,{value:Zn,children:k})})})})})})})}function IP(e,t,n,s,r,i,o,a={}){var c;if(s.type!=="turn_complete"&&s.type!=="turn_error")return!1;const u=(c=s.data)==null?void 0:c.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;Ei(o);try{const h=PN(s,u);if(!h)return!1;r.dispatch(Hh(s,h.stopReason)),i("idle"),d.resolve?(e.delete(n),d.resolve(h)):(e.delete(n),t.set(H7(n,u),{status:"resolved",result:h}))}catch(h){r.dispatch(Hh(s,"error")),i("idle"),d.reject?(e.delete(n),d.reject(h)):(e.delete(n),t.set(H7(n,u),{status:"rejected",error:h}))}return!0}function wme(e){return e.type==="turn_complete"}function a5(e,t,n,s,r={}){kme(e),r.updateConnection!==!1&&Afe(e,s);const i=Yde(e,{clientId:t,suppressOwnUserEcho:n.suppressOwnUserEcho,includeRawEvent:n.includeRawEvent}),o=Ame(e);return wme(e)?o?[o]:[]:o?[...i,o]:i}function kme(e){e.type==="settings_reloaded"&&console.debug("[DaemonSessionProvider] settings reloaded:",_me(e))}function _me(e){const t={};if(e.id!==void 0&&(t.eventId=e.id),!ea(e.data))return t.payload="non-object",t;const n=Sme(e.data.env),s=Gy(e.data.changedKeys),r=Gy(e.data.sessionsRefreshed),i=Gy(e.data.sessionsSkipped),o=e.data.childReloaded,a=Rc(e.data,"childError");return n&&(t.env=n),s&&(t.changedKeys=s),typeof o=="boolean"&&(t.childReloaded=o),r&&(t.sessionsRefreshed=r),i&&(t.sessionsSkipped=i),a&&(t.childError=a),t}function Sme(e){if(ea(e))return{updatedKeys:Gy(e.updatedKeys)??[],removedKeys:Gy(e.removedKeys)??[]}}function Gy(e){if(Array.isArray(e))return e.filter(t=>typeof t=="string")}function l5(e,t,n,s){if(e.type==="session_snapshot"&&ea(e.data)&&e.data.recordingDegraded===!1){const i=Rc(e.data,"sessionId");i&&s(`daemon.session_recording_degraded:${i}`)}const r=[];for(const i of t){if(i.type!=="error"){r.push(i);continue}if(e.type==="turn_error"){r.push(i);continue}const o=n(Cme(e,i));(o.category==="protocol"||o.category==="connection")&&console.warn("[DaemonSessionProvider] daemon notice:",o)}return r}function Cme(e,t){const n={message:t.text,debugMessage:t.text,recoverable:t.recoverable};switch(e.type){case"session_recording_degraded":case"session_snapshot":{const s=ea(e.data)?Rc(e.data,"sessionId"):void 0;return{...n,...s?{id:`daemon.session_recording_degraded:${s}`}:{},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 Y4(){const e=f.useContext(UG);if(!e)throw new Error("useDaemonTranscriptStore must be used within DaemonSessionProvider");return e}function QG(){const e=f.useContext(WG);if(!e)throw new Error("useDaemonTranscriptHistory must be used within DaemonSessionProvider");return e}function jv(){const e=Y4(),t=f.useCallback(()=>e.getSnapshot().blocks,[e]);return f.useSyncExternalStore(e.subscribe,t,t)}function X4(){const e=jv(),t=JG();return f.useMemo(()=>Qfe(e,t),[e,t])}function B1(){const e=f.useContext(XN);if(!e)throw new Error("useDaemonActions must be used within DaemonSessionProvider");return e}function Tme(){return f.useContext(XN)}function qu(){return f.useContext(YG)}function JG(){const e=f.useContext(GG);if(!e)throw new Error("useDaemonPromptStatus must be used within DaemonSessionProvider");return e}function Dl(){const e=f.useContext(VG);if(!e)throw new Error("useDaemonConnection must be used within DaemonSessionProvider");return e}function Eme(){const e=f.useContext(KG);if(!e)throw new Error("useDaemonSessionNotices must be used within DaemonSessionProvider");return e}function c5(e){return e.some(t=>t.type==="assistant.text.delta"||t.type==="thought.text.delta"||t.type==="tool.update")}function Ame(e){if(e.type!=="session_update")return null;const t=ea(e.data)?e.data:void 0,n=ea(t==null?void 0:t.update)?t.update:ea(e.data)?e.data:void 0;if(!n||n.sessionUpdate!=="agent_message_chunk")return null;const s=n._meta;if(!ea(s))return null;const r=Nme(s.goalStatus);if(r)return RP(e,r);const i=jme(s.goalTerminal);if(i)return RP(e,i);const o=s.stopHookLoop;if(!ea(o))return null;const a=o.goal;return!ea(a)||!Rc(a,"condition"),null}function RP(e,t){return{type:"status",...e.id!==void 0?{eventId:e.id}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},text:"",source:"goal",data:t}}function Nme(e){if(!ea(e))return null;const t=Rc(e,"kind");if(t!=="set"&&t!=="cleared"&&t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=Rc(e,"condition");if(!n)return null;const s=Ky(e,"iterations"),r=Ky(e,"durationMs"),i=Ky(e,"setAt"),o=Rc(e,"lastReason");return{kind:t,condition:n,...s!==void 0?{iterations:s}:{},...r!==void 0?{durationMs:r}:{},...i!==void 0?{setAt:i}:{},...o?{lastReason:o}:{}}}function jme(e){if(!ea(e))return null;const t=Rc(e,"kind");if(t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=Rc(e,"condition");if(!n)return null;const s=Ky(e,"iterations"),r=Ky(e,"durationMs"),i=Rc(e,"lastReason");return{kind:t,condition:n,...s!==void 0?{iterations:s}:{},...r!==void 0?{durationMs:r}:{},...i?{lastReason:i}:{}}}function Rc(e,t){const n=e[t];return typeof n=="string"?n:void 0}function Ky(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function DP(e,t){let n=0,s=0,r=0,i=0,o=0,a=0,c=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":s+=1;break;case"workspace.tool.toggled":r+=1;break;case"workspace.settings.changed":i+=1;break;case"workspace.mcp.budget_warning":case"workspace.mcp.child_refused":case"workspace.mcp.server_restarted":case"workspace.mcp.server_restart_refused":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":c+=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+s+r+i+o+a+c+d+h!==0&&t(m=>({memoryVersion:m.memoryVersion+n,agentsVersion:m.agentsVersion+s,toolsVersion:m.toolsVersion+r,settingsVersion:m.settingsVersion+i,mcpVersion:m.mcpVersion+o,extensionsVersion:m.extensionsVersion+a,artifactsVersion:m.artifactsVersion+c,...u?{lastExtensionChange:u}:{},initVersion:m.initVersion+d,authVersion:m.authVersion+h}))}function Mme(e){const t=eS(e);return t!==void 0&&bme.has(t)}function Ime(e){const t=eS(e);return t!==void 0&&QN.has(t)}function eS(e){if(e instanceof yc||ea(e)&&typeof e.status=="number")return e.status}function ea(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Uu(e,t){const{autoLoad:n=!1,enabled:s=!0}=t,[r,i]=f.useState({data:void 0,loading:!1,error:void 0}),o=f.useRef(0),a=f.useCallback(async()=>{if(!s)return;const c=++o.current;i(u=>({...u,loading:!0,error:void 0}));try{const u=await e();return c!==o.current?void 0:(i({data:u,loading:!1,error:void 0}),u)}catch(u){if(c!==o.current)return;const d=u instanceof Error?u:new Error(String(u));i(h=>({...h,loading:!1,error:d}));return}},[s,e]);return f.useEffect(()=>{!n||!s||a()},[n,s,a]),{...r,reload:a}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function $1(e,t,n){const s=f.useRef(!1);f.useEffect(()=>{if(!(e===void 0||!n)){if(!s.current){s.current=!0;return}t()}},[n,t,e])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Rme(e={}){var t;const n=To(),s=f.useCallback(()=>n.listAgents(),[n]),r=Uu(s,e),i=qu();return $1(i==null?void 0:i.agentsVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,agents:((t=r.data)==null?void 0:t.agents)??[],getAgent:n.getAgent,createAgent:n.createAgent,generateAgent:n.generateAgent,deleteAgent:n.deleteAgent,updateAgent:n.updateAgent}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function ZG(e={}){const t=To(),n=f.useCallback(()=>t.loadMcpStatus(),[t]),s=Uu(n,e),r=qu();return $1(r==null?void 0:r.mcpVersion,s.reload,e.autoLoad===!0||s.data!==void 0),{...s,status:s.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 Dme(e={}){var t;const n=To(),s=f.useCallback(()=>n.loadMemoryStatus(),[n]),r=Uu(s,e),i=qu();return $1(i==null?void 0:i.memoryVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,files:((t=r.data)==null?void 0:t.files)??[],readFile:n.readWorkspaceFile,writeMemory:n.writeMemory}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function $_(e={}){const{pageSize:t,cursor:n,archiveState:s,view:r,group:i,sourceType:o,...a}=e,c=ol(),u=Tme(),d=f.useCallback(()=>{const _={...t!==void 0?{pageSize:t}:{},...n!==void 0?{cursor:n}:{},...s!==void 0?{archiveState:s}:{},...r!==void 0?{view:r}:{},...i!==void 0?{group:i}:{},...o!==void 0?{sourceType:o}:{}};return c.actions.listSessionsPage(_)},[s,n,i,t,o,r,c.actions]),h=!!c.workspaceCwd,m=Uu(d,{...a,enabled:(a.enabled??!0)&&h}),p=m.reload,g=f.useCallback(async()=>{const _=await p();return _==null?void 0:_.sessions},[p]),b=m.data,v=(b==null?void 0:b.sessions)??[],x=f.useCallback(async _=>{const C=await c.actions.deleteSession(_);return C&&g(),C},[c.actions,g]),y=f.useCallback(async _=>{const C=await c.actions.deleteSessions(_);return(C.removed.length>0||C.notFound.length>0)&&g(),C},[c.actions,g]),w=f.useCallback((_,C="html")=>c.actions.exportSession(_,C),[c.actions]),k=f.useCallback(async _=>{const C=await c.actions.archiveSession(_);return C&&g(),C},[c.actions,g]),T=f.useCallback(async _=>{const C=await c.actions.unarchiveSession(_);return C&&g(),C},[c.actions,g]);return{...m,data:b!==void 0?v:void 0,reload:g,sessions:v,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:x,deleteSessions:y,exportSession:w,archiveSession:k,unarchiveSession:T}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Lme(e={}){var t;const n=To(),s=f.useCallback(()=>n.loadSkillsStatus(),[n]),r=Uu(s,e);return{...r,status:r.data,skills:((t=r.data)==null?void 0:t.skills)??[],setEnabled:n.setWorkspaceSkillEnabled,install:n.installWorkspaceSkill,remove:n.deleteWorkspaceSkill}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function G7(e={}){const{detail:t="summary",...n}=e,s=To(),r=f.useCallback(()=>s.loadDaemonStatus(t),[s,t]),i=Uu(r,n);return{...i,report:i.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Pme(e={}){const{range:t,heatmapDays:n,...s}=e,r=To(),i=f.useCallback(()=>r.loadUsageDashboard({range:t,heatmapDays:n}),[r,t,n]),o=Uu(i,s);return{...o,dashboard:o.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function eK(e={}){var t;const n=To(),s=f.useCallback(()=>n.loadToolsStatus(),[n]),r=Uu(s,e),i=qu();return $1(i==null?void 0:i.toolsVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,tools:((t=r.data)==null?void 0:t.tools)??[],setEnabled:n.setWorkspaceToolEnabled}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function tK(e={}){var t;const n=To(),s=f.useCallback(()=>n.loadSettingsStatus(),[n]),r=Uu(s,e),i=qu();return $1(i==null?void 0:i.settingsVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,settings:((t=r.data)==null?void 0:t.settings)??[],setValue:n.setWorkspaceSetting}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Ome(e={}){var t,n;const s=To(),r=f.useCallback(()=>s.loadProviders(),[s]),i=Uu(r,e),o=qu();return $1(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 Bme=300,$me=100,K0=Object.freeze({suggestion:null,isVisible:!1,shownAt:0});function u5(e){var t;const n=e;(t=n.clearFollowupSuggestion)==null||t.call(n)}function zme(e){const{enabled:t=!0,onStateChange:n,getOnAccept:s,getOnOutcome:r}=e;let i=K0,o=null,a=!1,c=null;function u(v){i=v,n(v)}function d(){o&&(clearTimeout(o),o=null),c&&(clearTimeout(c),c=null)}return{setSuggestion:v=>{if(o&&(clearTimeout(o),o=null),!v){u(K0);return}t&&(o=setTimeout(()=>{u({suggestion:v,isVisible:!0,shownAt:Date.now()})},Bme))},accept:(v,x)=>{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=r())==null||y({outcome:"accepted",accept_method:v,time_ms:k>0?Date.now()-k:0,suggestion_length:w.length})}catch(T){console.error("[followup] onOutcome callback threw:",T)}u(K0),queueMicrotask(()=>{var T;try{x!=null&&x.skipOnAccept||(T=s())==null||T(w)}catch(_){console.error("[followup] onAccept callback threw:",_)}finally{c&&clearTimeout(c),c=setTimeout(()=>{a=!1},$me)}})},dismiss:()=>{var v;if(o&&(clearTimeout(o),o=null),!(!i.isVisible&&!i.suggestion)){if(i.isVisible&&i.suggestion)try{(v=r())==null||v({outcome:"ignored",time_ms:i.shownAt>0?Date.now()-i.shownAt:0,suggestion_length:i.suggestion.length})}catch(x){console.error("[followup] onOutcome callback threw:",x)}u(K0)}},clear:()=>{d(),a=!1,u(K0)},cleanup:()=>{d(),a=!1}}}function nK(e={}){const{enabled:t=!0,onAccept:n,onOutcome:s}=e,r=Y4(),i=Dl().sessionId,[o,a]=f.useState(K0),c=f.useRef(n);c.current=n;const u=f.useRef(s);u.current=s;const d=f.useSyncExternalStore(r.subscribe,()=>r.getSnapshot().lastFollowupSuggestion,()=>r.getSnapshot().lastFollowupSuggestion),h=f.useSyncExternalStore(Jfe,AP,AP),m=(h==null?void 0:h.sessionId)===i?h:d,p=f.useMemo(()=>zme({enabled:t,onStateChange:a,getOnAccept:()=>c.current,getOnOutcome:()=>u.current}),[t]),{setSuggestion:g}=p;f.useEffect(()=>(t||p.clear(),()=>p.cleanup()),[p,t]);const b=f.useRef(void 0),v=f.useRef(i);f.useEffect(()=>{const k=v.current;v.current=i,k!==void 0&&i!==void 0&&k!==i&&(p.clear(),ik(),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 x=f.useCallback(()=>{p.clear(),u5(r),ik(),b.current=void 0},[p,r]),y=f.useCallback((k,T)=>{p.accept(k,T),u5(r),ik(),b.current=void 0},[p,r]),w=f.useCallback(()=>{p.dismiss(),u5(r),ik(),b.current=void 0},[p,r]);return f.useMemo(()=>({followupState:o,onAcceptFollowup:y,onDismissFollowup:w,clear:x}),[o,y,w,x])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Fme(){const e=f.useSyncExternalStore(tme,NP,NP),t=f.useCallback(n=>sme(n),[]);return{batches:e,consume:t}}const LP=[];function Hme(e,t){return e===t?!1:e.length!==t.length?!0:e.some((n,s)=>!Object.is(n,t[s]))}class Jd extends f.Component{constructor(){super(...arguments);Me(this,"state",{error:null,resetKeys:this.props.resetKeys??LP});Me(this,"reset",()=>{this.setState({error:null})})}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,s){const r=n.resetKeys??LP;return Hme(s.resetKeys,r)?{error:null,resetKeys:r}:null}componentDidCatch(n,s){console.error(`[web-shell] ${this.props.label??"render"} failed:`,n,s.componentStack)}render(){const{error:n}=this.state;if(n===null)return this.props.children;const{fallback:s}=this.props;return typeof s=="function"?s(n,this.reset):s}}const PP={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:"重试"}},qme={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},Ume={margin:0,fontSize:"1rem",fontWeight:600},Vme={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},Wme={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 Gme({error:e,onRetry:t,language:n="en"}){const s=PP[n]??PP.en;return l.jsxs("div",{role:"alert",style:qme,"data-web-shell-error":!0,children:[l.jsx("p",{style:Ume,children:s.title}),l.jsx("p",{style:Vme,children:s.body}),!1,l.jsx("button",{type:"button",style:Wme,onClick:t,children:s.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 sK=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.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 Kme=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 Yme=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.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 OP=e=>{const t=Yme(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 d5={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 Xme=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},Qme=f.createContext({}),Jme=()=>f.useContext(Qme),Zme=f.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:s,className:r="",children:i,iconNode:o,...a},c)=>{const{size:u=24,strokeWidth:d=2,absoluteStrokeWidth:h=!1,color:m="currentColor",className:p=""}=Jme()??{},g=s??h?Number(n??d)*24/Number(t??u):n??d;return f.createElement("svg",{ref:c,...d5,width:t??u??d5.width,height:t??u??d5.height,stroke:e??m,strokeWidth:g,className:sK("lucide",p,r),...!i&&!Xme(a)&&{"aria-hidden":"true"},...a},[...o.map(([b,v])=>f.createElement(b,v)),...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 An=(e,t)=>{const n=f.forwardRef(({className:s,...r},i)=>f.createElement(Zme,{ref:i,iconNode:t,className:sK(`lucide-${Kme(OP(e))}`,`lucide-${e}`,s),...r}));return n.displayName=OP(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 epe=[["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"}]],tpe=An("activity",epe);/**
 * @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 npe=[["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"}]],spe=An("archive-restore",npe);/**
 * @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 rpe=[["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"}]],h5=An("archive",rpe);/**
 * @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 ipe=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],JN=An("arrow-left",ipe);/**
 * @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 ope=[["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"}]],ape=An("blocks",ope);/**
 * @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 lpe=[["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"}]],rK=An("bot",lpe);/**
 * @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 cpe=[["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"}]],upe=An("box",cpe);/**
 * @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 dpe=[["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"}]],hpe=An("calendar-clock",dpe);/**
 * @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 fpe=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ZN=An("check",fpe);/**
 * @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 mpe=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ql=An("chevron-down",mpe);/**
 * @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 ppe=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Q4=An("chevron-right",ppe);/**
 * @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 gpe=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],bpe=An("chevron-up",gpe);/**
 * @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 ype=[["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"}]],Wa=An("circle-alert",ype);/**
 * @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 xpe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],vpe=An("circle-dot",xpe);/**
 * @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 wpe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],kpe=An("columns-2",wpe);/**
 * @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 _pe=[["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"}]],Spe=An("command",_pe);/**
 * @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 Cpe=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Tpe=An("copy",Cpe);/**
 * @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 Epe=[["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"}]],K7=An("database",Epe);/**
 * @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 Ape=[["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"}]],f5=An("download",Ape);/**
 * @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 Npe=[["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"}]],Ng=An("ellipsis-vertical",Npe);/**
 * @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 jpe=[["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"}]],Mpe=An("file-text",jpe);/**
 * @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 Ipe=[["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"}]],Rpe=An("flask-conical",Ipe);/**
 * @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 Dpe=[["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"}]],z_=An("folder-closed",Dpe);/**
 * @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 Lpe=[["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"}]],Ppe=An("folder-input",Lpe);/**
 * @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 Ope=[["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"}]],Bpe=An("folder-open",Ope);/**
 * @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 $pe=[["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"}]],zpe=An("folder-x",$pe);/**
 * @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 Fpe=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],tS=An("git-fork",Fpe);/**
 * @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 Hpe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Ex=An("info",Hpe);/**
 * @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 qpe=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Upe=An("layers",qpe);/**
 * @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 Vpe=[["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"}]],Wpe=An("layout-grid",Vpe);/**
 * @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 Gpe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Kpe=An("loader-circle",Gpe);/**
 * @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 Ype=[["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"}]],iK=An("maximize-2",Ype);/**
 * @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 Xpe=[["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"}]],oK=An("minimize-2",Xpe);/**
 * @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 Qpe=[["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"}]],Jpe=An("moon",Qpe);/**
 * @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 Zpe=[["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"}]],BP=An("package",Zpe);/**
 * @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 e0e=[["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"}]],t0e=An("palette",e0e);/**
 * @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 n0e=[["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"}]],s0e=An("panel-left-close",n0e);/**
 * @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 r0e=[["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"}]],i0e=An("panel-left-open",r0e);/**
 * @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 o0e=[["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"}]],Y7=An("pencil",o0e);/**
 * @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 a0e=[["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"}]],$P=An("pin",a0e);/**
 * @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 l0e=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],c0e=An("play",l0e);/**
 * @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 u0e=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ax=An("plus",u0e);/**
 * @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 d0e=[["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"}]],Yy=An("refresh-cw",d0e);/**
 * @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 h0e=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Zd=An("search",h0e);/**
 * @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 f0e=[["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"}]],jg=An("server",f0e);/**
 * @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 m0e=[["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"}]],aK=An("settings-2",m0e);/**
 * @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 p0e=[["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"}]],g0e=An("settings",p0e);/**
 * @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 b0e=[["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"}]],y0e=An("shield",b0e);/**
 * @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 x0e=[["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"}]],v0e=An("sliders-horizontal",x0e);/**
 * @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 w0e=[["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"}]],F_=An("sparkles",w0e);/**
 * @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 k0e=[["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"}]],zP=An("square-pen",k0e);/**
 * @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 _0e=[["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"}]],S0e=An("sun",_0e);/**
 * @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 C0e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],T0e=An("target",C0e);/**
 * @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 E0e=[["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"}]],hg=An("trash-2",E0e);/**
 * @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 A0e=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],N0e=An("triangle-alert",A0e);/**
 * @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 j0e=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],M0e=An("upload",j0e);/**
 * @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 I0e=[["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"}]],FP=An("wifi-off",I0e);/**
 * @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 R0e=[["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"}]],X7=An("wrench",R0e);/**
 * @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 D0e=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],J4=An("x",D0e);function Q7(e){for(const t of e){if(!L0e(t))continue;const n=t;if(n.resolved)continue;const s=fg(n.toolCall),r=typeof(s==null?void 0:s.toolCallId)=="string"?s.toolCallId:typeof(s==null?void 0:s.id)=="string"?s.id:void 0,i=typeof(s==null?void 0:s.kind)=="string"?s.kind:void 0,o=fg(s==null?void 0:s._meta),a=typeof(o==null?void 0:o.toolName)=="string"?o.toolName:void 0;return{id:n.requestId,sessionId:n.sessionId,toolCallId:r,title:n.title,toolKind:i,toolName:a,content:[{type:"text",text:n.title||"Tool permission"}],options:n.options.map(c=>({id:c.optionId,label:c.label,kind:O0e(c.raw)})),rawInput:P0e(n.toolCall)}}return null}function L0e(e){return e.kind==="permission"}function P0e(e){const t=fg(e);return t?fg(t.rawInput)??fg(t.input)??fg(t.args)??t:void 0}function fg(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function O0e(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 B0e(e,t,n){const s=new Array(e);return new Proxy(s,{get(r,i,o){if(typeof i=="string"){const a=i.charCodeAt(0);if(a>=48&&a<=57){const c=+i;if(Number.isInteger(c)&&c>=0&&c<e){let u=r[c];if(!u){const d=t[c*2];u=r[c]={index:c,key:n(c),start:d,size:t[c*2+1],end:d+t[c*2+1],lane:0}}return u}}if(i==="length")return e}return Reflect.get(r,i,o)}})}function A0(e,t,n){let s=n.initialDeps??[],r,i=!0;function o(){const a=e();return(a.length!==s.length||a.some((u,d)=>s[d]!==u))&&(s=a,r=t(...a),n!=null&&n.onChange&&!(i&&n.skipInitialOnChange)&&n.onChange(r),i=!1),r}return o.updateDeps=a=>{s=a},o}function HP(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const $0e=(e,t)=>Math.abs(e-t)<1.01,z0e=(e,t,n)=>{let s;return function(...r){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,r),n)}};let Wb;const m5=()=>{if(Wb!==void 0)return Wb;if(typeof navigator>"u")return Wb=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Wb=!0;const e=navigator.maxTouchPoints;return Wb=navigator.platform==="MacIntel"&&e!==void 0&&e>0},qP=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},F0e=e=>e,H0e=e=>{const t=Math.max(e.startIndex-e.overscan,0),s=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=new Array(s);for(let i=0;i<s;i++)r[i]=t+i;return r},q0e=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const r=o=>{const{width:a,height:c}=o;t({width:Math.round(a),height:Math.round(c)})};if(r(qP(n)),!s.ResizeObserver)return()=>{};const i=new s.ResizeObserver(o=>{const a=()=>{const c=o[0];if(c!=null&&c.borderBoxSize){const u=c.borderBoxSize[0];if(u){r({width:u.inlineSize,height:u.blockSize});return}}r(qP(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},nS={passive:!0},U0e=typeof window>"u"?!0:"onscrollend"in window,V0e=(e,t,n)=>{const s=e.scrollElement;if(!s)return;const r=e.targetWindow;if(!r)return;const i=e.options.useScrollendEvent&&U0e;let o=0;const a=i?null:z0e(r,()=>t(o,!1),e.options.isScrollingResetDelay),c=h=>()=>{o=n(s),a==null||a(),t(o,h)},u=c(!0),d=c(!1);return s.addEventListener("scroll",u,nS),i&&s.addEventListener("scrollend",d,nS),()=>{s.removeEventListener("scroll",u),i&&s.removeEventListener("scrollend",d)}},W0e=(e,t)=>V0e(e,t,n=>{const{horizontal:s,isRtl:r}=e.options;return s?n.scrollLeft*(r&&-1||1):n.scrollTop}),G0e=(e,t,n)=>{if(n.options.useCachedMeasurements){const s=n.indexFromElement(e),r=n.options.getItemKey(s);return n.itemSizeCache.get(r)??n.options.estimateSize(s)}if(t!=null&&t.borderBoxSize){const s=t.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){const s=n.indexFromElement(e),r=n.options.getItemKey(s),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},K0e=(e,{adjustments:t=0,behavior:n},s)=>{var r,i;(i=(r=s.scrollElement)==null?void 0:r.scrollTo)==null||i.call(r,{[s.options.horizontal?"left":"top"]:e+t,behavior:n})},Y0e=K0e;class X0e{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,s,r;return((r=(s=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:s.now)==null?void 0:r.call(s))??Date.now()},this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(r=>{r.forEach(i=>{const o=()=>{const a=i.target,c=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(c)&&this.resizeItem(c,this.options.measureElement(a,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var r;(r=s())==null||r.disconnect(),n=null},observe:r=>{var i;return(i=s())==null?void 0:i.observe(r,{box:"border-box"})},unobserve:r=>{var i;return(i=s())==null?void 0:i.unobserve(r)}}})(),this.range=null,this.setOptions=n=>{var s,r;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:F0e,rangeExtractor:H0e,onChange:()=>{},measureElement:G0e,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,c=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?((s=g[0])==null?void 0:s.key)??o.getItemKey(0):null,v=m>0?((r=g[m-1])==null?void 0:r.key)??o.getItemKey(m-1):null;if(p!==m||m>0&&p>0&&(i.getItemKey(0)!==b||i.getItemKey(p-1)!==v)){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)!==v)&&(c=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:v}=this.options;let x=0;for(;x<b&&v(x)!==m;)x++;if(x<b){const y=g[x];if(y){const w=y.start+p;w!==this.scrollOffset&&(h=w-this.scrollOffset,this.scrollOffset=w,d=!0)}}}(d||c)&&(this.pendingScrollAnchor=[d?a[0]:null,d?a[1]:0,c,h])},this.notify=n=>{var s,r;(r=(s=this.options).onChange)==null||r.call(s,this,n)},this.maybeNotify=A0(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}if(this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,o)=>{this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,o=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!m5()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",o,nS),i.addEventListener("touchend",a,nS),this.unsubs.push(()=>{i.removeEventListener("touchstart",o),i.removeEventListener("touchend",a),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const r=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,r&&this.scrollElement&&this.options.enabled){const[i,o,a,c]=r;i!==null&&!a&&(m5()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?c!==0&&(this._iosDeferredAdjustment+=c):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),a&&this.scrollToEnd({behavior:a})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),s=this.getMaxScrollOffset();if(n<0||n>s)return;const r=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=r,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const r=new Map,i=new Map;for(let o=s-1;o>=0;o--){const a=n[o];if(r.has(a.lane))continue;const c=i.get(a.lane);if(c==null||a.end>c.end?i.set(a.lane,a):a.end<c.end&&r.set(a.lane,!0),r.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((o,a)=>o.end===a.end?o.index-a.index:o.end-a.end)[0]:void 0},this.getMeasurementOptions=A0(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,s,r,i,o,a,c)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:n,paddingStart:s,scrollMargin:r,getItemKey:i,enabled:o,lanes:a,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=A0(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:s,scrollMargin:r,getItemKey:i,enabled:o,lanes:a,laneAssignmentMode:c},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 v=this._flatMeasurements;if(!v||v.length<b){const w=new Float64Array(b);v&&h>0&&w.set(v.subarray(0,h*2)),v=w,this._flatMeasurements=v}let x;if(h===0)x=s+r;else{const w=h-1;x=v[w*2]+v[w*2+1]+g}for(let w=h;w<n;w++){const k=i(w),T=d.get(k),_=typeof T=="number"?T:this.options.estimateSize(w);v[w*2]=x,v[w*2+1]=_,x+=_+g}const y=B0e(n,v,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),v=this.laneAssignments.get(g);let x,y;const w=c==="estimate"||d.has(b);if(v!==void 0&&this.options.lanes>1){x=v;const C=p[x],S=C!==void 0?m[C]:void 0;y=S?S.end+this.options.gap:s+r}else{const C=this.options.lanes===1?m[g-1]:this.getFurthestMeasurement(m,g);y=C?C.end+this.options.gap:s+r,x=C?C.lane:g%this.options.lanes,this.options.lanes>1&&w&&this.laneAssignments.set(g,x)}const k=d.get(b),T=typeof k=="number"?k:this.options.estimateSize(g),_=y+T;m[g]={index:g,start:y,size:T,end:_,key:b,lane:x},p[x]=g}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=A0(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,r,i)=>this.range=n.length>0&&s>0?Q0e({measurements:n,outerSize:s,scrollOffset:r,lanes:i,flat:i===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=A0(()=>{let n=null,s=null;const r=this.calculateRange();return r&&(n=r.startIndex,s=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,s]},(n,s,r,i,o)=>i===null||o===null?[]:n({startIndex:i,endIndex:o,overscan:s,count:r}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,r=n.getAttribute(s);return r?parseInt(r,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const r=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(r!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,r-i),a=Math.min(this.options.count-1,r+i);return n>=o&&n<=a}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((o,a)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(a))});return}const s=this.indexFromElement(n),r=this.options.getItemKey(s),i=this.elementsCache.get(r);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(r,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,s)=>{var r,i;if(n<0||n>=this.options.count)return;let o,a,c;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)c=this.options.getItemKey(n),a=u[n*2],o=u[n*2+1];else{const m=this.measurementsCache[n];if(!m)return;c=m.key,a=m.start,o=m.size}const d=this.itemSizeCache.get(c)??o,h=s-d;if(h!==0){const m=this.options.anchorTo==="end"&&((r=this.scrollState)==null?void 0:r.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:c,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(c,s),this.itemSizeCacheVersion++,m?this.applyScrollAdjustment(this.getTotalSize()-p):g&&this.applyScrollAdjustment(h),this.notify(!1)}},this.getVirtualItems=A0(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const r=[];for(let i=0,o=n.length;i<o;i++){const a=n[i],c=s[a];r.push(c)}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length===0)return;const r=this._flatMeasurements,i=this.options.lanes===1&&r!=null,o=lK(0,s.length-1,i?a=>r[a*2]:a=>HP(s[a]).start,n);return HP(s[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,s,r=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),o=this.getScrollOffset();s==="auto"&&(s=n>=o+i?"end":"start"),s==="center"?n+=(r-i)/2:s==="end"&&(n-=i);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const r=this.getSize(),i=this.getScrollOffset(),o=this.measurementsCache[n];if(!o)return;if(s==="auto")if(o.end>=i+r-this.options.scrollPaddingEnd)s="end";else if(o.start<=i+this.options.scrollPaddingStart)s="start";else return[i,s];if(s==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),s];const a=s==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,s,o.size),s]},this.scrollToOffset=(n,{align:s="start",behavior:r="auto"}={})=>{const i=this.getOffsetForAlignment(n,s),o=this.now();this.scrollState={index:null,align:s,behavior:r,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:s="auto",behavior:r="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getOffsetForIndex(n,s);if(!i)return;const[o,a]=i,c=this.now();this.scrollState={index:n,align:a,behavior:r,startedAt:c,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:s="auto"}={})=>{const r=this.getScrollOffset()+n,i=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let r;if(s.length===0)r=this.options.paddingStart;else if(this.options.lanes===1){const i=s.length-1,o=this._flatMeasurements;o!=null?r=o[i*2]+o[i*2+1]:r=((n=s[i])==null?void 0:n.end)??0}else{const i=Array(this.options.lanes).fill(null);let o=s.length-1;for(;o>=0&&i.some(a=>a===null);){const a=s[o];i[a.lane]===null&&(i[a.lane]=a.end),o--}r=Math.max(...i.filter(a=>a!==null))}return Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const s=this.getMeasurements();for(const r of s)r&&this.itemSizeCache.has(r.key)&&n.push({index:r.index,key:r.key,start:r.start,size:r.size,end:r.end,lane:r.lane});return n},this._scrollToOffset=(n,{adjustments:s,behavior:r})=>{this._intendedScrollOffset=n+(s??0),this.options.scrollToFn(n,{behavior:r,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){t!==0&&(m5()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,r=s?s[0]:this.scrollState.lastTargetOffset,i=1,o=r!==this.scrollState.lastTargetOffset;if(!o&&$0e(r,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==r&&this._scrollToOffset(r,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const a=this.getSize()||600,c=Math.abs(r-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&c>a;this.scrollState.lastTargetOffset=r,u||(this.scrollState.behavior="auto"),this._scrollToOffset(r,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const lK=(e,t,n,s)=>{for(;e<=t;){const r=(e+t)/2|0,i=n(r);if(i<s)e=r+1;else if(i>s)t=r-1;else return r}return e>0?e-1:0};function Q0e({measurements:e,outerSize:t,scrollOffset:n,lanes:s,flat:r}){const i=e.length-1,o=r?d=>r[d*2]:d=>e[d].start,a=r?d=>r[d*2]+r[d*2+1]:d=>e[d].end;if(e.length<=s)return{startIndex:0,endIndex:i};let c=lK(0,i,o,n),u=c;if(s===1)for(;u<i&&a(u)<n+t;)u++;else if(s>1){const d=Array(s).fill(0);for(;u<i&&d.some(m=>m<n+t);){const m=e[u];d[m.lane]=m.end,u++}const h=Array(s).fill(n+t);for(;c>=0&&h.some(m=>m>=n);){const m=e[c];h[m.lane]=m.start,c--}c=Math.max(0,c-c%s),u=Math.min(i,u+(s-1-u%s))}return{startIndex:c,endIndex:u}}const p5=typeof document<"u"?f.useLayoutEffect:f.useEffect;function J0e({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...s}){const r=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 x=u.options.horizontal?"width":"height";d.container.style[x]=`${h}px`}const m=!!u.options.horizontal,p=d.mode==="transform",g=m?"left":"top",b=u.options.scrollMargin,v=u.getVirtualItems();for(const x of v){const y=x.start-b,w=u.elementsCache.get(x.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={...s,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?$u.flushSync(r):r()),(h=s.onChange)==null||h.call(s,u,d)}},[c]=f.useState(()=>{const u=new X0e(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 c.setOptions(a),p5(()=>c._didMount(),[]),p5(()=>c._willUpdate()),p5(()=>{o(c)}),c}function Z0e(e){return J0e({observeElementRect:q0e,observeElementOffset:W0e,scrollToFn:Y0e,...e})}function cK(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function ege(e){var t;return((t=cK(e))==null?void 0:t.type)==="task_execution"}function Z4(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||ege(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function uK(e){if(!Z4(e))return!1;const t=cK(e.rawOutput),n=e.toolName.toLowerCase(),s=e.args,r=n==="agent"&&e.parentToolCallId===void 0,i=r&&(s==null?void 0:s.run_in_background)===void 0&&(s==null?void 0:s.working_dir)===void 0&&(s==null?void 0:s.name)===void 0&&(typeof(s==null?void 0:s.subagent_type)!="string"||s.subagent_type.toLowerCase()!=="fork"),o=(s==null?void 0:s.run_in_background)===!0&&(n!=="agent"||r);return(t==null?void 0:t.status)==="background"||o||i}const dK=f.createContext({}),UP=dK.Provider;function $c(){return f.useContext(dK)}const tge=["en","zh-CN"],ej={"git.currentBranch":e=>`Current Git branch: ${(e==null?void 0:e.branch)??""}`,"git.detached":"Detached HEAD","git.clean":"Working tree clean","git.operation.merge":"Merging","git.operation.rebase":"Rebasing","git.operation.cherry-pick":"Cherry-picking","git.operation.revert":"Reverting","git.operation.bisect":"Bisecting","git.conflicted":e=>`${(e==null?void 0:e.count)??0} conflicted`,"git.staged":e=>`${(e==null?void 0:e.count)??0} staged`,"git.unstaged":e=>`${(e==null?void 0:e.count)??0} modified`,"git.untracked":e=>`${(e==null?void 0:e.count)??0} untracked`,"git.ahead":e=>`${(e==null?void 0:e.count)??0} ahead`,"git.behind":e=>`${(e==null?void 0:e.count)??0} behind`,"git.stash":e=>`${(e==null?void 0:e.count)??0} stashed`,"gitDiff.title":"Changes","gitDiff.summary":e=>`${(e==null?void 0:e.count)??0} files · +${(e==null?void 0:e.added)??0} −${(e==null?void 0:e.removed)??0}`,"gitDiff.loading":"Loading changes…","gitDiff.empty":"No changes in the working tree","gitDiff.unavailable":"Git is not available for this workspace","gitDiff.error":"Failed to load changes","gitDiff.binary":"Binary","gitDiff.untracked":"Untracked","gitDiff.deleted":"Deleted","gitDiff.noDiff":"No changes to display","gitDiff.fileError":"Failed to load this diff","gitDiff.truncated":"Diff truncated — the file is too large to show in full","gitDiff.hidden":e=>`${(e==null?void 0:e.count)??0} more file(s) not shown`,"gitDiff.expand":e=>`Show changes for ${(e==null?void 0:e.path)??"file"}`,"gitDiff.collapse":e=>`Hide changes for ${(e==null?void 0:e.path)??"file"}`,"worktree.welcomeTitle":"Worktree isolated session","worktree.toggleHint":"Isolated copy · main branch untouched","worktree.welcomeDesc":"Changes happen in an isolated copy","worktree.cancel":"Cancel worktree isolation","gitLog.title":"History","gitLog.subtitle":e=>`${(e==null?void 0:e.count)??0} commits`,"gitLog.loading":"Loading history…","gitLog.empty":"No commits yet","gitLog.unavailable":"Git is not available for this workspace","gitLog.error":"Failed to load history","gitLog.loadMore":"Load more","gitLog.loadingMore":"Loading…","gitLog.files":e=>`${(e==null?void 0:e.count)??0} files · +${(e==null?void 0:e.added)??0} −${(e==null?void 0:e.removed)??0}`,"gitLog.detailError":"Failed to load commit details","gitLog.hidden":e=>`${(e==null?void 0:e.count)??0} more file(s) not shown`,"gitLog.copySha":e=>`Copy commit ${(e==null?void 0:e.sha)??""}`,"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","history.loadingEarlier":"Loading earlier messages…","history.capacityReached":"History display limit reached. Earlier messages remain saved.","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...","editor.newSessionSuggestionTitle":"This looks like a new topic","editor.newSessionSuggestionStart":"Send in new session","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.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.remove":"Remove","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.newWorktreeTask":"New worktree task","sidebar.plugins":"Plugins","sidebar.project":"Project","sidebar.pinnedSessions":"Pinned","sidebar.workspaceSelectLabel":"Workspace","sidebar.details":"Details","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.addWorkspaceDisplayName":"Display name (optional)","sidebar.addWorkspaceDisplayNameHint":"Shown in Web Shell; the directory path remains the workspace identity.","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.addWorkspaceSuggestions":"Directory suggestions","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.goals":"Goals","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.","localCommand.diffNoWorkspace":"No workspace is available yet to show changes for.","localCommand.logNoWorkspace":"No workspace is available yet to show history for.","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.log":"Show commit history for the workspace","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`,"goals.title":"Goals","goals.subtitle":"A goal keeps its session working until the condition is met. Only sessions that are currently loaded appear here — a goal advances only while its session is running.","goals.loading":"Loading goals…","goals.count":e=>`${(e==null?void 0:e.count)??0} active ${Number(e==null?void 0:e.count)===1?"goal":"goals"}`,"goals.empty":"No active goals. Set one with /goal <condition>.","goals.refresh":"Refresh","goals.new":"New goal","goals.newHint":"The goal starts in a new session and runs until its condition holds.","goals.condition":"Condition","goals.conditionPlaceholder":"e.g. all tests pass and the lint is clean","goals.cancel":"Cancel","goals.create":"Set goal","goals.creating":"Starting…","goals.clear":"Clear goal","goals.clearConfirm":e=>`Clear the goal "${(e==null?void 0:e.condition)??""}"?`,"goals.running":"Working","goals.idle":"Waiting","goals.dropped":e=>`${(e==null?void 0:e.count)??0} session${Number(e==null?void 0:e.count)===1?"":"s"} could not be reached — any goals they are running are missing from this list.`,"goals.notYetEvaluated":"not yet evaluated","goals.openSessionHint":"Open this goal's session","goals.error.emptyCondition":"Enter a condition for the goal.","goals.error.clearKeyword":e=>`"${(e==null?void 0:e.word)??""}" clears a goal rather than setting one. Describe the condition to work toward.`,"goals.error.createFailed":"Failed to start the goal","goals.error.clearFailed":"Failed to clear the goal","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.actions":"Skill actions","skills.disable":"Disable","skills.disabled":"Skill disabled.","skills.enable":"Enable","skills.enabled":"Skill enabled.","skills.install.action":"Upload skill","skills.install.description":"Install a skill from GitHub, a local folder, or a ZIP archive.","skills.install.error.authentication":"Authentication is required to upload skills.","skills.install.error.folderRequired":"Enter a folder path.","skills.install.error.githubRequired":"Enter a GitHub SKILL.md URL.","skills.install.error.invalidName":"The skill name is missing or contains unsupported characters.","skills.install.error.manifestMissing":"The package must contain a SKILL.md file at its root.","skills.install.error.invalidPackage":"The skill package is invalid. Check its structure and SKILL.md content.","skills.install.error.zipTooLarge":"The ZIP file must not exceed 6 MB.","skills.install.error.invalidFolder":"Enter a valid local skill folder.","skills.install.error.githubFailed":"Could not download the skill from GitHub. Check the URL or authentication and try again.","skills.install.error.invalidScope":"Choose either the workspace or global install location.","skills.install.error.invalidSource":"The daemon does not recognize this upload source. Restart the updated daemon and try again.","skills.install.error.notFound":"The requested skill was not found.","skills.install.error.nameRequired":"Enter the skill name.","skills.install.error.untrusted":"Trust this workspace before uploading skills.","skills.install.failed":"Failed to upload skill.","skills.install.folder":"Local folder","skills.install.folderPath":"Folder path","skills.install.githubUrl":"SKILL.md URL","skills.install.name":"Skill name","skills.install.scope":"Install to","skills.install.scope.global":"Global","skills.install.scope.workspace":"Workspace","skills.install.selectZip":"Select a ZIP archive.","skills.install.title":"Upload skill","skills.install.succeeded":e=>`Skill “${(e==null?void 0:e.name)??""}” uploaded successfully.`,"skills.install.zipSelected":e=>`Selected: ${(e==null?void 0:e.name)??""}`,"skills.delete.action":"Delete skill","skills.delete.description":e=>`Delete “${(e==null?void 0:e.name)??""}” from disk? This cannot be undone.`,"skills.delete.failed":"Failed to delete skill.","skills.delete.succeeded":e=>`Skill “${(e==null?void 0:e.name)??""}” deleted successfully.`,"skills.delete.title":"Delete skill?","skills.empty":"No skills available.","skills.count":e=>[`${(e==null?void 0:e.count)??0} skills`,...e!=null&&e.enabled?[`${e.enabled} enabled`]:[],...e!=null&&e.disabled?[`${e.disabled} disabled`]:[]].join(", "),"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.status.all":"All","skills.filter.status.disabled":"Disabled","skills.filter.status.enabled":"Enabled","skills.filter.status.label":"Filter skills by status","skills.filter.user":"Global 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":"Global","skills.loading":"Loading skills...","skills.manualReference":"Manual reference","skills.manualReferenceHint":"The model cannot discover this skill automatically. Reference it manually.","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.notToggleable":"This skill cannot be enabled or disabled.","skills.run":"Reference skill","skills.search":"Search skills…","skills.status":"Status","skills.status.disabled":"disabled","skills.status.enabled":"enabled","skills.toggleFailed":"Failed to update skill.","skills.error.inactiveExtension":"This skill belongs to an inactive extension. Enable the extension first.","skills.toggleUnsupported":"The connected daemon does not support skill enable or disable actions.","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:"},nge={...ej,"git.currentBranch":e=>`当前 Git 分支：${(e==null?void 0:e.branch)??""}`,"git.detached":"游离 HEAD","git.clean":"工作区干净","git.operation.merge":"合并中","git.operation.rebase":"变基中","git.operation.cherry-pick":"拣选中","git.operation.revert":"回退中","git.operation.bisect":"二分中","git.conflicted":e=>`${(e==null?void 0:e.count)??0} 个冲突`,"git.staged":e=>`${(e==null?void 0:e.count)??0} 已暂存`,"git.unstaged":e=>`${(e==null?void 0:e.count)??0} 已修改`,"git.untracked":e=>`${(e==null?void 0:e.count)??0} 未跟踪`,"git.ahead":e=>`领先 ${(e==null?void 0:e.count)??0}`,"git.behind":e=>`落后 ${(e==null?void 0:e.count)??0}`,"git.stash":e=>`${(e==null?void 0:e.count)??0} 个 stash`,"gitDiff.title":"变更","gitDiff.summary":e=>`${(e==null?void 0:e.count)??0} 个文件 · +${(e==null?void 0:e.added)??0} −${(e==null?void 0:e.removed)??0}`,"gitDiff.loading":"加载变更中…","gitDiff.empty":"工作区无变更","gitDiff.unavailable":"此工作区无 Git","gitDiff.error":"加载变更失败","gitDiff.binary":"二进制","gitDiff.untracked":"未跟踪","gitDiff.deleted":"已删除","gitDiff.noDiff":"无差异可显示","gitDiff.fileError":"加载此差异失败","gitDiff.truncated":"差异已截断——文件过大，未完整显示","gitDiff.hidden":e=>`还有 ${(e==null?void 0:e.count)??0} 个文件未显示`,"gitDiff.expand":e=>`显示 ${(e==null?void 0:e.path)??"文件"} 的变更`,"gitDiff.collapse":e=>`隐藏 ${(e==null?void 0:e.path)??"文件"} 的变更`,"worktree.welcomeTitle":"Worktree 隔离会话","worktree.toggleHint":"独立副本 · 不影响主分支","worktree.welcomeDesc":"变更在独立副本中进行","worktree.cancel":"取消 Worktree 隔离","gitLog.title":"提交历史","gitLog.subtitle":e=>`${(e==null?void 0:e.count)??0} 条提交`,"gitLog.loading":"加载历史中…","gitLog.empty":"暂无提交","gitLog.unavailable":"此工作区不可用 Git","gitLog.error":"加载历史失败","gitLog.loadMore":"加载更多","gitLog.loadingMore":"加载中…","gitLog.files":e=>`${(e==null?void 0:e.count)??0} 个文件 · +${(e==null?void 0:e.added)??0} −${(e==null?void 0:e.removed)??0}`,"gitLog.detailError":"加载提交详情失败","gitLog.hidden":e=>`还有 ${(e==null?void 0:e.count)??0} 个文件未显示`,"gitLog.copySha":e=>`复制提交 ${(e==null?void 0:e.sha)??""}`,"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":"输入消息或 @ 文件路径","history.loadingEarlier":"正在加载更早消息…","history.capacityReached":"已达到历史显示上限，更早消息仍保存在会话中。","editor.shellPlaceholder":"请输入终端命令","editor.send":"发送消息","editor.connectionDisconnected":"连接已中断，请在恢复后重试。","editor.sessionLoading":"会话正在加载，请稍后再发送。","editor.processing":"处理中。新消息会进入队列。","editor.searchHint":"ctrl+r 下一条 · tab 采纳 · enter 发送 · esc 取消","editor.searchLabel":"历史搜索：","editor.searchPlaceholder":"输入以搜索…","editor.newSessionSuggestionTitle":"这条消息看起来像新话题","editor.newSessionSuggestionStart":"在新会话发送","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.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.remove":"删除","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.newWorktreeTask":"新建 Worktree 任务","sidebar.plugins":"插件","sidebar.project":"项目","sidebar.pinnedSessions":"置顶","sidebar.workspaceSelectLabel":"工作区","sidebar.details":"详情","sidebar.workspaceUntrusted":"未信任","sidebar.workspaceReadOnly":"只读","sidebar.workspaceTrustToOpen":"信任此工作区后才能打开会话。","sidebar.addWorkspace":"添加工作区","sidebar.addWorkspaceTitle":"添加工作区","sidebar.addWorkspacePath":"目录路径","sidebar.addWorkspaceDisplayName":"展示名称（可选）","sidebar.addWorkspaceDisplayNameHint":"用于 Web Shell 展示；目录路径仍是工作区身份。","sidebar.addWorkspaceRegister":"注册","sidebar.addWorkspaceCancel":"取消","sidebar.addWorkspaceError":"添加工作区失败","sidebar.addWorkspacePersistenceError":"守护进程未确认工作区已持久化注册","sidebar.addWorkspaceAbsError":"路径必须是绝对路径","sidebar.addWorkspaceHint":"请输入项目目录的绝对路径。","sidebar.addWorkspaceSuggestions":"目录建议","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.goals":"目标","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":"当前还没有会话。请先发送第一条消息，再使用这个命令。","localCommand.diffNoWorkspace":"当前还没有可用于查看变更的工作区。","localCommand.logNoWorkspace":"当前还没有可用于查看历史的工作区。","local.agents":"管理智能体","local.bug":"提交错误报告","local.compress":"将上下文压缩为摘要","local.compressFast":"无需 AI 的快速上下文压缩","local.config":"通过点分路径键获取或设置配置项","local.diff":"显示工作区相对 HEAD 的改动统计","local.log":"显示工作区的提交历史","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} 轮`,"goals.title":"目标","goals.subtitle":"目标会让所在会话持续工作，直到条件满足。这里只列出当前已加载的会话——目标只在会话运行时才会推进。","goals.loading":"正在加载目标…","goals.count":e=>`${(e==null?void 0:e.count)??0} 个进行中的目标`,"goals.empty":"没有进行中的目标。用 /goal <条件> 设置一个。","goals.refresh":"刷新","goals.new":"新建目标","goals.newHint":"目标会在一个新会话中启动，并持续运行直到条件满足。","goals.condition":"条件","goals.conditionPlaceholder":"例如：所有测试通过且 lint 无告警","goals.cancel":"取消","goals.create":"设置目标","goals.creating":"正在启动…","goals.clear":"清除目标","goals.clearConfirm":e=>`确定清除目标“${(e==null?void 0:e.condition)??""}”？`,"goals.running":"工作中","goals.idle":"等待中","goals.dropped":e=>`有 ${(e==null?void 0:e.count)??0} 个会话无法访问——它们正在运行的目标未显示在此列表中。`,"goals.notYetEvaluated":"尚未判定","goals.openSessionHint":"打开该目标所在的会话","goals.error.emptyCondition":"请输入目标条件。","goals.error.clearKeyword":e=>`“${(e==null?void 0:e.word)??""}”是清除目标的指令，不是一个条件。请描述要达成的条件。`,"goals.error.createFailed":"启动目标失败","goals.error.clearFailed":"清除目标失败","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.actions":"Skill 操作","skills.disable":"禁用","skills.disabled":"Skill 已禁用。","skills.enable":"启用","skills.enabled":"Skill 已启用。","skills.install.action":"上传技能","skills.install.description":"从 GitHub、本地文件夹或 ZIP 压缩包安装技能。","skills.install.error.authentication":"上传技能需要身份认证。","skills.install.error.folderRequired":"请输入文件夹路径。","skills.install.error.githubRequired":"请输入 GitHub SKILL.md 地址。","skills.install.error.invalidName":"技能名称缺失或包含不支持的字符。","skills.install.error.manifestMissing":"技能包根目录中必须包含 SKILL.md 文件。","skills.install.error.invalidPackage":"技能包无效，请检查目录结构和 SKILL.md 内容。","skills.install.error.zipTooLarge":"ZIP 文件不能超过 6 MB。","skills.install.error.invalidFolder":"请输入有效的本地技能文件夹路径。","skills.install.error.githubFailed":"无法从 GitHub 下载技能，请检查地址或认证信息后重试。","skills.install.error.invalidScope":"请选择工作区或全局安装位置。","skills.install.error.invalidSource":"当前 daemon 无法识别这种上传来源，请重启已更新的 daemon 后重试。","skills.install.error.notFound":"未找到指定的技能。","skills.install.error.nameRequired":"请输入技能名称。","skills.install.error.untrusted":"请先信任当前工作区，再上传技能。","skills.install.failed":"上传技能失败。","skills.install.folder":"本地文件夹","skills.install.folderPath":"文件夹路径","skills.install.githubUrl":"SKILL.md 地址","skills.install.name":"技能名称","skills.install.scope":"安装位置","skills.install.scope.global":"全局","skills.install.scope.workspace":"工作区","skills.install.selectZip":"请选择 ZIP 压缩包。","skills.install.title":"上传技能","skills.install.succeeded":e=>`技能“${(e==null?void 0:e.name)??""}”上传成功。`,"skills.install.zipSelected":e=>`已选择：${(e==null?void 0:e.name)??""}`,"skills.delete.action":"删除技能","skills.delete.description":e=>`确定从磁盘删除“${(e==null?void 0:e.name)??""}”吗？此操作无法撤销。`,"skills.delete.failed":"删除技能失败。","skills.delete.succeeded":e=>`技能“${(e==null?void 0:e.name)??""}”删除成功。`,"skills.delete.title":"删除技能？","skills.empty":"没有可用 skill。","skills.count":e=>[`${(e==null?void 0:e.count)??0} 个技能`,...e!=null&&e.enabled?[`已启用 ${e.enabled} 个`]:[],...e!=null&&e.disabled?[`已禁用 ${e.disabled} 个`]:[]].join("，"),"skills.details":"Skill 详情","skills.extension":"所属扩展","skills.filter.all":"全部","skills.filter.bundled":"内置","skills.filter.extension":"扩展","skills.filter.label":"按来源筛选 Skills","skills.filter.project":"工作区设置","skills.filter.status.all":"全部","skills.filter.status.disabled":"已禁用","skills.filter.status.enabled":"已启用","skills.filter.status.label":"按状态筛选技能","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.manualReference":"手动引用","skills.manualReferenceHint":"模型无法自动识别，需手动引用 skill","skills.model":"模型","skills.modelAccess":"模型调用","skills.modelAccess.disabled":"不可由模型调用","skills.modelAccess.enabled":"可由模型调用","skills.modelInvocable":"模型可用","skills.noDescription":"暂无描述","skills.noMatches":"没有匹配的 Skill。","skills.notToggleable":"此 Skill 不支持启用或禁用。","skills.run":"引用 skill","skills.search":"搜索 Skills…","skills.status":"状态","skills.status.disabled":"已禁用","skills.status.enabled":"已启用","skills.toggleFailed":"更新 Skill 失败。","skills.error.inactiveExtension":"该技能所属扩展当前未启用，请先启用对应扩展。","skills.toggleUnsupported":"当前连接的 daemon 不支持启用或禁用 Skill。","skills.title":"Skills","plugins.extensions":"扩展","plugins.agents":"智能体","plugins.mcp":"MCP","plugins.mcpLoadFailed":"MCP 状态加载失败","plugins.sections":"插件分类","plugins.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":"提示："},sge={en:ej,"zh-CN":nge},rge={en:"English [en]","zh-CN":"中文 [zh-CN]"},hK=f.createContext({language:"en",t:e=>e});function Dd(e){const t=e==null?void 0:e.trim().toLowerCase();return t&&(t==="zh"||t==="zh-cn"||t==="zh_cn")?"zh-CN":"en"}function tj(e){if(typeof e!="string")return;const t=e.trim().toLowerCase().replace(/_/g,"-");if(t){if(t==="auto")return Dd(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 nj(e){return rge[e]}function sj(e){const t=sge[e];return(n,s)=>{const r=t[n]??ej[n]??n;return typeof r=="function"?r(s):r}}function ige({language:e,children:t}){const n=f.useMemo(()=>({language:e,t:sj(e)}),[e]);return l.jsx(hK.Provider,{value:n,children:t})}function ot(){return f.useContext(hK)}const fK=f.createContext(null);function oh(){return f.useContext(fK)}const oge="_row_19m4s_1",age="_tip_19m4s_13",lge="_chatRow_19m4s_35",cge="_chatTip_19m4s_43",uge="_chatActions_19m4s_56",dge="_copyButton_19m4s_71",Nh={row:oge,tip:age,chatRow:lge,chatTip:cge,chatActions:uge,copyButton:dge};function J7({timestamp:e,children:t,chatMode:n=!1,copyText:s,copyTitle:r="Copy"}){const[i,o]=f.useState(!1),a=f.useCallback(()=>{var u;s&&((u=navigator.clipboard)==null||u.writeText(s).then(()=>{o(!0),window.setTimeout(()=>o(!1),2e3)}).catch(()=>{}))},[s]);if(e===void 0&&!s)return l.jsx(l.Fragment,{children:t});const c=s?l.jsx("button",{type:"button",className:Nh.copyButton,title:r,"aria-label":r,onClick:a,children:i?l.jsx(fge,{}):l.jsx(hge,{})}):null;return e===void 0?l.jsxs("div",{className:n?Nh.chatRow:Nh.row,children:[t,c]}):l.jsxs("div",{className:n?Nh.chatRow:Nh.row,children:[t,n?l.jsxs("span",{className:Nh.chatActions,children:[l.jsx("span",{className:Nh.chatTip,"aria-hidden":"true",children:s1(e)}),c]}):l.jsx("span",{className:Nh.tip,"aria-hidden":"true",children:s1(e)})]})}function hge(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.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"}),l.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function fge(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function s1(e,t=new Date){const n=new Date(e),s=o=>String(o).padStart(2,"0"),r=`${s(n.getHours())}:${s(n.getMinutes())}:${s(n.getSeconds())}`;return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?r:`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())} ${r}`}const mge="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",pge="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",gge="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",bge="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";function yge(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&(t.label===void 0||typeof t.label=="string")&&(t.value===void 0||typeof t.value=="string")&&(t.removable===void 0||typeof t.removable=="boolean")&&(t.kind===void 0||typeof t.kind=="string")&&(t.icon===void 0||typeof t.icon=="string")&&(t.serialized===void 0||typeof t.serialized=="string")}function xge(e){if(!e||typeof e!="object")return!1;const t=e;return t.type==="text"?typeof t.text=="string":t.type!=="tag"?!1:yge(t.tag)}function rj(e,t,n,s={}){if(!t)return null;try{const r=t(e);return!Array.isArray(r)||r.length===0||!r.every(xge)||s.requireSourcePreservation&&r.map(i=>i.type==="text"?i.text:e3(i.tag)).join("")!==e?null:r}catch(r){return console.warn(n,r),null}}const ij={extension:mge,file:pge,mcp:gge,skill:bge},vge=new Set(Object.values(ij));function Z7(e,t){if(!e||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return typeof n=="string"?n:void 0}function e3(e){var t,n,s;return((t=e.serialized)==null?void 0:t.trim())||((n=e.value)==null?void 0:n.trim())||((s=e.label)==null?void 0:s.trim())||e.id}function t0(e,t){if(e)return Z7(t,e)??Z7(ij,e)}function oj(e){return e!==void 0&&vge.has(e)}function wge(e,t){const n=[];let s=0;for(const r of t){const i=e3(r);if(!i)continue;const o=e.indexOf(i,s);if(o<0)continue;const a=o+i.length;n.push({type:"reference",start:o,end:a,text:i,reference:{id:r.id,...r.kind?{kind:r.kind}:{},...r.label?{label:r.label}:{},...r.value?{value:r.value}:{},...r.serialized?{serialized:r.serialized}:{},...r.removable!==void 0?{removable:r.removable}:{}}}),s=a}return n}function mK(e,t){if(!t||t.length===0)return[{type:"text",text:e}];const n=[];let s=0;for(const r of t){if(r.type!=="reference")continue;const{start:i,end:o,text:a}=r,c=r.reference;!c||typeof c.id!="string"||i<s||o<=i||o>e.length||e.slice(i,o)!==a||(s<i&&n.push({type:"text",text:e.slice(s,i)}),n.push({type:"reference",tag:{id:c.id,...c.kind?{kind:c.kind}:{},...c.label?{label:c.label}:{},...c.value?{value:c.value}:{},serialized:c.serialized??a,...c.removable!==void 0?{removable:c.removable}:{}}}),s=o)}return s<e.length&&n.push({type:"text",text:e.slice(s)}),n.length>0?n:[{type:"text",text:e}]}function kge(e,t){var i,o;const n=((i=e.label)==null?void 0:i.trim())??"",s=((o=e.value)==null?void 0:o.trim())??"";return{tagLabel:(e.kind?Z7(ij,e.kind):void 0)?"":n,tagValue:s,fallback:e.id,iconUrl:t0(e.kind,t)}}const _ge="modulepreload",Sge=function(e){return"/"+e},VP={},ie=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=Promise.allSettled(n.map(c=>{if(c=Sge(c),c in VP)return;VP[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":_ge,u||(h.as="script"),h.crossOrigin="",h.href=c,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 ${c}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return r.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},qr={Dark:"dark",Light:"light"},pK=[qr.Dark,qr.Light],gK=f.createContext(qr.Dark),Cge=gK.Provider;function z1(){return f.useContext(gK)}const lp="ui.theme",sS="general.language";function aj(e,t){return e===qr.Light||e==="Qwen Light"?qr.Light:e===qr.Dark||e==="Qwen Dark"?qr.Dark:t}function bK(e){return e===qr.Light?"Qwen Light":"Qwen Dark"}const yK=f.createContext("interactive");yK.Provider;function lj(){return f.useContext(yK)}function WP(e){const t=[],n=String(e||"");let s=n.indexOf(","),r=0,i=!1;for(;!i;){s===-1&&(s=n.length,i=!0);const o=n.slice(r,s).trim();(o||!i)&&t.push(o),r=s+1,s=n.indexOf(",",r)}return t}function xK(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Tge=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ege=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Age={};function GP(e,t){return(Age.jsx?Ege:Tge).test(e)}const Nge=/[ \t\n\f\r]/g;function t3(e){return typeof e=="object"?e.type==="text"?KP(e.value):!1:KP(e)}function KP(e){return e.replace(Nge,"")===""}class Mv{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Mv.prototype.normal={};Mv.prototype.property={};Mv.prototype.space=void 0;function vK(e,t){const n={},s={};for(const r of e)Object.assign(n,r.property),Object.assign(s,r.normal);return new Mv(n,s,t)}function Nx(e){return e.toLowerCase()}class al{constructor(t,n){this.attribute=n,this.property=t}}al.prototype.attribute="";al.prototype.booleanish=!1;al.prototype.boolean=!1;al.prototype.commaOrSpaceSeparated=!1;al.prototype.commaSeparated=!1;al.prototype.defined=!1;al.prototype.mustUseProperty=!1;al.prototype.number=!1;al.prototype.overloadedBoolean=!1;al.prototype.property="";al.prototype.spaceSeparated=!1;al.prototype.space=void 0;let jge=0;const ts=n0(),Oi=n0(),eE=n0(),St=n0(),jr=n0(),kp=n0(),ml=n0();function n0(){return 2**++jge}const tE=Object.freeze(Object.defineProperty({__proto__:null,boolean:ts,booleanish:Oi,commaOrSpaceSeparated:ml,commaSeparated:kp,number:St,overloadedBoolean:eE,spaceSeparated:jr},Symbol.toStringTag,{value:"Module"})),g5=Object.keys(tE);class cj extends al{constructor(t,n,s,r){let i=-1;if(super(t,n),YP(this,"space",r),typeof s=="number")for(;++i<g5.length;){const o=g5[i];YP(this,g5[i],(s&tE[o])===tE[o])}}}cj.prototype.defined=!0;function YP(e,t,n){n&&(e[t]=n)}function F1(e){const t={},n={};for(const[s,r]of Object.entries(e.properties)){const i=new cj(s,e.transform(e.attributes||{},s),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,n[Nx(s)]=s,n[Nx(i.attribute)]=s}return new Mv(t,n,e.space)}const wK=F1({properties:{ariaActiveDescendant:null,ariaAtomic:Oi,ariaAutoComplete:null,ariaBusy:Oi,ariaChecked:Oi,ariaColCount:St,ariaColIndex:St,ariaColSpan:St,ariaControls:jr,ariaCurrent:null,ariaDescribedBy:jr,ariaDetails:null,ariaDisabled:Oi,ariaDropEffect:jr,ariaErrorMessage:null,ariaExpanded:Oi,ariaFlowTo:jr,ariaGrabbed:Oi,ariaHasPopup:null,ariaHidden:Oi,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:jr,ariaLevel:St,ariaLive:null,ariaModal:Oi,ariaMultiLine:Oi,ariaMultiSelectable:Oi,ariaOrientation:null,ariaOwns:jr,ariaPlaceholder:null,ariaPosInSet:St,ariaPressed:Oi,ariaReadOnly:Oi,ariaRelevant:null,ariaRequired:Oi,ariaRoleDescription:jr,ariaRowCount:St,ariaRowIndex:St,ariaRowSpan:St,ariaSelected:Oi,ariaSetSize:St,ariaSort:null,ariaValueMax:St,ariaValueMin:St,ariaValueNow:St,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function kK(e,t){return t in e?e[t]:t}function _K(e,t){return kK(e,t.toLowerCase())}const Mge=F1({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:kp,acceptCharset:jr,accessKey:jr,action:null,allow:null,allowFullScreen:ts,allowPaymentRequest:ts,allowUserMedia:ts,alpha:ts,alt:null,as:null,async:ts,autoCapitalize:null,autoComplete:jr,autoFocus:ts,autoPlay:ts,blocking:jr,capture:null,charSet:null,checked:ts,cite:null,className:jr,closedBy:null,colorSpace:null,cols:St,colSpan:St,command:null,commandFor:null,content:null,contentEditable:Oi,controls:ts,controlsList:jr,coords:St|kp,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ts,defer:ts,dir:null,dirName:null,disabled:ts,download:eE,draggable:Oi,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ts,formTarget:null,headers:jr,height:St,hidden:eE,high:St,href:null,hrefLang:null,htmlFor:jr,httpEquiv:jr,id:null,imageSizes:null,imageSrcSet:null,inert:ts,inputMode:null,integrity:null,is:null,isMap:ts,itemId:null,itemProp:jr,itemRef:jr,itemScope:ts,itemType:jr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ts,low:St,manifest:null,max:null,maxLength:St,media:null,method:null,min:null,minLength:St,multiple:ts,muted:ts,name:null,nonce:null,noModule:ts,noValidate:ts,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:ts,optimum:St,pattern:null,ping:jr,placeholder:null,playsInline:ts,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ts,referrerPolicy:null,rel:jr,required:ts,reversed:ts,rows:St,rowSpan:St,sandbox:jr,scope:null,scoped:ts,seamless:ts,selected:ts,shadowRootClonable:ts,shadowRootCustomElementRegistry:ts,shadowRootDelegatesFocus:ts,shadowRootMode:null,shadowRootSerializable:ts,shape:null,size:St,sizes:null,slot:null,span:St,spellCheck:Oi,src:null,srcDoc:null,srcLang:null,srcSet:null,start:St,step:null,style:null,tabIndex:St,target:null,title:null,translate:null,type:null,typeMustMatch:ts,useMap:null,value:Oi,width:St,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:jr,axis:null,background:null,bgColor:null,border:St,borderColor:null,bottomMargin:St,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ts,declare:ts,event:null,face:null,frame:null,frameBorder:null,hSpace:St,leftMargin:St,link:null,longDesc:null,lowSrc:null,marginHeight:St,marginWidth:St,noResize:ts,noHref:ts,noShade:ts,noWrap:ts,object:null,profile:null,prompt:null,rev:null,rightMargin:St,rules:null,scheme:null,scrolling:Oi,standby:null,summary:null,text:null,topMargin:St,valueType:null,version:null,vAlign:null,vLink:null,vSpace:St,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:ts,disablePictureInPicture:ts,disableRemotePlayback:ts,exportParts:kp,part:jr,prefix:null,property:null,results:St,security:null,unselectable:null},space:"html",transform:_K}),Ige=F1({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:ml,accentHeight:St,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:St,amplitude:St,arabicForm:null,ascent:St,attributeName:null,attributeType:null,azimuth:St,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:St,by:null,calcMode:null,capHeight:St,className:jr,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:St,diffuseConstant:St,direction:null,display:null,dur:null,divisor:St,dominantBaseline:null,download:ts,dx:null,dy:null,edgeMode:null,editable:null,elevation:St,enableBackground:null,end:null,event:null,exponent:St,externalResourcesRequired:null,fill:null,fillOpacity:St,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:kp,g2:kp,glyphName:kp,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:St,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:St,horizOriginX:St,horizOriginY:St,id:null,ideographic:St,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:St,k:St,k1:St,k2:St,k3:St,k4:St,kernelMatrix:ml,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:St,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:St,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:St,overlineThickness:St,paintOrder:null,panose1:null,path:null,pathLength:St,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:jr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:St,pointsAtY:St,pointsAtZ:St,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ml,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ml,rev:ml,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ml,requiredFeatures:ml,requiredFonts:ml,requiredFormats:ml,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:St,specularExponent:St,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:St,strikethroughThickness:St,string:null,stroke:null,strokeDashArray:ml,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:St,strokeOpacity:St,strokeWidth:null,style:null,surfaceScale:St,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ml,tabIndex:St,tableValues:null,target:null,targetX:St,targetY:St,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ml,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:St,underlineThickness:St,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:St,values:null,vAlphabetic:St,vMathematical:St,vectorEffect:null,vHanging:St,vIdeographic:St,version:null,vertAdvY:St,vertOriginX:St,vertOriginY:St,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:St,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:kK}),SK=F1({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()}}),CK=F1({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:_K}),TK=F1({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Rge={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"},Dge=/[A-Z]/g,XP=/-[a-z]/g,Lge=/^data[-\w.:]+$/i;function uj(e,t){const n=Nx(t);let s=t,r=al;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Lge.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(XP,Oge);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!XP.test(i)){let o=i.replace(Dge,Pge);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}r=cj}return new r(s,t)}function Pge(e){return"-"+e.toLowerCase()}function Oge(e){return e.charAt(1).toUpperCase()}const dj=vK([wK,Mge,SK,CK,TK],"html"),H1=vK([wK,Ige,SK,CK,TK],"svg");function QP(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function EK(e){return e.join(" ").trim()}var hj={},JP=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Bge=/\n/g,$ge=/^\s*/,zge=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Fge=/^:\s*/,Hge=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,qge=/^[;\s]*/,Uge=/^\s+|\s+$/g,Vge=`
`,ZP="/",eO="*",Zm="",Wge="comment",Gge="declaration";function Kge(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,s=1;function r(g){var b=g.match(Bge);b&&(n+=b.length);var v=g.lastIndexOf(Vge);s=~v?g.length-v:s+g.length}function i(){var g={line:n,column:s};return function(b){return b.position=new o(g),u(),b}}function o(g){this.start=g,this.end={line:n,column:s},this.source=t.source}o.prototype.content=e;function a(g){var b=new Error(t.source+":"+n+":"+s+": "+g);if(b.reason=g,b.filename=t.source,b.line=n,b.column=s,b.source=e,!t.silent)throw b}function c(g){var b=g.exec(e);if(b){var v=b[0];return r(v),e=e.slice(v.length),b}}function u(){c($ge)}function d(g){var b;for(g=g||[];b=h();)b!==!1&&g.push(b);return g}function h(){var g=i();if(!(ZP!=e.charAt(0)||eO!=e.charAt(1))){for(var b=2;Zm!=e.charAt(b)&&(eO!=e.charAt(b)||ZP!=e.charAt(b+1));)++b;if(b+=2,Zm===e.charAt(b-1))return a("End of comment missing");var v=e.slice(2,b-2);return s+=2,r(v),e=e.slice(b),s+=2,g({type:Wge,comment:v})}}function m(){var g=i(),b=c(zge);if(b){if(h(),!c(Fge))return a("property missing ':'");var v=c(Hge),x=g({type:Gge,property:tO(b[0].replace(JP,Zm)),value:v?tO(v[0].replace(JP,Zm)):Zm});return c(qge),x}}function p(){var g=[];d(g);for(var b;b=m();)b!==!1&&(g.push(b),d(g));return g}return u(),p()}function tO(e){return e?e.replace(Uge,Zm):Zm}var Yge=Kge,Xge=x2&&x2.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(hj,"__esModule",{value:!0});hj.default=Jge;const Qge=Xge(Yge);function Jge(e,t){let n=null;if(!e||typeof e!="string")return n;const s=(0,Qge.default)(e),r=typeof t=="function";return s.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:a}=i;r?t(o,a,i):a&&(n=n||{},n[o]=a)}),n}var n3={};Object.defineProperty(n3,"__esModule",{value:!0});n3.camelCase=void 0;var Zge=/^--[a-zA-Z0-9_-]+$/,e1e=/-([a-z])/g,t1e=/^[^-]+$/,n1e=/^-(webkit|moz|ms|o|khtml)-/,s1e=/^-(ms)-/,r1e=function(e){return!e||t1e.test(e)||Zge.test(e)},i1e=function(e,t){return t.toUpperCase()},nO=function(e,t){return"".concat(t,"-")},o1e=function(e,t){return t===void 0&&(t={}),r1e(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(s1e,nO):e=e.replace(n1e,nO),e.replace(e1e,i1e))};n3.camelCase=o1e;var a1e=x2&&x2.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},l1e=a1e(hj),c1e=n3;function nE(e,t){var n={};return!e||typeof e!="string"||(0,l1e.default)(e,function(s,r){s&&r&&(n[(0,c1e.camelCase)(s,t)]=r)}),n}nE.default=nE;var u1e=nE;const d1e=C4(u1e),AK=NK("end"),fj=NK("start");function NK(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function h1e(e){const t=fj(e),n=AK(e);if(t&&n)return{start:t,end:n}}function Xy(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?sO(e.position):"start"in e||"end"in e?sO(e):"line"in e||"column"in e?sE(e):""}function sE(e){return rO(e&&e.line)+":"+rO(e&&e.column)}function sO(e){return sE(e&&e.start)+"-"+sE(e&&e.end)}function rO(e){return e&&typeof e=="number"?e:1}class ia extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let r="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?r=t:!i.cause&&t&&(o=!0,r=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof s=="string"){const c=s.indexOf(":");c===-1?i.ruleId=s:(i.source=s.slice(0,c),i.ruleId=s.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=a?a.line:void 0,this.name=Xy(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}}ia.prototype.file="";ia.prototype.name="";ia.prototype.reason="";ia.prototype.message="";ia.prototype.stack="";ia.prototype.column=void 0;ia.prototype.line=void 0;ia.prototype.ancestors=void 0;ia.prototype.cause=void 0;ia.prototype.fatal=void 0;ia.prototype.place=void 0;ia.prototype.ruleId=void 0;ia.prototype.source=void 0;const mj={}.hasOwnProperty,f1e=new Map,m1e=/[A-Z]/g,p1e=new Set(["table","tbody","thead","tfoot","tr"]),g1e=new Set(["td","th"]),jK="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function b1e(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=C1e(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=S1e(n,t.jsx,t.jsxs)}const r={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?H1:dj,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=MK(r,e,void 0);return i&&typeof i!="string"?i:r.create(e,r.Fragment,{children:i||void 0},void 0)}function MK(e,t,n){if(t.type==="element")return y1e(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return x1e(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return w1e(e,t,n);if(t.type==="mdxjsEsm")return v1e(e,t);if(t.type==="root")return k1e(e,t,n);if(t.type==="text")return _1e(e,t)}function y1e(e,t,n){const s=e.schema;let r=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(r=H1,e.schema=r),e.ancestors.push(t);const i=RK(e,t.tagName,!1),o=T1e(e,t);let a=gj(e,t);return p1e.has(t.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!t3(c):!0})),IK(e,o,i,t),pj(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function x1e(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}jx(e,t.position)}function v1e(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);jx(e,t.position)}function w1e(e,t,n){const s=e.schema;let r=s;t.name==="svg"&&s.space==="html"&&(r=H1,e.schema=r),e.ancestors.push(t);const i=t.name===null?e.Fragment:RK(e,t.name,!0),o=E1e(e,t),a=gj(e,t);return IK(e,o,i,t),pj(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function k1e(e,t,n){const s={};return pj(s,gj(e,t)),e.create(t,e.Fragment,s,n)}function _1e(e,t){return t.value}function IK(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function pj(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function S1e(e,t,n){return s;function s(r,i,o,a){const u=Array.isArray(o.children)?n:t;return a?u(i,o,a):u(i,o)}}function C1e(e,t){return n;function n(s,r,i,o){const a=Array.isArray(i.children),c=fj(s);return t(r,i,o,a,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function T1e(e,t){const n={};let s,r;for(r in t.properties)if(r!=="children"&&mj.call(t.properties,r)){const i=A1e(e,r,t.properties[r]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&g1e.has(t.tagName)?s=a:n[o]=a}}if(s){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function E1e(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const i=s.data.estree.body[0];i.type;const o=i.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else jx(e,t.position);else{const r=s.name;let i;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const a=s.value.data.estree.body[0];a.type,i=e.evaluater.evaluateExpression(a.expression)}else jx(e,t.position);else i=s.value===null?!0:s.value;n[r]=i}return n}function gj(e,t){const n=[];let s=-1;const r=e.passKeys?new Map:f1e;for(;++s<t.children.length;){const i=t.children[s];let o;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=r.get(c)||0;o=c+"-"+u,r.set(c,u+1)}}const a=MK(e,i,o);a!==void 0&&n.push(a)}return n}function A1e(e,t,n){const s=uj(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?xK(n):EK(n)),s.property==="style"){let r=typeof n=="object"?n:N1e(e,String(n));return e.stylePropertyNameCase==="css"&&(r=j1e(r)),["style",r]}return[e.elementAttributeNameCase==="react"&&s.space?Rge[s.property]||s.property:s.attribute,n]}}function N1e(e,t){try{return d1e(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,r=new ia("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=jK+"#cannot-parse-style-attribute",r}}function RK(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const r=t.split(".");let i=-1,o;for(;++i<r.length;){const a=GP(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}s=o}else s=GP(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const r=s.value;return mj.call(e.components,r)?e.components[r]:r}if(e.evaluater)return e.evaluater.evaluateExpression(s);jx(e)}function jx(e,t){const n=new ia("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=jK+"#cannot-handle-mdx-estrees-without-createevaluater",n}function j1e(e){const t={};let n;for(n in e)mj.call(e,n)&&(t[M1e(n)]=e[n]);return t}function M1e(e){let t=e.replace(m1e,I1e);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function I1e(e){return"-"+e.toLowerCase()}const b5={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"]},R1e={};function bj(e,t){const n=R1e,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,r=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return DK(e,s,r)}function DK(e,t,n){if(D1e(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 iO(e.children,t,n)}return Array.isArray(e)?iO(e,t,n):""}function iO(e,t,n){const s=[];let r=-1;for(;++r<e.length;)s[r]=DK(e[r],t,n);return s.join("")}function D1e(e){return!!(e&&typeof e=="object")}const oO=document.createElement("i");function yj(e){const t="&"+e+";";oO.innerHTML=t;const n=oO.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function El(e,t,n,s){const r=e.length;let i=0,o;if(t<0?t=-t>r?0:r+t:t=t>r?r:t,n=n>0?n:0,s.length<1e4)o=Array.from(s),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<s.length;)o=s.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function nc(e,t){return e.length>0?(El(e,e.length,0,t),e):t}const aO={}.hasOwnProperty;function LK(e){const t={};let n=-1;for(;++n<e.length;)L1e(t,e[n]);return t}function L1e(e,t){let n;for(n in t){const r=(aO.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){aO.call(r,o)||(r[o]=[]);const a=i[o];P1e(r[o],Array.isArray(a)?a:a?[a]:[])}}}function P1e(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);El(e,0,0,s)}function PK(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 Dc(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ca=im(/[A-Za-z]/),ta=im(/[\dA-Za-z]/),O1e=im(/[#-'*+\--9=?A-Z^-~]/);function rS(e){return e!==null&&(e<32||e===127)}const rE=im(/\d/),B1e=im(/[\dA-Fa-f]/),$1e=im(/[!-/:-@[-`{-~]/);function En(e){return e!==null&&e<-2}function Lr(e){return e!==null&&(e<0||e===32)}function Ds(e){return e===-2||e===-1||e===32}const s3=im(new RegExp("\\p{P}|\\p{S}","u")),Rp=im(/\s/);function im(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function q1(e){const t=[];let n=-1,s=0,r=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&ta(e.charCodeAt(n+1))&&ta(e.charCodeAt(n+2)))r=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(o=String.fromCharCode(i,a),r=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(s,n),encodeURIComponent(o)),s=n+r+1,o=""),r&&(n+=r,r=0)}return t.join("")+e.slice(s)}function Ns(e,t,n,s){const r=s?s-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return Ds(c)?(e.enter(n),a(c)):t(c)}function a(c){return Ds(c)&&i++<r?(e.consume(c),a):(e.exit(n),t(c))}}const z1e={tokenize:F1e};function F1e(e){const t=e.attempt(this.parser.constructs.contentInitial,s,r);let n;return t;function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Ns(e,t,"linePrefix")}function r(a){return e.enter("paragraph"),i(a)}function i(a){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return En(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const H1e={tokenize:q1e},lO={tokenize:U1e};function q1e(e){const t=this,n=[];let s=0,r,i,o;return a;function a(w){if(s<n.length){const k=n[s];return t.containerState=k[1],e.attempt(k[0].continuation,c,u)(w)}return u(w)}function c(w){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&y();const k=t.events.length;let T=k,_;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){_=t.events[T][1].end;break}x(s);let C=k;for(;C<t.events.length;)t.events[C][1].end={..._},C++;return El(t.events,T+1,0,t.events.slice(k)),t.events.length=C,u(w)}return a(w)}function u(w){if(s===n.length){if(!r)return m(w);if(r.currentConstruct&&r.currentConstruct.concrete)return g(w);t.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(lO,d,h)(w)}function d(w){return r&&y(),x(s),m(w)}function h(w){return t.parser.lazy[t.now().line]=s!==n.length,o=t.now().offset,g(w)}function m(w){return t.containerState={},e.attempt(lO,p,g)(w)}function p(w){return s++,n.push([t.currentConstruct,t.containerState]),m(w)}function g(w){if(w===null){r&&y(),x(0),e.consume(w);return}return r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:i}),b(w)}function b(w){if(w===null){v(e.exit("chunkFlow"),!0),x(0),e.consume(w);return}return En(w)?(e.consume(w),v(e.exit("chunkFlow")),s=0,t.interrupt=void 0,a):(e.consume(w),b)}function v(w,k){const T=t.sliceStream(w);if(k&&T.push(null),w.previous=i,i&&(i.next=w),i=w,r.defineSkip(w.start),r.write(T),t.parser.lazy[w.start.line]){let _=r.events.length;for(;_--;)if(r.events[_][1].start.offset<o&&(!r.events[_][1].end||r.events[_][1].end.offset>o))return;const C=t.events.length;let S=C,L,N;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){if(L){N=t.events[S][1].end;break}L=!0}for(x(s),_=C;_<t.events.length;)t.events[_][1].end={...N},_++;El(t.events,S+1,0,t.events.slice(C)),t.events.length=_}}function x(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(){r.write([null]),i=void 0,r=void 0,t.containerState._closeFlow=void 0}}function U1e(e,t,n){return Ns(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function r1(e){if(e===null||Lr(e)||Rp(e))return 1;if(s3(e))return 2}function r3(e,t,n){const s=[];let r=-1;for(;++r<e.length;){const i=e[r].resolveAll;i&&!s.includes(i)&&(t=i(t,n),s.push(i))}return t}const iE={name:"attention",resolveAll:V1e,tokenize:W1e};function V1e(e,t){let n=-1,s,r,i,o,a,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[s][1].end},m={...e[n][1].start};cO(h,-c),cO(m,c),o={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...e[s][1].end}},a={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},i={type:c>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},r={type:c>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[s][1].end={...o.start},e[n][1].start={...a.end},u=[],e[s][1].end.offset-e[s][1].start.offset&&(u=nc(u,[["enter",e[s][1],t],["exit",e[s][1],t]])),u=nc(u,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=nc(u,r3(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),u=nc(u,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",r,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=nc(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,El(e,s-1,n-s+3,u),n=s+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function W1e(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,r=r1(s);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),a(c)}function a(c){if(c===i)return e.consume(c),a;const u=e.exit("attentionSequence"),d=r1(c),h=!d||d===2&&r||n.includes(c),m=!r||r===2&&d||n.includes(s);return u._open=!!(i===42?h:h&&(r||!m)),u._close=!!(i===42?m:m&&(d||!h)),t(c)}}function cO(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const G1e={name:"autolink",tokenize:K1e};function K1e(e,t,n){let s=0;return r;function r(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return Ca(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||ta(p)?(s=1,a(p)):u(p)}function a(p){return p===58?(e.consume(p),s=0,c):(p===43||p===45||p===46||ta(p))&&s++<32?(e.consume(p),a):(s=0,u(p))}function c(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||rS(p)?n(p):(e.consume(p),c)}function u(p){return p===64?(e.consume(p),d):O1e(p)?(e.consume(p),u):n(p)}function d(p){return ta(p)?h(p):n(p)}function h(p){return p===46?(e.consume(p),s=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||ta(p))&&s++<63){const g=p===45?m:h;return e.consume(p),g}return n(p)}}const Iv={partial:!0,tokenize:Y1e};function Y1e(e,t,n){return s;function s(i){return Ds(i)?Ns(e,r,"linePrefix")(i):r(i)}function r(i){return i===null||En(i)?t(i):n(i)}}const OK={continuation:{tokenize:Q1e},exit:J1e,name:"blockQuote",tokenize:X1e};function X1e(e,t,n){const s=this;return r;function r(o){if(o===62){const a=s.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return Ds(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Q1e(e,t,n){const s=this;return r;function r(o){return Ds(o)?Ns(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(OK,t,n)(o)}}function J1e(e){e.exit("blockQuote")}const BK={name:"characterEscape",tokenize:Z1e};function Z1e(e,t,n){return s;function s(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),r}function r(i){return $1e(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const $K={name:"characterReference",tokenize:ebe};function ebe(e,t,n){const s=this;let r=0,i,o;return a;function a(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),c}function c(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=ta,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=B1e,d):(e.enter("characterReferenceValue"),i=7,o=rE,d(h))}function d(h){if(h===59&&r){const m=e.exit("characterReferenceValue");return o===ta&&!yj(s.sliceSerialize(m))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(h)&&r++<i?(e.consume(h),d):n(h)}}const uO={partial:!0,tokenize:nbe},dO={concrete:!0,name:"codeFenced",tokenize:tbe};function tbe(e,t,n){const s=this,r={partial:!0,tokenize:T};let i=0,o=0,a;return c;function c(_){return u(_)}function u(_){const C=s.events[s.events.length-1];return i=C&&C[1].type==="linePrefix"?C[2].sliceSerialize(C[1],!0).length:0,a=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(_)}function d(_){return _===a?(o++,e.consume(_),d):o<3?n(_):(e.exit("codeFencedFenceSequence"),Ds(_)?Ns(e,h,"whitespace")(_):h(_))}function h(_){return _===null||En(_)?(e.exit("codeFencedFence"),s.interrupt?t(_):e.check(uO,b,k)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(_))}function m(_){return _===null||En(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(_)):Ds(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ns(e,p,"whitespace")(_)):_===96&&_===a?n(_):(e.consume(_),m)}function p(_){return _===null||En(_)?h(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(_))}function g(_){return _===null||En(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(_)):_===96&&_===a?n(_):(e.consume(_),g)}function b(_){return e.attempt(r,k,v)(_)}function v(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),x}function x(_){return i>0&&Ds(_)?Ns(e,y,"linePrefix",i+1)(_):y(_)}function y(_){return _===null||En(_)?e.check(uO,b,k)(_):(e.enter("codeFlowValue"),w(_))}function w(_){return _===null||En(_)?(e.exit("codeFlowValue"),y(_)):(e.consume(_),w)}function k(_){return e.exit("codeFenced"),t(_)}function T(_,C,S){let L=0;return N;function N(O){return _.enter("lineEnding"),_.consume(O),_.exit("lineEnding"),$}function $(O){return _.enter("codeFencedFence"),Ds(O)?Ns(_,M,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):M(O)}function M(O){return O===a?(_.enter("codeFencedFenceSequence"),P(O)):S(O)}function P(O){return O===a?(L++,_.consume(O),P):L>=o?(_.exit("codeFencedFenceSequence"),Ds(O)?Ns(_,E,"whitespace")(O):E(O)):S(O)}function E(O){return O===null||En(O)?(_.exit("codeFencedFence"),C(O)):S(O)}}}function nbe(e,t,n){const s=this;return r;function r(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}const y5={name:"codeIndented",tokenize:rbe},sbe={partial:!0,tokenize:ibe};function rbe(e,t,n){const s=this;return r;function r(u){return e.enter("codeIndented"),Ns(e,i,"linePrefix",5)(u)}function i(u){const d=s.events[s.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?c(u):En(u)?e.attempt(sbe,o,c)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||En(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),a)}function c(u){return e.exit("codeIndented"),t(u)}}function ibe(e,t,n){const s=this;return r;function r(o){return s.parser.lazy[s.now().line]?n(o):En(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r):Ns(e,i,"linePrefix",5)(o)}function i(o){const a=s.events[s.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):En(o)?r(o):n(o)}}const obe={name:"codeText",previous:lbe,resolve:abe,tokenize:cbe};function abe(e){let t=e.length-4,n=3,s,r;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)r===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(r=s):(s===t||e[s][1].type==="lineEnding")&&(e[r][1].type="codeTextData",s!==r+2&&(e[r][1].end=e[s-1][1].end,e.splice(r+2,s-r-2),t-=s-r-2,s=r+2),r=void 0);return e}function lbe(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function cbe(e,t,n){let s=0,r,i;return o;function o(h){return e.enter("codeText"),e.enter("codeTextSequence"),a(h)}function a(h){return h===96?(e.consume(h),s++,a):(e.exit("codeTextSequence"),c(h))}function c(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),c):h===96?(i=e.enter("codeTextSequence"),r=0,d(h)):En(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||En(h)?(e.exit("codeTextData"),c(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),r++,d):r===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}class ube{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const r=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return s&&Gb(this.left,s),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Gb(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Gb(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);Gb(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Gb(this.left,n.reverse())}}}function Gb(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 zK(e){const t={};let n=-1,s,r,i,o,a,c,u;const d=new ube(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(s=d.get(n),n&&s[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=s[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,dbe(d,n)),n=t[n],u=!0);else if(s[1]._container){for(i=n,r=void 0;i--;)if(o=d.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(r&&(d.get(r)[1].type="lineEndingBlank"),o[1].type="lineEnding",r=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;r&&(s[1].end={...d.get(r)[1].start},a=d.slice(r,n),a.unshift(s),d.splice(r,n-r+1,a))}}return El(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function dbe(e,t){const n=e.get(t)[1],s=e.get(t)[2];let r=t-1;const i=[];let o=n._tokenizer;o||(o=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,c=[],u={};let d,h,m=-1,p=n,g=0,b=0;const v=[b];for(;p;){for(;e.get(++r)[1]!==p;);i.push(r),p._tokenizer||(d=s.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,v.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):v.pop(),m=v.length;m--;){const x=a.slice(v[m],v[m+1]),y=i.pop();c.push([y,y+x.length-1]),e.splice(y,2,x)}for(c.reverse(),m=-1;++m<c.length;)u[g+c[m][0]]=g+c[m][1],g+=c[m][1]-c[m][0]-1;return u}const hbe={resolve:mbe,tokenize:pbe},fbe={partial:!0,tokenize:gbe};function mbe(e){return zK(e),e}function pbe(e,t){let n;return s;function s(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(a)}function r(a){return a===null?i(a):En(a)?e.check(fbe,o,i)(a):(e.consume(a),r)}function i(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}function gbe(e,t,n){const s=this;return r;function r(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ns(e,i,"linePrefix")}function i(o){if(o===null||En(o))return n(o);const a=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(s.parser.constructs.flow,n,t)(o)}}function FK(e,t,n,s,r,i,o,a,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return h;function h(x){return x===60?(e.enter(s),e.enter(r),e.enter(i),e.consume(x),e.exit(i),m):x===null||x===32||x===41||rS(x)?n(x):(e.enter(s),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),b(x))}function m(x){return x===62?(e.enter(i),e.consume(x),e.exit(i),e.exit(r),e.exit(s),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===62?(e.exit("chunkString"),e.exit(a),m(x)):x===null||x===60||En(x)?n(x):(e.consume(x),x===92?g:p)}function g(x){return x===60||x===62||x===92?(e.consume(x),p):p(x)}function b(x){return!d&&(x===null||x===41||Lr(x))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(s),t(x)):d<u&&x===40?(e.consume(x),d++,b):x===41?(e.consume(x),d--,b):x===null||x===32||x===40||rS(x)?n(x):(e.consume(x),x===92?v:b)}function v(x){return x===40||x===41||x===92?(e.consume(x),b):b(x)}}function HK(e,t,n,s,r,i){const o=this;let a=0,c;return u;function u(p){return e.enter(s),e.enter(r),e.consume(p),e.exit(r),e.enter(i),d}function d(p){return a>999||p===null||p===91||p===93&&!c||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(i),e.enter(r),e.consume(p),e.exit(r),e.exit(s),t):En(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||En(p)||a++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!Ds(p)),p===92?m:h)}function m(p){return p===91||p===92||p===93?(e.consume(p),a++,h):h(p)}}function qK(e,t,n,s,r,i){let o;return a;function a(m){return m===34||m===39||m===40?(e.enter(s),e.enter(r),e.consume(m),e.exit(r),o=m===40?41:m,c):n(m)}function c(m){return m===o?(e.enter(r),e.consume(m),e.exit(r),e.exit(s),t):(e.enter(i),u(m))}function u(m){return m===o?(e.exit(i),c(o)):m===null?n(m):En(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Ns(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===o||m===null||En(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 Qy(e,t){let n;return s;function s(r){return En(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),n=!0,s):Ds(r)?Ns(e,s,n?"linePrefix":"lineSuffix")(r):t(r)}}const bbe={name:"definition",tokenize:xbe},ybe={partial:!0,tokenize:vbe};function xbe(e,t,n){const s=this;let r;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return HK.call(s,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return r=Dc(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return Lr(p)?Qy(e,u)(p):u(p)}function u(p){return FK(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(ybe,h,h)(p)}function h(p){return Ds(p)?Ns(e,m,"whitespace")(p):m(p)}function m(p){return p===null||En(p)?(e.exit("definition"),s.parser.defined.push(r),t(p)):n(p)}}function vbe(e,t,n){return s;function s(a){return Lr(a)?Qy(e,r)(a):n(a)}function r(a){return qK(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return Ds(a)?Ns(e,o,"whitespace")(a):o(a)}function o(a){return a===null||En(a)?t(a):n(a)}}const wbe={name:"hardBreakEscape",tokenize:kbe};function kbe(e,t,n){return s;function s(i){return e.enter("hardBreakEscape"),e.consume(i),r}function r(i){return En(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const _be={name:"headingAtx",resolve:Sbe,tokenize:Cbe};function Sbe(e,t){let n=e.length-2,s=3,r,i;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(r={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},i={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},El(e,s,n-s+1,[["enter",r,t],["enter",i,t],["exit",i,t],["exit",r,t]])),e}function Cbe(e,t,n){let s=0;return r;function r(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&s++<6?(e.consume(d),o):d===null||Lr(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||En(d)?(e.exit("atxHeading"),t(d)):Ds(d)?Ns(e,a,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),a(d))}function u(d){return d===null||d===35||Lr(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),u)}}const Tbe=["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"],hO=["pre","script","style","textarea"],Ebe={concrete:!0,name:"htmlFlow",resolveTo:jbe,tokenize:Mbe},Abe={partial:!0,tokenize:Rbe},Nbe={partial:!0,tokenize:Ibe};function jbe(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 Mbe(e,t,n){const s=this;let r,i,o,a,c;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),r=3,s.interrupt?t:I):Ca(j)?(e.consume(j),o=String.fromCharCode(j),v):n(j)}function m(j){return j===45?(e.consume(j),r=2,p):j===91?(e.consume(j),r=5,a=0,g):Ca(j)?(e.consume(j),r=4,s.interrupt?t:I):n(j)}function p(j){return j===45?(e.consume(j),s.interrupt?t:I):n(j)}function g(j){const ee="CDATA[";return j===ee.charCodeAt(a++)?(e.consume(j),a===ee.length?s.interrupt?t:M:g):n(j)}function b(j){return Ca(j)?(e.consume(j),o=String.fromCharCode(j),v):n(j)}function v(j){if(j===null||j===47||j===62||Lr(j)){const ee=j===47,se=o.toLowerCase();return!ee&&!i&&hO.includes(se)?(r=1,s.interrupt?t(j):M(j)):Tbe.includes(o.toLowerCase())?(r=6,ee?(e.consume(j),x):s.interrupt?t(j):M(j)):(r=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(j):i?y(j):w(j))}return j===45||ta(j)?(e.consume(j),o+=String.fromCharCode(j),v):n(j)}function x(j){return j===62?(e.consume(j),s.interrupt?t:M):n(j)}function y(j){return Ds(j)?(e.consume(j),y):N(j)}function w(j){return j===47?(e.consume(j),N):j===58||j===95||Ca(j)?(e.consume(j),k):Ds(j)?(e.consume(j),w):N(j)}function k(j){return j===45||j===46||j===58||j===95||ta(j)?(e.consume(j),k):T(j)}function T(j){return j===61?(e.consume(j),_):Ds(j)?(e.consume(j),T):w(j)}function _(j){return j===null||j===60||j===61||j===62||j===96?n(j):j===34||j===39?(e.consume(j),c=j,C):Ds(j)?(e.consume(j),_):S(j)}function C(j){return j===c?(e.consume(j),c=null,L):j===null||En(j)?n(j):(e.consume(j),C)}function S(j){return j===null||j===34||j===39||j===47||j===60||j===61||j===62||j===96||Lr(j)?T(j):(e.consume(j),S)}function L(j){return j===47||j===62||Ds(j)?w(j):n(j)}function N(j){return j===62?(e.consume(j),$):n(j)}function $(j){return j===null||En(j)?M(j):Ds(j)?(e.consume(j),$):n(j)}function M(j){return j===45&&r===2?(e.consume(j),z):j===60&&r===1?(e.consume(j),F):j===62&&r===4?(e.consume(j),Y):j===63&&r===3?(e.consume(j),I):j===93&&r===5?(e.consume(j),W):En(j)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(Abe,V,P)(j)):j===null||En(j)?(e.exit("htmlFlowData"),P(j)):(e.consume(j),M)}function P(j){return e.check(Nbe,E,V)(j)}function E(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),O}function O(j){return j===null||En(j)?P(j):(e.enter("htmlFlowData"),M(j))}function z(j){return j===45?(e.consume(j),I):M(j)}function F(j){return j===47?(e.consume(j),o="",B):M(j)}function B(j){if(j===62){const ee=o.toLowerCase();return hO.includes(ee)?(e.consume(j),Y):M(j)}return Ca(j)&&o.length<8?(e.consume(j),o+=String.fromCharCode(j),B):M(j)}function W(j){return j===93?(e.consume(j),I):M(j)}function I(j){return j===62?(e.consume(j),Y):j===45&&r===2?(e.consume(j),I):M(j)}function Y(j){return j===null||En(j)?(e.exit("htmlFlowData"),V(j)):(e.consume(j),Y)}function V(j){return e.exit("htmlFlow"),t(j)}}function Ibe(e,t,n){const s=this;return r;function r(o){return En(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}function Rbe(e,t,n){return s;function s(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(Iv,t,n)}}const Dbe={name:"htmlText",tokenize:Lbe};function Lbe(e,t,n){const s=this;let r,i,o;return a;function a(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),c}function c(I){return I===33?(e.consume(I),u):I===47?(e.consume(I),T):I===63?(e.consume(I),w):Ca(I)?(e.consume(I),S):n(I)}function u(I){return I===45?(e.consume(I),d):I===91?(e.consume(I),i=0,g):Ca(I)?(e.consume(I),y):n(I)}function d(I){return I===45?(e.consume(I),p):n(I)}function h(I){return I===null?n(I):I===45?(e.consume(I),m):En(I)?(o=h,F(I)):(e.consume(I),h)}function m(I){return I===45?(e.consume(I),p):h(I)}function p(I){return I===62?z(I):I===45?m(I):h(I)}function g(I){const Y="CDATA[";return I===Y.charCodeAt(i++)?(e.consume(I),i===Y.length?b:g):n(I)}function b(I){return I===null?n(I):I===93?(e.consume(I),v):En(I)?(o=b,F(I)):(e.consume(I),b)}function v(I){return I===93?(e.consume(I),x):b(I)}function x(I){return I===62?z(I):I===93?(e.consume(I),x):b(I)}function y(I){return I===null||I===62?z(I):En(I)?(o=y,F(I)):(e.consume(I),y)}function w(I){return I===null?n(I):I===63?(e.consume(I),k):En(I)?(o=w,F(I)):(e.consume(I),w)}function k(I){return I===62?z(I):w(I)}function T(I){return Ca(I)?(e.consume(I),_):n(I)}function _(I){return I===45||ta(I)?(e.consume(I),_):C(I)}function C(I){return En(I)?(o=C,F(I)):Ds(I)?(e.consume(I),C):z(I)}function S(I){return I===45||ta(I)?(e.consume(I),S):I===47||I===62||Lr(I)?L(I):n(I)}function L(I){return I===47?(e.consume(I),z):I===58||I===95||Ca(I)?(e.consume(I),N):En(I)?(o=L,F(I)):Ds(I)?(e.consume(I),L):z(I)}function N(I){return I===45||I===46||I===58||I===95||ta(I)?(e.consume(I),N):$(I)}function $(I){return I===61?(e.consume(I),M):En(I)?(o=$,F(I)):Ds(I)?(e.consume(I),$):L(I)}function M(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),r=I,P):En(I)?(o=M,F(I)):Ds(I)?(e.consume(I),M):(e.consume(I),E)}function P(I){return I===r?(e.consume(I),r=void 0,O):I===null?n(I):En(I)?(o=P,F(I)):(e.consume(I),P)}function E(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||Lr(I)?L(I):(e.consume(I),E)}function O(I){return I===47||I===62||Lr(I)?L(I):n(I)}function z(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function F(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),B}function B(I){return Ds(I)?Ns(e,W,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):W(I)}function W(I){return e.enter("htmlTextData"),o(I)}}const xj={name:"labelEnd",resolveAll:$be,resolveTo:zbe,tokenize:Fbe},Pbe={tokenize:Hbe},Obe={tokenize:qbe},Bbe={tokenize:Ube};function $be(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const r=s.type==="labelImage"?4:2;s.type="data",t+=r}}return e.length!==n.length&&El(e,0,e.length,n),e}function zbe(e,t){let n=e.length,s=0,r,i,o,a;for(;n--;)if(r=e[n][1],i){if(r.type==="link"||r.type==="labelLink"&&r._inactive)break;e[n][0]==="enter"&&r.type==="labelLink"&&(r._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(r.type==="labelImage"||r.type==="labelLink")&&!r._balanced&&(i=n,r.type!=="labelLink")){s=2;break}}else r.type==="labelEnd"&&(o=n);const c={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+s+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",c,t],["enter",u,t]],a=nc(a,e.slice(i+1,i+s+3)),a=nc(a,[["enter",d,t]]),a=nc(a,r3(t.parser.constructs.insideSpan.null,e.slice(i+s+4,o-3),t)),a=nc(a,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),a=nc(a,e.slice(o+1)),a=nc(a,[["exit",c,t]]),El(e,i,e.length,a),e}function Fbe(e,t,n){const s=this;let r=s.events.length,i,o;for(;r--;)if((s.events[r][1].type==="labelImage"||s.events[r][1].type==="labelLink")&&!s.events[r][1]._balanced){i=s.events[r][1];break}return a;function a(m){return i?i._inactive?h(m):(o=s.parser.defined.includes(Dc(s.sliceSerialize({start:i.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),c):n(m)}function c(m){return m===40?e.attempt(Pbe,d,o?d:h)(m):m===91?e.attempt(Obe,d,o?u:h)(m):o?d(m):h(m)}function u(m){return e.attempt(Bbe,d,h)(m)}function d(m){return t(m)}function h(m){return i._balanced=!0,n(m)}}function Hbe(e,t,n){return s;function s(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),r}function r(h){return Lr(h)?Qy(e,i)(h):i(h)}function i(h){return h===41?d(h):FK(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Lr(h)?Qy(e,c)(h):d(h)}function a(h){return n(h)}function c(h){return h===34||h===39||h===40?qK(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return Lr(h)?Qy(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 qbe(e,t,n){const s=this;return r;function r(a){return HK.call(s,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return s.parser.defined.includes(Dc(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function Ube(e,t,n){return s;function s(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),r}function r(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const Vbe={name:"labelStartImage",resolveAll:xj.resolveAll,tokenize:Wbe};function Wbe(e,t,n){const s=this;return r;function r(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),i}function i(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(a):t(a)}}const Gbe={name:"labelStartLink",resolveAll:xj.resolveAll,tokenize:Kbe};function Kbe(e,t,n){const s=this;return r;function r(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(o):t(o)}}const x5={name:"lineEnding",tokenize:Ybe};function Ybe(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ns(e,t,"linePrefix")}}const H_={name:"thematicBreak",tokenize:Xbe};function Xbe(e,t,n){let s=0,r;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return r=u,a(u)}function a(u){return u===r?(e.enter("thematicBreakSequence"),c(u)):s>=3&&(u===null||En(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===r?(e.consume(u),s++,c):(e.exit("thematicBreakSequence"),Ds(u)?Ns(e,a,"whitespace")(u):a(u))}}const Fa={continuation:{tokenize:eye},exit:nye,name:"list",tokenize:Zbe},Qbe={partial:!0,tokenize:sye},Jbe={partial:!0,tokenize:tye};function Zbe(e,t,n){const s=this,r=s.events[s.events.length-1];let i=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,o=0;return a;function a(p){const g=s.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!s.containerState.marker||p===s.containerState.marker:rE(p)){if(s.containerState.type||(s.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(H_,n,u)(p):u(p);if(!s.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return rE(p)&&++o<10?(e.consume(p),c):(!s.interrupt||o<2)&&(s.containerState.marker?p===s.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"),s.containerState.marker=s.containerState.marker||p,e.check(Iv,s.interrupt?n:d,e.attempt(Qbe,m,h))}function d(p){return s.containerState.initialBlankLine=!0,i++,m(p)}function h(p){return Ds(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return s.containerState.size=i+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function eye(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(Iv,r,i);function r(a){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Ns(e,t,"listItemIndent",s.containerState.size+1)(a)}function i(a){return s.containerState.furtherBlankLines||!Ds(a)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,o(a)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(Jbe,t,o)(a))}function o(a){return s.containerState._closeFlow=!0,s.interrupt=void 0,Ns(e,e.attempt(Fa,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function tye(e,t,n){const s=this;return Ns(e,r,"listItemIndent",s.containerState.size+1);function r(i){const o=s.events[s.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===s.containerState.size?t(i):n(i)}}function nye(e){e.exit(this.containerState.type)}function sye(e,t,n){const s=this;return Ns(e,r,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(i){const o=s.events[s.events.length-1];return!Ds(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const fO={name:"setextUnderline",resolveTo:rye,tokenize:iye};function rye(e,t){let n=e.length,s,r,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(r=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",o,t]),e.splice(i+1,0,["exit",e[s][1],t]),e[s][1].end={...e[i][1].end}):e[s][1]=o,e.push(["exit",o,t]),e}function iye(e,t,n){const s=this;let r;return i;function i(u){let d=s.events.length,h;for(;d--;)if(s.events[d][1].type!=="lineEnding"&&s.events[d][1].type!=="linePrefix"&&s.events[d][1].type!=="content"){h=s.events[d][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||h)?(e.enter("setextHeadingLine"),r=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===r?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),Ds(u)?Ns(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||En(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const oye={tokenize:aye};function aye(e){const t=this,n=e.attempt(Iv,s,e.attempt(this.parser.constructs.flowInitial,r,Ns(e,e.attempt(this.parser.constructs.flow,r,e.attempt(hbe,r)),"linePrefix")));return n;function s(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function r(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const lye={resolveAll:VK()},cye=UK("string"),uye=UK("text");function UK(e){return{resolveAll:VK(e==="text"?dye:void 0),tokenize:t};function t(n){const s=this,r=this.parser.constructs[e],i=n.attempt(r,o,a);return o;function o(d){return u(d)?i(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const h=r[d];let m=-1;if(h)for(;++m<h.length;){const p=h[m];if(!p.previous||p.previous.call(s,s.previous))return!0}return!1}}}function VK(e){return t;function t(n,s){let r=-1,i;for(;++r<=n.length;)i===void 0?n[r]&&n[r][1].type==="data"&&(i=r,r++):(!n[r]||n[r][1].type!=="data")&&(r!==i+2&&(n[i][1].end=n[r-1][1].end,n.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(n,s):n}}function dye(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],r=t.sliceStream(s);let i=r.length,o=-1,a=0,c;for(;i--;){const u=r[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)c=!0,a++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||c||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:s.start._bufferIndex+o,_index:s.start._index+i,line:s.end.line,column:s.end.column-a,offset:s.end.offset-a},end:{...s.end}};s.end={...u.start},s.start.offset===s.end.offset?Object.assign(s,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const hye={42:Fa,43:Fa,45:Fa,48:Fa,49:Fa,50:Fa,51:Fa,52:Fa,53:Fa,54:Fa,55:Fa,56:Fa,57:Fa,62:OK},fye={91:bbe},mye={[-2]:y5,[-1]:y5,32:y5},pye={35:_be,42:H_,45:[fO,H_],60:Ebe,61:fO,95:H_,96:dO,126:dO},gye={38:$K,92:BK},bye={[-5]:x5,[-4]:x5,[-3]:x5,33:Vbe,38:$K,42:iE,60:[G1e,Dbe],91:Gbe,92:[wbe,BK],93:xj,95:iE,96:obe},yye={null:[iE,lye]},xye={null:[42,95]},vye={null:[]},wye=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:xye,contentInitial:fye,disable:vye,document:hye,flow:pye,flowInitial:mye,insideSpan:yye,string:gye,text:bye},Symbol.toStringTag,{value:"Module"}));function kye(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},i=[];let o=[],a=[];const c={attempt:C(T),check:C(_),consume:y,enter:w,exit:k,interrupt:C(_,{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,c);return t.resolveAll&&i.push(t),u;function h($){return o=nc(o,$),v(),o[o.length-1]!==null?[]:(S(t,0),u.events=r3(i,u.events,u),u.events)}function m($,M){return Sye(p($),M)}function p($){return _ye(o,$)}function g(){const{_bufferIndex:$,_index:M,line:P,column:E,offset:O}=s;return{_bufferIndex:$,_index:M,line:P,column:E,offset:O}}function b($){r[$.line]=$.column,N()}function v(){let $;for(;s._index<o.length;){const M=o[s._index];if(typeof M=="string")for($=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===$&&s._bufferIndex<M.length;)x(M.charCodeAt(s._bufferIndex));else x(M)}}function x($){d=d($)}function y($){En($)?(s.line++,s.column=1,s.offset+=$===-3?2:1,N()):$!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===o[s._index].length&&(s._bufferIndex=-1,s._index++)),u.previous=$}function w($,M){const P=M||{};return P.type=$,P.start=g(),u.events.push(["enter",P,u]),a.push(P),P}function k($){const M=a.pop();return M.end=g(),u.events.push(["exit",M,u]),M}function T($,M){S($,M.from)}function _($,M){M.restore()}function C($,M){return P;function P(E,O,z){let F,B,W,I;return Array.isArray(E)?V(E):"tokenize"in E?V([E]):Y(E);function Y(X){return Q;function Q(ue){const re=ue!==null&&X[ue],J=ue!==null&&X.null,q=[...Array.isArray(re)?re:re?[re]:[],...Array.isArray(J)?J:J?[J]:[]];return V(q)(ue)}}function V(X){return F=X,B=0,X.length===0?z:j(X[B])}function j(X){return Q;function Q(ue){return I=L(),W=X,X.partial||(u.currentConstruct=X),X.name&&u.parser.constructs.disable.null.includes(X.name)?se():X.tokenize.call(M?Object.assign(Object.create(u),M):u,c,ee,se)(ue)}}function ee(X){return $(W,I),O}function se(X){return I.restore(),++B<F.length?j(F[B]):z}}}function S($,M){$.resolveAll&&!i.includes($)&&i.push($),$.resolve&&El(u.events,M,u.events.length-M,$.resolve(u.events.slice(M),u)),$.resolveTo&&(u.events=$.resolveTo(u.events,u))}function L(){const $=g(),M=u.previous,P=u.currentConstruct,E=u.events.length,O=Array.from(a);return{from:E,restore:z};function z(){s=$,u.previous=M,u.currentConstruct=P,u.events.length=E,a=O,N()}}function N(){s.line in r&&s.column<2&&(s.column=r[s.line],s.offset+=r[s.line]-1)}}function _ye(e,t){const n=t.start._index,s=t.start._bufferIndex,r=t.end._index,i=t.end._bufferIndex;let o;if(n===r)o=[e[n].slice(s,i)];else{if(o=e.slice(n,r),s>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(s):o.shift()}i>0&&o.push(e[r].slice(0,i))}return o}function Sye(e,t){let n=-1;const s=[];let r;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
`;break}case-3:{o=`\r
`;break}case-2:{o=t?" ":"	";break}case-1:{if(!t&&r)continue;o=" ";break}default:o=String.fromCharCode(i)}r=i===-2,s.push(o)}return s.join("")}function Cye(e){const s={constructs:LK([wye,...(e||{}).extensions||[]]),content:r(z1e),defined:[],document:r(H1e),flow:r(oye),lazy:{},string:r(cye),text:r(uye)};return s;function r(i){return o;function o(a){return kye(s,i,a)}}}function Tye(e){for(;!zK(e););return e}const mO=/[\0\t\n\r]/g;function Eye(){let e=1,t="",n=!0,s;return r;function r(i,o,a){const c=[];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(mO.lastIndex=h,u=mO.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&&s)c.push(-3),s=void 0;else switch(s&&(c.push(-5),s=void 0),h<m&&(c.push(i.slice(h,m)),e+=m-h),p){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:s=!0,e=1}h=m+1}return a&&(s&&c.push(-5),t&&c.push(t),c.push(null)),c}}const Aye=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Nye(e){return e.replace(Aye,jye)}function jye(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const r=n.charCodeAt(1),i=r===120||r===88;return PK(n.slice(i?2:1),i?16:10)}return yj(n)||e}const WK={}.hasOwnProperty;function Mye(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),Iye(n)(Tye(Cye(n).document().write(Eye()(e,t,!0))))}function Iye(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Et),autolinkProtocol:L,autolinkEmail:L,atxHeading:i(oe),blockQuote:i(J),characterEscape:L,characterReference:L,codeFenced:i(q),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(q,o),codeText:i(Z,o),codeTextData:L,data:L,codeFlowValue:L,definition:i(he),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(ye),hardBreakEscape:i(we),hardBreakTrailing:i(we),htmlFlow:i(Ve,o),htmlFlowData:L,htmlText:i(Ve,o),htmlTextData:L,image:i(lt),label:o,link:i(Et),listItem:i(je),listItemValue:m,listOrdered:i(pt,h),listUnordered:i(pt),paragraph:i(Ae),reference:j,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(oe),strong:i(De),thematicBreak:i(tt)},exit:{atxHeading:c(),atxHeadingSequence:T,autolink:c(),autolinkEmail:re,autolinkProtocol:ue,blockQuote:c(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:X,characterReference:Q,codeFenced:c(v),codeFencedFence:b,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:N,codeIndented:c(x),codeText:c(O),codeTextData:N,data:N,definition:c(),definitionDestinationString:k,definitionLabelString:y,definitionTitleString:w,emphasis:c(),hardBreakEscape:c(M),hardBreakTrailing:c(M),htmlFlow:c(P),htmlFlowData:N,htmlText:c(E),htmlTextData:N,image:c(F),label:W,labelText:B,lineEnding:$,link:c(z),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ee,resourceDestinationString:I,resourceTitleString:Y,resource:V,setextHeading:c(S),setextHeadingLineSequence:C,setextHeadingText:_,strong:c(),thematicBreak:c()}};GK(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(Se){let Be={type:"root",children:[]};const le={stack:[Be],tokenStack:[],config:t,enter:a,exit:u,buffer:o,resume:d,data:n},Le=[];let sn=-1;for(;++sn<Se.length;)if(Se[sn][1].type==="listOrdered"||Se[sn][1].type==="listUnordered")if(Se[sn][0]==="enter")Le.push(sn);else{const Cn=Le.pop();sn=r(Se,Cn,sn)}for(sn=-1;++sn<Se.length;){const Cn=t[Se[sn][0]];WK.call(Cn,Se[sn][1].type)&&Cn[Se[sn][1].type].call(Object.assign({sliceSerialize:Se[sn][2].sliceSerialize},le),Se[sn][1])}if(le.tokenStack.length>0){const Cn=le.tokenStack[le.tokenStack.length-1];(Cn[1]||pO).call(le,void 0,Cn[0])}for(Be.position={start:jh(Se.length>0?Se[0][1].start:{line:1,column:1,offset:0}),end:jh(Se.length>0?Se[Se.length-2][1].end:{line:1,column:1,offset:0})},sn=-1;++sn<t.transforms.length;)Be=t.transforms[sn](Be)||Be;return Be}function r(Se,Be,le){let Le=Be-1,sn=-1,Cn=!1,In,_t,Te,at;for(;++Le<=le;){const ke=Se[Le];switch(ke[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ke[0]==="enter"?sn++:sn--,at=void 0;break}case"lineEndingBlank":{ke[0]==="enter"&&(In&&!at&&!sn&&!Te&&(Te=Le),at=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:at=void 0}if(!sn&&ke[0]==="enter"&&ke[1].type==="listItemPrefix"||sn===-1&&ke[0]==="exit"&&(ke[1].type==="listUnordered"||ke[1].type==="listOrdered")){if(In){let Pe=Le;for(_t=void 0;Pe--;){const ve=Se[Pe];if(ve[1].type==="lineEnding"||ve[1].type==="lineEndingBlank"){if(ve[0]==="exit")continue;_t&&(Se[_t][1].type="lineEndingBlank",Cn=!0),ve[1].type="lineEnding",_t=Pe}else if(!(ve[1].type==="linePrefix"||ve[1].type==="blockQuotePrefix"||ve[1].type==="blockQuotePrefixWhitespace"||ve[1].type==="blockQuoteMarker"||ve[1].type==="listItemIndent"))break}Te&&(!_t||Te<_t)&&(In._spread=!0),In.end=Object.assign({},_t?Se[_t][1].start:ke[1].end),Se.splice(_t||Le,0,["exit",In,ke[2]]),Le++,le++}if(ke[1].type==="listItemPrefix"){const Pe={type:"listItem",_spread:!1,start:Object.assign({},ke[1].start),end:void 0};In=Pe,Se.splice(Le,0,["enter",Pe,ke[2]]),Le++,le++,Te=void 0,at=!0}}}return Se[Be][1]._spread=Cn,le}function i(Se,Be){return le;function le(Le){a.call(this,Se(Le),Le),Be&&Be.call(this,Le)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(Se,Be,le){this.stack[this.stack.length-1].children.push(Se),this.stack.push(Se),this.tokenStack.push([Be,le||void 0]),Se.position={start:jh(Be.start),end:void 0}}function c(Se){return Be;function Be(le){Se&&Se.call(this,le),u.call(this,le)}}function u(Se,Be){const le=this.stack.pop(),Le=this.tokenStack.pop();if(Le)Le[0].type!==Se.type&&(Be?Be.call(this,Se,Le[0]):(Le[1]||pO).call(this,Se,Le[0]));else throw new Error("Cannot close `"+Se.type+"` ("+Xy({start:Se.start,end:Se.end})+"): it’s not open");le.position.end=jh(Se.end)}function d(){return bj(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function m(Se){if(this.data.expectingFirstListItemValue){const Be=this.stack[this.stack.length-2];Be.start=Number.parseInt(this.sliceSerialize(Se),10),this.data.expectingFirstListItemValue=void 0}}function p(){const Se=this.resume(),Be=this.stack[this.stack.length-1];Be.lang=Se}function g(){const Se=this.resume(),Be=this.stack[this.stack.length-1];Be.meta=Se}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const Se=this.resume(),Be=this.stack[this.stack.length-1];Be.value=Se.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const Se=this.resume(),Be=this.stack[this.stack.length-1];Be.value=Se.replace(/(\r?\n|\r)$/g,"")}function y(Se){const Be=this.resume(),le=this.stack[this.stack.length-1];le.label=Be,le.identifier=Dc(this.sliceSerialize(Se)).toLowerCase()}function w(){const Se=this.resume(),Be=this.stack[this.stack.length-1];Be.title=Se}function k(){const Se=this.resume(),Be=this.stack[this.stack.length-1];Be.url=Se}function T(Se){const Be=this.stack[this.stack.length-1];if(!Be.depth){const le=this.sliceSerialize(Se).length;Be.depth=le}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function C(Se){const Be=this.stack[this.stack.length-1];Be.depth=this.sliceSerialize(Se).codePointAt(0)===61?1:2}function S(){this.data.setextHeadingSlurpLineEnding=void 0}function L(Se){const le=this.stack[this.stack.length-1].children;let Le=le[le.length-1];(!Le||Le.type!=="text")&&(Le=Ne(),Le.position={start:jh(Se.start),end:void 0},le.push(Le)),this.stack.push(Le)}function N(Se){const Be=this.stack.pop();Be.value+=this.sliceSerialize(Se),Be.position.end=jh(Se.end)}function $(Se){const Be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const le=Be.children[Be.children.length-1];le.position.end=jh(Se.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Be.type)&&(L.call(this,Se),N.call(this,Se))}function M(){this.data.atHardBreak=!0}function P(){const Se=this.resume(),Be=this.stack[this.stack.length-1];Be.value=Se}function E(){const Se=this.resume(),Be=this.stack[this.stack.length-1];Be.value=Se}function O(){const Se=this.resume(),Be=this.stack[this.stack.length-1];Be.value=Se}function z(){const Se=this.stack[this.stack.length-1];if(this.data.inReference){const Be=this.data.referenceType||"shortcut";Se.type+="Reference",Se.referenceType=Be,delete Se.url,delete Se.title}else delete Se.identifier,delete Se.label;this.data.referenceType=void 0}function F(){const Se=this.stack[this.stack.length-1];if(this.data.inReference){const Be=this.data.referenceType||"shortcut";Se.type+="Reference",Se.referenceType=Be,delete Se.url,delete Se.title}else delete Se.identifier,delete Se.label;this.data.referenceType=void 0}function B(Se){const Be=this.sliceSerialize(Se),le=this.stack[this.stack.length-2];le.label=Nye(Be),le.identifier=Dc(Be).toLowerCase()}function W(){const Se=this.stack[this.stack.length-1],Be=this.resume(),le=this.stack[this.stack.length-1];if(this.data.inReference=!0,le.type==="link"){const Le=Se.children;le.children=Le}else le.alt=Be}function I(){const Se=this.resume(),Be=this.stack[this.stack.length-1];Be.url=Se}function Y(){const Se=this.resume(),Be=this.stack[this.stack.length-1];Be.title=Se}function V(){this.data.inReference=void 0}function j(){this.data.referenceType="collapsed"}function ee(Se){const Be=this.resume(),le=this.stack[this.stack.length-1];le.label=Be,le.identifier=Dc(this.sliceSerialize(Se)).toLowerCase(),this.data.referenceType="full"}function se(Se){this.data.characterReferenceType=Se.type}function X(Se){const Be=this.sliceSerialize(Se),le=this.data.characterReferenceType;let Le;le?(Le=PK(Be,le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Le=yj(Be);const sn=this.stack[this.stack.length-1];sn.value+=Le}function Q(Se){const Be=this.stack.pop();Be.position.end=jh(Se.end)}function ue(Se){N.call(this,Se);const Be=this.stack[this.stack.length-1];Be.url=this.sliceSerialize(Se)}function re(Se){N.call(this,Se);const Be=this.stack[this.stack.length-1];Be.url="mailto:"+this.sliceSerialize(Se)}function J(){return{type:"blockquote",children:[]}}function q(){return{type:"code",lang:null,meta:null,value:""}}function Z(){return{type:"inlineCode",value:""}}function he(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ye(){return{type:"emphasis",children:[]}}function oe(){return{type:"heading",depth:0,children:[]}}function we(){return{type:"break"}}function Ve(){return{type:"html",value:""}}function lt(){return{type:"image",title:null,url:"",alt:null}}function Et(){return{type:"link",title:null,url:"",children:[]}}function pt(Se){return{type:"list",ordered:Se.type==="listOrdered",start:null,spread:Se._spread,children:[]}}function je(Se){return{type:"listItem",spread:Se._spread,checked:null,children:[]}}function Ae(){return{type:"paragraph",children:[]}}function De(){return{type:"strong",children:[]}}function Ne(){return{type:"text",value:""}}function tt(){return{type:"thematicBreak"}}}function jh(e){return{line:e.line,column:e.column,offset:e.offset}}function GK(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?GK(e,s):Rye(e,s)}}function Rye(e,t){let n;for(n in t)if(WK.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function pO(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Xy({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Xy({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Xy({start:t.start,end:t.end})+") is still open")}function Dye(e){const t=this;t.parser=n;function n(s){return Mye(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Lye(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 Pye(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function Oye(e,t){const n=t.value?t.value+`
`:"",s={},r=t.lang?t.lang.split(/\s+/):[];r.length>0&&(s.className=["language-"+r[0]]);let i={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function Bye(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $ye(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function zye(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),r=q1(s.toLowerCase()),i=e.footnoteOrder.indexOf(s);let o,a=e.footnoteCounts.get(s);a===void 0?(a=0,e.footnoteOrder.push(s),o=e.footnoteOrder.length):o=i+1,a+=1,e.footnoteCounts.set(s,a);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function Fye(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 Hye(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function KK(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const r=e.all(t),i=r[0];i&&i.type==="text"?i.value="["+i.value:r.unshift({type:"text",value:"["});const o=r[r.length-1];return o&&o.type==="text"?o.value+=s:r.push({type:"text",value:s}),r}function qye(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return KK(e,t);const r={src:q1(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(r.title=s.title);const i={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,i),e.applyData(t,i)}function Uye(e,t){const n={src:q1(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function Vye(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function Wye(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return KK(e,t);const r={href:q1(s.url||"")};s.title!==null&&s.title!==void 0&&(r.title=s.title);const i={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Gye(e,t){const n={href:q1(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function Kye(e,t,n){const s=e.all(t),r=n?Yye(n):YK(t),i={},o=[];if(typeof t.checked=="boolean"){const d=s[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},s.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<s.length;){const d=s[a];(r||a!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
`}),d.type==="element"&&d.tagName==="p"&&!r?o.push(...d.children):o.push(d)}const c=s[s.length-1];c&&(r||c.type!=="element"||c.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 Yye(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=YK(n[s])}return t}function YK(e){const t=e.spread;return t??e.children.length>1}function Xye(e,t){const n={},s=e.all(t);let r=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++r<s.length;){const o=s[r];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function Qye(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Jye(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Zye(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function exe(e,t){const n=e.all(t),s=n.shift(),r=[];if(s){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],o),r.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=fj(t.children[1]),c=AK(t.children[t.children.length-1]);a&&c&&(o.position={start:a,end:c}),r.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function txe(e,t,n){const s=n?n.children:void 0,i=(s?s.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:t.children.length;let c=-1;const u=[];for(;++c<a;){const h=t.children[c],m={},p=o?o[c]: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 nxe(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const gO=9,bO=32;function sxe(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),r=0;const i=[];for(;s;)i.push(yO(t.slice(r,s.index),r>0,!0),s[0]),r=s.index+s[0].length,s=n.exec(t);return i.push(yO(t.slice(r),r>0,!1)),i.join("")}function yO(e,t,n){let s=0,r=e.length;if(t){let i=e.codePointAt(s);for(;i===gO||i===bO;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(r-1);for(;i===gO||i===bO;)r--,i=e.codePointAt(r-1)}return r>s?e.slice(s,r):""}function rxe(e,t){const n={type:"text",value:sxe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function ixe(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const oxe={blockquote:Lye,break:Pye,code:Oye,delete:Bye,emphasis:$ye,footnoteReference:zye,heading:Fye,html:Hye,imageReference:qye,image:Uye,inlineCode:Vye,linkReference:Wye,link:Gye,listItem:Kye,list:Xye,paragraph:Qye,root:Jye,strong:Zye,table:exe,tableCell:nxe,tableRow:txe,text:rxe,thematicBreak:ixe,toml:ok,yaml:ok,definition:ok,footnoteDefinition:ok};function ok(){}const XK=-1,i3=0,Jy=1,iS=2,vj=3,wj=4,kj=5,_j=6,QK=7,JK=8,xO=typeof self=="object"?self:globalThis,axe=(e,t)=>{const n=(r,i)=>(e.set(i,r),r),s=r=>{if(e.has(r))return e.get(r);const[i,o]=t[r];switch(i){case i3:case XK:return n(o,r);case Jy:{const a=n([],r);for(const c of o)a.push(s(c));return a}case iS:{const a=n({},r);for(const[c,u]of o)a[s(c)]=s(u);return a}case vj:return n(new Date(o),r);case wj:{const{source:a,flags:c}=o;return n(new RegExp(a,c),r)}case kj:{const a=n(new Map,r);for(const[c,u]of o)a.set(s(c),s(u));return a}case _j:{const a=n(new Set,r);for(const c of o)a.add(s(c));return a}case QK:{const{name:a,message:c}=o;return n(new xO[a](c),r)}case JK:return n(BigInt(o),r);case"BigInt":return n(Object(BigInt(o)),r);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new xO[i](o),r)};return s},vO=e=>axe(new Map,e)(0),N0="",{toString:lxe}={},{keys:cxe}=Object,Kb=e=>{const t=typeof e;if(t!=="object"||!e)return[i3,t];const n=lxe.call(e).slice(8,-1);switch(n){case"Array":return[Jy,N0];case"Object":return[iS,N0];case"Date":return[vj,N0];case"RegExp":return[wj,N0];case"Map":return[kj,N0];case"Set":return[_j,N0];case"DataView":return[Jy,n]}return n.includes("Array")?[Jy,n]:n.includes("Error")?[QK,n]:[iS,n]},ak=([e,t])=>e===i3&&(t==="function"||t==="symbol"),uxe=(e,t,n,s)=>{const r=(o,a)=>{const c=s.push(o)-1;return n.set(a,c),c},i=o=>{if(n.has(o))return n.get(o);let[a,c]=Kb(o);switch(a){case i3:{let d=o;switch(c){case"bigint":a=JK,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return r([XK],o)}return r([a,d],o)}case Jy:{if(c){let m=o;return c==="DataView"?m=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(m=new Uint8Array(o)),r([c,[...m]],o)}const d=[],h=r([a,d],o);for(const m of o)d.push(i(m));return h}case iS:{if(c)switch(c){case"BigInt":return r([c,o.toString()],o);case"Boolean":case"Number":case"String":return r([c,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const d=[],h=r([a,d],o);for(const m of cxe(o))(e||!ak(Kb(o[m])))&&d.push([i(m),i(o[m])]);return h}case vj:return r([a,o.toISOString()],o);case wj:{const{source:d,flags:h}=o;return r([a,{source:d,flags:h}],o)}case kj:{const d=[],h=r([a,d],o);for(const[m,p]of o)(e||!(ak(Kb(m))||ak(Kb(p))))&&d.push([i(m),i(p)]);return h}case _j:{const d=[],h=r([a,d],o);for(const m of o)(e||!ak(Kb(m)))&&d.push(i(m));return h}}const{message:u}=o;return r([a,{name:c,message:u}],o)};return i},wO=(e,{json:t,lossy:n}={})=>{const s=[];return uxe(!(t||n),!!t,new Map,s)(e),s},oS=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?vO(wO(e,t)):structuredClone(e):(e,t)=>vO(wO(e,t));function dxe(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 hxe(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function fxe(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||dxe,s=e.options.footnoteBackLabel||hxe,r=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),h=String(u.identifier).toUpperCase(),m=q1(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(c,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 s=="string"?s:s(c,p),className:["data-footnote-backref"]},children:Array.isArray(y)?y:[y]})}const v=d[d.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const y=v.children[v.children.length-1];y&&y.type==="text"?y.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...g)}else d.push(...g);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(u,x),a.push(x)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...oS(o),id:"footnote-label"},children:[{type:"text",value:r}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
`}]}}const Rv=function(e){if(e==null)return bxe;if(typeof e=="function")return o3(e);if(typeof e=="object")return Array.isArray(e)?mxe(e):pxe(e);if(typeof e=="string")return gxe(e);throw new Error("Expected function, string, or object as test")};function mxe(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Rv(e[n]);return o3(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function pxe(e){const t=e;return o3(n);function n(s){const r=s;let i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function gxe(e){return o3(t);function t(n){return n&&n.type===e}}function o3(e){return t;function t(n,s,r){return!!(yxe(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function bxe(){return!0}function yxe(e){return e!==null&&typeof e=="object"&&"type"in e}const ZK=[],xxe=!0,oE=!1,eY="skip";function Sj(e,t,n,s){let r;typeof t=="function"&&typeof n!="function"?(s=n,n=t):r=t;const i=Rv(r),o=s?-1:1;a(e,void 0,[])();function a(c,u,d){const h=c&&typeof c=="object"?c:{};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 ("+(c.type+(p?"<"+p+">":""))+")"})}return m;function m(){let p=ZK,g,b,v;if((!t||i(c,u,d[d.length-1]||void 0))&&(p=vxe(n(c,d)),p[0]===oE))return p;if("children"in c&&c.children){const x=c;if(x.children&&p[0]!==eY)for(b=(s?x.children.length:-1)+o,v=d.concat(x);b>-1&&b<x.children.length;){const y=x.children[b];if(g=a(y,b,v)(),g[0]===oE)return g;b=typeof g[1]=="number"?g[1]:b+o}}return p}}}function vxe(e){return Array.isArray(e)?e:typeof e=="number"?[xxe,e]:e==null?ZK:[e]}function Cj(e,t,n,s){let r,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,r=n):(i=t,o=n,r=s),Sj(e,i,a,r);function a(c,u){const d=u[u.length-1],h=d?d.children.indexOf(c):void 0;return o(c,h,d)}}const aE={}.hasOwnProperty,wxe={};function kxe(e,t){const n=t||wxe,s=new Map,r=new Map,i=new Map,o={...oxe,...n.handlers},a={all:u,applyData:Sxe,definitionById:s,footnoteById:r,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:_xe,wrap:Txe};return Cj(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?s:r,m=String(d.identifier).toUpperCase();h.has(m)||h.set(m,d)}}),a;function c(d,h){const m=d.type,p=a.handlers[m];if(aE.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,...v}=d,x=oS(v);return x.children=a.all(d),x}return oS(d)}return(a.options.unknownHandler||Cxe)(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=kO(g.value)),!Array.isArray(g)&&g.type==="element")){const b=g.children[0];b&&b.type==="text"&&(b.value=kO(b.value))}Array.isArray(g)?h.push(...g):h.push(g)}}}return h}}function _xe(e,t){e.position&&(t.position=h1e(e))}function Sxe(e,t){let n=t;if(e&&e.data){const s=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const o="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,oS(i)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function Cxe(e,t){const n=t.data||{},s="value"in t&&!(aE.call(n,"hProperties")||aE.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function Txe(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
`});++s<e.length;)s&&n.push({type:"text",value:`
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
`}),n}function kO(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function _O(e,t){const n=kxe(e,t),s=n.one(e,void 0),r=fxe(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return r&&i.children.push({type:"text",value:`
`},r),i}function Exe(e,t){return e&&"run"in e?async function(n,s){const r=_O(n,{file:s,...t});await e.run(r,s)}:function(n,s){return _O(n,{file:s,...e||t})}}function SO(e){if(e)throw e}var q_=Object.prototype.hasOwnProperty,tY=Object.prototype.toString,CO=Object.defineProperty,TO=Object.getOwnPropertyDescriptor,EO=function(t){return typeof Array.isArray=="function"?Array.isArray(t):tY.call(t)==="[object Array]"},AO=function(t){if(!t||tY.call(t)!=="[object Object]")return!1;var n=q_.call(t,"constructor"),s=t.constructor&&t.constructor.prototype&&q_.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!s)return!1;var r;for(r in t);return typeof r>"u"||q_.call(t,r)},NO=function(t,n){CO&&n.name==="__proto__"?CO(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},jO=function(t,n){if(n==="__proto__")if(q_.call(t,n)){if(TO)return TO(t,n).value}else return;return t[n]},Axe=function e(){var t,n,s,r,i,o,a=arguments[0],c=1,u=arguments.length,d=!1;for(typeof a=="boolean"&&(d=a,a=arguments[1]||{},c=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)s=jO(a,n),r=jO(t,n),a!==r&&(d&&r&&(AO(r)||(i=EO(r)))?(i?(i=!1,o=s&&EO(s)?s:[]):o=s&&AO(s)?s:{},NO(a,{name:n,newValue:e(d,o,r)})):typeof r<"u"&&NO(a,{name:n,newValue:r}));return a};const v5=C4(Axe);function lE(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 Nxe(){const e=[],t={run:n,use:s};return t;function n(...r){let i=-1;const o=r.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...r);function a(c,...u){const d=e[++i];let h=-1;if(c){o(c);return}for(;++h<r.length;)(u[h]===null||u[h]===void 0)&&(u[h]=r[h]);r=u,d?jxe(d,a)(...u):o(null,...u)}}function s(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}}function jxe(e,t){let n;return s;function s(...o){const a=e.length>o.length;let c;a&&o.push(r);try{c=e.apply(this,o)}catch(u){const d=u;if(a&&n)throw d;return r(d)}a||(c&&c.then&&typeof c.then=="function"?c.then(i,r):c instanceof Error?r(c):i(c))}function r(o,...a){n||(n=!0,t(o,...a))}function i(o){r(null,o)}}const pu={basename:Mxe,dirname:Ixe,extname:Rxe,join:Dxe,sep:"/"};function Mxe(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Dv(e);let n=0,s=-1,r=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;r--;)if(e.codePointAt(r)===47){if(i){n=r+1;break}}else s<0&&(i=!0,s=r+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let o=-1,a=t.length-1;for(;r--;)if(e.codePointAt(r)===47){if(i){n=r+1;break}}else o<0&&(i=!0,o=r+1),a>-1&&(e.codePointAt(r)===t.codePointAt(a--)?a<0&&(s=r):(a=-1,s=o));return n===s?s=o:s<0&&(s=e.length),e.slice(n,s)}function Ixe(e){if(Dv(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Rxe(e){Dv(e);let t=e.length,n=-1,s=0,r=-1,i=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){s=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?r<0?r=t:i!==1&&(i=1):r>-1&&(i=-1)}return r<0||n<0||i===0||i===1&&r===n-1&&r===s+1?"":e.slice(r,n)}function Dxe(...e){let t=-1,n;for(;++t<e.length;)Dv(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Lxe(n)}function Lxe(e){Dv(e);const t=e.codePointAt(0)===47;let n=Pxe(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Pxe(e,t){let n="",s=0,r=-1,i=0,o=-1,a,c;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(r===o-1||i===1))if(r!==o-1&&i===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",s=0):(n=n.slice(0,c),s=n.length-1-n.lastIndexOf("/")),r=o,i=0;continue}}else if(n.length>0){n="",s=0,r=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(r+1,o):n=e.slice(r+1,o),s=o-r-1;r=o,i=0}else a===46&&i>-1?i++:i=-1}return n}function Dv(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Oxe={cwd:Bxe};function Bxe(){return"/"}function cE(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function $xe(e){if(typeof e=="string")e=new URL(e);else if(!cE(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 zxe(e)}function zxe(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const r=new TypeError("File URL path must not include encoded / characters");throw r.code="ERR_INVALID_FILE_URL_PATH",r}}return decodeURIComponent(t)}const w5=["history","path","basename","stem","extname","dirname"];class nY{constructor(t){let n;t?cE(t)?n={path:t}:typeof t=="string"||Fxe(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Oxe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<w5.length;){const i=w5[s];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let r;for(r in n)w5.includes(r)||(this[r]=n[r])}get basename(){return typeof this.path=="string"?pu.basename(this.path):void 0}set basename(t){_5(t,"basename"),k5(t,"basename"),this.path=pu.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?pu.dirname(this.path):void 0}set dirname(t){MO(this.basename,"dirname"),this.path=pu.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?pu.extname(this.path):void 0}set extname(t){if(k5(t,"extname"),MO(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=pu.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){cE(t)&&(t=$xe(t)),_5(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?pu.basename(this.path,this.extname):void 0}set stem(t){_5(t,"stem"),k5(t,"stem"),this.path=pu.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const r=this.message(t,n,s);throw r.fatal=!0,r}info(t,n,s){const r=this.message(t,n,s);return r.fatal=void 0,r}message(t,n,s){const r=new ia(t,n,s);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function k5(e,t){if(e&&e.includes(pu.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+pu.sep+"`")}function _5(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function MO(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Fxe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Hxe=function(e){const s=this.constructor.prototype,r=s[e],i=function(){return r.apply(i,arguments)};return Object.setPrototypeOf(i,s),i},qxe={}.hasOwnProperty;class Tj extends Hxe{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=Nxe()}copy(){const t=new Tj;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(v5(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(T5("data",this.frozen),this.namespace[t]=n,this):qxe.call(this.namespace,t)&&this.namespace[t]||void 0:t?(T5("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const r=n.call(t,...s);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=lk(t),s=this.parser||this.Parser;return S5("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),S5("process",this.parser||this.Parser),C5("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(i,o){const a=lk(t),c=s.parse(a);s.run(c,a,function(d,h,m){if(d||!h||!m)return u(d);const p=h,g=s.stringify(p,m);Wxe(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,s;return this.freeze(),S5("processSync",this.parser||this.Parser),C5("processSync",this.compiler||this.Compiler),this.process(t,r),RO("processSync","process",n),s;function r(i,o){n=!0,SO(i),s=o}}run(t,n,s){IO(t),this.freeze();const r=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?i(void 0,s):new Promise(i);function i(o,a){const c=lk(n);r.run(t,c,u);function u(d,h,m){const p=h||t;d?a(d):o?o(p):s(void 0,p,m)}}}runSync(t,n){let s=!1,r;return this.run(t,n,i),RO("runSync","run",s),r;function i(o,a){SO(o),r=a,s=!0}}stringify(t,n){this.freeze();const s=lk(n),r=this.compiler||this.Compiler;return C5("stringify",r),IO(t),r(t,s)}use(t,...n){const s=this.attachers,r=this.namespace;if(T5("use",this.frozen),t!=null)if(typeof t=="function")c(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")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;c(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&&(r.settings=v5(!0,r.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 c(u,d){let h=-1,m=-1;for(;++h<s.length;)if(s[h][0]===u){m=h;break}if(m===-1)s.push([u,...d]);else if(d.length>0){let[p,...g]=d;const b=s[m][1];lE(b)&&lE(p)&&(p=v5(!0,b,p)),s[m]=[u,p,...g]}}}}const Uxe=new Tj().freeze();function S5(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function C5(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function T5(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 IO(e){if(!lE(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function RO(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function lk(e){return Vxe(e)?e:new nY(e)}function Vxe(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Wxe(e){return typeof e=="string"||Gxe(e)}function Gxe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Kxe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",DO=[],LO={allowDangerousHtml:!0},Yxe=/^(https?|ircs?|mailto|xmpp)$/i,Xxe=[{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 Qxe(e){const t=Jxe(e),n=Zxe(e);return eve(t.runSync(t.parse(n),n),e)}function Jxe(e){const t=e.rehypePlugins||DO,n=e.remarkPlugins||DO,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...LO}:LO;return Uxe().use(Dye).use(n).use(Exe,s).use(t)}function Zxe(e){const t=e.children||"",n=new nY;return typeof t=="string"&&(n.value=t),n}function eve(e,t){const n=t.allowedElements,s=t.allowElement,r=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,c=t.urlTransform||sY;for(const d of Xxe)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Kxe+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Cj(e,u),b1e(e,{Fragment:l.Fragment,components:r,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.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 b5)if(Object.hasOwn(b5,p)&&Object.hasOwn(d.properties,p)){const g=d.properties[p],b=b5[p];(b===null||b.includes(d.tagName))&&(d.properties[p]=c(String(g||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!p&&s&&typeof h=="number"&&(p=!s(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 sY(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),r=e.indexOf("/");return t===-1||r!==-1&&t>r||n!==-1&&t>n||s!==-1&&t>s||Yxe.test(e.slice(0,t))?e:""}function aS(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,r=n.indexOf(t);for(;r!==-1;)s++,r=n.indexOf(t,r+t.length);return s}function tve(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function nve(e,t,n){const r=Rv((n||{}).ignore||[]),i=sve(t);let o=-1;for(;++o<i.length;)Sj(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(r(p,g?g.indexOf(p):void 0,m))return;m=p}if(m)return c(u,d)}function c(u,d){const h=d[d.length-1],m=i[o][0],p=i[o][1];let g=0;const v=h.children.indexOf(u);let x=!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 _=p(...w,T);if(typeof _=="string"&&(_=_.length>0?{type:"text",value:_}:void 0),_===!1?m.lastIndex=k+1:(g!==k&&y.push({type:"text",value:u.value.slice(g,k)}),Array.isArray(_)?y.push(..._):_&&y.push(_),g=k+w[0].length,x=!0),!m.global)break;w=m.exec(u.value)}return x?(g<u.value.length&&y.push({type:"text",value:u.value.slice(g)}),h.children.splice(v,1,...y)):y=[u],v+y.length}}function sve(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<n.length;){const r=n[s];t.push([rve(r[0]),ive(r[1])])}return t}function rve(e){return typeof e=="string"?new RegExp(tve(e),"g"):e}function ive(e){return typeof e=="function"?e:function(){return e}}const E5="phrasing",A5=["autolink","link","image","label"];function ove(){return{transforms:[fve],enter:{literalAutolink:lve,literalAutolinkEmail:N5,literalAutolinkHttp:N5,literalAutolinkWww:N5},exit:{literalAutolink:hve,literalAutolinkEmail:dve,literalAutolinkHttp:cve,literalAutolinkWww:uve}}}function ave(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:E5,notInConstruct:A5},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:E5,notInConstruct:A5},{character:":",before:"[ps]",after:"\\/",inConstruct:E5,notInConstruct:A5}]}}function lve(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function N5(e){this.config.enter.autolinkProtocol.call(this,e)}function cve(e){this.config.exit.autolinkProtocol.call(this,e)}function uve(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 dve(e){this.config.exit.autolinkEmail.call(this,e)}function hve(e){this.exit(e)}function fve(e){nve(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,mve],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),pve]],{ignore:["link","linkReference"]})}function mve(e,t,n,s,r){let i="";if(!rY(r)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!gve(n)))return!1;const o=bve(n+s);if(!o[0])return!1;const a={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function pve(e,t,n,s){return!rY(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function gve(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 bve(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const r=aS(e,"(");let i=aS(e,")");for(;s!==-1&&r>i;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),i++;return[e,n]}function rY(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Rp(n)||s3(n))&&(!t||n!==47)}iY.peek=Tve;function yve(){this.buffer()}function xve(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function vve(){this.buffer()}function wve(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function kve(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Dc(this.sliceSerialize(e)).toLowerCase(),n.label=t}function _ve(e){this.exit(e)}function Sve(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Dc(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Cve(e){this.exit(e)}function Tve(){return"["}function iY(e,t,n,s){const r=n.createTracker(s);let i=r.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return i+=r.move(n.safe(n.associationId(e),{after:"]",before:i})),a(),o(),i+=r.move("]"),i}function Eve(){return{enter:{gfmFootnoteCallString:yve,gfmFootnoteCall:xve,gfmFootnoteDefinitionLabelString:vve,gfmFootnoteDefinition:wve},exit:{gfmFootnoteCallString:kve,gfmFootnoteCall:_ve,gfmFootnoteDefinitionLabelString:Sve,gfmFootnoteDefinition:Cve}}}function Ave(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:iY},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,r,i,o){const a=i.createTracker(o);let c=a.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return c+=a.move(i.safe(i.associationId(s),{before:c,after:"]"})),d(),c+=a.move("]:"),s.children&&s.children.length>0&&(a.shift(4),c+=a.move((t?`
`:" ")+i.indentLines(i.containerFlow(s,a.current()),t?oY:Nve))),u(),c}}function Nve(e,t,n){return t===0?e:oY(e,t,n)}function oY(e,t,n){return(n?"":"    ")+e}const jve=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];aY.peek=Lve;function Mve(){return{canContainEols:["delete"],enter:{strikethrough:Rve},exit:{strikethrough:Dve}}}function Ive(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:jve}],handlers:{delete:aY}}}function Rve(e){this.enter({type:"delete",children:[]},e)}function Dve(e){this.exit(e)}function aY(e,t,n,s){const r=n.createTracker(s),i=n.enter("strikethrough");let o=r.move("~~");return o+=n.containerPhrasing(e,{...r.current(),before:o,after:"~"}),o+=r.move("~~"),i(),o}function Lve(){return"~"}function Pve(e){return e.length}function Ove(e,t){const n=t||{},s=(n.align||[]).concat(),r=n.stringLength||Pve,i=[],o=[],a=[],c=[];let u=0,d=-1;for(;++d<e.length;){const b=[],v=[];let x=-1;for(e[d].length>u&&(u=e[d].length);++x<e[d].length;){const y=Bve(e[d][x]);if(n.alignDelimiters!==!1){const w=r(y);v[x]=w,(c[x]===void 0||w>c[x])&&(c[x]=w)}b.push(y)}o[d]=b,a[d]=v}let h=-1;if(typeof s=="object"&&"length"in s)for(;++h<u;)i[h]=PO(s[h]);else{const b=PO(s);for(;++h<u;)i[h]=b}h=-1;const m=[],p=[];for(;++h<u;){const b=i[h];let v="",x="";b===99?(v=":",x=":"):b===108?v=":":b===114&&(x=":");let y=n.alignDelimiters===!1?1:Math.max(1,c[h]-v.length-x.length);const w=v+"-".repeat(y)+x;n.alignDelimiters!==!1&&(y=v.length+y+x.length,y>c[h]&&(c[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],v=a[d];h=-1;const x=[];for(;++h<u;){const y=b[h]||"";let w="",k="";if(n.alignDelimiters!==!1){const T=c[h]-(v[h]||0),_=i[h];_===114?w=" ".repeat(T):_===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&&x.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&y==="")&&(n.delimiterStart!==!1||h)&&x.push(" "),n.alignDelimiters!==!1&&x.push(w),x.push(y),n.alignDelimiters!==!1&&x.push(k),n.padding!==!1&&x.push(" "),(n.delimiterEnd!==!1||h!==u-1)&&x.push("|")}g.push(n.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return g.join(`
`)}function Bve(e){return e==null?"":String(e)}function PO(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 OO={}.hasOwnProperty;function $ve(e,t){const n=t||{};function s(r,...i){let o=s.invalid;const a=s.handlers;if(r&&OO.call(r,e)){const c=String(r[e]);o=OO.call(a,c)?a[c]:s.unknown}if(o)return o.call(this,r,...i)}return s.handlers=n.handlers||{},s.invalid=n.invalid,s.unknown=n.unknown,s}function zve(e,t,n,s){const r=n.enter("blockquote"),i=n.createTracker(s);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),Fve);return r(),o}function Fve(e,t,n){return">"+(n?"":" ")+e}function Hve(e,t){return BO(e,t.inConstruct,!0)&&!BO(e,t.notInConstruct,!1)}function BO(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function $O(e,t,n,s){let r=-1;for(;++r<n.unsafe.length;)if(n.unsafe[r].character===`
`&&Hve(n.stack,n.unsafe[r]))return/[ \t]/.test(s.before)?"":" ";return`\\
`}function lY(e,t){const n=String(e);let s=n.indexOf(t),r=s,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===r?++i>o&&(o=i):i=1,r=s+t.length,s=n.indexOf(t,r);return o}function qve(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 Uve(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 Vve(e,t,n,s){const r=Uve(n),i=e.value||"",o=r==="`"?"GraveAccent":"Tilde";if(qve(e,n)){const h=n.enter("codeIndented"),m=n.indentLines(i,Wve);return h(),m}const a=n.createTracker(s),c=r.repeat(Math.max(lY(i,r)+1,3)),u=n.enter("codeFenced");let d=a.move(c);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(c),u(),d}function Wve(e,t,n){return(n?"":"    ")+e}function Ej(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 Gve(e,t,n,s){const r=Ej(n),i=r==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const c=n.createTracker(s);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(a=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":`
`,...c.current()}))),a(),e.title&&(a=n.enter(`title${i}`),u+=c.move(" "+r),u+=c.move(n.safe(e.title,{before:u,after:r,...c.current()})),u+=c.move(r),a()),o(),u}function Kve(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 Mx(e){return"&#x"+e.toString(16).toUpperCase()+";"}function lS(e,t,n){const s=r1(e),r=r1(t);return s===void 0?r===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}cY.peek=Yve;function cY(e,t,n,s){const r=Kve(n),i=n.enter("emphasis"),o=n.createTracker(s),a=o.move(r);let c=o.move(n.containerPhrasing(e,{after:r,before:a,...o.current()}));const u=c.charCodeAt(0),d=lS(s.before.charCodeAt(s.before.length-1),u,r);d.inside&&(c=Mx(u)+c.slice(1));const h=c.charCodeAt(c.length-1),m=lS(s.after.charCodeAt(0),h,r);m.inside&&(c=c.slice(0,-1)+Mx(h));const p=o.move(r);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},a+c+p}function Yve(e,t,n){return n.options.emphasis||"*"}function Xve(e,t){let n=!1;return Cj(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,oE}),!!((!e.depth||e.depth<3)&&bj(e)&&(t.options.setext||n))}function Qve(e,t,n,s){const r=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(s);if(Xve(e,n)){const d=n.enter("headingSetext"),h=n.enter("phrasing"),m=n.containerPhrasing(e,{...i.current(),before:`
`,after:`
`});return h(),d(),m+`
`+(r===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(`
`))+1))}const o="#".repeat(r),a=n.enter("headingAtx"),c=n.enter("phrasing");i.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
`,...i.current()});return/^[\t ]/.test(u)&&(u=Mx(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),a(),u}uY.peek=Jve;function uY(e){return e.value||""}function Jve(){return"<"}dY.peek=Zve;function dY(e,t,n,s){const r=Ej(n),i=r==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const c=n.createTracker(s);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(a=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),a(),e.title&&(a=n.enter(`title${i}`),u+=c.move(" "+r),u+=c.move(n.safe(e.title,{before:u,after:r,...c.current()})),u+=c.move(r),a()),u+=c.move(")"),o(),u}function Zve(){return"!"}hY.peek=ewe;function hY(e,t,n,s){const r=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(s);let c=a.move("![");const u=n.safe(e.alt,{before:c,after:"]",...a.current()});c+=a.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...a.current()});return o(),n.stack=d,i(),r==="full"||!u||u!==h?c+=a.move(h+"]"):r==="shortcut"?c=c.slice(0,-1):c+=a.move("]"),c}function ewe(){return"!"}fY.peek=twe;function fY(e,t,n){let s=e.value||"",r="`",i=-1;for(;new RegExp("(^|[^`])"+r+"([^`]|$)").test(s);)r+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++i<n.unsafe.length;){const o=n.unsafe[i],a=n.compilePattern(o);let c;if(o.atBreak)for(;c=a.exec(s);){let u=c.index;s.charCodeAt(u)===10&&s.charCodeAt(u-1)===13&&u--,s=s.slice(0,u)+" "+s.slice(c.index+1)}}return r+s+r}function twe(){return"`"}function mY(e,t){const n=bj(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))}pY.peek=nwe;function pY(e,t,n,s){const r=Ej(n),i=r==='"'?"Quote":"Apostrophe",o=n.createTracker(s);let a,c;if(mY(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"),c=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(c=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=n.enter(`title${i}`),u+=o.move(" "+r),u+=o.move(n.safe(e.title,{before:u,after:r,...o.current()})),u+=o.move(r),c()),u+=o.move(")"),a(),u}function nwe(e,t,n){return mY(e,n)?"<":"["}gY.peek=swe;function gY(e,t,n,s){const r=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(s);let c=a.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...a.current()});c+=a.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...a.current()});return o(),n.stack=d,i(),r==="full"||!u||u!==h?c+=a.move(h+"]"):r==="shortcut"?c=c.slice(0,-1):c+=a.move("]"),c}function swe(){return"["}function Aj(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 rwe(e){const t=Aj(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 iwe(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 bY(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 owe(e,t,n,s){const r=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?iwe(n):Aj(n);const a=e.ordered?o==="."?")":".":rwe(n);let c=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&&(c=!0),bY(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"){c=!0;break}}}}c&&(o=a),n.bulletCurrent=o;const u=n.containerFlow(e,s);return n.bulletLastUsed=o,n.bulletCurrent=i,r(),u}function awe(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 lwe(e,t,n,s){const r=awe(n);let i=n.bulletCurrent||Aj(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let o=i.length+1;(r==="tab"||r==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(s);a.move(i+" ".repeat(o-i.length)),a.shift(o);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),d);return c(),u;function d(h,m,p){return m?(p?"":" ".repeat(o))+h:(p?i:i+" ".repeat(o-i.length))+h}}function cwe(e,t,n,s){const r=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,s);return i(),r(),o}const uwe=Rv(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function dwe(e,t,n,s){return(e.children.some(function(o){return uwe(o)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function hwe(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}yY.peek=fwe;function yY(e,t,n,s){const r=hwe(n),i=n.enter("strong"),o=n.createTracker(s),a=o.move(r+r);let c=o.move(n.containerPhrasing(e,{after:r,before:a,...o.current()}));const u=c.charCodeAt(0),d=lS(s.before.charCodeAt(s.before.length-1),u,r);d.inside&&(c=Mx(u)+c.slice(1));const h=c.charCodeAt(c.length-1),m=lS(s.after.charCodeAt(0),h,r);m.inside&&(c=c.slice(0,-1)+Mx(h));const p=o.move(r+r);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},a+c+p}function fwe(e,t,n){return n.options.strong||"*"}function mwe(e,t,n,s){return n.safe(e.value,s)}function pwe(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 gwe(e,t,n){const s=(bY(n)+(n.options.ruleSpaces?" ":"")).repeat(pwe(n));return n.options.ruleSpaces?s.slice(0,-1):s}const xY={blockquote:zve,break:$O,code:Vve,definition:Gve,emphasis:cY,hardBreak:$O,heading:Qve,html:uY,image:dY,imageReference:hY,inlineCode:fY,link:pY,linkReference:gY,list:owe,listItem:lwe,paragraph:cwe,root:dwe,strong:yY,text:mwe,thematicBreak:gwe};function bwe(){return{enter:{table:ywe,tableData:zO,tableHeader:zO,tableRow:vwe},exit:{codeText:wwe,table:xwe,tableData:j5,tableHeader:j5,tableRow:j5}}}function ywe(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 xwe(e){this.exit(e),this.data.inTable=void 0}function vwe(e){this.enter({type:"tableRow",children:[]},e)}function j5(e){this.exit(e)}function zO(e){this.enter({type:"tableCell",children:[]},e)}function wwe(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,kwe));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function kwe(e,t){return t==="|"?t:e}function _we(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,r=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[	 :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:o,tableCell:c,tableRow:a}};function o(p,g,b,v){return u(d(p,b,v),p.align)}function a(p,g,b,v){const x=h(p,b,v),y=u([x]);return y.slice(0,y.indexOf(`
`))}function c(p,g,b,v){const x=b.enter("tableCell"),y=b.enter("phrasing"),w=b.containerPhrasing(p,{...v,before:i,after:i});return y(),x(),w}function u(p,g){return Ove(p,{align:g,alignDelimiters:s,padding:n,stringLength:r})}function d(p,g,b){const v=p.children;let x=-1;const y=[],w=g.enter("table");for(;++x<v.length;)y[x]=h(v[x],g,b);return w(),y}function h(p,g,b){const v=p.children;let x=-1;const y=[],w=g.enter("tableRow");for(;++x<v.length;)y[x]=c(v[x],p,g,b);return w(),y}function m(p,g,b){let v=xY.inlineCode(p,g,b);return b.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function Swe(){return{exit:{taskListCheckValueChecked:FO,taskListCheckValueUnchecked:FO,paragraph:Twe}}}function Cwe(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Ewe}}}function FO(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Twe(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const s=n.children[0];if(s&&s.type==="text"){const r=t.children;let i=-1,o;for(;++i<r.length;){const a=r[i];if(a.type==="paragraph"){o=a;break}}o===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function Ewe(e,t,n,s){const r=e.children[0],i=typeof e.checked=="boolean"&&r&&r.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(s);i&&a.move(o);let c=xY.listItem(e,t,n,{...s,...a.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(d){return d+o}}function Awe(){return[ove(),Eve(),Mve(),bwe(),Swe()]}function Nwe(e){return{extensions:[ave(),Ave(e),Ive(),_we(e),Cwe()]}}const jwe={tokenize:Pwe,partial:!0},vY={tokenize:Owe,partial:!0},wY={tokenize:Bwe,partial:!0},kY={tokenize:$we,partial:!0},Mwe={tokenize:zwe,partial:!0},_Y={name:"wwwAutolink",tokenize:Dwe,previous:CY},SY={name:"protocolAutolink",tokenize:Lwe,previous:TY},ah={name:"emailAutolink",tokenize:Rwe,previous:EY},Vu={};function Iwe(){return{text:Vu}}let Lm=48;for(;Lm<123;)Vu[Lm]=ah,Lm++,Lm===58?Lm=65:Lm===91&&(Lm=97);Vu[43]=ah;Vu[45]=ah;Vu[46]=ah;Vu[95]=ah;Vu[72]=[ah,SY];Vu[104]=[ah,SY];Vu[87]=[ah,_Y];Vu[119]=[ah,_Y];function Rwe(e,t,n){const s=this;let r,i;return o;function o(h){return!uE(h)||!EY.call(s,s.previous)||Nj(s.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(h))}function a(h){return uE(h)?(e.consume(h),a):h===64?(e.consume(h),c):n(h)}function c(h){return h===46?e.check(Mwe,d,u)(h):h===45||h===95||ta(h)?(i=!0,e.consume(h),c):d(h)}function u(h){return e.consume(h),r=!0,c}function d(h){return i&&r&&Ca(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function Dwe(e,t,n){const s=this;return r;function r(o){return o!==87&&o!==119||!CY.call(s,s.previous)||Nj(s.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(jwe,e.attempt(vY,e.attempt(wY,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function Lwe(e,t,n){const s=this;let r="",i=!1;return o;function o(h){return(h===72||h===104)&&TY.call(s,s.previous)&&!Nj(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),r+=String.fromCodePoint(h),e.consume(h),a):n(h)}function a(h){if(Ca(h)&&r.length<5)return r+=String.fromCodePoint(h),e.consume(h),a;if(h===58){const m=r.toLowerCase();if(m==="http"||m==="https")return e.consume(h),c}return n(h)}function c(h){return h===47?(e.consume(h),i?u:(i=!0,c)):n(h)}function u(h){return h===null||rS(h)||Lr(h)||Rp(h)||s3(h)?n(h):e.attempt(vY,e.attempt(wY,d),n)(h)}function d(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function Pwe(e,t,n){let s=0;return r;function r(o){return(o===87||o===119)&&s<3?(s++,e.consume(o),r):o===46&&s===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function Owe(e,t,n){let s,r,i;return o;function o(u){return u===46||u===95?e.check(kY,c,a)(u):u===null||Lr(u)||Rp(u)||u!==45&&s3(u)?c(u):(i=!0,e.consume(u),o)}function a(u){return u===95?s=!0:(r=s,s=void 0),e.consume(u),o}function c(u){return r||s||!i?n(u):t(u)}}function Bwe(e,t){let n=0,s=0;return r;function r(o){return o===40?(n++,e.consume(o),r):o===41&&s<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(kY,t,i)(o):o===null||Lr(o)||Rp(o)?t(o):(e.consume(o),r)}function i(o){return o===41&&s++,e.consume(o),r}}function $we(e,t,n){return s;function s(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),s):a===38?(e.consume(a),i):a===93?(e.consume(a),r):a===60||a===null||Lr(a)||Rp(a)?t(a):n(a)}function r(a){return a===null||a===40||a===91||Lr(a)||Rp(a)?t(a):s(a)}function i(a){return Ca(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),s):Ca(a)?(e.consume(a),o):n(a)}}function zwe(e,t,n){return s;function s(i){return e.consume(i),r}function r(i){return ta(i)?n(i):t(i)}}function CY(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Lr(e)}function TY(e){return!Ca(e)}function EY(e){return!(e===47||uE(e))}function uE(e){return e===43||e===45||e===46||e===95||ta(e)}function Nj(e){let t=e.length,n=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Fwe={tokenize:Ywe,partial:!0};function Hwe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Wwe,continuation:{tokenize:Gwe},exit:Kwe}},text:{91:{name:"gfmFootnoteCall",tokenize:Vwe},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:qwe,resolveTo:Uwe}}}}function qwe(e,t,n){const s=this;let r=s.events.length;const i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o;for(;r--;){const c=s.events[r][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return a;function a(c){if(!o||!o._balanced)return n(c);const u=Dc(s.sliceSerialize({start:o.end,end:s.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function Uwe(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},r={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};r.end.column++,r.end.offset++,r.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},r.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},a=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",r,t],["exit",r,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...a),e}function Vwe(e,t,n){const s=this,r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i=0,o;return a;function a(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),c}function c(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||Lr(h))return n(h);if(h===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return r.includes(Dc(s.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return Lr(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 Wwe(e,t,n){const s=this,r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i,o=0,a;return c;function c(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||Lr(g))return n(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return i=Dc(s.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return Lr(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"),r.includes(i)||r.push(i),Ns(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return t(g)}}function Gwe(e,t,n){return e.check(Iv,t,e.attempt(Fwe,t,n))}function Kwe(e){e.exit("gfmFootnoteDefinition")}function Ywe(e,t,n){const s=this;return Ns(e,r,"gfmFootnoteDefinitionIndent",5);function r(i){const o=s.events[s.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function Xwe(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:i,resolveAll:r};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function r(o,a){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let u=c;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[c][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[c][1].end)},h={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[c][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&&El(m,m.length,0,r3(p,o.slice(u+1,c),a)),El(m,m.length,0,[["exit",h,a],["enter",o[c][1],a],["exit",o[c][1],a],["exit",d,a]]),El(o,u-1,c-u+3,m),c=u+m.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function i(o,a,c){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"?c(g):(o.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const b=r1(u);if(g===126)return h>1?c(g):(o.consume(g),h++,p);if(h<2&&!n)return c(g);const v=o.exit("strikethroughSequenceTemporary"),x=r1(g);return v._open=!x||x===2&&!!b,v._close=!b||b===2&&!!x,a(g)}}}class Qwe{constructor(){this.map=[]}add(t,n,s){Jwe(this,t,n,s)}consume(t){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let r=s.pop();for(;r;){for(const i of r)t.push(i);r=s.pop()}this.map.length=0}}function Jwe(e,t,n,s){let r=0;if(!(n===0&&s.length===0)){for(;r<e.map.length;){if(e.map[r][0]===t){e.map[r][1]+=n,e.map[r][2].push(...s);return}r+=1}e.map.push([t,n,s])}}function Zwe(e,t){let n=!1;const s=[];for(;t<e.length;){const r=e[t];if(n){if(r[0]==="enter")r[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(r[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=s.length-1;s[i]=s[i]==="left"?"center":"right"}}else if(r[1].type==="tableDelimiterRow")break}else r[0]==="enter"&&r[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return s}function eke(){return{flow:{null:{name:"table",tokenize:tke,resolveAll:nke}}}}function tke(e,t,n){const s=this;let r=0,i=0,o;return a;function a(N){let $=s.events.length-1;for(;$>-1;){const E=s.events[$][1].type;if(E==="lineEnding"||E==="linePrefix")$--;else break}const M=$>-1?s.events[$][1].type:null,P=M==="tableHead"||M==="tableRow"?_:c;return P===_&&s.parser.lazy[s.now().line]?n(N):P(N)}function c(N){return e.enter("tableHead"),e.enter("tableRow"),u(N)}function u(N){return N===124||(o=!0,i+=1),d(N)}function d(N){return N===null?n(N):En(N)?i>1?(i=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),p):n(N):Ds(N)?Ns(e,d,"whitespace")(N):(i+=1,o&&(o=!1,r+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),h(N)))}function h(N){return N===null||N===124||Lr(N)?(e.exit("data"),d(N)):(e.consume(N),N===92?m:h)}function m(N){return N===92||N===124?(e.consume(N),h):h(N)}function p(N){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(N):(e.enter("tableDelimiterRow"),o=!1,Ds(N)?Ns(e,g,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):g(N))}function g(N){return N===45||N===58?v(N):N===124?(o=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),b):T(N)}function b(N){return Ds(N)?Ns(e,v,"whitespace")(N):v(N)}function v(N){return N===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),x):N===45?(i+=1,x(N)):N===null||En(N)?k(N):T(N)}function x(N){return N===45?(e.enter("tableDelimiterFiller"),y(N)):T(N)}function y(N){return N===45?(e.consume(N),y):N===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(N))}function w(N){return Ds(N)?Ns(e,k,"whitespace")(N):k(N)}function k(N){return N===124?g(N):N===null||En(N)?!o||r!==i?T(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(N)):T(N)}function T(N){return n(N)}function _(N){return e.enter("tableRow"),C(N)}function C(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),C):N===null||En(N)?(e.exit("tableRow"),t(N)):Ds(N)?Ns(e,C,"whitespace")(N):(e.enter("data"),S(N))}function S(N){return N===null||N===124||Lr(N)?(e.exit("data"),C(N)):(e.consume(N),N===92?L:S)}function L(N){return N===92||N===124?(e.consume(N),S):S(N)}}function nke(e,t){let n=-1,s=!0,r=0,i=[0,0,0,0],o=[0,0,0,0],a=!1,c=0,u,d,h;const m=new Qwe;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(a=!1,c!==0&&(HO(m,t,c,u,d),d=void 0,c=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"?(s=!0,h=void 0,i=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,d={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},m.add(n,0,[["enter",d,t]])),r=g.type==="tableDelimiterRow"?2:d?3:1):r&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(s=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],h=ck(m,t,i,r,void 0,h),i=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(s?s=!1:(i[1]!==0&&(o[0]=o[1],h=ck(m,t,i,r,void 0,h)),i=o,o=[i[1],n,0,0])):g.type==="tableHead"?(a=!0,c=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(c=n,i[1]!==0?(o[0]=o[1],h=ck(m,t,i,r,n,h)):o[1]!==0&&(h=ck(m,t,o,r,n,h)),r=0):r&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&HO(m,t,c,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=Zwe(t.events,n))}return e}function ck(e,t,n,s,r,i){const o=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},Y0(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=Y0(t.events,n[1]);if(i={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const u=Y0(t.events,n[2]),d=Y0(t.events,n[3]),h={type:a,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",h,t]]),s!==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 r!==void 0&&(i.end=Object.assign({},Y0(t.events,r)),e.add(r,0,[["exit",i,t]]),i=void 0),i}function HO(e,t,n,s,r){const i=[],o=Y0(t.events,n);r&&(r.end=Object.assign({},o),i.push(["exit",r,t])),s.end=Object.assign({},o),i.push(["exit",s,t]),e.add(n+1,0,i)}function Y0(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const ske={name:"tasklistCheck",tokenize:ike};function rke(){return{text:{91:ske}}}function ike(e,t,n){const s=this;return r;function r(c){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Lr(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(c)}function a(c){return En(c)?t(c):Ds(c)?e.check({tokenize:oke},t,n)(c):n(c)}}function oke(e,t,n){return Ns(e,s,"whitespace");function s(r){return r===null?n(r):t(r)}}function ake(e){return LK([Iwe(),Hwe(),Xwe(e),eke(),rke()])}const lke={};function qO(e){const t=this,n=e||lke,s=t.data(),r=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);r.push(ake(n)),i.push(Awe()),o.push(Nwe(n))}function cke(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:i},exit:{mathFlow:r,mathFlowFence:s,mathFlowFenceMeta:n,mathFlowValue:a,mathText:o,mathTextData:a}};function e(c){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]}},c)}function t(){this.buffer()}function n(){const c=this.resume(),u=this.stack[this.stack.length-1];u.type,u.meta=c}function s(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function r(c){const u=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),d=this.stack[this.stack.length-1];d.type,this.exit(c),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(c){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},c),this.buffer()}function o(c){const u=this.resume(),d=this.stack[this.stack.length-1];d.type,this.exit(c),d.value=u,d.data.hChildren.push({type:"text",value:u})}function a(c){this.config.enter.data.call(this,c),this.config.exit.data.call(this,c)}}function uke(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),s.peek=r,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
`,inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:s}};function n(i,o,a,c){const u=i.value||"",d=a.createTracker(c),h="$".repeat(Math.max(lY(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 s(i,o,a){let c=i.value||"",u=1;for(t||u++;new RegExp("(^|[^$])"+"\\$".repeat(u)+"([^$]|$)").test(c);)u++;const d="$".repeat(u);/[^ \r\n]/.test(c)&&(/^[ \r\n]/.test(c)&&/[ \r\n]$/.test(c)||/^\$|\$$/.test(c))&&(c=" "+c+" ");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(c);){let b=g.index;c.codePointAt(b)===10&&c.codePointAt(b-1)===13&&b--,c=c.slice(0,b)+" "+c.slice(g.index+1)}}return d+c+d}function r(){return"$"}}const dke={tokenize:hke,concrete:!0,name:"mathFlow"},UO={tokenize:fke,partial:!0};function hke(e,t,n){const s=this,r=s.events[s.events.length-1],i=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0;let o=0;return a;function a(y){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),c(y)}function c(y){return y===36?(e.consume(y),o++,c):o<2?n(y):(e.exit("mathFlowFenceSequence"),Ns(e,u,"whitespace")(y))}function u(y){return y===null||En(y)?h(y):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(y))}function d(y){return y===null||En(y)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),h(y)):y===36?n(y):(e.consume(y),d)}function h(y){return e.exit("mathFlowFence"),s.interrupt?t(y):e.attempt(UO,m,v)(y)}function m(y){return e.attempt({tokenize:x,partial:!0},v,p)(y)}function p(y){return(i?Ns(e,g,"linePrefix",i+1):g)(y)}function g(y){return y===null?v(y):En(y)?e.attempt(UO,m,v)(y):(e.enter("mathFlowValue"),b(y))}function b(y){return y===null||En(y)?(e.exit("mathFlowValue"),g(y)):(e.consume(y),b)}function v(y){return e.exit("mathFlow"),t(y)}function x(y,w,k){let T=0;return Ns(y,_,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function _(L){return y.enter("mathFlowFence"),y.enter("mathFlowFenceSequence"),C(L)}function C(L){return L===36?(T++,y.consume(L),C):T<o?k(L):(y.exit("mathFlowFenceSequence"),Ns(y,S,"whitespace")(L))}function S(L){return L===null||En(L)?(y.exit("mathFlowFence"),w(L)):k(L)}}}function fke(e,t,n){const s=this;return r;function r(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}function mke(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:s,resolve:pke,previous:gke,name:"mathText"};function s(r,i,o){let a=0,c,u;return d;function d(b){return r.enter("mathText"),r.enter("mathTextSequence"),h(b)}function h(b){return b===36?(r.consume(b),a++,h):a<2&&!n?o(b):(r.exit("mathTextSequence"),m(b))}function m(b){return b===null?o(b):b===36?(u=r.enter("mathTextSequence"),c=0,g(b)):b===32?(r.enter("space"),r.consume(b),r.exit("space"),m):En(b)?(r.enter("lineEnding"),r.consume(b),r.exit("lineEnding"),m):(r.enter("mathTextData"),p(b))}function p(b){return b===null||b===32||b===36||En(b)?(r.exit("mathTextData"),m(b)):(r.consume(b),p)}function g(b){return b===36?(r.consume(b),c++,g):c===a?(r.exit("mathTextSequence"),r.exit("mathText"),i(b)):(u.type="mathTextData",p(b))}}}function pke(e){let t=e.length-4,n=3,s,r;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="mathTextData"){e[t][1].type="mathTextPadding",e[n][1].type="mathTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)r===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(r=s):(s===t||e[s][1].type==="lineEnding")&&(e[r][1].type="mathTextData",s!==r+2&&(e[r][1].end=e[s-1][1].end,e.splice(r+2,s-r-2),t-=s-r-2,s=r+2),r=void 0);return e}function gke(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function bke(e){return{flow:{36:dke},text:{36:mke(e)}}}class kt extends Error{constructor(t,n){var s="KaTeX parse error: "+t,r,i,o=n&&n.loc;if(o&&o.start<=o.end){var a=o.lexer.input;r=o.start,i=o.end,r===a.length?s+=" at end of input: ":s+=" at position "+(r+1)+": ";var c=a.slice(r,i).replace(/[^]/g,"$&̲"),u;r>15?u="…"+a.slice(r-15,r):u=a.slice(0,r);var d;i+15<a.length?d=a.slice(i,i+15)+"…":d=a.slice(i),s+=u+c+d}super(s),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,kt.prototype),this.position=r,r!=null&&i!=null&&(this.length=i-r),this.rawMessage=t}}var yke=/([A-Z])/g,xke=e=>e.replace(yke,"-$1").toLowerCase(),vke={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},wke=/[&><"']/g,na=e=>String(e).replace(wke,t=>vke[t]),U_=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?U_(e.body[0]):e:e.type==="font"?U_(e.body):e,kke=new Set(["mathord","textord","atom"]),lh=e=>kke.has(U_(e).type),_ke=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"},cS={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 Ske(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 Cke(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return Ske(t)}function Tke(e,t,n,s){var r=n[t];e[t]=r!==void 0?s.processor?s.processor(r):r:Cke(s)}class jj{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(cS)){var s=cS[n];s&&Tke(this,n,t,s)}}reportNonstrict(t,n,s){var r=this.strict;if(typeof r=="function"&&(r=r(t,n,s)),!(!r||r==="ignore")){if(r===!0||r==="error")throw new kt("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+t+"]"),s);r==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+r+"': "+n+" ["+t+"]"))}}useStrictBehavior(t,n,s){var r=this.strict;if(typeof r=="function")try{r=r(t,n,s)}catch{r="error"}return!r||r==="ignore"?!1:r===!0||r==="error"?!0:r==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+r+"': "+n+" ["+t+"]")),!1)}isTrusted(t){if("url"in t&&t.url&&!t.protocol){var n=_ke(t.url);if(n==null)return!1;t.protocol=n}var s=typeof this.trust=="function"?this.trust(t):this.trust;return!!s}}let Mh=class{constructor(t,n,s){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=n,this.cramped=s}sup(){return bu[Eke[this.id]]}sub(){return bu[Ake[this.id]]}fracNum(){return bu[Nke[this.id]]}fracDen(){return bu[jke[this.id]]}cramp(){return bu[Mke[this.id]]}text(){return bu[Ike[this.id]]}isTight(){return this.size>=2}};var Mj=0,uS=1,Mg=2,Ld=3,Ix=4,uc=5,i1=6,Aa=7,bu=[new Mh(Mj,0,!1),new Mh(uS,0,!0),new Mh(Mg,1,!1),new Mh(Ld,1,!0),new Mh(Ix,2,!1),new Mh(uc,2,!0),new Mh(i1,3,!1),new Mh(Aa,3,!0)],Eke=[Ix,uc,Ix,uc,i1,Aa,i1,Aa],Ake=[uc,uc,uc,uc,Aa,Aa,Aa,Aa],Nke=[Mg,Ld,Ix,uc,i1,Aa,i1,Aa],jke=[Ld,Ld,uc,uc,Aa,Aa,Aa,Aa],Mke=[uS,uS,Ld,Ld,uc,uc,Aa,Aa],Ike=[Mj,uS,Mg,Ld,Mg,Ld,Mg,Ld],ss={DISPLAY:bu[Mj],TEXT:bu[Mg],SCRIPT:bu[Ix],SCRIPTSCRIPT:bu[i1]},dE=[{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 Rke(e){for(var t=0;t<dE.length;t++)for(var n=dE[t],s=0;s<n.blocks.length;s++){var r=n.blocks[s];if(e>=r[0]&&e<=r[1])return n.name}return null}var V_=[];dE.forEach(e=>e.blocks.forEach(t=>V_.push(...t)));function AY(e){for(var t=0;t<V_.length;t+=2)if(e>=V_[t]&&e<=V_[t+1])return!0;return!1}var Xi=e=>e+" "+e,j0=80,Dke=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"},Lke=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"},Pke=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"},Oke=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"},Bke=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"},$ke=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},zke=function(t,n,s){var r=s-54-n-t;return"M702 "+(t+n)+"H400000"+(40+t)+`
H742v`+r+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
219 661 l218 661zM702 `+n+"H400000v"+(40+t)+"H742z"},Fke=function(t,n,s){n=1e3*n;var r="";switch(t){case"sqrtMain":r=Dke(n,j0);break;case"sqrtSize1":r=Lke(n,j0);break;case"sqrtSize2":r=Pke(n,j0);break;case"sqrtSize3":r=Oke(n,j0);break;case"sqrtSize4":r=Bke(n,j0);break;case"sqrtTall":r=zke(n,j0,s)}return r},Hke=function(t,n){switch(t){case"⎜":return Xi("M291 0 H417 V"+n+" H291z");case"∣":return Xi("M145 0 H188 V"+n+" H145z");case"∥":return Xi("M145 0 H188 V"+n+" H145z")+Xi("M367 0 H410 V"+n+" H367z");case"⎟":return Xi("M457 0 H583 V"+n+" H457z");case"⎢":return Xi("M319 0 H403 V"+n+" H319z");case"⎥":return Xi("M263 0 H347 V"+n+" H263z");case"⎪":return Xi("M384 0 H504 V"+n+" H384z");case"⏐":return Xi("M312 0 H355 V"+n+" H312z");case"‖":return Xi("M257 0 H300 V"+n+" H257z")+Xi("M478 0 H521 V"+n+" H478z");default:return""}},VO={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:Xi("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:Xi("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:Xi("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:Xi("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:Xi("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:Xi("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:Xi("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:Xi("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`},qke=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 Uke(e){return"toText"in e}let U1=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(Uke(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}};var hE={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},Vke={ex:!0,em:!0,mu:!0},NY=function(t){return typeof t!="string"&&(t=t.unit),t in hE||t in Vke||t==="ex"},pi=function(t,n){var s;if(t.unit in hE)s=hE[t.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(t.unit==="mu")s=n.fontMetrics().cssEmPerMu;else{var r;if(n.style.isTight()?r=n.havingStyle(n.style.text()):r=n,t.unit==="ex")s=r.fontMetrics().xHeight;else if(t.unit==="em")s=r.fontMetrics().quad;else throw new kt("Invalid unit: '"+t.unit+"'");r!==n&&(s*=r.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*s,n.maxSize)},jt=function(t){return+t.toFixed(4)+"em"},Df=function(t){return t.filter(n=>n).join(" ")},Ij=function(t){var n="";for(var s of Object.keys(t)){var r=t[s];r!==void 0&&(n+=xke(s)+":"+r+";")}return n},jY=function(t,n,s){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=s||{},n){n.style.isTight()&&this.classes.push("mtight");var r=n.getColor();r&&(this.style.color=r)}},MY=function(t){var n=document.createElement(t);n.className=Df(this.classes),Object.assign(n.style,this.style);for(var s of Object.keys(this.attributes))n.setAttribute(s,this.attributes[s]);for(var r=0;r<this.children.length;r++)n.appendChild(this.children[r].toNode());return n},Wke=/[\s"'>/=\x00-\x1f]/,IY=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+na(Df(this.classes))+'"');var s=Ij(this.style);s&&(n+=' style="'+na(s)+'"');for(var r of Object.keys(this.attributes)){if(Wke.test(r))throw new kt("Invalid attribute name '"+r+"'");n+=" "+r+'="'+na(this.attributes[r])+'"'}n+=">";for(var i=0;i<this.children.length;i++)n+=this.children[i].toMarkup();return n+="</"+t+">",n};class V1{constructor(t,n,s,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,jY.call(this,t,s,r),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return MY.call(this,"span")}toMarkup(){return IY.call(this,"span")}}let a3=class{constructor(t,n,s,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,jY.call(this,n,r),this.children=s||[],this.setAttribute("href",t)}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return MY.call(this,"a")}toMarkup(){return IY.call(this,"a")}};class Gke{constructor(t,n,s){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=t,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=s}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createElement("img");return t.src=this.src,t.alt=this.alt,t.className="mord",Object.assign(t.style,this.style),t}toMarkup(){var t='<img src="'+na(this.src)+'"'+(' alt="'+na(this.alt)+'"'),n=Ij(this.style);return n&&(t+=' style="'+na(n)+'"'),t+="'/>",t}}var Kke={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Il{constructor(t,n,s,r,i,o,a,c){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=t,this.height=n||0,this.depth=s||0,this.italic=r||0,this.skew=i||0,this.width=o||0,this.classes=a||[],this.style=c||{},this.maxFontSize=0;var u=Rke(this.text.charCodeAt(0));u&&this.classes.push(u+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=Kke[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=jt(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=Df(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+=na(Df(this.classes)),n+='"');var s="";this.italic>0&&(s+="margin-right:"+jt(this.italic)+";"),s+=Ij(this.style),s&&(t=!0,n+=' style="'+na(s)+'"');var r=na(this.text);return t?(n+=">",n+=r,n+="</span>",n):r}}class eh{constructor(t,n){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=n||{}}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");for(var s of Object.keys(this.attributes))n.setAttribute(s,this.attributes[s]);for(var r=0;r<this.children.length;r++)n.appendChild(this.children[r].toNode());return n}toMarkup(){var t='<svg xmlns="http://www.w3.org/2000/svg"';for(var n of Object.keys(this.attributes))t+=" "+n+'="'+na(this.attributes[n])+'"';t+=">";for(var s=0;s<this.children.length;s++)t+=this.children[s].toMarkup();return t+="</svg>",t}}class Lf{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",VO[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+na(this.alternate)+'"/>':'<path d="'+na(VO[this.pathName])+'"/>'}}class fE{constructor(t){this.attributes=void 0,this.attributes=t||{}}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"line");for(var s of Object.keys(this.attributes))n.setAttribute(s,this.attributes[s]);return n}toMarkup(){var t="<line";for(var n of Object.keys(this.attributes))t+=" "+n+'="'+na(this.attributes[n])+'"';return t+="/>",t}}function Yke(e){if(e instanceof Il)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function Xke(e){if(e instanceof V1)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var Qke=e=>e instanceof V1||e instanceof a3||e instanceof U1,Tu={"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]}},uk={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]},WO={Å:"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 RY(e,t){Tu[e]=t}function Rj(e,t,n){if(!Tu[t])throw new Error("Font metrics not found for font: "+t+".");var s=e.charCodeAt(0),r=Tu[t][s];if(!r&&e[0]in WO&&(s=WO[e[0]].charCodeAt(0),r=Tu[t][s]),!r&&n==="text"&&AY(s)&&(r=Tu[t][77]),r)return{depth:r[0],height:r[1],italic:r[2],skew:r[3],width:r[4]}}var M5={};function Jke(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!M5[t]){var n=M5[t]={cssEmPerMu:uk.quad[t]/18};for(var s in uk)uk.hasOwnProperty(s)&&(n[s]=uk[s][t])}return M5[t]}var oi={math:{},text:{}};function A(e,t,n,s,r,i){oi[e][r]={font:t,group:n,replace:s},i&&s&&(oi[e][s]=oi[e][r])}var D="math",mt="text",U="main",ce="ams",li="accent-token",hn="bin",Ia="close",W1="inner",Fn="mathord",Vi="op-token",Ll="open",Lv="punct",de="rel",ch="spacing",be="textord";A(D,U,de,"≡","\\equiv",!0);A(D,U,de,"≺","\\prec",!0);A(D,U,de,"≻","\\succ",!0);A(D,U,de,"∼","\\sim",!0);A(D,U,de,"⊥","\\perp");A(D,U,de,"⪯","\\preceq",!0);A(D,U,de,"⪰","\\succeq",!0);A(D,U,de,"≃","\\simeq",!0);A(D,U,de,"∣","\\mid",!0);A(D,U,de,"≪","\\ll",!0);A(D,U,de,"≫","\\gg",!0);A(D,U,de,"≍","\\asymp",!0);A(D,U,de,"∥","\\parallel");A(D,U,de,"⋈","\\bowtie",!0);A(D,U,de,"⌣","\\smile",!0);A(D,U,de,"⊑","\\sqsubseteq",!0);A(D,U,de,"⊒","\\sqsupseteq",!0);A(D,U,de,"≐","\\doteq",!0);A(D,U,de,"⌢","\\frown",!0);A(D,U,de,"∋","\\ni",!0);A(D,U,de,"∝","\\propto",!0);A(D,U,de,"⊢","\\vdash",!0);A(D,U,de,"⊣","\\dashv",!0);A(D,U,de,"∋","\\owns");A(D,U,Lv,".","\\ldotp");A(D,U,Lv,"⋅","\\cdotp");A(D,U,Lv,"⋅","·");A(mt,U,be,"⋅","·");A(D,U,be,"#","\\#");A(mt,U,be,"#","\\#");A(D,U,be,"&","\\&");A(mt,U,be,"&","\\&");A(D,U,be,"ℵ","\\aleph",!0);A(D,U,be,"∀","\\forall",!0);A(D,U,be,"ℏ","\\hbar",!0);A(D,U,be,"∃","\\exists",!0);A(D,U,be,"∇","\\nabla",!0);A(D,U,be,"♭","\\flat",!0);A(D,U,be,"ℓ","\\ell",!0);A(D,U,be,"♮","\\natural",!0);A(D,U,be,"♣","\\clubsuit",!0);A(D,U,be,"℘","\\wp",!0);A(D,U,be,"♯","\\sharp",!0);A(D,U,be,"♢","\\diamondsuit",!0);A(D,U,be,"ℜ","\\Re",!0);A(D,U,be,"♡","\\heartsuit",!0);A(D,U,be,"ℑ","\\Im",!0);A(D,U,be,"♠","\\spadesuit",!0);A(D,U,be,"§","\\S",!0);A(mt,U,be,"§","\\S");A(D,U,be,"¶","\\P",!0);A(mt,U,be,"¶","\\P");A(D,U,be,"†","\\dag");A(mt,U,be,"†","\\dag");A(mt,U,be,"†","\\textdagger");A(D,U,be,"‡","\\ddag");A(mt,U,be,"‡","\\ddag");A(mt,U,be,"‡","\\textdaggerdbl");A(D,U,Ia,"⎱","\\rmoustache",!0);A(D,U,Ll,"⎰","\\lmoustache",!0);A(D,U,Ia,"⟯","\\rgroup",!0);A(D,U,Ll,"⟮","\\lgroup",!0);A(D,U,hn,"∓","\\mp",!0);A(D,U,hn,"⊖","\\ominus",!0);A(D,U,hn,"⊎","\\uplus",!0);A(D,U,hn,"⊓","\\sqcap",!0);A(D,U,hn,"∗","\\ast");A(D,U,hn,"⊔","\\sqcup",!0);A(D,U,hn,"◯","\\bigcirc",!0);A(D,U,hn,"∙","\\bullet",!0);A(D,U,hn,"‡","\\ddagger");A(D,U,hn,"≀","\\wr",!0);A(D,U,hn,"⨿","\\amalg");A(D,U,hn,"&","\\And");A(D,U,de,"⟵","\\longleftarrow",!0);A(D,U,de,"⇐","\\Leftarrow",!0);A(D,U,de,"⟸","\\Longleftarrow",!0);A(D,U,de,"⟶","\\longrightarrow",!0);A(D,U,de,"⇒","\\Rightarrow",!0);A(D,U,de,"⟹","\\Longrightarrow",!0);A(D,U,de,"↔","\\leftrightarrow",!0);A(D,U,de,"⟷","\\longleftrightarrow",!0);A(D,U,de,"⇔","\\Leftrightarrow",!0);A(D,U,de,"⟺","\\Longleftrightarrow",!0);A(D,U,de,"↦","\\mapsto",!0);A(D,U,de,"⟼","\\longmapsto",!0);A(D,U,de,"↗","\\nearrow",!0);A(D,U,de,"↩","\\hookleftarrow",!0);A(D,U,de,"↪","\\hookrightarrow",!0);A(D,U,de,"↘","\\searrow",!0);A(D,U,de,"↼","\\leftharpoonup",!0);A(D,U,de,"⇀","\\rightharpoonup",!0);A(D,U,de,"↙","\\swarrow",!0);A(D,U,de,"↽","\\leftharpoondown",!0);A(D,U,de,"⇁","\\rightharpoondown",!0);A(D,U,de,"↖","\\nwarrow",!0);A(D,U,de,"⇌","\\rightleftharpoons",!0);A(D,ce,de,"≮","\\nless",!0);A(D,ce,de,"","\\@nleqslant");A(D,ce,de,"","\\@nleqq");A(D,ce,de,"⪇","\\lneq",!0);A(D,ce,de,"≨","\\lneqq",!0);A(D,ce,de,"","\\@lvertneqq");A(D,ce,de,"⋦","\\lnsim",!0);A(D,ce,de,"⪉","\\lnapprox",!0);A(D,ce,de,"⊀","\\nprec",!0);A(D,ce,de,"⋠","\\npreceq",!0);A(D,ce,de,"⋨","\\precnsim",!0);A(D,ce,de,"⪹","\\precnapprox",!0);A(D,ce,de,"≁","\\nsim",!0);A(D,ce,de,"","\\@nshortmid");A(D,ce,de,"∤","\\nmid",!0);A(D,ce,de,"⊬","\\nvdash",!0);A(D,ce,de,"⊭","\\nvDash",!0);A(D,ce,de,"⋪","\\ntriangleleft");A(D,ce,de,"⋬","\\ntrianglelefteq",!0);A(D,ce,de,"⊊","\\subsetneq",!0);A(D,ce,de,"","\\@varsubsetneq");A(D,ce,de,"⫋","\\subsetneqq",!0);A(D,ce,de,"","\\@varsubsetneqq");A(D,ce,de,"≯","\\ngtr",!0);A(D,ce,de,"","\\@ngeqslant");A(D,ce,de,"","\\@ngeqq");A(D,ce,de,"⪈","\\gneq",!0);A(D,ce,de,"≩","\\gneqq",!0);A(D,ce,de,"","\\@gvertneqq");A(D,ce,de,"⋧","\\gnsim",!0);A(D,ce,de,"⪊","\\gnapprox",!0);A(D,ce,de,"⊁","\\nsucc",!0);A(D,ce,de,"⋡","\\nsucceq",!0);A(D,ce,de,"⋩","\\succnsim",!0);A(D,ce,de,"⪺","\\succnapprox",!0);A(D,ce,de,"≆","\\ncong",!0);A(D,ce,de,"","\\@nshortparallel");A(D,ce,de,"∦","\\nparallel",!0);A(D,ce,de,"⊯","\\nVDash",!0);A(D,ce,de,"⋫","\\ntriangleright");A(D,ce,de,"⋭","\\ntrianglerighteq",!0);A(D,ce,de,"","\\@nsupseteqq");A(D,ce,de,"⊋","\\supsetneq",!0);A(D,ce,de,"","\\@varsupsetneq");A(D,ce,de,"⫌","\\supsetneqq",!0);A(D,ce,de,"","\\@varsupsetneqq");A(D,ce,de,"⊮","\\nVdash",!0);A(D,ce,de,"⪵","\\precneqq",!0);A(D,ce,de,"⪶","\\succneqq",!0);A(D,ce,de,"","\\@nsubseteqq");A(D,ce,hn,"⊴","\\unlhd");A(D,ce,hn,"⊵","\\unrhd");A(D,ce,de,"↚","\\nleftarrow",!0);A(D,ce,de,"↛","\\nrightarrow",!0);A(D,ce,de,"⇍","\\nLeftarrow",!0);A(D,ce,de,"⇏","\\nRightarrow",!0);A(D,ce,de,"↮","\\nleftrightarrow",!0);A(D,ce,de,"⇎","\\nLeftrightarrow",!0);A(D,ce,de,"△","\\vartriangle");A(D,ce,be,"ℏ","\\hslash");A(D,ce,be,"▽","\\triangledown");A(D,ce,be,"◊","\\lozenge");A(D,ce,be,"Ⓢ","\\circledS");A(D,ce,be,"®","\\circledR");A(mt,ce,be,"®","\\circledR");A(D,ce,be,"∡","\\measuredangle",!0);A(D,ce,be,"∄","\\nexists");A(D,ce,be,"℧","\\mho");A(D,ce,be,"Ⅎ","\\Finv",!0);A(D,ce,be,"⅁","\\Game",!0);A(D,ce,be,"‵","\\backprime");A(D,ce,be,"▲","\\blacktriangle");A(D,ce,be,"▼","\\blacktriangledown");A(D,ce,be,"■","\\blacksquare");A(D,ce,be,"⧫","\\blacklozenge");A(D,ce,be,"★","\\bigstar");A(D,ce,be,"∢","\\sphericalangle",!0);A(D,ce,be,"∁","\\complement",!0);A(D,ce,be,"ð","\\eth",!0);A(mt,U,be,"ð","ð");A(D,ce,be,"╱","\\diagup");A(D,ce,be,"╲","\\diagdown");A(D,ce,be,"□","\\square");A(D,ce,be,"□","\\Box");A(D,ce,be,"◊","\\Diamond");A(D,ce,be,"¥","\\yen",!0);A(mt,ce,be,"¥","\\yen",!0);A(D,ce,be,"✓","\\checkmark",!0);A(mt,ce,be,"✓","\\checkmark");A(D,ce,be,"ℶ","\\beth",!0);A(D,ce,be,"ℸ","\\daleth",!0);A(D,ce,be,"ℷ","\\gimel",!0);A(D,ce,be,"ϝ","\\digamma",!0);A(D,ce,be,"ϰ","\\varkappa");A(D,ce,Ll,"┌","\\@ulcorner",!0);A(D,ce,Ia,"┐","\\@urcorner",!0);A(D,ce,Ll,"└","\\@llcorner",!0);A(D,ce,Ia,"┘","\\@lrcorner",!0);A(D,ce,de,"≦","\\leqq",!0);A(D,ce,de,"⩽","\\leqslant",!0);A(D,ce,de,"⪕","\\eqslantless",!0);A(D,ce,de,"≲","\\lesssim",!0);A(D,ce,de,"⪅","\\lessapprox",!0);A(D,ce,de,"≊","\\approxeq",!0);A(D,ce,hn,"⋖","\\lessdot");A(D,ce,de,"⋘","\\lll",!0);A(D,ce,de,"≶","\\lessgtr",!0);A(D,ce,de,"⋚","\\lesseqgtr",!0);A(D,ce,de,"⪋","\\lesseqqgtr",!0);A(D,ce,de,"≑","\\doteqdot");A(D,ce,de,"≓","\\risingdotseq",!0);A(D,ce,de,"≒","\\fallingdotseq",!0);A(D,ce,de,"∽","\\backsim",!0);A(D,ce,de,"⋍","\\backsimeq",!0);A(D,ce,de,"⫅","\\subseteqq",!0);A(D,ce,de,"⋐","\\Subset",!0);A(D,ce,de,"⊏","\\sqsubset",!0);A(D,ce,de,"≼","\\preccurlyeq",!0);A(D,ce,de,"⋞","\\curlyeqprec",!0);A(D,ce,de,"≾","\\precsim",!0);A(D,ce,de,"⪷","\\precapprox",!0);A(D,ce,de,"⊲","\\vartriangleleft");A(D,ce,de,"⊴","\\trianglelefteq");A(D,ce,de,"⊨","\\vDash",!0);A(D,ce,de,"⊪","\\Vvdash",!0);A(D,ce,de,"⌣","\\smallsmile");A(D,ce,de,"⌢","\\smallfrown");A(D,ce,de,"≏","\\bumpeq",!0);A(D,ce,de,"≎","\\Bumpeq",!0);A(D,ce,de,"≧","\\geqq",!0);A(D,ce,de,"⩾","\\geqslant",!0);A(D,ce,de,"⪖","\\eqslantgtr",!0);A(D,ce,de,"≳","\\gtrsim",!0);A(D,ce,de,"⪆","\\gtrapprox",!0);A(D,ce,hn,"⋗","\\gtrdot");A(D,ce,de,"⋙","\\ggg",!0);A(D,ce,de,"≷","\\gtrless",!0);A(D,ce,de,"⋛","\\gtreqless",!0);A(D,ce,de,"⪌","\\gtreqqless",!0);A(D,ce,de,"≖","\\eqcirc",!0);A(D,ce,de,"≗","\\circeq",!0);A(D,ce,de,"≜","\\triangleq",!0);A(D,ce,de,"∼","\\thicksim");A(D,ce,de,"≈","\\thickapprox");A(D,ce,de,"⫆","\\supseteqq",!0);A(D,ce,de,"⋑","\\Supset",!0);A(D,ce,de,"⊐","\\sqsupset",!0);A(D,ce,de,"≽","\\succcurlyeq",!0);A(D,ce,de,"⋟","\\curlyeqsucc",!0);A(D,ce,de,"≿","\\succsim",!0);A(D,ce,de,"⪸","\\succapprox",!0);A(D,ce,de,"⊳","\\vartriangleright");A(D,ce,de,"⊵","\\trianglerighteq");A(D,ce,de,"⊩","\\Vdash",!0);A(D,ce,de,"∣","\\shortmid");A(D,ce,de,"∥","\\shortparallel");A(D,ce,de,"≬","\\between",!0);A(D,ce,de,"⋔","\\pitchfork",!0);A(D,ce,de,"∝","\\varpropto");A(D,ce,de,"◀","\\blacktriangleleft");A(D,ce,de,"∴","\\therefore",!0);A(D,ce,de,"∍","\\backepsilon");A(D,ce,de,"▶","\\blacktriangleright");A(D,ce,de,"∵","\\because",!0);A(D,ce,de,"⋘","\\llless");A(D,ce,de,"⋙","\\gggtr");A(D,ce,hn,"⊲","\\lhd");A(D,ce,hn,"⊳","\\rhd");A(D,ce,de,"≂","\\eqsim",!0);A(D,U,de,"⋈","\\Join");A(D,ce,de,"≑","\\Doteq",!0);A(D,ce,hn,"∔","\\dotplus",!0);A(D,ce,hn,"∖","\\smallsetminus");A(D,ce,hn,"⋒","\\Cap",!0);A(D,ce,hn,"⋓","\\Cup",!0);A(D,ce,hn,"⩞","\\doublebarwedge",!0);A(D,ce,hn,"⊟","\\boxminus",!0);A(D,ce,hn,"⊞","\\boxplus",!0);A(D,ce,hn,"⋇","\\divideontimes",!0);A(D,ce,hn,"⋉","\\ltimes",!0);A(D,ce,hn,"⋊","\\rtimes",!0);A(D,ce,hn,"⋋","\\leftthreetimes",!0);A(D,ce,hn,"⋌","\\rightthreetimes",!0);A(D,ce,hn,"⋏","\\curlywedge",!0);A(D,ce,hn,"⋎","\\curlyvee",!0);A(D,ce,hn,"⊝","\\circleddash",!0);A(D,ce,hn,"⊛","\\circledast",!0);A(D,ce,hn,"⋅","\\centerdot");A(D,ce,hn,"⊺","\\intercal",!0);A(D,ce,hn,"⋒","\\doublecap");A(D,ce,hn,"⋓","\\doublecup");A(D,ce,hn,"⊠","\\boxtimes",!0);A(D,ce,de,"⇢","\\dashrightarrow",!0);A(D,ce,de,"⇠","\\dashleftarrow",!0);A(D,ce,de,"⇇","\\leftleftarrows",!0);A(D,ce,de,"⇆","\\leftrightarrows",!0);A(D,ce,de,"⇚","\\Lleftarrow",!0);A(D,ce,de,"↞","\\twoheadleftarrow",!0);A(D,ce,de,"↢","\\leftarrowtail",!0);A(D,ce,de,"↫","\\looparrowleft",!0);A(D,ce,de,"⇋","\\leftrightharpoons",!0);A(D,ce,de,"↶","\\curvearrowleft",!0);A(D,ce,de,"↺","\\circlearrowleft",!0);A(D,ce,de,"↰","\\Lsh",!0);A(D,ce,de,"⇈","\\upuparrows",!0);A(D,ce,de,"↿","\\upharpoonleft",!0);A(D,ce,de,"⇃","\\downharpoonleft",!0);A(D,U,de,"⊶","\\origof",!0);A(D,U,de,"⊷","\\imageof",!0);A(D,ce,de,"⊸","\\multimap",!0);A(D,ce,de,"↭","\\leftrightsquigarrow",!0);A(D,ce,de,"⇉","\\rightrightarrows",!0);A(D,ce,de,"⇄","\\rightleftarrows",!0);A(D,ce,de,"↠","\\twoheadrightarrow",!0);A(D,ce,de,"↣","\\rightarrowtail",!0);A(D,ce,de,"↬","\\looparrowright",!0);A(D,ce,de,"↷","\\curvearrowright",!0);A(D,ce,de,"↻","\\circlearrowright",!0);A(D,ce,de,"↱","\\Rsh",!0);A(D,ce,de,"⇊","\\downdownarrows",!0);A(D,ce,de,"↾","\\upharpoonright",!0);A(D,ce,de,"⇂","\\downharpoonright",!0);A(D,ce,de,"⇝","\\rightsquigarrow",!0);A(D,ce,de,"⇝","\\leadsto");A(D,ce,de,"⇛","\\Rrightarrow",!0);A(D,ce,de,"↾","\\restriction");A(D,U,be,"‘","`");A(D,U,be,"$","\\$");A(mt,U,be,"$","\\$");A(mt,U,be,"$","\\textdollar");A(D,U,be,"%","\\%");A(mt,U,be,"%","\\%");A(D,U,be,"_","\\_");A(mt,U,be,"_","\\_");A(mt,U,be,"_","\\textunderscore");A(D,U,be,"∠","\\angle",!0);A(D,U,be,"∞","\\infty",!0);A(D,U,be,"′","\\prime");A(D,U,be,"△","\\triangle");A(D,U,be,"Γ","\\Gamma",!0);A(D,U,be,"Δ","\\Delta",!0);A(D,U,be,"Θ","\\Theta",!0);A(D,U,be,"Λ","\\Lambda",!0);A(D,U,be,"Ξ","\\Xi",!0);A(D,U,be,"Π","\\Pi",!0);A(D,U,be,"Σ","\\Sigma",!0);A(D,U,be,"Υ","\\Upsilon",!0);A(D,U,be,"Φ","\\Phi",!0);A(D,U,be,"Ψ","\\Psi",!0);A(D,U,be,"Ω","\\Omega",!0);A(D,U,be,"A","Α");A(D,U,be,"B","Β");A(D,U,be,"E","Ε");A(D,U,be,"Z","Ζ");A(D,U,be,"H","Η");A(D,U,be,"I","Ι");A(D,U,be,"K","Κ");A(D,U,be,"M","Μ");A(D,U,be,"N","Ν");A(D,U,be,"O","Ο");A(D,U,be,"P","Ρ");A(D,U,be,"T","Τ");A(D,U,be,"X","Χ");A(D,U,be,"¬","\\neg",!0);A(D,U,be,"¬","\\lnot");A(D,U,be,"⊤","\\top");A(D,U,be,"⊥","\\bot");A(D,U,be,"∅","\\emptyset");A(D,ce,be,"∅","\\varnothing");A(D,U,Fn,"α","\\alpha",!0);A(D,U,Fn,"β","\\beta",!0);A(D,U,Fn,"γ","\\gamma",!0);A(D,U,Fn,"δ","\\delta",!0);A(D,U,Fn,"ϵ","\\epsilon",!0);A(D,U,Fn,"ζ","\\zeta",!0);A(D,U,Fn,"η","\\eta",!0);A(D,U,Fn,"θ","\\theta",!0);A(D,U,Fn,"ι","\\iota",!0);A(D,U,Fn,"κ","\\kappa",!0);A(D,U,Fn,"λ","\\lambda",!0);A(D,U,Fn,"μ","\\mu",!0);A(D,U,Fn,"ν","\\nu",!0);A(D,U,Fn,"ξ","\\xi",!0);A(D,U,Fn,"ο","\\omicron",!0);A(D,U,Fn,"π","\\pi",!0);A(D,U,Fn,"ρ","\\rho",!0);A(D,U,Fn,"σ","\\sigma",!0);A(D,U,Fn,"τ","\\tau",!0);A(D,U,Fn,"υ","\\upsilon",!0);A(D,U,Fn,"ϕ","\\phi",!0);A(D,U,Fn,"χ","\\chi",!0);A(D,U,Fn,"ψ","\\psi",!0);A(D,U,Fn,"ω","\\omega",!0);A(D,U,Fn,"ε","\\varepsilon",!0);A(D,U,Fn,"ϑ","\\vartheta",!0);A(D,U,Fn,"ϖ","\\varpi",!0);A(D,U,Fn,"ϱ","\\varrho",!0);A(D,U,Fn,"ς","\\varsigma",!0);A(D,U,Fn,"φ","\\varphi",!0);A(D,U,hn,"∗","*",!0);A(D,U,hn,"+","+");A(D,U,hn,"−","-",!0);A(D,U,hn,"⋅","\\cdot",!0);A(D,U,hn,"∘","\\circ",!0);A(D,U,hn,"÷","\\div",!0);A(D,U,hn,"±","\\pm",!0);A(D,U,hn,"×","\\times",!0);A(D,U,hn,"∩","\\cap",!0);A(D,U,hn,"∪","\\cup",!0);A(D,U,hn,"∖","\\setminus",!0);A(D,U,hn,"∧","\\land");A(D,U,hn,"∨","\\lor");A(D,U,hn,"∧","\\wedge",!0);A(D,U,hn,"∨","\\vee",!0);A(D,U,be,"√","\\surd");A(D,U,Ll,"⟨","\\langle",!0);A(D,U,Ll,"∣","\\lvert");A(D,U,Ll,"∥","\\lVert");A(D,U,Ia,"?","?");A(D,U,Ia,"!","!");A(D,U,Ia,"⟩","\\rangle",!0);A(D,U,Ia,"∣","\\rvert");A(D,U,Ia,"∥","\\rVert");A(D,U,de,"=","=");A(D,U,de,":",":");A(D,U,de,"≈","\\approx",!0);A(D,U,de,"≅","\\cong",!0);A(D,U,de,"≥","\\ge");A(D,U,de,"≥","\\geq",!0);A(D,U,de,"←","\\gets");A(D,U,de,">","\\gt",!0);A(D,U,de,"∈","\\in",!0);A(D,U,de,"","\\@not");A(D,U,de,"⊂","\\subset",!0);A(D,U,de,"⊃","\\supset",!0);A(D,U,de,"⊆","\\subseteq",!0);A(D,U,de,"⊇","\\supseteq",!0);A(D,ce,de,"⊈","\\nsubseteq",!0);A(D,ce,de,"⊉","\\nsupseteq",!0);A(D,U,de,"⊨","\\models");A(D,U,de,"←","\\leftarrow",!0);A(D,U,de,"≤","\\le");A(D,U,de,"≤","\\leq",!0);A(D,U,de,"<","\\lt",!0);A(D,U,de,"→","\\rightarrow",!0);A(D,U,de,"→","\\to");A(D,ce,de,"≱","\\ngeq",!0);A(D,ce,de,"≰","\\nleq",!0);A(D,U,ch," ","\\ ");A(D,U,ch," ","\\space");A(D,U,ch," ","\\nobreakspace");A(mt,U,ch," ","\\ ");A(mt,U,ch," "," ");A(mt,U,ch," ","\\space");A(mt,U,ch," ","\\nobreakspace");A(D,U,ch,"","\\nobreak");A(D,U,ch,"","\\allowbreak");A(D,U,Lv,",",",");A(D,U,Lv,";",";");A(D,ce,hn,"⊼","\\barwedge",!0);A(D,ce,hn,"⊻","\\veebar",!0);A(D,U,hn,"⊙","\\odot",!0);A(D,U,hn,"⊕","\\oplus",!0);A(D,U,hn,"⊗","\\otimes",!0);A(D,U,be,"∂","\\partial",!0);A(D,U,hn,"⊘","\\oslash",!0);A(D,ce,hn,"⊚","\\circledcirc",!0);A(D,ce,hn,"⊡","\\boxdot",!0);A(D,U,hn,"△","\\bigtriangleup");A(D,U,hn,"▽","\\bigtriangledown");A(D,U,hn,"†","\\dagger");A(D,U,hn,"⋄","\\diamond");A(D,U,hn,"⋆","\\star");A(D,U,hn,"◃","\\triangleleft");A(D,U,hn,"▹","\\triangleright");A(D,U,Ll,"{","\\{");A(mt,U,be,"{","\\{");A(mt,U,be,"{","\\textbraceleft");A(D,U,Ia,"}","\\}");A(mt,U,be,"}","\\}");A(mt,U,be,"}","\\textbraceright");A(D,U,Ll,"{","\\lbrace");A(D,U,Ia,"}","\\rbrace");A(D,U,Ll,"[","\\lbrack",!0);A(mt,U,be,"[","\\lbrack",!0);A(D,U,Ia,"]","\\rbrack",!0);A(mt,U,be,"]","\\rbrack",!0);A(D,U,Ll,"(","\\lparen",!0);A(D,U,Ia,")","\\rparen",!0);A(mt,U,be,"<","\\textless",!0);A(mt,U,be,">","\\textgreater",!0);A(D,U,Ll,"⌊","\\lfloor",!0);A(D,U,Ia,"⌋","\\rfloor",!0);A(D,U,Ll,"⌈","\\lceil",!0);A(D,U,Ia,"⌉","\\rceil",!0);A(D,U,be,"\\","\\backslash");A(D,U,be,"∣","|");A(D,U,be,"∣","\\vert");A(mt,U,be,"|","\\textbar",!0);A(D,U,be,"∥","\\|");A(D,U,be,"∥","\\Vert");A(mt,U,be,"∥","\\textbardbl");A(mt,U,be,"~","\\textasciitilde");A(mt,U,be,"\\","\\textbackslash");A(mt,U,be,"^","\\textasciicircum");A(D,U,de,"↑","\\uparrow",!0);A(D,U,de,"⇑","\\Uparrow",!0);A(D,U,de,"↓","\\downarrow",!0);A(D,U,de,"⇓","\\Downarrow",!0);A(D,U,de,"↕","\\updownarrow",!0);A(D,U,de,"⇕","\\Updownarrow",!0);A(D,U,Vi,"∐","\\coprod");A(D,U,Vi,"⋁","\\bigvee");A(D,U,Vi,"⋀","\\bigwedge");A(D,U,Vi,"⨄","\\biguplus");A(D,U,Vi,"⋂","\\bigcap");A(D,U,Vi,"⋃","\\bigcup");A(D,U,Vi,"∫","\\int");A(D,U,Vi,"∫","\\intop");A(D,U,Vi,"∬","\\iint");A(D,U,Vi,"∭","\\iiint");A(D,U,Vi,"∏","\\prod");A(D,U,Vi,"∑","\\sum");A(D,U,Vi,"⨂","\\bigotimes");A(D,U,Vi,"⨁","\\bigoplus");A(D,U,Vi,"⨀","\\bigodot");A(D,U,Vi,"∮","\\oint");A(D,U,Vi,"∯","\\oiint");A(D,U,Vi,"∰","\\oiiint");A(D,U,Vi,"⨆","\\bigsqcup");A(D,U,Vi,"∫","\\smallint");A(mt,U,W1,"…","\\textellipsis");A(D,U,W1,"…","\\mathellipsis");A(mt,U,W1,"…","\\ldots",!0);A(D,U,W1,"…","\\ldots",!0);A(D,U,W1,"⋯","\\@cdots",!0);A(D,U,W1,"⋱","\\ddots",!0);A(D,U,be,"⋮","\\varvdots");A(mt,U,be,"⋮","\\varvdots");A(D,U,li,"ˊ","\\acute");A(D,U,li,"ˋ","\\grave");A(D,U,li,"¨","\\ddot");A(D,U,li,"~","\\tilde");A(D,U,li,"ˉ","\\bar");A(D,U,li,"˘","\\breve");A(D,U,li,"ˇ","\\check");A(D,U,li,"^","\\hat");A(D,U,li,"⃗","\\vec");A(D,U,li,"˙","\\dot");A(D,U,li,"˚","\\mathring");A(D,U,Fn,"","\\@imath");A(D,U,Fn,"","\\@jmath");A(D,U,be,"ı","ı");A(D,U,be,"ȷ","ȷ");A(mt,U,be,"ı","\\i",!0);A(mt,U,be,"ȷ","\\j",!0);A(mt,U,be,"ß","\\ss",!0);A(mt,U,be,"æ","\\ae",!0);A(mt,U,be,"œ","\\oe",!0);A(mt,U,be,"ø","\\o",!0);A(mt,U,be,"Æ","\\AE",!0);A(mt,U,be,"Œ","\\OE",!0);A(mt,U,be,"Ø","\\O",!0);A(mt,U,li,"ˊ","\\'");A(mt,U,li,"ˋ","\\`");A(mt,U,li,"ˆ","\\^");A(mt,U,li,"˜","\\~");A(mt,U,li,"ˉ","\\=");A(mt,U,li,"˘","\\u");A(mt,U,li,"˙","\\.");A(mt,U,li,"¸","\\c");A(mt,U,li,"˚","\\r");A(mt,U,li,"ˇ","\\v");A(mt,U,li,"¨",'\\"');A(mt,U,li,"˝","\\H");A(mt,U,li,"◯","\\textcircled");var DY={"--":!0,"---":!0,"``":!0,"''":!0};A(mt,U,be,"–","--",!0);A(mt,U,be,"–","\\textendash");A(mt,U,be,"—","---",!0);A(mt,U,be,"—","\\textemdash");A(mt,U,be,"‘","`",!0);A(mt,U,be,"‘","\\textquoteleft");A(mt,U,be,"’","'",!0);A(mt,U,be,"’","\\textquoteright");A(mt,U,be,"“","``",!0);A(mt,U,be,"“","\\textquotedblleft");A(mt,U,be,"”","''",!0);A(mt,U,be,"”","\\textquotedblright");A(D,U,be,"°","\\degree",!0);A(mt,U,be,"°","\\degree");A(mt,U,be,"°","\\textdegree",!0);A(D,U,be,"£","\\pounds");A(D,U,be,"£","\\mathsterling",!0);A(mt,U,be,"£","\\pounds");A(mt,U,be,"£","\\textsterling",!0);A(D,ce,be,"✠","\\maltese");A(mt,ce,be,"✠","\\maltese");var GO='0123456789/@."';for(var I5=0;I5<GO.length;I5++){var KO=GO.charAt(I5);A(D,U,be,KO,KO)}var YO='0123456789!@*()-=+";:?/.,';for(var R5=0;R5<YO.length;R5++){var XO=YO.charAt(R5);A(mt,U,be,XO,XO)}var dS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var D5=0;D5<dS.length;D5++){var dk=dS.charAt(D5);A(D,U,Fn,dk,dk),A(mt,U,be,dk,dk)}A(D,ce,be,"C","ℂ");A(mt,ce,be,"C","ℂ");A(D,ce,be,"H","ℍ");A(mt,ce,be,"H","ℍ");A(D,ce,be,"N","ℕ");A(mt,ce,be,"N","ℕ");A(D,ce,be,"P","ℙ");A(mt,ce,be,"P","ℙ");A(D,ce,be,"Q","ℚ");A(mt,ce,be,"Q","ℚ");A(D,ce,be,"R","ℝ");A(mt,ce,be,"R","ℝ");A(D,ce,be,"Z","ℤ");A(mt,ce,be,"Z","ℤ");A(D,U,Fn,"h","ℎ");A(mt,U,Fn,"h","ℎ");var Yn;for(var pa=0;pa<dS.length;pa++){var yi=dS.charAt(pa);Yn=String.fromCharCode(55349,56320+pa),A(D,U,Fn,yi,Yn),A(mt,U,be,yi,Yn),Yn=String.fromCharCode(55349,56372+pa),A(D,U,Fn,yi,Yn),A(mt,U,be,yi,Yn),Yn=String.fromCharCode(55349,56424+pa),A(D,U,Fn,yi,Yn),A(mt,U,be,yi,Yn),Yn=String.fromCharCode(55349,56580+pa),A(D,U,Fn,yi,Yn),A(mt,U,be,yi,Yn),Yn=String.fromCharCode(55349,56684+pa),A(D,U,Fn,yi,Yn),A(mt,U,be,yi,Yn),Yn=String.fromCharCode(55349,56736+pa),A(D,U,Fn,yi,Yn),A(mt,U,be,yi,Yn),Yn=String.fromCharCode(55349,56788+pa),A(D,U,Fn,yi,Yn),A(mt,U,be,yi,Yn),Yn=String.fromCharCode(55349,56840+pa),A(D,U,Fn,yi,Yn),A(mt,U,be,yi,Yn),Yn=String.fromCharCode(55349,56944+pa),A(D,U,Fn,yi,Yn),A(mt,U,be,yi,Yn),pa<26&&(Yn=String.fromCharCode(55349,56632+pa),A(D,U,Fn,yi,Yn),A(mt,U,be,yi,Yn),Yn=String.fromCharCode(55349,56476+pa),A(D,U,Fn,yi,Yn),A(mt,U,be,yi,Yn))}Yn="𝕜";A(D,U,Fn,"k",Yn);A(mt,U,be,"k",Yn);for(var Pm=0;Pm<10;Pm++){var Ih=Pm.toString();Yn=String.fromCharCode(55349,57294+Pm),A(D,U,Fn,Ih,Yn),A(mt,U,be,Ih,Yn),Yn=String.fromCharCode(55349,57314+Pm),A(D,U,Fn,Ih,Yn),A(mt,U,be,Ih,Yn),Yn=String.fromCharCode(55349,57324+Pm),A(D,U,Fn,Ih,Yn),A(mt,U,be,Ih,Yn),Yn=String.fromCharCode(55349,57334+Pm),A(D,U,Fn,Ih,Yn),A(mt,U,be,Ih,Yn)}var mE="ÐÞþ";for(var L5=0;L5<mE.length;L5++){var hk=mE.charAt(L5);A(D,U,Fn,hk,hk),A(mt,U,be,hk,hk)}var pE={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},QO={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},JO={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},Zke={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},ep={mathClass:"",textClass:"",font:""},ZO={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},eB={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},tB={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},gE={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},bE={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},nB={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},yE={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},sB=[pE,pE,QO,QO,JO,JO,Zke,ep,ep,ep,ZO,ZO,eB,eB,tB,tB,gE,gE,bE,bE,nB,nB,ep,ep,yE,yE],e_e=[pE,ep,gE,bE,yE],t_e=e=>{var t=e.charCodeAt(0),n=e.charCodeAt(1),s=(t-55296)*1024+(n-56320)+65536;if(119808<=s&&s<120484){var r=Math.floor((s-119808)/26);return sB[r]}else if(120782<=s&&s<=120831){var i=Math.floor((s-120782)/10);return e_e[i]}else{if(s===120485||s===120486)return sB[0];if(120486<s&&s<120782)return ep;throw new kt("Unsupported character: "+e)}},l3=function(t,n,s){if(oi[s][t]){var r=oi[s][t].replace;r&&(t=r)}return{value:t,metrics:Rj(t,n,s)}},va=function(t,n,s,r,i){var o=l3(t,n,s),a=o.metrics;t=o.value;var c;if(a){var u=a.italic;(s==="text"||r&&r.font==="mathit")&&(u=0),c=new Il(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 '"+s+"'")),c=new Il(t,0,0,0,0,0,i);if(r){c.maxFontSize=r.sizeMultiplier,r.style.isTight()&&c.classes.push("mtight");var d=r.getColor();d&&(c.style.color=d)}return c},Dj=function(t,n,s,r){return r===void 0&&(r=[]),s.font==="boldsymbol"&&l3(t,"Main-Bold",n).metrics?va(t,"Main-Bold",n,s,r.concat(["mathbf"])):t==="\\"||oi[n][t].font==="main"?va(t,"Main-Regular",n,s,r):va(t,"AMS-Regular",n,s,r.concat(["amsrm"]))},n_e=function(t,n,s){return s!=="textord"&&l3(t,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},c3=function(t,n,s){var r=t.mode,i=t.text,o=["mord"],{font:a,fontFamily:c,fontWeight:u,fontShape:d}=n,h=r==="math"||r==="text"&&!!a,m=h?a:c,p="",g="";if(i.charCodeAt(0)===55349){var b=t_e(i);p=b.font,g=b[r+"Class"]}if(p)return va(i,p,r,n,o.concat(g));if(m){var v,x;if(m==="boldsymbol"){var y=n_e(i,r,s);v=y.fontName,x=[y.fontClass]}else h?(v=xE[a].fontName,x=[a]):(v=fk(c,u,d),x=[c,u,d]);if(l3(i,v,r).metrics)return va(i,v,r,n,o.concat(x));if(DY.hasOwnProperty(i)&&v.slice(0,10)==="Typewriter"){for(var w=[],k=0;k<i.length;k++)w.push(va(i[k],v,r,n,o.concat(x)));return uh(w)}}if(s==="mathord")return va(i,"Math-Italic",r,n,o.concat(["mathnormal"]));if(s==="textord"){var T=oi[r][i]&&oi[r][i].font;if(T==="ams"){var _=fk("amsrm",u,d);return va(i,_,r,n,o.concat("amsrm",u,d))}else if(T==="main"||!T){var C=fk("textrm",u,d);return va(i,C,r,n,o.concat(u,d))}else{var S=fk(T,u,d);return va(i,S,r,n,o.concat(S,u,d))}}else throw new Error("unexpected type: "+s+" in makeOrd")},s_e=(e,t)=>{if(Df(e.classes)!==Df(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize||e.italic!==0&&e.hasClass("mathnormal"))return!1;if(e.classes.length===1){var n=e.classes[0];if(n==="mbin"||n==="mord")return!1}for(var s of Object.keys(e.style))if(e.style[s]!==t.style[s])return!1;for(var r of Object.keys(t.style))if(e.style[r]!==t.style[r])return!1;return!0},LY=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],s=e[t+1];n instanceof Il&&s instanceof Il&&s_e(n,s)&&(n.text+=s.text,n.height=Math.max(n.height,s.height),n.depth=Math.max(n.depth,s.depth),n.italic=s.italic,e.splice(t+1,1),t--)}return e},Lj=function(t){for(var n=0,s=0,r=0,i=0;i<t.children.length;i++){var o=t.children[i];o.height>n&&(n=o.height),o.depth>s&&(s=o.depth),o.maxFontSize>r&&(r=o.maxFontSize)}t.height=n,t.depth=s,t.maxFontSize=r},vt=function(t,n,s,r){var i=new V1(t,n,s,r);return Lj(i),i},Pf=(e,t,n,s)=>new V1(e,t,n,s),o1=function(t,n,s){var r=vt([t],[],n);return r.height=Math.max(s||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),r.style.borderBottomWidth=jt(r.height),r.maxFontSize=1,r},r_e=function(t,n,s,r){var i=new a3(t,n,s,r);return Lj(i),i},uh=function(t){var n=new U1(t);return Lj(n),n},a1=function(t,n){return t instanceof U1?vt([],[t],n):t},i_e=function(t){if(t.positionType==="individualShift"){for(var n=t.children,s=[n[0]],r=-n[0].shift-n[0].elem.depth,i=r,o=1;o<n.length;o++){var a=-n[o].shift-i-n[o].elem.depth,c=a-(n[o-1].elem.height+n[o-1].elem.depth);i=i+a,s.push({type:"kern",size:c}),s.push(n[o])}return{children:s,depth:r}}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}},fr=function(t,n){for(var{children:s,depth:r}=i_e(t),i=0,o=0;o<s.length;o++){var a=s[o];if(a.type==="elem"){var c=a.elem;i=Math.max(i,c.maxFontSize,c.height)}}i+=2;var u=vt(["pstrut"],[]);u.style.height=jt(i);for(var d=[],h=r,m=r,p=r,g=0;g<s.length;g++){var b=s[g];if(b.type==="kern")p+=b.size;else{var v=b.elem,x=b.wrapperClasses||[],y=b.wrapperStyle||{},w=vt(x,[u,v],void 0,y);w.style.top=jt(-i-p-v.depth),b.marginLeft&&(w.style.marginLeft=b.marginLeft),b.marginRight&&(w.style.marginRight=b.marginRight),d.push(w),p+=v.height+v.depth}h=Math.min(h,p),m=Math.max(m,p)}var k=vt(["vlist"],d);k.style.height=jt(m);var T;if(h<0){var _=vt([],[]),C=vt(["vlist"],[_]);C.style.height=jt(-h);var S=vt(["vlist-s"],[new Il("​")]);T=[vt(["vlist-r"],[k,S]),vt(["vlist-r"],[C])]}else T=[vt(["vlist-r"],[k])];var L=vt(["vlist-t"],T);return T.length===2&&L.classes.push("vlist-t2"),L.height=m,L.depth=-h,L},PY=(e,t)=>{var n=vt(["mspace"],[],t),s=pi(e,t);return n.style.marginRight=jt(s),n},fk=(e,t,n)=>{var s,r;switch(e){case"amsrm":s="AMS";break;case"textrm":s="Main";break;case"textsf":s="SansSerif";break;case"texttt":s="Typewriter";break;default:s=e}return t==="textbf"&&n==="textit"?r="BoldItalic":t==="textbf"?r="Bold":n==="textit"?r="Italic":r="Regular",s+"-"+r},xE={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"}},OY={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},BY=function(t,n){var[s,r,i]=OY[t],o=new Lf(s),a=new eh([o],{width:jt(r),height:jt(i),style:"width:"+jt(r),viewBox:"0 0 "+1e3*r+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),c=Pf(["overlay"],[a],n);return c.height=i,c.style.height=jt(i),c.style.width=jt(r),c},hi={number:3,unit:"mu"},Om={number:4,unit:"mu"},dd={number:5,unit:"mu"},o_e={mord:{mop:hi,mbin:Om,mrel:dd,minner:hi},mop:{mord:hi,mop:hi,mrel:dd,minner:hi},mbin:{mord:Om,mop:Om,mopen:Om,minner:Om},mrel:{mord:dd,mop:dd,mopen:dd,minner:dd},mopen:{},mclose:{mop:hi,mbin:Om,mrel:dd,minner:hi},mpunct:{mord:hi,mop:hi,mrel:dd,mopen:hi,mclose:hi,mpunct:hi,minner:hi},minner:{mord:hi,mop:hi,mbin:Om,mrel:dd,mopen:hi,mpunct:hi,minner:hi}},a_e={mord:{mop:hi},mop:{mord:hi,mop:hi},mbin:{},mrel:{},mopen:{},mclose:{mop:hi},mpunct:{},minner:{mop:hi}},$Y={},hS={},fS={};function nn(e){for(var{type:t,names:n,props:s,handler:r,htmlBuilder:i,mathmlBuilder:o}=e,a={type:t,numArgs:s.numArgs,argTypes:s.argTypes,allowedInArgument:!!s.allowedInArgument,allowedInText:!!s.allowedInText,allowedInMath:s.allowedInMath===void 0?!0:s.allowedInMath,numOptionalArgs:s.numOptionalArgs||0,infix:!!s.infix,primitive:!!s.primitive,handler:r},c=0;c<n.length;++c)$Y[n[c]]=a;t&&(i&&(hS[t]=i),o&&(fS[t]=o))}function s0(e){var{type:t,htmlBuilder:n,mathmlBuilder:s}=e;nn({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:s})}var mS=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},qi=function(t){return t.type==="ordgroup"?t.body:[t]},l_e=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),c_e=new Set(["rightmost","mrel","mclose","mpunct"]),u_e={display:ss.DISPLAY,text:ss.TEXT,script:ss.SCRIPT,scriptscript:ss.SCRIPTSCRIPT},d_e={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},oo=function(t,n,s,r){r===void 0&&(r=[null,null]);for(var i=[],o=0;o<t.length;o++){var a=pr(t[o],n);if(a instanceof U1){var c=a.children;i.push(...c)}else i.push(a)}if(LY(i),!s)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(u_e[d.style]))}var h=vt([r[0]||"leftmost"],[],n),m=vt([r[1]||"rightmost"],[],n),p=s==="root";return vE(i,(g,b)=>{var v=b.classes[0],x=g.classes[0];v==="mbin"&&c_e.has(x)?b.classes[0]="mord":x==="mbin"&&l_e.has(v)&&(g.classes[0]="mord")},{node:h},m,p),vE(i,(g,b)=>{var v,x,y=kE(b),w=kE(g),k=y&&w?g.hasClass("mtight")?(v=a_e[y])==null?void 0:v[w]:(x=o_e[y])==null?void 0:x[w]:null;if(k)return PY(k,u)},{node:h},m,p),i},vE=function(t,n,s,r,i){r&&t.push(r);for(var o=0;o<t.length;o++){var a=t[o],c=zY(a);if(c){vE(c.children,n,s,null,i);continue}var u=!a.hasClass("mspace");if(u){var d=n(a,s.node);d&&(s.insertAfter?s.insertAfter(d):(t.unshift(d),o++))}u?s.node=a:i&&a.hasClass("newline")&&(s.node=vt(["leftmost"])),s.insertAfter=(h=>m=>{t.splice(h+1,0,m),o++})(o)}r&&t.pop()},zY=function(t){return t instanceof U1||t instanceof a3||t instanceof V1&&t.hasClass("enclosing")?t:null},wE=function(t,n){var s=zY(t);if(s){var r=s.children;if(r.length){if(n==="right")return wE(r[r.length-1],"right");if(n==="left")return wE(r[0],"left")}}return t},kE=function(t,n){if(!t)return null;n&&(t=wE(t,n));var s=t.classes[0];return d_e[s]||null},Rx=function(t,n){var s=["nulldelimiter"].concat(t.baseSizingClasses());return vt(n.concat(s))},pr=function(t,n,s){if(!t)return vt();if(hS[t.type]){var r=hS[t.type](t,n);if(s&&n.size!==s.size){r=vt(n.sizingClasses(s),[r],n);var i=n.sizeMultiplier/s.sizeMultiplier;r.height*=i,r.depth*=i}return r}else throw new kt("Got group of unknown type: '"+t.type+"'")};function mk(e,t){var n=vt(["base"],e,t),s=vt(["strut"]);return s.style.height=jt(n.height+n.depth),n.depth&&(s.style.verticalAlign=jt(-n.depth)),n.children.unshift(s),n}function _E(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var s=oo(e,t,"root"),r;s.length===2&&s[1].hasClass("tag")&&(r=s.pop());for(var i=[],o=[],a=0;a<s.length;a++)if(o.push(s[a]),s[a].hasClass("mbin")||s[a].hasClass("mrel")||s[a].hasClass("allowbreak")){for(var c=!1;a<s.length-1&&s[a+1].hasClass("mspace")&&!s[a+1].hasClass("newline");)a++,o.push(s[a]),s[a].hasClass("nobreak")&&(c=!0);c||(i.push(mk(o,t)),o=[])}else s[a].hasClass("newline")&&(o.pop(),o.length>0&&(i.push(mk(o,t)),o=[]),i.push(s[a]));o.length>0&&i.push(mk(o,t));var u;n?(u=mk(oo(n,t,!0),t),u.classes=["tag"],i.push(u)):r&&i.push(r);var d=vt(["katex-html"],i);if(d.setAttribute("aria-hidden","true"),u){var h=u.children[0];h.style.height=jt(d.height+d.depth),d.depth&&(h.style.verticalAlign=jt(-d.depth))}return d}function FY(e){return new U1(e)}class Ct{constructor(t,n,s){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=t,this.attributes={},this.children=n||[],this.classes=s||[]}setAttribute(t,n){this.attributes[t]=n}getAttribute(t){return this.attributes[t]}toNode(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);this.classes.length>0&&(t.className=Df(this.classes));for(var s=0;s<this.children.length;s++)if(this.children[s]instanceof Ui&&this.children[s+1]instanceof Ui){for(var r=this.children[s].toText()+this.children[++s].toText();this.children[s+1]instanceof Ui;)r+=this.children[++s].toText();t.appendChild(new Ui(r).toNode())}else t.appendChild(this.children[s].toNode());return t}toMarkup(){var t="<"+this.type;for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(t+=" "+n+'="',t+=na(this.attributes[n]),t+='"');this.classes.length>0&&(t+=' class ="'+na(Df(this.classes))+'"'),t+=">";for(var s=0;s<this.children.length;s++)t+=this.children[s].toMarkup();return t+="</"+this.type+">",t}toText(){return this.children.map(t=>t.toText()).join("")}}let Ui=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return na(this.toText())}toText(){return this.text}};class HY{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",jt(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+jt(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var h_e=new Set(["\\imath","\\jmath"]),f_e=new Set(["mrow","mtable"]),vc=function(t,n,s){return oi[n][t]&&oi[n][t].replace&&t.charCodeAt(0)!==55349&&!(DY.hasOwnProperty(t)&&s&&(s.fontFamily&&s.fontFamily.slice(4,6)==="tt"||s.font&&s.font.slice(4,6)==="tt"))&&(t=oi[n][t].replace),new Ui(t)},Pj=function(t){return t.length===1?t[0]:new Ct("mrow",t)},m_e={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"},Oj=(e,t)=>{if(e.mode==="text"){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold"}var n=t.font;if(!n||n==="mathnormal")return null;var s=e.mode,r=m_e[n];if(r)return typeof r=="function"?r(e):r;var i=e.text;if(h_e.has(i))return null;if(oi[s][i]){var o=oi[s][i].replace;o&&(i=o)}var a=xE[n].fontName;return Rj(i,a,s)?xE[n].variant:null};function P5(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof Ui&&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 Ui&&n.text===","}else return!1}var Pl=function(t,n,s){if(t.length===1){var r=Pr(t[0],n);return s&&r instanceof Ct&&r.type==="mo"&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}for(var i=[],o,a=0;a<t.length;a++){var c=Pr(t[a],n);if(c instanceof Ct&&o instanceof Ct){if(c.type==="mtext"&&o.type==="mtext"&&c.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...c.children);continue}else if(c.type==="mn"&&o.type==="mn"){o.children.push(...c.children);continue}else if(P5(c)&&o.type==="mn"){o.children.push(...c.children);continue}else if(c.type==="mn"&&P5(o))c.children=[...o.children,...c.children],i.pop();else if((c.type==="msup"||c.type==="msub")&&c.children.length>=1&&(o.type==="mn"||P5(o))){var u=c.children[0];u instanceof Ct&&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 Ui&&d.text==="̸"&&(c.type==="mo"||c.type==="mi"||c.type==="mn")){var h=c.children[0];h instanceof Ui&&h.text.length>0&&(h.text=h.text.slice(0,1)+"̸"+h.text.slice(1),i.pop())}}}i.push(c),o=c}return i},Of=function(t,n,s){return Pj(Pl(t,n,s))},Pr=function(t,n){if(!t)return new Ct("mrow");if(fS[t.type])return fS[t.type](t,n);throw new kt("Got group of unknown type: '"+t.type+"'")};function rB(e,t,n,s,r){var i=Pl(e,n),o;i.length===1&&i[0]instanceof Ct&&f_e.has(i[0].type)?o=i[0]:o=new Ct("mrow",i);var a=new Ct("annotation",[new Ui(t)]);a.setAttribute("encoding","application/x-tex");var c=new Ct("semantics",[o,a]),u=new Ct("math",[c]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),s&&u.setAttribute("display","block");var d=r?"katex":"katex-mathml";return vt([d],[u])}var p_e=[[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]],iB=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],oB=function(t,n){return n.size<2?t:p_e[t-1][n.size-1]};class yd{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||yd.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=iB[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 yd(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:oB(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:iB[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=oB(yd.BASESIZE,t);return this.size===n&&this.textSize===yd.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!==yd.BASESIZE?["sizing","reset-size"+this.size,"size"+yd.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Jke(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}yd.BASESIZE=6;var qY=function(t){return new yd({style:t.displayMode?ss.DISPLAY:ss.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},UY=function(t,n){if(n.displayMode){var s=["katex-display"];n.leqno&&s.push("leqno"),n.fleqn&&s.push("fleqn"),t=vt(s,[t])}return t},g_e=function(t,n,s){var r=qY(s),i;if(s.output==="mathml")return rB(t,n,r,s.displayMode,!0);if(s.output==="html"){var o=_E(t,r);i=vt(["katex"],[o])}else{var a=rB(t,n,r,s.displayMode,!1),c=_E(t,r);i=vt(["katex"],[a,c])}return UY(i,s)},b_e=function(t,n,s){var r=qY(s),i=_E(t,r),o=vt(["katex"],[i]);return UY(o,s)},y_e={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":"="},u3=function(t){var n=new Ct("mo",[new Ui(y_e[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},x_e={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]},v_e=new Set(["widehat","widecheck","widetilde","utilde"]),d3=function(t,n){function s(){var a=4e5,c=t.label.slice(1);if(v_e.has(c)&&"base"in t){var u=t.base.type==="ordgroup"?t.base.body.length:1,d,h,m;if(u>5)c==="widehat"||c==="widecheck"?(d=420,a=2364,m=.42,h=c+"4"):(d=312,a=2340,m=.34,h="tilde4");else{var p=[1,1,2,2,3,3][u];c==="widehat"||c==="widecheck"?(a=[0,1062,2364,2364,2364][p],d=[0,239,300,360,420][p],m=[0,.24,.3,.3,.36,.42][p],h=c+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 Lf(h),b=new eh([g],{width:"100%",height:jt(m),viewBox:"0 0 "+a+" "+d,preserveAspectRatio:"none"});return{span:Pf([],[b],n),minWidth:0,height:m}}else{var v=[],x=x_e[c];if(!x)throw new Error('No SVG data for "'+c+'".');var[y,w,k]=x,T=k/1e3,_=y.length,C,S;if(_===1){if(x.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+c+'".');C=["hide-tail"],S=[x[3]]}else if(_===2)C=["halfarrow-left","halfarrow-right"],S=["xMinYMin","xMaxYMin"];else if(_===3)C=["brace-left","brace-center","brace-right"],S=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+_+" children.");for(var L=0;L<_;L++){var N=new Lf(y[L]),$=new eh([N],{width:"400em",height:jt(T),viewBox:"0 0 "+a+" "+k,preserveAspectRatio:S[L]+" slice"}),M=Pf([C[L]],[$],n);if(_===1)return{span:M,minWidth:w,height:T};M.style.height=jt(T),v.push(M)}return{span:vt(["stretchy"],v,n),minWidth:w,height:T}}}var{span:r,minWidth:i,height:o}=s();return r.height=o,r.style.height=jt(o),i>0&&(r.style.minWidth=jt(i)),r},w_e=function(t,n,s,r,i){var o,a=t.height+t.depth+s+r;if(/fbox|color|angl/.test(n)){if(o=vt(["stretchy",n],[],i),n==="fbox"){var c=i.color&&i.getColor();c&&(o.style.borderColor=c)}}else{var u=[];/^[bx]cancel$/.test(n)&&u.push(new fE({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&u.push(new fE({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var d=new eh(u,{width:"100%",height:jt(a)});o=Pf([],[d],i)}return o.height=a,o.style.height=jt(a),o},k_e={bin:1,close:1,inner:1,open:1,punct:1,rel:1},__e={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function S_e(e){return e in k_e}function ps(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 h3(e){var t=f3(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 f3(e){return e&&(e.type==="atom"||__e.hasOwnProperty(e.type))?e:null}var VY=e=>{if(e instanceof Il)return e;if(Qke(e)&&e.children.length===1)return VY(e.children[0])},Bj=(e,t)=>{var n,s,r;e&&e.type==="supsub"?(s=ps(e.base,"accent"),n=s.base,e.base=n,r=Xke(pr(e,t)),e.base=s):(s=ps(e,"accent"),n=s.base);var i=pr(n,t.havingCrampedStyle()),o=s.isShifty&&lh(n),a=0;if(o){var c,u;a=(c=(u=VY(i))==null?void 0:u.skew)!=null?c:0}var d=s.label==="\\c",h=d?i.height+i.depth:Math.min(i.height,t.fontMetrics().xHeight),m;if(s.isStretchy)m=d3(s,t),m=fr({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:m,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+jt(2*a)+")",marginLeft:jt(2*a)}:void 0}]});else{var p,g;s.label==="\\vec"?(p=BY("vec",t),g=OY.vec[1]):(p=c3({mode:s.mode,text:s.label},t,"textord"),p=Yke(p),p.italic=0,g=p.width,d&&(h+=p.depth)),m=vt(["accent-body"],[p]);var b=s.label==="\\textcircled";b&&(m.classes.push("accent-full"),h=i.height);var v=a;b||(v-=g/2),m.style.left=jt(v),s.label==="\\textcircled"&&(m.style.top=".2em"),m=fr({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-h},{type:"elem",elem:m}]})}var x=vt(["mord","accent"],[m],t);return r?(r.children[0]=x,r.height=Math.max(x.height,r.height),r.classes[0]="mord",r):x},WY=(e,t)=>{var n=e.isStretchy?u3(e.label):new Ct("mo",[vc(e.label,e.mode)]),s=new Ct("mover",[Pr(e.base,t),n]);return s.setAttribute("accent","true"),s},C_e=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));nn({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=mS(t[0]),s=!C_e.test(e.funcName),r=!s||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:s,isShifty:r,base:n}},htmlBuilder:Bj,mathmlBuilder:WY});nn({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var n=t[0],s=e.parser.mode;return s==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),s="text"),{type:"accent",mode:s,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:Bj,mathmlBuilder:WY});nn({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0];return{type:"accentUnder",mode:n.mode,label:s,base:r}},htmlBuilder:(e,t)=>{var n=pr(e.base,t),s=d3(e,t),r=e.label==="\\utilde"?.12:0,i=fr({positionType:"top",positionData:n.height,children:[{type:"elem",elem:s,wrapperClasses:["svg-align"]},{type:"kern",size:r},{type:"elem",elem:n}]});return vt(["mord","accentunder"],[i],t)},mathmlBuilder:(e,t)=>{var n=u3(e.label),s=new Ct("munder",[Pr(e.base,t),n]);return s.setAttribute("accentunder","true"),s}});var pk=e=>{var t=new Ct("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};nn({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:s,funcName:r}=e;return{type:"xArrow",mode:s.mode,label:r,body:t[0],below:n[0]}},htmlBuilder(e,t){var n=t.style,s=t.havingStyle(n.sup()),r=a1(pr(e.body,s,t),t),i=e.label.slice(0,2)==="\\x"?"x":"cd";r.classes.push(i+"-arrow-pad");var o;e.below&&(s=t.havingStyle(n.sub()),o=a1(pr(e.below,s,t),t),o.classes.push(i+"-arrow-pad"));var a=d3(e,t),c=-t.fontMetrics().axisHeight+.5*a.height,u=-t.fontMetrics().axisHeight-.5*a.height-.111;(r.depth>.25||e.label==="\\xleftequilibrium")&&(u-=r.depth);var d;if(o){var h=-t.fontMetrics().axisHeight+o.height+.5*a.height+.111;d=fr({positionType:"individualShift",children:[{type:"elem",elem:r,shift:u},{type:"elem",elem:a,shift:c,wrapperClasses:["svg-align"]},{type:"elem",elem:o,shift:h}]})}else d=fr({positionType:"individualShift",children:[{type:"elem",elem:r,shift:u},{type:"elem",elem:a,shift:c,wrapperClasses:["svg-align"]}]});return vt(["mrel","x-arrow"],[d],t)},mathmlBuilder(e,t){var n=u3(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var s;if(e.body){var r=pk(Pr(e.body,t));if(e.below){var i=pk(Pr(e.below,t));s=new Ct("munderover",[n,i,r])}else s=new Ct("mover",[n,r])}else if(e.below){var o=pk(Pr(e.below,t));s=new Ct("munder",[n,o])}else s=pk(),s=new Ct("mover",[n,s]);return s}});function GY(e,t){var n=oo(e.body,t,!0);return vt([e.mclass],n,t)}function KY(e,t){var n,s=Pl(e.body,t);return e.mclass==="minner"?n=new Ct("mpadded",s):e.mclass==="mord"?e.isCharacterBox?(n=s[0],n.type="mi"):n=new Ct("mi",s):(e.isCharacterBox?(n=s[0],n.type="mo"):n=new Ct("mo",s),e.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):e.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):e.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}nn({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:n,funcName:s}=e,r=t[0];return{type:"mclass",mode:n.mode,mclass:"m"+s.slice(5),body:qi(r),isCharacterBox:lh(r)}},htmlBuilder:GY,mathmlBuilder:KY});var m3=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"};nn({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:m3(t[0]),body:qi(t[1]),isCharacterBox:lh(t[1])}}});nn({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:n,funcName:s}=e,r=t[1],i=t[0],o;s!=="\\stackrel"?o=m3(r):o="mrel";var a={type:"op",mode:r.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:s!=="\\stackrel",body:qi(r)},c={type:"supsub",mode:i.mode,base:a,sup:s==="\\underset"?null:i,sub:s==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:o,body:[c],isCharacterBox:lh(c)}},htmlBuilder:GY,mathmlBuilder:KY});nn({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:m3(t[0]),body:qi(t[0])}},htmlBuilder(e,t){var n=oo(e.body,t,!0),s=vt([e.mclass],n,t);return s.style.textShadow="0.02em 0.01em 0.04px",s},mathmlBuilder(e,t){var n=Pl(e.body,t),s=new Ct("mstyle",n);return s.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),s}});var T_e={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},aB=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),lB=e=>e.type==="textord"&&e.text==="@",E_e=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function A_e(e,t,n){var s=T_e[e];switch(s){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(s,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var r=n.callFunction("\\\\cdleft",[t[0]],[]),i={type:"atom",text:s,mode:"math",family:"rel"},o=n.callFunction("\\Big",[i],[]),a=n.callFunction("\\\\cdright",[t[1]],[]),c={type:"ordgroup",mode:"math",body:[r,o,a]};return n.callFunction("\\\\cdparent",[c],[])}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 N_e(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 kt("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var s=[],r=[s],i=0;i<t.length;i++){for(var o=t[i],a=aB(),c=0;c<o.length;c++)if(!lB(o[c]))a.body.push(o[c]);else{s.push(a),c+=1;var u=h3(o[c]).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=c+1;p<o.length;p++){if(E_e(o[p],u)){m=!1,c=p;break}if(lB(o[p]))throw new kt("Missing a "+u+" character to complete a CD arrow.",o[p]);d[h].body.push(o[p])}if(m)throw new kt("Missing a "+u+" character to complete a CD arrow.",o[c])}else throw new kt('Expected one of "<>AV=|." after @',o[c]);var g=A_e(u,d,e),b={type:"styling",body:[g],mode:"math",style:"display",resetFont:!0};s.push(b),a=aB()}i%2===0?s.push(a):s.shift(),s=[],r.push(s)}e.gullet.endGroup(),e.gullet.endGroup();var v=new Array(r[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:r,arraystretch:1,addJot:!0,rowGaps:[null],cols:v,colSeparationType:"CD",hLinesBeforeRow:new Array(r.length+1).fill([])}}nn({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:s}=e;return{type:"cdlabel",mode:n.mode,side:s.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),s=a1(pr(e.label,n,t),t);return s.classes.push("cd-label-"+e.side),s.style.bottom=jt(.8-s.depth),s.height=0,s.depth=0,s},mathmlBuilder(e,t){var n=new Ct("mrow",[Pr(e.label,t)]);return n=new Ct("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Ct("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});nn({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=a1(pr(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new Ct("mrow",[Pr(e.fragment,t)])}});nn({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,s=ps(t[0],"ordgroup"),r=s.body,i="",o=0;o<r.length;o++){var a=ps(r[o],"textord");i+=a.text}var c=parseInt(i),u;if(isNaN(c))throw new kt("\\@char has non-numeric argument "+i);if(c<0||c>=1114111)throw new kt("\\@char with invalid code point "+i);return c<=65535?u=String.fromCharCode(c):(c-=65536,u=String.fromCharCode((c>>10)+55296,(c&1023)+56320)),{type:"textord",mode:n.mode,text:u}}});var YY=(e,t)=>{var n=oo(e.body,t.withColor(e.color),!1);return uh(n)},XY=(e,t)=>{var n=Pl(e.body,t.withColor(e.color)),s=new Ct("mstyle",n);return s.setAttribute("mathcolor",e.color),s};nn({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,s=ps(t[0],"color-token").color,r=t[1];return{type:"color",mode:n.mode,color:s,body:qi(r)}},htmlBuilder:YY,mathmlBuilder:XY});nn({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:s}=e,r=ps(t[0],"color-token").color;n.gullet.macros.set("\\current@color",r);var i=n.parseExpression(!0,s);return{type:"color",mode:n.mode,color:r,body:i}},htmlBuilder:YY,mathmlBuilder:XY});nn({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,n){var{parser:s}=e,r=s.gullet.future().text==="["?s.parseSizeGroup(!0):null,i=!s.settings.displayMode||!s.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:s.mode,newLine:i,size:r&&ps(r,"size").value}},htmlBuilder(e,t){var n=vt(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=jt(pi(e.size,t)))),n},mathmlBuilder(e,t){var n=new Ct("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",jt(pi(e.size,t)))),n}});var SE={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},QY=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new kt("Expected a control sequence",e);return t},j_e=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},JY=(e,t,n,s)=>{var r=e.gullet.macros.get(n.text);r==null&&(n.noexpand=!0,r={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,r,s)};nn({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:n}=e;t.consumeSpaces();var s=t.fetch();if(SE[s.text])return(n==="\\global"||n==="\\\\globallong")&&(s.text=SE[s.text]),ps(t.parseFunction(),"internal");throw new kt("Invalid token after macro prefix",s)}});nn({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=t.gullet.popToken(),r=s.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(r))throw new kt("Expected a control sequence",s);for(var i=0,o,a=[[]];t.gullet.future().text!=="{";)if(s=t.gullet.popToken(),s.text==="#"){if(t.gullet.future().text==="{"){o=t.gullet.future(),a[i].push("{");break}if(s=t.gullet.popToken(),!/^[1-9]$/.test(s.text))throw new kt('Invalid argument number "'+s.text+'"');if(parseInt(s.text)!==i+1)throw new kt('Argument number "'+s.text+'" out of order');i++,a.push([])}else{if(s.text==="EOF")throw new kt("Expected a macro definition");a[i].push(s.text)}var{tokens:c}=t.gullet.consumeArg();return o&&c.unshift(o),(n==="\\edef"||n==="\\xdef")&&(c=t.gullet.expandTokens(c),c.reverse()),t.gullet.macros.set(r,{tokens:c,numArgs:i,delimiters:a},n===SE[n]),{type:"internal",mode:t.mode}}});nn({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=QY(t.gullet.popToken());t.gullet.consumeSpaces();var r=j_e(t);return JY(t,s,r,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});nn({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=QY(t.gullet.popToken()),r=t.gullet.popToken(),i=t.gullet.popToken();return JY(t,s,i,n==="\\\\globalfuture"),t.gullet.pushToken(i),t.gullet.pushToken(r),{type:"internal",mode:t.mode}}});var yy=function(t,n,s){var r=oi.math[t]&&oi.math[t].replace,i=Rj(r||t,n,s);if(!i)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return i},$j=function(t,n,s,r){var i=s.havingBaseStyle(n),o=vt(r.concat(i.sizingClasses(s)),[t],s),a=i.sizeMultiplier/s.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=i.sizeMultiplier,o},ZY=function(t,n,s){var r=n.havingBaseStyle(s),i=(1-n.sizeMultiplier/r.sizeMultiplier)*n.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=jt(i),t.height-=i,t.depth+=i},M_e=function(t,n,s,r,i,o){var a=va(t,"Main-Regular",i,r),c=$j(a,n,r,o);return ZY(c,r,n),c},I_e=function(t,n,s,r){return va(t,"Size"+n+"-Regular",s,r)},eX=function(t,n,s,r,i,o){var a=I_e(t,n,i,r),c=$j(vt(["delimsizing","size"+n],[a],r),ss.TEXT,r,o);return s&&ZY(c,r,ss.TEXT),c},O5=function(t,n,s){var r;n==="Size1-Regular"?r="delim-size1":r="delim-size4";var i=vt(["delimsizinginner",r],[vt([],[va(t,n,s)])]);return{type:"elem",elem:i}},B5=function(t,n,s){var r=Tu["Size4-Regular"][t.charCodeAt(0)]?Tu["Size4-Regular"][t.charCodeAt(0)][4]:Tu["Size1-Regular"][t.charCodeAt(0)][4],i=new Lf("inner",Hke(t,Math.round(1e3*n))),o=new eh([i],{width:jt(r),height:jt(n),style:"width:"+jt(r),viewBox:"0 0 "+1e3*r+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),a=Pf([],[o],s);return a.height=n,a.style.height=jt(n),a.style.width=jt(r),{type:"elem",elem:a}},CE=.008,gk={type:"kern",size:-1*CE},R_e=new Set(["|","\\lvert","\\rvert","\\vert"]),D_e=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),tX=function(t,n,s,r,i,o){var a,c,u,d,h="",m=0;a=u=d=t,c=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"):R_e.has(t)?(u="∣",h="vert",m=333):D_e.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="⎧",c="⎨",d="⎩",u="⎪",p="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(a="⎫",c="⎬",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=yy(a,p,i),b=g.height+g.depth,v=yy(u,p,i),x=v.height+v.depth,y=yy(d,p,i),w=y.height+y.depth,k=0,T=1;if(c!==null){var _=yy(c,p,i);k=_.height+_.depth,T=2}var C=b+w+k,S=Math.max(0,Math.ceil((n-C)/(T*x))),L=C+S*T*x,N=r.fontMetrics().axisHeight;s&&(N*=r.sizeMultiplier);var $=L/2-N,M=[];if(h.length>0){var P=L-b-w,E=Math.round(L*1e3),O=qke(h,Math.round(P*1e3)),z=new Lf(h,O),F=jt(m/1e3),B=jt(E/1e3),W=new eh([z],{width:F,height:B,viewBox:"0 0 "+m+" "+E}),I=Pf([],[W],r);I.height=E/1e3,I.style.width=F,I.style.height=B,M.push({type:"elem",elem:I})}else{if(M.push(O5(d,p,i)),M.push(gk),c===null){var Y=L-b-w+2*CE;M.push(B5(u,Y,r))}else{var V=(L-b-w-k)/2+2*CE;M.push(B5(u,V,r)),M.push(gk),M.push(O5(c,p,i)),M.push(gk),M.push(B5(u,V,r))}M.push(gk),M.push(O5(a,p,i))}var j=r.havingBaseStyle(ss.TEXT),ee=fr({positionType:"bottom",positionData:$,children:M});return $j(vt(["delimsizing","mult"],[ee],j),ss.TEXT,r,o)},$5=80,z5=.08,F5=function(t,n,s,r,i){var o=Fke(t,r,s),a=new Lf(t,o),c=new eh([a],{width:"400em",height:jt(n),viewBox:"0 0 400000 "+s,preserveAspectRatio:"xMinYMin slice"});return Pf(["hide-tail"],[c],i)},L_e=function(t,n){var s=n.havingBaseSizing(),r=oX("\\surd",t*s.sizeMultiplier,iX,s),i=s.sizeMultiplier,o=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),a,c,u,d,h;return r.type==="small"?(d=1e3+1e3*o+$5,t<1?i=1:t<1.4&&(i=.7),c=(1+o+z5)/i,u=(1+o)/i,a=F5("sqrtMain",c,d,o,n),a.style.minWidth="0.853em",h=.833/i):r.type==="large"?(d=(1e3+$5)*Zy[r.size],u=(Zy[r.size]+o)/i,c=(Zy[r.size]+o+z5)/i,a=F5("sqrtSize"+r.size,c,d,o,n),a.style.minWidth="1.02em",h=1/i):(c=t+o+z5,u=t+o,d=Math.floor(1e3*t+o)+$5,a=F5("sqrtTall",c,d,o,n),a.style.minWidth="0.742em",h=1.056),a.height=u,a.style.height=jt(c),{span:a,advanceWidth:h,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*i}},nX=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),P_e=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),sX=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),Zy=[0,1.2,1.8,2.4,3],rX=function(t,n,s,r,i){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),nX.has(t)||sX.has(t))return eX(t,n,!1,s,r,i);if(P_e.has(t))return tX(t,Zy[n],!1,s,r,i);throw new kt("Illegal delimiter: '"+t+"'")},O_e=[{type:"small",style:ss.SCRIPTSCRIPT},{type:"small",style:ss.SCRIPT},{type:"small",style:ss.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],B_e=[{type:"small",style:ss.SCRIPTSCRIPT},{type:"small",style:ss.SCRIPT},{type:"small",style:ss.TEXT},{type:"stack"}],iX=[{type:"small",style:ss.SCRIPTSCRIPT},{type:"small",style:ss.SCRIPT},{type:"small",style:ss.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],$_e=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.")},oX=function(t,n,s,r){for(var i=Math.min(2,3-r.style.size),o=i;o<s.length;o++){var a=s[o];if(a.type==="stack")break;var c=yy(t,$_e(a),"math"),u=c.height+c.depth;if(a.type==="small"){var d=r.havingBaseStyle(a.style);u*=d.sizeMultiplier}if(u>n)return a}return s[s.length-1]},TE=function(t,n,s,r,i,o){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var a;sX.has(t)?a=O_e:nX.has(t)?a=iX:a=B_e;var c=oX(t,n,a,r);return c.type==="small"?M_e(t,c.style,s,r,i,o):c.type==="large"?eX(t,c.size,s,r,i,o):tX(t,n,s,r,i,o)},H5=function(t,n,s,r,i,o){var a=r.fontMetrics().axisHeight*r.sizeMultiplier,c=901,u=5/r.fontMetrics().ptPerEm,d=Math.max(n-a,s+a),h=Math.max(d/500*c,2*d-u);return TE(t,h,!0,r,i,o)},cB={"\\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}},z_e=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 uB(e){return"isMiddle"in e}function p3(e,t){var n=f3(e);if(n&&z_e.has(n.text))return n;throw n?new kt("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new kt("Invalid delimiter type '"+e.type+"'",e)}nn({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=p3(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:cB[e.funcName].size,mclass:cB[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?vt([e.mclass]):rX(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(vc(e.delim,e.mode));var n=new Ct("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var s=jt(Zy[e.size]);return n.setAttribute("minsize",s),n.setAttribute("maxsize",s),n}});function dB(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}nn({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 kt("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:p3(t[0],e).text,color:n}}});nn({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=p3(t[0],e),s=e.parser;++s.leftrightDepth;var r=s.parseExpression(!1);--s.leftrightDepth,s.expect("\\right",!1);var i=ps(s.parseFunction(),"leftright-right");return{type:"leftright",mode:s.mode,body:r,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{dB(e);for(var n=oo(e.body,t,!0,["mopen","mclose"]),s=0,r=0,i=!1,o=0;o<n.length;o++){var a=n[o];uB(a)?i=!0:(s=Math.max(n[o].height,s),r=Math.max(n[o].depth,r))}s*=t.sizeMultiplier,r*=t.sizeMultiplier;var c;if(e.left==="."?c=Rx(t,["mopen"]):c=H5(e.left,s,r,t,e.mode,["mopen"]),n.unshift(c),i)for(var u=1;u<n.length;u++){var d=n[u];if(uB(d)){var h=d.isMiddle;n[u]=H5(h.delim,s,r,h.options,e.mode,[])}}var m;if(e.right===".")m=Rx(t,["mclose"]);else{var p=e.rightColor?t.withColor(e.rightColor):t;m=H5(e.right,s,r,p,e.mode,["mclose"])}return n.push(m),vt(["minner"],n,t)},mathmlBuilder:(e,t)=>{dB(e);var n=Pl(e.body,t);if(e.left!=="."){var s=new Ct("mo",[vc(e.left,e.mode)]);s.setAttribute("fence","true"),n.unshift(s)}if(e.right!=="."){var r=new Ct("mo",[vc(e.right,e.mode)]);r.setAttribute("fence","true"),e.rightColor&&r.setAttribute("mathcolor",e.rightColor),n.push(r)}return Pj(n)}});nn({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=p3(t[0],e);if(!e.parser.leftrightDepth)throw new kt("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return e.delim==="."?n=Rx(t,[]):(n=rX(e.delim,1,t,e.mode,[]),n.isMiddle={delim:e.delim,options:t}),n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?vc("|","text"):vc(e.delim,e.mode),s=new Ct("mo",[n]);return s.setAttribute("fence","true"),s.setAttribute("lspace","0.05em"),s.setAttribute("rspace","0.05em"),s}});var g3=(e,t)=>{var n=a1(pr(e.body,t),t),s=e.label.slice(1),r=t.sizeMultiplier,i,o,a=lh(e.body);if(s==="sout")i=vt(["stretchy","sout"]),i.height=t.fontMetrics().defaultRuleThickness/r,o=-.5*t.fontMetrics().xHeight;else if(s==="phase"){var c=pi({number:.6,unit:"pt"},t),u=pi({number:.35,unit:"ex"},t),d=t.havingBaseSizing();r=r/d.sizeMultiplier;var h=n.height+n.depth+c+u;n.style.paddingLeft=jt(h/2+c);var m=Math.floor(1e3*h*r),p=$ke(m),g=new eh([new Lf("phase",p)],{width:"400em",height:jt(m/1e3),viewBox:"0 0 400000 "+m,preserveAspectRatio:"xMinYMin slice"});i=Pf(["hide-tail"],[g],t),i.style.height=jt(h),o=n.depth+c+u}else{/cancel/.test(s)?a||n.classes.push("cancel-pad"):s==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var b,v,x=0;/box/.test(s)?(x=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),b=t.fontMetrics().fboxsep+(s==="colorbox"?0:x),v=b):s==="angl"?(x=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),b=4*x,v=Math.max(0,.25-n.depth)):(b=a?.2:0,v=b),i=w_e(n,s,b,v,t),/fbox|boxed|fcolorbox/.test(s)?(i.style.borderStyle="solid",i.style.borderWidth=jt(x)):s==="angl"&&x!==.049&&(i.style.borderTopWidth=jt(x),i.style.borderRightWidth=jt(x)),o=n.depth+v,e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor,e.borderColor&&(i.style.borderColor=e.borderColor))}var y;if(e.backgroundColor)y=fr({positionType:"individualShift",children:[{type:"elem",elem:i,shift:o},{type:"elem",elem:n,shift:0}]});else{var w=/cancel|phase/.test(s)?["svg-align"]:[];y=fr({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:o,wrapperClasses:w}]})}return/cancel/.test(s)&&(y.height=n.height,y.depth=n.depth),/cancel/.test(s)&&!a?vt(["mord","cancel-lap"],[y],t):vt(["mord"],[y],t)},b3=(e,t)=>{var n,s=new Ct(e.label.includes("colorbox")?"mpadded":"menclose",[Pr(e.body,t)]);switch(e.label){case"\\cancel":s.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":s.setAttribute("notation","downdiagonalstrike");break;case"\\phase":s.setAttribute("notation","phasorangle");break;case"\\sout":s.setAttribute("notation","horizontalstrike");break;case"\\fbox":s.setAttribute("notation","box");break;case"\\angl":s.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,s.setAttribute("width","+"+2*n+"pt"),s.setAttribute("height","+"+2*n+"pt"),s.setAttribute("lspace",n+"pt"),s.setAttribute("voffset",n+"pt"),e.label==="\\fcolorbox"){var r=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);s.setAttribute("style","border: "+jt(r)+" solid "+e.borderColor)}break;case"\\xcancel":s.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&s.setAttribute("mathbackground",e.backgroundColor),s};nn({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,n){var{parser:s,funcName:r}=e,i=ps(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:s.mode,label:r,backgroundColor:i,body:o}},htmlBuilder:g3,mathmlBuilder:b3});nn({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,n){var{parser:s,funcName:r}=e,i=ps(t[0],"color-token").color,o=ps(t[1],"color-token").color,a=t[2];return{type:"enclose",mode:s.mode,label:r,backgroundColor:o,borderColor:i,body:a}},htmlBuilder:g3,mathmlBuilder:b3});nn({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]}}});nn({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:s}=e,r=t[0];return{type:"enclose",mode:n.mode,label:s,body:r}},htmlBuilder:g3,mathmlBuilder:b3});nn({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n,funcName:s}=e;n.mode==="math"&&n.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var r=t[0];return{type:"enclose",mode:n.mode,label:s,body:r}},htmlBuilder:g3,mathmlBuilder:b3});nn({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 aX={};function Wu(e){for(var{type:t,names:n,props:s,handler:r,htmlBuilder:i,mathmlBuilder:o}=e,a={type:t,numArgs:s.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:r},c=0;c<n.length;++c)aX[n[c]]=a;i&&(hS[t]=i),o&&(fS[t]=o)}var lX={};function K(e,t){lX[e]=t}class Ga{constructor(t,n,s){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=n,this.end=s}static range(t,n){return n?!t||!t.loc||!n.loc||t.loc.lexer!==n.loc.lexer?null:new Ga(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}}class Al{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 Al(n,Ga.range(this,t))}}function hB(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 y3=e=>{var t=e.parser.settings;if(!t.displayMode)throw new kt("{"+e.envName+"} can be used only in display mode.")},F_e=new Set(["gather","gather*"]);function zj(e){if(!e.includes("ed"))return!e.includes("*")}function om(e,t,n){var{hskipBeforeAndAfter:s,addJot:r,cols:i,arraystretch:o,colSeparationType:a,autoTag:c,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 kt("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var g=[],b=[g],v=[],x=[],y=c!=null?[]:void 0;function w(){c&&e.gullet.macros.set("\\@eqnsw","1",!0)}function k(){y&&(e.gullet.macros.get("\\df@tag")?(y.push(e.subparse([new Al("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):y.push(!!c&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(w(),x.push(hB(e));;){var T=e.parseExpression(!1,u?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var _={type:"ordgroup",mode:e.mode,body:T};n&&(_={type:"styling",mode:e.mode,style:n,resetFont:!0,body:[_]}),g.push(_);var C=e.fetch().text;if(C==="&"){if(h&&g.length===h){if(u||a)throw new kt("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&&_.type==="styling"&&_.body.length===1&&_.body[0].type==="ordgroup"&&_.body[0].body.length===0&&(b.length>1||!d)&&b.pop(),x.length<b.length+1&&x.push([]);break}else if(C==="\\\\"){e.consume();var S=void 0;e.gullet.future().text!==" "&&(S=e.parseSizeGroup(!0)),v.push(S?S.value:null),k(),x.push(hB(e)),g=[],b.push(g),w()}else throw new kt("Expected & or \\\\ or \\cr or \\end",e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:r,arraystretch:o,body:b,cols:i,rowGaps:v,hskipBeforeAndAfter:s,hLinesBeforeRow:x,colSeparationType:a,tags:y,leqno:m}}function Fj(e){return e.slice(0,1)==="d"?"display":"text"}var Gu=function(t,n){var s,r,i=t.body.length,o=t.hLinesBeforeRow,a=0,c=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(ss.SCRIPT).sizeMultiplier;m=.2778*(p/n.sizeMultiplier)}var g=t.colSeparationType==="CD"?pi({number:3,unit:"ex"},n):12*h,b=3*h,v=t.arraystretch*g,x=.7*v,y=.3*v,w=0;function k(le){for(var Le=0;Le<le.length;++Le)Le>0&&(w+=.25),u.push({pos:w,isDashed:le[Le]})}for(k(o[0]),s=0;s<t.body.length;++s){var T=t.body[s],_=x,C=y;a<T.length&&(a=T.length);var S={cells:new Array(T.length),height:0,depth:0,pos:0};for(r=0;r<T.length;++r){var L=pr(T[r],n);C<L.depth&&(C=L.depth),_<L.height&&(_=L.height),S.cells[r]=L}var N=t.rowGaps[s],$=0;N&&($=pi(N,n),$>0&&($+=y,C<$&&(C=$),$=0)),t.addJot&&s<t.body.length-1&&(C+=b),S.height=_,S.depth=C,w+=_,S.pos=w,w+=C+$,c[s]=S,k(o[s+1])}var M=w/2+n.fontMetrics().axisHeight,P=t.cols||[],E=[],O,z,F=[];if(t.tags&&t.tags.some(le=>le))for(s=0;s<i;++s){var B=c[s],W=B.pos-M,I=t.tags[s],Y=void 0;I===!0?Y=vt(["eqn-num"],[],n):I===!1?Y=vt([],[],n):Y=vt([],oo(I,n,!0),n),Y.depth=B.depth,Y.height=B.height,F.push({type:"elem",elem:Y,shift:W})}for(r=0,z=0;r<a||z<P.length;++r,++z){for(var V,j=P[z],ee=!0;((se=j)==null?void 0:se.type)==="separator";){var se;if(ee||(O=vt(["arraycolsep"],[]),O.style.width=jt(n.fontMetrics().doubleRuleSep),E.push(O)),j.separator==="|"||j.separator===":"){var X=j.separator==="|"?"solid":"dashed",Q=vt(["vertical-separator"],[],n);Q.style.height=jt(w),Q.style.borderRightWidth=jt(d),Q.style.borderRightStyle=X,Q.style.margin="0 "+jt(-d/2);var ue=w-M;ue&&(Q.style.verticalAlign=jt(-ue)),E.push(Q)}else throw new kt("Invalid separator type: "+j.separator);z++,j=P[z],ee=!1}if(!(r>=a)){var re=void 0;if(r>0||t.hskipBeforeAndAfter){var J,q;re=(J=(q=j)==null?void 0:q.pregap)!=null?J:m,re!==0&&(O=vt(["arraycolsep"],[]),O.style.width=jt(re),E.push(O))}var Z=[];for(s=0;s<i;++s){var he=c[s],ye=he.cells[r];if(ye){var oe=he.pos-M;ye.depth=he.depth,ye.height=he.height,Z.push({type:"elem",elem:ye,shift:oe})}}var we=fr({positionType:"individualShift",children:Z}),Ve=vt(["col-align-"+(((V=j)==null?void 0:V.align)||"c")],[we]);if(E.push(Ve),r<a-1||t.hskipBeforeAndAfter){var lt,Et;re=(lt=(Et=j)==null?void 0:Et.postgap)!=null?lt:m,re!==0&&(O=vt(["arraycolsep"],[]),O.style.width=jt(re),E.push(O))}}}var pt=vt(["mtable"],E);if(u.length>0){for(var je=o1("hline",n,d),Ae=o1("hdashline",n,d),De=[{type:"elem",elem:pt,shift:0}];u.length>0;){var Ne=u.pop(),tt=Ne.pos-M;Ne.isDashed?De.push({type:"elem",elem:Ae,shift:tt}):De.push({type:"elem",elem:je,shift:tt})}pt=fr({positionType:"individualShift",children:De})}if(F.length===0)return vt(["mord"],[pt],n);var Se=fr({positionType:"individualShift",children:F}),Be=vt(["tag"],[Se],n);return uh([pt,Be])},H_e={c:"center ",l:"left ",r:"right "},Ku=function(t,n){for(var s=[],r=new Ct("mtd",[],["mtr-glue"]),i=new Ct("mtd",[],["mml-eqn-num"]),o=0;o<t.body.length;o++){for(var a=t.body[o],c=[],u=0;u<a.length;u++)c.push(new Ct("mtd",[Pr(a[u],n)]));t.tags&&t.tags[o]&&(c.unshift(r),c.push(r),t.leqno?c.unshift(i):c.push(i)),s.push(new Ct("mtr",c))}var d=new Ct("mtable",s),h=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);d.setAttribute("rowspacing",jt(h));var m="",p="";if(t.cols&&t.cols.length>0){var g=t.cols,b="",v=!1,x=0,y=g.length;g[0].type==="separator"&&(m+="top ",x=1),g[g.length-1].type==="separator"&&(m+="bottom ",y-=1);for(var w=x;w<y;w++){var k=g[w];k.type==="align"?(p+=H_e[k.align],v&&(b+="none "),v=!0):k.type==="separator"&&v&&(b+=k.separator==="|"?"solid ":"dashed ",v=!1)}d.setAttribute("columnalign",p.trim()),/[sd]/.test(b)&&d.setAttribute("columnlines",b.trim())}if(t.colSeparationType==="align"){for(var T=t.cols||[],_="",C=1;C<T.length;C++)_+=C%2?"0em ":"1em ";d.setAttribute("columnspacing",_.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 S="",L=t.hLinesBeforeRow;m+=L[0].length>0?"left ":"",m+=L[L.length-1].length>0?"right ":"";for(var N=1;N<L.length-1;N++)S+=L[N].length===0?"none ":L[N][0]?"dashed ":"solid ";return/[sd]/.test(S)&&d.setAttribute("rowlines",S.trim()),m!==""&&(d=new Ct("menclose",[d]),d.setAttribute("notation",m.trim())),t.arraystretch&&t.arraystretch<1&&(d=new Ct("mstyle",[d]),d.setAttribute("scriptlevel","1")),d},cX=function(t,n){t.envName.includes("ed")||y3(t);var s=[],r=t.envName.includes("at")?"alignat":"align",i=t.envName==="split",o=om(t.parser,{cols:s,addJot:!0,autoTag:i?void 0:zj(t.envName),emptySingleRow:!0,colSeparationType:r,maxNumCols:i?2:void 0,leqno:t.parser.settings.leqno},"display"),a=0,c=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=ps(n[0].body[h],"textord");d+=m.text}a=Number(d),c=a*2}var p=!c;o.body.forEach(function(x){for(var y=1;y<x.length;y+=2){var w=ps(x[y],"styling"),k=ps(w.body[0],"ordgroup");k.body.unshift(u)}if(p)c<x.length&&(c=x.length);else{var T=x.length/2;if(a<T)throw new kt("Too many math in a row: "+("expected "+a+", but got "+T),x[0])}});for(var g=0;g<c;++g){var b="r",v=0;g%2===1?b="l":g>0&&p&&(v=1),s[g]={type:"align",align:b,pregap:v,postgap:0}}return o.colSeparationType=p?"align":"alignat",o};Wu({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=f3(t[0]),s=n?[t[0]]:ps(t[0],"ordgroup").body,r=s.map(function(o){var a=h3(o),c=a.text;if("lcr".includes(c))return{type:"align",align:c};if(c==="|")return{type:"separator",separator:"|"};if(c===":")return{type:"separator",separator:":"};throw new kt("Unknown column alignment: "+c,o)}),i={cols:r,hskipBeforeAndAfter:!0,maxNumCols:r.length};return om(e.parser,i,Fj(e.envName))},htmlBuilder:Gu,mathmlBuilder:Ku});Wu({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],n="c",s={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(e.envName.charAt(e.envName.length-1)==="*"){var r=e.parser;if(r.consumeSpaces(),r.fetch().text==="["){if(r.consume(),r.consumeSpaces(),n=r.fetch().text,!"lcr".includes(n))throw new kt("Expected l or c or r",r.nextToken);r.consume(),r.consumeSpaces(),r.expect("]"),r.consume(),s.cols=[{type:"align",align:n}]}}var i=om(e.parser,s,Fj(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:Gu,mathmlBuilder:Ku});Wu({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=om(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:Gu,mathmlBuilder:Ku});Wu({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=f3(t[0]),s=n?[t[0]]:ps(t[0],"ordgroup").body,r=s.map(function(a){var c=h3(a),u=c.text;if("lc".includes(u))return{type:"align",align:u};throw new kt("Unknown column alignment: "+u,a)});if(r.length>1)throw new kt("{subarray} can contain only one column");var i={cols:r,hskipBeforeAndAfter:!1,arraystretch:.5},o=om(e.parser,i,"script");if(o.body.length>0&&o.body[0].length>1)throw new kt("{subarray} can contain only one column");return o},htmlBuilder:Gu,mathmlBuilder:Ku});Wu({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=om(e.parser,t,Fj(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Gu,mathmlBuilder:Ku});Wu({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:cX,htmlBuilder:Gu,mathmlBuilder:Ku});Wu({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){F_e.has(e.envName)&&y3(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:zj(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return om(e.parser,t,"display")},htmlBuilder:Gu,mathmlBuilder:Ku});Wu({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:cX,htmlBuilder:Gu,mathmlBuilder:Ku});Wu({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){y3(e);var t={autoTag:zj(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return om(e.parser,t,"display")},htmlBuilder:Gu,mathmlBuilder:Ku});Wu({type:"array",names:["CD"],props:{numArgs:0},handler(e){return y3(e),N_e(e.parser)},htmlBuilder:Gu,mathmlBuilder:Ku});K("\\nonumber","\\gdef\\@eqnsw{0}");K("\\notag","\\nonumber");nn({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new kt(e.funcName+" valid only within array environment")}});var fB=aX;nn({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:n,funcName:s}=e,r=t[0];if(r.type!=="ordgroup")throw new kt("Invalid environment name",r);for(var i="",o=0;o<r.body.length;++o)i+=ps(r.body[o],"textord").text;if(s==="\\begin"){if(!fB.hasOwnProperty(i))throw new kt("No such environment: "+i,r);var a=fB[i],{args:c,optArgs:u}=n.parseArguments("\\begin{"+i+"}",a),d={mode:n.mode,envName:i,parser:n},h=a.handler(d,c,u);n.expect("\\end",!1);var m=n.nextToken,p=ps(n.parseFunction(),"environment");if(p.name!==i)throw new kt("Mismatch: \\begin{"+i+"} matched by \\end{"+p.name+"}",m);return h}return{type:"environment",mode:n.mode,name:i,nameGroup:r}}});var uX=(e,t)=>{var n=e.font,s=t.withFont(n);return pr(e.body,s)},dX=(e,t)=>{var n=e.font,s=t.withFont(n);return Pr(e.body,s)},mB={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};nn({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=mS(t[0]),i=s;return i in mB&&(i=mB[i]),{type:"font",mode:n.mode,font:i.slice(1),body:r}},htmlBuilder:uX,mathmlBuilder:dX});nn({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:n}=e,s=t[0];return{type:"mclass",mode:n.mode,mclass:m3(s),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:s}],isCharacterBox:lh(s)}}});nn({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:s,breakOnTokenText:r}=e,{mode:i}=n,o=n.parseExpression(!0,r);return{type:"font",mode:i,font:"math"+s.slice(1),body:{type:"ordgroup",mode:n.mode,body:o}}},htmlBuilder:uX,mathmlBuilder:dX});var q_e=(e,t)=>{var n=t.style,s=n.fracNum(),r=n.fracDen(),i;i=t.havingStyle(s);var o=pr(e.numer,i,t);if(e.continued){var a=8.5/t.fontMetrics().ptPerEm,c=3.5/t.fontMetrics().ptPerEm;o.height=o.height<a?a:o.height,o.depth=o.depth<c?c:o.depth}i=t.havingStyle(r);var u=pr(e.denom,i,t),d,h,m;e.hasBarLine?(e.barSize?(h=pi(e.barSize,t),d=o1("frac-line",t,h)):d=o1("frac-line",t),h=d.height,m=d.height):(d=null,h=0,m=t.fontMetrics().defaultRuleThickness);var p,g,b;n.size===ss.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 v;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);v=fr({positionType:"individualShift",children:[{type:"elem",elem:u,shift:b},{type:"elem",elem:d,shift:w},{type:"elem",elem:o,shift:-p}]})}else{var x=p-o.depth-(u.height-b);x<g&&(p+=.5*(g-x),b+=.5*(g-x)),v=fr({positionType:"individualShift",children:[{type:"elem",elem:u,shift:b},{type:"elem",elem:o,shift:-p}]})}i=t.havingStyle(n),v.height*=i.sizeMultiplier/t.sizeMultiplier,v.depth*=i.sizeMultiplier/t.sizeMultiplier;var k;n.size===ss.DISPLAY.size?k=t.fontMetrics().delim1:n.size===ss.SCRIPTSCRIPT.size?k=t.havingStyle(ss.SCRIPT).fontMetrics().delim2:k=t.fontMetrics().delim2;var T,_;return e.leftDelim==null?T=Rx(t,["mopen"]):T=TE(e.leftDelim,k,!0,t.havingStyle(n),e.mode,["mopen"]),e.continued?_=vt([]):e.rightDelim==null?_=Rx(t,["mclose"]):_=TE(e.rightDelim,k,!0,t.havingStyle(n),e.mode,["mclose"]),vt(["mord"].concat(i.sizingClasses(t)),[T,vt(["mfrac"],[v]),_],t)},U_e=(e,t)=>{var n=new Ct("mfrac",[Pr(e.numer,t),Pr(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var s=pi(e.barSize,t);n.setAttribute("linethickness",jt(s))}if(e.leftDelim!=null||e.rightDelim!=null){var r=[];if(e.leftDelim!=null){var i=new Ct("mo",[new Ui(e.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),r.push(i)}if(r.push(n),e.rightDelim!=null){var o=new Ct("mo",[new Ui(e.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),r.push(o)}return Pj(r)}return n},hX=(e,t)=>{if(!t)return e;var n={type:"styling",mode:e.mode,style:t,body:[e]};return n};nn({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0],i=t[1],o,a=null,c=null;switch(s){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,a="(",c=")";break;case"\\\\bracefrac":o=!1,a="\\{",c="\\}";break;case"\\\\brackfrac":o=!1,a="[",c="]";break;default:throw new Error("Unrecognized genfrac command")}var u=s==="\\cfrac",d=null;return u||s.startsWith("\\d")?d="display":s.startsWith("\\t")&&(d="text"),hX({type:"genfrac",mode:n.mode,numer:r,denom:i,continued:u,hasBarLine:o,leftDelim:a,rightDelim:c,barSize:null},d)},htmlBuilder:q_e,mathmlBuilder:U_e});nn({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:n,token:s}=e,r;switch(n){case"\\over":r="\\frac";break;case"\\choose":r="\\binom";break;case"\\atop":r="\\\\atopfrac";break;case"\\brace":r="\\\\bracefrac";break;case"\\brack":r="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:r,token:s}}});var pB=["display","text","script","scriptscript"],gB=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};nn({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:n}=e,s=t[4],r=t[5],i=mS(t[0]),o=i.type==="atom"&&i.family==="open"?gB(i.text):null,a=mS(t[1]),c=a.type==="atom"&&a.family==="close"?gB(a.text):null,u=ps(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=ps(p.body[0],"textord");m=pB[Number(g.text)]}}else p=ps(p,"textord"),m=pB[Number(p.text)];return hX({type:"genfrac",mode:n.mode,numer:s,denom:r,continued:!1,hasBarLine:d,barSize:h,leftDelim:o,rightDelim:c},m)}});nn({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:n,funcName:s,token:r}=e;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:ps(t[0],"size").value,token:r}}});nn({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0],i=ps(t[1],"infix").size;if(!i)throw new Error("\\\\abovefrac expected size, but got "+String(i));var o=t[2],a=i.number>0;return{type:"genfrac",mode:n.mode,numer:r,denom:o,continued:!1,hasBarLine:a,barSize:i,leftDelim:null,rightDelim:null}}});var fX=(e,t)=>{var n=t.style,s,r;e.type==="supsub"?(s=e.sup?pr(e.sup,t.havingStyle(n.sup()),t):pr(e.sub,t.havingStyle(n.sub()),t),r=ps(e.base,"horizBrace")):r=ps(e,"horizBrace");var i=pr(r.base,t.havingBaseStyle(ss.DISPLAY)),o=d3(r,t),a;if(r.isOver?a=fr({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:o,wrapperClasses:["svg-align"]}]}):a=fr({positionType:"bottom",positionData:i.depth+.1+o.height,children:[{type:"elem",elem:o,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:i}]}),s){var c=vt(["minner",r.isOver?"mover":"munder"],[a],t);r.isOver?a=fr({positionType:"firstBaseline",children:[{type:"elem",elem:c},{type:"kern",size:.2},{type:"elem",elem:s}]}):a=fr({positionType:"bottom",positionData:c.depth+.2+s.height+s.depth,children:[{type:"elem",elem:s},{type:"kern",size:.2},{type:"elem",elem:c}]})}return vt(["minner",r.isOver?"mover":"munder"],[a],t)},V_e=(e,t)=>{var n=u3(e.label);return new Ct(e.isOver?"mover":"munder",[Pr(e.base,t),n])};nn({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:s}=e;return{type:"horizBrace",mode:n.mode,label:s,isOver:s.includes("\\over"),base:t[0]}},htmlBuilder:fX,mathmlBuilder:V_e});nn({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=t[1],r=ps(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:r})?{type:"href",mode:n.mode,href:r,body:qi(s)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=oo(e.body,t,!1);return r_e(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=Of(e.body,t);return n instanceof Ct||(n=new Ct("mrow",[n])),n.setAttribute("href",e.href),n}});nn({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=ps(t[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:s}))return n.formatUnsupportedCmd("\\url");for(var r=[],i=0;i<s.length;i++){var o=s[i];o==="~"&&(o="\\textasciitilde"),r.push({type:"textord",mode:"text",text:o})}var a={type:"text",mode:n.mode,font:"\\texttt",body:r};return{type:"href",mode:n.mode,href:s,body:qi(a)}}});nn({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:qi(t[0])}},htmlBuilder(e,t){var n=oo(e.body,t.withFont(""),!1);return uh(n)},mathmlBuilder(e,t){return new Ct("mrow",Pl(e.body,t.withFont("")))}});nn({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:s,token:r}=e,i=ps(t[0],"raw").string,o=t[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var a,c={};switch(s){case"\\htmlClass":c.class=i,a={command:"\\htmlClass",class:i};break;case"\\htmlId":c.id=i,a={command:"\\htmlId",id:i};break;case"\\htmlStyle":c.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 kt("\\htmlData key/value '"+h+"' missing equals sign");var p=h.slice(0,m),g=h.slice(m+1);c["data-"+p.trim()]=g}a={command:"\\htmlData",attributes:c};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(a)?{type:"html",mode:n.mode,attributes:c,body:qi(o)}:n.formatUnsupportedCmd(s)},htmlBuilder:(e,t)=>{var n=oo(e.body,t,!1),s=["enclosing"];e.attributes.class&&s.push(...e.attributes.class.trim().split(/\s+/));var r=vt(s,n,t);for(var i in e.attributes)i!=="class"&&e.attributes.hasOwnProperty(i)&&r.setAttribute(i,e.attributes[i]);return r},mathmlBuilder:(e,t)=>Of(e.body,t)});nn({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:qi(t[0]),mathml:qi(t[1])}},htmlBuilder:(e,t)=>{var n=oo(e.html,t,!1);return uh(n)},mathmlBuilder:(e,t)=>Of(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 kt("Invalid size: '"+t+"' in \\includegraphics");var s={number:+(n[1]+n[2]),unit:n[3]};if(!NY(s))throw new kt("Invalid unit: '"+s.unit+"' in \\includegraphics.");return s};nn({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,n)=>{var{parser:s}=e,r={number:0,unit:"em"},i={number:.9,unit:"em"},o={number:0,unit:"em"},a="";if(n[0])for(var c=ps(n[0],"raw").string,u=c.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":r=q5(m);break;case"height":i=q5(m);break;case"totalheight":o=q5(m);break;default:throw new kt("Invalid key: '"+h[0]+"' in \\includegraphics.")}}}var p=ps(t[0],"url").url;return a===""&&(a=p,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),s.settings.isTrusted({command:"\\includegraphics",url:p})?{type:"includegraphics",mode:s.mode,alt:a,width:r,height:i,totalheight:o,src:p}:s.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=pi(e.height,t),s=0;e.totalheight.number>0&&(s=pi(e.totalheight,t)-n);var r=0;e.width.number>0&&(r=pi(e.width,t));var i={height:jt(n+s)};r>0&&(i.width=jt(r)),s>0&&(i.verticalAlign=jt(-s));var o=new Gke(e.src,e.alt,i);return o.height=n,o.depth=s,o},mathmlBuilder:(e,t)=>{var n=new Ct("mglyph",[]);n.setAttribute("alt",e.alt);var s=pi(e.height,t),r=0;if(e.totalheight.number>0&&(r=pi(e.totalheight,t)-s,n.setAttribute("valign",jt(-r))),n.setAttribute("height",jt(s+r)),e.width.number>0){var i=pi(e.width,t);n.setAttribute("width",jt(i))}return n.setAttribute("src",e.src),n}});nn({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:s}=e,r=ps(t[0],"size");if(n.settings.strict){var i=s[1]==="m",o=r.value.unit==="mu";i?(o||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+s+" supports only mu units, "+("not "+r.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+s+" works only in math mode")):o&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+s+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:r.value}},htmlBuilder(e,t){return PY(e.dimension,t)},mathmlBuilder(e,t){var n=pi(e.dimension,t);return new HY(n)}});nn({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0];return{type:"lap",mode:n.mode,alignment:s.slice(5),body:r}},htmlBuilder:(e,t)=>{var n;e.alignment==="clap"?(n=vt([],[pr(e.body,t)]),n=vt(["inner"],[n],t)):n=vt(["inner"],[pr(e.body,t)]);var s=vt(["fix"],[]),r=vt([e.alignment],[n,s],t),i=vt(["strut"]);return i.style.height=jt(r.height+r.depth),r.depth&&(i.style.verticalAlign=jt(-r.depth)),r.children.unshift(i),r=vt(["thinbox"],[r],t),vt(["mord","vbox"],[r],t)},mathmlBuilder:(e,t)=>{var n=new Ct("mpadded",[Pr(e.body,t)]);if(e.alignment!=="rlap"){var s=e.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",s+"width")}return n.setAttribute("width","0px"),n}});nn({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:n,parser:s}=e,r=s.mode;s.switchMode("math");var i=n==="\\("?"\\)":"$",o=s.parseExpression(!1,i);return s.expect(i),s.switchMode(r),{type:"styling",mode:s.mode,style:"text",resetFont:!0,body:o}}});nn({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new kt("Mismatched "+e.funcName)}});var bB=(e,t)=>{switch(t.style.size){case ss.DISPLAY.size:return e.display;case ss.TEXT.size:return e.text;case ss.SCRIPT.size:return e.script;case ss.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};nn({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:qi(t[0]),text:qi(t[1]),script:qi(t[2]),scriptscript:qi(t[3])}},htmlBuilder:(e,t)=>{var n=bB(e,t),s=oo(n,t,!1);return uh(s)},mathmlBuilder:(e,t)=>{var n=bB(e,t);return Of(n,t)}});var mX=(e,t,n,s,r,i,o)=>{e=vt([],[e]);var a=n&&lh(n),c,u;if(t){var d=pr(t,s.havingStyle(r.sup()),s);u={elem:d,kern:Math.max(s.fontMetrics().bigOpSpacing1,s.fontMetrics().bigOpSpacing3-d.depth)}}if(n){var h=pr(n,s.havingStyle(r.sub()),s);c={elem:h,kern:Math.max(s.fontMetrics().bigOpSpacing2,s.fontMetrics().bigOpSpacing4-h.height)}}var m;if(u&&c){var p=s.fontMetrics().bigOpSpacing5+c.elem.height+c.elem.depth+c.kern+e.depth+o;m=fr({positionType:"bottom",positionData:p,children:[{type:"kern",size:s.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:jt(-i)},{type:"kern",size:c.kern},{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:jt(i)},{type:"kern",size:s.fontMetrics().bigOpSpacing5}]})}else if(c){var g=e.height-o;m=fr({positionType:"top",positionData:g,children:[{type:"kern",size:s.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:jt(-i)},{type:"kern",size:c.kern},{type:"elem",elem:e}]})}else if(u){var b=e.depth+o;m=fr({positionType:"bottom",positionData:b,children:[{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:jt(i)},{type:"kern",size:s.fontMetrics().bigOpSpacing5}]})}else return e;var v=[m];if(c&&i!==0&&!a){var x=vt(["mspace"],[],s);x.style.marginRight=jt(i),v.unshift(x)}return vt(["mop","op-limits"],v,s)},pX=new Set(["\\smallint"]),G1=(e,t)=>{var n,s,r=!1,i;e.type==="supsub"?(n=e.sup,s=e.sub,i=ps(e.base,"op"),r=!0):i=ps(e,"op");var o=t.style,a=!1;o.size===ss.DISPLAY.size&&i.symbol&&!pX.has(i.name)&&(a=!0);var c,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"),c=va(i.name,d,"math",t,["mop","op-symbol",a?"large-op":"small-op"]),u=c.italic,h.length>0){var m=BY(h+"Size"+(a?"2":"1"),t);c=fr({positionType:"individualShift",children:[{type:"elem",elem:c,shift:0},{type:"elem",elem:m,shift:a?.08:0}]}),i.name="\\"+h,c.classes.unshift("mop"),c.italic=u}}else if(i.body){var p=oo(i.body,t,!0);p.length===1&&p[0]instanceof Il?(c=p[0],c.classes[0]="mop"):c=vt(["mop"],p,t)}else{for(var g=[],b=1;b<i.name.length;b++)g.push(Dj(i.name[b],i.mode,t));c=vt(["mop"],g,t)}var v=0,x=0;if((c instanceof Il||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift){var y;v=(c.height-c.depth)/2-t.fontMetrics().axisHeight,x=(y=c.italic)!=null?y:0}return r?mX(c,n,s,t,o,x,v):(v&&(c.style.position="relative",c.style.top=jt(v)),c)},Pv=(e,t)=>{var n;if(e.symbol)n=new Ct("mo",[vc(e.name,e.mode)]),pX.has(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new Ct("mo",Pl(e.body,t));else{n=new Ct("mi",[new Ui(e.name.slice(1))]);var s=new Ct("mo",[vc("⁡","text")]);e.parentIsSupSub?n=new Ct("mrow",[n,s]):n=FY([n,s])}return n},W_e={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};nn({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=s;return r.length===1&&(r=W_e[r]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:G1,mathmlBuilder:Pv});nn({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:n}=e,s=t[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:qi(s)}},htmlBuilder:G1,mathmlBuilder:Pv});var G_e={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};nn({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:G1,mathmlBuilder:Pv});nn({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:G1,mathmlBuilder:Pv});nn({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(e){var{parser:t,funcName:n}=e,s=n;return s.length===1&&(s=G_e[s]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:G1,mathmlBuilder:Pv});var gX=(e,t)=>{var n,s,r=!1,i;e.type==="supsub"?(n=e.sup,s=e.sub,i=ps(e.base,"operatorname"),r=!0):i=ps(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}),c=oo(a,t.withFont("mathrm"),!0),u=0;u<c.length;u++){var d=c[u];d instanceof Il&&(d.text=d.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=vt(["mop"],c,t)}else o=vt(["mop"],[],t);return r?mX(o,n,s,t,t.style,0,0):o},K_e=(e,t)=>{for(var n=Pl(e.body,t.withFont("mathrm")),s=!0,r=0;r<n.length;r++){var i=n[r];if(!(i instanceof HY))if(i instanceof Ct)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 Ui?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):s=!1;break}default:s=!1}else s=!1}if(s){var a=n.map(d=>d.toText()).join("");n=[new Ui(a)]}var c=new Ct("mi",n);c.setAttribute("mathvariant","normal");var u=new Ct("mo",[vc("⁡","text")]);return e.parentIsSupSub?new Ct("mrow",[c,u]):FY([c,u])};nn({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0];return{type:"operatorname",mode:n.mode,body:qi(r),alwaysHandleSupSub:s==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:gX,mathmlBuilder:K_e});K("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");s0({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?uh(oo(e.body,t,!1)):vt(["mord"],oo(e.body,t,!0),t)},mathmlBuilder(e,t){return Of(e.body,t,!0)}});nn({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:n}=e,s=t[0];return{type:"overline",mode:n.mode,body:s}},htmlBuilder(e,t){var n=pr(e.body,t.havingCrampedStyle()),s=o1("overline-line",t),r=t.fontMetrics().defaultRuleThickness,i=fr({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*r},{type:"elem",elem:s},{type:"kern",size:r}]});return vt(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new Ct("mo",[new Ui("‾")]);n.setAttribute("stretchy","true");var s=new Ct("mover",[Pr(e.body,t),n]);return s.setAttribute("accent","true"),s}});nn({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=t[0];return{type:"phantom",mode:n.mode,body:qi(s)}},htmlBuilder:(e,t)=>{var n=oo(e.body,t.withPhantom(),!1);return uh(n)},mathmlBuilder:(e,t)=>{var n=Pl(e.body,t);return new Ct("mphantom",n)}});K("\\hphantom","\\smash{\\phantom{#1}}");nn({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=t[0];return{type:"vphantom",mode:n.mode,body:s}},htmlBuilder:(e,t)=>{var n=vt(["inner"],[pr(e.body,t.withPhantom())]),s=vt(["fix"],[]);return vt(["mord","rlap"],[n,s],t)},mathmlBuilder:(e,t)=>{var n=Pl(qi(e.body),t),s=new Ct("mphantom",n),r=new Ct("mpadded",[s]);return r.setAttribute("width","0px"),r}});nn({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,s=ps(t[0],"size").value,r=t[1];return{type:"raisebox",mode:n.mode,dy:s,body:r}},htmlBuilder(e,t){var n=pr(e.body,t),s=pi(e.dy,t);return fr({positionType:"shift",positionData:-s,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Ct("mpadded",[Pr(e.body,t)]),s=e.dy.number+e.dy.unit;return n.setAttribute("voffset",s),n}});nn({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});nn({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,n){var{parser:s}=e,r=n[0],i=ps(t[0],"size"),o=ps(t[1],"size");return{type:"rule",mode:s.mode,shift:r&&ps(r,"size").value,width:i.value,height:o.value}},htmlBuilder(e,t){var n=vt(["mord","rule"],[],t),s=pi(e.width,t),r=pi(e.height,t),i=e.shift?pi(e.shift,t):0;return n.style.borderRightWidth=jt(s),n.style.borderTopWidth=jt(r),n.style.bottom=jt(i),n.width=s,n.height=r+i,n.depth=-i,n.maxFontSize=r*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=pi(e.width,t),s=pi(e.height,t),r=e.shift?pi(e.shift,t):0,i=t.color&&t.getColor()||"black",o=new Ct("mspace");o.setAttribute("mathbackground",i),o.setAttribute("width",jt(n)),o.setAttribute("height",jt(s));var a=new Ct("mpadded",[o]);return r>=0?a.setAttribute("height",jt(r)):(a.setAttribute("height",jt(r)),a.setAttribute("depth",jt(-r))),a.setAttribute("voffset",jt(r)),a}});function bX(e,t,n){for(var s=oo(e,t,!1),r=t.sizeMultiplier/n.sizeMultiplier,i=0;i<s.length;i++){var o=s[i].classes.indexOf("sizing");o<0?Array.prototype.push.apply(s[i].classes,t.sizingClasses(n)):s[i].classes[o+1]==="reset-size"+t.size&&(s[i].classes[o+1]="reset-size"+n.size),s[i].height*=r,s[i].depth*=r}return uh(s)}var yB=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],Y_e=(e,t)=>{var n=t.havingSize(e.size);return bX(e.body,n,t)};nn({type:"sizing",names:yB,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:n,funcName:s,parser:r}=e,i=r.parseExpression(!1,n);return{type:"sizing",mode:r.mode,size:yB.indexOf(s)+1,body:i}},htmlBuilder:Y_e,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),s=Pl(e.body,n),r=new Ct("mstyle",s);return r.setAttribute("mathsize",jt(n.sizeMultiplier)),r}});nn({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:s}=e,r=!1,i=!1,o=n[0]&&ps(n[0],"ordgroup");if(o)for(var a,c=0;c<o.body.length;++c){var u=o.body[c];if(a=h3(u).text,a==="t")r=!0;else if(a==="b")i=!0;else{r=!1,i=!1;break}}else r=!0,i=!0;var d=t[0];return{type:"smash",mode:s.mode,body:d,smashHeight:r,smashDepth:i}},htmlBuilder:(e,t)=>{var n=vt([],[pr(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 vt(["mord","smash"],[n],t);if(n.children)for(var s=0;s<n.children.length;s++)e.smashHeight&&(n.children[s].height=0),e.smashDepth&&(n.children[s].depth=0);var r=fr({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return vt(["mord"],[r],t)},mathmlBuilder:(e,t)=>{var n=new Ct("mpadded",[Pr(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});nn({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:s}=e,r=n[0],i=t[0];return{type:"sqrt",mode:s.mode,body:i,index:r}},htmlBuilder(e,t){var n=pr(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=a1(n,t);var s=t.fontMetrics(),r=s.defaultRuleThickness,i=r;t.style.id<ss.TEXT.id&&(i=t.fontMetrics().xHeight);var o=r+i/4,a=n.height+n.depth+o+r,{span:c,ruleWidth:u,advanceWidth:d}=L_e(a,t),h=c.height-u;h>n.height+n.depth+o&&(o=(o+h-n.height-n.depth)/2);var m=c.height-n.height-o-u;n.style.paddingLeft=jt(d);var p=fr({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+m)},{type:"elem",elem:c},{type:"kern",size:u}]});if(e.index){var g=t.havingStyle(ss.SCRIPTSCRIPT),b=pr(e.index,g,t),v=.6*(p.height-p.depth),x=fr({positionType:"shift",positionData:-v,children:[{type:"elem",elem:b}]}),y=vt(["root"],[x]);return vt(["mord","sqrt"],[y,p],t)}else return vt(["mord","sqrt"],[p],t)},mathmlBuilder(e,t){var{body:n,index:s}=e;return s?new Ct("mroot",[Pr(n,t),Pr(s,t)]):new Ct("msqrt",[Pr(n,t)])}});var EE={display:ss.DISPLAY,text:ss.TEXT,script:ss.SCRIPT,scriptscript:ss.SCRIPTSCRIPT};function X_e(e){return e in EE}nn({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:n,funcName:s,parser:r}=e,i=r.parseExpression(!0,n),o=s.slice(1,s.length-5);if(!X_e(o))throw new Error("Unknown style: "+o);return{type:"styling",mode:r.mode,style:o,body:i}},htmlBuilder(e,t){var n=EE[e.style],s=t.havingStyle(n);return e.resetFont&&(s=s.withFont("")),bX(e.body,s,t)},mathmlBuilder(e,t){var n=EE[e.style],s=t.havingStyle(n);e.resetFont&&(s=s.withFont(""));var r=Pl(e.body,s),i=new Ct("mstyle",r),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},a=o[e.style];return i.setAttribute("scriptlevel",a[0]),i.setAttribute("displaystyle",a[1]),i}});var Q_e=function(t,n){var s=t.base;if(s)if(s.type==="op"){var r=s.limits&&(n.style.size===ss.DISPLAY.size||s.alwaysHandleSupSub);return r?G1:null}else if(s.type==="operatorname"){var i=s.alwaysHandleSupSub&&(n.style.size===ss.DISPLAY.size||s.limits);return i?gX:null}else{if(s.type==="accent")return lh(s.base)?Bj:null;if(s.type==="horizBrace"){var o=!t.sub;return o===s.isOver?fX:null}else return null}else return null};s0({type:"supsub",htmlBuilder(e,t){var n=Q_e(e,t);if(n)return n(e,t);var{base:s,sup:r,sub:i}=e,o=pr(s,t),a,c,u=t.fontMetrics(),d=0,h=0,m=s&&lh(s);if(r){var p=t.havingStyle(t.style.sup());a=pr(r,p,t),m||(d=o.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(i){var g=t.havingStyle(t.style.sub());c=pr(i,g,t),m||(h=o.depth+g.fontMetrics().subDrop*g.sizeMultiplier/t.sizeMultiplier)}var b;t.style===ss.DISPLAY?b=u.sup1:t.style.cramped?b=u.sup3:b=u.sup2;var v=t.sizeMultiplier,x=jt(.5/u.ptPerEm/v),y=null;if(c){var w=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(o instanceof Il||w){var k;y=jt(-((k=o.italic)!=null?k:0))}}var T;if(a&&c){d=Math.max(d,b,a.depth+.25*u.xHeight),h=Math.max(h,u.sub2);var _=u.defaultRuleThickness,C=4*_;if(d-a.depth-(c.height-h)<C){h=C-(d-a.depth)+c.height;var S=.8*u.xHeight-(d-a.depth);S>0&&(d+=S,h-=S)}var L=[{type:"elem",elem:c,shift:h,marginRight:x,marginLeft:y},{type:"elem",elem:a,shift:-d,marginRight:x}];T=fr({positionType:"individualShift",children:L})}else if(c){h=Math.max(h,u.sub1,c.height-.8*u.xHeight);var N=[{type:"elem",elem:c,marginLeft:y,marginRight:x}];T=fr({positionType:"shift",positionData:h,children:N})}else if(a)d=Math.max(d,b,a.depth+.25*u.xHeight),T=fr({positionType:"shift",positionData:-d,children:[{type:"elem",elem:a,marginRight:x}]});else throw new Error("supsub must have either sup or sub.");var $=kE(o,"right")||"mord";return vt([$],[o,vt(["msupsub"],[T])],t)},mathmlBuilder(e,t){var n=!1,s,r;e.base&&e.base.type==="horizBrace"&&(r=!!e.sup,r===e.base.isOver&&(n=!0,s=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var i=[Pr(e.base,t)];e.sub&&i.push(Pr(e.sub,t)),e.sup&&i.push(Pr(e.sup,t));var o;if(n)o=s?"mover":"munder";else if(e.sub)if(e.sup){var u=e.base;u&&u.type==="op"&&u.limits&&t.style===ss.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(t.style===ss.DISPLAY||u.limits)?o="munderover":o="msubsup"}else{var c=e.base;c&&c.type==="op"&&c.limits&&(t.style===ss.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||t.style===ss.DISPLAY)?o="munder":o="msub"}else{var a=e.base;a&&a.type==="op"&&a.limits&&(t.style===ss.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||t.style===ss.DISPLAY)?o="mover":o="msup"}return new Ct(o,i)}});s0({type:"atom",htmlBuilder(e,t){return Dj(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new Ct("mo",[vc(e.text,e.mode)]);if(e.family==="bin"){var s=Oj(e,t);s==="bold-italic"&&n.setAttribute("mathvariant",s)}else e.family==="punct"?n.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&n.setAttribute("stretchy","false");return n}});var yX={mi:"italic",mn:"normal",mtext:"normal"};s0({type:"mathord",htmlBuilder(e,t){return c3(e,t,"mathord")},mathmlBuilder(e,t){var n=new Ct("mi",[vc(e.text,e.mode,t)]),s=Oj(e,t)||"italic";return s!==yX[n.type]&&n.setAttribute("mathvariant",s),n}});s0({type:"textord",htmlBuilder(e,t){return c3(e,t,"textord")},mathmlBuilder(e,t){var n=vc(e.text,e.mode,t),s=Oj(e,t)||"normal",r;return e.mode==="text"?r=new Ct("mtext",[n]):/[0-9]/.test(e.text)?r=new Ct("mn",[n]):e.text==="\\prime"?r=new Ct("mo",[n]):r=new Ct("mi",[n]),s!==yX[r.type]&&r.setAttribute("mathvariant",s),r}});var U5={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},V5={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};s0({type:"spacing",htmlBuilder(e,t){if(V5.hasOwnProperty(e.text)){var n=V5[e.text].className||"";if(e.mode==="text"){var s=c3(e,t,"textord");return s.classes.push(n),s}else return vt(["mspace",n],[Dj(e.text,e.mode,t)],t)}else{if(U5.hasOwnProperty(e.text))return vt(["mspace",U5[e.text]],[],t);throw new kt('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(V5.hasOwnProperty(e.text))n=new Ct("mtext",[new Ui(" ")]);else{if(U5.hasOwnProperty(e.text))return new Ct("mspace");throw new kt('Unknown type of space "'+e.text+'"')}return n}});var xB=()=>{var e=new Ct("mtd",[]);return e.setAttribute("width","50%"),e};s0({type:"tag",mathmlBuilder(e,t){var n=new Ct("mtable",[new Ct("mtr",[xB(),new Ct("mtd",[Of(e.body,t)]),xB(),new Ct("mtd",[Of(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var vB={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},wB={"\\textbf":"textbf","\\textmd":"textmd"},J_e={"\\textit":"textit","\\textup":"textup"},kB=(e,t)=>{var n=e.font;if(n){if(vB[n])return t.withTextFontFamily(vB[n]);if(wB[n])return t.withTextFontWeight(wB[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(J_e[n])};nn({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:s}=e,r=t[0];return{type:"text",mode:n.mode,body:qi(r),font:s}},htmlBuilder(e,t){var n=kB(e,t),s=oo(e.body,n,!0);return vt(["mord","text"],s,n)},mathmlBuilder(e,t){var n=kB(e,t);return Of(e.body,n)}});nn({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=pr(e.body,t),s=o1("underline-line",t),r=t.fontMetrics().defaultRuleThickness,i=fr({positionType:"top",positionData:n.height,children:[{type:"kern",size:r},{type:"elem",elem:s},{type:"kern",size:3*r},{type:"elem",elem:n}]});return vt(["mord","underline"],[i],t)},mathmlBuilder(e,t){var n=new Ct("mo",[new Ui("‾")]);n.setAttribute("stretchy","true");var s=new Ct("munder",[Pr(e.body,t),n]);return s.setAttribute("accentunder","true"),s}});nn({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=pr(e.body,t),s=t.fontMetrics().axisHeight,r=.5*(n.height-s-(n.depth+s));return fr({positionType:"shift",positionData:r,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Ct("mpadded",[Pr(e.body,t)],["vcenter"]);return new Ct("mrow",[n])}});nn({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new kt("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=_B(e),s=[],r=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var o=n[i];o==="~"&&(o="\\textasciitilde"),s.push(va(o,"Typewriter-Regular",e.mode,r,["mord","texttt"]))}return vt(["mord","text"].concat(r.sizingClasses(t)),LY(s),r)},mathmlBuilder(e,t){var n=new Ui(_B(e)),s=new Ct("mtext",[n]);return s.setAttribute("mathvariant","monospace"),s}});var _B=e=>e.body.replace(/ /g,e.star?"␣":" "),rf=$Y,xX=`[ \r
	]`,Z_e="\\\\[a-zA-Z@]+",e2e="\\\\[^\uD800-\uDFFF]",t2e="("+Z_e+")"+xX+"*",n2e=`\\\\(
|[ \r	]+
?)[ \r	]*`,AE="[̀-ͯ]",s2e=new RegExp(AE+"+$"),r2e="("+xX+"+)|"+(n2e+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(AE+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(AE+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+t2e)+("|"+e2e+")");class SB{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(r2e,"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 Al("EOF",new Ga(this,n,n));var s=this.tokenRegex.exec(t);if(s===null||s.index!==n)throw new kt("Unexpected character: '"+t[n]+"'",new Al(t[n],new Ga(this,n,n+1)));var r=s[6]||s[3]||(s[2]?"\\ ":" ");if(this.catcodes[r]===14){var i=t.indexOf(`
`,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new Al(r,new Ga(this,n,this.tokenRegex.lastIndex))}}class i2e{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 kt("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var n in t)t.hasOwnProperty(n)&&(t[n]==null?delete this.current[n]:this.current[n]=t[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,n,s){if(s===void 0&&(s=!1),s){for(var r=0;r<this.undefStack.length;r++)delete this.undefStack[r][t];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][t]=n)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(t)&&(i[t]=this.current[t])}n==null?delete this.current[t]:this.current[t]=n}}var o2e=lX;K("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});K("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});K("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});K("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});K("\\@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}});K("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");K("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var CB={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};K("\\char",function(e){var t=e.popToken(),n,s=0;if(t.text==="'")n=8,t=e.popToken();else if(t.text==='"')n=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")s=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new kt("\\char` missing argument");s=t.text.charCodeAt(0)}else n=10;if(n){if(s=CB[t.text],s==null||s>=n)throw new kt("Invalid base-"+n+" digit "+t.text);for(var r;(r=CB[e.future().text])!=null&&r<n;)s*=n,s+=r,e.popToken()}return"\\@char{"+s+"}"});var Hj=(e,t,n,s)=>{var r=e.consumeArg().tokens;if(r.length!==1)throw new kt("\\newcommand's first argument must be a macro name");var i=r[0].text,o=e.isDefined(i);if(o&&!t)throw new kt("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!o&&!n)throw new kt("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var a=0;if(r=e.consumeArg().tokens,r.length===1&&r[0].text==="["){for(var c="",u=e.expandNextToken();u.text!=="]"&&u.text!=="EOF";)c+=u.text,u=e.expandNextToken();if(!c.match(/^\s*[0-9]+\s*$/))throw new kt("Invalid number of arguments: "+c);a=parseInt(c),r=e.consumeArg().tokens}return o&&s||e.macros.set(i,{tokens:r,numArgs:a}),""};K("\\newcommand",e=>Hj(e,!1,!0,!1));K("\\renewcommand",e=>Hj(e,!0,!1,!1));K("\\providecommand",e=>Hj(e,!0,!0,!0));K("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(n=>n.text).join("")),""});K("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(n=>n.text).join("")),""});K("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),rf[n],oi.math[n],oi.text[n]),""});K("\\bgroup","{");K("\\egroup","}");K("~","\\nobreakspace");K("\\lq","`");K("\\rq","'");K("\\aa","\\r a");K("\\AA","\\r A");K("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");K("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");K("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");K("ℬ","\\mathscr{B}");K("ℰ","\\mathscr{E}");K("ℱ","\\mathscr{F}");K("ℋ","\\mathscr{H}");K("ℐ","\\mathscr{I}");K("ℒ","\\mathscr{L}");K("ℳ","\\mathscr{M}");K("ℛ","\\mathscr{R}");K("ℭ","\\mathfrak{C}");K("ℌ","\\mathfrak{H}");K("ℨ","\\mathfrak{Z}");K("\\Bbbk","\\Bbb{k}");K("\\llap","\\mathllap{\\textrm{#1}}");K("\\rlap","\\mathrlap{\\textrm{#1}}");K("\\clap","\\mathclap{\\textrm{#1}}");K("\\mathstrut","\\vphantom{(}");K("\\underbar","\\underline{\\text{#1}}");K("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');K("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");K("\\ne","\\neq");K("≠","\\neq");K("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");K("∉","\\notin");K("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");K("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");K("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");K("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");K("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");K("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");K("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");K("⟂","\\perp");K("‼","\\mathclose{!\\mkern-0.8mu!}");K("∌","\\notni");K("⌜","\\ulcorner");K("⌝","\\urcorner");K("⌞","\\llcorner");K("⌟","\\lrcorner");K("©","\\copyright");K("®","\\textregistered");K("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');K("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');K("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');K("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');K("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");K("⋮","\\vdots");K("\\varGamma","\\mathit{\\Gamma}");K("\\varDelta","\\mathit{\\Delta}");K("\\varTheta","\\mathit{\\Theta}");K("\\varLambda","\\mathit{\\Lambda}");K("\\varXi","\\mathit{\\Xi}");K("\\varPi","\\mathit{\\Pi}");K("\\varSigma","\\mathit{\\Sigma}");K("\\varUpsilon","\\mathit{\\Upsilon}");K("\\varPhi","\\mathit{\\Phi}");K("\\varPsi","\\mathit{\\Psi}");K("\\varOmega","\\mathit{\\Omega}");K("\\substack","\\begin{subarray}{c}#1\\end{subarray}");K("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");K("\\boxed","\\fbox{$\\displaystyle{#1}$}");K("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");K("\\implies","\\DOTSB\\;\\Longrightarrow\\;");K("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");K("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");K("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var TB={",":"\\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"},a2e=new Set(["bin","rel"]);K("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in TB?t=TB[n]:(n.slice(0,4)==="\\not"||n in oi.math&&a2e.has(oi.math[n].group))&&(t="\\dotsb"),t});var qj={")":!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};K("\\dotso",function(e){var t=e.future().text;return t in qj?"\\ldots\\,":"\\ldots"});K("\\dotsc",function(e){var t=e.future().text;return t in qj&&t!==","?"\\ldots\\,":"\\ldots"});K("\\cdots",function(e){var t=e.future().text;return t in qj?"\\@cdots\\,":"\\@cdots"});K("\\dotsb","\\cdots");K("\\dotsm","\\cdots");K("\\dotsi","\\!\\cdots");K("\\dotsx","\\ldots\\,");K("\\DOTSI","\\relax");K("\\DOTSB","\\relax");K("\\DOTSX","\\relax");K("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");K("\\,","\\tmspace+{3mu}{.1667em}");K("\\thinspace","\\,");K("\\>","\\mskip{4mu}");K("\\:","\\tmspace+{4mu}{.2222em}");K("\\medspace","\\:");K("\\;","\\tmspace+{5mu}{.2777em}");K("\\thickspace","\\;");K("\\!","\\tmspace-{3mu}{.1667em}");K("\\negthinspace","\\!");K("\\negmedspace","\\tmspace-{4mu}{.2222em}");K("\\negthickspace","\\tmspace-{5mu}{.277em}");K("\\enspace","\\kern.5em ");K("\\enskip","\\hskip.5em\\relax");K("\\quad","\\hskip1em\\relax");K("\\qquad","\\hskip2em\\relax");K("\\tag","\\@ifstar\\tag@literal\\tag@paren");K("\\tag@paren","\\tag@literal{({#1})}");K("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new kt("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});K("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");K("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");K("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");K("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");K("\\newline","\\\\\\relax");K("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var vX=jt(Tu["Main-Regular"][84][1]-.7*Tu["Main-Regular"][65][1]);K("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+vX+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");K("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+vX+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");K("\\hspace","\\@ifstar\\@hspacer\\@hspace");K("\\@hspace","\\hskip #1\\relax");K("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");K("\\ordinarycolon",":");K("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");K("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');K("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');K("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');K("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');K("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');K("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');K("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');K("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');K("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');K("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');K("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');K("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');K("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');K("∷","\\dblcolon");K("∹","\\eqcolon");K("≔","\\coloneqq");K("≕","\\eqqcolon");K("⩴","\\Coloneqq");K("\\ratio","\\vcentcolon");K("\\coloncolon","\\dblcolon");K("\\colonequals","\\coloneqq");K("\\coloncolonequals","\\Coloneqq");K("\\equalscolon","\\eqqcolon");K("\\equalscoloncolon","\\Eqqcolon");K("\\colonminus","\\coloneq");K("\\coloncolonminus","\\Coloneq");K("\\minuscolon","\\eqcolon");K("\\minuscoloncolon","\\Eqcolon");K("\\coloncolonapprox","\\Colonapprox");K("\\coloncolonsim","\\Colonsim");K("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");K("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");K("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");K("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");K("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");K("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");K("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");K("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");K("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");K("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");K("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");K("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");K("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");K("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");K("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");K("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");K("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");K("\\nleqq","\\html@mathml{\\@nleqq}{≰}");K("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");K("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");K("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");K("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");K("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");K("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");K("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");K("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");K("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");K("\\imath","\\html@mathml{\\@imath}{ı}");K("\\jmath","\\html@mathml{\\@jmath}{ȷ}");K("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");K("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");K("⟦","\\llbracket");K("⟧","\\rrbracket");K("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");K("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");K("⦃","\\lBrace");K("⦄","\\rBrace");K("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");K("⦵","\\minuso");K("\\darr","\\downarrow");K("\\dArr","\\Downarrow");K("\\Darr","\\Downarrow");K("\\lang","\\langle");K("\\rang","\\rangle");K("\\uarr","\\uparrow");K("\\uArr","\\Uparrow");K("\\Uarr","\\Uparrow");K("\\N","\\mathbb{N}");K("\\R","\\mathbb{R}");K("\\Z","\\mathbb{Z}");K("\\alef","\\aleph");K("\\alefsym","\\aleph");K("\\Alpha","\\mathrm{A}");K("\\Beta","\\mathrm{B}");K("\\bull","\\bullet");K("\\Chi","\\mathrm{X}");K("\\clubs","\\clubsuit");K("\\cnums","\\mathbb{C}");K("\\Complex","\\mathbb{C}");K("\\Dagger","\\ddagger");K("\\diamonds","\\diamondsuit");K("\\empty","\\emptyset");K("\\Epsilon","\\mathrm{E}");K("\\Eta","\\mathrm{H}");K("\\exist","\\exists");K("\\harr","\\leftrightarrow");K("\\hArr","\\Leftrightarrow");K("\\Harr","\\Leftrightarrow");K("\\hearts","\\heartsuit");K("\\image","\\Im");K("\\infin","\\infty");K("\\Iota","\\mathrm{I}");K("\\isin","\\in");K("\\Kappa","\\mathrm{K}");K("\\larr","\\leftarrow");K("\\lArr","\\Leftarrow");K("\\Larr","\\Leftarrow");K("\\lrarr","\\leftrightarrow");K("\\lrArr","\\Leftrightarrow");K("\\Lrarr","\\Leftrightarrow");K("\\Mu","\\mathrm{M}");K("\\natnums","\\mathbb{N}");K("\\Nu","\\mathrm{N}");K("\\Omicron","\\mathrm{O}");K("\\plusmn","\\pm");K("\\rarr","\\rightarrow");K("\\rArr","\\Rightarrow");K("\\Rarr","\\Rightarrow");K("\\real","\\Re");K("\\reals","\\mathbb{R}");K("\\Reals","\\mathbb{R}");K("\\Rho","\\mathrm{P}");K("\\sdot","\\cdot");K("\\sect","\\S");K("\\spades","\\spadesuit");K("\\sub","\\subset");K("\\sube","\\subseteq");K("\\supe","\\supseteq");K("\\Tau","\\mathrm{T}");K("\\thetasym","\\vartheta");K("\\weierp","\\wp");K("\\Zeta","\\mathrm{Z}");K("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");K("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");K("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");K("\\bra","\\mathinner{\\langle{#1}|}");K("\\ket","\\mathinner{|{#1}\\rangle}");K("\\braket","\\mathinner{\\langle{#1}\\rangle}");K("\\Bra","\\left\\langle#1\\right|");K("\\Ket","\\left|#1\\right\\rangle");var wX=e=>t=>{var n=t.consumeArg().tokens,s=t.consumeArg().tokens,r=t.consumeArg().tokens,i=t.consumeArg().tokens,o=t.macros.get("|"),a=t.macros.get("\\|");t.macros.beginGroup();var c=h=>m=>{e&&(m.macros.set("|",o),r.length&&m.macros.set("\\|",a));var p=h;if(!h&&r.length){var g=m.future();g.text==="|"&&(m.popToken(),p=!0)}return{tokens:p?r:s,numArgs:0}};t.macros.set("|",c(!1)),r.length&&t.macros.set("\\|",c(!0));var u=t.consumeArg().tokens,d=t.expandTokens([...i,...u,...n]);return t.macros.endGroup(),{tokens:d.reverse(),numArgs:0}};K("\\bra@ket",wX(!1));K("\\bra@set",wX(!0));K("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");K("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");K("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");K("\\angln","{\\angl n}");K("\\blue","\\textcolor{##6495ed}{#1}");K("\\orange","\\textcolor{##ffa500}{#1}");K("\\pink","\\textcolor{##ff00af}{#1}");K("\\red","\\textcolor{##df0030}{#1}");K("\\green","\\textcolor{##28ae7b}{#1}");K("\\gray","\\textcolor{gray}{#1}");K("\\purple","\\textcolor{##9d38bd}{#1}");K("\\blueA","\\textcolor{##ccfaff}{#1}");K("\\blueB","\\textcolor{##80f6ff}{#1}");K("\\blueC","\\textcolor{##63d9ea}{#1}");K("\\blueD","\\textcolor{##11accd}{#1}");K("\\blueE","\\textcolor{##0c7f99}{#1}");K("\\tealA","\\textcolor{##94fff5}{#1}");K("\\tealB","\\textcolor{##26edd5}{#1}");K("\\tealC","\\textcolor{##01d1c1}{#1}");K("\\tealD","\\textcolor{##01a995}{#1}");K("\\tealE","\\textcolor{##208170}{#1}");K("\\greenA","\\textcolor{##b6ffb0}{#1}");K("\\greenB","\\textcolor{##8af281}{#1}");K("\\greenC","\\textcolor{##74cf70}{#1}");K("\\greenD","\\textcolor{##1fab54}{#1}");K("\\greenE","\\textcolor{##0d923f}{#1}");K("\\goldA","\\textcolor{##ffd0a9}{#1}");K("\\goldB","\\textcolor{##ffbb71}{#1}");K("\\goldC","\\textcolor{##ff9c39}{#1}");K("\\goldD","\\textcolor{##e07d10}{#1}");K("\\goldE","\\textcolor{##a75a05}{#1}");K("\\redA","\\textcolor{##fca9a9}{#1}");K("\\redB","\\textcolor{##ff8482}{#1}");K("\\redC","\\textcolor{##f9685d}{#1}");K("\\redD","\\textcolor{##e84d39}{#1}");K("\\redE","\\textcolor{##bc2612}{#1}");K("\\maroonA","\\textcolor{##ffbde0}{#1}");K("\\maroonB","\\textcolor{##ff92c6}{#1}");K("\\maroonC","\\textcolor{##ed5fa6}{#1}");K("\\maroonD","\\textcolor{##ca337c}{#1}");K("\\maroonE","\\textcolor{##9e034e}{#1}");K("\\purpleA","\\textcolor{##ddd7ff}{#1}");K("\\purpleB","\\textcolor{##c6b9fc}{#1}");K("\\purpleC","\\textcolor{##aa87ff}{#1}");K("\\purpleD","\\textcolor{##7854ab}{#1}");K("\\purpleE","\\textcolor{##543b78}{#1}");K("\\mintA","\\textcolor{##f5f9e8}{#1}");K("\\mintB","\\textcolor{##edf2df}{#1}");K("\\mintC","\\textcolor{##e0e5cc}{#1}");K("\\grayA","\\textcolor{##f6f7f7}{#1}");K("\\grayB","\\textcolor{##f0f1f2}{#1}");K("\\grayC","\\textcolor{##e3e5e6}{#1}");K("\\grayD","\\textcolor{##d6d8da}{#1}");K("\\grayE","\\textcolor{##babec2}{#1}");K("\\grayF","\\textcolor{##888d93}{#1}");K("\\grayG","\\textcolor{##626569}{#1}");K("\\grayH","\\textcolor{##3b3e40}{#1}");K("\\grayI","\\textcolor{##21242c}{#1}");K("\\kaBlue","\\textcolor{##314453}{#1}");K("\\kaGreen","\\textcolor{##71B307}{#1}");var kX={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class l2e{constructor(t,n,s){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(t),this.macros=new i2e(o2e,n.macros),this.mode=s,this.stack=[]}feed(t){this.lexer=new SB(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var n,s,r;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:r,end:s}=this.consumeArg(["]"])}else({tokens:r,start:n,end:s}=this.consumeArg());return this.pushToken(new Al("EOF",s.loc)),this.pushTokens(r),new Al("",Ga.range(n,s))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var n=[],s=t&&t.length>0;s||this.consumeSpaces();var r=this.future(),i,o=0,a=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++o;else if(i.text==="}"){if(--o,o===-1)throw new kt("Extra }",i)}else if(i.text==="EOF")throw new kt("Unexpected end of input in a macro argument, expected '"+(t&&s?t[a]:"}")+"'",i);if(t&&s)if((o===0||o===1&&t[a]==="{")&&i.text===t[a]){if(++a,a===t.length){n.splice(-a,a);break}}else a=0}while(o!==0||s);return r.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:r,end:i}}consumeArgs(t,n){if(n){if(n.length!==t+1)throw new kt("The length of delimiters doesn't match the number of args!");for(var s=n[0],r=0;r<s.length;r++){var i=this.popToken();if(s[r]!==i.text)throw new kt("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 kt("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var n=this.popToken(),s=n.text,r=n.noexpand?null:this._getExpansion(s);if(r==null||t&&r.unexpandable){if(t&&r==null&&s[0]==="\\"&&!this.isDefined(s))throw new kt("Undefined control sequence: "+s);return this.pushToken(n),!1}this.countExpansion(1);var i=r.tokens,o=this.consumeArgs(r.numArgs,r.delimiters);if(r.numArgs){i=i.slice();for(var a=i.length-1;a>=0;--a){var c=i[a];if(c.text==="#"){if(a===0)throw new kt("Incomplete placeholder at end of macro body",c);if(c=i[--a],c.text==="#")i.splice(a+1,1);else if(/^[1-9]$/.test(c.text))i.splice(a,2,...o[+c.text-1]);else throw new kt("Not a valid argument number",c)}}}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 Al(t)]):void 0}expandTokens(t){var n=[],s=this.stack.length;for(this.pushTokens(t);this.stack.length>s;)if(this.expandOnce(!0)===!1){var r=this.stack.pop();r.treatAsRelax&&(r.noexpand=!1,r.treatAsRelax=!1),n.push(r)}return this.countExpansion(n.length),n}expandMacroAsText(t){var n=this.expandMacro(t);return n&&n.map(s=>s.text).join("")}_getExpansion(t){var n=this.macros.get(t);if(n==null)return n;if(t.length===1){var s=this.lexer.catcodes[t];if(s!=null&&s!==13)return}var r=typeof n=="function"?n(this):n;if(typeof r=="string"){var i=0;if(r.includes("#"))for(var o=r.replace(/##/g,"");o.includes("#"+(i+1));)++i;for(var a=new SB(r,this.settings),c=[],u=a.lex();u.text!=="EOF";)c.push(u),u=a.lex();c.reverse();var d={tokens:c,numArgs:i};return d}return r}isDefined(t){return this.macros.has(t)||rf.hasOwnProperty(t)||oi.math.hasOwnProperty(t)||oi.text.hasOwnProperty(t)||kX.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:rf.hasOwnProperty(t)&&!rf[t].primitive}}var EB=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,bk=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),W5={"́":{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"}},AB={á:"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 _X=class SX{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 l2e(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 kt("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 Al("}")),this.gullet.pushTokens(t);var s=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,s}parseExpression(t,n){for(var s=[];;){this.mode==="math"&&this.consumeSpaces();var r=this.fetch();if(SX.endOfExpression.has(r.text)||n&&r.text===n||t&&rf[r.text]&&rf[r.text].infix)break;var i=this.parseAtom(n);if(i){if(i.type==="internal")continue}else break;s.push(i)}return this.mode==="text"&&this.formLigatures(s),this.handleInfixNodes(s)}handleInfixNodes(t){for(var n=-1,s,r=0;r<t.length;r++){var i=t[r];if(i.type==="infix"){if(n!==-1)throw new kt("only one infix operator per group",i.token);n=r,s=i.replaceWith}}if(n!==-1&&s){var o,a,c=t.slice(0,n),u=t.slice(n+1);c.length===1&&c[0].type==="ordgroup"?o=c[0]:o={type:"ordgroup",mode:this.mode,body:c},u.length===1&&u[0].type==="ordgroup"?a=u[0]:a={type:"ordgroup",mode:this.mode,body:u};var d;return s==="\\\\abovefrac"?d=this.callFunction(s,[o,t[n],a],[]):d=this.callFunction(s,[o,a],[]),[d]}else return t}handleSupSubscript(t){var n=this.fetch(),s=n.text;this.consume(),this.consumeSpaces();var r;do{var i;r=this.parseGroup(t)}while(((i=r)==null?void 0:i.type)==="internal");if(!r)throw new kt("Expected group after '"+s+"'",n);return r}formatUnsupportedCmd(t){for(var n=[],s=0;s<t.length;s++)n.push({type:"textord",mode:"text",text:t[s]});var r={type:"text",mode:this.mode,body:n},i={type:"color",mode:this.mode,color:this.settings.errorColor,body:[r]};return i}parseAtom(t){var n=this.parseGroup("atom",t);if((n==null?void 0:n.type)==="internal"||this.mode==="text")return n;for(var s,r;;){this.consumeSpaces();var i=this.fetch();if(i.text==="\\limits"||i.text==="\\nolimits"){if(n&&n.type==="op"){var o=i.text==="\\limits";n.limits=o,n.alwaysHandleSupSub=!0}else if(n&&n.type==="operatorname")n.alwaysHandleSupSub&&(n.limits=i.text==="\\limits");else throw new kt("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(s)throw new kt("Double superscript",i);s=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(r)throw new kt("Double subscript",i);r=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(s)throw new kt("Double superscript",i);var a={type:"textord",mode:this.mode,text:"\\prime"},c=[a];for(this.consume();this.fetch().text==="'";)c.push(a),this.consume();this.fetch().text==="^"&&c.push(this.handleSupSubscript("superscript")),s={type:"ordgroup",mode:this.mode,body:c}}else if(bk[i.text]){var u=EB.test(i.text),d=[];for(d.push(new Al(bk[i.text])),this.consume();;){var h=this.fetch().text;if(!bk[h]||EB.test(h)!==u)break;d.unshift(new Al(bk[h])),this.consume()}var m=this.subparse(d);u?r={type:"ordgroup",mode:"math",body:m}:s={type:"ordgroup",mode:"math",body:m}}else break}return s||r?{type:"supsub",mode:this.mode,base:n,sup:s,sub:r}:n}parseFunction(t,n){var s=this.fetch(),r=s.text,i=rf[r];if(!i)return null;if(this.consume(),n&&n!=="atom"&&!i.allowedInArgument)throw new kt("Got function '"+r+"' with no arguments"+(n?" as "+n:""),s);if(this.mode==="text"&&!i.allowedInText)throw new kt("Can't use function '"+r+"' in text mode",s);if(this.mode==="math"&&i.allowedInMath===!1)throw new kt("Can't use function '"+r+"' in math mode",s);var{args:o,optArgs:a}=this.parseArguments(r,i);return this.callFunction(r,o,a,s,t)}callFunction(t,n,s,r,i){var o={funcName:t,parser:this,token:r,breakOnTokenText:i},a=rf[t];if(a&&a.handler)return a.handler(o,n,s);throw new kt("No function handler for "+t)}parseArguments(t,n){var s=n.numArgs+n.numOptionalArgs;if(s===0)return{args:[],optArgs:[]};for(var r=[],i=[],o=0;o<s;o++){var a=n.argTypes&&n.argTypes[o],c=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,c);if(c)i.push(u);else if(u!=null)r.push(u);else throw new kt("Null argument, please report this as a bug")}return{args:r,optArgs:i}}parseGroupOfType(t,n,s){switch(n){case"color":return this.parseColorGroup(s);case"size":return this.parseSizeGroup(s);case"url":return this.parseUrlGroup(s);case"math":case"text":return this.parseArgumentGroup(s,n);case"hbox":{var r=this.parseArgumentGroup(s,"text");return r!=null?{type:"styling",mode:r.mode,body:[r],style:"text",resetFont:!0}:null}case"raw":{var i=this.parseStringGroup("raw",s);return i!=null?{type:"raw",mode:"text",string:i.text}:null}case"primitive":{if(s)throw new kt("A primitive argument cannot be optional");var o=this.parseGroup(t);if(o==null)throw new kt("Expected group as "+t,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(s);default:throw new kt("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(t,n){var s=this.gullet.scanArgument(n);if(s==null)return null;for(var r="",i;(i=this.fetch()).text!=="EOF";)r+=i.text,this.consume();return this.consume(),s.text=r,s}parseRegexGroup(t,n){for(var s=this.fetch(),r=s,i="",o;(o=this.fetch()).text!=="EOF"&&t.test(i+o.text);)r=o,i+=r.text,this.consume();if(i==="")throw new kt("Invalid "+n+": '"+s.text+"'",s);return s.range(r,i)}parseColorGroup(t){var n=this.parseStringGroup("color",t);if(n==null)return null;var s=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(n.text);if(!s)throw new kt("Invalid color: '"+n.text+"'",n);var r=s[0];return/^[0-9a-f]{6}$/i.test(r)&&(r="#"+r),{type:"color-token",mode:this.mode,color:r}}parseSizeGroup(t){var n,s=!1;if(this.gullet.consumeSpaces(),!t&&this.gullet.future().text!=="{"?n=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):n=this.parseStringGroup("size",t),!n)return null;!t&&n.text.length===0&&(n.text="0pt",s=!0);var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(n.text);if(!r)throw new kt("Invalid size: '"+n.text+"'",n);var i={number:+(r[1]+r[2]),unit:r[3]};if(!NY(i))throw new kt("Invalid unit: '"+i.unit+"'",n);return{type:"size",mode:this.mode,value:i,isBlank:s}}parseUrlGroup(t){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var n=this.parseStringGroup("url",t);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),n==null)return null;var s=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:s}}parseArgumentGroup(t,n){var s=this.gullet.scanArgument(t);if(s==null)return null;var r=this.mode;n&&this.switchMode(n),this.gullet.beginGroup();var i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:s.loc,body:i};return n&&this.switchMode(r),o}parseGroup(t,n){var s=this.fetch(),r=s.text,i;if(r==="{"||r==="\\begingroup"){this.consume();var o=r==="{"?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,o),c=this.fetch();this.expect(o),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:Ga.range(s,c),body:a,semisimple:r==="\\begingroup"||void 0}}else if(i=this.parseFunction(n,t)||this.parseSymbol(),i==null&&r[0]==="\\"&&!kX.hasOwnProperty(r)){if(this.settings.throwOnError)throw new kt("Undefined control sequence: "+r,s);i=this.formatUnsupportedCmd(r),this.consume()}return i}formLigatures(t){for(var n=t.length-1,s=0;s<n;++s){var r=t[s];if(r.type==="textord"){var i=r.text,o=t[s+1];if(!(!o||o.type!=="textord")){if(i==="-"&&o.text==="-"){var a=t[s+2];s+1<n&&a&&a.type==="textord"&&a.text==="-"?(t.splice(s,3,{type:"textord",mode:"text",loc:Ga.range(r,a),text:"---"}),n-=2):(t.splice(s,2,{type:"textord",mode:"text",loc:Ga.range(r,o),text:"--"}),n-=1)}(i==="'"||i==="`")&&o.text===i&&(t.splice(s,2,{type:"textord",mode:"text",loc:Ga.range(r,o),text:i+i}),n-=1)}}}}parseSymbol(){var t=this.fetch(),n=t.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();var s=n.slice(5),r=s.charAt(0)==="*";if(r&&(s=s.slice(1)),s.length<2||s.charAt(0)!==s.slice(-1))throw new kt(`\\verb assertion failed --
                    please report what input caused this bug`);return s=s.slice(1,-1),{type:"verb",mode:"text",body:s,star:r}}AB.hasOwnProperty(n[0])&&!oi[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=AB[n[0]]+n.slice(1));var i=s2e.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if(oi[this.mode][n]){this.settings.strict&&this.mode==="math"&&mE.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var a=oi[this.mode][n].group,c=Ga.range(t),u;S_e(a)?u={type:"atom",mode:this.mode,family:a,loc:c,text:n}:u={type:a,mode:this.mode,loc:c,text:n},o=u}else if(n.charCodeAt(0)>=128)this.settings.strict&&(AY(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:Ga.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(!W5[h])throw new kt("Unknown accent ' "+h+"'",t);var m=W5[h][this.mode]||W5[h].text;if(!m)throw new kt("Accent "+h+" unsupported in "+this.mode+" mode",t);o={type:"accent",mode:this.mode,loc:Ga.range(t),label:m,isStretchy:!1,isShifty:!0,base:o}}return o}};_X.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var Uj=function(t,n){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var s=new _X(t,n);delete s.gullet.macros.current["\\df@tag"];var r=s.parse();if(delete s.gullet.macros.current["\\current@color"],delete s.gullet.macros.current["\\color"],s.gullet.macros.get("\\df@tag")){if(!n.displayMode)throw new kt("\\tag works only in display equations");r=[{type:"tag",mode:"text",body:r,tag:s.subparse([new Al("\\df@tag")])}]}return r},Vj=function(t,n,s){n.textContent="";var r=x3(t,s).toNode();n.appendChild(r)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),Vj=function(){throw new kt("KaTeX doesn't work in quirks mode.")});var CX=function(t,n){var s=x3(t,n).toMarkup();return s},TX=function(t,n){var s=new jj(n);return Uj(t,s)},EX=function(t,n,s){if(s.throwOnError||!(t instanceof kt))throw t;var r=vt(["katex-error"],[new Il(n)]);return r.setAttribute("title",t.toString()),r.setAttribute("style","color:"+s.errorColor),r},x3=function(t,n){var s=new jj(n);try{var r=Uj(t,s);return g_e(r,t,s)}catch(i){return EX(i,t,s)}},AX=function(t,n){var s=new jj(n);try{var r=Uj(t,s);return b_e(r,t,s)}catch(i){return EX(i,t,s)}},NX="0.16.47",jX={Span:V1,Anchor:a3,SymbolNode:Il,SvgNode:eh,PathNode:Lf,LineNode:fE},NE={version:NX,render:Vj,renderToString:CX,ParseError:kt,SETTINGS_SCHEMA:cS,__parse:TX,__renderToDomTree:x3,__renderToHTMLTree:AX,__setFontMetrics:RY,__defineSymbol:A,__defineFunction:nn,__defineMacro:K,__domTree:jX};const f_t=Object.freeze(Object.defineProperty({__proto__:null,ParseError:kt,SETTINGS_SCHEMA:cS,__defineFunction:nn,__defineMacro:K,__defineSymbol:A,__domTree:jX,__parse:TX,__renderToDomTree:x3,__renderToHTMLTree:AX,__setFontMetrics:RY,default:NE,get render(){return Vj},renderToString:CX,version:NX},Symbol.toStringTag,{value:"Module"})),c2e={};function NB(e){const t=this,n=e||c2e,s=t.data(),r=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);r.push(bke(n)),i.push(cke()),o.push(uke(n))}const jB=/[#.]/g;function u2e(e,t){const n=e||"",s={};let r=0,i,o;for(;r<n.length;){jB.lastIndex=r;const a=jB.exec(n),c=n.slice(r,a?a.index:n.length);c&&(i?i==="#"?s.id=c:Array.isArray(s.className)?s.className.push(c):s.className=[c]:o=c,r+=c.length),a&&(i=a[0],r++)}return{type:"element",tagName:o||t||"div",properties:s,children:[]}}function MX(e,t,n){const s=n?m2e(n):void 0;function r(i,o,...a){let c;if(i==null){c={type:"root",children:[]};const u=o;a.unshift(u)}else{c=u2e(i,t);const u=c.tagName.toLowerCase(),d=s?s.get(u):void 0;if(c.tagName=d||u,d2e(o))a.unshift(o);else for(const[h,m]of Object.entries(o))h2e(e,c.properties,h,m)}for(const u of a)jE(c.children,u);return c.type==="element"&&c.tagName==="template"&&(c.content={type:"root",children:c.children},c.children=[]),c}return r}function d2e(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const s of n){const r=t[s];if(r&&typeof r=="object"){if(!Array.isArray(r))return!0;const i=r;for(const o of i)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function h2e(e,t,n,s){const r=uj(e,n);let i;if(s!=null){if(typeof s=="number"){if(Number.isNaN(s))return;i=s}else typeof s=="boolean"?i=s:typeof s=="string"?r.spaceSeparated?i=QP(s):r.commaSeparated?i=WP(s):r.commaOrSpaceSeparated?i=QP(WP(s).join(" ")):i=MB(r,r.property,s):Array.isArray(s)?i=[...s]:i=r.property==="style"?f2e(s):String(s);if(Array.isArray(i)){const o=[];for(const a of i)o.push(MB(r,r.property,a));i=o}r.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[r.property]=i}}function jE(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)jE(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?jE(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function MB(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||Nx(n)===Nx(t)))return!0}return n}function f2e(e){const t=[];for(const[n,s]of Object.entries(e))t.push([n,s].join(": "));return t.join("; ")}function m2e(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const p2e=["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"],g2e=MX(dj,"div"),b2e=MX(H1,"g",p2e),G5={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function y2e(e,t){return IX(e,{})||{type:"root",children:[]}}function IX(e,t){const n=x2e(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function x2e(e,t){switch(e.nodeType){case 1:return _2e(e,t);case 3:return w2e(e);case 8:return k2e(e);case 9:return IB(e,t);case 10:return v2e();case 11:return IB(e,t);default:return}}function IB(e,t){return{type:"root",children:RX(e,t)}}function v2e(){return{type:"doctype"}}function w2e(e){return{type:"text",value:e.nodeValue||""}}function k2e(e){return{type:"comment",value:e.nodeValue||""}}function _2e(e,t){const n=e.namespaceURI,s=n===G5.svg?b2e:g2e,r=n===G5.html?e.tagName.toLowerCase():e.tagName,i=n===G5.html&&r==="template"?e.content:e,o=e.getAttributeNames(),a={};let c=-1;for(;++c<o.length;)a[o[c]]=e.getAttribute(o[c])||"";return s(r,a,RX(i,t))}function RX(e,t){const n=e.childNodes,s=[];let r=-1;for(;++r<n.length;){const i=IX(n[r],t);i!==void 0&&s.push(i)}return s}new DOMParser;function S2e(e,t){const n=C2e(e);return y2e(n)}function C2e(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const RB=function(e,t,n){const s=Rv(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(s(e.children[t],t,e))return e.children[t]},r0=function(e){if(e==null)return A2e;if(typeof e=="string")return E2e(e);if(typeof e=="object")return T2e(e);if(typeof e=="function")return Wj(e);throw new Error("Expected function, string, or array as `test`")};function T2e(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=r0(e[n]);return Wj(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function E2e(e){return Wj(t);function t(n){return n.tagName===e}}function Wj(e){return t;function t(n,s,r){return!!(N2e(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function A2e(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function N2e(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const DB=/\n/g,LB=/[\t ]+/g,ME=r0("br"),PB=r0(O2e),j2e=r0("p"),OB=r0("tr"),M2e=r0(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",P2e,B2e]),DX=r0(["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 I2e(e,t){const n=t||{},s="children"in e?e.children:[],r=DX(e),i=OX(e,{whitespace:n.whitespace||"normal"}),o=[];(e.type==="text"||e.type==="comment")&&o.push(...PX(e,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<s.length;)o.push(...LX(s[a],e,{whitespace:i,breakBefore:a?void 0:r,breakAfter:a<s.length-1?ME(s[a+1]):r}));const c=[];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&&c.push(`
`.repeat(u)||" "),u=-1,c.push(d))}return c.join("")}function LX(e,t,n){return e.type==="element"?R2e(e,t,n):e.type==="text"?n.whitespace==="normal"?PX(e,n):D2e(e):[]}function R2e(e,t,n){const s=OX(e,n),r=e.children||[];let i=-1,o=[];if(M2e(e))return o;let a,c;for(ME(e)||OB(e)&&RB(t,e,OB)?c=`
`:j2e(e)?(a=2,c=2):DX(e)&&(a=1,c=1);++i<r.length;)o=o.concat(LX(r[i],e,{whitespace:s,breakBefore:i?void 0:a,breakAfter:i<r.length-1?ME(r[i+1]):c}));return PB(e)&&RB(t,e,PB)&&o.push("	"),a&&o.unshift(a),c&&o.push(c),o}function PX(e,t){const n=String(e.value),s=[],r=[];let i=0;for(;i<=n.length;){DB.lastIndex=i;const c=DB.exec(n),u=c&&"index"in c?c.index:n.length;s.push(L2e(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<s.length;)s[o].charCodeAt(s[o].length-1)===8203||o<s.length-1&&s[o+1].charCodeAt(0)===8203?(r.push(s[o]),a=void 0):s[o]?(typeof a=="number"&&r.push(a),r.push(s[o]),a=0):(o===0||o===s.length-1)&&r.push(0);return r}function D2e(e){return[String(e.value)]}function L2e(e,t,n){const s=[];let r=0,i;for(;r<e.length;){LB.lastIndex=r;const o=LB.exec(e);i=o?o.index:e.length,!r&&!i&&o&&!t&&s.push(""),r!==i&&s.push(e.slice(r,i)),r=o?i+o[0].length:i}return r!==i&&!n&&s.push(""),s.join(" ")}function OX(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 P2e(e){return!!(e.properties||{}).hidden}function O2e(e){return e.tagName==="td"||e.tagName==="th"}function B2e(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const $2e={},z2e=[];function BB(e){const t=e||$2e;return function(n,s){Sj(n,"element",function(r,i){const o=Array.isArray(r.properties.className)?r.properties.className:z2e,a=o.includes("language-math"),c=o.includes("math-display"),u=o.includes("math-inline");let d=c;if(!a&&!c&&!u)return;let h=i[i.length-1],m=r;if(r.tagName==="code"&&a&&h&&h.type==="element"&&h.tagName==="pre"&&(m=h,h=i[i.length-2],d=!0),!h)return;const p=I2e(m,{whitespace:"pre"});let g;try{g=NE.renderToString(p,{...t,displayMode:d,throwOnError:!0})}catch(v){const x=v,y=x.name.toLowerCase();s.message("Could not render math with KaTeX",{ancestors:[...i,r],cause:x,place:r.position,ruleId:y,source:"rehype-katex"});try{g=NE.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(v)},children:[{type:"text",value:p}]}]}}typeof g=="string"&&(g=S2e(g).children);const b=h.children.indexOf(m);return h.children.splice(b,1,...g),eY})}}const BX=[{id:"abap",name:"ABAP",import:()=>ie(()=>import("./abap-DsBKuouk.js"),[])},{id:"actionscript-3",name:"ActionScript",import:()=>ie(()=>import("./actionscript-3-D_z4Izcz.js"),[])},{id:"ada",name:"Ada",import:()=>ie(()=>import("./ada-727ZlQH0.js"),[])},{id:"angular-html",name:"Angular HTML",import:()=>ie(()=>import("./angular-html-LfdN0zeE.js").then(e=>e.f),__vite__mapDeps([0,1,2,3]))},{id:"angular-ts",name:"Angular TypeScript",import:()=>ie(()=>import("./angular-ts-CKsD7JZE.js"),__vite__mapDeps([4,0,1,2,3,5]))},{id:"apache",name:"Apache Conf",import:()=>ie(()=>import("./apache-Dn00JSTd.js"),[])},{id:"apex",name:"Apex",import:()=>ie(()=>import("./apex-COJ4H7py.js"),[])},{id:"apl",name:"APL",import:()=>ie(()=>import("./apl-BBq3IX1j.js"),__vite__mapDeps([6,1,2,3,7,8,9]))},{id:"applescript",name:"AppleScript",import:()=>ie(()=>import("./applescript-Bu5BbsvL.js"),[])},{id:"ara",name:"Ara",import:()=>ie(()=>import("./ara-7O62HKoU.js"),[])},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>ie(()=>import("./asciidoc-BPT9niGB.js"),[])},{id:"asm",name:"Assembly",import:()=>ie(()=>import("./asm-Dhn9LcZ4.js"),[])},{id:"astro",name:"Astro",import:()=>ie(()=>import("./astro-CqkE3fuf.js"),__vite__mapDeps([10,9,2,11,3,12]))},{id:"awk",name:"AWK",import:()=>ie(()=>import("./awk-eg146-Ew.js"),[])},{id:"ballerina",name:"Ballerina",import:()=>ie(()=>import("./ballerina-Du268qiB.js"),[])},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>ie(()=>import("./bat-fje9CFhw.js"),[])},{id:"beancount",name:"Beancount",import:()=>ie(()=>import("./beancount-BwXTMy5W.js"),[])},{id:"berry",name:"Berry",aliases:["be"],import:()=>ie(()=>import("./berry-3xVqZejG.js"),[])},{id:"bibtex",name:"BibTeX",import:()=>ie(()=>import("./bibtex-xW4inM5L.js"),[])},{id:"bicep",name:"Bicep",import:()=>ie(()=>import("./bicep-DHo0CJ0O.js"),[])},{id:"blade",name:"Blade",import:()=>ie(()=>import("./blade-a8OxSdnT.js"),__vite__mapDeps([13,1,2,3,7,8,14,9]))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>ie(()=>import("./bsl-Dgyn0ogV.js"),__vite__mapDeps([15,16]))},{id:"c",name:"C",import:()=>ie(()=>import("./c-C3t2pwGQ.js"),[])},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>ie(()=>import("./cadence-DNquZEk8.js"),[])},{id:"cairo",name:"Cairo",import:()=>ie(()=>import("./cairo--RitsXJZ.js"),__vite__mapDeps([17,18]))},{id:"clarity",name:"Clarity",import:()=>ie(()=>import("./clarity-BHOwM8T6.js"),[])},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>ie(()=>import("./clojure-DxSadP1t.js"),[])},{id:"cmake",name:"CMake",import:()=>ie(()=>import("./cmake-DbXoA79R.js"),[])},{id:"cobol",name:"COBOL",import:()=>ie(()=>import("./cobol-PTqiYgYu.js"),__vite__mapDeps([19,1,2,3,8]))},{id:"codeowners",name:"CODEOWNERS",import:()=>ie(()=>import("./codeowners-Bp6g37R7.js"),[])},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>ie(()=>import("./codeql-sacFqUAJ.js"),[])},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>ie(()=>import("./coffee-dyiR41kL.js"),__vite__mapDeps([20,2]))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>ie(()=>import("./common-lisp-C7gG9l05.js"),[])},{id:"coq",name:"Coq",import:()=>ie(()=>import("./coq-Dsg_Bt_b.js"),[])},{id:"cpp",name:"C++",aliases:["c++"],import:()=>ie(()=>import("./cpp-BksuvNSY.js"),__vite__mapDeps([21,22,23,24,14]))},{id:"crystal",name:"Crystal",import:()=>ie(()=>import("./crystal-DtDmRg-F.js"),__vite__mapDeps([25,1,2,3,14,24,26]))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>ie(()=>import("./csharp-D9R-vmeu.js"),[])},{id:"css",name:"CSS",import:()=>ie(()=>import("./css-BPhBrDlE.js"),[])},{id:"csv",name:"CSV",import:()=>ie(()=>import("./csv-B0qRVHPH.js"),[])},{id:"cue",name:"CUE",import:()=>ie(()=>import("./cue-DtFQj3wx.js"),[])},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>ie(()=>import("./cypher-m2LEI-9-.js"),[])},{id:"d",name:"D",import:()=>ie(()=>import("./d-BoXegm-a.js"),[])},{id:"dart",name:"Dart",import:()=>ie(()=>import("./dart-B9wLZaAG.js"),[])},{id:"dax",name:"DAX",import:()=>ie(()=>import("./dax-ClGRhx96.js"),[])},{id:"desktop",name:"Desktop",import:()=>ie(()=>import("./desktop-DEIpsLCJ.js"),[])},{id:"diff",name:"Diff",import:()=>ie(()=>import("./diff-BgYniUM_.js"),[])},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>ie(()=>import("./docker-COcR7UxN.js"),[])},{id:"dotenv",name:"dotEnv",import:()=>ie(()=>import("./dotenv-BjQB5zDj.js"),[])},{id:"dream-maker",name:"Dream Maker",import:()=>ie(()=>import("./dream-maker-C-nORZOA.js"),[])},{id:"edge",name:"Edge",import:()=>ie(()=>import("./edge-D5gP-w-T.js"),__vite__mapDeps([27,11,1,2,3,28]))},{id:"elixir",name:"Elixir",import:()=>ie(()=>import("./elixir-CLiX3zqd.js"),__vite__mapDeps([29,1,2,3]))},{id:"elm",name:"Elm",import:()=>ie(()=>import("./elm-CmHSxxaM.js"),__vite__mapDeps([30,23,24]))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>ie(()=>import("./emacs-lisp-BX77sIaO.js"),[])},{id:"erb",name:"ERB",import:()=>ie(()=>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:()=>ie(()=>import("./erlang-B-DoSBHF.js"),[])},{id:"fennel",name:"Fennel",import:()=>ie(()=>import("./fennel-bCA53EVm.js"),[])},{id:"fish",name:"Fish",import:()=>ie(()=>import("./fish-w-ucz2PV.js"),[])},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>ie(()=>import("./fluent-Dayu4EKP.js"),[])},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>ie(()=>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:()=>ie(()=>import("./fortran-free-form-DKXYxT9g.js"),[])},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>ie(()=>import("./fsharp-XplgxFYe.js"),__vite__mapDeps([41,42]))},{id:"gdresource",name:"GDResource",import:()=>ie(()=>import("./gdresource-BHYsBjWJ.js"),__vite__mapDeps([43,44,45]))},{id:"gdscript",name:"GDScript",import:()=>ie(()=>import("./gdscript-DfxzS6Rs.js"),[])},{id:"gdshader",name:"GDShader",import:()=>ie(()=>import("./gdshader-SKMF96pI.js"),[])},{id:"genie",name:"Genie",import:()=>ie(()=>import("./genie-ajMbGru0.js"),[])},{id:"gherkin",name:"Gherkin",import:()=>ie(()=>import("./gherkin--30QC5Em.js"),[])},{id:"git-commit",name:"Git Commit Message",import:()=>ie(()=>import("./git-commit-i4q6IMui.js"),__vite__mapDeps([46,47]))},{id:"git-rebase",name:"Git Rebase Message",import:()=>ie(()=>import("./git-rebase-B-v9cOL2.js"),__vite__mapDeps([48,26]))},{id:"gleam",name:"Gleam",import:()=>ie(()=>import("./gleam-B430Bg39.js"),[])},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>ie(()=>import("./glimmer-js-D-cwc0-E.js"),__vite__mapDeps([49,2,11,3,1]))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>ie(()=>import("./glimmer-ts-pgjy16dm.js"),__vite__mapDeps([50,11,3,2,1]))},{id:"glsl",name:"GLSL",import:()=>ie(()=>import("./glsl-DBO2IWDn.js"),__vite__mapDeps([23,24]))},{id:"gnuplot",name:"Gnuplot",import:()=>ie(()=>import("./gnuplot-CM8KxXT1.js"),[])},{id:"go",name:"Go",import:()=>ie(()=>import("./go-B1SYOhNW.js"),[])},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>ie(()=>import("./graphql-cDcHW_If.js"),__vite__mapDeps([34,2,11,35,36]))},{id:"groovy",name:"Groovy",import:()=>ie(()=>import("./groovy-DkBy-JyN.js"),[])},{id:"hack",name:"Hack",import:()=>ie(()=>import("./hack-D1yCygmZ.js"),__vite__mapDeps([51,1,2,3,14]))},{id:"haml",name:"Ruby Haml",import:()=>ie(()=>import("./haml-B2EZWmdv.js"),__vite__mapDeps([33,2,3]))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>ie(()=>import("./handlebars-BQGss363.js"),__vite__mapDeps([52,1,2,3,38]))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>ie(()=>import("./haskell-BILxekzW.js"),[])},{id:"haxe",name:"Haxe",import:()=>ie(()=>import("./haxe-C5wWYbrZ.js"),[])},{id:"hcl",name:"HashiCorp HCL",import:()=>ie(()=>import("./hcl-HzYwdGDm.js"),[])},{id:"hjson",name:"Hjson",import:()=>ie(()=>import("./hjson-T-Tgc4AT.js"),[])},{id:"hlsl",name:"HLSL",import:()=>ie(()=>import("./hlsl-ifBTmRxC.js"),[])},{id:"html",name:"HTML",import:()=>ie(()=>import("./html-C2L_23MC.js"),__vite__mapDeps([1,2,3]))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>ie(()=>import("./html-derivative-CSfWNPLT.js"),__vite__mapDeps([28,1,2,3]))},{id:"http",name:"HTTP",import:()=>ie(()=>import("./http-FRrOvY1W.js"),__vite__mapDeps([53,26,9,7,8,34,2,11,35,36]))},{id:"hxml",name:"HXML",import:()=>ie(()=>import("./hxml-TIA70rKU.js"),__vite__mapDeps([54,55]))},{id:"hy",name:"Hy",import:()=>ie(()=>import("./hy-BMj5Y0dO.js"),[])},{id:"imba",name:"Imba",import:()=>ie(()=>import("./imba-bv_oIlVt.js"),__vite__mapDeps([56,11]))},{id:"ini",name:"INI",aliases:["properties"],import:()=>ie(()=>import("./ini-BjABl1g7.js"),[])},{id:"java",name:"Java",import:()=>ie(()=>import("./java-xI-RfyKK.js"),[])},{id:"javascript",name:"JavaScript",aliases:["js"],import:()=>ie(()=>import("./javascript-ySlJ1b_l.js"),[])},{id:"jinja",name:"Jinja",import:()=>ie(()=>import("./jinja-DGy0s7-h.js"),__vite__mapDeps([57,1,2,3]))},{id:"jison",name:"Jison",import:()=>ie(()=>import("./jison-BqZprYcd.js"),__vite__mapDeps([58,2]))},{id:"json",name:"JSON",import:()=>ie(()=>import("./json-BQoSv7ci.js"),[])},{id:"json5",name:"JSON5",import:()=>ie(()=>import("./json5-w8dY5SsB.js"),[])},{id:"jsonc",name:"JSON with Comments",import:()=>ie(()=>import("./jsonc-TU54ms6u.js"),[])},{id:"jsonl",name:"JSON Lines",import:()=>ie(()=>import("./jsonl-DREVFZK8.js"),[])},{id:"jsonnet",name:"Jsonnet",import:()=>ie(()=>import("./jsonnet-BfivnA6A.js"),[])},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>ie(()=>import("./jssm-P4WzXJd0.js"),[])},{id:"jsx",name:"JSX",import:()=>ie(()=>import("./jsx-BAng5TT0.js"),[])},{id:"julia",name:"Julia",aliases:["jl"],import:()=>ie(()=>import("./julia-BBuGR-5E.js"),__vite__mapDeps([59,21,22,23,24,14,18,2,60]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>ie(()=>import("./kotlin-B5lbUyaz.js"),[])},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>ie(()=>import("./kusto-mebxcVVE.js"),[])},{id:"latex",name:"LaTeX",import:()=>ie(()=>import("./latex-C-cWTeAZ.js"),__vite__mapDeps([61,62,60]))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>ie(()=>import("./lean-XBlWyCtg.js"),[])},{id:"less",name:"Less",import:()=>ie(()=>import("./less-BfCpw3nA.js"),[])},{id:"liquid",name:"Liquid",import:()=>ie(()=>import("./liquid-D3W5UaiH.js"),__vite__mapDeps([63,1,2,3,9]))},{id:"log",name:"Log file",import:()=>ie(()=>import("./log-Cc5clBb7.js"),[])},{id:"logo",name:"Logo",import:()=>ie(()=>import("./logo-IuBKFhSY.js"),[])},{id:"lua",name:"Lua",import:()=>ie(()=>import("./lua-CvWAzNxB.js"),__vite__mapDeps([37,24]))},{id:"luau",name:"Luau",import:()=>ie(()=>import("./luau-Du5NY7AG.js"),[])},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>ie(()=>import("./make-Bvotw-X0.js"),[])},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>ie(()=>import("./markdown-UIAJJxZW.js"),[])},{id:"marko",name:"Marko",import:()=>ie(()=>import("./marko-z0MBrx5-.js"),__vite__mapDeps([64,3,65,5,2]))},{id:"matlab",name:"MATLAB",import:()=>ie(()=>import("./matlab-D9-PGadD.js"),[])},{id:"mdc",name:"MDC",import:()=>ie(()=>import("./mdc-DB_EDNY_.js"),__vite__mapDeps([66,42,38,28,1,2,3]))},{id:"mdx",name:"MDX",import:()=>ie(()=>import("./mdx-sdHcTMYB.js"),[])},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>ie(()=>import("./mermaid-Ci6OQyBP.js"),[])},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>ie(()=>import("./mipsasm-BC5c_5Pe.js"),[])},{id:"mojo",name:"Mojo",import:()=>ie(()=>import("./mojo-Tz6hzZYG.js"),[])},{id:"move",name:"Move",import:()=>ie(()=>import("./move-DB_GagMm.js"),[])},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>ie(()=>import("./narrat-DLbgOhZU.js"),[])},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>ie(()=>import("./nextflow-B0XVJmRM.js"),[])},{id:"nginx",name:"Nginx",import:()=>ie(()=>import("./nginx-D_VnBJ67.js"),__vite__mapDeps([67,37,24]))},{id:"nim",name:"Nim",import:()=>ie(()=>import("./nim-ZlGxZxc3.js"),__vite__mapDeps([68,24,1,2,3,7,8,23,42]))},{id:"nix",name:"Nix",import:()=>ie(()=>import("./nix-shcSOmrb.js"),[])},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>ie(()=>import("./nushell-D4Tzg5kh.js"),[])},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>ie(()=>import("./objective-c-Deuh7S70.js"),[])},{id:"objective-cpp",name:"Objective-C++",import:()=>ie(()=>import("./objective-cpp-BUEGK8hf.js"),[])},{id:"ocaml",name:"OCaml",import:()=>ie(()=>import("./ocaml-BNioltXt.js"),[])},{id:"pascal",name:"Pascal",import:()=>ie(()=>import("./pascal-JqZropPD.js"),[])},{id:"perl",name:"Perl",import:()=>ie(()=>import("./perl-CHQXSrWU.js"),__vite__mapDeps([69,1,2,3,7,8,14]))},{id:"php",name:"PHP",import:()=>ie(()=>import("./php-B5ebYQev.js"),__vite__mapDeps([70,1,2,3,7,8,14,9]))},{id:"plsql",name:"PL/SQL",import:()=>ie(()=>import("./plsql-LKU2TuZ1.js"),[])},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>ie(()=>import("./po-BFLt1xDp.js"),[])},{id:"polar",name:"Polar",import:()=>ie(()=>import("./polar-DKykz6zU.js"),[])},{id:"postcss",name:"PostCSS",import:()=>ie(()=>import("./postcss-B3ZDOciz.js"),[])},{id:"powerquery",name:"PowerQuery",import:()=>ie(()=>import("./powerquery-CSHBycmS.js"),[])},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>ie(()=>import("./powershell-BIEUsx6d.js"),[])},{id:"prisma",name:"Prisma",import:()=>ie(()=>import("./prisma-B48N-Iqd.js"),[])},{id:"prolog",name:"Prolog",import:()=>ie(()=>import("./prolog-BY-TUvya.js"),[])},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>ie(()=>import("./proto-zocC4JxJ.js"),[])},{id:"pug",name:"Pug",aliases:["jade"],import:()=>ie(()=>import("./pug-CM9l7STV.js"),__vite__mapDeps([71,2,3,1]))},{id:"puppet",name:"Puppet",import:()=>ie(()=>import("./puppet-Cza_XSSt.js"),[])},{id:"purescript",name:"PureScript",import:()=>ie(()=>import("./purescript-Bg-kzb6g.js"),[])},{id:"python",name:"Python",aliases:["py"],import:()=>ie(()=>import("./python-DhUJRlN_.js"),[])},{id:"qml",name:"QML",import:()=>ie(()=>import("./qml-D8XfuvdV.js"),__vite__mapDeps([72,2]))},{id:"qmldir",name:"QML Directory",import:()=>ie(()=>import("./qmldir-C8lEn-DE.js"),[])},{id:"qss",name:"Qt Style Sheets",import:()=>ie(()=>import("./qss-DhMKtDLN.js"),[])},{id:"r",name:"R",import:()=>ie(()=>import("./r-CwjWoCRV.js"),[])},{id:"racket",name:"Racket",import:()=>ie(()=>import("./racket-CzouJOBO.js"),[])},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>ie(()=>import("./raku-B1bQXN8T.js"),[])},{id:"razor",name:"ASP.NET Razor",import:()=>ie(()=>import("./razor-CNLDkMZG.js"),__vite__mapDeps([73,1,2,3,74]))},{id:"reg",name:"Windows Registry Script",import:()=>ie(()=>import("./reg-5LuOXUq_.js"),[])},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>ie(()=>import("./regexp-DWJ3fJO_.js"),[])},{id:"rel",name:"Rel",import:()=>ie(()=>import("./rel-DJlmqQ1C.js"),[])},{id:"riscv",name:"RISC-V",import:()=>ie(()=>import("./riscv-QhoSD0DR.js"),[])},{id:"rst",name:"reStructuredText",import:()=>ie(()=>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:()=>ie(()=>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:()=>ie(()=>import("./rust-Be6lgOlo.js"),[])},{id:"sas",name:"SAS",import:()=>ie(()=>import("./sas-BmTFh92c.js"),__vite__mapDeps([77,14]))},{id:"sass",name:"Sass",import:()=>ie(()=>import("./sass-BJ4Li9vH.js"),[])},{id:"scala",name:"Scala",import:()=>ie(()=>import("./scala-DQVVAn-B.js"),[])},{id:"scheme",name:"Scheme",import:()=>ie(()=>import("./scheme-BJGe-b2p.js"),[])},{id:"scss",name:"SCSS",import:()=>ie(()=>import("./scss-C31hgJw-.js"),__vite__mapDeps([5,3]))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>ie(()=>import("./sdbl-BLhTXw86.js"),[])},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>ie(()=>import("./shaderlab-B7qAK45m.js"),__vite__mapDeps([78,79]))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>ie(()=>import("./shellscript-atvbtKCR.js"),[])},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>ie(()=>import("./shellsession-C_rIy8kc.js"),__vite__mapDeps([80,26]))},{id:"smalltalk",name:"Smalltalk",import:()=>ie(()=>import("./smalltalk-DkLiglaE.js"),[])},{id:"solidity",name:"Solidity",import:()=>ie(()=>import("./solidity-C1w2a3ep.js"),[])},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>ie(()=>import("./soy-C-lX7w71.js"),__vite__mapDeps([81,1,2,3]))},{id:"sparql",name:"SPARQL",import:()=>ie(()=>import("./sparql-bYkjHRlG.js"),__vite__mapDeps([82,83]))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>ie(()=>import("./splunk-Cf8iN4DR.js"),[])},{id:"sql",name:"SQL",import:()=>ie(()=>import("./sql-COK4E0Yg.js"),[])},{id:"ssh-config",name:"SSH Config",import:()=>ie(()=>import("./ssh-config-BknIz3MU.js"),[])},{id:"stata",name:"Stata",import:()=>ie(()=>import("./stata-DorPZHa4.js"),__vite__mapDeps([84,14]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>ie(()=>import("./stylus-BeQkCIfX.js"),[])},{id:"svelte",name:"Svelte",import:()=>ie(()=>import("./svelte-MSaWC3Je.js"),__vite__mapDeps([85,2,11,3,12]))},{id:"swift",name:"Swift",import:()=>ie(()=>import("./swift-BSxZ-RaX.js"),[])},{id:"system-verilog",name:"SystemVerilog",import:()=>ie(()=>import("./system-verilog-C7L56vO4.js"),[])},{id:"systemd",name:"Systemd Units",import:()=>ie(()=>import("./systemd-CUnW07Te.js"),[])},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>ie(()=>import("./talonscript-C1XDQQGZ.js"),[])},{id:"tasl",name:"Tasl",import:()=>ie(()=>import("./tasl-CQjiPCtT.js"),[])},{id:"tcl",name:"Tcl",import:()=>ie(()=>import("./tcl-DQ1-QYvQ.js"),[])},{id:"templ",name:"Templ",import:()=>ie(()=>import("./templ-dwX3ZSMB.js"),__vite__mapDeps([86,87,2,3]))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>ie(()=>import("./terraform-BbSNqyBO.js"),[])},{id:"tex",name:"TeX",import:()=>ie(()=>import("./tex-rYs2v40G.js"),__vite__mapDeps([62,60]))},{id:"toml",name:"TOML",import:()=>ie(()=>import("./toml-CB2ApiWb.js"),[])},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>ie(()=>import("./ts-tags-CipyTH0X.js"),__vite__mapDeps([88,11,3,2,23,24,1,14,7,8]))},{id:"tsv",name:"TSV",import:()=>ie(()=>import("./tsv-B_m7g4N7.js"),[])},{id:"tsx",name:"TSX",import:()=>ie(()=>import("./tsx-B6W0miNI.js"),[])},{id:"turtle",name:"Turtle",import:()=>ie(()=>import("./turtle-BMR_PYu6.js"),[])},{id:"twig",name:"Twig",import:()=>ie(()=>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:()=>ie(()=>import("./typescript-Dj6nwHGl.js"),[])},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>ie(()=>import("./typespec-BpWG_bgh.js"),[])},{id:"typst",name:"Typst",aliases:["typ"],import:()=>ie(()=>import("./typst-BVUVsWT6.js"),[])},{id:"v",name:"V",import:()=>ie(()=>import("./v-CAQ2eGtk.js"),[])},{id:"vala",name:"Vala",import:()=>ie(()=>import("./vala-BFOHcciG.js"),[])},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>ie(()=>import("./vb-CdO5JTpU.js"),[])},{id:"verilog",name:"Verilog",import:()=>ie(()=>import("./verilog-CJaU5se_.js"),[])},{id:"vhdl",name:"VHDL",import:()=>ie(()=>import("./vhdl-DYoNaHQp.js"),[])},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>ie(()=>import("./viml-m4uW47V2.js"),[])},{id:"vue",name:"Vue",import:()=>ie(()=>import("./vue-BuYVFjOK.js"),__vite__mapDeps([90,1,2,3,11,9,28]))},{id:"vue-html",name:"Vue HTML",import:()=>ie(()=>import("./vue-html-xdeiXROB.js"),__vite__mapDeps([91,90,1,2,3,11,9,28]))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>ie(()=>import("./vyper-nyqBNV6O.js"),[])},{id:"wasm",name:"WebAssembly",import:()=>ie(()=>import("./wasm-C6j12Q_x.js"),[])},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>ie(()=>import("./wenyan-7A4Fjokl.js"),[])},{id:"wgsl",name:"WGSL",import:()=>ie(()=>import("./wgsl-CB0Krxn9.js"),[])},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>ie(()=>import("./wikitext-DCE3LsBG.js"),[])},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>ie(()=>import("./wolfram-C3FkfJm5.js"),[])},{id:"xml",name:"XML",import:()=>ie(()=>import("./xml-e3z08dGr.js"),__vite__mapDeps([7,8]))},{id:"xsl",name:"XSL",import:()=>ie(()=>import("./xsl-Dd0NUgwM.js"),__vite__mapDeps([92,7,8]))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>ie(()=>import("./yaml-CVw76BM1.js"),[])},{id:"zenscript",name:"ZenScript",import:()=>ie(()=>import("./zenscript-HnGAYVZD.js"),[])},{id:"zig",name:"Zig",import:()=>ie(()=>import("./zig-BVz_zdnA.js"),[])}],F2e=Object.fromEntries(BX.map(e=>[e.id,e.import])),H2e=Object.fromEntries(BX.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),q2e={...F2e,...H2e},U2e=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>ie(()=>import("./andromeeda-C3khCPGq.js"),[])},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>ie(()=>import("./aurora-x-D-2ljcwZ.js"),[])},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>ie(()=>import("./ayu-dark-Cv9koXgw.js"),[])},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>ie(()=>import("./catppuccin-frappe-CD_QflpE.js"),[])},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>ie(()=>import("./catppuccin-latte-DRW-0cLl.js"),[])},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>ie(()=>import("./catppuccin-macchiato-C-_shW-Y.js"),[])},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>ie(()=>import("./catppuccin-mocha-LGGdnPYs.js"),[])},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>ie(()=>import("./dark-plus-C3mMm8J8.js"),[])},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>ie(()=>import("./dracula-BzJJZx-M.js"),[])},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>ie(()=>import("./dracula-soft-BXkSAIEj.js"),[])},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>ie(()=>import("./everforest-dark-BgDCqdQA.js"),[])},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>ie(()=>import("./everforest-light-C8M2exoo.js"),[])},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>ie(()=>import("./github-dark-DHJKELXO.js"),[])},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>ie(()=>import("./github-dark-default-Cuk6v7N8.js"),[])},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>ie(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[])},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>ie(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[])},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>ie(()=>import("./github-light-DAi9KRSo.js"),[])},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>ie(()=>import("./github-light-default-D7oLnXFd.js"),[])},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>ie(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[])},{id:"houston",displayName:"Houston",type:"dark",import:()=>ie(()=>import("./houston-DnULxvSX.js"),[])},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>ie(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[])},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>ie(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[])},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>ie(()=>import("./kanagawa-wave-DWedfzmr.js"),[])},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>ie(()=>import("./laserwave-DUszq2jm.js"),[])},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>ie(()=>import("./light-plus-B7mTdjB0.js"),[])},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>ie(()=>import("./material-theme-D5KoaKCx.js"),[])},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>ie(()=>import("./material-theme-darker-BfHTSMKl.js"),[])},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>ie(()=>import("./material-theme-lighter-B0m2ddpp.js"),[])},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>ie(()=>import("./material-theme-ocean-CyktbL80.js"),[])},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>ie(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[])},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>ie(()=>import("./min-dark-CafNBF8u.js"),[])},{id:"min-light",displayName:"Min Light",type:"light",import:()=>ie(()=>import("./min-light-CTRr51gU.js"),[])},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>ie(()=>import("./monokai-D4h5O-jR.js"),[])},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>ie(()=>import("./night-owl-C39BiMTA.js"),[])},{id:"nord",displayName:"Nord",type:"dark",import:()=>ie(()=>import("./nord-Ddv68eIx.js"),[])},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>ie(()=>import("./one-dark-pro-GBQ2dnAY.js"),[])},{id:"one-light",displayName:"One Light",type:"light",import:()=>ie(()=>import("./one-light-PoHY5YXO.js"),[])},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>ie(()=>import("./plastic-3e1v2bzS.js"),[])},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>ie(()=>import("./poimandres-CS3Unz2-.js"),[])},{id:"red",displayName:"Red",type:"dark",import:()=>ie(()=>import("./red-bN70gL4F.js"),[])},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>ie(()=>import("./rose-pine-CmCqftbK.js"),[])},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>ie(()=>import("./rose-pine-dawn-Ds-gbosJ.js"),[])},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>ie(()=>import("./rose-pine-moon-CjDtw9vr.js"),[])},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>ie(()=>import("./slack-dark-BthQWCQV.js"),[])},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>ie(()=>import("./slack-ochin-DqwNpetd.js"),[])},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>ie(()=>import("./snazzy-light-Bw305WKR.js"),[])},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>ie(()=>import("./solarized-dark-DXbdFlpD.js"),[])},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>ie(()=>import("./solarized-light-L9t79GZl.js"),[])},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>ie(()=>import("./synthwave-84-CbfX1IO0.js"),[])},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>ie(()=>import("./tokyo-night-DBQeEorK.js"),[])},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>ie(()=>import("./vesper-BEBZ7ncR.js"),[])},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>ie(()=>import("./vitesse-black-Bkuqu6BP.js"),[])},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>ie(()=>import("./vitesse-dark-D0r3Knsf.js"),[])},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>ie(()=>import("./vitesse-light-CVO1_9PV.js"),[])}],V2e=Object.fromEntries(U2e.map(e=>[e.id,e.import]));let Pd=class extends Error{constructor(t){super(t),this.name="ShikiError"}},Gj=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function W2e(){return 2147483648}function G2e(){return typeof performance<"u"?performance.now():Date.now()}const K2e=(e,t)=>e+(t-e%t)%t;async function Y2e(e){let t,n;const s={};function r(p){n=p,s.HEAPU8=new Uint8Array(p),s.HEAPU32=new Uint32Array(p)}function i(p,g,b){s.HEAPU8.copyWithin(p,g,g+b)}function o(p){try{return t.grow(p-n.byteLength+65535>>>16),r(t.buffer),1}catch{}}function a(p){const g=s.HEAPU8.length;p=p>>>0;const b=W2e();if(p>b)return!1;for(let v=1;v<=4;v*=2){let x=g*(1+.2/v);x=Math.min(x,p+100663296);const y=Math.min(b,K2e(Math.max(p,x),65536));if(o(y))return!0}return!1}const c=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function u(p,g,b=1024){const v=g+b;let x=g;for(;p[x]&&!(x>=v);)++x;if(x-g>16&&p.buffer&&c)return c.decode(p.subarray(g,x));let y="";for(;g<x;){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 _=w-65536;y+=String.fromCharCode(55296|_>>10,56320|_&1023)}}return y}function d(p,g){return p?u(s.HEAPU8,p,g):""}const h={emscripten_get_now:G2e,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,r(t.buffer),Object.assign(s,g),s.UTF8ToString=d}return await m(),s}var X2e=Object.defineProperty,Q2e=(e,t,n)=>t in e?X2e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,eo=(e,t,n)=>(Q2e(e,typeof t!="symbol"?t+"":t,n),n);let bo=null;function J2e(e){throw new Gj(e.UTF8ToString(e.getLastOnigError()))}class v3{constructor(t){eo(this,"utf16Length"),eo(this,"utf8Length"),eo(this,"utf16Value"),eo(this,"utf8Value"),eo(this,"utf16OffsetToUtf8"),eo(this,"utf8OffsetToUtf16");const n=t.length,s=v3._utf8ByteLength(t),r=s!==n,i=r?new Uint32Array(n+1):null;r&&(i[n]=s);const o=r?new Uint32Array(s+1):null;r&&(o[s]=n);const a=new Uint8Array(s);let c=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)}r&&(i[u]=c,m&&(i[u+1]=c),h<=127?o[c+0]=u:h<=2047?(o[c+0]=u,o[c+1]=u):h<=65535?(o[c+0]=u,o[c+1]=u,o[c+2]=u):(o[c+0]=u,o[c+1]=u,o[c+2]=u,o[c+3]=u)),h<=127?a[c++]=h:h<=2047?(a[c++]=192|(h&1984)>>>6,a[c++]=128|(h&63)>>>0):h<=65535?(a[c++]=224|(h&61440)>>>12,a[c++]=128|(h&4032)>>>6,a[c++]=128|(h&63)>>>0):(a[c++]=240|(h&1835008)>>>18,a[c++]=128|(h&258048)>>>12,a[c++]=128|(h&4032)>>>6,a[c++]=128|(h&63)>>>0),m&&u++}this.utf16Length=n,this.utf8Length=s,this.utf16Value=t,this.utf8Value=a,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=o}static _utf8ByteLength(t){let n=0;for(let s=0,r=t.length;s<r;s++){const i=t.charCodeAt(s);let o=i,a=!1;if(i>=55296&&i<=56319&&s+1<r){const c=t.charCodeAt(s+1);c>=56320&&c<=57343&&(o=(i-55296<<10)+65536|c-56320,a=!0)}o<=127?n+=1:o<=2047?n+=2:o<=65535?n+=3:n+=4,a&&s++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const uu=class{constructor(e){if(eo(this,"id",++uu.LAST_ID),eo(this,"_onigBinding"),eo(this,"content"),eo(this,"utf16Length"),eo(this,"utf8Length"),eo(this,"utf16OffsetToUtf8"),eo(this,"utf8OffsetToUtf16"),eo(this,"ptr"),!bo)throw new Gj("Must invoke loadWasm first.");this._onigBinding=bo,this.content=e;const t=new v3(e);this.utf16Length=t.utf16Length,this.utf8Length=t.utf8Length,this.utf16OffsetToUtf8=t.utf16OffsetToUtf8,this.utf8OffsetToUtf16=t.utf8OffsetToUtf16,this.utf8Length<1e4&&!uu._sharedPtrInUse?(uu._sharedPtr||(uu._sharedPtr=bo.omalloc(1e4)),uu._sharedPtrInUse=!0,bo.HEAPU8.set(t.utf8Value,uu._sharedPtr),this.ptr=uu._sharedPtr):this.ptr=t.createString(bo)}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===uu._sharedPtr?uu._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let Ov=uu;eo(Ov,"LAST_ID",0);eo(Ov,"_sharedPtr",0);eo(Ov,"_sharedPtrInUse",!1);class Z2e{constructor(t){if(eo(this,"_onigBinding"),eo(this,"_ptr"),!bo)throw new Gj("Must invoke loadWasm first.");const n=[],s=[];for(let a=0,c=t.length;a<c;a++){const u=new v3(t[a]);n[a]=u.createString(bo),s[a]=u.utf8Length}const r=bo.omalloc(4*t.length);bo.HEAPU32.set(n,r/4);const i=bo.omalloc(4*t.length);bo.HEAPU32.set(s,i/4);const o=bo.createOnigScanner(r,i,t.length);for(let a=0,c=t.length;a<c;a++)bo.ofree(n[a]);bo.ofree(i),bo.ofree(r),o===0&&J2e(bo),this._onigBinding=bo,this._ptr=o}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,s){let r=0;if(typeof s=="number"&&(r=s),typeof t=="string"){t=new Ov(t);const i=this._findNextMatchSync(t,n,!1,r);return t.dispose(),i}return this._findNextMatchSync(t,n,!1,r)}_findNextMatchSync(t,n,s,r){const i=this._onigBinding,o=i.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),r);if(o===0)return null;const a=i.HEAPU32;let c=o/4;const u=a[c++],d=a[c++],h=[];for(let m=0;m<d;m++){const p=t.convertUtf8OffsetToUtf16(a[c++]),g=t.convertUtf8OffsetToUtf16(a[c++]);h[m]={start:p,end:g,length:g-p}}return{index:u,captureIndices:h}}}function eSe(e){return typeof e.instantiator=="function"}function tSe(e){return typeof e.default=="function"}function nSe(e){return typeof e.data<"u"}function sSe(e){return typeof Response<"u"&&e instanceof Response}function rSe(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 yk;function iSe(e){if(yk)return yk;async function t(){bo=await Y2e(async n=>{let s=e;return s=await s,typeof s=="function"&&(s=await s(n)),typeof s=="function"&&(s=await s(n)),eSe(s)?s=await s.instantiator(n):tSe(s)?s=await s.default(n):(nSe(s)&&(s=s.data),sSe(s)?typeof WebAssembly.instantiateStreaming=="function"?s=await oSe(s)(n):s=await aSe(s)(n):rSe(s)?s=await K5(s)(n):s instanceof WebAssembly.Module?s=await K5(s)(n):"default"in s&&s.default instanceof WebAssembly.Module&&(s=await K5(s.default)(n))),"instance"in s&&(s=s.instance),"exports"in s&&(s=s.exports),s})}return yk=t(),yk}function K5(e){return t=>WebAssembly.instantiate(e,t)}function oSe(e){return t=>WebAssembly.instantiateStreaming(e,t)}function aSe(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let lSe;function cSe(){return lSe}async function $X(e){return e&&await iSe(e),{createScanner(t){return new Z2e(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new Ov(t)}}}function uSe(e){return Kj(e)}function Kj(e){return Array.isArray(e)?dSe(e):e instanceof RegExp?e:typeof e=="object"?hSe(e):e}function dSe(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=Kj(e[n]);return t}function hSe(e){let t={};for(let n in e)t[n]=Kj(e[n]);return t}function zX(e,...t){return t.forEach(n=>{for(let s in n)e[s]=n[s]}),e}function FX(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?FX(e.substring(0,e.length-1)):e.substr(~t+1)}var Y5=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,xk=class{static hasCaptures(e){return e===null?!1:(Y5.lastIndex=0,Y5.test(e))}static replaceCaptures(e,t,n){return e.replace(Y5,(s,r,i,o)=>{let a=n[parseInt(r||i,10)];if(a){let c=t.substring(a.start,a.end);for(;c[0]===".";)c=c.substring(1);switch(o){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return s})}};function HX(e,t){return e<t?-1:e>t?1:0}function qX(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,s=t.length;if(n===s){for(let r=0;r<n;r++){let i=HX(e[r],t[r]);if(i!==0)return i}return 0}return n-s}function $B(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 UX(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var VX=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}},pS=class{constructor(e,t,n){Me(this,"_cachedMatchRoot",new VX(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(pSe(e),t)}static createFromParsedTheme(e,t){return bSe(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,s=this._cachedMatchRoot.get(t).find(r=>fSe(e.parent,r.parentScopes));return s?new WX(s.fontStyle,s.foreground,s.background):null}},X5=class W_{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const s of n)t=new W_(t,s);return t}static from(...t){let n=null;for(let s=0;s<t.length;s++)n=new W_(n,t[s]);return n}push(t){return new W_(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let s=this;for(;s&&s!==t;)n.push(s.scopeName),s=s.parent;return s===t?n.reverse():void 0}};function fSe(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let s=t[n],r=!1;if(s===">"){if(n===t.length-1)return!1;s=t[++n],r=!0}for(;e&&!mSe(e.scopeName,s);){if(r)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function mSe(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var WX=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function pSe(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],s=0;for(let r=0,i=t.length;r<i;r++){let o=t[r];if(!o.settings)continue;let a;if(typeof o.scope=="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),a=h.split(",")}else Array.isArray(o.scope)?a=o.scope:a=[""];let c=-1;if(typeof o.settings.fontStyle=="string"){c=0;let h=o.settings.fontStyle.split(" ");for(let m=0,p=h.length;m<p;m++)switch(h[m]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let u=null;typeof o.settings.foreground=="string"&&$B(o.settings.foreground)&&(u=o.settings.foreground);let d=null;typeof o.settings.background=="string"&&$B(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],v=null;g.length>1&&(v=g.slice(0,g.length-1),v.reverse()),n[s++]=new gSe(b,v,r,c,u,d)}}return n}var gSe=class{constructor(e,t,n,s,r,i){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=s,this.foreground=r,this.background=i}},Ed=(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))(Ed||{});function bSe(e,t){e.sort((c,u)=>{let d=HX(c.scope,u.scope);return d!==0||(d=qX(c.parentScopes,u.parentScopes),d!==0)?d:c.index-u.index});let n=0,s="#000000",r="#ffffff";for(;e.length>=1&&e[0].scope==="";){let c=e.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(s=c.foreground),c.background!==null&&(r=c.background)}let i=new ySe(t),o=new WX(n,i.getId(s),i.getId(r)),a=new vSe(new IE(0,null,-1,0,0),[]);for(let c=0,u=e.length;c<u;c++){let d=e[c];a.insert(0,d.scope,d.parentScopes,d.fontStyle,i.getId(d.foreground),i.getId(d.background))}return new pS(i,o,a)}var ySe=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)}},xSe=Object.freeze([]),IE=class GX{constructor(t,n,s,r,i){Me(this,"scopeDepth");Me(this,"parentScopes");Me(this,"fontStyle");Me(this,"foreground");Me(this,"background");this.scopeDepth=t,this.parentScopes=n||xSe,this.fontStyle=s,this.foreground=r,this.background=i}clone(){return new GX(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let s=0,r=t.length;s<r;s++)n[s]=t[s].clone();return n}acceptOverwrite(t,n,s,r){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),s!==0&&(this.foreground=s),r!==0&&(this.background=r)}},vSe=class RE{constructor(t,n=[],s={}){Me(this,"_rulesWithParentScopes");this._mainRule=t,this._children=s,this._rulesWithParentScopes=n}static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let s=0,r=0;for(;t.parentScopes[s]===">"&&s++,n.parentScopes[r]===">"&&r++,!(s>=t.parentScopes.length||r>=n.parentScopes.length);){const i=n.parentScopes[r].length-t.parentScopes[s].length;if(i!==0)return i;s++,r++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let s=t.indexOf("."),r,i;if(s===-1?(r=t,i=""):(r=t.substring(0,s),i=t.substring(s+1)),this._children.hasOwnProperty(r))return this._children[r].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(RE._cmpBySpecificity),n}insert(t,n,s,r,i,o){if(n===""){this._doInsertHere(t,s,r,i,o);return}let a=n.indexOf("."),c,u;a===-1?(c=n,u=""):(c=n.substring(0,a),u=n.substring(a+1));let d;this._children.hasOwnProperty(c)?d=this._children[c]:(d=new RE(this._mainRule.clone(),IE.cloneArr(this._rulesWithParentScopes)),this._children[c]=d),d.insert(t+1,u,s,r,i,o)}_doInsertHere(t,n,s,r,i){if(n===null){this._mainRule.acceptOverwrite(t,s,r,i);return}for(let o=0,a=this._rulesWithParentScopes.length;o<a;o++){let c=this._rulesWithParentScopes[o];if(qX(c.parentScopes,n)===0){c.acceptOverwrite(t,s,r,i);return}}s===-1&&(s=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new IE(t,n,s,r,i))}},l1=class Yl{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=Yl.getLanguageId(t),s=Yl.getTokenType(t),r=Yl.getFontStyle(t),i=Yl.getForeground(t),o=Yl.getBackground(t);console.log({languageId:n,tokenType:s,fontStyle:r,foreground:i,background:o})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,s,r,i,o,a){let c=Yl.getLanguageId(t),u=Yl.getTokenType(t),d=Yl.containsBalancedBrackets(t)?1:0,h=Yl.getFontStyle(t),m=Yl.getForeground(t),p=Yl.getBackground(t);return n!==0&&(c=n),s!==8&&(u=s),r!==null&&(d=r?1:0),i!==-1&&(h=i),o!==0&&(m=o),a!==0&&(p=a),(c<<0|u<<8|d<<10|h<<11|m<<15|p<<24)>>>0}};function gS(e,t){const n=[],s=wSe(e);let r=s.next();for(;r!==null;){let c=0;if(r.length===2&&r.charAt(1)===":"){switch(r.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=s.next()}let u=o();if(n.push({matcher:u,priority:c}),r!==",")break;r=s.next()}return n;function i(){if(r==="-"){r=s.next();const c=i();return u=>!!c&&!c(u)}if(r==="("){r=s.next();const c=a();return r===")"&&(r=s.next()),c}if(zB(r)){const c=[];do c.push(r),r=s.next();while(zB(r));return u=>t(c,u)}return null}function o(){const c=[];let u=i();for(;u;)c.push(u),u=i();return d=>c.every(h=>h(d))}function a(){const c=[];let u=o();for(;u&&(c.push(u),r==="|"||r===",");){do r=s.next();while(r==="|"||r===",");u=o()}return d=>c.some(h=>h(d))}}function zB(e){return!!e&&!!e.match(/[\w\.:]+/)}function wSe(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const s=n[0];return n=t.exec(e),s}}}function KX(e){typeof e.dispose=="function"&&e.dispose()}var Dx=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},kSe=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},_Se=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))}},SSe=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 Dx(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new _Se;for(const n of e)CSe(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof Dx){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 CSe(e,t,n,s){const r=n.lookup(e.scopeName);if(!r){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const i=n.lookup(t);e instanceof Dx?G_({baseGrammar:i,selfGrammar:r},s):DE(e.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},s);const o=n.injections(e.scopeName);if(o)for(const a of o)s.add(new Dx(a))}function DE(e,t,n){if(t.repository&&t.repository[e]){const s=t.repository[e];bS([s],t,n)}}function G_(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&bS(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&bS(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function bS(e,t,n){for(const s of e){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const r=s.repository?zX({},t.repository,s.repository):t.repository;Array.isArray(s.patterns)&&bS(s.patterns,{...t,repository:r},n);const i=s.include;if(!i)continue;const o=YX(i);switch(o.kind){case 0:G_({...t,selfGrammar:t.baseGrammar},n);break;case 1:G_(t,n);break;case 2:DE(o.ruleName,{...t,repository:r},n);break;case 3:case 4:const a=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(a){const c={baseGrammar:t.baseGrammar,selfGrammar:a,repository:r};o.kind===4?DE(o.ruleName,c,n):G_(c,n)}else o.kind===4?n.add(new kSe(o.scopeName,o.ruleName)):n.add(new Dx(o.scopeName));break}}}var TSe=class{constructor(){Me(this,"kind",0)}},ESe=class{constructor(){Me(this,"kind",1)}},ASe=class{constructor(e){Me(this,"kind",2);this.ruleName=e}},NSe=class{constructor(e){Me(this,"kind",3);this.scopeName=e}},jSe=class{constructor(e,t){Me(this,"kind",4);this.scopeName=e,this.ruleName=t}};function YX(e){if(e==="$base")return new TSe;if(e==="$self")return new ESe;const t=e.indexOf("#");if(t===-1)return new NSe(e);if(t===0)return new ASe(e.substring(1));{const n=e.substring(0,t),s=e.substring(t+1);return new jSe(n,s)}}var MSe=/\\(\d+)/,FB=/\\(\d+)/g,ISe=-1,XX=-2;var Bv=class{constructor(t,n,s,r){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=s||null,this._nameIsCapturing=xk.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=xk.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${FX(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:xk.replaceCaptures(this._name,t,n)}getContentName(t,n){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:xk.replaceCaptures(this._contentName,t,n)}},RSe=class extends Bv{constructor(t,n,s,r,i){super(t,n,s,r);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,s,r){throw new Error("Not supported!")}},DSe=class extends Bv{constructor(t,n,s,r,i){super(t,n,s,null);Me(this,"_match");Me(this,"captures");Me(this,"_cachedCompiledPatterns");this._match=new Lx(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,n){n.push(this._match)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,r){return this._getCachedCompiledPatterns(t).compileAG(t,s,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Px,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},HB=class extends Bv{constructor(t,n,s,r,i){super(t,n,s,r);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 s of this.patterns)t.getRule(s).collectPatterns(t,n)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,r){return this._getCachedCompiledPatterns(t).compileAG(t,s,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Px,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},LE=class extends Bv{constructor(t,n,s,r,i,o,a,c,u,d){super(t,n,s,r);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 Lx(i,this.id),this.beginCaptures=o,this._end=new Lx(a||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=c,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,s,r){return this._getCachedCompiledPatterns(t,n).compileAG(t,s,r)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Px;for(const s of this.patterns)t.getRule(s).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,n):this._cachedCompiledPatterns.setSource(0,n)),this._cachedCompiledPatterns}},yS=class extends Bv{constructor(t,n,s,r,i,o,a,c,u){super(t,n,s,r);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 Lx(i,this.id),this.beginCaptures=o,this.whileCaptures=c,this._while=new Lx(a,XX),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,n){return this._while.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,r){return this._getCachedCompiledPatterns(t).compileAG(t,s,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Px;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,n){return this._getCachedCompiledWhilePatterns(t,n).compile(t)}compileWhileAG(t,n,s,r){return this._getCachedCompiledWhilePatterns(t,n).compileAG(t,s,r)}_getCachedCompiledWhilePatterns(t,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Px,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},QX=class Qo{static createCaptureRule(t,n,s,r,i){return t.registerRule(o=>new RSe(n,o,s,r,i))}static getCompiledRuleId(t,n,s){return t.id||n.registerRule(r=>{if(t.id=r,t.match)return new DSe(t.$vscodeTextmateLocation,t.id,t.name,t.match,Qo._compileCaptures(t.captures,n,s));if(typeof t.begin>"u"){t.repository&&(s=zX({},s,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new HB(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,Qo._compilePatterns(i,n,s))}return t.while?new yS(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Qo._compileCaptures(t.beginCaptures||t.captures,n,s),t.while,Qo._compileCaptures(t.whileCaptures||t.captures,n,s),Qo._compilePatterns(t.patterns,n,s)):new LE(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Qo._compileCaptures(t.beginCaptures||t.captures,n,s),t.end,Qo._compileCaptures(t.endCaptures||t.captures,n,s),t.applyEndPatternLast,Qo._compilePatterns(t.patterns,n,s))}),t.id}static _compileCaptures(t,n,s){let r=[];if(t){let i=0;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);a>i&&(i=a)}for(let o=0;o<=i;o++)r[o]=null;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);let c=0;t[o].patterns&&(c=Qo.getCompiledRuleId(t[o],n,s)),r[a]=Qo.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,c)}}return r}static _compilePatterns(t,n,s){let r=[];if(t)for(let i=0,o=t.length;i<o;i++){const a=t[i];let c=-1;if(a.include){const u=YX(a.include);switch(u.kind){case 0:case 1:c=Qo.getCompiledRuleId(s[a.include],n,s);break;case 2:let d=s[u.ruleName];d&&(c=Qo.getCompiledRuleId(d,n,s));break;case 3:case 4:const h=u.scopeName,m=u.kind===4?u.ruleName:null,p=n.getExternalGrammar(h,s);if(p)if(m){let g=p.repository[m];g&&(c=Qo.getCompiledRuleId(g,n,p.repository))}else c=Qo.getCompiledRuleId(p.repository.$self,n,p.repository);break}}else c=Qo.getCompiledRuleId(a,n,s);if(c!==-1){const u=n.getRule(c);let d=!1;if((u instanceof HB||u instanceof LE||u instanceof yS)&&u.hasMissingPatterns&&u.patterns.length===0&&(d=!0),d)continue;r.push(c)}}return{patterns:r,hasMissingPatterns:(t?t.length:0)!==r.length}}},Lx=class JX{constructor(t,n){Me(this,"source");Me(this,"ruleId");Me(this,"hasAnchor");Me(this,"hasBackReferences");Me(this,"_anchorCache");if(t&&typeof t=="string"){const s=t.length;let r=0,i=[],o=!1;for(let a=0;a<s;a++)if(t.charAt(a)==="\\"&&a+1<s){const u=t.charAt(a+1);u==="z"?(i.push(t.substring(r,a)),i.push("$(?!\\n)(?<!\\n)"),r=a+2):(u==="A"||u==="G")&&(o=!0),a++}this.hasAnchor=o,r===0?this.source=t:(i.push(t.substring(r,s)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=MSe.test(this.source):this.hasBackReferences=!1}clone(){return new JX(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let s=n.map(r=>t.substring(r.start,r.end));return FB.lastIndex=0,this.source.replace(FB,(r,i)=>UX(s[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],s=[],r=[],i,o,a,c;for(i=0,o=this.source.length;i<o;i++)a=this.source.charAt(i),t[i]=a,n[i]=a,s[i]=a,r[i]=a,a==="\\"&&i+1<o&&(c=this.source.charAt(i+1),c==="A"?(t[i+1]="",n[i+1]="",s[i+1]="A",r[i+1]="A"):c==="G"?(t[i+1]="",n[i+1]="G",s[i+1]="",r[i+1]="G"):(t[i+1]=c,n[i+1]=c,s[i+1]=c,r[i+1]=c),i++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:s.join(""),A1_G1:r.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Px=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 qB(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let s=this._items.map(r=>r.resolveAnchors(t,n));return new qB(e,s,this._items.map(r=>r.ruleId))}},qB=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 s=this.scanner.findNextMatchSync(e,t,n);return s?{ruleId:this.rules[s.index],captureIndices:s.captureIndices}:null}},Q5=class{constructor(e,t){this.languageId=e,this.tokenType=t}},kd,LSe=(kd=class{constructor(t,n){Me(this,"_defaultAttributes");Me(this,"_embeddedLanguagesMatcher");Me(this,"_getBasicScopeAttributes",new VX(t=>{const n=this._scopeToLanguage(t),s=this._toStandardTokenType(t);return new Q5(n,s)}));this._defaultAttributes=new Q5(t,8),this._embeddedLanguagesMatcher=new PSe(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?kd._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(kd.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(kd,"_NULL_SCOPE_METADATA",new Q5(0,0)),Me(kd,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),kd),PSe=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,s])=>UX(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])}},UB=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function ZX(e,t,n,s,r,i,o,a){const c=t.content.length;let u=!1,d=-1;if(o){const p=OSe(e,t,n,s,r,i);r=p.stack,s=p.linePos,n=p.isFirstLine,d=p.anchorPosition}const h=Date.now();for(;!u;){if(a!==0&&Date.now()-h>a)return new UB(r,!0);m()}return new UB(r,!1);function m(){const p=BSe(e,t,n,s,r,d);if(!p){i.produce(r,c),u=!0;return}const g=p.captureIndices,b=p.matchedRuleId,v=g&&g.length>0?g[0].end>s:!1;if(b===ISe){const x=r.getRule(e);i.produce(r,g[0].start),r=r.withContentNameScopesList(r.nameScopesList),xy(e,t,n,r,i,x.endCaptures,g),i.produce(r,g[0].end);const y=r;if(r=r.parent,d=y.getAnchorPos(),!v&&y.getEnterPos()===s){r=y,i.produce(r,c),u=!0;return}}else{const x=e.getRule(b);i.produce(r,g[0].start);const y=r,w=x.getName(t.content,g),k=r.contentNameScopesList.pushAttributed(w,e);if(r=r.push(b,s,d,g[0].end===c,null,k,k),x instanceof LE){const T=x;xy(e,t,n,r,i,T.beginCaptures,g),i.produce(r,g[0].end),d=g[0].end;const _=T.getContentName(t.content,g),C=k.pushAttributed(_,e);if(r=r.withContentNameScopesList(C),T.endHasBackReferences&&(r=r.withEndRule(T.getEndWithResolvedBackReferences(t.content,g))),!v&&y.hasSameRuleAs(r)){r=r.pop(),i.produce(r,c),u=!0;return}}else if(x instanceof yS){const T=x;xy(e,t,n,r,i,T.beginCaptures,g),i.produce(r,g[0].end),d=g[0].end;const _=T.getContentName(t.content,g),C=k.pushAttributed(_,e);if(r=r.withContentNameScopesList(C),T.whileHasBackReferences&&(r=r.withEndRule(T.getWhileWithResolvedBackReferences(t.content,g))),!v&&y.hasSameRuleAs(r)){r=r.pop(),i.produce(r,c),u=!0;return}}else if(xy(e,t,n,r,i,x.captures,g),i.produce(r,g[0].end),r=r.pop(),!v){r=r.safePop(),i.produce(r,c),u=!0;return}}g[0].end>s&&(s=g[0].end,n=!1)}}function OSe(e,t,n,s,r,i){let o=r.beginRuleCapturedEOL?0:-1;const a=[];for(let c=r;c;c=c.pop()){const u=c.getRule(e);u instanceof yS&&a.push({rule:u,stack:c})}for(let c=a.pop();c;c=a.pop()){const{ruleScanner:u,findOptions:d}=FSe(c.rule,e,c.stack.endRule,n,s===o),h=u.findNextMatchSync(t,s,d);if(h){if(h.ruleId!==XX){r=c.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(i.produce(c.stack,h.captureIndices[0].start),xy(e,t,n,c.stack,i,c.rule.whileCaptures,h.captureIndices),i.produce(c.stack,h.captureIndices[0].end),o=h.captureIndices[0].end,h.captureIndices[0].end>s&&(s=h.captureIndices[0].end,n=!1))}else{r=c.stack.pop();break}}return{stack:r,linePos:s,anchorPosition:o,isFirstLine:n}}function BSe(e,t,n,s,r,i){const o=$Se(e,t,n,s,r,i),a=e.getInjections();if(a.length===0)return o;const c=zSe(a,e,t,n,s,r,i);if(!c)return o;if(!o)return c;const u=o.captureIndices[0].start,d=c.captureIndices[0].start;return d<u||c.priorityMatch&&d===u?c:o}function $Se(e,t,n,s,r,i){const o=r.getRule(e),{ruleScanner:a,findOptions:c}=eQ(o,e,r.endRule,n,s===i),u=a.findNextMatchSync(t,s,c);return u?{captureIndices:u.captureIndices,matchedRuleId:u.ruleId}:null}function zSe(e,t,n,s,r,i,o){let a=Number.MAX_VALUE,c=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:v,findOptions:x}=eQ(b,t,null,s,r===o),y=v.findNextMatchSync(n,r,x);if(!y)continue;const w=y.captureIndices[0].start;if(!(w>=a)&&(a=w,c=y.captureIndices,u=y.ruleId,d=g.priority,a===r))break}return c?{priorityMatch:d===-1,captureIndices:c,matchedRuleId:u}:null}function eQ(e,t,n,s,r){return{ruleScanner:e.compileAG(t,n,s,r),findOptions:0}}function FSe(e,t,n,s,r){return{ruleScanner:e.compileWhileAG(t,n,s,r),findOptions:0}}function xy(e,t,n,s,r,i,o){if(i.length===0)return;const a=t.content,c=Math.min(i.length,o.length),u=[],d=o[0].end;for(let h=0;h<c;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;)r.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?r.produceFromScopes(u[u.length-1].scopes,p.start):r.produce(s,p.start),m.retokenizeCapturedWithRuleId){const b=m.getName(a,o),v=s.contentNameScopesList.pushAttributed(b,e),x=m.getContentName(a,o),y=v.pushAttributed(x,e),w=s.push(m.retokenizeCapturedWithRuleId,p.start,-1,!1,null,v,y),k=e.createOnigString(a.substring(0,p.end));ZX(e,k,n&&p.start===0,p.start,w,r,!1,0),KX(k);continue}const g=m.getName(a,o);if(g!==null){const v=(u.length>0?u[u.length-1].scopes:s.contentNameScopesList).pushAttributed(g,e);u.push(new HSe(v,p.end))}}for(;u.length>0;)r.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var HSe=class{constructor(e,t){Me(this,"scopes");Me(this,"endPos");this.scopes=e,this.endPos=t}};function qSe(e,t,n,s,r,i,o,a){return new VSe(e,t,n,s,r,i,o,a)}function VB(e,t,n,s,r){const i=gS(t,xS),o=QX.getCompiledRuleId(n,s,r.repository);for(const a of i)e.push({debugSelector:t,matcher:a.matcher,ruleId:o,grammar:r,priority:a.priority})}function xS(e,t){if(t.length<e.length)return!1;let n=0;return e.every(s=>{for(let r=n;r<t.length;r++)if(USe(t[r],s))return n=r+1,!0;return!1})}function USe(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 VSe=class{constructor(e,t,n,s,r,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 LSe(n,s),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=WB(t,null),this._injections=null,this._tokenTypeMatchers=[],r)for(const c of Object.keys(r)){const u=gS(c,xS);for(const d of u)this._tokenTypeMatchers.push({matcher:d.matcher,type:r[c]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:r=>r===this._rootScopeName?this._grammar:this.getExternalGrammar(r),injections:r=>this._grammarRepository.injections(r)},t=[],n=this._rootScopeName,s=e.lookup(n);if(s){const r=s.injections;if(r)for(let o in r)VB(t,o,r[o],this,s);const i=this._grammarRepository.injections(n);i&&i.forEach(o=>{const a=this.getExternalGrammar(o);if(a){const c=a.injectionSelector;c&&VB(t,c,a,this,a)}})}return t.sort((r,i)=>r.priority-i.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=WB(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const s=this._tokenize(e,t,!1,n);return{tokens:s.lineTokens.getResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}tokenizeLine2(e,t,n=0){const s=this._tokenize(e,t,!0,n);return{tokens:s.lineTokens.getBinaryResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}_tokenize(e,t,n,s){this._rootId===-1&&(this._rootId=QX.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let r;if(!t||t===PE.NULL){r=!0;const u=this._basicScopeAttributesProvider.getDefaultAttributes(),d=this.themeProvider.getDefaults(),h=l1.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=ex.createRootAndLookUpScopeName(m,h,this):p=ex.createRoot("unknown",h),t=new PE(null,this._rootId,-1,-1,!1,null,p,p)}else r=!1,t.reset();e=e+`
`;const i=this.createOnigString(e),o=i.content.length,a=new GSe(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=ZX(this,i,r,0,t,a,!0,s);return KX(i),{lineLength:o,lineTokens:a,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function WB(e,t){return e=uSe(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 ex=class du{constructor(t,n,s){this.parent=t,this.scopePath=n,this.tokenAttributes=s}static fromExtension(t,n){let s=t,r=(t==null?void 0:t.scopePath)??null;for(const i of n)r=X5.push(r,i.scopeNames),s=new du(s,r,i.encodedTokenAttributes);return s}static createRoot(t,n){return new du(null,new X5(null,t),n)}static createRootAndLookUpScopeName(t,n,s){const r=s.getMetadataForScope(t),i=new X5(null,t),o=s.themeProvider.themeMatch(i),a=du.mergeAttributes(n,r,o);return new du(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return du.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,s){let r=-1,i=0,o=0;return s!==null&&(r=s.fontStyle,i=s.foregroundId,o=s.backgroundId),l1.set(t,n.languageId,n.tokenType,null,r,i,o)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return du._pushAttributed(this,t,n);const s=t.split(/ /g);let r=this;for(const i of s)r=du._pushAttributed(r,i,n);return r}static _pushAttributed(t,n,s){const r=s.getMetadataForScope(n),i=t.scopePath.push(n),o=s.themeProvider.themeMatch(i),a=du.mergeAttributes(t.tokenAttributes,r,o);return new du(t,i,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){var r;const n=[];let s=this;for(;s&&s!==t;)n.push({encodedTokenAttributes:s.tokenAttributes,scopeNames:s.scopePath.getExtensionIfDefined(((r=s.parent)==null?void 0:r.scopePath)??null)}),s=s.parent;return s===t?n.reverse():void 0}},oc,PE=(oc=class{constructor(t,n,s,r,i,o,a,c){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=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=s,this._anchorPos=r}equals(t){return t===null?!1:oc._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?ex.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(){oc._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,s,r,i,o,a){return new oc(this,t,n,s,r,i,o,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){var s,r;return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${(s=this.nameScopesList)==null?void 0:s.toString()}, ${(r=this.contentNameScopesList)==null?void 0:r.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new oc(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){var t,n,s;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((n=this.nameScopesList)==null?void 0:n.getExtensionIfDefined(((t=this.parent)==null?void 0:t.nameScopesList)??null))??[],contentNameScopesList:((s=this.contentNameScopesList)==null?void 0:s.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(t,n){const s=ex.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new oc(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,ex.fromExtension(s,n.contentNameScopesList))}},Me(oc,"NULL",new oc(null,0,0,0,!1,null,null,null)),oc),WSe=class{constructor(e,t){Me(this,"balancedBracketScopes");Me(this,"unbalancedBracketScopes");Me(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):gS(n,xS).map(s=>s.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>gS(n,xS).map(s=>s.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},GSe=class{constructor(e,t,n,s){Me(this,"_emitBinaryTokens");Me(this,"_lineText");Me(this,"_tokens");Me(this,"_binaryTokens");Me(this,"_lastTokenEndIndex");Me(this,"_tokenTypeOverrides");this.balancedBracketSelectors=s,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){var s;if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let r=(e==null?void 0:e.tokenAttributes)??0,i=!1;if((s=this.balancedBracketSelectors)!=null&&s.matchesAlways&&(i=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=(e==null?void 0:e.getScopeNames())??[];for(const a of this._tokenTypeOverrides)a.matcher(o)&&(r=l1.set(r,0,a.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(o))}if(i&&(r=l1.set(r,0,8,i,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=t;return}const n=(e==null?void 0:e.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let s=0,r=this._binaryTokens.length;s<r;s++)n[s]=this._binaryTokens[s];return n}},KSe=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,s,r){if(!this._grammars.has(e)){let i=this._rawGrammars.get(e);if(!i)return null;this._grammars.set(e,qSe(e,i,t,n,s,r,this,this._onigLib))}return this._grammars.get(e)}},YSe=class{constructor(t){Me(this,"_options");Me(this,"_syncRegistry");Me(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new KSe(pS.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(pS.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,s){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:s})}loadGrammarWithConfiguration(t,n,s){return this._loadGrammar(t,n,s.embeddedLanguages,s.tokenTypes,new WSe(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,s,r,i){const o=new SSe(this._syncRegistry,t);for(;o.Q.length>0;)o.Q.map(a=>this._loadSingleGrammar(a.scopeName)),o.processQueue();return this._grammarForScopeName(t,n,s,r,i)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const s=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,s)}}addGrammar(t,n=[],s=0,r=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,s,r)}_grammarForScopeName(t,n=0,s=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(t,n,s,r,i)}},OE=PE.NULL;const XSe=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],QSe=/["&'<>`]/g,JSe=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ZSe=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,e4e=/[|\\{}()[\]^$+*?.]/g,GB=new WeakMap;function t4e(e,t){if(e=e.replace(t.subset?n4e(t.subset):QSe,s),t.subset||t.escapeOnly)return e;return e.replace(JSe,n).replace(ZSe,s);function n(r,i,o){return t.format((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),t)}function s(r,i,o){return t.format(r.charCodeAt(0),o.charCodeAt(i+1),t)}}function n4e(e){let t=GB.get(e);return t||(t=s4e(e),GB.set(e,t)),t}function s4e(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(e4e,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const r4e=/[\dA-Fa-f]/;function i4e(e,t,n){const s="&#x"+e.toString(16).toUpperCase();return n&&t&&!r4e.test(String.fromCharCode(t))?s:s+";"}const o4e=/\d/;function a4e(e,t,n){const s="&#"+String(e);return n&&t&&!o4e.test(String.fromCharCode(t))?s:s+";"}const l4e=["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"],J5={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:"€"},c4e=["cent","copy","divide","gt","lt","not","para","times"],tQ={}.hasOwnProperty,BE={};let vk;for(vk in J5)tQ.call(J5,vk)&&(BE[J5[vk]]=vk);const u4e=/[^\dA-Za-z]/;function d4e(e,t,n,s){const r=String.fromCharCode(e);if(tQ.call(BE,r)){const i=BE[r],o="&"+i;return n&&l4e.includes(i)&&!c4e.includes(i)&&(!s||t&&t!==61&&u4e.test(String.fromCharCode(t)))?o:o+";"}return""}function h4e(e,t,n){let s=i4e(e,t,n.omitOptionalSemicolons),r;if((n.useNamedReferences||n.useShortestReferences)&&(r=d4e(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const i=a4e(e,t,n.omitOptionalSemicolons);i.length<s.length&&(s=i)}return r&&(!n.useShortestReferences||r.length<s.length)?r:s}function Ig(e,t){return t4e(e,Object.assign({format:h4e},t))}const f4e=/^>|^->|<!--|-->|--!>|<!-$/g,m4e=[">"],p4e=["<",">"];function g4e(e,t,n,s){return s.settings.bogusComments?"<?"+Ig(e.value,Object.assign({},s.settings.characterReferences,{subset:m4e}))+">":"<!--"+e.value.replace(f4e,r)+"-->";function r(i){return Ig(i,Object.assign({},s.settings.characterReferences,{subset:p4e}))}}function b4e(e,t,n,s){return"<!"+(s.settings.upperDoctype?"DOCTYPE":"doctype")+(s.settings.tightDoctype?"":" ")+"html>"}const ao=sQ(1),nQ=sQ(-1),y4e=[];function sQ(e){return t;function t(n,s,r){const i=n?n.children:y4e;let o=(s||0)+e,a=i[o];if(!r)for(;a&&t3(a);)o+=e,a=i[o];return a}}const x4e={}.hasOwnProperty;function rQ(e){return t;function t(n,s,r){return x4e.call(e,n.tagName)&&e[n.tagName](n,s,r)}}const Yj=rQ({body:w4e,caption:Z5,colgroup:Z5,dd:C4e,dt:S4e,head:Z5,html:v4e,li:_4e,optgroup:T4e,option:E4e,p:k4e,rp:KB,rt:KB,tbody:N4e,td:YB,tfoot:j4e,th:YB,thead:A4e,tr:M4e});function Z5(e,t,n){const s=ao(n,t,!0);return!s||s.type!=="comment"&&!(s.type==="text"&&t3(s.value.charAt(0)))}function v4e(e,t,n){const s=ao(n,t);return!s||s.type!=="comment"}function w4e(e,t,n){const s=ao(n,t);return!s||s.type!=="comment"}function k4e(e,t,n){const s=ao(n,t);return s?s.type==="element"&&(s.tagName==="address"||s.tagName==="article"||s.tagName==="aside"||s.tagName==="blockquote"||s.tagName==="details"||s.tagName==="div"||s.tagName==="dl"||s.tagName==="fieldset"||s.tagName==="figcaption"||s.tagName==="figure"||s.tagName==="footer"||s.tagName==="form"||s.tagName==="h1"||s.tagName==="h2"||s.tagName==="h3"||s.tagName==="h4"||s.tagName==="h5"||s.tagName==="h6"||s.tagName==="header"||s.tagName==="hgroup"||s.tagName==="hr"||s.tagName==="main"||s.tagName==="menu"||s.tagName==="nav"||s.tagName==="ol"||s.tagName==="p"||s.tagName==="pre"||s.tagName==="section"||s.tagName==="table"||s.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function _4e(e,t,n){const s=ao(n,t);return!s||s.type==="element"&&s.tagName==="li"}function S4e(e,t,n){const s=ao(n,t);return!!(s&&s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd"))}function C4e(e,t,n){const s=ao(n,t);return!s||s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd")}function KB(e,t,n){const s=ao(n,t);return!s||s.type==="element"&&(s.tagName==="rp"||s.tagName==="rt")}function T4e(e,t,n){const s=ao(n,t);return!s||s.type==="element"&&s.tagName==="optgroup"}function E4e(e,t,n){const s=ao(n,t);return!s||s.type==="element"&&(s.tagName==="option"||s.tagName==="optgroup")}function A4e(e,t,n){const s=ao(n,t);return!!(s&&s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot"))}function N4e(e,t,n){const s=ao(n,t);return!s||s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot")}function j4e(e,t,n){return!ao(n,t)}function M4e(e,t,n){const s=ao(n,t);return!s||s.type==="element"&&s.tagName==="tr"}function YB(e,t,n){const s=ao(n,t);return!s||s.type==="element"&&(s.tagName==="td"||s.tagName==="th")}const I4e=rQ({body:L4e,colgroup:P4e,head:D4e,html:R4e,tbody:O4e});function R4e(e){const t=ao(e,-1);return!t||t.type!=="comment"}function D4e(e){const t=new Set;for(const s of e.children)if(s.type==="element"&&(s.tagName==="base"||s.tagName==="title")){if(t.has(s.tagName))return!1;t.add(s.tagName)}const n=e.children[0];return!n||n.type==="element"}function L4e(e){const t=ao(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&t3(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function P4e(e,t,n){const s=nQ(n,t),r=ao(e,-1,!0);return n&&s&&s.type==="element"&&s.tagName==="colgroup"&&Yj(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="col")}function O4e(e,t,n){const s=nQ(n,t),r=ao(e,-1);return n&&s&&s.type==="element"&&(s.tagName==="thead"||s.tagName==="tbody")&&Yj(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="tr")}const wk={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 B4e(e,t,n,s){const r=s.schema,i=r.space==="svg"?!1:s.settings.omitOptionalTags;let o=r.space==="svg"?s.settings.closeEmptyElements:s.settings.voids.includes(e.tagName.toLowerCase());const a=[];let c;r.space==="html"&&e.tagName==="svg"&&(s.schema=H1);const u=$4e(s,e.properties),d=s.all(r.space==="html"&&e.tagName==="template"?e.content:e);return s.schema=r,d&&(o=!1),(u||!i||!I4e(e,t,n))&&(a.push("<",e.tagName,u?" "+u:""),o&&(r.space==="svg"||s.settings.closeSelfClosing)&&(c=u.charAt(u.length-1),(!s.settings.tightSelfClosing||c==="/"||c&&c!=='"'&&c!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(d),!o&&(!i||!Yj(e,t,n))&&a.push("</"+e.tagName+">"),a.join("")}function $4e(e,t){const n=[];let s=-1,r;if(t){for(r in t)if(t[r]!==null&&t[r]!==void 0){const i=z4e(e,r,t[r]);i&&n.push(i)}}for(;++s<n.length;){const i=e.settings.tightAttributes?n[s].charAt(n[s].length-1):void 0;s!==n.length-1&&i!=='"'&&i!=="'"&&(n[s]+=" ")}return n.join("")}function z4e(e,t,n){const s=uj(e.schema,t),r=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,i=e.settings.allowDangerousCharacters?0:1;let o=e.quote,a;if(s.overloadedBoolean&&(n===s.attribute||n==="")?n=!0:(s.boolean||s.overloadedBoolean)&&(typeof n!="string"||n===s.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const c=Ig(s.attribute,Object.assign({},e.settings.characterReferences,{subset:wk.name[r][i]}));return n===!0||(n=Array.isArray(n)?(s.commaSeparated?xK:EK)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(a=Ig(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:wk.unquoted[r][i]}))),a!==n&&(e.settings.quoteSmart&&aS(n,o)>aS(n,e.alternative)&&(o=e.alternative),a=o+Ig(n,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?wk.single:wk.double)[r][i],attribute:!0}))+o),c+(a&&"="+a))}const F4e=["<","&"];function iQ(e,t,n,s){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Ig(e.value,Object.assign({},s.settings.characterReferences,{subset:F4e}))}function H4e(e,t,n,s){return s.settings.allowDangerousHtml?e.value:iQ(e,t,n,s)}function q4e(e,t,n,s){return s.all(e)}const U4e=$ve("type",{invalid:V4e,unknown:W4e,handlers:{comment:g4e,doctype:b4e,element:B4e,raw:H4e,root:q4e,text:iQ}});function V4e(e){throw new Error("Expected node, not `"+e+"`")}function W4e(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const G4e={},K4e={},Y4e=[];function X4e(e,t){const n=G4e,s=n.quote||'"',r=s==='"'?"'":'"';if(s!=='"'&&s!=="'")throw new Error("Invalid quote `"+s+"`, expected `'` or `\"`");return{one:Q4e,all:J4e,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||XSe,characterReferences:n.characterReferences||K4e,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?H1:dj,quote:s,alternative:r}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function Q4e(e,t,n){return U4e(e,t,n,this)}function J4e(e){const t=[],n=e&&e.children||Y4e;let s=-1;for(;++s<n.length;)t[s]=this.one(n[s],s,e);return t.join("")}function Z4e(e){return Array.isArray(e)?e:[e]}function w3(e,t=!1){var i;const n=e.split(/(\r?\n)/g);let s=0;const r=[];for(let o=0;o<n.length;o+=2){const a=t?n[o]+(n[o+1]||""):n[o];r.push([a,s]),s+=n[o].length,s+=((i=n[o+1])==null?void 0:i.length)||0}return r}function Xj(e){return!e||["plaintext","txt","text","plain"].includes(e)}function oQ(e){return e==="ansi"||Xj(e)}function Qj(e){return e==="none"}function aQ(e){return Qj(e)}function lQ(e,t){var s;if(!t)return e;e.properties||(e.properties={}),(s=e.properties).class||(s.class=[]),typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(/\s+/g);for(const r of n)r&&!e.properties.class.includes(r)&&e.properties.class.push(r);return e}function e3e(e,t){let n=0;const s=[];for(const r of t)r>n&&s.push({...e,content:e.content.slice(n,r),offset:e.offset+n}),n=r;return n<e.content.length&&s.push({...e,content:e.content.slice(n),offset:e.offset+n}),s}function t3e(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((s,r)=>s-r);return n.length?e.map(s=>s.flatMap(r=>{const i=n.filter(o=>r.offset<o&&o<r.offset+r.content.length).map(o=>o-r.offset).sort((o,a)=>o-a);return i.length?e3e(r,i):r})):e}async function cQ(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function vS(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},s=typeof e=="string"?e:e.name;for(const[r,i]of Object.entries((t==null?void 0:t.colorReplacements)||{}))typeof i=="string"?n[r]=i:r===s&&Object.assign(n,i);return n}function cp(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function uQ(e){const t={};return e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle&&(e.fontStyle&Ed.Italic&&(t["font-style"]="italic"),e.fontStyle&Ed.Bold&&(t["font-weight"]="bold"),e.fontStyle&Ed.Underline&&(t["text-decoration"]="underline")),t}function n3e(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function s3e(e){const t=w3(e,!0).map(([r])=>r);function n(r){if(r===e.length)return{line:t.length-1,character:t[t.length-1].length};let i=r,o=0;for(const a of t){if(i<a.length)break;i-=a.length,o++}return{line:o,character:i}}function s(r,i){let o=0;for(let a=0;a<r;a++)o+=t[a].length;return o+=i,o}return{lines:t,indexToPos:n,posToIndex:s}}class _a extends Error{constructor(t){super(t),this.name="ShikiError"}}const dQ=new WeakMap;function k3(e,t){dQ.set(e,t)}function Ox(e){return dQ.get(e)}class K1{constructor(...t){Me(this,"_stacks",{});Me(this,"lang");if(t.length===2){const[n,s]=t;this.lang=s,this._stacks=n}else{const[n,s,r]=t;this.lang=s,this._stacks={[r]:n}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new K1(Object.fromEntries(Z4e(n).map(s=>[s,OE])),t)}getInternalStack(t=this.theme){return this._stacks[t]}get scopes(){return XB(this._stacks[this.theme])}getScopes(t=this.theme){return XB(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function XB(e){const t=[],n=new Set;function s(r){var o;if(n.has(r))return;n.add(r);const i=(o=r==null?void 0:r.nameScopesList)==null?void 0:o.scopeName;i&&t.push(i),r.parent&&s(r.parent)}return s(e),t}function r3e(e,t){if(!(e instanceof K1))throw new _a("Invalid grammar state");return e.getInternalStack(t)}function i3e(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let s=function(o){if(typeof o=="number"){if(o<0||o>n.source.length)throw new _a(`Invalid decoration offset: ${o}. Code length: ${n.source.length}`);return{...r.indexToPos(o),offset:o}}else{const a=r.lines[o.line];if(a===void 0)throw new _a(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${r.lines.length}`);if(o.character<0||o.character>a.length)throw new _a(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${a.length}`);return{...o,offset:r.posToIndex(o.line,o.character)}}};const r=s3e(n.source),i=(n.options.decorations||[]).map(o=>({...o,start:s(o.start),end:s(o.end)}));o3e(i),e.set(n.meta,{decorations:i,converter:r,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(n){var o;if(!((o=this.options.decorations)!=null&&o.length))return;const r=t(this).decorations.flatMap(a=>[a.start.offset,a.end.offset]);return t3e(n,r)},code(n){var d;if(!((d=this.options.decorations)!=null&&d.length))return;const s=t(this),r=Array.from(n.children).filter(h=>h.type==="element"&&h.tagName==="span");if(r.length!==s.converter.lines.length)throw new _a(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${s.converter.lines.length}). Failed to apply decorations.`);function i(h,m,p,g){const b=r[h];let v="",x=-1,y=-1;if(m===0&&(x=0),p===0&&(y=0),p===Number.POSITIVE_INFINITY&&(y=b.children.length),x===-1||y===-1)for(let k=0;k<b.children.length;k++)v+=hQ(b.children[k]),x===-1&&v.length===m&&(x=k+1),y===-1&&v.length===p&&(y=k+1);if(x===-1)throw new _a(`Failed to find start index for decoration ${JSON.stringify(g.start)}`);if(y===-1)throw new _a(`Failed to find end index for decoration ${JSON.stringify(g.end)}`);const w=b.children.slice(x,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(x,w.length,k)}}function o(h,m){r[h]=a(r[h],m,"line")}function a(h,m,p){var v;const g=m.properties||{},b=m.transform||(x=>x);return h.tagName=m.tagName||"span",h.properties={...h.properties,...g,class:h.properties.class},(v=m.properties)!=null&&v.class&&lQ(h,m.properties.class),h=b(h,p)||h,h}const c=[],u=s.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++)c.unshift(()=>o(g,h));i(p.line,0,p.character,h)}}c.forEach(h=>h())}}}function o3e(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new _a(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let s=t+1;s<e.length;s++){const r=e[s],i=n.start.offset<r.start.offset&&r.start.offset<n.end.offset,o=n.start.offset<r.end.offset&&r.end.offset<n.end.offset,a=r.start.offset<n.start.offset&&n.start.offset<r.end.offset,c=r.start.offset<n.end.offset&&n.end.offset<r.end.offset;if(i||o||a||c){if(o&&o||a&&c)continue;throw new _a(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(r.start)} intersect.`)}}}}function hQ(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(hQ).join(""):""}const a3e=[i3e()];function wS(e){return[...e.transformers||[],...a3e]}var up=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],e6={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function l3e(e,t){const n=e.indexOf("\x1B[",t);if(n!==-1){const s=e.indexOf("m",n);return{sequence:e.substring(n+2,s).split(";"),startPosition:n,position:s+1}}return{position:e.length}}function QB(e,t){let n=1;const s=e[t+n++];let r;if(s==="2"){const i=[e[t+n++],e[t+n++],e[t+n]].map(o=>Number.parseInt(o));i.length===3&&!i.some(o=>Number.isNaN(o))&&(r={type:"rgb",rgb:i})}else if(s==="5"){const i=Number.parseInt(e[t+n]);Number.isNaN(i)||(r={type:"table",index:Number(i)})}return[n,r]}function c3e(e){const t=[];for(let n=0;n<e.length;n++){const s=e[n],r=Number.parseInt(s);if(!Number.isNaN(r))if(r===0)t.push({type:"resetAll"});else if(r<=9)e6[r]&&t.push({type:"setDecoration",value:e6[r]});else if(r<=29){const i=e6[r-20];i&&t.push({type:"resetDecoration",value:i})}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:up[r-30]}});else if(r===38){const[i,o]=QB(e,n);o&&t.push({type:"setForegroundColor",value:o}),n+=i}else if(r===39)t.push({type:"resetForegroundColor"});else if(r<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:up[r-40]}});else if(r===48){const[i,o]=QB(e,n);o&&t.push({type:"setBackgroundColor",value:o}),n+=i}else r===49?t.push({type:"resetBackgroundColor"}):r>=90&&r<=97?t.push({type:"setForegroundColor",value:{type:"named",name:up[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:up[r-100+8]}})}return t}function u3e(){let e=null,t=null,n=new Set;return{parse(s){const r=[];let i=0;do{const o=l3e(s,i),a=o.sequence?s.substring(i,o.startPosition):s.substring(i);if(a.length>0&&r.push({value:a,foreground:e,background:t,decorations:new Set(n)}),o.sequence){const c=c3e(o.sequence);for(const u of c)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 c)u.type==="setForegroundColor"?e=u.value:u.type==="setBackgroundColor"?t=u.value:u.type==="setDecoration"&&n.add(u.value)}i=o.position}while(i<s.length);return r}}}var d3e={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 h3e(e=d3e){function t(a){return e[a]}function n(a){return`#${a.map(c=>Math.max(0,Math.min(c,255)).toString(16).padStart(2,"0")).join("")}`}let s;function r(){if(s)return s;s=[];for(let u=0;u<up.length;u++)s.push(t(up[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++)s.push(n([a[u],a[d],a[h]]));let c=8;for(let u=0;u<24;u++,c+=10)s.push(n([c,c,c]));return s}function i(a){return r()[a]}function o(a){switch(a.type){case"named":return t(a.name);case"rgb":return n(a.rgb);case"table":return i(a.index)}}return{value:o}}function f3e(e,t,n){const s=vS(e,n),r=w3(t),i=h3e(Object.fromEntries(up.map(a=>{var c;return[a,(c=e.colors)==null?void 0:c[`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`]]}))),o=u3e();return r.map(a=>o.parse(a[0]).map(c=>{let u,d;c.decorations.has("reverse")?(u=c.background?i.value(c.background):e.bg,d=c.foreground?i.value(c.foreground):e.fg):(u=c.foreground?i.value(c.foreground):e.fg,d=c.background?i.value(c.background):void 0),u=cp(u,s),d=cp(d,s),c.decorations.has("dim")&&(u=m3e(u));let h=Ed.None;return c.decorations.has("bold")&&(h|=Ed.Bold),c.decorations.has("italic")&&(h|=Ed.Italic),c.decorations.has("underline")&&(h|=Ed.Underline),{content:c.value,offset:a[1],color:u,bgColor:d,fontStyle:h}}))}function m3e(e){const t=e.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(t)if(t[3]){const s=Math.round(Number.parseInt(t[3],16)/2).toString(16).padStart(2,"0");return`#${t[1]}${t[2]}${s}`}else return t[2]?`#${t[1]}${t[2]}80`:`#${Array.from(t[1]).map(s=>`${s}${s}`).join("")}80`;const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function Jj(e,t,n={}){const{lang:s="text",theme:r=e.getLoadedThemes()[0]}=n;if(Xj(s)||Qj(r))return w3(t).map(c=>[{content:c[0],offset:c[1]}]);const{theme:i,colorMap:o}=e.setTheme(r);if(s==="ansi")return f3e(i,t,n);const a=e.getLanguage(s);if(n.grammarState){if(n.grammarState.lang!==a.name)throw new Pd(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(i.name))throw new Pd(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return g3e(t,a,i,o,n)}function p3e(...e){if(e.length===2)return Ox(e[1]);const[t,n,s={}]=e,{lang:r="text",theme:i=t.getLoadedThemes()[0]}=s;if(Xj(r)||Qj(i))throw new Pd("Plain language does not have grammar state");if(r==="ansi")throw new Pd("ANSI language does not have grammar state");const{theme:o,colorMap:a}=t.setTheme(i),c=t.getLanguage(r);return new K1(kS(n,c,o,a,s).stateStack,c.name,o.name)}function g3e(e,t,n,s,r){const i=kS(e,t,n,s,r),o=new K1(kS(e,t,n,s,r).stateStack,t.name,n.name);return k3(i.tokens,o),i.tokens}function kS(e,t,n,s,r){const i=vS(n,r),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500}=r,c=w3(e);let u=r.grammarState?r3e(r.grammarState,n.name)??OE:r.grammarContextCode!=null?kS(r.grammarContextCode,t,n,s,{...r,grammarState:void 0,grammarContextCode:void 0}).stateStack:OE,d=[];const h=[];for(let m=0,p=c.length;m<p;m++){const[g,b]=c[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 v,x,y;r.includeExplanation&&(v=t.tokenizeLine(g,u),x=v.tokens,y=0);const w=t.tokenizeLine2(g,u,a),k=w.tokens.length/2;for(let T=0;T<k;T++){const _=w.tokens[2*T],C=T+1<k?w.tokens[2*T+2]:g.length;if(_===C)continue;const S=w.tokens[2*T+1],L=cp(s[l1.getForeground(S)],i),N=l1.getFontStyle(S),$={content:g.substring(_,C),offset:b+_,color:L,fontStyle:N};if(r.includeExplanation){const M=[];if(r.includeExplanation!=="scopeName")for(const E of n.settings){let O;switch(typeof E.scope){case"string":O=E.scope.split(/,/).map(z=>z.trim());break;case"object":O=E.scope;break;default:continue}M.push({settings:E,selectors:O.map(z=>z.split(/ /))})}$.explanation=[];let P=0;for(;_+P<C;){const E=x[y],O=g.substring(E.startIndex,E.endIndex);P+=O.length,$.explanation.push({content:O,scopes:r.includeExplanation==="scopeName"?b3e(E.scopes):y3e(M,E.scopes)}),y+=1}}d.push($)}h.push(d),d=[],u=w.ruleStack}return{tokens:h,stateStack:u}}function b3e(e){return e.map(t=>({scopeName:t}))}function y3e(e,t){const n=[];for(let s=0,r=t.length;s<r;s++){const i=t[s];n[s]={scopeName:i,themeMatches:v3e(e,i,t.slice(0,s))}}return n}function JB(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function x3e(e,t,n){if(!JB(e[e.length-1],t))return!1;let s=e.length-2,r=n.length-1;for(;s>=0&&r>=0;)JB(e[s],n[r])&&(s-=1),r-=1;return s===-1}function v3e(e,t,n){const s=[];for(const{selectors:r,settings:i}of e)for(const o of r)if(x3e(o,t,n)){s.push(i);break}return s}function fQ(e,t,n){const s=Object.entries(n.themes).filter(c=>c[1]).map(c=>({color:c[0],theme:c[1]})),r=s.map(c=>{const u=Jj(e,t,{...n,theme:c.theme}),d=Ox(u),h=typeof c.theme=="string"?c.theme:c.theme.name;return{tokens:u,state:d,theme:h}}),i=w3e(...r.map(c=>c.tokens)),o=i[0].map((c,u)=>c.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:v,offset:x,...y}=p[u][h];m.variants[s[g].color]=y}),m})),a=r[0].state?new K1(Object.fromEntries(r.map(c=>{var u;return[c.theme,(u=c.state)==null?void 0:u.getInternalStack(c.theme)]})),r[0].state.lang):void 0;return a&&k3(o,a),o}function w3e(...e){const t=e.map(()=>[]),n=e.length;for(let s=0;s<e[0].length;s++){const r=e.map(c=>c[s]),i=t.map(()=>[]);t.forEach((c,u)=>c.push(i[u]));const o=r.map(()=>0),a=r.map(c=>c[0]);for(;a.every(c=>c);){const c=Math.min(...a.map(u=>u.content.length));for(let u=0;u<n;u++){const d=a[u];d.content.length===c?(i[u].push(d),o[u]+=1,a[u]=r[u][o[u]]):(i[u].push({...d,content:d.content.slice(0,c)}),a[u]={...d,content:d.content.slice(c),offset:d.offset+c})}}}return t}function _S(e,t,n){let s,r,i,o,a,c;if("themes"in n){const{defaultColor:u="light",cssVariablePrefix:d="--shiki-"}=n,h=Object.entries(n.themes).filter(v=>v[1]).map(v=>({color:v[0],theme:v[1]})).sort((v,x)=>v.color===u?-1:x.color===u?1:0);if(h.length===0)throw new Pd("`themes` option must not be empty");const m=fQ(e,t,n);if(c=Ox(m),u&&!h.find(v=>v.color===u))throw new Pd(`\`themes\` option must contain the defaultColor key \`${u}\``);const p=h.map(v=>e.getTheme(v.theme)),g=h.map(v=>v.color);i=m.map(v=>v.map(x=>k3e(x,g,d,u))),c&&k3(i,c);const b=h.map(v=>vS(v.theme,n));r=h.map((v,x)=>(x===0&&u?"":`${d+v.color}:`)+(cp(p[x].fg,b[x])||"inherit")).join(";"),s=h.map((v,x)=>(x===0&&u?"":`${d+v.color}-bg:`)+(cp(p[x].bg,b[x])||"inherit")).join(";"),o=`shiki-themes ${p.map(v=>v.name).join(" ")}`,a=u?void 0:[r,s].join(";")}else if("theme"in n){const u=vS(n.theme,n);i=Jj(e,t,n);const d=e.getTheme(n.theme);s=cp(d.bg,u),r=cp(d.fg,u),o=d.name,c=Ox(i)}else throw new Pd("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:r,bg:s,themeName:o,rootStyle:a,grammarState:c}}function k3e(e,t,n,s){const r={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(c=>uQ(e.variants[c])),o=new Set(i.flatMap(c=>Object.keys(c))),a={};return i.forEach((c,u)=>{for(const d of o){const h=c[d]||"inherit";if(u===0&&s)a[d]=h;else{const m=d==="color"?"":d==="background-color"?"-bg":`-${d}`,p=n+t[u]+(d==="color"?"":m);a[p]=h}}}),r.htmlStyle=a,r}function SS(e,t,n,s={meta:{},options:n,codeToHast:(r,i)=>SS(e,r,i),codeToTokens:(r,i)=>_S(e,r,i)}){var p,g;let r=t;for(const b of wS(n))r=((p=b.preprocess)==null?void 0:p.call(s,r,n))||r;let{tokens:i,fg:o,bg:a,themeName:c,rootStyle:u,grammarState:d}=_S(e,r,n);const{mergeWhitespaces:h=!0}=n;h===!0?i=S3e(i):h==="never"&&(i=C3e(i));const m={...s,get source(){return r}};for(const b of wS(n))i=((g=b.tokens)==null?void 0:g.call(m,i))||i;return _3e(i,{...n,fg:o,bg:a,themeName:c,rootStyle:u},m,d)}function _3e(e,t,n,s=Ox(e)){var g,b,v;const r=wS(t),i=[],o={type:"root",children:[]},{structure:a="classic",tabindex:c="0"}=t;let u={type:"element",tagName:"pre",properties:{class:`shiki ${t.themeName||""}`,style:t.rootStyle||`background-color:${t.bg};color:${t.fg}`,...c!==!1&&c!=null?{tabindex:c.toString()}:{},...Object.fromEntries(Array.from(Object.entries(t.meta||{})).filter(([x])=>!x.startsWith("_")))},children:[]},d={type:"element",tagName:"code",properties:{},children:i};const h=[],m={...n,structure:a,addClassToHast:lQ,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((x,y)=>{var T,_;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 x){let S={type:"element",tagName:"span",properties:{...C.htmlAttrs},children:[{type:"text",value:C.content}]};C.htmlStyle;const L=n3e(C.htmlStyle||uQ(C));L&&(S.properties.style=L);for(const N of r)S=((T=N==null?void 0:N.span)==null?void 0:T.call(m,S,y+1,k,w,C))||S;a==="inline"?o.children.push(S):a==="classic"&&w.children.push(S),k+=C.content.length}if(a==="classic"){for(const C of r)w=((_=C==null?void 0:C.line)==null?void 0:_.call(m,w,y+1))||w;h.push(w),i.push(w)}}),a==="classic"){for(const x of r)d=((g=x==null?void 0:x.code)==null?void 0:g.call(m,d))||d;u.children.push(d);for(const x of r)u=((b=x==null?void 0:x.pre)==null?void 0:b.call(m,u))||u;o.children.push(u)}let p=o;for(const x of r)p=((v=x==null?void 0:x.root)==null?void 0:v.call(m,p))||p;return s&&k3(p,s),p}function S3e(e){return e.map(t=>{const n=[];let s="",r=0;return t.forEach((i,o)=>{const c=!(i.fontStyle&&i.fontStyle&Ed.Underline);c&&i.content.match(/^\s+$/)&&t[o+1]?(r||(r=i.offset),s+=i.content):s?(c?n.push({...i,offset:r,content:s+i.content}):n.push({content:s,offset:r},i),r=0,s=""):n.push(i)}),n})}function C3e(e){return e.map(t=>t.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const s=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!s)return n;const[,r,i,o]=s;if(!r&&!o)return n;const a=[{...n,offset:n.offset+r.length,content:i}];return r&&a.unshift({content:r,offset:n.offset}),o&&a.push({content:o,offset:n.offset+r.length+i.length}),a}))}function T3e(e,t,n){var i;const s={meta:{},options:n,codeToHast:(o,a)=>SS(e,o,a),codeToTokens:(o,a)=>_S(e,o,a)};let r=X4e(SS(e,t,n,s));for(const o of wS(n))r=((i=o.postprocess)==null?void 0:i.call(s,r,n))||r;return r}const ZB={light:"#333333",dark:"#bbbbbb"},e$={light:"#fffffe",dark:"#1e1e1e"},t$="__shiki_resolved";function Zj(e){var a,c,u,d,h;if(e!=null&&e[t$])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||(t.type="dark"),t.colorReplacements={...t.colorReplacements},t.settings||(t.settings=[]);let{bg:n,fg:s}=t;if(!n||!s){const m=t.settings?t.settings.find(p=>!p.name&&!p.scope):void 0;(a=m==null?void 0:m.settings)!=null&&a.foreground&&(s=m.settings.foreground),(c=m==null?void 0:m.settings)!=null&&c.background&&(n=m.settings.background),!s&&((u=t==null?void 0:t.colors)!=null&&u["editor.foreground"])&&(s=t.colors["editor.foreground"]),!n&&((d=t==null?void 0:t.colors)!=null&&d["editor.background"])&&(n=t.colors["editor.background"]),s||(s=t.type==="light"?ZB.light:ZB.dark),n||(n=t.type==="light"?e$.light:e$.dark),t.fg=s,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let r=0;const i=new Map;function o(m){var g;if(i.has(m))return i.get(m);r+=1;const p=`#${r.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 v,x;const p=((v=m.settings)==null?void 0:v.foreground)&&!m.settings.foreground.startsWith("#"),g=((x=m.settings)==null?void 0:x.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,t$,{enumerable:!1,writable:!1,value:!0}),t}async function mQ(e){return Array.from(new Set((await Promise.all(e.filter(t=>!oQ(t)).map(async t=>await cQ(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function pQ(e){return(await Promise.all(e.map(async n=>aQ(n)?null:Zj(await cQ(n))))).filter(n=>!!n)}class E3e extends YSe{constructor(n,s,r,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=s,this._langs=r,this._alias=i,this._themes.map(o=>this.loadTheme(o)),this.loadLanguages(this._langs)}getTheme(n){return typeof n=="string"?this._resolvedThemes.get(n):this.loadTheme(n)}loadTheme(n){const s=Zj(n);return s.name&&(this._resolvedThemes.set(s.name,s),this._loadedThemesCache=null),s}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(n){let s=this._textmateThemeCache.get(n);s||(s=pS.createFromRawTheme(n),this._textmateThemeCache.set(n,s)),this._syncRegistry.setTheme(s)}getGrammar(n){if(this._alias[n]){const s=new Set([n]);for(;this._alias[n];){if(n=this._alias[n],s.has(n))throw new _a(`Circular alias \`${Array.from(s).join(" -> ")} -> ${n}\``);s.add(n)}}return this._resolvedGrammars.get(n)}loadLanguage(n){var o,a,c,u;if(this.getGrammar(n.name))return;const s=new Set([...this._langMap.values()].filter(d=>{var h;return(h=d.embeddedLangsLazy)==null?void 0:h.includes(n.name)}));this._resolver.addLanguage(n);const r={balancedBracketSelectors:n.balancedBracketSelectors||["*"],unbalancedBracketSelectors:n.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(n.scopeName,n);const i=this.loadGrammarWithConfiguration(n.scopeName,1,r);if(i.name=n.name,this._resolvedGrammars.set(n.name,i),n.aliases&&n.aliases.forEach(d=>{this._alias[d]=n.name}),this._loadedLanguagesCache=null,s.size)for(const d of s)this._resolvedGrammars.delete(d.name),this._loadedLanguagesCache=null,(a=(o=this._syncRegistry)==null?void 0:o._injectionGrammars)==null||a.delete(d.scopeName),(u=(c=this._syncRegistry)==null?void 0:c._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 s=Array.from(this._langGraph.entries()),r=s.filter(([i,o])=>!o);if(r.length){const i=s.filter(([o,a])=>{var c;return a&&((c=a.embeddedLangs)==null?void 0:c.some(u=>r.map(([d])=>d).includes(u)))}).filter(o=>!r.includes(o));throw new _a(`Missing languages ${r.map(([o])=>`\`${o}\``).join(", ")}, required by ${i.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[i,o]of s)this._resolver.addLanguage(o);for(const[i,o]of s)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(n){if(this._langMap.set(n.name,n),this._langGraph.set(n.name,n),n.embeddedLangs)for(const s of n.embeddedLangs)this._langGraph.set(s,this._langMap.get(s))}}class A3e{constructor(t,n){Me(this,"_langs",new Map);Me(this,"_scopeToLang",new Map);Me(this,"_injections",new Map);Me(this,"_onigLib");this._onigLib={createOnigScanner:s=>t.createScanner(s),createOnigString:s=>t.createString(s)},n.forEach(s=>this.addLanguage(s))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){this._langs.set(t.name,t),t.aliases&&t.aliases.forEach(n=>{this._langs.set(n,t)}),this._scopeToLang.set(t.scopeName,t),t.injectTo&&t.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(t.scopeName)})}getInjections(t){const n=t.split(".");let s=[];for(let r=1;r<=n.length;r++){const i=n.slice(0,r).join(".");s=[...s,...this._injections.get(i)||[]]}return s}}let Yb=0;function N3e(e){Yb+=1,e.warnings!==!1&&Yb>=10&&Yb%10===0&&console.warn(`[Shiki] ${Yb} 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 _a("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),s=(e.themes||[]).flat(1).map(Zj),r=new A3e(e.engine,n),i=new E3e(r,s,n,e.langAlias);let o;function a(y){v();const w=i.getGrammar(typeof y=="string"?y:y.name);if(!w)throw new _a(`Language \`${y}\` not found, you may need to load it first`);return w}function c(y){if(y==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};v();const w=i.getTheme(y);if(!w)throw new _a(`Theme \`${y}\` not found, you may need to load it first`);return w}function u(y){v();const w=c(y);o!==y&&(i.setTheme(w),o=y);const k=i.getColorMap();return{theme:w,colorMap:k}}function d(){return v(),i.getLoadedThemes()}function h(){return v(),i.getLoadedLanguages()}function m(...y){v(),i.loadLanguages(y.flat(1))}async function p(...y){return m(await mQ(y))}function g(...y){v();for(const w of y.flat(1))i.loadTheme(w)}async function b(...y){return v(),g(await pQ(y))}function v(){if(t)throw new _a("Shiki instance has been disposed")}function x(){t||(t=!0,i.dispose(),Yb-=1)}return{setTheme:u,getTheme:c,getLanguage:a,getLoadedThemes:d,getLoadedLanguages:h,loadLanguage:p,loadLanguageSync:m,loadTheme:b,loadThemeSync:g,dispose:x,[Symbol.dispose]:x}}async function j3e(e={}){e.loadWasm;const[t,n,s]=await Promise.all([pQ(e.themes||[]),mQ(e.langs||[]),e.engine||$X(e.loadWasm||cSe())]);return N3e({...e,themes:t,langs:n,engine:s})}async function M3e(e={}){const t=await j3e(e);return{getLastGrammarState:(...n)=>p3e(t,...n),codeToTokensBase:(n,s)=>Jj(t,n,s),codeToTokensWithThemes:(n,s)=>fQ(t,n,s),codeToTokens:(n,s)=>_S(t,n,s),codeToHast:(n,s)=>SS(t,n,s),codeToHtml:(n,s)=>T3e(t,n,s),...t,getInternalContext:()=>t}}function I3e(e,t,n){let s,r,i;{const a=e;s=a.langs,r=a.themes,i=a.engine}async function o(a){function c(p){if(typeof p=="string"){if(oQ(p))return[];const g=s[p];if(!g)throw new Pd(`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(aQ(p))return"none";if(typeof p=="string"){const g=r[p];if(!g)throw new Pd(`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=>c(p)),m=await M3e({engine:a.engine??i(),...a,themes:d,langs:h});return{...m,loadLanguage(...p){return m.loadLanguage(...p.map(c))},loadTheme(...p){return m.loadTheme(...p.map(u))}}}return o}const R3e=I3e({langs:q2e,themes:V2e,engine:()=>$X(ie(()=>import("./wasm-CG6Dc4jp.js"),[]))});/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const D3e=["github-light-default","github-dark-default"];let kk=null,$E=null;const zE=new Set,t6=new Map,n$=new Set,L3e=128,vy=new Map;function gQ(e,t,n){return`${t}\0${n}\0${e}`}function P3e(e,t){if(vy.size>=L3e){const n=vy.keys().next().value;n!==void 0&&vy.delete(n)}vy.set(e,t)}function O3e(e,t,n){return vy.get(gQ(e,t,n))??null}function B3e(){return kk||(kk=R3e({langs:[],themes:D3e}).then(e=>($E=e,e)).catch(e=>{throw kk=null,e})),kk}async function bQ(e){const t=await B3e();if(zE.has(e))return t;if(n$.has(e))throw new Error(`shiki: language "${e}" previously failed to load`);let n=t6.get(e);return n||(n=t.loadLanguage(e).then(()=>{zE.add(e)}).catch(s=>{throw n$.add(e),s}).finally(()=>{t6.delete(e)}),t6.set(e,n)),await n,t}const $3e=1e5,z3e=2e4;function FE(e){if(e.length>$3e)return!0;let t=0;const n=e.length;for(let s=0;s<=n;s++)if(s===n||e.charCodeAt(s)===10){if(s-t>z3e)return!0;t=s+1}return!1}function s$(e,t,n,s=!0){if($E&&zE.has(t))try{const r=$E.codeToHtml(e,{lang:t,theme:n});return s&&P3e(gQ(e,t,n),r),r}catch(r){return console.warn("[web-shell] sync highlight failed for lang=%s",t,r),null}return null}const F3e=()=>{},H3e=()=>F3e,yQ=f.createContext(H3e);function q3e(){return f.useContext(yQ)}function xQ(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=xQ(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function vQ(){for(var e,t,n=0,s="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=xQ(e))&&(s&&(s+=" "),s+=t);return s}const r$=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,i$=vQ,i0=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return i$(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:i}=t,o=Object.keys(r).map(u=>{const d=n==null?void 0:n[u],h=i==null?void 0:i[u];if(d===null)return null;const m=r$(d)||r$(h);return r[u][m]}),a=n&&Object.entries(n).reduce((u,d)=>{let[h,m]=d;return m===void 0||(u[h]=m),u},{}),c=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((u,d)=>{let{class:h,className:m,...p}=d;return Object.entries(p).every(g=>{let[b,v]=g;return Array.isArray(v)?v.includes({...i,...a}[b]):{...i,...a}[b]===v})?[...u,h,m]:u},[]);return i$(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)};function o$(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function U3e(...e){return t=>{let n=!1;const s=e.map(r=>{const i=o$(r,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let r=0;r<s.length;r++){const i=s[r];typeof i=="function"?i():o$(e[r],null)}}}}function os(...e){return f.useCallback(U3e(...e),e)}function Bf(e){const t=f.forwardRef((n,s)=>{let{children:r,...i}=n,o=null,a=!1;const c=[];a$(r)&&typeof _k=="function"&&(r=_k(r._payload)),f.Children.forEach(r,m=>{var p;if(Y3e(m)){a=!0;const g=m;let b="child"in g.props?g.props.child:g.props.children;a$(b)&&typeof _k=="function"&&(b=_k(b._payload)),o=W3e(g,b),c.push((p=o==null?void 0:o.props)==null?void 0:p.children)}else c.push(m)}),o?o=f.cloneElement(o,void 0,c):!a&&f.Children.count(r)===1&&f.isValidElement(r)&&(o=r);const u=o?K3e(o):void 0,d=os(s,u);if(!o){if(r||r===0)throw new Error(a?Z3e(e):J3e(e));return r}const h=G3e(i,o.props??{});return o.type!==f.Fragment&&(h.ref=s?d:u),f.cloneElement(o,h)});return t.displayName=`${e}.Slot`,t}var eM=Bf("Slot"),wQ=Symbol.for("radix.slottable");function V3e(e){const t=n=>"child"in n?n.children(n.child):n.children;return t.displayName=`${e}.Slottable`,t.__radixId=wQ,t}var W3e=(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 G3e(e,t){const n={...t};for(const s in t){const r=e[s],i=t[s];/^on[A-Z]/.test(s)?r&&i?n[s]=(...a)=>{const c=i(...a);return r(...a),c}:r&&(n[s]=r):s==="style"?n[s]={...r,...i}:s==="className"&&(n[s]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function K3e(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Y3e(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===wQ}var X3e=Symbol.for("react.lazy");function a$(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===X3e&&"_payload"in e&&Q3e(e._payload)}function Q3e(e){return typeof e=="object"&&e!==null&&"then"in e}var J3e=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Z3e=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,_k=E4[" use ".trim().toString()],eCe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Mn=eCe.reduce((e,t)=>{const n=Bf(`Primitive.${t}`),s=f.forwardRef((r,i)=>{const{asChild:o,...a}=r,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function kQ(e,t){e&&$u.flushSync(()=>e.dispatchEvent(t))}var _Q=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"}),tCe="VisuallyHidden",SQ=f.forwardRef((e,t)=>l.jsx(Mn.span,{...e,ref:t,style:{..._Q,...e.style}}));SQ.displayName=tCe;var nCe=SQ;function oa(e,t=[]){let n=[];function s(i,o){const a=f.createContext(o);a.displayName=i+"Context";const c=n.length;n=[...n,o];const u=h=>{var x;const{scope:m,children:p,...g}=h,b=((x=m==null?void 0:m[e])==null?void 0:x[c])||a,v=f.useMemo(()=>g,Object.values(g));return l.jsx(b.Provider,{value:v,children:p})};u.displayName=i+"Provider";function d(h,m,p={}){var x;const{optional:g=!1}=p,b=((x=m==null?void 0:m[e])==null?void 0:x[c])||a,v=f.useContext(b);if(v)return v;if(o!==void 0)return o;if(!g)throw new Error(`\`${h}\` must be used within \`${i}\``)}return[u,d]}const r=()=>{const i=n.map(o=>f.createContext(o));return function(a){const c=(a==null?void 0:a[e])||i;return f.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return r.scopeName=e,[s,sCe(r,...t)]}function sCe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(i){const o=s.reduce((a,{useScope:c,scopeName:u})=>{const h=c(i)[`__scope${u}`];return{...a,...h}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function tM(e){const t=e+"CollectionProvider",[n,s]=oa(t),[r,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=b=>{const{scope:v,children:x}=b,y=f.useRef(null),w=f.useRef(new Map).current;return l.jsx(r,{scope:v,itemMap:w,collectionRef:y,children:x})};o.displayName=t;const a=e+"CollectionSlot",c=Bf(a),u=f.forwardRef((b,v)=>{const{scope:x,children:y}=b,w=i(a,x),k=os(v,w.collectionRef);return l.jsx(c,{ref:k,children:y})});u.displayName=a;const d=e+"CollectionItemSlot",h="data-radix-collection-item",m=Bf(d),p=f.forwardRef((b,v)=>{const{scope:x,children:y,...w}=b,k=f.useRef(null),T=os(v,k),_=i(d,x);return f.useEffect(()=>(_.itemMap.set(k,{ref:k,...w}),()=>void _.itemMap.delete(k))),l.jsx(m,{[h]:"",ref:T,children:y})});p.displayName=d;function g(b){const v=i(e+"CollectionConsumer",b);return f.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${h}]`));return Array.from(v.itemMap.values()).sort((_,C)=>w.indexOf(_.ref.current)-w.indexOf(C.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:u,ItemSlot:p},g,s]}function $t(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r||!r.defaultPrevented)return t==null?void 0:t(r)}}var Co=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{},rCe=E4[" useInsertionEffect ".trim().toString()]||Co;function ja({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[r,i,o]=iCe({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:r;{const d=f.useRef(e!==void 0);f.useEffect(()=>{const h=d.current;h!==a&&console.warn(`${s} 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,s])}const u=f.useCallback(d=>{var h;if(a){const m=oCe(d)?d(e):d;m!==e&&((h=o.current)==null||h.call(o,m))}else i(d)},[a,e,i,o]);return[c,u]}function iCe({defaultProp:e,onChange:t}){const[n,s]=f.useState(e),r=f.useRef(n),i=f.useRef(t);return rCe(()=>{i.current=t},[t]),f.useEffect(()=>{var o;r.current!==n&&((o=i.current)==null||o.call(i,n),r.current=n)},[n,r]),[n,s,i]}function oCe(e){return typeof e=="function"}function aCe(e,t){return f.useReducer((n,s)=>t[n][s]??n,e)}var aa=e=>{const{present:t,children:n}=e,s=lCe(t),r=typeof n=="function"?n({present:s.isPresent}):f.Children.only(n),i=cCe(s.ref,uCe(r));return typeof n=="function"||s.isPresent?f.cloneElement(r,{ref:i}):null};aa.displayName="Presence";function lCe(e){const[t,n]=f.useState(),s=f.useRef(null),r=f.useRef(e),i=f.useRef("none"),o=f.useRef(void 0),a=e?"mounted":"unmounted",[c,u]=aCe(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{c==="mounted"?(i.current=o.current??Xb(s.current),o.current=void 0):i.current="none"},[c]),Co(()=>{const d=s.current,h=r.current;if(h!==e){const p=i.current,g=Xb(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"),r.current=e}},[e,u]),Co(()=>{if(t){let d;const h=t.ownerDocument.defaultView??window,m=g=>{const v=Xb(s.current).includes(CSS.escape(g.animationName));if(g.target===t&&v&&(u("ANIMATION_END"),!r.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",d=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},p=g=>{g.target===t&&(i.current=Xb(s.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(c),ref:f.useCallback(d=>{if(d){const h=getComputedStyle(d);s.current=h,o.current=Xb(h)}else s.current=null;n(d)},[])}}function l$(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function cCe(...e){const t=f.useRef(e);return t.current=e,f.useCallback(n=>{const s=t.current;let r=!1;const i=s.map(o=>{const a=l$(o,n);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let o=0;o<i.length;o++){const a=i[o];typeof a=="function"?a():l$(s[o],null)}}},[])}function Xb(e){return(e==null?void 0:e.animationName)||"none"}function uCe(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var dCe=E4[" useId ".trim().toString()]||(()=>{}),hCe=0;function tl(e){const[t,n]=f.useState(dCe());return Co(()=>{n(s=>s??String(hCe++))},[e]),e||(t?`radix-${t}`:"")}var fCe=f.createContext(void 0);function Y1(e){const t=f.useContext(fCe);return e||t||"ltr"}function Rl(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}var mCe="DismissableLayer",HE="dismissableLayer.update",pCe="dismissableLayer.pointerDownOutside",gCe="dismissableLayer.focusOutside",c$,nM=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),X1=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:c,...u}=e,d=f.useContext(nM),[h,m]=f.useState(null),p=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=f.useState({}),b=os(t,m),v=Array.from(d.layers),[x]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),y=x?v.indexOf(x):-1,w=h?v.indexOf(h):-1,k=d.layersWithOutsidePointerEventsDisabled.size>0,T=w>=y,_=f.useRef(!1),C=wCe($=>{i==null||i($),a==null||a($),$.defaultPrevented||c==null||c()},{ownerDocument:p,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:_,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:f.useCallback($=>{if(!($ instanceof Node))return!1;const M=[...d.branches].some(P=>P.contains($));return T&&!M},[d.branches,T])}),S=kCe($=>{if(s&&_.current)return;const M=$.target;[...d.branches].some(E=>E.contains(M))||(o==null||o($),a==null||a($),$.defaultPrevented||c==null||c())},p),L=h?w===v.length-1:!1,N=Rl($=>{$.key==="Escape"&&(r==null||r($),!$.defaultPrevented&&c&&($.preventDefault(),c()))});return f.useEffect(()=>{if(L)return p.addEventListener("keydown",N,{capture:!0}),()=>p.removeEventListener("keydown",N,{capture:!0})},[p,L,N]),f.useEffect(()=>{if(h)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(c$=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),u$(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(h),d.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=c$))}},[h,p,n,d]),f.useEffect(()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),u$())},[h,d]),f.useEffect(()=>{const $=()=>g({});return document.addEventListener(HE,$),()=>document.removeEventListener(HE,$)},[]),l.jsx(Mn.div,{...u,ref:b,style:{pointerEvents:k?T?"auto":"none":void 0,...e.style},onFocusCapture:$t(e.onFocusCapture,S.onFocusCapture),onBlurCapture:$t(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:$t(e.onPointerDownCapture,C.onPointerDownCapture)})});X1.displayName=mCe;var bCe="DismissableLayerBranch",yCe=f.forwardRef((e,t)=>{const n=f.useContext(nM),s=f.useRef(null),r=os(t,s);return f.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),l.jsx(Mn.div,{...e,ref:r})});yCe.displayName=bCe;function xCe(){const e=f.useContext(nM),[t,n]=f.useState(null);return f.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var vCe=()=>!0;function wCe(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:s=!1,isDeferredPointerDownOutsideRef:r,dismissableSurfaces:i,shouldHandlePointerDownOutside:o=vCe}=t,a=Rl(e),c=f.useRef(!1),u=f.useRef(!1),d=f.useRef(new Map),h=f.useRef(()=>{});return f.useEffect(()=>{function m(){u.current=!1,r.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(_=>_.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 v=w=>{if(w.target&&!c.current){let k=function(){n.removeEventListener("click",h.current);const _=p();m(),_||CQ(pCe,a,T,{discrete:!0})};if(!o(w.target)){n.removeEventListener("click",h.current),m(),c.current=!1;return}const T={originalEvent:w};u.current=!0,r.current=s&&w.button===0,d.current.clear(),!s||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();c.current=!1},x=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const w of x)n.addEventListener(w,g,!0),n.addEventListener(w,b);const y=window.setTimeout(()=>{n.addEventListener("pointerdown",v)},0);return()=>{window.clearTimeout(y),n.removeEventListener("pointerdown",v),n.removeEventListener("click",h.current);for(const w of x)n.removeEventListener(w,g,!0),n.removeEventListener(w,b)}},[n,a,s,r,i,o]),{onPointerDownCapture:()=>c.current=!0}}function kCe(e,t=globalThis==null?void 0:globalThis.document){const n=Rl(e),s=f.useRef(!1);return f.useEffect(()=>{const r=i=>{i.target&&!s.current&&CQ(gCe,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function u$(){const e=new CustomEvent(HE);document.dispatchEvent(e)}function CQ(e,t,n,{discrete:s}){const r=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),s?kQ(r,i):r.dispatchEvent(i)}var n6="focusScope.autoFocusOnMount",s6="focusScope.autoFocusOnUnmount",d$={bubbles:!1,cancelable:!0},_Ce="FocusScope",$v=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:r,onUnmountAutoFocus:i,...o}=e,[a,c]=f.useState(null),u=Rl(r),d=Rl(i),h=f.useRef(null),m=os(t,c),p=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(s){let b=function(w){if(p.paused||!a)return;const k=w.target;a.contains(k)?h.current=k:Oh(h.current,{select:!0})},v=function(w){if(p.paused||!a)return;const k=w.relatedTarget;k!==null&&(a.contains(k)||Oh(h.current,{select:!0}))},x=function(w){if(document.activeElement===document.body)for(const T of w)T.removedNodes.length>0&&Oh(a)};document.addEventListener("focusin",b),document.addEventListener("focusout",v);const y=new MutationObserver(x);return a&&y.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",v),y.disconnect()}}},[s,a,p.paused]),f.useEffect(()=>{if(a){f$.add(p);const b=document.activeElement;if(!a.contains(b)){const x=new CustomEvent(n6,d$);a.addEventListener(n6,u),a.dispatchEvent(x),x.defaultPrevented||(SCe(NCe(TQ(a)),{select:!0}),document.activeElement===b&&Oh(a))}return()=>{a.removeEventListener(n6,u),setTimeout(()=>{const x=new CustomEvent(s6,d$);a.addEventListener(s6,d),a.dispatchEvent(x),x.defaultPrevented||Oh(b??document.body,{select:!0}),a.removeEventListener(s6,d),f$.remove(p)},0)}}},[a,u,d,p]);const g=f.useCallback(b=>{if(!n&&!s||p.paused)return;const v=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,x=document.activeElement;if(v&&x){const y=b.currentTarget,[w,k]=CCe(y);w&&k?!b.shiftKey&&x===k?(b.preventDefault(),n&&Oh(w,{select:!0})):b.shiftKey&&x===w&&(b.preventDefault(),n&&Oh(k,{select:!0})):x===y&&b.preventDefault()}},[n,s,p.paused]);return l.jsx(Mn.div,{tabIndex:-1,...o,ref:m,onKeyDown:g})});$v.displayName=_Ce;function SCe(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(Oh(s,{select:t}),document.activeElement!==n)return}function CCe(e){const t=TQ(e),n=h$(t,e),s=h$(t.reverse(),e);return[n,s]}function TQ(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function h$(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const s of e)if(!(n?!s.checkVisibility({checkVisibilityCSS:!0}):TCe(s,{upTo:t})))return s}function TCe(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 ECe(e){return e instanceof HTMLInputElement&&"select"in e}function Oh(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ECe(e)&&t&&e.select()}}var f$=ACe();function ACe(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=m$(e,t),e.unshift(t)},remove(t){var n;e=m$(e,t),(n=e[0])==null||n.resume()}}}function m$(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function NCe(e){return e.filter(t=>t.tagName!=="A")}var jCe="Portal",Q1=f.forwardRef((e,t)=>{var a;const{container:n,...s}=e,[r,i]=f.useState(!1);Co(()=>i(!0),[]);const o=n||r&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?$u.createPortal(l.jsx(Mn.div,{...s,ref:t}),o):null});Q1.displayName=jCe;var Sk=0,su=null;function _3(){f.useEffect(()=>{su||(su={start:p$(),end:p$()});const{start:e,end:t}=su;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Sk++,()=>{Sk===1&&(su==null||su.start.remove(),su==null||su.end.remove(),su=null),Sk=Math.max(0,Sk-1)}},[])}function p$(){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 yu=function(){return yu=Object.assign||function(t){for(var n,s=1,r=arguments.length;s<r;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},yu.apply(this,arguments)};function EQ(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(n[s[r]]=e[s[r]]);return n}function MCe(e,t,n){if(n||arguments.length===2)for(var s=0,r=t.length,i;s<r;s++)(i||!(s in t))&&(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}var K_="right-scroll-bar-position",Y_="width-before-scroll-bar",ICe="with-scroll-bars-hidden",RCe="--removed-body-scroll-bar-size";function r6(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function DCe(e,t){var n=f.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var r=n.value;r!==s&&(n.value=s,n.callback(s,r))}}}})[0];return n.callback=t,n.facade}var LCe=typeof window<"u"?f.useLayoutEffect:f.useEffect,g$=new WeakMap;function PCe(e,t){var n=DCe(null,function(s){return e.forEach(function(r){return r6(r,s)})});return LCe(function(){var s=g$.get(n);if(s){var r=new Set(s),i=new Set(e),o=n.current;r.forEach(function(a){i.has(a)||r6(a,null)}),i.forEach(function(a){r.has(a)||r6(a,o)})}g$.set(n,e)},[e]),n}function OCe(e){return e}function BCe(e,t){t===void 0&&(t=OCe);var n=[],s=!1,r={read:function(){if(s)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,s);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(i){for(s=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){s=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(i),o=n}var c=function(){var d=o;o=[],d.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),n}}}};return r}function $Ce(e){e===void 0&&(e={});var t=BCe(null);return t.options=yu({async:!0,ssr:!1},e),t}var AQ=function(e){var t=e.sideCar,n=EQ(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return f.createElement(s,yu({},n))};AQ.isSideCarExport=!0;function zCe(e,t){return e.useMedium(t),AQ}var NQ=$Ce(),i6=function(){},S3=f.forwardRef(function(e,t){var n=f.useRef(null),s=f.useState({onScrollCapture:i6,onWheelCapture:i6,onTouchMoveCapture:i6}),r=s[0],i=s[1],o=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,h=e.shards,m=e.sideCar,p=e.noRelative,g=e.noIsolation,b=e.inert,v=e.allowPinchZoom,x=e.as,y=x===void 0?"div":x,w=e.gapMode,k=EQ(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=m,_=PCe([n,t]),C=yu(yu({},k),r);return f.createElement(f.Fragment,null,d&&f.createElement(T,{sideCar:NQ,removeScrollBar:u,shards:h,noRelative:p,noIsolation:g,inert:b,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:w}),o?f.cloneElement(f.Children.only(a),yu(yu({},C),{ref:_})):f.createElement(y,yu({},C,{className:c,ref:_}),a))});S3.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};S3.classNames={fullWidth:Y_,zeroRight:K_};var FCe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function HCe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=FCe();return t&&e.setAttribute("nonce",t),e}function qCe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function UCe(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var VCe=function(){var e=0,t=null;return{add:function(n){e==0&&(t=HCe())&&(qCe(t,n),UCe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},WCe=function(){var e=VCe();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},jQ=function(){var e=WCe(),t=function(n){var s=n.styles,r=n.dynamic;return e(s,r),null};return t},GCe={left:0,top:0,right:0,gap:0},o6=function(e){return parseInt(e||"",10)||0},KCe=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],r=t[e==="padding"?"paddingRight":"marginRight"];return[o6(n),o6(s),o6(r)]},YCe=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return GCe;var t=KCe(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},XCe=jQ(),Rg="data-scroll-locked",QCe=function(e,t,n,s){var r=e.left,i=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
  .`.concat(ICe,` {
   overflow: hidden `).concat(s,`;
   padding-right: `).concat(a,"px ").concat(s,`;
  }
  body[`).concat(Rg,`] {
    overflow: hidden `).concat(s,`;
    overscroll-behavior: contain;
    `).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
    padding-left: `.concat(r,`px;
    padding-top: `).concat(i,`px;
    padding-right: `).concat(o,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(a,"px ").concat(s,`;
    `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(s,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(K_,` {
    right: `).concat(a,"px ").concat(s,`;
  }
  
  .`).concat(Y_,` {
    margin-right: `).concat(a,"px ").concat(s,`;
  }
  
  .`).concat(K_," .").concat(K_,` {
    right: 0 `).concat(s,`;
  }
  
  .`).concat(Y_," .").concat(Y_,` {
    margin-right: 0 `).concat(s,`;
  }
  
  body[`).concat(Rg,`] {
    `).concat(RCe,": ").concat(a,`px;
  }
`)},b$=function(){var e=parseInt(document.body.getAttribute(Rg)||"0",10);return isFinite(e)?e:0},JCe=function(){f.useEffect(function(){return document.body.setAttribute(Rg,(b$()+1).toString()),function(){var e=b$()-1;e<=0?document.body.removeAttribute(Rg):document.body.setAttribute(Rg,e.toString())}},[])},ZCe=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,r=s===void 0?"margin":s;JCe();var i=f.useMemo(function(){return YCe(r)},[r]);return f.createElement(XCe,{styles:QCe(i,!t,r,n?"":"!important")})},qE=!1;if(typeof window<"u")try{var Ck=Object.defineProperty({},"passive",{get:function(){return qE=!0,!0}});window.addEventListener("test",Ck,Ck),window.removeEventListener("test",Ck,Ck)}catch{qE=!1}var M0=qE?{passive:!1}:!1,eTe=function(e){return e.tagName==="TEXTAREA"},MQ=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!eTe(e)&&n[t]==="visible")},tTe=function(e){return MQ(e,"overflowY")},nTe=function(e){return MQ(e,"overflowX")},y$=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var r=IQ(e,s);if(r){var i=RQ(e,s),o=i[1],a=i[2];if(o>a)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},sTe=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},rTe=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},IQ=function(e,t){return e==="v"?tTe(t):nTe(t)},RQ=function(e,t){return e==="v"?sTe(t):rTe(t)},iTe=function(e,t){return e==="h"&&t==="rtl"?-1:1},oTe=function(e,t,n,s,r){var i=iTe(e,window.getComputedStyle(t).direction),o=i*s,a=n.target,c=t.contains(a),u=!1,d=o>0,h=0,m=0;do{if(!a)break;var p=RQ(e,a),g=p[0],b=p[1],v=p[2],x=b-v-i*g;(g||x)&&IQ(e,a)&&(h+=x,m+=g);var y=a.parentNode;a=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&Math.abs(h)<1||!d&&Math.abs(m)<1)&&(u=!0),u},Tk=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},x$=function(e){return[e.deltaX,e.deltaY]},v$=function(e){return e&&"current"in e?e.current:e},aTe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},lTe=function(e){return`
  .block-interactivity-`.concat(e,` {pointer-events: none;}
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},cTe=0,I0=[];function uTe(e){var t=f.useRef([]),n=f.useRef([0,0]),s=f.useRef(),r=f.useState(cTe++)[0],i=f.useState(jQ)[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(r));var b=MCe([e.lockRef.current],(e.shards||[]).map(v$),!0).filter(Boolean);return b.forEach(function(v){return v.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),b.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var a=f.useCallback(function(b,v){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!o.current.allowPinchZoom;var x=Tk(b),y=n.current,w="deltaX"in b?b.deltaX:y[0]-x[0],k="deltaY"in b?b.deltaY:y[1]-x[1],T,_=b.target,C=Math.abs(w)>Math.abs(k)?"h":"v";if("touches"in b&&C==="h"&&_.type==="range")return!1;var S=window.getSelection(),L=S&&S.anchorNode,N=L?L===_||L.contains(_):!1;if(N)return!1;var $=y$(C,_);if(!$)return!0;if($?T=C:(T=C==="v"?"h":"v",$=y$(C,_)),!$)return!1;if(!s.current&&"changedTouches"in b&&(w||k)&&(s.current=T),!T)return!0;var M=s.current||T;return oTe(M,v,b,M==="h"?w:k)},[]),c=f.useCallback(function(b){var v=b;if(!(!I0.length||I0[I0.length-1]!==i)){var x="deltaY"in v?x$(v):Tk(v),y=t.current.filter(function(T){return T.name===v.type&&(T.target===v.target||v.target===T.shadowParent)&&aTe(T.delta,x)})[0];if(y&&y.should){v.cancelable&&v.preventDefault();return}if(!y){var w=(o.current.shards||[]).map(v$).filter(Boolean).filter(function(T){return T.contains(v.target)}),k=w.length>0?a(v,w[0]):!o.current.noIsolation;k&&v.cancelable&&v.preventDefault()}}},[]),u=f.useCallback(function(b,v,x,y){var w={name:b,delta:v,target:x,should:y,shadowParent:dTe(x)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(k){return k!==w})},1)},[]),d=f.useCallback(function(b){n.current=Tk(b),s.current=void 0},[]),h=f.useCallback(function(b){u(b.type,x$(b),b.target,a(b,e.lockRef.current))},[]),m=f.useCallback(function(b){u(b.type,Tk(b),b.target,a(b,e.lockRef.current))},[]);f.useEffect(function(){return I0.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",c,M0),document.addEventListener("touchmove",c,M0),document.addEventListener("touchstart",d,M0),function(){I0=I0.filter(function(b){return b!==i}),document.removeEventListener("wheel",c,M0),document.removeEventListener("touchmove",c,M0),document.removeEventListener("touchstart",d,M0)}},[]);var p=e.removeScrollBar,g=e.inert;return f.createElement(f.Fragment,null,g?f.createElement(i,{styles:lTe(r)}):null,p?f.createElement(ZCe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function dTe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const hTe=zCe(NQ,uTe);var zv=f.forwardRef(function(e,t){return f.createElement(S3,yu({},e,{ref:t,sideCar:hTe}))});zv.classNames=S3.classNames;var fTe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},R0=new WeakMap,Ek=new WeakMap,Ak={},a6=0,DQ=function(e){return e&&(e.host||DQ(e.parentNode))},mTe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=DQ(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},pTe=function(e,t,n,s){var r=mTe(t,Array.isArray(e)?e:[e]);Ak[n]||(Ak[n]=new WeakMap);var i=Ak[n],o=[],a=new Set,c=new Set(r),u=function(h){!h||a.has(h)||(a.add(h),u(h.parentNode))};r.forEach(u);var d=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(m){if(a.has(m))d(m);else try{var p=m.getAttribute(s),g=p!==null&&p!=="false",b=(R0.get(m)||0)+1,v=(i.get(m)||0)+1;R0.set(m,b),i.set(m,v),o.push(m),b===1&&g&&Ek.set(m,!0),v===1&&m.setAttribute(n,"true"),g||m.setAttribute(s,"true")}catch(x){console.error("aria-hidden: cannot operate on ",m,x)}})};return d(t),a.clear(),a6++,function(){o.forEach(function(h){var m=R0.get(h)-1,p=i.get(h)-1;R0.set(h,m),i.set(h,p),m||(Ek.has(h)||h.removeAttribute(s),Ek.delete(h)),p||h.removeAttribute(n)}),a6--,a6||(R0=new WeakMap,R0=new WeakMap,Ek=new WeakMap,Ak={})}},C3=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=fTe(e);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),pTe(s,r,n,"aria-hidden")):function(){return null}},T3="Dialog",[LQ,PQ]=oa(T3),[gTe,zc]=LQ(T3),sM=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:r,onOpenChange:i,modal:o=!0}=e,a=f.useRef(null),c=f.useRef(null),[u,d]=ja({prop:s,defaultProp:r??!1,onChange:i,caller:T3});return l.jsx(gTe,{scope:t,triggerRef:a,contentRef:c,contentId:tl(),titleId:tl(),descriptionId:tl(),open:u,onOpenChange:d,onOpenToggle:f.useCallback(()=>d(h=>!h),[d]),modal:o,children:n})};sM.displayName=T3;var OQ="DialogTrigger",BQ=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=zc(OQ,n),i=os(t,r.triggerRef);return l.jsx(Mn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":uM(r.open),...s,ref:i,onClick:$t(e.onClick,r.onOpenToggle)})});BQ.displayName=OQ;var rM="DialogPortal",[bTe,$Q]=LQ(rM,{forceMount:void 0}),iM=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:r}=e,i=zc(rM,t);return l.jsx(bTe,{scope:t,forceMount:n,children:f.Children.map(s,o=>l.jsx(aa,{present:n||i.open,children:l.jsx(Q1,{asChild:!0,container:r,children:o})}))})};iM.displayName=rM;var CS="DialogOverlay",oM=f.forwardRef((e,t)=>{const n=$Q(CS,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,i=zc(CS,e.__scopeDialog);return i.modal?l.jsx(aa,{present:s||i.open,children:l.jsx(xTe,{...r,ref:t})}):null});oM.displayName=CS;var yTe=Bf("DialogOverlay.RemoveScroll"),xTe=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=zc(CS,n),i=xCe(),o=os(t,i);return l.jsx(zv,{as:yTe,allowPinchZoom:!0,shards:[r.contentRef],children:l.jsx(Mn.div,{"data-state":uM(r.open),...s,ref:o,style:{pointerEvents:"auto",...s.style}})})}),c1="DialogContent",aM=f.forwardRef((e,t)=>{const n=$Q(c1,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,i=zc(c1,e.__scopeDialog);return l.jsx(aa,{present:s||i.open,children:i.modal?l.jsx(vTe,{...r,ref:t}):l.jsx(wTe,{...r,ref:t})})});aM.displayName=c1;var vTe=f.forwardRef((e,t)=>{const n=zc(c1,e.__scopeDialog),s=f.useRef(null),r=os(t,n.contentRef,s);return f.useEffect(()=>{const i=s.current;if(i)return C3(i)},[]),l.jsx(zQ,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:$t(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:$t(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:$t(e.onFocusOutside,i=>i.preventDefault())})}),wTe=f.forwardRef((e,t)=>{const n=zc(c1,e.__scopeDialog),s=f.useRef(!1),r=f.useRef(!1);return l.jsx(zQ,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(s.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),s.current=!1,r.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),zQ=f.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:i,...o}=e,a=zc(c1,n);return _3(),l.jsx(l.Fragment,{children:l.jsx($v,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:i,children:l.jsx(X1,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":uM(a.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),FQ="DialogTitle",lM=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=zc(FQ,n);return l.jsx(Mn.h2,{id:r.titleId,...s,ref:t})});lM.displayName=FQ;var HQ="DialogDescription",cM=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=zc(HQ,n);return l.jsx(Mn.p,{id:r.descriptionId,...s,ref:t})});cM.displayName=HQ;var qQ="DialogClose",J1=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=zc(qQ,n);return l.jsx(Mn.button,{type:"button",...s,ref:t,onClick:$t(e.onClick,()=>r.onOpenChange(!1))})});J1.displayName=qQ;function uM(e){return e?"open":"closed"}var UQ="AlertDialog",[kTe,y_t]=oa(UQ,[PQ]),dh=PQ(),VQ=e=>{const{__scopeAlertDialog:t,...n}=e,s=dh(t);return l.jsx(sM,{...s,...n,modal:!0})};VQ.displayName=UQ;var _Te="AlertDialogTrigger",STe=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=dh(n);return l.jsx(BQ,{...r,...s,ref:t})});STe.displayName=_Te;var CTe="AlertDialogPortal",WQ=e=>{const{__scopeAlertDialog:t,...n}=e,s=dh(t);return l.jsx(iM,{...s,...n})};WQ.displayName=CTe;var TTe="AlertDialogOverlay",GQ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=dh(n);return l.jsx(oM,{...r,...s,ref:t})});GQ.displayName=TTe;var KQ="AlertDialogContent",[ETe,ATe]=kTe(KQ),YQ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...r}=e,i=dh(n),o=f.useRef(null),a=os(t,o),c=f.useRef(null);return l.jsx(ETe,{scope:n,cancelRef:c,children:l.jsx(aM,{role:"alertdialog",...i,...r,ref:a,onOpenAutoFocus:$t(r.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:s})})});YQ.displayName=KQ;var NTe="AlertDialogTitle",XQ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=dh(n);return l.jsx(lM,{...r,...s,ref:t})});XQ.displayName=NTe;var jTe="AlertDialogDescription",QQ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=dh(n);return l.jsx(cM,{...r,...s,ref:t})});QQ.displayName=jTe;var MTe="AlertDialogAction",JQ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=dh(n);return l.jsx(J1,{...r,...s,ref:t})});JQ.displayName=MTe;var ZQ="AlertDialogCancel",eJ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:r}=ATe(ZQ,n),i=dh(n),o=os(t,r);return l.jsx(J1,{...i,...s,ref:o})});eJ.displayName=ZQ;var ITe=VQ,RTe=WQ,DTe=GQ,LTe=YQ,PTe=JQ,OTe=eJ,BTe=XQ,$Te=QQ;function E3(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 A3(e){const[t,n]=f.useState(void 0);return Co(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const i=r[0];let o,a;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,a=u.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var N3="Checkbox",[zTe,x_t]=oa(N3),[FTe,dM]=zTe(N3);function HTe(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:r,disabled:i,form:o,name:a,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:h}=e,[m,p]=ja({prop:n,defaultProp:r??!1,onChange:c,caller:N3}),[g,b]=f.useState(null),[v,x]=f.useState(null),y=f.useRef(!1),w=g?!!o||!!g.closest("form"):!0,k={checked:m,disabled:i,setChecked:p,control:g,setControl:b,name:a,form:o,value:d,hasConsumerStoppedPropagationRef:y,required:u,defaultChecked:Sf(r)?!1:r,isFormControl:w,bubbleInput:v,setBubbleInput:x};return l.jsx(FTe,{scope:t,...k,children:qTe(h)?h(k):s})}var tJ="CheckboxTrigger",nJ=f.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...s},r)=>{const{control:i,value:o,disabled:a,checked:c,required:u,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:p,bubbleInput:g}=dM(tJ,e),b=os(r,d),v=f.useRef(c);return f.useEffect(()=>{const x=i==null?void 0:i.form;if(x){const y=()=>h(v.current);return x.addEventListener("reset",y),()=>x.removeEventListener("reset",y)}},[i,h]),l.jsx(Mn.button,{type:"button",role:"checkbox","aria-checked":Sf(c)?"mixed":c,"aria-required":u,"data-state":lJ(c),"data-disabled":a?"":void 0,disabled:a,value:o,...s,ref:b,onKeyDown:$t(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:$t(n,x=>{h(y=>Sf(y)?!0:!y),g&&p&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})})});nJ.displayName=tJ;var sJ=f.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:s,checked:r,defaultChecked:i,required:o,disabled:a,value:c,onCheckedChange:u,form:d,...h}=e;return l.jsx(HTe,{__scopeCheckbox:n,checked:r,defaultChecked:i,disabled:a,required:o,onCheckedChange:u,name:s,form:d,value:c,internal_do_not_use_render:({isFormControl:m})=>l.jsxs(l.Fragment,{children:[l.jsx(nJ,{...h,ref:t,__scopeCheckbox:n}),m&&l.jsx(aJ,{__scopeCheckbox:n})]})})});sJ.displayName=N3;var rJ="CheckboxIndicator",iJ=f.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...r}=e,i=dM(rJ,n);return l.jsx(aa,{present:s||Sf(i.checked)||i.checked===!0,children:l.jsx(Mn.span,{"data-state":lJ(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t,style:{pointerEvents:"none",...e.style}})})});iJ.displayName=rJ;var oJ="CheckboxBubbleInput",aJ=f.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:r,checked:i,defaultChecked:o,required:a,disabled:c,name:u,value:d,form:h,bubbleInput:m,setBubbleInput:p}=dM(oJ,e),g=os(n,p),b=E3(i),v=A3(s);f.useEffect(()=>{const y=m;if(!y)return;const w=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(w,"checked").set,_=!r.current;if(b!==i&&T){const C=new Event("click",{bubbles:_});y.indeterminate=Sf(i),T.call(y,Sf(i)?!1:i),y.dispatchEvent(C)}},[m,b,i,r]);const x=f.useRef(Sf(i)?!1:i);return l.jsx(Mn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??x.current,required:a,disabled:c,name:u,value:d,form:h,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});aJ.displayName=oJ;function qTe(e){return typeof e=="function"}function Sf(e){return e==="indeterminate"}function lJ(e){return Sf(e)?"indeterminate":e?"checked":"unchecked"}const UTe=["top","right","bottom","left"],$f=Math.min,Od=Math.max,TS=Math.round,Nk=Math.floor,Bd=e=>({x:e,y:e}),VTe={left:"right",right:"left",bottom:"top",top:"bottom"};function cJ(e,t,n){return Od(e,$f(t,n))}function th(e,t){return typeof e=="function"?e(t):e}function zf(e){return e.split("-")[0]}function Z1(e){return e.split("-")[1]}function hM(e){return e==="x"?"y":"x"}function fM(e){return e==="y"?"height":"width"}function Eu(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function mM(e){return hM(Eu(e))}function WTe(e,t,n){n===void 0&&(n=!1);const s=Z1(e),r=mM(e),i=fM(r);let o=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=ES(o)),[o,ES(o)]}function GTe(e){const t=ES(e);return[UE(e),t,UE(t)]}function UE(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const w$=["left","right"],k$=["right","left"],KTe=["top","bottom"],YTe=["bottom","top"];function XTe(e,t,n){switch(e){case"top":case"bottom":return n?t?k$:w$:t?w$:k$;case"left":case"right":return t?KTe:YTe;default:return[]}}function QTe(e,t,n,s){const r=Z1(e);let i=XTe(zf(e),n==="start",s);return r&&(i=i.map(o=>o+"-"+r),t&&(i=i.concat(i.map(UE)))),i}function ES(e){const t=zf(e);return VTe[t]+e.slice(t.length)}function JTe(e){var t,n,s,r;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(s=e.bottom)!=null?s:0,left:(r=e.left)!=null?r:0}}function uJ(e){return typeof e!="number"?JTe(e):{top:e,right:e,bottom:e,left:e}}function AS(e){const{x:t,y:n,width:s,height:r}=e;return{width:s,height:r,top:n,left:t,right:t+s,bottom:n+r,x:t,y:n}}function _$(e,t,n){let{reference:s,floating:r}=e;const i=Eu(t),o=mM(t),a=fM(o),c=zf(t),u=i==="y",d=s.x+s.width/2-r.width/2,h=s.y+s.height/2-r.height/2,m=s[a]/2-r[a]/2;let p;switch(c){case"top":p={x:d,y:s.y-r.height};break;case"bottom":p={x:d,y:s.y+s.height};break;case"right":p={x:s.x+s.width,y:h};break;case"left":p={x:s.x-r.width,y:h};break;default:p={x:s.x,y:s.y}}const g=Z1(t);return g&&(p[o]+=m*(g==="end"?1:-1)*(n&&u?-1:1)),p}async function ZTe(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:i,rects:o,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:m=!1,padding:p=0}=th(t,e),g=uJ(p),v=a[m?h==="floating"?"reference":"floating":h],x=AS(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),y=h==="floating"?{x:s,y:r,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=AS(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:w,strategy:c}):y);return{top:(x.top-T.top+g.top)/k.y,bottom:(T.bottom-x.bottom+g.bottom)/k.y,left:(x.left-T.left+g.left)/k.x,right:(T.right-x.right+g.right)/k.x}}const e5e=50,t5e=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:ZTe},c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:h}=_$(u,s,c),m=s,p=0;const g={};for(let b=0;b<i.length;b++){const v=i[b];if(!v)continue;const{name:x,fn:y}=v,{x:w,y:k,data:T,reset:_}=await y({x:d,y:h,initialPlacement:s,placement:m,strategy:r,middlewareData:g,rects:u,platform:a,elements:{reference:e,floating:t}});d=w??d,h=k??h,g[x]={...g[x],...T},_&&p<e5e&&(p++,typeof _=="object"&&(_.placement&&(m=_.placement),_.rects&&(u=_.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:r}):_.rects),{x:d,y:h}=_$(u,m,c)),b=-1)}return{x:d,y:h,placement:m,strategy:r,middlewareData:g}},n5e=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:i,platform:o,elements:a,middlewareData:c}=t,{element:u,padding:d=0}=th(e,t)||{};if(u==null)return{};const h=uJ(d),m={x:n,y:s},p=mM(r),g=fM(p),b=await o.getDimensions(u),v=p==="y",x=v?"top":"left",y=v?"bottom":"right",w=v?"clientHeight":"clientWidth",k=i.reference[g]+i.reference[p]-m[p]-i.floating[g],T=m[p]-i.reference[p],_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let C=_?_[w]:0;(!C||!await(o.isElement==null?void 0:o.isElement(_)))&&(C=a.floating[w]||i.floating[g]);const S=k/2-T/2,L=C/2-b[g]/2-1,N=$f(h[x],L),$=$f(h[y],L),M=C-b[g]-$,P=C/2-b[g]/2+S,E=cJ(N,P,M),O=!c.arrow&&Z1(r)!=null&&P!==E&&i.reference[g]/2-(P<N?N:$)-b[g]/2<0,z=O?P<N?P-N:P-M:0;return{[p]:m[p]+z,data:{[p]:E,centerOffset:P-E-z,...O&&{alignmentOffset:z}},reset:O}}}),s5e=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:r,middlewareData:i,rects:o,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...v}=th(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=zf(r),y=Eu(a),w=zf(a)===a,k=await(c.isRTL==null?void 0:c.isRTL(u.floating)),T=m||(w||!b?[ES(a)]:GTe(a)),_=g!=="none";!m&&_&&T.push(...QTe(a,b,g,k));const C=[a,...T],S=await c.detectOverflow(t,v),L=[];let N=((s=i.flip)==null?void 0:s.overflows)||[];if(d&&L.push(S[x]),h){const E=WTe(r,o,k);L.push(S[E[0]],S[E[1]])}if(N=[...N,{placement:r,overflows:L}],!L.every(E=>E<=0)){var $,M;const E=((($=i.flip)==null?void 0:$.index)||0)+1,O=C[E];if(O&&(!(h==="alignment"?y!==Eu(O):!1)||N.every(B=>Eu(B.placement)===y?B.overflows[0]>0:!0)))return{data:{index:E,overflows:N},reset:{placement:O}};let z=(M=N.filter(F=>F.overflows[0]<=0).sort((F,B)=>F.overflows[1]-B.overflows[1])[0])==null?void 0:M.placement;if(!z)switch(p){case"bestFit":{var P;const F=(P=N.filter(B=>{if(_){const W=Eu(B.placement);return W===y||W==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(W=>W>0).reduce((W,I)=>W+I,0)]).sort((B,W)=>B[1]-W[1])[0])==null?void 0:P[0];F&&(z=F);break}case"initialPlacement":z=a;break}if(r!==z)return{reset:{placement:z}}}return{}}}};function S$(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function C$(e){return UTe.some(t=>e[t]>=0)}const r5e=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:r="referenceHidden",...i}=th(e,t);switch(r){case"referenceHidden":{const o=await s.detectOverflow(t,{...i,elementContext:"reference"}),a=S$(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:C$(a)}}}case"escaped":{const o=await s.detectOverflow(t,{...i,altBoundary:!0}),a=S$(o,n.floating);return{data:{escapedOffsets:a,escaped:C$(a)}}}default:return{}}}}},dJ=new Set(["left","top"]);async function i5e(e,t){const{placement:n,platform:s,elements:r}=e,i=await(s.isRTL==null?void 0:s.isRTL(r.floating)),o=zf(n),a=Z1(n),c=Eu(n)==="y",u=dJ.has(o)?-1:1,d=i&&c?-1:1,h=th(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),c?{x:p*d,y:m*u}:{x:m*u,y:p*d}}const o5e=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:r,y:i,placement:o,middlewareData:a}=t,c=await i5e(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:r+c.x,y:i+c.y,data:{...c,placement:o}}}}},a5e=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r,platform:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:c={fn:y=>{let{x:w,y:k}=y;return{x:w,y:k}}},...u}=th(e,t),d={x:n,y:s},h=await i.detectOverflow(t,u),m=Eu(r),p=hM(m);let g=d[p],b=d[m];const v=(y,w)=>cJ(w+h[y==="y"?"top":"left"],w,w-h[y==="y"?"bottom":"right"]);o&&(g=v(p,g)),a&&(b=v(m,b));const x=c.fn({...t,[p]:g,[m]:b});return{...x,data:{x:x.x-n,y:x.y-s,enabled:{[p]:o,[m]:a}}}}}},l5e=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,s;const{x:r,y:i,placement:o,rects:a,middlewareData:c}=t,{offset:u=0,mainAxis:d=!0,crossAxis:h=!0}=th(e,t),m={x:r,y:i},p=Eu(o),g=hM(p);let b=m[g],v=m[p];const x=th(u,t),y=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:(n=x.mainAxis)!=null?n:0,crossAxis:(s=x.crossAxis)!=null?s:0};if(d){const T=g==="y"?"height":"width",_=a.reference[g]-a.floating[T]+y.mainAxis,C=a.reference[g]+a.reference[T]-y.mainAxis;b<_?b=_:b>C&&(b=C)}if(h){var w,k;const T=g==="y"?"width":"height",_=dJ.has(zf(o)),C=a.reference[p]-a.floating[T]+(_&&((w=c.offset)==null?void 0:w[p])||0)+(_?0:y.crossAxis),S=a.reference[p]+a.reference[T]+(_?0:((k=c.offset)==null?void 0:k[p])||0)-(_?y.crossAxis:0);v<C?v=C:v>S&&(v=S)}return{[g]:b,[p]:v}}}},c5e=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:s,platform:r,elements:i}=t,{apply:o=()=>{},...a}=th(e,t),c=await r.detectOverflow(t,a),u=zf(n),d=Z1(n),h=Eu(n)==="y",{width:m,height:p}=s.floating;let g,b;u==="top"||u==="bottom"?(g=u,b=d===(await(r.isRTL==null?void 0:r.isRTL(i.floating))?"start":"end")?"left":"right"):(b=u,g=d==="end"?"top":"bottom");const v=p-c.top-c.bottom,x=m-c.left-c.right,y=$f(p-c[g],v),w=$f(m-c[b],x),k=t.middlewareData.shift,T=!k;let _=y,C=w;k!=null&&k.enabled.x&&(C=x),k!=null&&k.enabled.y&&(_=v),T&&!d&&(h?C=m-2*Od(c.left,c.right):_=p-2*Od(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:_});const S=await r.getDimensions(i.floating);return m!==S.width||p!==S.height?{reset:{rects:!0}}:{}}}};function j3(){return typeof window<"u"}function eb(e){return hJ(e)?(e.nodeName||"").toLowerCase():"#document"}function nl(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function hh(e){var t;return(t=(hJ(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function hJ(e){return j3()?e instanceof Node||e instanceof nl(e).Node:!1}function Lu(e){return j3()?e instanceof Element||e instanceof nl(e).Element:!1}function am(e){return j3()?e instanceof HTMLElement||e instanceof nl(e).HTMLElement:!1}function T$(e){return!j3()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof nl(e).ShadowRoot}function M3(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=Pu(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&r!=="inline"&&r!=="contents"}function u5e(e){return/^(table|td|th)$/.test(eb(e))}function I3(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const d5e=/transform|translate|scale|rotate|perspective|filter/,h5e=/paint|layout|strict|content/,Bm=e=>!!e&&e!=="none";let l6;function pM(e){const t=Lu(e)?Pu(e):e;return Bm(t.transform)||Bm(t.translate)||Bm(t.scale)||Bm(t.rotate)||Bm(t.perspective)||!gM()&&(Bm(t.backdropFilter)||Bm(t.filter))||d5e.test(t.willChange||"")||h5e.test(t.contain||"")}function f5e(e){let t=Dp(e);for(;am(t)&&!Bx(t);){if(pM(t))return t;if(I3(t))return null;t=Dp(t)}return null}function gM(){return l6==null&&(l6=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),l6}function Bx(e){return/^(html|body|#document)$/.test(eb(e))}function Pu(e){return nl(e).getComputedStyle(e)}function R3(e){return Lu(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Dp(e){if(eb(e)==="html")return e;const t=e.assignedSlot||e.parentNode||T$(e)&&e.host||hh(e);return T$(t)?t.host:t}function fJ(e){const t=Dp(e);return Bx(t)?(e.ownerDocument||e).body:am(t)&&M3(t)?t:fJ(t)}function $x(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=fJ(e),i=r===((s=e.ownerDocument)==null?void 0:s.body),o=nl(r);if(i){const a=VE(o);return t.concat(o,o.visualViewport||[],M3(r)?r:[],a&&n?$x(a):[])}else return t.concat(r,$x(r,[],n))}function VE(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function mJ(e){const t=Pu(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=am(e),i=r?e.offsetWidth:n,o=r?e.offsetHeight:s,a=TS(n)!==i||TS(s)!==o;return a&&(n=i,s=o),{width:n,height:s,$:a}}function bM(e){return Lu(e)?e:e.contextElement}function Dg(e){const t=bM(e);if(!am(t))return Bd(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:i}=mJ(t);let o=(i?TS(n.width):n.width)/s,a=(i?TS(n.height):n.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const m5e=Bd(0);function pJ(e){const t=nl(e);return!gM()||!t.visualViewport?m5e:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function p5e(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===nl(e)}function Lp(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=bM(e);let o=Bd(1);t&&(s?Lu(s)&&(o=Dg(s)):o=Dg(e));const a=p5e(i,n,s)?pJ(i):Bd(0);let c=(r.left+a.x)/o.x,u=(r.top+a.y)/o.y,d=r.width/o.x,h=r.height/o.y;if(i&&s){const m=nl(i),p=Lu(s)?nl(s):s;let g=m,b=VE(g);for(;b&&p!==g;){const v=Dg(b),x=b.getBoundingClientRect(),y=Pu(b),w=x.left+(b.clientLeft+parseFloat(y.paddingLeft))*v.x,k=x.top+(b.clientTop+parseFloat(y.paddingTop))*v.y;c*=v.x,u*=v.y,d*=v.x,h*=v.y,c+=w,u+=k,g=nl(b),b=VE(g)}}return AS({width:d,height:h,x:c,y:u})}function D3(e,t){const n=R3(e).scrollLeft;return t?t.left+n:Lp(hh(e)).left+n}function gJ(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-D3(e,n),r=n.top+t.scrollTop;return{x:s,y:r}}function g5e(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const i=r==="fixed",o=hh(s),a=t?I3(t.floating):!1;if(s===o||a&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Bd(1);const d=Bd(0),h=am(s);if((h||!i)&&((eb(s)!=="body"||M3(o))&&(c=R3(s)),h)){const p=Lp(s);u=Dg(s),d.x=p.x+s.clientLeft,d.y=p.y+s.clientTop}const m=o&&!h&&!i?gJ(o,c):Bd(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+m.x,y:n.y*u.y-c.scrollTop*u.y+d.y+m.y}}function b5e(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function y5e(e){const t=R3(e),n=e.ownerDocument.body,s=Od(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=Od(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+D3(e);const o=-t.scrollTop;return Pu(n).direction==="rtl"&&(i+=Od(e.clientWidth,n.clientWidth)-s),{width:s,height:r,x:i,y:o}}const x5e=25;function v5e(e,t,n){n===void 0&&(n="viewport");const s=n==="layoutViewport",r=nl(e),i=hh(e),o=r.visualViewport;let a=i.clientWidth,c=i.clientHeight,u=0,d=0;if(o){const m=!gM()||t==="fixed";s?m||(u=-o.offsetLeft,d=-o.offsetTop):(a=o.width,c=o.height,m&&(u=o.offsetLeft,d=o.offsetTop))}if(D3(i)<=0){const m=i.ownerDocument,p=m.body,g=getComputedStyle(p),b=m.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(i.clientWidth-p.clientWidth-b),x=getComputedStyle(i).scrollbarGutter==="stable both-edges"?v/2:v;x<=x5e&&(a-=x)}return{width:a,height:c,x:u,y:d}}function w5e(e,t){const n=Lp(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,i=Dg(e),o=e.clientWidth*i.x,a=e.clientHeight*i.y,c=r*i.x,u=s*i.y;return{width:o,height:a,x:c,y:u}}function E$(e,t,n){let s;if(t==="viewport"||t==="layoutViewport")s=v5e(e,n,t);else if(t==="document")s=y5e(hh(e));else if(Lu(t))s=w5e(t,n);else{const r=pJ(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return AS(s)}function k5e(e,t){const n=t.get(e);if(n)return n;let s=$x(e,[],!1).filter(a=>Lu(a)&&eb(a)!=="body"),r=null;const i=Pu(e).position==="fixed";let o=i?Dp(e):e;for(;Lu(o)&&!Bx(o);){const a=Pu(o),c=pM(o),u=r?r.position:i?"fixed":"";!c&&(u==="fixed"||u==="absolute"&&a.position==="static")?s=s.filter(h=>h!==o):r=a,o=Dp(o)}return t.set(e,s),s}function _5e(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const o=[...n==="clippingAncestors"?I3(t)?[]:k5e(t,this._c):[].concat(n),s],a=E$(t,o[0],r);let c=a.top,u=a.right,d=a.bottom,h=a.left;for(let m=1;m<o.length;m++){const p=E$(t,o[m],r);c=Od(p.top,c),u=$f(p.right,u),d=$f(p.bottom,d),h=Od(p.left,h)}return{width:u-h,height:d-c,x:h,y:c}}function S5e(e){const{width:t,height:n}=mJ(e);return{width:t,height:n}}function C5e(e,t,n){const s=am(t),r=hh(t),i=n==="fixed",o=Lp(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Bd(0);if((s||!i)&&((eb(t)!=="body"||M3(r))&&(a=R3(t)),s)){const m=Lp(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}!s&&r&&(c.x=D3(r));const u=r&&!s&&!i?gJ(r,a):Bd(0),d=o.left+a.scrollLeft-c.x-u.x,h=o.top+a.scrollTop-c.y-u.y;return{x:d,y:h,width:o.width,height:o.height}}function c6(e){return Pu(e).position==="static"}function A$(e,t){if(!am(e)||Pu(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return hh(e)===n&&(n=n.ownerDocument.body),n}function bJ(e,t){const n=nl(e);if(I3(e))return n;if(!am(e)){let r=Dp(e);for(;r&&!Bx(r);){if(Lu(r)&&!c6(r))return r;r=Dp(r)}return n}let s=A$(e,t);for(;s&&u5e(s)&&c6(s);)s=A$(s,t);return s&&Bx(s)&&c6(s)&&!pM(s)?n:s||f5e(e)||n}const T5e=async function(e){const t=this.getOffsetParent||bJ,n=this.getDimensions,s=await n(e.floating);return{reference:C5e(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function E5e(e){return Pu(e).direction==="rtl"}const A5e={convertOffsetParentRelativeRectToViewportRelativeRect:g5e,getDocumentElement:hh,getClippingRect:_5e,getOffsetParent:bJ,getElementRects:T5e,getClientRects:b5e,getDimensions:S5e,getScale:Dg,isElement:Lu,isRTL:E5e};function yJ(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function N5e(e,t,n){let s=null,r;const i=hh(e);function o(){var d;clearTimeout(r),(d=s)==null||d.disconnect(),s=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:v}=m;if(d||t(),!b||!v)return;const x=Nk(g),y=Nk(i.clientWidth-(p+b)),w=Nk(i.clientHeight-(g+v)),k=Nk(p),_={rootMargin:-x+"px "+-y+"px "+-w+"px "+-k+"px",threshold:Od(0,$f(1,h))||1};let C=!0;function S(L){const N=L[0].intersectionRatio;if(!yJ(m,e.getBoundingClientRect()))return a();if(N!==h){if(!C)return a();N?a(!1,N):r=setTimeout(()=>{a(!1,1e-7)},1e3)}C=!1}try{s=new IntersectionObserver(S,{..._,root:i.ownerDocument})}catch{s=new IntersectionObserver(S,_)}s.observe(e)}const c=nl(e),u=()=>a(n);return c.addEventListener("resize",u),a(!0),()=>{c.removeEventListener("resize",u),o()}}function j5e(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,u=bM(e),d=r||i?[...u?$x(u):[],...t?$x(t):[]]:[];d.forEach(x=>{r&&x.addEventListener("scroll",n),i&&x.addEventListener("resize",n)});const h=u&&a?N5e(u,n,i):null;let m=-1,p=null;o&&(p=new ResizeObserver(x=>{let[y]=x;y&&y.target===u&&p&&t&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),u&&!c&&p.observe(u),t&&p.observe(t));let g,b=c?Lp(e):null;c&&v();function v(){const x=Lp(e);b&&!yJ(b,x)&&n(),b=x,g=requestAnimationFrame(v)}return n(),()=>{var x;d.forEach(y=>{r&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n)}),h==null||h(),(x=p)==null||x.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const M5e=o5e,I5e=a5e,R5e=s5e,D5e=c5e,L5e=r5e,N$=n5e,P5e=l5e,O5e=(e,t,n)=>{const s=new Map,r=n??{},i={...A5e,...r.platform,_c:s};return t5e(e,t,{...r,platform:i})};var B5e=typeof document<"u",$5e=function(){},X_=B5e?f.useLayoutEffect:$5e;function NS(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,s,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!NS(e[s],t[s]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,r[s]))return!1;for(s=n;s--!==0;){const i=r[s];if(!(i==="_owner"&&e.$$typeof)&&!NS(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function xJ(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function j$(e,t){const n=xJ(e);return Math.round(t*n)/n}function u6(e){const t=f.useRef(e);return X_(()=>{t.current=e}),t}function z5e(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:r,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[d,h]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=f.useState(s);NS(m,s)||p(s);const[g,b]=f.useState(null),[v,x]=f.useState(null),y=f.useCallback(B=>{B!==_.current&&(_.current=B,b(B))},[]),w=f.useCallback(B=>{B!==C.current&&(C.current=B,x(B))},[]),k=i||g,T=o||v,_=f.useRef(null),C=f.useRef(null),S=f.useRef(d),L=c!=null,N=u6(c),$=u6(r),M=u6(u),P=f.useCallback(()=>{if(!_.current||!C.current)return;const B={placement:t,strategy:n,middleware:m};$.current&&(B.platform=$.current),O5e(_.current,C.current,B).then(W=>{const I={...W,isPositioned:M.current!==!1};E.current&&!NS(S.current,I)&&(S.current=I,$u.flushSync(()=>{h(I)}))})},[m,t,n,$,M]);X_(()=>{u===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,h(B=>({...B,isPositioned:!1})))},[u]);const E=f.useRef(!1);X_(()=>(E.current=!0,()=>{E.current=!1}),[]),X_(()=>{if(k&&(_.current=k),T&&(C.current=T),k&&T){if(N.current)return N.current(k,T,P);P()}},[k,T,P,N,L]);const O=f.useMemo(()=>({reference:_,floating:C,setReference:y,setFloating:w}),[y,w]),z=f.useMemo(()=>({reference:k,floating:T}),[k,T]),F=f.useMemo(()=>{const B={position:n,left:0,top:0};if(!z.floating)return B;const W=j$(z.floating,d.x),I=j$(z.floating,d.y);return a?{...B,transform:"translate("+W+"px, "+I+"px)",...xJ(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:I}},[n,a,z.floating,d.x,d.y]);return f.useMemo(()=>({...d,update:P,refs:O,elements:z,floatingStyles:F}),[d,P,O,z,F])}const F5e=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:r}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?N$({element:s.current,padding:r}).fn(n):{}:s?N$({element:s,padding:r}).fn(n):{}}}},H5e=(e,t)=>{const n=M5e(e);return{name:n.name,fn:n.fn,options:[e,t]}},q5e=(e,t)=>{const n=I5e(e);return{name:n.name,fn:n.fn,options:[e,t]}},U5e=(e,t)=>({fn:P5e(e).fn,options:[e,t]}),V5e=(e,t)=>{const n=R5e(e);return{name:n.name,fn:n.fn,options:[e,t]}},W5e=(e,t)=>{const n=D5e(e);return{name:n.name,fn:n.fn,options:[e,t]}},G5e=(e,t)=>{const n=L5e(e);return{name:n.name,fn:n.fn,options:[e,t]}},K5e=(e,t)=>{const n=F5e(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Y5e="Arrow",vJ=f.forwardRef((e,t)=>{const{children:n,width:s=10,height:r=5,...i}=e;return l.jsx(Mn.svg,{...i,ref:t,width:s,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});vJ.displayName=Y5e;var X5e=vJ,yM="Popper",[wJ,lm]=oa(yM),[Q5e,kJ]=wJ(yM),_J=e=>{const{__scopePopper:t,children:n}=e,[s,r]=f.useState(null),[i,o]=f.useState(void 0);return l.jsx(Q5e,{scope:t,anchor:s,onAnchorChange:r,placementState:i,setPlacementState:o,children:n})};_J.displayName=yM;var SJ="PopperAnchor",CJ=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...r}=e,i=kJ(SJ,n),o=f.useRef(null),a=i.onAnchorChange,c=f.useCallback(g=>{o.current=g,g&&a(g)},[a]),u=os(t,c),d=f.useRef(null);f.useEffect(()=>{if(!s)return;const g=d.current;d.current=s.current,g!==d.current&&a(d.current)});const h=i.placementState&&vM(i.placementState),m=h==null?void 0:h[0],p=h==null?void 0:h[1];return s?null:l.jsx(Mn.div,{"data-radix-popper-side":m,"data-radix-popper-align":p,...r,ref:u})});CJ.displayName=SJ;var xM="PopperContent",[J5e,Z5e]=wJ(xM),TJ=f.forwardRef((e,t)=>{var ue,re,J,q,Z,he;const{__scopePopper:n,side:s="bottom",sideOffset:r=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:g,...b}=e,v=kJ(xM,n),[x,y]=f.useState(null),w=os(t,y),[k,T]=f.useState(null),_=A3(k),C=(_==null?void 0:_.width)??0,S=(_==null?void 0:_.height)??0,L=s+(i!=="center"?"-"+i:""),N=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},$=Array.isArray(u)?u:[u],M=$.length>0,P={padding:N,boundary:$.filter(t6e),altBoundary:M},{refs:E,floatingStyles:O,placement:z,isPositioned:F,middlewareData:B}=z5e({strategy:"fixed",placement:L,whileElementsMounted:(...ye)=>j5e(...ye,{animationFrame:p==="always"}),elements:{reference:v.anchor},middleware:[H5e({mainAxis:r+S,alignmentAxis:o}),c&&q5e({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?U5e():void 0,...P}),c&&V5e({...P}),W5e({...P,apply:({elements:ye,rects:oe,availableWidth:we,availableHeight:Ve})=>{const{width:lt,height:Et}=oe.reference,pt=ye.floating.style;pt.setProperty("--radix-popper-available-width",`${we}px`),pt.setProperty("--radix-popper-available-height",`${Ve}px`),pt.setProperty("--radix-popper-anchor-width",`${lt}px`),pt.setProperty("--radix-popper-anchor-height",`${Et}px`)}}),k&&K5e({element:k,padding:a}),n6e({arrowWidth:C,arrowHeight:S}),m&&G5e({strategy:"referenceHidden",...P,boundary:M?P.boundary:void 0})]}),W=v.setPlacementState;Co(()=>(W(z),()=>{W(void 0)}),[z,W]);const[I,Y]=vM(z),V=Rl(g);Co(()=>{F&&(V==null||V())},[F,V]);const j=(ue=B.arrow)==null?void 0:ue.x,ee=(re=B.arrow)==null?void 0:re.y,se=((J=B.arrow)==null?void 0:J.centerOffset)!==0,[X,Q]=f.useState();return Co(()=>{x&&Q(window.getComputedStyle(x).zIndex)},[x]),l.jsx("div",{ref:E.setFloating,"data-radix-popper-content-wrapper":"",style:{...O,transform:F?O.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:X,"--radix-popper-transform-origin":[(q=B.transformOrigin)==null?void 0:q.x,(Z=B.transformOrigin)==null?void 0:Z.y].join(" "),...((he=B.hide)==null?void 0:he.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(J5e,{scope:n,placedSide:I,placedAlign:Y,onArrowChange:T,arrowX:j,arrowY:ee,shouldHideArrow:se,children:l.jsx(Mn.div,{"data-side":I,"data-align":Y,...b,ref:w,style:{...b.style,animation:F?void 0:"none"}})})})});TJ.displayName=xM;var EJ="PopperArrow",e6e={top:"bottom",right:"left",bottom:"top",left:"right"},AJ=f.forwardRef(function(t,n){const{__scopePopper:s,...r}=t,i=Z5e(EJ,s),o=e6e[i.placedSide];return l.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:l.jsx(X5e,{...r,ref:n,style:{...r.style,display:"block"}})})});AJ.displayName=EJ;function t6e(e){return e!==null}var n6e=e=>({name:"transformOrigin",options:e,fn(t){var v,x,y;const{placement:n,rects:s,middlewareData:r}=t,o=((v=r.arrow)==null?void 0:v.centerOffset)!==0,a=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,d]=vM(n),h={start:"0%",center:"50%",end:"100%"}[d],m=(((x=r.arrow)==null?void 0:x.x)??0)+a/2,p=(((y=r.arrow)==null?void 0:y.y)??0)+c/2;let g="",b="";return u==="bottom"?(g=o?h:`${m}px`,b=`${-c}px`):u==="top"?(g=o?h:`${m}px`,b=`${s.floating.height+c}px`):u==="right"?(g=`${-c}px`,b=o?h:`${p}px`):u==="left"&&(g=`${s.floating.width+c}px`,b=o?h:`${p}px`),{data:{x:g,y:b}}}});function vM(e){const[t,n="center"]=e.split("-");return[t,n]}var Fv=_J,Hv=CJ,L3=TJ,P3=AJ,d6=!1;function s6e(){const[e,t]=f.useState(d6);return f.useEffect(()=>{d6||(d6=!0,t(!0))},[]),e}var NJ=E4[" useSyncExternalStore ".trim().toString()];function r6e(){return()=>{}}function i6e(){return NJ(r6e,()=>!0,()=>!1)}var o6e=typeof NJ=="function"?i6e:s6e,h6="rovingFocusGroup.onEntryFocus",a6e={bubbles:!1,cancelable:!0},qv="RovingFocusGroup",[WE,jJ,l6e]=tM(qv),[c6e,cm]=oa(qv,[l6e]),[u6e,d6e]=c6e(qv),MJ=f.forwardRef((e,t)=>l.jsx(WE.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(WE.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(h6e,{...e,ref:t})})}));MJ.displayName=qv;var h6e=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:r=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=e,m=f.useRef(null),p=os(t,m),g=Y1(i),[b,v]=ja({prop:o,defaultProp:a??null,onChange:c,caller:qv}),[x,y]=f.useState(!1),w=Rl(u),k=jJ(n),T=f.useRef(!1),[_,C]=f.useState(0);return f.useEffect(()=>{const S=m.current;if(S)return S.addEventListener(h6,w),()=>S.removeEventListener(h6,w)},[w]),l.jsx(u6e,{scope:n,orientation:s,dir:g,loop:r,currentTabStopId:b,onItemFocus:f.useCallback(S=>v(S),[v]),onItemShiftTab:f.useCallback(()=>y(!0),[]),onFocusableItemAdd:f.useCallback(()=>C(S=>S+1),[]),onFocusableItemRemove:f.useCallback(()=>C(S=>S-1),[]),children:l.jsx(Mn.div,{tabIndex:x||_===0?-1:0,"data-orientation":s,...h,ref:p,style:{outline:"none",...e.style},onMouseDown:$t(e.onMouseDown,()=>{T.current=!0}),onFocus:$t(e.onFocus,S=>{const L=!T.current;if(S.target===S.currentTarget&&L&&!x){const N=new CustomEvent(h6,a6e);if(S.currentTarget.dispatchEvent(N),!N.defaultPrevented){const $=k().filter(z=>z.focusable),M=$.find(z=>z.active),P=$.find(z=>z.id===b),O=[M,P,...$].filter(Boolean).map(z=>z.ref.current);DJ(O,d)}}T.current=!1}),onBlur:$t(e.onBlur,()=>y(!1))})})}),IJ="RovingFocusGroupItem",RJ=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:r=!1,tabStopId:i,children:o,...a}=e,c=tl(),u=i||c,d=d6e(IJ,n),h=d.currentTabStopId===u,m=jJ(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:b}=d,v=o6e();return Co(()=>{if(!(!v||!s))return p(),()=>g()},[v,s,p,g]),f.useEffect(()=>{if(!(v||!s))return p(),()=>g()},[v,s,p,g]),l.jsx(WE.ItemSlot,{scope:n,id:u,focusable:s,active:r,children:l.jsx(Mn.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:$t(e.onMouseDown,x=>{s?d.onItemFocus(u):x.preventDefault()}),onFocus:$t(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:$t(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){d.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const y=p6e(x,d.orientation,d.dir);if(y!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.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(x.currentTarget);k=d.loop?g6e(k,T+1):k.slice(T+1)}setTimeout(()=>DJ(k))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:b!=null}):o})})});RJ.displayName=IJ;var f6e={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function m6e(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function p6e(e,t,n){const s=m6e(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return f6e[s]}function DJ(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function g6e(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var O3=MJ,B3=RJ,GE=["Enter"," "],b6e=["ArrowDown","PageUp","Home"],LJ=["ArrowUp","PageDown","End"],y6e=[...b6e,...LJ],x6e={ltr:[...GE,"ArrowRight"],rtl:[...GE,"ArrowLeft"]},v6e={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Uv="Menu",[zx,w6e,k6e]=tM(Uv),[o0,PJ]=oa(Uv,[k6e,lm,cm]),Vv=lm(),OJ=cm(),[BJ,um]=o0(Uv),[_6e,Wv]=o0(Uv),$J=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:r,onOpenChange:i,modal:o=!0}=e,a=Vv(t),[c,u]=f.useState(null),d=f.useRef(!1),h=Rl(i),m=Y1(r);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]),l.jsx(Fv,{...a,children:l.jsx(BJ,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:u,children:l.jsx(_6e,{scope:t,onClose:f.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:d,dir:m,modal:o,children:s})})})};$J.displayName=Uv;var S6e="MenuAnchor",wM=f.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,r=Vv(n);return l.jsx(Hv,{...r,...s,ref:t})});wM.displayName=S6e;var kM="MenuPortal",[C6e,zJ]=o0(kM,{forceMount:void 0}),FJ=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:r}=e,i=um(kM,t);return l.jsx(C6e,{scope:t,forceMount:n,children:l.jsx(aa,{present:n||i.open,children:l.jsx(Q1,{asChild:!0,container:r,children:s})})})};FJ.displayName=kM;var gc="MenuContent",[T6e,_M]=o0(gc),HJ=f.forwardRef((e,t)=>{const n=zJ(gc,e.__scopeMenu),{forceMount:s=n.forceMount,...r}=e,i=um(gc,e.__scopeMenu),o=Wv(gc,e.__scopeMenu);return l.jsx(zx.Provider,{scope:e.__scopeMenu,children:l.jsx(aa,{present:s||i.open,children:l.jsx(zx.Slot,{scope:e.__scopeMenu,children:o.modal?l.jsx(E6e,{...r,ref:t}):l.jsx(A6e,{...r,ref:t})})})})}),E6e=f.forwardRef((e,t)=>{const n=um(gc,e.__scopeMenu),s=f.useRef(null),r=os(t,s);return f.useEffect(()=>{const i=s.current;if(i)return C3(i)},[]),l.jsx(SM,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:$t(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),A6e=f.forwardRef((e,t)=>{const n=um(gc,e.__scopeMenu);return l.jsx(SM,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),N6e=Bf("MenuContent.ScrollLock"),SM=f.forwardRef((e,t)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,onDismiss:p,disableOutsideScroll:g,...b}=e,v=um(gc,n),x=Wv(gc,n),y=Vv(n),w=OJ(n),k=w6e(n),[T,_]=f.useState(null),C=f.useRef(null),S=os(t,C,v.onContentChange),L=f.useRef(0),N=f.useRef(""),$=f.useRef(0),M=f.useRef(null),P=f.useRef("right"),E=f.useRef(0),O=g?zv:f.Fragment,z=g?{as:N6e,allowPinchZoom:!0}:void 0,F=W=>{var Q,ue;const I=N.current+W,Y=k().filter(re=>!re.disabled),V=document.activeElement,j=(Q=Y.find(re=>re.ref.current===V))==null?void 0:Q.textValue,ee=Y.map(re=>re.textValue),se=F6e(ee,I,j),X=(ue=Y.find(re=>re.textValue===se))==null?void 0:ue.ref.current;(function re(J){N.current=J,window.clearTimeout(L.current),J!==""&&(L.current=window.setTimeout(()=>re(""),1e3))})(I),X&&setTimeout(()=>X.focus())};f.useEffect(()=>()=>window.clearTimeout(L.current),[]),_3();const B=f.useCallback(W=>{var Y,V;return P.current===((Y=M.current)==null?void 0:Y.side)&&q6e(W,(V=M.current)==null?void 0:V.area)},[]);return l.jsx(T6e,{scope:n,searchRef:N,onItemEnter:f.useCallback(W=>{B(W)&&W.preventDefault()},[B]),onItemLeave:f.useCallback(W=>{var I;B(W)||((I=C.current)==null||I.focus(),_(null))},[B]),onTriggerLeave:f.useCallback(W=>{B(W)&&W.preventDefault()},[B]),pointerGraceTimerRef:$,onPointerGraceIntentChange:f.useCallback(W=>{M.current=W},[]),children:l.jsx(O,{...z,children:l.jsx($v,{asChild:!0,trapped:r,onMountAutoFocus:$t(i,W=>{var I;W.preventDefault(),(I=C.current)==null||I.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:l.jsx(X1,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,onDismiss:p,children:l.jsx(O3,{asChild:!0,...w,dir:x.dir,orientation:"vertical",loop:s,currentTabStopId:T,onCurrentTabStopIdChange:_,onEntryFocus:$t(c,W=>{x.isUsingKeyboardRef.current||W.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(L3,{role:"menu","aria-orientation":"vertical","data-state":iZ(v.open),"data-radix-menu-content":"",dir:x.dir,...y,...b,ref:S,style:{outline:"none",...b.style},onKeyDown:$t(b.onKeyDown,W=>{const Y=W.target.closest("[data-radix-menu-content]")===W.currentTarget,V=W.ctrlKey||W.altKey||W.metaKey,j=W.key.length===1;Y&&(W.key==="Tab"&&W.preventDefault(),!V&&j&&F(W.key));const ee=C.current;if(W.target!==ee||!y6e.includes(W.key))return;W.preventDefault();const X=k().filter(Q=>!Q.disabled).map(Q=>Q.ref.current);LJ.includes(W.key)&&X.reverse(),$6e(X)}),onBlur:$t(e.onBlur,W=>{W.currentTarget.contains(W.target)||(window.clearTimeout(L.current),N.current="")}),onPointerMove:$t(e.onPointerMove,Fx(W=>{const I=W.target,Y=E.current!==W.clientX;if(W.currentTarget.contains(I)&&Y){const V=W.clientX>E.current?"right":"left";P.current=V,E.current=W.clientX}}))})})})})})})});HJ.displayName=gc;var j6e="MenuGroup",CM=f.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return l.jsx(Mn.div,{role:"group",...s,ref:t})});CM.displayName=j6e;var M6e="MenuLabel",qJ=f.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return l.jsx(Mn.div,{...s,ref:t})});qJ.displayName=M6e;var jS="MenuItem",M$="menu.itemSelect",$3=f.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...r}=e,i=f.useRef(null),o=Wv(jS,e.__scopeMenu),a=_M(jS,e.__scopeMenu),c=os(t,i),u=f.useRef(!1),d=()=>{const h=i.current;if(!n&&h){const m=new CustomEvent(M$,{bubbles:!0,cancelable:!0});h.addEventListener(M$,p=>s==null?void 0:s(p),{once:!0}),kQ(h,m),m.defaultPrevented?u.current=!1:o.onClose()}};return l.jsx(UJ,{...r,ref:c,disabled:n,onClick:$t(e.onClick,d),onPointerDown:h=>{var m;(m=e.onPointerDown)==null||m.call(e,h),u.current=!0},onPointerUp:$t(e.onPointerUp,h=>{var m;u.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:$t(e.onKeyDown,h=>{n||h.target!==h.currentTarget||a.searchRef.current!==""&&h.key===" "||GE.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});$3.displayName=jS;var UJ=f.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:r,...i}=e,o=_M(jS,n),a=OJ(n),c=f.useRef(null),u=os(t,c),[d,h]=f.useState(!1),[m,p]=f.useState("");return f.useEffect(()=>{const g=c.current;g&&p((g.textContent??"").trim())},[i.children]),l.jsx(zx.ItemSlot,{scope:n,disabled:s,textValue:r??m,children:l.jsx(B3,{asChild:!0,...a,focusable:!s,children:l.jsx(Mn.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...i,ref:u,onPointerMove:$t(e.onPointerMove,Fx(g=>{s?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:$t(e.onPointerLeave,Fx(g=>o.onItemLeave(g))),onFocus:$t(e.onFocus,()=>h(!0)),onBlur:$t(e.onBlur,()=>h(!1))})})})}),I6e="MenuCheckboxItem",VJ=f.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...r}=e;return l.jsx(XJ,{scope:e.__scopeMenu,checked:n,children:l.jsx($3,{role:"menuitemcheckbox","aria-checked":MS(n)?"mixed":n,...r,ref:t,"data-state":AM(n),onSelect:$t(r.onSelect,()=>s==null?void 0:s(MS(n)?!0:!n),{checkForDefaultPrevented:!1})})})});VJ.displayName=I6e;var WJ="MenuRadioGroup",[R6e,D6e]=o0(WJ,{value:void 0,onValueChange:()=>{}}),GJ=f.forwardRef((e,t)=>{const{value:n,onValueChange:s,...r}=e,i=Rl(s);return l.jsx(R6e,{scope:e.__scopeMenu,value:n,onValueChange:i,children:l.jsx(CM,{...r,ref:t})})});GJ.displayName=WJ;var KJ="MenuRadioItem",YJ=f.forwardRef((e,t)=>{const{value:n,...s}=e,r=D6e(KJ,e.__scopeMenu),i=n===r.value;return l.jsx(XJ,{scope:e.__scopeMenu,checked:i,children:l.jsx($3,{role:"menuitemradio","aria-checked":i,...s,ref:t,"data-state":AM(i),onSelect:$t(s.onSelect,()=>{var o;return(o=r.onValueChange)==null?void 0:o.call(r,n)},{checkForDefaultPrevented:!1})})})});YJ.displayName=KJ;var TM="MenuItemIndicator",[XJ,L6e]=o0(TM,{checked:!1}),QJ=f.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...r}=e,i=L6e(TM,n);return l.jsx(aa,{present:s||MS(i.checked)||i.checked===!0,children:l.jsx(Mn.span,{...r,ref:t,"data-state":AM(i.checked)})})});QJ.displayName=TM;var P6e="MenuSeparator",JJ=f.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return l.jsx(Mn.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});JJ.displayName=P6e;var O6e="MenuArrow",ZJ=f.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,r=Vv(n);return l.jsx(P3,{...r,...s,ref:t})});ZJ.displayName=O6e;var EM="MenuSub",[B6e,eZ]=o0(EM),tZ=e=>{const{__scopeMenu:t,children:n,open:s=!1,onOpenChange:r}=e,i=um(EM,t),o=Vv(t),[a,c]=f.useState(null),[u,d]=f.useState(null),h=Rl(r);return f.useEffect(()=>(i.open===!1&&h(!1),()=>h(!1)),[i.open,h]),l.jsx(Fv,{...o,children:l.jsx(BJ,{scope:t,open:s,onOpenChange:h,content:u,onContentChange:d,children:l.jsx(B6e,{scope:t,contentId:tl(),triggerId:tl(),trigger:a,onTriggerChange:c,children:n})})})};tZ.displayName=EM;var wy="MenuSubTrigger",nZ=f.forwardRef((e,t)=>{const n=um(wy,e.__scopeMenu),s=Wv(wy,e.__scopeMenu),r=eZ(wy,e.__scopeMenu),i=_M(wy,e.__scopeMenu),o=f.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=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),c(null)}},[a,c]);const h=os(t,r.onTriggerChange);return l.jsx(wM,{asChild:!0,...u,children:l.jsx(UJ,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":n.open?r.contentId:void 0,"data-state":iZ(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:$t(e.onPointerMove,Fx(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:$t(e.onPointerLeave,Fx(m=>{var g,b;d();const p=(g=n.content)==null?void 0:g.getBoundingClientRect();if(p){const v=(b=n.content)==null?void 0:b.dataset.side,x=v==="right",y=x?-5:5,w=p[x?"left":"right"],k=p[x?"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:v}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(m),m.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:$t(e.onKeyDown,m=>{var g;e.disabled||m.target!==m.currentTarget||i.searchRef.current!==""&&m.key===" "||x6e[s.dir].includes(m.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),m.preventDefault())})})})});nZ.displayName=wy;var sZ="MenuSubContent",rZ=f.forwardRef((e,t)=>{const n=zJ(gc,e.__scopeMenu),{forceMount:s=n.forceMount,align:r="start",...i}=e,o=um(gc,e.__scopeMenu),a=Wv(gc,e.__scopeMenu),c=eZ(sZ,e.__scopeMenu),u=f.useRef(null),d=os(t,u);return l.jsx(zx.Provider,{scope:e.__scopeMenu,children:l.jsx(aa,{present:s||o.open,children:l.jsx(zx.Slot,{scope:e.__scopeMenu,children:l.jsx(SM,{id:c.contentId,"aria-labelledby":c.triggerId,...i,ref:d,align:r,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:$t(e.onFocusOutside,h=>{h.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:$t(e.onEscapeKeyDown,h=>{a.onClose(),h.preventDefault()}),onKeyDown:$t(e.onKeyDown,h=>{var g;const m=h.currentTarget.contains(h.target),p=v6e[a.dir].includes(h.key);m&&p&&(o.onOpenChange(!1),(g=c.trigger)==null||g.focus(),h.preventDefault())})})})})})});rZ.displayName=sZ;function iZ(e){return e?"open":"closed"}function MS(e){return e==="indeterminate"}function AM(e){return MS(e)?"indeterminate":e?"checked":"unchecked"}function $6e(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function z6e(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function F6e(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=z6e(e,Math.max(i,0));r.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function H6e(e,t){const{x:n,y:s}=e;let r=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const a=t[i],c=t[o],u=a.x,d=a.y,h=c.x,m=c.y;d>s!=m>s&&n<(h-u)*(s-d)/(m-d)+u&&(r=!r)}return r}function q6e(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return H6e(n,t)}function Fx(e){return t=>t.pointerType==="mouse"?e(t):void 0}var U6e=$J,V6e=wM,W6e=FJ,G6e=HJ,K6e=CM,Y6e=qJ,X6e=$3,Q6e=VJ,J6e=GJ,Z6e=YJ,e8e=QJ,t8e=JJ,n8e=ZJ,s8e=tZ,r8e=nZ,i8e=rZ,z3="DropdownMenu",[o8e,v_t]=oa(z3,[PJ]),la=PJ(),[a8e,oZ]=o8e(z3),aZ=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:r,defaultOpen:i,onOpenChange:o,modal:a=!0}=e,c=la(t),u=f.useRef(null),[d,h]=ja({prop:r,defaultProp:i??!1,onChange:o,caller:z3});return l.jsx(a8e,{scope:t,triggerId:tl(),triggerRef:u,contentId:tl(),open:d,onOpenChange:h,onOpenToggle:f.useCallback(()=>h(m=>!m),[h]),modal:a,children:l.jsx(U6e,{...c,open:d,onOpenChange:h,dir:s,modal:a,children:n})})};aZ.displayName=z3;var lZ="DropdownMenuTrigger",cZ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...r}=e,i=oZ(lZ,n),o=la(n),a=os(t,i.triggerRef);return l.jsx(V6e,{asChild:!0,...o,children:l.jsx(Mn.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":s?"":void 0,disabled:s,...r,ref:a,onPointerDown:$t(e.onPointerDown,c=>{!s&&c.button===0&&c.ctrlKey===!1&&(i.onOpenToggle(),i.open||c.preventDefault())}),onKeyDown:$t(e.onKeyDown,c=>{s||(["Enter"," "].includes(c.key)&&i.onOpenToggle(),c.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});cZ.displayName=lZ;var l8e="DropdownMenuPortal",uZ=e=>{const{__scopeDropdownMenu:t,...n}=e,s=la(t);return l.jsx(W6e,{...s,...n})};uZ.displayName=l8e;var dZ="DropdownMenuContent",hZ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=oZ(dZ,n),i=la(n),o=f.useRef(!1);return l.jsx(G6e,{id:r.contentId,"aria-labelledby":r.triggerId,...i,...s,ref:t,onCloseAutoFocus:$t(e.onCloseAutoFocus,a=>{var c;o.current||(c=r.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:$t(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!r.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)"}})});hZ.displayName=dZ;var c8e="DropdownMenuGroup",fZ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=la(n);return l.jsx(K6e,{...r,...s,ref:t})});fZ.displayName=c8e;var u8e="DropdownMenuLabel",d8e=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=la(n);return l.jsx(Y6e,{...r,...s,ref:t})});d8e.displayName=u8e;var h8e="DropdownMenuItem",mZ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=la(n);return l.jsx(X6e,{...r,...s,ref:t})});mZ.displayName=h8e;var f8e="DropdownMenuCheckboxItem",m8e=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=la(n);return l.jsx(Q6e,{...r,...s,ref:t})});m8e.displayName=f8e;var p8e="DropdownMenuRadioGroup",g8e=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=la(n);return l.jsx(J6e,{...r,...s,ref:t})});g8e.displayName=p8e;var b8e="DropdownMenuRadioItem",y8e=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=la(n);return l.jsx(Z6e,{...r,...s,ref:t})});y8e.displayName=b8e;var x8e="DropdownMenuItemIndicator",v8e=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=la(n);return l.jsx(e8e,{...r,...s,ref:t})});v8e.displayName=x8e;var w8e="DropdownMenuSeparator",pZ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=la(n);return l.jsx(t8e,{...r,...s,ref:t})});pZ.displayName=w8e;var k8e="DropdownMenuArrow",_8e=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=la(n);return l.jsx(n8e,{...r,...s,ref:t})});_8e.displayName=k8e;var S8e=e=>{const{__scopeDropdownMenu:t,children:n,open:s,onOpenChange:r,defaultOpen:i}=e,o=la(t),[a,c]=ja({prop:s,defaultProp:i??!1,onChange:r,caller:"DropdownMenuSub"});return l.jsx(s8e,{...o,open:a,onOpenChange:c,children:n})},C8e="DropdownMenuSubTrigger",gZ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=la(n);return l.jsx(r8e,{...r,...s,ref:t})});gZ.displayName=C8e;var T8e="DropdownMenuSubContent",bZ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=la(n);return l.jsx(i8e,{...r,...s,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)"}})});bZ.displayName=T8e;var E8e=aZ,A8e=cZ,N8e=uZ,j8e=hZ,M8e=fZ,I8e=mZ,R8e=pZ,D8e=S8e,L8e=gZ,P8e=bZ,O8e="Label",yZ=f.forwardRef((e,t)=>l.jsx(Mn.label,{...e,ref:t,onMouseDown:n=>{var r;n.target.closest("button, input, select, textarea")||((r=e.onMouseDown)==null||r.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));yZ.displayName=O8e;var B8e=yZ;function I$(e,[t,n]){return Math.min(n,Math.max(t,e))}var F3="Popover",[xZ,w_t]=oa(F3,[lm]),Gv=lm(),[$8e,dm]=xZ(F3),vZ=e=>{const{__scopePopover:t,children:n,open:s,defaultOpen:r,onOpenChange:i,modal:o=!1}=e,a=Gv(t),c=f.useRef(null),[u,d]=f.useState(!1),[h,m]=ja({prop:s,defaultProp:r??!1,onChange:i,caller:F3});return l.jsx(Fv,{...a,children:l.jsx($8e,{scope:t,contentId:tl(),triggerRef:c,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})})};vZ.displayName=F3;var wZ="PopoverAnchor",kZ=f.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=dm(wZ,n),i=Gv(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=r;return f.useEffect(()=>(o(),()=>a()),[o,a]),l.jsx(Hv,{...i,...s,ref:t})});kZ.displayName=wZ;var _Z="PopoverTrigger",SZ=f.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=dm(_Z,n),i=Gv(n),o=os(t,r.triggerRef),a=l.jsx(Mn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":NZ(r.open),...s,ref:o,onClick:$t(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?a:l.jsx(Hv,{asChild:!0,...i,children:a})});SZ.displayName=_Z;var NM="PopoverPortal",[z8e,F8e]=xZ(NM,{forceMount:void 0}),CZ=e=>{const{__scopePopover:t,forceMount:n,children:s,container:r}=e,i=dm(NM,t);return l.jsx(z8e,{scope:t,forceMount:n,children:l.jsx(aa,{present:n||i.open,children:l.jsx(Q1,{asChild:!0,container:r,children:s})})})};CZ.displayName=NM;var u1="PopoverContent",TZ=f.forwardRef((e,t)=>{const n=F8e(u1,e.__scopePopover),{forceMount:s=n.forceMount,...r}=e,i=dm(u1,e.__scopePopover);return l.jsx(aa,{present:s||i.open,children:i.modal?l.jsx(q8e,{...r,ref:t}):l.jsx(U8e,{...r,ref:t})})});TZ.displayName=u1;var H8e=Bf("PopoverContent.RemoveScroll"),q8e=f.forwardRef((e,t)=>{const n=dm(u1,e.__scopePopover),s=f.useRef(null),r=os(t,s),i=f.useRef(!1);return f.useEffect(()=>{const o=s.current;if(o)return C3(o)},[]),l.jsx(zv,{as:H8e,allowPinchZoom:!0,children:l.jsx(EZ,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:$t(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),i.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:$t(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0,u=a.button===2||c;i.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:$t(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),U8e=f.forwardRef((e,t)=>{const n=dm(u1,e.__scopePopover),s=f.useRef(!1),r=f.useRef(!1);return l.jsx(EZ,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(s.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),s.current=!1,r.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),EZ=f.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...h}=e,m=dm(u1,n),p=Gv(n);return _3(),l.jsx($v,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:i,children:l.jsx(X1,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>m.onOpenChange(!1),deferPointerDownOutside:!0,children:l.jsx(L3,{"data-state":NZ(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)"}})})})}),AZ="PopoverClose",V8e=f.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=dm(AZ,n);return l.jsx(Mn.button,{type:"button",...s,ref:t,onClick:$t(e.onClick,()=>r.onOpenChange(!1))})});V8e.displayName=AZ;var W8e="PopoverArrow",G8e=f.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=Gv(n);return l.jsx(P3,{...r,...s,ref:t})});G8e.displayName=W8e;function NZ(e){return e?"open":"closed"}var K8e=vZ,Y8e=kZ,X8e=SZ,Q8e=CZ,J8e=TZ,jM="Radio",[Z8e,jZ]=oa(jM),[e7e,H3]=Z8e(jM);function MZ(e){const{__scopeRadio:t,checked:n=!1,children:s,disabled:r,form:i,name:o,onCheck:a,required:c,value:u="on",internal_do_not_use_render:d}=e,[h,m]=f.useState(null),[p,g]=f.useState(null),b=f.useRef(!1),v=h?!!i||!!h.closest("form"):!0,x={checked:n,disabled:r,required:c,name:o,form:i,value:u,control:h,setControl:m,hasConsumerStoppedPropagationRef:b,isFormControl:v,bubbleInput:p,setBubbleInput:g,onCheck:()=>a==null?void 0:a()};return l.jsx(e7e,{scope:t,...x,children:n7e(d)?d(x):s})}var IZ="RadioTrigger",MM=f.forwardRef(({__scopeRadio:e,onClick:t,...n},s)=>{const{checked:r,disabled:i,value:o,setControl:a,onCheck:c,hasConsumerStoppedPropagationRef:u,isFormControl:d,bubbleInput:h}=H3(IZ,e),m=os(s,a);return l.jsx(Mn.button,{type:"button",role:"radio","aria-checked":r,"data-state":PZ(r),"data-disabled":i?"":void 0,disabled:i,value:o,...n,ref:m,onClick:$t(t,p=>{r||c(),h&&d&&(u.current=p.isPropagationStopped(),u.current||p.stopPropagation())})})});MM.displayName=IZ;var t7e=f.forwardRef((e,t)=>{const{__scopeRadio:n,name:s,checked:r,required:i,disabled:o,value:a,onCheck:c,form:u,...d}=e;return l.jsx(MZ,{__scopeRadio:n,checked:r,disabled:o,required:i,onCheck:c,name:s,form:u,value:a,internal_do_not_use_render:({isFormControl:h})=>l.jsxs(l.Fragment,{children:[l.jsx(MM,{...d,ref:t,__scopeRadio:n}),h&&l.jsx(IM,{__scopeRadio:n})]})})});t7e.displayName=jM;var RZ="RadioIndicator",DZ=f.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:s,...r}=e,i=H3(RZ,n);return l.jsx(aa,{present:s||i.checked,children:l.jsx(Mn.span,{"data-state":PZ(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})})});DZ.displayName=RZ;var LZ="RadioBubbleInput",IM=f.forwardRef(({__scopeRadio:e,...t},n)=>{const{control:s,checked:r,required:i,disabled:o,name:a,value:c,form:u,bubbleInput:d,setBubbleInput:h,hasConsumerStoppedPropagationRef:m}=H3(LZ,e),p=os(n,h),g=E3(r),b=A3(s);f.useEffect(()=>{const x=d;if(!x)return;const y=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(y,"checked").set,T=!m.current;if(g!==r&&k){const _=new Event("click",{bubbles:T});k.call(x,r),x.dispatchEvent(_)}},[d,g,r,m]);const v=f.useRef(r);return l.jsx(Mn.input,{type:"radio","aria-hidden":!0,defaultChecked:v.current,required:i,disabled:o,name:a,value:c,form:u,...t,tabIndex:-1,ref:p,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});IM.displayName=LZ;function n7e(e){return typeof e=="function"}function PZ(e){return e?"checked":"unchecked"}var s7e=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],q3="RadioGroup",[r7e,k_t]=oa(q3,[cm,jZ]),OZ=cm(),U3=jZ(),[i7e,o7e]=r7e(q3),BZ=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:s,form:r,defaultValue:i,value:o,required:a=!1,disabled:c=!1,orientation:u,dir:d,loop:h=!0,onValueChange:m,...p}=e,g=OZ(n),b=Y1(d),[v,x]=ja({prop:o,defaultProp:i??null,onChange:m,caller:q3}),[y,w]=f.useState(null),k=os(t,w),T=f.useRef(v);return f.useEffect(()=>{const _=r?y==null?void 0:y.ownerDocument.getElementById(r):y==null?void 0:y.closest("form");if(_ instanceof HTMLFormElement){const C=()=>x(T.current);return _.addEventListener("reset",C),()=>_.removeEventListener("reset",C)}},[y,r,x]),l.jsx(i7e,{scope:n,name:s,form:r,required:a,disabled:c,value:v,onValueChange:x,children:l.jsx(O3,{asChild:!0,...g,orientation:u,dir:b,loop:h,children:l.jsx(Mn.div,{role:"radiogroup","aria-required":a,"aria-orientation":u,"data-disabled":c?"":void 0,dir:b,...p,ref:k})})})});BZ.displayName=q3;var a7e="RadioGroupItem",l7e="RadioGroupItemProvider",$Z="RadioGroupItemTrigger",c7e="RadioGroupItemBubbleInput";function u7e(e){const{__scopeRadioGroup:t,value:n,disabled:s,children:r,internal_do_not_use_render:i}=e,o=o7e(l7e,t),a=U3(t),c=o.disabled||s;return l.jsx(MZ,{...a,checked:o.value===n,disabled:c,required:o.required,name:o.name,form:o.form,value:n,onCheck:()=>o.onValueChange(n),internal_do_not_use_render:i,children:r})}var zZ=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,r=OZ(n),i=U3(n),{checked:o,disabled:a}=H3($Z,i.__scopeRadio),c=f.useRef(null),u=os(t,c),d=f.useRef(!1);return f.useEffect(()=>{const h=p=>{s7e.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)}},[]),l.jsx(B3,{asChild:!0,...r,focusable:!a,active:o,children:l.jsx(MM,{...i,...s,ref:u,onKeyDown:$t(s.onKeyDown,h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:$t(s.onFocus,()=>{var h;d.current&&((h=c.current)==null||h.click())})})})});zZ.displayName=$Z;var FZ=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,value:s,disabled:r,...i}=e;return l.jsx(u7e,{__scopeRadioGroup:n,value:s,disabled:r,internal_do_not_use_render:({isFormControl:o})=>l.jsxs(l.Fragment,{children:[l.jsx(zZ,{...i,ref:t,__scopeRadioGroup:n}),o&&l.jsx(HZ,{__scopeRadioGroup:n})]})})});FZ.displayName=a7e;var HZ=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,r=U3(n);return l.jsx(IM,{...r,...s,ref:t})});HZ.displayName=c7e;var d7e="RadioGroupIndicator",qZ=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,r=U3(n);return l.jsx(DZ,{...r,...s,ref:t})});qZ.displayName=d7e;var h7e=[" ","Enter","ArrowUp","ArrowDown"],f7e=[" ","Enter"],Pp="Select",[V3,W3,m7e]=tM(Pp),[a0,__t]=oa(Pp,[m7e,lm]),G3=lm(),[p7e,hm]=a0(Pp),[g7e,b7e]=a0(Pp),y7e="SelectProvider";function UZ(e){const{__scopeSelect:t,children:n,open:s,defaultOpen:r,onOpenChange:i,value:o,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:h,disabled:m,required:p,form:g,internal_do_not_use_render:b}=e,v=G3(t),[x,y]=f.useState(null),[w,k]=f.useState(null),[T,_]=f.useState(!1),C=Y1(u),[S,L]=ja({prop:s,defaultProp:r??!1,onChange:i,caller:Pp}),[N,$]=ja({prop:o,defaultProp:a,onChange:c,caller:Pp}),M=f.useRef(null),P=f.useRef(N);f.useEffect(()=>{const V=g?x==null?void 0:x.ownerDocument.getElementById(g):x==null?void 0:x.form;if(V instanceof HTMLFormElement){const j=()=>$(P.current);return V.addEventListener("reset",j),()=>V.removeEventListener("reset",j)}},[g,x,$]);const E=x?!!g||!!x.closest("form"):!0,[O,z]=f.useState(new Set),F=tl(),B=Array.from(O).map(V=>V.props.value).join(";"),W=f.useCallback(V=>{z(j=>new Set(j).add(V))},[]),I=f.useCallback(V=>{z(j=>{const ee=new Set(j);return ee.delete(V),ee})},[]),Y={required:p,trigger:x,onTriggerChange:y,valueNode:w,onValueNodeChange:k,valueNodeHasChildren:T,onValueNodeHasChildrenChange:_,contentId:F,value:N,onValueChange:$,open:S,onOpenChange:L,dir:C,triggerPointerDownPosRef:M,disabled:m,name:d,autoComplete:h,form:g,nativeOptions:O,nativeSelectKey:B,isFormControl:E};return l.jsx(Fv,{...v,children:l.jsx(p7e,{scope:t,...Y,children:l.jsx(V3.Provider,{scope:t,children:l.jsx(g7e,{scope:t,onNativeOptionAdd:W,onNativeOptionRemove:I,children:D7e(b)?b(Y):n})})})})}UZ.displayName=y7e;var VZ=e=>{const{__scopeSelect:t,children:n,...s}=e;return l.jsx(UZ,{__scopeSelect:t,...s,internal_do_not_use_render:({isFormControl:r})=>l.jsxs(l.Fragment,{children:[n,r?l.jsx(yee,{__scopeSelect:t}):null]})})};VZ.displayName=Pp;var WZ="SelectTrigger",GZ=f.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...r}=e,i=G3(n),o=hm(WZ,n),a=o.disabled||s,c=os(t,o.onTriggerChange),u=W3(n),d=f.useRef("touch"),[h,m,p]=xee(b=>{const v=u().filter(w=>!w.disabled),x=v.find(w=>w.value===o.value),y=vee(v,b,x);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 l.jsx(Hv,{asChild:!0,...i,children:l.jsx(Mn.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":K3(o.value)?"":void 0,...r,ref:c,onClick:$t(r.onClick,b=>{b.currentTarget.focus(),d.current!=="mouse"&&g(b)}),onPointerDown:$t(r.onPointerDown,b=>{d.current=b.pointerType;const v=b.target;v.hasPointerCapture(b.pointerId)&&v.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(g(b),b.preventDefault())}),onKeyDown:$t(r.onKeyDown,b=>{const v=h.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&m(b.key),!(v&&b.key===" ")&&h7e.includes(b.key)&&(g(),b.preventDefault())})})})});GZ.displayName=WZ;var KZ="SelectValue",YZ=f.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:r,children:i,placeholder:o="",...a}=e,c=hm(KZ,n),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,h=os(t,c.onValueNodeChange);Co(()=>{u(d)},[u,d]);const m=K3(c.value);return l.jsx(Mn.span,{...a,asChild:m?!1:a.asChild,ref:h,style:{pointerEvents:"none"},children:l.jsx(f.Fragment,{children:m?o:i},m?"placeholder":"value")})});YZ.displayName=KZ;var x7e="SelectIcon",XZ=f.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...r}=e;return l.jsx(Mn.span,{"aria-hidden":!0,...r,ref:t,children:s||"▼"})});XZ.displayName=x7e;var QZ="SelectPortal",[v7e,w7e]=a0(QZ,{forceMount:void 0}),JZ=e=>{const{__scopeSelect:t,forceMount:n,...s}=e;return l.jsx(v7e,{scope:e.__scopeSelect,forceMount:n,children:l.jsx(Q1,{asChild:!0,...s})})};JZ.displayName=QZ;var Ff="SelectContent",ZZ=f.forwardRef((e,t)=>{const n=w7e(Ff,e.__scopeSelect),{forceMount:s=n.forceMount,...r}=e,i=hm(Ff,e.__scopeSelect),[o,a]=f.useState();return Co(()=>{a(new DocumentFragment)},[]),l.jsx(aa,{present:s||i.open,children:({present:c})=>c?l.jsx(nee,{...r,ref:t}):l.jsx(eee,{...r,fragment:o})})});ZZ.displayName=Ff;var eee=f.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,fragment:r}=e;return r?$u.createPortal(l.jsx(tee,{scope:n,children:l.jsx(V3.Slot,{scope:n,children:l.jsx("div",{ref:t,children:s})})}),r):null});eee.displayName="SelectContentFragment";var Nc=10,[tee,fm]=a0(Ff),k7e="SelectContentImpl",_7e=Bf("SelectContent.RemoveScroll"),nee=f.forwardRef((e,t)=>{const{__scopeSelect:n}=e,{position:s="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:b,avoidCollisions:v,...x}=e,y=hm(Ff,n),[w,k]=f.useState(null),[T,_]=f.useState(null),C=os(t,k),[S,L]=f.useState(null),[N,$]=f.useState(null),M=W3(n),[P,E]=f.useState(!1),O=f.useRef(!1);f.useEffect(()=>{if(w)return C3(w)},[w]),_3();const z=f.useCallback(Q=>{const[ue,...re]=M().map(Z=>Z.ref.current),[J]=re.slice(-1),q=document.activeElement;for(const Z of Q)if(Z===q||(Z==null||Z.scrollIntoView({block:"nearest"}),Z===ue&&T&&(T.scrollTop=0),Z===J&&T&&(T.scrollTop=T.scrollHeight),Z==null||Z.focus(),document.activeElement!==q))return},[M,T]),F=f.useCallback(()=>z([S,w]),[z,S,w]);f.useEffect(()=>{P&&F()},[P,F]);const{onOpenChange:B,triggerPointerDownPosRef:W}=y;f.useEffect(()=>{if(w){let Q={x:0,y:0};const ue=J=>{var q,Z;Q={x:Math.abs(Math.round(J.pageX)-(((q=W.current)==null?void 0:q.x)??0)),y:Math.abs(Math.round(J.pageY)-(((Z=W.current)==null?void 0:Z.y)??0))}},re=J=>{Q.x<=10&&Q.y<=10?J.preventDefault():J.composedPath().includes(w)||B(!1),document.removeEventListener("pointermove",ue),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",ue),document.addEventListener("pointerup",re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ue),document.removeEventListener("pointerup",re,{capture:!0})}}},[w,B,W]),f.useEffect(()=>{const Q=()=>B(!1);return window.addEventListener("blur",Q),window.addEventListener("resize",Q),()=>{window.removeEventListener("blur",Q),window.removeEventListener("resize",Q)}},[B]);const[I,Y]=xee(Q=>{const ue=M().filter(q=>!q.disabled),re=ue.find(q=>q.ref.current===document.activeElement),J=vee(ue,Q,re);J&&setTimeout(()=>{var q;return(q=J.ref.current)==null?void 0:q.focus()})}),V=f.useCallback((Q,ue,re)=>{const J=!O.current&&!re;(y.value!==void 0&&y.value===ue||J)&&(L(Q),J&&(O.current=!0))},[y.value]),j=f.useCallback(()=>w==null?void 0:w.focus(),[w]),ee=f.useCallback((Q,ue,re)=>{const J=!O.current&&!re;(y.value!==void 0&&y.value===ue||J)&&$(Q)},[y.value]),se=s==="popper"?KE:see,X=se===KE?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:b,avoidCollisions:v}:{};return l.jsx(tee,{scope:n,content:w,viewport:T,onViewportChange:_,itemRefCallback:V,selectedItem:S,onItemLeave:j,itemTextRefCallback:ee,focusSelectedItem:F,selectedItemText:N,position:s,isPositioned:P,searchRef:I,children:l.jsx(zv,{as:_7e,allowPinchZoom:!0,children:l.jsx($v,{asChild:!0,trapped:y.open,onMountAutoFocus:Q=>{Q.preventDefault()},onUnmountAutoFocus:$t(r,Q=>{var ue;(ue=y.trigger)==null||ue.focus({preventScroll:!0}),Q.preventDefault()}),children:l.jsx(X1,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:Q=>Q.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:l.jsx(se,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:Q=>Q.preventDefault(),...x,...X,onPlaced:()=>E(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:$t(x.onKeyDown,Q=>{const ue=Q.ctrlKey||Q.altKey||Q.metaKey;if(Q.key==="Tab"&&Q.preventDefault(),!ue&&Q.key.length===1&&Y(Q.key),["ArrowUp","ArrowDown","Home","End"].includes(Q.key)){let J=M().filter(q=>!q.disabled).map(q=>q.ref.current);if(["ArrowUp","End"].includes(Q.key)&&(J=J.slice().reverse()),["ArrowUp","ArrowDown"].includes(Q.key)){const q=Q.target,Z=J.indexOf(q);J=J.slice(Z+1)}setTimeout(()=>z(J)),Q.preventDefault()}})})})})})})});nee.displayName=k7e;var S7e="SelectItemAlignedPosition",see=f.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...r}=e,i=hm(Ff,n),o=fm(Ff,n),[a,c]=f.useState(null),[u,d]=f.useState(null),h=os(t,d),m=W3(n),p=f.useRef(!1),g=f.useRef(!0),{viewport:b,selectedItem:v,selectedItemText:x,focusSelectedItem:y}=o,w=f.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&u&&b&&v&&x){const C=i.trigger.getBoundingClientRect(),S=u.getBoundingClientRect(),L=i.valueNode.getBoundingClientRect(),N=x.getBoundingClientRect();if(i.dir!=="rtl"){const q=N.left-S.left,Z=L.left-q,he=C.left-Z,ye=C.width+he,oe=Math.max(ye,S.width),we=window.innerWidth-Nc,Ve=I$(Z,[Nc,Math.max(Nc,we-oe)]);a.style.minWidth=ye+"px",a.style.left=Ve+"px"}else{const q=S.right-N.right,Z=window.innerWidth-L.right-q,he=window.innerWidth-C.right-Z,ye=C.width+he,oe=Math.max(ye,S.width),we=window.innerWidth-Nc,Ve=I$(Z,[Nc,Math.max(Nc,we-oe)]);a.style.minWidth=ye+"px",a.style.right=Ve+"px"}const $=m(),M=window.innerHeight-Nc*2,P=b.scrollHeight,E=window.getComputedStyle(u),O=parseInt(E.borderTopWidth,10),z=parseInt(E.paddingTop,10),F=parseInt(E.borderBottomWidth,10),B=parseInt(E.paddingBottom,10),W=O+z+P+B+F,I=Math.min(v.offsetHeight*5,W),Y=window.getComputedStyle(b),V=parseInt(Y.paddingTop,10),j=parseInt(Y.paddingBottom,10),ee=C.top+C.height/2-Nc,se=M-ee,X=v.offsetHeight/2,Q=v.offsetTop+X,ue=O+z+Q,re=W-ue;if(ue<=ee){const q=$.length>0&&v===$[$.length-1].ref.current;a.style.bottom="0px";const Z=u.clientHeight-b.offsetTop-b.offsetHeight,he=Math.max(se,X+(q?j:0)+Z+F),ye=ue+he;a.style.height=ye+"px"}else{const q=$.length>0&&v===$[0].ref.current;a.style.top="0px";const he=Math.max(ee,O+b.offsetTop+(q?V:0)+X)+re;a.style.height=he+"px",b.scrollTop=ue-ee+b.offsetTop}a.style.margin=`${Nc}px 0`,a.style.minHeight=I+"px",a.style.maxHeight=M+"px",s==null||s(),requestAnimationFrame(()=>p.current=!0)}},[m,i.trigger,i.valueNode,a,u,b,v,x,i.dir,s]);Co(()=>w(),[w]);const[k,T]=f.useState();Co(()=>{u&&T(window.getComputedStyle(u).zIndex)},[u]);const _=f.useCallback(C=>{C&&g.current===!0&&(w(),y==null||y(),g.current=!1)},[w,y]);return l.jsx(T7e,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:_,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:l.jsx(Mn.div,{...r,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});see.displayName=S7e;var C7e="SelectPopperPosition",KE=f.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:r=Nc,...i}=e,o=G3(n);return l.jsx(L3,{...o,...i,ref:t,align:s,collisionPadding:r,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)"}})});KE.displayName=C7e;var[T7e,RM]=a0(Ff,{}),YE="SelectViewport",ree=f.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...r}=e,i=fm(YE,n),o=RM(YE,n),a=os(t,i.onViewportChange),c=f.useRef(0);return l.jsxs(l.Fragment,{children:[l.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:s}),l.jsx(V3.Slot,{scope:n,children:l.jsx(Mn.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:$t(r.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&h){const p=Math.abs(c.current-d.scrollTop);if(p>0){const g=window.innerHeight-Nc*2,b=parseFloat(h.style.minHeight),v=parseFloat(h.style.height),x=Math.max(b,v);if(x<g){const y=x+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")}}}c.current=d.scrollTop})})})]})});ree.displayName=YE;var iee="SelectGroup",[E7e,A7e]=a0(iee),oee=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=tl();return l.jsx(E7e,{scope:n,id:r,children:l.jsx(Mn.div,{role:"group","aria-labelledby":r,...s,ref:t})})});oee.displayName=iee;var aee="SelectLabel",N7e=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=A7e(aee,n);return l.jsx(Mn.div,{id:r.id,...s,ref:t})});N7e.displayName=aee;var IS="SelectItem",[j7e,lee]=a0(IS),cee=f.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:r=!1,textValue:i,...o}=e,a=hm(IS,n),c=fm(IS,n),u=a.value===s,[d,h]=f.useState(i??""),[m,p]=f.useState(!1),g=Rl(w=>{var k;return(k=c.itemRefCallback)==null?void 0:k.call(c,w,s,r)}),b=os(t,g),v=tl(),x=f.useRef("touch"),y=()=>{r||(a.onValueChange(s),a.onOpenChange(!1))};return l.jsx(j7e,{scope:n,value:s,disabled:r,textId:v,isSelected:u,onItemTextChange:f.useCallback(w=>{h(k=>k||((w==null?void 0:w.textContent)??"").trim())},[]),children:l.jsx(V3.ItemSlot,{scope:n,value:s,disabled:r,textValue:d,children:l.jsx(Mn.div,{role:"option","aria-labelledby":v,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...o,ref:b,onFocus:$t(o.onFocus,()=>p(!0)),onBlur:$t(o.onBlur,()=>p(!1)),onClick:$t(o.onClick,()=>{x.current!=="mouse"&&y()}),onPointerUp:$t(o.onPointerUp,()=>{x.current==="mouse"&&y()}),onPointerDown:$t(o.onPointerDown,w=>{x.current=w.pointerType}),onPointerMove:$t(o.onPointerMove,w=>{var k;x.current=w.pointerType,r?(k=c.onItemLeave)==null||k.call(c):x.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:$t(o.onPointerLeave,w=>{var k;w.currentTarget===document.activeElement&&((k=c.onItemLeave)==null||k.call(c))}),onKeyDown:$t(o.onKeyDown,w=>{var T;r||w.target!==w.currentTarget||((T=c.searchRef)==null?void 0:T.current)!==""&&w.key===" "||(f7e.includes(w.key)&&y(),w.key===" "&&w.preventDefault())})})})})});cee.displayName=IS;var ky="SelectItemText",uee=f.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:r,...i}=e,o=hm(ky,n),a=fm(ky,n),c=lee(ky,n),u=b7e(ky,n),[d,h]=f.useState(null),m=Rl(y=>{var w;return(w=a.itemTextRefCallback)==null?void 0:w.call(a,y,c.value,c.disabled)}),p=os(t,h,c.onItemTextChange,m),g=d==null?void 0:d.textContent,b=f.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:x}=u;return Co(()=>(v(b),()=>x(b)),[v,x,b]),l.jsxs(l.Fragment,{children:[l.jsx(Mn.span,{id:c.textId,...i,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!K3(o.value)?$u.createPortal(i.children,o.valueNode):null]})});uee.displayName=ky;var dee="SelectItemIndicator",hee=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return lee(dee,n).isSelected?l.jsx(Mn.span,{"aria-hidden":!0,...s,ref:t}):null});hee.displayName=dee;var XE="SelectScrollUpButton",fee=f.forwardRef((e,t)=>{const n=fm(XE,e.__scopeSelect),s=RM(XE,e.__scopeSelect),[r,i]=f.useState(!1),o=os(t,s.onScrollButtonChange);return Co(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollTop>0;i(u)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?l.jsx(pee,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});fee.displayName=XE;var QE="SelectScrollDownButton",mee=f.forwardRef((e,t)=>{const n=fm(QE,e.__scopeSelect),s=RM(QE,e.__scopeSelect),[r,i]=f.useState(!1),o=os(t,s.onScrollButtonChange);return Co(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;i(d)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?l.jsx(pee,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});mee.displayName=QE;var pee=f.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...r}=e,i=fm("SelectScrollButton",n),o=f.useRef(null),a=W3(n),c=f.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return f.useEffect(()=>()=>c(),[c]),Co(()=>{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]),l.jsx(Mn.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:$t(r.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(s,50))}),onPointerMove:$t(r.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),o.current===null&&(o.current=window.setInterval(s,50))}),onPointerLeave:$t(r.onPointerLeave,()=>{c()})})}),M7e="SelectSeparator",I7e=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return l.jsx(Mn.div,{"aria-hidden":!0,...s,ref:t})});I7e.displayName=M7e;var gee="SelectArrow",R7e=f.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=G3(n);return fm(gee,n).position==="popper"?l.jsx(P3,{...r,...s,ref:t}):null});R7e.displayName=gee;var bee="SelectBubbleInput",yee=f.forwardRef(({__scopeSelect:e,...t},n)=>{const s=hm(bee,e),{value:r,onValueChange:i,required:o,disabled:a,name:c,autoComplete:u,form:d}=s,{nativeOptions:h,nativeSelectKey:m}=s,p=f.useRef(null),g=os(n,p),b=r??"",v=E3(b),x=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(v!==b&&T){const _=new Event("change",{bubbles:!0});T.call(y,b),y.dispatchEvent(_)}},[v,b]),l.jsxs(Mn.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:u,disabled:a,form:d,onChange:y=>i(y.target.value),...t,style:{..._Q,...t.style},ref:g,defaultValue:b,children:[K3(r)&&!x?l.jsx("option",{value:""}):null,Array.from(h)]},m)});yee.displayName=bee;function D7e(e){return typeof e=="function"}function K3(e){return e===""||e===void 0}function xee(e){const t=Rl(e),n=f.useRef(""),s=f.useRef(0),r=f.useCallback(o=>{const a=n.current+o;t(a),function c(u){n.current=u,window.clearTimeout(s.current),u!==""&&(s.current=window.setTimeout(()=>c(""),1e3))}(a)},[t]),i=f.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return f.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,r,i]}function vee(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=L7e(e,Math.max(i,0));r.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function L7e(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var P7e="Separator",R$="horizontal",O7e=["horizontal","vertical"],wee=f.forwardRef((e,t)=>{const{decorative:n,orientation:s=R$,...r}=e,i=B7e(s)?s:R$,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return l.jsx(Mn.div,{"data-orientation":i,...a,...r,ref:t})});wee.displayName=P7e;function B7e(e){return O7e.includes(e)}var $7e=wee,Y3="Switch",[z7e,S_t]=oa(Y3),[F7e,DM]=z7e(Y3);function H7e(e){const{__scopeSwitch:t,checked:n,children:s,defaultChecked:r,disabled:i,form:o,name:a,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:h}=e,[m,p]=ja({prop:n,defaultProp:r??!1,onChange:c,caller:Y3}),[g,b]=f.useState(null),[v,x]=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:r,isFormControl:w,bubbleInput:v,setBubbleInput:x};return l.jsx(F7e,{scope:t,...k,children:q7e(h)?h(k):s})}var kee="SwitchTrigger",_ee=f.forwardRef(({__scopeSwitch:e,onClick:t,...n},s)=>{const{control:r,form:i,value:o,disabled:a,checked:c,required:u,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:p,bubbleInput:g}=DM(kee,e),b=os(s,d),v=f.useRef(c);return f.useEffect(()=>{const x=i?r==null?void 0:r.ownerDocument.getElementById(i):r==null?void 0:r.form;if(x instanceof HTMLFormElement){const y=()=>h(v.current);return x.addEventListener("reset",y),()=>x.removeEventListener("reset",y)}},[r,i,h]),l.jsx(Mn.button,{type:"button",role:"switch","aria-checked":c,"aria-required":u,"data-state":Nee(c),"data-disabled":a?"":void 0,disabled:a,value:o,...n,ref:b,onClick:$t(t,x=>{h(y=>!y),g&&p&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})})});_ee.displayName=kee;var See=f.forwardRef((e,t)=>{const{__scopeSwitch:n,name:s,checked:r,defaultChecked:i,required:o,disabled:a,value:c,onCheckedChange:u,form:d,...h}=e;return l.jsx(H7e,{__scopeSwitch:n,checked:r,defaultChecked:i,disabled:a,required:o,onCheckedChange:u,name:s,form:d,value:c,internal_do_not_use_render:({isFormControl:m})=>l.jsxs(l.Fragment,{children:[l.jsx(_ee,{...h,ref:t,__scopeSwitch:n}),m&&l.jsx(Aee,{__scopeSwitch:n})]})})});See.displayName=Y3;var Cee="SwitchThumb",Tee=f.forwardRef((e,t)=>{const{__scopeSwitch:n,...s}=e,r=DM(Cee,n);return l.jsx(Mn.span,{"data-state":Nee(r.checked),"data-disabled":r.disabled?"":void 0,...s,ref:t})});Tee.displayName=Cee;var Eee="SwitchBubbleInput",Aee=f.forwardRef(({__scopeSwitch:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:r,checked:i,defaultChecked:o,required:a,disabled:c,name:u,value:d,form:h,bubbleInput:m,setBubbleInput:p}=DM(Eee,e),g=os(n,p),b=E3(i),v=A3(s);f.useEffect(()=>{const y=m;if(!y)return;const w=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(w,"checked").set,_=!r.current;if(b!==i&&T){const C=new Event("click",{bubbles:_});T.call(y,i),y.dispatchEvent(C)}},[m,b,i,r]);const x=f.useRef(i);return l.jsx(Mn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??x.current,required:a,disabled:c,name:u,value:d,form:h,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Aee.displayName=Eee;function q7e(e){return typeof e=="function"}function Nee(e){return e?"checked":"unchecked"}var X3="Tabs",[U7e,C_t]=oa(X3,[cm]),jee=cm(),[V7e,LM]=U7e(X3),Mee=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:r,defaultValue:i,orientation:o="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=Y1(a),[h,m]=ja({prop:s,onChange:r,defaultProp:i??"",caller:X3});return l.jsx(V7e,{scope:n,baseId:tl(),value:h,onValueChange:m,orientation:o,dir:d,activationMode:c,children:l.jsx(Mn.div,{dir:d,"data-orientation":o,...u,ref:t})})});Mee.displayName=X3;var Iee="TabsList",Ree=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...r}=e,i=LM(Iee,n),o=jee(n);return l.jsx(O3,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:s,children:l.jsx(Mn.div,{role:"tablist","aria-orientation":i.orientation,...r,ref:t})})});Ree.displayName=Iee;var Dee="TabsTrigger",Lee=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:r=!1,...i}=e,o=LM(Dee,n),a=jee(n),c=Bee(o.baseId,s),u=$ee(o.baseId,s),d=s===o.value;return l.jsx(B3,{asChild:!0,...a,focusable:!r,active:d,children:l.jsx(Mn.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:c,...i,ref:t,onMouseDown:$t(e.onMouseDown,h=>{!r&&h.button===0&&h.ctrlKey===!1?o.onValueChange(s):h.preventDefault()}),onKeyDown:$t(e.onKeyDown,h=>{r||h.target!==h.currentTarget||[" ","Enter"].includes(h.key)&&o.onValueChange(s)}),onFocus:$t(e.onFocus,()=>{const h=o.activationMode!=="manual";!d&&!r&&h&&o.onValueChange(s)})})})});Lee.displayName=Dee;var Pee="TabsContent",Oee=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:r,children:i,...o}=e,a=LM(Pee,n),c=Bee(a.baseId,s),u=$ee(a.baseId,s),d=s===a.value,h=f.useRef(d);return f.useEffect(()=>{const m=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(aa,{present:r||d,children:({present:m})=>l.jsx(Mn.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:m&&i})})});Oee.displayName=Pee;function Bee(e,t){return`${e}-trigger-${t}`}function $ee(e,t){return`${e}-content-${t}`}var W7e=Mee,G7e=Ree,K7e=Lee,Y7e=Oee,zee="Toggle",Fee=f.forwardRef((e,t)=>{const{pressed:n,defaultPressed:s,onPressedChange:r,...i}=e,[o,a]=ja({prop:n,onChange:r,defaultProp:s??!1,caller:zee});return l.jsx(Mn.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":e.disabled?"":void 0,...i,ref:t,onClick:$t(e.onClick,()=>{e.disabled||a(!o)})})});Fee.displayName=zee;var mm="ToggleGroup",[Hee,T_t]=oa(mm,[cm]),qee=cm(),PM=f.forwardRef((e,t)=>{const{type:n,...s}=e;if(n==="single"){const r=s;return l.jsx(X7e,{role:"radiogroup",...r,ref:t})}if(n==="multiple"){const r=s;return l.jsx(Q7e,{role:"toolbar",...r,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${mm}\``)});PM.displayName=mm;var[Uee,Vee]=Hee(mm),X7e=f.forwardRef((e,t)=>{const{value:n,defaultValue:s,onValueChange:r=()=>{},...i}=e,[o,a]=ja({prop:n,defaultProp:s??"",onChange:r,caller:mm});return l.jsx(Uee,{scope:e.__scopeToggleGroup,type:"single",value:f.useMemo(()=>o?[o]:[],[o]),onItemActivate:a,onItemDeactivate:f.useCallback(()=>a(""),[a]),children:l.jsx(Wee,{...i,ref:t})})}),Q7e=f.forwardRef((e,t)=>{const{value:n,defaultValue:s,onValueChange:r=()=>{},...i}=e,[o,a]=ja({prop:n,defaultProp:s??[],onChange:r,caller:mm}),c=f.useCallback(d=>a((h=[])=>[...h,d]),[a]),u=f.useCallback(d=>a((h=[])=>h.filter(m=>m!==d)),[a]);return l.jsx(Uee,{scope:e.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:c,onItemDeactivate:u,children:l.jsx(Wee,{...i,ref:t})})});PM.displayName=mm;var[J7e,Z7e]=Hee(mm),Wee=f.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:s=!1,rovingFocus:r=!0,orientation:i,dir:o,loop:a=!0,...c}=e,u=qee(n),d=Y1(o),h={dir:d,...c};return l.jsx(J7e,{scope:n,rovingFocus:r,disabled:s,children:r?l.jsx(O3,{asChild:!0,...u,orientation:i,dir:d,loop:a,children:l.jsx(Mn.div,{...h,ref:t})}):l.jsx(Mn.div,{...h,ref:t})})}),RS="ToggleGroupItem",Gee=f.forwardRef((e,t)=>{const n=Vee(RS,e.__scopeToggleGroup),s=Z7e(RS,e.__scopeToggleGroup),r=qee(e.__scopeToggleGroup),i=n.value.includes(e.value),o=s.disabled||e.disabled,a={...e,pressed:i,disabled:o},c=f.useRef(null);return s.rovingFocus?l.jsx(B3,{asChild:!0,...r,focusable:!o,active:i,ref:c,children:l.jsx(D$,{...a,ref:t})}):l.jsx(D$,{...a,ref:t})});Gee.displayName=RS;var D$=f.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:s,...r}=e,i=Vee(RS,n),o={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},a=i.type==="single"?o:void 0;return l.jsx(Fee,{...a,...r,ref:t,onPressedChange:c=>{c?i.onItemActivate(s):i.onItemDeactivate(s)}})}),[Q3,E_t]=oa("Tooltip",[lm]),J3=lm(),Kee="TooltipProvider",eEe=700,JE="tooltip.open",[tEe,OM]=Q3(Kee),Yee=e=>{const{__scopeTooltip:t,delayDuration:n=eEe,skipDelayDuration:s=300,disableHoverableContent:r=!1,children:i}=e,o=f.useRef(!0),a=f.useRef(!1),c=f.useRef(0);return f.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),l.jsx(tEe,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:f.useCallback(()=>{s<=0||(window.clearTimeout(c.current),o.current=!1)},[s]),onClose:f.useCallback(()=>{s<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,s))},[s]),isPointerInTransitRef:a,onPointerInTransitChange:f.useCallback(u=>{a.current=u},[]),disableHoverableContent:r,children:i})};Yee.displayName=Kee;var Hx="Tooltip",[nEe,Kv]=Q3(Hx),Xee=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:r,onOpenChange:i,disableHoverableContent:o,delayDuration:a}=e,c=OM(Hx,e.__scopeTooltip),u=J3(t),[d,h]=f.useState(null),m=tl(),p=f.useRef(0),g=o??c.disableHoverableContent,b=a??c.delayDuration,v=f.useRef(!1),[x,y]=ja({prop:s,defaultProp:r??!1,onChange:C=>{C?(c.onOpen(),document.dispatchEvent(new CustomEvent(JE))):c.onClose(),i==null||i(C)},caller:Hx}),w=f.useMemo(()=>x?v.current?"delayed-open":"instant-open":"closed",[x]),k=f.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v.current=!1,y(!0)},[y]),T=f.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),_=f.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{v.current=!0,y(!0),p.current=0},b)},[b,y]);return f.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),l.jsx(Fv,{...u,children:l.jsx(nEe,{scope:t,contentId:m,open:x,stateAttribute:w,trigger:d,onTriggerChange:h,onTriggerEnter:f.useCallback(()=>{c.isOpenDelayedRef.current?_():k()},[c.isOpenDelayedRef,_,k]),onTriggerLeave:f.useCallback(()=>{g?T():(window.clearTimeout(p.current),p.current=0)},[T,g]),onOpen:k,onClose:T,disableHoverableContent:g,children:n})})};Xee.displayName=Hx;var ZE="TooltipTrigger",Qee=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=Kv(ZE,n),i=OM(ZE,n),o=J3(n),a=f.useRef(null),c=os(t,a,r.onTriggerChange),u=f.useRef(!1),d=f.useRef(!1),h=f.useCallback(()=>u.current=!1,[]);return f.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),l.jsx(Hv,{asChild:!0,...o,children:l.jsx(Mn.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...s,ref:c,onPointerMove:$t(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(r.onTriggerEnter(),d.current=!0)}),onPointerLeave:$t(e.onPointerLeave,()=>{r.onTriggerLeave(),d.current=!1}),onPointerDown:$t(e.onPointerDown,()=>{r.open&&r.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:$t(e.onFocus,()=>{u.current||r.onOpen()}),onBlur:$t(e.onBlur,r.onClose),onClick:$t(e.onClick,r.onClose)})})});Qee.displayName=ZE;var BM="TooltipPortal",[sEe,rEe]=Q3(BM,{forceMount:void 0}),Jee=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:r}=e,i=Kv(BM,t);return l.jsx(sEe,{scope:t,forceMount:n,children:l.jsx(aa,{present:n||i.open,children:l.jsx(Q1,{asChild:!0,container:r,children:s})})})};Jee.displayName=BM;var d1="TooltipContent",Zee=f.forwardRef((e,t)=>{const n=rEe(d1,e.__scopeTooltip),{forceMount:s=n.forceMount,side:r="top",...i}=e,o=Kv(d1,e.__scopeTooltip);return l.jsx(aa,{present:s||o.open,children:o.disableHoverableContent?l.jsx(ete,{side:r,...i,ref:t}):l.jsx(iEe,{side:r,...i,ref:t})})}),iEe=f.forwardRef((e,t)=>{const n=Kv(d1,e.__scopeTooltip),s=OM(d1,e.__scopeTooltip),r=f.useRef(null),i=os(t,r),[o,a]=f.useState(null),{trigger:c,onClose:u}=n,d=r.current,{onPointerInTransitChange:h}=s,m=f.useCallback(()=>{a(null),h(!1)},[h]),p=f.useCallback((g,b)=>{const v=g.currentTarget,x={x:g.clientX,y:g.clientY},y=cEe(x,v.getBoundingClientRect()),w=uEe(x,y),k=dEe(b.getBoundingClientRect()),T=fEe([...w,...k]);a(T),h(!0)},[h]);return f.useEffect(()=>()=>m(),[m]),f.useEffect(()=>{if(c&&d){const g=v=>p(v,d),b=v=>p(v,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",b),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",b)}}},[c,d,p,m]),f.useEffect(()=>{if(o){const g=b=>{const v=b.target,x={x:b.clientX,y:b.clientY},y=(c==null?void 0:c.contains(v))||(d==null?void 0:d.contains(v)),w=!hEe(x,o);y?m():w&&(m(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,o,u,m]),l.jsx(ete,{...e,ref:i})}),[oEe,aEe]=Q3(Hx,{isInside:!1}),lEe=V3e("TooltipContent"),ete=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":r,onEscapeKeyDown:i,onPointerDownOutside:o,...a}=e,c=Kv(d1,n),u=J3(n),{onClose:d}=c;return f.useEffect(()=>(document.addEventListener(JE,d),()=>document.removeEventListener(JE,d)),[d]),f.useEffect(()=>{if(c.trigger){const h=m=>{m.target instanceof Node&&m.target.contains(c.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,d]),l.jsx(X1,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:l.jsxs(L3,{"data-state":c.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:[l.jsx(lEe,{children:s}),l.jsx(oEe,{scope:n,isInside:!0,children:l.jsx(nCe,{id:c.contentId,role:"tooltip",children:r||s})})]})})});Zee.displayName=d1;var tte="TooltipArrow",nte=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=J3(n);return aEe(tte,n).isInside?null:l.jsx(P3,{...r,...s,ref:t})});nte.displayName=tte;function cEe(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,s,r,i)){case i:return"left";case r:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function uEe(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function dEe(e){const{top:t,right:n,bottom:s,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:s},{x:r,y:s}]}function hEe(e,t){const{x:n,y:s}=e;let r=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const a=t[i],c=t[o],u=a.x,d=a.y,h=c.x,m=c.y;d>s!=m>s&&n<(h-u)*(s-d)/(m-d)+u&&(r=!r)}return r}function fEe(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),mEe(t)}function mEe(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const r=e[s];for(;t.length>=2;){const i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(r.y-o.y)>=(i.y-o.y)*(r.x-o.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const r=e[s];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(r.y-o.y)>=(i.y-o.y)*(r.x-o.x))n.pop();else break}n.push(r)}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 ste=Yee,rte=Xee,ite=Qee,ote=Jee,ate=Zee,pEe=nte;const gEe=(e,t)=>{const n=new Array(e.length+t.length);for(let s=0;s<e.length;s++)n[s]=e[s];for(let s=0;s<t.length;s++)n[e.length+s]=t[s];return n},bEe=(e,t)=>({classGroupId:e,validator:t}),lte=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),DS="-",L$=[],yEe="arbitrary..",xEe=e=>{const t=wEe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return vEe(o);const a=o.split(DS),c=a[0]===""&&a.length>1?1:0;return cte(a,c,t)},getConflictingClassGroupIds:(o,a)=>{if(a){const c=s[o],u=n[o];return c?u?gEe(u,c):c:u||L$}return n[o]||L$}}},cte=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],i=n.nextPart.get(r);if(i){const u=cte(e,t+1,i);if(u)return u}const o=n.validators;if(o===null)return;const a=t===0?e.join(DS):e.slice(t).join(DS),c=o.length;for(let u=0;u<c;u++){const d=o[u];if(d.validator(a))return d.classGroupId}},vEe=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),s=t.slice(0,n);return s?yEe+s:void 0})(),wEe=e=>{const{theme:t,classGroups:n}=e;return kEe(n,t)},kEe=(e,t)=>{const n=lte();for(const s in e){const r=e[s];$M(r,n,s,t)}return n},$M=(e,t,n,s)=>{const r=e.length;for(let i=0;i<r;i++){const o=e[i];_Ee(o,t,n,s)}},_Ee=(e,t,n,s)=>{if(typeof e=="string"){SEe(e,t,n);return}if(typeof e=="function"){CEe(e,t,n,s);return}TEe(e,t,n,s)},SEe=(e,t,n)=>{const s=e===""?t:ute(t,e);s.classGroupId=n},CEe=(e,t,n,s)=>{if(EEe(e)){$M(e(s),t,n,s);return}t.validators===null&&(t.validators=[]),t.validators.push(bEe(n,e))},TEe=(e,t,n,s)=>{const r=Object.entries(e),i=r.length;for(let o=0;o<i;o++){const[a,c]=r[o];$M(c,ute(t,a),n,s)}},ute=(e,t)=>{let n=e;const s=t.split(DS),r=s.length;for(let i=0;i<r;i++){const o=s[i];let a=n.nextPart.get(o);a||(a=lte(),n.nextPart.set(o,a)),n=a}return n},EEe=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,AEe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),s=Object.create(null);const r=(i,o)=>{n[i]=o,t++,t>e&&(t=0,s=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=s[i])!==void 0)return r(i,o),o},set(i,o){i in n?n[i]=o:r(i,o)}}},eA="!",P$=":",NEe=[],O$=(e,t,n,s,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:s,isExternal:r}),jEe=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=r=>{const i=[];let o=0,a=0,c=0,u;const d=r.length;for(let b=0;b<d;b++){const v=r[b];if(o===0&&a===0){if(v===P$){i.push(r.slice(c,b)),c=b+1;continue}if(v==="/"){u=b;continue}}v==="["?o++:v==="]"?o--:v==="("?a++:v===")"&&a--}const h=i.length===0?r:r.slice(c);let m=h,p=!1;h.endsWith(eA)?(m=h.slice(0,-1),p=!0):h.startsWith(eA)&&(m=h.slice(1),p=!0);const g=u&&u>c?u-c:void 0;return O$(i,p,m,g)};if(t){const r=t+P$,i=s;s=o=>o.startsWith(r)?i(o.slice(r.length)):O$(NEe,!1,o,void 0,!0)}if(n){const r=s;s=i=>n({className:i,parseClassName:r})}return s},MEe=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,s)=>{t.set(n,1e6+s)}),n=>{const s=[];let r=[];for(let i=0;i<n.length;i++){const o=n[i],a=o[0]==="[",c=t.has(o);a||c?(r.length>0&&(r.sort(),s.push(...r),r=[]),s.push(o)):r.push(o)}return r.length>0&&(r.sort(),s.push(...r)),s}},IEe=e=>({cache:AEe(e.cacheSize),parseClassName:jEe(e),sortModifiers:MEe(e),postfixLookupClassGroupIds:REe(e),...xEe(e)}),REe=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let s=0;s<n.length;s++)t[n[s]]=!0;return t},DEe=/\s+/,LEe=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:i,postfixLookupClassGroupIds:o}=t,a=[],c=e.trim().split(DEe);let u="";for(let d=c.length-1;d>=0;d-=1){const h=c[d],{isExternal:m,modifiers:p,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:v}=n(h);if(m){u=h+(u.length>0?" "+u:u);continue}let x=!!v,y;if(x){const C=b.substring(0,v);y=s(C);const S=y&&o[y]?s(b):void 0;S&&S!==y&&(y=S,x=!1)}else y=s(b);if(!y){if(!x){u=h+(u.length>0?" "+u:u);continue}if(y=s(b),!y){u=h+(u.length>0?" "+u:u);continue}x=!1}const w=p.length===0?"":p.length===1?p[0]:i(p).join(":"),k=g?w+eA:w,T=k+y;if(a.indexOf(T)>-1)continue;a.push(T);const _=r(y,x);for(let C=0;C<_.length;++C){const S=_[C];a.push(k+S)}u=h+(u.length>0?" "+u:u)}return u},PEe=(...e)=>{let t=0,n,s,r="";for(;t<e.length;)(n=e[t++])&&(s=dte(n))&&(r&&(r+=" "),r+=s);return r},dte=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=dte(e[s]))&&(n&&(n+=" "),n+=t);return n},OEe=(e,...t)=>{let n,s,r,i;const o=c=>{const u=t.reduce((d,h)=>h(d),e());return n=IEe(u),s=n.cache.get,r=n.cache.set,i=a,a(c)},a=c=>{const u=s(c);if(u)return u;const d=LEe(c,n);return r(c,d),d};return i=o,(...c)=>i(PEe(...c))},BEe=[],Yi=e=>{const t=n=>n[e]||BEe;return t.isThemeGetter=!0,t},hte=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fte=/^\((?:(\w[\w-]*):)?(.+)\)$/i,$Ee=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,zEe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,FEe=/\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$/,HEe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,qEe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,UEe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Rh=e=>$Ee.test(e),ks=e=>!!e&&!Number.isNaN(Number(e)),ru=e=>!!e&&Number.isInteger(Number(e)),f6=e=>e.endsWith("%")&&ks(e.slice(0,-1)),hd=e=>zEe.test(e),mte=()=>!0,VEe=e=>FEe.test(e)&&!HEe.test(e),zM=()=>!1,WEe=e=>qEe.test(e),GEe=e=>UEe.test(e),KEe=e=>!gn(e)&&!yn(e),YEe=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)),XEe=e=>pm(e,bte,zM),gn=e=>hte.test(e),$m=e=>pm(e,yte,VEe),B$=e=>pm(e,rAe,ks),QEe=e=>pm(e,vte,mte),JEe=e=>pm(e,xte,zM),$$=e=>pm(e,pte,zM),ZEe=e=>pm(e,gte,GEe),jk=e=>pm(e,wte,WEe),yn=e=>fte.test(e),Qb=e=>l0(e,yte),eAe=e=>l0(e,xte),z$=e=>l0(e,pte),tAe=e=>l0(e,bte),nAe=e=>l0(e,gte),Mk=e=>l0(e,wte,!0),sAe=e=>l0(e,vte,!0),pm=(e,t,n)=>{const s=hte.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},l0=(e,t,n=!1)=>{const s=fte.exec(e);return s?s[1]?t(s[1]):n:!1},pte=e=>e==="position"||e==="percentage",gte=e=>e==="image"||e==="url",bte=e=>e==="length"||e==="size"||e==="bg-size",yte=e=>e==="length",rAe=e=>e==="number",xte=e=>e==="family-name",vte=e=>e==="number"||e==="weight",wte=e=>e==="shadow",iAe=()=>{const e=Yi("color"),t=Yi("font"),n=Yi("text"),s=Yi("font-weight"),r=Yi("tracking"),i=Yi("leading"),o=Yi("breakpoint"),a=Yi("container"),c=Yi("spacing"),u=Yi("radius"),d=Yi("shadow"),h=Yi("inset-shadow"),m=Yi("text-shadow"),p=Yi("drop-shadow"),g=Yi("blur"),b=Yi("perspective"),v=Yi("aspect"),x=Yi("ease"),y=Yi("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(),yn,gn],_=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],S=()=>[yn,gn,c],L=()=>[Rh,"full","auto",...S()],N=()=>[ru,"none","subgrid",yn,gn],$=()=>["auto",{span:["full",ru,yn,gn]},ru,yn,gn],M=()=>[ru,"auto",yn,gn],P=()=>["auto","min","max","fr",yn,gn],E=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],O=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...S()],F=()=>[Rh,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],B=()=>[Rh,"screen","full","dvw","lvw","svw","min","max","fit",...S()],W=()=>[Rh,"screen","full","lh","dvh","lvh","svh","min","max","fit",...S()],I=()=>[e,yn,gn],Y=()=>[...k(),z$,$$,{position:[yn,gn]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],j=()=>["auto","cover","contain",tAe,XEe,{size:[yn,gn]}],ee=()=>[f6,Qb,$m],se=()=>["","none","full",u,yn,gn],X=()=>["",ks,Qb,$m],Q=()=>["solid","dashed","dotted","double"],ue=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>[ks,f6,z$,$$],J=()=>["","none",g,yn,gn],q=()=>["none",ks,yn,gn],Z=()=>["none",ks,yn,gn],he=()=>[ks,yn,gn],ye=()=>[Rh,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[hd],breakpoint:[hd],color:[mte],container:[hd],"drop-shadow":[hd],ease:["in","out","in-out"],font:[KEe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[hd],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[hd],shadow:[hd],spacing:["px",ks],text:[hd],"text-shadow":[hd],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Rh,gn,yn,v]}],container:["container"],"container-type":[{"@container":["","normal","size",yn,gn]}],"container-named":[YEe],columns:[{columns:[ks,gn,yn,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:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{"inset-s":L(),start:L()}],end:[{"inset-e":L(),end:L()}],"inset-bs":[{"inset-bs":L()}],"inset-be":[{"inset-be":L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[ru,"auto",yn,gn]}],basis:[{basis:[Rh,"full","auto",a,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ks,Rh,"auto","initial","none",gn]}],grow:[{grow:["",ks,yn,gn]}],shrink:[{shrink:["",ks,yn,gn]}],order:[{order:[ru,"first","last","none",yn,gn]}],"grid-cols":[{"grid-cols":N()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":N()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":P()}],"auto-rows":[{"auto-rows":P()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...E(),"normal"]}],"justify-items":[{"justify-items":[...O(),"normal"]}],"justify-self":[{"justify-self":["auto",...O()]}],"align-content":[{content:["normal",...E()]}],"align-items":[{items:[...O(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...O(),{baseline:["","last"]}]}],"place-content":[{"place-content":E()}],"place-items":[{"place-items":[...O(),"baseline"]}],"place-self":[{"place-self":["auto",...O()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pbs:[{pbs:S()}],pbe:[{pbe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],"inline-size":[{inline:["auto",...B()]}],"min-inline-size":[{"min-inline":["auto",...B()]}],"max-inline-size":[{"max-inline":["none",...B()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[a,"screen",...F()]}],"min-w":[{"min-w":[a,"screen","none",...F()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",n,Qb,$m]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,sAe,QEe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",f6,gn]}],"font-family":[{font:[eAe,JEe,t]}],"font-features":[{"font-features":[gn]}],"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:[r,yn,gn]}],"line-clamp":[{"line-clamp":[ks,"none",yn,B$]}],leading:[{leading:[i,...S()]}],"list-image":[{"list-image":["none",yn,gn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",yn,gn]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Q(),"wavy"]}],"text-decoration-thickness":[{decoration:[ks,"from-font","auto",yn,$m]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[ks,"auto",yn,gn]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"tab-size":[{tab:[ru,yn,gn]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",yn,gn]}],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",yn,gn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Y()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:j()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ru,yn,gn],radial:["",yn,gn],conic:[ru,yn,gn]},nAe,ZEe]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:se()}],"rounded-s":[{"rounded-s":se()}],"rounded-e":[{"rounded-e":se()}],"rounded-t":[{"rounded-t":se()}],"rounded-r":[{"rounded-r":se()}],"rounded-b":[{"rounded-b":se()}],"rounded-l":[{"rounded-l":se()}],"rounded-ss":[{"rounded-ss":se()}],"rounded-se":[{"rounded-se":se()}],"rounded-ee":[{"rounded-ee":se()}],"rounded-es":[{"rounded-es":se()}],"rounded-tl":[{"rounded-tl":se()}],"rounded-tr":[{"rounded-tr":se()}],"rounded-br":[{"rounded-br":se()}],"rounded-bl":[{"rounded-bl":se()}],"border-w":[{border:X()}],"border-w-x":[{"border-x":X()}],"border-w-y":[{"border-y":X()}],"border-w-s":[{"border-s":X()}],"border-w-e":[{"border-e":X()}],"border-w-bs":[{"border-bs":X()}],"border-w-be":[{"border-be":X()}],"border-w-t":[{"border-t":X()}],"border-w-r":[{"border-r":X()}],"border-w-b":[{"border-b":X()}],"border-w-l":[{"border-l":X()}],"divide-x":[{"divide-x":X()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":X()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Q(),"hidden","none"]}],"divide-style":[{divide:[...Q(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...Q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ks,yn,gn]}],"outline-w":[{outline:["",ks,Qb,$m]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",d,Mk,jk]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",h,Mk,jk]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[ks,$m]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":X()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",m,Mk,jk]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[ks,yn,gn]}],"mix-blend":[{"mix-blend":[...ue(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ue()}],"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":[ks]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[yn,gn]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":[ks]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Y()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:j()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",yn,gn]}],filter:[{filter:["","none",yn,gn]}],blur:[{blur:J()}],brightness:[{brightness:[ks,yn,gn]}],contrast:[{contrast:[ks,yn,gn]}],"drop-shadow":[{"drop-shadow":["","none",p,Mk,jk]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",ks,yn,gn]}],"hue-rotate":[{"hue-rotate":[ks,yn,gn]}],invert:[{invert:["",ks,yn,gn]}],saturate:[{saturate:[ks,yn,gn]}],sepia:[{sepia:["",ks,yn,gn]}],"backdrop-filter":[{"backdrop-filter":["","none",yn,gn]}],"backdrop-blur":[{"backdrop-blur":J()}],"backdrop-brightness":[{"backdrop-brightness":[ks,yn,gn]}],"backdrop-contrast":[{"backdrop-contrast":[ks,yn,gn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ks,yn,gn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ks,yn,gn]}],"backdrop-invert":[{"backdrop-invert":["",ks,yn,gn]}],"backdrop-opacity":[{"backdrop-opacity":[ks,yn,gn]}],"backdrop-saturate":[{"backdrop-saturate":[ks,yn,gn]}],"backdrop-sepia":[{"backdrop-sepia":["",ks,yn,gn]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",yn,gn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ks,"initial",yn,gn]}],ease:[{ease:["linear","initial",x,yn,gn]}],delay:[{delay:[ks,yn,gn]}],animate:[{animate:["none",y,yn,gn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,yn,gn]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:q()}],"rotate-x":[{"rotate-x":q()}],"rotate-y":[{"rotate-y":q()}],"rotate-z":[{"rotate-z":q()}],scale:[{scale:Z()}],"scale-x":[{"scale-x":Z()}],"scale-y":[{"scale-y":Z()}],"scale-z":[{"scale-z":Z()}],"scale-3d":["scale-3d"],skew:[{skew:he()}],"skew-x":[{"skew-x":he()}],"skew-y":[{"skew-y":he()}],transform:[{transform:[yn,gn,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ye()}],"translate-x":[{"translate-x":ye()}],"translate-y":[{"translate-y":ye()}],"translate-z":[{"translate-z":ye()}],"translate-none":["translate-none"],zoom:[{zoom:[ru,yn,gn]}],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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",yn,gn]}],"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":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mbs":[{"scroll-mbs":S()}],"scroll-mbe":[{"scroll-mbe":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pbs":[{"scroll-pbs":S()}],"scroll-pbe":[{"scroll-pbe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"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",yn,gn]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[ks,Qb,$m,B$]}],stroke:[{stroke:["none",...I()]}],"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"]}},oAe=OEe(iAe);function Wt(...e){return oAe(vQ(e))}const aAe=i0("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"}}),qn=f.forwardRef(function({className:t,variant:n="default",size:s="default",asChild:r=!1,...i},o){const a=r?eM:"button";return l.jsx(a,{ref:o,"data-slot":"button","data-variant":n,"data-size":s,className:Wt(aAe({variant:n,size:s,className:t})),...i})}),F$=f.forwardRef(function({className:t,...n},s){return l.jsx(sJ,{ref:s,"data-slot":"checkbox",className:Wt("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 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-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",t),...n,children:l.jsx(iJ,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:l.jsx(ZN,{})})})});function h1({...e}){return l.jsx(sM,{"data-slot":"dialog",...e})}function lAe({container:e,...t}){const n=oh();return l.jsx(iM,{"data-slot":"dialog-portal",container:e??n??void 0,...t})}function tA({...e}){return l.jsx(J1,{"data-slot":"dialog-close",...e})}const cAe=f.forwardRef(function({className:t,...n},s){return l.jsx(oM,{ref:s,"data-slot":"dialog-overlay",className:Wt("fixed inset-0 isolate z-[var(--web-shell-dialog-backdrop-z-index,50)] bg-black/10 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...n})}),f1=f.forwardRef(function({className:t,children:n,showCloseButton:s=!0,overlayProps:r,...i},o){return l.jsxs(lAe,{children:[l.jsx(cAe,{...r}),l.jsxs(aM,{ref:o,"data-slot":"dialog-content",className:Wt("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,s&&l.jsx(J1,{"data-slot":"dialog-close",asChild:!0,children:l.jsxs(qn,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm",children:[l.jsx(J4,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})})]})]})});function m1({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-header",className:Wt("flex flex-col gap-2",e),...t})}function p1({className:e,showCloseButton:t=!1,children:n,...s}){return l.jsxs("div",{"data-slot":"dialog-footer",className:Wt("-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),...s,children:[n,t&&l.jsx(J1,{asChild:!0,children:l.jsx(qn,{variant:"outline",children:"Close"})})]})}function g1({className:e,...t}){return l.jsx(lM,{"data-slot":"dialog-title",className:Wt("text-base leading-none font-medium",e),...t})}function qx({className:e,...t}){return l.jsx(cM,{"data-slot":"dialog-description",className:Wt("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const ri=f.forwardRef(function({className:t,type:n,...s},r){return l.jsx("input",{ref:r,type:n,"data-slot":"input",className:Wt("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),...s})});function nA({className:e,...t}){return l.jsx(B8e,{"data-slot":"label",className:Wt("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 Ux({...e}){return l.jsx(K8e,{"data-slot":"popover",...e})}const LS=f.forwardRef(function(t,n){return l.jsx(X8e,{ref:n,"data-slot":"popover-trigger",...t})}),Vx=f.forwardRef(function({className:t,align:n="center",sideOffset:s=4,...r},i){const o=oh();return l.jsx(Q8e,{container:o??void 0,children:l.jsx(J8e,{ref:i,"data-slot":"popover-content",align:n,sideOffset:s,className:Wt("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),...r})})}),H$=f.forwardRef(function(t,n){return l.jsx(Y8e,{ref:n,"data-slot":"popover-anchor",...t})});function uAe({className:e,...t}){return l.jsx("div",{"data-slot":"popover-header",className:Wt("flex flex-col gap-0.5 text-sm",e),...t})}function dAe({className:e,...t}){return l.jsx("div",{"data-slot":"popover-title",className:Wt("font-medium",e),...t})}function Hf({...e}){return l.jsx(VZ,{"data-slot":"select",...e})}function FM({className:e,...t}){return l.jsx(oee,{"data-slot":"select-group",className:Wt("scroll-my-1 p-1",e),...t})}function qf({...e}){return l.jsx(YZ,{"data-slot":"select-value",...e})}const Uf=f.forwardRef(function({className:t,size:n="default",children:s,...r},i){return l.jsxs(GZ,{ref:i,"data-slot":"select-trigger","data-size":n,className:Wt("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),...r,children:[s,l.jsx(XZ,{asChild:!0,children:l.jsx(Ql,{className:"pointer-events-none size-4 text-muted-foreground"})})]})});function Vf({className:e,children:t,position:n="item-aligned",align:s="center",...r}){const i=oh();return l.jsx(JZ,{container:i??void 0,children:l.jsxs(ZZ,{"data-slot":"select-content","data-align-trigger":n==="item-aligned",className:Wt("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:s,...r,children:[l.jsx(hAe,{}),l.jsx(ree,{"data-position":n,className:Wt("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}),l.jsx(fAe,{})]})})}function Nl({className:e,children:t,...n}){return l.jsxs(cee,{"data-slot":"select-item",className:Wt("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:[l.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:l.jsx(hee,{children:l.jsx(ZN,{className:"pointer-events-none"})})}),l.jsx(uee,{children:t})]})}function hAe({className:e,...t}){return l.jsx(fee,{"data-slot":"select-scroll-up-button",className:Wt("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:l.jsx(bpe,{})})}function fAe({className:e,...t}){return l.jsx(mee,{"data-slot":"select-scroll-down-button",className:Wt("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:l.jsx(Ql,{})})}const mAe="_tableShell_ysf4j_1",pAe="_densityCompact_ysf4j_11",gAe="_densityStandard_ysf4j_21",bAe="_densityComfortable_ysf4j_29",yAe="_toolbar_ysf4j_37",xAe="_summary_ysf4j_48",vAe="_hint_ysf4j_53",wAe="_selection_ysf4j_57",kAe="_selectionStats_ysf4j_62",_Ae="_selectionMetric_ysf4j_70",SAe="_selectionMetricValue_ysf4j_74",CAe="_copyButton_ysf4j_80",TAe="_copyCheck_ysf4j_90",EAe="_scroller_ysf4j_98",AAe="_table_ysf4j_1",NAe="_headerCell_ysf4j_120",jAe="_cell_ysf4j_121",MAe="_frozenHeaderCell_ysf4j_144",IAe="_headerControls_ysf4j_149",RAe="_headerButton_ysf4j_155",DAe="_filterTrigger_ysf4j_172",LAe="_headerText_ysf4j_176",PAe="_sortIcon_ysf4j_183",OAe="_activeHeaderCell_ysf4j_199",BAe="_reorderHandle_ysf4j_203",$Ae="_reorderHandleVisible_ysf4j_226",zAe="_resizeHandle_ysf4j_246",FAe="_filterTriggerActive_ysf4j_265",HAe="_columnContextMenu_ysf4j_270",qAe="_columnContextMenuAction_ysf4j_283",UAe="_cellContent_ysf4j_315",VAe="_detailValueContent_ysf4j_316",WAe="_cellText_ysf4j_322",GAe="_detailValueText_ysf4j_323",KAe="_cellContentCollapsed_ysf4j_329",YAe="_detailValueCollapsed_ysf4j_330",XAe="_dragging_ysf4j_337",QAe="_evenRow_ysf4j_341",JAe="_selectedCell_ysf4j_349",ZAe="_actionHeaderCell_ysf4j_356",e9e="_actionCell_ysf4j_357",t9e="_stickyActionHeaderCell_ysf4j_365",n9e="_stickyActionCell_ysf4j_366",s9e="_frozenCell_ysf4j_382",r9e="_hasFrozenColumn_ysf4j_388",i9e="_rowDetailButton_ysf4j_435",o9e="_detailRow_ysf4j_450",a9e="_detailCell_ysf4j_454",l9e="_detailPanel_ysf4j_461",c9e="_detailTitle_ysf4j_467",u9e="_detailItem_ysf4j_472",d9e="_detailLabel_ysf4j_479",h9e="_detailValue_ysf4j_316",f9e="_emptyValue_ysf4j_494",m9e="_emptyState_ysf4j_499",Xt={tableShell:mAe,densityCompact:pAe,densityStandard:gAe,densityComfortable:bAe,toolbar:yAe,summary:xAe,hint:vAe,selection:wAe,selectionStats:kAe,selectionMetric:_Ae,selectionMetricValue:SAe,copyButton:CAe,copyCheck:TAe,scroller:EAe,table:AAe,headerCell:NAe,cell:jAe,frozenHeaderCell:MAe,headerControls:IAe,headerButton:RAe,filterTrigger:DAe,headerText:LAe,sortIcon:PAe,activeHeaderCell:OAe,reorderHandle:BAe,reorderHandleVisible:$Ae,resizeHandle:zAe,filterTriggerActive:FAe,columnContextMenu:HAe,columnContextMenuAction:qAe,cellContent:UAe,detailValueContent:VAe,cellText:WAe,detailValueText:GAe,cellContentCollapsed:KAe,detailValueCollapsed:YAe,dragging:XAe,evenRow:QAe,selectedCell:JAe,actionHeaderCell:ZAe,actionCell:e9e,stickyActionHeaderCell:t9e,stickyActionCell:n9e,frozenCell:s9e,hasFrozenColumn:r9e,rowDetailButton:i9e,detailRow:o9e,detailCell:a9e,detailPanel:l9e,detailTitle:c9e,detailItem:u9e,detailLabel:d9e,detailValue:h9e,emptyValue:f9e,emptyState:m9e},p9e={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"},g9e={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"},b9e=500,y9e=50,Cf=160,kte=80,_te=640,q$=16,Ste="application/x-qwen-web-shell-table-column",x9e=60,v9e=3,m6=["standard","compact","comfortable"],w9e={width:Cf,minWidth:Cf,maxWidth:Cf},k9e={width:"auto"};function U$(e){return Math.min(_te,Math.max(kte,e))}function p6(e){return e instanceof Element&&!!e.closest('a, button, input, textarea, select, [contenteditable="true"]')}function _9e(){const e=document.getSelection();return!!(e&&!e.isCollapsed)}function dp(e,t){return f.isValidElement(e)&&e.type===t}function S9e(e){return e.replace(/\s+/g," ").trim()}function g6(e){return e.length>x9e||e.split(/\r\n|\r|\n/).length>v9e}function C9e(e){const t=m6.indexOf(e);return m6[(t+1)%m6.length]??"standard"}function T9e(e){switch(e){case"compact":return Xt.densityCompact;case"comfortable":return Xt.densityComfortable;case"standard":default:return Xt.densityStandard}}function sA(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(sA).join(""):f.isValidElement(e)?e.type==="img"?e.props.alt??"":sA(e.props.children):""}function E9e(e,t){return{key:`${e}-empty-${t}`,content:"",text:"",rawText:"",isHeader:!1}}function Cte(e,t){const n=f.Children.toArray(e.props.children).filter(s=>dp(s,"td")||dp(s,"th"));return{key:t,cells:n.map((s,r)=>{var o;const i=sA(s.props.children);return{key:`${t}-${r}`,content:s.props.children,text:S9e(i),rawText:i,isHeader:s.type==="th",textAlign:(o=s.props.style)==null?void 0:o.textAlign}})}}function b6(e,t){return f.Children.toArray(e.props.children).filter(n=>dp(n,"tr")).map((n,s)=>Cte(n,`${t}-${s}`))}function A9e(e,t){return{...e,cells:Array.from({length:t},(n,s)=>e.cells[s]??E9e(e.key,s))}}function N9e(e,t){const n=f.Children.toArray(e),s=[],r=[],i=[];if(n.forEach((d,h)=>{dp(d,"thead")?s.push(...b6(d,`head-${h}`)):dp(d,"tbody")?r.push(...b6(d,`body-${h}`)):dp(d,"tfoot")?r.push(...b6(d,`foot-${h}`)):dp(d,"tr")&&i.push(Cte(d,`row-${h}`))}),i.length>0){const[d,...h]=i;d!=null&&d.cells.some(m=>m.isHeader)?(s.push(d),r.push(...h)):r.push(...i)}const o=[...s,...r],a=Math.max(0,...o.map(d=>d.cells.length)),c=s[0];return{headers:Array.from({length:a},(d,h)=>{const m=c==null?void 0:c.cells[h];if(m)return m;const p=t(h);return{key:`header-${h}`,content:p,text:p,rawText:p,isHeader:!0}}),rows:r.map(d=>A9e(d,a)),columnCount:a}}function $d(e){const t=e.trim(),n=t.endsWith("%"),r=(n?t.slice(0,-1):t).replace(/[$€£¥₹,\s]/g,"");if(!/^-?(\d+(\.\d+)?|\.\d+)$/.test(r))return null;const i=Number(r);return Number.isFinite(i)?n?i/100:i:null}function Tte(e,t){const n=$d(e),s=$d(t);return n!==null&&s!==null&&n!==s?n-s:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function PS(e){return{minRow:Math.min(e.anchorRow,e.focusRow),maxRow:Math.max(e.anchorRow,e.focusRow)}}function HM(e,t){if(!e)return[];const n=t.indexOf(e.anchorCol),s=t.indexOf(e.focusCol);if(n===-1||s===-1)return[];const r=Math.min(n,s),i=Math.max(n,s);return t.slice(r,i+1)}function OS(e){const t=e.replace(/[\u200B-\u200D\u2060\u00AD\uFEFF]/g,"").trimStart();return/^[=+\-@]/.test(t)?`'${e}`:e}function rA(e){return((e==null?void 0:e.rawText)??(e==null?void 0:e.text)??"").replace(/[\r\n\t]+/g," ")}function y6(e){return e.rawText||e.text}function V$(e,t,n){if((e[t]??Cf)===n)return e;if(n===Cf){const r={...e};return delete r[t],r}return{...e,[t]:n}}function W$(e,t,n){if(!e)return"";const{minRow:s,maxRow:r}=PS(e),i=HM(e,n);if(i.length===0)return"";const o=[];for(let a=s;a<=r;a++){const c=t[a];c&&o.push(i.map(u=>OS(rA(c.cells[u]))).join("	"))}return o.join(`
`)}function j9e(e,t,n){return n.length===0?"":[n.map(r=>OS(rA(e[r]))).join("	"),...t.map(r=>n.map(i=>OS(rA(r.cells[i]))).join("	"))].join(`
`)}function M9e(e,t,n){if(!e)return null;const{minRow:s,maxRow:r}=PS(e),i=HM(e,n);if(i.length===0)return null;let o=0,a=0,c=0,u=0,d=1/0,h=-1/0,m=!0,p=!0,g;for(let v=s;v<=r;v++){const x=t[v];x&&i.forEach(y=>{const w=x.cells[y];if(!w)return;o+=1;const k=w.text.trim();if(!k)return;a+=1;const T=$d(k);if(T===null)return;c+=1,u+=T,d=Math.min(d,T),h=Math.max(h,T),m=m&&k.endsWith("%");const _=k.match(/[$€£¥₹]/g),C=(_==null?void 0:_.length)===1?_[0]:void 0;C?g===void 0?g=C:g!==C&&(p=!1):p=!1})}if(o===0)return null;const b=c>0&&m?"percent":c>0&&p&&g?"currency":"number";return{selectedCount:o,nonEmptyCount:a,numericCount:c,sum:u,average:c>0?u/c:0,min:c>0?d:0,max:c>0?h:0,format:b,currencySymbol:g}}function Ik(e,t,n){const s=Object.is(e,-0)?0:e,r=n==="en"?"en-US":n;if(t.format==="percent")return new Intl.NumberFormat(r,{style:"percent",maximumFractionDigits:6}).format(s);const i=new Intl.NumberFormat(r,{maximumFractionDigits:6}).format(Math.abs(s));return t.format==="currency"&&t.currencySymbol?`${s<0?"-":""}${t.currencySymbol}${i}`:s<0?`-${i}`:i}function G$(e,t,n){if(t===n)return e;const s=e.indexOf(t),r=e.indexOf(n);if(s===-1||r===-1)return e;const i=[...e],[o]=i.splice(s,1);return o===void 0?e:(i.splice(r,0,o),i)}function I9e(e,t,n,s){if(s.size===0)return G$(e,t,n);const r=e.filter(a=>!s.has(a)),i=G$(r,t,n);if(i===r)return e;let o=0;return e.map(a=>{if(s.has(a))return a;const c=i[o];return o+=1,c??a})}function K$(e){return Array.from({length:e},(t,n)=>n)}function Y$(e){return Array.from(e.types).includes(Ste)}function tx(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 R9e(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=e.toLowerCase(),s=t.value.trim().toLowerCase();switch(t.operator){case"equals":return n===s;case"notEquals":return n!==s;case"startsWith":return n.startsWith(s);case"endsWith":return n.endsWith(s);case"contains":default:return n.includes(s)}}function D9e(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=$d(e),s=$d(t.value);if(n===null||s===null)return!1;switch(t.operator){case"gt":return n>s;case"gte":return n>=s;case"lt":return n<s;case"lte":return n<=s;case"between":{const r=$d(t.valueTo??"");if(r===null)return!1;const i=Math.min(s,r),o=Math.max(s,r);return n>=i&&n<=o}default:return!0}}function L9e(e,t){return t.selectedValues!==void 0&&!t.selectedValues.includes(e)?!1:R9e(e,t.textFilter)&&D9e(e,t.numberFilter)}function X$(e,t,n){const s=Object.entries(t).map(([r,i])=>[Number(r),i]).filter(([r,i])=>r!==n&&tx(i));return s.length===0?e:e.filter(r=>s.every(([i,o])=>{var a;return L9e(((a=r.cells[i])==null?void 0:a.text)??"",o)}))}function P9e(e,t){return t?e.map((n,s)=>({row:n,index:s})).sort((n,s)=>{var o,a;const r=Tte(((o=n.row.cells[t.columnIndex])==null?void 0:o.text)??"",((a=s.row.cells[t.columnIndex])==null?void 0:a.text)??""),i=t.direction==="asc"?r:-r;return i===0?n.index-s.index:i}).map(({row:n})=>n):e}function O9e(e,t,n){const s=new Map;return e.forEach(r=>{var o;const i=((o=r.cells[t])==null?void 0:o.text)??"";s.set(i,(s.get(i)??0)+1)}),Array.from(s.entries()).map(([r,i])=>({value:r,label:r||n,count:i})).sort((r,i)=>Tte(r.value,i.value))}function B9e(e,t){let n=0,s=0;return e.forEach(r=>{var o;const i=((o=r.cells[t])==null?void 0:o.text)??"";i&&(n+=1,$d(i)!==null&&(s+=1))}),n>0&&s/n>=.7}function $9e(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function z9e(e,t){var s,r,i;const n={};if(e.selectedValues!==void 0&&!$9e(e.selectedValues,t)&&(n.selectedValues=e.selectedValues),(s=e.textFilter)!=null&&s.value.trim()&&(n.textFilter={operator:e.textFilter.operator,value:e.textFilter.value.trim()}),(r=e.numberFilter)!=null&&r.value.trim()){const o=e.numberFilter.value.trim(),a=(i=e.numberFilter.valueTo)==null?void 0:i.trim();$d(o)!==null&&(e.numberFilter.operator!=="between"||$d(a??"")!==null)&&(n.numberFilter={operator:e.numberFilter.operator,value:o,valueTo:a})}return tx(n)?n:void 0}function F9e({columnIndex:e,sortedThisColumn:t,onSort:n}){const{t:s}=ot();return l.jsxs("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:[l.jsx(qn,{variant:"ghost",size:"sm",className:`w-full justify-start text-xs ${(t==null?void 0:t.direction)==="asc"?"bg-muted text-primary":""}`,type:"button",onClick:()=>n(e,"asc"),children:s("markdownTable.sort.asc")}),l.jsx(qn,{variant:"ghost",size:"sm",className:`w-full justify-start text-xs ${(t==null?void 0:t.direction)==="desc"?"bg-muted text-primary":""}`,type:"button",onClick:()=>n(e,"desc"),children:s("markdownTable.sort.desc")}),l.jsx(qn,{variant:"ghost",size:"sm",className:"w-full justify-start text-xs",type:"button",onClick:()=>n(e,null),children:s("markdownTable.sort.clear")})]})}function H9e({onHideColumn:e}){const{t}=ot();return l.jsx("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:l.jsx(qn,{variant:"ghost",size:"sm",className:"w-full justify-start text-xs",type:"button",onClick:e,children:t("markdownTable.hideColumn")})})}function q9e({columnIndex:e,columnName:t,search:n,searchInputRef:s,filteredOptions:r,visibleOptions:i,selectedValues:o,allFilteredSelected:a,onSearchChange:c,onFilteredSelectionChange:u,onToggleValue:d}){const{t:h}=ot();return l.jsxs("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:[l.jsx(ri,{ref:s,className:"h-7 text-xs",value:n,onChange:m=>c(m.currentTarget.value),placeholder:h("markdownTable.filter.searchPlaceholder"),name:`markdown-table-option-search-${e}`,"aria-label":h("markdownTable.filter.searchAria",{column:t})}),l.jsxs(nA,{htmlFor:`markdown-table-filter-all-${e}`,className:"min-h-7 cursor-pointer gap-2 px-1.5 py-1 text-xs font-normal hover:bg-muted",children:[l.jsx(F$,{id:`markdown-table-filter-all-${e}`,name:`markdown-table-filter-all-${e}`,"data-name":`markdown-table-filter-all-${e}`,checked:a,onCheckedChange:m=>u(m===!0)}),l.jsx("span",{children:h("markdownTable.filter.selectVisible")}),l.jsx("span",{className:"ml-auto text-muted-foreground tabular-nums",children:r.length})]}),l.jsxs("div",{className:"max-h-[170px] overflow-auto rounded-md border bg-muted/50",children:[i.map((m,p)=>l.jsxs(nA,{htmlFor:`markdown-table-filter-option-${e}-${p}`,className:"min-h-7 cursor-pointer gap-2 px-1.5 py-1 text-xs font-normal hover:bg-muted",children:[l.jsx(F$,{id:`markdown-table-filter-option-${e}-${p}`,name:`markdown-table-filter-option-${e}-${p}`,"data-name":`markdown-table-filter-option-${e}-${p}`,checked:o.has(m.value),onCheckedChange:()=>d(m.value)}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:m.label}),l.jsx("span",{className:"ml-auto text-muted-foreground tabular-nums",children:m.count})]},m.value)),r.length>i.length&&l.jsx("div",{className:"p-2 text-center text-muted-foreground",children:h("markdownTable.filter.optionLimit",{count:i.length})}),r.length===0&&l.jsx("div",{className:"p-2 text-center text-muted-foreground",children:h("markdownTable.filter.noOptions")})]})]})}function U9e({overlayId:e,columnIndex:t,columnName:n,isNumeric:s,textOperator:r,textValue:i,numberOperator:o,numberValue:a,numberValueTo:c,onTextOperatorChange:u,onTextValueChange:d,onNumberOperatorChange:h,onNumberValueChange:m,onNumberValueToChange:p}){const{t:g}=ot();return l.jsxs("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:[l.jsx("div",{className:"font-semibold text-muted-foreground",children:g("markdownTable.filter.custom")}),s?l.jsxs(l.Fragment,{children:[l.jsxs(Hf,{value:o,name:`markdown-table-number-operator-${t}`,onValueChange:b=>h(b),children:[l.jsx(Uf,{size:"sm",className:"w-full text-xs","data-name":`markdown-table-number-operator-${t}`,"aria-label":g("markdownTable.filter.numberAria",{column:n}),children:l.jsx(qf,{})}),l.jsx(Vf,{"data-markdown-table-filter-owner":e,className:"z-[calc(var(--web-shell-popover-z-index,1000)+1)]",children:Object.entries(g9e).map(([b,v])=>l.jsx(Nl,{value:b,"data-value":b,className:"text-xs",children:g(v)},b))})]}),l.jsxs("div",{className:"flex gap-1.5",children:[l.jsx(ri,{className:"h-7 text-xs",value:a,onChange:b=>m(b.currentTarget.value),placeholder:g("markdownTable.filter.numberPlaceholder"),name:`markdown-table-number-filter-${t}`}),o==="between"&&l.jsx(ri,{className:"h-7 text-xs",value:c,onChange:b=>p(b.currentTarget.value),placeholder:g("markdownTable.filter.toPlaceholder"),name:`markdown-table-number-filter-to-${t}`})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs(Hf,{value:r,name:`markdown-table-text-operator-${t}`,onValueChange:b=>u(b),children:[l.jsx(Uf,{size:"sm",className:"w-full text-xs","data-name":`markdown-table-text-operator-${t}`,"aria-label":g("markdownTable.filter.textAria",{column:n}),children:l.jsx(qf,{})}),l.jsx(Vf,{"data-markdown-table-filter-owner":e,className:"z-[calc(var(--web-shell-popover-z-index,1000)+1)]",children:Object.entries(p9e).map(([b,v])=>l.jsx(Nl,{value:b,"data-value":b,className:"text-xs",children:g(v)},b))})]}),l.jsx(ri,{className:"h-7 text-xs",value:i,onChange:b=>d(b.currentTarget.value),placeholder:g("markdownTable.filter.textPlaceholder"),name:`markdown-table-text-filter-${t}`})]})]})}function V9e({onClear:e,onClose:t,onApply:n}){const{t:s}=ot();return l.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-2",children:[l.jsx(qn,{variant:"outline",size:"sm",type:"button",onClick:e,children:s("markdownTable.filter.reset")}),l.jsx("span",{className:"flex-1"}),l.jsx(qn,{variant:"outline",size:"sm",type:"button",onClick:t,children:s("markdownTable.filter.cancel")}),l.jsx(qn,{size:"sm",type:"button",onClick:n,children:s("markdownTable.filter.confirm")})]})}function W9e({id:e,columnName:t,columnIndex:n,filter:s,isNumeric:r,options:i,sort:o,canHideColumn:a,onApply:c,onClose:u,onHideColumn:d,onSort:h}){var I,Y,V,j,ee;const m=f.useMemo(()=>i.map(se=>se.value),[i]),[p,g]=f.useState(""),[b,v]=f.useState(()=>new Set((s==null?void 0:s.selectedValues)??m)),[x,y]=f.useState(((I=s==null?void 0:s.textFilter)==null?void 0:I.operator)??"contains"),[w,k]=f.useState(((Y=s==null?void 0:s.textFilter)==null?void 0:Y.value)??""),[T,_]=f.useState(((V=s==null?void 0:s.numberFilter)==null?void 0:V.operator)??"gt"),[C,S]=f.useState(((j=s==null?void 0:s.numberFilter)==null?void 0:j.value)??""),[L,N]=f.useState(((ee=s==null?void 0:s.numberFilter)==null?void 0:ee.valueTo)??""),$=f.useRef(null);f.useEffect(()=>{var se;(se=$.current)==null||se.focus()},[]);const M=f.useMemo(()=>{const se=p.trim().toLowerCase();return se?i.filter(X=>X.label.toLowerCase().includes(se)):i},[i,p]),P=M.slice(0,500),E=M.length>0&&M.every(se=>b.has(se.value)),O=se=>{v(X=>{const Q=new Set(X);return M.forEach(ue=>{se?Q.add(ue.value):Q.delete(ue.value)}),Q})},z=se=>{v(X=>{const Q=new Set(X);return Q.has(se)?Q.delete(se):Q.add(se),Q})},F=()=>{c(n,z9e({selectedValues:Array.from(b),textFilter:{operator:x,value:w},numberFilter:{operator:T,value:C,valueTo:L}},m))},B=()=>{c(n,void 0)},W=(o==null?void 0:o.columnIndex)===n?o:null;return l.jsxs(Vx,{id:e,"data-markdown-table-filter-owner":e,align:"end",sideOffset:2,collisionPadding:6,onCloseAutoFocus:se=>{document.activeElement&&document.activeElement!==document.body&&se.preventDefault()},className:"max-h-[min(430px,calc(100vh-16px))] w-[300px] max-w-[80vw] gap-0 overflow-auto p-0 text-xs",role:"dialog","aria-labelledby":`${e}-title`,children:[l.jsx(uAe,{className:"border-b px-2.5 py-2",children:l.jsx(dAe,{id:`${e}-title`,className:"truncate text-xs font-bold",children:t})}),l.jsx(F9e,{columnIndex:n,sortedThisColumn:W,onSort:h}),a&&l.jsx(H9e,{onHideColumn:()=>d(n)}),l.jsx(q9e,{columnIndex:n,columnName:t,search:p,searchInputRef:$,filteredOptions:M,visibleOptions:P,selectedValues:b,allFilteredSelected:E,onSearchChange:g,onFilteredSelectionChange:O,onToggleValue:z}),l.jsx(U9e,{overlayId:e,columnIndex:n,columnName:t,isNumeric:r,textOperator:x,textValue:w,numberOperator:T,numberValue:C,numberValueTo:L,onTextOperatorChange:y,onTextValueChange:k,onNumberOperatorChange:_,onNumberValueChange:S,onNumberValueToChange:N}),l.jsx(V9e,{onClear:B,onClose:u,onApply:F})]})}function G9e({children:e,fallback:t,toolbarExtra:n}){const{t:s}=ot(),r=f.useMemo(()=>N9e(e,i=>s("markdownTable.column",{index:i+1})),[e,s]);return r.columnCount===0?l.jsx(l.Fragment,{children:t??l.jsx("table",{children:e})}):r.rows.length>b9e||r.columnCount>y9e?l.jsx(l.Fragment,{children:t??l.jsx("table",{children:e})}):l.jsx(K9e,{table:r,toolbarExtra:n})}function K9e({table:e,toolbarExtra:t}){const{language:n,t:s}=ot(),r=q3e(),i=f.useId(),[o,a]=f.useState(null),[c,u]=f.useState({}),[d,h]=f.useState(null),[m,p]=f.useState(null),[g,b]=f.useState(null),[v,x]=f.useState(()=>new Set),[y,w]=f.useState({}),[k,T]=f.useState(()=>K$(e.columnCount)),[_,C]=f.useState(null),[S,L]=f.useState(!1),[N,$]=f.useState(null),[M,P]=f.useState(null),[E,O]=f.useState(null),[z,F]=f.useState(!1),[B,W]=f.useState("standard"),[I,Y]=f.useState(!1),[V,j]=f.useState(!1),[ee,se]=f.useState(!1),[X,Q]=f.useState(!1),ue=f.useRef(!1),re=f.useRef(null),J=f.useRef(null),q=f.useRef(null),Z=f.useRef(0),he=f.useRef(0),ye=f.useRef(0),oe=f.useRef(!0),we=f.useRef(null),Ve=f.useRef(null),lt=f.useRef(null),Et=f.useRef(null),pt=f.useRef(null),je=f.useRef(null),Ae=f.useRef(0),De=f.useRef(0),Ne=f.useRef(null),tt=f.useRef(null),Se=f.useMemo(()=>`${e.columnCount}\0${e.headers.map(pe=>pe.text).join("\0")}`,[e.columnCount,e.headers]),Be=f.useRef(Se),le=f.useCallback(()=>{p(null)},[]),Le=f.useCallback(()=>{Z.current+=1,re.current&&(clearTimeout(re.current),re.current=null),j(!1)},[]),sn=f.useCallback(()=>{he.current+=1,J.current&&(clearTimeout(J.current),J.current=null),se(!1)},[]),Cn=f.useCallback(()=>{ye.current+=1,q.current&&(clearTimeout(q.current),q.current=null),Q(!1)},[]),In=f.useCallback(()=>{Ae.current&&(cancelAnimationFrame(Ae.current),Ae.current=0);const pe=je.current;je.current=null,pe&&h(Oe=>Oe&&{...Oe,focusRow:pe.rowIndex,focusCol:pe.columnIndex})},[]),_t=f.useCallback(()=>{In(),ue.current=!1,Y(!1)},[In]);f.useEffect(()=>{const pe=()=>{document.hidden&&_t()};return window.addEventListener("mouseup",_t),window.addEventListener("blur",_t),document.addEventListener("visibilitychange",pe),()=>{window.removeEventListener("mouseup",_t),window.removeEventListener("blur",_t),document.removeEventListener("visibilitychange",pe),Ae.current&&cancelAnimationFrame(Ae.current)}},[_t]),f.useEffect(()=>{Be.current!==Se&&(Be.current=Se,a(null),u({}),h(null),p(null),b(null),x(new Set),w({}),T(K$(e.columnCount)),C(null),L(!1),$(null),P(null),O(null),F(!1),W("standard"),Le(),sn(),Cn(),ue.current=!1,tt.current=null,Y(!1))},[sn,Cn,Le,e.columnCount,Se]),f.useEffect(()=>{sn()},[sn,d]),f.useEffect(()=>(oe.current=!0,()=>{oe.current=!1,re.current&&(clearTimeout(re.current),re.current=null),J.current&&(clearTimeout(J.current),J.current=null),q.current&&(clearTimeout(q.current),q.current=null)}),[]),f.useEffect(()=>{if(!m)return;const pe=`${i}-filter-${m.columnIndex}`,Oe=Ut=>{if(Ut.target instanceof Element){const fn=Ut.target.closest("[data-markdown-table-filter-owner]");if((fn==null?void 0:fn.getAttribute("data-markdown-table-filter-owner"))===pe)return}p(null)},rt=()=>p(null);return document.addEventListener("scroll",Oe,!0),window.addEventListener("resize",rt),()=>{document.removeEventListener("scroll",Oe,!0),window.removeEventListener("resize",rt)}},[m,i]),f.useEffect(()=>{if(!g)return;const pe=Ut=>{var un;const fn=Ut.target;(un=lt.current)!=null&&un.contains(fn)||b(null)},Oe=Ut=>{Ut.key==="Escape"&&(Ut.preventDefault(),b(null))},rt=()=>b(null);return document.addEventListener("mousedown",pe),document.addEventListener("keydown",Oe),document.addEventListener("scroll",rt,!0),window.addEventListener("resize",rt),()=>{document.removeEventListener("mousedown",pe),document.removeEventListener("keydown",Oe),document.removeEventListener("scroll",rt,!0),window.removeEventListener("resize",rt)}},[g]),f.useEffect(()=>{const pe=rt=>{var fn,un;const Ut=rt.target;Ut instanceof Node&&!((fn=we.current)!=null&&fn.contains(Ut))&&!((un=lt.current)!=null&&un.contains(Ut))&&C(null)},Oe=rt=>{rt.defaultPrevented||m||E||g||rt.key==="Escape"&&C(null)};return document.addEventListener("mousedown",pe),document.addEventListener("keydown",Oe),()=>{document.removeEventListener("mousedown",pe),document.removeEventListener("keydown",Oe)}},[E,g,m]);const Te=f.useMemo(()=>X$(e.rows,c),[c,e.rows]),at=f.useMemo(()=>P9e(Te,o),[Te,o]);f.useEffect(()=>{h(pe=>pe&&(PS(pe).maxRow<at.length?pe:null))},[at.length]);const ke=f.useMemo(()=>{if(!m)return[];const pe=m.columnIndex;return O9e(X$(e.rows,c,pe),pe,s("markdownTable.blank"))},[c,m,s,e.rows]),Pe=f.useMemo(()=>e.headers.map((pe,Oe)=>B9e(e.rows,Oe)),[e.headers,e.rows]),ve=f.useMemo(()=>k.filter(pe=>pe>=0&&pe<e.columnCount).filter(pe=>!v.has(pe)),[k,v,e.columnCount]),Ke=S?ve[0]:void 0,me=f.useMemo(()=>{if(!E)return null;const pe=at.find(Oe=>Oe.key===E.rowKey);return(pe==null?void 0:pe.cells[E.columnIndex])??null},[E,at]),qe=me==null?void 0:me.text;f.useEffect(()=>{Le()},[Le,ve,at]),f.useEffect(()=>{if(!N)return;const pe=()=>{const fn=Ne.current;Ne.current=null,De.current&&(cancelAnimationFrame(De.current),De.current=0),fn!==null&&w(un=>V$(un,N.columnIndex,fn))},Oe=fn=>{Ne.current=U$(N.startWidth+fn.clientX-N.startX),!De.current&&(De.current=requestAnimationFrame(pe))},rt=()=>{pe(),$(null)},Ut=()=>{document.hidden&&rt()};return window.addEventListener("mousemove",Oe),window.addEventListener("mouseup",rt),window.addEventListener("blur",rt),document.addEventListener("visibilitychange",Ut),()=>{window.removeEventListener("mousemove",Oe),window.removeEventListener("mouseup",rt),window.removeEventListener("blur",rt),document.removeEventListener("visibilitychange",Ut),De.current&&(cancelAnimationFrame(De.current),De.current=0),Ne.current=null}},[N]),f.useEffect(()=>{M&&!at.some(pe=>pe.key===M)&&P(null),E&&!at.some(pe=>pe.key===E.rowKey&&pe.cells[E.columnIndex])&&O(null)},[E,M,at]),f.useEffect(()=>{if(E)return r()},[E,r]),f.useEffect(()=>{E&&Cn()},[E,qe,Cn]),f.useEffect(()=>{if(E)return()=>{const pe=pt.current;pt.current=null,pe!=null&&pe.isConnected&&pe.focus()}},[E]);const Mt=(pe,Oe)=>{h(null),u(rt=>{const Ut={...rt};return Oe&&tx(Oe)?Ut[pe]=Oe:delete Ut[pe],Ut}),le()},ln=(pe,Oe)=>{h(null),C(pe),a(Oe?{columnIndex:pe,direction:Oe}:null)},Ft=pe=>{h(null),C(pe),a(Oe=>(Oe==null?void 0:Oe.columnIndex)!==pe?{columnIndex:pe,direction:"asc"}:Oe.direction==="asc"?{columnIndex:pe,direction:"desc"}:null)},st=(pe,Oe)=>{if(!Oe){p(rt=>(rt==null?void 0:rt.columnIndex)===pe?null:rt);return}h(null),C(pe),b(null),p({columnIndex:pe})},Tn=pe=>{ve.length<=1||(h(null),C(Oe=>Oe===pe?null:Oe),le(),u(Oe=>{const rt={...Oe};return delete rt[pe],rt}),a(Oe=>(Oe==null?void 0:Oe.columnIndex)===pe?null:Oe),x(Oe=>{const rt=new Set(Oe);return rt.add(pe),rt}))},ne=()=>{h(null),x(new Set)},gt=()=>{L(pe=>!pe),b(null)},bt=(pe,Oe)=>{if(Oe!==ve[0])return;pe.preventDefault(),h(null),C(Oe),p(null),b({left:Math.max(6,Math.min(pe.clientX,window.innerWidth-220-6)),top:Math.max(6,Math.min(pe.clientY,window.innerHeight-72-6))})},It=()=>{W(pe=>C9e(pe))},Rt=pe=>{h(null),O(null),Cn(),P(Oe=>Oe===pe?null:pe)},We=(pe,Oe)=>{pt.current=document.activeElement instanceof HTMLElement?document.activeElement:null,h(null),p(null),P(null),Cn(),O({rowKey:pe,columnIndex:Oe})},Zn=()=>{O(null),Cn()},Ar=()=>{if(qe==null||!navigator.clipboard)return;const pe=ye.current;navigator.clipboard.writeText(OS(qe)).then(()=>{oe.current&&ye.current===pe&&(q.current&&clearTimeout(q.current),Q(!0),q.current=setTimeout(()=>Q(!1),2e3))}).catch(Oe=>console.warn("[web-shell] clipboard write failed:",Oe))},Ge=f.useMemo(()=>d?PS(d):null,[d]),dt=f.useMemo(()=>new Set(HM(d,ve)),[d,ve]),bn=(pe,Oe)=>{if(!Ge)return!1;const{minRow:rt,maxRow:Ut}=Ge;return pe>=rt&&pe<=Ut&&dt.has(Oe)},Ht=(pe,Oe)=>{const rt=y[pe];if(rt===void 0){const Ut=B==="compact"?k9e:w9e;return Oe?{...Ut,...Oe}:Ut}return{width:rt,minWidth:rt,maxWidth:rt,...Oe}},Rn=(pe,Oe)=>{pe.preventDefault(),pe.stopPropagation();const rt=pe.currentTarget.closest("th"),Ut=rt==null?void 0:rt.getBoundingClientRect().width;$({columnIndex:Oe,startX:pe.clientX,startWidth:y[Oe]??(Ut?Math.round(Ut):Cf)})},Gn=(pe,Oe)=>{if(pe.ctrlKey||pe.metaKey||pe.altKey||pe.shiftKey)return;let rt=0;if(pe.key==="ArrowRight"?rt=q$:pe.key==="ArrowLeft"&&(rt=-q$),rt===0)return;pe.preventDefault(),pe.stopPropagation();const Ut=pe.currentTarget.closest("th"),fn=Ut==null?void 0:Ut.getBoundingClientRect().width;w(un=>{const _e=un[Oe]??(fn?Math.round(fn):Cf),Ue=U$(_e+rt);return V$(un,Oe,Ue)})},Or=(pe,Oe)=>{pe.stopPropagation(),C(Oe),tt.current=Oe,pe.dataTransfer.effectAllowed="move",pe.dataTransfer.setData(Ste,String(Oe))},Bn=()=>{tt.current=null},_n=pe=>{tt.current===null||!Y$(pe.dataTransfer)||(pe.preventDefault(),pe.dataTransfer.dropEffect="move")},gs=(pe,Oe)=>{const rt=tt.current;Bn(),!(rt===null||!Y$(pe.dataTransfer))&&(pe.preventDefault(),pe.stopPropagation(),h(null),C(rt),T(Ut=>I9e(Ut,rt,Oe,v)))},Qn=(pe,Oe)=>{m!==null&&p(null),C(null),ue.current=!0,h({anchorRow:pe,anchorCol:Oe,focusRow:pe,focusCol:Oe})},Dn=(pe,Oe,rt)=>{var Ut;pe.button!==0||p6(pe.target)||(pe.preventDefault(),(Ut=Ve.current)==null||Ut.focus({preventScroll:!0}),Qn(Oe,rt))},wn=(pe,Oe)=>{ue.current&&(Y(!0),je.current={rowIndex:pe,columnIndex:Oe},!Ae.current&&(Ae.current=requestAnimationFrame(()=>{Ae.current=0;const rt=je.current;je.current=null,rt&&h(Ut=>Ut&&{...Ut,focusRow:rt.rowIndex,focusCol:rt.columnIndex})})))},br=pe=>{var un;const Oe=document.elementFromPoint(pe.clientX,pe.clientY),rt=Oe==null?void 0:Oe.closest("[data-row-index][data-column-index]");if(!rt||!((un=we.current)!=null&&un.contains(rt)))return null;const Ut=Number(rt.dataset.rowIndex),fn=Number(rt.dataset.columnIndex);return!Number.isInteger(Ut)||!Number.isInteger(fn)?null:{rowIndex:Ut,columnIndex:fn}},Qs=(pe,Oe,rt)=>{pe.touches.length!==1||p6(pe.target)||Qn(Oe,rt)},hs=pe=>{if(!ue.current||pe.touches.length!==1)return;const Oe=pe.touches[0];if(!Oe)return;const rt=br(Oe);rt&&(pe.preventDefault(),wn(rt.rowIndex,rt.columnIndex))},cn=()=>{const pe=W$(d,at,ve);if(!pe||!navigator.clipboard)return;const Oe=he.current;navigator.clipboard.writeText(pe).then(()=>{oe.current&&he.current===Oe&&(J.current&&clearTimeout(J.current),se(!0),J.current=setTimeout(()=>se(!1),2e3))}).catch(rt=>console.warn("[web-shell] clipboard write failed:",rt))},Jn=()=>{const pe=j9e(e.headers,at,ve);if(!pe||!navigator.clipboard)return;const Oe=Z.current;navigator.clipboard.writeText(pe).then(()=>{oe.current&&Z.current===Oe&&(re.current&&clearTimeout(re.current),j(!0),re.current=setTimeout(()=>j(!1),2e3))}).catch(rt=>console.warn("[web-shell] clipboard write failed:",rt))},Wi=pe=>{if(_9e())return;const Oe=W$(d,at,ve);Oe&&(pe.preventDefault(),pe.clipboardData.setData("text/plain",Oe))},is=f.useMemo(()=>M9e(d,at,ve),[ve,d,at]),tr=(is==null?void 0:is.selectedCount)??0,kr=Object.values(c).filter(tx).length,Br=s(`markdownTable.density.${B}`),gr=f.useMemo(()=>at.some(pe=>ve.some(Oe=>{const rt=pe.cells[Oe];return rt?g6(y6(rt)):!1})),[ve,at]),bs=at.length===e.rows.length?s("markdownTable.rows",{count:e.rows.length}):s("markdownTable.rowsFiltered",{visible:at.length,total:e.rows.length}),ir=(pe,Oe)=>{const rt=y6(pe),Ut=g6(rt);return l.jsx("div",{className:`${Xt.cellContent} ${Ut&&!Oe?Xt.cellContentCollapsed:""}`,title:Ut&&!Oe?rt:void 0,children:l.jsx("div",{className:Xt.cellText,children:pe.content})})},or=(pe,Oe)=>{const rt=pe.text.length===0,Ut=y6(pe),fn=g6(Ut);return l.jsx("div",{className:`${Xt.detailValueContent} ${fn&&!Oe?Xt.detailValueCollapsed:""} ${rt?Xt.emptyValue:""}`,title:fn&&!Oe?Ut:void 0,children:l.jsx("div",{className:Xt.detailValueText,children:rt?s("markdownTable.emptyValue"):pe.content})})};return l.jsxs("div",{ref:we,className:`${Xt.tableShell} ${T9e(B)} ${S?Xt.hasFrozenColumn:""} ${I?Xt.dragging:""}`,children:[l.jsxs("div",{className:Xt.toolbar,children:[l.jsx("span",{className:Xt.summary,children:bs}),l.jsx("span",{className:Xt.hint,children:s("markdownTable.hint")}),l.jsx("button",{className:Xt.copyButton,type:"button",onClick:Jn,children:V?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Xt.copyCheck,children:"✓"}),s("code.copied")]}):s("markdownTable.copyVisible")}),v.size>0&&l.jsx("button",{className:Xt.copyButton,type:"button",onClick:ne,children:s("markdownTable.showHiddenColumns",{count:v.size})}),l.jsx("button",{className:Xt.copyButton,type:"button",onClick:It,children:s("markdownTable.density",{density:Br})}),gr&&l.jsx("button",{className:Xt.copyButton,type:"button",onClick:()=>F(pe=>!pe),children:s(z?"markdownTable.collapseLongText":"markdownTable.expandLongText")}),kr>0&&l.jsx("span",{className:Xt.selection,children:s("markdownTable.filtersActive",{count:kr})}),tr>0&&l.jsxs(l.Fragment,{children:[is&&l.jsxs("div",{className:Xt.selectionStats,children:[l.jsxs("span",{className:Xt.selectionMetric,children:[s("markdownTable.selection.selected")," ",l.jsx("strong",{className:Xt.selectionMetricValue,children:is.selectedCount})]}),l.jsxs("span",{className:Xt.selectionMetric,children:[s("markdownTable.selection.nonEmpty")," ",l.jsx("strong",{className:Xt.selectionMetricValue,children:is.nonEmptyCount})]}),l.jsxs("span",{className:Xt.selectionMetric,children:[s("markdownTable.selection.numeric")," ",l.jsx("strong",{className:Xt.selectionMetricValue,children:is.numericCount})]}),is.numericCount>0&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:Xt.selectionMetric,children:[s("markdownTable.selection.sum")," ",l.jsx("strong",{className:Xt.selectionMetricValue,children:Ik(is.sum,is,n)})]}),l.jsxs("span",{className:Xt.selectionMetric,children:[s("markdownTable.selection.average")," ",l.jsx("strong",{className:Xt.selectionMetricValue,children:Ik(is.average,is,n)})]}),l.jsxs("span",{className:Xt.selectionMetric,children:[s("markdownTable.selection.min")," ",l.jsx("strong",{className:Xt.selectionMetricValue,children:Ik(is.min,is,n)})]}),l.jsxs("span",{className:Xt.selectionMetric,children:[s("markdownTable.selection.max")," ",l.jsx("strong",{className:Xt.selectionMetricValue,children:Ik(is.max,is,n)})]})]})]}),l.jsx("button",{className:Xt.copyButton,type:"button",onClick:cn,children:ee?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Xt.copyCheck,children:"✓"}),s("code.copied")]}):s("markdownTable.copyTsv")})]}),t]}),l.jsxs("div",{ref:Ve,className:Xt.scroller,tabIndex:0,onCopy:Wi,children:[l.jsxs("table",{className:Xt.table,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{className:`${Xt.headerCell} ${Xt.actionHeaderCell} ${S?Xt.stickyActionHeaderCell:""}`,children:s("markdownTable.actions")}),ve.map(pe=>{const Oe=e.headers[pe];if(!Oe)return null;const rt=(o==null?void 0:o.columnIndex)===pe,Ut=tx(c[pe]),fn=(m==null?void 0:m.columnIndex)===pe,un=rt?o.direction==="asc"?"↑":"↓":"↕",_e=Oe.text||s("markdownTable.column",{index:pe+1}),Ue=rt?s(o.direction==="asc"?"markdownTable.sortByColumnAsc":"markdownTable.sortByColumnDesc",{column:_e}):s("markdownTable.sortByColumn",{column:_e}),zt=rt?o.direction==="asc"?"ascending":"descending":"none",Sn=`${i}-filter-${pe}`,Gt=Oe.textAlign?{textAlign:Oe.textAlign}:void 0,Ls=Ke===pe,kn=_===pe;return l.jsxs("th",{className:`${Xt.headerCell} ${Ls?Xt.frozenHeaderCell:""} ${kn?Xt.activeHeaderCell:""}`,"aria-sort":zt,onContextMenu:Pn=>bt(Pn,pe),onDragOver:_n,onDrop:Pn=>gs(Pn,pe),style:Ht(pe,Gt),title:_e,children:[l.jsxs("div",{className:Xt.headerControls,children:[l.jsxs("button",{className:Xt.headerButton,type:"button",onClick:()=>Ft(pe),"aria-label":Ue,style:Gt,children:[l.jsx("span",{className:Xt.headerText,style:Gt,children:Oe.content}),l.jsx("span",{className:Xt.sortIcon,"aria-hidden":"true",children:un})]}),l.jsx("button",{className:`${Xt.reorderHandle} ${kn?Xt.reorderHandleVisible:""}`,type:"button",draggable:!0,tabIndex:kn?0:-1,onDragStart:Pn=>Or(Pn,pe),onDragEnd:Bn,"aria-label":s("markdownTable.moveColumn",{column:_e}),children:"⋮⋮"}),l.jsxs(Ux,{open:fn,onOpenChange:Pn=>st(pe,Pn),children:[l.jsx(LS,{asChild:!0,children:l.jsx("button",{className:`${Xt.filterTrigger} ${Ut?Xt.filterTriggerActive:""}`,type:"button","aria-label":s("markdownTable.filterColumn",{column:_e}),"aria-controls":fn?Sn:void 0,children:"▾"})}),fn&&l.jsx(W9e,{id:Sn,columnName:_e,columnIndex:pe,filter:c[pe],isNumeric:Pe[pe]??!1,options:ke,sort:o,canHideColumn:ve.length>1,onApply:Mt,onClose:le,onHideColumn:Tn,onSort:ln},pe)]})]}),l.jsx("button",{className:Xt.resizeHandle,type:"button",onMouseDown:Pn=>Rn(Pn,pe),onKeyDown:Pn=>Gn(Pn,pe),role:"separator","aria-label":s("markdownTable.resizeColumn",{column:_e}),"aria-orientation":"vertical","aria-valuemin":kte,"aria-valuemax":_te,"aria-valuenow":y[pe]??Cf})]},Oe.key)})]})}),l.jsx("tbody",{children:at.map((pe,Oe)=>{const rt=M===pe.key,Ut=`${i}-detail-${pe.key}`;return l.jsxs(f.Fragment,{children:[l.jsxs("tr",{className:Oe%2===1?Xt.evenRow:void 0,children:[l.jsx("td",{className:`${Xt.cell} ${Xt.actionCell} ${S?Xt.stickyActionCell:""}`,children:l.jsx("button",{className:Xt.rowDetailButton,type:"button",onClick:()=>Rt(pe.key),"aria-expanded":rt,"aria-controls":Ut,"aria-label":s(rt?"markdownTable.closeRowDetailsAria":"markdownTable.rowDetailsAria",{index:Oe+1}),children:s("markdownTable.rowDetails")})}),ve.map(fn=>{const un=pe.cells[fn];if(!un)return null;const _e=un.textAlign?{textAlign:un.textAlign}:void 0,Ue=Ke===fn;return l.jsx("td",{className:`${Xt.cell} ${bn(Oe,fn)?Xt.selectedCell:""} ${Ue?Xt.frozenCell:""}`,style:Ht(fn,_e),"data-row-index":Oe,"data-column-index":fn,onMouseDown:zt=>Dn(zt,Oe,fn),onMouseEnter:()=>wn(Oe,fn),onTouchStart:zt=>Qs(zt,Oe,fn),onTouchMove:hs,onTouchEnd:_t,onTouchCancel:_t,onDoubleClick:zt=>{p6(zt.target)||We(pe.key,fn)},children:ir(un,z)},un.key)})]}),rt&&l.jsx("tr",{id:Ut,className:Xt.detailRow,children:l.jsx("td",{className:Xt.detailCell,colSpan:ve.length+1,children:l.jsxs("div",{className:Xt.detailPanel,children:[l.jsx("div",{className:Xt.detailTitle,children:s("markdownTable.detailsHeader")}),ve.map(fn=>{const un=e.headers[fn],_e=pe.cells[fn];return!un||!_e?null:l.jsxs("div",{className:Xt.detailItem,children:[l.jsx("div",{className:Xt.detailLabel,title:un.text,children:un.content}),l.jsx("div",{className:Xt.detailValue,children:or(_e,z)})]},`${pe.key}-detail-${fn}`)})]})})})]},pe.key)})})]}),at.length===0&&l.jsx("div",{className:Xt.emptyState,children:e.rows.length===0?s("markdownTable.empty"):s("markdownTable.emptyFiltered")})]}),g&&ve.length>0&&l.jsx("div",{ref:lt,className:Xt.columnContextMenu,style:{left:g.left,top:g.top},role:"menu",children:l.jsx("button",{className:Xt.columnContextMenuAction,type:"button",role:"menuitem",onClick:gt,children:s(S?"markdownTable.unfreezeFirstColumn":"markdownTable.freezeFirstColumn")})}),l.jsx(h1,{open:E!==null&&me!==null,onOpenChange:pe=>{pe||Zn()},children:me&&l.jsxs(f1,{ref:Et,className:"sm:max-w-lg",showCloseButton:!1,overlayProps:{onMouseDown:Zn},onOpenAutoFocus:pe=>{var Oe;pe.preventDefault(),(Oe=Et.current)==null||Oe.focus()},tabIndex:-1,children:[l.jsx(tA,{asChild:!0,children:l.jsxs(qn,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm","aria-label":s("markdownTable.close"),children:[l.jsx(J4,{}),l.jsx("span",{className:"sr-only",children:s("markdownTable.close")})]})}),l.jsx(m1,{children:l.jsx(g1,{children:s("markdownTable.cellDialogTitle")})}),l.jsx("div",{className:"max-h-[200px] min-h-[100px] cursor-text overflow-auto rounded-lg border bg-background/70 p-3 leading-relaxed font-semibold whitespace-pre-wrap break-words select-text",children:me.content}),l.jsxs(p1,{children:[l.jsx(qn,{variant:"outline",onClick:Ar,children:s(X?"code.copied":"markdownTable.copyCell")}),l.jsx(tA,{asChild:!0,children:l.jsx(qn,{children:s("markdownTable.close")})})]})]})})]})}const Y9e="_content_1n6wo_1",X9e="_inlineCode_1n6wo_127",Q9e="_link_1n6wo_139",J9e="_tableWrapper_1n6wo_149",Z9e="_table_1n6wo_149",eNe="_image_1n6wo_179",tNe="_codeBlock_1n6wo_187",nNe="_codeBlockHeader_1n6wo_196",sNe="_codeBlockLang_1n6wo_205",rNe="_codeBlockCopy_1n6wo_213",iNe="_codeBlockContent_1n6wo_236",oNe="_codeBlockPlain_1n6wo_256",aNe="_mermaidBlock_1n6wo_274",lNe="_mermaidInline_1n6wo_286",cNe="_mermaidLoading_1n6wo_305",uNe="_mermaidActions_1n6wo_312",dNe="_mermaidZoomWrapper_1n6wo_317",hNe="_mermaidDragging_1n6wo_325",As={content:Y9e,inlineCode:X9e,link:Q9e,tableWrapper:J9e,table:Z9e,image:eNe,codeBlock:tNe,codeBlockHeader:nNe,codeBlockLang:sNe,codeBlockCopy:rNe,codeBlockContent:iNe,codeBlockPlain:oNe,mermaidBlock:aNe,mermaidInline:lNe,mermaidLoading:cNe,mermaidActions:uNe,mermaidZoomWrapper:dNe,mermaidDragging:hNe},fNe=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"]),Q$={"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 qM(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(Q$,t)?Q$[t]:t,s=fNe.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const Ete=/^(https?:|mailto:)/i,mNe=/^data:image\/(png|jpeg|gif|webp);base64,/i;function Ate(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:Ete.test(t):!1}function tb(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")||mNe.test(t)?!0:Ete.test(t):!1}let J$,pNe=0;function gNe({code:e}){const{t}=ot(),n=z1(),[s,r]=f.useState(null),[i,o]=f.useState(null),[a,c]=f.useState("diagram"),[u,d]=f.useState(!1),[h,m]=f.useState(1),[p,g]=f.useState({x:0,y:0}),[b,v]=f.useState(!1),x=f.useRef(null),y=n==="light"?"default":"dark",w=.5,k=3,T=.25,_=()=>{m($=>Math.min(k,Math.round(($+T)*100)/100))},C=()=>{m($=>Math.max(w,Math.round(($-T)*100)/100))},S=f.useCallback(()=>{x.current=null,v(!1),m(1),g({x:0,y:0})},[]),L=f.useCallback($=>{$.preventDefault(),v(!0),x.current={startX:$.clientX,startY:$.clientY,origX:p.x,origY:p.y}},[p]);f.useEffect(()=>{if(!b)return;const $=P=>{if(!x.current)return;const E=P.clientX-x.current.startX,O=P.clientY-x.current.startY,z=1500;g({x:x.current.origX+E,y:Math.max(-z,Math.min(z,x.current.origY+O))})},M=()=>{x.current=null,v(!1)};return window.addEventListener("mousemove",$),window.addEventListener("mouseup",M),window.addEventListener("blur",M),()=>{window.removeEventListener("mousemove",$),window.removeEventListener("mouseup",M),window.removeEventListener("blur",M)}},[b]),f.useEffect(()=>{m(1),g({x:0,y:0})},[e]),f.useEffect(()=>{let $=!1;r(null),o(null);const M=setTimeout(()=>{ie(()=>import("./mermaid.core-G6fbZRPf.js").then(P=>P.bm),[]).then(async P=>{if($)return;const E=P.default;J$!==y&&(E.initialize({startOnLoad:!1,theme:y,securityLevel:"strict",suppressErrorRendering:!0,flowchart:{wrappingWidth:300,useMaxWidth:!1}}),J$=y);try{const O=`mermaid-${++pNe}`,{svg:z}=await E.render(O,e.trim());$||r(z)}catch(O){$||o(O instanceof Error?O.message:"Mermaid render failed")}})},150);return()=>{$=!0,clearTimeout(M)}},[e,y]);const N=()=>{navigator.clipboard.writeText(e).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)},()=>{})};return i?l.jsxs("div",{className:As.codeBlock,children:[l.jsx("div",{className:As.codeBlockHeader,children:l.jsx("span",{className:As.codeBlockLang,children:t("mermaid.errorLabel")})}),l.jsx("pre",{className:`${As.codeBlockContent} ${As.codeBlockPlain}`,children:l.jsx("code",{children:e})})]}):l.jsxs("div",{className:As.codeBlock,children:[l.jsxs("div",{className:As.codeBlockHeader,children:[l.jsx("span",{className:As.codeBlockLang,children:t("mermaid.label")}),l.jsxs("span",{className:As.mermaidActions,children:[a==="diagram"&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:As.codeBlockCopy,onClick:C,title:t("mermaid.zoomOut"),disabled:h<=w,children:t("mermaid.zoomOut")}),l.jsx("button",{className:As.codeBlockCopy,onClick:S,title:t("mermaid.zoomReset"),disabled:h===1&&p.x===0&&p.y===0,children:t("mermaid.zoomReset")}),l.jsx("button",{className:As.codeBlockCopy,onClick:_,title:t("mermaid.zoomIn"),disabled:h>=k,children:t("mermaid.zoomIn")})]}),l.jsx("button",{className:As.codeBlockCopy,onClick:()=>c(a==="diagram"?"code":"diagram"),children:t(a==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),l.jsx("button",{className:As.codeBlockCopy,onClick:N,children:t(u?"code.copied":"code.copy")})]})]}),a==="code"?l.jsx("pre",{className:`${As.codeBlockContent} ${As.codeBlockPlain}`,children:l.jsx("code",{children:e})}):s?l.jsx("div",{className:`${As.mermaidZoomWrapper} ${b?As.mermaidDragging:""}`,onMouseDown:L,onDoubleClick:S,children:l.jsx("div",{className:`${As.mermaidBlock} ${As.mermaidInline}`,style:{transform:`translate(${p.x}px, ${p.y}px) scale(${h})`,transformOrigin:"top center"},dangerouslySetInnerHTML:{__html:s}})}):l.jsx("div",{className:`${As.mermaidBlock} ${As.mermaidLoading} ${As.mermaidInline}`,children:l.jsx("span",{children:t("mermaid.rendering")})})]})}function bNe({className:e,children:t,isStreaming:n}){const{t:s}=ot(),r=z1(),[i,o]=f.useState(null),[a,c]=f.useState(!1),{label:u,lang:d,resolvedLang:h}=qM(Nte(e)),m=String(t).replace(/\n$/,""),p=r==="light"?"github-light-default":"github-dark-default";f.useEffect(()=>{if(d==="mermaid"||h==="text"||FE(m)){o(null);return}const b=O3e(m,h,p);if(b!==null){o(b);return}const v=!n,x=s$(m,h,p,v);if(x!==null){o(x);return}o(null);let y=!1;return bQ(h).then(()=>{if(y)return;const w=s$(m,h,p,v);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(()=>{c(!0),setTimeout(()=>c(!1),2e3)},()=>{})};return d==="mermaid"&&!n?l.jsx(gNe,{code:m}):l.jsxs("div",{className:As.codeBlock,children:[l.jsxs("div",{className:As.codeBlockHeader,children:[l.jsx("span",{className:As.codeBlockLang,children:u}),l.jsx("button",{className:As.codeBlockCopy,onClick:g,children:s(a?"code.copied":"code.copy")})]}),i!==null?l.jsx("div",{className:As.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):l.jsx("pre",{className:`${As.codeBlockContent} ${As.codeBlockPlain}`,children:l.jsx("code",{children:m})})]})}function Nte(e){var i;const t=((i=e==null?void 0:e.match(/(?:^|\s)language-([^\s]+)/))==null?void 0:i[1])??"",n=t.match(/^([\w+.#-]+)/);if(!n)return"";const s=n[1]??"",r=t[s.length];return!r||r==="{"||r===":"?s:""}function yNe({children:e}){return l.jsx("code",{className:As.inlineCode,children:e})}function Z$({children:e}){return l.jsx("div",{className:As.tableWrapper,children:l.jsx("table",{className:As.table,children:e})})}const jte=f.createContext(!1),Mte=f.createContext(void 0);function xNe({className:e,children:t}){const n=f.useContext(jte);return(e==null?void 0:e.startsWith("language-"))||typeof t=="string"&&t.includes(`
`)?l.jsx(vNe,{className:e,isStreaming:n,children:t}):l.jsx(yNe,{children:t})}function vNe({className:e,children:t,isStreaming:n}){var m;const s=f.useContext(Mte),r=z1(),{markdown:i}=$c(),o=String(t),a=o.replace(/\n$/,""),c=l.jsx(bNe,{className:e,isStreaming:n,children:o}),u=Nte(e),{resolvedLang:d}=qM(u);if(!!s&&!!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:s,theme:r});if(p!=null&&typeof p!="boolean")return l.jsx(Jd,{fallback:c,label:`custom code block component render (lang=${u})`,resetKeys:[u,s,r,n?"streaming":"settled",a],children:p})}catch(p){console.error("[web-shell] custom code block renderer call failed (lang=%s):",u,p)}return c}function wNe({children:e}){return l.jsx(l.Fragment,{children:e})}const iA=/^qwen-session:\/\//i;function kNe(e){return iA.test(e.trim())?e:sY(e)}function _Ne({href:e,children:t}){const n=lj();if(e&&iA.test(e.trim())){if(n==="readonly")return l.jsx("span",{className:As.link,children:t});const r=e.trim().replace(iA,"");return l.jsx("a",{href:"#",role:"button",className:As.link,onClick:i=>{i.preventDefault(),i.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:r}))},children:t})}const s=Ate(e)?e:void 0;return l.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:As.link,children:t})}function SNe({src:e,alt:t}){const n=tb(e)?e:void 0;return l.jsx("img",{src:n,alt:t||"",className:As.image})}function Ite(e="basic",t=""){return{code:xNe,pre:wNe,a:_Ne,img:SNe,table({children:n}){if(e==="advanced"){const s=l.jsx(Z$,{children:n});return l.jsx(Jd,{fallback:s,label:"enhanced markdown table",resetKeys:[t],children:l.jsx(G9e,{fallback:s,children:n})})}return l.jsx(Z$,{children:n})}}}const CNe=Ite(),Op=f.memo(function({content:t,source:n,isStreaming:s,tableMode:r}){const{markdown:i,markdownTableMode:o}=$c(),a=n?i:void 0,c=t&&n&&(a!=null&&a.transformMarkdown)?a.transformMarkdown(t,{source:n}):t,u=s?"basic":r??o??"basic",d=f.useMemo(()=>u==="advanced"?Ite("advanced",c):CNe,[u,c]),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?[qO,NB,...a.remarkPlugins]:[qO,NB],g=a!=null&&a.rehypePlugins?[BB,...a.rehypePlugins]:[BB];return l.jsx("div",{className:n!=="thinking"?As.content:void 0,"data-markdown-source":n,children:l.jsx(jte.Provider,{value:!!s,children:l.jsx(Mte.Provider,{value:n,children:l.jsx(Qxe,{remarkPlugins:p,rehypePlugins:g,components:m,urlTransform:kNe,children:c})})})})});let oA=[],Rte=[];(()=>{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?Rte:oA).push(n=n+e[t])})();function TNe(e){if(e<768)return!1;for(let t=0,n=oA.length;;){let s=t+n>>1;if(e<oA[s])n=s;else if(e>=Rte[s])t=s+1;else return!0;if(t==n)return!1}}function ez(e){return e>=127462&&e<=127487}const tz=8205;function ENe(e,t,n=!0,s=!0){return(n?Dte:ANe)(e,t,s)}function Dte(e,t,n){if(t==e.length)return t;t&&Lte(e.charCodeAt(t))&&Pte(e.charCodeAt(t-1))&&t--;let s=x6(e,t);for(t+=nz(s);t<e.length;){let r=x6(e,t);if(s==tz||r==tz||n&&TNe(r))t+=nz(r),s=r;else if(ez(r)){let i=0,o=t-2;for(;o>=0&&ez(x6(e,o));)i++,o-=2;if(i%2==0)break;t+=2}else break}return t}function ANe(e,t,n){for(;t>0;){let s=Dte(e,t-2,n);if(s<t)return s;t--}return 0}function x6(e,t){let n=e.charCodeAt(t);if(!Pte(n)||t+1==e.length)return n;let s=e.charCodeAt(t+1);return Lte(s)?(n-55296<<10)+(s-56320)+65536:n}function Lte(e){return e>=56320&&e<57344}function Pte(e){return e>=55296&&e<56320}function nz(e){return e<65536?1:2}class rr{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,n,s){[t,n]=b1(this,t,n);let r=[];return this.decompose(0,t,r,2),s.length&&s.decompose(0,s.length,r,3),this.decompose(n,this.length,r,1),xu.from(r,this.length-(n-t)+s.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,n=this.length){[t,n]=b1(this,t,n);let s=[];return this.decompose(t,n,s,0),xu.from(s,n-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let n=this.scanIdentical(t,1),s=this.length-this.scanIdentical(t,-1),r=new nx(this),i=new nx(t);for(let o=n,a=n;;){if(r.next(o),i.next(o),o=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=s)return!0}}iter(t=1){return new nx(this,t)}iterRange(t,n=this.length){return new Ote(this,t,n)}iterLines(t,n){let s;if(t==null)s=this.iter();else{n==null&&(n=this.lines+1);let r=this.line(t).from;s=this.iterRange(r,Math.max(r,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new Bte(s)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?rr.empty:t.length<=32?new Ai(t):xu.from(Ai.split(t,[]))}}class Ai extends rr{constructor(t,n=NNe(t)){super(),this.text=t,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(t,n,s,r){for(let i=0;;i++){let o=this.text[i],a=r+o.length;if((n?s:a)>=t)return new jNe(r,a,s,o);r=a+1,s++}}decompose(t,n,s,r){let i=t<=0&&n>=this.length?this:new Ai(sz(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(r&1){let o=s.pop(),a=Q_(i.text,o.text.slice(),0,i.length);if(a.length<=32)s.push(new Ai(a,o.length+i.length));else{let c=a.length>>1;s.push(new Ai(a.slice(0,c)),new Ai(a.slice(c)))}}else s.push(i)}replace(t,n,s){if(!(s instanceof Ai))return super.replace(t,n,s);[t,n]=b1(this,t,n);let r=Q_(this.text,Q_(s.text,sz(this.text,0,t)),n),i=this.length+s.length-(n-t);return r.length<=32?new Ai(r,i):xu.from(Ai.split(r,[]),i)}sliceString(t,n=this.length,s=`
`){[t,n]=b1(this,t,n);let r="";for(let i=0,o=0;i<=n&&o<this.text.length;o++){let a=this.text[o],c=i+a.length;i>t&&o&&(r+=s),t<c&&n>i&&(r+=a.slice(Math.max(0,t-i),n-i)),i=c+1}return r}flatten(t){for(let n of this.text)t.push(n)}scanIdentical(){return 0}static split(t,n){let s=[],r=-1;for(let i of t)s.push(i),r+=i.length+1,s.length==32&&(n.push(new Ai(s,r)),s=[],r=-1);return r>-1&&n.push(new Ai(s,r)),n}}class xu extends rr{constructor(t,n){super(),this.children=t,this.length=n,this.lines=0;for(let s of t)this.lines+=s.lines}lineInner(t,n,s,r){for(let i=0;;i++){let o=this.children[i],a=r+o.length,c=s+o.lines-1;if((n?c:a)>=t)return o.lineInner(t,n,s,r);r=a+1,s=c+1}}decompose(t,n,s,r){for(let i=0,o=0;o<=n&&i<this.children.length;i++){let a=this.children[i],c=o+a.length;if(t<=c&&n>=o){let u=r&((o<=t?1:0)|(c>=n?2:0));o>=t&&c<=n&&!u?s.push(a):a.decompose(t-o,n-o,s,u)}o=c+1}}replace(t,n,s){if([t,n]=b1(this,t,n),s.lines<this.lines)for(let r=0,i=0;r<this.children.length;r++){let o=this.children[r],a=i+o.length;if(t>=i&&n<=a){let c=o.replace(t-i,n-i,s),u=this.lines-o.lines+c.lines;if(c.lines<u>>4&&c.lines>u>>6){let d=this.children.slice();return d[r]=c,new xu(d,this.length-(n-t)+s.length)}return super.replace(i,a,c)}i=a+1}return super.replace(t,n,s)}sliceString(t,n=this.length,s=`
`){[t,n]=b1(this,t,n);let r="";for(let i=0,o=0;i<this.children.length&&o<=n;i++){let a=this.children[i],c=o+a.length;o>t&&i&&(r+=s),t<c&&n>o&&(r+=a.sliceString(t-o,n-o,s)),o=c+1}return r}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof xu))return 0;let s=0,[r,i,o,a]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;r+=n,i+=n){if(r==o||i==a)return s;let c=this.children[r],u=t.children[i];if(c!=u)return s+c.scanIdentical(u,n);s+=c.length+1}}static from(t,n=t.reduce((s,r)=>s+r.length+1,-1)){let s=0;for(let p of t)s+=p.lines;if(s<32){let p=[];for(let g of t)g.flatten(p);return new Ai(p,n)}let r=Math.max(32,s>>5),i=r<<1,o=r>>1,a=[],c=0,u=-1,d=[];function h(p){let g;if(p.lines>i&&p instanceof xu)for(let b of p.children)h(b);else p.lines>o&&(c>o||!c)?(m(),a.push(p)):p instanceof Ai&&c&&(g=d[d.length-1])instanceof Ai&&p.lines+g.lines<=32?(c+=p.lines,u+=p.length+1,d[d.length-1]=new Ai(g.text.concat(p.text),g.length+1+p.length)):(c+p.lines>r&&m(),c+=p.lines,u+=p.length+1,d.push(p))}function m(){c!=0&&(a.push(d.length==1?d[0]:xu.from(d,u)),u=-1,c=d.length=0)}for(let p of t)h(p);return m(),a.length==1?a[0]:new xu(a,n)}}rr.empty=new Ai([""],0);function NNe(e){let t=-1;for(let n of e)t+=n.length+1;return t}function Q_(e,t,n=0,s=1e9){for(let r=0,i=0,o=!0;i<e.length&&r<=s;i++){let a=e[i],c=r+a.length;c>=n&&(c>s&&(a=a.slice(0,s-r)),r<n&&(a=a.slice(n-r)),o?(t[t.length-1]+=a,o=!1):t.push(a)),r=c+1}return t}function sz(e,t,n){return Q_(e,[""],t,n)}class nx{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 Ai?t.text.length:t.children.length)<<1]}nextInner(t,n){for(this.done=this.lineBreak=!1;;){let s=this.nodes.length-1,r=this.nodes[s],i=this.offsets[s],o=i>>1,a=r instanceof Ai?r.text.length:r.children.length;if(o==(n>0?a:0)){if(s==0)return this.done=!0,this.value="",this;n>0&&this.offsets[s-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[s]+=n,t==0)return this.lineBreak=!0,this.value=`
`,this;t--}else if(r instanceof Ai){let c=r.text[o+(n<0?-1:0)];if(this.offsets[s]+=n,c.length>Math.max(0,t))return this.value=t==0?c:n>0?c.slice(t):c.slice(0,c.length-t),this;t-=c.length}else{let c=r.children[o+(n<0?-1:0)];t>c.length?(t-=c.length,this.offsets[s]+=n):(n<0&&this.offsets[s]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof Ai?c.text.length:c.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class Ote{constructor(t,n,s){this.value="",this.done=!1,this.cursor=new nx(t,n>s?-1:1),this.pos=n>s?t.length:0,this.from=Math.min(n,s),this.to=Math.max(n,s)}nextInner(t,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let s=n<0?this.pos-this.from:this.to-this.pos;t>s&&(t=s),s-=t;let{value:r}=this.cursor.next(t);return this.pos+=(r.length+t)*n,this.value=r.length<=s?r:n<0?r.slice(r.length-s):r.slice(0,s),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Bte{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:n,lineBreak:s,value:r}=this.inner.next(t);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):s?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(rr.prototype[Symbol.iterator]=function(){return this.iter()},nx.prototype[Symbol.iterator]=Ote.prototype[Symbol.iterator]=Bte.prototype[Symbol.iterator]=function(){return this});class jNe{constructor(t,n,s,r){this.from=t,this.to=n,this.number=s,this.text=r}get length(){return this.to-this.from}}function b1(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function _o(e,t,n=!0,s=!0){return ENe(e,t,n,s)}function MNe(e){return e>=56320&&e<57344}function INe(e){return e>=55296&&e<56320}function Ka(e,t){let n=e.charCodeAt(t);if(!INe(n)||t+1==e.length)return n;let s=e.charCodeAt(t+1);return MNe(s)?(n-55296<<10)+(s-56320)+65536:n}function UM(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function vu(e){return e<65536?1:2}const aA=/\r\n?|\n/;var Ta=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Ta||(Ta={}));class Ru{constructor(t){this.sections=t}get length(){let t=0;for(let n=0;n<this.sections.length;n+=2)t+=this.sections[n];return t}get newLength(){let t=0;for(let n=0;n<this.sections.length;n+=2){let s=this.sections[n+1];t+=s<0?this.sections[n]:s}return t}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(t){for(let n=0,s=0,r=0;n<this.sections.length;){let i=this.sections[n++],o=this.sections[n++];o<0?(t(s,r,i),r+=i):r+=o,s+=i}}iterChangedRanges(t,n=!1){lA(this,t,n)}get invertedDesc(){let t=[];for(let n=0;n<this.sections.length;){let s=this.sections[n++],r=this.sections[n++];r<0?t.push(s,r):t.push(r,s)}return new Ru(t)}composeDesc(t){return this.empty?t:t.empty?this:$te(this,t)}mapDesc(t,n=!1){return t.empty?this:cA(this,t,n)}mapPos(t,n=-1,s=Ta.Simple){let r=0,i=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],c=this.sections[o++],u=r+a;if(c<0){if(u>t)return i+(t-r);i+=a}else{if(s!=Ta.Simple&&u>=t&&(s==Ta.TrackDel&&r<t&&u>t||s==Ta.TrackBefore&&r<t||s==Ta.TrackAfter&&u>t))return null;if(u>t||u==t&&n<0&&!a)return t==r||n<0?i:i+c;i+=c}r=u}if(t>r)throw new RangeError(`Position ${t} is out of range for changeset of length ${r}`);return i}touchesRange(t,n=t){for(let s=0,r=0;s<this.sections.length&&r<=n;){let i=this.sections[s++],o=this.sections[s++],a=r+i;if(o>=0&&r<=n&&a>=t)return r<t&&a>n?"cover":!0;r=a}return!1}toString(){let t="";for(let n=0;n<this.sections.length;){let s=this.sections[n++],r=this.sections[n++];t+=(t?" ":"")+s+(r>=0?":"+r:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ru(t)}static create(t){return new Ru(t)}}class to extends Ru{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 lA(this,(n,s,r,i,o)=>t=t.replace(r,r+(s-n),o),!1),t}mapDesc(t,n=!1){return cA(this,t,n,!0)}invert(t){let n=this.sections.slice(),s=[];for(let r=0,i=0;r<n.length;r+=2){let o=n[r],a=n[r+1];if(a>=0){n[r]=a,n[r+1]=o;let c=r>>1;for(;s.length<c;)s.push(rr.empty);s.push(o?t.slice(i,i+o):rr.empty)}i+=o}return new to(n,s)}compose(t){return this.empty?t:t.empty?this:$te(this,t,!0)}map(t,n=!1){return t.empty?this:cA(this,t,n,!0)}iterChanges(t,n=!1){lA(this,t,n)}get desc(){return Ru.create(this.sections)}filter(t){let n=[],s=[],r=[],i=new Wx(this);e:for(let o=0,a=0;;){let c=o==t.length?1e9:t[o++];for(;a<c||a==c&&i.len==0;){if(i.done)break e;let d=Math.min(i.len,c-a);Zo(r,d,-1);let h=i.ins==-1?-1:i.off==0?i.ins:0;Zo(n,d,h),h>0&&of(s,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);Zo(n,d,-1),Zo(r,d,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(d),a+=d}}return{changes:new to(n,s),filtered:Ru.create(r)}}toJSON(){let t=[];for(let n=0;n<this.sections.length;n+=2){let s=this.sections[n],r=this.sections[n+1];r<0?t.push(s):r==0?t.push([s]):t.push([s].concat(this.inserted[n>>1].toJSON()))}return t}static of(t,n,s){let r=[],i=[],o=0,a=null;function c(d=!1){if(!d&&!r.length)return;o<n&&Zo(r,n-o,-1);let h=new to(r,i);a=a?a.compose(h.map(a)):h,r=[],i=[],o=0}function u(d){if(Array.isArray(d))for(let h of d)u(h);else if(d instanceof to){if(d.length!=n)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${n})`);c(),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"?rr.of(p.split(s||aA)):p:rr.empty,b=g.length;if(h==m&&b==0)return;h<o&&c(),h>o&&Zo(r,h-o,-1),Zo(r,m-h,b),of(i,r,g),o=m}}return u(t),c(!a),a}static empty(t){return new to(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],s=[];for(let r=0;r<t.length;r++){let i=t[r];if(typeof i=="number")n.push(i,-1);else{if(!Array.isArray(i)||typeof i[0]!="number"||i.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;s.length<r;)s.push(rr.empty);s[r]=rr.of(i.slice(1)),n.push(i[0],s[r].length)}}}return new to(n,s)}static createSet(t,n){return new to(t,n)}}function Zo(e,t,n,s=!1){if(t==0&&n<=0)return;let r=e.length-2;r>=0&&n<=0&&n==e[r+1]?e[r]+=t:r>=0&&t==0&&e[r]==0?e[r+1]+=n:s?(e[r]+=t,e[r+1]+=n):e.push(t,n)}function of(e,t,n){if(n.length==0)return;let s=t.length-2>>1;if(s<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<s;)e.push(rr.empty);e.push(n)}}function lA(e,t,n){let s=e.inserted;for(let r=0,i=0,o=0;o<e.sections.length;){let a=e.sections[o++],c=e.sections[o++];if(c<0)r+=a,i+=a;else{let u=r,d=i,h=rr.empty;for(;u+=a,d+=c,c&&s&&(h=h.append(s[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)a=e.sections[o++],c=e.sections[o++];t(r,u,i,d,h),r=u,i=d}}}function cA(e,t,n,s=!1){let r=[],i=s?[]:null,o=new Wx(e),a=new Wx(t);for(let c=-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);Zo(r,u,-1),o.forward(u),a.forward(u)}else if(a.ins>=0&&(o.ins<0||c==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!n))){let u=a.len;for(Zo(r,a.ins,-1);u;){let d=Math.min(o.len,u);o.ins>=0&&c<o.i&&o.len<=d&&(Zo(r,0,o.ins),i&&of(i,r,o.text),c=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;Zo(r,u,c<o.i?o.ins:0),i&&c<o.i&&of(i,r,o.text),c=o.i,o.forward(o.len-d)}else{if(o.done&&a.done)return i?to.createSet(r,i):Ru.create(r);throw new Error("Mismatched change set lengths")}}}function $te(e,t,n=!1){let s=[],r=n?[]:null,i=new Wx(e),o=new Wx(t);for(let a=!1;;){if(i.done&&o.done)return r?to.createSet(s,r):Ru.create(s);if(i.ins==0)Zo(s,i.len,0,a),i.next();else if(o.len==0&&!o.done)Zo(s,0,o.ins,a),r&&of(r,s,o.text),o.next();else{if(i.done||o.done)throw new Error("Mismatched change set lengths");{let c=Math.min(i.len2,o.len),u=s.length;if(i.ins==-1){let d=o.ins==-1?-1:o.off?0:o.ins;Zo(s,c,d,a),r&&d&&of(r,s,o.text)}else o.ins==-1?(Zo(s,i.off?0:i.len,c,a),r&&of(r,s,i.textBit(c))):(Zo(s,i.off?0:i.len,o.off?0:o.ins,a),r&&!o.off&&of(r,s,o.text));a=(i.ins>c||o.ins>=0&&o.len>c)&&(a||s.length>u),i.forward2(c),o.forward(c)}}}}class Wx{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?rr.empty:t[n]}textBit(t){let{inserted:n}=this.set,s=this.i-2>>1;return s>=n.length&&!t?rr.empty:n[s].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class hp{constructor(t,n,s){this.from=t,this.to=n,this.flags=s}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,n=-1){let s,r;return this.empty?s=r=t.mapPos(this.from,n):(s=t.mapPos(this.from,1),r=t.mapPos(this.to,-1)),s==this.from&&r==this.to?this:new hp(s,r,this.flags)}extend(t,n=t,s=0){if(t<=this.anchor&&n>=this.anchor)return Ye.range(t,n,void 0,void 0,s);let r=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return Ye.range(this.anchor,r,void 0,void 0,s)}eq(t,n=!1){return this.anchor==t.anchor&&this.head==t.head&&this.goalColumn==t.goalColumn&&(!n||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Ye.range(t.anchor,t.head)}static create(t,n,s){return new hp(t,n,s)}}class Ye{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:Ye.create(this.ranges.map(s=>s.map(t,n)),this.mainIndex)}eq(t,n=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let s=0;s<this.ranges.length;s++)if(!this.ranges[s].eq(t.ranges[s],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Ye([this.main],0)}addRange(t,n=!0){return Ye.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let s=this.ranges.slice();return s[n]=t,Ye.create(s,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(t=>t.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ye(t.ranges.map(n=>hp.fromJSON(n)),t.main)}static single(t,n=t){return new Ye([Ye.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let s=0,r=0;r<t.length;r++){let i=t[r];if(i.empty?i.from<=s:i.from<s)return Ye.normalized(t.slice(),n);s=i.to}return new Ye(t,n)}static cursor(t,n=0,s,r){return hp.create(t,t,(n==0?0:n<0?8:16)|(s==null?7:Math.min(6,s))|(r??16777215)<<6)}static range(t,n,s,r,i){let o=(s??16777215)<<6|(r==null?7:Math.min(6,r));return!i&&t!=n&&(i=n<t?1:-1),n<t?hp.create(n,t,48|o):hp.create(t,n,(i?i<0?8:16:0)|o)}static normalized(t,n=0){let s=t[n];t.sort((r,i)=>r.from-i.from),n=t.indexOf(s);for(let r=1;r<t.length;r++){let i=t[r],o=t[r-1];if(i.empty?i.from<=o.to:i.from<o.to){let a=o.from,c=Math.max(i.to,o.to);r<=n&&n--,t.splice(--r,2,i.anchor>i.head?Ye.range(c,a):Ye.range(a,c))}}return new Ye(t,n)}}function zte(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let VM=0;class on{constructor(t,n,s,r,i){this.combine=t,this.compareInput=n,this.compare=s,this.isStatic=r,this.id=VM++,this.default=t([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(t={}){return new on(t.combine||(n=>n),t.compareInput||((n,s)=>n===s),t.compare||(t.combine?(n,s)=>n===s:WM),!!t.static,t.enables)}of(t){return new J_([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new J_(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new J_(t,this,2,n)}from(t,n){return n||(n=s=>s),this.compute([t],s=>n(s.field(t)))}}function WM(e,t){return e==t||e.length==t.length&&e.every((n,s)=>n===t[s])}class J_{constructor(t,n,s,r){this.dependencies=t,this.facet=n,this.type=s,this.value=r,this.id=VM++}dynamicSlot(t){var n;let s=this.value,r=this.facet.compareInput,i=this.id,o=t[i]>>1,a=this.type==2,c=!1,u=!1,d=[];for(let h of this.dependencies)h=="doc"?c=!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]=s(h),1},update(h,m){if(c&&m.docChanged||u&&(m.docChanged||m.selection)||uA(h,d)){let p=s(h);if(a?!rz(p,h.values[o],r):!r(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=$S(m,g);if(this.dependencies.every(v=>v instanceof on?m.facet(v)===h.facet(v):v instanceof Ho?m.field(v,!1)==h.field(v,!1):!0)||(a?rz(p=s(h),b,r):r(p=s(h),b)))return h.values[o]=b,0}else p=s(h);return h.values[o]=p,1}}}}function rz(e,t,n){if(e.length!=t.length)return!1;for(let s=0;s<e.length;s++)if(!n(e[s],t[s]))return!1;return!0}function uA(e,t){let n=!1;for(let s of t)sx(e,s)&1&&(n=!0);return n}function RNe(e,t,n){let s=n.map(c=>e[c.id]),r=n.map(c=>c.type),i=s.filter(c=>!(c&1)),o=e[t.id]>>1;function a(c){let u=[];for(let d=0;d<s.length;d++){let h=$S(c,s[d]);if(r[d]==2)for(let m of h)u.push(m);else u.push(h)}return t.combine(u)}return{create(c){for(let u of s)sx(c,u);return c.values[o]=a(c),1},update(c,u){if(!uA(c,i))return 0;let d=a(c);return t.compare(d,c.values[o])?0:(c.values[o]=d,1)},reconfigure(c,u){let d=uA(c,s),h=u.config.facets[t.id],m=u.facet(t);if(h&&!d&&WM(n,h))return c.values[o]=m,0;let p=a(c);return t.compare(p,m)?(c.values[o]=m,0):(c.values[o]=p,1)}}}const Rk=on.define({static:!0});class Ho{constructor(t,n,s,r,i){this.id=t,this.createF=n,this.updateF=s,this.compareF=r,this.spec=i,this.provides=void 0}static define(t){let n=new Ho(VM++,t.create,t.update,t.compare||((s,r)=>s===r),t);return t.provide&&(n.provides=t.provide(n)),n}create(t){let n=t.facet(Rk).find(s=>s.field==this);return((n==null?void 0:n.create)||this.createF)(t)}slot(t){let n=t[this.id]>>1;return{create:s=>(s.values[n]=this.create(s),1),update:(s,r)=>{let i=s.values[n],o=this.updateF(i,r);return this.compareF(i,o)?0:(s.values[n]=o,1)},reconfigure:(s,r)=>{let i=s.facet(Rk),o=r.facet(Rk),a;return(a=i.find(c=>c.field==this))&&a!=o.find(c=>c.field==this)?(s.values[n]=a.create(s),1):r.config.address[this.id]!=null?(s.values[n]=r.field(this),0):(s.values[n]=this.create(s),1)}}}init(t){return[this,Rk.of({field:this,create:t})]}get extension(){return this}}const tp={lowest:4,low:3,default:2,high:1,highest:0};function Jb(e){return t=>new Fte(t,e)}const gm={highest:Jb(tp.highest),high:Jb(tp.high),default:Jb(tp.default),low:Jb(tp.low),lowest:Jb(tp.lowest)};class Fte{constructor(t,n){this.inner=t,this.prec=n}}class c0{of(t){return new dA(this,t)}reconfigure(t){return c0.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class dA{constructor(t,n){this.compartment=t,this.inner=n}}class BS{constructor(t,n,s,r,i,o){for(this.base=t,this.compartments=n,this.dynamicSlots=s,this.address=r,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<s.length;)this.statusTemplate.push(0)}staticFacet(t){let n=this.address[t.id];return n==null?t.default:this.staticValues[n>>1]}static resolve(t,n,s){let r=[],i=Object.create(null),o=new Map;for(let m of DNe(t,n,o))m instanceof Ho?r.push(m):(i[m.facet.id]||(i[m.facet.id]=[])).push(m);let a=Object.create(null),c=[],u=[];for(let m of r)a[m.id]=u.length<<1,u.push(p=>m.slot(p));let d=s==null?void 0:s.config.facets;for(let m in i){let p=i[m],g=p[0].facet,b=d&&d[m]||[];if(p.every(v=>v.type==0))if(a[g.id]=c.length<<1|1,WM(b,p))c.push(s.facet(g));else{let v=g.combine(p.map(x=>x.value));c.push(s&&g.compare(v,s.facet(g))?s.facet(g):v)}else{for(let v of p)v.type==0?(a[v.id]=c.length<<1|1,c.push(v.value)):(a[v.id]=u.length<<1,u.push(x=>v.dynamicSlot(x)));a[g.id]=u.length<<1,u.push(v=>RNe(v,g,p))}}let h=u.map(m=>m(a));return new BS(t,o,h,a,c,i)}}function DNe(e,t,n){let s=[[],[],[],[],[]],r=new Map;function i(o,a){let c=r.get(o);if(c!=null){if(c<=a)return;let u=s[c].indexOf(o);u>-1&&s[c].splice(u,1),o instanceof dA&&n.delete(o.compartment)}if(r.set(o,a),Array.isArray(o))for(let u of o)i(u,a);else if(o instanceof dA){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 Fte)i(o.inner,o.prec);else if(o instanceof Ho)s[a].push(o),o.provides&&i(o.provides,a);else if(o instanceof J_)s[a].push(o),o.facet.extensions&&i(o.facet.extensions,tp.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,tp.default),s.reduce((o,a)=>o.concat(a))}function sx(e,t){if(t&1)return 2;let n=t>>1,s=e.status[n];if(s==4)throw new Error("Cyclic dependency between fields and/or facets");if(s&2)return s;e.status[n]=4;let r=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|r}function $S(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const Hte=on.define(),hA=on.define({combine:e=>e.some(t=>t),static:!0}),qte=on.define({combine:e=>e.length?e[0]:void 0,static:!0}),Ute=on.define(),Vte=on.define(),Wte=on.define(),Gte=on.define({combine:e=>e.length?e[0]:!1});class fh{constructor(t,n){this.type=t,this.value=n}static define(){return new LNe}}class LNe{of(t){return new fh(this,t)}}class PNe{constructor(t){this.map=t}of(t){return new rs(this,t)}}class rs{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 rs(this.type,n)}is(t){return this.type==t}static define(t={}){return new PNe(t.map||(n=>n))}static mapEffects(t,n){if(!t.length)return t;let s=[];for(let r of t){let i=r.map(n);i&&s.push(i)}return s}}rs.reconfigure=rs.define();rs.appendConfig=rs.define();class so{constructor(t,n,s,r,i,o){this.startState=t,this.changes=n,this.selection=s,this.effects=r,this.annotations=i,this.scrollIntoView=o,this._doc=null,this._state=null,s&&zte(s,n.newLength),i.some(a=>a.type==so.time)||(this.annotations=i.concat(so.time.of(Date.now())))}static create(t,n,s,r,i,o){return new so(t,n,s,r,i,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let n of this.annotations)if(n.type==t)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(so.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}so.time=fh.define();so.userEvent=fh.define();so.addToHistory=fh.define();so.remote=fh.define();function ONe(e,t){let n=[];for(let s=0,r=0;;){let i,o;if(s<e.length&&(r==t.length||t[r]>=e[s]))i=e[s++],o=e[s++];else if(r<t.length)i=t[r++],o=t[r++];else return n;!n.length||n[n.length-1]<i?n.push(i,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function Kte(e,t,n){var s;let r,i,o;return n?(r=t.changes,i=to.empty(t.changes.length),o=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),o=e.changes.compose(r)),{changes:o,selection:t.selection?t.selection.map(i):(s=e.selection)===null||s===void 0?void 0:s.map(r),effects:rs.mapEffects(e.effects,r).concat(rs.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function fA(e,t,n){let s=t.selection,r=Lg(t.annotations);return t.userEvent&&(r=r.concat(so.userEvent.of(t.userEvent))),{changes:t.changes instanceof to?t.changes:to.of(t.changes||[],n,e.facet(qte)),selection:s&&(s instanceof Ye?s:Ye.single(s.anchor,s.head)),effects:Lg(t.effects),annotations:r,scrollIntoView:!!t.scrollIntoView}}function Yte(e,t,n){let s=fA(e,t.length?t[0]:{},e.doc.length);t.length&&t[0].filter===!1&&(n=!1);for(let i=1;i<t.length;i++){t[i].filter===!1&&(n=!1);let o=!!t[i].sequential;s=Kte(s,fA(e,t[i],o?s.changes.newLength:e.doc.length),o)}let r=so.create(e,s.changes,s.selection,s.effects,s.annotations,s.scrollIntoView);return $Ne(n?BNe(r):r)}function BNe(e){let t=e.startState,n=!0;for(let r of t.facet(Ute)){let i=r(e);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:ONe(n,i))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=to.empty(t.doc.length);else{let o=e.changes.filter(n);r=o.changes,i=o.filtered.mapDesc(o.changes).invertedDesc}e=so.create(t,r,e.selection&&e.selection.map(i),rs.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let s=t.facet(Vte);for(let r=s.length-1;r>=0;r--){let i=s[r](e);i instanceof so?e=i:Array.isArray(i)&&i.length==1&&i[0]instanceof so?e=i[0]:e=Yte(t,Lg(i),!1)}return e}function $Ne(e){let t=e.startState,n=t.facet(Wte),s=e;for(let r=n.length-1;r>=0;r--){let i=n[r](e);i&&Object.keys(i).length&&(s=Kte(s,fA(t,i,e.changes.newLength),!0))}return s==e?e:so.create(t,e.changes,e.selection,s.effects,s.annotations,s.scrollIntoView)}const zNe=[];function Lg(e){return e==null?zNe:Array.isArray(e)?e:[e]}var ii=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(ii||(ii={}));const FNe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let mA;try{mA=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function HNe(e){if(mA)return mA.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||FNe.test(n)))return!0}return!1}function qNe(e){return t=>{if(!/\S/.test(t))return ii.Space;if(HNe(t))return ii.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return ii.Word;return ii.Other}}class Ks{constructor(t,n,s,r,i,o){this.config=t,this.doc=n,this.selection=s,this.values=r,this.status=t.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)sx(this,a<<1);this.computeSlot=null}field(t,n=!0){let s=this.config.address[t.id];if(s==null){if(n)throw new RangeError("Field is not present in this state");return}return sx(this,s),$S(this,s)}update(...t){return Yte(this,t,!0)}applyTransaction(t){let n=this.config,{base:s,compartments:r}=n;for(let a of t.effects)a.is(c0.reconfigure)?(n&&(r=new Map,n.compartments.forEach((c,u)=>r.set(u,c)),n=null),r.set(a.value.compartment,a.value.extension)):a.is(rs.reconfigure)?(n=null,s=a.value):a.is(rs.appendConfig)&&(n=null,s=Lg(s).concat(a.value));let i;n?i=t.startState.values.slice():(n=BS.resolve(s,r,this),i=new Ks(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,u)=>u.reconfigure(c,this),null).values);let o=t.startState.facet(hA)?t.newSelection:t.newSelection.asSingle();new Ks(n,t.newDoc,o,i,(a,c)=>c.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:Ye.cursor(n.from+t.length)}))}changeByRange(t){let n=this.selection,s=t(n.ranges[0]),r=this.changes(s.changes),i=[s.range],o=Lg(s.effects);for(let a=1;a<n.ranges.length;a++){let c=t(n.ranges[a]),u=this.changes(c.changes),d=u.map(r);for(let m=0;m<a;m++)i[m]=i[m].map(d);let h=r.mapDesc(u,!0);i.push(c.range.map(h)),r=r.compose(d),o=rs.mapEffects(o,d).concat(rs.mapEffects(Lg(c.effects),h))}return{changes:r,selection:Ye.create(i,n.mainIndex),effects:o}}changes(t=[]){return t instanceof to?t:to.of(t,this.doc.length,this.facet(Ks.lineSeparator))}toText(t){return rr.of(t.split(this.facet(Ks.lineSeparator)||aA))}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:(sx(this,n),$S(this,n))}toJSON(t){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let s in t){let r=t[s];r instanceof Ho&&this.config.address[r.id]!=null&&(n[s]=r.spec.toJSON(this.field(t[s]),this))}return n}static fromJSON(t,n={},s){if(!t||typeof t.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(s){for(let i in s)if(Object.prototype.hasOwnProperty.call(t,i)){let o=s[i],a=t[i];r.push(o.init(c=>o.spec.fromJSON(a,c)))}}return Ks.create({doc:t.doc,selection:Ye.fromJSON(t.selection),extensions:n.extensions?r.concat([n.extensions]):r})}static create(t={}){let n=BS.resolve(t.extensions||[],new Map),s=t.doc instanceof rr?t.doc:rr.of((t.doc||"").split(n.staticFacet(Ks.lineSeparator)||aA)),r=t.selection?t.selection instanceof Ye?t.selection:Ye.single(t.selection.anchor,t.selection.head):Ye.single(0);return zte(r,s.length),n.staticFacet(hA)||(r=r.asSingle()),new Ks(n,s,r,n.dynamicSlots.map(()=>null),(i,o)=>o.create(i),null)}get tabSize(){return this.facet(Ks.tabSize)}get lineBreak(){return this.facet(Ks.lineSeparator)||`
`}get readOnly(){return this.facet(Gte)}phrase(t,...n){for(let s of this.facet(Ks.phrases))if(Object.prototype.hasOwnProperty.call(s,t)){t=s[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(s,r)=>{if(r=="$")return"$";let i=+(r||1);return!i||i>n.length?s:n[i-1]})),t}languageDataAt(t,n,s=-1){let r=[];for(let i of this.facet(Hte))for(let o of i(this,n,s))Object.prototype.hasOwnProperty.call(o,t)&&r.push(o[t]);return r}charCategorizer(t){let n=this.languageDataAt("wordChars",t);return qNe(n.length?n[0]:"")}wordAt(t){let{text:n,from:s,length:r}=this.doc.lineAt(t),i=this.charCategorizer(t),o=t-s,a=t-s;for(;o>0;){let c=_o(n,o,!1);if(i(n.slice(c,o))!=ii.Word)break;o=c}for(;a<r;){let c=_o(n,a);if(i(n.slice(a,c))!=ii.Word)break;a=c}return o==a?null:Ye.range(o+s,a+s)}}Ks.allowMultipleSelections=hA;Ks.tabSize=on.define({combine:e=>e.length?e[0]:4});Ks.lineSeparator=qte;Ks.readOnly=Gte;Ks.phrases=on.define({compare(e,t){let n=Object.keys(e),s=Object.keys(t);return n.length==s.length&&n.every(r=>e[r]==t[r])}});Ks.languageData=Hte;Ks.changeFilter=Ute;Ks.transactionFilter=Vte;Ks.transactionExtender=Wte;c0.reconfigure=rs.define();function Yu(e,t,n={}){let s={};for(let r of e)for(let i of Object.keys(r)){let o=r[i],a=s[i];if(a===void 0)s[i]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(n,i))s[i]=n[i](a,o);else throw new Error("Config merge conflict for field "+i)}for(let r in t)s[r]===void 0&&(s[r]=t[r]);return s}class Wf{eq(t){return this==t}range(t,n=t){return pA.create(t,n,this)}}Wf.prototype.startSide=Wf.prototype.endSide=0;Wf.prototype.point=!1;Wf.prototype.mapMode=Ta.TrackDel;function GM(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}let pA=class Xte{constructor(t,n,s){this.from=t,this.to=n,this.value=s}static create(t,n,s){return new Xte(t,n,s)}};function gA(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class KM{constructor(t,n,s,r){this.from=t,this.to=n,this.value=s,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(t,n,s,r=0){let i=s?this.to:this.from;for(let o=r,a=i.length;;){if(o==a)return o;let c=o+a>>1,u=i[c]-t||(s?this.value[c].endSide:this.value[c].startSide)-n;if(c==o)return u>=0?o:a;u>=0?a=c:o=c+1}}between(t,n,s,r){for(let i=this.findIndex(n,-1e9,!0),o=this.findIndex(s,1e9,!1,i);i<o;i++)if(r(this.from[i]+t,this.to[i]+t,this.value[i])===!1)return!1}map(t,n){let s=[],r=[],i=[],o=-1,a=-1;for(let c=0;c<this.value.length;c++){let u=this.value[c],d=this.from[c]+t,h=this.to[c]+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)),s.push(u),r.push(m-o),i.push(p-o))}return{mapped:s.length?new KM(r,i,s,a):null,pos:o}}}class Rs{constructor(t,n,s,r){this.chunkPos=t,this.chunk=n,this.nextLayer=s,this.maxPoint=r}static create(t,n,s,r){return new Rs(t,n,s,r)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let n of this.chunk)t+=n.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:n=[],sort:s=!1,filterFrom:r=0,filterTo:i=this.length}=t,o=t.filter;if(n.length==0&&!o)return this;if(s&&(n=n.slice().sort(gA)),this.isEmpty)return n.length?Rs.of(n):this;let a=new Qte(this,null,-1).goto(0),c=0,u=[],d=new Ou;for(;a.value||c<n.length;)if(c<n.length&&(a.from-n[c].from||a.startSide-n[c].value.startSide)>=0){let h=n[c++];d.addInner(h.from,h.to,h.value)||u.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(c==n.length||this.chunkEnd(a.chunkIndex)<n[c].from)&&(!o||r>this.chunkEnd(a.chunkIndex)||i<this.chunkPos[a.chunkIndex])&&d.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||r>a.to||i<a.from||o(a.from,a.to,a.value))&&(d.addInner(a.from,a.to,a.value)||u.push(pA.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!u.length?Rs.empty:this.nextLayer.update({add:u,filter:o,filterFrom:r,filterTo:i}))}map(t){if(t.empty||this.isEmpty)return this;let n=[],s=[],r=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],c=this.chunk[o],u=t.touchesRange(a,a+c.length);if(u===!1)r=Math.max(r,c.maxPoint),n.push(c),s.push(t.mapPos(a));else if(u===!0){let{mapped:d,pos:h}=c.map(a,t);d&&(r=Math.max(r,d.maxPoint),n.push(d),s.push(h))}}let i=this.nextLayer.map(t);return n.length==0?i:new Rs(s,n,i||Rs.empty,r)}between(t,n,s){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let i=this.chunkPos[r],o=this.chunk[r];if(n>=i&&t<=i+o.length&&o.between(i,t-i,n-i,s)===!1)return}this.nextLayer.between(t,n,s)}}iter(t=0){return Gx.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return Gx.from(t).goto(n)}static compare(t,n,s,r,i=-1){let o=t.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=i),a=n.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=i),c=iz(o,a,s),u=new Zb(o,c,i),d=new Zb(a,c,i);s.iterGaps((h,m,p)=>oz(u,h,d,m,p,r)),s.empty&&s.length==0&&oz(u,0,d,0,0,r)}static eq(t,n,s=0,r){r==null&&(r=999999999);let i=t.filter(d=>!d.isEmpty&&n.indexOf(d)<0),o=n.filter(d=>!d.isEmpty&&t.indexOf(d)<0);if(i.length!=o.length)return!1;if(!i.length)return!0;let a=iz(i,o),c=new Zb(i,a,0).goto(s),u=new Zb(o,a,0).goto(s);for(;;){if(c.to!=u.to||!bA(c.active,u.active)||c.point&&(!u.point||!GM(c.point,u.point)))return!1;if(c.to>r)return!0;c.next(),u.next()}}static spans(t,n,s,r,i=-1){let o=new Zb(t,null,i).goto(n),a=n,c=o.openStart;for(;;){let u=Math.min(o.to,s);if(o.point){let d=o.activeForPoint(o.to),h=o.pointFrom<n?d.length+1:o.point.startSide<0?d.length:Math.min(d.length,c);r.point(a,u,o.point,d,h,o.pointRank),c=Math.min(o.openEnd(u),d.length)}else u>a&&(r.span(a,u,o.active,c),c=o.openEnd(u));if(o.to>s)return c+(o.point&&o.to>s?1:0);a=o.to,o.next()}}static of(t,n=!1){let s=new Ou;for(let r of t instanceof pA?[t]:n?UNe(t):t)s.add(r.from,r.to,r.value);return s.finish()}static join(t){if(!t.length)return Rs.empty;let n=t[t.length-1];for(let s=t.length-2;s>=0;s--)for(let r=t[s];r!=Rs.empty;r=r.nextLayer)n=new Rs(r.chunkPos,r.chunk,n,Math.max(r.maxPoint,n.maxPoint));return n}}Rs.empty=new Rs([],[],null,-1);function UNe(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let s=e[n];if(gA(t,s)>0)return e.slice().sort(gA);t=s}return e}Rs.empty.nextLayer=Rs.empty;class Ou{finishChunk(t){this.chunks.push(new KM(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,n,s){this.addInner(t,n,s)||(this.nextLayer||(this.nextLayer=new Ou)).add(t,n,s)}addInner(t,n,s){let r=t-this.lastTo||s.startSide-this.last.endSide;if(r<=0&&(t-this.lastFrom||s.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(n-this.chunkStart),this.last=s,this.lastFrom=t,this.lastTo=n,this.value.push(s),s.point&&(this.maxPoint=Math.max(this.maxPoint,n-t)),!0)}addChunk(t,n){if((t-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(t);let s=n.value.length-1;return this.last=n.value[s],this.lastFrom=n.from[s]+t,this.lastTo=n.to[s]+t,!0}finish(){return this.finishInner(Rs.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=Rs.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function iz(e,t,n){let s=new Map;for(let i of e)for(let o=0;o<i.chunk.length;o++)i.chunk[o].maxPoint<=0&&s.set(i.chunk[o],i.chunkPos[o]);let r=new Set;for(let i of t)for(let o=0;o<i.chunk.length;o++){let a=s.get(i.chunk[o]);a!=null&&(n?n.mapPos(a):a)==i.chunkPos[o]&&!(n!=null&&n.touchesRange(a,a+i.chunk[o].length))&&r.add(i.chunk[o])}return r}class Qte{constructor(t,n,s,r=0){this.layer=t,this.skip=n,this.minPoint=s,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(t,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,n,!1),this}gotoInner(t,n,s){for(;this.chunkIndex<this.layer.chunk.length;){let r=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<t||r.maxPoint<this.minPoint))break;this.chunkIndex++,s=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],n,!0);(!s||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(t,n){(this.to-t||this.endSide-n)<0&&this.gotoInner(t,n,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let t=this.layer.chunkPos[this.chunkIndex],n=this.layer.chunk[this.chunkIndex],s=t+n.from[this.rangeIndex];if(this.from=s,this.to=t+n.to[this.rangeIndex],this.value=n.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=t}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide}}class Gx{constructor(t){this.heap=t}static from(t,n=null,s=-1){let r=[];for(let i=0;i<t.length;i++)for(let o=t[i];!o.isEmpty;o=o.nextLayer)o.maxPoint>=s&&r.push(new Qte(o,n,s,i));return r.length==1?r[0]:new Gx(r)}get startSide(){return this.value?this.value.startSide:0}goto(t,n=-1e9){for(let s of this.heap)s.goto(t,n);for(let s=this.heap.length>>1;s>=0;s--)v6(this.heap,s);return this.next(),this}forward(t,n){for(let s of this.heap)s.forward(t,n);for(let s=this.heap.length>>1;s>=0;s--)v6(this.heap,s);(this.to-t||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),v6(this.heap,0)}}}function v6(e,t){for(let n=e[t];;){let s=(t<<1)+1;if(s>=e.length)break;let r=e[s];if(s+1<e.length&&r.compare(e[s+1])>=0&&(r=e[s+1],s++),n.compare(r)<0)break;e[s]=n,e[t]=r,t=s}}class Zb{constructor(t,n,s){this.minPoint=s,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Gx.from(t,n,s)}goto(t,n=-1e9){return this.cursor.goto(t,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=n,this.openStart=-1,this.next(),this}forward(t,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(t,n)}removeActive(t){Dk(this.active,t),Dk(this.activeTo,t),Dk(this.activeRank,t),this.minActive=az(this.active,this.activeTo)}addActive(t){let n=0,{value:s,to:r,rank:i}=this.cursor;for(;n<this.activeRank.length&&(i-this.activeRank[n]||r-this.activeTo[n])>0;)n++;Lk(this.active,n,s),Lk(this.activeTo,n,r),Lk(this.activeRank,n,i),t&&Lk(t,n,this.cursor.from),this.minActive=az(this.active,this.activeTo)}next(){let t=this.to,n=this.point;this.point=null;let s=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>t){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),s&&Dk(s,r)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(s),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=i,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=i.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(s){this.openStart=0;for(let r=s.length-1;r>=0&&s[r]<t;r--)this.openStart++}}activeForPoint(t){if(!this.active.length)return this.active;let n=[];for(let s=this.active.length-1;s>=0&&!(this.activeRank[s]<this.pointRank);s--)(this.activeTo[s]>t||this.activeTo[s]==t&&this.active[s].endSide>=this.point.endSide)&&n.push(this.active[s]);return n.reverse()}openEnd(t){let n=0;for(let s=this.activeTo.length-1;s>=0&&this.activeTo[s]>t;s--)n++;return n}}function oz(e,t,n,s,r,i){e.goto(t),n.goto(s);let o=s+r,a=s,c=s-t,u=!!i.boundChange;for(let d=!1;;){let h=e.to+c-n.to,m=h||e.endSide-n.endSide,p=m<0?e.to+c:n.to,g=Math.min(p,o);if(e.point||n.point?(e.point&&n.point&&GM(e.point,n.point)&&bA(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(a,g,e.point,n.point),d=!1):(d&&i.boundChange(a),g>a&&!bA(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 bA(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!GM(e[n],t[n]))return!1;return!0}function Dk(e,t){for(let n=t,s=e.length-1;n<s;n++)e[n]=e[n+1];e.pop()}function Lk(e,t,n){for(let s=e.length-1;s>=t;s--)e[s+1]=e[s];e[t]=n}function az(e,t){let n=-1,s=1e9;for(let r=0;r<t.length;r++)(t[r]-s||e[r].endSide-e[n].endSide)<0&&(n=r,s=t[r]);return n}function nb(e,t,n=e.length){let s=0;for(let r=0;r<n&&r<e.length;)e.charCodeAt(r)==9?(s+=t-s%t,r++):(s++,r=_o(e,r));return s}function yA(e,t,n,s){for(let r=0,i=0;;){if(i>=t)return r;if(r==e.length)break;i+=e.charCodeAt(r)==9?n-i%n:1,r=_o(e,r)}return s===!0?-1:e.length}const xA="ͼ",lz=typeof Symbol>"u"?"__"+xA:Symbol.for(xA),vA=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),cz=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Gf{constructor(t,n){this.rules=[];let{finish:s}=n||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function i(o,a,c,u){let d=[],h=/^@(\w+)\b/.exec(o[0]),m=h&&h[1]=="keyframes";if(h&&a==null)return c.push(o[0]+";");for(let p in a){let g=a[p];if(/&/.test(p))i(p.split(/,\s*/).map(b=>o.map(v=>b.replace(/&/,v))).reduce((b,v)=>b.concat(v)),g,c);else if(g&&typeof g=="object"){if(!h)throw new RangeError("The value of a property ("+p+") should be a primitive value.");i(r(p),g,d,m)}else g!=null&&d.push(p.replace(/_.*/,"").replace(/[A-Z]/g,b=>"-"+b.toLowerCase())+": "+g+";")}(d.length||m)&&c.push((s&&!h&&!u?o.map(s):o).join(", ")+" {"+d.join(" ")+"}")}for(let o in t)i(r(o),t[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let t=cz[lz]||1;return cz[lz]=t+1,xA+t.toString(36)}static mount(t,n,s){let r=t[vA],i=s&&s.nonce;r?i&&r.setNonce(i):r=new VNe(t,i),r.mount(Array.isArray(n)?n:[n],t)}}let uz=new Map;class VNe{constructor(t,n){let s=t.ownerDocument||t,r=s.defaultView;if(!t.head&&t.adoptedStyleSheets&&r.CSSStyleSheet){let i=uz.get(s);if(i)return t[vA]=i;this.sheet=new r.CSSStyleSheet,uz.set(s,this)}else this.styleTag=s.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[vA]=this}mount(t,n){let s=this.sheet,r=0,i=0;for(let o=0;o<t.length;o++){let a=t[o],c=this.modules.indexOf(a);if(c<i&&c>-1&&(this.modules.splice(c,1),i--,c=-1),c==-1){if(this.modules.splice(i++,0,a),s)for(let u=0;u<a.rules.length;u++)s.insertRule(a.rules[u],r++)}else{for(;i<c;)r+=this.modules[i++].rules.length;r+=a.rules.length,i++}}if(s)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let o="";for(let c=0;c<this.modules.length;c++)o+=this.modules[c].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 Kf={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:"'"},Kx={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},WNe=typeof navigator<"u"&&/Mac/.test(navigator.platform),GNe=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ro=0;Ro<10;Ro++)Kf[48+Ro]=Kf[96+Ro]=String(Ro);for(var Ro=1;Ro<=24;Ro++)Kf[Ro+111]="F"+Ro;for(var Ro=65;Ro<=90;Ro++)Kf[Ro]=String.fromCharCode(Ro+32),Kx[Ro]=String.fromCharCode(Ro);for(var w6 in Kf)Kx.hasOwnProperty(w6)||(Kx[w6]=Kf[w6]);function KNe(e){var t=WNe&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||GNe&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Kx:Kf)[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 Cr(){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 s in n)if(Object.prototype.hasOwnProperty.call(n,s)){var r=n[s];typeof r=="string"?e.setAttribute(s,r):r!=null&&(e[s]=r)}t++}for(;t<arguments.length;t++)Jte(e,arguments[t]);return e}function Jte(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++)Jte(e,t[n]);else throw new RangeError("Unsupported child node: "+t)}let wa=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},wA=typeof document<"u"?document:{documentElement:{style:{}}};const kA=/Edge\/(\d+)/.exec(wa.userAgent),Zte=/MSIE \d/.test(wa.userAgent),_A=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(wa.userAgent),Z3=!!(Zte||_A||kA),dz=!Z3&&/gecko\/(\d+)/i.test(wa.userAgent),k6=!Z3&&/Chrome\/(\d+)/.exec(wa.userAgent),hz="webkitFontSmoothing"in wA.documentElement.style,SA=!Z3&&/Apple Computer/.test(wa.vendor),fz=SA&&(/Mobile\/\w+/.test(wa.userAgent)||wa.maxTouchPoints>2);var rn={mac:fz||/Mac/.test(wa.platform),windows:/Win/.test(wa.platform),linux:/Linux|X11/.test(wa.platform),ie:Z3,ie_version:Zte?wA.documentMode||6:_A?+_A[1]:kA?+kA[1]:0,gecko:dz,gecko_version:dz?+(/Firefox\/(\d+)/.exec(wa.userAgent)||[0,0])[1]:0,chrome:!!k6,chrome_version:k6?+k6[1]:0,ios:fz,android:/Android\b/.test(wa.userAgent),webkit:hz,webkit_version:hz?+(/\bAppleWebKit\/(\d+)/.exec(wa.userAgent)||[0,0])[1]:0,safari:SA,safari_version:SA?+(/\bVersion\/(\d+(\.\d+)?)/.exec(wa.userAgent)||[0,0])[1]:0,tabSize:wA.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function YM(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 zS=Object.create(null);function XM(e,t,n){if(e==t)return!0;e||(e=zS),t||(t=zS);let s=Object.keys(e),r=Object.keys(t);if(s.length-0!=r.length-0)return!1;for(let i of s)if(i!=n&&(r.indexOf(i)==-1||e[i]!==t[i]))return!1;return!0}function YNe(e,t){for(let n=e.attributes.length-1;n>=0;n--){let s=e.attributes[n].name;t[s]==null&&e.removeAttribute(s)}for(let n in t){let s=t[n];n=="style"?e.style.cssText=s:e.getAttribute(n)!=s&&e.setAttribute(n,s)}}function mz(e,t,n){let s=!1;if(t)for(let r in t)n&&r in n||(s=!0,r=="style"?e.style.cssText="":e.removeAttribute(r));if(n)for(let r in n)t&&t[r]==n[r]||(s=!0,r=="style"?e.style.cssText=n[r]:e.setAttribute(r,n[r]));return s}function XNe(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let s=e.attributes[n];t[s.name]=s.value}return t}class Ol{eq(t){return!1}updateDOM(t,n,s){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,n,s){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}}var Fo=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(Fo||(Fo={}));class vn extends Wf{constructor(t,n,s,r){super(),this.startSide=t,this.endSide=n,this.widget=s,this.spec=r}get heightRelevant(){return!1}static mark(t){return new Yv(t)}static widget(t){let n=Math.max(-1e4,Math.min(1e4,t.side||0)),s=!!t.block;return n+=s&&!t.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new Bp(t,n,n,s,t.widget||null,!1)}static replace(t){let n=!!t.block,s,r;if(t.isBlockGap)s=-5e8,r=4e8;else{let{start:i,end:o}=ene(t,n);s=(i?n?-3e8:-1:5e8)-1,r=(o?n?2e8:1:-6e8)+1}return new Bp(t,s,r,n,t.widget||null,!0)}static line(t){return new Xv(t)}static set(t,n=!1){return Rs.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}vn.none=Rs.empty;class Yv extends vn{constructor(t){let{start:n,end:s}=ene(t);super(n?-1:5e8,s?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?YM(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||zS}eq(t){return this==t||t instanceof Yv&&this.tagName==t.tagName&&XM(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)}}Yv.prototype.point=!1;class Xv extends vn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof Xv&&this.spec.class==t.spec.class&&XM(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)}}Xv.prototype.mapMode=Ta.TrackBefore;Xv.prototype.point=!0;class Bp extends vn{constructor(t,n,s,r,i,o){super(n,s,i,t),this.block=r,this.isReplace=o,this.mapMode=r?n<=0?Ta.TrackBefore:Ta.TrackAfter:Ta.TrackDel}get type(){return this.startSide!=this.endSide?Fo.WidgetRange:this.startSide<=0?Fo.WidgetBefore:Fo.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Bp&&QNe(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)}}Bp.prototype.point=!0;function ene(e,t=!1){let{inclusiveStart:n,inclusiveEnd:s}=e;return n==null&&(n=e.inclusive),s==null&&(s=e.inclusive),{start:n??t,end:s??t}}function QNe(e,t){return e==t||!!(e&&t&&e.compare(t))}function Pg(e,t,n,s=0){let r=n.length-1;r>=0&&n[r]+s>=e?n[r]=Math.max(n[r],t):n.push(e,t)}class Yx extends Wf{constructor(t,n,s){super(),this.tagName=t,this.attributes=n,this.rank=s}eq(t){return t==this||t instanceof Yx&&this.tagName==t.tagName&&XM(this.attributes,t.attributes)}static create(t){return new Yx(t.tagName,t.attributes||zS,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return Rs.of(t,n)}}Yx.prototype.startSide=Yx.prototype.endSide=-1;function Xx(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function CA(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function rx(e,t){if(!t.anchorNode)return!1;try{return CA(e,t.anchorNode)}catch{return!1}}function ix(e){return e.nodeType==3?Jx(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function ox(e,t,n,s){return n?pz(e,t,n,s,-1)||pz(e,t,n,s,1):!1}function Yf(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function FS(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function pz(e,t,n,s,r){for(;;){if(e==n&&t==s)return!0;if(t==(r<0?0:nh(e))){if(e.nodeName=="DIV")return!1;let i=e.parentNode;if(!i||i.nodeType!=1)return!1;t=Yf(e)+(r<0?0:1),e=i}else if(e.nodeType==1){if(e=e.childNodes[t+(r<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;t=r<0?nh(e):0}else return!1}}function nh(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Qx(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function JNe(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 tne(e,t){let n=t.width/e.offsetWidth,s=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(s>.995&&s<1.005||!isFinite(s)||Math.abs(t.height-e.offsetHeight)<1)&&(s=1),{scaleX:n,scaleY:s}}function ZNe(e,t,n,s,r,i,o,a){let c=e.ownerDocument,u=c.defaultView||window;for(let d=e,h=!1;d&&!h;)if(d.nodeType==1){let m,p=d==c.body,g=1,b=1;if(p)m=JNe(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}=tne(d,y)),m={left:y.left,right:y.left+d.clientWidth*g,top:y.top,bottom:y.top+d.clientHeight*b}}let v=0,x=0;if(r=="nearest")t.top<m.top+o?(x=t.top-(m.top+o),n>0&&t.bottom>m.bottom+x&&(x=t.bottom-m.bottom+o)):t.bottom>m.bottom-o&&(x=t.bottom-m.bottom+o,n<0&&t.top-x<m.top&&(x=t.top-(m.top+o)));else{let y=t.bottom-t.top,w=m.bottom-m.top;x=(r=="center"&&y<=w?t.top+y/2-w/2:r=="start"||r=="center"&&n<0?t.top-o:t.bottom-w+o)-m.top}if(s=="nearest"?t.left<m.left+i?(v=t.left-(m.left+i),n>0&&t.right>m.right+v&&(v=t.right-m.right+i)):t.right>m.right-i&&(v=t.right-m.right+i,n<0&&t.left<m.left+v&&(v=t.left-(m.left+i))):v=(s=="center"?t.left+(t.right-t.left)/2-(m.right-m.left)/2:s=="start"==a?t.left-i:t.right-(m.right-m.left)+i)-m.left,v||x)if(p)u.scrollBy(v,x);else{let y=0,w=0;if(x){let k=d.scrollTop;d.scrollTop+=x/b,w=(d.scrollTop-k)*b}if(v){let k=d.scrollLeft;d.scrollLeft+=v/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-v)<1&&(s="nearest"),w&&Math.abs(w-x)<1&&(r="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 nne(e,t=!0){let n=e.ownerDocument,s=null,r=null;for(let i=e.parentNode;i&&!(i==n.body||(!t||s)&&r);)if(i.nodeType==1)!r&&i.scrollHeight>i.clientHeight&&(r=i),t&&!s&&i.scrollWidth>i.clientWidth&&(s=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:s,y:r}}class eje{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:n,focusNode:s}=t;this.set(n,Math.min(t.anchorOffset,n?nh(n):0),s,Math.min(t.focusOffset,s?nh(s):0))}set(t,n,s,r){this.anchorNode=t,this.anchorOffset=n,this.focusNode=s,this.focusOffset=r}}let Xm=null;rn.safari&&rn.safari_version>=26&&(Xm=!1);function sne(e){if(e.setActive)return e.setActive();if(Xm)return e.focus(Xm);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(Xm==null?{get preventScroll(){return Xm={preventScroll:!0},!0}}:void 0),!Xm){Xm=!1;for(let n=0;n<t.length;){let s=t[n++],r=t[n++],i=t[n++];s.scrollTop!=r&&(s.scrollTop=r),s.scrollLeft!=i&&(s.scrollLeft=i)}}}let gz;function Jx(e,t,n=t){let s=gz||(gz=document.createRange());return s.setEnd(e,n),s.setStart(e,t),s}function Og(e,t,n,s){let r={key:t,code:t,keyCode:n,which:n,cancelable:!0};s&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=s);let i=new KeyboardEvent("keydown",r);i.synthetic=!0,e.dispatchEvent(i);let o=new KeyboardEvent("keyup",r);return o.synthetic=!0,e.dispatchEvent(o),i.defaultPrevented||o.defaultPrevented}function tje(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function nje(e,t){let n=t.focusNode,s=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=s)return!1;for(s=Math.min(s,nh(n));;)if(s){if(n.nodeType!=1)return!1;let r=n.childNodes[s-1];r.contentEditable=="false"?s--:(n=r,s=nh(n))}else{if(n==e)return!0;s=Yf(n),n=n.parentNode}}function rne(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 ine(e,t){for(let n=e,s=t;;){if(n.nodeType==3&&s>0)return{node:n,offset:s};if(n.nodeType==1&&s>0){if(n.contentEditable=="false")return null;n=n.childNodes[s-1],s=nh(n)}else if(n.parentNode&&!FS(n))s=Yf(n),n=n.parentNode;else return null}}function one(e,t){for(let n=e,s=t;;){if(n.nodeType==3&&s<n.nodeValue.length)return{node:n,offset:s};if(n.nodeType==1&&s<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[s],s=0}else if(n.parentNode&&!FS(n))s=Yf(n)+1,n=n.parentNode;else return null}}class Ic{constructor(t,n,s=!0){this.node=t,this.offset=n,this.precise=s}static before(t,n){return new Ic(t.parentNode,Yf(t),n)}static after(t,n){return new Ic(t.parentNode,Yf(t)+1,n)}}var Rr=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(Rr||(Rr={}));const $p=Rr.LTR,QM=Rr.RTL;function ane(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const sje=ane("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),rje=ane("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),TA=Object.create(null),iu=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);TA[t]=n,TA[n]=-t}function lne(e){return e<=247?sje[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?rje[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const ije=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Au{get dir(){return this.level%2?QM:$p}constructor(t,n,s){this.from=t,this.to=n,this.level=s}side(t,n){return this.dir==n==t?this.to:this.from}forward(t,n){return t==(this.dir==n)}static find(t,n,s,r){let i=-1;for(let o=0;o<t.length;o++){let a=t[o];if(a.from<=n&&a.to>=n){if(a.level==s)return o;(i<0||(r!=0?r<0?a.from<n:a.to>n:t[i].level>a.level))&&(i=o)}}if(i<0)throw new RangeError("Index out of range");return i}}function cne(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let s=e[n],r=t[n];if(s.from!=r.from||s.to!=r.to||s.direction!=r.direction||!cne(s.inner,r.inner))return!1}return!0}const Mr=[];function oje(e,t,n,s,r){for(let i=0;i<=s.length;i++){let o=i?s[i-1].to:t,a=i<s.length?s[i].from:n,c=i?256:r;for(let u=o,d=c,h=c;u<a;u++){let m=lne(e.charCodeAt(u));m==512?m=d:m==8&&h==4&&(m=16),Mr[u]=m==4?2:m,m&7&&(h=m),d=m}for(let u=o,d=c,h=c;u<a;u++){let m=Mr[u];if(m==128)u<a-1&&d==Mr[u+1]&&d&24?m=Mr[u]=d:Mr[u]=256;else if(m==64){let p=u+1;for(;p<a&&Mr[p]==64;)p++;let g=u&&d==8||p<n&&Mr[p]==8?h==1?1:8:256;for(let b=u;b<p;b++)Mr[b]=g;u=p-1}else m==8&&h==1&&(Mr[u]=1);d=m,m&7&&(h=m)}}}function aje(e,t,n,s,r){let i=r==1?2:1;for(let o=0,a=0,c=0;o<=s.length;o++){let u=o?s[o-1].to:t,d=o<s.length?s[o].from:n;for(let h=u,m,p,g;h<d;h++)if(p=TA[m=e.charCodeAt(h)])if(p<0){for(let b=a-3;b>=0;b-=3)if(iu[b+1]==-p){let v=iu[b+2],x=v&2?r:v&4?v&1?i:r:0;x&&(Mr[h]=Mr[iu[b]]=x),a=b;break}}else{if(iu.length==189)break;iu[a++]=h,iu[a++]=m,iu[a++]=c}else if((g=Mr[h])==2||g==1){let b=g==r;c=b?0:1;for(let v=a-3;v>=0;v-=3){let x=iu[v+2];if(x&2)break;if(b)iu[v+2]|=2;else{if(x&4)break;iu[v+2]|=4}}}}}function lje(e,t,n,s){for(let r=0,i=s;r<=n.length;r++){let o=r?n[r-1].to:e,a=r<n.length?n[r].from:t;for(let c=o;c<a;){let u=Mr[c];if(u==256){let d=c+1;for(;;)if(d==a){if(r==n.length)break;d=n[r++].to,a=r<n.length?n[r].from:t}else if(Mr[d]==256)d++;else break;let h=i==1,m=(d<t?Mr[d]:s)==1,p=h==m?h?1:2:s;for(let g=d,b=r,v=b?n[b-1].to:e;g>c;)g==v&&(g=n[--b].from,v=b?n[b-1].to:e),Mr[--g]=p;c=d}else i=u,c++}}}function EA(e,t,n,s,r,i,o){let a=s%2?2:1;if(s%2==r%2)for(let c=t,u=0;c<n;){let d=!0,h=!1;if(u==i.length||c<i[u].from){let b=Mr[c];b!=a&&(d=!1,h=b==16)}let m=!d&&a==1?[]:null,p=d?s:s+1,g=c;e:for(;;)if(u<i.length&&g==i[u].from){if(h)break e;let b=i[u];if(!d)for(let v=b.to,x=u+1;;){if(v==n)break e;if(x<i.length&&i[x].from==v)v=i[x++].to;else{if(Mr[v]==a)break e;break}}if(u++,m)m.push(b);else{b.from>c&&o.push(new Au(c,b.from,p));let v=b.direction==$p!=!(p%2);AA(e,v?s+1:s,r,b.inner,b.from,b.to,o),c=b.to}g=b.to}else{if(g==n||(d?Mr[g]!=a:Mr[g]==a))break;g++}m?EA(e,c,g,s+1,r,m,o):c<g&&o.push(new Au(c,g,p)),c=g}else for(let c=n,u=i.length;c>t;){let d=!0,h=!1;if(!u||c>i[u-1].to){let b=Mr[c-1];b!=a&&(d=!1,h=b==16)}let m=!d&&a==1?[]:null,p=d?s:s+1,g=c;e:for(;;)if(u&&g==i[u-1].to){if(h)break e;let b=i[--u];if(!d)for(let v=b.from,x=u;;){if(v==t)break e;if(x&&i[x-1].to==v)v=i[--x].from;else{if(Mr[v-1]==a)break e;break}}if(m)m.push(b);else{b.to<c&&o.push(new Au(b.to,c,p));let v=b.direction==$p!=!(p%2);AA(e,v?s+1:s,r,b.inner,b.from,b.to,o),c=b.from}g=b.from}else{if(g==t||(d?Mr[g-1]!=a:Mr[g-1]==a))break;g--}m?EA(e,g,c,s+1,r,m,o):g<c&&o.push(new Au(g,c,p)),c=g}}function AA(e,t,n,s,r,i,o){let a=t%2?2:1;oje(e,r,i,s,a),aje(e,r,i,s,a),lje(r,i,s,a),EA(e,r,i,t,n,s,o)}function cje(e,t,n){if(!e)return[new Au(0,0,t==QM?1:0)];if(t==$p&&!n.length&&!ije.test(e))return une(e.length);if(n.length)for(;e.length>Mr.length;)Mr[Mr.length]=256;let s=[],r=t==$p?0:1;return AA(e,r,r,n,0,e.length,s),s}function une(e){return[new Au(0,e,0)]}let dne="";function uje(e,t,n,s,r){var i;let o=s.head-e.from,a=Au.find(t,o,(i=s.bidiLevel)!==null&&i!==void 0?i:-1,s.assoc),c=t[a],u=c.side(r,n);if(o==u){let m=a+=r?1:-1;if(m<0||m>=t.length)return null;c=t[a=m],o=c.side(!r,n),u=c.side(r,n)}let d=_o(e.text,o,c.forward(r,n));(d<c.from||d>c.to)&&(d=u),dne=e.text.slice(Math.min(o,d),Math.max(o,d));let h=a==(r?t.length-1:0)?null:t[a+(r?1:-1)];return h&&d==u&&h.level+(r?0:1)<c.level?Ye.cursor(h.side(!r,n)+e.from,h.forward(r,n)?1:-1,h.level):Ye.cursor(d+e.from,c.forward(r,n)?-1:1,c.level)}function dje(e,t,n){for(let s=t;s<n;s++){let r=lne(e.charCodeAt(s));if(r==1)return $p;if(r==2||r==4)return QM}return $p}const hne=on.define(),fne=on.define(),mne=on.define(),pne=on.define(),NA=on.define(),gne=on.define(),bne=on.define(),JM=on.define(),ZM=on.define(),yne=on.define({combine:e=>e.some(t=>t)}),xne=on.define({combine:e=>e.some(t=>t)}),vne=on.define();class Bg{constructor(t,n,s,r,i,o=!1){this.range=t,this.y=n,this.x=s,this.yMargin=r,this.xMargin=i,this.isSnapshot=o}map(t){return t.empty?this:new Bg(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 Bg(Ye.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Pk=rs.define({map:(e,t)=>e.map(t)}),wne=rs.define();function Qa(e,t,n){let s=e.facet(pne);s.length?s[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const vd=on.define({combine:e=>e.length?e[0]:!0});let hje=0;const mg=on.define({combine(e){return e.filter((t,n)=>{for(let s=0;s<n;s++)if(e[s].plugin==t.plugin)return!1;return!0})}});class ai{constructor(t,n,s,r,i){this.id=t,this.create=n,this.domEventHandlers=s,this.domEventObservers=r,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(mg.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(mg.of({plugin:this,arg:t}))}static define(t,n){const{eventHandlers:s,eventObservers:r,provide:i,decorations:o}=n||{};return new ai(hje++,t,s,r,a=>{let c=[];return o&&c.push(eC.of(u=>{let d=u.plugin(a);return d?o(d):vn.none})),i&&c.push(i(a)),c})}static fromClass(t,n){return ai.define((s,r)=>new t(s,r),n)}}class _6{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(s){if(Qa(n.state,s,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(n){Qa(t.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(s){Qa(t.state,s,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const kne=on.define(),eI=on.define(),eC=on.define(),_ne=on.define(),tI=on.define(),Qv=on.define(),Sne=on.define();function bz(e,t){let n=e.state.facet(Sne);if(!n.length)return n;let s=n.map(i=>i instanceof Function?i(e):i),r=[];return Rs.spans(s,t.from,t.to,{point(){},span(i,o,a,c){let u=i-t.from,d=o-t.from,h=r;for(let m=a.length-1;m>=0;m--,c--){let p=a[m].spec.bidiIsolate,g;if(p==null&&(p=dje(t.text,u,d)),c>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}}}}),r}const Cne=on.define();function nI(e){let t=0,n=0,s=0,r=0;for(let i of e.state.facet(Cne)){let o=i(e);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(s=Math.max(s,o.top)),o.bottom!=null&&(r=Math.max(r,o.bottom)))}return{left:t,right:n,top:s,bottom:r}}const _y=on.define();class dc{constructor(t,n,s,r){this.fromA=t,this.toA=n,this.fromB=s,this.toB=r}join(t){return new dc(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let n=t.length,s=this;for(;n>0;n--){let r=t[n-1];if(!(r.fromA>s.toA)){if(r.toA<s.fromA)break;s=s.join(r),t.splice(n-1,1)}}return t.splice(n,0,s),t}static extendWithRanges(t,n){if(n.length==0)return t;let s=[];for(let r=0,i=0,o=0;;){let a=r<t.length?t[r].fromB:1e9,c=i<n.length?n[i]:1e9,u=Math.min(a,c);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=r;g<t.length&&t[g].fromB<=h;g++)o=t[g].toA-t[g].toB;m=Math.max(m,p+o)}else if(r<t.length&&t[r].fromB<=h){let p=t[r++];h=Math.max(h,p.toB),m=Math.max(m,p.toA),o=p.toA-p.toB}else break;s.push(new dc(d,m,u,h))}return s}}class HS{constructor(t,n,s){this.view=t,this.state=n,this.transactions=s,this.flags=0,this.startState=t.state,this.changes=to.empty(this.startState.doc.length);for(let i of s)this.changes=this.changes.compose(i.changes);let r=[];this.changes.iterChangedRanges((i,o,a,c)=>r.push(new dc(i,o,a,c))),this.changedRanges=r}static create(t,n,s){return new HS(t,n,s)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const fje=[];class _i{constructor(t,n,s=0){this.dom=t,this.length=n,this.flags=s,this.parent=null,t.cmTile=this}get breakAfter(){return this.flags&1}get children(){return fje}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&&YNe(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(t){this.dom=t,t.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t,n=this.posAtStart){let s=n;for(let r of this.children){if(r==t)return s;s+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}covers(t){return!0}coordsIn(t,n){return null}domPosFor(t,n){let s=Yf(this.dom),r=this.length?t>0:n>0;return new Ic(this.parent.dom,s+(r?1:0),t==0||t==this.length)}markDirty(t){this.flags&=-3,t&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let t=this;t;t=t.parent)if(t instanceof nC)return t;return null}static get(t){return t.cmTile}}class tC extends _i{constructor(t){super(t,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(t){this.children.push(t),t.parent=this}sync(t){if(this.flags&2)return;super.sync(t);let n=this.dom,s=null,r,i=(t==null?void 0:t.node)==n?t:null,o=0;for(let a of this.children){if(a.sync(t),o+=a.length+a.breakAfter,r=s?s.nextSibling:n.firstChild,i&&r!=a.dom&&(i.written=!0),a.dom.parentNode==n)for(;r&&r!=a.dom;)r=yz(r);else n.insertBefore(a.dom,r);s=a.dom}for(r=s?s.nextSibling:n.firstChild,i&&r&&(i.written=!0);r;)r=yz(r);this.length=o}}function yz(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class nC extends tC{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=_i.get(t);if(n&&this.owns(n))return n;t=t.parentNode}}blockTiles(t){for(let n=[],s=this,r=0,i=0;;)if(r==s.children.length){if(!n.length)return;s=s.parent,s.breakAfter&&i++,r=n.pop()}else{let o=s.children[r++];if(o instanceof zd)n.push(r),s=o,r=0;else{let a=i+o.length,c=t(o,i);if(c!==void 0)return c;i=a+o.breakAfter}}}resolveBlock(t,n){let s,r=-1,i,o=-1;if(this.blockTiles((a,c)=>{let u=c+a.length;if(t>=c&&t<=u){if(a.isWidget()&&n>=-1&&n<=1){if(a.flags&32)return!0;a.flags&16&&(s=void 0)}(c<t||t==u&&(n<-1?a.length:a.covers(1)))&&(!s||!a.isWidget()&&s.isWidget())&&(s=a,r=t-c),(u>t||t==c&&(n>1?a.length:a.covers(-1)))&&(!i||!a.isWidget()&&i.isWidget())&&(i=a,o=t-c)}}),!s&&!i)throw new Error("No tile at position "+t);return s&&n<0||!i?{tile:s,offset:r}:{tile:i,offset:o}}}class zd extends tC{constructor(t,n){super(t),this.wrapper=n}isBlock(){return!0}covers(t){return this.children.length?t<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,n){let s=new zd(n||document.createElement(t.tagName),t);return n||(s.flags|=4),s}}class y1 extends tC{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,s){let r=new y1(n||document.createElement("div"),t);return(!n||!s)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(t,n,s){let r=null,i=-1,o=null,a=-1;function c(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()?c(g,h-p):(!o||o.isHidden&&(n>0||s&&pje(o,g)))&&(b>h||g.flags&32)?(o=g,a=h-p):(p<h||g.flags&16&&!g.isHidden)&&(r=g,i=h-p)),p=b}}c(this,t);let u=(n<0?r:o)||r||o;return u?{tile:u,offset:u==r?i:a}:null}coordsIn(t,n){let s=this.resolveInline(t,n,!0);return s?s.tile.coordsIn(Math.max(0,s.offset),n):mje(this)}domIn(t,n){let s=this.resolveInline(t,n);if(s){let{tile:r,offset:i}=s;if(this.dom.contains(r.dom))return r.isText()?new Ic(r.dom,Math.min(r.dom.nodeValue.length,i)):r.domPosFor(i,r.flags&16?1:r.flags&32?-1:n);let o=s.tile.parent,a=!1;for(let c of o.children){if(a)return new Ic(c.dom,0);c==s.tile&&(a=!0)}}return new Ic(this.dom,0)}}function mje(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=ix(t);return n[n.length-1]||null}function pje(e,t){let n=e.coordsIn(0,1),s=t.coordsIn(0,1);return n&&s&&s.top<n.bottom}class Xa extends tC{constructor(t,n){super(t),this.mark=n}get domAttrs(){return this.mark.attrs}static of(t,n){let s=new Xa(n||document.createElement(t.tagName),t);return n||(s.flags|=4),s}}class fp extends _i{constructor(t,n){super(t,n.length),this.text=n}sync(t){this.flags&2||(super.sync(t),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(t,n){let s=this.dom.nodeValue.length;t>s&&(t=s);let r=t,i=t,o=0;t==0&&n<0||t==s&&n>=0?rn.chrome||rn.gecko||(t?(r--,o=1):i<s&&(i++,o=-1)):n<0?r--:i<s&&i++;let a=Jx(this.dom,r,i).getClientRects();if(!a.length)return null;let c=a[(o?o<0:n>=0)?0:a.length-1];return rn.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(a,u=>u.width)||c),o?Qx(c,o<0):c||null}static of(t,n){let s=new fp(n||document.createTextNode(t),t);return n||(s.flags|=2),s}}class zp extends _i{constructor(t,n,s,r){super(t,n,r),this.widget=s}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return this.flags&48?!1:(this.flags&(t<0?64:128))>0}coordsIn(t,n){return this.coordsInWidget(t,n,!1)}coordsInWidget(t,n,s){let r=this.widget.coordsAt(this.dom,t,n);if(r)return r;if(s)return Qx(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 c=a?i.length-1:0;o=i[c],!(t>0?c==0:c==i.length-1||o.top<o.bottom);c+=a?-1:1);return Qx(o,!a)}}get overrideDOMText(){if(!this.length)return rr.empty;let{root:t}=this;if(!t)return rr.empty;let n=this.posAtStart;return t.view.state.doc.slice(n,n+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,n,s,r,i){return i||(i=t.toDOM(n),t.editable||(i.contentEditable="false")),new zp(i,s,t,r)}}class qS extends _i{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 rr.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class gje{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,n,s){let{tile:r,index:i,beforeBreak:o,parents:a}=this;for(;t||n>0;)if(r.isComposite())if(o){if(!t)break;s&&s.break(),t--,o=!1}else if(i==r.children.length){if(!t&&!a.length)break;s&&s.leave(r),o=!!r.breakAfter,{tile:r,index:i}=a.pop(),i++}else{let c=r.children[i],u=c.breakAfter;(n>0?c.length<=t:c.length<t)&&(!s||s.skip(c,0,c.length)!==!1||!c.isComposite)?(o=!!u,i++,t-=c.length):(a.push({tile:r,index:i}),r=c,i=0,s&&c.isComposite()&&s.enter(c))}else if(i==r.length)o=!!r.breakAfter,{tile:r,index:i}=a.pop(),i++;else if(t){let c=Math.min(t,r.length-i);s&&s.skip(r,i,i+c),t-=c,i+=c}else break;return this.tile=r,this.index=i,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class bje{constructor(t,n,s,r){this.from=t,this.to=n,this.wrapper=s,this.rank=r}}class yje{constructor(t,n,s){this.cache=t,this.root=n,this.blockWrappers=s,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(t,n,s,r){var i;this.flushBuffer();let o=this.ensureMarks(n,s),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+t.length<512){this.cache.reused.set(a,2);let c=o.children[o.children.length-1]=new fp(a.dom,a.text+t);c.parent=o}else o.append(r||fp.of(t,(i=this.cache.find(fp))===null||i===void 0?void 0:i.dom));this.pos+=t.length,this.afterWidget=null}addComposition(t,n){let s=this.curLine;s.dom!=n.line.dom&&(s.setDOM(this.cache.reused.has(n.line)?S6(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let r=s;for(let a=n.marks.length-1;a>=0;a--){let c=n.marks[a],u=r.lastChild;if(u instanceof Xa&&u.mark.eq(c.mark))u.dom!=c.dom&&u.setDOM(S6(c.dom)),r=u;else{if(this.cache.reused.get(c)){let h=_i.get(c.dom);h&&h.setDOM(S6(c.dom))}let d=Xa.of(c.mark,c.dom);r.append(d),r=d}this.cache.reused.set(c,2)}let i=_i.get(t.text);i&&this.cache.reused.set(i,2);let o=new fp(t.text,t.text.nodeValue);o.flags|=8,this.pos=t.range.toB,r.append(o)}addInlineWidget(t,n,s){let r=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);r||this.flushBuffer();let i=this.ensureMarks(n,s);!r&&!(t.flags&16)&&i.append(this.getBuffer(1)),i.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,n,s){this.flushBuffer(),this.ensureMarks(n,s).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){let n=this.afterWidget||this.lastBlock;n.length+=t,this.pos+=t}addLineStart(t,n){var s;t||(t=Tne);let r=y1.start(t,n||((s=this.cache.find(y1))===null||s===void 0?void 0:s.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,n){var s;let r=this.curLine;for(let i=t.length-1;i>=0;i--){let o=t[i],a;if(n>0&&(a=r.lastChild)&&a instanceof Xa&&a.mark.eq(o))r=a,n--;else{let c=Xa.of(o,(s=this.cache.find(Xa,u=>u.mark.eq(o)))===null||s===void 0?void 0:s.dom);r.append(c),r=c,n=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!xz(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(rn.ios&&xz(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(C6,0,32)||new zp(C6.toDOM(),0,C6,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let t=this.wrappers.length-1;t>=0;t--)this.wrappers[t].to<this.pos&&this.wrappers.splice(t,1);for(let t=this.blockWrappers;t.value&&t.from<=this.pos;t.next())if(t.to>=this.pos){let n=t.rank*102+t.value.rank,s=new bje(t.from,t.to,t.value,n),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-s.rank||this.wrappers[r-1].to-s.to)<0;)r--;this.wrappers.splice(r,0,s)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let n=this.root;for(let s of this.wrappers){let r=n.lastChild;if(s.from<this.pos&&r instanceof zd&&r.wrapper.eq(s.wrapper))n=r;else{let i=zd.of(s.wrapper,(t=this.cache.find(zd,o=>o.wrapper.eq(s.wrapper)))===null||t===void 0?void 0:t.dom);n.append(i),n=i}}return n}blockPosCovered(){let t=this.lastBlock;return t!=null&&!t.breakAfter&&(!t.isWidget()||(t.flags&160)>0)}getBuffer(t){let n=2|(t<0?16:32),s=this.cache.find(qS,void 0,1);return s&&(s.flags=n),s||new qS(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class xje{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:r,lineBreak:i,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=r;let a=this.textOff=Math.min(t,r.length);return i?null:r.slice(0,a)}let n=Math.min(this.text.length,this.textOff+t),s=this.text.slice(this.textOff,n);return this.textOff=n,s}}const US=[zp,y1,fp,Xa,qS,zd,nC];for(let e=0;e<US.length;e++)US[e].bucket=e;class vje{constructor(t){this.view=t,this.buckets=US.map(()=>[]),this.index=US.map(()=>0),this.reused=new Map}add(t){let n=t.constructor.bucket,s=this.buckets[n];s.length<6?s.push(t):s[this.index[n]=(this.index[n]+1)%6]=t}find(t,n,s=2){let r=t.bucket,i=this.buckets[r],o=this.index[r];for(let a=i.length-1;a>=0;a--){let c=(a+o)%i.length,u=i[c];if((!n||n(u))&&!this.reused.has(u))return i.splice(c,1),c<o&&this.index[r]--,this.reused.set(u,s),u}return null}findWidget(t,n,s){let r=this.buckets[0];if(r.length)for(let i=0,o=0;;i++){if(i==r.length){if(o)return null;o=1,i=0}let a=r[i];if(!this.reused.has(a)&&(o==0?a.widget.compare(t):a.widget.constructor==t.constructor&&t.updateDOM(a.dom,this.view,a.widget)))return r.splice(i,1),i<this.index[0]&&this.index[0]--,a.widget==t&&a.length==n&&(a.flags&497)==s?(this.reused.set(a,1),a):(this.reused.set(a,2),new zp(a.dom,n,t,a.flags&-498|s))}}reuse(t){return this.reused.set(t,1),t}maybeReuse(t,n=2){if(!this.reused.has(t))return this.reused.set(t,n),t.dom}clear(){for(let t=0;t<this.buckets.length;t++)this.buckets[t].length=this.index[t]=0}}class wje{constructor(t,n,s,r,i){this.view=t,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new vje(t),this.text=new xje(t.state.doc),this.builder=new yje(this.cache,new nC(t,t.contentDOM),Rs.iter(s)),this.cache.reused.set(n,2),this.old=new gje(n),this.reuseWalker={skip:(o,a,c)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(t,n){let s=n&&this.getCompositionContext(n.text);for(let r=0,i=0,o=0;;){let a=o<t.length?t[o++]:null,c=a?a.fromA:this.old.root.length;if(c>r){let u=c-r;this.preserve(u,!o,!a),r=c,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,s),this.text.skip(n.range.toB-n.range.fromB),this.forward(n.range.fromA,a.toA),this.emit(n.range.toB,a.toB)):(this.forward(a.fromA,a.toA),this.emit(i,a.toB)),i=a.toB,r=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(t,n,s){let r=Sje(this.old),i=this.openMarks;this.old.advance(t,s?1:-1,{skip:(o,a,c)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(c-a);else{let u=c>0||a<o.length?zp.of(o.widget,this.view,c-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,r,i),i=r.length)}else if(o.isText())this.builder.ensureLine(null),!a&&c==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,r,i,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,c),r,i)),i=r.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof qS)this.cache.add(o);else if(o instanceof Xa)this.builder.ensureLine(null),this.builder.addMark(o,r,i),this.cache.reused.set(o,1),i=r.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof Xa&&r.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?r.length&&(r.length=i=0):o instanceof Xa&&(r.shift(),i=Math.min(i,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,n){let s=null,r=this.builder,i=0,o=Rs.spans(this.decorations,t,n,{point:(a,c,u,d,h,m)=>{if(u instanceof Bp){if(this.disallowBlockEffectsFor[m]){if(u.block)throw new RangeError("Block decorations may not be specified via plugins");if(c>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(i=d.length,h>d.length)r.continueWidget(c-a);else{let p=u.widget||(u.block?x1.block:x1.inline),g=kje(u),b=this.cache.findWidget(p,c-a,g)||zp.of(p,this.view,c-a,g);u.block?(u.startSide>0&&r.addLineStartIfNotCovered(s),r.addBlockWidget(b)):(r.ensureLine(s),r.addInlineWidget(b,d,h))}s=null}else s=_je(s,u);c>a&&this.text.skip(c-a)},span:(a,c,u,d)=>{for(let h=a;h<c;){let m=this.text.next(Math.min(512,c-h));m==null?(r.addLineStartIfNotCovered(s),r.addBreak(),h++):(r.ensureLine(s),r.addText(m,u,h==a?d:u.length),h+=m.length),s=null}}});r.addLineStartIfNotCovered(s),this.openWidget=o>i,this.openMarks=o}forward(t,n,s=1){n-t<=10?this.old.advance(n-t,s,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-t-10,-1),this.old.advance(5,s,this.reuseWalker))}getCompositionContext(t){let n=[],s=null;for(let r=t.parentNode;;r=r.parentNode){let i=_i.get(r);if(r==this.view.contentDOM)break;i instanceof Xa?n.push(i):i!=null&&i.isLine()?s=i:i instanceof zd||(r.nodeName=="DIV"&&!s&&r!=this.view.contentDOM?s=new y1(r,Tne):s||n.push(Xa.of(new Yv({tagName:r.nodeName.toLowerCase(),attributes:XNe(r)}),r)))}return{line:s,marks:n}}}function xz(e,t){let n=s=>{for(let r of s.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}function kje(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 Tne={class:"cm-line"};function _je(e,t){let n=t.spec.attributes,s=t.spec.class;return!n&&!s||(e||(e={class:"cm-line"}),n&&YM(n,e),s&&(e.class+=" "+s)),e}function Sje(e){let t=[];for(let n=e.parents.length;n>1;n--){let s=n==e.parents.length?e.tile:e.parents[n].tile;s instanceof Xa&&t.push(s.mark)}return t}function S6(e){let t=_i.get(e);return t&&t.setDOM(e.cloneNode()),e}class x1 extends Ol{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}}x1.inline=new x1("span");x1.block=new x1("div");const C6=new class extends Ol{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class vz{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 nC(t,t.contentDOM),this.updateInner([new dc(0,0,0,t.state.doc.length)],null)}update(t){var n;let s=t.changedRanges;this.minWidth>0&&s.length&&(s.every(({fromA:d,toA:h})=>h<this.minWidthFrom||d>this.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?r=this.domChanged.newSel.head:!Rje(t.changes,this.hasComposition)&&!t.selectionSet&&(r=t.state.selection.main.head));let i=r>-1?Tje(this.view,t.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:h}=this.hasComposition;s=new dc(d,h,t.changes.mapPos(d,-1),t.changes.mapPos(h,1)).addToSet(s.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(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 c=Nje(o,this.decorations,t.changes);c.length&&(s=dc.extendWithRanges(s,c));let u=Mje(a,this.blockWrappers,t.changes);return u.length&&(s=dc.extendWithRanges(s,u)),i&&!s.some(d=>d.fromA<=i.range.fromA&&d.toA>=i.range.toA)&&(s=i.range.addToSet(s.slice())),this.tile.flags&2&&s.length==0?!1:(this.updateInner(s,i),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,n){this.view.viewState.mustMeasureContent=!0;let{observer:s}=this.view;s.ignore(()=>{if(n||t.length){let o=this.tile,a=new wje(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&_i.get(n.text)&&a.cache.reused.set(_i.get(n.text),2),this.tile=a.run(t,n),jA(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:s.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(i),i&&(i.written||s.selectionRange.focusNode!=i.node||!this.tile.dom.contains(i.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let i of this.tile.children)i.isWidget()&&i.widget instanceof T6&&r.push(i.dom);s.updateGaps(r)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let n of t.transactions)for(let s of n.effects)s.is(wne)&&(this.editContextFormatting=s.value)}updateSelection(t=!1,n=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:s}=this.tile,r=this.view.root.activeElement,i=r==s,o=!i&&!(this.view.state.facet(vd)||s.tabIndex>-1)&&rx(s,this.view.observer.selectionRange)&&!(r&&s.contains(r));if(!(i||n||o))return;let a=this.forceSelection;this.forceSelection=!1;let c=this.view.state.selection.main,u,d;if(c.empty?d=u=this.inlineDOMNearPos(c.anchor,c.assoc||1):(d=this.inlineDOMNearPos(c.head,c.head==c.from?1:-1),u=this.inlineDOMNearPos(c.anchor,c.anchor==c.from?1:-1)),rn.gecko&&c.empty&&!this.hasComposition&&Cje(u)){let m=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(m,u.node.childNodes[u.offset]||null)),u=d=new Ic(m,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!ox(u.node,u.offset,h.anchorNode,h.anchorOffset)||!ox(d.node,d.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,c))&&(this.view.observer.ignore(()=>{rn.android&&rn.chrome&&s.contains(h.focusNode)&&Ije(h.focusNode,s)&&(s.blur(),s.focus({preventScroll:!0}));let m=Xx(this.view.root);if(m)if(c.empty){if(rn.gecko){let p=Eje(u.node,u.offset);if(p&&p!=3){let g=(p==1?ine:one)(u.node,u.offset);g&&(u=new Ic(g.node,g.offset))}}m.collapse(u.node,u.offset),c.bidiLevel!=null&&m.caretBidiLevel!==void 0&&(m.caretBidiLevel=c.bidiLevel)}else if(m.extend){m.collapse(u.node,u.offset);try{m.extend(d.node,d.offset)}catch{}}else{let p=document.createRange();c.anchor>c.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==s&&(s.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(u,d)),this.impreciseAnchor=u.precise?null:new Ic(h.anchorNode,h.anchorOffset),this.impreciseHead=d.precise?null:new Ic(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&ox(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,n=t.state.selection.main,s=Xx(t.root),{anchorNode:r,anchorOffset:i}=t.observer.selectionRange;if(!s||!n.empty||!n.assoc||!s.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let a=o.posAtStart;if(n.head==a||n.head==a+o.length)return;let c=this.coordsAt(n.head,-1),u=this.coordsAt(n.head,1);if(!c||!u||c.bottom>u.top)return;let d=this.domAtPos(n.head+n.assoc,n.assoc);s.collapse(d.node,d.offset),s.modify("move",n.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let h=t.observer.selectionRange;t.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=n.from&&s.collapse(r,i)}posFromDOM(t,n){let s=this.tile.nearest(t);if(!s)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let r=s.posAtStart;if(s.isComposite()){let i;if(t==s.dom)i=s.dom.childNodes[n];else{let o=nh(t)==0?0:n==0?-1:1;for(;;){let a=t.parentNode;if(a==s.dom)break;o==0&&a.firstChild!=a.lastChild&&(t==a.firstChild?o=-1:o=1),t=a}o<0?i=t:i=t.nextSibling}if(i==s.dom.firstChild)return r;for(;i&&!_i.get(i);)i=i.nextSibling;if(!i)return r+s.length;for(let o=0,a=r;;o++){let c=s.children[o];if(c.dom==i)return a;a+=c.length+c.breakAfter}}else return s.isText()?t==s.dom?r+n:r+(n?s.length:0):r}domAtPos(t,n){let{tile:s,offset:r}=this.tile.resolveBlock(t,n);return s.isWidget()?s.domPosFor(t,n):s.domIn(r,n)}inlineDOMNearPos(t,n){let s,r=-1,i=!1,o,a=-1,c=!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&&(s=u,r=t-d,i=h<t),h>=t&&!o&&(o=u,a=t-d,c=d>t),d>t&&o)return!0}}),!s&&!o?this.domAtPos(t,n):(i&&o?s=null:c&&s&&(o=null),s&&n<0||!o?s.domIn(r,n):o.domIn(a,n))}coordsAt(t,n){let{tile:s,offset:r}=this.tile.resolveBlock(t,n);return s.isWidget()?s.widget instanceof T6?null:s.coordsInWidget(r,n,!0):s.coordsIn(r,n)}lineAt(t,n){let{tile:s}=this.tile.resolveBlock(t,n);return s.isLine()?s:null}coordsForChar(t){let{tile:n,offset:s}=this.tile.resolveBlock(t,1);if(!n.isLine())return null;function r(i,o){if(i.isComposite())for(let a of i.children){if(a.length>=o){let c=r(a,o);if(c)return c}if(o-=a.length,o<0)break}else if(i.isText()&&o<i.length){let a=_o(i.text,o);if(a==o)return null;let c=Jx(i.dom,o,a).getClientRects();for(let u=0;u<c.length;u++){let d=c[u];if(u==c.length-1||d.top<d.bottom&&d.left<d.right)return d}}return null}return r(n,s)}measureVisibleLineHeights(t){let n=[],{from:s,to:r}=t,i=this.view.contentDOM.clientWidth,o=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,c=this.view.textDirection==Rr.LTR,u=0,d=(h,m,p)=>{for(let g=0;g<h.children.length&&!(m>r);g++){let b=h.children[g],v=m+b.length,x=b.dom.getBoundingClientRect(),{height:y}=x;if(p&&!g&&(u+=x.top-p.top),b instanceof zd)v>s&&d(b,m,x);else if(m>=s&&(u>0&&n.push(-u),n.push(y+u),u=0,o)){let w=b.dom.lastChild,k=w?ix(w):[];if(k.length){let T=k[k.length-1],_=c?T.right-x.left:x.right-T.left;_>a&&(a=_,this.minWidth=i,this.minWidthFrom=m,this.minWidthTo=v)}}p&&g==h.children.length-1&&(u+=p.bottom-x.bottom),m=v+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"?Rr.RTL:Rr.LTR}measureTextSize(){let t=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,c;for(let u of o.children){if(!u.isText()||/[^ -~]/.test(u.text))return;let d=ix(u.dom);if(d.length!=1)return;a+=d[0].width,c=d[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:c}}});if(t)return t;let n=document.createElement("div"),s,r,i;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=ix(n.firstChild)[0];s=n.getBoundingClientRect().height,r=o&&o.width?o.width/27:7,i=o&&o.height?o.height:s,n.remove()}),{lineHeight:s,charWidth:r,textHeight:i}}computeBlockGapDeco(){let t=[],n=this.view.viewState;for(let s=0,r=0;;r++){let i=r==n.viewports.length?null:n.viewports[r],o=i?i.from-1:this.view.state.doc.length;if(o>s){let a=(n.lineBlockAt(o).bottom-n.lineBlockAt(s).top)/this.view.scaleY;t.push(vn.replace({widget:new T6(a),block:!0,inclusive:!0,isBlockGap:!0}).range(s,o))}if(!i)break;s=i.to+1}return vn.set(t)}updateDeco(){let t=1,n=this.view.state.facet(eC).map(i=>(this.dynamicDecorationMap[t++]=typeof i=="function")?i(this.view):i),s=!1,r=this.view.state.facet(tI).map((i,o)=>{let a=typeof i=="function";return a&&(s=!0),a?i(this.view):i});for(r.length&&(this.dynamicDecorationMap[t++]=s,n.push(Rs.join(r))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;this.blockWrappers=this.view.state.facet(_ne).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(vne))try{if(d(this.view,t.range,t))return!0}catch(h){Qa(this.view.state,h,"scroll handler")}let{range:s}=t,r=this.coordsAt(s.head,(n=s.assoc)!==null&&n!==void 0?n:s.empty?0:s.head>s.anchor?-1:1),i;if(!r)return;!s.empty&&(i=this.coordsAt(s.anchor,s.anchor>s.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let o=nI(this.view),a={left:r.left-o.left,top:r.top-o.top,right:r.right+o.right,bottom:r.bottom+o.bottom},{offsetWidth:c,offsetHeight:u}=this.view.scrollDOM;if(ZNe(this.view.scrollDOM,a,s.head<s.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,c),-c),Math.max(Math.min(t.yMargin,u),-u),this.view.textDirection==Rr.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(r.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||r.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let d=this.view.docView.lineAt(s.head,1);d&&d.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(t){let n=s=>s.isWidget()||s.children.some(n);return n(this.tile.resolveBlock(t,1).tile)}destroy(){jA(this.tile)}}function jA(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let s of e.children)jA(s,t)}}function Cje(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 Ene(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let s=ine(n.focusNode,n.focusOffset),r=one(n.focusNode,n.focusOffset),i=s||r;if(r&&s&&r.node!=s.node){let a=_i.get(r.node);if(!a||a.isText()&&a.text!=r.node.nodeValue)i=r;else if(e.docView.lastCompositionAfterCursor){let c=_i.get(s.node);!c||c.isText()&&c.text!=s.node.nodeValue||(i=r)}}if(e.docView.lastCompositionAfterCursor=i!=s,!i)return null;let o=t-i.offset;return{from:o,to:o+i.node.nodeValue.length,node:i.node}}function Tje(e,t,n){let s=Ene(e,n);if(!s)return null;let{node:r,from:i,to:o}=s,a=r.nodeValue;if(/[\n\r]/.test(a)||e.state.doc.sliceString(s.from,s.to)!=a)return null;let c=t.invertedDesc;return{range:new dc(c.mapPos(i),c.mapPos(o),i,o),text:r}}function Eje(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 Aje=class{constructor(){this.changes=[]}compareRange(t,n){Pg(t,n,this.changes)}comparePoint(t,n){Pg(t,n,this.changes)}boundChange(t){Pg(t,t,this.changes)}};function Nje(e,t,n){let s=new Aje;return Rs.compare(e,t,n,s),s.changes}class jje{constructor(){this.changes=[]}compareRange(t,n){Pg(t,n,this.changes)}comparePoint(){}boundChange(t){Pg(t,t,this.changes)}}function Mje(e,t,n){let s=new jje;return Rs.compare(e,t,n,s),s.changes}function Ije(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 Rje(e,t){let n=!1;return t&&e.iterChangedRanges((s,r)=>{s<t.to&&r>t.from&&(n=!0)}),n}class T6 extends Ol{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 Dje(e,t,n=1){let s=e.charCategorizer(t),r=e.doc.lineAt(t),i=t-r.from;if(r.length==0)return Ye.cursor(t);i==0?n=1:i==r.length&&(n=-1);let o=i,a=i;n<0?o=_o(r.text,i,!1):a=_o(r.text,i);let c=s(r.text.slice(o,a));for(;o>0;){let u=_o(r.text,o,!1);if(s(r.text.slice(u,o))!=c)break;o=u}for(;a<r.length;){let u=_o(r.text,a);if(s(r.text.slice(a,u))!=c)break;a=u}return Ye.range(o+r.from,a+r.from)}function Lje(e,t,n,s,r){let i=Math.round((s-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let a=e.viewState.heightOracle.textHeight,c=Math.floor((r-n.top-(e.defaultLineHeight-a)*.5)/a);i+=c*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+yA(o,i,e.state.tabSize)}function MA(e,t,n){let s=e.lineBlockAt(t);if(Array.isArray(s.type)){let r;for(let i of s.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;(!r||i.type==Fo.Text&&(r.type!=i.type||(n<0?i.from<t:i.to>t)))&&(r=i)}}return r||s}return s}function Pje(e,t,n,s){let r=MA(e,t.head,t.assoc||-1),i=!s||r.type!=Fo.Text||!(e.lineWrapping||r.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head);if(i){let o=e.dom.getBoundingClientRect(),a=e.textDirectionAt(r.from),c=e.posAtCoords({x:n==(a==Rr.LTR)?o.right-1:o.left+1,y:(i.top+i.bottom)/2});if(c!=null)return Ye.cursor(c,n?-1:1)}return Ye.cursor(n?r.to:r.from,n?-1:1)}function wz(e,t,n,s){let r=e.state.doc.lineAt(t.head),i=e.bidiSpans(r),o=e.textDirectionAt(r.from);for(let a=t,c=null;;){let u=uje(r,i,o,a,n),d=dne;if(!u){if(r.number==(n?e.state.doc.lines:1))return a;d=`
`,r=e.state.doc.line(r.number+(n?1:-1)),i=e.bidiSpans(r),u=e.visualLineSide(r,!n)}if(c){if(!c(d))return a}else{if(!s)return u;c=s(d)}a=u}}function Oje(e,t,n){let s=e.state.charCategorizer(t),r=s(n);return i=>{let o=s(i);return r==ii.Space&&(r=o),r==o}}function Bje(e,t,n,s){let r=t.head,i=n?1:-1;if(r==(n?e.state.doc.length:0))return Ye.cursor(r,t.assoc);let o=t.goalColumn,a,c=e.contentDOM.getBoundingClientRect(),u=e.coordsAtPos(r,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),d=e.documentTop;if(u)o==null&&(o=u.left-c.left),a=i<0?u.top:u.bottom;else{let g=e.viewState.lineBlockAt(r);o==null&&(o=Math.min(c.right-c.left,e.defaultCharacterWidth*(r-g.from))),a=(i<0?g.top:g.bottom)+d}let h=c.left+o,m=e.viewState.heightOracle.textHeight>>1,p=s??m;for(let g=0;;g+=m){let b=a+(p+g)*i,v=IA(e,{x:h,y:b},!1,i);if(n?b>c.bottom:b<c.top)return Ye.cursor(v.pos,v.assoc);let x=e.coordsAtPos(v.pos,v.assoc),y=x?(x.top+x.bottom)/2:0;if(!x||(n?y>a:y<a))return Ye.cursor(v.pos,v.assoc,void 0,o)}}function ax(e,t,n){for(;;){let s=0;for(let r of e)r.between(t-1,t+1,(i,o,a)=>{if(t>i&&t<o){let c=s||n||(t-i<o-t?-1:1);t=c<0?i:o,s=c}});if(!s)return t}}function Ane(e,t){let n=null;for(let s=0;s<t.ranges.length;s++){let r=t.ranges[s],i=null;if(r.empty){let o=ax(e,r.from,0);o!=r.from&&(i=Ye.cursor(o,-1))}else{let o=ax(e,r.from,-1),a=ax(e,r.to,1);(o!=r.from||a!=r.to)&&(i=Ye.range(r.from==r.anchor?o:a,r.from==r.head?o:a))}i&&(n||(n=t.ranges.slice()),n[s]=i)}return n?Ye.create(n,t.mainIndex):t}function E6(e,t,n){let s=ax(e.state.facet(Qv).map(r=>r(e)),n.from,t.head>n.from?-1:1);return s==n.from?n:Ye.cursor(s,s<n.from?1:-1)}class wu{constructor(t,n){this.pos=t,this.assoc=n}}function IA(e,t,n,s){let r=e.contentDOM.getBoundingClientRect(),i=r.top+e.viewState.paddingTop,{x:o,y:a}=t,c=a-i,u;for(;;){if(c<0)return new wu(0,1);if(c>e.viewState.docHeight)return new wu(e.state.doc.length,-1);if(u=e.elementAtHeight(c),s==null)break;if(u.type==Fo.Text){if(s<0?u.to<e.viewport.from:u.from>e.viewport.to)break;let m=e.docView.coordsAt(s<0?u.from:u.to,s>0?-1:1);if(m&&(s<0?m.top<=c+i:m.bottom>=c+i))break}let h=e.viewState.heightOracle.textHeight/2;c=s>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==Fo.Text){let h=Lje(e,r,u,o,a);return new wu(h,h==u.from?1:-1)}}if(u.type!=Fo.Text)return c<(u.top+u.bottom)/2?new wu(u.from,1):new wu(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 $je(e,o,a,e.textDirectionAt(u.from)).scanTile(d,u.from)}class $je{constructor(t,n,s,r){this.view=t,this.x=n,this.y=s,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(t){return(!this.line||this.line.from>t||this.line.to<t)&&(this.line=this.view.state.doc.lineAt(t),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(t,n){let{line:s,spans:r}=this.bidiSpansAt(t);return r[Au.find(r,t-s.from,-1,n)].level==this.baseDir}dirAt(t,n){let{line:s,spans:r}=this.bidiSpansAt(t);return r[Au.find(r,t-s.from,-1,n)].dir}bidiIn(t,n){let{spans:s,line:r}=this.bidiSpansAt(t);return s.length>1||s.length&&(s[0].level!=this.baseDir||s[0].to+r.from<n)}scan(t,n,s=!1){let r=0,i=t.length-1,o=new Set,a=this.bidiIn(t[0],t[i]),c,u,d=-1,h=1e9,m;e:for(;r<i;){let g=i-r,b=r+i>>1;t:if(o.has(b)){let x=r+Math.floor(Math.random()*g);for(let y=0;y<g;y++){if(!o.has(x)){b=x;break t}x++,x==i&&(x=r)}break e}o.add(b);let v=n(b);if(v)for(let x=0;x<v.length;x++){let y=v[x],w=0;if(!(y.width==0&&v.length>1)){if(y.bottom<this.y)(!c||c.bottom<y.bottom)&&(c=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==Rr.LTR)?-1:1)}w==-1&&(!a||this.baseDirAt(t[b],1))?i=b:w==1&&(!a||this.baseDirAt(t[b+1],-1))&&(r=b+1)}}}if(!m){if(!u&&!c)return{i:t[0],after:!1};let g=c&&(!u||this.y-c.bottom<u.top-this.y)?c:u;return this.y=(g.top+g.bottom)/2,this.scan(t,n,!0)}if(h&&!s){let{top:g,bottom:b}=m;if(c&&c.bottom>(g+g+b)/3)return this.y=c.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)==Rr.LTR;return{i:d,after:this.x>(m.left+m.right)/2==p}}scanText(t,n){let s=[];for(let i=0;i<t.length;i=_o(t.text,i))s.push(n+i);s.push(n+t.length);let r=this.scan(s,i=>{let o=s[i]-n,a=s[i+1]-n;return Jx(t.dom,o,a).getClientRects()});return r.after?new wu(s[r.i+1],-1):new wu(s[r.i],1)}scanTile(t,n){if(!t.length)return new wu(n,1);if(t.children.length==1){let a=t.children[0];if(a.isText())return this.scanText(a,n);if(a.isComposite())return this.scanTile(a,n)}let s=[n];for(let a=0,c=n;a<t.children.length;a++)s.push(c+=t.children[a].length);let r=this.scan(s,a=>{let c=t.children[a];return c.flags&48?null:(c.dom.nodeType==1?c.dom:Jx(c.dom,0,c.length)).getClientRects()}),i=t.children[r.i],o=s[r.i];return i.isText()?this.scanText(i,o):i.isComposite()?this.scanTile(i,o):r.after?new wu(s[r.i+1],-1):new wu(o,1)}}const X0="";class zje{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(Ks.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=X0}readRange(t,n){if(!t)return this;let s=t.parentNode;for(let r=t;;){this.findPointBefore(s,r);let i=this.text.length;this.readNode(r);let o=_i.get(r),a=r.nextSibling;if(a==n){o!=null&&o.breakAfter&&!a&&s!=this.view.contentDOM&&this.lineBreak();break}let c=_i.get(a);(o&&c?o.breakAfter:(o?o.breakAfter:FS(r))||FS(a)&&(r.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>i)&&!Hje(a,n)&&this.lineBreak(),r=a}return this.findPointBefore(s,n),this}readTextNode(t){let n=t.nodeValue;for(let s of this.points)s.node==t&&(s.pos=this.text.length+Math.min(s.offset,n.length));for(let s=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,o=1,a;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,s),o=this.lineSeparator.length):(a=r.exec(n))&&(i=a.index,o=a[0].length),this.append(n.slice(s,i<0?n.length:i)),i<0)break;if(this.lineBreak(),o>1)for(let c of this.points)c.node==t&&c.pos>this.text.length&&(c.pos-=o-1);s=i+o}}readNode(t){let n=_i.get(t),s=n&&n.overrideDOMText;if(s!=null){this.findPointInside(t,s.length);for(let r=s.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName=="BR"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,n){for(let s of this.points)s.node==t&&t.childNodes[s.offset]==n&&(s.pos=this.text.length)}findPointInside(t,n){for(let s of this.points)(t.nodeType==3?s.node==t:t.contains(s.node))&&(s.pos=this.text.length+(Fje(t,s.node,s.offset)?n:0))}}function Fje(e,t,n){for(;;){if(!t||n<nh(t))return!1;if(t==e)return!0;n=Yf(t)+1,t=t.parentNode}}function Hje(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let s=_i.get(e);if(!(s!=null&&s.isWidget()))return!1;s&&(n||(n=[])).push(s)}if(n)for(let s of n){let r=s.overrideDOMText;if(r!=null&&r.length)return!1}return!0}class kz{constructor(t,n){this.node=t,this.offset=n,this.pos=-1}}class qje{constructor(t,n,s,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:i,impreciseAnchor:o}=t.docView,a=t.state.selection;if(t.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=Nne(t.docView.tile,n,s,0))){let c=i||o?[]:Vje(t),u=new zje(c,t);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=Wje(c,this.bounds.from)}else{let c=t.observer.selectionRange,u=i&&i.node==c.focusNode&&i.offset==c.focusOffset||!CA(t.contentDOM,c.focusNode)?a.main.head:t.docView.posFromDOM(c.focusNode,c.focusOffset),d=o&&o.node==c.anchorNode&&o.offset==c.anchorOffset||!CA(t.contentDOM,c.anchorNode)?a.main.anchor:t.docView.posFromDOM(c.anchorNode,c.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(Ye.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=Ye.create([Ye.cursor(u,p)])}else this.newSel=Ye.single(d,u)}}}function Nne(e,t,n,s){if(e.isComposite()){let r=-1,i=-1,o=-1,a=-1;for(let c=0,u=s,d=s;c<e.children.length;c++){let h=e.children[c],m=u+h.length;if(u<t&&m>n)return Nne(h,t,n,u);if(m>=t&&r==-1&&(r=c,i=u),u>n&&h.dom.parentNode==e.dom){o=c,a=d;break}d=m,u=m+h.breakAfter}return{from:i,to:a<0?s+e.length:a,startDOM:(r?e.children[r-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}else return e.isText()?{from:s,to:s+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function jne(e,t){let n,{newSel:s}=t,{state:r}=e,i=r.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:a,to:c}=t.bounds,u=i.from,d=null;(o===8||rn.android&&t.text.length<c-a)&&(u=i.to,d="end");let h=r.doc.sliceString(a,c,X0),m,p;!i.empty&&i.from>=a&&i.to<=c&&(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:rr.of(t.text.slice(i.from-a,m).split(X0))}:(p=Mne(h,t.text,u-a,d))&&(rn.chrome&&o==13&&p.toB==p.from+2&&t.text.slice(p.from,p.toB)==X0+X0&&p.toB--,n={from:a+p.from,to:a+p.toA,insert:rr.of(t.text.slice(p.from,p.toB).split(X0))})}else s&&(!e.hasFocus&&r.facet(vd)||VS(s,i))&&(s=null);if(!n&&!s)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"?(s&&n.insert.length==2&&(s=Ye.single(s.main.anchor-1,s.main.head-1)),n={from:n.from,to:n.to,insert:rr.of([n.insert.toString().replace("."," ")])}):r.doc.lineAt(i.from).to<i.to&&e.docView.lineHasWidget(i.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:i.from,to:i.to,insert:r.toText(e.inputState.insertingText)}:rn.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
 `&&e.lineWrapping&&(s&&(s=Ye.single(s.main.anchor-1,s.main.head-1)),n={from:i.from,to:i.to,insert:rr.of([" "])}),n)return sI(e,n,s,o);if(s&&!VS(s,i)){let a=!1,c="select";return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin=="select"&&(a=!0),c=e.inputState.lastSelectionOrigin,c=="select.pointer"&&(s=Ane(r.facet(Qv).map(u=>u(e)),s))),e.dispatch({selection:s,scrollIntoView:a,userEvent:c}),!0}else return!1}function sI(e,t,n,s=-1){if(rn.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(rn.android&&(t.to==r.to&&(t.from==r.from||t.from==r.from-1&&e.state.sliceDoc(t.from,r.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&Og(e.contentDOM,"Enter",13)||(t.from==r.from-1&&t.to==r.to&&t.insert.length==0||s==8&&t.insert.length<t.to-t.from&&t.to>r.head)&&Og(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&t.insert.length==0&&Og(e.contentDOM,"Delete",46)))return!0;let i=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,a=()=>o||(o=Uje(e,t,n));return e.state.facet(gne).some(c=>c(e,t.from,t.to,i,a))||e.dispatch(a()),!0}function Uje(e,t,n){let s,r=e.state,i=r.selection.main,o=-1;if(t.from==t.to&&t.from<i.from||t.from>i.to){let c=t.from<i.from?-1:1,u=c<0?i.from:i.to,d=ax(r.facet(Qv).map(h=>h(e)),u,c);t.from==d&&(o=d)}if(o>-1)s={changes:t,selection:Ye.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 c=i.from<t.from?r.sliceDoc(i.from,t.from):"",u=i.to>t.to?r.sliceDoc(t.to,i.to):"";s=r.replaceSelection(e.state.toText(c+t.insert.sliceString(0,void 0,e.state.lineBreak)+u))}else{let c=r.changes(t),u=n&&n.main.to<=c.newLength?n.main:void 0;if(r.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=i.to+10&&t.to>=i.to-10){let d=e.state.sliceDoc(t.from,t.to),h,m=n&&Ene(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;s=r.changeByRange(g=>{if(g.from==i.from&&g.to==i.to)return{changes:c,range:u||g.map(c)};let b=g.to-p,v=b-d.length;if(e.state.sliceDoc(v,b)!=d||b>=h.from&&v<=h.to)return{range:g};let x=r.changes({from:v,to:b,insert:t.insert}),y=g.to-i.to;return{changes:x,range:u?Ye.range(Math.max(0,u.anchor+y),Math.max(0,u.head+y)):g.map(x)}})}else s={changes:c,selection:u&&r.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)),r.update(s,{userEvent:a,scrollIntoView:!0})}function Mne(e,t,n,s){let r=Math.min(e.length,t.length),i=0;for(;i<r&&e.charCodeAt(i)==t.charCodeAt(i);)i++;if(i==r&&e.length==t.length)return null;let o=e.length,a=t.length;for(;o>0&&a>0&&e.charCodeAt(o-1)==t.charCodeAt(a-1);)o--,a--;if(s=="end"){let c=Math.max(0,i-Math.min(o,a));n-=o+c-i}if(o<i&&e.length<t.length){let c=n<=i&&n>=o?i-n:0;i-=c,a=i+(a-o),o=i}else if(a<i){let c=n<=i&&n>=a?i-n:0;i-=c,o=i+(o-a),a=i}return{from:i,toA:o,toB:a}}function Vje(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:i}=e.observer.selectionRange;return n&&(t.push(new kz(n,s)),(r!=n||i!=s)&&t.push(new kz(r,i))),t}function Wje(e,t){if(e.length==0)return null;let n=e[0].pos,s=e.length==2?e[1].pos:n;return n>-1&&s>-1?Ye.single(n+t,s+t):null}function VS(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class Gje{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&&lMe(t.contentDOM.ownerDocument)}handleEvent(t){!tMe(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t))}runHandlers(t,n){let s=this.handlers[t];if(s){for(let r of s.observers)r(this.view,n);for(let r of s.handlers){if(n.defaultPrevented)break;if(r(this.view,n)){n.preventDefault();break}}}}ensureHandlers(t){let n=Kje(t),s=this.handlers,r=this.view.contentDOM;for(let i in n)if(i!="scroll"){let o=!n[i].handlers.length,a=s[i];a&&o!=!a.handlers.length&&(r.removeEventListener(i,this.handleEvent),a=null),a||r.addEventListener(i,this.handleEvent,{passive:o})}for(let i in s)i!="scroll"&&!n[i]&&r.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&t.keyCode!=27&&Rne.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=Ine.find(s=>s.keyCode==t.keyCode))&&!t.ctrlKey||Yje.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,Og(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 _z(e,t){return(n,s)=>{try{return t.call(e,s,n)}catch(r){Qa(n.state,r)}}}function Kje(e){let t=Object.create(null);function n(s){return t[s]||(t[s]={observers:[],handlers:[]})}for(let s of e){let r=s.spec,i=r&&r.plugin.domEventHandlers,o=r&&r.plugin.domEventObservers;if(i)for(let a in i){let c=i[a];c&&n(a).handlers.push(_z(s.value,c))}if(o)for(let a in o){let c=o[a];c&&n(a).observers.push(_z(s.value,c))}}for(let s in Lc)n(s).handlers.push(Lc[s]);for(let s in rl)n(s).observers.push(rl[s]);return t}const Ine=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Yje="dthko",Rne=[16,17,18,20,91,92,224,225],Ok=6;function Bk(e){return Math.max(0,e)*.7+8}function Xje(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class Qje{constructor(t,n,s,r){this.view=t,this.startEvent=n,this.style=s,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=nne(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(Ks.allowMultipleSelections)&&Jje(t,n),this.dragging=eMe(t,n)&&Pne(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&&Xje(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let n=0,s=0,r=0,i=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:a}=this.scrollParents.y.getBoundingClientRect());let c=nI(this.view);t.clientX-c.left<=r+Ok?n=-Bk(r-t.clientX):t.clientX+c.right>=o-Ok&&(n=Bk(t.clientX-o)),t.clientY-c.top<=i+Ok?s=-Bk(i-t.clientY):t.clientY+c.bottom>=a-Ok&&(s=Bk(t.clientY-a)),this.setScrollSpeed(n,s)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,n){this.scrollSpeed={x:t,y:n},t||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:n}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(t||n)&&this.view.win.scrollBy(t,n),this.dragging===!1&&this.select(this.lastEvent)}select(t){let{view:n}=this,s=Ane(this.atoms,this.style.get(t,this.extend,this.multiple));(this.mustSelect||!s.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:s,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Jje(e,t){let n=e.state.facet(hne);return n.length?n[0](t):rn.mac?t.metaKey:t.ctrlKey}function Zje(e,t){let n=e.state.facet(fne);return n.length?n[0](t):rn.mac?!t.altKey:!t.ctrlKey}function eMe(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let s=Xx(e.root);if(!s||s.rangeCount==0)return!0;let r=s.getRangeAt(0).getClientRects();for(let i=0;i<r.length;i++){let o=r[i];if(o.left<=t.clientX&&o.right>=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function tMe(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,s;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(s=_i.get(n))&&s.isWidget()&&!s.isHidden&&s.widget.ignoreEvent(t))return!1;return!0}const Lc=Object.create(null),rl=Object.create(null),Dne=rn.ie&&rn.ie_version<15||rn.ios&&rn.webkit_version<604;function nMe(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(),Lne(e,n.value)},50)}function sC(e,t,n){for(let s of e.facet(t))n=s(n,e);return n}function Lne(e,t){t=sC(e.state,JM,t);let{state:n}=e,s,r=1,i=n.toText(t),o=i.lines==n.selection.ranges.length;if(RA!=null&&n.selection.ranges.every(c=>c.empty)&&RA==i.toString()){let c=-1;s=n.changeByRange(u=>{let d=n.doc.lineAt(u.from);if(d.from==c)return{range:u};c=d.from;let h=n.toText((o?i.line(r++).text:t)+n.lineBreak);return{changes:{from:d.from,insert:h},range:Ye.cursor(u.from+h.length)}})}else o?s=n.changeByRange(c=>{let u=i.line(r++);return{changes:{from:c.from,to:c.to,insert:u.text},range:Ye.cursor(c.from+u.length)}}):s=n.replaceSelection(i);e.dispatch(s,{userEvent:"input.paste",scrollIntoView:!0})}rl.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft};rl.wheel=rl.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};Lc.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);rl.touchstart=(e,t)=>{let n=e.inputState,s=t.targetTouches[0];n.lastTouchTime=Date.now(),s&&(n.lastTouchX=s.clientX,n.lastTouchY=s.clientY),n.setSelectionOrigin("select.pointer")};rl.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};Lc.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let s of e.state.facet(mne))if(n=s(e,t),n)break;if(!n&&t.button==0&&(n=rMe(e,t)),n){let s=!e.hasFocus;e.inputState.startMouseSelection(new Qje(e,t,n,s)),s&&e.observer.ignore(()=>{sne(e.contentDOM);let i=e.root.activeElement;i&&!i.contains(e.contentDOM)&&i.blur()});let r=e.inputState.mouseSelection;if(r)return r.start(t),r.dragging===!1}else e.inputState.setSelectionOrigin("select.pointer");return!1};function Sz(e,t,n,s){if(s==1)return Ye.cursor(t,n);if(s==2)return Dje(e.state,t,n);{let r=e.docView.lineAt(t,n),i=e.state.doc.lineAt(r?r.posAtEnd:t),o=r?r.posAtStart:i.from,a=r?r.posAtEnd:i.to;return a<e.state.doc.length&&a==i.to&&a++,Ye.range(o,a)}}const sMe=rn.ie&&rn.ie_version<=11;let Cz=null,Tz=0,Ez=0;function Pne(e){if(!sMe)return e.detail;let t=Cz,n=Ez;return Cz=e,Ez=Date.now(),Tz=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(Tz+1)%3:1}function rMe(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),s=Pne(t),r=e.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),r=r.map(i.changes))},get(i,o,a){let c=e.posAndSideAtCoords({x:i.clientX,y:i.clientY},!1),u,d=Sz(e,c.pos,c.assoc,s);if(n.pos!=c.pos&&!o){let h=Sz(e,n.pos,n.assoc,s),m=Math.min(h.from,d.from),p=Math.max(h.to,d.to);d=m<d.from?Ye.range(m,p,d.assoc):Ye.range(p,m,d.assoc)}return o?r.replaceRange(r.main.extend(d.from,d.to,d.assoc)):a&&s==1&&r.ranges.length>1&&(u=iMe(r,c.pos))?u:a?r.addRange(d):Ye.create([d])}}}function iMe(e,t){for(let n=0;n<e.ranges.length;n++){let{from:s,to:r}=e.ranges[n];if(s<=t&&r>=t)return Ye.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}Lc.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let i=r.posAtStart,o=i+r.length;(i>=n.to||o<=n.from)&&(n=Ye.range(i,o))}}let{inputState:s}=e;return s.mouseSelection&&(s.mouseSelection.dragging=!0),s.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",sC(e.state,ZM,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};Lc.dragend=e=>(e.inputState.draggedContent=null,!1);function Az(e,t,n,s){if(n=sC(e.state,JM,n),!n)return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:i}=e.inputState,o=s&&i&&Zje(e,t)?{from:i.from,to:i.to}:null,a={from:r,insert:n},c=e.state.changes(o?[o,a]:a);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(r,-1),head:c.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Lc.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let s=Array(n.length),r=0,i=()=>{++r==n.length&&Az(e,t,s.filter(o=>o!=null).join(e.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let a=new FileReader;a.onerror=i,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(s[o]=a.result),i()},a.readAsText(n[o])}return!0}else{let s=t.dataTransfer.getData("Text");if(s)return Az(e,t,s,!0),!0}return!1};Lc.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=Dne?null:t.clipboardData;return n?(Lne(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(nMe(e),!1)};function oMe(e,t){let n=e.dom.parentNode;if(!n)return;let s=n.appendChild(document.createElement("textarea"));s.style.cssText="position: fixed; left: -10000px; top: 10px",s.value=t,s.focus(),s.selectionEnd=t.length,s.selectionStart=0,setTimeout(()=>{s.remove(),e.focus()},50)}function aMe(e){let t=[],n=[],s=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let r=-1;for(let{from:i}of e.selection.ranges){let o=e.doc.lineAt(i);o.number>r&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),r=o.number}s=!0}return{text:sC(e,ZM,t.join(e.lineBreak)),ranges:n,linewise:s}}let RA=null;Lc.copy=Lc.cut=(e,t)=>{if(!rx(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:s,linewise:r}=aMe(e.state);if(!n&&!r)return!1;RA=r?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"});let i=Dne?null:t.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(oMe(e,n),!1)};const One=fh.define();function Bne(e,t){let n=[];for(let s of e.facet(bne)){let r=s(e,t);r&&n.push(r)}return n.length?e.update({effects:n,annotations:One.of(!0)}):null}function $ne(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Bne(e.state,t);n?e.dispatch(n):e.update([])}},10)}rl.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),$ne(e)};rl.blur=e=>{e.observer.clearSelectionRange(),$ne(e)};rl.compositionstart=rl.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};rl.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))};rl.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};Lc.beforeinput=(e,t)=>{var n,s;if((t.inputType=="insertText"||t.inputType=="insertCompositionText")&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType=="insertReplacementText"&&e.observer.editContext){let i=(n=t.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=t.getTargetRanges();if(i&&o.length){let a=o[0],c=e.posAtDOM(a.startContainer,a.startOffset),u=e.posAtDOM(a.endContainer,a.endOffset);return sI(e,{from:c,to:u,insert:e.state.toText(i)},null),!0}}let r;if(rn.chrome&&rn.android&&(r=Ine.find(i=>i.inputType==t.inputType))&&(e.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let i=((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>i+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return rn.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),rn.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>rl.compositionend(e,t),20),!1};const Nz=new Set;function lMe(e){Nz.has(e)||(Nz.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const jz=["pre-wrap","normal","pre-line","break-spaces"];let v1=!1;function Mz(){v1=!1}class cMe{constructor(t){this.lineWrapping=t,this.doc=rr.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,n){let s=this.doc.lineAt(n).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(s+=Math.max(0,Math.ceil((n-t-s*this.lineLength*.5)/this.lineLength))),this.lineHeight*s}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jz.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let n=!1;for(let s=0;s<t.length;s++){let r=t[s];r<0?s++:this.heightSamples[Math.floor(r*10)]||(n=!0,this.heightSamples[Math.floor(r*10)]=!0)}return n}refresh(t,n,s,r,i,o){let a=jz.indexOf(t)>-1,c=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=n,this.charWidth=s,this.textHeight=r,this.lineLength=i,c){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 c}}class uMe{constructor(t,n){this.from=t,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class Mc{constructor(t,n,s,r,i){this.from=t,this.length=n,this.top=s,this.height=r,this._content=i}get type(){return typeof this._content=="number"?Fo.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 Bp?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 Mc(this.from,this.length+t.length,this.top,this.height+t.height,n)}}var Hr=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(Hr||(Hr={}));const Z_=.001;class Na{constructor(t,n,s=2){this.length=t,this.height=n,this.flags=s}get outdated(){return(this.flags&2)>0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>Z_&&(v1=!0),this.height=t)}replace(t,n,s){return Na.of(s)}decomposeLeft(t,n){n.push(this)}decomposeRight(t,n){n.push(this)}applyChanges(t,n,s,r){let i=this,o=s.doc;for(let a=r.length-1;a>=0;a--){let{fromA:c,toA:u,fromB:d,toB:h}=r[a],m=i.lineAt(c,Hr.ByPosNoHeight,s.setDoc(n),0,0),p=m.to>=u?m:i.lineAt(u,Hr.ByPosNoHeight,s,0,0);for(h+=p.to-u,u=p.to;a>0&&m.from<=r[a-1].toA;)c=r[a-1].fromA,d=r[a-1].fromB,a--,c<m.from&&(m=i.lineAt(c,Hr.ByPosNoHeight,s,0,0));d+=m.from-c,c=m.from;let g=rI.build(s.setDoc(o),t,d,h);i=WS(i,i.replace(c,u,g))}return i.updateHeight(s,0)}static empty(){return new gl(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,s=t.length,r=0,i=0;for(;;)if(n==s)if(r>i*2){let a=t[n-1];a.break?t.splice(--n,1,a.left,null,a.right):t.splice(--n,1,a.left,a.right),s+=1+a.break,r-=a.size}else if(i>r*2){let a=t[s];a.break?t.splice(s,1,a.left,null,a.right):t.splice(s,1,a.left,a.right),s+=2+a.break,i-=a.size}else break;else if(r<i){let a=t[n++];a&&(r+=a.size)}else{let a=t[--s];a&&(i+=a.size)}let o=0;return t[n-1]==null?(o=1,n--):t[n]==null&&(o=1,s++),new hMe(Na.of(t.slice(0,n)),o,Na.of(t.slice(s)))}}function WS(e,t){return e==t?e:(e.constructor!=t.constructor&&(v1=!0),t)}Na.prototype.size=1;const dMe=vn.replace({});class zne extends Na{constructor(t,n,s){super(t,n),this.deco=s,this.spaceAbove=0}mainBlock(t,n){return new Mc(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(t,n,s,r){return this.spaceAbove&&t<s+this.spaceAbove?new Mc(r,0,s,this.spaceAbove,dMe):this.mainBlock(s,r)}lineAt(t,n,s,r,i){let o=this.mainBlock(r,i);return this.spaceAbove?this.blockAt(0,s,r,i).join(o):o}forEachLine(t,n,s,r,i,o){t<=i+this.length&&n>=i&&o(this.lineAt(0,Hr.ByPos,s,r,i))}setMeasuredHeight(t){let n=t.heights[t.index++];n<0?(this.spaceAbove=-n,n=t.heights[t.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(t,n=0,s=!1,r){return r&&r.from<=n&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class gl extends zne{constructor(t,n,s){super(t,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=s}mainBlock(t,n){return new Mc(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,s){let r=s[0];return s.length==1&&(r instanceof gl||r instanceof jo&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof jo?r=new gl(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):Na.of(s)}updateHeight(t,n=0,s=!1,r){return r&&r.from<=n&&r.more?this.setMeasuredHeight(r):(s||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class jo extends Na{constructor(t){super(t,0)}heightMetrics(t,n){let s=t.doc.lineAt(n).number,r=t.doc.lineAt(n+this.length).number,i=r-s+1,o,a=0;if(t.lineWrapping){let c=Math.min(this.height,t.lineHeight*i);o=c/i,this.length>i+1&&(a=(this.height-c)/(this.length-i-1))}else o=this.height/i;return{firstLine:s,lastLine:r,perLine:o,perChar:a}}blockAt(t,n,s,r){let{firstLine:i,lastLine:o,perLine:a,perChar:c}=this.heightMetrics(n,r);if(n.lineWrapping){let u=r+(t<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-s)/this.height))*this.length)),d=n.doc.lineAt(u),h=a+d.length*c,m=Math.max(s,t-h/2);return new Mc(d.from,d.length,m,h,0)}else{let u=Math.max(0,Math.min(o-i,Math.floor((t-s)/a))),{from:d,length:h}=n.doc.line(i+u);return new Mc(d,h,s+a*u,a,0)}}lineAt(t,n,s,r,i){if(n==Hr.ByHeight)return this.blockAt(t,s,r,i);if(n==Hr.ByPosNoHeight){let{from:p,to:g}=s.doc.lineAt(t);return new Mc(p,g-p,0,0,0)}let{firstLine:o,perLine:a,perChar:c}=this.heightMetrics(s,i),u=s.doc.lineAt(t),d=a+u.length*c,h=u.number-o,m=r+a*h+c*(u.from-i-h);return new Mc(u.from,u.length,Math.max(r,Math.min(m,r+this.height-d)),d,0)}forEachLine(t,n,s,r,i,o){t=Math.max(t,i),n=Math.min(n,i+this.length);let{firstLine:a,perLine:c,perChar:u}=this.heightMetrics(s,i);for(let d=t,h=r;d<=n;){let m=s.doc.lineAt(d);if(d==t){let g=m.number-a;h+=c*g+u*(t-i-g)}let p=c+u*m.length;o(new Mc(m.from,m.length,h,p,0)),h+=p,d=m.to+1}}replace(t,n,s){let r=this.length-n;if(r>0){let i=s[s.length-1];i instanceof jo?s[s.length-1]=new jo(i.length+r):s.push(null,new jo(r-1))}if(t>0){let i=s[0];i instanceof jo?s[0]=new jo(t+i.length):s.unshift(new jo(t-1),null)}return Na.of(s)}decomposeLeft(t,n){n.push(new jo(t-1),null)}decomposeRight(t,n){n.push(null,new jo(this.length-t-1))}updateHeight(t,n=0,s=!1,r){let i=n+this.length;if(r&&r.from<=n+this.length&&r.more){let o=[],a=Math.max(n,r.from),c=-1;for(r.from>n&&o.push(new jo(r.from-n-1).updateHeight(t,n));a<=i&&r.more;){let d=t.doc.lineAt(a).length;o.length&&o.push(null);let h=r.heights[r.index++],m=0;h<0&&(m=-h,h=r.heights[r.index++]),c==-1?c=h:Math.abs(h-c)>=Z_&&(c=-2);let p=new gl(d,h,m);p.outdated=!1,o.push(p),a+=d+1}a<=i&&o.push(null,new jo(i-a).updateHeight(t,a));let u=Na.of(o);return(c<0||Math.abs(u.height-this.height)>=Z_||Math.abs(c-this.heightMetrics(t,n).perLine)>=Z_)&&(v1=!0),WS(this,u)}else(s||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class hMe extends Na{constructor(t,n,s){super(t.length+n+s.length,t.height+s.height,n|(t.outdated||s.outdated?2:0)),this.left=t,this.right=s,this.size=t.size+s.size}get break(){return this.flags&1}blockAt(t,n,s,r){let i=s+this.left.height;return t<i?this.left.blockAt(t,n,s,r):this.right.blockAt(t,n,i,r+this.left.length+this.break)}lineAt(t,n,s,r,i){let o=r+this.left.height,a=i+this.left.length+this.break,c=n==Hr.ByHeight?t<o:t<a,u=c?this.left.lineAt(t,n,s,r,i):this.right.lineAt(t,n,s,o,a);if(this.break||(c?u.to<a:u.from>a))return u;let d=n==Hr.ByPosNoHeight?Hr.ByPosNoHeight:Hr.ByPos;return c?u.join(this.right.lineAt(a,d,s,o,a)):this.left.lineAt(a,d,s,r,i).join(u)}forEachLine(t,n,s,r,i,o){let a=r+this.left.height,c=i+this.left.length+this.break;if(this.break)t<c&&this.left.forEachLine(t,n,s,r,i,o),n>=c&&this.right.forEachLine(t,n,s,a,c,o);else{let u=this.lineAt(c,Hr.ByPos,s,r,i);t<u.from&&this.left.forEachLine(t,u.from-1,s,r,i,o),u.to>=t&&u.from<=n&&o(u),n>u.to&&this.right.forEachLine(u.to+1,n,s,a,c,o)}}replace(t,n,s){let r=this.left.length+this.break;if(n<r)return this.balanced(this.left.replace(t,n,s),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-r,n-r,s));let i=[];t>0&&this.decomposeLeft(t,i);let o=i.length;for(let a of s)i.push(a);if(t>0&&Iz(i,o-1),n<this.length){let a=i.length;this.decomposeRight(n,i),Iz(i,a)}return Na.of(i)}decomposeLeft(t,n){let s=this.left.length;if(t<=s)return this.left.decomposeLeft(t,n);n.push(this.left),this.break&&(s++,t>=s&&n.push(null)),t>s&&this.right.decomposeLeft(t-s,n)}decomposeRight(t,n){let s=this.left.length,r=s+this.break;if(t>=r)return this.right.decomposeRight(t-r,n);t<s&&this.left.decomposeRight(t,n),this.break&&t<r&&n.push(null),n.push(this.right)}balanced(t,n){return t.size>2*n.size||n.size>2*t.size?Na.of(this.break?[t,null,n]:[t,n]):(this.left=WS(this.left,t),this.right=WS(this.right,n),this.setHeight(t.height+n.height),this.outdated=t.outdated||n.outdated,this.size=t.size+n.size,this.length=t.length+this.break+n.length,this)}updateHeight(t,n=0,s=!1,r){let{left:i,right:o}=this,a=n+i.length+this.break,c=null;return r&&r.from<=n+i.length&&r.more?c=i=i.updateHeight(t,n,s,r):i.updateHeight(t,n,s),r&&r.from<=a+o.length&&r.more?c=o=o.updateHeight(t,a,s,r):o.updateHeight(t,a,s),c?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 Iz(e,t){let n,s;e[t]==null&&(n=e[t-1])instanceof jo&&(s=e[t+1])instanceof jo&&e.splice(t-1,3,new jo(n.length+1+s.length))}const fMe=5;class rI{constructor(t,n){this.pos=t,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,n){if(this.lineStart>-1){let s=Math.min(n,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof gl?r.length+=s-this.pos:(s>this.pos||!this.isCovered)&&this.nodes.push(new gl(s-this.pos,-1,0)),this.writtenTo=s,n>s&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(t,n,s){if(t<n||s.heightRelevant){let r=s.widget?s.widget.estimatedHeight:0,i=s.widget?s.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let o=n-t;s.block?this.addBlock(new zne(o,r,s)):(o||i||r>=fMe)&&this.addLineDeco(r,i,o)}else n>t&&this.span(t,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=n,this.writtenTo<t&&((this.writtenTo<t-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new gl(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let s=new jo(n-t);return this.oracle.doc.lineAt(t).to==n&&(s.flags|=4),s}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof gl)return t;let n=new gl(0,-1,0);return this.nodes.push(n),n}addBlock(t){this.enterLine();let n=t.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,n&&n.endSide>0&&(this.covering=t)}addLineDeco(t,n,s){let r=this.ensureLine();r.length+=s,r.collapsed+=s,r.widgetHeight=Math.max(r.widgetHeight,t),r.breaks+=n,this.writtenTo=this.pos=this.pos+s}finish(t){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof gl)&&!this.isCovered?this.nodes.push(new gl(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let s=t;for(let r of this.nodes)r instanceof gl&&r.updateHeight(this.oracle,s),s+=r?r.length:1;return this.nodes}static build(t,n,s,r){let i=new rI(s,t);return Rs.spans(n,s,r,i,0),i.finish(s)}}function mMe(e,t,n){let s=new pMe;return Rs.compare(e,t,n,s,0),s.changes}class pMe{constructor(){this.changes=[]}compareRange(){}comparePoint(t,n,s,r){(t<n||s&&s.heightRelevant||r&&r.heightRelevant)&&Pg(t,n,this.changes,5)}}function gMe(e,t){let n=e.getBoundingClientRect(),s=e.ownerDocument,r=s.defaultView||window,i=Math.max(0,n.left),o=Math.min(r.innerWidth,n.right),a=Math.max(0,n.top),c=Math.min(r.innerHeight,n.bottom);for(let u=e.parentNode;u&&u!=s.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),c=Math.min(u==e.parentNode?r.innerHeight:c,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,c)-(n.top+t)}}function bMe(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}function yMe(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class A6{constructor(t,n,s,r){this.from=t,this.to=n,this.size=s,this.displaySize=r}static same(t,n){if(t.length!=n.length)return!1;for(let s=0;s<t.length;s++){let r=t[s],i=n[s];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(t,n){return vn.replace({widget:new xMe(this.displaySize*(n?t.scaleY:t.scaleX),n)}).range(this.from,this.to)}}class xMe extends Ol{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 Rz{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=Dz,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Rr.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let s=n.facet(eI).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new cMe(s),this.stateDeco=Lz(n),this.heightMap=Na.empty().applyChanges(this.stateDeco,rr.empty,this.heightOracle.setDoc(n.doc),[new dc(0,0,0,n.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=vn.set(this.lineGaps.map(r=>r.draw(this,!1))),this.scrollParent=t.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:n}=this.state.selection;for(let s=0;s<=1;s++){let r=s?n.head:n.anchor;if(!t.some(({from:i,to:o})=>r>=i&&r<=o)){let{from:i,to:o}=this.lineBlockAt(r);t.push(new $k(i,o))}}return this.viewports=t.sort((s,r)=>s.from-r.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?Dz:new iI(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(Sy(t,this.scaler))})}update(t,n=null){this.state=t.state;let s=this.stateDeco;this.stateDeco=Lz(this.state);let r=t.changedRanges,i=dc.extendWithRanges(r,mMe(s,this.stateDeco,t?t.changes:to.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);Mz(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||v1)&&(t.flags|=2),a?(this.scrollAnchorPos=t.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let c=i.length?this.mapViewport(this.viewport,t.changes):this.viewport;(n&&(n.range.head<c.from||n.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,n));let u=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,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(xne)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:t}=this,n=t.contentDOM,s=window.getComputedStyle(n),r=this.heightOracle,i=s.whiteSpace;this.defaultTextDirection=s.direction=="rtl"?Rr.RTL:Rr.LTR;let o=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent==="refresh",a=n.getBoundingClientRect(),c=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:_}=tne(n,a);(T>.005&&Math.abs(this.scaleX-T)>.005||_>.005&&Math.abs(this.scaleY-_)>.005)&&(this.scaleX=T,this.scaleY=_,u|=16,o=c=!0)}let h=(parseInt(s.paddingTop)||0)*this.scaleY,m=(parseInt(s.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=m)&&(this.paddingTop=h,this.paddingBottom=m,u|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(r.lineWrapping&&(c=!0),this.editorWidth=t.scrollDOM.clientWidth,u|=16);let p=nne(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=rne(this.scrollParent||t.win);let b=(this.printing?yMe:gMe)(n,this.paddingTop),v=b.top-this.pixelViewport.top,x=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&&(c=!0)),!this.inView&&!this.scrollTarget&&!bMe(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),c){let T=t.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(T)&&(o=!0),o||r.lineWrapping&&Math.abs(w-this.contentDOMWidth)>r.charWidth){let{lineHeight:_,charWidth:C,textHeight:S}=t.docView.measureTextSize();o=_>0&&r.refresh(i,_,C,S,Math.max(5,w/C),T),o&&(t.docView.minWidth=0,u|=16)}v>0&&x>0?d=Math.max(v,x):v<0&&x<0&&(d=Math.min(v,x)),Mz();for(let _ of this.viewports){let C=_.from==this.viewport.from?T:t.docView.measureVisibleLineHeights(_);this.heightMap=(o?Na.empty().applyChanges(this.stateDeco,rr.empty,this.heightOracle,[new dc(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new uMe(_.from,C))}v1&&(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 s=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,c=new $k(r.lineAt(o-s*1e3,Hr.ByHeight,i,0,0).from,r.lineAt(a+(1-s)*1e3,Hr.ByHeight,i,0,0).to);if(n){let{head:u}=n.range;if(u<c.from||u>c.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=r.lineAt(u,Hr.ByPos,i,0,0),m;n.y=="center"?m=(h.top+h.bottom)/2-d/2:n.y=="start"||n.y=="nearest"&&u<c.from?m=h.top:m=h.bottom-d,c=new $k(r.lineAt(m-1e3/2,Hr.ByHeight,i,0,0).from,r.lineAt(m+d+1e3/2,Hr.ByHeight,i,0,0).to)}}return c}mapViewport(t,n){let s=n.mapPos(t.from,-1),r=n.mapPos(t.to,1);return new $k(this.heightMap.lineAt(s,Hr.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Hr.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:n},s=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(t,Hr.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,Hr.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(t==0||r<=o-Math.max(10,Math.min(-s,250)))&&(n==this.state.doc.length||i>=a+Math.max(10,Math.min(s,250)))&&r>o-2*1e3&&i<a+2*1e3}mapLineGaps(t,n){if(!t.length||n.empty)return t;let s=[];for(let r of t)n.touchesRange(r.from,r.to)||s.push(new A6(n.mapPos(r.from),n.mapPos(r.to),r.size,r.displaySize));return s}ensureLineGaps(t,n){let s=this.heightOracle.lineWrapping,r=s?1e4:2e3,i=r>>1,o=r<<1;if(this.defaultTextDirection!=Rr.LTR&&!s)return[];let a=[],c=(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 x of b)if(x>d&&x<h){c(d,x-10,m,p),c(x+10,h,m,p);return}let v=wMe(t,x=>x.from>=m.from&&x.to<=m.to&&Math.abs(x.from-d)<i&&Math.abs(x.to-h)<i&&!b.some(y=>x.from<y&&x.to>y));if(!v){if(h<m.to&&n&&s&&n.visibleRanges.some(w=>w.from<=h&&w.to>=h)){let w=n.moveToLineBoundary(Ye.cursor(h),!1,!0).head;w>d&&(h=w)}let x=this.gapSize(m,d,h,p),y=s||x<2e6?x:2e6;v=new A6(d,h,x,y)}a.push(v)},u=d=>{if(d.length<o||d.type!=Fo.Text)return;let h=vMe(d.from,d.to,this.stateDeco);if(h.total<o)return;let m=this.scrollTarget?this.scrollTarget.range.head:null,p,g;if(s){let b=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,v,x;if(m!=null){let y=Fk(h,m),w=((this.visibleBottom-this.visibleTop)/2+b)/d.height;v=y-w,x=y+w}else v=(this.visibleTop-d.top-b)/d.height,x=(this.visibleBottom-d.top+b)/d.height;p=zk(h,v),g=zk(h,x)}else{let b=h.total*this.heightOracle.charWidth,v=r*this.heightOracle.charWidth,x=0;if(b>2e6)for(let _ of t)_.from>=d.from&&_.from<d.to&&_.size!=_.displaySize&&_.from*this.heightOracle.charWidth+x<this.pixelViewport.left&&(x=_.size-_.displaySize);let y=this.pixelViewport.left+x,w=this.pixelViewport.right+x,k,T;if(m!=null){let _=Fk(h,m),C=((w-y)/2+v)/b;k=_-C,T=_+C}else k=(y-v)/b,T=(w+v)/b;p=zk(h,k),g=zk(h,T)}p>d.from&&c(d.from,p,d,h),g<d.to&&c(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,s,r){let i=Fk(r,s)-Fk(r,n);return this.heightOracle.lineWrapping?t.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(t){A6.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 s=[];Rs.spans(n,this.viewport.from,this.viewport.to,{span(i,o){s.push({from:i,to:o})},point(){}},20);let r=0;if(s.length!=this.visibleRanges.length)r=12;else for(let i=0;i<s.length&&!(r&8);i++){let o=this.visibleRanges[i],a=s[i];(o.from!=a.from||o.to!=a.to)&&(r|=4,t&&t.mapPos(o.from,-1)==a.from&&t.mapPos(o.to,1)==a.to||(r|=8))}return this.visibleRanges=s,r}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(n=>n.from<=t&&n.to>=t)||Sy(this.heightMap.lineAt(t,Hr.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)||Sy(this.heightMap.lineAt(this.scaler.fromDOM(t),Hr.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 Sy(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 $k{constructor(t,n){this.from=t,this.to=n}}function vMe(e,t,n){let s=[],r=e,i=0;return Rs.spans(n,e,t,{span(){},point(o,a){o>r&&(s.push({from:r,to:o}),i+=o-r),r=a}},20),r<t&&(s.push({from:r,to:t}),i+=t-r),{total:i,ranges:s}}function zk({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let s=Math.floor(e*n);for(let r=0;;r++){let{from:i,to:o}=t[r],a=o-i;if(s<=a)return i+s;s-=a}}function Fk(e,t){let n=0;for(let{from:s,to:r}of e.ranges){if(t<=r){n+=t-s;break}n+=r-s}return n/e.total}function wMe(e,t){for(let n of e)if(t(n))return n}const Dz={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function Lz(e){let t=e.facet(eC).filter(s=>typeof s!="function"),n=e.facet(tI).filter(s=>typeof s!="function");return n.length&&t.push(Rs.join(n)),t}class iI{constructor(t,n,s){let r=0,i=0,o=0;this.viewports=s.map(({from:a,to:c})=>{let u=n.lineAt(a,Hr.ByPos,t,0,0).top,d=n.lineAt(c,Hr.ByPos,t,0,0).bottom;return r+=d-u,{from:a,to:c,top:u,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(n.height-r);for(let a of this.viewports)a.domTop=o+(a.top-i)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),i=a.bottom}toDOM(t){for(let n=0,s=0,r=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||t<i.top)return r+(t-s)*this.scale;if(t<=i.bottom)return i.domTop+(t-i.top);s=i.bottom,r=i.domBottom}}fromDOM(t){for(let n=0,s=0,r=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||t<i.domTop)return s+(t-r)/this.scale;if(t<=i.domBottom)return i.top+(t-i.domTop);s=i.bottom,r=i.domBottom}}eq(t){return t instanceof iI?this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((n,s)=>n.from==t.viewports[s].from&&n.to==t.viewports[s].to):!1}}function Sy(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),s=t.toDOM(e.bottom);return new Mc(e.from,e.length,n,s-n,Array.isArray(e._content)?e._content.map(r=>Sy(r,t)):e._content)}const Hk=on.define({combine:e=>e.join(" ")}),DA=on.define({combine:e=>e.indexOf(!0)>-1}),LA=Gf.newName(),Fne=Gf.newName(),Hne=Gf.newName(),qne={"&light":"."+Fne,"&dark":"."+Hne};function PA(e,t,n){return new Gf(t,{finish(s){return/&/.test(s)?s.replace(/&\w*/,r=>{if(r=="&")return e;if(!n||!n[r])throw new RangeError(`Unsupported selector: ${r}`);return n[r]}):e+" "+s}})}const kMe=PA("."+LA,{"&":{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"}},qne),_Me={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},N6=rn.ie&&rn.ie_version<=11;class SMe{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new eje,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(n=>{for(let s of n)this.queue.push(s);(rn.ie&&rn.ie_version<=11||rn.ios&&t.composing)&&n.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&rn.android&&t.constructor.EDIT_CONTEXT!==!1&&!(rn.chrome&&rn.chrome_version<126)&&(this.editContext=new TMe(t),t.state.facet(vd)&&(t.contentDOM.editContext=this.editContext.editContext)),N6&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){(t.type=="change"||!t.type)&&!t.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((n,s)=>n!=t[s]))){this.gapIntersection.disconnect();for(let n of t)this.gapIntersection.observe(n);this.gaps=t}}onSelectionChange(t){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:s}=this,r=this.selectionRange;if(s.state.facet(vd)?s.root.activeElement!=this.dom:!rx(this.dom,r))return;let i=r.anchorNode&&s.docView.tile.nearest(r.anchorNode);if(i&&i.isWidget()&&i.widget.ignoreEvent(t)){n||(this.selectionChanged=!1);return}(rn.ie&&rn.ie_version<=11||rn.android&&rn.chrome)&&!s.state.selection.main.empty&&r.focusNode&&ox(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=Xx(t.root);if(!n)return!1;let s=rn.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&CMe(this.view,n)||n;if(!s||this.selectionRange.eq(s))return!1;let r=rx(this.dom,s);return r&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&nje(this.dom,s)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(s),r&&(this.selectionChanged=!0),!0)}setSelectionRange(t,n){this.selectionRange.set(t.node,t.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let t=0,n=null;for(let s=this.dom;s;)if(s.nodeType==1)!n&&t<this.scrollTargets.length&&this.scrollTargets[t]==s?t++:n||(n=this.scrollTargets.slice(0,t)),n&&n.push(s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;if(t<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,t)),n){for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);for(let s of this.scrollTargets=n)s.addEventListener("scroll",this.onScroll)}}ignore(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,_Me),N6&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),N6&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,n){var s;if(!this.delayedAndroidKey){let r=()=>{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&Og(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((s=this.delayedAndroidKey)===null||s===void 0)&&s.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let n=-1,s=-1,r=!1;for(let i of t){let o=this.readMutation(i);o&&(o.typeOver&&(r=!0),n==-1?{from:n,to:s}=o:(n=Math.min(o.from,n),s=Math.max(o.to,s)))}return{from:n,to:s,typeOver:r}}readChange(){let{from:t,to:n,typeOver:s}=this.processRecords(),r=this.selectionChanged&&rx(this.dom,this.selectionRange);if(t<0&&!r)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new qje(this.view,t,n,s);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let s=this.view.state,r=jne(this.view,n);return this.view.state==s&&(n.domChanged||n.newSel&&!VS(this.view.state.selection,n.newSel.main))&&this.view.update([]),r}readMutation(t){let n=this.view.docView.tile.nearest(t.target);if(!n||n.isWidget())return null;if(n.markDirty(t.type=="attributes"),t.type=="childList"){let s=Pz(n,t.previousSibling||t.target.previousSibling,-1),r=Pz(n,t.nextSibling||t.target.nextSibling,1);return{from:s?n.posAfter(s):n.posAtStart,to:r?n.posBefore(r):n.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(vd)!=t.state.facet(vd)&&(t.view.contentDOM.editContext=t.state.facet(vd)?this.editContext.editContext:null))}destroy(){var t,n,s;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(s=this.resizeScroll)===null||s===void 0||s.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Pz(e,t,n){for(;t;){let s=_i.get(t);if(s&&s.parent==e)return s;let r=t.parentNode;t=r!=e.dom?r:n>0?t.nextSibling:t.previousSibling}return null}function Oz(e,t){let n=t.startContainer,s=t.startOffset,r=t.endContainer,i=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return ox(o.node,o.offset,r,i)&&([n,s,r,i]=[r,i,n,s]),{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:i}}function CMe(e,t){if(t.getComposedRanges){let r=t.getComposedRanges(e.root)[0];if(r)return Oz(e,r)}let n=null;function s(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",s,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",s,!0),n?Oz(e,n):null}class TMe{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let n=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=s=>{let r=t.state.selection.main,{anchor:i,head:o}=r,a=this.toEditorPos(s.updateRangeStart),c=this.toEditorPos(s.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:s.updateRangeStart,editorBase:a,drifted:!1});let u=c-a>s.text.length;a==this.from&&i<this.from?a=i:c==this.to&&i>this.to&&(c=i);let d=Mne(t.state.sliceDoc(a,c),s.text,(u?r.from:r.to)-a,u?"end":null);if(!d){let m=Ye.single(this.toEditorPos(s.selectionStart),this.toEditorPos(s.selectionEnd));VS(m,r)||t.dispatch({selection:m,userEvent:"select"});return}let h={from:d.from+a,to:d.toA+a,insert:rr.of(s.text.slice(d.from,d.toB).split(`
`))};if((rn.mac||rn.android)&&h.from==o-1&&/^\. ?$/.test(s.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:c,insert:rr.of([s.text.replace("."," ")])}),this.pendingContextChange=h,!t.state.readOnly){let m=this.to-this.from+(h.to-h.from+h.insert.length);sI(t,h,Ye.single(this.toEditorPos(s.selectionStart,m),this.toEditorPos(s.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,s.updateRangeStart-1),Math.min(n.text.length,s.updateRangeStart+1)))&&this.handlers.compositionend(s)},this.handlers.characterboundsupdate=s=>{let r=[],i=null;for(let o=this.toEditorPos(s.rangeStart),a=this.toEditorPos(s.rangeEnd);o<a;o++){let c=t.coordsForChar(o);i=c&&new DOMRect(c.left,c.top,c.right-c.left,c.bottom-c.top)||i||new DOMRect,r.push(i)}n.updateCharacterBounds(s.rangeStart,r)},this.handlers.textformatupdate=s=>{let r=[];for(let i of s.getTextFormats()){let o=i.underlineStyle,a=i.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let c=this.toEditorPos(i.rangeStart),u=this.toEditorPos(i.rangeEnd);if(c<u){let d=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;r.push(vn.mark({attributes:{style:d}}).range(c,u))}}}t.dispatch({effects:wne.of(vn.set(r))})},this.handlers.compositionstart=()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:s}=this.composing;this.composing=null,s&&this.reset(t.state)}};for(let s in this.handlers)n.addEventListener(s,this.handlers[s]);this.measureReq={read:s=>{this.editContext.updateControlBounds(s.contentDOM.getBoundingClientRect());let r=Xx(s.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let n=0,s=!1,r=this.pendingContextChange;return t.changes.iterChanges((i,o,a,c,u)=>{if(s)return;let d=u.length-(o-i);if(r&&o>=r.to)if(r.from==i&&r.to==o&&r.insert.eq(u)){r=this.pendingContextChange=null,n+=d,this.to+=d;return}else r=null,this.revertPending(t.state);if(i+=n,o+=n,o<=this.from)this.from+=d,this.to+=d;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+u.length>3e4){s=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),u.toString()),this.to+=d}n+=d}),r&&!s&&this.revertPending(t.state),!s}update(t){let n=this.pendingContextChange,s=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(s.from,s.to)&&t.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.reset(t.state)):(t.docChanged||t.selectionSet||n)&&this.setSelection(t.state),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:n}=t.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(t.doc.length,n+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),t.doc.sliceString(n.from,n.to))}setSelection(t){let{main:n}=t.selection,s=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),r=this.toContextPos(n.head);(this.editContext.selectionStart!=s||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(s,r)}rangeIsValid(t){let{head:n}=t.selection.main;return!(this.from>0&&n-this.from<500||this.to<t.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(t,n=this.to-this.from){t=Math.min(t,n);let s=this.composing;return s&&s.drifted?s.editorBase+(t-s.contextBase):t+this.from}toContextPos(t){let n=this.composing;return n&&n.drifted?n.contextBase+(t-n.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class Nt{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:s}=t;this.dispatchTransactions=t.dispatchTransactions||s&&(r=>r.forEach(i=>s(i,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=t.root||tje(t.parent)||document,this.viewState=new Rz(this,t.state||Ks.create(t)),t.scrollTo&&t.scrollTo.is(Pk)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(mg).map(r=>new _6(r));for(let r of this.plugins)r.update(this);this.observer=new SMe(this),this.inputState=new Gje(this),this.inputState.ensureHandlers(this.plugins),this.docView=new vz(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 so?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(n,this)}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,s=!1,r,i=this.state;for(let 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,c=null;t.some(m=>m.annotation(One))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=Bne(i,o),c||(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(Ks.phrases)!=this.state.facet(Ks.phrases))return this.setState(i);r=HS.create(this,i,t),r.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(Nt.cursorScrollMargin);h=new Bg(p.empty?p:Ye.cursor(p.head,p.head>p.anchor?-1:1),"nearest","nearest",b,g)}for(let p of m.effects)p.is(Pk)&&(h=p.value.clip(this.state))}this.viewState.update(r,h),this.bidiCache=GS.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),n=this.docView.update(r),this.state.facet(_y)!=this.styleModules&&this.mountStyles(),s=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(m=>m.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(Hk)!=r.state.facet(Hk)&&(this.viewState.mustMeasureContent=!0),(n||s||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!r.empty)for(let m of this.state.facet(NA))try{m(r)}catch(p){Qa(this.state,p,"update listener")}(c||d)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),d&&!jne(this,d)&&u.force&&Og(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 s of this.plugins)s.destroy(this);this.viewState=new Rz(this,t),this.plugins=t.facet(mg).map(s=>new _6(s)),this.pluginMap.clear();for(let s of this.plugins)s.update(this);this.docView.destroy(),this.docView=new vz(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(mg),s=t.state.facet(mg);if(n!=s){let r=[];for(let i of s){let o=n.indexOf(i);if(o<0)r.push(new _6(i));else{let a=this.plugins[o];a.mustUpdate=t,r.push(a)}}for(let i of this.plugins)i.mustUpdate!=t&&i.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=t;for(let r=0;r<this.plugins.length;r++)this.plugins[r].update(this);n!=s&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let t of this.plugins){let n=t.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(s){Qa(this.state,s,"doc view update listener")}}}measure(t=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let n=null,s=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(rne(s||this.win))i=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(r);i=p.from,o=p.top}this.updateState=1;let c=this.viewState.measure();if(!c&&!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=[];c&4||([this.measureRequests,u]=[u,this.measureRequests]);let d=u.map(p=>{try{return p.read(this)}catch(g){return Qa(this.state,g),Bz}}),h=HS.create(this,this.state,[]),m=!1;h.flags|=c,n?n.flags|=c: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]!=Bz)try{let g=u[p];g.write&&g.write(d[p],this)}catch(g){Qa(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)&&(s==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r=r+g,s?s.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(NA))a(n)}get themeClasses(){return LA+" "+(this.state.facet(DA)?Hne:Fne)+" "+this.state.facet(Hk)}updateAttrs(){let t=$z(this,kne,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(vd)?"true":"false",class:"cm-content",style:`${rn.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),$z(this,eI,n);let s=this.observer.ignore(()=>{let r=mz(this.contentDOM,this.contentAttrs,n),i=mz(this.dom,this.editorAttrs,t);return r||i});return this.editorAttrs=t,this.contentAttrs=n,s}showAnnouncements(t){let n=!0;for(let s of t)for(let r of s.effects)if(r.is(Nt.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(_y);let t=this.state.facet(Nt.cspNonce);Gf.mount(this.root,this.styleModules.concat(kMe).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===t.key){this.measureRequests[n]=t;return}}this.measureRequests.push(t)}}plugin(t){let n=this.pluginMap.get(t);return(n===void 0||n&&n.plugin!=t)&&this.pluginMap.set(t,n=this.plugins.find(s=>s.plugin==t)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,n,s){return E6(this,t,wz(this,t,n,s))}moveByGroup(t,n){return E6(this,t,wz(this,t,n,s=>Oje(this,t.head,s)))}visualLineSide(t,n){let s=this.bidiSpans(t),r=this.textDirectionAt(t.from),i=s[n?s.length-1:0];return Ye.cursor(i.side(n,r)+t.from,i.forward(!n,r)?1:-1)}moveToLineBoundary(t,n,s=!0){return Pje(this,t,n,s)}moveVertically(t,n,s){return E6(this,t,Bje(this,t,n,s))}domAtPos(t,n=1){return this.docView.domAtPos(t,n)}posAtDOM(t,n=0){return this.docView.posFromDOM(t,n)}posAtCoords(t,n=!0){this.readMeasured();let s=IA(this,t,n);return s&&s.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),IA(this,t,n)}coordsAtPos(t,n=1){this.readMeasured();let s=this.docView.coordsAt(t,n);if(!s||s.left==s.right)return s;let r=this.state.doc.lineAt(t),i=this.bidiSpans(r),o=i[Au.find(i,t-r.from,-1,n)];return Qx(s,o.dir==Rr.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(yne)||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>EMe)return une(t.length);let n=this.textDirectionAt(t.from),s;for(let i of this.bidiCache)if(i.from==t.from&&i.dir==n&&(i.fresh||cne(i.isolates,s=bz(this,t))))return i.order;s||(s=bz(this,t));let r=cje(t.text,n,s);return this.bidiCache.push(new GS(t.from,t.to,n,s,!0,r)),r}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(()=>{sne(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,n={}){var s,r,i,o;return Pk.of(new Bg(typeof t=="number"?Ye.cursor(t):t,(s=n.y)!==null&&s!==void 0?s:"nearest",(r=n.x)!==null&&r!==void 0?r:"nearest",(i=n.yMargin)!==null&&i!==void 0?i:5,(o=n.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:t,scrollLeft:n}=this.scrollDOM,s=this.viewState.scrollAnchorAt(t);return Pk.of(new Bg(Ye.cursor(s.from),"start","start",s.top-t,n,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return ai.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return ai.define(()=>({}),{eventObservers:t})}static theme(t,n){let s=Gf.newName(),r=[Hk.of(s),_y.of(PA(`.${s}`,t))];return n&&n.dark&&r.push(DA.of(!0)),r}static baseTheme(t){return gm.lowest(_y.of(PA("."+LA,t,qne)))}static findFromDOM(t){var n;let s=t.querySelector(".cm-content"),r=s&&_i.get(s)||_i.get(t);return((n=r==null?void 0:r.root)===null||n===void 0?void 0:n.view)||null}}Nt.styleModule=_y;Nt.inputHandler=gne;Nt.clipboardInputFilter=JM;Nt.clipboardOutputFilter=ZM;Nt.scrollHandler=vne;Nt.focusChangeEffect=bne;Nt.perLineTextDirection=yne;Nt.exceptionSink=pne;Nt.updateListener=NA;Nt.editable=vd;Nt.mouseSelectionStyle=mne;Nt.dragMovesSelection=fne;Nt.clickAddsSelectionRange=hne;Nt.decorations=eC;Nt.blockWrappers=_ne;Nt.outerDecorations=tI;Nt.atomicRanges=Qv;Nt.bidiIsolatedRanges=Sne;Nt.cursorScrollMargin=on.define({combine:e=>{let t=5,n=5;for(let s of e)typeof s=="number"?t=n=s:{x:t,y:n}=s;return{x:t,y:n}}});Nt.scrollMargins=Cne;Nt.darkTheme=DA;Nt.cspNonce=on.define({combine:e=>e.length?e[0]:""});Nt.contentAttributes=eI;Nt.editorAttributes=kne;Nt.lineWrapping=Nt.contentAttributes.of({class:"cm-lineWrapping"});Nt.announce=rs.define();const EMe=4096,Bz={};class GS{constructor(t,n,s,r,i,o){this.from=t,this.to=n,this.dir=s,this.isolates=r,this.fresh=i,this.order=o}static update(t,n){if(n.empty&&!t.some(i=>i.fresh))return t;let s=[],r=t.length?t[t.length-1].dir:Rr.LTR;for(let i=Math.max(0,t.length-10);i<t.length;i++){let o=t[i];o.dir==r&&!n.touchesRange(o.from,o.to)&&s.push(new GS(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return s}}function $z(e,t,n){for(let s=e.state.facet(t),r=s.length-1;r>=0;r--){let i=s[r],o=typeof i=="function"?i(e):i;o&&YM(o,n)}return n}const AMe=rn.mac?"mac":rn.windows?"win":rn.linux?"linux":"key";function NMe(e,t){const n=e.split(/-(?!$)/);let s=n[n.length-1];s=="Space"&&(s=" ");let r,i,o,a;for(let c=0;c<n.length-1;++c){const u=n[c];if(/^(cmd|meta|m)$/i.test(u))a=!0;else if(/^a(lt)?$/i.test(u))r=!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 r&&(s="Alt-"+s),i&&(s="Ctrl-"+s),a&&(s="Meta-"+s),o&&(s="Shift-"+s),s}function qk(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 jMe=gm.default(Nt.domEventHandlers({keydown(e,t){return Vne(Une(t.state),e,t,"editor")}})),w1=on.define({enables:jMe}),zz=new WeakMap;function Une(e){let t=e.facet(w1),n=zz.get(t);return n||zz.set(t,n=RMe(t.reduce((s,r)=>s.concat(r),[]))),n}function MMe(e,t,n){return Vne(Une(e.state),t,e,n)}let Xh=null;const IMe=4e3;function RMe(e,t=AMe){let n=Object.create(null),s=Object.create(null),r=(o,a)=>{let c=s[o];if(c==null)s[o]=a;else if(c!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},i=(o,a,c,u,d)=>{var h,m;let p=n[o]||(n[o]=Object.create(null)),g=a.split(/ (?!$)/).map(x=>NMe(x,t));for(let x=1;x<g.length;x++){let y=g.slice(0,x).join(" ");r(y,!0),p[y]||(p[y]={preventDefault:!0,stopPropagation:!1,run:[w=>{let k=Xh={view:w,prefix:y,scope:o};return setTimeout(()=>{Xh==k&&(Xh=null)},IMe),!0}]})}let b=g.join(" ");r(b,!1);let v=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())||[]});c&&v.run.push(c),u&&(v.preventDefault=!0),d&&(v.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,OA))}let c=o[t]||o.key;if(c)for(let u of a)i(u,c,o.run,o.preventDefault,o.stopPropagation),o.shift&&i(u,"Shift-"+c,o.shift,o.preventDefault,o.stopPropagation)}return n}let OA=null;function Vne(e,t,n,s){OA=t;let r=KNe(t),i=Ka(r,0),o=vu(i)==r.length&&r!=" ",a="",c=!1,u=!1,d=!1;Xh&&Xh.view==n&&Xh.scope==s&&(a=Xh.prefix+" ",Rne.indexOf(t.keyCode)<0&&(u=!0,Xh=null));let h=new Set,m=v=>{if(v){for(let x of v.run)if(!h.has(x)&&(h.add(x),x(n)))return v.stopPropagation&&(d=!0),!0;v.preventDefault&&(v.stopPropagation&&(d=!0),u=!0)}return!1},p=e[s],g,b;return p&&(m(p[a+qk(r,t,!o)])?c=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(rn.windows&&t.ctrlKey&&t.altKey)&&!(rn.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(g=Kf[t.keyCode])&&g!=r?(m(p[a+qk(g,t,!0)])||t.shiftKey&&(b=Kx[t.keyCode])!=r&&b!=g&&m(p[a+qk(b,t,!1)]))&&(c=!0):o&&t.shiftKey&&m(p[a+qk(r,t,!0)])&&(c=!0),!c&&m(p._any)&&(c=!0)),u&&(c=!0),c&&d&&t.stopPropagation(),OA=null,c}class _p{constructor(t,n,s,r,i){this.className=t,this.left=n,this.top=s,this.width=r,this.height=i}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,n){return n.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",this.width!=null&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,n,s){if(s.empty){let r=t.coordsAtPos(s.head,s.assoc||1);if(!r)return[];let i=Wne(t);return[new _p(n,r.left-i.left,r.top-i.top,null,r.bottom-r.top)]}else return DMe(t,n,s)}}function Wne(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Rr.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function Fz(e,t,n,s){let r=e.coordsAtPos(t,n*2);if(!r)return s;let i=e.dom.getBoundingClientRect(),o=(r.top+r.bottom)/2,a=e.posAtCoords({x:i.left+1,y:o}),c=e.posAtCoords({x:i.right-1,y:o});return a==null||c==null?s:{from:Math.max(s.from,Math.min(a,c)),to:Math.min(s.to,Math.max(a,c))}}function DMe(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let s=Math.max(n.from,e.viewport.from),r=Math.min(n.to,e.viewport.to),i=e.textDirection==Rr.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),c=Wne(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=MA(e,s,1),g=MA(e,r,-1),b=p.type==Fo.Text?p:null,v=g.type==Fo.Text?g:null;if(b&&(e.lineWrapping||p.widgetLineBreaks)&&(b=Fz(e,s,1,b)),v&&(e.lineWrapping||g.widgetLineBreaks)&&(v=Fz(e,r,-1,v)),b&&v&&b.from==v.from&&b.to==v.to)return y(w(n.from,n.to,b));{let T=b?w(n.from,null,b):k(p,!1),_=v?w(null,n.to,v):k(g,!0),C=[];return(b||p).to<(v||g).from-(b&&v?1:0)||p.widgetLineBreaks>1&&T.bottom+e.defaultLineHeight/2<_.top?C.push(x(h,T.bottom,m,_.top)):T.bottom<_.top&&e.elementAtHeight((T.bottom+_.top)/2).type==Fo.Text&&(T.bottom=_.top=(T.bottom+_.top)/2),y(T).concat(C).concat(y(_))}function x(T,_,C,S){return new _p(t,T-c.left,_-c.top,Math.max(0,C-T),S-_)}function y({top:T,bottom:_,horizontal:C}){let S=[];for(let L=0;L<C.length;L+=2)S.push(x(C[L],T,C[L+1],_));return S}function w(T,_,C){let S=1e9,L=-1e9,N=[];function $(E,O,z,F,B){let W=e.coordsAtPos(E,E==C.to?-2:2),I=e.coordsAtPos(z,z==C.from?2:-2);!W||!I||(S=Math.min(W.top,I.top,S),L=Math.max(W.bottom,I.bottom,L),B==Rr.LTR?N.push(i&&O?h:W.left,i&&F?m:I.right):N.push(!i&&F?h:I.left,!i&&O?m:W.right))}let M=T??C.from,P=_??C.to;for(let E of e.visibleRanges)if(E.to>M&&E.from<P)for(let O=Math.max(E.from,M),z=Math.min(E.to,P);;){let F=e.state.doc.lineAt(O);for(let B of e.bidiSpans(F)){let W=B.from+F.from,I=B.to+F.from;if(W>=z)break;I>O&&$(Math.max(W,O),T==null&&W<=M,Math.min(I,z),_==null&&I>=P,B.dir)}if(O=F.to+1,O>=z)break}return N.length==0&&$(M,T==null,P,_==null,e.textDirection),{top:S,bottom:L,horizontal:N}}function k(T,_){let C=a.top+(_?T.top:T.bottom);return{top:C,bottom:C,horizontal:[]}}}function LMe(e,t){return e.constructor==t.constructor&&e.eq(t)}class PMe{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(e2)!=t.state.facet(e2)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}docViewUpdate(t){this.layer.updateOnDocViewUpdate!==!1&&t.requestMeasure(this.measureReq)}setOrder(t){let n=0,s=t.facet(e2);for(;n<s.length&&s[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:t,scaleY:n}=this.view;(t!=this.scaleX||n!=this.scaleY)&&(this.scaleX=t,this.scaleY=n,this.dom.style.transform=`scale(${1/t}, ${1/n})`)}draw(t){if(t.length!=this.drawn.length||t.some((n,s)=>!LMe(n,this.drawn[s]))){let n=this.dom.firstChild,s=0;for(let r of t)r.update&&n&&r.constructor&&this.drawn[s].constructor&&r.update(n,this.drawn[s])?(n=n.nextSibling,s++):this.dom.insertBefore(r.draw(),n);for(;n;){let r=n.nextSibling;n.remove(),n=r}this.drawn=t,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 e2=on.define();function Gne(e){return[ai.define(t=>new PMe(t,e)),e2.of(e)]}const k1=on.define({combine(e){return Yu(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function Kne(e={}){return[k1.of(e),OMe,BMe,$Me,xne.of(!0)]}function Yne(e){return e.startState.facet(k1)!=e.state.facet(k1)}const OMe=Gne({above:!0,markers(e){let{state:t}=e,n=t.facet(k1),s=[];for(let r of t.selection.ranges){let i=r==t.selection.main;if(r.empty||n.drawRangeCursor&&!(i&&rn.ios&&n.iosSelectionHandles)){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=r.empty?r:Ye.cursor(r.head,r.assoc);for(let c of _p.forRange(e,o,a))s.push(c)}}return s},update(e,t){e.transactions.some(s=>s.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=Yne(e);return n&&Hz(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){Hz(t.state,e)},class:"cm-cursorLayer"});function Hz(e,t){t.style.animationDuration=e.facet(k1).cursorBlinkRate+"ms"}const BMe=Gne({above:!1,markers(e){let t=[],{main:n,ranges:s}=e.state.selection;for(let r of s)if(!r.empty)for(let i of _p.forRange(e,"cm-selectionBackground",r))t.push(i);if(rn.ios&&!n.empty&&e.state.facet(k1).iosSelectionHandles){for(let r of _p.forRange(e,"cm-selectionHandle cm-selectionHandle-start",Ye.cursor(n.from,1)))t.push(r);for(let r of _p.forRange(e,"cm-selectionHandle cm-selectionHandle-end",Ye.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||Yne(e)},class:"cm-selectionLayer"}),$Me=gm.highest(Nt.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"}}}})),Xne=rs.define({map(e,t){return e==null?null:t.mapPos(e)}}),Cy=Ho.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((n,s)=>s.is(Xne)?s.value:n,e)}}),zMe=ai.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(Cy);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(Cy)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(Cy),n=t!=null&&e.coordsAtPos(t);if(!n)return null;let s=e.scrollDOM.getBoundingClientRect();return{left:n.left-s.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-s.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(Cy)!=e&&this.view.dispatch({effects:Xne.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 FMe(){return[Cy,zMe]}function qz(e,t,n,s,r){t.lastIndex=0;for(let i=e.iterRange(n,s),o=n,a;!i.next().done;o+=i.value.length)if(!i.lineBreak)for(;a=t.exec(i.value);)r(o+a.index,a)}function HMe(e,t){let n=e.visibleRanges;if(n.length==1&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let s=[];for(let{from:r,to:i}of n)r=Math.max(e.state.doc.lineAt(r).from,r-t),i=Math.min(e.state.doc.lineAt(i).to,i+t),s.length&&s[s.length-1].to>=r?s[s.length-1].to=i:s.push({from:r,to:i});return s}class qMe{constructor(t){const{regexp:n,decoration:s,decorate:r,boundary:i,maxLength:o=1e3}=t;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,r)this.addMatch=(a,c,u,d)=>r(d,u,u+a[0].length,a,c);else if(typeof s=="function")this.addMatch=(a,c,u,d)=>{let h=s(a,c,u);h&&d(u,u+a[0].length,h)};else if(s)this.addMatch=(a,c,u,d)=>d(u,u+a[0].length,s);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=o}createDeco(t){let n=new Ou,s=n.add.bind(n);for(let{from:r,to:i}of HMe(t,this.maxLength))qz(t.state.doc,this.regexp,r,i,(o,a)=>this.addMatch(a,t,o,s));return n.finish()}updateDeco(t,n){let s=1e9,r=-1;return t.docChanged&&t.changes.iterChanges((i,o,a,c)=>{c>=t.view.viewport.from&&a<=t.view.viewport.to&&(s=Math.min(a,s),r=Math.max(c,r))}),t.viewportMoved||r-s>1e3?this.createDeco(t.view):r>-1?this.updateRange(t.view,n.map(t.changes),s,r):n}updateRange(t,n,s,r){for(let i of t.visibleRanges){let o=Math.max(i.from,s),a=Math.min(i.to,r);if(a>=o){let c=t.state.doc.lineAt(o),u=c.to<a?t.state.doc.lineAt(a):c,d=Math.max(i.from,c.from),h=Math.min(i.to,u.to);if(this.boundary){for(;o>c.from;o--)if(this.boundary.test(c.text[o-1-c.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,v,x)=>m.push(x.range(b,v));if(c==u)for(this.regexp.lastIndex=d-c.from;(p=this.regexp.exec(c.text))&&p.index<h-c.from;)this.addMatch(p,t,p.index+c.from,g);else qz(t.state.doc,this.regexp,d,h,(b,v)=>this.addMatch(v,t,b,g));n=n.update({filterFrom:d,filterTo:h,filter:(b,v)=>b<d||v>h,add:m})}}return n}}const BA=/x/.unicode!=null?"gu":"g",UMe=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,BA),VMe={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 j6=null;function WMe(){var e;if(j6==null&&typeof document<"u"&&document.body){let t=document.body.style;j6=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return j6||!1}const t2=on.define({combine(e){let t=Yu(e,{render:null,specialChars:UMe,addSpecialChars:null});return(t.replaceTabs=!WMe())&&(t.specialChars=new RegExp("	|"+t.specialChars.source,BA)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,BA)),t}});function Qne(e={}){return[t2.of(e),GMe()]}let Uz=null;function GMe(){return Uz||(Uz=ai.fromClass(class{constructor(e){this.view=e,this.decorations=vn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(t2)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new qMe({regexp:e.specialChars,decoration:(t,n,s)=>{let{doc:r}=n.state,i=Ka(t[0],0);if(i==9){let o=r.lineAt(s),a=n.state.tabSize,c=nb(o.text,a,s-o.from);return vn.replace({widget:new QMe((a-c%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=vn.replace({widget:new XMe(e,i)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(t2);e.startState.facet(t2)!=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 KMe="•";function YMe(e){return e>=32?KMe:e==10?"␤":String.fromCharCode(9216+e)}class XMe extends Ol{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=YMe(this.code),s=t.state.phrase("Control character")+" "+(VMe[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,s,n);if(r)return r;let i=document.createElement("span");return i.textContent=n,i.title=s,i.setAttribute("aria-label",s),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class QMe extends Ol{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 JMe(){return eIe}const ZMe=vn.line({class:"cm-activeLine"}),eIe=ai.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 s of e.state.selection.ranges){let r=e.lineBlockAt(s.head);r.from>t&&(n.push(ZMe.range(r.from)),t=r.from)}return vn.set(n)}},{decorations:e=>e.decorations});class tIe extends Ol{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?ix(t.firstChild):[];if(!n.length)return null;let s=window.getComputedStyle(t.parentNode),r=Qx(n[0],s.direction!="rtl"),i=parseInt(s.lineHeight);return r.bottom-r.top>i*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+i}:r}ignoreEvent(){return!1}}function Vz(e){let t=ai.fromClass(class{constructor(n){this.view=n,this.placeholder=e?vn.set([vn.widget({widget:new tIe(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,Nt.contentAttributes.of({"aria-placeholder":e})]:t}const $A=2e3;function nIe(e,t,n){let s=Math.min(t.line,n.line),r=Math.max(t.line,n.line),i=[];if(t.off>$A||n.off>$A||t.col<0||n.col<0){let o=Math.min(t.off,n.off),a=Math.max(t.off,n.off);for(let c=s;c<=r;c++){let u=e.doc.line(c);u.length<=a&&i.push(Ye.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 c=s;c<=r;c++){let u=e.doc.line(c),d=yA(u.text,o,e.tabSize,!0);if(d<0)i.push(Ye.cursor(u.to));else{let h=yA(u.text,a,e.tabSize);i.push(Ye.range(u.from+d,u.from+h))}}}return i}function sIe(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function Wz(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),s=e.state.doc.lineAt(n),r=n-s.from,i=r>$A?-1:r==s.length?sIe(e,t.clientX):nb(s.text,e.state.tabSize,n-s.from);return{line:s.number,col:i,off:r}}function rIe(e,t){let n=Wz(e,t),s=e.state.selection;return n?{update(r){if(r.docChanged){let i=r.changes.mapPos(r.startState.doc.line(n.line).from),o=r.state.doc.lineAt(i);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},s=s.map(r.changes)}},get(r,i,o){let a=Wz(e,r);if(!a)return s;let c=nIe(e.state,n,a);return c.length?o?Ye.create(c.concat(s.ranges)):Ye.create(c):s}}:null}function iIe(e){let t=n=>n.altKey&&n.button==0;return Nt.mouseSelectionStyle.of((n,s)=>t(s)?rIe(n,s):null)}const oIe={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},aIe={style:"cursor: crosshair"};function lIe(e={}){let[t,n]=oIe[e.key||"Alt"],s=ai.fromClass(class{constructor(r){this.view=r,this.isDown=!1}set(r){this.isDown!=r&&(this.isDown=r,this.view.update([]))}},{eventObservers:{keydown(r){this.set(r.keyCode==t||n(r))},keyup(r){(r.keyCode==t||!n(r))&&this.set(!1)},mousemove(r){this.set(n(r))}}});return[s,Nt.contentAttributes.of(r=>{var i;return!((i=r.plugin(s))===null||i===void 0)&&i.isDown?aIe:null})]}const Uk="-10000px";class Jne{constructor(t,n,s,r){this.facet=n,this.createTooltipView=s,this.removeTooltipView=r,this.input=t.state.facet(n),this.tooltips=this.input.filter(o=>o);let i=null;this.tooltipViews=this.tooltips.map(o=>i=s(o,i))}update(t,n){var s;let r=t.state.facet(this.facet),i=r.filter(c=>c);if(r===this.input){for(let c of this.tooltipViews)c.update&&c.update(t);return!1}let o=[],a=n?[]:null;for(let c=0;c<i.length;c++){let u=i[c],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[c]=this.createTooltipView(u,c?o[c-1]:null),a&&(a[c]=!!u.above);else{let h=o[c]=this.tooltipViews[d];a&&(a[c]=n[d]),h.update&&h.update(t)}}}for(let c of this.tooltipViews)o.indexOf(c)<0&&(this.removeTooltipView(c),(s=c.destroy)===null||s===void 0||s.call(c));return n&&(a.forEach((c,u)=>n[u]=c),n.length=a.length),this.input=r,this.tooltips=i,this.tooltipViews=o,!0}}function cIe(e={}){return n2.of(e)}function uIe(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const n2=on.define({combine:e=>{var t,n,s;return{position:rn.ios?"absolute":((t=e.find(r=>r.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((n=e.find(r=>r.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((s=e.find(r=>r.tooltipSpace))===null||s===void 0?void 0:s.tooltipSpace)||uIe}}}),Gz=new WeakMap,oI=ai.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(n2);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 Jne(e,aI,(n,s)=>this.createTooltip(n,s),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,s=e.state.facet(n2);if(s.position!=this.position&&!this.madeAbsolute){this.position=s.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;n=!0}if(s.parent!=this.parent){this.parent&&this.container.remove(),this.parent=s.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),s=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",n.dom.appendChild(r)}return n.dom.style.position=this.position,n.dom.style.top=Uk,n.dom.style.left="0px",this.container.insertBefore(n.dom,s),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let s of this.manager.tooltipViews)s.dom.remove(),(e=s.destroy)===null||e===void 0||e.call(s);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(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 s=this.view.scrollDOM.getBoundingClientRect(),r=nI(this.view);return{visible:{left:s.left+r.left,top:s.top+r.top,right:s.right-r.right,bottom:s.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(n2).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:n,space:s,scaleX:r,scaleY:i}=e,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let c=this.manager.tooltips[a],u=this.manager.tooltipViews[a],{dom:d}=u,h=e.pos[a],m=e.size[a];if(!h||c.clip!==!1&&(h.bottom<=Math.max(n.top,s.top)||h.top>=Math.min(n.bottom,s.bottom)||h.right<Math.max(n.left,s.left)-.1||h.left>Math.min(n.right,s.right)+.1)){d.style.top=Uk;continue}let p=c.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,g=p?7:0,b=m.right-m.left,v=(t=Gz.get(u))!==null&&t!==void 0?t:m.bottom-m.top,x=u.offset||hIe,y=this.view.textDirection==Rr.LTR,w=m.width>s.right-s.left?y?s.left:s.right-m.width:y?Math.max(s.left,Math.min(h.left-(p?14:0)+x.x,s.right-b)):Math.min(Math.max(s.left,h.left-b+(p?14:0)-x.x),s.right-b),k=this.above[a];!c.strictSide&&(k?h.top-v-g-x.y<s.top:h.bottom+v+g+x.y>s.bottom)&&k==s.bottom-h.bottom>h.top-s.top&&(k=this.above[a]=!k);let T=(k?h.top-s.top:s.bottom-h.bottom)-g;if(T<v&&u.resize!==!1){if(T<this.view.defaultLineHeight){d.style.top=Uk;continue}Gz.set(u,v),d.style.height=(v=T)/i+"px"}else d.style.height&&(d.style.height="");let _=k?h.top-v-g-x.y:h.bottom+g+x.y,C=w+b;if(u.overlap!==!0)for(let S of o)S.left<C&&S.right>w&&S.top<_+v&&S.bottom>_&&(_=k?S.top-v-2-g:S.bottom+g+2);if(this.position=="absolute"?(d.style.top=(_-e.parent.top)/i+"px",Kz(d,(w-e.parent.left)/r)):(d.style.top=_/i+"px",Kz(d,w/r)),p){let S=h.left+(y?x.x:-x.x)-(w+14-7);p.style.left=S/r+"px"}u.overlap!==!0&&o.push({left:w,top:_,right:C,bottom:_+v}),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=Uk}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Kz(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const dIe=Nt.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"}}}),hIe={x:0,y:0},aI=on.define({enables:[oI,dIe]}),KS=on.define({combine:e=>e.reduce((t,n)=>t.concat(n),[])});class rC{static create(t){return new rC(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Jne(t,KS,(n,s)=>this.createHostedView(n,s),n=>n.dom.remove())}createHostedView(t,n){let s=t.create(this.view);return s.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(s.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&s.mount&&s.mount(this.view),s}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 s of this.manager.tooltipViews){let r=s[t];if(r!==void 0){if(n===void 0)n=r;else if(n!==r)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 fIe=aI.compute([KS],e=>{let t=e.facet(KS);return t.length===0?null:{pos:Math.min(...t.map(n=>n.pos)),end:Math.max(...t.map(n=>{var s;return(s=n.end)!==null&&s!==void 0?s:n.pos})),create:rC.create,above:t[0].above,arrow:t.some(n=>n.arrow)}}),Zne=on.define();class mIe{constructor(t,n,s,r,i,o){this.view=t,this.source=n,this.field=s,this.locked=r,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,s=t.docView.tile.nearest(n.target);if(!s)return;let r,i=1;if(s.isWidget())r=s.posAtStart;else{if(r=t.posAtCoords(n),r==null)return;let o=t.coordsAtPos(r);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(r)).find(u=>u.from<=r&&u.to>=r),c=a&&a.dir==Rr.RTL?-1:1;i=n.x<o.left?-c:c}this.activateHover(t,r,i)}activateHover(t,n,s,r){let i=this.source(t,n,s),o=a=>{if(a&&!(Array.isArray(a)&&!a.length)){let c=Array.isArray(a)?a:[a];r&&this.locked.set(c,r),t.dispatch({effects:this.setHover.of(c)})}};if(i&&"then"in i){let a=this.pending={pos:n};i.then(c=>{this.pending==a&&(this.pending=null,o(c))},c=>Qa(t.state,c,"hover tooltip"))}else o(i)}get tooltip(){let t=this.view.plugin(oI),n=t?t.manager.tooltips.findIndex(s=>s.create==rC.create):-1;return n>-1?t.manager.tooltipViews[n]:null}mousemove(t){var n,s;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:r,tooltip:i}=this;if(r.length&&!this.locked.has(r)&&i&&!pIe(i.dom,t)||this.pending){let{pos:o}=r[0]||this.pending,a=(s=(n=r[0])===null||n===void 0?void 0:n.end)!==null&&s!==void 0?s:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!gIe(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:s}=this;s&&s.dom.contains(t.relatedTarget)?this.watchTooltipLeave(s.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let n=s=>{t.removeEventListener("mouseleave",n);let{active:r}=this;r.length&&!this.locked.has(r)&&!this.view.dom.contains(s.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 Vk=4;function pIe(e,t){let{left:n,right:s,top:r,bottom:i}=e.getBoundingClientRect(),o;if(o=e.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();r=Math.min(a.top,r),i=Math.max(a.bottom,i)}return t.clientX>=n-Vk&&t.clientX<=s+Vk&&t.clientY>=r-Vk&&t.clientY<=i+Vk}function gIe(e,t,n,s,r,i){let o=e.scrollDOM.getBoundingClientRect(),a=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>s||o.right<s||o.top>r||Math.min(o.bottom,a)<r)return!1;let c=e.posAtCoords({x:s,y:r},!1);return c>=t&&c<=n}function bIe(e,t={}){let n=rs.define(),s=new WeakMap,r=Ho.define({create(){return[]},update(o,a){let c=s.get(o);if(o.length&&(t.hideOnChange&&(a.docChanged||a.selection)?o=[]:c&&c(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,Ta.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,c=void 0),(u.is(xIe)&&!u.value||u.value==r)&&(o=[]);return o.length&&c&&s.set(o,c),o},provide:o=>KS.from(o)});const i=ai.define(o=>new mIe(o,e,r,s,n,t.hoverTime||300));return{active:r,extension:[r,i,Zne.of(i),fIe]}}function yIe(e,t,n,s={}){var r;let i=e.state.facet(Zne).map(o=>e.plugin(o)).filter(o=>!!o);if(s.tooltip&&s.tooltip.active){let o=i.find(a=>a.field==s.tooltip.active);o&&(i=[o])}for(let o of i)o.activateHover(e,t,n,(r=s.until)!==null&&r!==void 0?r:()=>!1)}function ese(e,t){let n=e.plugin(oI);if(!n)return null;let s=n.manager.tooltips.indexOf(t);return s<0?null:n.manager.tooltipViews[s]}const xIe=rs.define(),Yz=on.define({combine(e){let t,n;for(let s of e)t=t||s.topContainer,n=n||s.bottomContainer;return{topContainer:t,bottomContainer:n}}});function lI(e,t){let n=e.plugin(tse),s=n?n.specs.indexOf(t):-1;return s>-1?n.panels[s]:null}const tse=ai.fromClass(class{constructor(e){this.input=e.state.facet(Zx),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(e));let t=e.state.facet(Yz);this.top=new Wk(e,!0,t.topContainer),this.bottom=new Wk(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(Yz);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Wk(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Wk(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Zx);if(n!=this.input){let s=n.filter(c=>c),r=[],i=[],o=[],a=[];for(let c of s){let u=this.specs.indexOf(c),d;u<0?(d=c(e.view),a.push(d)):(d=this.panels[u],d.update&&d.update(e)),r.push(d),(d.top?i:o).push(d)}this.specs=s,this.panels=r,this.top.sync(i),this.bottom.sync(o);for(let c of a)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let s of this.panels)s.update&&s.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>Nt.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Wk{constructor(t,n,s){this.view=t,this.top=n,this.container=s,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=Xz(t);t=t.nextSibling}else this.dom.insertBefore(n.dom,t);for(;t;)t=Xz(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 Xz(e){let t=e.nextSibling;return e.remove(),t}const Zx=on.define({enables:tse});function vIe(e,t){let n,s=new Promise(o=>n=o),r=o=>wIe(o,t,n);e.state.field(M6,!1)?e.dispatch({effects:nse.of(r)}):e.dispatch({effects:rs.appendConfig.of(M6.init(()=>[r]))});let i=sse.of(r);return{close:i,result:s.then(o=>((e.win.queueMicrotask||(c=>e.win.setTimeout(c,10)))(()=>{e.state.field(M6).indexOf(r)>-1&&e.dispatch({effects:i})}),o))}}const M6=Ho.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(nse)?e=[n.value].concat(e):n.is(sse)&&(e=e.filter(s=>s!=n.value));return e},provide:e=>Zx.computeN([e],t=>t.field(e))}),nse=rs.define(),sse=rs.define();function wIe(e,t,n){let s=t.content?t.content(e,()=>o(null)):null;if(!s){if(s=Cr("form"),t.input){let a=Cr("input",t.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),s.appendChild(Cr("label",(t.label||"")+": ",a))}else s.appendChild(document.createTextNode(t.label||""));s.appendChild(document.createTextNode(" ")),s.appendChild(Cr("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let r=s.nodeName=="FORM"?[s]:s.querySelectorAll("form");for(let a=0;a<r.length;a++){let c=r[a];c.addEventListener("keydown",u=>{u.keyCode==27?(u.preventDefault(),o(null)):u.keyCode==13&&(u.preventDefault(),o(c))}),c.addEventListener("submit",u=>{u.preventDefault(),o(c)})}let i=Cr("div",s,Cr("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=s.querySelector(t.focus):a=s.querySelector("input")||s.querySelector("button"),a&&"select"in a?a.select():a&&"focus"in a&&a.focus()}}}}class sh extends Wf{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}sh.prototype.elementClass="";sh.prototype.toDOM=void 0;sh.prototype.mapMode=Ta.TrackBefore;sh.prototype.startSide=sh.prototype.endSide=-1;sh.prototype.point=!0;const s2=on.define(),kIe=on.define(),_Ie={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Rs.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},lx=on.define();function SIe(e){return[rse(),lx.of({..._Ie,...e})]}const Qz=on.define({combine:e=>e.some(t=>t)});function rse(e){return[CIe]}const CIe=ai.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(lx).map(t=>new Zz(e,t)),this.fixed=!e.state.facet(Qz);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,s=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(s<(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(Qz)!=!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=Rs.iter(this.view.state.facet(s2),this.view.viewport.from),s=[],r=this.gutters.map(i=>new TIe(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(s.length&&(s=[]),Array.isArray(i.type)){let o=!0;for(let a of i.type)if(a.type==Fo.Text&&o){zA(n,s,a.from);for(let c of r)c.line(this.view,a,s);o=!1}else if(a.widget)for(let c of r)c.widget(this.view,a)}else if(i.type==Fo.Text){zA(n,s,i.from);for(let o of r)o.line(this.view,i,s)}else if(i.widget)for(let o of r)o.widget(this.view,i);for(let i of r)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(lx),n=e.state.facet(lx),s=e.docChanged||e.heightChanged||e.viewportChanged||!Rs.eq(e.startState.facet(s2),e.state.facet(s2),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let r of this.gutters)r.update(e)&&(s=!0);else{s=!0;let r=[];for(let i of n){let o=t.indexOf(i);o<0?r.push(new Zz(this.view,i)):(this.gutters[o].update(e),r.push(this.gutters[o]))}for(let i of this.gutters)i.dom.remove(),r.indexOf(i)<0&&i.destroy();for(let i of r)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=r}return s}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>Nt.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||n.gutters.length==0||!n.fixed)return null;let s=n.dom.offsetWidth*t.scaleX,r=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==Rr.LTR?{left:s,right:r}:{right:s,left:r}})});function Jz(e){return Array.isArray(e)?e:[e]}function zA(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class TIe{constructor(t,n,s){this.gutter=t,this.height=s,this.i=0,this.cursor=Rs.iter(t.markers,n.from)}addElement(t,n,s){let{gutter:r}=this,i=(n.top-this.height)/t.scaleY,o=n.height/t.scaleY;if(this.i==r.elements.length){let a=new ise(t,o,i,s);r.elements.push(a),r.dom.appendChild(a.dom)}else r.elements[this.i].update(t,o,i,s);this.height=n.bottom,this.i++}line(t,n,s){let r=[];zA(this.cursor,r,n.from),s.length&&(r=r.concat(s));let i=this.gutter.config.lineMarker(t,n,r);i&&r.unshift(i);let o=this.gutter;r.length==0&&!o.config.renderEmptyElements||this.addElement(t,n,r)}widget(t,n){let s=this.gutter.config.widgetMarker(t,n.widget,n),r=s?[s]:null;for(let i of t.state.facet(kIe)){let o=i(t,n.widget,n);o&&(r||(r=[])).push(o)}r&&this.addElement(t,n,r)}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let n=t.elements.pop();t.dom.removeChild(n.dom),n.destroy()}}}class Zz{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 s in n.domEventHandlers)this.dom.addEventListener(s,r=>{let i=r.target,o;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let c=i.getBoundingClientRect();o=(c.top+c.bottom)/2}else o=r.clientY;let a=t.lineBlockAtHeight(o-t.documentTop);n.domEventHandlers[s](t,a,r)&&r.preventDefault()});this.markers=Jz(n.markers(t)),n.initialSpacer&&(this.spacer=new ise(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=Jz(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],t);r!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[r])}let s=t.view.viewport;return!Rs.eq(this.markers,n,s.from,s.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}}class ise{constructor(t,n,s,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,n,s,r)}update(t,n,s,r){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=s&&(this.dom.style.marginTop=(this.above=s)?s+"px":""),EIe(this.markers,r)||this.setMarkers(t,r)}setMarkers(t,n){let s="cm-gutterElement",r=this.dom.firstChild;for(let i=0,o=0;;){let a=o,c=i<n.length?n[i++]:null,u=!1;if(c){let d=c.elementClass;d&&(s+=" "+d);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(c)){a=h,u=!0;break}}else a=this.markers.length;for(;o<a;){let d=this.markers[o++];if(d.toDOM){d.destroy(r);let h=r.nextSibling;r.remove(),r=h}}if(!c)break;c.toDOM&&(u?r=r.nextSibling:this.dom.insertBefore(c.toDOM(t),r)),u&&o++}this.dom.className=s,this.markers=n}destroy(){this.setMarkers(null,[])}}function EIe(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 AIe=on.define(),NIe=on.define(),pg=on.define({combine(e){return Yu(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,n){let s=Object.assign({},t);for(let r in n){let i=s[r],o=n[r];s[r]=i?(a,c,u)=>i(a,c,u)||o(a,c,u):o}return s}})}});class I6 extends sh{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function R6(e,t){return e.state.facet(pg).formatNumber(t,e.state)}const jIe=lx.compute([pg],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(AIe)},lineMarker(t,n,s){return s.some(r=>r.toDOM)?null:new I6(R6(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,s)=>{for(let r of t.state.facet(NIe)){let i=r(t,n,s);if(i)return i}return null},lineMarkerChange:t=>t.startState.facet(pg)!=t.state.facet(pg),initialSpacer(t){return new I6(R6(t,eF(t.state.doc.lines)))},updateSpacer(t,n){let s=R6(n.view,eF(n.view.state.doc.lines));return s==t.number?t:new I6(s)},domEventHandlers:e.facet(pg).domEventHandlers,side:"before"}));function MIe(e={}){return[pg.of(e),rse(),jIe]}function eF(e){let t=9;for(;t<e;)t=t*10+9;return t}const IIe=new class extends sh{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},RIe=s2.compute(["selection"],e=>{let t=[],n=-1;for(let s of e.selection.ranges){let r=e.doc.lineAt(s.head).from;r>n&&(n=r,t.push(IIe.range(r)))}return Rs.of(t)});function DIe(){return RIe}const LIe=1024;let PIe=0;class D6{constructor(t,n){this.from=t,this.to=n}}class Xs{constructor(t={}){this.id=PIe++,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=wc.match(t)),n=>{let s=t(n);return s===void 0?null:[this,s]}}}Xs.closedBy=new Xs({deserialize:e=>e.split(" ")});Xs.openedBy=new Xs({deserialize:e=>e.split(" ")});Xs.group=new Xs({deserialize:e=>e.split(" ")});Xs.isolate=new Xs({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});Xs.contextHash=new Xs({perNode:!0});Xs.lookAhead=new Xs({perNode:!0});Xs.mounted=new Xs({perNode:!0});class cx{constructor(t,n,s,r=!1){this.tree=t,this.overlay=n,this.parser=s,this.bracketed=r}static get(t){return t&&t.props&&t.props[Xs.mounted.id]}}const OIe=Object.create(null);class wc{constructor(t,n,s,r=0){this.name=t,this.props=n,this.id=s,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):OIe,s=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),r=new wc(t.name||"",n,t.id,s);if(t.props){for(let i of t.props)if(Array.isArray(i)||(i=i(r)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return r}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let n=this.prop(Xs.group);return n?n.indexOf(t)>-1:!1}return this.id==t}static match(t){let n=Object.create(null);for(let s in t)for(let r of s.split(" "))n[r]=t[s];return s=>{for(let r=s.prop(Xs.group),i=-1;i<(r?r.length:0);i++){let o=n[i<0?s.name:r[i]];if(o)return o}}}}wc.none=new wc("",Object.create(null),0,8);const Gk=new WeakMap,tF=new WeakMap;var Ni;(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"})(Ni||(Ni={}));class Bo{constructor(t,n,s,r,i){if(this.type=t,this.children=n,this.positions=s,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[o,a]of i)this.props[typeof o=="number"?o:o.id]=a}}toString(){let t=cx.get(this);if(t&&!t.overlay)return t.tree.toString();let n="";for(let s of this.children){let r=s.toString();r&&(n&&(n+=","),n+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(t=0){return new HA(this.topNode,t)}cursorAt(t,n=0,s=0){let r=Gk.get(this)||this.topNode,i=new HA(r);return i.moveTo(t,n),Gk.set(this,i._tree),i}get topNode(){return new Qf(this,0,0,null)}resolve(t,n=0){let s=ev(Gk.get(this)||this.topNode,t,n,!1);return Gk.set(this,s),s}resolveInner(t,n=0){let s=ev(tF.get(this)||this.topNode,t,n,!0);return tF.set(this,s),s}resolveStack(t,n=0){return zIe(this,t,n)}iterate(t){let{enter:n,leave:s,from:r=0,to:i=this.length}=t,o=t.mode||0,a=(o&Ni.IncludeAnonymous)>0;for(let c=this.cursor(o|Ni.IncludeAnonymous);;){let u=!1;if(c.from<=i&&c.to>=r&&(!a&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;u=!0}for(;u&&s&&(a||!c.type.isAnonymous)&&s(c),!c.nextSibling();){if(!c.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:dI(wc.none,this.children,this.positions,0,this.children.length,0,this.length,(n,s,r)=>new Bo(this.type,n,s,r,this.propValues),t.makeTree||((n,s,r)=>new Bo(wc.none,n,s,r)))}static build(t){return FIe(t)}}Bo.empty=new Bo(wc.none,[],[],0);class cI{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 cI(this.buffer,this.index)}}class Xf{constructor(t,n,s){this.buffer=t,this.length=n,this.set=s}get type(){return wc.none}toString(){let t=[];for(let n=0;n<this.buffer.length;)t.push(this.childString(n)),n=this.buffer[n+3];return t.join(",")}childString(t){let n=this.buffer[t],s=this.buffer[t+3],r=this.set.types[n],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),t+=4,s==t)return i;let o=[];for(;t<s;)o.push(this.childString(t)),t=this.buffer[t+3];return i+"("+o.join(",")+")"}findChild(t,n,s,r,i){let{buffer:o}=this,a=-1;for(let c=t;c!=n&&!(ose(i,r,o[c+1],o[c+2])&&(a=c,s>0));c=o[c+3]);return a}slice(t,n,s){let r=this.buffer,i=new Uint16Array(n-t),o=0;for(let a=t,c=0;a<n;){i[c++]=r[a++],i[c++]=r[a++]-s;let u=i[c++]=r[a++]-s;i[c++]=r[a++]-t,o=Math.max(o,u)}return new Xf(i,o,this.set)}}function ose(e,t,n,s){switch(e){case-2:return n<t;case-1:return s>=t&&n<t;case 0:return n<t&&s>t;case 1:return n<=t&&s>t;case 2:return s>t;case 4:return!0}}function ev(e,t,n,s){for(var r;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let o=!s&&e instanceof Qf&&e.index<0?null:e.parent;if(!o)return e;e=o}let i=s?0:Ni.IgnoreOverlays;if(s)for(let o=e,a=o.parent;a;o=a,a=o.parent)o instanceof Qf&&o.index<0&&((r=a.enter(t,n,i))===null||r===void 0?void 0:r.from)!=o.from&&(e=a);for(;;){let o=e.enter(t,n,i);if(!o)return e;e=o}}class ase{cursor(t=0){return new HA(this,t)}getChild(t,n=null,s=null){let r=nF(this,t,n,s);return r.length?r[0]:null}getChildren(t,n=null,s=null){return nF(this,t,n,s)}resolve(t,n=0){return ev(this,t,n,!1)}resolveInner(t,n=0){return ev(this,t,n,!0)}matchContext(t){return FA(this.parent,t)}enterUnfinishedNodesBefore(t){let n=this.childBefore(t),s=this;for(;n;){let r=n.lastChild;if(!r||r.to!=n.to)break;r.type.isError&&r.from==r.to?(s=n,n=r.prevSibling):n=r}return s}get node(){return this}get next(){return this.parent}}let Qf=class r2 extends ase{constructor(t,n,s,r){super(),this._tree=t,this.from=n,this.index=s,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,s,r,i=0){for(let o=this;;){for(let{children:a,positions:c}=o._tree,u=n>0?a.length:-1;t!=u;t+=n){let d=a[t],h=c[t]+o.from,m;if(!(!(i&Ni.EnterBracketed&&d instanceof Bo&&(m=cx.get(d))&&!m.overlay&&m.bracketed&&s>=h&&s<=h+d.length)&&!ose(r,s,h,h+d.length))){if(d instanceof Xf){if(i&Ni.ExcludeBuffers)continue;let p=d.findChild(0,d.buffer.length,n,s-h,r);if(p>-1)return new af(new BIe(o,d,t,h),null,p)}else if(i&Ni.IncludeAnonymous||!d.type.isAnonymous||uI(d)){let p;if(!(i&Ni.IgnoreMounts)&&(p=cx.get(d))&&!p.overlay)return new r2(p.tree,h,t,o);let g=new r2(d,h,t,o);return i&Ni.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?d.children.length-1:0,n,s,r,i)}}}if(i&Ni.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+n:t=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,n,s=0){let r;if(!(s&Ni.IgnoreOverlays)&&(r=cx.get(this._tree))&&r.overlay){let i=t-this.from,o=s&Ni.EnterBracketed&&r.bracketed;for(let{from:a,to:c}of r.overlay)if((n>0||o?a<=i:a<i)&&(n<0||o?c>=i:c>i))return new r2(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,s)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function nF(e,t,n,s){let r=e.cursor(),i=[];if(!r.firstChild())return i;if(n!=null){for(let o=!1;!o;)if(o=r.type.is(n),!r.nextSibling())return i}for(;;){if(s!=null&&r.type.is(s))return i;if(r.type.is(t)&&i.push(r.node),!r.nextSibling())return s==null?i:[]}}function FA(e,t,n=t.length-1){for(let s=e;n>=0;s=s.parent){if(!s)return!1;if(!s.type.isAnonymous){if(t[n]&&t[n]!=s.name)return!1;n--}}return!0}class BIe{constructor(t,n,s,r){this.parent=t,this.buffer=n,this.index=s,this.start=r}}class af extends ase{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,n,s){super(),this.context=t,this._parent=n,this.index=s,this.type=t.buffer.set.types[t.buffer.buffer[s]]}child(t,n,s){let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],t,n-this.context.start,s);return i<0?null:new af(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,n,s=0){if(s&Ni.ExcludeBuffers)return null;let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return i<0?null:new af(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 af(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 af(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],n=[],{buffer:s}=this.context,r=this.index+4,i=s.buffer[this.index+3];if(i>r){let o=s.buffer[this.index+1];t.push(s.slice(r,i,o)),n.push(0)}return new Bo(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function lse(e){if(!e.length)return null;let t=0,n=e[0];for(let i=1;i<e.length;i++){let o=e[i];(o.from>n.from||o.to<n.to)&&(n=o,t=i)}let s=n instanceof Qf&&n.index<0?null:n.parent,r=e.slice();return s?r[t]=s:r.splice(t,1),new $Ie(r,n)}class $Ie{constructor(t,n){this.heads=t,this.node=n}get next(){return lse(this.heads)}}function zIe(e,t,n){let s=e.resolveInner(t,n),r=null;for(let i=s instanceof Qf?s:s.context.parent;i;i=i.parent)if(i.index<0){let o=i.parent;(r||(r=[s])).push(o.resolve(t,n)),i=o}else{let o=cx.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new Qf(o.tree,o.overlay[0].from+i.from,-1,i);(r||(r=[s])).push(ev(a,t,n,!1))}}return r?lse(r):s}class HA{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&~Ni.EnterBracketed,t instanceof Qf)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let s=t._parent;s;s=s._parent)this.stack.unshift(s.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,n){this.index=t;let{start:s,buffer:r}=this.buffer;return this.type=n||r.set.types[r.buffer[t]],this.from=s+r.buffer[t+1],this.to=s+r.buffer[t+2],!0}yield(t){return t?t instanceof Qf?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,n,s){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,n,s,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],t,n-this.buffer.start,s);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,n,s=this.mode){return this.buffer?s&Ni.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,s))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ni.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Ni.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:n}=this.buffer,s=this.stack.length-1;if(t<0){let r=s<0?0:this.stack[s]+4;if(this.index!=r)return this.yieldBuf(n.findChild(r,this.index,-1,0,4))}else{let r=n.buffer[this.index+3];if(r<(s<0?n.buffer.length:n.buffer[this.stack[s]+3]))return this.yieldBuf(r)}return s<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let n,s,{buffer:r}=this;if(r){if(t>0){if(this.index<r.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(r.buffer.buffer[i+3]<this.index)return!1;({index:n,parent:s}=r)}else({index:n,_parent:s}=this._tree);for(;s;{index:n,_parent:s}=s)if(n>-1)for(let i=n+t,o=t<0?-1:s._tree.children.length;i!=o;i+=t){let a=s._tree.children[i];if(this.mode&Ni.IncludeAnonymous||a instanceof Xf||!a.type.isAnonymous||uI(a))return!1}return!0}move(t,n){if(n&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,n=0){for(;(this.from==this.to||(n<1?this.from>=t:this.from>t)||(n>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,n););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,n=null,s=0;if(t&&t.context==this.buffer)e:for(let r=this.index,i=this.stack.length;i>=0;){for(let o=t;o;o=o._parent)if(o.index==r){if(r==this.index)return o;n=o,s=i+1;break e}r=this.stack[--i]}for(let r=s;r<this.stack.length;r++)n=new af(this.buffer,n,this.stack[r]);return this.bufferNode=new af(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,n){for(let s=0;;){let r=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){s++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&n&&n(this),r=this.type.isAnonymous,!s)return;if(this.nextSibling())break;this.parent(),s--,r=!0}}}matchContext(t){if(!this.buffer)return FA(this.node.parent,t);let{buffer:n}=this.buffer,{types:s}=n.set;for(let r=t.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return FA(this._tree,t,r);let o=s[n.buffer[this.stack[i]]];if(!o.isAnonymous){if(t[r]&&t[r]!=o.name)return!1;r--}}return!0}}function uI(e){return e.children.some(t=>t instanceof Xf||!t.type.isAnonymous||uI(t))}function FIe(e){var t;let{buffer:n,nodeSet:s,maxBufferLength:r=LIe,reused:i=[],minRepeatType:o=s.types.length}=e,a=Array.isArray(n)?new cI(n,n.length):n,c=s.types,u=0,d=0;function h(T,_,C,S,L,N){let{id:$,start:M,end:P,size:E}=a,O=d,z=u;if(E<0)if(a.next(),E==-1){let Y=i[$];C.push(Y),S.push(M-T);return}else if(E==-3){u=$;return}else if(E==-4){d=$;return}else throw new RangeError(`Unrecognized record size: ${E}`);let F=c[$],B,W,I=M-T;if(P-M<=r&&(W=v(a.pos-_,L))){let Y=new Uint16Array(W.size-W.skip),V=a.pos-W.size,j=Y.length;for(;a.pos>V;)j=x(W.start,Y,j);B=new Xf(Y,P-W.start,s),I=W.start-T}else{let Y=a.pos-E;a.next();let V=[],j=[],ee=$>=o?$:-1,se=0,X=P;for(;a.pos>Y;)ee>=0&&a.id==ee&&a.size>=0?(a.end<=X-r&&(g(V,j,M,se,a.end,X,ee,O,z),se=V.length,X=a.end),a.next()):N>2500?m(M,Y,V,j):h(M,Y,V,j,ee,N+1);if(ee>=0&&se>0&&se<V.length&&g(V,j,M,se,M,X,ee,O,z),V.reverse(),j.reverse(),ee>-1&&se>0){let Q=p(F,z);B=dI(F,V,j,0,V.length,0,P-M,Q,Q)}else B=b(F,V,j,P-M,O-P,z)}C.push(B),S.push(I)}function m(T,_,C,S){let L=[],N=0,$=-1;for(;a.pos>_;){let{id:M,start:P,end:E,size:O}=a;if(O>4)a.next();else{if($>-1&&P<$)break;$<0&&($=E-r),L.push(M,P,E),N++,a.next()}}if(N){let M=new Uint16Array(N*4),P=L[L.length-2];for(let E=L.length-3,O=0;E>=0;E-=3)M[O++]=L[E],M[O++]=L[E+1]-P,M[O++]=L[E+2]-P,M[O++]=O;C.push(new Xf(M,L[2]-P,s)),S.push(P-T)}}function p(T,_){return(C,S,L)=>{let N=0,$=C.length-1,M,P;if($>=0&&(M=C[$])instanceof Bo){if(!$&&M.type==T&&M.length==L)return M;(P=M.prop(Xs.lookAhead))&&(N=S[$]+M.length+P)}return b(T,C,S,L,N,_)}}function g(T,_,C,S,L,N,$,M,P){let E=[],O=[];for(;T.length>S;)E.push(T.pop()),O.push(_.pop()+C-L);T.push(b(s.types[$],E,O,N-L,M-N,P)),_.push(L-C)}function b(T,_,C,S,L,N,$){if(N){let M=[Xs.contextHash,N];$=$?[M].concat($):[M]}if(L>25){let M=[Xs.lookAhead,L];$=$?[M].concat($):[M]}return new Bo(T,_,C,S,$)}function v(T,_){let C=a.fork(),S=0,L=0,N=0,$=C.end-r,M={size:0,start:0,skip:0};e:for(let P=C.pos-T;C.pos>P;){let E=C.size;if(C.id==_&&E>=0){M.size=S,M.start=L,M.skip=N,N+=4,S+=4,C.next();continue}let O=C.pos-E;if(E<0||O<P||C.start<$)break;let z=C.id>=o?4:0,F=C.start;for(C.next();C.pos>O;){if(C.size<0)if(C.size==-3||C.size==-4)z+=4;else break e;else C.id>=o&&(z+=4);C.next()}L=F,S+=E,N+=z}return(_<0||S==T)&&(M.size=S,M.start=L,M.skip=N),M.size>4?M:void 0}function x(T,_,C){let{id:S,start:L,end:N,size:$}=a;if(a.next(),$>=0&&S<o){let M=C;if($>4){let P=a.pos-($-4);for(;a.pos>P;)C=x(T,_,C)}_[--C]=M,_[--C]=N-T,_[--C]=L-T,_[--C]=S}else $==-3?u=S:$==-4&&(d=S);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 Bo(c[e.topID],y.reverse(),w.reverse(),k)}const sF=new WeakMap;function i2(e,t){if(!e.isAnonymous||t instanceof Xf||t.type!=e)return 1;let n=sF.get(t);if(n==null){n=1;for(let s of t.children){if(s.type!=e||!(s instanceof Bo)){n=1;break}n+=i2(e,s)}sF.set(t,n)}return n}function dI(e,t,n,s,r,i,o,a,c){let u=0;for(let g=s;g<r;g++)u+=i2(e,t[g]);let d=Math.ceil(u*1.5/8),h=[],m=[];function p(g,b,v,x,y){for(let w=v;w<x;){let k=w,T=b[w],_=i2(e,g[w]);for(w++;w<x;w++){let C=i2(e,g[w]);if(_+C>=d)break;_+=C}if(w==k+1){if(_>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(dI(e,g,b,k,w,T,C,null,c))}m.push(T+y-i)}}return p(t,n,s,r,0),(a||c)(h,m,o)}class Sp{constructor(t,n,s,r,i=!1,o=!1){this.from=t,this.to=n,this.tree=s,this.offset=r,this.open=(i?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],s=!1){let r=[new Sp(0,t.length,t,0,!1,s)];for(let i of n)i.to>t.length&&r.push(i);return r}static applyChanges(t,n,s=128){if(!n.length)return t;let r=[],i=1,o=t.length?t[0]:null;for(let a=0,c=0,u=0;;a++){let d=a<n.length?n[a]:null,h=d?d.fromA:1e9;if(h-c>=s)for(;o&&o.from<h;){let m=o;if(c>=m.from||h<=m.to||u){let p=Math.max(m.from,c)-u,g=Math.min(m.to,h)-u;m=p>=g?null:new Sp(p,g,m.tree,m.offset+u,a>0,!!d)}if(m&&r.push(m),o.to>h)break;o=i<t.length?t[i++]:null}if(!d)break;c=d.toA,u=d.toA-d.toB}return r}}class HIe{startParse(t,n,s){return typeof t=="string"&&(t=new qIe(t)),s=s?s.length?s.map(r=>new D6(r.from,r.to)):[new D6(0,0)]:[new D6(0,t.length)],this.createParse(t,n||[],s)}parse(t,n,s){let r=this.startParse(t,n,s);for(;;){let i=r.advance();if(i)return i}}}class qIe{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 Xs({perNode:!0});let UIe=0;class sc{constructor(t,n,s,r){this.name=t,this.set=n,this.base=s,this.modified=r,this.id=UIe++}toString(){let{name:t}=this;for(let n of this.modified)n.name&&(t=`${n.name}(${t})`);return t}static define(t,n){let s=typeof t=="string"?t:"?";if(t instanceof sc&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let r=new sc(s,[],null,[]);if(r.set.push(r),n)for(let i of n.set)r.set.push(i);return r}static defineModifier(t){let n=new YS(t);return s=>s.modified.indexOf(n)>-1?s:YS.get(s.base||s,s.modified.concat(n).sort((r,i)=>r.id-i.id))}}let VIe=0;class YS{constructor(t){this.name=t,this.instances=[],this.id=VIe++}static get(t,n){if(!n.length)return t;let s=n[0].instances.find(a=>a.base==t&&WIe(n,a.modified));if(s)return s;let r=[],i=new sc(t.name,r,t,n);for(let a of n)a.instances.push(i);let o=GIe(n);for(let a of t.set)if(!a.modified.length)for(let c of o)r.push(YS.get(a,c));return i}}function WIe(e,t){return e.length==t.length&&e.every((n,s)=>n==t[s])}function GIe(e){let t=[[]];for(let n=0;n<e.length;n++)for(let s=0,r=t.length;s<r;s++)t.push(t[s].concat(e[n]));return t.sort((n,s)=>s.length-n.length)}function KIe(e){let t=Object.create(null);for(let n in e){let s=e[n];Array.isArray(s)||(s=[s]);for(let r of n.split(" "))if(r){let i=[],o=2,a=r;for(let h=0;;){if(a=="..."&&h>0&&h+3==r.length){o=1;break}let m=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!m)throw new RangeError("Invalid path: "+r);if(i.push(m[0]=="*"?"":m[0][0]=='"'?JSON.parse(m[0]):m[0]),h+=m[0].length,h==r.length)break;let p=r[h++];if(h==r.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+r);a=r.slice(h)}let c=i.length-1,u=i[c];if(!u)throw new RangeError("Invalid path: "+r);let d=new tv(s,o,c>0?i.slice(0,c):null);t[u]=d.sort(t[u])}}return cse.add(t)}const cse=new Xs({combine(e,t){let n,s,r;for(;e||t;){if(!e||t&&e.depth>=t.depth?(r=t,t=t.next):(r=e,e=e.next),n&&n.mode==r.mode&&!r.context&&!n.context)continue;let i=new tv(r.tags,r.mode,r.context);n?n.next=i:s=i,n=i}return s}});class tv{constructor(t,n,s,r){this.tags=t,this.mode=n,this.context=s,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}get depth(){return this.context?this.context.length:0}}tv.empty=new tv([],2,null);function use(e,t){let n=Object.create(null);for(let i of e)if(!Array.isArray(i.tag))n[i.tag.id]=i.class;else for(let o of i.tag)n[o.id]=i.class;let{scope:s,all:r=null}=t||{};return{style:i=>{let o=r;for(let a of i)for(let c of a.set){let u=n[c.id];if(u){o=o?o+" "+u:u;break}}return o},scope:s}}function YIe(e,t){let n=null;for(let s of e){let r=s.style(t);r&&(n=n?n+" "+r:r)}return n}function XIe(e,t,n,s=0,r=e.length){let i=new QIe(s,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),s,r,"",i.highlighters),i.flush(r)}class QIe{constructor(t,n,s){this.at=t,this.highlighters=n,this.span=s,this.class=""}startSpan(t,n){n!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=n)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,n,s,r,i){let{type:o,from:a,to:c}=t;if(a>=s||c<=n)return;o.isTop&&(i=this.highlighters.filter(p=>!p.scope||p.scope(o)));let u=r,d=JIe(t)||tv.empty,h=YIe(i,d.tags);if(h&&(u&&(u+=" "),u+=h,d.mode==1&&(r+=(r?" ":"")+h)),this.startSpan(Math.max(n,a),u),d.opaque)return;let m=t.tree&&t.tree.prop(Xs.mounted);if(m&&m.overlay){let p=t.node.enter(m.overlay[0].from+a,1),g=this.highlighters.filter(v=>!v.scope||v.scope(m.tree.type)),b=t.firstChild();for(let v=0,x=a;;v++){let y=v<m.overlay.length?m.overlay[v]:null,w=y?y.from+a:c,k=Math.max(n,x),T=Math.min(s,w);if(k<T&&b)for(;t.from<T&&(this.highlightRange(t,k,T,r,i),this.startSpan(Math.min(T,t.to),u),!(t.to>=w||!t.nextSibling())););if(!y||w>s)break;x=y.to+a,x>n&&(this.highlightRange(p.cursor(),Math.max(n,y.from+a),Math.min(s,x),"",g),this.startSpan(Math.min(s,x),u))}b&&t.parent()}else if(t.firstChild()){m&&(r="");do if(!(t.to<=n)){if(t.from>=s)break;this.highlightRange(t,n,s,r,i),this.startSpan(Math.min(s,t.to),u)}while(t.nextSibling());t.parent()}}}function JIe(e){let t=e.type.prop(cse);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const Bt=sc.define,Kk=Bt(),qh=Bt(),rF=Bt(qh),iF=Bt(qh),Uh=Bt(),Yk=Bt(Uh),L6=Bt(Uh),hu=Bt(),zm=Bt(hu),ou=Bt(),au=Bt(),qA=Bt(),ey=Bt(qA),Xk=Bt(),Qt={comment:Kk,lineComment:Bt(Kk),blockComment:Bt(Kk),docComment:Bt(Kk),name:qh,variableName:Bt(qh),typeName:rF,tagName:Bt(rF),propertyName:iF,attributeName:Bt(iF),className:Bt(qh),labelName:Bt(qh),namespace:Bt(qh),macroName:Bt(qh),literal:Uh,string:Yk,docString:Bt(Yk),character:Bt(Yk),attributeValue:Bt(Yk),number:L6,integer:Bt(L6),float:Bt(L6),bool:Bt(Uh),regexp:Bt(Uh),escape:Bt(Uh),color:Bt(Uh),url:Bt(Uh),keyword:ou,self:Bt(ou),null:Bt(ou),atom:Bt(ou),unit:Bt(ou),modifier:Bt(ou),operatorKeyword:Bt(ou),controlKeyword:Bt(ou),definitionKeyword:Bt(ou),moduleKeyword:Bt(ou),operator:au,derefOperator:Bt(au),arithmeticOperator:Bt(au),logicOperator:Bt(au),bitwiseOperator:Bt(au),compareOperator:Bt(au),updateOperator:Bt(au),definitionOperator:Bt(au),typeOperator:Bt(au),controlOperator:Bt(au),punctuation:qA,separator:Bt(qA),bracket:ey,angleBracket:Bt(ey),squareBracket:Bt(ey),paren:Bt(ey),brace:Bt(ey),content:hu,heading:zm,heading1:Bt(zm),heading2:Bt(zm),heading3:Bt(zm),heading4:Bt(zm),heading5:Bt(zm),heading6:Bt(zm),contentSeparator:Bt(hu),list:Bt(hu),quote:Bt(hu),emphasis:Bt(hu),strong:Bt(hu),link:Bt(hu),monospace:Bt(hu),strikethrough:Bt(hu),inserted:Bt(),deleted:Bt(),changed:Bt(),invalid:Bt(),meta:Xk,documentMeta:Bt(Xk),annotation:Bt(Xk),processingInstruction:Bt(Xk),definition:sc.defineModifier("definition"),constant:sc.defineModifier("constant"),function:sc.defineModifier("function"),standard:sc.defineModifier("standard"),local:sc.defineModifier("local"),special:sc.defineModifier("special")};for(let e in Qt){let t=Qt[e];t instanceof sc&&(t.name=e)}use([{tag:Qt.link,class:"tok-link"},{tag:Qt.heading,class:"tok-heading"},{tag:Qt.emphasis,class:"tok-emphasis"},{tag:Qt.strong,class:"tok-strong"},{tag:Qt.keyword,class:"tok-keyword"},{tag:Qt.atom,class:"tok-atom"},{tag:Qt.bool,class:"tok-bool"},{tag:Qt.url,class:"tok-url"},{tag:Qt.labelName,class:"tok-labelName"},{tag:Qt.inserted,class:"tok-inserted"},{tag:Qt.deleted,class:"tok-deleted"},{tag:Qt.literal,class:"tok-literal"},{tag:Qt.string,class:"tok-string"},{tag:Qt.number,class:"tok-number"},{tag:[Qt.regexp,Qt.escape,Qt.special(Qt.string)],class:"tok-string2"},{tag:Qt.variableName,class:"tok-variableName"},{tag:Qt.local(Qt.variableName),class:"tok-variableName tok-local"},{tag:Qt.definition(Qt.variableName),class:"tok-variableName tok-definition"},{tag:Qt.special(Qt.variableName),class:"tok-variableName2"},{tag:Qt.definition(Qt.propertyName),class:"tok-propertyName tok-definition"},{tag:Qt.typeName,class:"tok-typeName"},{tag:Qt.namespace,class:"tok-namespace"},{tag:Qt.className,class:"tok-className"},{tag:Qt.macroName,class:"tok-macroName"},{tag:Qt.propertyName,class:"tok-propertyName"},{tag:Qt.operator,class:"tok-operator"},{tag:Qt.comment,class:"tok-comment"},{tag:Qt.meta,class:"tok-meta"},{tag:Qt.invalid,class:"tok-invalid"},{tag:Qt.punctuation,class:"tok-punctuation"}]);var P6;const Ty=new Xs,ZIe=new Xs;class Nu{constructor(t,n,s=[],r=""){this.data=t,this.name=r,Ks.prototype.hasOwnProperty("tree")||Object.defineProperty(Ks.prototype,"tree",{get(){return ra(this)}}),this.parser=n,this.extension=[Jf.of(this),Ks.languageData.of((i,o,a)=>{let c=oF(i,o,a),u=c.type.prop(Ty);if(!u)return[];let d=i.facet(u),h=c.type.prop(ZIe);if(h){let m=c.resolve(o-c.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(s)}isActiveAt(t,n,s=-1){return oF(t,n,s).type.prop(Ty)==this.data}findRegions(t){let n=t.facet(Jf);if((n==null?void 0:n.data)==this.data)return[{from:0,to:t.doc.length}];if(!n||!n.allowsNesting)return[];let s=[],r=(i,o)=>{if(i.prop(Ty)==this.data){s.push({from:o,to:o+i.length});return}let a=i.prop(Xs.mounted);if(a){if(a.tree.prop(Ty)==this.data){if(a.overlay)for(let c of a.overlay)s.push({from:c.from+o,to:c.to+o});else s.push({from:o,to:o+i.length});return}else if(a.overlay){let c=s.length;if(r(a.tree,a.overlay[0].from+o),s.length>c)return}}for(let c=0;c<i.children.length;c++){let u=i.children[c];u instanceof Bo&&r(u,i.positions[c]+o)}};return r(ra(t),0),s}get allowsNesting(){return!0}}Nu.setState=rs.define();function oF(e,t,n){let s=e.facet(Jf),r=ra(e).topNode;if(!s||s.allowsNesting)for(let i=r;i;i=i.enter(t,n,Ni.ExcludeBuffers|Ni.EnterBracketed))i.type.isTop&&(r=i);return r}function ra(e){let t=e.field(Nu.state,!1);return t?t.tree:Bo.empty}class eRe{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,n){let s=this.cursorPos-this.string.length;return t<s||n>=this.cursorPos?this.doc.sliceString(t,n):this.string.slice(t-s,n-s)}}let ty=null;class XS{constructor(t,n,s=[],r,i,o,a,c){this.parser=t,this.state=n,this.fragments=s,this.tree=r,this.treeLen=i,this.viewport=o,this.skipped=a,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(t,n,s){return new XS(t,n,[],Bo.empty,0,s,[],null)}startParse(){return this.parser.startParse(new eRe(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Bo.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var s;if(typeof t=="number"){let r=Date.now()+t;t=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let r=this.parse.advance();if(r)if(this.fragments=this.withoutTempSkipped(Sp.addTree(r,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(s=this.parse.stoppedAt)!==null&&s!==void 0?s:this.state.doc.length,this.tree=r,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(t())return!1}})}takeTree(){let t,n;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=t,this.tree=n,this.fragments=this.withoutTempSkipped(Sp.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=ty;ty=this;try{return t()}finally{ty=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=aF(t,n.from,n.to);return t}changes(t,n){let{fragments:s,tree:r,treeLen:i,viewport:o,skipped:a}=this;if(this.takeTree(),!t.empty){let c=[];if(t.iterChangedRanges((u,d,h,m)=>c.push({fromA:u,toA:d,fromB:h,toB:m})),s=Sp.applyChanges(s,c),r=Bo.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 XS(this.parser,n,s,r,i,o,a,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let n=this.skipped.length;for(let s=0;s<this.skipped.length;s++){let{from:r,to:i}=this.skipped[s];r<t.to&&i>t.from&&(this.fragments=aF(this.fragments,r,i),this.skipped.splice(s--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,n){this.skipped.push({from:t,to:n})}static getSkippingParser(t){return new class extends HIe{createParse(n,s,r){let i=r[0].from,o=r[r.length-1].to;return{parsedPos:i,advance(){let c=ty;if(c){for(let u of r)c.tempSkipped.push(u);t&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,t]):t)}return this.parsedPos=o,new Bo(wc.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 ty}}function aF(e,t,n){return Sp.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class _1{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),s=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,s)||n.takeTree(),new _1(n)}static init(t){let n=Math.min(3e3,t.doc.length),s=XS.create(t.facet(Jf).parser,t,{from:0,to:n});return s.work(20,n)||s.takeTree(),new _1(s)}}Nu.state=Ho.define({create:_1.init,update(e,t){for(let n of t.effects)if(n.is(Nu.setState))return n.value;return t.startState.facet(Jf)!=t.state.facet(Jf)?_1.init(t.state):e.apply(t)}});let dse=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(dse=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const O6=typeof navigator<"u"&&(!((P6=navigator.scheduling)===null||P6===void 0)&&P6.isInputPending)?()=>navigator.scheduling.isInputPending():null,tRe=ai.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(Nu.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(Nu.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=dse(this.work))}work(t){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:s,viewport:{to:r}}=this.view,i=s.field(Nu.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!O6?Math.max(25,t.timeRemaining()-5):1e9),a=i.context.treeLen<r&&s.doc.length>r+1e3,c=i.context.work(()=>O6&&O6()||Date.now()>o,r+(a?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Nu.setState.of(new _1(i.context))})),this.chunkBudget>0&&!(c&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Qa(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()}}}),Jf=on.define({combine(e){return e.length?e[0]:null},enables:e=>[Nu.state,tRe,Nt.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),nRe=on.define(),hI=on.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 QS(e){let t=e.facet(hI);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function nv(e,t){let n="",s=e.tabSize,r=e.facet(hI)[0];if(r=="	"){for(;t>=s;)n+="	",t-=s;r=" "}for(let i=0;i<t;i++)n+=r;return n}function fI(e,t){e instanceof Ks&&(e=new iC(e));for(let s of e.state.facet(nRe)){let r=s(e,t);if(r!==void 0)return r}let n=ra(e.state);return n.length>=t?rRe(e,n,t):null}class iC{constructor(t,n={}){this.state=t,this.options=n,this.unit=QS(t)}lineAt(t,n=1){let s=this.state.doc.lineAt(t),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return r!=null&&r>=s.from&&r<=s.to?i&&r==t?{text:"",from:t}:(n<0?r<t:r<=t)?{text:s.text.slice(r-s.from),from:r}:{text:s.text.slice(0,r-s.from),from:s.from}:s}textAfterPos(t,n=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:s,from:r}=this.lineAt(t,n);return s.slice(t-r,Math.min(s.length,t+100-r))}column(t,n=1){let{text:s,from:r}=this.lineAt(t,n),i=this.countColumn(s,t-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(i+=o-this.countColumn(s,s.search(/\S|$/))),i}countColumn(t,n=t.length){return nb(t,this.state.tabSize,n)}lineIndent(t,n=1){let{text:s,from:r}=this.lineAt(t,n),i=this.options.overrideIndentation;if(i){let o=i(r);if(o>-1)return o}return this.countColumn(s,s.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const sRe=new Xs;function rRe(e,t,n){let s=t.resolveStack(n),r=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=s.node){let i=[];for(let o=r;o&&!(o.from<s.node.from||o.to>s.node.to||o.from==s.node.from&&o.type==s.node.type);o=o.parent)i.push(o);for(let o=i.length-1;o>=0;o--)s={node:i[o],next:s}}return hse(s,e,n)}function hse(e,t,n){for(let s=e;s;s=s.next){let r=oRe(s.node);if(r)return r(mI.create(t,n,s))}return 0}function iRe(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function oRe(e){let t=e.type.prop(sRe);if(t)return t;let n=e.firstChild,s;if(n&&(s=n.type.prop(Xs.closedBy))){let r=e.lastChild,i=r&&s.indexOf(r.name)>-1;return o=>uRe(o,!0,1,void 0,i&&!iRe(o)?r.from:void 0)}return e.parent==null?aRe:null}function aRe(){return 0}class mI extends iC{constructor(t,n,s){super(t.state,t.options),this.base=t,this.pos=n,this.context=s}get node(){return this.context.node}static create(t,n,s){return new mI(t,n,s)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let n=this.state.doc.lineAt(t.from);for(;;){let s=t.resolve(n.from);for(;s.parent&&s.parent.from==s.from;)s=s.parent;if(lRe(s,t))break;n=this.state.doc.lineAt(s.from)}return this.lineIndent(n.from)}continue(){return hse(this.context.next,this.base,this.pos)}}function lRe(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function cRe(e){let t=e.node,n=t.childAfter(t.from),s=t.lastChild;if(!n)return null;let r=e.options.simulateBreak,i=e.state.doc.lineAt(n.from),o=r==null||r<=i.from?i.to:Math.min(i.to,r);for(let a=n.to;;){let c=t.childAfter(a);if(!c||c==s)return null;if(!c.type.isSkipped){if(c.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=c.to}}function uRe(e,t,n,s,r){let i=e.textAfter,o=i.match(/^\s*/)[0].length,a=s&&i.slice(o,o+s.length)==s||r==e.pos+o,c=cRe(e);return c?a?e.column(c.from):e.column(c.to):e.baseIndent+(a?0:e.unit*n)}const dRe=200;function hRe(){return Ks.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:s}=e.newSelection.main,r=n.lineAt(s);if(s>r.from+dRe)return e;let i=n.sliceString(r.from,s);if(!t.some(u=>u.test(i)))return e;let{state:o}=e,a=-1,c=[];for(let{head:u}of o.selection.ranges){let d=o.doc.lineAt(u);if(d.from==a)continue;a=d.from;let h=fI(o,d.from);if(h==null)continue;let m=/^\s*/.exec(d.text)[0],p=nv(o,h);m!=p&&c.push({from:d.from,to:d.from+m.length,insert:p})}return c.length?[e,{changes:c,sequential:!0}]:e})}const fRe=on.define(),mRe=new Xs;function pRe(e,t,n){let s=ra(e);if(s.length<n)return null;let r=s.resolveStack(n,1),i=null;for(let o=r;o;o=o.next){let a=o.node;if(a.to<=n||a.from>n)continue;if(i&&a.from<t)break;let c=a.type.prop(mRe);if(c&&(a.to<s.length-50||s.length==e.doc.length||!gRe(a))){let u=c(a,e);u&&u.from<=n&&u.from>=t&&u.to>n&&(i=u)}}return i}function gRe(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function JS(e,t,n){for(let s of e.facet(fRe)){let r=s(e,t,n);if(r)return r}return pRe(e,t,n)}function fse(e,t){let n=t.mapPos(e.from,1),s=t.mapPos(e.to,-1);return n>=s?void 0:{from:n,to:s}}const oC=rs.define({map:fse}),Jv=rs.define({map:fse});function mse(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(s=>s.from<=n&&s.to>=n)||t.push(e.lineBlockAt(n));return t}const Fp=Ho.define({create(){return vn.none},update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((n,s)=>e=lF(e,n,s)),e=e.map(t.changes);for(let n of t.effects)if(n.is(oC)&&!bRe(e,n.value.from,n.value.to)){let{preparePlaceholder:s}=t.state.facet(bse),r=s?vn.replace({widget:new SRe(s(t.state,n.value))}):cF;e=e.update({add:[r.range(n.value.from,n.value.to)]})}else n.is(Jv)&&(e=e.update({filter:(s,r)=>n.value.from!=s||n.value.to!=r,filterFrom:n.value.from,filterTo:n.value.to}));return t.selection&&(e=lF(e,t.selection.main.head)),e},provide:e=>Nt.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(s,r)=>{n.push(s,r)}),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 s=e[n++],r=e[n++];if(typeof s!="number"||typeof r!="number")throw new RangeError("Invalid JSON for fold state");t.push(cF.range(s,r))}return vn.set(t,!0)}});function lF(e,t,n=t){let s=!1;return e.between(t,n,(r,i)=>{r<n&&i>t&&(s=!0)}),s?e.update({filterFrom:t,filterTo:n,filter:(r,i)=>r>=n||i<=t}):e}function ZS(e,t,n){var s;let r=null;return(s=e.field(Fp,!1))===null||s===void 0||s.between(t,n,(i,o)=>{(!r||r.from>i)&&(r={from:i,to:o})}),r}function bRe(e,t,n){let s=!1;return e.between(t,t,(r,i)=>{r==t&&i==n&&(s=!0)}),s}function pse(e,t){return e.field(Fp,!1)?t:t.concat(rs.appendConfig.of(yse()))}const yRe=e=>{for(let t of mse(e)){let n=JS(e.state,t.from,t.to);if(n)return e.dispatch({effects:pse(e.state,[oC.of(n),gse(e,n)])}),!0}return!1},xRe=e=>{if(!e.state.field(Fp,!1))return!1;let t=[];for(let n of mse(e)){let s=ZS(e.state,n.from,n.to);s&&t.push(Jv.of(s),gse(e,s,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function gse(e,t,n=!0){let s=e.state.doc.lineAt(t.from).number,r=e.state.doc.lineAt(t.to).number;return Nt.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${s} ${e.state.phrase("to")} ${r}.`)}const vRe=e=>{let{state:t}=e,n=[];for(let s=0;s<t.doc.length;){let r=e.lineBlockAt(s),i=JS(t,r.from,r.to);i&&n.push(oC.of(i)),s=(i?e.lineBlockAt(i.to):r).to+1}return n.length&&e.dispatch({effects:pse(e.state,n)}),!!n.length},wRe=e=>{let t=e.state.field(Fp,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(s,r)=>{n.push(Jv.of({from:s,to:r}))}),e.dispatch({effects:n}),!0},kRe=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:yRe},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:xRe},{key:"Ctrl-Alt-[",run:vRe},{key:"Ctrl-Alt-]",run:wRe}],_Re={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},bse=on.define({combine(e){return Yu(e,_Re)}});function yse(e){return[Fp,ERe]}function xse(e,t){let{state:n}=e,s=n.facet(bse),r=o=>{let a=e.lineBlockAt(e.posAtDOM(o.target)),c=ZS(e.state,a.from,a.to);c&&e.dispatch({effects:Jv.of(c)}),o.preventDefault()};if(s.placeholderDOM)return s.placeholderDOM(e,r,t);let i=document.createElement("span");return i.textContent=s.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=r,i}const cF=vn.replace({widget:new class extends Ol{toDOM(e){return xse(e,null)}}});class SRe extends Ol{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return xse(t,this.value)}}const CRe={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class B6 extends sh{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 TRe(e={}){let t={...CRe,...e},n=new B6(t,!0),s=new B6(t,!1),r=ai.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Jf)!=o.state.facet(Jf)||o.startState.field(Fp,!1)!=o.state.field(Fp,!1)||ra(o.startState)!=ra(o.state)||t.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Ou;for(let c of o.viewportLineBlocks){let u=ZS(o.state,c.from,c.to)?s:JS(o.state,c.from,c.to)?n:null;u&&a.add(c.from,c.from,u)}return a.finish()}}),{domEventHandlers:i}=t;return[r,SIe({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(r))===null||a===void 0?void 0:a.markers)||Rs.empty},initialSpacer(){return new B6(t,!1)},domEventHandlers:{...i,click:(o,a,c)=>{if(i.click&&i.click(o,a,c))return!0;let u=ZS(o.state,a.from,a.to);if(u)return o.dispatch({effects:Jv.of(u)}),!0;let d=JS(o.state,a.from,a.to);return d?(o.dispatch({effects:oC.of(d)}),!0):!1}}}),yse()]}const ERe=Nt.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 aC{constructor(t,n){this.specs=t;let s;function r(a){let c=Gf.newName();return(s||(s=Object.create(null)))["."+c]=a,c}const i=typeof n.all=="string"?n.all:n.all?r(n.all):void 0,o=n.scope;this.scope=o instanceof Nu?a=>a.prop(Ty)==o.data:o?a=>a==o:void 0,this.style=use(t.map(a=>({tag:a.tag,class:a.class||r(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=s?new Gf(s):null,this.themeType=n.themeType}static define(t,n){return new aC(t,n||{})}}const UA=on.define(),vse=on.define({combine(e){return e.length?[e[0]]:null}});function o2(e){let t=e.facet(UA);return t.length?t:e.facet(vse)}function wse(e,t){let n=[NRe],s;return e instanceof aC&&(e.module&&n.push(Nt.styleModule.of(e.module)),s=e.themeType),t!=null&&t.fallback?n.push(vse.of(e)):s?n.push(UA.computeN([Nt.darkTheme],r=>r.facet(Nt.darkTheme)==(s=="dark")?[e]:[])):n.push(UA.of(e)),n}function j_t(e,t,n){let s=o2(e),r=null;if(s){for(let i of s)if(!i.scope||n){let o=i.style(t);o&&(r=r?r+" "+o:o)}}return r}class ARe{constructor(t){this.markCache=Object.create(null),this.tree=ra(t.state),this.decorations=this.buildDeco(t,o2(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=ra(t.state),s=o2(t.state),r=s!=o2(t.startState),{viewport:i}=t.view,o=t.changes.mapPos(this.decoratedTo,1);n.length<i.to&&!r&&n.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(n!=this.tree||t.viewportChanged||r)&&(this.tree=n,this.decorations=this.buildDeco(t.view,s),this.decoratedTo=i.to)}buildDeco(t,n){if(!n||!this.tree.length)return vn.none;let s=new Ou;for(let{from:r,to:i}of t.visibleRanges)XIe(this.tree,n,(o,a,c)=>{s.add(o,a,this.markCache[c]||(this.markCache[c]=vn.mark({class:c})))},r,i);return s.finish()}}const NRe=gm.high(ai.fromClass(ARe,{decorations:e=>e.decorations})),kse=aC.define([{tag:Qt.meta,color:"#404740"},{tag:Qt.link,textDecoration:"underline"},{tag:Qt.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Qt.emphasis,fontStyle:"italic"},{tag:Qt.strong,fontWeight:"bold"},{tag:Qt.strikethrough,textDecoration:"line-through"},{tag:Qt.keyword,color:"#708"},{tag:[Qt.atom,Qt.bool,Qt.url,Qt.contentSeparator,Qt.labelName],color:"#219"},{tag:[Qt.literal,Qt.inserted],color:"#164"},{tag:[Qt.string,Qt.deleted],color:"#a11"},{tag:[Qt.regexp,Qt.escape,Qt.special(Qt.string)],color:"#e40"},{tag:Qt.definition(Qt.variableName),color:"#00f"},{tag:Qt.local(Qt.variableName),color:"#30a"},{tag:[Qt.typeName,Qt.namespace],color:"#085"},{tag:Qt.className,color:"#167"},{tag:[Qt.special(Qt.variableName),Qt.macroName],color:"#256"},{tag:Qt.definition(Qt.propertyName),color:"#00c"},{tag:Qt.comment,color:"#940"},{tag:Qt.invalid,color:"#f00"}]),jRe=Nt.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),_se=1e4,Sse="()[]{}",Cse=on.define({combine(e){return Yu(e,{afterCursor:!0,brackets:Sse,maxScanDistance:_se,renderMatch:RRe})}}),MRe=vn.mark({class:"cm-matchingBracket"}),IRe=vn.mark({class:"cm-nonmatchingBracket"});function RRe(e){let t=[],n=e.matched?MRe:IRe;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 uF(e){let t=[],n=e.facet(Cse);for(let s of e.selection.ranges){if(!s.empty)continue;let r=ju(e,s.head,-1,n)||s.head>0&&ju(e,s.head-1,1,n)||n.afterCursor&&(ju(e,s.head,1,n)||s.head<e.doc.length&&ju(e,s.head+1,-1,n));r&&(t=t.concat(n.renderMatch(r,e)))}return vn.set(t,!0)}const DRe=ai.fromClass(class{constructor(e){this.paused=!1,this.decorations=uF(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=uF(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),LRe=[DRe,jRe];function PRe(e={}){return[Cse.of(e),LRe]}const ORe=new Xs;function VA(e,t,n){let s=e.prop(t<0?Xs.openedBy:Xs.closedBy);if(s)return s;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==(t<0?1:0))return[n[r+t]]}return null}function WA(e){let t=e.type.prop(ORe);return t?t(e.node):e}function ju(e,t,n,s={}){let r=s.maxScanDistance||_se,i=s.brackets||Sse,o=ra(e),a=o.resolveInner(t,n);for(let c=a;c;c=c.parent){let u=VA(c.type,n,i);if(u&&c.from<c.to){let d=WA(c);if(d&&(n>0?t>=d.from&&t<d.to:t>d.from&&t<=d.to))return BRe(e,t,n,c,d,u,i)}}return $Re(e,t,n,o,a.type,r,i)}function BRe(e,t,n,s,r,i,o){let a=s.parent,c={from:r.from,to:r.to},u=0,d=a==null?void 0:a.cursor();if(d&&(n<0?d.childBefore(s.from):d.childAfter(s.to)))do if(n<0?d.to<=s.from:d.from>=s.to){if(u==0&&i.indexOf(d.type.name)>-1&&d.from<d.to){let h=WA(d);return{start:c,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(VA(d.type,n,o))u++;else if(VA(d.type,-n,o)){if(u==0){let h=WA(d);return{start:c,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:c,matched:!1}}function $Re(e,t,n,s,r,i,o){if(n<0?!t:t==e.doc.length)return null;let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),c=o.indexOf(a);if(c<0||c%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,v=n>0?p.length:-1;b!=v;b+=n){let x=o.indexOf(p[b]);if(!(x<0||s.resolveInner(g+b,1).type!=r))if(x%2==0==n>0)h++;else{if(h==1)return{start:u,end:{from:g+b,to:g+b+1},matched:x>>1==c>>1};h--}}n>0&&(m+=p.length)}return d.done?{start:u,matched:!1}:null}const zRe=Object.create(null),dF=[wc.none],hF=[],fF=Object.create(null),FRe=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"]])FRe[e]=HRe(zRe,t);function $6(e,t){hF.indexOf(e)>-1||(hF.push(e),console.warn(t))}function HRe(e,t){let n=[];for(let a of t.split(" ")){let c=[];for(let u of a.split(".")){let d=e[u]||Qt[u];d?typeof d=="function"?c.length?c=c.map(d):$6(u,`Modifier ${u} used at start of tag`):c.length?$6(u,`Tag ${u} used as modifier`):c=Array.isArray(d)?d:[d]:$6(u,`Unknown highlighting tag ${u}`)}for(let u of c)n.push(u)}if(!n.length)return 0;let s=t.replace(/ /g,"_"),r=s+" "+n.map(a=>a.id),i=fF[r];if(i)return i.id;let o=fF[r]=wc.define({id:dF.length,name:s,props:[KIe({[s]:n})]});return dF.push(o),o.id}Rr.RTL,Rr.LTR;const qRe=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),s=gI(e.state,n.from);return s.line?URe(e):s.block?WRe(e):!1};function pI(e,t){return({state:n,dispatch:s})=>{if(n.readOnly)return!1;let r=e(t,n);return r?(s(n.update(r)),!0):!1}}const URe=pI(YRe,0),VRe=pI(Tse,0),WRe=pI((e,t)=>Tse(e,t,KRe(t)),0);function gI(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const ny=50;function GRe(e,{open:t,close:n},s,r){let i=e.sliceDoc(s-ny,s),o=e.sliceDoc(r,r+ny),a=/\s*$/.exec(i)[0].length,c=/^\s*/.exec(o)[0].length,u=i.length-a;if(i.slice(u-t.length,u)==t&&o.slice(c,c+n.length)==n)return{open:{pos:s-a,margin:a&&1},close:{pos:r+c,margin:c&&1}};let d,h;r-s<=2*ny?d=h=e.sliceDoc(s,r):(d=e.sliceDoc(s,s+ny),h=e.sliceDoc(r-ny,r));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:s+m+t.length,margin:/\s/.test(d.charAt(m+t.length))?1:0},close:{pos:r-p-n.length,margin:/\s/.test(h.charAt(g-1))?1:0}}:null}function KRe(e){let t=[];for(let n of e.selection.ranges){let s=e.doc.lineAt(n.from),r=n.to<=s.to?s:e.doc.lineAt(n.to);r.from>s.from&&r.from==n.to&&(r=n.to==s.to+1?s:e.doc.lineAt(n.to-1));let i=t.length-1;i>=0&&t[i].to>s.from?t[i].to=r.to:t.push({from:s.from+/^\s*/.exec(s.text)[0].length,to:r.to})}return t}function Tse(e,t,n=t.selection.ranges){let s=n.map(i=>gI(t,i.from).block);if(!s.every(i=>i))return null;let r=n.map((i,o)=>GRe(t,s[o],i.from,i.to));if(e!=2&&!r.every(i=>i))return{changes:t.changes(n.map((i,o)=>r[o]?[]:[{from:i.from,insert:s[o].open+" "},{from:i.to,insert:" "+s[o].close}]))};if(e!=1&&r.some(i=>i)){let i=[];for(let o=0,a;o<r.length;o++)if(a=r[o]){let c=s[o],{open:u,close:d}=a;i.push({from:u.pos-c.open.length,to:u.pos+u.margin},{from:d.pos-d.margin,to:d.pos+c.close.length})}return{changes:i}}return null}function YRe(e,t,n=t.selection.ranges){let s=[],r=-1;e:for(let{from:i,to:o}of n){let a=s.length,c=1e9,u;for(let d=i;d<=o;){let h=t.doc.lineAt(d);if(u==null&&(u=gI(t,h.from).line,!u))continue e;if(h.from>r&&(i==o||o>h.from)){r=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<c&&(c=m),s.push({line:h,comment:g,token:u,indent:m,empty:p,single:!1})}d=h.to+1}if(c<1e9)for(let d=a;d<s.length;d++)s[d].indent<s[d].line.text.length&&(s[d].indent=c);s.length==a+1&&(s[a].single=!0)}if(e!=2&&s.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:a,token:c,indent:u,empty:d,single:h}of s)(h||!d)&&i.push({from:a.from+u,insert:c+" "});let o=t.changes(i);return{changes:o,selection:t.selection.map(o,1)}}else if(e!=1&&s.some(i=>i.comment>=0)){let i=[];for(let{line:o,comment:a,token:c}of s)if(a>=0){let u=o.from+a,d=u+c.length;o.text[d-o.from]==" "&&d++,i.push({from:u,to:d})}return{changes:i}}return null}const GA=fh.define(),XRe=fh.define(),QRe=on.define(),Ese=on.define({combine(e){return Yu(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(s,r)=>t(s,r)||n(s,r)})}}),Ase=Ho.define({create(){return Mu.empty},update(e,t){let n=t.state.facet(Ese),s=t.annotation(GA);if(s){let c=Ja.fromTransaction(t,s.selection),u=s.side,d=u==0?e.undone:e.done;return c?d=e4(d,d.length,n.minDepth,c):d=Mse(d,t.startState.selection),new Mu(u==0?s.rest:d,u==0?d:s.rest)}let r=t.annotation(XRe);if((r=="full"||r=="before")&&(e=e.isolate()),t.annotation(so.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let i=Ja.fromTransaction(t),o=t.annotation(so.time),a=t.annotation(so.userEvent);return i?e=e.addChanges(i,o,a,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,a,n.newGroupDelay)),(r=="full"||r=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new Mu(e.done.map(Ja.fromJSON),e.undone.map(Ja.fromJSON))}});function bI(e={}){return[Ase,Ese.of(e),Nt.domEventHandlers({beforeinput(t,n){let s=t.inputType=="historyUndo"?Nse:t.inputType=="historyRedo"?KA:null;return s?(t.preventDefault(),s(n)):!1}})]}function lC(e,t){return function({state:n,dispatch:s}){if(!t&&n.readOnly)return!1;let r=n.field(Ase,!1);if(!r)return!1;let i=r.pop(e,n,t);return i?(s(i),!0):!1}}const Nse=lC(0,!1),KA=lC(1,!1),JRe=lC(0,!0),ZRe=lC(1,!0);class Ja{constructor(t,n,s,r,i){this.changes=t,this.effects=n,this.mapped=s,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new Ja(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,s;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(s=this.startSelection)===null||s===void 0?void 0:s.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(t){return new Ja(t.changes&&to.fromJSON(t.changes),[],t.mapped&&Ru.fromJSON(t.mapped),t.startSelection&&Ye.fromJSON(t.startSelection),t.selectionsAfter.map(Ye.fromJSON))}static fromTransaction(t,n){let s=hc;for(let r of t.startState.facet(QRe)){let i=r(t);i.length&&(s=s.concat(i))}return!s.length&&t.changes.empty?null:new Ja(t.changes.invert(t.startState.doc),s,void 0,n||t.startState.selection,hc)}static selection(t){return new Ja(void 0,hc,void 0,void 0,t)}}function e4(e,t,n,s){let r=t+1>n+20?t-n-1:0,i=e.slice(r,t);return i.push(s),i}function eDe(e,t){let n=[],s=!1;return e.iterChangedRanges((r,i)=>n.push(r,i)),t.iterChangedRanges((r,i,o,a)=>{for(let c=0;c<n.length;){let u=n[c++],d=n[c++];a>=u&&o<=d&&(s=!0)}}),s}function tDe(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,s)=>n.empty!=t.ranges[s].empty).length===0}function jse(e,t){return e.length?t.length?e.concat(t):e:t}const hc=[],nDe=200;function Mse(e,t){if(e.length){let n=e[e.length-1],s=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-nDe));return s.length&&s[s.length-1].eq(t)?e:(s.push(t),e4(e,e.length-1,1e9,n.setSelAfter(s)))}else return[Ja.selection([t])]}function sDe(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 z6(e,t){if(!e.length)return e;let n=e.length,s=hc;for(;n;){let r=rDe(e[n-1],t,s);if(r.changes&&!r.changes.empty||r.effects.length){let i=e.slice(0,n);return i[n-1]=r,i}else t=r.mapped,n--,s=r.selectionsAfter}return s.length?[Ja.selection(s)]:hc}function rDe(e,t,n){let s=jse(e.selectionsAfter.length?e.selectionsAfter.map(a=>a.map(t)):hc,n);if(!e.changes)return Ja.selection(s);let r=e.changes.map(t),i=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(i):i;return new Ja(r,rs.mapEffects(e.effects,t),o,e.startSelection.map(i),s)}const iDe=/^(input\.type|delete)($|\.)/;class Mu{constructor(t,n,s=0,r=void 0){this.done=t,this.undone=n,this.prevTime=s,this.prevUserEvent=r}isolate(){return this.prevTime?new Mu(this.done,this.undone):this}addChanges(t,n,s,r,i){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&t.changes&&(!s||iDe.test(s))&&(!a.selectionsAfter.length&&n-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,eDe(a.changes,t.changes))||s=="input.type.compose")?o=e4(o,o.length-1,r.minDepth,new Ja(t.changes.compose(a.changes),jse(rs.mapEffects(t.effects,a.changes),a.effects),a.mapped,a.startSelection,hc)):o=e4(o,o.length,r.minDepth,t),new Mu(o,hc,n,s)}addSelection(t,n,s,r){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:hc;return i.length>0&&n-this.prevTime<r&&s==this.prevUserEvent&&s&&/^select($|\.)/.test(s)&&tDe(i[i.length-1],t)?this:new Mu(Mse(this.done,t),this.undone,n,s)}addMapping(t){return new Mu(z6(this.done,t),z6(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,s){let r=t==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],o=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):n.selection);if(s&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:GA.of({side:t,rest:sDe(r),selection:o}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=r.length==1?hc:r.slice(0,r.length-1);return i.mapped&&(a=z6(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:GA.of({side:t,rest:a,selection:o}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}Mu.empty=new Mu(hc,hc);const yI=[{key:"Mod-z",run:Nse,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:KA,preventDefault:!0},{linux:"Ctrl-Shift-z",run:KA,preventDefault:!0},{key:"Mod-u",run:JRe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:ZRe,preventDefault:!0}];function sb(e,t){return Ye.create(e.ranges.map(t),e.mainIndex)}function Fc(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Hc({state:e,dispatch:t},n){let s=sb(e.selection,n);return s.eq(e.selection,!0)?!1:(t(Fc(e,s)),!0)}function cC(e,t){return Ye.cursor(t?e.to:e.from)}function Ise(e,t){return Hc(e,n=>n.empty?e.moveByChar(n,t):cC(n,t))}function ca(e){return e.textDirectionAt(e.state.selection.main.head)==Rr.LTR}const Rse=e=>Ise(e,!ca(e)),Dse=e=>Ise(e,ca(e));function Lse(e,t){return Hc(e,n=>n.empty?e.moveByGroup(n,t):cC(n,t))}const oDe=e=>Lse(e,!ca(e)),aDe=e=>Lse(e,ca(e));function lDe(e,t,n){if(t.type.prop(n))return!0;let s=t.to-t.from;return s&&(s>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function uC(e,t,n){let s=ra(e).resolveInner(t.head),r=n?Xs.closedBy:Xs.openedBy;for(let c=t.head;;){let u=n?s.childAfter(c):s.childBefore(c);if(!u)break;lDe(e,u,r)?s=u:c=n?u.to:u.from}let i=s.type.prop(r),o,a;return i&&(o=n?ju(e,s.from,1):ju(e,s.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?s.to:s.from,Ye.cursor(a,n?-1:1)}const cDe=e=>Hc(e,t=>uC(e.state,t,!ca(e))),uDe=e=>Hc(e,t=>uC(e.state,t,ca(e)));function Pse(e,t){return Hc(e,n=>{if(!n.empty)return cC(n,t);let s=e.moveVertically(n,t);return s.head!=n.head?s:e.moveToLineBoundary(n,t)})}const Ose=e=>Pse(e,!1),Bse=e=>Pse(e,!0);function $se(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,s=0,r;if(t){for(let i of e.state.facet(Nt.scrollMargins)){let o=i(e);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(s=Math.max(o==null?void 0:o.bottom,s))}r=e.scrollDOM.clientHeight-n-s}else r=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:s,selfScroll:t,height:Math.max(e.defaultLineHeight,r-5)}}function zse(e,t){let n=$se(e),{state:s}=e,r=sb(s.selection,o=>o.empty?e.moveVertically(o,t,n.height):cC(o,t));if(r.eq(s.selection))return!1;let i;if(n.selfScroll){let o=e.coordsAtPos(s.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),c=a.top+n.marginTop,u=a.bottom-n.marginBottom;o&&o.top>c&&o.bottom<u&&(i=Nt.scrollIntoView(r.main.head,{y:"start",yMargin:o.top-c}))}return e.dispatch(Fc(s,r),{effects:i}),!0}const mF=e=>zse(e,!1),YA=e=>zse(e,!0);function bm(e,t,n){let s=e.lineBlockAt(t.head),r=e.moveToLineBoundary(t,n);if(r.head==t.head&&r.head!=(n?s.to:s.from)&&(r=e.moveToLineBoundary(t,n,!1)),!n&&r.head==s.from&&s.length){let i=/^\s*/.exec(e.state.sliceDoc(s.from,Math.min(s.from+100,s.to)))[0].length;i&&t.head!=s.from+i&&(r=Ye.cursor(s.from+i))}return r}const dDe=e=>Hc(e,t=>bm(e,t,!0)),hDe=e=>Hc(e,t=>bm(e,t,!1)),fDe=e=>Hc(e,t=>bm(e,t,!ca(e))),mDe=e=>Hc(e,t=>bm(e,t,ca(e))),pDe=e=>Hc(e,t=>Ye.cursor(e.lineBlockAt(t.head).from,1)),gDe=e=>Hc(e,t=>Ye.cursor(e.lineBlockAt(t.head).to,-1));function bDe(e,t,n){let s=!1,r=sb(e.selection,i=>{let o=ju(e,i.head,-1)||ju(e,i.head,1)||i.head>0&&ju(e,i.head-1,1)||i.head<e.doc.length&&ju(e,i.head+1,-1);if(!o||!o.end)return i;s=!0;let a=o.start.from==i.head?o.end.to:o.end.from;return Ye.cursor(a)});return s?(t(Fc(e,r)),!0):!1}const yDe=({state:e,dispatch:t})=>bDe(e,t);function kc(e,t){let n=sb(e.state.selection,s=>{let r=t(s);return Ye.range(s.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(Fc(e.state,n)),!0)}function Fse(e,t){return kc(e,n=>e.moveByChar(n,t))}const Hse=e=>Fse(e,!ca(e)),qse=e=>Fse(e,ca(e));function Use(e,t){return kc(e,n=>e.moveByGroup(n,t))}const xDe=e=>Use(e,!ca(e)),vDe=e=>Use(e,ca(e)),wDe=e=>kc(e,t=>uC(e.state,t,!ca(e))),kDe=e=>kc(e,t=>uC(e.state,t,ca(e)));function Vse(e,t){return kc(e,n=>e.moveVertically(n,t))}const Wse=e=>Vse(e,!1),Gse=e=>Vse(e,!0);function Kse(e,t){return kc(e,n=>e.moveVertically(n,t,$se(e).height))}const pF=e=>Kse(e,!1),gF=e=>Kse(e,!0),_De=e=>kc(e,t=>bm(e,t,!0)),SDe=e=>kc(e,t=>bm(e,t,!1)),CDe=e=>kc(e,t=>bm(e,t,!ca(e))),TDe=e=>kc(e,t=>bm(e,t,ca(e))),EDe=e=>kc(e,t=>Ye.cursor(e.lineBlockAt(t.head).from)),ADe=e=>kc(e,t=>Ye.cursor(e.lineBlockAt(t.head).to)),bF=({state:e,dispatch:t})=>(t(Fc(e,{anchor:0})),!0),yF=({state:e,dispatch:t})=>(t(Fc(e,{anchor:e.doc.length})),!0),xF=({state:e,dispatch:t})=>(t(Fc(e,{anchor:e.selection.main.anchor,head:0})),!0),vF=({state:e,dispatch:t})=>(t(Fc(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),NDe=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),jDe=({state:e,dispatch:t})=>{let n=dC(e).map(({from:s,to:r})=>Ye.range(s,Math.min(r+1,e.doc.length)));return t(e.update({selection:Ye.create(n),userEvent:"select"})),!0},MDe=({state:e,dispatch:t})=>{let n=sb(e.selection,s=>{let r=ra(e),i=r.resolveStack(s.from,1);if(s.empty){let o=r.resolveStack(s.from,-1);o.node.from>=i.node.from&&o.node.to<=i.node.to&&(i=o)}for(let o=i;o;o=o.next){let{node:a}=o;if((a.from<s.from&&a.to>=s.to||a.to>s.to&&a.from<=s.from)&&o.next)return Ye.range(a.to,a.from)}return s});return n.eq(e.selection)?!1:(t(Fc(e,n)),!0)};function Yse(e,t){let{state:n}=e,s=n.selection,r=n.selection.ranges.slice();for(let i of n.selection.ranges){let o=n.doc.lineAt(i.head);if(t?o.to<e.state.doc.length:o.from>0)for(let a=i;;){let c=e.moveVertically(a,t);if(c.head<o.from||c.head>o.to){r.some(u=>u.head==c.head)||r.push(c);break}else{if(c.head==a.head)break;a=c}}}return r.length==s.ranges.length?!1:(e.dispatch(Fc(n,Ye.create(r,r.length-1))),!0)}const IDe=e=>Yse(e,!1),RDe=e=>Yse(e,!0),DDe=({state:e,dispatch:t})=>{let n=e.selection,s=null;return n.ranges.length>1?s=Ye.create([n.main]):n.main.empty||(s=Ye.create([Ye.cursor(n.main.head)])),s?(t(Fc(e,s)),!0):!1};function Zv(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:s}=e,r=s.changeByRange(i=>{let{from:o,to:a}=i;if(o==a){let c=t(i);c<o?(n="delete.backward",c=Qk(e,c,!1)):c>o&&(n="delete.forward",c=Qk(e,c,!0)),o=Math.min(o,c),a=Math.max(a,c)}else o=Qk(e,o,!1),a=Qk(e,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:Ye.cursor(o,o<i.head?-1:1)}});return r.changes.empty?!1:(e.dispatch(s.update(r,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?Nt.announce.of(s.phrase("Selection deleted")):void 0})),!0)}function Qk(e,t,n){if(e instanceof Nt)for(let s of e.state.facet(Nt.atomicRanges).map(r=>r(e)))s.between(t,t,(r,i)=>{r<t&&i>t&&(t=n?i:r)});return t}const Xse=(e,t,n)=>Zv(e,s=>{let r=s.from,{state:i}=e,o=i.doc.lineAt(r),a,c;if(n&&!t&&r>o.from&&r<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,r-o.from))){if(a[a.length-1]=="	")return r-1;let u=nb(a,i.tabSize),d=u%QS(i)||QS(i);for(let h=0;h<d&&a[a.length-1-h]==" ";h++)r--;c=r}else c=_o(o.text,r-o.from,t,t)+o.from,c==r&&o.number!=(t?i.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,r-o.from))&&(c=_o(o.text,c-o.from,!1,!1)+o.from);return c}),XA=e=>Xse(e,!1,!0),Qse=e=>Xse(e,!0,!1),Jse=(e,t)=>Zv(e,n=>{let s=n.head,{state:r}=e,i=r.doc.lineAt(s),o=r.charCategorizer(s);for(let a=null;;){if(s==(t?i.to:i.from)){s==n.head&&i.number!=(t?r.doc.lines:1)&&(s+=t?1:-1);break}let c=_o(i.text,s-i.from,t)+i.from,u=i.text.slice(Math.min(s,c)-i.from,Math.max(s,c)-i.from),d=o(u);if(a!=null&&d!=a)break;(u!=" "||s!=n.head)&&(a=d),s=c}return s}),Zse=e=>Jse(e,!1),LDe=e=>Jse(e,!0),PDe=e=>Zv(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),ODe=e=>Zv(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),BDe=e=>Zv(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),$De=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(s=>({changes:{from:s.from,to:s.to,insert:rr.of(["",""])},range:Ye.cursor(s.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},zDe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(s=>{if(!s.empty||s.from==0||s.from==e.doc.length)return{range:s};let r=s.from,i=e.doc.lineAt(r),o=r==i.from?r-1:_o(i.text,r-i.from,!1)+i.from,a=r==i.to?r+1:_o(i.text,r-i.from,!0)+i.from;return{changes:{from:o,to:a,insert:e.doc.slice(r,a).append(e.doc.slice(o,r))},range:Ye.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function dC(e){let t=[],n=-1;for(let s of e.selection.ranges){let r=e.doc.lineAt(s.from),i=e.doc.lineAt(s.to);if(!s.empty&&s.to==i.from&&(i=e.doc.lineAt(s.to-1)),n>=r.number){let o=t[t.length-1];o.to=i.to,o.ranges.push(s)}else t.push({from:r.from,to:i.to,ranges:[s]});n=i.number+1}return t}function ere(e,t,n){if(e.readOnly)return!1;let s=[],r=[];for(let i of dC(e)){if(n?i.to==e.doc.length:i.from==0)continue;let o=e.doc.lineAt(n?i.to+1:i.from-1),a=o.length+1;if(n){s.push({from:i.to,to:o.to},{from:i.from,insert:o.text+e.lineBreak});for(let c of i.ranges)r.push(Ye.range(Math.min(e.doc.length,c.anchor+a),Math.min(e.doc.length,c.head+a)))}else{s.push({from:o.from,to:i.from},{from:i.to,insert:e.lineBreak+o.text});for(let c of i.ranges)r.push(Ye.range(c.anchor-a,c.head-a))}}return s.length?(t(e.update({changes:s,scrollIntoView:!0,selection:Ye.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const FDe=({state:e,dispatch:t})=>ere(e,t,!1),HDe=({state:e,dispatch:t})=>ere(e,t,!0);function tre(e,t,n){if(e.readOnly)return!1;let s=[];for(let i of dC(e))n?s.push({from:i.from,insert:e.doc.slice(i.from,i.to)+e.lineBreak}):s.push({from:i.to,insert:e.lineBreak+e.doc.slice(i.from,i.to)});let r=e.changes(s);return t(e.update({changes:r,selection:e.selection.map(r,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const qDe=({state:e,dispatch:t})=>tre(e,t,!1),UDe=({state:e,dispatch:t})=>tre(e,t,!0),VDe=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(dC(t).map(({from:r,to:i})=>(r>0?r--:i<t.doc.length&&i++,{from:r,to:i}))),s=sb(t.selection,r=>{let i;if(e.lineWrapping){let o=e.lineBlockAt(r.head),a=e.coordsAtPos(r.head,r.assoc||1);a&&(i=o.bottom+e.documentTop-a.bottom+e.defaultLineHeight/2)}return e.moveVertically(r,!0,i)}).map(n);return e.dispatch({changes:n,selection:s,scrollIntoView:!0,userEvent:"delete.line"}),!0};function WDe(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=ra(e).resolveInner(t),s=n.childBefore(t),r=n.childAfter(t),i;return s&&r&&s.to<=t&&r.from>=t&&(i=s.type.prop(Xs.closedBy))&&i.indexOf(r.name)>-1&&e.doc.lineAt(s.to).from==e.doc.lineAt(r.from).from&&!/\S/.test(e.sliceDoc(s.to,r.from))?{from:s.to,to:r.from}:null}const wF=nre(!1),GDe=nre(!0);function nre(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let s=t.changeByRange(r=>{let{from:i,to:o}=r,a=t.doc.lineAt(i),c=!e&&i==o&&WDe(t,i);e&&(i=o=(o<=a.to?a:t.doc.lineAt(o)).to);let u=new iC(t,{simulateBreak:i,simulateDoubleBreak:!!c}),d=fI(u,i);for(d==null&&(d=nb(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;c?{from:i,to:o}=c:i>a.from&&i<a.from+100&&!/\S/.test(a.text.slice(0,i))&&(i=a.from);let h=["",nv(t,d)];return c&&h.push(nv(t,u.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:rr.of(h)},range:Ye.cursor(i+1+h[1].length)}});return n(t.update(s,{scrollIntoView:!0,userEvent:"input"})),!0}}function xI(e,t){let n=-1;return e.changeByRange(s=>{let r=[];for(let o=s.from;o<=s.to;){let a=e.doc.lineAt(o);a.number>n&&(s.empty||s.to>a.from)&&(t(a,r,s),n=a.number),o=a.to+1}let i=e.changes(r);return{changes:r,range:Ye.range(i.mapPos(s.anchor,1),i.mapPos(s.head,1))}})}const KDe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),s=new iC(e,{overrideIndentation:i=>{let o=n[i];return o??-1}}),r=xI(e,(i,o,a)=>{let c=fI(s,i.from);if(c==null)return;/\S/.test(i.text)||(c=0);let u=/^\s*/.exec(i.text)[0],d=nv(e,c);(u!=d||a.from<i.from+u.length)&&(n[i.from]=c,o.push({from:i.from,to:i.from+u.length,insert:d}))});return r.changes.empty||t(e.update(r,{userEvent:"indent"})),!0},YDe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(xI(e,(n,s)=>{s.push({from:n.from,insert:e.facet(hI)})}),{userEvent:"input.indent"})),!0),XDe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(xI(e,(n,s)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let i=nb(r,e.tabSize),o=0,a=nv(e,Math.max(0,i-QS(e)));for(;o<r.length&&o<a.length&&r.charCodeAt(o)==a.charCodeAt(o);)o++;s.push({from:n.from+o,to:n.from+r.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),QDe=e=>(e.setTabFocusMode(),!0),JDe=[{key:"Ctrl-b",run:Rse,shift:Hse,preventDefault:!0},{key:"Ctrl-f",run:Dse,shift:qse},{key:"Ctrl-p",run:Ose,shift:Wse},{key:"Ctrl-n",run:Bse,shift:Gse},{key:"Ctrl-a",run:pDe,shift:EDe},{key:"Ctrl-e",run:gDe,shift:ADe},{key:"Ctrl-d",run:Qse},{key:"Ctrl-h",run:XA},{key:"Ctrl-k",run:PDe},{key:"Ctrl-Alt-h",run:Zse},{key:"Ctrl-o",run:$De},{key:"Ctrl-t",run:zDe},{key:"Ctrl-v",run:YA}],ZDe=[{key:"ArrowLeft",run:Rse,shift:Hse,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:oDe,shift:xDe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:fDe,shift:CDe,preventDefault:!0},{key:"ArrowRight",run:Dse,shift:qse,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:aDe,shift:vDe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:mDe,shift:TDe,preventDefault:!0},{key:"ArrowUp",run:Ose,shift:Wse,preventDefault:!0},{mac:"Cmd-ArrowUp",run:bF,shift:xF},{mac:"Ctrl-ArrowUp",run:mF,shift:pF},{key:"ArrowDown",run:Bse,shift:Gse,preventDefault:!0},{mac:"Cmd-ArrowDown",run:yF,shift:vF},{mac:"Ctrl-ArrowDown",run:YA,shift:gF},{key:"PageUp",run:mF,shift:pF},{key:"PageDown",run:YA,shift:gF},{key:"Home",run:hDe,shift:SDe,preventDefault:!0},{key:"Mod-Home",run:bF,shift:xF},{key:"End",run:dDe,shift:_De,preventDefault:!0},{key:"Mod-End",run:yF,shift:vF},{key:"Enter",run:wF,shift:wF},{key:"Mod-a",run:NDe},{key:"Backspace",run:XA,shift:XA,preventDefault:!0},{key:"Delete",run:Qse,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Zse,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:LDe,preventDefault:!0},{mac:"Mod-Backspace",run:ODe,preventDefault:!0},{mac:"Mod-Delete",run:BDe,preventDefault:!0}].concat(JDe.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),vI=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:cDe,shift:wDe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:uDe,shift:kDe},{key:"Alt-ArrowUp",run:FDe},{key:"Shift-Alt-ArrowUp",run:qDe},{key:"Alt-ArrowDown",run:HDe},{key:"Shift-Alt-ArrowDown",run:UDe},{key:"Mod-Alt-ArrowUp",run:IDe},{key:"Mod-Alt-ArrowDown",run:RDe},{key:"Escape",run:DDe},{key:"Mod-Enter",run:GDe},{key:"Alt-l",mac:"Ctrl-l",run:jDe},{key:"Mod-i",run:MDe,preventDefault:!0},{key:"Mod-[",run:XDe},{key:"Mod-]",run:YDe},{key:"Mod-Alt-\\",run:KDe},{key:"Shift-Mod-k",run:VDe},{key:"Shift-Mod-\\",run:yDe},{key:"Mod-/",run:qRe},{key:"Alt-A",run:VRe},{key:"Ctrl-m",mac:"Shift-Alt-m",run:QDe}].concat(ZDe);class sre{constructor(t,n,s,r){this.state=t,this.pos=n,this.explicit=s,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let n=ra(this.state).resolveInner(this.pos,-1);for(;n&&t.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(t){let n=this.state.doc.lineAt(this.pos),s=Math.max(n.from,this.pos-250),r=n.text.slice(s-n.from,this.pos-n.from),i=r.search(rre(t,!1));return i<0?null:{from:s+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(t,n,s){t=="abort"&&this.abortListeners&&(this.abortListeners.push(n),s&&s.onDocChange&&(this.abortOnDocChange=!0))}}function kF(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 eLe(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let i=1;i<r.length;i++)n[r[i]]=!0}let s=kF(t)+kF(n)+"*$";return[new RegExp("^"+s),new RegExp(s)]}function tLe(e){let t=e.map(r=>typeof r=="string"?{label:r}:r),[n,s]=t.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:eLe(t);return r=>{let i=r.matchBefore(s);return i||r.explicit?{from:i?i.from:r.pos,options:t,validFor:n}:null}}class _F{constructor(t,n,s,r){this.completion=t,this.source=n,this.match=s,this.score=r}}function Cp(e){return e.selection.main.from}function rre(e,t){var n;let{source:s}=e,r=t&&s[0]!="^",i=s[s.length-1]!="$";return!r&&!i?e:new RegExp(`${r?"^":""}(?:${s})${i?"$":""}`,(n=e.flags)!==null&&n!==void 0?n:e.ignoreCase?"i":"")}const ire=fh.define();function nLe(e,t,n,s){let{main:r}=e.selection,i=n-r.from,o=s-r.from;return{...e.changeByRange(a=>{if(a!=r&&n!=s&&e.sliceDoc(a.from+i,a.from+o)!=e.sliceDoc(n,s))return{range:a};let c=e.toText(t);return{changes:{from:a.from+i,to:s==r.from?a.to:a.from+o,insert:c},range:Ye.cursor(a.from+i+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const SF=new WeakMap;function sLe(e){if(!Array.isArray(e))return e;let t=SF.get(e);return t||SF.set(e,t=tLe(e)),t}const t4=rs.define(),sv=rs.define();class rLe{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<t.length;){let s=Ka(t,n),r=vu(s);this.chars.push(s);let i=t.slice(n,n+r),o=i.toUpperCase();this.folded.push(Ka(o==i?i.toLowerCase():o,0)),n+=r}this.astral=t.length!=this.chars.length}ret(t,n){return this.score=t,this.matched=n,this}match(t){if(this.pattern.length==0)return this.ret(-100,[]);if(t.length<this.pattern.length)return null;let{chars:n,folded:s,any:r,precise:i,byWord:o}=this;if(n.length==1){let y=Ka(t,0),w=vu(y),k=w==t.length?0:-100;if(y!=n[0])if(y==s[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 c=n.length,u=0;if(a<0){for(let y=0,w=Math.min(t.length,200);y<w&&u<c;){let k=Ka(t,y);(k==n[u]||k==s[u])&&(r[u++]=y),y+=vu(k)}if(u<c)return null}let d=0,h=0,m=!1,p=0,g=-1,b=-1,v=/[a-z]/.test(t),x=!0;for(let y=0,w=Math.min(t.length,200),k=0;y<w&&h<c;){let T=Ka(t,y);a<0&&(d<c&&T==n[d]&&(i[d++]=y),p<c&&(T==n[p]||T==s[p]?(p==0&&(g=y),b=y+1,p++):p=0));let _,C=T<255?T>=48&&T<=57||T>=97&&T<=122?2:T>=65&&T<=90?1:0:(_=UM(T))!=_.toLowerCase()?1:_!=_.toUpperCase()?2:0;(!y||C==1&&v||k==0&&C!=0)&&(n[h]==T||s[h]==T&&(m=!0)?o[h++]=y:o.length&&(x=!1)),k=C,y+=vu(T)}return h==c&&o[0]==0&&x?this.result(-100+(m?-200:0),o,t):p==c&&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==c?this.ret(-900-t.length,[g,b]):h==c?this.result(-100+(m?-200:0)+-700+(x?0:-1100),o,t):n.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,t)}result(t,n,s){let r=[],i=0;for(let o of n){let a=o+(this.astral?vu(Ka(s,o)):1);i&&r[i-1]==o?r[i-1]=a:(r[i++]=o,r[i++]=a)}return this.ret(t-s.length,r)}}class iLe{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length<this.pattern.length)return null;let n=t.slice(0,this.pattern.length),s=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return s==null?null:(this.matched=[0,n.length],this.score=s+(t.length==this.pattern.length?0:-100),this)}}const ko=on.define({combine(e){return Yu(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:oLe,filterStrict:!1,compareCompletions:(t,n)=>(t.sortText||t.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,n)=>t&&n,closeOnBlur:(t,n)=>t&&n,icons:(t,n)=>t&&n,tooltipClass:(t,n)=>s=>CF(t(s),n(s)),optionClass:(t,n)=>s=>CF(t(s),n(s)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function CF(e,t){return e?t?e+" "+t:e:t}function oLe(e,t,n,s,r,i){let o=e.textDirection==Rr.RTL,a=o,c=!1,u="top",d,h,m=t.left-r.left,p=r.right-t.right,g=s.right-s.left,b=s.bottom-s.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(r.top,Math.min(n.top,r.bottom-b))-t.top,h=Math.min(400,a?m:p);else{c=!0,h=Math.min(400,(o?t.right:r.right-t.left)-30);let y=r.bottom-t.bottom;y>=b||y>t.top?d=n.bottom-t.top:(u="bottom",d=t.bottom-n.top)}let v=(t.bottom-t.top)/i.offsetHeight,x=(t.right-t.left)/i.offsetWidth;return{style:`${u}: ${d/v}px; max-width: ${h/x}px`,class:"cm-completionInfo-"+(c?o?"left-narrow":"right-narrow":a?"left":"right")}}const wI=rs.define();function aLe(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(n){let s=document.createElement("div");return s.classList.add("cm-completionIcon"),n.type&&s.classList.add(...n.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),s.setAttribute("aria-hidden","true"),s},position:20}),t.push({render(n,s,r,i){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.label,c=0;for(let u=0;u<i.length;){let d=i[u++],h=i[u++];d>c&&o.appendChild(document.createTextNode(a.slice(c,d)));let m=o.appendChild(document.createElement("span"));m.appendChild(document.createTextNode(a.slice(d,h))),m.className="cm-completionMatchedText",c=h}return c<a.length&&o.appendChild(document.createTextNode(a.slice(c))),o},position:50},{render(n){if(!n.detail)return null;let s=document.createElement("span");return s.className="cm-completionDetail",s.textContent=n.detail,s},position:80}),t.sort((n,s)=>n.position-s.position).map(n=>n.render)}function F6(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let r=Math.floor(t/n);return{from:r*n,to:(r+1)*n}}let s=Math.ceil((e-t)/n);return{from:e-s*n,to:e-(s-1)*n}}class lLe{constructor(t,n,s){this.view=t,this.stateField=n,this.applyCompletion=s,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:c=>this.placeInfo(c),key:this},this.space=null,this.currentClass="";let r=t.state.field(n),{options:i,selected:o}=r.open,a=t.state.facet(ko);this.optionContent=aLe(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=F6(i.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",c=>{let{options:u}=t.state.field(n).open;for(let d=c.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]]),c.preventDefault();return}if(c.target==this.list){let d=this.list.classList.contains("cm-completionListIncompleteTop")&&c.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&c.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;d!=null&&(t.dispatch({effects:wI.of(d)}),c.preventDefault())}}),this.dom.addEventListener("focusout",c=>{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet(ko).closeOnBlur&&c.relatedTarget!=t.contentDOM&&t.dispatch({effects:sv.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(t,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),s!=r){let{options:i,selected:o,disabled:a}=s.open;(!r.open||r.open.options!=i)&&(this.range=F6(i.length,o,t.state.facet(ko).maxRenderedOptions),this.showOptions(i,s.id)),this.updateSel(),a!=((n=r.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(t){let n=this.tooltipClass(t);if(n!=this.currentClass){for(let s of this.currentClass.split(" "))s&&this.dom.classList.remove(s);for(let s of n.split(" "))s&&this.dom.classList.add(s);this.currentClass=n}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),n=t.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=F6(n.options.length,n.selected,this.view.state.facet(ko).maxRenderedOptions),this.showOptions(n.options,t.id));let s=this.updateSelectedOption(n.selected);if(s){this.destroyInfo();let{completion:r}=n.options[n.selected],{info:i}=r;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(r);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(a,r)}).catch(a=>Qa(this.view.state,a,"completion info")):(this.addInfoPane(o,r),s.setAttribute("aria-describedby",this.info.id))}}addInfoPane(t,n){this.destroyInfo();let s=this.info=document.createElement("div");if(s.className="cm-tooltip cm-completionInfo",s.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),t.nodeType!=null)s.appendChild(t),this.infoDestroy=null;else{let{dom:r,destroy:i}=t;s.appendChild(r),this.infoDestroy=i||null}this.dom.appendChild(s),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let n=null;for(let s=this.list.firstChild,r=this.range.from;s;s=s.nextSibling,r++)s.nodeName!="LI"||!s.id?r--:r==t?s.hasAttribute("aria-selected")||(s.setAttribute("aria-selected","true"),n=s):s.hasAttribute("aria-selected")&&(s.removeAttribute("aria-selected"),s.removeAttribute("aria-describedby"));return n&&uLe(this.list,n),n}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let n=this.dom.getBoundingClientRect(),s=this.info.getBoundingClientRect(),r=t.getBoundingClientRect(),i=this.space;if(!i){let o=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return r.top>Math.min(i.bottom,n.bottom)-10||r.bottom<Math.max(i.top,n.top)+10?null:this.view.state.facet(ko).positionInfo(this.view,n,r,s,i,this.dom)}placeInfo(t){this.info&&(t?(t.style&&(this.info.style.cssText=t.style),this.info.className="cm-tooltip cm-completionInfo "+(t.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(t,n,s){const r=document.createElement("ul");r.id=n,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),r.addEventListener("mousedown",o=>{o.target==r&&o.preventDefault()});let i=null;for(let o=s.from;o<s.to;o++){let{completion:a,match:c}=t[o],{section:u}=a;if(u){let m=typeof u=="string"?u:u.name;if(m!=i&&(o>s.from||s.from==0))if(i=m,typeof u!="string"&&u.header)r.appendChild(u.header(u));else{let p=r.appendChild(document.createElement("completion-section"));p.textContent=m}}const d=r.appendChild(document.createElement("li"));d.id=n+"-"+o,d.setAttribute("role","option");let h=this.optionClass(a);h&&(d.className=h);for(let m of this.optionContent){let p=m(a,this.view.state,this.view,c);p&&d.appendChild(p)}}return s.from&&r.classList.add("cm-completionListIncompleteTop"),s.to<t.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function cLe(e,t){return n=>new lLe(n,e,t)}function uLe(e,t){let n=e.getBoundingClientRect(),s=t.getBoundingClientRect(),r=n.height/e.offsetHeight;s.top<n.top?e.scrollTop-=(n.top-s.top)/r:s.bottom>n.bottom&&(e.scrollTop+=(s.bottom-n.bottom)/r)}function TF(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function dLe(e,t){let n=[],s=null,r=null,i=d=>{n.push(d);let{section:h}=d.completion;if(h){s||(s=[]);let m=typeof h=="string"?h:h.name;s.some(p=>p.name==m)||s.push(typeof h=="string"?{name:m}:h)}},o=t.facet(ko);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 _F(m,d.source,h?h(m):[],1e9-n.length));else{let m=t.sliceDoc(d.from,d.to),p,g=o.filterStrict?new iLe(m):new rLe(m);for(let b of d.result.options)if(p=g.match(b.label)){let v=b.displayLabel?h?h(b,p.matched):[]:p.matched,x=p.score+(b.boost||0);if(i(new _F(b,d.source,v,x)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:y}=b.section;r||(r=Object.create(null)),r[y]=Math.max(x,r[y]||-1e9)}}}}if(s){let d=Object.create(null),h=0,m=(p,g)=>(p.rank==="dynamic"&&g.rank==="dynamic"?r[g.name]-r[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 s.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=[],c=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;!c||c.label!=h.label||c.detail!=h.detail||c.type!=null&&h.type!=null&&c.type!=h.type||c.apply!=h.apply||c.boost!=h.boost?a.push(d):TF(d.completion)>TF(c)&&(a[a.length-1]=d),c=d.completion}return a}class gg{constructor(t,n,s,r,i,o){this.options=t,this.attrs=n,this.tooltip=s,this.timestamp=r,this.selected=i,this.disabled=o}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new gg(this.options,EF(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,s,r,i,o){if(r&&!o&&t.some(u=>u.isPending))return r.setDisabled();let a=dLe(t,n);if(!a.length)return r&&t.some(u=>u.isPending)?r.setDisabled():null;let c=n.facet(ko).selectOnOpen?0:-1;if(r&&r.selected!=c&&r.selected!=-1){let u=r.options[r.selected].completion;for(let d=0;d<a.length;d++)if(a[d].completion==u){c=d;break}}return new gg(a,EF(s,c),{pos:t.reduce((u,d)=>d.hasResult()?Math.min(u,d.from):u,1e8),create:bLe,above:i.aboveCursor},r?r.timestamp:Date.now(),c,!1)}map(t){return new gg(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new gg(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class n4{constructor(t,n,s){this.active=t,this.id=n,this.open=s}static start(){return new n4(pLe,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,s=n.facet(ko),i=(s.override||n.languageDataAt("autocomplete",Cp(n)).map(sLe)).map(c=>(this.active.find(d=>d.source==c)||new fc(c,this.active.some(d=>d.state!=0)?1:0)).update(t,s));i.length==this.active.length&&i.every((c,u)=>c==this.active[u])&&(i=this.active);let o=this.open,a=t.effects.some(c=>c.is(kI));o&&t.docChanged&&(o=o.map(t.changes)),t.selection||i.some(c=>c.hasResult()&&t.changes.touchesRange(c.from,c.to))||!hLe(i,this.active)||a?o=gg.build(i,n,this.id,o,s,a):o&&o.disabled&&!i.some(c=>c.isPending)&&(o=null),!o&&i.every(c=>!c.isPending)&&i.some(c=>c.hasResult())&&(i=i.map(c=>c.hasResult()?new fc(c.source,0):c));for(let c of t.effects)c.is(wI)&&(o=o&&o.setSelected(c.value,this.id));return i==this.active&&o==this.open?this:new n4(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?fLe:mLe}}function hLe(e,t){if(e==t)return!0;for(let n=0,s=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;s<t.length&&!t[s].hasResult();)s++;let r=n==e.length,i=s==t.length;if(r||i)return r==i;if(e[n++].result!=t[s++].result)return!1}}const fLe={"aria-autocomplete":"list"},mLe={};function EF(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const pLe=[];function ore(e,t){if(e.isUserEvent("input.complete")){let s=e.annotation(ire);if(s&&t.activateOnCompletion(s))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class fc{constructor(t,n,s=!1){this.source=t,this.state=n,this.explicit=s}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let s=ore(t,n),r=this;(s&8||s&16&&this.touches(t))&&(r=new fc(r.source,0)),s&4&&r.state==0&&(r=new fc(this.source,1)),r=r.updateFor(t,s);for(let i of t.effects)if(i.is(t4))r=new fc(r.source,1,i.value);else if(i.is(sv))r=new fc(r.source,0);else if(i.is(kI))for(let o of i.value)o.source==r.source&&(r=o);return r}updateFor(t,n){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(Cp(t.state))}}class $g extends fc{constructor(t,n,s,r,i,o){super(t,3,n),this.limit=s,this.result=r,this.from=i,this.to=o}hasResult(){return!0}updateFor(t,n){var s;if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),a=Cp(t.state);if(a>o||!r||n&2&&(Cp(t.startState)==this.from||a<this.limit))return new fc(this.source,n&4?1:0);let c=t.changes.mapPos(this.limit);return gLe(r.validFor,t.state,i,o)?new $g(this.source,this.explicit,c,r,i,o):r.update&&(r=r.update(r,i,o,new sre(t.state,a,!1)))?new $g(this.source,this.explicit,c,r,r.from,(s=r.to)!==null&&s!==void 0?s:Cp(t.state)):new fc(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 $g(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new fc(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function gLe(e,t,n,s){if(!e)return!1;let r=t.sliceDoc(n,s);return typeof e=="function"?e(r,n,s,t):rre(e,!0).test(r)}const kI=rs.define({map(e,t){return e.map(n=>n.map(t))}}),Sa=Ho.define({create(){return n4.start()},update(e,t){return e.update(t)},provide:e=>[aI.from(e,t=>t.tooltip),Nt.contentAttributes.from(e,t=>t.attrs)]});function _I(e,t){const n=t.completion.apply||t.completion.label;let s=e.state.field(Sa).active.find(r=>r.source==t.source);return s instanceof $g?(typeof n=="string"?e.dispatch({...nLe(e.state,n,s.from,s.to),annotations:ire.of(t.completion)}):n(e,t.completion,s.from,s.to),!0):!1}const bLe=cLe(Sa,_I);function lf(e,t="option"){return n=>{let s=n.state.field(Sa,!1);if(!s||!s.open||s.open.disabled||Date.now()-s.open.timestamp<n.state.facet(ko).interactionDelay)return!1;let r=1,i;t=="page"&&(i=ese(n,s.open.tooltip))&&(r=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:o}=s.open.options,a=s.open.selected>-1?s.open.selected+r*(e?1:-1):e?0:o-1;return a<0?a=t=="page"?0:o-1:a>=o&&(a=t=="page"?o-1:0),n.dispatch({effects:wI.of(a)}),!0}}const are=e=>{let t=e.state.field(Sa,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(ko).interactionDelay?!1:_I(e,t.open.options[t.open.selected])},a2=e=>e.state.field(Sa,!1)?(e.dispatch({effects:t4.of(!0)}),!0):!1,l2=e=>{let t=e.state.field(Sa,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:sv.of(null)}),!0)};class yLe{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const xLe=50,vLe=1e3,wLe=ai.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(Sa).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Sa),n=e.state.facet(ko);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Sa)==t)return;let s=e.transactions.some(i=>{let o=ore(i,n);return o&8||(i.selection||i.docChanged)&&!(o&3)});for(let i=0;i<this.running.length;i++){let o=this.running[i];if(s||o.context.abortOnDocChange&&e.docChanged||o.updates.length+e.transactions.length>xLe&&Date.now()-o.time>vLe){for(let a of o.context.abortListeners)try{a()}catch(c){Qa(this.view.state,c)}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(t4)))&&(this.pendingStart=!0);let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(i=>i.isPending&&!this.running.some(o=>o.active.source==i.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let i of e.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(Sa);for(let n of t.active)n.isPending&&!this.running.some(s=>s.active.source==n.source)&&this.startQuery(n);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ko).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=Cp(t),s=new sre(t,n,e.explicit,this.view),r=new yLe(e,s);this.running.push(r),Promise.resolve(e.source(s)).then(i=>{r.context.aborted||(r.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:sv.of(null)}),Qa(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(ko).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(ko),s=this.view.state.field(Sa);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let a=Cp(i.updates.length?i.updates[0].startState:this.view.state),c=Math.min(a,i.done.from+(i.active.explicit?0:1)),u=new $g(i.active.source,i.active.explicit,c,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=s.active.find(a=>a.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new fc(i.active.source,0);for(let c of i.updates)a=a.update(c,n);a.isPending||t.push(a)}else this.startQuery(o)}(t.length||s.open&&s.open.disabled)&&this.view.dispatch({effects:kI.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Sa,!1);if(t&&t.tooltip&&this.view.state.facet(ko).closeOnBlur){let n=t.open&&ese(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:sv.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:t4.of(!1)}),20),this.composing=0}}}),kLe=typeof navigator=="object"&&/Win/.test(navigator.platform),_Le=gm.highest(Nt.domEventHandlers({keydown(e,t){let n=t.state.field(Sa,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(kLe&&e.altKey)||e.metaKey)return!1;let s=n.open.options[n.open.selected],r=n.active.find(o=>o.source==s.source),i=s.completion.commitCharacters||r.result.commitCharacters;return i&&i.indexOf(e.key)>-1&&_I(t,s),!1}})),SLe=Nt.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"}}}),rv={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},mp=rs.define({map(e,t){let n=t.mapPos(e,-1,Ta.TrackAfter);return n??void 0}}),SI=new class extends Wf{};SI.startSide=1;SI.endSide=-1;const lre=Ho.define({create(){return Rs.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:s=>s>=n.from&&s<=n.to})}for(let n of t.effects)n.is(mp)&&(e=e.update({add:[SI.range(n.value,n.value+1)]}));return e}});function CLe(){return[ELe,lre]}const H6="()[]{}<>«»»«［］｛｝";function cre(e){for(let t=0;t<H6.length;t+=2)if(H6.charCodeAt(t)==e)return H6.charAt(t+1);return UM(e<128?e:e+1)}function ure(e,t){return e.languageDataAt("closeBrackets",t)[0]||rv}const TLe=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),ELe=Nt.inputHandler.of((e,t,n,s)=>{if((TLe?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let r=e.state.selection.main;if(s.length>2||s.length==2&&vu(Ka(s,0))==1||t!=r.from||n!=r.to)return!1;let i=jLe(e.state,s);return i?(e.dispatch(i),!0):!1}),ALe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let s=ure(e,e.selection.main.head).brackets||rv.brackets,r=null,i=e.changeByRange(o=>{if(o.empty){let a=MLe(e.doc,o.head);for(let c of s)if(c==a&&hC(e.doc,o.head)==cre(Ka(c,0)))return{changes:{from:o.head-c.length,to:o.head+c.length},range:Ye.cursor(o.head-c.length)}}return{range:r=o}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},NLe=[{key:"Backspace",run:ALe}];function jLe(e,t){let n=ure(e,e.selection.main.head),s=n.brackets||rv.brackets;for(let r of s){let i=cre(Ka(r,0));if(t==r)return i==r?DLe(e,r,s.indexOf(r+r+r)>-1,n):ILe(e,r,i,n.before||rv.before);if(t==i&&dre(e,e.selection.main.from))return RLe(e,r,i)}return null}function dre(e,t){let n=!1;return e.field(lre).between(0,e.doc.length,s=>{s==t&&(n=!0)}),n}function hC(e,t){let n=e.sliceString(t,t+2);return n.slice(0,vu(Ka(n,0)))}function MLe(e,t){let n=e.sliceString(t-2,t);return vu(Ka(n,0))==n.length?n:n.slice(1)}function ILe(e,t,n,s){let r=null,i=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:n,from:o.to}],effects:mp.of(o.to+t.length),range:Ye.range(o.anchor+t.length,o.head+t.length)};let a=hC(e.doc,o.head);return!a||/\s/.test(a)||s.indexOf(a)>-1?{changes:{insert:t+n,from:o.head},effects:mp.of(o.head+t.length),range:Ye.cursor(o.head+t.length)}:{range:r=o}});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function RLe(e,t,n){let s=null,r=e.changeByRange(i=>i.empty&&hC(e.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ye.cursor(i.head+n.length)}:s={range:i});return s?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function DLe(e,t,n,s){let r=s.stringPrefixes||rv.stringPrefixes,i=null,o=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:t,from:a.to}],effects:mp.of(a.to+t.length),range:Ye.range(a.anchor+t.length,a.head+t.length)};let c=a.head,u=hC(e.doc,c),d;if(u==t){if(AF(e,c))return{changes:{insert:t+t,from:c},effects:mp.of(c+t.length),range:Ye.cursor(c+t.length)};if(dre(e,c)){let m=n&&e.sliceDoc(c,c+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:c,to:c+m.length,insert:m},range:Ye.cursor(c+m.length)}}}else{if(n&&e.sliceDoc(c-2*t.length,c)==t+t&&(d=NF(e,c-2*t.length,r))>-1&&AF(e,d))return{changes:{insert:t+t+t+t,from:c},effects:mp.of(c+t.length),range:Ye.cursor(c+t.length)};if(e.charCategorizer(c)(u)!=ii.Word&&NF(e,c,r)>-1&&!LLe(e,c,t,r))return{changes:{insert:t+t,from:c},effects:mp.of(c+t.length),range:Ye.cursor(c+t.length)}}return{range:i=a}});return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function AF(e,t){let n=ra(e).resolveInner(t+1);return n.parent&&n.from==t}function LLe(e,t,n,s){let r=ra(e).resolveInner(t,-1),i=s.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=e.sliceDoc(r.from,Math.min(r.to,r.from+n.length+i)),c=a.indexOf(n);if(!c||c>-1&&s.indexOf(a.slice(0,c))>-1){let d=r.firstChild;for(;d&&d.from==r.from&&d.to-d.from>n.length+c;){if(e.sliceDoc(d.to-n.length,d.to)==n)return!1;d=d.firstChild}return!0}let u=r.to==t&&r.parent;if(!u)break;r=u}return!1}function NF(e,t,n){let s=e.charCategorizer(t);if(s(e.sliceDoc(t-1,t))!=ii.Word)return t;for(let r of n){let i=t-r.length;if(e.sliceDoc(i,t)==r&&s(e.sliceDoc(i-1,i))!=ii.Word)return i}return-1}function hre(e={}){return[_Le,Sa,ko.of(e),wLe,PLe,SLe]}const fre=[{key:"Ctrl-Space",run:a2},{mac:"Alt-`",run:a2},{mac:"Alt-i",run:a2},{key:"Escape",run:l2},{key:"ArrowDown",run:lf(!0)},{key:"ArrowUp",run:lf(!1)},{key:"PageDown",run:lf(!0,"page")},{key:"PageUp",run:lf(!1,"page")},{key:"Enter",run:are}],PLe=gm.highest(w1.computeN([ko],e=>e.facet(ko).defaultKeymap?[fre]:[]));function cl(e){let t=e.field(Sa,!1);return t&&t.active.some(n=>n.isPending)?"pending":t&&t.active.some(n=>n.state!=0)?"active":null}const jF=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class S1{constructor(t,n,s=0,r=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(s,r),this.bufferStart=s,this.normalize=i?a=>i(jF(a)):jF,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 Ka(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=UM(t),s=this.bufferStart+this.bufferPos;this.bufferPos+=vu(t);let r=this.normalize(n);if(r.length)for(let i=0,o=s,a=!0;;i++){let c=r.charCodeAt(i),u=this.match(c,o,a,this.bufferPos+this.bufferStart,i==r.length-1);if(u)return this.value=u,this;if(i==r.length-1)break;a&&i<n.length&&n.charCodeAt(i)==c?o++:a=!1}}}match(t,n,s,r,i){let o=null;for(let a=0;a<this.matches.length;){let c=this.matches[a],u=!1;this.query.charCodeAt(c.index)==t&&(c.index==this.query.length-1?o={from:c.from,to:r,precise:i&&c.precise}:(c.index++,u=!0)),u?a++:this.matches.splice(a,1)}return this.query.charCodeAt(0)==t&&(this.query.length==1?o={from:n,to:r,precise:s&&i}:this.matches.push({from:n,index:1,precise:s})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(S1.prototype[Symbol.iterator]=function(){return this});const mre={from:-1,to:-1,match:/.*/.exec(""),precise:!0},CI="gm"+(/x/.unicode==null?"":"u");class pre{constructor(t,n,s,r=0,i=t.length){if(this.text=t,this.to=i,this.curLine="",this.done=!1,this.value=mre,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new gre(t,n,s,r,i);this.re=new RegExp(n,CI+(s!=null&&s.ignoreCase?"i":"")),this.test=s==null?void 0:s.test,this.iter=t.iter();let o=t.lineAt(r);this.curLineStart=o.from,this.matchPos=s4(t,r),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 s=this.curLineStart+n.index,r=s+n[0].length;if(this.matchPos=s4(this.text,r+(s==r?1:0)),s==this.curLineStart+this.curLine.length&&this.nextLine(),(s<r||s>this.value.to)&&(!this.test||this.test(s,r,n)))return this.value={from:s,to:r,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 q6=new WeakMap;class zg{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,s){let r=q6.get(t);if(!r||r.from>=s||r.to<=n){let a=new zg(n,t.sliceString(n,s));return q6.set(t,a),a}if(r.from==n&&r.to==s)return r;let{text:i,from:o}=r;return o>n&&(i=t.sliceString(n,o)+i,o=n),r.to<s&&(i+=t.sliceString(r.to,s)),q6.set(t,new zg(o,i)),new zg(n,i.slice(n-o,s-o))}}class gre{constructor(t,n,s,r,i){this.text=t,this.to=i,this.done=!1,this.value=mre,this.matchPos=s4(t,r),this.re=new RegExp(n,CI+(s!=null&&s.ignoreCase?"i":"")),this.test=s==null?void 0:s.test,this.flat=zg.get(t,r,this.chunkEnd(r+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 s=this.flat.from+n.index,r=s+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(s,r,n)))return this.value={from:s,to:r,precise:!0,match:n},this.matchPos=s4(this.text,r+(s==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=zg.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(pre.prototype[Symbol.iterator]=gre.prototype[Symbol.iterator]=function(){return this});function OLe(e){try{return new RegExp(e,CI),!0}catch{return!1}}function s4(e,t){if(t>=e.length)return t;let n=e.lineAt(t),s;for(;t<n.to&&(s=n.text.charCodeAt(t-n.from))>=56320&&s<57344;)t++;return t}const BLe=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:s,result:r}=vIe(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return r.then(i=>{let o=i&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(i.elements.line.value);if(!o){e.dispatch({effects:s});return}let a=t.doc.lineAt(t.selection.main.head),[,c,u,d,h]=o,m=d?+d.slice(1):0,p=u?+u:a.number;if(u&&h){let v=p/100;c&&(v=v*(c=="-"?-1:1)+a.number/t.doc.lines),p=Math.round(t.doc.lines*v)}else u&&c&&(p=p*(c=="-"?-1:1)+a.number);let g=t.doc.line(Math.max(1,Math.min(t.doc.lines,p))),b=Ye.cursor(g.from+Math.max(0,Math.min(m,g.length)));e.dispatch({effects:[s,Nt.scrollIntoView(b.from,{y:"center"})],selection:b})}),!0},$Le={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},zLe=on.define({combine(e){return Yu(e,$Le,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function FLe(e){return[WLe,VLe]}const HLe=vn.mark({class:"cm-selectionMatch"}),qLe=vn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function MF(e,t,n,s){return(n==0||e(t.sliceDoc(n-1,n))!=ii.Word)&&(s==t.doc.length||e(t.sliceDoc(s,s+1))!=ii.Word)}function ULe(e,t,n,s){return e(t.sliceDoc(n,n+1))==ii.Word&&e(t.sliceDoc(s-1,s))==ii.Word}const VLe=ai.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(zLe),{state:n}=e,s=n.selection;if(s.ranges.length>1)return vn.none;let r=s.main,i,o=null;if(r.empty){if(!t.highlightWordAroundCursor)return vn.none;let c=n.wordAt(r.head);if(!c)return vn.none;o=n.charCategorizer(r.head),i=n.sliceDoc(c.from,c.to)}else{let c=r.to-r.from;if(c<t.minSelectionLength||c>200)return vn.none;if(t.wholeWords){if(i=n.sliceDoc(r.from,r.to),o=n.charCategorizer(r.head),!(MF(o,n,r.from,r.to)&&ULe(o,n,r.from,r.to)))return vn.none}else if(i=n.sliceDoc(r.from,r.to),!i)return vn.none}let a=[];for(let c of e.visibleRanges){let u=new S1(n.doc,i,c.from,c.to);for(;!u.next().done;){let{from:d,to:h}=u.value;if((!o||MF(o,n,d,h))&&(r.empty&&d<=r.from&&h>=r.to?a.push(qLe.range(d,h)):(d>=r.to||h<=r.from)&&a.push(HLe.range(d,h)),a.length>t.maxMatches))return vn.none}}return vn.set(a)}},{decorations:e=>e.decorations}),WLe=Nt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),GLe=({state:e,dispatch:t})=>{let{selection:n}=e,s=Ye.create(n.ranges.map(r=>e.wordAt(r.head)||Ye.cursor(r.head)),n.mainIndex);return s.eq(n)?!1:(t(e.update({selection:s})),!0)};function KLe(e,t){let{main:n,ranges:s}=e.selection,r=e.wordAt(n.head),i=r&&r.from==n.from&&r.to==n.to;for(let o=!1,a=new S1(e.doc,t,s[s.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new S1(e.doc,t,0,Math.max(0,s[s.length-1].from-1)),o=!0}else{if(o&&s.some(c=>c.from==a.value.from))continue;if(i){let c=e.wordAt(a.value.from);if(!c||c.from!=a.value.from||c.to!=a.value.to)continue}return a.value}}const YLe=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(i=>i.from===i.to))return GLe({state:e,dispatch:t});let s=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(i=>e.sliceDoc(i.from,i.to)!=s))return!1;let r=KLe(e,s);return r?(t(e.update({selection:e.selection.addRange(Ye.range(r.from,r.to),!1),effects:Nt.scrollIntoView(r.to)})),!0):!1},rb=on.define({combine(e){return Yu(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new cPe(t),scrollToMatch:t=>Nt.scrollIntoView(t)})}});class bre{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||OLe(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,s)=>s=="n"?`
`:s=="r"?"\r":s=="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 tPe(this):new JLe(this)}getCursor(t,n=0,s){let r=t.doc?t:Ks.create({doc:t});return s==null&&(s=r.doc.length),this.regexp?J0(this,r,n,s):Q0(this,r,n,s)}}class yre{constructor(t){this.spec=t}}function XLe(e,t,n){return(s,r,i,o)=>{if(n&&!n(s,r,i,o))return!1;let a=s>=o&&r<=o+i.length?i.slice(s-o,r-o):t.doc.sliceString(s,r);return e(a,t,s,r)}}function Q0(e,t,n,s){let r;return e.wholeWord&&(r=QLe(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(r=XLe(e.test,t,r)),new S1(t.doc,e.unquoted,n,s,e.caseSensitive?void 0:i=>i.toLowerCase(),r)}function QLe(e,t){return(n,s,r,i)=>((i>n||i+r.length<s)&&(i=Math.max(0,n-2),r=e.sliceString(i,Math.min(e.length,s+2))),(t(r4(r,n-i))!=ii.Word||t(i4(r,n-i))!=ii.Word)&&(t(i4(r,s-i))!=ii.Word||t(r4(r,s-i))!=ii.Word))}class JLe extends yre{constructor(t){super(t)}nextMatch(t,n,s){let r=Q0(this.spec,t,s,t.doc.length).nextOverlapping();if(r.done){let i=Math.min(t.doc.length,n+this.spec.unquoted.length);r=Q0(this.spec,t,0,i).nextOverlapping()}return r.done||r.value.from==n&&r.value.to==s?null:r.value}prevMatchInRange(t,n,s){for(let r=s;;){let i=Math.max(n,r-1e4-this.spec.unquoted.length),o=Q0(this.spec,t,i,r),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(i==n)return null;r-=1e4}}prevMatch(t,n,s){let r=this.prevMatchInRange(t,0,n);return r||(r=this.prevMatchInRange(t,Math.max(0,s-this.spec.unquoted.length),t.doc.length)),r&&(r.from!=n||r.to!=s)?r:null}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,n){let s=Q0(this.spec,t,0,t.doc.length),r=[];for(;!s.next().done;){if(r.length>=n)return null;r.push(s.value)}return r}highlight(t,n,s,r){let i=Q0(this.spec,t,Math.max(0,n-this.spec.unquoted.length),Math.min(s+this.spec.unquoted.length,t.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}function ZLe(e,t,n){return(s,r,i)=>(!n||n(s,r,i))&&e(i[0],t,s,r)}function J0(e,t,n,s){let r;return e.wholeWord&&(r=ePe(t.charCategorizer(t.selection.main.head))),e.test&&(r=ZLe(e.test,t,r)),new pre(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:r},n,s)}function r4(e,t){return e.slice(_o(e,t,!1),t)}function i4(e,t){return e.slice(t,_o(e,t))}function ePe(e){return(t,n,s)=>!s[0].length||(e(r4(s.input,s.index))!=ii.Word||e(i4(s.input,s.index))!=ii.Word)&&(e(i4(s.input,s.index+s[0].length))!=ii.Word||e(r4(s.input,s.index+s[0].length))!=ii.Word)}class tPe extends yre{nextMatch(t,n,s){let r=J0(this.spec,t,s,t.doc.length).next();return r.done&&(r=J0(this.spec,t,0,n).next()),r.done?null:r.value}prevMatchInRange(t,n,s){for(let r=1;;r++){let i=Math.max(n,s-r*1e4),o=J0(this.spec,t,i,s),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,s){return this.prevMatchInRange(t,0,n)||this.prevMatchInRange(t,s,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,s)=>{if(s=="&")return t.match[0];if(s=="$")return"$";for(let r=s.length;r>0;r--){let i=+s.slice(0,r);if(i>0&&i<t.match.length)return t.match[i]+s.slice(r)}return n})}matchAll(t,n){let s=J0(this.spec,t,0,t.doc.length),r=[];for(;!s.next().done;){if(r.length>=n)return null;r.push(s.value)}return r}highlight(t,n,s,r){let i=J0(this.spec,t,Math.max(0,n-250),Math.min(s+250,t.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}const iv=rs.define(),TI=rs.define(),Tf=Ho.define({create(e){return new U6(QA(e).create(),null)},update(e,t){for(let n of t.effects)n.is(iv)?e=new U6(n.value.create(),e.panel):n.is(TI)&&(e=new U6(e.query,n.value?EI:null));return e},provide:e=>Zx.from(e,t=>t.panel)});class U6{constructor(t,n){this.query=t,this.panel=n}}const nPe=vn.mark({class:"cm-searchMatch"}),sPe=vn.mark({class:"cm-searchMatch cm-searchMatch-selected"}),rPe=ai.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Tf))}update(e){let t=e.state.field(Tf);(t!=e.startState.field(Tf)||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,s=new Ou;for(let r=0,i=n.visibleRanges,o=i.length;r<o;r++){let{from:a,to:c}=i[r];for(;r<o-1&&c>i[r+1].from-2*250;)c=i[++r].to;e.highlight(n.state,a,c,(u,d)=>{let h=n.state.selection.ranges.some(m=>m.from==u&&m.to==d);s.add(u,d,h?sPe:nPe)})}return s.finish()}},{decorations:e=>e.decorations});function ew(e){return t=>{let n=t.state.field(Tf,!1);return n&&n.query.spec.valid?e(t,n):wre(t)}}const o4=ew((e,{query:t})=>{let{to:n}=e.state.selection.main,s=t.nextMatch(e.state,n,n);if(!s)return!1;let r=Ye.single(s.from,s.to),i=e.state.facet(rb);return e.dispatch({selection:r,effects:[AI(e,s),i.scrollToMatch(r.main,e)],userEvent:"select.search"}),vre(e),!0}),a4=ew((e,{query:t})=>{let{state:n}=e,{from:s}=n.selection.main,r=t.prevMatch(n,s,s);if(!r)return!1;let i=Ye.single(r.from,r.to),o=e.state.facet(rb);return e.dispatch({selection:i,effects:[AI(e,r),o.scrollToMatch(i.main,e)],userEvent:"select.search"}),vre(e),!0}),iPe=ew((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:Ye.create(n.map(s=>Ye.range(s.from,s.to))),userEvent:"select.search.matches"}),!0)}),oPe=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:s,to:r}=n.main,i=[],o=0;for(let a=new S1(e.doc,e.sliceDoc(s,r));!a.next().done;){if(i.length>1e3)return!1;a.value.from==s&&(o=i.length),i.push(Ye.range(a.value.from,a.value.to))}return t(e.update({selection:Ye.create(i,o),userEvent:"select.search.matches"})),!0},IF=ew((e,{query:t})=>{let{state:n}=e,{from:s,to:r}=n.selection.main;if(n.readOnly)return!1;let i=t.nextMatch(n,s,s);if(!i)return!1;let o=i,a=[],c,u,d=[];o.precise?o.from==s&&o.to==r&&(u=n.toText(t.getReplacement(o)),a.push({from:o.from,to:o.to,insert:u}),d.push(Nt.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(s).number)+"."))):o=t.nextMatch(n,o.from,o.to);let h=e.state.changes(a);return o&&(c=Ye.single(o.from,o.to).map(h),d.push(AI(e,o)),d.push(n.facet(rb).scrollToMatch(c.main,e))),e.dispatch({changes:h,selection:c,effects:d,userEvent:"input.replace"}),!0}),aPe=ew((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:i,to:o,precise:a}=r;a&&n.push({from:i,to:o,insert:t.getReplacement(r)})}if(!n.length)return!1;let s=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:Nt.announce.of(s),userEvent:"input.replace.all"}),!0});function EI(e){return e.state.facet(rb).createPanel(e)}function QA(e,t){var n,s,r,i,o;let a=e.selection.main,c=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!c)return t;let u=e.facet(rb);return new bre({search:((n=t==null?void 0:t.literal)!==null&&n!==void 0?n:u.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(s=t==null?void 0:t.caseSensitive)!==null&&s!==void 0?s:u.caseSensitive,literal:(r=t==null?void 0:t.literal)!==null&&r!==void 0?r: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 xre(e){let t=lI(e,EI);return t&&t.dom.querySelector("[main-field]")}function vre(e){let t=xre(e);t&&t==e.root.activeElement&&t.select()}const wre=e=>{let t=e.state.field(Tf,!1);if(t&&t.panel){let n=xre(e);if(n&&n!=e.root.activeElement){let s=QA(e.state,t.query.spec);s.valid&&e.dispatch({effects:iv.of(s)}),n.focus(),n.select()}}else e.dispatch({effects:[TI.of(!0),t?iv.of(QA(e.state,t.query.spec)):rs.appendConfig.of(dPe)]});return!0},kre=e=>{let t=e.state.field(Tf,!1);if(!t||!t.panel)return!1;let n=lI(e,EI);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:TI.of(!1)}),!0},lPe=[{key:"Mod-f",run:wre,scope:"editor search-panel"},{key:"F3",run:o4,shift:a4,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:o4,shift:a4,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:kre,scope:"editor search-panel"},{key:"Mod-Shift-l",run:oPe},{key:"Mod-Alt-g",run:BLe},{key:"Mod-d",run:YLe,preventDefault:!0}];class cPe{constructor(t){this.view=t;let n=this.query=t.state.field(Tf).query.spec;this.commit=this.commit.bind(this),this.searchField=Cr("input",{value:n.search,placeholder:ul(t,"Find"),"aria-label":ul(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Cr("input",{value:n.replace,placeholder:ul(t,"Replace"),"aria-label":ul(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Cr("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Cr("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Cr("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function s(r,i,o){return Cr("button",{class:"cm-button",name:r,onclick:i,type:"button"},o)}this.dom=Cr("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,s("next",()=>o4(t),[ul(t,"next")]),s("prev",()=>a4(t),[ul(t,"previous")]),s("select",()=>iPe(t),[ul(t,"all")]),Cr("label",null,[this.caseField,ul(t,"match case")]),Cr("label",null,[this.reField,ul(t,"regexp")]),Cr("label",null,[this.wordField,ul(t,"by word")]),...t.state.readOnly?[]:[Cr("br"),this.replaceField,s("replace",()=>IF(t),[ul(t,"replace")]),s("replaceAll",()=>aPe(t),[ul(t,"replace all")])],Cr("button",{name:"close",onclick:()=>kre(t),"aria-label":ul(t,"close"),type:"button"},["×"])])}commit(){let t=new bre({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:iv.of(t)}))}keydown(t){MMe(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?a4:o4)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),IF(this.view))}update(t){for(let n of t.transactions)for(let s of n.effects)s.is(iv)&&!s.value.eq(this.query)&&this.setQuery(s.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(rb).top}}function ul(e,t){return e.state.phrase(t)}const Jk=30,Zk=/[\s\.,:;?!]/;function AI(e,{from:t,to:n}){let s=e.state.doc.lineAt(t),r=e.state.doc.lineAt(n).to,i=Math.max(s.from,t-Jk),o=Math.min(r,n+Jk),a=e.state.sliceDoc(i,o);if(i!=s.from){for(let c=0;c<Jk;c++)if(!Zk.test(a[c+1])&&Zk.test(a[c])){a=a.slice(c);break}}if(o!=r){for(let c=a.length-1;c>a.length-Jk;c--)if(!Zk.test(a[c-1])&&Zk.test(a[c])){a=a.slice(0,c);break}}return Nt.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${s.number}.`)}const uPe=Nt.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"}}),dPe=[Tf,gm.low(rPe),uPe];class RF{constructor(t,n,s){this.from=t,this.to=n,this.diagnostic=s}}class np{constructor(t,n,s){this.diagnostics=t,this.panel=n,this.selected=s}static init(t,n,s){let r=s.facet(ov).markerFilter;r&&(t=r(t,s));let i=t.slice().sort((p,g)=>p.from-g.from||p.to-g.to),o=new Ou,a=[],c=0,u=s.doc.iter(),d=0,h=s.doc.length;for(let p=0;;){let g=p==i.length?null:i[p];if(!g&&!a.length)break;let b,v;if(a.length)b=c,v=a.reduce((w,k)=>Math.min(w,k.to),g&&g.from>b?g.from:1e8);else{if(b=g.from,b>h)break;v=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++,v=Math.min(w.to,v);else{v=Math.min(w.from,v);break}}v=Math.min(v,h);let x=!1;if(a.some(w=>w.from==b&&(w.to==v||v==h))&&(x=b==v,!x&&v-b<10)){let w=b-(d+u.value.length);w>0&&(u.next(w),d=b);for(let k=b;;){if(k>=v){x=!0;break}if(!u.lineBreak&&d+u.value.length>k)break;k=d+u.value.length,d+=u.value.length,u.next()}}let y=SPe(a);if(x)o.add(b,b,vn.widget({widget:new vPe(y),diagnostics:a.slice()}));else{let w=a.reduce((k,T)=>T.markClass?k+" "+T.markClass:k,"");o.add(b,v,vn.mark({class:"cm-lintRange cm-lintRange-"+y+w,diagnostics:a.slice(),inclusiveEnd:a.some(k=>k.to>v)}))}if(c=v,c==h)break;for(let w=0;w<a.length;w++)a[w].to<=c&&a.splice(w--,1)}let m=o.finish();return new np(m,n,Zf(m))}}function Zf(e,t=null,n=0){let s=null;return e.between(n,1e9,(r,i,{spec:o})=>{if(!(t&&o.diagnostics.indexOf(t)<0))if(!s)s=new RF(r,i,t||o.diagnostics[0]);else{if(o.diagnostics.indexOf(s.diagnostic)<0)return!1;s=new RF(s.from,i,s.diagnostic)}}),s}function hPe(e,t){let n=t.pos,s=t.end||n,r=e.state.facet(ov).hideOn(e,n,s);if(r!=null)return r;let i=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(o=>o.is(_re))||e.changes.touchesRange(i.from,Math.max(i.to,s)))}function fPe(e,t){return e.field(wl,!1)?t:t.concat(rs.appendConfig.of(CPe))}const _re=rs.define(),NI=rs.define(),Sre=rs.define(),wl=Ho.define({create(){return new np(vn.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),s=null,r=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);s=Zf(n,e.selected.diagnostic,i)||Zf(n,null,i)}!n.size&&r&&t.state.facet(ov).autoPanel&&(r=null),e=new np(n,r,s)}for(let n of t.effects)if(n.is(_re)){let s=t.state.facet(ov).autoPanel?n.value.length?av.open:null:e.panel;e=np.init(n.value,s,t.state)}else n.is(NI)?e=new np(e.diagnostics,n.value?av.open:null,e.selected):n.is(Sre)&&(e=new np(e.diagnostics,e.panel,n.value));return e},provide:e=>[Zx.from(e,t=>t.panel),Nt.decorations.from(e,t=>t.diagnostics)]}),mPe=vn.mark({class:"cm-lintRange cm-lintRange-active"});function pPe(e,t,n){let{diagnostics:s}=e.state.field(wl),r,i=-1,o=-1;s.between(t-(n<0?1:0),t+(n>0?1:0),(c,u,{spec:d})=>{if(t>=c&&t<=u&&(c==u||(t>c||n>0)&&(t<u||n<0)))return r=d.diagnostics,i=c,o=u,!1});let a=e.state.facet(ov).tooltipFilter;return r&&a&&(r=a(r,e.state)),r?{pos:i,end:o,above:!0,create(){return{dom:gPe(e,r)}}}:null}function gPe(e,t){return Cr("ul",{class:"cm-tooltip-lint"},t.map(n=>Tre(e,n,!1)))}const bPe=e=>{let t=e.state.field(wl,!1);(!t||!t.panel)&&e.dispatch({effects:fPe(e.state,[NI.of(!0)])});let n=lI(e,av.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},DF=e=>{let t=e.state.field(wl,!1);return!t||!t.panel?!1:(e.dispatch({effects:NI.of(!1)}),!0)},yPe=e=>{let t=e.state.field(wl,!1);if(!t)return!1;let n=e.state.selection.main,s=Zf(t.diagnostics,null,n.to+1);return!s&&(s=Zf(t.diagnostics,null,0),!s||s.from==n.from&&s.to==n.to)?!1:(e.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0}),yIe(e,s.from,1,{tooltip:Ere,until:r=>r.docChanged||r.newSelection.main.head<s.from||r.newSelection.main.head>s.to}),!0)},xPe=[{key:"Mod-Shift-m",run:bPe,preventDefault:!0},{key:"F8",run:yPe}],ov=on.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...Yu(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:LF,tooltipFilter:LF,needsRefresh:(t,n)=>t?n?s=>t(s)||n(s):t:n,hideOn:(t,n)=>t?n?(s,r,i)=>t(s,r,i)||n(s,r,i):t:n,autoPanel:(t,n)=>t||n})}}});function LF(e,t){return e?t?(n,s)=>t(e(n,s),s):e:t}function Cre(e){let t=[];if(e)e:for(let{name:n}of e){for(let s=0;s<n.length;s++){let r=n[s];if(/[a-zA-Z]/.test(r)&&!t.some(i=>i.toLowerCase()==r.toLowerCase())){t.push(r);continue e}}t.push("")}return t}function Tre(e,t,n){var s;let r=n?Cre(t.actions):[];return Cr("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},Cr("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),(s=t.actions)===null||s===void 0?void 0:s.map((i,o)=>{let a=!1,c=p=>{if(p.preventDefault(),a)return;a=!0;let g=Zf(e.state.field(wl).diagnostics,t);g&&i.apply(e,g.from,g.to)},{name:u}=i,d=r[o]?u.indexOf(r[o]):-1,h=d<0?u:[u.slice(0,d),Cr("u",u.slice(d,d+1)),u.slice(d+1)],m=i.markClass?" "+i.markClass:"";return Cr("button",{type:"button",class:"cm-diagnosticAction"+m,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${r[o]})"`}.`},h)}),t.source&&Cr("div",{class:"cm-diagnosticSource"},t.source))}class vPe extends Ol{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return Cr("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class PF{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Tre(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class av{constructor(t){this.view=t,this.items=[];let n=r=>{if(!(r.ctrlKey||r.altKey||r.metaKey)){if(r.keyCode==27)DF(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],o=Cre(i.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==r.keyCode){let c=Zf(this.view.state.field(wl).diagnostics,i);c&&i.actions[a].apply(t,c.from,c.to)}}else return;r.preventDefault()}},s=r=>{for(let i=0;i<this.items.length;i++)this.items[i].dom.contains(r.target)&&this.moveSelection(i)};this.list=Cr("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:s}),this.dom=Cr("div",{class:"cm-panel-lint"},this.list,Cr("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>DF(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(wl).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(wl),s=0,r=!1,i=null,o=new Set;for(t.between(0,this.view.state.doc.length,(a,c,{spec:u})=>{for(let d of u.diagnostics){if(o.has(d))continue;o.add(d);let h=-1,m;for(let p=s;p<this.items.length;p++)if(this.items[p].diagnostic==d){h=p;break}h<0?(m=new PF(this.view,d),this.items.splice(s,0,m),r=!0):(m=this.items[h],h>s&&(this.items.splice(s,h-s),r=!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"),s++}});s<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new PF(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!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:c})=>{let u=c.height/this.list.offsetHeight;a.top<c.top?this.list.scrollTop-=(c.top-a.top)/u:a.bottom>c.bottom&&(this.list.scrollTop+=(a.bottom-c.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let t=this.list.firstChild;function n(){let s=t;t=s.nextSibling,s.remove()}for(let s of this.items)if(s.dom.parentNode==this.list){for(;t!=s.dom;)n();t=s.dom.nextSibling}else this.list.insertBefore(s.dom,t);for(;t;)n()}moveSelection(t){if(this.selectedIndex<0)return;let n=this.view.state.field(wl),s=Zf(n.diagnostics,this.items[t].diagnostic);s&&this.view.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0,effects:Sre.of(s)})}static open(t){return new av(t)}}function wPe(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 e_(e){return wPe(`<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 kPe=Nt.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:e_("#f11")},".cm-lintRange-warning":{backgroundImage:e_("orange")},".cm-lintRange-info":{backgroundImage:e_("#999")},".cm-lintRange-hint":{backgroundImage:e_("#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 _Pe(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function SPe(e){let t="hint",n=1;for(let s of e){let r=_Pe(s.severity);r>n&&(n=r,t=s.severity)}return t}const Ere=bIe(pPe,{hideOn:hPe}),CPe=[wl,Nt.decorations.compute([wl],e=>{let{selected:t,panel:n}=e.field(wl);return!t||!n||t.from==t.to?vn.none:vn.set([mPe.range(t.from,t.to)])}),Ere,kPe],Are=[MIe(),DIe(),Qne(),bI(),TRe(),Kne(),FMe(),Ks.allowMultipleSelections.of(!0),hRe(),wse(kse,{fallback:!0}),PRe(),CLe(),hre(),iIe(),lIe(),JMe(),FLe(),w1.of([...NLe,...vI,...lPe,...yI,...kRe,...fre,...xPe])],TPe=[Qne(),bI(),Kne(),wse(kse,{fallback:!0}),w1.of([...vI,...yI])];/** @license
 * fzf v0.5.2
 * Copyright (c) 2021 Ajit
 * Licensed under BSD 3-Clause
 */const jI={216:"O",223:"s",248:"o",273:"d",295:"h",305:"i",320:"l",322:"l",359:"t",383:"s",384:"b",385:"B",387:"b",390:"O",392:"c",393:"D",394:"D",396:"d",398:"E",400:"E",402:"f",403:"G",407:"I",409:"k",410:"l",412:"M",413:"N",414:"n",415:"O",421:"p",427:"t",429:"t",430:"T",434:"V",436:"y",438:"z",477:"e",485:"g",544:"N",545:"d",549:"z",564:"l",565:"n",566:"t",567:"j",570:"A",571:"C",572:"c",573:"L",574:"T",575:"s",576:"z",579:"B",580:"U",581:"V",582:"E",583:"e",584:"J",585:"j",586:"Q",587:"q",588:"R",589:"r",590:"Y",591:"y",592:"a",593:"a",595:"b",596:"o",597:"c",598:"d",599:"d",600:"e",603:"e",604:"e",605:"e",606:"e",607:"j",608:"g",609:"g",610:"G",613:"h",614:"h",616:"i",618:"I",619:"l",620:"l",621:"l",623:"m",624:"m",625:"m",626:"n",627:"n",628:"N",629:"o",633:"r",634:"r",635:"r",636:"r",637:"r",638:"r",639:"r",640:"R",641:"R",642:"s",647:"t",648:"t",649:"u",651:"v",652:"v",653:"w",654:"y",655:"Y",656:"z",657:"z",663:"c",665:"B",666:"e",667:"G",668:"H",669:"j",670:"k",671:"L",672:"q",686:"h",867:"a",868:"e",869:"i",870:"o",871:"u",872:"c",873:"d",874:"h",875:"m",876:"r",877:"t",878:"v",879:"x",7424:"A",7427:"B",7428:"C",7429:"D",7431:"E",7432:"e",7433:"i",7434:"J",7435:"K",7436:"L",7437:"M",7438:"N",7439:"O",7440:"O",7441:"o",7442:"o",7443:"o",7446:"o",7447:"o",7448:"P",7449:"R",7450:"R",7451:"T",7452:"U",7453:"u",7454:"u",7455:"m",7456:"V",7457:"W",7458:"Z",7522:"i",7523:"r",7524:"u",7525:"v",7834:"a",7835:"s",8305:"i",8341:"h",8342:"k",8343:"l",8344:"m",8345:"n",8346:"p",8347:"s",8348:"t",8580:"c"};for(let e="̀".codePointAt(0);e<="ͯ".codePointAt(0);++e){const t=String.fromCodePoint(e);for(const n of"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"){const r=(n+t).normalize().codePointAt(0);r>126&&(jI[r]=n)}}const V6={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(const e of Object.keys(V6)){const t=e.toUpperCase();for(let n=V6[e][0];n<=V6[e][1];++n)jI[n]=n%2===0?t:e}function tw(e){if(e<192||e>8580)return e;const t=jI[e];return t!==void 0?t.codePointAt(0):e}function Vh(e,t){return e>t?e:t}const Nre=e=>e.split("").map(t=>t.codePointAt(0)),EPe=new Set(` \f
\r	\v  \u2028\u2029  　\uFEFF`.split("").map(e=>e.codePointAt(0)));for(let e=" ".codePointAt(0);e<=" ".codePointAt(0);e++)EPe.add(e);const C1="".codePointAt(0),lv="A".codePointAt(0),cv="Z".codePointAt(0),jre="a".codePointAt(0),Mre="z".codePointAt(0),APe="0".codePointAt(0),NPe="9".codePointAt(0);function bg(e,t,n){return n?e:t-e-1}const uv=16,JA=-3,l4=-1,Hp=uv/2,jPe=uv/2,MPe=Hp+l4,Ire=4,Rre=2;function ZA(e){return e?new Set:null}function sy(e,t,n){if(t!==null&&t.i16.length>e+n){const s=t.i16.subarray(e,e+n);return[e+n,s]}return[e,new Int16Array(n)]}function OF(e,t,n){if(t!==null&&t.i32.length>e+n){const s=t.i32.subarray(e,e+n);return[e+n,s]}return[e,new Int32Array(n)]}function Dre(e){return e>=jre&&e<=Mre?1:e>=lv&&e<=cv?2:e>=APe&&e<=NPe?4:0}function Lre(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 c4(e){return e<=C1?Dre(e):Lre(e)}function MI(e,t){return e===0&&t!==0?Hp:e===1&&t===2||e!==4&&t===4?MPe:t===0?jPe:0}function IPe(e,t){return t===0?Hp:MI(c4(e[t-1]),c4(e[t]))}function RPe(e,t,n,s){let r=e.slice(s),i=r.indexOf(n);if(i===0)return s;if(!t&&n>=jre&&n<=Mre){i>0&&(r=r.slice(0,i));const o=r.indexOf(n-32);o>=0&&(i=o)}return i<0?-1:s+i}function BF(e){for(const t of e)if(t>=128)return!1;return!0}function II(e,t,n){if(!BF(e))return 0;if(!BF(t))return-1;let s=0,r=0;for(let i=0;i<t.length;i++){if(r=RPe(e,n,t[i],r),r<0)return-1;i===0&&r>0&&(s=r-1),r++}return s}const DPe=(e,t,n,s,r,i,o)=>{const a=r.length;if(a===0)return[{start:0,end:0,score:0},ZA(i)];const c=s.length;if(o!==null&&c*a>o.i16.length)return Ore(e,t,n,s,r,i);const u=II(s,r,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]=sy(d,o,c),[d,p]=sy(d,o,c),[d,g]=sy(d,o,c),[h,b]=OF(h,o,a);const[,v]=OF(h,o,c);for(let V=0;V<v.length;V++)v[V]=s[V];let x=0,y=0,w=0,k=0;const T=r[0];let _=r[0],C=0,S=0,L=!1,N=v.subarray(u),$=m.subarray(u).subarray(0,N.length),M=p.subarray(u).subarray(0,N.length),P=g.subarray(u).subarray(0,N.length);for(let[V,j]of N.entries()){let ee=null;j<=C1?(ee=Dre(j),!e&&ee===2&&(j+=32)):(ee=Lre(j),!e&&ee===2&&(j=String.fromCodePoint(j).toLowerCase().codePointAt(0)),t&&(j=tw(j))),N[V]=j;const se=MI(S,ee);if(P[V]=se,S=ee,j===_&&(w<a&&(b[w]=u+V,w++,_=r[Math.min(w,a-1)]),k=u+V),j===T){const X=uv+se*Rre;if($[V]=X,M[V]=1,a===1&&(n&&X>x||!n&&X>=x)&&(x=X,y=u+V,n&&se===Hp))break;L=!1}else L?$[V]=Vh(C+l4,0):$[V]=Vh(C+JA,0),M[V]=0,L=!0;C=$[V]}if(w!==a)return[{start:-1,end:-1,score:0},null];if(a===1){const V={start:y,end:y+1,score:x};if(!i)return[V,null];const j=new Set;return j.add(y),[V,j]}const E=b[0],O=k-E+1;let z=null;[d,z]=sy(d,o,O*a);{const V=m.subarray(E,k+1);for(const[j,ee]of V.entries())z[j]=ee}let[,F]=sy(d,o,O*a);{const V=p.subarray(E,k+1);for(const[j,ee]of V.entries())F[j]=ee}const B=b.subarray(1),W=r.slice(1).slice(0,B.length);for(const[V,j]of B.entries()){let ee=!1;const se=W[V],X=V+1,Q=X*O,ue=v.subarray(j,k+1),re=g.subarray(j).subarray(0,ue.length),J=F.subarray(Q+j-E).subarray(0,ue.length),q=F.subarray(Q+j-E-1-O).subarray(0,ue.length),Z=z.subarray(Q+j-E).subarray(0,ue.length),he=z.subarray(Q+j-E-1-O).subarray(0,ue.length),ye=z.subarray(Q+j-E-1).subarray(0,ue.length);ye[0]=0;for(const[oe,we]of ue.entries()){const Ve=oe+j;let lt=0,Et=0,pt=0;if(ee?Et=ye[oe]+l4:Et=ye[oe]+JA,se===we){lt=he[oe]+uv;let Ae=re[oe];pt=q[oe]+1,Ae===Hp?pt=1:pt>1&&(Ae=Vh(Ae,Vh(Ire,g[Ve-pt+1]))),lt+Ae<Et?(lt+=re[oe],pt=0):lt+=Ae}J[oe]=pt,ee=lt<Et;const je=Vh(Vh(lt,Et),0);X===a-1&&(n&&je>x||!n&&je>=x)&&(x=je,y=Ve),Z[oe]=je}}const I=ZA(i);let Y=E;if(i&&I!==null){let V=a-1;Y=y;let j=!0;for(;;){const ee=V*O,se=Y-E,X=z[ee+se];let Q=0,ue=0;if(V>0&&Y>=b[V]&&(Q=z[ee-O+se-1]),Y>b[V]&&(ue=z[ee+se-1]),X>Q&&(X>ue||X===ue&&j)){if(I.add(Y),V===0)break;V--}j=F[ee+se]>1||ee+O+se+1<F.length&&F[ee+O+se+1]>0,Y--}}return[{start:Y,end:y+1,score:x},I]};function Pre(e,t,n,s,r,i,o){let a=0,c=0,u=!1,d=0,h=0;const m=ZA(o);let p=0;r>0&&(p=c4(n[r-1]));for(let g=r;g<i;g++){let b=n[g];const v=c4(b);if(e||(b>=lv&&b<=cv?b+=32:b>C1&&(b=String.fromCodePoint(b).toLowerCase().codePointAt(0))),t&&(b=tw(b)),b===s[a]){o&&m!==null&&m.add(g),c+=uv;let x=MI(p,v);d===0?h=x:(x===Hp&&(h=x),x=Vh(Vh(x,h),Ire)),a===0?c+=x*Rre:c+=x,u=!1,d++,a++}else u?c+=l4:c+=JA,u=!0,d=0,h=0;p=v}return[c,m]}const Ore=(e,t,n,s,r,i,o)=>{if(r.length===0)return[{start:0,end:0,score:0},null];if(II(s,r,e)<0)return[{start:-1,end:-1,score:0},null];let a=0,c=-1,u=-1;const d=s.length,h=r.length;for(let m=0;m<d;m++){let p=s[bg(m,d,n)];e||(p>=lv&&p<=cv?p+=32:p>C1&&(p=String.fromCodePoint(p).toLowerCase().codePointAt(0))),t&&(p=tw(p));const g=r[bg(a,h,n)];if(p===g&&(c<0&&(c=m),a++,a===h)){u=m+1;break}}if(c>=0&&u>=0){a--;for(let g=u-1;g>=c;g--){const b=bg(g,d,n);let v=s[b];e||(v>=lv&&v<=cv?v+=32:v>C1&&(v=String.fromCodePoint(v).toLowerCase().codePointAt(0)));const x=bg(a,h,n),y=r[x];if(v===y&&(a--,a<0)){c=g;break}}if(!n){const g=c;c=d-u,u=d-g}const[m,p]=Pre(e,t,s,r,c,u,i);return[{start:c,end:u,score:m},p]}return[{start:-1,end:-1,score:0},null]},LPe=(e,t,n,s,r,i,o)=>{if(r.length===0)return[{start:0,end:0,score:0},null];const a=s.length,c=r.length;if(a<c)return[{start:-1,end:-1,score:0},null];if(II(s,r,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=bg(p,a,n);let b=s[g];e||(b>=lv&&b<=cv?b+=32:b>C1&&(b=String.fromCodePoint(b).toLowerCase().codePointAt(0))),t&&(b=tw(b));const v=bg(u,c,n);if(r[v]===b){if(v===0&&(h=IPe(s,g)),u++,u===c){if(h>m&&(d=p,m=h),h===Hp)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-c+1,g=d+1):(p=a-(d+1),g=a-(d-c+1));const[b]=Pre(e,t,s,r,p,g,!1);return[{start:p,end:g,score:b},null]}return[{start:-1,end:-1,score:0},null]},PPe=100*1024,OPe=2048;function BPe(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}const $Pe=BPe(PPe,OPe),zPe=(e,t,n)=>{let s=!1;switch(t){case"smart-case":e.toLowerCase()!==e&&(s=!0);break;case"case-sensitive":s=!0;break;case"case-insensitive":e=e.toLowerCase(),s=!1;break}let r=Nre(e);return n&&(r=r.map(tw)),{queryRunes:r,caseSensitive:s}};function FPe(e,t){const n=Object.keys(e).map(r=>parseInt(r,10)).sort((r,i)=>i-r);let s=[];for(const r of n)if(s=s.concat(e[r]),s.length>=t)break;return s}function HPe(e,t,n){return s=>{const r=this.runesList[s];if(t.length>r.length)return;let[i,o]=this.algoFn(n,this.opts.normalize,this.opts.forward,r,t,!0,$Pe);if(i.start===-1)return;if(this.opts.fuzzy===!1){o=new Set;for(let c=i.start;c<i.end;++c)o.add(c)}const a=this.opts.sort?i.score:0;e[a]===void 0&&(e[a]=[]),e[a].push({item:this.items[s],...i,positions:o??new Set})}}function qPe(e){const{queryRunes:t,caseSensitive:n}=zPe(e,this.opts.casing,this.opts.normalize),s={},r=HPe.bind(this)(s,t,n);for(let i=0,o=this.runesList.length;i<o;++i)r(i);return FPe(s,this.opts.limit)}const Bre={limit:1/0,selector:e=>e,casing:"smart-case",normalize:!0,fuzzy:"v2",tiebreakers:[],sort:!0,forward:!0};class UPe{constructor(t,...n){switch(this.opts={...Bre,...n[0]},this.items=t,this.runesList=t.map(s=>Nre(this.opts.selector(s).normalize())),this.algoFn=LPe,this.opts.fuzzy){case"v2":this.algoFn=DPe;break;case"v1":this.algoFn=Ore;break}}}const VPe={...Bre,match:qPe};class WPe extends UPe{constructor(t,...n){super(t,...n),this.opts={...VPe,...n[0]}}find(t){if(t.length===0||this.items.length===0)return this.items.slice(0,this.opts.limit).map(GPe);t=t.normalize();let n=this.opts.match.bind(this)(t);return KPe(n,this.opts)}}const GPe=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function KPe(e,t){if(t.sort){const{selector:n}=t;e.sort((s,r)=>{if(s.score===r.score)for(const i of t.tiebreakers){const o=i(s,r,n);if(o!==0)return o}return 0})}return Number.isFinite(t.limit)&&e.splice(t.limit),e}class YPe{constructor(t,...n){this.finder=new WPe(t,...n),this.find=this.finder.find.bind(this.finder)}}const dv=["custom","skill","system"];function e9(e){return e.displayCategory?e.displayCategory:e.source==="builtin-command"?"system":e.source==="bundled-skill"||e.source==="skill"?"skill":"custom"}function XPe(e,t,n=dv){return $F(e9(e),n)-$F(e9(t),n)}function $F(e,t=dv){const n=t.indexOf(e);return n>=0?n:t.length+dv.indexOf(e)}const RI=String.raw`([^\s/]+)`,fC={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:"安装扩展"}]},mC={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"}]},pC={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 文件列表"}]},gC={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 QPe(e,t,n,s,r){if(e==="skills"&&t.length===0)return!n||n.length===0?null:n.map(a=>({name:a.name,description:a.description}));let o=(s==="zh-CN"?fC:mC)[e];if(o||(o=(s==="zh-CN"?pC:gC)[e]),!o&&t.length===0&&(r!=null&&r.length)&&(o=r.map(a=>({name:a,description:""}))),!o)return null;for(const a of t){const c=o.find(u=>u.name===a);if(!(c!=null&&c.children))return null;o=c.children}return o}function JPe(e,t,n){const s=e.toLowerCase(),r=t.toLowerCase(),i=s.startsWith(n),o=r.startsWith(n);return i!==o?i?-1:1:e.localeCompare(t)}function ZPe(e,t,n,s){const r=XPe(e,t,s);return r!==0?r:0}const eOe={custom:"slash.category.custom",skill:"slash.category.skill",system:"slash.category.system"};function tOe(e,t){if(!e||e.includes(" ")||/^[/@!?]/.test(e))return null;const n=e.toLowerCase(),s=t.find(r=>r.name.toLowerCase().startsWith(n));return s?`/${s.name} `:null}function nOe(e,t,n){var u;const s=e.match(new RegExp(`^/${RI}\\s+$`));if(!s)return null;const r=s[1],i=t.find(d=>d.name===r),o=n==="zh-CN"?fC:mC;if((u=i==null?void 0:i.subcommands)!=null&&u.length||o[r]||r==="skills")return null;const c=(n==="zh-CN"?pC:gC)[r];return!c||c.length===0?null:`/${r} ${c[0].name} `}function sOe(e,t,n){var d,h;const s=e.match(new RegExp(`^/${RI}(\\s*)$`));if(!s)return null;const r=s[1],i=t.find(m=>m.name===r);if(!i)return null;const o=(d=i.argumentHint)==null?void 0:d.trim();if(o)return o;const a=n==="zh-CN"?fC:mC;if((h=i.subcommands)!=null&&h.length||a[r]||r==="skills")return null;const u=(n==="zh-CN"?pC:gC)[r];return!u||u.length===0?null:`[${u.map(m=>m.name).join("|")}]`}function rOe(e,t){const n=Math.max(0,Math.min(t,e.length)),s=e.lastIndexOf(`
`,Math.max(0,n-1))+1,r=e.indexOf(`
`,n),i=r===-1?e.length:r;return{lineStart:s,lineEnd:i,lineText:e.slice(s,i),textBefore:e.slice(s,n),cursor:n}}const zF=new WeakMap;function iOe(e){let t=zF.get(e);if(!t){const n=[],s=new Map;for(const r of e)s.has(r.name)||(n.push(r.name),s.set(r.name,r));t={fzf:new YPe(n,{fuzzy:"v2",casing:"case-insensitive"}),byName:s},zF.set(e,t)}return t}function oOe(e,t){try{const{fzf:n,byName:s}=iOe(e),r=[];for(const i of n.find(t)){const o=s.get(i.item);o&&r.push(o)}return r}catch(n){console.warn("[web-shell] slash fuzzy search failed, falling back to substring match:",n);const s=t.toLowerCase();return e.filter(r=>r.name.toLowerCase().includes(s))}}function aOe(e,t,n,s=[],r="en",i=a=>a,o=dv){var y,w;const{lineStart:a,lineEnd:c,lineText:u,textBefore:d,cursor:h}=rOe(e,t),m=d.match(new RegExp(`^/${RI}\\s+(.*)$`));if(m){const[,k,T]=m,_=n.find(I=>I.name===k),C=r==="zh-CN"?fC:mC,S=r==="zh-CN"?pC:gC,L=!!C[k]||k==="skills",N=!!S[k];if(!((y=_==null?void 0:_.subcommands)!=null&&y.length)&&!L&&!N)return null;const $=T.split(/\s+/),M=$.pop()||"",P=$;if(!((w=_==null?void 0:_.subcommands)!=null&&w.length)&&!L&&N&&!M)return null;const E=QPe(k,P,s,r,_==null?void 0:_.subcommands);if(!E)return null;const O=M.toLowerCase(),z=`/${k} ${P.length>0?P.join(" ")+" ":""}`,F=E.filter(I=>!M||I.name.toLowerCase().includes(O)).sort((I,Y)=>M?JPe(I.name,Y.name,O):0),B=k==="skills"&&P.length===0,W=F.map(I=>{const Y=`${z}${I.name}`;return{id:Y,label:I.name,detail:I.description||void 0,apply:`${Y} `,...B?{type:"skill"}:{}}});return W.length===0?null:{kind:"subcommand",from:a,to:h,query:M,items:W}}const p=u.match(/^\/([^\s/]*)$/);if(!p)return null;const g=p[1],b=g.length===0,x=(b?[...n].sort((k,T)=>ZPe(k,T,"",o)):oOe(n,g)).map(k=>{const T=`/${k.name} `,_=e9(k),C=_==="custom"||_==="skill";return{id:k.name,label:`/${k.name}`,detail:k.description||void 0,apply:T,category:_,...b?{section:i(eOe[_])}:{},...C&&k.description?{type:"command-info"}:{}}});return x.length===0?null:{kind:"command",from:a,to:c,query:g,items:x}}const lOe="qwen-web-shell-history",$re=100;function cOe(e){try{const t=localStorage.getItem(e);if(!t)return[];const n=JSON.parse(t);return Array.isArray(n)?n.filter(s=>typeof s=="string"):[]}catch{return[]}}function uOe(e,t){try{localStorage.setItem(e,JSON.stringify(t.slice(-$re)))}catch{}}function FF(e=lOe){const t=f.useRef(e);t.current=e;const n=f.useRef(cOe(e)),s=f.useRef(-1),r=f.useRef(""),i=f.useRef(-1),[o,a]=f.useState(()=>({canUp:n.current.length>0,canDown:!1})),c=f.useCallback(()=>{const y=n.current,w=s.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>$re&&w.shift(),uOe(t.current,w),s.current=-1,c())},[c]),d=f.useCallback(y=>{const w=n.current;if(w.length===0)return null;if(s.current===-1)r.current=y,s.current=w.length-1;else if(s.current>0)s.current--;else return null;return c(),w[s.current]},[c]),h=f.useCallback(()=>{const y=n.current;return s.current===-1?null:s.current<y.length-1?(s.current++,c(),y[s.current]):(s.current=-1,c(),r.current)},[c]),m=f.useCallback(()=>s.current!==-1,[]),p=f.useCallback(()=>{s.current=-1,i.current=-1,c()},[c]),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 _=k;_>=0;_--)if(w[_].toLowerCase().includes(T))return i.current=_,w[_];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))},[]),v=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},[]),x=f.useCallback(()=>{i.current=-1},[]);return{push:u,navigateUp:d,navigateDown:h,isNavigating:m,reset:p,searchReverse:g,getReverseMatches:b,getLastEntry:v,resetSearch:x,nav:o}}function t_(){return{directories:new Map,globResults:new Map,mcpResources:new Map}}function t9(e,t,n){let s=e.get(t);return s||(s=n().catch(r=>{throw e.delete(t),r}),e.set(t,s)),s}const dOe=/@((?:[\p{L}\p{N}_./:-]|\\.)*)$/u,hOe=[],HF=150,qp=50,zre=qp+1,Ao="files",ib="extensions",Mo="mcp-resources",Fre=[Ao,ib,Mo],fOe="\x1B",Hre=new RegExp(`${fOe}(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])`,"g"),qre=/[\u200B\u200E\u200F\u061C\u2066-\u2069\u202A-\u202E]/g,hv="[invalid]",mOe=/[^\p{L}\p{N}_./-]/gu;function c2(e){return Fre.includes(e)}function pOe(e,t){var s;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)||(s=n.exclude)!=null&&s.includes(e))}function gOe(e){const t=new Set(Fre),n=[];for(const s of e){if(t.has(s.id)){console.error(`[@mention] duplicate provider id="${s.id}" ignored`);continue}t.add(s.id),n.push(s)}return n}function qF(e){return(e.textValue===void 0?void 0:Er(e.textValue))??(typeof e.label=="string"?Er(e.label)??void 0:void 0)??rh(e.id)??hv}function Ure(e,t){return e==="."||e===""?t:`${e.replace(/\/+$/,"")}/${t}`}function Fd(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 bOe(e){return Array.from(e,t=>/[a-z]/i.test(t)?`[${t.toLowerCase()}${t.toUpperCase()}]`:/[\\*?[{\]}()!@+|]/.test(t)?`\\${t}`:t).join("")}function n9(e){const t=bC(e).replace(/^\.\//,"");return t?`**/*${bOe(t)}*`:"**/*"}function u4(e,...t){const n=e.toLowerCase();return t.some(s=>s==null?void 0:s.toLowerCase().includes(n))}function UF(e){const t=Fd(e),n=Bu(t);return t==="."?"@./ ":`@${Up(n)}/ `}function yOe(e,t){return`${e}:${t}`}function Up(e){return e.replace(mOe,"\\$&")}function bC(e){return e.replace(/\\(.)/g,"$1")}function Vre(e){const t=e.charCodeAt(0);return t>31&&t!==127&&(t<128||t>159)}function xOe(e,t){return`@${Up(yOe(Bu(e),Bu(t)))} `}function vOe(e,t,n){const s=bC(e);return t===Mo&&n&&s.startsWith(`${n}:`)?{providerId:Mo,serverName:n,itemQuery:s.slice(n.length+1),validateServer:!0}:e.startsWith("ext:")?{providerId:ib,itemQuery:e.slice(4)}:e.startsWith("mcp:")?{providerId:Mo,itemQuery:e.slice(4)}:null}function wOe(e,t,n){if(e===ib&&t.startsWith("ext:")||e===Mo&&t.startsWith("mcp:"))return t.slice(4);const s=bC(t);return e===Mo&&n&&s.startsWith(`${n}:`)?s.slice(n.length+1):!c2(e)&&t.startsWith(`${e}:`)?t.slice(e.length+1):t}async function kOe(e,t,n,s){if(n!=null&&n.aborted)return!1;const r=s??(e==null?void 0:e.loadMcpStatus);if(!r)return!1;try{const i=await r();return n!=null&&n.aborted?!1:i.servers.some(o=>o.name===t&&!o.disabled)}catch(i){return console.warn(`Failed to verify @ MCP server "${t}" status`,i),!1}}function _Oe(e){const t=Fd(e);if(t===".")return".";const n=t.lastIndexOf("/");return n<0?".":t.slice(0,n)}function Wre(e,t){const n=bC(e).replace(/^\.\/+/,"").replace(/\/+/g,"/"),s=n.lastIndexOf("/");if(s<0)return{dirPath:Fd(t),entryQuery:n};const r=n.slice(0,s),i=Fd(t),o=i==="."?r:Ure(i,r);return{dirPath:Fd(o),entryQuery:n.slice(s+1)}}function SOe(e){if(!e)return null;const t=e.state.selection.main;if(!t.empty)return null;const n=e.state.doc.lineAt(t.head),r=n.text.slice(0,t.head-n.from).match(dOe);if(!r)return null;const i=t.head-r[0].length;if(i>n.from){const o=e.state.doc.sliceString(i-1,i);if(!/[\s([{'"]/.test(o))return null}return{from:i,to:t.head,query:r[1]??""}}function Er(e){const t=e.replace(Hre,"").replace(qre,"").split("").filter(Vre).join("").replace(/\s+/g," ").trim();return t.length>0?t:void 0}function Bu(e){const t=e.replace(Hre,"").replace(qre,"").split("").filter(Vre).join("");return t.length>0?t:hv}function rh(e){return e===void 0?hv:Er(e)??hv}function COe(e){if(e!==void 0)return Bu(e).trim()}function TOe(e){if(!e)return;const t=e.kind===void 0?void 0:Er(e.kind);return{id:Er(e.id)??hv,label:e.label===void 0?void 0:Er(e.label),value:e.value===void 0?void 0:Er(e.value),removable:e.removable,kind:t,icon:e.icon,metadata:e.metadata,serialized:COe(e.serialized)}}function EOe(e,t){const n={...e,label:Er(e.label)??rh(e.id),description:e.description===void 0?void 0:Er(e.description),subtitle:e.subtitle===void 0?void 0:Er(e.subtitle),detail:e.detail===void 0?void 0:Er(e.detail),icon:e.icon,iconTooltip:e.iconTooltip===void 0?void 0:Er(e.iconTooltip),insertText:e.insertText===void 0?void 0:Bu(e.insertText),composerTag:TOe(e.composerTag)};if(!(t!=null&&t.customProvider))return n;const s={...n};return delete s.targetPath,delete s.serverName,{...s,kind:"insert"}}function AOe(e,t,n){var r;const s=n.trim();return s?t.composerTag?{...t.composerTag,serialized:((r=t.composerTag.serialized)==null?void 0:r.trim())||s}:e===ib?{id:`extension:${s}`,kind:"extension",value:t.label,serialized:s}:e===Mo?{id:`mcp:${s}`,kind:"mcp",value:t.label,serialized:s}:e===Ao?{id:`file:${s}`,kind:"file",value:t.description??t.label,serialized:s}:null:null}function NOe(e,t,n,s,r){return{id:Ao,label:s,description:r,order:1,async search({query:i,signal:o}){const a=e(),c=Fd(t()),u=a==null?void 0:a.listDirectory;if(u&&(!i||!(a!=null&&a.globWorkspace)))try{const{dirPath:h,entryQuery:m}=Wre(i,c),p=m.toLowerCase(),g=await t9(n().directories,h,()=>u(h,{signal:o}));if(o.aborted)return[];const b=g.entries.filter(x=>!x.ignored).filter(x=>x.name.toLowerCase().includes(p)).sort((x,y)=>x.kind==="directory"&&y.kind!=="directory"?-1:x.kind!=="directory"&&y.kind==="directory"?1:x.name.localeCompare(y.name)),v={id:`current:${h}`,label:UF(h).trim(),description:Er(h),insertText:UF(h),kind:"insert"};return[...m?[]:[v],...b.map(x=>{const y=Ure(h,x.name),w=rh(x.name),k=Er(y),T=Bu(y);return x.kind==="directory"?{id:`dir:${y}`,label:`${w}/`,description:k,kind:"directory",targetPath:y}:{id:`file:${y}`,label:w,description:k,insertText:`@${Up(T)} `,kind:"insert"}})].slice(0,m?qp:zre)}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=n9(i),m=await t9(n().globResults,h,()=>d(h,{maxResults:qp,signal:o}));return o.aborted?[]:m.matches.filter(p=>p!==".").map(p=>({id:p,label:rh(p),insertText:`@${Up(Bu(p))} `,kind:"insert"}))}catch(h){return o.aborted||console.warn("Failed to load @ file suggestions",h),[]}}}}function jOe(e,t,n,s){return{id:ib,label:n,description:s,order:2,async search({query:r,signal:i}){var a;const o=(a=e())==null?void 0:a.loadExtensionsStatus;if(!o)return[];try{const c=t();c.extensionsStatus??(c.extensionsStatus=o().catch(h=>{throw c.extensionsStatus=void 0,h}));const u=await c.extensionsStatus;if(i.aborted)return[];const d=r.toLowerCase();return u.extensions.filter(h=>h.isActive).map(h=>{const m=rh(h.name),g=`@ext:${Up(Bu(h.name))}`,b=Er(h.displayName??""),v=Er(h.description??"");return{id:h.name,label:m,description:b&&b!==m?b:v,detail:b&&v?`${b} - ${v}`:b??v,composerTag:{id:`extension:${g}`,kind:"extension",value:b||m,serialized:g},insertText:`${g} `}}).filter(h=>u4(d,h.label,h.description)).sort((h,m)=>{const p=h.label.toLowerCase(),g=m.label.toLowerCase(),b=p.startsWith(d)?0:1,v=g.startsWith(d)?0:1;return b!==v?b-v:p.localeCompare(g)}).slice(0,qp)}catch(c){return i.aborted||console.warn("Failed to load @ extension suggestions",c),[]}}}}function MOe(e,t,n,s,r){return{id:Mo,label:n,description:s,order:3,async search({query:i,signal:o}){var c;const a=(c=e())==null?void 0:c.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=Bu(m.name),g=m.resourceCount===void 0?void 0:r(m.resourceCount);return m.resourceCount===0?{id:`mcp-server-ref:${m.name}`,label:rh(m.name),description:Er(m.description??""),detail:Er(m.description??""),insertText:`@mcp:${Up(p)} `,kind:"insert"}:{id:`mcp-server:${m.name}`,label:rh(m.name),description:g===void 0?Er(m.description??""):g,detail:Er(m.description??""),kind:"mcp-server",serverName:m.name}}).filter(m=>u4(h,m.label,m.description)).sort((m,p)=>m.label.localeCompare(p.label)).slice(0,qp)}catch(u){return o.aborted||console.warn("Failed to load @ MCP resource suggestions",u),[]}}}}function IOe(e,t,n){return t<=0?null:n==="up"?e<=0?null:e-1:e>=t-1?null:e+1}function ROe({viewRef:e,disabledRef:t,shellModeRef:n,workspaceActionsRef:s,workspaceKey:r,builtinProviders:i,providers:o=hOe,createInlineTagEffect:a}){const{t:c}=ot(),[u,d]=f.useState(null),h=f.useRef(null),m=f.useRef(0),p=f.useRef(null),g=f.useRef(null),b=f.useRef("."),v=f.useRef(t_()),x=f.useRef(null),y=f.useRef(null),w=f.useRef(!1),k=f.useMemo(()=>[...[NOe(()=>s.current,()=>b.current,()=>v.current,c("at.category.files"),c("at.category.files.description")),jOe(()=>s.current,()=>v.current,c("at.category.extensions"),c("at.category.extensions.description")),MOe(()=>s.current,()=>v.current,c("at.category.mcpResources"),c("at.category.mcpResources.description"),Q=>c("mcp.resourceCount",{count:Q}))].filter(Q=>pOe(Q.id,i)),...gOe(o)].sort((Q,ue)=>(Q.order??0)-(ue.order??0)),[i,o,c,s]),T=f.useRef(k);T.current=k;const _=f.useMemo(()=>k.map(X=>({id:X.id,provider:X,textValue:qF(X),label:typeof X.label=="string"?qF(X):X.label,description:X.description===void 0?void 0:Er(X.description),tabs:X.tabs,renderItem:X.renderItem})),[k]),C=f.useRef(_);C.current=_;const S=f.useCallback(X=>{const Q=typeof X=="function"?X(h.current):X;h.current=Q,d(Q)},[]);f.useEffect(()=>{var X;(X=p.current)==null||X.abort(),p.current=null,g.current&&(clearTimeout(g.current),g.current=null),b.current=".",v.current=t_(),h.current=null,d(null)},[r]);const L=f.useCallback(()=>{var X;(X=p.current)==null||X.abort(),p.current=null,g.current&&(clearTimeout(g.current),g.current=null)},[]),N=f.useCallback((X={})=>{L(),v.current=t_();const Q=X.preserveProviderSelection||w.current;w.current=!1,Q||(x.current=null,y.current=null),S(null)},[L,S]),$=f.useCallback(()=>{const X=h.current;return X?X.level==="items"?(L(),S({...X,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"):(N(),"closed"):!1},[L,N,S]);f.useEffect(()=>()=>{var X;g.current&&clearTimeout(g.current),(X=p.current)==null||X.abort(),p.current=null,b.current=".",v.current=t_()},[]);const M=f.useCallback((X,Q,ue)=>{const re=h.current;return(re==null?void 0:re.level)!=="items"||re.selectedProviderId!==X||re.selectedTabId!==ue.selectedTabId||re.itemMode!==ue.itemMode||re.mcpServerName!==ue.mcpServerName||re.fileDirectory!==ue.fileDirectory?[]:re.query!==Q&&!c2(X)?[]:X===Ao&&Q===""&&b.current==="."?[]:re.items},[]),P=f.useCallback((X,Q)=>{const ue=s.current,re=v.current;if(X===Ao){if(Q&&(ue!=null&&ue.globWorkspace))return re.globResults.has(n9(Q));if(ue!=null&&ue.listDirectory){const{dirPath:q}=Wre(Q,Fd(b.current));return re.directories.has(q)}const J=n9(Q);return!!(ue!=null&&ue.globWorkspace)&&re.globResults.has(J)}return X===ib?re.extensionsStatus!==void 0:X===Mo?re.mcpStatus!==void 0:!1},[s]),E=f.useCallback((X,Q,ue,re={})=>{var ye;const J=T.current.find(oe=>oe.id===X);if(!J){console.warn(`[@mention] provider="${X}" not found (may have been removed)`),S(null);return}(ye=p.current)==null||ye.abort();const q=new AbortController;p.current=q;const Z=m.current+1;m.current=Z;const he=M(X,Q,ue);re.loadingAlreadySet||S({...ue,items:he,loading:!0}),Promise.resolve().then(()=>J.search({query:Q,signal:q.signal,tabId:ue.selectedTabId})).then(oe=>{q.signal.aborted||m.current!==Z||S(we=>{if(!we||we.level!=="items")return we;const Ve=X===Ao&&Q.length===0?zre:qp;return{...we,items:oe.slice(0,Ve).map(lt=>EOe(lt,{customProvider:!c2(X)})),selectedIndex:0,loading:!1}})}).catch(oe=>{q.signal.aborted||m.current!==Z||(console.warn(`[@mention] provider="${X}" query=<redacted> failed`,oe),S(we=>!we||we.level!=="items"?we:{...we,items:[],selectedIndex:0,loading:!1}))})},[M,S]),O=f.useCallback((X,Q,ue)=>{var J;g.current&&clearTimeout(g.current),(J=p.current)==null||J.abort(),p.current=null;const re=M(X,Q,ue);if(S({...ue,items:re,loading:!0}),P(X,Q)){E(X,Q,ue,{loadingAlreadySet:!0});return}g.current=setTimeout(()=>{g.current=null,E(X,Q,ue,{loadingAlreadySet:!0})},HF)},[M,P,E,S]),z=f.useCallback((X,Q,ue,re={})=>{var Ve,lt;const J=s.current,q=J==null?void 0:J.loadMcpResources;if(!q){console.warn(`[@mention] loadMcpResources not available for server="${X}"`),S({...ue,items:[],loading:!1});return}(Ve=p.current)==null||Ve.abort();const Z=new AbortController;p.current=Z;const he=m.current+1;m.current=he;const ye=((lt=h.current)==null?void 0:lt.level)==="items"&&h.current.itemMode==="mcpResources"&&h.current.mcpServerName===X?h.current.items:[];re.loadingAlreadySet||S({...ue,items:ye,loading:!0});const oe=J==null?void 0:J.loadMcpStatus;(re.validateServer?kOe(J,X,Z.signal,oe?()=>{const Et=v.current;return Et.mcpStatus??(Et.mcpStatus=oe().catch(pt=>{throw Et.mcpStatus=void 0,pt})),Et.mcpStatus}:void 0):Promise.resolve(!0)).then(Et=>Z.signal.aborted?{resources:[]}:Et?t9(v.current.mcpResources,X,()=>q(X,{signal:Z.signal})):(console.warn("[@mention] MCP server disabled or not found",{serverName:X}),{resources:[]})).then(Et=>{if(Z.signal.aborted||m.current!==he)return;const pt=Et.resources.map(je=>{const Ae=Er(je.title??"")??Er(je.name??"")??rh(je.uri);return{id:`mcp-resource:${X}:${je.uri}`,label:Ae,description:Er(je.description??"")??Er(je.mimeType??""),detail:rh(je.uri),insertText:xOe(X,je.uri),kind:"insert"}}).filter(je=>u4(Q,je.label,je.description,je.detail)).sort((je,Ae)=>je.label.localeCompare(Ae.label)).slice(0,qp);S(je=>!je||je.level!=="items"?je:{...je,items:pt,selectedIndex:0,loading:!1})}).catch(Et=>{Z.signal.aborted||m.current!==he||(console.warn("Failed to load @ MCP resources",Et),S(pt=>!pt||pt.level!=="items"?pt:{...pt,items:[],selectedIndex:0,loading:!1}))})},[S,s]),F=f.useCallback((X,Q,ue,re={})=>{var q,Z;g.current&&clearTimeout(g.current),(q=p.current)==null||q.abort(),p.current=null;const J=((Z=h.current)==null?void 0:Z.level)==="items"&&h.current.itemMode==="mcpResources"&&h.current.mcpServerName===X&&ue.itemMode==="mcpResources"?h.current.items:[];if(S({...ue,items:J,loading:!0}),v.current.mcpResources.has(X)){z(X,Q,ue,{...re,loadingAlreadySet:!0});return}g.current=setTimeout(()=>{g.current=null,z(X,Q,ue,{...re,loadingAlreadySet:!0})},HF)},[z,S]),B=f.useCallback(X=>{if(t.current||n.current)return N(),!1;const Q=SOe(X);if(!Q)return N(),!1;const ue=h.current;if((ue==null?void 0:ue.level)==="items"&&ue.from===Q.from&&(ue.to===Q.to||ue.inputMode==="search"&&Q.to>=ue.to||ue.inputMode==="context"&&Q.to>=ue.to)&&ue.selectedProviderId!==void 0&&C.current.some(q=>q.id===ue.selectedProviderId)){if(!ue.selectedProviderId)return!0;const q=ue.selectedProviderId,Z=ue.inputMode==="context"?wOe(q,Q.query,ue.mcpServerName):ue.query;if(Z!==ue.query){const he={...ue,from:Q.from,to:Q.to,query:Z,selectedIndex:0,providers:C.current};return q===Mo&&ue.itemMode==="mcpResources"&&ue.mcpServerName?(F(ue.mcpServerName,Z,he,{validateServer:ue.validateMcpServer}),!0):(O(q,Z,he),!0)}return S({...ue,from:Q.from,to:Q.to,query:Z,providers:C.current}),!0}const J=C.current.filter(q=>u4(Q.query,q.textValue,q.description));if(J.length===0&&Q.query){const q=vOe(Q.query,x.current,y.current);if(q&&C.current.some(he=>he.id===q.providerId))return q.providerId===Mo&&q.serverName?(y.current=q.serverName,F(q.serverName,q.itemQuery,{from:Q.from,to:Q.to,query:q.itemQuery,level:"items",selectedProviderId:Mo,selectedIndex:0,providers:C.current,itemMode:"mcpResources",mcpServerName:q.serverName,fileDirectory:void 0,inputMode:"context",validateMcpServer:q.validateServer},{validateServer:q.validateServer}),!0):(O(q.providerId,q.itemQuery,{from:Q.from,to:Q.to,query:q.itemQuery,level:"items",selectedProviderId:q.providerId,selectedIndex:0,providers:C.current,itemMode:"default",mcpServerName:void 0,fileDirectory:q.providerId===Ao?b.current:void 0,inputMode:"context"}),!0);const Z=C.current.find(he=>!c2(he.id)&&Q.query.startsWith(`${he.id}:`));if(Z){const he=Q.query.slice(Z.id.length+1);return O(Z.id,he,{from:Q.from,to:Q.to,query:he,level:"items",selectedProviderId:Z.id,selectedIndex:0,providers:C.current,itemMode:"default",mcpServerName:void 0,fileDirectory:void 0,inputMode:"context"}),!0}if(C.current.some(he=>he.id===Ao))return b.current=".",O(Ao,Q.query,{from:Q.from,to:Q.to,query:Q.query,level:"items",selectedProviderId:Ao,selectedIndex:0,providers:C.current,itemMode:"default",mcpServerName:void 0,fileDirectory:b.current,inputMode:"context"}),!0}return S({from:Q.from,to:Q.to,query:Q.query,level:"categories",selectedIndex:0,providers:J,items:[],loading:!1,inputMode:void 0}),!0},[N,t,O,F,S,n]),W=f.useCallback(X=>{const Q=h.current;if(!Q)return!1;const ue=Q.level==="categories"?Q.providers.length:Q.items.length;if(ue<=0)return!0;const re=IOe(Q.selectedIndex,ue,X);return re===null||S({...Q,selectedIndex:re}),!0},[S]),I=f.useCallback(X=>{const Q=h.current;if(!Q)return!1;const ue=Q.level==="categories"?Q.providers.length:Q.items.length;return X<0||X>=ue?!1:(S({...Q,selectedIndex:X}),!0)},[S]),Y=f.useCallback(X=>{var J,q;const Q=h.current;if(!Q||Q.level!=="categories")return!1;const ue=Q.providers[X??Q.selectedIndex];if(!ue)return!1;x.current=ue.id,ue.id===Ao&&(b.current=".");const re=(q=(J=ue.tabs)==null?void 0:J.find(Z=>!Z.disabled))==null?void 0:q.id;return O(ue.id,Q.query,{...Q,level:"items",selectedProviderId:ue.id,selectedIndex:0,tabs:ue.tabs,selectedTabId:re,itemMode:ue.id===Mo?"mcpServers":"default",mcpServerName:void 0,fileDirectory:ue.id===Ao?b.current:void 0,inputMode:"search"}),!0},[O]),V=f.useCallback(X=>{const Q=h.current;if(!Q||Q.level!=="items"||!Q.selectedProviderId)return!1;const ue={...Q,query:X,selectedIndex:0,inputMode:"search"};return Q.selectedProviderId===Mo&&Q.itemMode==="mcpResources"&&Q.mcpServerName?(F(Q.mcpServerName,X,ue,{validateServer:Q.validateMcpServer}),!0):(O(Q.selectedProviderId,X,ue),!0)},[O,F]),j=f.useCallback(X=>{var re;const Q=h.current;if(!Q||Q.level!=="items"||!Q.selectedProviderId||!((re=Q.tabs)!=null&&re.some(J=>J.id===X&&!J.disabled)))return!1;if(Q.selectedTabId===X)return!0;const ue={...Q,selectedTabId:X,selectedIndex:0,inputMode:"search"};return O(Q.selectedProviderId,Q.query,ue),!0},[O]),ee=f.useCallback(()=>{const X=h.current;if(!X||X.level!=="items")return!1;if(X.selectedProviderId===Mo&&X.itemMode==="mcpResources")return O(Mo,"",{...X,query:"",selectedIndex:0,itemMode:"mcpServers",mcpServerName:void 0,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),"items";if(X.selectedProviderId===Ao){const Q=Fd(X.fileDirectory??b.current);if(Q!==".")return b.current=_Oe(Q),O(Ao,"",{...X,query:"",selectedIndex:0,fileDirectory:b.current,inputMode:"search"}),"items"}return S({...X,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}),L(),"categories"},[L,O,S]),se=f.useCallback(X=>{const Q=h.current;if(!Q)return!1;if(Q.level==="categories")return Y(X);const ue=e.current;if(!ue)return!1;if(Q.loading)return!0;const re=Q.items[X??Q.selectedIndex];if(!re)return!1;if(Q.selectedProviderId&&(x.current=Q.selectedProviderId),Q.selectedProviderId===Ao&&re.kind==="directory"&&re.targetPath)return b.current=Fd(re.targetPath),O(Ao,"",{...Q,query:"",selectedIndex:0,fileDirectory:b.current,inputMode:"search"}),!0;if(Q.selectedProviderId===Mo&&re.kind==="mcp-server"&&re.serverName)return y.current=re.serverName,F(re.serverName,"",{...Q,query:"",selectedIndex:0,itemMode:"mcpResources",mcpServerName:re.serverName,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),!0;const J=re.insertText??`@${Up(Bu(re.label))} `,q=re.composerTag&&!/\s$/.test(J)?`${J} `:J,Z=ue.state.doc.length;if(Q.from<0||Q.to<Q.from||Q.to>Z)return console.warn("[@mention] stale insertion range",{from:Q.from,to:Q.to,docLength:Z}),N(),!0;if(!ue.state.doc.sliceString(Q.from,Q.to).startsWith("@"))return console.warn("[@mention] stale insertion text",{from:Q.from,to:Q.to}),N(),!0;w.current=!0;const ye=AOe(Q.selectedProviderId,re,q),oe=q.trimEnd(),we=ye&&a?[a({from:Q.from,to:Q.from+oe.length,tag:ye})]:void 0;return ue.dispatch({changes:{from:Q.from,to:Q.to,insert:q},...we?{effects:we}:{},selection:{anchor:Q.from+q.length},scrollIntoView:!0}),ue.focus(),N({preserveProviderSelection:!0}),!0},[N,Y,a,O,F,e]);return{state:u,close:N,closeIfOpen:$,refreshForView:B,moveSelection:W,select:I,accept:se,enterCategory:Y,selectTab:j,backToCategories:ee,updateSearch:V}}const DOe=vn.mark({class:"cm-input-slash"}),LOe=vn.mark({class:"cm-input-at"}),POe=vn.mark({class:"cm-input-code"});class OOe extends Ol{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 VF(e,t,n){const s=new Ou,r=e.state.doc,i=[];for(let o=1;o<=r.lines;o++){const a=r.line(o),c=a.text,u=a.from;if(c.startsWith("/")){const g=c.indexOf(" "),b=g===-1?c.length:g;i.push({from:u,to:u+b,deco:DOe})}const d=sOe(c,t(),n());if(d){const g=c.endsWith(" ")?"":" ";i.push({from:u+c.length,to:u+c.length,deco:vn.widget({widget:new OOe(`${g}${d}`),side:1})})}const h=/@[^\s]+/g;let m;for(;(m=h.exec(c))!==null;)i.push({from:u+m.index,to:u+m.index+m[0].length,deco:LOe});const p=/`[^`]+`/g;for(;(m=p.exec(c))!==null;)i.push({from:u+m.index,to:u+m.index+m[0].length,deco:POe})}i.sort((o,a)=>o.from-a.from||o.to-a.to);for(const{from:o,to:a,deco:c}of i)s.add(o,a,c);return s.finish()}function BOe(e=()=>[],t=()=>"en"){return ai.fromClass(class{constructor(n){Me(this,"decorations");this.decorations=VF(n,e,t)}update(n){(n.docChanged||n.viewportChanged)&&(this.decorations=VF(n.view,e,t))}},{decorations:n=>n.decorations})}const $Oe=Nt.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 Vp(e){return e instanceof HTMLElement?e.isContentEditable?!0:!!e.closest('input, textarea, select, [contenteditable="true"], .cm-editor, [data-keyboard-scope]'):!1}function yC(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 cf(e,t){return{[e]:yC(t)}}const zOe=1e3,FOe=10,WF="web-shell-tooltip-styles",HOe=`
[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 qOe(){if(document.getElementById(WF))return;const e=document.createElement("style");e.id=WF,e.textContent=HOe,document.head.appendChild(e)}function UOe(e,t,n){return t<=0?null:((e+(n==="up"?-1:1))%t+t)%t}function VOe(e){return typeof e.apply=="string"&&e.apply.trim().startsWith("/")}function DI(e){return VOe(e)}function WOe(e){var t;return typeof e.apply=="string"?e.apply.trim():((t=e.displayLabel)==null?void 0:t.trim())||e.label}function GOe(e){e.querySelectorAll(".cm-completionInfo-hover").forEach(t=>{t.remove()})}function KOe(e,t,n){if(!t.detail||!DI(t))return;const s=e.closest("[data-web-shell-tooltip-portal]");if(!s)return;let r=s.querySelector(".cm-completionInfo-hover");r||(r=document.createElement("div"),r.className="cm-tooltip cm-completionInfo cm-completionInfo-hover cm-completionInfo-right-narrow",s.appendChild(r)),r.textContent=`${WOe(t)}

${t.detail}`;const i=r.dataset.hideTimerId;i&&(window.clearTimeout(Number(i)),delete r.dataset.hideTimerId);const o=r.getBoundingClientRect(),a=18,c=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+c),Math.max(u,h-o.height-u));r.style.position="fixed",r.style.left=`${p}px`,r.style.top=`${g}px`,r.style.right="auto",r.style.bottom="auto"}function YOe(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 XOe(e){if(!e.detail||!DI(e))return null;const t=document.createElement("span");return t.className="cm-command-hover-info-anchor",t.setAttribute("aria-hidden","true"),queueMicrotask(()=>{const n=t.closest("li");!n||n.hasAttribute("data-web-shell-hover-info")||(n.setAttribute("data-web-shell-hover-info","true"),n.addEventListener("mouseenter",s=>{KOe(t,e,s)}),n.addEventListener("mouseleave",()=>{const s=t.closest("[data-web-shell-tooltip-portal]");s&&YOe(s)}))}),t}function QOe(e){return e.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function JOe(e){return[...e].length>zOe||e.split(`
`).length>FOe}function ZOe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function eBe(e,t,n){const r=`[Pasted Content ${[...n].length} chars]`,i=t===1?r:`${r} #${t}`;return e.set(i,n),{placeholderText:i,nextPasteId:t+1}}function tBe(e,t){for(const n of e.keys())t.includes(n)||e.delete(n);return e.size===0?1:null}function nBe(e,t){if(e.size===0)return t;const n=[...e.keys()].sort((r,i)=>i.length-r.length),s=new RegExp(n.map(ZOe).join("|"),"g");return t.replace(s,r=>e.get(r)??r)}function ux(e){return e3(e)}function sBe(e){return e.map(ux).join(`
`)}function xC(e){var t;return((t=e.label)==null?void 0:t.trim())??""}function vC(e){var t;return((t=e.value)==null?void 0:t.trim())??""}function LI(e){return vC(e)||xC(e)||e.id}function rBe(e,t){const n=sBe(t);return n?e?`${n}

${e}`:n:e}function iBe(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 s=0;const r=[];for(const i of n)i.start<s||(r.push(e.slice(s,i.start)),r.push(ux(i.tag)),s=i.end);return r.push(e.slice(s)),r.join("")}function wC(e){const t={...e};return delete t.iconUrl,delete t.renderContent,delete t.tooltip,delete t.tooltipText,delete t.onClick,t}const Z0=rs.define({map:e=>e}),PI=rs.define(),Ac=rs.define();let oBe=0;class aBe extends Ol{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 s=document.createElement("span"),r=wC(this.tag);s.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&&(s.setAttribute("role","button"),s.tabIndex=0,s.style.cursor="pointer",s.addEventListener("pointerdown",b=>{b.preventDefault(),b.stopPropagation()}),s.addEventListener("mousedown",b=>{b.preventDefault(),b.stopPropagation()}),s.addEventListener("click",b=>{var v,x;b.stopPropagation(),(x=(v=this.tag).onClick)==null||x.call(v,{tag:r,placement:"composer",readonly:!1,anchorRect:s.getBoundingClientRect()})}),s.addEventListener("keydown",b=>{var v,x;b.key!=="Enter"&&b.key!==" "||(b.preventDefault(),(x=(v=this.tag).onClick)==null||x.call(v,{tag:r,placement:"composer",readonly:!1,anchorRect:s.getBoundingClientRect()}))}));const i=xC(this.tag),o=vC(this.tag),a=this.tag.kind?"":i,c=this.tag.iconUrl??t0(this.tag.kind),u=c&&(oj(c)||tb(c))?c:void 0;let d;try{d=(p=(m=this.tag).renderContent)==null?void 0:p.call(m,{tag:r,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=I7.createRoot(b),this.contentRoot.render(d),s.appendChild(b),h=!0}catch(v){(g=this.contentRoot)==null||g.unmount(),this.contentRoot=null,console.warn("[WebShell] inline tag renderContent failed",v)}}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",yC(u)),s.appendChild(b)}return h||this.appendDefaultContent(s,a,o),this.tag.tooltip!==void 0&&this.tag.tooltip!==null&&this.appendTooltip(s,this.tag.tooltip),this.tag.removable!==!1&&this.appendRemoveButton(s,n),s}appendDefaultContent(n,s,r){if(s){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=s,n.appendChild(i)}if(r){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=r,n.appendChild(i)}else if(!s){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,s){var a;const r=document.createElement("span");r.setAttribute("role","tooltip"),r.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=I7.createRoot(r),this.tooltipRoot.render(s),n.appendChild(r),r.id=`composer-tag-tooltip-${++oBe}`,n.setAttribute("aria-describedby",r.id)}catch(c){(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",c);return}const i=()=>{r.style.display="block"},o=()=>{r.style.display="none"};n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",o),n.addEventListener("focusin",i),n.addEventListener("focusout",o)}appendRemoveButton(n,s){const r=document.createElement("button");r.type="button",r.setAttribute("aria-label",`Remove ${LI(this.tag)}`),r.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;",r.textContent="×",r.addEventListener("mousedown",i=>i.preventDefault()),r.addEventListener("keydown",i=>{if(i.key==="Enter"||i.key===" "){i.stopPropagation();return}i.key!=="Backspace"&&i.key!=="Delete"||(i.preventDefault(),i.stopPropagation(),r.click())}),r.addEventListener("click",i=>{i.stopPropagation();const o=[];s.state.field(Qh).between(0,s.state.doc.length,(a,c,u)=>{const d=u.spec.tag;(d==null?void 0:d.id)===this.tag.id&&d.removable!==!1&&o.push({from:a,to:c,insert:""})}),o.length!==0&&(s.dispatch({changes:o,effects:PI.of({predicate:a=>a.id===this.tag.id}),scrollIntoView:!0}),s.focus())}),r.addEventListener("mouseenter",()=>{r.style.color="var(--error-color)"}),r.addEventListener("mouseleave",()=>{r.style.color="var(--muted-foreground)"}),n.appendChild(r)}destroy(){var n,s;(n=this.contentRoot)==null||n.unmount(),(s=this.tooltipRoot)==null||s.unmount(),this.contentRoot=null,this.tooltipRoot=null}ignoreEvent(){return!1}}function lBe(e){const t={widget:new aBe(e.tag),inclusive:!1,tag:e.tag};return vn.replace(t).range(e.from,e.to)}const Qh=Ho.define({create(){return vn.none},update(e,t){let n=e.map(t.changes);for(const s of t.effects)s.is(Z0)?n=n.update({add:[lBe(s.value)]}):s.is(PI)?n=n.update({filter:(r,i,o)=>{const a=o.spec.tag;return a&&s.value.predicate?!s.value.predicate(a):!0}}):s.is(Ac)&&(n=vn.none);return n},provide:e=>[Nt.decorations.from(e),Nt.atomicRanges.of(t=>t.state.field(e))]});function GF(e){const t=[],n=e.state.field(Qh,!1);return n==null||n.between(0,e.state.doc.length,(s,r,i)=>{const o=i.spec.tag;o&&t.push(wC(o))}),t}function cBe(e){const t=[];return e.state.field(Qh).between(0,e.state.doc.length,(n,s,r)=>{const i=r.spec.tag;i&&t.push({start:n,end:s,tag:wC(i)})}),t}const KF=new c0,YF=new c0,XF=new c0;function Qm(e,t){return t&&(e.length===0||t.startsWith(e))?t:null}function uBe(e,t){const n=Qm(e,t);if(!n||e.length===0)return null;const s=n.slice(e.length);return s.length>0?s:null}class dBe extends Ol{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 QF(e){return ai.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,s=t.state.doc.toString(),r=uBe(s,e);return!r||!n.empty||n.head!==s.length?vn.none:vn.set([vn.widget({widget:new dBe(r),side:1}).range(s.length)])}},{decorations:t=>t.decorations})}function JF(e,t){const n=e.state.doc;if(n.lines<=1)return"history";const s=e.state.selection.main;if(!s.empty)return"editor";const r=s.head,i=n.lineAt(r);return t==="up"?i.number>1?"editor":r>i.from?(e.dispatch({selection:{anchor:i.from},scrollIntoView:!0}),"handled"):"history":i.number<n.lines?"editor":r<i.to?(e.dispatch({selection:{anchor:i.to},scrollIntoView:!0}),"handled"):"history"}function hBe(e){const{onSubmit:t,onInputTextChange:n,onCycleMode:s,onToggleShortcuts:r,disabled:i=!1,placeholderText:o="Type a message...",commands:a,skills:c=[],slashCommandCategoryOrder:u,queuedMessages:d=[],onPopQueuedMessages:h,currentMode:m="default",onFocusFooter:p,dialogOpen:g=!1,followupState:b,onAcceptFollowup:v,onDismissFollowup:x,sessionName:y,composerInput:w,composerInputVersion:k,builtinAtProviders:T,atProviders:_,atWorkspaceCwd:C,composerTagIcons:S,parseUserMessageContent:L,renderComposerTag:N,renderComposerTagTooltip:$,onComposerTagClick:M,editorTheme:P}=e,E=PG(),{language:O,t:z}=ot(),F=f.useRef(null),B=f.useRef(null),W=f.useRef(t);W.current=t;const I=f.useRef(n);I.current=n;const Y=f.useRef(s);Y.current=s;const V=f.useRef(r);V.current=r;const j=f.useRef(i);j.current=i;const ee=f.useRef(a);ee.current=a;const se=f.useRef(c);se.current=c;const X=f.useRef(u);X.current=u;const Q=f.useRef(z);Q.current=z;const ue=f.useRef(d);ue.current=d;const re=f.useRef(h);re.current=h;const J=f.useRef(b);J.current=b;const q=f.useRef(v);q.current=v;const Z=f.useRef(x);Z.current=x;const he=f.useRef(p);he.current=p;const ye=f.useRef(O);ye.current=O;const oe=f.useRef(void 0);if(E&&C){const ae=E.client.workspaceByCwd(C);oe.current={...E.actions,async globWorkspace(xe,ze){var At,Un;(At=ze==null?void 0:ze.signal)==null||At.throwIfAborted();const Qe=await ae.glob(xe,{maxResults:ze==null?void 0:ze.maxResults,signal:ze==null?void 0:ze.signal});return(Un=ze==null?void 0:ze.signal)==null||Un.throwIfAborted(),{matches:Array.isArray(Qe.matches)?Qe.matches.filter(Os=>typeof Os=="string"):[]}},async listDirectory(xe,ze){var Kt,At;if((Kt=ze==null?void 0:ze.signal)!=null&&Kt.aborted)return{kind:"list",path:xe,entries:[],truncated:!1};const Qe=await ae.dirList(xe);return(At=ze==null?void 0:ze.signal)!=null&&At.aborted?{kind:"list",path:xe,entries:[],truncated:!1}:Qe}}}else oe.current=E==null?void 0:E.actions;const we=f.useRef(S);we.current=S;const Ve=f.useRef(L);Ve.current=L;const lt=f.useRef(N);lt.current=N;const Et=f.useRef($);Et.current=$;const pt=f.useRef(M);pt.current=M;const je=f.useCallback(ae=>{var At;const xe=ae.icon??t0(ae.kind,we.current),ze={tag:ae,placement:"composer",readonly:!1};let Qe;try{Qe=(At=Et.current)==null?void 0:At.call(Et,ze)}catch(Un){console.warn("[WebShell] inline tag tooltip render failed",Un)}const Kt=typeof Qe=="string"||typeof Qe=="number"?String(Qe):void 0;return{...ae,...xe?{iconUrl:xe}:{},...lt.current?{renderContent:lt.current}:{},...Qe!=null?{tooltip:Qe}:{},...Kt?{tooltipText:Kt}:{},...pt.current?{onClick:pt.current}:{}}},[]),[Ae,De]=f.useState(!1),Ne=f.useRef(Ae);Ne.current=Ae;const tt=ROe({viewRef:B,disabledRef:j,shellModeRef:Ne,workspaceActionsRef:oe,workspaceKey:C,builtinProviders:T,providers:_,createInlineTagEffect:ae=>Z0.of({...ae,tag:je(ae.tag)})}),Se=tt.close,Be=tt.refreshForView;f.useEffect(()=>{const ae=B.current;if(!ae)return;const xe=[Ac.of()];ae.state.field(Qh).between(0,ae.state.doc.length,(ze,Qe,Kt)=>{const At=Kt.spec.tag;At&&xe.push(Z0.of({from:ze,to:Qe,tag:je(wC(At))}))}),xe.length!==1&&ae.dispatch({effects:xe})},[S,M,N,$,je]);const le=f.useCallback(()=>{var ae,xe,ze;(ae=J.current)!=null&&ae.isVisible&&((xe=Z.current)==null||xe.call(Z)),De(Qe=>!Qe),(ze=B.current)==null||ze.focus()},[]),[Le,sn]=f.useState(!1),[Cn,In]=f.useState(""),[_t,Te]=f.useState([]),[at,ke]=f.useState(0),Pe=f.useRef(null),ve=f.useRef(null),Ke=f.useRef(""),[me,qe]=f.useState([]),Mt=f.useRef([]),ln=f.useRef(new Map),Ft=f.useRef(1),[st,Tn]=f.useState([]),ne=f.useRef([]);ne.current=st;const gt=f.useRef(null),bt=f.useCallback(()=>{gt.current===null&&(gt.current=[...ne.current])},[]),It=f.useCallback(()=>{const ae=gt.current;if(ae===null)return;gt.current=null;const xe=[...ae];ne.current=xe,Tn(xe)},[]),Rt=f.useCallback(()=>{gt.current=null},[]),We=f.useCallback(()=>{ne.current=[],Tn([])},[]),Zn=f.useCallback((ae,xe)=>{We(),ae.dispatch({changes:{from:0,to:ae.state.doc.length,insert:xe},effects:Ac.of(),selection:{anchor:xe.length}})},[We]),Ar=f.useCallback((ae,xe)=>{const ze=rj(xe,Ve.current,"[WebShell] failed to parse composer history content",{requireSourcePreservation:!0}),Qe=(ze==null?void 0:ze.some(Un=>Un.type==="tag"))??!1;if(!ze||!Qe){Zn(ae,xe);return}const Kt=[Ac.of()];let At="";for(const Un of ze){if(Un.type==="text"){At+=Un.text;continue}const Os=e3(Un.tag),Ss=At.length;At+=Os,Kt.push(Z0.of({from:Ss,to:At.length,tag:je(Un.tag)}))}We(),ae.dispatch({changes:{from:0,to:ae.state.doc.length,insert:At},effects:Kt,selection:{anchor:At.length}})},[We,je,Zn]),Ge=f.useCallback((ae,xe)=>{if(Ne.current){Zn(ae,xe);return}Ar(ae,xe)},[Ar,Zn]),dt=f.useCallback(ae=>{const xe=B.current;xe&&Ge(xe,ae)},[Ge]),bn=f.useRef(w);bn.current=w;const Ht=f.useRef(()=>!0),Rn=f.useRef(null),[Gn,Or]=f.useState(null),Bn=f.useRef(null),_n=f.useRef(!1),gs=f.useCallback(ae=>{Bn.current=ae,Or(ae)},[]),Qn=f.useCallback(()=>{const ae=Rn.current,xe=B.current;if(!ae||!xe)return;const ze=xe.state.doc,Qe=ae.from+ae.text.length;ze.length===Qe&&ze.sliceString(ae.from,Qe)===ae.text&&xe.dispatch({changes:{from:ae.from,to:Qe,insert:""}}),Rn.current=null},[]),Dn=f.useCallback(()=>{Qn(),Se()},[Qn,Se]),wn=tt.closeIfOpen,br=f.useCallback(()=>{const ae=wn();return ae?(ae==="closed"&&Qn(),!0):!1},[Qn,wn]),Qs=f.useCallback((ae,xe)=>{var Un;if(!ae||j.current||Ne.current){gs(null);return}if(_n.current){gs(null);return}const ze=ae.state.selection.main;if(!ze.empty){gs(null);return}const Qe=aOe(ae.state.doc.toString(),ze.head,ee.current,se.current,ye.current,Os=>Q.current(Os),X.current??dv);if(!Qe){gs(null);return}Dn();const Kt=xe??((Un=Bn.current)==null?void 0:Un.selectedIndex)??0,At=Math.max(0,Math.min(Kt,Qe.items.length-1));gs({...Qe,selectedIndex:At})},[Dn,gs]),hs=f.useCallback(()=>{gs(null)},[gs]),cn=f.useCallback(ae=>{const xe=Bn.current;return!xe||ae<0||ae>=xe.items.length?!1:(xe.selectedIndex===ae||gs({...xe,selectedIndex:ae}),!0)},[gs]),Jn=f.useCallback(ae=>{const xe=Bn.current;if(!xe)return!1;const ze=UOe(xe.selectedIndex,xe.items.length,ae);return ze===null?!1:(gs({...xe,selectedIndex:ze}),!0)},[gs]),Wi=f.useCallback(ae=>{const xe=B.current,ze=Bn.current;if(!xe||!ze)return!1;const Qe=ze.items[ae??ze.selectedIndex];return Qe?(xe.dispatch({changes:{from:ze.from,to:ze.to,insert:Qe.apply},selection:{anchor:ze.from+Qe.apply.length},scrollIntoView:!0}),xe.focus(),!0):!1},[]),[is,tr]=f.useState(!1);f.useEffect(()=>{const ae=B.current,xe=(ae==null?void 0:ae.state.doc.toString())??"",ze=Qm(xe,b!=null&&b.isVisible?b.suggestion:null);tr(xe.trim().length>0||!!ze||st.length>0||me.length>0)},[st,me,b==null?void 0:b.isVisible,b==null?void 0:b.suggestion]);const kr=FF(),Br=FF("qwen-web-shell-command-history"),{push:gr,navigateUp:bs,navigateDown:ir,isNavigating:or,reset:pe,getReverseMatches:Oe,getLastEntry:rt,resetSearch:Ut}=kr,fn=f.useRef({push:gr,navigateUp:bs,navigateDown:ir,isNavigating:or,reset:pe,getReverseMatches:Oe,getLastEntry:rt,resetSearch:Ut});fn.current={push:gr,navigateUp:bs,navigateDown:ir,isNavigating:or,reset:pe,getReverseMatches:Oe,getLastEntry:rt,resetSearch:Ut};const un=f.useRef(Br);un.current=Br,Mt.current=me;const _e=f.useCallback(ae=>{const xe=Ne.current,Qe=(xe?un.current:fn.current).getReverseMatches(ae);return xe?Qe:Qe.filter(Kt=>!Kt.trimStart().startsWith("/"))},[]),Ue=f.useCallback(()=>{if(j.current)return;const ae=B.current;if(!ae)return;hs(),Dn();const xe=ae.state.doc.toString();Ke.current=xe,sn(!0),In("");const ze=Ne.current?un.current:fn.current;Te(_e("")),ke(0),ze.resetSearch(),setTimeout(()=>{var Qe;return(Qe=Pe.current)==null?void 0:Qe.focus()},0)},[Dn,hs,_e]),zt=f.useRef(Ue);zt.current=Ue;const Sn=f.useCallback(()=>{if(j.current)return;const ae=B.current;if(!ae)return;if(cl(ae.state)==="active"){lf(!1)(ae),ae.focus();return}if(ae.state.doc.lines>1){ae.focus();return}const xe=Ne.current?un.current:fn.current,ze=ae.state.doc.toString(),Qe=xe.navigateUp(ze);Qe!==null&&(Ne.current||bt(),Ge(ae,Qe)),ae.focus()},[bt,Ge]),Gt=f.useCallback(()=>{if(j.current)return;const ae=B.current;if(!ae)return;if(cl(ae.state)==="active"){lf(!0)(ae),ae.focus();return}if(ae.state.doc.lines>1){ae.focus();return}const xe=Ne.current?un.current:fn.current,ze=xe.navigateDown();if(ze!==null){const Qe=!Ne.current&&!xe.isNavigating();Ge(ae,ze),Qe&&It()}ae.focus()},[Ge,It]);f.useEffect(()=>{var gi,sr;if(!F.current)return;qOe();const ae=document.createElement("div");ae.setAttribute("data-web-shell-tooltip-portal",""),ae.style.position="fixed",ae.style.inset="0",ae.style.zIndex="var(--web-shell-tooltip-z-index)",ae.style.pointerEvents="none";const xe=/\b\S*theme(?:Dark|Light)\S*/gi,ze=()=>{var Yt,Nn;let Je=F.current,Lt=null;if(F.current){const Hn=getComputedStyle(F.current);for(let He=0;He<Hn.length;He+=1){const pn=Hn[He];pn.startsWith("--")&&ae.style.setProperty(pn,Hn.getPropertyValue(pn))}Hn.getPropertyValue("--web-shell-tooltip-z-index").trim()||ae.style.setProperty("--web-shell-tooltip-z-index","1000")}for(;Je;){const Hn=(Nn=(Yt=Je.className)==null?void 0:Yt.match)==null?void 0:Nn.call(Yt,xe);if(Hn){Lt=Hn[0];break}Je=Je.parentElement}Lt&&(ae.className=Lt)};ze(),document.body.appendChild(ae);const Qe=new MutationObserver(ze);let Kt=F.current;for(;Kt&&(Qe.observe(Kt,{attributes:!0,attributeFilter:["class","style"]}),!((sr=(gi=Kt.className)==null?void 0:gi.match)!=null&&sr.call(gi,xe)));)Kt=Kt.parentElement;const At=(Je,Lt,Yt,Nn=!1)=>{const Hn=Yt===void 0?cBe(Je):[],He=Je.state.doc.toString(),pn=J.current,js=Lt===void 0&&!Nn&&Hn.length===0&&(pn!=null&&pn.isVisible)?Qm(He,pn.suggestion):null,ls=Lt??js??He,Cs=ls.length-ls.trimStart().length,Di=ls.trim(),lo=Lt===void 0&&js===null?Hn.map(zr=>({...zr,start:zr.start-Cs,end:zr.end-Cs})).filter(zr=>zr.end>0).map(zr=>({...zr,start:Math.max(0,zr.start)})):[],Bs=Yt??ne.current;if(!Di&&Bs.length===0&&Hn.length===0)return!0;const Si=Yt===void 0?iBe(Di,lo):Di,ui=nBe(ln.current,Si),Kn=rBe(ui,Bs),Ts=Mt.current,Bl=Ne.current,Li=Bl?`!${Kn}`:Kn,di=wge(Li,[...Bs,...lo.map(zr=>zr.tag)]);let $l=!1;const Uc=()=>{var zr,Ra;$l||($l=!0,gs(null),js&&((zr=q.current)==null||zr.call(q,"enter",{skipOnAccept:!0})),(Ra=Z.current)==null||Ra.call(Z),ln.current.clear(),Ft.current=1,Bl?(un.current.push(ui),un.current.reset()):(fn.current.push(ui),fn.current.reset()),_n.current=!1,Rt(),Tn([]),qe([]),Je.dispatch({changes:{from:0,to:Je.state.doc.length,insert:""},effects:Ac.of()}))};return W.current(Li,Ts.length>0?[...Ts]:void 0,Uc,di.length>0?{inputAnnotations:di}:void 0)===!1||Uc(),!0};Ht.current=At;const Un=Je=>(Je.dispatch(Je.state.replaceSelection(`
`)),!0),Os=(Je,Lt)=>{var He;const Yt=J.current,Nn=Yt==null?void 0:Yt.suggestion,Hn=Qm(Je.state.doc.toString(),Nn);return!(Yt!=null&&Yt.isVisible)||!Hn?!1:(Je.dispatch({changes:{from:0,to:Je.state.doc.length,insert:Hn},selection:{anchor:Hn.length},scrollIntoView:!0}),Je.focus(),(He=q.current)==null||He.call(q,Lt,{skipOnAccept:!0}),!0)},Ss=w1.of([{key:"Backspace",run:Je=>{var Hn;const Lt=Je.state.selection.main;if(!Lt.empty||Lt.from!==0)return!1;let Yt=!1;if(Je.state.field(Qh).between(0,1,He=>{He===0&&(Yt=!0)}),Yt)return!1;let Nn=-1;for(let He=ne.current.length-1;He>=0;He-=1)if(((Hn=ne.current[He])==null?void 0:Hn.removable)!==!1){Nn=He;break}return Nn<0?!1:(Tn(He=>He.filter((pn,js)=>js!==Nn)),!0)}},{key:"Delete",run:Je=>{const Lt=Je.state.selection.main;if(!Lt.empty||Lt.from!==0)return!1;let Yt=!1;if(Je.state.field(Qh).between(0,1,Hn=>{Hn===0&&(Yt=!0)}),Yt)return!1;const Nn=ne.current.findIndex(Hn=>Hn.removable!==!1);return Nn<0?!1:(Tn(Hn=>Hn.filter((He,pn)=>pn!==Nn)),!0)}},{key:"Enter",run:Je=>{var Hn;if(tt.accept())return!0;if(Bn.current)return Wi();if(cl(Je.state)==="active")return!1;const Lt=J.current,Nn=GF(Je).length>0?null:Qm(Je.state.doc.toString(),Lt==null?void 0:Lt.suggestion);return Lt!=null&&Lt.isVisible&&Nn?((Hn=q.current)==null||Hn.call(q,"enter",{skipOnAccept:!0}),At(Je,Nn)):At(Je)}},{key:"Shift-Enter",run:Un},{key:"Ctrl-j",run:Un},{key:"Mod-Enter",run:Un},{key:"Alt-Enter",run:Un},{key:"Escape",run:()=>br()?!0:Bn.current?(hs(),!0):Ne.current?(De(!1),!0):!1},{key:"Ctrl-o",run:()=>!0},{key:"Ctrl-l",run:()=>!0},{key:"Ctrl-y",run:()=>!0},{key:"ArrowUp",run:Je=>{var pn;const Lt=Ne.current?un.current:fn.current;if(_n.current)l2(Je),hs(),Dn();else{if(tt.moveSelection("up")||Jn("up"))return!0;if(cl(Je.state)==="active")return lf(!1)(Je)}const Nn=JF(Je,"up");if(Nn==="handled")return!0;if(Nn==="editor")return!1;if(Ne.current){const js=Je.state.doc.toString(),ls=Lt.navigateUp(js);return ls===null||(_n.current=!0,Ge(Je,ls)),!0}if(ue.current.length>0&&(pn=re.current)!=null&&pn.call(re))return!0;const Hn=Je.state.doc.toString(),He=Lt.navigateUp(Hn);return He===null?!1:(bt(),_n.current=!0,Ge(Je,He),!0)}},{key:"ArrowDown",run:Je=>{var pn;const Lt=Ne.current?un.current:fn.current;if(_n.current)l2(Je),hs(),Dn();else{if(tt.moveSelection("down")||Jn("down"))return!0;if(cl(Je.state)==="active")return lf(!0)(Je)}const Nn=JF(Je,"down");if(Nn==="handled")return!0;if(Nn==="editor")return!1;if(Ne.current){const js=Lt.navigateDown();return js===null||(_n.current=Lt.isNavigating(),Ge(Je,js)),!0}const Hn=Lt.navigateDown();if(Hn===null)return((pn=he.current)==null?void 0:pn.call(he))??!1;const He=!Lt.isNavigating();return _n.current=!He,Ge(Je,Hn),He&&It(),!0}},{key:"Ctrl-r",run:()=>(zt.current(),!0)},{key:"Tab",run:Je=>{if(tt.accept()||Os(Je,"tab"))return!0;if(Bn.current)return Wi();if(cl(Je.state)==="active")return are(Je);const Lt=Je.state.doc.toString(),Yt=nOe(Lt,ee.current,ye.current);if(Yt)return Je.dispatch({changes:{from:0,to:Je.state.doc.length,insert:Yt},selection:{anchor:Yt.length}}),!0;const Nn=tOe(Lt,ee.current);return Nn&&Je.dispatch({changes:{from:0,to:Je.state.doc.length,insert:Nn},selection:{anchor:Nn.length}}),!0}},{key:"ArrowRight",run:Je=>!!(cl(Je.state)!=="active"&&Os(Je,"right"))},{key:"Shift-Tab",run:()=>{var Je;return(Je=Y.current)==null||Je.call(Y),!0}}]),yr=Nt.updateListener.of(Je=>{if(Je.docChanged&&ln.current.size>0){const Yt=tBe(ln.current,Je.state.doc.toString());Yt!==null&&(Ft.current=Yt)}Je.transactions.some(Yt=>Yt.isUserEvent("input")||Yt.isUserEvent("delete"))&&(_n.current=!1),(Je.docChanged||Je.selectionSet)&&(Qs(Je.view),_n.current?Dn():Be(Je.view)&&hs())});let Zr=!1;const _c=Nt.updateListener.of(Je=>{const Lt=Rn.current,Yt=cl(Je.state)==="active";if(Lt){const Nn=Je.state.doc;if(!(Nn.length===Lt.from+Lt.text.length&&Nn.sliceString(Lt.from)===Lt.text))Rn.current=null;else if(Zr&&!Yt){Rn.current=null;const{view:He}=Je,{from:pn}=Lt;window.setTimeout(()=>{if(B.current!==He)return;const js=He.state.doc;js.length===pn+Lt.text.length&&js.sliceString(pn)===Lt.text&&He.dispatch({changes:{from:pn,to:pn+Lt.text.length,insert:""}})},0)}}Zr=Yt,Yt||GOe(ae)}),xr=Ks.create({doc:"",extensions:[gm.highest(Ss),TPe,bI(),w1.of([...vI,...yI]),hre({override:[],activateOnTyping:!0,icons:!1,optionClass:Je=>{const Lt=[];return Je.type==="file"&&Lt.push("cm-file-completion"),DI(Je)&&Lt.push("cm-command-info-completion"),Lt.join(" ")},addToOptions:[{render:XOe,position:90}],maxRenderedOptions:300,aboveCursor:!0,positionInfo:(Je,Lt,Yt,Nn,Hn)=>{const He=Nn.bottom-Nn.top,pn=Hn.bottom-Lt.bottom,js=pn>=He||pn>Lt.top,ls=js?"top":"bottom",Cs=js?Yt.bottom-Lt.top:Lt.bottom-Yt.top;return{style:`${ls}: ${Cs}px`,class:"cm-completionInfo-right-narrow"}},activateOnCompletion:Je=>typeof Je.apply=="string"&&Je.apply.endsWith(" ")}),cIe({parent:ae}),YF.of(Vz("")),XF.of(QF(null)),Nt.lineWrapping,KF.of(Nt.editable.of(!0)),BOe(()=>ee.current,()=>ye.current),$Oe,Qh,yr,_c,Nt.updateListener.of(Je=>{var Lt;if(Je.docChanged){const Yt=Je.state.doc.toString();(Lt=I.current)==null||Lt.call(I,Yt);const Nn=J.current,Hn=Qm(Yt,Nn!=null&&Nn.isVisible?Nn.suggestion:null);tr(Yt.trim().length>0||!!Hn||ne.current.length>0||Mt.current.length>0)}}),Nt.inputHandler.of((Je,Lt,Yt,Nn)=>{var Hn;return Nn==="!"&&Je.state.doc.toString()===""&&cl(Je.state)!=="active"?(le(),!0):Nn==="?"&&Je.state.doc.toString()===""&&cl(Je.state)!=="active"?((Hn=V.current)==null||Hn.call(V),!0):!1}),Nt.domEventHandlers({blur(Je){return hs(),Je.relatedTarget instanceof Element&&Je.relatedTarget.closest('[data-at-mention-panel="true"]')||window.setTimeout(()=>{const Lt=B.current;Lt!=null&&Lt.hasFocus||document.activeElement instanceof Element&&document.activeElement.closest('[data-at-mention-panel="true"]')||Dn()},0),!1},paste(Je){var js,ls,Cs,Di;const Lt=(js=Je.clipboardData)==null?void 0:js.items;if(!Lt)return!1;let Yt=!1;for(const lo of Lt)if(lo.type.startsWith("image/")&&/^image\/(png|jpeg|gif|webp)$/i.test(lo.type)){Yt=!0;const Bs=lo.getAsFile();if(!Bs)continue;const Si=lo.type,ui=new FileReader;ui.onload=()=>{const Kn=ui.result.split(",")[1];qe(Ts=>[...Ts,{data:Kn,media_type:Si}])},ui.readAsDataURL(Bs)}if(Yt)return Je.preventDefault(),!0;const Nn=QOe(((ls=Je.clipboardData)==null?void 0:ls.getData("text/plain"))??"");if(!Nn||!JOe(Nn))return!1;Je.preventDefault(),ua.state.doc.toString()===""&&((Cs=J.current)!=null&&Cs.isVisible)&&((Di=Z.current)==null||Di.call(Z));const{placeholderText:Hn,nextPasteId:He}=eBe(ln.current,Ft.current,Nn);Ft.current=He;const pn=ua.state.selection.main;return ua.dispatch({changes:{from:pn.from,to:pn.to,insert:Hn},selection:{anchor:pn.from+Hn.length},scrollIntoView:!0}),!0}}),Nt.theme(P)]}),ua=new Nt({state:xr,parent:F.current});B.current=ua,ua.focus();const Nr=ua.state.doc.toString().trim();return tr(Nr.length>0||ne.current.length>0||Mt.current.length>0),()=>{ua.dispatch({effects:Ac.of()}),ua.destroy(),B.current=null,Qe.disconnect(),ae.remove()}},[]),f.useEffect(()=>{const ae=B.current;ae&&(ae.dispatch({effects:KF.reconfigure(Nt.editable.of(!i))}),i||ae.focus())},[i]),f.useEffect(()=>{const ae=B.current;if(!ae)return;const xe=!i&&(b!=null&&b.isVisible)&&b.suggestion?b.suggestion:null,ze=xe??(Ae?z("editor.shellPlaceholder"):o);ae.dispatch({effects:[YF.reconfigure(Vz(ze)),XF.reconfigure(QF(xe))]})},[i,o,Ae,z,b==null?void 0:b.isVisible,b==null?void 0:b.suggestion]),f.useEffect(()=>{const ae=B.current;!ae||cl(ae.state)!=="active"||(l2(ae),window.setTimeout(()=>{B.current===ae&&a2(ae)},0))},[O]);const Ls=[a.map(ae=>{var xe;return[ae.name,ae.description??"",ae.source??"",ae.displayCategory??"",ae.argumentHint??"",((xe=ae.subcommands)==null?void 0:xe.join(","))??""].join("\0")}).join(""),c.map(ae=>[ae.name,ae.description].join("\0")).join(""),(u==null?void 0:u.join("|"))??""].join("");f.useEffect(()=>{Bn.current&&Qs(B.current)},[Ls,O,Qs]),f.useEffect(()=>{const ae=B.current;ae&&(g?(hs(),Dn(),ae.contentDOM.blur()):ae.focus())},[Dn,g,hs]),f.useEffect(()=>{const ae=xe=>{var yr,Zr,_c;if(j.current||Le||g||xe.defaultPrevented)return;const ze=xe.target,Qe=(yr=F.current)==null?void 0:yr.contains(ze),Kt=document.activeElement===document.body;if(!Qe&&!Kt)return;const At=B.current,Un=J.current,Os=Qm((At==null?void 0:At.state.doc.toString())??"",Un==null?void 0:Un.suggestion);if(At&&!At.hasFocus&&(Un!=null&&Un.isVisible)&&Os&&!Vp(xe.target)){if(xe.key==="Tab"&&!xe.shiftKey&&!xe.metaKey&&!xe.ctrlKey&&!xe.altKey&&cl(At.state)!=="active"){xe.preventDefault(),At.dispatch({changes:{from:0,to:At.state.doc.length,insert:Os},selection:{anchor:Os.length},scrollIntoView:!0}),At.focus(),(Zr=q.current)==null||Zr.call(q,"tab",{skipOnAccept:!0});return}if(xe.key==="ArrowRight"&&!xe.shiftKey&&!xe.metaKey&&!xe.ctrlKey&&!xe.altKey&&cl(At.state)!=="active"){xe.preventDefault(),At.dispatch({changes:{from:0,to:At.state.doc.length,insert:Os},selection:{anchor:Os.length},scrollIntoView:!0}),At.focus(),(_c=q.current)==null||_c.call(q,"right",{skipOnAccept:!0});return}}if(xe.metaKey||xe.ctrlKey||xe.altKey||xe.key.length!==1||Vp(xe.target)||!At||At.hasFocus)return;if(xe.preventDefault(),xe.key==="!"&&At.state.doc.toString()===""){le();return}const Ss=At.state.selection.main;At.dispatch({changes:{from:Ss.from,to:Ss.to,insert:xe.key},selection:{anchor:Ss.from+xe.key.length},scrollIntoView:!0}),At.focus(),xe.key==="/"?window.setTimeout(()=>{Qs(B.current)},0):xe.key==="@"&&window.setTimeout(()=>{const xr=B.current;xr&&xr.hasFocus&&(hs(),Be(xr))},0)};return window.addEventListener("keydown",ae),()=>window.removeEventListener("keydown",ae)},[Be,hs,Le,g,Qs,le]);const kn=f.useCallback(()=>{var ae;(ae=B.current)==null||ae.focus()},[]),Pn=f.useCallback((ae,xe)=>{const ze=B.current;if(!ze||!ae){ze==null||ze.focus();return}if((xe==null?void 0:xe.mode)==="replace"){ze.dispatch({changes:{from:0,to:ze.state.doc.length,insert:ae},effects:Ac.of(),selection:{anchor:ae.length},scrollIntoView:!0}),ze.focus();return}const Qe=ze.state.selection.main;let Kt=ae,At=!1,Un=null;const Os=ae==="@";let Ss=ae==="/";if(ae==="/")ze.state.doc.lineAt(Qe.head).text.startsWith("/")?At=!0:ze.state.doc.length>0&&(At=!0,Ss=!1);else if(ae==="@"){const yr=Qe.from>0?ze.state.doc.sliceString(Qe.from-1,Qe.from):"";ze.state.doc.sliceString(Qe.from,Qe.from+1)==="@"?(At=!0,Un=Qe.from+1):yr==="@"?At=!0:yr&&!/\s/.test(yr)&&(Kt=" @")}At?Un!==null&&ze.dispatch({selection:{anchor:Un},scrollIntoView:!0}):(ze.dispatch({changes:{from:Qe.from,to:Qe.to,insert:Kt},selection:{anchor:Qe.from+Kt.length},scrollIntoView:!0}),Os&&(Rn.current={text:Kt,from:Qe.from})),ze.focus(),Ss?window.setTimeout(()=>{Qs(B.current)},0):Os&&window.setTimeout(()=>{const yr=B.current;yr&&yr.hasFocus&&(hs(),Be(yr))},0)},[hs,Be,Qs]),es=f.useCallback(()=>{var ae;return((ae=B.current)==null?void 0:ae.state.doc.toString())??""},[]),jn=f.useCallback(ae=>{const xe=B.current;xe&&(xe.dispatch({changes:{from:0,to:xe.state.doc.length,insert:ae},effects:Ac.of(),selection:{anchor:ae.length},scrollIntoView:!0}),xe.focus())},[]),$n=f.useCallback(ae=>{const xe=B.current;if(!xe)return;const ze=[];xe.state.field(Qh).between(0,xe.state.doc.length,(Qe,Kt,At)=>{const Un=At.spec.tag;Un&&(!ae||ae(Un))&&ze.push({from:Qe,to:Kt,insert:""})}),ze.length!==0&&xe.dispatch({changes:ze,effects:PI.of({predicate:ae}),scrollIntoView:!0})},[]),qs=f.useCallback(ae=>{const xe=(ae==null?void 0:ae.text)??!0,ze=(ae==null?void 0:ae.tags)??!0,Qe=B.current;xe&&Qe&&Qe.state.doc.length>0&&Qe.dispatch({changes:{from:0,to:Qe.state.doc.length,insert:""},effects:Ac.of()}),xe&&(qe([]),ln.current.clear(),Ft.current=1),ze&&(Tn([]),xe||$n())},[$n]),mn=f.useCallback(()=>{qs({text:!0,tags:!1})},[qs]),Ps=f.useCallback((ae,xe)=>{if(ae.length!==0){if((xe==null?void 0:xe.placement)==="inline"){const ze=B.current;if(!ze)return;const Qe=ze.state.selection.main;let Kt=Qe.from;const At=[],Un=ae.map(Ss=>{const yr=ux(Ss);return At.push({from:Kt,to:Kt+yr.length,tag:Ss}),Kt+=yr.length+1,yr}).join(" "),Os=Un?`${Un} `:"";ze.dispatch({changes:{from:Qe.from,to:Qe.to,insert:Os},effects:At.length>0?At.map(Ss=>Z0.of({...Ss,tag:je(Ss.tag)})):void 0,selection:{anchor:Qe.from+Os.length},scrollIntoView:!0}),ze.focus();return}Tn(ze=>{const Qe=[...ze];for(const Kt of ae){const At=Qe.findIndex(Un=>Un.id===Kt.id);At>=0?Qe[At]=Kt:Qe.push(Kt)}return Qe})}},[je]),ys=f.useCallback(ae=>{Tn(xe=>{const ze=xe.filter(Qe=>Qe.id!==ae||Qe.removable===!1);return ze.length===xe.length?xe:ze}),$n(xe=>xe.id===ae&&xe.removable!==!1)},[$n]),Re=f.useCallback(()=>{var ae;return(((ae=B.current)==null?void 0:ae.state.doc.toString().trim().length)??0)>0||ne.current.length>0||Mt.current.length>0},[]),Dt=f.useCallback(ae=>{const xe=B.current;if(!xe)return;const ze=GF(xe);if((ae==null?void 0:ae.tagPlacement)==="inline"){Ht.current(xe,ae.text??"",ae.tags??ze);return}if((ae==null?void 0:ae.text)!==void 0&&ae.tags===void 0&&ze.length>0){Ht.current(xe,ae.text,ze);return}Ht.current(xe,ae==null?void 0:ae.text,ae?ae.tags??[]:void 0)},[]),zn=f.useCallback(()=>{const ae=fn.current.getLastEntry(ze=>!ze.startsWith("/")&&!ze.startsWith("!"));!ae||W.current(ae)===!1||qe([])},[]),xs=f.useCallback(ae=>{const xe=B.current;xe&&xe.dispatch({changes:{from:0,to:xe.state.doc.length,insert:ae},selection:{anchor:ae.length},scrollIntoView:!0})},[]);f.useEffect(()=>{const ae=bn.current;if(!ae)return;const xe=B.current;if(!xe)return;const ze=ae.tagPlacement??"top";if(ae.tags!==void 0&&ze==="top"&&Tn([...ae.tags]),ae.text!==void 0||ze==="inline"){const Kt=ze==="inline"?[...ae.tags??[]]:[],At=Kt.map(ux).join(" "),Un=ze==="inline"?At&&ae.text?`${At} ${ae.text}`:At||(ae.text??""):ae.text??"",Os=[Ac.of()];if(Kt.length>0){let Ss=0;for(const yr of Kt){const Zr=ux(yr);Os.push(Z0.of({from:Ss,to:Ss+Zr.length,tag:je(yr)})),Ss+=Zr.length+1}}xe.dispatch({changes:{from:0,to:xe.state.doc.length,insert:Un},effects:Os,selection:{anchor:Un.length},scrollIntoView:!0})}else xe.dispatch({effects:Ac.of()});(ae.text!==void 0||ae.submit)&&xe.focus();let Qe=null;return ae.submit&&(Qe=window.setTimeout(()=>{B.current&&Dt(ae)},0)),()=>{Qe!==null&&window.clearTimeout(Qe)}},[k,je,Dt]);const nr=f.useCallback((ae,xe=!0)=>{var Qe;ae&&xs(Ke.current),sn(!1),In(""),Te([]),ke(0),(Ne.current?un.current:fn.current).resetSearch(),xe&&((Qe=B.current)==null||Qe.focus())},[xs]);f.useEffect(()=>{if(!Le)return;const ae=xe=>{if(xe instanceof MouseEvent&&xe.button!==0||xe.defaultPrevented)return;const ze=ve.current,Qe=xe.target;ze&&Qe instanceof Node&&!ze.contains(Qe)&&nr(!0,!1)};return window.addEventListener("mousedown",ae),window.addEventListener("touchstart",ae),()=>{window.removeEventListener("mousedown",ae),window.removeEventListener("touchstart",ae)}},[Le,nr]);const Js=f.useCallback(ae=>{var At;const xe=B.current;if(!xe)return;if(nr(!1),!Ne.current){dt(ae),Ht.current(xe,void 0,void 0,!0);return}const ze=ae.trim();if(!ze)return;const Qe=Mt.current;if(W.current(`!${ze}`,Qe.length>0?[...Qe]:void 0)===!1){dt(ae);return}(At=Z.current)==null||At.call(Z),un.current.push(ze),un.current.reset(),qe([]),xs("")},[nr,xs,dt]),vs=ae=>{if(!ae.nativeEvent.isComposing)if(ae.key==="Escape")ae.preventDefault(),nr(!0);else if(ae.key==="Tab"){ae.preventDefault();const xe=_t[at];xe&&dt(xe),nr(!1)}else if(ae.key==="Enter"){ae.preventDefault();const xe=_t[at];xe?Js(xe):nr(!1)}else ae.key==="r"&&ae.ctrlKey&&(ae.preventDefault(),_t.length>0&&ke(xe=>(xe+1)%_t.length))},Jr=ae=>{const xe=Ne.current?un.current:fn.current;Te(_e(ae)),ke(0),xe.resetSearch()},Gi=ae=>{const xe=ae.target.value;In(xe),!ae.nativeEvent.isComposing&&Jr(xe)},$r=ae=>{const xe=ae.currentTarget.value;In(xe),Jr(xe)},Ii=f.useCallback(ae=>{qe(xe=>xe.filter((ze,Qe)=>Qe!==ae))},[]),qo=!Ae&&!Le&&!(b!=null&&b.isVisible)&&!i&&!g,ci=f.useCallback(ae=>{qe(xe=>[...xe,...ae])},[]),Ri=f.useMemo(()=>({clearText:mn,clear:qs,focus:kn,getText:es,hasInput:Re,setText:jn,addTags:Ps,removeTag:ys,insertText:Pn,retryLast:zn,restoreImages:ci,submit:Dt}),[Ps,qs,mn,kn,es,Re,Pn,ys,ci,zn,jn,Dt]);return{containerRef:F,viewRef:B,focus:kn,submitText:f.useCallback(()=>{const ae=B.current;ae&&Ht.current(ae)},[]),clearText:mn,getText:es,hasInput:Re,hasContent:is,handle:Ri,pastedImages:me,removeImage:Ii,composerTags:st,removeTopTag:ys,addTags:Ps,removeInlineTags:$n,insertText:Pn,setText:jn,submit:Dt,clear:qs,retryLast:zn,replaceEditorText:xs,shellMode:Ae,setShellMode:De,toggleShellMode:le,currentMode:m,sessionName:y,searchState:{searchMode:Le,searchQuery:Cn,searchMatches:_t,searchActiveIndex:at,searchInputRef:Pe,searchUiRef:ve,openHistorySearch:Ue,closeSearch:nr,submitSearchMatch:Js,restoreSearchMatch:dt,handleSearchKeyDown:vs,handleSearchInput:Gi,handleSearchCompositionEnd:$r},navigatePrevHistory:Sn,navigateNextHistory:Gt,showShortcutHints:qo,followupState:b,disabled:i,onAcceptFollowup:v,onDismissFollowup:x,slashMenu:Gn,closeSlashMenu:hs,selectSlashCompletion:cn,acceptSlashCompletion:Wi,atMenu:tt.state,closeAtMenu:Dn,selectAtCompletion:tt.select,acceptAtCompletion:tt.accept,enterAtCategory:tt.enterCategory,backAtCategories:tt.backToCategories,updateAtSearch:tt.updateSearch,selectAtTab:tt.selectTab}}const fBe="_flash_96ig5_1",em={flash:fBe},mBe="_chatMessageRow_17pz3_41",pBe="_chatBubble_17pz3_48",gBe="_chatContent_17pz3_61",bBe="_messageTag_17pz3_66",yBe="_messageTagTooltip_17pz3_83",xBe="_messageTagClickable_17pz3_117",vBe="_messageTagIcon_17pz3_127",wBe="_messageTagLabel_17pz3_138",kBe="_messageTagValue_17pz3_139",_Be="_chatContentCollapsed_17pz3_162",SBe="_toggleButton_17pz3_167",CBe="_toggleIcon_17pz3_188",TBe="_toggleIconExpanded_17pz3_195",EBe="_chatImages_17pz3_199",ABe="_chatImageThumb_17pz3_206",Jo={chatMessageRow:mBe,chatBubble:pBe,chatContent:gBe,messageTag:bBe,messageTagTooltip:yBe,messageTagClickable:xBe,messageTagIcon:vBe,messageTagLabel:wBe,messageTagValue:kBe,chatContentCollapsed:_Be,toggleButton:SBe,toggleIcon:CBe,toggleIconExpanded:TBe,chatImages:EBe,chatImageThumb:ABe};function NBe({composerTagIcons:e,content:t,inputAnnotations:n,onComposerTagClick:s,renderComposerTag:r,renderComposerTagTooltip:i}){const o=f.useMemo(()=>mK(t,n),[t,n]);return l.jsx(l.Fragment,{children:o.map((a,c)=>a.type==="text"?l.jsx(f.Fragment,{children:a.text},c):l.jsx(OI,{composerTagIcons:e,onComposerTagClick:s,renderComposerTag:r,renderComposerTagTooltip:i,tag:a.tag,title:a.tag.serialized,preserveCustomKindLabel:!0},`${a.tag.id}:${c}`))})}const jBe=f.memo(function({content:t,images:n,inputAnnotations:s,isLocateFlashing:r=!1}){const{t:i}=ot(),{parseUserMessageContent:o,renderUserMessageContent:a,composerTagIcons:c,renderComposerTag:u,renderComposerTagTooltip:d,onComposerTagClick:h}=$c(),m=f.useRef(null),[p,g]=f.useState(!1),[b,v]=f.useState(!1),x=f.useMemo(()=>{const w=a==null?void 0:a({content:t,images:n,inputAnnotations:s});if(w!=null)return w;if(s&&s.length>0)return l.jsx(NBe,{composerTagIcons:c,content:t,inputAnnotations:s,onComposerTagClick:h,renderComposerTag:u,renderComposerTagTooltip:d});const k=rj(t,o,"[WebShell] failed to parse user message content");return k?k.map((T,_)=>T.type==="text"?T.text:l.jsx(OI,{tag:T.tag,composerTagIcons:c,renderComposerTag:u,renderComposerTagTooltip:d,onComposerTagClick:h},`${T.tag.id}-${_}`)):t},[t,n,s,h,o,c,u,d,a]),y=f.useCallback(()=>{const w=m.current;w&&v(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]),l.jsx("div",{className:Jo.chatMessageRow,children:l.jsxs("div",{className:`${Jo.chatBubble}${r?` ${em.flash}`:""}`,children:[l.jsxs("div",{ref:m,className:`${Jo.chatContent} ${b&&!p?Jo.chatContentCollapsed:""}`,children:[n&&n.length>0&&l.jsx("div",{className:Jo.chatImages,children:n.map((w,k)=>{const T=w.data.startsWith("data:")?w.data:`data:${w.mimeType};base64,${w.data}`;return tb(T)?l.jsx("img",{src:T,alt:i("user.uploadedImage",{index:k+1}),className:Jo.chatImageThumb,onLoad:y},k):null})}),x]}),b&&l.jsxs("button",{type:"button",className:Jo.toggleButton,onClick:()=>g(w=>!w),children:[l.jsx("span",{children:i(p?"userMessage.showLess":"userMessage.showMore")}),l.jsx("svg",{className:`${Jo.toggleIcon} ${p?Jo.toggleIconExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})})});function MBe(e){return LI(e)}function OI({tag:e,composerTagIcons:t,renderComposerTag:n,renderComposerTagTooltip:s,onComposerTagClick:r,title:i,preserveCustomKindLabel:o=!1}){const a={tag:e,placement:"user-message",readonly:!0};let c,u;try{c=n==null?void 0:n(a)}catch(y){console.warn("[WebShell] user message tag render failed",y)}try{u=s==null?void 0:s(a)}catch(y){console.warn("[WebShell] user message tag tooltip render failed",y)}const d=!!r,h=o?kge(e,t):null,m=xC(e),p=(h==null?void 0:h.tagValue)??vC(e),g=(h==null?void 0:h.tagLabel)??(e.kind?"":m),b=(h==null?void 0:h.fallback)??e.id,v=e.icon??(h==null?void 0:h.iconUrl)??t0(e.kind,t),x=v&&(oj(v)||tb(v))?v:void 0;return l.jsxs("span",{className:`${Jo.messageTag}${d?` ${Jo.messageTagClickable}`:""}`,role:d?"button":void 0,tabIndex:d?0:void 0,title:i??MBe(e),onClick:y=>{d&&(y.stopPropagation(),r==null||r({...a,anchorRect:y.currentTarget.getBoundingClientRect()}))},onKeyDown:y=>{d&&(y.key!=="Enter"&&y.key!==" "||(y.preventDefault(),r==null||r({...a,anchorRect:y.currentTarget.getBoundingClientRect()})))},children:[c??l.jsxs(l.Fragment,{children:[x&&l.jsx("span",{className:Jo.messageTagIcon,style:cf("--user-message-tag-icon-url",x),"aria-hidden":"true"}),g&&l.jsx("span",{className:Jo.messageTagLabel,children:g}),p?l.jsx("span",{className:Jo.messageTagValue,children:p}):g?null:l.jsx("span",{className:Jo.messageTagLabel,children:b})]}),u!=null&&l.jsx("span",{className:Jo.messageTagTooltip,role:"tooltip",children:u})]})}const IBe="_message_1nmy0_1",RBe="_customFooter_1nmy0_7",DBe="_messageFooter_1nmy0_11",LBe="_copyButton_1nmy0_27",PBe="_footerTime_1nmy0_53",OBe="_thinking_1nmy0_65",BBe="_thinkingBody_1nmy0_77",$Be="_thinkingHeader_1nmy0_108",zBe="_thinkingSummary_1nmy0_120",FBe="_translateButton_1nmy0_136",HBe="_thinkingHeaderExpanded_1nmy0_147",qBe="_translationPopover_1nmy0_154",UBe="_translationTitle_1nmy0_159",VBe="_translationContent_1nmy0_164",WBe="_translationPending_1nmy0_171",GBe="_translationError_1nmy0_175",KBe="_translationFooter_1nmy0_179",YBe="_translationUsage_1nmy0_189",XBe="_translationActions_1nmy0_196",QBe="_thinkingSummaryTextActive_1nmy0_211",JBe="_thinkingSummaryIcon_1nmy0_218",ZBe="_thinkingSummaryText_1nmy0_211",e$e="_thinkingChevronRight_1nmy0_275",t$e="_thinkingChevronDown_1nmy0_276",n$e="_thinkingExpandedWrap_1nmy0_339",s$e="_thinkingExpandedClip_1nmy0_343",r$e="_thinkingExpandedCollapsed_1nmy0_351",i$e="_thinkingExpandedInner_1nmy0_355",o$e="_content_1nmy0_403",a$e="_contentBody_1nmy0_408",Ws={message:IBe,customFooter:RBe,messageFooter:DBe,copyButton:LBe,footerTime:PBe,thinking:OBe,thinkingBody:BBe,thinkingHeader:$Be,thinkingSummary:zBe,translateButton:FBe,thinkingHeaderExpanded:HBe,translationPopover:qBe,translationTitle:UBe,translationContent:VBe,translationPending:WBe,translationError:GBe,translationFooter:KBe,translationUsage:YBe,translationActions:XBe,thinkingSummaryTextActive:QBe,thinkingSummaryIcon:JBe,thinkingSummaryText:ZBe,thinkingChevronRight:e$e,thinkingChevronDown:t$e,thinkingExpandedWrap:n$e,thinkingExpandedClip:s$e,thinkingExpandedCollapsed:r$e,thinkingExpandedInner:i$e,content:o$e,contentBody:a$e},l$e=f.memo(function({content:t,isStreaming:n,timestamp:s,onBranchSession:r,showFooterActions:i=!1,showBranchAction:o=!1,isLocateFlashing:a=!1,customFooterInfo:c}){const{t:u}=ot(),{renderAssistantTurnFooter:d}=$c(),[h,m]=f.useState(!1),p=!!t&&!n&&i,g=f.useMemo(()=>c?d==null?void 0:d(c):void 0,[c,d]),b=f.useCallback(()=>{var x;const v=(x=navigator.clipboard)==null?void 0:x.writeText(t);v&&v.then(()=>{m(!0),window.setTimeout(()=>m(!1),2e3)}).catch(()=>{})},[t]);return l.jsxs("div",{className:Ws.message,children:[t&&l.jsx("div",{className:`${Ws.content}${a?` ${em.flash}`:""}`,children:l.jsx("div",{className:Ws.contentBody,children:l.jsx(Op,{content:t,source:"assistant",isStreaming:n})})}),g&&l.jsx("div",{className:Ws.customFooter,children:g}),p&&l.jsxs("div",{className:Ws.messageFooter,children:[l.jsx("button",{type:"button",className:Ws.copyButton,title:u("assistant.copy"),"aria-label":u("assistant.copy"),onClick:b,children:h?l.jsx(u$e,{}):l.jsx(c$e,{})}),o&&r&&l.jsx("button",{type:"button",className:Ws.copyButton,title:u("assistant.branch"),"aria-label":u("assistant.branch"),onClick:r,children:l.jsx(d$e,{})}),s!==void 0&&l.jsx("span",{className:Ws.footerTime,"aria-hidden":"true",children:s1(s)})]})]})});function c$e(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.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"}),l.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function u$e(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function d$e(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.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"}),l.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"}),l.jsx("circle",{cx:"5",cy:"3.5",r:"1.5",fill:"currentColor"}),l.jsx("circle",{cx:"11",cy:"4",r:"1.5",fill:"currentColor"}),l.jsx("circle",{cx:"11",cy:"12.5",r:"1.5",fill:"currentColor"})]})}const sp=new Map,h$e=200;function ZF(e,t){if(sp.delete(e),sp.set(e,t),sp.size<=h$e)return;const n=sp.keys().next().value;n!==void 0&&sp.delete(n)}const f$e=f.memo(function({messageId:t,content:n,isStreaming:s,timestamp:r,isLocateFlashing:i=!1,generateContent:o}){const{language:a,t:c}=ot(),u=f.useContext(Kp),[d,h]=f.useState(!1),m=s===!0,p=f.useRef(r??Date.now()),g=f.useRef(m),[b,v]=f.useState(()=>Date.now()),[x,y]=f.useState(null),[w,k]=f.useState(!1),[T,_]=f.useState(),[C,S]=f.useState(!1),[L,N]=f.useState(!1),[$,M]=f.useState(!1),P=f.useRef(void 0);f.useEffect(()=>{if(!n||!m)return;v(Date.now());const Y=setInterval(()=>v(Date.now()),1e3);return()=>clearInterval(Y)},[n,m]),f.useEffect(()=>{if(n){if(m){g.current=!0,y(null);return}g.current&&x===null&&y(Date.now())}},[n,x,m]);const E=m||x!==null?(m?b:x)-p.current:void 0,O=m$e({isStreaming:s,durationMs:E}),z=E!==void 0?p$e(E):"",F=f.useCallback(()=>{h(Y=>!Y)},[]);f.useEffect(()=>()=>{var Y;(Y=P.current)==null||Y.abort()},[]);const B=f.useCallback(async(Y=!1)=>{var Q;if(s||!o||C&&!Y)return;const V=`${a}:${t}:${n}`,j=sp.get(V);if(j&&!Y){ZF(V,j),_(j);return}Y&&sp.delete(V),(Q=P.current)==null||Q.abort();const ee=new AbortController;P.current=ee,_({text:""}),N(!1),M(!1),S(!0);let se="",X=!1;try{const re=`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 J of o(re,{signal:ee.signal})){if(P.current!==ee)return;if(J.type==="thinking")N(!0);else if(J.type==="delta")N(!1),se+=J.text,_({text:se});else if(J.type==="done"){if(!se.trim())throw new Error("Translation was empty");X=!0;const q={text:se,inputTokens:J.inputTokens,outputTokens:J.outputTokens};ZF(V,q),_(q)}else if(J.type==="error")throw new Error(J.message)}if(!X)throw new Error("Translation stream ended early")}catch{ee.signal.aborted||M(!0)}finally{P.current===ee&&(P.current=void 0,N(!1),S(!1))}},[n,o,s,a,t,C]),W=f.useCallback(Y=>{k(Y),Y&&B()},[B]),I=f.useCallback(()=>{const Y=P.current;P.current=void 0,Y==null||Y.abort(),N(!1),S(!1),k(!1)},[]);return l.jsx("div",{className:`${Ws.message}${i?` ${em.flash}`:""}`,children:n&&!u&&l.jsx("div",{className:Ws.thinking,children:l.jsxs("div",{className:Ws.thinkingBody,children:[l.jsxs("div",{className:`${Ws.thinkingHeader}${d?` ${Ws.thinkingHeaderExpanded}`:""}`,onClick:Y=>{Y.currentTarget.contains(Y.target)&&F()},children:[l.jsxs("button",{type:"button",className:Ws.thinkingSummary,"aria-expanded":d,title:c(d?"thinking.collapse":"thinking.expand"),children:[l.jsx("span",{className:Ws.thinkingSummaryIcon,"aria-hidden":"true",children:l.jsx(g$e,{})}),l.jsx("span",{className:m?`${Ws.thinkingSummaryText} ${Ws.thinkingSummaryTextActive}`:Ws.thinkingSummaryText,children:c(O,z?{duration:z}:{})})]}),a==="zh-CN"&&!m&&o&&l.jsxs(Ux,{open:w,onOpenChange:W,children:[l.jsx(LS,{asChild:!0,children:l.jsx(qn,{type:"button",variant:"secondary",size:"xs",className:Ws.translateButton,title:c("thinking.translate"),onClick:Y=>Y.stopPropagation(),children:c("thinking.translate")})}),l.jsxs(Vx,{align:"start",className:Ws.translationPopover,children:[l.jsx("div",{className:Ws.translationTitle,children:c("thinking.translation")}),$?l.jsx("div",{className:Ws.translationError,children:c("thinking.translationFailed")}):T!=null&&T.text?l.jsx("div",{className:`${Ws.thinkingExpandedWrap} ${Ws.translationContent}`,children:l.jsx(Op,{content:T.text,source:"thinking",isStreaming:C})}):l.jsx("div",{className:Ws.translationPending,children:c(L?"thinking.translationThinking":"thinking.translating")}),l.jsxs("div",{className:Ws.translationFooter,children:[l.jsx("div",{className:Ws.translationUsage,children:!C&&(T==null?void 0:T.text)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{children:c("thinking.inputTokens",{count:T.inputTokens??"--"})}),l.jsx("span",{children:c("thinking.outputTokens",{count:T.outputTokens??"--"})})]})}),l.jsxs("div",{className:Ws.translationActions,children:[l.jsx(qn,{type:"button",variant:"outline",size:"xs",onClick:()=>void B(!0),children:c("thinking.retranslate")}),l.jsx(qn,{type:"button",variant:"outline",size:"xs",disabled:!C&&!(T!=null&&T.text)&&!$,onClick:I,children:c(C?"thinking.cancelTranslation":"thinking.closeTranslation")})]})]})]})]}),l.jsx("span",{className:d?Ws.thinkingChevronDown:Ws.thinkingChevronRight,"aria-hidden":"true"})]}),l.jsx("div",{className:d?Ws.thinkingExpandedClip:`${Ws.thinkingExpandedClip} ${Ws.thinkingExpandedCollapsed}`,children:l.jsx("div",{className:Ws.thinkingExpandedInner,children:l.jsx("div",{className:Ws.thinkingExpandedWrap,children:l.jsx(Op,{content:n,source:"thinking",isStreaming:s})})})})]})})})});function m$e({isStreaming:e,durationMs:t}){return e?"thinking.running":t!==void 0&&t<1e3?"thinking.doneBriefly":"thinking.done"}function p$e(e){const t=Math.max(1,Math.round(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t%60;return s>0?`${n}m ${s}s`:`${n}m`}function g$e(){return l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[l.jsx("path",{d:"M7.2 15.2h4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),l.jsx("path",{d:"M6.5 13.1h5.4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),l.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"}),l.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 b$e="_panel_8ng9u_1",y$e="_title_8ng9u_16",x$e="_metaLine_8ng9u_22",v$e="_progress_8ng9u_32",w$e="_spacer_8ng9u_38",k$e="_row_8ng9u_42",_$e="_detailRow_8ng9u_43",S$e="_subDetailRow_8ng9u_44",C$e="_symbol_8ng9u_65",T$e="_label_8ng9u_69",E$e="_value_8ng9u_73",A$e="_detailName_8ng9u_80",N$e="_sectionTitle_8ng9u_88",j$e="_detailSection_8ng9u_94",M$e="_skillBlock_8ng9u_100",I$e="_hint_8ng9u_105",R$e="_detailCommand_8ng9u_111",D$e="_bodyLoaded_8ng9u_132",L$e="_accent_8ng9u_137",P$e="_secondary_8ng9u_141",O$e="_warning_8ng9u_145",B$e="_error_8ng9u_149",$$e="_success_8ng9u_153",Wn={panel:b$e,title:y$e,metaLine:x$e,progress:v$e,spacer:w$e,row:k$e,detailRow:_$e,subDetailRow:S$e,symbol:C$e,label:T$e,value:E$e,detailName:A$e,sectionTitle:N$e,detailSection:j$e,skillBlock:M$e,hint:I$e,detailCommand:R$e,bodyLoaded:D$e,accent:L$e,secondary:P$e,warning:O$e,error:B$e,success:$$e},s9="web-shell:context-usage:v1:",Bh="█",Gre="▒",Kre="░",Yre=30;function z$e(e){return`${s9}${JSON.stringify(e)}`}function F$e(e){if(!e.startsWith(s9))return null;try{const t=JSON.parse(e.slice(s9.length));return!(t!=null&&t.usage)||typeof t.usage.totalTokens!="number"?null:t}catch{return null}}function Xre(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function T1(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function H$e(e,t){if(t<=0)return"0.0";const n=e/t*100;return n>100?">100":n.toFixed(1)}function q$e(e){return[...e].sort((t,n)=>n.tokens-t.tokens)}function U$e({usedPercentage:e,bufferPercentage:t}){const s=Math.round(Math.min(e,100)/100*56),r=Math.round(Math.min(t,Math.max(0,100-e))/100*56),i=Math.max(0,56-s-r),o=e>80?Wn.error:e>60?Wn.warning:Wn.accent;return l.jsxs("div",{className:Wn.progress,"aria-hidden":"true",children:[l.jsx("span",{className:o,children:Bh.repeat(Math.max(0,s))}),l.jsx("span",{className:Wn.secondary,children:Kre.repeat(Math.max(0,i))}),l.jsx("span",{className:Wn.warning,children:Gre.repeat(Math.max(0,r))})]})}function fd({symbol:e,label:t,tokens:n,tokenLabel:s,contextWindowSize:r,symbolClassName:i=Wn.secondary,isOverLimit:o}){return l.jsxs("div",{className:Wn.row,children:[l.jsx("span",{className:`${Wn.symbol} ${i}`,children:e}),l.jsx("span",{className:Wn.label,children:t}),l.jsxs("span",{className:o?Wn.error:Wn.value,children:[T1(n)," ",s," (",H$e(n,r),"%)"]})]})}const W6="/context detail";function V$e({hint:e,onShowDetail:t}){const n=t?e.indexOf(W6):-1;return n<0?l.jsx("div",{className:Wn.hint,children:e}):l.jsxs("div",{className:Wn.hint,children:[e.slice(0,n),l.jsx("button",{type:"button",className:Wn.detailCommand,onClick:t,children:W6}),e.slice(n+W6.length)]})}function W$e({name:e,tokens:t,tokenLabel:n}){return l.jsxs("div",{className:Wn.detailRow,children:[l.jsxs("span",{className:Wn.secondary,children:["└"," "]}),l.jsx("span",{className:Wn.detailName,title:e,children:Xre(e,Yre)}),l.jsxs("span",{className:Wn.value,children:[T1(t)," ",n]})]})}function G6({title:e,items:t,getName:n,tokenLabel:s}){const r=q$e(t);return r.length===0?null:l.jsxs("section",{className:Wn.detailSection,children:[l.jsx("div",{className:Wn.sectionTitle,children:e}),r.map(i=>l.jsx(W$e,{name:n(i),tokens:i.tokens,tokenLabel:s},n(i)))]})}function G$e({skills:e,labels:t}){const n=[...e].sort((s,r)=>s.loaded!==r.loaded?s.loaded?-1:1:r.tokens+(r.bodyTokens??0)-(s.tokens+(s.bodyTokens??0)));return n.length===0?null:l.jsxs("section",{className:Wn.detailSection,children:[l.jsx("div",{className:Wn.sectionTitle,children:t.skills}),n.map(s=>l.jsxs("div",{className:Wn.skillBlock,children:[l.jsxs("div",{className:Wn.detailRow,children:[l.jsxs("span",{className:Wn.secondary,children:["└"," "]}),l.jsxs("span",{className:Wn.detailName,title:s.name,children:[Xre(s.name,Yre),s.loaded&&l.jsxs("span",{className:Wn.success,children:[" ",t.active]})]}),l.jsxs("span",{className:Wn.value,children:[T1(s.tokens)," ",t.tokens]})]}),s.loaded&&s.bodyTokens!=null&&s.bodyTokens>0&&l.jsxs("div",{className:Wn.subDetailRow,children:[l.jsxs("span",{className:Wn.secondary,children:["  └"," "]}),l.jsx("span",{className:Wn.bodyLoaded,children:t.bodyLoaded}),l.jsxs("span",{className:Wn.success,children:["+",T1(s.bodyTokens)," ",t.tokens]})]})]},s.name))]})}function K$e({status:e,onShowDetail:t}){const{t:n}=ot(),{usage:s}=e,{breakdown:r,contextWindowSize:i}=s,o=i>0?s.totalTokens/i*100:0,a=o>100,c=i>0?r.autocompactBuffer/i*100:0;return l.jsxs("div",{className:Wn.panel,children:[l.jsx("div",{className:Wn.title,children:n("contextUsage.title")}),s.isEstimated?l.jsx(l.Fragment,{children:l.jsxs("div",{className:Wn.metaLine,children:[l.jsxs("span",{children:[n("contextUsage.model"),": ",s.modelName]}),l.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",T1(i)," ",n("contextUsage.tokens")]})]})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Wn.metaLine,children:[l.jsxs("span",{children:[n("contextUsage.model"),": ",s.modelName]}),l.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",T1(i)," ",n("contextUsage.tokens")]})]}),a&&l.jsx("div",{className:Wn.error,children:n("contextUsage.overLimit")})]}),l.jsx(U$e,{usedPercentage:Math.min(o,100),bufferPercentage:c}),l.jsx("div",{className:Wn.spacer}),l.jsx(fd,{symbol:Bh,label:n("contextUsage.used"),tokens:s.totalTokens,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:a?Wn.error:Wn.accent,isOverLimit:a}),l.jsx(fd,{symbol:Kre,label:n("contextUsage.free"),tokens:r.freeSpace,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i}),l.jsx(fd,{symbol:Gre,label:n("contextUsage.autocompactBuffer"),tokens:r.autocompactBuffer,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Wn.warning}),l.jsx("div",{className:Wn.spacer}),l.jsx("div",{className:Wn.sectionTitle,children:n("contextUsage.usageByCategory")}),l.jsx(fd,{symbol:Bh,label:n("contextUsage.systemPrompt"),tokens:r.systemPrompt,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Wn.accent}),l.jsx(fd,{symbol:Bh,label:n("contextUsage.builtinTools"),tokens:r.builtinTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Wn.accent}),r.mcpTools>0&&l.jsx(fd,{symbol:Bh,label:n("contextUsage.mcpTools"),tokens:r.mcpTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Wn.accent}),l.jsx(fd,{symbol:Bh,label:n("contextUsage.memoryFiles"),tokens:r.memoryFiles,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Wn.accent}),l.jsx(fd,{symbol:Bh,label:n("contextUsage.skills"),tokens:r.skills,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Wn.accent}),!s.isEstimated&&l.jsx(fd,{symbol:Bh,label:n("contextUsage.messages"),tokens:r.messages,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Wn.accent}),s.showDetails?l.jsxs(l.Fragment,{children:[l.jsx(G6,{title:n("contextUsage.builtinTools"),items:s.builtinTools,getName:u=>"name"in u?u.name:u.path,tokenLabel:n("contextUsage.tokens")}),l.jsx(G6,{title:n("contextUsage.mcpTools"),items:s.mcpTools,getName:u=>"name"in u?u.name:u.path,tokenLabel:n("contextUsage.tokens")}),l.jsx(G6,{title:n("contextUsage.memoryFiles"),items:s.memoryFiles,getName:u=>"path"in u?u.path:u.name,tokenLabel:n("contextUsage.tokens")}),l.jsx(G$e,{skills:s.skills,labels:{active:n("contextUsage.active"),bodyLoaded:n("contextUsage.bodyLoaded"),skills:n("contextUsage.skills"),tokens:n("contextUsage.tokens")}})]}):l.jsx(V$e,{hint:n("contextUsage.detailHint"),onShowDetail:t})]})}const Y$e={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"},X$e=/[\x00-\x08\x0b-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/g;function u2(e){return e.replace(X$e,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 Qre(e){if(!e.trim())return"Tool";const t=Y$e[e];if(t)return t;const n=e.toLowerCase();return n==="web_fetch"||n==="webfetch"||n==="fetch"?"WebFetch":e}function Pc(e,t){const n=Qre(e),s=[`toolName.${e}`,`toolName.${e.toLowerCase()}`,`toolName.${n.toLowerCase()}`];for(const r of s){const i=t(r);if(i!==r)return i}return n}function qc(e){const t=e.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function ro(e,t){return e.length<=t?e:e.slice(0,t)+"..."}const Fg=2e3;function BI(e,t){if(_C(e.toolName)){const r=kC(e.args,"skill");if(r)return ro(r,Fg)}const n=Z$e(e,t);if(n)return ro(n,Fg);const s=Zre(e,t);return s?ro(s,Fg):""}function Jre(e,t){if(!kl(e.toolName))return BI(e,t);const n=kC(e.args,"description");if(n)return ro(n,Fg);const s=Zre(e,t,{includeTimeout:!1});return s?ro(s,Fg):""}function Q$e(e){return kl(e.toolName)?kC(e.args,"description"):""}function Du(e){var t;if(!e.content)return i9(e.rawOutput);for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text;return i9(e.rawOutput)}function J$e(e){if(e.status!=="completed"&&e.status!=="failed")return"";const t=e.toolName.toLowerCase();if(t==="grep_search"||t==="grep"||t==="search"){const o=eH((i9(e.rawOutput)??"").trim());if(o)return o}const n=Du(e);if(!n)return"";const s=n.split(`
`),r=s.length;if(t==="read"||t==="read_file"||t==="readfile")return`${r} line(s)`;if(t==="glob")return`Found ${s.filter(a=>a.trim()).length} matching file(s)`;if(t==="list_directory"||t==="listfiles")return`${s.filter(a=>a.trim()).length} item(s)`;if(kl(t)){if(r>3)return`${r} lines of output`;const o=s[0]||"";return ro(o,80)}if(t==="grep_search"||t==="grep"||t==="search"){const o=eH(n.trim());return o||`${s.filter(c=>c.trim()).length} result(s)`}if(t==="edit"||t==="write"||t==="write_file"||t==="editfile")return"";if(t==="webfetch"||t==="web_fetch"||t==="fetch"){const o=s[0]||"";return ro(o,80)}if(t==="websearch"||t==="web_search"){const o=s.filter(a=>a.trim()).length;return o>1?`${o} result(s)`:s[0]||""}if(qc(t))return"";const i=s[0]||"";return ro(i,80)}function Z$e(e,t){if(!e.title)return null;const n=Qre(e.toolName),s=e.title.trim();if(s===e.toolName||s===n)return null;const r=[n,e.toolName];for(const i of r)if(s.startsWith(i)){const o=s.slice(i.length);if(/^(:\s*|\s+)/.test(o))return tH(o.replace(/^:\s*|\s+/,""),t)}return tH(s,t)}function eH(e){return e==="No matches found"||/^Found \d+ match(?:es)?(?: \(truncated\))?$/.test(e)?e:null}function Zre(e,t,n={}){const s=e.args||{},r=e.toolName.toLowerCase(),i=n.includeTimeout??!0;if(s.command){let o=String(s.command);s.directory&&r!=="shell"&&(o+=` [in ${yg(String(s.directory),t)}]`),s.is_background?o+=" [background]":i&&s.timeout&&(o+=` [timeout: ${String(s.timeout)}ms]`);const a=kC(s,"description");return a&&(o+=` (${a})`),ro(o,Fg)}if(r==="grep_search"||r==="grep"||r==="search"){const o=s.pattern??s.query;if(o){let a=`'${String(o)}'`;return s.path?a+=` in path '${String(s.path)}'`:(r==="grep_search"||r==="grep")&&(a+=" in path './'"),s.glob&&(a+=` (filter: '${String(s.glob)}')`),a}}if(r==="glob"&&s.pattern){let o=`'${String(s.pattern)}'`;return s.path&&(o+=` in path '${String(s.path)}'`),o}if(s.file_path)return s.description?String(s.description):yg(String(s.file_path),t);if(s.url){const o=String(s.url),a=typeof s.prompt=="string"?s.prompt:void 0,c=a?`${o} — "${ro(a,40)}"`:o;return ro(c,80)}if(s.path)return yg(String(s.path),t);if(s.query)return ro(String(s.query),60);if(r==="list_directory"||r==="listfiles"){const o=s.path||s.directory||"";return yg(String(o),t)}return s.description?String(s.description):""}function kC(e,t){const n=e==null?void 0:e[t];return typeof n=="string"?n.trim().replace(/\n/g," "):""}function kl(e){const t=e.toLowerCase();return t==="run_shell_command"||t==="bash"||t==="shell"||t==="execute_command"}function _C(e){return e.toLowerCase()==="skill"}function Oc(e,t){var n;return e.callId===t?!0:((n=e.subTools)==null?void 0:n.some(s=>Oc(s,t)))??!1}function tH(e,t){const n=e.trim();return eie(r9(n))?yg(n,t):n.replace(/(?:[A-Za-z]:)?\/[^\s'")]+/g,s=>yg(s,t))}function yg(e,t){const n=r9(e),s=t?r9(t).replace(/\/+$/,""):"";return s&&(n===s||n.startsWith(`${s}/`))?n.slice(s.length+1)||".":eie(n)?eze(n):n}function r9(e){return e.replace(/\\/g,"/")}function eie(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function eze(e){return e.replace(/\/+$/,"").split("/").pop()||e}function nw(e){if(!e||typeof e!="object")return;const t=e;return t.type==="task_execution"?t:void 0}function $I(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():"",s=$I(e);return n==="cancelled"||n==="canceled"||s.toLowerCase().includes("cancel")?"failed":e.status}function zI(e){return e>=1e6?`${(e/1e6).toFixed(1)}M tokens`:e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k tokens":`${e} tokens`}const tze="general-purpose";function FI(e){var s;const t=nw(e.rawOutput);if(t){const r=t.subagentName;if(typeof r=="string"&&r)return r}const n=(s=e.args)==null?void 0:s.subagent_type;return typeof n=="string"&&n?n:e.toolName==="task"?"task":tze}function HI(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=nw(e.rawOutput),s=n==null?void 0:n.taskDescription;if(typeof s=="string"&&s.trim())return s.trim();const r=(o=e.args)==null?void 0:o.prompt;return typeof r=="string"&&r.trim()?r.trim().split(`
`)[0]??"":""}function nze(e,t){var i,o;if(e.status!=="in_progress")return"";const n=e.subTools;if(!n||n.length===0)return"";const s=n[n.length-1];if(s.status!=="in_progress"&&s.status!=="pending")return"";let r=Pc(s.toolName??"",t);if(s.title){const a=s.title.indexOf(": ");r+=" "+(a>0?s.title.slice(a+2):s.title)}else(i=s.args)!=null&&i.command?r+=" "+String(s.args.command):(o=s.args)!=null&&o.file_path&&(r+=" "+String(s.args.file_path));return ro(r,50)}function i9(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 sze="_panel_qchwm_1",rze="_title_qchwm_17",ize="_sectionTitle_qchwm_23",oze="_spacer_qchwm_29",aze="_pivotRow_qchwm_35",lze="_metricCell_qchwm_41",cze="_metricCellSection_qchwm_48",uze="_metricCellSub_qchwm_56",dze="_modelCell_qchwm_64",hze="_modelCellHeader_qchwm_71",fze="_divider_qchwm_79",mze="_kvRow_qchwm_87",pze="_kvSubRow_qchwm_94",gze="_kvLabel_qchwm_102",bze="_kvValue_qchwm_106",yze="_tableRow_qchwm_115",xze="_modelUsageRow_qchwm_121",vze="_tableNameCol_qchwm_129",wze="_tableToolCol_qchwm_137",kze="_tableNumCol_qchwm_145",_ze="_tableValueCol_qchwm_153",Sze="_success_qchwm_162",Cze="_error_qchwm_166",Tze="_secondary_qchwm_170",Eze="_warning_qchwm_174",Tt={panel:sze,title:rze,sectionTitle:ize,spacer:oze,pivotRow:aze,metricCell:lze,metricCellSection:cze,metricCellSub:uze,modelCell:dze,modelCellHeader:hze,divider:fze,kvRow:mze,kvSubRow:pze,kvLabel:gze,kvValue:bze,tableRow:yze,modelUsageRow:xze,tableNameCol:vze,tableToolCol:wze,tableNumCol:kze,tableValueCol:_ze,success:Sze,error:Cze,secondary:Tze,warning:Eze},o9="web-shell:session-stats:v1:";function Aze(e,t="overview"){return`${o9}${JSON.stringify({_view:t,...e})}`}function Nze(e){if(!e.startsWith(o9))return null;try{const t=JSON.parse(e.slice(o9.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 Ef(e){if(e<=0)return"0s";if(e<1e3)return`${Math.round(e)}ms`;const t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;const n=Math.floor(t/3600),s=Math.floor(t%3600/60),r=Math.floor(t%60),i=[];return n>0&&i.push(`${n}h`),s>0&&i.push(`${s}m`),r>0&&i.push(`${r}s`),i.join(" ")||"0s"}function rp({label:e,children:t}){return l.jsxs("div",{className:Tt.kvRow,children:[l.jsx("span",{className:Tt.kvLabel,children:e}),l.jsx("span",{className:Tt.kvValue,children:t})]})}function dx({label:e,children:t}){return l.jsxs("div",{className:Tt.kvSubRow,children:[l.jsxs("span",{className:Tt.secondary,children:["»"," ",e]}),l.jsx("span",{className:Tt.kvValue,children:t})]})}function tie(e){return Object.entries(e).filter(([,t])=>t.api.totalRequests>0).map(([t,n])=>{const s=t.split("::"),r=s[0],i=s[1],o=i?`${r} (${i})`:r;return{key:t,label:o,metrics:n}})}function jze(e){return e.api.totalRequests===0?0:e.api.totalErrors/e.api.totalRequests*100}function Mze(e){return e.api.totalRequests===0?0:e.api.totalLatencyMs/e.api.totalRequests}function Ize(e){return e.tokens.prompt===0?0:e.tokens.cached/e.tokens.prompt*100}function lu({metric:e,values:t,variant:n="normal"}){const s=n==="section"?Tt.metricCellSection:n==="sub"?Tt.metricCellSub:Tt.metricCell;return l.jsxs("div",{className:Tt.pivotRow,children:[l.jsx("span",{className:s,children:n==="sub"?`↳ ${e}`:e}),t.map((r,i)=>l.jsx("span",{className:Tt.modelCell,children:r},i))]})}function Rze({status:e}){const{t}=ot(),{models:n,tools:s,files:r}=e,i=Object.values(n).reduce((b,v)=>b+v.api.totalLatencyMs,0),o=s.totalDurationMs,a=i+o,c=a>0?i/a*100:0,u=a>0?o/a*100:0,d=s.totalCalls>0?s.totalSuccess/s.totalCalls*100:0,h=tie(n),m=h.reduce((b,v)=>b+v.metrics.tokens.cached,0),p=h.reduce((b,v)=>b+v.metrics.tokens.prompt,0),g=p>0?m/p*100:0;return l.jsxs("div",{className:Tt.panel,children:[l.jsx("div",{className:Tt.title,children:t("stats.title")}),l.jsx("div",{className:Tt.sectionTitle,children:t("stats.overview")}),l.jsx(rp,{label:t("stats.duration"),children:Ef(e.durationMs)}),l.jsx(rp,{label:t("stats.prompts"),children:e.promptCount}),l.jsx(rp,{label:t("stats.toolCalls"),children:l.jsxs("span",{children:[s.totalCalls," ",l.jsx("span",{className:Tt.secondary,children:"("}),l.jsxs("span",{className:Tt.success,children:["✓",s.totalSuccess]})," ",l.jsxs("span",{className:Tt.error,children:["✗",s.totalFail]}),l.jsx("span",{className:Tt.secondary,children:")"})]})}),l.jsx(rp,{label:t("stats.successRate"),children:l.jsxs("span",{className:d>=90?Tt.success:d>=70?Tt.warning:Tt.error,children:[d.toFixed(1),"%"]})}),(r.totalLinesAdded>0||r.totalLinesRemoved>0)&&l.jsx(rp,{label:t("stats.codeChanges"),children:l.jsxs("span",{children:[l.jsxs("span",{className:Tt.success,children:["+",r.totalLinesAdded]})," ",l.jsxs("span",{className:Tt.error,children:["-",r.totalLinesRemoved]})]})}),l.jsx("div",{className:Tt.spacer}),l.jsx("div",{className:Tt.sectionTitle,children:t("stats.performance")}),l.jsxs(dx,{label:t("stats.apiTime"),children:[Ef(i)," ",l.jsxs("span",{className:Tt.secondary,children:["(",c.toFixed(1),"%)"]})]}),l.jsxs(dx,{label:t("stats.toolTime"),children:[Ef(o)," ",l.jsxs("span",{className:Tt.secondary,children:["(",u.toFixed(1),"%)"]})]}),h.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Tt.spacer}),l.jsx("div",{className:Tt.sectionTitle,children:t("stats.modelUsage")}),l.jsx("div",{className:Tt.spacer}),l.jsxs("div",{className:`${Tt.tableRow} ${Tt.modelUsageRow}`,children:[l.jsx("span",{className:Tt.tableNameCol,children:t("stats.modelUsage")}),l.jsx("span",{className:Tt.tableValueCol,children:t("stats.reqs")}),l.jsx("span",{className:Tt.tableValueCol,children:t("stats.inputTokens")}),l.jsx("span",{className:Tt.tableValueCol,children:t("stats.outputTokens")})]}),l.jsx("div",{className:Tt.divider}),h.map(b=>l.jsxs("div",{className:`${Tt.tableRow} ${Tt.modelUsageRow}`,children:[l.jsx("span",{className:Tt.tableNameCol,children:b.label}),l.jsx("span",{className:Tt.tableValueCol,children:b.metrics.api.totalRequests}),l.jsx("span",{className:`${Tt.tableValueCol} ${Tt.warning}`,children:b.metrics.tokens.prompt.toLocaleString()}),l.jsx("span",{className:`${Tt.tableValueCol} ${Tt.warning}`,children:b.metrics.tokens.candidates.toLocaleString()})]},b.key)),g>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Tt.spacer}),l.jsxs("div",{children:[l.jsx("span",{className:Tt.success,children:t("stats.savingsHighlight")})," ",m.toLocaleString()," (",g.toFixed(1),"%)"," ",t("stats.cacheDesc")]}),l.jsxs("div",{className:Tt.secondary,children:["»"," ",t("stats.modelTip")]})]})]})]})}function Dze({status:e}){const{t}=ot(),n=tie(e.models);if(n.length===0)return l.jsxs("div",{className:Tt.panel,children:[l.jsx("div",{className:Tt.title,children:t("stats.modelStats")}),l.jsx("div",{children:t("stats.noApiCalls")})]});const s=n.some(o=>o.metrics.tokens.cached>0),r=n.some(o=>o.metrics.tokens.thoughts>0),i=o=>n.map(a=>o(a.metrics));return l.jsxs("div",{className:Tt.panel,children:[l.jsx("div",{className:Tt.title,children:t("stats.modelStats")}),l.jsx("div",{className:Tt.spacer}),l.jsxs("div",{className:Tt.pivotRow,children:[l.jsx("span",{className:Tt.metricCellSection,children:t("stats.metric")}),n.map(o=>l.jsx("span",{className:Tt.modelCellHeader,children:o.label},o.key))]}),l.jsx("div",{className:Tt.divider}),l.jsx(lu,{metric:t("stats.api"),values:[],variant:"section"}),l.jsx(lu,{metric:t("stats.requests"),values:i(o=>o.api.totalRequests.toLocaleString())}),l.jsx(lu,{metric:t("stats.errors"),values:i(o=>{const a=jze(o);return l.jsxs("span",{className:o.api.totalErrors>0?Tt.error:void 0,children:[o.api.totalErrors.toLocaleString()," (",a.toFixed(1),"%)"]})})}),l.jsx(lu,{metric:t("stats.avgLatency"),values:i(o=>Ef(Mze(o)))}),l.jsx("div",{className:Tt.spacer}),l.jsx(lu,{metric:t("stats.tokens"),values:[],variant:"section"}),l.jsx(lu,{metric:t("stats.total"),values:i(o=>l.jsx("span",{className:Tt.warning,children:o.tokens.total.toLocaleString()}))}),l.jsx(lu,{metric:t("stats.inputTokens"),values:i(o=>o.tokens.prompt.toLocaleString()),variant:"sub"}),s&&l.jsx(lu,{metric:t("stats.cached"),values:i(o=>l.jsxs("span",{className:Tt.success,children:[o.tokens.cached.toLocaleString()," (",Ize(o).toFixed(1),"%)"]})),variant:"sub"}),l.jsx(lu,{metric:t("stats.outputTokens"),values:i(o=>o.tokens.candidates.toLocaleString()),variant:"sub"}),r&&l.jsx(lu,{metric:t("stats.thoughts"),values:i(o=>o.tokens.thoughts.toLocaleString()),variant:"sub"})]})}function Lze(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 Pze({status:e}){const{t}=ot(),n=Lze(e.tools.byName);if(n.length===0)return l.jsxs("div",{className:Tt.panel,children:[l.jsx("div",{className:Tt.title,children:t("stats.toolStats")}),l.jsx("div",{children:t("stats.noToolCalls")})]});const s=Object.values(e.tools.byName).reduce((o,a)=>{var c,u,d;return o.accept+=((c=a.decisions)==null?void 0:c.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}),r=s.accept+s.reject+s.modify,i=r>0?s.accept/r*100:0;return l.jsxs("div",{className:Tt.panel,children:[l.jsx("div",{className:Tt.title,children:t("stats.toolStats")}),l.jsx("div",{className:Tt.spacer}),l.jsxs("div",{className:Tt.tableRow,children:[l.jsx("span",{className:Tt.tableToolCol,children:t("stats.toolName")}),l.jsx("span",{className:Tt.tableNumCol,children:t("stats.calls")}),l.jsx("span",{className:Tt.tableNumCol,children:t("stats.successRate")}),l.jsx("span",{className:Tt.tableNumCol,children:t("stats.avgDuration")})]}),l.jsx("div",{className:Tt.divider}),n.map(o=>{const a=o.stats.count>0?o.stats.success/o.stats.count*100:0,c=o.stats.count>0?o.stats.durationMs/o.stats.count:0;return l.jsxs("div",{className:Tt.tableRow,children:[l.jsx("span",{className:`${Tt.tableToolCol} ${Tt.metricCell}`,children:Pc(o.name,t)}),l.jsx("span",{className:Tt.tableNumCol,children:o.stats.count}),l.jsxs("span",{className:`${Tt.tableNumCol} ${a>=90?Tt.success:a>=70?Tt.warning:Tt.error}`,children:[a.toFixed(1),"%"]}),l.jsx("span",{className:Tt.tableNumCol,children:Ef(c)})]},o.name)}),l.jsx("div",{className:Tt.spacer}),l.jsx("div",{className:Tt.sectionTitle,children:t("stats.decisionSummary")}),l.jsx(rp,{label:t("stats.totalReviewed"),children:r}),l.jsx(dx,{label:t("stats.accepted"),children:l.jsx("span",{className:Tt.success,children:s.accept})}),l.jsx(dx,{label:t("stats.rejected"),children:l.jsx("span",{className:Tt.error,children:s.reject})}),l.jsx(dx,{label:t("stats.modified"),children:l.jsx("span",{className:Tt.warning,children:s.modify})}),l.jsx("div",{className:Tt.divider}),l.jsx(rp,{label:t("stats.agreementRate"),children:l.jsx("span",{className:r>0?i>=90?Tt.success:i>=70?Tt.warning:Tt.error:void 0,children:r>0?`${i.toFixed(1)}%`:"--"})})]})}function Oze({view:e,status:t}){switch(e){case"model":return l.jsx(Dze,{status:t});case"tools":return l.jsx(Pze,{status:t});default:return l.jsx(Rze,{status:t})}}function SC(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 Bze="_panel_13hcg_1",$ze="_title_13hcg_17",zze="_row_13hcg_23",Fze="_rowGap_13hcg_31",Hze="_label_13hcg_35",qze="_value_13hcg_41",Uze="_accent_13hcg_46",pp={panel:Bze,title:$ze,row:zze,rowGap:Fze,label:Hze,value:qze,accent:Uze},{serialize:Vze,parse:Wze}=SC("web-shell:status:v1:");function Tc({label:e,children:t,gap:n}){return l.jsxs("div",{className:`${pp.row}${n?` ${pp.rowGap}`:""}`,children:[l.jsx("span",{className:pp.label,children:e}),l.jsx("span",{className:pp.value,children:t})]})}function Gze({info:e}){const{t}=ot();return l.jsxs("div",{className:pp.panel,children:[l.jsx("div",{className:pp.title,children:t("about.title")}),e.cliVersion&&l.jsx(Tc,{label:t("about.qwenCode"),children:l.jsx("span",{className:pp.accent,children:e.cliVersion})}),e.runtime&&l.jsx(Tc,{label:t("about.runtime"),children:e.runtime}),e.platform&&l.jsx(Tc,{label:t("about.platform"),children:e.platform}),e.auth&&l.jsx(Tc,{label:t("about.auth"),gap:!0,children:e.auth}),e.baseUrl&&l.jsx(Tc,{label:t("about.baseUrl"),children:e.baseUrl}),e.model&&l.jsx(Tc,{label:t("about.model"),children:e.model}),e.fastModel&&e.fastModel!==e.model&&l.jsx(Tc,{label:t("about.fastModel"),children:e.fastModel}),e.sessionId&&l.jsx(Tc,{label:t("about.sessionId"),children:e.sessionId}),l.jsx(Tc,{label:t("about.sandbox"),children:e.sandbox||t("about.noSandbox")}),l.jsx(Tc,{label:t("about.proxy"),children:e.proxy||t("about.noProxy")}),e.memoryUsage&&l.jsx(Tc,{label:t("about.memoryUsage"),children:e.memoryUsage})]})}function Kze(e){return e instanceof HTMLElement?!!e.closest("[data-keyboard-scope]"):!1}function nie(e,t,n=50){const s=f.useRef(e);f.useEffect(()=>{s.current=e},[e]),f.useEffect(()=>{const r=o=>{o.defaultPrevented||Vp(o.target)&&!Kze(o.target)||s.current(o)},i=setTimeout(()=>{window.addEventListener("keydown",r)},n);return()=>{clearTimeout(i),window.removeEventListener("keydown",r)}},t)}function ba(e){if(e&&typeof e=="object"){const t=e.body;if(t&&typeof t=="object"){const n=t.data;if(n&&typeof n=="object"){const r=n.details;if(typeof r=="string"&&r)return r}const s=t.error;if(typeof s=="string"&&s)return s}if(e instanceof Error&&e.message)return e.message}return String(e)}const Yze="_panel_1jx2a_1",Xze="_title_1jx2a_13",Qze="_header_1jx2a_18",Jze="_startup_1jx2a_24",Zze="_note_1jx2a_28",eFe="_secondary_1jx2a_29",tFe="_row_1jx2a_39",nFe="_selected_1jx2a_48",sFe="_disabled_1jx2a_52",rFe="_pointer_1jx2a_56",iFe="_nameCell_1jx2a_62",oFe="_truncate_1jx2a_69",aFe="_separator_1jx2a_75",lFe="_sectionTitle_1jx2a_79",cFe="_groupTitle_1jx2a_80",uFe="_success_1jx2a_84",dFe="_warning_1jx2a_88",hFe="_error_1jx2a_92",fFe="_group_1jx2a_80",mFe="_list_1jx2a_102",pFe="_description_1jx2a_108",gFe="_schema_1jx2a_113",bFe="_shortcuts_1jx2a_131",yFe="_detail_1jx2a_137",xFe="_serverFields_1jx2a_143",vFe="_serverField_1jx2a_143",wFe="_serverFieldLabel_1jx2a_156",kFe="_detailBlock_1jx2a_160",_Fe="_parameters_1jx2a_161",SFe="_invalidBlock_1jx2a_162",CFe="_parameterRow_1jx2a_172",TFe="_actionMessage_1jx2a_177",EFe="_oauthPage_1jx2a_183",AFe="_scrollHint_1jx2a_189",Zt={panel:Yze,title:Xze,header:Qze,startup:Jze,note:Zze,secondary:eFe,row:tFe,selected:nFe,disabled:sFe,pointer:rFe,nameCell:iFe,truncate:oFe,separator:aFe,sectionTitle:lFe,groupTitle:cFe,success:uFe,warning:dFe,error:hFe,group:fFe,list:mFe,description:pFe,schema:gFe,shortcuts:bFe,detail:yFe,serverFields:xFe,serverField:vFe,serverFieldLabel:wFe,detailBlock:kFe,parameters:_Fe,invalidBlock:SFe,parameterRow:CFe,actionMessage:TFe,oauthPage:EFe,scrollHint:AFe},a9="web-shell:mcp-panel-active",Fm=10,{parse:NFe}=SC("web-shell:mcp-status:v1:");function jFe(e){const t=NFe(e);return!t||!t.status?null:t}function n_(e,t){if(e.disabled)return{icon:"✗",text:t("mcp.status.disabled"),className:Zt.error};if(e.approvalState==="pending")return{icon:"!",text:t("mcp.status.needsApproval"),className:Zt.warning};if(e.approvalState==="rejected")return{icon:"✗",text:t("mcp.status.rejected"),className:Zt.warning};switch(e.mcpStatus){case"connected":return{icon:"✓",text:t("mcp.status.connected"),className:Zt.success};case"connecting":return{icon:"🔄",text:t("mcp.status.starting"),className:Zt.warning};case"disconnected":default:return{icon:"🔴",text:t("mcp.status.disconnectedTitle"),className:Zt.error}}}function sie(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 MFe(e){const t=sie(e);return t?JSON.stringify(t,null,2):""}function IFe(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function RFe(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 DFe(e,t){var s;const n=e.config;if(n!=null&&n.httpUrl)return`${n.httpUrl} (http)`;if(n!=null&&n.url)return`${n.url} (sse)`;if(n!=null&&n.command){const r=((s=n.args)==null?void 0:s.join(" "))??"";return`${n.command} ${r} (stdio)`.trim()}return e.transport?`(${e.transport})`:t("mcp.status.unknown")}function K6(e,t){const n=e.annotations??{},s=[];return n.destructiveHint&&s.push(t("mcp.annotation.destructive")),n.readOnlyHint&&s.push(t("mcp.annotation.readOnly")),n.openWorldHint&&s.push(t("mcp.annotation.openWorld")),n.idempotentHint&&s.push(t("mcp.annotation.idempotent")),s.join(", ")}function nH(e,t){window.dispatchEvent(new CustomEvent(a9,{detail:{id:e,active:t}}))}function s_(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function LFe(e,t){return e?t("mcp.required"):""}function PFe(e,t){const n=sie(e),s=n==null?void 0:n.properties,r=Array.isArray(n==null?void 0:n.required)?new Set(n.required.filter(o=>typeof o=="string")):new Set;if(!s||typeof s!="object"){const o=MFe(e);return o?l.jsx("pre",{className:Zt.schema,children:o}):null}const i=Object.entries(s);return i.length===0?null:l.jsxs("div",{className:Zt.parameters,children:[l.jsx("div",{className:Zt.sectionTitle,children:t("mcp.parameters")}),i.map(([o,a])=>{const c=a&&typeof a=="object"?a:{},u=typeof c.type=="string"?c.type:"any",d=typeof c.description=="string"?c.description:"";return l.jsx("div",{className:Zt.parameterRow,children:`• ${o}${LFe(r.has(o),t)}: ${u}${d?` - ${d}`:""}`},o)})]})}function OFe({message:e}){var Y;const{t}=ot(),n=ZG({autoLoad:!1}),[s,r]=f.useState(e.status),[i,o]=f.useState(e.toolsByServer),[a,c]=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"),[v,x]=f.useState(0),[y,w]=f.useState(0),[k,T]=f.useState(0),_=f.useMemo(()=>s.servers??[],[s.servers]),C=_[v]??null,S=f.useMemo(()=>{var V;return C?((V=i[C.name])==null?void 0:V.tools)??[]:[]},[C,i]),L=S[k]??null,N=f.useMemo(()=>S.length<=Fm||k<Fm-1?0:Math.min(k-Fm+1,S.length-Fm),[k,S.length]),$=f.useMemo(()=>S.slice(N,N+Fm),[S,N]),M=_.filter(V=>!V.disabled&&V.mcpStatus==="connecting").length,P=f.useMemo(()=>{const V=[];for(const j of _){const ee=IFe(j,t),se=V.find(X=>X.label===ee);se?se.servers.push(j):V.push({label:ee,servers:[j]})}return V},[_,t]),E=f.useMemo(()=>_.length===0?20:Math.min(Math.max(..._.map(V=>V.name.length))+2,35),[_]),O=f.useMemo(()=>S.length===0?30:Math.min(Math.max(...S.map(V=>V.name.length))+2,50),[S]),z=f.useMemo(()=>{if(!C)return[];const V=[],j=!!C.approvalState;return!C.disabled&&!j&&S.length>0&&V.push({id:"view-tools",label:t("mcp.action.tools")}),!C.disabled&&!j&&C.mcpStatus==="disconnected"&&V.push({id:"reconnect",label:t("mcp.action.reconnect")}),!C.disabled&&j&&V.push({id:"approve",label:t("mcp.action.approve")}),(!(C.configOrigin==="extension"||C.source==="extension"||!!C.extensionName)||C.disabled)&&V.push({id:C.disabled?"enable":"disable",label:C.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),!C.disabled&&!j&&(V.push({id:"authenticate",label:C.hasOAuthTokens?t("mcp.action.reauth"):t("mcp.action.auth")}),C.hasOAuthTokens&&V.push({id:"clear-auth",label:t("mcp.action.clearAuth")})),V},[C,S.length,t]),F=f.useCallback(async()=>{var j;const V=await n.reload();if(V){r(V);const ee=((j=V.servers)==null?void 0:j.find(se=>se.name===(C==null?void 0:C.name)))??null;if(ee){if(ee.approvalState)return;const se=await n.loadTools(ee.name);o(X=>({...X,[ee.name]:se}))}}},[n,C==null?void 0:C.name]),B=f.useCallback(async V=>{if(!(!C||V.disabled||u)){if(V.id==="view-tools"){b("tools"),T(0),c(null);return}d(!0),V.id==="authenticate"&&b("oauth"),c(V.id==="authenticate"?s_(C.name,t):t("mcp.action.running",{action:V.label}));try{let j=null;if(V.id==="reconnect"){const ee=await n.restartServer(C.name);if("restarted"in ee&&!ee.restarted)throw new Error(t("mcp.reconnect.skipped",{reason:ee.reason}));if("entries"in ee&&(ee.entries.length===0||ee.entries.every(se=>!se.restarted)))throw new Error(t("mcp.reconnect.skipped",{reason:ee.entries.map(se=>se.reason).filter(Boolean).join(", ")||"not connected"}))}else{const ee=await n.manageServer(C.name,V.id),se=[...ee.messages??[],...ee.authUrl?[ee.authUrl]:[]].join(`
`);se&&(j=V.id==="authenticate"?s_(C.name,t,se):se)}await F(),c(j??t("mcp.action.done",{action:V.label}))}catch(j){c(V.id==="authenticate"?s_(C.name,t,ba(j)):t("mcp.action.failed",{error:ba(j)}))}finally{d(!1)}}},[u,n,F,C,t]);if(f.useEffect(()=>{const V=h.current;return nH(V,m),()=>nH(V,!1)},[m]),f.useEffect(()=>{const V=j=>{const ee=j.detail;ee!=null&&ee.active&&ee.id&&ee.id!==h.current&&p(!1)};return window.addEventListener(a9,V),()=>window.removeEventListener(a9,V)},[]),nie(V=>{if(m){if(V.key==="Escape"){V.preventDefault(),V.stopPropagation(),g==="servers"?p(!1):g==="server"?(b("servers"),w(0),c(null)):g==="oauth"?(b("server"),c(null)):g==="tools"?(b("server"),T(0)):b("tools");return}if(V.key==="ArrowUp"||V.key==="ArrowDown"){V.preventDefault(),V.stopPropagation();const j=V.key==="ArrowUp"?-1:1;g==="servers"?(x(ee=>Math.min(Math.max(ee+j,0),_.length-1)),w(0)):g==="server"?w(ee=>Math.min(Math.max(ee+j,0),z.length-1)):g==="tools"&&T(ee=>Math.min(Math.max(ee+j,0),S.length-1));return}if(V.key==="Enter")if(V.preventDefault(),V.stopPropagation(),g==="servers"&&_.length>0)b("server"),w(0);else if(g==="server"&&z.length>0){const j=z[y];j&&B(j)}else g==="tools"&&S.length>0&&b("tool")}},[m,y,S.length,z,B,_.length,g]),!m)return null;if(_.length===0)return l.jsxs("div",{className:Zt.panel,"data-keyboard-scope":!0,children:[l.jsxs("div",{className:Zt.header,children:[l.jsx("div",{className:Zt.title,children:t("mcp.manageServers")}),l.jsx("div",{className:Zt.secondary,children:t("mcp.servers",{count:0})})]}),l.jsx("div",{className:Zt.secondary,children:t("mcp.empty")}),l.jsx("div",{className:Zt.shortcuts,children:t("mcp.shortcut.close")})]});const W=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")}):(L==null?void 0:L.name)??t("mcp.toolDetail"),I=g==="servers"?t("mcp.servers",{count:_.length}):g==="server"||g==="oauth"?"":g==="tools"?t(S.length===1?"mcp.toolCount":"mcp.toolsCount",{count:S.length}):(L==null?void 0:L.serverToolName)??(C==null?void 0:C.name)??"";return l.jsxs("div",{className:Zt.panel,"data-keyboard-scope":!0,children:[M>0&&l.jsxs("div",{children:[l.jsx("div",{className:Zt.startup,children:t("mcp.starting",{count:M})}),l.jsx("div",{className:Zt.note,children:t("mcp.startingNote")})]}),l.jsxs("div",{className:Zt.header,children:[l.jsx("div",{className:Zt.title,children:W}),I&&l.jsx("div",{className:Zt.secondary,children:I})]}),g==="servers"&&l.jsx("div",{className:Zt.list,children:P.map(V=>{let j=0;for(const ee of P){if(ee===V)break;j+=ee.servers.length}return l.jsxs("div",{className:Zt.group,children:[l.jsx("div",{className:Zt.groupTitle,children:V.label}),V.servers.map((ee,se)=>{const X=j+se,Q=X===v,ue=n_(ee,t);return l.jsxs("div",{className:Q?`${Zt.row} ${Zt.selected}`:Zt.row,onClick:()=>{x(X),b("server"),w(0)},onMouseEnter:()=>x(X),children:[l.jsx("span",{className:Zt.pointer,children:Q?"❯":""}),l.jsx("span",{className:Zt.nameCell,style:{width:`${E}ch`},children:ee.name}),l.jsx("span",{className:Zt.separator,children:"·"}),l.jsxs("span",{className:ue.className,children:[ue.icon," ",ue.text]})]},ee.name)})]},V.label)})}),g==="server"&&C&&l.jsxs("div",{className:Zt.detail,children:[l.jsxs("div",{className:Zt.serverFields,children:[l.jsxs("div",{className:Zt.serverField,children:[l.jsxs("span",{className:Zt.serverFieldLabel,children:[t("mcp.status"),":"]}),l.jsxs("span",{className:n_(C,t).className,children:[n_(C,t).icon," ",n_(C,t).text]})]}),l.jsxs("div",{className:Zt.serverField,children:[l.jsxs("span",{className:Zt.serverFieldLabel,children:[t("mcp.source"),":"]}),l.jsx("span",{children:RFe(C,t)})]}),l.jsxs("div",{className:Zt.serverField,children:[l.jsxs("span",{className:Zt.serverFieldLabel,children:[t("mcp.command"),":"]}),l.jsx("span",{className:Zt.truncate,children:DFe(C,t)})]}),((Y=C.config)==null?void 0:Y.cwd)&&l.jsxs("div",{className:Zt.serverField,children:[l.jsxs("span",{className:Zt.serverFieldLabel,children:[t("mcp.workingDirectory"),":"]}),l.jsx("span",{className:Zt.truncate,children:C.config.cwd})]}),!C.disabled&&l.jsxs("div",{className:Zt.serverField,children:[l.jsxs("span",{className:Zt.serverFieldLabel,children:[t("mcp.tools"),":"]}),l.jsx("span",{children:t(S.length===1?"mcp.toolCount":"mcp.toolsCount",{count:S.length})})]})]}),l.jsx("div",{className:Zt.list,children:z.map((V,j)=>{const ee=j===y,se=[Zt.row,ee?Zt.selected:"",V.disabled?Zt.disabled:""].filter(Boolean).join(" ");return l.jsxs("div",{className:se,onClick:()=>{w(j),B(V)},children:[l.jsx("span",{className:Zt.pointer,children:ee?"❯":""}),l.jsx("span",{children:V.label})]},V.id)})}),a&&l.jsx("pre",{className:Zt.actionMessage,children:a})]}),g==="oauth"&&l.jsx("div",{className:Zt.oauthPage,children:l.jsx("pre",{className:Zt.actionMessage,children:a??(C?s_(C.name,t):t("mcp.status.unknown"))})}),g==="tools"&&l.jsx("div",{className:Zt.list,children:S.length===0?l.jsx("div",{className:Zt.secondary,children:t("mcp.emptyTools")}):$.map((V,j)=>{const ee=N+j,se=ee===k,X=K6(V,t);return l.jsxs("div",{className:se?`${Zt.row} ${Zt.selected}`:Zt.row,onClick:()=>{T(ee),b("tool")},onMouseEnter:()=>T(ee),children:[l.jsx("span",{className:Zt.pointer,children:se?"❯":""}),l.jsx("span",{className:Zt.nameCell,style:{width:`${O}ch`},children:V.name}),V.isValid?X?l.jsx("span",{className:Zt.secondary,children:X}):null:l.jsx("span",{className:Zt.warning,children:t("mcp.invalidReason",{reason:V.invalidReason||t("mcp.status.unknown")})})]},V.name)})}),g==="tools"&&S.length>Fm&&l.jsxs("div",{className:Zt.scrollHint,children:[N>0?"↑ ":"  ",t("mcp.scrollPosition",{current:k+1,total:S.length}),N+Fm<S.length?" ↓":""]}),g==="tool"&&L&&l.jsxs("div",{className:Zt.detail,children:[!L.isValid&&l.jsxs("div",{className:Zt.invalidBlock,children:[l.jsx("div",{className:Zt.sectionTitle,children:t("mcp.invalidToolWarning")}),l.jsxs("div",{children:[t("mcp.invalidReasonLabel")," ",L.invalidReason||t("mcp.status.unknown")]}),l.jsx("div",{className:Zt.secondary,children:t("mcp.invalidToolHelp")})]}),L.description&&l.jsxs("div",{className:Zt.detailBlock,children:[l.jsx("div",{className:Zt.sectionTitle,children:t("mcp.description")}),l.jsx("div",{className:Zt.description,children:L.description.trim()})]}),K6(L,t)&&l.jsxs("div",{className:Zt.detailBlock,children:[l.jsx("span",{className:Zt.sectionTitle,children:t("mcp.annotations")})," ",l.jsx("span",{children:K6(L,t)})]}),PFe(L,t)]}),l.jsx("div",{className:Zt.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 BFe=3;function d4(e){return e.kind==="agent"&&typeof e.id=="string"}function $Fe(e){const t=e.filter(d4),n=new Map;for(const u of t)n.set(u.id,u);const s=new Map,r=[];for(const u of t){const d=u.parentAgentId;if(d!=null&&d!==u.id&&n.has(d)){const h=s.get(d);h?h.push(u):s.set(d,[u])}else r.push(u)}if(s.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 s.get(u.id)??[])a(d)}};for(const u of r)a(u);for(const u of t)o.has(u.id)||(o.add(u.id),i.push(u));let c=0;return e.map(u=>d4(u)?i[c++]:u)}function rie(e,t){const n=[],s=new Set(e.id!=null?[e.id]:[]);let r=e.parentAgentId;for(;;){if(r==null)return{chain:n,terminatedBy:"root"};if(s.has(r))return{chain:n,terminatedBy:"cycle"};const i=t(r);if(!i)return{chain:n,terminatedBy:"missing"};s.add(r),n.push(i),r=i.parentAgentId}}function zFe(e){const t=new Map;for(const s of e)d4(s)&&t.set(s.id,s);const n=new Map;for(const s of t.values()){const{chain:r,terminatedBy:i}=rie(s,o=>t.get(o));n.set(s.id,{visibleDepth:i==="cycle"?0:r.length,orphaned:r.length===0&&i==="missing"})}return n}function FFe(e){const t=new Map;for(const s of e)d4(s)&&t.set(s.id,s);const n=new Set;for(const s of t.values()){if(s.isBackgrounded!==!1)continue;const{chain:r,terminatedBy:i}=rie(s,o=>t.get(o));i==="root"&&r.every(o=>o.isBackgrounded===!1)&&n.add(s.id)}return n}function h4(e){const t=Math.max(0,Math.floor(e/1e3)),n=t%60,s=Math.floor(t/60);if(s===0)return`${n}s`;const r=s%60,i=Math.floor(s/60);return i===0?`${r}m ${n}s`:`${i}h ${r}m`}const HFe="_panel_1c0ra_1",qFe="_embeddedPanel_1c0ra_12",UFe="_title_1c0ra_19",VFe="_sectionTitle_1c0ra_24",WFe="_overflowHint_1c0ra_28",GFe="_header_1c0ra_33",KFe="_secondary_1c0ra_39",YFe="_row_1c0ra_43",XFe="_selected_1c0ra_51",QFe="_pointer_1c0ra_55",JFe="_nameCell_1c0ra_61",ZFe="_treeMarker_1c0ra_70",eHe="_orphanNote_1c0ra_74",tHe="_status_1c0ra_78",nHe="_chevronCell_1c0ra_84",sHe="_chevron_1c0ra_84",rHe="_chevronExpanded_1c0ra_101",iHe="_separator_1c0ra_111",oHe="_list_1c0ra_115",aHe="_task_1c0ra_121",lHe="_taskExpanded_1c0ra_127",cHe="_success_1c0ra_132",uHe="_warning_1c0ra_136",dHe="_error_1c0ra_140",hHe="_detail_1c0ra_144",fHe="_detailTop_1c0ra_153",mHe="_detailTopMain_1c0ra_160",pHe="_inlineDetail_1c0ra_200",gHe="_taskIcon_1c0ra_222",bHe="_detailField_1c0ra_251",yHe="_detailFieldLabel_1c0ra_258",xHe="_detailContent_1c0ra_264",vHe="_compactSummary_1c0ra_271",wHe="_actionBar_1c0ra_280",kHe="_actionHint_1c0ra_289",_He="_actionButton_1c0ra_294",SHe="_dangerButton_1c0ra_314",CHe="_shortcuts_1c0ra_318",THe="_confirmHint_1c0ra_324",EHe="_statusBadge_1c0ra_328",AHe="_activityCurrent_1c0ra_334",NHe="_activityPast_1c0ra_341",jHe="_promptContent_1c0ra_348",Pt={panel:HFe,embeddedPanel:qFe,title:UFe,sectionTitle:VFe,overflowHint:WFe,header:GFe,secondary:KFe,row:YFe,selected:XFe,pointer:QFe,nameCell:JFe,treeMarker:ZFe,orphanNote:eHe,status:tHe,chevronCell:nHe,chevron:sHe,chevronExpanded:rHe,separator:iHe,list:oHe,task:aHe,taskExpanded:lHe,success:cHe,warning:uHe,error:dHe,detail:hHe,detailTop:fHe,detailTopMain:mHe,inlineDetail:pHe,taskIcon:gHe,detailField:bHe,detailFieldLabel:yHe,detailContent:xHe,compactSummary:vHe,actionBar:wHe,actionHint:kHe,actionButton:_He,dangerButton:SHe,shortcuts:CHe,confirmHint:THe,statusBadge:EHe,activityCurrent:AHe,activityPast:NHe,promptContent:jHe},mv="web-shell:tasks-panel-active",MHe=3e3,sH=8,{parse:IHe}=SC("web-shell:tasks-status:v1:");function RHe(e){const t=IHe(e);return!t||!t.snapshot?null:t}function rH(e,t){window.dispatchEvent(new CustomEvent(mv,{detail:{id:e,active:t}}))}function iH(e){return e.status==="running"||e.status==="paused"}function DHe(e){return[...e].sort((t,n)=>{const s=iH(t),r=iH(n);return s!==r?s?-1:1:s?n.startTime-t.startTime:(n.endTime??n.startTime)-(t.endTime??t.startTime)})}function Y6(e){return $Fe(DHe(e))}function oH(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function iie(e){switch(e){case"running":return Pt.success;case"paused":return Pt.warning;case"completed":return Pt.success;case"failed":return Pt.error;case"cancelled":return Pt.warning;default:return""}}function LHe(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 PHe(e){switch(e){case"paused":return"⏸";case"completed":return"✓";case"failed":case"cancelled":return"✗";case"running":return null;default:return null}}function OHe({expanded:e}){return l.jsx("svg",{className:`${Pt.chevron} ${e?Pt.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function BHe(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 $He(e,t){if(e.length<=sH)return{visible:e,windowStart:0,hiddenAbove:0,hiddenBelow:0};const n=Math.max(1,sH-2),s=Math.max(0,Math.min(t-Math.floor(n/2),e.length-n)),r=Math.min(e.length,s+n);return{visible:e.slice(s,r),windowStart:s,hiddenAbove:s,hiddenBelow:e.length-r}}function zHe(e,t,n){const s=Pc(e,n),r=t?t.replace(/\s*\n\s*/g," ").trim():"",i=r?`${s}(${r})`:s;return u2(i)}function oie({message:e,embedded:t=!1,manageActiveEvent:n=!0,onClose:s}){const{t:r}=ot(),i=B1(),[o,a]=f.useState(()=>Y6(e.snapshot.tasks)),[c,u]=f.useState(!0),[d,h]=f.useState("list"),[m,p]=f.useState(0),[g,b]=f.useState(null),[v,x]=f.useState(!1),[y,w]=f.useState(!1),[k,T]=f.useState(null),_=f.useRef(`tasks-${Math.random().toString(36).slice(2)}`),C=f.useRef(!1),S=f.useRef(null),L=o.length===0?0:Math.min(m,o.length-1),N=o[L]??null,$=f.useMemo(()=>zFe(o),[o]),M=f.useMemo(()=>FFe(o),[o]);f.useEffect(()=>{if(!c)return;const ee=setInterval(()=>{C.current||(C.current=!0,i.getTasks().then(se=>{a(Y6(se.tasks)),w(!1)}).catch(se=>{console.warn("[web-shell] failed to refresh tasks:",se),w(!0)}).finally(()=>{C.current=!1}))},MHe);return()=>clearInterval(ee)},[c,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(!c||d!=="detail"){S.current=null;return}if(!N){S.current=null,h("list");return}const j=S.current;if(!j||j.taskId!==N.id){S.current={taskId:N.id,status:N.status};return}j.status==="running"&&N.status!=="running"&&(b(null),h("list"))},[c,d,N]),f.useEffect(()=>{if(!n)return;const j=_.current;return rH(j,c),()=>rH(j,!1)},[c,n]),f.useEffect(()=>{if(!n)return;const j=ee=>{const se=ee.detail;se!=null&&se.active&&se.id&&se.id!==_.current&&u(!1)};return window.addEventListener(mv,j),()=>window.removeEventListener(mv,j)},[n]),f.useEffect(()=>{c||s==null||s()},[c,s]);const P=f.useCallback(async j=>{if(v)return;const ee=j.status==="running",se=j.kind==="agent"&&j.status==="paused";if(!ee&&!se)return;if(j.kind==="agent"&&M.has(j.id)&&g!==j.id){b(j.id);return}b(null),x(!0);try{if(!(await i.cancelTask(j.id,j.kind)).cancelled){T(r("tasks.alreadyStopped"));return}const ue=await i.getTasks();a(Y6(ue.tasks)),T(null)}catch(Q){console.warn("[web-shell] failed to cancel task:",Q),T(r("tasks.cancelFailed"))}finally{x(!1)}},[i,v,M,g,r]);if(nie(j=>{if(c){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 ee=j.key==="ArrowUp"?-1:1;p(se=>Math.min(Math.max(se+ee,0),o.length-1)),b(null);return}if(j.key==="Enter"){j.preventDefault(),j.stopPropagation(),d==="list"&&N?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(),N&&P(N);return}}},[c,d,o.length,N,P,g]),!c)return null;const E=g!==null&&N!==null&&g===N.id,O=[];E?(O.push(r("tasks.confirmStop")),O.push(r("tasks.shortcut.cancelConfirm"))):(O.push(r("tasks.shortcut.select")),O.push(r("tasks.shortcut.view")),(N==null?void 0:N.status)==="running"?O.push(r("tasks.shortcut.stop")):(N==null?void 0:N.kind)==="agent"&&(N==null?void 0:N.status)==="paused"&&O.push(r("tasks.shortcut.abandon")),O.push(r("tasks.shortcut.listClose")));const z=[];if(E?(z.push(r("tasks.confirmStop")),z.push(r("tasks.shortcut.cancelConfirm"))):(z.push(r("tasks.shortcut.detailBack")),z.push(r("tasks.shortcut.detailClose")),(N==null?void 0:N.status)==="running"?z.push(r("tasks.shortcut.stop")):(N==null?void 0:N.kind)==="agent"&&(N==null?void 0:N.status)==="paused"&&z.push(r("tasks.shortcut.abandon"))),o.length===0)return l.jsxs("div",{className:t?`${Pt.panel} ${Pt.embeddedPanel}`:Pt.panel,"data-keyboard-scope":!0,children:[(y||k||!t)&&l.jsxs("div",{className:Pt.header,children:[!t&&l.jsx("div",{className:Pt.title,children:r("tasks.title")}),y&&l.jsx("div",{className:Pt.warning,children:r("tasks.refreshStale")}),k&&l.jsx("div",{className:Pt.error,children:k})]}),l.jsx("div",{children:l.jsx("div",{className:Pt.secondary,children:r("tasks.empty")})}),!t&&l.jsx("div",{className:Pt.shortcuts,children:r("tasks.shortcut.close")})]});const{visible:F,windowStart:B,hiddenAbove:W,hiddenBelow:I}=$He(o,L),Y=t?o:F,V=t?0:B;return l.jsxs("div",{className:t?`${Pt.panel} ${Pt.embeddedPanel}`:Pt.panel,"data-keyboard-scope":!0,children:[(t||d==="list")&&(y||k||!t)&&l.jsxs("div",{className:Pt.header,children:[!t&&l.jsx("div",{className:Pt.title,children:r("tasks.title")}),y&&l.jsx("div",{className:Pt.warning,children:r("tasks.refreshStale")}),k&&l.jsx("div",{className:Pt.error,children:k})]}),(t||d==="list")&&l.jsxs("div",{className:Pt.list,children:[!t&&l.jsxs("div",{className:Pt.sectionTitle,children:[r("tasks.title")," ",l.jsxs("span",{className:Pt.secondary,children:["(",o.length,")"]})]}),!t&&W>0&&l.jsx("div",{className:Pt.overflowHint,children:r("tasks.moreAbove",{count:W})}),Y.map((j,ee)=>{const se=V+ee,X=se===L,Q=iie(j.status),ue=LHe(j.status,r),re=t&&X&&d==="detail",J=t?re:X,q=j.kind==="agent"?$.get(j.id):void 0,Z=Math.min((q==null?void 0:q.visibleDepth)??0,BFe),he=j.kind==="agent"&&j.parentAgentId!=null,ye=q!=null&&q.orphaned?j.kind==="agent"&&j.parentName?r("tasks.row.from",{parent:j.parentName}):r("tasks.row.nested"):null;return l.jsxs("div",{className:`${Pt.task} ${re?Pt.taskExpanded:""}`,children:[l.jsxs("div",{className:J?`${Pt.row} ${Pt.selected}`:Pt.row,onClick:()=>{p(se),h(t&&re?"list":"detail")},onMouseEnter:()=>{t||p(se)},children:[l.jsx("span",{className:Pt.pointer,children:J?"❯":""}),t&&l.jsx("span",{className:Pt.taskIcon,"aria-hidden":"true"}),l.jsxs("span",{className:Pt.nameCell,style:Z>0?{paddingLeft:`${Z*16}px`}:void 0,children:[he&&l.jsx("span",{className:Pt.treeMarker,"aria-hidden":"true",children:"↳ "}),BHe(j,M.has(j.id)),ye&&l.jsxs("span",{className:Pt.orphanNote,children:[" · ",ye]})]}),l.jsx("span",{className:`${Pt.status} ${Q}`,children:ue}),l.jsx("span",{className:Pt.chevronCell,children:l.jsx(OHe,{expanded:re})})]}),re&&l.jsx("div",{className:Pt.inlineDetail,children:l.jsx(aH,{task:j,t:r,hideHeader:!0,busy:v,showCancelConfirm:g===j.id,onCancel:()=>void P(j),onCancelConfirmDismiss:()=>b(null)})})]},j.id)}),!t&&I>0&&l.jsx("div",{className:Pt.overflowHint,children:r("tasks.moreBelow",{count:I})})]}),!t&&d==="detail"&&N&&l.jsxs(l.Fragment,{children:[k&&l.jsx("div",{className:Pt.error,children:k}),l.jsx(aH,{task:N,t:r,busy:v,showCancelConfirm:g===N.id,onCancel:()=>void P(N),onCancelConfirmDismiss:()=>b(null)})]}),!t&&l.jsx("div",{className:E?`${Pt.shortcuts} ${Pt.confirmHint}`:Pt.shortcuts,children:(d==="list"?O:z).join(" · ")})]})}function FHe(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 aH({task:e,t,hideHeader:n=!1,busy:s=!1,showCancelConfirm:r=!1,onCancel:i,onCancelConfirmDismiss:o}){var w,k,T;const a=PHe(e.status),c=iie(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=[h4(e.runtimeMs)],g=[{label:t("tasks.detail.runtime"),value:h4(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:oH(b)})),g.push({label:t("tasks.detail.tokenCount"),value:oH(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 v=e.kind==="agent"&&e.prompt?e.prompt.split(`
`):[],x=d&&i?l.jsx("div",{className:Pt.actionBar,children:r?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Pt.actionHint,children:t("tasks.action.confirmHint")}),l.jsx("button",{type:"button",className:`${Pt.actionButton} ${Pt.dangerButton}`,disabled:s,onClick:i,children:m}),l.jsx("button",{type:"button",className:Pt.actionButton,onClick:o,children:t("common.cancel")})]}):l.jsx("button",{type:"button",className:`${Pt.actionButton} ${Pt.dangerButton}`,disabled:s,onClick:i,children:h})}):null,y=n?g.length>0?l.jsx("div",{className:Pt.compactSummary,children:g.map(_=>`${_.label} ${_.value}`).join(" · ")}):null:l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Pt.title,children:FHe(e,t)}),l.jsxs("div",{className:Pt.statusBadge,children:[a&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:c,children:[a," ",t(`tasks.${e.status}`)]}),l.jsx("span",{className:Pt.separator,children:"·"})]}),l.jsx("span",{className:Pt.secondary,children:p.join(" · ")})]})]});return l.jsxs("div",{className:Pt.detail,children:[(y||x)&&l.jsxs("div",{className:Pt.detailTop,children:[y&&l.jsx("div",{className:Pt.detailTopMain,children:y}),x]}),e.kind==="shell"&&l.jsxs(l.Fragment,{children:[l.jsx(D0,{label:t("tasks.detail.workingDir"),value:e.cwd}),e.outputFile&&l.jsx(D0,{label:t("tasks.detail.outputFile"),value:e.outputFile})]}),e.kind==="monitor"&&l.jsx(D0,{label:t("tasks.detail.command"),value:e.command}),e.kind==="agent"&&e.subagentType&&l.jsx(D0,{label:t("tasks.detail.type"),value:e.subagentType}),e.kind==="agent"&&(e.depth??0)>0&&l.jsx(D0,{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&&l.jsxs("div",{className:Pt.detailField,children:[l.jsx("div",{className:Pt.detailFieldLabel,children:t("tasks.detail.progress")}),l.jsx("div",{className:Pt.detailContent,children:e.recentActivities.slice(-5).map((_,C,S)=>{const L=C===S.length-1,N=zHe(_.name,_.description,t);return l.jsxs("div",{className:L?Pt.activityCurrent:Pt.activityPast,children:[L?"> ":"  ",N]},`${_.at}-${C}`)})})]}),e.kind==="agent"&&e.prompt&&l.jsxs("div",{className:Pt.detailField,children:[l.jsx("div",{className:Pt.detailFieldLabel,children:t("tasks.detail.prompt")}),l.jsx("div",{className:Pt.promptContent,children:v.slice(0,5).map((_,C,S)=>l.jsx("div",{children:C===S.length-1&&v.length>5?`${_}…`:_||" "},C))})]}),e.kind==="agent"&&e.outputFile&&l.jsx(D0,{label:t("tasks.detail.outputFile"),value:e.outputFile}),e.kind==="agent"&&e.status==="paused"&&e.resumeBlockedReason&&l.jsxs("div",{className:Pt.detailField,children:[l.jsx("div",{className:`${Pt.detailFieldLabel} ${Pt.error}`,children:t("tasks.detail.resumeBlocked")}),l.jsx("div",{className:Pt.error,children:e.resumeBlockedReason})]}),e.error&&l.jsxs("div",{className:Pt.detailField,children:[l.jsx("div",{className:`${Pt.detailFieldLabel} ${e.kind==="monitor"&&e.status!=="failed"?Pt.warning:Pt.error}`,children:e.kind==="monitor"&&e.status!=="failed"?t("tasks.detail.stoppedBecause"):t("tasks.detail.error")}),l.jsx("div",{className:e.kind==="monitor"&&e.status!=="failed"?Pt.warning:Pt.error,children:e.error})]})]})}function D0({label:e,value:t}){return l.jsxs("div",{className:Pt.detailField,children:[l.jsx("div",{className:Pt.detailFieldLabel,children:e}),l.jsx("div",{className:Pt.detailContent,children:t})]})}const HHe="_message_fm8gc_1",qHe="_body_fm8gc_15",UHe="_title_fm8gc_20",VHe="_muted_fm8gc_24",WHe="_accent_fm8gc_28",GHe="_success_fm8gc_32",KHe="_error_fm8gc_36",YHe="_warning_fm8gc_40",XHe="_row_fm8gc_44",QHe="_label_fm8gc_50",JHe="_value_fm8gc_55",Va={message:HHe,body:qHe,title:UHe,muted:VHe,accent:WHe,success:GHe,error:KHe,warning:YHe,row:XHe,label:QHe,value:JHe},l9="web-shell-goal-status-active",{serialize:lH,parse:ZHe}=SC(Tfe),eqe=new Set(["set","achieved","cleared","failed","aborted","checking"]);function f4(e){const t=typeof e=="string"?ZHe(e):e;return tqe(t)}function tqe(e){if(!e||typeof e!="object")return null;const t=e,n=t.kind,s=t.condition;if(typeof n!="string"||!eqe.has(n)||typeof s!="string")return null;const r=X6(t.iterations),i=X6(t.durationMs),o=X6(t.setAt),a=typeof t.lastReason=="string"?t.lastReason:void 0;return{kind:n,condition:s,...r!==void 0?{iterations:r}:{},...i!==void 0?{durationMs:i}:{},...o!==void 0?{setAt:o}:{},...a!==void 0?{lastReason:a}:{}}}function X6(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function nqe(e,t){return t(e===1?"goal.turn":"goal.turns",{count:e})}function sqe(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:Va.muted};case"set":return{title:t("goal.set"),colorClass:Va.accent};case"achieved":return{title:t("goal.achieved"),colorClass:Va.success};case"cleared":return{title:t("goal.cleared"),colorClass:Va.muted};case"failed":return{title:t("goal.failed"),colorClass:Va.error};case"aborted":return{title:t("goal.aborted"),colorClass:Va.warning}}}function rqe({status:e,activateFooter:t=!1}){var u;const{t:n}=ot(),s=lj();f.useEffect(()=>{if(!t||s==="readonly")return;const d=e.kind==="set"||e.kind==="checking";window.dispatchEvent(new CustomEvent(l9,{detail:{active:d,condition:e.condition,setAt:e.setAt}}))},[t,s,e.condition,e.kind,e.setAt]);const r=sqe(e,n),i=[];e.kind!=="checking"&&(e.iterations&&e.iterations>0&&i.push(nqe(e.iterations,n)),typeof e.durationMs=="number"&&i.push(h4(e.durationMs)));const o=i.length>0?` · ${i.join(" · ")}`:"",a=(e.kind==="checking"||e.kind==="achieved"||e.kind==="failed"||e.kind==="aborted")&&((u=e.lastReason)==null?void 0:u.trim()),c=e.kind==="checking"?n("goal.judge"):n("goal.lastCheck");return l.jsx("div",{className:Va.message,children:l.jsxs("div",{className:Va.body,children:[l.jsxs("div",{className:`${Va.title} ${r.colorClass}`,children:[r.title,o&&l.jsx("span",{className:Va.muted,children:o})]}),l.jsxs("div",{className:Va.row,children:[l.jsxs("span",{className:Va.label,children:[n("goal.label"),":"]}),l.jsx("span",{className:Va.value,children:e.condition})]}),a&&l.jsxs("div",{className:Va.muted,children:[c,": ",a]})]})})}const iqe="_message_u8kmd_1",oqe="_flushMessage_u8kmd_12",aqe="_noMarker_u8kmd_26",lqe="_content_u8kmd_30",cqe="_info_u8kmd_49",uqe="_recap_u8kmd_54",dqe="_modelSwitch_u8kmd_67",hqe="_error_u8kmd_71",fqe="_warning_u8kmd_77",mqe="_retryHint_u8kmd_83",pqe="_retryButton_u8kmd_90",gqe="_cancelled_u8kmd_108",$a={message:iqe,flushMessage:oqe,noMarker:aqe,content:lqe,info:cqe,recap:uqe,modelSwitch:dqe,error:hqe,warning:fqe,retryHint:mqe,retryButton:pqe,cancelled:gqe},bqe=f.memo(function({content:t,variant:n,source:s,data:r,onShowContextDetail:i,isLatest:o=!1,showRetryHint:a=!1,onRetryClick:c}){const{t:u}=ot();if(s==="prompt_cancelled")return l.jsx("div",{className:$a.cancelled,role:"status",children:l.jsx("span",{children:u("turn.stopped")})});const d=n==="info"?F$e(t):null;if(d)return l.jsx("div",{className:$a.flushMessage,children:l.jsx(K$e,{status:d,onShowDetail:i})});const h=n==="info"?Nze(t):null;if(h)return l.jsx("div",{className:$a.flushMessage,children:l.jsx(Oze,{view:h.view,status:h.status})});const m=n==="info"?Wze(t):null;if(m)return l.jsx("div",{className:$a.flushMessage,children:l.jsx(Gze,{info:m})});const p=n==="info"?jFe(t):null;if(p)return l.jsx("div",{className:$a.flushMessage,children:l.jsx(OFe,{message:p})});const g=n==="info"?RHe(t):null;if(g)return l.jsx("div",{className:$a.flushMessage,children:l.jsx(oie,{message:g})});const b=n==="info"?f4(s==="goal"?r:t):null;if(b)return l.jsx("div",{className:$a.flushMessage,children:l.jsx(rqe,{status:b,activateFooter:o})});const v=n==="info"&&s==="model_switch_summary",x=n==="info"&&s==="recap";return l.jsx("div",{className:`${$a.message} ${$a[n]} ${v?$a.modelSwitch:""} ${x?$a.recap:""}`,children:l.jsxs("div",{className:$a.content,children:[v?l.jsx("pre",{children:t}):n==="info"?l.jsx(Op,{content:t}):l.jsx("pre",{children:t}),a&&c&&l.jsx("div",{className:$a.retryHint,children:l.jsx("button",{type:"button",className:$a.retryButton,onClick:c,children:u("retry.hint")})})]})})}),yqe="_group_1lo6j_1",xqe="_chatSummaryGroup_1lo6j_14",vqe="_line_1lo6j_22",wqe="_chatSummary_1lo6j_14",kqe="_chatSummaryTextActive_1lo6j_49",_qe="_chatSummaryIcon_1lo6j_55",Sqe="_chatSummaryToolIcon_1lo6j_69",Cqe="_chatSummaryText_1lo6j_49",Tqe="_chatSummaryInline_1lo6j_85",Eqe="_chatChevronRight_1lo6j_122",Aqe="_chatChevronDown_1lo6j_123",Nqe="_chatSummaryContentClip_1lo6j_184",jqe="_chatSummaryContentCollapsed_1lo6j_192",Mqe="_chatSummaryContentInner_1lo6j_196",Iqe="_lineMain_1lo6j_201",Rqe="_icon_1lo6j_211",Dqe="_iconError_1lo6j_216",Lqe="_lineName_1lo6j_221",Pqe="_lineArg_1lo6j_225",Oqe="_lineElapsed_1lo6j_233",Bqe="_lineExpandable_1lo6j_239",$qe="_lineChevronRight_1lo6j_259",zqe="_lineChevronDown_1lo6j_260",Fqe="_lineOutput_1lo6j_297",Hqe="_expandedCard_1lo6j_306",qqe="_expandedCardHeader_1lo6j_316",Uqe="_expandedCardTitle_1lo6j_325",Vqe="_expandedCardDetail_1lo6j_332",Wqe="_expandedCardBody_1lo6j_342",Gqe="_expandedAgentCard_1lo6j_347",Kqe="_expandedLineOutput_1lo6j_357",Yqe="_lineDetail_1lo6j_361",Xqe="_markdownLineDetail_1lo6j_367",Qqe="_expandedBash_1lo6j_375",Jqe="_expandedRead_1lo6j_376",Zqe="_expandedOutput_1lo6j_380",eUe="_expandedEdit_1lo6j_394",tUe="_todoProgress_1lo6j_408",nUe="_todoBody_1lo6j_415",sUe="_compactGroup_1lo6j_423",rUe="_compactHeader_1lo6j_430",iUe="_compactCount_1lo6j_440",oUe="_compactHint_1lo6j_446",Vt={group:yqe,chatSummaryGroup:xqe,line:vqe,chatSummary:wqe,chatSummaryTextActive:kqe,chatSummaryIcon:_qe,chatSummaryToolIcon:Sqe,chatSummaryText:Cqe,chatSummaryInline:Tqe,chatChevronRight:Eqe,chatChevronDown:Aqe,chatSummaryContentClip:Nqe,chatSummaryContentCollapsed:jqe,chatSummaryContentInner:Mqe,lineMain:Iqe,icon:Rqe,iconError:Dqe,lineName:Lqe,lineArg:Pqe,lineElapsed:Oqe,lineExpandable:Bqe,lineChevronRight:$qe,lineChevronDown:zqe,lineOutput:Fqe,expandedCard:Hqe,expandedCardHeader:qqe,expandedCardTitle:Uqe,expandedCardDetail:Vqe,expandedCardBody:Wqe,expandedAgentCard:Gqe,expandedLineOutput:Kqe,lineDetail:Yqe,markdownLineDetail:Xqe,expandedBash:Qqe,expandedRead:Jqe,expandedOutput:Zqe,expandedEdit:eUe,todoProgress:tUe,todoBody:nUe,compactGroup:sUe,compactHeader:rUe,compactCount:iUe,compactHint:oUe};function tm({status:e}){const{t}=ot();switch(e){case"completed":case"success":return null;case"failed":case"error":case"cancelled":case"canceled":return l.jsx("span",{className:`${Vt.icon} ${Vt.iconError}`,children:t("tool.status.failed")});case"in_progress":case"running":return null;default:return null}}function sw(e,t){if(!e)return"";const n=Math.round(((t||Date.now())-e)/1e3);if(n<3)return"";if(n<60)return`${n}s`;const s=Math.floor(n/60),r=n%60;return`${s}m ${r}s`}function aie(e){if(!e)return"";const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t%60;return`${n}m ${s}s`}function lie(e){const t=Math.max(1,Math.ceil(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t%60;return s>0?`${n}m ${s}s`:`${n}m`}const aUe="_panel_rcjxd_1",lUe="_header_rcjxd_11",cUe="_desc_rcjxd_23",uUe="_toggle_rcjxd_32",dUe="_meta_rcjxd_38",hUe="_body_rcjxd_44",fUe="_content_rcjxd_55",mUe="_stream_rcjxd_70",pUe="_streamCollapsed_rcjxd_80",gUe="_scrollWindow_rcjxd_88",bUe="_expandToggle_rcjxd_93",yUe="_sectionCap_rcjxd_110",xUe="_tools_rcjxd_128",vUe="_step_rcjxd_142",wUe="_toolTimeRow_rcjxd_188",kUe="_toolTimeTip_rcjxd_192",fi={panel:aUe,header:lUe,desc:cUe,toggle:uUe,meta:dUe,body:hUe,content:fUe,stream:mUe,streamCollapsed:pUe,scrollWindow:gUe,expandToggle:bUe,sectionCap:yUe,tools:xUe,step:vUe,toolTimeRow:wUe,toolTimeTip:kUe};function cie(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function _Ue({timestamp:e,children:t}){return e===void 0?l.jsx(l.Fragment,{children:t}):l.jsxs("div",{className:fi.toolTimeRow,children:[t,l.jsx("span",{className:fi.toolTimeTip,"aria-hidden":"true",children:s1(e)})]})}const SUe=f.memo(function({tool:t}){const n=t.subTools||t.subContent?l.jsx(qI,{tool:t}):l.jsx(d9,{tool:t,forceExpandable:!0,hideCollapsedOutput:!0});return l.jsx(_Ue,{timestamp:t.startTime,children:n})});function CUe({tc:e}){const{t}=ot();return l.jsx("div",{className:Vt.line,children:l.jsxs("div",{className:Vt.lineMain,children:[l.jsx(tm,{status:e.status}),l.jsx("span",{className:Vt.lineName,children:Pc(e.name,t)})]})})}function TUe(e){var t;if(e.rawOutput&&cie(e.rawOutput)&&e.rawOutput.result)return e.rawOutput.result;if(e.content){for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text}if(e.rawOutput){if(typeof e.rawOutput=="string")return e.rawOutput;const n=e.rawOutput;if(typeof n.output=="string")return n.output;if(typeof n.result=="string")return n.result;if(typeof n.content=="string")return n.content;if(typeof n.reason=="string")return n.reason;if(typeof n.terminateReason=="string"&&n.terminateReason!=="GOAL")return n.terminateReason;if(typeof n.error=="string")return n.error;if(typeof n.text=="string")return n.text}return""}function EUe({text:e}){const{compactThinking:t}=$c(),{t:n}=ot(),[s,r]=f.useState(!1),[i,o]=f.useState(!1),a=f.useRef(null),c=t&&!s;return f.useEffect(()=>{const u=a.current;!u||!c||(o(u.scrollHeight>u.clientHeight),u.scrollTop=u.scrollHeight)},[c,e]),f.useEffect(()=>{const u=a.current;if(!u||!c)return;const d=()=>o(u.scrollHeight>u.clientHeight),h=new ResizeObserver(d);return h.observe(u),()=>h.disconnect()},[c]),l.jsxs("div",{children:[l.jsx("pre",{ref:a,className:c?`${fi.stream} ${fi.streamCollapsed}`:fi.stream,children:e}),t&&(i||s)&&l.jsx("button",{className:fi.expandToggle,onClick:()=>r(u=>!u),"aria-expanded":s,"aria-label":n("subagent.toggleStream"),children:s?"▲":"▼"})]})}function AUe({content:e}){const{compactThinking:t}=$c();return l.jsx("div",{className:t?fi.scrollWindow:void 0,children:l.jsx(Op,{content:e,source:"assistant"})})}function cH({pinTail:e,itemCount:t,children:n}){const s=f.useRef(null);return f.useEffect(()=>{const r=s.current;r&&(r.scrollTop=e?r.scrollHeight:0)},[e,t]),l.jsx("div",{ref:s,className:`${fi.tools} ${fi.scrollWindow}`,children:n})}function qI({tool:e,defaultExpanded:t,hideHeader:n,inline:s}){var T,_,C,S;const{t:r}=ot(),i=e.status==="completed"||e.status==="failed",o=fv(e),[a,c]=f.useState(t??!1),u=cie(e.rawOutput)?e.rawOutput:null,d=((T=e.subTools)==null?void 0:T.length)||((_=u==null?void 0:u.toolCalls)==null?void 0:_.length)||0,h=HI(e),m=FI(e),p=sw(e.startTime,e.endTime)||aie((C=u==null?void 0:u.executionSummary)==null?void 0:C.totalDurationMs),g=u!=null&&u.tokenCount&&u.tokenCount>0?u.tokenCount:(S=u==null?void 0:u.executionSummary)==null?void 0:S.outputTokens,b=g?zI(g):"",v=i?TUe(e):"",x=f.useMemo(()=>e.subTools&&e.subTools.length>0?null:(u==null?void 0:u.toolCalls)||null,[e.subTools,u]),y=!!(e.subContent||v),w=!!(e.subTools&&e.subTools.length>0||x&&x.length>0),k=i&&y&&w;return l.jsxs("div",{className:s?void 0:fi.panel,children:[!n&&l.jsxs("div",{className:fi.header,onClick:()=>c(!a),children:[l.jsx(tm,{status:o}),l.jsxs("span",{className:Vt.lineName,children:[m,":"]}),h&&l.jsx("span",{className:fi.desc,children:ro(h,50)}),i&&d>0&&l.jsxs("span",{className:fi.meta,children:["· ",r("subagent.toolsCount",{count:d})]}),p&&l.jsxs("span",{className:fi.meta,children:["· ",p]}),b&&l.jsxs("span",{className:fi.meta,children:["· ",b]}),!i&&l.jsx("span",{className:fi.toggle,children:a?"▼":"▶"})]}),(a||n)&&l.jsxs("div",{className:fi.body,children:[i&&y&&l.jsxs("div",{className:fi.content,children:[k&&l.jsx("div",{className:fi.sectionCap,children:r("subagent.result")}),l.jsx(AUe,{content:e.subContent||v})]}),k&&l.jsx("div",{className:fi.sectionCap,children:r("subagent.tools",{count:d})}),e.subTools&&e.subTools.length>0&&l.jsx(cH,{pinTail:!i,itemCount:e.subTools.length,children:e.subTools.map(L=>l.jsx("div",{className:fi.step,"data-status":L.status,children:l.jsx(SUe,{tool:L})},L.callId))}),x&&x.length>0&&l.jsx(cH,{pinTail:!i,itemCount:x.length,children:x.map(L=>l.jsx("div",{className:fi.step,"data-status":L.status,children:l.jsx(CUe,{tc:L})},L.callId))}),!i&&e.subContent&&l.jsx("div",{className:fi.content,children:l.jsx(EUe,{text:e.subContent})})]})]})}const NUe="_view_1ycry_1",jUe="_stats_1ycry_7",MUe="_statAdd_1ycry_16",IUe="_statDel_1ycry_20",RUe="_lines_1ycry_24",DUe="_line_1ycry_24",LUe="_lineAdd_1ycry_36",PUe="_lineDel_1ycry_40",OUe="_lineHeader_1ycry_44",BUe="_lineContext_1ycry_50",$Ue="_lineNo_1ycry_54",zUe="_marker_1ycry_64",FUe="_content_1ycry_79",cu={view:NUe,stats:jUe,statAdd:MUe,statDel:IUe,lines:RUe,line:DUe,lineAdd:LUe,lineDel:PUe,lineHeader:OUe,lineContext:BUe,lineNo:$Ue,marker:zUe,content:FUe};function HUe(e){let t=0,n=0;const s=[];let r=0,i=0;for(const o of e.split(`
`))if(o.startsWith("@@")){const a=o.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);a&&(r=parseInt(a[1],10),i=parseInt(a[2],10)),s.push({type:"header",content:o})}else o.startsWith("+")&&!o.startsWith("+++ ")?(t++,s.push({type:"add",content:o.slice(1),newLine:i}),i++):o.startsWith("-")&&!o.startsWith("--- ")?(n++,s.push({type:"del",content:o.slice(1),oldLine:r}),r++):(s.push({type:"context",content:o.startsWith(" ")?o.slice(1):o,oldLine:r,newLine:i}),r++,i++);return{lines:s,additions:t,deletions:n}}const qUe=f.memo(function({diff:t}){if(!t)return null;const{lines:n,additions:s,deletions:r}=HUe(t);return l.jsxs("div",{className:cu.view,children:[l.jsxs("div",{className:cu.stats,children:[s>0&&l.jsxs("span",{className:cu.statAdd,children:["+",s]}),r>0&&l.jsxs("span",{className:cu.statDel,children:["-",r]})]}),l.jsx("div",{className:cu.lines,children:n.map((i,o)=>l.jsxs("div",{className:`${cu.line} ${cu[`line${i.type[0].toUpperCase()}${i.type.slice(1)}`]}`,children:[l.jsx("span",{className:cu.lineNo,children:i.type==="header"?"":i.oldLine??i.newLine}),l.jsx("span",{className:cu.marker,children:i.type==="add"?"+":i.type==="del"?"-":i.type==="header"?"":" "}),l.jsx("span",{className:cu.content,children:i.content})]},o))})]})}),uH={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 UUe(e){const t=[];let n,s=!1,r=!1,i=0;const o=new RegExp(String.raw`\x1b\[([0-9;]*)m`,"g");let a;for(;(a=o.exec(e))!==null;){a.index>i&&t.push({text:e.slice(i,a.index),color:n,bold:s,dim:r}),i=a.index+a[0].length;const c=a[1].split(";").map(Number);for(const u of c)u===0?(n=void 0,s=!1,r=!1):u===1?s=!0:u===2?r=!0:u===22?(s=!1,r=!1):u>=30&&u<=37||u>=90&&u<=97?n=uH[u]:u===39&&(n=void 0)}return i<e.length&&t.push({text:e.slice(i),color:n,bold:s,dim:r}),t}function VUe(e){return new RegExp(String.raw`\x1b\[`).test(e)}function mh(e){const t=e.toLowerCase();return t==="todo_write"||t==="todowrite"}function Q6(e){const t=e.flatMap((n,s)=>{const r=p4(n),i=r_(r,"content");return i?[{id:r_(r,"id")??`plan-${s}`,content:i,status:sVe(r_(r,"status")),priority:rVe(r_(r,"priority"))}]:[]});return t.length>0?t:void 0}function UI(e){if(!mh(e.toolName)&&e.kind!=="other")return;const t=hH(e.args);if(t)return Q6(t);const n=p4(e.rawOutput),s=hH(n);if(s)return Q6(s);const r=Array.isArray(n==null?void 0:n.entries)?n.entries:void 0;return r?Q6(r):void 0}function WUe(e){return e.some(t=>t.status==="pending"||t.status==="in_progress")}function m4(e){switch(e){case"completed":return"●";case"in_progress":return"◐";case"pending":return"○"}}const dH={todos:[],allCompleted:!1,sourceMessageId:null,sourceCallId:null};function GUe(e){let t=[],n=null,s=null,r=!1;for(const o of e){if(o.role==="user"||o.role==="user_shell"){r=!0;continue}if(o.role==="plan"){t=o.todos,n=o.id,s=null,r=!1;continue}if(o.role==="tool_group")for(const a of o.tools){const c=UI(a);c&&(t=c,n=o.id,s=a.callId,r=!1)}}if(t.length===0)return dH;const i=!WUe(t);return r?dH:{todos:t,allCompleted:i,sourceMessageId:n,sourceCallId:s}}function VI(e){return JSON.stringify([e.id,e.content])}function CC(e){if(e.role==="plan")return[{key:e.id,todos:e.todos}];if(e.role==="tool_group"){const t=[];for(const n of e.tools){const s=UI(n);s&&t.push({key:n.callId,todos:s,stats:QUe(n)})}return t}return[]}function KUe(e){const t=new Map,n=new Map;for(const s of e)for(const{key:r,todos:i}of CC(s)){const o=[];for(const a of i){const c=VI(a),u=n.get(c);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(c,a.status)}t.set(r,{events:o})}return t}function YUe(e){const t=[];for(const n of e)for(const{key:s,todos:r}of CC(n))t.push(JSON.stringify([s,r.map(i=>[i.id,i.status,i.content])]));return t.join(`
`)}function XUe(e){const t=[];for(const n of e){if(n.role==="tool_group")for(const s of n.tools)!mh(s.toolName)&&(s.startTime!==void 0||s.endTime!==void 0)&&t.push(JSON.stringify(["span",s.callId,s.startTime,s.endTime]));for(const{key:s,todos:r,stats:i}of CC(n))t.push(JSON.stringify([s,n.timestamp,r.map(o=>[o.id,o.status,o.content]),i]))}return t.join(`
`)}function QUe(e){var o;const t=p4((o=p4(e.rawOutput))==null?void 0:o.stats);if(!t)return;const n=a=>{const c=t[a];return typeof c=="number"&&Number.isFinite(c)?c:void 0},s=n("promptTokens"),r=n("cachedTokens"),i=n("candidateTokens");if(!(s===void 0||r===void 0||i===void 0))return{promptTokens:s,cachedTokens:r,candidateTokens:i,apiTimeMs:n("apiTimeMs")??0}}function JUe(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const s of n.tools){if(mh(s.toolName))continue;const{startTime:r,endTime:i}=s;typeof r=="number"&&typeof i=="number"&&i>=r&&t.push({start:r,end:i})}return t.sort((n,s)=>n.start-s.start),t}function ZUe(e,t,n){let s=0,r=e.length;for(;s<r;){const o=s+r>>>1;e[o].start<t?s=o+1:r=o}let i=0;for(let o=s;o<e.length&&e[o].start<=n;o++)i+=e[o].end-e[o].start;return i}function eVe(e,t){const n=(s,r)=>Math.max(0,r-s);return{inputTokens:n(e.promptTokens,t.promptTokens),cachedTokens:n(e.cachedTokens,t.cachedTokens),outputTokens:n(e.candidateTokens,t.candidateTokens),apiTimeMs:n(e.apiTimeMs,t.apiTimeMs)}}function tVe(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 nVe(e){var a;const t=new Map,n=new Map,s=new Map,r=new Set,i=JUe(e),o=c=>{let u=t.get(c);return u||(u={},t.set(c,u)),u};for(const c of e){const u=c.timestamp;for(const{todos:d,stats:h}of CC(c))for(const m of d){const p=VI(m),g=n.get(p);if(m.status==="in_progress"&&g!=="in_progress")r.has(p)&&(r.delete(p),s.delete(p),t.delete(p)),s.get(p)===void 0&&(s.set(p,h),u!==void 0&&(o(p).startTs=u));else if(m.status==="completed"&&g!=="completed"&&g!==void 0){const b=s.get(p),v=b&&h?eVe(b,h):void 0,x=(a=t.get(p))==null?void 0:a.startTs,y=x!==void 0&&u!==void 0?ZUe(i,x,u):void 0,w=tVe(v,y);if(u!==void 0||w){const k=o(p);u!==void 0&&(k.endTs=u),w&&(k.resources=w)}}m.status==="completed"&&r.add(p),n.set(p,m.status)}}return t}function hH(e){const t=e==null?void 0:e.todos;return Array.isArray(t)?t:void 0}function sVe(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function rVe(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function p4(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function r_(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}const d2=new Set;let ry=null,uie=Date.now();function iVe(){uie=Date.now();for(const e of d2)e()}function oVe(e){return d2.add(e),ry||(ry=setInterval(iVe,1e3)),()=>{d2.delete(e),d2.size===0&&ry&&(clearInterval(ry),ry=null)}}function WI(e){const[t,n]=f.useState(()=>Date.now());return f.useEffect(()=>{if(e)return n(Date.now()),oVe(()=>n(uie))},[e]),t}const aVe="_list_1bo8s_1",lVe="_summary_1bo8s_2",cVe="_row_1bo8s_8",uVe="_num_1bo8s_16",dVe="_icon_1bo8s_23",hVe="_text_1bo8s_29",fVe="_inProgress_1bo8s_43",mVe="_completed_1bo8s_48",pVe="_item_1bo8s_62",gVe="_rowButton_1bo8s_69",bVe="_detailChevron_1bo8s_82",yVe="_detail_1bo8s_82",xVe="_detailSection_1bo8s_100",vVe="_detailSectionTitle_1bo8s_106",wVe="_detailRows_1bo8s_114",kVe="_detailLabel_1bo8s_122",_Ve="_detailValue_1bo8s_126",SVe="_detailDuration_1bo8s_132",CVe="_detailHint_1bo8s_136",er={list:aVe,summary:lVe,row:cVe,num:uVe,icon:dVe,text:hVe,inProgress:fVe,completed:mVe,item:pVe,rowButton:gVe,detailChevron:bVe,detail:yVe,detailSection:xVe,detailSectionTitle:vVe,detailRows:wVe,detailLabel:kVe,detailValue:_Ve,detailDuration:SVe,detailHint:CVe};function c9(e){switch(e){case"completed":return er.completed;case"in_progress":return er.inProgress;case"pending":return""}}function die({todos:e,events:t}){const{t:n}=ot();if(t.length===0){if(e.length>0&&e.every(i=>i.status==="completed"))return l.jsx("div",{className:er.summary,children:l.jsxs("div",{className:`${er.row} ${er.completed}`,children:[l.jsx("span",{className:er.icon,"aria-hidden":"true",children:"✓"}),l.jsx("span",{className:er.text,children:n("todo.allDone")})]})});const r=e.find(i=>i.status==="in_progress")??e.find(i=>i.status==="pending");return r?l.jsx("div",{className:er.summary,children:l.jsxs("div",{className:`${er.row} ${c9(r.status)}`,children:[l.jsx("span",{className:er.icon,"aria-hidden":"true",children:m4(r.status)}),l.jsx("span",{className:er.text,children:r.content})]})}):null}return l.jsx("div",{className:er.summary,children:t.map(s=>l.jsxs("div",{className:`${er.row} ${s.kind==="completed"?er.completed:er.inProgress}`,children:[l.jsx("span",{className:er.icon,"aria-hidden":"true",children:m4(s.kind==="completed"?"completed":"in_progress")}),l.jsx("span",{className:er.text,children:s.content})]},`${s.kind}-${s.id}`))})}function Hm({label:e,value:t,suffix:n}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{className:er.detailLabel,children:e}),l.jsxs("span",{className:er.detailValue,children:[t,n]})]})}function J6({title:e,children:t}){return l.jsxs("div",{className:er.detailSection,children:[l.jsx("div",{className:er.detailSectionTitle,children:e}),l.jsx("div",{className:er.detailRows,children:t})]})}function TVe({detail:e}){const{t}=ot(),{startTs:n,endTs:s,resources:r}=e,i=n!==void 0||s!==void 0,o=(r==null?void 0:r.inputTokens)!==void 0,a=(r==null?void 0:r.apiTimeMs)!==void 0||(r==null?void 0:r.toolTimeMs)!==void 0;return l.jsxs("div",{className:er.detail,children:[i&&l.jsxs(J6,{title:t("todo.detail.sectionTime"),children:[n!==void 0&&l.jsx(Hm,{label:t("todo.detail.start"),value:s1(n)}),s!==void 0&&l.jsx(Hm,{label:t("todo.detail.end"),value:s1(s),suffix:n!==void 0?l.jsxs("span",{className:er.detailDuration,children:[" ","(",Ef(s-n),")"]}):void 0})]}),o&&l.jsxs(J6,{title:t("todo.detail.sectionTokens"),children:[l.jsx(Hm,{label:t("todo.detail.input"),value:((r==null?void 0:r.inputTokens)??0).toLocaleString()}),l.jsx(Hm,{label:t("todo.detail.output"),value:((r==null?void 0:r.outputTokens)??0).toLocaleString()}),l.jsx(Hm,{label:t("todo.detail.cached"),value:((r==null?void 0:r.cachedTokens)??0).toLocaleString()})]}),a&&l.jsxs(J6,{title:t("todo.detail.sectionSpent"),children:[(r==null?void 0:r.apiTimeMs)!==void 0&&l.jsx(Hm,{label:t("todo.detail.api"),value:Ef(r.apiTimeMs)}),(r==null?void 0:r.toolTimeMs)!==void 0&&l.jsx(Hm,{label:t("todo.detail.tool"),value:Ef(r.toolTimeMs)})]}),!r&&l.jsx("div",{className:er.detailHint,children:t("todo.detail.noResources")})]})}function EVe(e){return!!e&&(e.endTs!==void 0||e.resources!==void 0)}function hie({todos:e,numbered:t=!1}){const{t:n}=ot(),s=f.useContext(hae),[r,i]=f.useState(()=>new Set),o=`${String(e.length).length+1}ch`,a=c=>i(u=>{const d=new Set(u);return d.has(c)?d.delete(c):d.add(c),d});return l.jsx("div",{className:er.list,children:e.map((c,u)=>{const d=c.id||String(u),h=s.get(VI(c)),m=EVe(h),p=m&&r.has(d),g=l.jsxs(l.Fragment,{children:[t&&l.jsxs("span",{className:er.num,style:{minWidth:o},children:[u+1,"."]}),l.jsx("span",{className:er.icon,"aria-hidden":"true",children:m4(c.status)}),l.jsx("span",{className:er.text,children:c.content}),m&&l.jsx("span",{className:er.detailChevron,"aria-hidden":"true",children:p?"▾":"▸"})]});return l.jsxs("div",{className:er.item,children:[m?l.jsx("button",{type:"button",className:`${er.row} ${er.rowButton} ${c9(c.status)}`,onClick:b=>{b.stopPropagation(),a(d)},"aria-expanded":p,title:n(p?"todo.detail.hide":"todo.detail.show"),children:g}):l.jsx("div",{className:`${er.row} ${c9(c.status)}`,children:g}),p&&h&&l.jsx(TVe,{detail:h})]},d)})})}function AVe(e){const t=e.toolName.toLowerCase();if(qc(e.toolName))return!!Du(e);if(t==="write_file"||t==="writefile")return!!UVe(e)||fH(e);if(e.status!=="completed"&&e.status!=="failed")return!1;if(kl(t)){const n=Du(e);return!!n&&n.trim().length>0&&n.split(`
`).length>1}if(_C(t))return!!pie(e);if(t==="edit"||t==="write"||t==="editfile")return fH(e);if(t==="read"||t==="read_file"||t==="readfile"){const n=Du(e);return!!n&&n.split(`
`).length>3}return!1}function NVe(e){const t=e.toolName.toLowerCase();return kl(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||_C(t)||qc(e.toolName)}function jVe(e){var t;return(t=e.content)!=null&&t.some(n=>n.type==="diff")?!0:!!fie(e)}function fH(e){return jVe(e)||!!Du(e)}function MVe(e){const t=fie(e);if(t)return t;if(e.content){const n=e.content.find(s=>s.type==="diff");if(n&&n.type==="diff")return DVe(n.oldText||"",n.newText||"")}return""}function fie(e){if(e.rawOutput&&typeof e.rawOutput=="object"){const t=e.rawOutput;if(IVe(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function IVe(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}const RVe=25e4;function DVe(e,t){const n=e.split(`
`),s=t.split(`
`),r=n.length,i=s.length;if(r*i>RVe){const d=n.map(m=>m?`-${m}`:"-"),h=s.map(m=>m?`+${m}`:"+");return[...d,...h].join(`
`)}const o=Array.from({length:r+1},()=>Array(i+1).fill(0));for(let d=1;d<=r;d++)for(let h=1;h<=i;h++)o[d][h]=n[d-1]===s[h-1]?o[d-1][h-1]+1:Math.max(o[d-1][h],o[d][h-1]);const a=[];let c=r,u=i;for(;c>0||u>0;)c>0&&u>0&&n[c-1]===s[u-1]?(a.push(` ${n[c-1]}`),c--,u--):u>0&&(c===0||o[c][u-1]>=o[c-1][u])?(a.push(`+${s[u-1]}`),u--):(a.push(`-${n[c-1]}`),c--);return a.reverse().join(`
`)}const LVe=60,PVe=2e5,OVe=1e3,BVe={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 $Ve({tool:e}){const t=f.useMemo(()=>Du(e)||"",[e]),n=f.useMemo(()=>VUe(t)?UUe(t):null,[t]);return l.jsx("div",{className:Vt.expandedBash,children:l.jsx("pre",{className:Vt.expandedOutput,children:n?n.map((s,r)=>l.jsx("span",{style:{color:s.color,fontWeight:s.bold?"bold":void 0,opacity:s.dim?.6:void 0},children:s.text},r)):t})})}function zVe({tool:e}){const t=f.useMemo(()=>Du(e)||"",[e]),n=mie(FVe(e)),s=n==="text"||t.length>PVe||HVe(t,OVe);return l.jsx("div",{className:Vt.expandedRead,children:s?l.jsx("pre",{className:Vt.expandedOutput,children:t}):l.jsx(Op,{content:qVe(n,t)})})}function FVe(e){var n,s;const t=((n=e.args)==null?void 0:n.file_path)??((s=e.args)==null?void 0:s.path);return typeof t=="string"?t:""}function HVe(e,t){let n=1;for(let s=0;s<e.length;s++)if(e.charCodeAt(s)===10&&++n>t)return!0;return!1}function mie(e){var s,r;const t=(r=(s=e.split(/[?#]/,1)[0])==null?void 0:s.split(".").pop())==null?void 0:r.toLowerCase();if(!t||t===e.toLowerCase()||t==="mermaid"||t==="mmd")return"text";const n=BVe[t]??t;return/^[\w+.#-]+$/.test(n)?n:"text"}function qVe(e,t){var r;const n=((r=t.match(/~{3,}/g))==null?void 0:r.reduce((i,o)=>Math.max(i,o.length),0))??0,s="~".repeat(Math.max(3,n+1));return`${s}${e}
${t}
${s}`}function mH({tool:e}){const t=f.useMemo(()=>MVe(e),[e]),n=f.useMemo(()=>Du(e)||"",[e]);return!t&&!n?null:l.jsx("div",{className:Vt.expandedEdit,children:t?l.jsx(qUe,{diff:t}):l.jsx("pre",{className:Vt.expandedOutput,children:n})})}function u9({title:e,detail:t,children:n}){return l.jsxs("div",{className:Vt.expandedCard,children:[l.jsxs("div",{className:Vt.expandedCardHeader,children:[l.jsx("span",{className:Vt.expandedCardTitle,children:e}),t&&l.jsx("span",{className:Vt.expandedCardDetail,children:t})]}),n&&l.jsx("div",{className:Vt.expandedCardBody,children:n})]})}function UVe(e){var n,s;if((n=e.args)!=null&&n.content)return e.args.content;if((s=e.args)!=null&&s.new_string)return e.args.new_string;const t=Du(e);if(t)return t;if(e.rawOutput&&typeof e.rawOutput=="object"){const r=e.rawOutput;if(typeof r.content=="string")return r.content;if(typeof r.newContent=="string")return r.newContent}return""}function VVe({tool:e,todos:t,expanded:n,title:s}){var o;const i=((o=f.useContext(cR).get(e.callId))==null?void 0:o.events)??[];return n?l.jsx(u9,{title:s,children:l.jsx("div",{className:Vt.todoBody,children:l.jsx(hie,{todos:t})})}):l.jsx("div",{className:Vt.todoBody,children:l.jsx(die,{todos:t,events:i})})}function WVe(e,t){var p,g;const n=nw(e.rawOutput),s=$I(e),r=fv(e),i=FI(e),o=GVe(e),a=HI(e),c=((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"?aie(u.totalDurationMs):sw(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?zI(h):"";return{agentType:i,explicitAgentType:o,description:a,subToolCount:c,elapsed:d,tokens:m,status:r,reason:s}}function GVe(e){var r;const t=nw(e.rawOutput),n=t==null?void 0:t.subagentName;if(typeof n=="string"&&n.trim())return n.trim();const s=(r=e.args)==null?void 0:r.subagent_type;return typeof s=="string"&&s.trim()?s.trim():""}function pH(e){if(e.status==="completed")return!1;const t=e.toolName.toLowerCase();return!!(qc(e.toolName)||t==="write_file"||t==="writefile"||t==="edit"||t==="editfile"||kl(t))}function KVe({tool:e}){const t=Du(e)||"";return l.jsx("pre",{className:Vt.expandedOutput,children:t})}function YVe({tool:e}){var n;const t=pie(e)||(typeof((n=e.args)==null?void 0:n.args)=="string"&&e.args.args.trim()?e.args.args.trim():e.title??"");return l.jsx("pre",{className:Vt.expandedOutput,children:t})}function pie(e){var n,s;const t=(n=e.content)==null?void 0:n[0];return(t==null?void 0:t.type)!=="content"?"":typeof((s=t.content)==null?void 0:s.text)=="string"?t.content.text:""}function TC(e){const t=e.toolName.toLowerCase();return Z4(e)?"agent":qc(e.toolName)?"ask":kl(t)?"shell":KI(t)?"fetch":mh(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 XVe({description:e,elapsed:t}){return l.jsxs(l.Fragment,{children:[e&&l.jsx("span",{className:Vt.lineArg,children:e}),t&&l.jsx("span",{className:Vt.lineElapsed,children:t})]})}function g4({info:e}){const{renderToolHeaderExtra:t}=$c(),n=t==null?void 0:t(e);return n?l.jsx(l.Fragment,{children:n}):l.jsx(XVe,{description:e.description,elapsed:e.elapsed})}function QVe(e){return e.length>LVe||e.includes(`
`)}function EC(e){return e==="in_progress"||e==="pending"||e==="running"}function GI(e){return e.find(t=>EC(t.status))??e[e.length-1]}function JVe(e,t,n){if(yie(e)){const r=GI(e);return qc(r.toolName)?t("toolGroup.summary.provideInformation"):t("toolGroup.running",{name:Pc(r.toolName,t),count:e.length,duration:n??""})}const s=tWe(e,t);return s||t("toolGroup.summary",{count:e.length})}function ZVe(e,t,n){if(mh(e.toolName))return t("toolGroup.summary.updatedTodos",{count:1});if(qc(e.toolName))return EC(e.status)?t("toolGroup.summary.provideInformation"):t("toolGroup.summary.askedQuestions",{count:bie(e)});const{displayName:s,description:r,hideDisplayName:i}=gie(e,t,n);return[i?"":s,r].filter(Boolean).join(" ")}function gie(e,t,n){const s=Pc(e.toolName,t),r=ro(Jre(e,n),120);return{kind:TC(e),tool:e,displayName:s,description:r,elapsed:"",workspaceCwd:n,hideDisplayName:!!Q$e(e)}}function eWe({tool:e,runningDuration:t,workspaceCwd:n}){const{t:s}=ot(),r=qc(e.toolName),i=!r&&EC(e.status)&&s("toolGroup.runningPrefix").trim();if(mh(e.toolName)||r)return l.jsxs(l.Fragment,{children:[i&&l.jsxs("span",{children:[i," "]}),ZVe(e,s,n),t&&l.jsxs("span",{children:[" ",t]})]});const o=gie(e,s,n);return l.jsxs(l.Fragment,{children:[i&&l.jsxs("span",{children:[i," "]}),l.jsxs("span",{className:Vt.chatSummaryInline,children:[!o.hideDisplayName&&l.jsx("span",{className:Vt.lineName,children:o.displayName}),l.jsx(g4,{info:o})]}),t&&l.jsxs("span",{children:[" ",t]})]})}function tWe(e,t){let n=0,s=0,r=0,i=0,o=0,a=0,c=0;for(const d of e){const h=d.toolName.toLowerCase();kl(h)?s++:h==="edit"||h==="editfile"||h==="write"||h==="write_file"||h==="writefile"?n++:h==="read"||h==="read_file"||h==="readfile"?r++:h==="grep"||h==="grep_search"||h==="search"||h==="glob"||h==="web_search"||h==="websearch"?i++:mh(h)?o++:qc(h)?a+=bie(d):c++}return[n?t("toolGroup.summary.editedFiles",{count:n}):"",s?t("toolGroup.summary.ranCommands",{count:s}):"",r?t("toolGroup.summary.readFiles",{count:r}):"",i?t("toolGroup.summary.searched",{count:i}):"",o?t("toolGroup.summary.updatedTodos",{count:o}):"",a?t("toolGroup.summary.askedQuestions",{count:a}):"",c?t("toolGroup.summary.otherTools",{count:c}):""].filter(Boolean).join(" ")}function bie(e){var n;const t=(n=e.args)==null?void 0:n.questions;return Array.isArray(t)&&t.length>0?t.length:1}function yie(e){return e.some(t=>EC(t.status))}function nWe(){return l.jsxs("svg",{className:Vt.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:[l.jsx("path",{d:"M12 20h9"}),l.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function xie(){return l.jsxs("svg",{className:Vt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","data-testid":"chat-summary-tool-icon","aria-hidden":"true",children:[l.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.4",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("path",{d:"M4.6 5.2 6 6.6 4.6 8",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M7.3 8.1h2.1",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function sWe(){return l.jsxs("svg",{className:Vt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[l.jsx("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.25"}),l.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 rWe(){return l.jsxs("svg",{className:Vt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[l.jsx("rect",{x:"2",y:"1.6",width:"10",height:"10.8",rx:"2.2",stroke:"currentColor",strokeWidth:"1.25"}),l.jsx("path",{d:"M4.5 5.2h5M4.5 7h5M4.5 8.8h5",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function iWe(){return l.jsx("svg",{className:Vt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:l.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 oWe(){return l.jsx("svg",{className:Vt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:l.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 aWe(){return l.jsx("svg",{className:Vt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:l.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 lWe({tool:e}){const t=TC(e);return t==="agent"?l.jsx(aWe,{}):t==="ask"?l.jsx(oWe,{}):t==="edit"||t==="write"?l.jsx(nWe,{}):t==="fetch"?l.jsx(sWe,{}):t==="read"?l.jsx(rWe,{}):t==="todo"?l.jsx(iWe,{}):l.jsx(xie,{})}function KI(e){const t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}const cWe=fv;function uWe({tools:e,workspaceCwd:t,isLocateFlashing:n=!1}){const{t:s}=ot(),r=GI(e),i=Pc(r.toolName,s),o=cWe(r),a=BI(r,t),c=kl(r.toolName)||KI(r.toolName)?"":sw(r.startTime,r.endTime);return l.jsxs("div",{className:`${Vt.compactGroup}${n?` ${em.flash}`:""}`,children:[l.jsxs("div",{className:Vt.compactHeader,children:[l.jsx(tm,{status:o}),l.jsx("span",{className:Vt.lineName,children:i}),e.length>1&&l.jsxs("span",{className:Vt.compactCount,children:["× ",e.length]}),l.jsx(g4,{info:{kind:TC(r),tool:r,displayName:i,description:a,elapsed:c,workspaceCwd:t}})]}),l.jsx("div",{className:Vt.compactHint,children:s("compact.hint")})]})}function dWe(e,t){var r,i;if(((r=e.approval)==null?void 0:r.id)!==((i=t.approval)==null?void 0:i.id)||e.workspaceCwd!==t.workspaceCwd||e.summaryOnly!==t.summaryOnly||e.forceExpanded!==t.forceExpanded||e.forceExpandable!==t.forceExpandable||e.hideHeader!==t.hideHeader||e.hideCollapsedOutput!==t.hideCollapsedOutput)return!1;const n=e.tool,s=t.tool;return n.callId===s.callId&&n.toolName===s.toolName&&n.status===s.status&&n.startTime===s.startTime&&n.endTime===s.endTime&&n.subContent===s.subContent&&n.rawOutput===s.rawOutput&&n.args===s.args&&n.content===s.content&&n.title===s.title&&hWe(n.subTools,s.subTools)}function hWe(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],r=t[n];if(s.callId!==r.callId||s.toolName!==r.toolName||s.status!==r.status||s.endTime!==r.endTime||s.rawOutput!==r.rawOutput||s.args!==r.args||s.subContent!==r.subContent||s.title!==r.title)return!1}return!0}const gH=/\[([^\]]+)\]\(qwen-session:\/\/([^)]+)\)/g;function Z6(e,t){if(!e||!e.includes("qwen-session://"))return e;const n=[];let s=0,r;for(gH.lastIndex=0;(r=gH.exec(e))!==null;){r.index>s&&n.push(e.slice(s,r.index));const i=r[2];n.push(t==="readonly"?l.jsx("span",{style:{textDecoration:"underline"},children:r[1]},r.index):l.jsx("a",{href:"#",role:"button",style:{textDecoration:"underline",cursor:"pointer"},onClick:o=>{o.preventDefault(),o.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:i}))},children:r[1]},r.index)),s=r.index+r[0].length}return s<e.length&&n.push(e.slice(s)),n.length===1?n[0]:l.jsx(l.Fragment,{children:n})}const d9=f.memo(function({tool:t,approval:n,workspaceCwd:s,summaryOnly:r=!1,forceExpanded:i=!1,forceExpandable:o=!1,hideHeader:a=!1,hideCollapsedOutput:c=!1}){const{t:u}=ot(),d=lj(),h=f.useContext(Kp),[m,p]=f.useState(()=>i||!h&&pH(t)),g=f.useRef(!1);f.useEffect(()=>{p(i||(h?!1:pH(t))),g.current=!1},[h,i,t.callId,t.toolName]);const b=Z4(t),v=n&&n.toolCallId===t.callId,x=!v&&(n==null?void 0:n.toolCallId)&&b&&Oc(t,n.toolCallId),y=b&&t.status==="in_progress",w=WI(y);if(f.useEffect(()=>{!i&&!b&&t.status==="completed"&&!g.current&&p(!1)},[i,b,t.status]),b){const X=WVe(t,w),Q=X.explicitAgentType?`${u("agent.label")} (${X.explicitAgentType})`:u("agent.label"),ue=t.status==="completed"||t.status==="failed",J=[t.status==="pending"?u("subagent.pending"):u("subagent.running"),X.elapsed].filter(Boolean).join(" · "),q=[X.subToolCount>0?u("subagent.toolsCount",{count:X.subToolCount}):"",X.elapsed,X.tokens,X.reason?ro(X.reason,80):""].filter(Boolean).join(" · "),Z=i||m||!!v||!!x,he=l.jsx(qI,{tool:t,hideHeader:!0,defaultExpanded:!0,inline:!0});return l.jsxs("div",{className:Vt.line,children:[!a&&l.jsxs("div",{className:`${Vt.lineMain} ${Vt.lineExpandable}`,onClick:()=>p(!m),children:[l.jsx(tm,{status:ue?X.status:t.status}),l.jsx("span",{className:Vt.lineName,children:Q}),l.jsx(g4,{info:{kind:"agent",tool:t,displayName:Q,description:X.description?ro(X.description,60):"",elapsed:ue?q:J,workspaceCwd:s}}),l.jsx("span",{className:m?Vt.lineChevronDown:Vt.lineChevronRight,"aria-hidden":"true"})]}),Z&&l.jsx("div",{className:Vt.lineDetail,children:a?l.jsx("div",{className:Vt.expandedAgentCard,children:he}):he})]})}const k=BI(t,s),T=J$e(t),C=r&&kl(t.toolName)?Jre(t,s):k,S=Pc(t.toolName,u),L=kl(t.toolName)||KI(t.toolName)?"":sw(t.startTime,t.endTime),N=t.toolName.toLowerCase(),$=mh(N),M=$?UI(t):void 0,P=!!M&&M.length>0,E=M?M.filter(X=>X.status==="completed").length:0,O=kl(N),z=N==="grep"||N==="grep_search"||N==="search"||N==="glob",F=N==="read"||N==="read_file"||N==="readfile",B=!$&&QVe(C),W=!i&&(o||($?P:AVe(t)||B)),I=NVe(t),Y=m&&B,V=F,j=Y&&!O&&!z&&!F,ee=k,se=!$&&m&&!I&&(Y||T);return l.jsxs("div",{className:Vt.line,children:[!a&&l.jsxs("div",{className:`${Vt.lineMain} ${W?Vt.lineExpandable:""}`,title:W?u(m?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":W?m:void 0,role:W?"button":void 0,tabIndex:W?0:void 0,onClick:W?()=>{g.current=!0,p(X=>!X)}:void 0,onKeyDown:W?X=>{X.key!=="Enter"&&X.key!==" "||(X.preventDefault(),g.current=!0,p(Q=>!Q))}:void 0,children:[l.jsx(tm,{status:t.status}),l.jsx("span",{className:Vt.lineName,children:S}),$&&P&&l.jsxs("span",{className:Vt.todoProgress,children:[E,"/",M.length]}),l.jsx(g4,{info:{kind:TC(t),tool:t,displayName:S,description:$||j?"":C,elapsed:$?"":L,workspaceCwd:s}}),W&&l.jsx("span",{className:m?Vt.lineChevronDown:Vt.lineChevronRight,"aria-hidden":"true"})]}),(!r||m)&&$&&P&&l.jsx(VVe,{tool:t,todos:M,expanded:m,title:S}),(!r||m)&&$&&!P&&T&&l.jsx("div",{className:Vt.lineOutput,children:Z6(T,d)}),se&&l.jsx(u9,{title:S,detail:ee,children:T&&l.jsx("div",{className:`${Vt.lineOutput} ${Vt.expandedLineOutput}`,children:Z6(T,d)})}),!$&&!c&&T&&!se&&(!m||!I)&&(!r||m)&&l.jsx("div",{className:m?`${Vt.lineOutput} ${Vt.expandedLineOutput}`:Vt.lineOutput,children:Z6(T,d)}),!$&&m&&I&&l.jsx("div",{className:V?`${Vt.lineDetail} ${Vt.markdownLineDetail}`:Vt.lineDetail,children:F?l.jsx(zVe,{tool:t}):l.jsxs(u9,{title:S,detail:ee,children:[kl(N)&&l.jsx($Ve,{tool:t}),(N==="write_file"||N==="writefile")&&l.jsx(mH,{tool:t}),(N==="edit"||N==="write"||N==="editfile")&&l.jsx(mH,{tool:t}),qc(t.toolName)&&l.jsx(KVe,{tool:t}),_C(N)&&l.jsx(YVe,{tool:t})]})})]})},dWe),fWe=f.memo(function({tools:t,pendingApproval:n,workspaceCwd:s,isLocateFlashing:r=!1}){const{t:i}=ot(),o=f.useContext(Kp),[a,c]=f.useState(!1),u=yie(t),d=t.some(w=>w.status==="failed"),h=t.length>0?GI(t):void 0,m=t.length===1?t[0]:void 0,p=t[0]??h,g=f.useRef(Date.now()),b=WI(u),v=(n==null?void 0:n.toolCallId)&&t.some(w=>Oc(w,n.toolCallId)),x=o&&!v,y=u?lie(b-g.current):void 0;return f.useEffect(()=>{u&&(g.current=Date.now())},[u,h==null?void 0:h.callId]),x?l.jsx(uWe,{tools:t,workspaceCwd:s,isLocateFlashing:r}):v?l.jsx("div",{className:`${Vt.group}${r?` ${em.flash}`:""}`,children:t.map(w=>l.jsx(d9,{tool:w,approval:n,workspaceCwd:s},w.callId))}):l.jsxs("div",{className:r?em.flash:void 0,children:[l.jsxs("button",{type:"button",className:Vt.chatSummary,onClick:()=>c(w=>!w),"aria-expanded":a,title:i(a?"tool.collapseHint":"tool.expand"),children:[l.jsx("span",{className:Vt.chatSummaryIcon,"aria-hidden":"true",children:p?l.jsx(lWe,{tool:p}):l.jsx(xie,{})}),d&&l.jsx(tm,{status:"failed"}),l.jsx("span",{className:u?`${Vt.chatSummaryText} ${Vt.chatSummaryTextActive}`:Vt.chatSummaryText,children:m?l.jsx(eWe,{tool:m,runningDuration:u?y:void 0,workspaceCwd:s}):JVe(t,i,y)}),l.jsx("span",{className:a?Vt.chatChevronDown:Vt.chatChevronRight,"aria-hidden":"true"})]}),l.jsx("div",{className:a?Vt.chatSummaryContentClip:`${Vt.chatSummaryContentClip} ${Vt.chatSummaryContentCollapsed}`,children:l.jsx("div",{className:Vt.chatSummaryContentInner,children:l.jsx("div",{className:`${Vt.group} ${Vt.chatSummaryGroup}`,children:t.map(w=>l.jsx(d9,{tool:w,approval:n,workspaceCwd:s,summaryOnly:!m,forceExpanded:!!m,hideHeader:!!m},w.callId))})})})]})}),mWe="_message_kwepu_1",pWe="_header_kwepu_6",gWe="_chevron_kwepu_20",bWe="_title_kwepu_26",yWe="_progress_kwepu_35",iy={message:mWe,header:pWe,chevron:gWe,title:bWe,progress:yWe};function xWe({id:e,todos:t}){var r;const s=((r=f.useContext(cR).get(e))==null?void 0:r.events)??[];return l.jsx(die,{todos:t,events:s})}const vWe=f.memo(function({id:t,todos:n,isLocateFlashing:s=!1}){const{t:r}=ot(),[i,o]=f.useState(!1);if(n.length===0)return null;const a=n.length,c=n.filter(u=>u.status==="completed").length;return l.jsxs("div",{className:`${iy.message}${s?` ${em.flash}`:""}`,children:[l.jsxs("button",{type:"button",className:iy.header,onClick:()=>o(u=>!u),"aria-expanded":i,title:r(i?"todo.collapse":"todo.expand"),children:[l.jsx("span",{className:iy.chevron,"aria-hidden":"true",children:i?"▾":"▸"}),l.jsx("span",{className:iy.title,children:r("plan.title")}),l.jsxs("span",{className:iy.progress,children:[c,"/",a]})]}),i?l.jsx(hie,{todos:n,numbered:!0}):l.jsx(xWe,{id:t,todos:n})]})}),wWe="_message_1abcu_1",kWe="_content_1abcu_11",_We="_question_1abcu_17",SWe="_prefix_1abcu_24",CWe="_answer_1abcu_28",TWe="_pending_1abcu_32",EWe="_shortcuts_1abcu_36",qm={message:wWe,content:kWe,question:_We,prefix:SWe,answer:CWe,pending:TWe,shortcuts:EWe},vie=f.memo(function({question:t,answer:n,isPending:s}){const{t:r}=ot();return l.jsxs("div",{className:qm.message,children:[l.jsxs("div",{className:qm.content,children:[l.jsxs("div",{className:qm.question,children:[l.jsx("span",{className:qm.prefix,children:"/btw "}),l.jsx("span",{children:t})]}),l.jsx("div",{className:qm.answer,children:s?l.jsx("span",{className:qm.pending,children:r("btw.answering")}):l.jsx(Op,{content:n})})]}),l.jsx("div",{className:qm.shortcuts,children:r(s?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),AWe="_message_1q4dw_1",NWe="_compact_1q4dw_16",jWe="_header_1q4dw_21",MWe="_status_1q4dw_30",IWe="_name_1q4dw_35",RWe="_command_1q4dw_42",DWe="_output_1q4dw_51",LWe="_compactHint_1q4dw_62",md={message:AWe,compact:NWe,header:jWe,status:MWe,name:IWe,command:RWe,output:DWe,compactHint:LWe},PWe=f.memo(function({command:t,output:n}){const s=f.useContext(Kp),{t:r}=ot();return l.jsxs("div",{className:s?`${md.message} ${md.compact}`:md.message,children:[l.jsxs("div",{className:md.header,children:[l.jsx("span",{className:md.status,children:"✓"}),l.jsx("span",{className:md.name,children:r("shell.command")}),t&&l.jsx("span",{className:md.command,children:t})]}),s?l.jsx("div",{className:md.compactHint,children:r("compact.hint")}):n&&l.jsx("pre",{className:md.output,children:n})]})}),OWe="_progress_1j3ys_1",BWe="_spinner_1j3ys_12",$We="_bar_1j3ys_19",zWe="_stage_1j3ys_25",FWe="_icon_1j3ys_29",HWe="_done_1j3ys_35",qWe="_error_1j3ys_43",UWe="_detail_1j3ys_51",VWe="_path_1j3ys_56",go={progress:OWe,spinner:BWe,bar:$We,stage:zWe,icon:FWe,done:HWe,error:qWe,detail:UWe,path:VWe},bH=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"];function WWe({progress:e}){const{stage:t,progress:n,detail:s,isComplete:r,error:i}=e,[o,a]=f.useState(0),c=30,u=Math.round(n/100*c),d=c-u,h="█".repeat(Math.max(0,u))+"░".repeat(Math.max(0,d));return f.useEffect(()=>{if(r||i)return;const m=setInterval(()=>{a(p=>(p+1)%bH.length)},120);return()=>clearInterval(m)},[r,i]),i?l.jsxs("div",{className:`${go.progress} ${go.error}`,children:[l.jsx("span",{className:go.icon,children:"✕"}),l.jsx("span",{className:go.stage,children:t}),l.jsx("div",{className:go.detail,children:i})]}):r?l.jsxs("div",{className:`${go.progress} ${go.done}`,children:[l.jsx("span",{className:go.icon,children:"✓"}),l.jsx("span",{className:go.stage,children:t})]}):l.jsxs("div",{className:go.progress,children:[l.jsx("span",{className:go.spinner,children:bH[o]}),l.jsx("span",{className:go.bar,children:h}),l.jsxs("span",{className:go.stage,children:[t,s?` (${s})`:""]})]})}function GWe({path:e}){const{t}=ot();return l.jsxs("div",{className:`${go.progress} ${go.done}`,children:[l.jsx("span",{className:go.icon,children:"✓"}),l.jsx("span",{className:go.stage,children:t("insight.ready")}),l.jsx("span",{className:go.path,children:e})]})}const KWe=f.memo(function({message:t,pendingApproval:n,onShowContextDetail:s,workspaceCwd:r,isLatest:i=!1,showRetryHint:o=!1,onRetryClick:a,onBranchSession:c,showAssistantActions:u=!1,showAssistantBranch:d=!1,isLocateFlashing:h=!1,assistantTurnFooterInfo:m,generateContent:p}){const{t:g}=ot(),b=(()=>{switch(t.role){case"user":return l.jsx(jBe,{content:t.content,images:t.images,inputAnnotations:t.inputAnnotations,isLocateFlashing:h});case"assistant":return l.jsx(l$e,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,onBranchSession:c,showFooterActions:u,showBranchAction:d,isLocateFlashing:h,customFooterInfo:m});case"thinking":return l.jsx(f$e,{messageId:t.id,content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,isLocateFlashing:h,generateContent:p});case"tool_group":return l.jsx(fWe,{tools:t.tools,pendingApproval:n,workspaceCwd:r,isLocateFlashing:h});case"plan":return l.jsx(vWe,{id:t.id,todos:t.todos,isLocateFlashing:h});case"system":return l.jsx(bqe,{content:t.content,variant:t.variant,source:t.source,data:t.data,onShowContextDetail:s,isLatest:i,showRetryHint:o&&t.retryable===!0,onRetryClick:a});case"user_shell":return l.jsx(PWe,{command:t.command,output:t.output});case"btw":return l.jsx(vie,{question:t.question,answer:t.answer,isPending:t.isPending});case"insight_progress":return l.jsx(WWe,{progress:{stage:t.stage,progress:t.progress,detail:t.detail}});case"insight_ready":return l.jsx(GWe,{path:t.path});case"insight_error":return l.jsx("div",{style:{color:"var(--error-color, #e06c75)"},children:t.error});default:return null}})();if(b===null)return null;const v=l.jsx(Jd,{label:`message:${t.role}`,resetKeys:[t],fallback:l.jsx(YWe,{align:t.role==="user"?"end":"start"}),children:b}),x=l.jsx("div",{"data-user-selectable":"true",style:{display:"contents"},children:v});return t.role==="assistant"?u?x:l.jsx(J7,{timestamp:t.timestamp,children:x}):t.role==="system"&&t.source==="prompt_cancelled"?x:l.jsx(J7,{timestamp:t.timestamp,chatMode:t.role==="user",copyText:t.role==="user"?t.content:void 0,copyTitle:g("common.copy"),children:x})},XWe);function YWe({align:e}){const{t}=ot();return l.jsx("div",{role:"alert",style:{display:"flex",justifyContent:e==="end"?"flex-end":"flex-start"},children:l.jsx("span",{style:{color:"var(--error-color, #e06c75)",fontSize:"0.85em",opacity:.85},children:t("message.renderError")})})}function XWe(e,t){var n,s;return((n=e.pendingApproval)==null?void 0:n.id)!==((s=t.pendingApproval)==null?void 0:s.id)||e.onShowContextDetail!==t.onShowContextDetail||e.workspaceCwd!==t.workspaceCwd||e.isLatest!==t.isLatest||e.showRetryHint!==t.showRetryHint||e.onRetryClick!==t.onRetryClick||e.onBranchSession!==t.onBranchSession||e.showAssistantActions!==t.showAssistantActions||e.showAssistantBranch!==t.showAssistantBranch||e.isLocateFlashing!==t.isLocateFlashing||e.generateContent!==t.generateContent||!QWe(e.assistantTurnFooterInfo,t.assistantTurnFooterInfo)?!1:JWe(e.message,t.message)}function QWe(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 JWe(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&&tGe(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"&&ZWe(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&e.tools.length===t.tools.length&&e.tools.every((n,s)=>wie(n,t.tools[s]));default:return!1}}function ZWe(e,t){return e.length===t.length&&e.every((n,s)=>{const r=t[s];return r&&n.id===r.id&&n.content===r.content&&n.status===r.status&&n.priority===r.priority})}function wie(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&&Dh(e.args)===Dh(t.args)&&Dh(e.rawOutput)===Dh(t.rawOutput)&&Dh(e.locations)===Dh(t.locations)&&Dh(e.content)===Dh(t.content)&&eGe(e.subTools,t.subTools):!1}function eGe(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((n,s)=>wie(n,t[s]))}const yH=new WeakMap;function tGe(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,s)=>n.data===t[s].data&&n.mimeType===t[s].mimeType)}function Dh(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=yH.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return yH.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 nGe(e){const t=/^(\d{1,2}):(\d{2})$/.exec(e.trim());if(!t)return null;const n=Number(t[1]),s=Number(t[2]);return n<0||n>23||s<0||s>59?null:{hh:n,mm:s}}function b4(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=nGe(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[s,r,i,o,a]=n,c=d=>/^\d+$/.test(d),u=d=>d.padStart(2,"0");if(/^\*\/\d+$/.test(s)&&r==="*"&&i==="*"&&o==="*"&&a==="*"){const d=Number(s.slice(2));return Number.isInteger(d)&&d>=1&&d<=30&&60%d===0?t("scheduledTasks.human.everyMinutes",{n:d}):e}if(c(s)&&r==="*"&&i==="*"&&o==="*"&&a==="*")return t("scheduledTasks.human.hourly",{min:u(s)});if(c(s)&&c(r)&&i==="*"&&o==="*"&&a==="*")return t("scheduledTasks.human.daily",{time:`${u(r)}:${u(s)}`});if(c(s)&&c(r)&&i==="*"&&o==="*"&&a==="1-5")return t("scheduledTasks.human.weekdays",{time:`${u(r)}:${u(s)}`});if(c(s)&&c(r)&&i==="*"&&o==="*"&&c(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(r)}:${u(s)}`})}return e}const gu={frequency:"daily",time:"09:00",weekday:1,minuteInterval:30,customCron:"0 9 * * *"};function $h(e){const t=e.trim(),n={...gu,frequency:"custom",customCron:t.length>0?t:gu.customCron},s=t.split(/\s+/);if(s.length!==5)return n;const[r,i,o,a,c]=s,u=b=>/^\d+$/.test(b),d=b=>String(b).padStart(2,"0"),h=o==="*"&&a==="*";if(/^\*\/\d+$/.test(r)&&i==="*"&&h&&c==="*"){const b=Number(r.slice(2));return Number.isInteger(b)&&b>=1&&b<=30&&60%b===0?{...gu,frequency:"minutes",minuteInterval:b}:n}if(!u(r))return n;const m=Number(r);if(m>59)return n;if(i==="*"&&h&&c==="*")return{...gu,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&&c==="*")return{...gu,frequency:"daily",time:g};if(h&&c==="1-5")return{...gu,frequency:"weekdays",time:g};if(h&&u(c)){const b=Number(c);if(b>=0&&b<=7)return{...gu,frequency:"weekly",time:g,weekday:b===7?0:b}}return n}function sGe(e,t){if(e<=0)return t("scheduledTasks.dueNow");const n=Math.floor(e/1e3),s=Math.floor(n/86400),r=Math.floor(n%86400/3600),i=Math.floor(n%3600/60),o=n%60,a=(u,d)=>`${d}${t(`scheduledTasks.dur.${u}`)}`;let c;return s>0?c=r>0?[a("d",s),a("h",r)]:[a("d",s)]:r>0?c=i>0?[a("h",r),a("m",i)]:[a("h",r)]:i>0?c=o>0?[a("m",i),a("s",o)]:[a("m",i)]:c=[a("s",o)],c.join(" ")}function rGe(e,t){const n=e.createdAt-e.createdAt%6e4;if(e.lastFiredAt===null||e.lastFiredAt<=n)return t("scheduledTasks.never");let s;try{s=new Date(e.lastFiredAt).toLocaleString()}catch{return t("scheduledTasks.never")}return t("scheduledTasks.lastFired",{when:s})}function kie(e){switch(e){case"html":return"HTML";case"pdf":return"PDF";case"notebook":return"Notebook";default:return e||"artifact"}}function _ie(e){return e===void 0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function iGe(e){return e.workspacePath??e.url??e.managedId??""}function Wp(e){const t=(e??"").replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,""),n=t.startsWith("/"),s=[];for(const i of t.split("/"))if(!(!i||i===".")){if(i===".."){s.length>0&&s.at(-1)!==".."?s.pop():n||s.push(i);continue}s.push(i)}const r=s.join("/");return n?`/${r}`:r}function h9(e,t){const n=Wp(e),s=Wp(t);if(!s)return n;if(n===s)return n.split("/").pop()??n;const r=`${s}/`;return n.startsWith(r)?n.slice(r.length):n}function Sie(e,t,n){const s=h9(e??"",n),r=h9(t??"",n);return!!s&&s===r}const xH="default-src 'none'; base-uri 'none'; style-src 'unsafe-inline'; img-src data: blob:;";function oGe(e){if(typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${xH}"></head><body>${aGe(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(s=>s.remove());const n=t.createElement("meta");return n.httpEquiv="Content-Security-Policy",n.content=xH,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function aGe(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 y4({additions:e,deletions:t,className:n,additionsClassName:s,deletionsClassName:r}){return e===void 0||t===void 0?null:l.jsxs("span",{className:n,children:[l.jsxs("span",{className:s,children:["+",e]}),l.jsxs("span",{className:r,children:["-",t]})]})}function Cie(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 lGe="_root_aths8_1",cGe="_card_aths8_7",uGe="_summary_aths8_14",dGe="_icon_aths8_22",hGe="_iconSvg_aths8_33",fGe="_title_aths8_39",mGe="_linkButton_aths8_46",pGe="_reviewButton_aths8_47",gGe="_showMoreButton_aths8_48",bGe="_actions_aths8_79",yGe="_list_aths8_97",xGe="_fileRow_aths8_104",vGe="_path_aths8_124",wGe="_lineStats_aths8_133",kGe="_additions_aths8_142",_Ge="_deletions_aths8_146",SGe="_chevronIcon_aths8_160",CGe="_chevronIconOpen_aths8_168",TGe="_artifactInfo_aths8_172",EGe="_artifactMeta_aths8_178",_s={root:lGe,card:cGe,summary:uGe,icon:dGe,iconSvg:hGe,title:fGe,linkButton:mGe,reviewButton:pGe,showMoreButton:gGe,actions:bGe,list:yGe,fileRow:xGe,path:vGe,lineStats:wGe,additions:kGe,deletions:_Ge,chevronIcon:SGe,chevronIconOpen:CGe,artifactInfo:TGe,artifactMeta:EGe},Tie=["file","artifact","scheduled_task"];function AGe({turnId:e,changes:t,artifacts:n,scheduledTasks:s,workspaceCwd:r,onOpenRequest:i,onReviewChanges:o,onOpenArtifact:a,onOpenScheduledTask:c}){const{t:u}=ot(),[d,h]=f.useState(!1);if(t.length===0&&n.length===0&&s.length===0)return null;const m=d?t:t.slice(0,3),p=t.length-3,g=Cie(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)},v=y=>{const w=LGe(y,t,r);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)},x=y=>{if(i){i({id:`scheduled-task:${y.toolCallId}`,kind:"scheduled_task",title:u("scheduledTasks.title"),turnId:e,task:y});return}c(y)};return l.jsxs("div",{className:_s.root,children:[t.length>0&&l.jsxs("div",{className:_s.card,children:[l.jsxs("div",{className:_s.summary,children:[l.jsx("span",{className:_s.icon,"aria-hidden":"true",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",focusable:"false",className:_s.iconSvg,children:[l.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),l.jsx("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),l.jsx("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),l.jsxs("div",{children:[l.jsx("div",{className:_s.title,children:u("turnOutputs.filesEdited",{count:t.length})}),l.jsx(y4,{additions:g==null?void 0:g.additions,deletions:g==null?void 0:g.deletions,className:_s.lineStats,additionsClassName:_s.additions,deletionsClassName:_s.deletions}),l.jsxs("button",{type:"button",className:_s.linkButton,onClick:()=>b(),children:[u("turnOutputs.viewChanges")," ↗"]})]}),l.jsx("div",{className:_s.actions,children:l.jsx("button",{type:"button",className:_s.reviewButton,onClick:()=>b(),children:u("turnOutputs.review")})})]}),l.jsxs("div",{className:_s.list,children:[m.map(y=>l.jsxs("button",{type:"button",className:_s.fileRow,onClick:()=>b(y.path),title:y.path,children:[l.jsx("span",{className:_s.path,children:YI(y.path,r)}),l.jsx(y4,{additions:y.additions,deletions:y.deletions,className:_s.lineStats,additionsClassName:_s.additions,deletionsClassName:_s.deletions})]},`${y.toolCallId}:${y.path}`)),p>0&&l.jsxs("button",{type:"button",className:_s.showMoreButton,onClick:()=>h(y=>!y),children:[l.jsx("span",{children:d?u("turnOutputs.collapseFiles"):u("turnOutputs.showMoreFiles",{count:p})}),l.jsx(RGe,{open:d})]})]})]}),n.map(y=>l.jsx(NGe,{artifact:y,onOpen:()=>v(y)},y.id)),s.map(y=>l.jsx(jGe,{task:y,scheduleLabel:pv(y.cron,u),onOpen:()=>x(y)},y.toolCallId))]})}function NGe({artifact:e,onOpen:t}){const{t:n}=ot(),s=_ie(e.sizeBytes);return l.jsx("div",{className:_s.card,children:l.jsxs("div",{className:_s.summary,children:[l.jsx("span",{className:_s.icon,"aria-hidden":"true",children:l.jsx(MGe,{})}),l.jsxs("div",{className:_s.artifactInfo,children:[l.jsx("div",{className:_s.title,children:e.title}),l.jsx("div",{className:_s.artifactMeta,children:[kie(e.kind),s].filter(Boolean).join(" · ")})]}),l.jsx("div",{className:_s.actions,children:l.jsx("button",{type:"button",className:_s.reviewButton,onClick:t,title:e.title,children:n("common.open")})})]})})}function jGe({task:e,scheduleLabel:t,onOpen:n}){const{t:s}=ot();return l.jsx("div",{className:_s.card,children:l.jsxs("div",{className:_s.summary,children:[l.jsx("span",{className:_s.icon,"aria-hidden":"true",children:l.jsx(IGe,{})}),l.jsxs("div",{className:_s.artifactInfo,children:[l.jsx("div",{className:_s.title,children:e.title}),l.jsx("div",{className:_s.artifactMeta,children:[t,e.recurring?s("scheduledTasks.repeats"):s("scheduledTasks.runsOnce")].filter(Boolean).join(" · ")})]}),l.jsx("div",{className:_s.actions,children:l.jsx("button",{type:"button",className:_s.reviewButton,onClick:n,title:e.title,children:s("common.open")})})]})})}function MGe(){return l.jsxs("svg",{className:_s.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[l.jsx("rect",{x:"6",y:"4",width:"12",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"1.8"}),l.jsx("path",{d:"M9 10h6M9 14h4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function IGe(){return l.jsxs("svg",{className:_s.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[l.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),l.jsx("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function RGe({open:e}){return l.jsx("svg",{className:[_s.chevronIcon,e?_s.chevronIconOpen:""].filter(Boolean).join(" "),viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:l.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}const DGe=f.memo(AGe);function LGe(e,t,n){if(e.kind!=="html"||!e.workspacePath)return;const s=t.find(r=>Sie(r.path,e.workspacePath,n));if(s)for(let r=s.diffs.length-1;r>=0;r--){const i=s.diffs[r];if(i!=null&&i.fullContent)return i.newText}}function YI(e,t){return h9(e,t)}const PGe="_wrap_bymxa_1",OGe="_summary_bymxa_5",BGe="_summaryTextActive_bymxa_27",$Ge="_summaryIcon_bymxa_33",zGe="_summaryStatus_bymxa_47",FGe="_summaryToolIcon_bymxa_54",HGe="_summaryText_bymxa_27",qGe="_summaryDot_bymxa_96",UGe="_chevronRight_bymxa_100",VGe="_chevronDown_bymxa_101",WGe="_group_bymxa_161",GGe="_list_bymxa_193",KGe="_row_bymxa_199",YGe="_rowStats_bymxa_213",XGe="_rowDesc_bymxa_221",QGe="_rowTool_bymxa_231",JGe="_detail_bymxa_235",ZGe="_track_bymxa_241",eKe="_bar_bymxa_249",tKe="_barRunning_bymxa_257",nKe="_ruler_bymxa_296",sKe="_tick_bymxa_303",ti={wrap:PGe,summary:OGe,summaryTextActive:BGe,summaryIcon:$Ge,summaryStatus:zGe,summaryToolIcon:FGe,summaryText:HGe,summaryDot:qGe,chevronRight:UGe,chevronDown:VGe,group:WGe,list:GGe,row:KGe,rowStats:YGe,rowDesc:XGe,rowTool:QGe,detail:JGe,track:ZGe,bar:eKe,barRunning:tKe,ruler:nKe,tick:sKe};function Eie(e){const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t%60;return s>0?`${n}m ${s}s`:`${n}m`}function rKe(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 s=e.map((h,m)=>h.status==="in_progress"?Math.max(t,n[m]):Math.max(h.endTime??n[m],n[m])),r=Math.min(...n),i=Math.max(...s)-r;if(i<1e3)return null;const o=new Map;e.forEach((h,m)=>{const p=Math.max((s[m]-n[m])/i,.02),g=Math.min((n[m]-r)/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),c=Math.pow(10,Math.floor(Math.log10(a))),u=[5,2,1].map(h=>h*c).find(h=>h<=a)??c,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:Eie(m)})}return{rows:o,ticks:d}}function iKe(e,t){const n=[],s=nw(e.rawOutput),r=s==null?void 0:s.executionSummary,i=r&&typeof r.totalDurationMs=="number"?Eie(r.totalDurationMs):sw(e.startTime,e.endTime??(e.status==="in_progress"?t:void 0));i&&n.push(i);const o=s&&typeof s.tokenCount=="number"&&s.tokenCount>0?s.tokenCount:r&&typeof r.outputTokens=="number"&&r.outputTokens>0?r.outputTokens:0;o>0&&n.push(zI(o));const a=$I(e);return a&&n.push(ro(a,80)),n.join(" · ")}function oKe(){return l.jsx("svg",{className:ti.summaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:l.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 aKe({agents:e,pendingApproval:t}){const{t:n}=ot(),[s,r]=f.useState(!1),[i,o]=f.useState(null),[a,c]=f.useState(()=>Date.now()),u=f.useRef(Date.now()),d=e.some(y=>y.status==="in_progress");f.useEffect(()=>{d&&(u.current=Date.now(),c(Date.now()))},[d]),f.useEffect(()=>{if(!d)return;const y=setInterval(()=>c(Date.now()),1e3);return()=>clearInterval(y)},[d]);const h=d?lie(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=>Oc(y,t.toolCallId)):void 0,b=s||!!g,v=b?rKe(e,a):null,x=e.some(y=>fv(y)==="failed")?"failed":d?"in_progress":"completed";return l.jsxs("div",{className:ti.wrap,children:[l.jsxs("button",{type:"button",className:ti.summary,onClick:()=>r(y=>!y),"aria-expanded":b,title:n(b?"tool.collapseHint":"tool.expand"),children:[x==="failed"?l.jsx("span",{className:ti.summaryStatus,children:l.jsx(tm,{status:x})}):l.jsx("span",{className:ti.summaryIcon,"aria-hidden":"true",children:l.jsx(oKe,{})}),l.jsxs("span",{className:d?`${ti.summaryText} ${ti.summaryTextActive}`:ti.summaryText,children:[n("parallelAgents.title"),h&&l.jsxs(l.Fragment,{children:[" ",h]}),l.jsx("span",{className:ti.summaryDot,children:"·"}),n("parallelAgents.done",{done:m,total:p})]}),l.jsx("span",{className:b?ti.chevronDown:ti.chevronRight,"aria-hidden":"true"})]}),b&&l.jsxs("div",{className:ti.group,children:[l.jsx("div",{className:ti.list,children:e.map(y=>{const w=FI(y),k=HI(y),T=nze(y,n),_=iKe(y,a),C=fv(y),S=i===y.callId,L=v==null?void 0:v.rows.get(y.callId);return l.jsxs("div",{children:[l.jsxs("div",{className:ti.row,onClick:()=>o(S?null:y.callId),children:[l.jsx(tm,{status:C}),l.jsxs("span",{className:ti.rowDesc,children:[ro(k||w,50),T&&l.jsx("span",{className:ti.rowTool,children:` (${T})`})]}),_&&l.jsx("span",{className:ti.rowStats,children:_})]}),L&&l.jsx("div",{className:ti.track,"aria-hidden":"true",children:l.jsx("span",{className:L.running?`${ti.bar} ${ti.barRunning}`:ti.bar,style:{left:`${L.leftPct}%`,width:`${L.widthPct}%`}})}),S&&l.jsx("div",{className:ti.detail,children:l.jsx(qI,{tool:y,hideHeader:!0})})]},y.callId)})}),v&&v.ticks.length>=2&&l.jsx("div",{className:ti.ruler,"aria-hidden":"true",children:v.ticks.map(y=>l.jsx("span",{className:ti.tick,style:{left:`${y.leftPct}%`},children:y.label},y.label))})]})]})}const lKe="_collapseRow_d7f01_1",cKe="_collapseRowClickable_d7f01_14",uKe="_collapseLabel_d7f01_19",dKe="_processedLabel_d7f01_36",hKe="_processedMeta_d7f01_43",fKe="_hiddenMetrics_d7f01_47",mKe="_summaryMetrics_d7f01_51",pKe="_collapseIcon_d7f01_59",gKe="_chevronRight_d7f01_72",bKe="_chevronDown_d7f01_73",Ec={collapseRow:lKe,collapseRowClickable:cKe,collapseLabel:uKe,processedLabel:dKe,processedMeta:hKe,hiddenMetrics:fKe,summaryMetrics:mKe,collapseIcon:pKe,chevronRight:gKe,chevronDown:bKe},yKe="_list_1sazw_1",xKe="_listWithWelcomeHeader_1sazw_12",vKe="_historyStatus_1sazw_32",wKe="_virtualSizer_1sazw_48",kKe="_virtualRow_1sazw_57",_Ke="_loadingSkeleton_1sazw_67",SKe="_srOnly_1sazw_75",CKe="_loadingSkeletonUserRow_1sazw_87",TKe="_loadingSkeletonAssistantRow_1sazw_93",EKe="_loadingSkeletonUserBubble_1sazw_99",AKe="_loadingSkeletonUserBubbleCompact_1sazw_100",NKe="_loadingSkeletonAssistantBlock_1sazw_114",jKe="_loadingSkeletonLineWide_1sazw_122",MKe="_loadingSkeletonLineMedium_1sazw_123",IKe="_loadingSkeletonLineShort_1sazw_124",RKe="_loadingSkeletonLineNarrow_1sazw_125",DKe="_turnStatusRow_1sazw_165",LKe="_turnAnswerRow_1sazw_166",PKe="_turnContentRow_1sazw_177",OKe="_turnContentClip_1sazw_181",BKe="_turnContentCollapsed_1sazw_189",$Ke="_turnContentInner_1sazw_193",zKe="_sessionTimelineLayer_1sazw_198",FKe="_sessionTimelinePanel_1sazw_211",HKe="_sessionTimelineViewport_1sazw_222",qKe="_sessionTimelineList_1sazw_263",UKe="_sessionTimelineItem_1sazw_273",VKe="_sessionTimelineButton_1sazw_278",WKe="_sessionTimelineTick_1sazw_297",GKe="_sessionTimelineButtonInRange_1sazw_384",KKe="_sessionTimelineButtonCurrent_1sazw_388",YKe="_sessionTimelineDetails_1sazw_399",XKe="_sessionTimelineDetailsTitle_1sazw_433",QKe="_sessionTimelineDetailsIcon_1sazw_440",JKe="_sessionTimelineDetailsTitleText_1sazw_452",ZKe="_sessionTimelineDetailsDetail_1sazw_462",ns={list:yKe,listWithWelcomeHeader:xKe,historyStatus:vKe,virtualSizer:wKe,virtualRow:kKe,loadingSkeleton:_Ke,srOnly:SKe,loadingSkeletonUserRow:CKe,loadingSkeletonAssistantRow:TKe,loadingSkeletonUserBubble:EKe,loadingSkeletonUserBubbleCompact:AKe,loadingSkeletonAssistantBlock:NKe,loadingSkeletonLineWide:jKe,loadingSkeletonLineMedium:MKe,loadingSkeletonLineShort:IKe,loadingSkeletonLineNarrow:RKe,turnStatusRow:DKe,turnAnswerRow:LKe,turnContentRow:PKe,turnContentClip:OKe,turnContentCollapsed:BKe,turnContentInner:$Ke,sessionTimelineLayer:zKe,sessionTimelinePanel:FKe,sessionTimelineViewport:HKe,sessionTimelineList:qKe,sessionTimelineItem:UKe,sessionTimelineButton:VKe,sessionTimelineTick:WKe,sessionTimelineButtonInRange:GKe,sessionTimelineButtonCurrent:KKe,sessionTimelineDetails:YKe,sessionTimelineDetailsTitle:XKe,sessionTimelineDetailsIcon:QKe,sessionTimelineDetailsTitleText:JKe,sessionTimelineDetailsDetail:ZKe},e8=()=>{};function eYe(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 tYe(e){return e[e.length-1]}function nYe(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&u0(n))return n.id}return null}function vH(e){return e.role==="tool_group"&&e.tools.length===1&&Z4(e.tools[0])}function t8(e){return e.role==="tool_group"&&e.tools.length===1&&uK(e.tools[0])}function wH(e){return e.role==="thinking"}function kH(e,t){return e.role!=="tool_group"?!1:!!(t!=null&&t.toolCallId&&e.tools.some(n=>Oc(n,t.toolCallId)))}function _H(e){return e.role==="thinking"}function sYe(e,t){const n=[];let s=0;for(;s<e.length;){const r=e[s];if(r.role!=="tool_group"||kH(r,t)){_H(r)||n.push(r),s++;continue}const i=[r];let o=s,a=s+1;for(;a<e.length;){const u=e[a];if(_H(u)){a++;continue}if(u.role==="tool_group"&&!kH(u,t)){i.push(u),o=a,a++;continue}break}if(i.length===1){n.push(r),s++;continue}const c=i.flatMap(u=>u.role==="tool_group"?u.tools:[]);n.push({id:i[0].id,role:"tool_group",tools:c}),s=o+1}return n}function Aie(e){const t=[];let n=0;for(;n<e.length;){if(t8(e[n])){const s=[];let r=n;for(;r<e.length;){const i=e[r];if(t8(i)){s.push(i),r++;continue}if(wH(i)){let o=r+1;for(;o<e.length&&wH(e[o]);)o++;if(o<e.length&&t8(e[o])){r=o;continue}}break}if(s.length>=2){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}),n=r;continue}}if(vH(e[n])){const s=n;for(;n<e.length&&vH(e[n]);)n++;if(n-s>=2){const r=e.slice(s,n);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})}else t.push({type:"message",key:e[s].id,message:e[s]})}else t.push({type:"message",key:e[n].id,message:e[n]}),n++}return t}function SH(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 rYe(e,t,n,s,r){if((!n||n.size===0)&&(!s||s.size===0)&&(!r||r.size===0))return e;const i=[];let o=null;const a=(c,u)=>{if(u&&t||!c)return;const d=(n==null?void 0:n.get(c))??[],h=(s==null?void 0:s.get(c))??[],m=(r==null?void 0:r.get(c))??[];d.length===0&&h.length===0&&m.length===0||i.push({type:"turn_outputs",key:c,turnId:c,changes:d,artifacts:h,scheduledTasks:m})};for(const c of e)c.type==="message"&&u0(c.message)?(a(o,!1),o=c.message.id):!o&&c.type==="message"?o=c.message.id:!o&&c.type==="parallel_agents"&&(o=c.turnId),i.push(c);return a(o,!0),i}function iYe(e){return e.type==="message"&&e.message.role==="assistant"&&!!e.message.content&&e.message.content.trim().length>0}function XI(e,t,n){let s=t;for(let r=n;r>t;r--)if(Nie(e[r])){s=r;break}for(let r=n;r>s;r--)if(iYe(e[r]))return r;return-1}function oYe(e,t){const n=[];for(let r=0;r<e.length;r++){const i=e[r];i.type==="message"&&u0(i.message)&&n.push(r)}const s=new Map;for(let r=0;r<n.length;r++){if(r===n.length-1&&t)continue;const i=n[r],o=(r+1<n.length?n[r+1]:e.length)-1,a=e[i],c=XI(e,i,o);if(c<0)continue;const u=e[c];(a==null?void 0:a.type)==="message"&&u.type==="message"&&u.message.role==="assistant"&&s.set(u.message.id,a.message.id)}return s}function f9(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=>f9(n,t));switch(e.message.role){case"tool_group":case"plan":return!0;case"assistant":return!t;case"thinking":return!0;case"system":return QI(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 QI(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 aYe(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}:Gp(n.content,1)?{kind:"commentary",timestamp:n.timestamp,label:t?t("timeline.assistantUpdate"):"Assistant update"}:{kind:"none",timestamp:n.timestamp};case"tool_group":{const s=n.tools.length;return{kind:"tool",timestamp:n.timestamp,label:t?t("timeline.toolCalls",{count:s}):`${s} tool call${s===1?"":"s"}`}}case"plan":return{kind:"plan",timestamp:n.timestamp,label:t?t("timeline.planUpdate"):"Plan update"};case"system":return QI(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 Gp(e,t,n={}){const r=(n.stripMarkdown===!0?lYe(e):e??"").replace(/\s+/g," ").trim();if(t<=0||!r)return"";const i=Array.from(r);return i.length>t?`${i.slice(0,t-1).join("")}…`:r}function lYe(e){if(!e)return"";const t=[],n=r=>{const i=`\0${t.length}\0`;return t.push(r),i};let s=e.replace(/```[^\n`]*\n?([\s\S]*?)```/g,(r,i)=>n(i)).replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`\n]+)`/g,(r,i)=>n(i)).replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"");s=n8(s,"~~"),s=n8(s,"**"),s=n8(s,"__"),s=s.replace(/\*([^*\s][^*]*?\S)\*/g,"$1").replace(/(^|[^\p{L}\p{N}_])_([^_\s][^_]*?\S)_(?=$|[^\p{L}\p{N}_])/gu,"$1$2");for(const[r,i]of t.entries())s=s.split(`\0${r}\0`).join(i);return s}function n8(e,t){let n="",s=0;for(;s<e.length;){const r=e.indexOf(t,s);if(r===-1)return n+e.slice(s);const i=r+t.length,o=e.indexOf(t,i);if(o===-1)return n+e.slice(s);const a=e.slice(i,o);n+=a.trim().length===0?e.slice(s,o+t.length):e.slice(s,r)+a,s=o+t.length}return n}function cYe(e,t){const n=e.role==="user"?e.content:e.role==="user_shell"?e.command:"",s=Gp(n,32);return s||(t?t("timeline.userTurn"):"User turn")}function uYe(e){return e.role==="user"&&(e.source==="cron"||e.source==="loop")}function u0(e){return e.role==="user"||e.role==="user_shell"}function dYe(e,t){switch(e.role){case"thinking":return t?t("timeline.kind.thought"):"thinking";case"assistant":return Gp(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 QI(e)?Gp(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 hYe(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"?"":dYe(e.message,t)}function fYe(e,t){return t?t(`timeline.kind.${e}`):BYe[e]}function mYe(e,t,n,s){if(t!==null)for(const o of e){if(o.type!=="message")continue;const{message:a}=o;if(a.id!==t||a.role!=="assistant")continue;const c=Gp(a.content,180,{stripMarkdown:!0});if(c)return c}const r=[];for(let o=0;o<e.length;o+=1){const a=e[o];if(a.type==="message"&&t!==null&&a.message.id===t)continue;const c=hYe(a,s);c&&r.push(c)}const i=Gp(r.join(" · "),180);return i||(n.length>0?n.map(o=>fYe(o,s)).join(" · "):s?s("timeline.noActivity"):"No activity")}function pYe(e,t){const n=[];let s=null,r=[];const i=()=>{if(!s)return;const o=Aie(r),a=XI(o,-1,o.length-1),c=a>=0?o[a]:null,u=(c==null?void 0:c.type)==="message"&&c.message.role==="assistant"&&!c.message.isStreaming&&Gp(c.message.content,1,{stripMarkdown:!0}).length>0?c.message.id:null,d=[];for(const h of o){if(h.type==="message"&&u!==null&&h.message.id===u)continue;const m=aYe(h,t);m.kind!=="none"&&!d.includes(m.kind)&&d.push(m.kind)}n.push({id:s.id,label:cYe(s,t),detail:mYe(o,u,d,t),timestamp:s.timestamp,nodeKinds:d,...uYe(s)?{isScheduledTask:!0}:{}})};for(const o of e){if(u0(o)){i(),s=o,r=[];continue}s&&r.push(o)}return i(),n}function gYe(){return l.jsxs("svg",{className:ns.sessionTimelineDetailsIcon,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6.25"}),l.jsx("path",{d:"M8 4.5v4l-2.5 2"})]})}function bYe(e){var n,s,r;const t=e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0;return[e.callId,e.toolName,e.kind??"",e.status,e.parentToolCallId??"",e.subContent?"sub-content":"",((n=e.subTools)==null?void 0:n.length)??0,String(((s=e.args)==null?void 0:s.subagent_type)??""),((r=e.args)==null?void 0:r.run_in_background)===!0?"background":"",String((t==null?void 0:t.type)??""),String((t==null?void 0:t.status)??"")].join(":")}function yYe(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(bYe).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 Nie(e){return e.type==="parallel_agents"?!0:e.type==="turn_outputs"||e.type==="turn_collapse"?!1:e.type==="turn_content"?e.items.some(Nie):e.message.role==="tool_group"||e.message.role==="plan"}function CH(e){return e==="pending"||e==="running"||e==="in_progress"}function jie(e){if(e.type==="turn_content"){for(let n=e.items.length-1;n>=0;n--){const s=jie(e.items[n]);if(s)return s}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(s=>CH(s.status));return n.length===0?null:`agents:${e.key}:${n.map(s=>s.callId).join(",")}`}if(e.message.role!=="tool_group")return null;const t=e.message.tools.filter(n=>CH(n.status));return t.length===0?null:`tools:${e.message.id}:${t.map(n=>n.callId).join(",")}`}function xYe(e){for(let t=e.length-1;t>=0;t--){const n=jie(e[t]);if(n)return n}return null}function vYe(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 wYe(e){return e.type==="message"&&e.message.role==="system"&&e.message.source==="turn_error"}function kYe(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 _Ye(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function Mie(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+Mie(n),0):e.message.role==="tool_group"?e.message.tools.length:0}function Iie(e,t){for(let n=Math.min(t,e.length-1);n>=0;n--){const s=e[n];if(s.type==="message"&&u0(s.message))return s.message.id}return null}function Rie(e){const t=[];let n=null;for(const s of e)s.type==="message"&&u0(s.message)&&(n=s.message.id),t.push(n);return t}function TH(e,t,n,s){const r=s===void 0?Iie(e,t):s[t]??null;return r?n.get(r)??null:null}function SYe(e,t,n,s,r=Rie(e)){let i=Number.POSITIVE_INFINITY,o=-1;for(const c of t){if(c<0||c>=e.length)continue;const u=TH(e,c,n,r);u!==null&&(i=Math.min(i,u),o=Math.max(o,u))}if(o<0)return null;const a=s==null?null:TH(e,s,n,r);return{startIndex:i,endIndex:o,currentIndex:a!==null&&a>=i&&a<=o?a:o}}function CYe(e,t,n,s){if(!s)return!1;for(let r=t;r<=n;r++){const i=e[r];if(i.type==="parallel_agents"){if(i.agents.some(o=>Oc(o,s)))return!0}else if(i.type==="message"&&i.message.role==="tool_group"&&i.message.tools.some(o=>Oc(o,s)))return!0}return!1}function TYe(e,{overrides:t,isResponding:n,activeTurnStartedAt:s,pendingApprovalCallId:r,enabled:i}){if(!i||e.length===0)return e;const o=[];for(let c=0;c<e.length;c++){const u=e[c];u.type==="message"&&u0(u.message)&&o.push(c)}if(o.length===0)return e;const a=[];for(let c=0;c<o[0];c++)a.push(e[c]);for(let c=0;c<o.length;c++){const u=o[c],d=(c+1<o.length?o[c+1]:e.length)-1,h=e[u],m=h.message.id,p=h.message.timestamp,g=c===o.length-1&&n,b=CYe(e,u,d,r),v=XI(e,u,d);let x=0,y,w,k=0,T=0,_=0,C=0,S=0,L=!1,N=!1;for(let j=u+1;j<=d;j++){const ee=e[j];f9(ee,j===v)&&x++,wYe(ee)&&(N=!0),C+=Mie(ee),ee.type==="message"&&ee.message.role==="thinking"&&S++;const X=vYe(ee);X!==void 0&&(y=y===void 0?X:Math.max(y,X));const Q=kYe(ee);Q!==void 0&&(w=w===void 0?Q:Math.max(w,Q));const ue=_Ye(ee);ue&&(k+=ue.inputTokens,T+=ue.outputTokens,_+=ue.cachedTokens??0,L=!0)}const $=g?s??p??Date.now():void 0,M=y??w,P=p!==void 0&&M!==void 0&&M>=p?M-p:void 0;if(b||x===0&&!(L||P!==void 0||$!==void 0)){for(let j=u;j<=d;j++)a.push(e[j]);continue}const O=g||N||v<0,F=!(x===0?!0:t.has(m)?t.get(m):O);let B=0;const W=j=>{j.length!==0&&a.push({type:"turn_content",key:`${m}-content-${B++}`,turnId:m,collapsed:F,items:j})};a.push({type:"message",key:h.key,message:h.message});const I={turnId:m,collapsed:F,hiddenCount:x,...P!==void 0?{elapsedMs:P}:{},...L?{inputTokens:k,outputTokens:T}:{},..._>0?{cachedTokens:_}:{},...C>0?{toolCallCount:C}:{},...S>0?{thinkingCount:S}:{},...$!==void 0?{liveStartedAt:$}:{}};if(a.push({type:"turn_collapse",key:`tc-${m}`,turnCollapse:I}),!F){let j=[];for(let ee=u+1;ee<=d;ee++){const se=e[ee];ee===v&&se.type==="message"&&se.message.role==="assistant"?(W(j),j=[],a.push({...se,turnCollapse:I})):j.push(se)}W(j);continue}const Y=[],V=[];for(let j=u+1;j<=d;j++){const ee=e[j];if(!(j===v&&g)){if(j===v&&ee.type==="message"&&ee.message.role==="assistant"){V.push({...ee,turnCollapse:I});continue}if(f9(ee,j===v)){Y.push(ee);continue}V.push(ee)}}W(Y),a.push(...V)}return a}function h2(e,t,n){for(let s=0;s<e.length;s++){const r=e[s];if(r.type==="message"){if(r.message.id===t||n&&r.message.role==="tool_group"&&r.message.tools.some(i=>Oc(i,n)))return s}else{if(r.type==="parallel_agents"&&n&&r.agents.some(i=>Oc(i,n)))return s;if(r.type==="turn_content"&&h2(r.items,t,n)>=0)return s;if(r.type==="turn_outputs")continue}}return-1}function m9(e,t){if(!t)return!1;const n=t.callId;return e.type==="message"?e.message.id===t.messageId?!0:!!n&&e.message.role==="tool_group"&&e.message.tools.some(s=>Oc(s,n)):e.type==="parallel_agents"?!!n&&e.agents.some(s=>Oc(s,n)):e.type==="turn_content"?e.items.some(s=>m9(s,t)):(e.type==="turn_outputs",!1)}const s8=0,EYe=120,r8=80,AYe=32,NYe=240,i8=30,EH=48,Die=200,jYe=4;function MYe(e,t=Die){return e>t}function IYe(e){const t=Math.max(0,Math.ceil(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t-n*60;return`${n}m ${s}s`}function o8(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function RYe(e){return e!==void 0?IYe(e):""}function DYe(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";const n=e.cachedTokens??0,s=n>0&&e.inputTokens>0?` (${o8(n)} ${t("turn.cached")}, ${Math.round(n/e.inputTokens*100)}%)`:"";return`↑${o8(e.inputTokens)}${s} ↓${o8(e.outputTokens)}`}function AH(e,t){const n=[],s=DYe(e,t);return s&&n.push(s),e.toolCallCount!==void 0&&e.toolCallCount>0&&n.push(t("turn.toolCalls",{count:e.toolCallCount})),e.thinkingCount!==void 0&&e.thinkingCount>0&&n.push(t("turn.thinkingCount",{count:e.thinkingCount})),n.join(" · ")}function LYe(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}const PYe=f.memo(function({turnCollapse:t,onToggleCollapse:n}){const{t:s}=ot(),r=t.hiddenCount>0,i=t.liveStartedAt,o=r||i!==void 0||LYe(t),a=WI(i!==void 0&&o),c=f.useRef(0),u=f.useRef(i);u.current!==i&&(u.current=i,c.current=0);let d;i!==void 0&&o?(c.current=Math.max(c.current,Math.max(0,a-i)),d=c.current):o&&t.elapsedMs!==void 0?(c.current=0,d=t.elapsedMs):(c.current=0,d=void 0);const h=RYe(d),m=AH(t,s),p=AH(t,s),g=s(i!==void 0?"turn.processing":"turn.processed"),b=!!h&&o,v=!!m&&o,x=!!p&&o;if(!o)return null;const y=()=>{if(!r)return;const w=t.collapsed;n(t.turnId,w)};return l.jsxs("div",{className:r?`${Ec.collapseRow} ${Ec.collapseRowClickable}`:Ec.collapseRow,role:r?"button":void 0,tabIndex:r?0:void 0,"aria-expanded":r?!t.collapsed:void 0,"aria-label":r?t.collapsed?s("turn.expand"):s("turn.collapse"):void 0,title:r?t.collapsed?s("turn.expand"):s("turn.collapse"):void 0,onClick:r?y:void 0,onKeyDown:r?w=>{w.key!=="Enter"&&w.key!==" "||(w.preventDefault(),y())}:void 0,children:[l.jsxs("span",{className:Ec.collapseLabel,children:[l.jsxs("span",{className:Ec.processedLabel,children:[g,b&&l.jsxs("span",{className:Ec.processedMeta,children:[" ",h]})]}),x&&l.jsx("span",{className:Ec.summaryMetrics,children:p}),v&&l.jsx("span",{className:Ec.hiddenMetrics,children:m})]}),r&&l.jsx("span",{"data-testid":`toggle-${t.turnId}`,className:Ec.collapseIcon,onClick:w=>{w.stopPropagation(),y()},children:l.jsx("span",{className:t.collapsed?Ec.chevronRight:Ec.chevronDown,"aria-hidden":"true"})})]})});function NH(e){if(e.type==="turn_collapse")return ns.turnStatusRow;if(e.type==="turn_outputs"||e.type==="turn_content")return ns.turnContentRow;if(e.type==="message"&&e.turnCollapse)return ns.turnAnswerRow}const OYe=f.memo(function({collapsed:t,children:n}){const s=x4(ns.turnContentClip,t?ns.turnContentCollapsed:void 0);return l.jsx("div",{className:s,"data-collapsed":t?"true":"false",children:l.jsx("div",{className:ns.turnContentInner,children:n})})}),BYe={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},$Ye=["--background","--foreground","--muted-foreground","--border","--font-sans"],jH="session-timeline-detail-tooltip",zYe=f.memo(function({entries:t,currentTurnId:n,currentRange:s,hidden:r,onSelect:i}){const o=oh(),{t:a}=ot(),c=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,v]=f.useState(null),x=s!==null?s.currentIndex:t.findIndex(N=>N.id===n),y=f.useCallback(()=>v(null),[]),w=f.useCallback(()=>{h.current||m.current||y()},[y]),k=f.useCallback((N,$)=>{const M=c.current;if(!M)return null;const P=getComputedStyle(M),E=$.getBoundingClientRect();return{entry:N,top:E.top+E.height/2,left:E.right+8,clamped:!1,themeVars:Object.fromEntries($Ye.map(O=>[O,P.getPropertyValue(O)]))}},[]),T=f.useCallback(N=>{const $=u.current;if(!$)return null;const M=Array.from($.querySelectorAll('[data-testid="session-timeline-entry"]')).find(P=>P.getAttribute("data-turn-id")===N.id);return(M==null?void 0:M.querySelector("button"))??null},[]),_=f.useCallback(N=>{const $=u.current;if(!$)return!1;const M=$.getBoundingClientRect(),P=N.getBoundingClientRect();return P.bottom>=M.top&&P.top<=M.bottom},[]),C=f.useCallback(()=>{v(N=>{if(!N)return null;const $=T(N.entry);return!$||!_($)?null:k(N.entry,$)})},[k,T,_]),S=f.useCallback((N,$)=>{v(k(N,$))},[k]),L=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(r)return;const N=u.current;if(!N||x<0)return;const $=N.querySelector(`[data-timeline-index="${x}"]`);if(!$)return;const M=$.offsetTop+$.offsetHeight/2,P=N.scrollHeight-N.clientHeight,E=Math.max(0,Math.min(M-N.clientHeight/2,P));if(N.scrollTop===E)return;h.current=!0,N.scrollTop=E;const O=window.requestAnimationFrame(()=>{h.current=!1,C()}),z=window.setTimeout(()=>{h.current=!1},100);return()=>{window.cancelAnimationFrame(O),window.clearTimeout(z),h.current=!1}},[x,r,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 N=c.current,$=d.current;if(!N||!$||typeof window>"u")return;const M=$.getBoundingClientRect(),P=12;let E=b.top;M.top<P?E+=P-M.top:M.bottom>window.innerHeight-P&&(E-=M.bottom-(window.innerHeight-P)),E!==b.top&&v(O=>(O==null?void 0:O.entry.id)===b.entry.id?{...O,top:E,clamped:!0}:O)},[b]),r||t.length===0?null:l.jsx("div",{className:ns.sessionTimelineLayer,"aria-hidden":"false",children:l.jsxs("nav",{ref:c,className:ns.sessionTimelinePanel,"aria-label":a("timeline.sessionTimeline"),"data-testid":"session-timeline",onMouseLeave:y,children:[l.jsx("div",{ref:u,className:ns.sessionTimelineViewport,"data-testid":"session-timeline-viewport",onScroll:w,children:l.jsx("ol",{className:ns.sessionTimelineList,children:t.map((N,$)=>{const M=s!==null&&$>=s.startIndex&&$<=s.endIndex,P=s!==null?$===s.currentIndex:N.id===n,E=N.nodeKinds.join(","),O=[`${a("timeline.turnPrefix",{index:$+1})}: ${N.label}`,P?a("timeline.currentTurn"):null].filter(Boolean).join(". "),z=W=>S(N,W.currentTarget),F=W=>{L(),S(N,W.currentTarget)},B=(b==null?void 0:b.entry.id)===N.id;return l.jsx("li",{className:ns.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":N.id,"data-timeline-index":$,"data-node-kinds":E,"data-in-current-range":M?"true":void 0,children:l.jsx("button",{type:"button",className:x4(ns.sessionTimelineButton,M?ns.sessionTimelineButtonInRange:void 0,P?ns.sessionTimelineButtonCurrent:void 0),"aria-current":P?"step":void 0,"aria-describedby":B?jH:void 0,"aria-label":O,onClick:()=>i(N.id),onFocus:F,onBlur:y,onMouseEnter:z,onMouseLeave:y,children:l.jsx("span",{className:ns.sessionTimelineTick})})},N.id)})})}),b&&typeof document<"u"&&$u.createPortal(l.jsxs("div",{ref:d,className:ns.sessionTimelineDetails,id:jH,"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:[l.jsxs("span",{className:ns.sessionTimelineDetailsTitle,children:[b.entry.isScheduledTask&&l.jsx(gYe,{}),l.jsx("span",{className:ns.sessionTimelineDetailsTitleText,children:b.entry.label})]}),l.jsx("span",{className:ns.sessionTimelineDetailsDetail,children:b.entry.detail})]}),o??document.body)]})})});function x4(...e){return e.filter(Boolean).join(" ")||void 0}const FYe=[];function HYe({label:e}){return l.jsxs(l.Fragment,{children:[l.jsx("div",{role:"status","aria-live":"polite",className:ns.srOnly,children:e}),l.jsxs("div",{className:ns.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[l.jsx("div",{className:ns.loadingSkeletonUserRow,children:l.jsxs("div",{className:ns.loadingSkeletonUserBubble,children:[l.jsx("span",{className:ns.loadingSkeletonLineWide}),l.jsx("span",{className:ns.loadingSkeletonLineShort})]})}),l.jsx("div",{className:ns.loadingSkeletonAssistantRow,children:l.jsxs("div",{className:ns.loadingSkeletonAssistantBlock,children:[l.jsx("span",{className:ns.loadingSkeletonLineMedium}),l.jsx("span",{className:ns.loadingSkeletonLineWide}),l.jsx("span",{className:ns.loadingSkeletonLineNarrow})]})}),l.jsx("div",{className:ns.loadingSkeletonUserRow,children:l.jsx("div",{className:ns.loadingSkeletonUserBubbleCompact,children:l.jsx("span",{className:ns.loadingSkeletonLineMedium})})}),l.jsx("div",{className:ns.loadingSkeletonAssistantRow,children:l.jsxs("div",{className:ns.loadingSkeletonAssistantBlock,children:[l.jsx("span",{className:ns.loadingSkeletonLineWide}),l.jsx("span",{className:ns.loadingSkeletonLineMedium})]})})]})]})}const Lie=f.memo(f.forwardRef(function({messages:t,pendingApproval:n,onShowContextDetail:s,loadingTranscript:r,catchingUp:i,hasOlderHistory:o=!1,loadingOlderHistory:a=!1,historyCapacityReached:c=!1,onLoadOlderHistory:u,isResponding:d=!1,activeTurnStartedAt:h,welcomeHeader:m,centerWelcomeHeader:p=!1,workspaceCwd:g,tailContent:b,tailKey:v="tail",virtualScrollThreshold:x=Die,autoScrollTailIntoView:y=!1,bottomOverlayInset:w=0,hideSessionTimeline:k=!1,showRetryHint:T=!1,onRetryClick:_,onBranchSession:C,onCanScrollToBottomChange:S,turnFileChanges:L,turnArtifacts:N,turnScheduledTasks:$,onReviewChanges:M,onOpenArtifact:P,onOpenScheduledTask:E,onTurnOutputOpen:O,generateContent:z},F){var un;const{t:B}=ot(),W=f.useContext(Kp),I=f.useMemo(()=>W?sYe(t,n):t,[W,t,n]),Y=f.useMemo(()=>rYe(Aie(I),d,L,N,$),[I,d,L,N,$]),[V,j]=f.useState(!1),ee=f.useRef(null),se=f.useMemo(()=>{var Ue,zt;if(!V)return FYe;const _e=yYe(I);return(((Ue=ee.current)==null?void 0:Ue.signature)!==_e||((zt=ee.current)==null?void 0:zt.t)!==B)&&(ee.current={signature:_e,t:B,entries:pYe(I,B)}),ee.current.entries},[V,I,B]),X=f.useMemo(()=>new Map(se.map((_e,Ue)=>[_e.id,Ue])),[se]),Q=f.useMemo(()=>nYe(I),[I]),[ue,re]=f.useState(null),J=ue!==null?((un=se[ue.currentIndex])==null?void 0:un.id)??Q:Q,q=f.useMemo(()=>{var _e;if(d)return null;for(let Ue=I.length-1;Ue>=0;Ue-=1){const zt=I[Ue];if(zt&&(zt.role==="tool_group"||zt.role==="plan"))return null;if((zt==null?void 0:zt.role)==="assistant"&&!zt.isStreaming&&((_e=zt.content)!=null&&_e.trim()))return zt.id}return null},[d,I]),Z=f.useMemo(()=>oYe(Y,d),[Y,d]),{collapseCompletedTurns:he}=$c(),ye=he??!0,[oe,we]=f.useState(()=>new Map),Ve=f.useRef(!0),lt=f.useRef(!1),Et=f.useRef(0),pt=f.useRef(0),je=f.useRef(!1),Ae=f.useRef(!1),De=f.useRef(0),Ne=f.useRef(null),tt=f.useRef(null),Se=f.useRef(!1),Be=f.useRef(null),le=f.useRef(!1),Le=f.useRef(r),sn=f.useRef(!!r),Cn=f.useRef(void 0),In=f.useRef(void 0),_t=f.useRef(w),Te=f.useRef(null),at=f.useRef(i),ke=f.useRef(i),Pe=f.useRef(!1),ve=f.useRef(!1),Ke=f.useRef(void 0),me=f.useRef(void 0),qe=f.useRef(void 0);ke.current=i;const Mt=f.useRef(null),ln=f.useRef(!1),Ft=f.useRef(null),[st,Tn]=f.useState(null);f.useLayoutEffect(()=>{if(!st)return;const _e=Mt.current;_e&&(_e.scrollTop=st.scrollTop+Math.max(0,_e.scrollHeight-st.scrollHeight)),je.current=!1,Tn(null)},[st]),f.useEffect(()=>{o||(ln.current=!1,Ft.current=null)},[o]);const ne=f.useCallback(()=>{const _e=Mt.current,Ue=_e?_e.scrollHeight-_e.scrollTop-_e.clientHeight:0,zt=!Ve.current&&Ue>1;tt.current!==zt&&(tt.current=zt,S==null||S(zt))},[S]),gt=f.useCallback(()=>{qe.current!==void 0&&window.cancelAnimationFrame(qe.current),qe.current=window.requestAnimationFrame(ne)},[ne]),bt=f.useCallback(_e=>{Ve.current!==_e&&(Ve.current=_e,gt())},[gt]),It=f.useMemo(()=>TYe(Y,{overrides:oe,isResponding:d,activeTurnStartedAt:h,pendingApprovalCallId:(n==null?void 0:n.toolCallId)??null,enabled:ye}),[Y,oe,d,h,n==null?void 0:n.toolCallId,ye]),Rt=f.useMemo(()=>Rie(It),[It]),We=se.length>=jYe;f.useLayoutEffect(()=>{if(k){j(Sn=>Sn&&!1);return}const _e=Mt.current;if(!_e)return;const Ue=()=>{const Gt=_e.getBoundingClientRect().width>=1160;j(Ls=>Ls===Gt?Ls:Gt)};if(Ue(),typeof ResizeObserver>"u")return;const zt=new ResizeObserver(Ue);return zt.observe(_e),()=>zt.disconnect()},[k]);const Zn=b!=null,Ar=!!r,Ge=!!m,dt=Ge?1:0,bn=dt+It.length,Ht=bn+(Zn?1:0),Rn=MYe(Ht,x),Gn=f.useCallback(()=>Mt.current,[]),Or=f.useCallback(()=>{const _e=Mt.current;if(!_e)return;const zt=_e.scrollHeight-_e.scrollTop-_e.clientHeight<i8;lt.current=!zt,bt(zt),gt()},[gt,bt]),Bn=f.useCallback(()=>{Et.current=Date.now()+1e3},[]),_n=f.useCallback(()=>{ve.current=!0,Ke.current!==void 0&&window.cancelAnimationFrame(Ke.current),me.current!==void 0&&window.clearTimeout(me.current),Ke.current=window.requestAnimationFrame(Or),me.current=window.setTimeout(()=>{ve.current=!1,Ke.current=void 0,me.current=void 0,Or()},220)},[Or]);f.useEffect(()=>()=>{Ke.current!==void 0&&window.cancelAnimationFrame(Ke.current),me.current!==void 0&&window.clearTimeout(me.current),qe.current!==void 0&&window.cancelAnimationFrame(qe.current),Cn.current!==void 0&&window.cancelAnimationFrame(Cn.current),In.current!==void 0&&window.cancelAnimationFrame(In.current)},[]);const gs=f.useCallback((_e,Ue)=>{const zt=Mt.current;(!zt||zt.scrollHeight>zt.clientHeight+1)&&(lt.current=!0,bt(!1)),_n(),we(Sn=>{const Gt=new Map(Sn);return Gt.set(_e,Ue),Gt})},[_n,bt]),Qn=f.useCallback(_e=>{const Ue=_e.target;Ue instanceof HTMLElement&&Ue.closest("[aria-expanded]")&&(lt.current=!0,bt(!1),_n())},[_n,bt]),Dn=f.useCallback(_e=>{if(Ge&&_e===s8)return"slot:header";if(Zn&&_e===bn)return`slot:tail:${v}`;const Ue=It[_e-dt];return Ue?SH(Ue):`slot:row:${_e}`},[Ge,Zn,bn,v,It,dt]),wn=f.useCallback((_e="auto")=>{const Ue=Gn();if(!Ue||Ue.scrollHeight<=Ue.clientHeight)return;De.current+=1;const zt=De.current;Ae.current=!0,_e==="smooth"?Ue.scrollTo({top:Ue.scrollHeight,behavior:_e}):Ue.scrollTop=Ue.scrollHeight,gt(),pt.current=Math.max(0,Ue.scrollHeight-Ue.clientHeight),ne();const Sn=()=>{De.current===zt&&(Ae.current=!1)};_e==="smooth"?setTimeout(Sn,350):requestAnimationFrame(Sn)},[Gn,ne,gt]),br=f.useCallback((_e="smooth")=>{lt.current=!1,bt(!0),wn(_e)},[wn,bt]),Qs=Z0e({count:Ht,enabled:Rn,getScrollElement:Gn,getItemKey:Dn,estimateSize:_e=>{if(Ge&&_e===s8)return EYe;if(Zn&&_e===bn)return NYe;const Ue=It[_e-dt];return(Ue==null?void 0:Ue.type)==="turn_collapse"?AYe:(Ue==null?void 0:Ue.type)==="turn_content"?Math.max(r8,Ue.items.length*r8):r8},overscan:20,useFlushSync:!1,useAnimationFrameWithResizeObserver:!0}),hs=Qs.getVirtualItems(),cn=Qs.getTotalSize(),Jn=f.useRef({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});Jn.current={entryIndexById:X,headerOffset:dt,isVisible:V,turnIdByDisplayIndex:Rt,visibleItems:It};const Wi=f.useCallback(()=>{const _e=Gn(),Ue=Jn.current;if(!_e||!Ue.isVisible||Ue.entryIndexById.size===0){re($n=>$n===null?$n:null);return}const zt=_e.getBoundingClientRect(),Sn=zt.top,Gt=zt.bottom,Ls=Sn+(Gt-Sn)/2,kn=[];let Pn=null,es=Number.POSITIVE_INFINITY;_e.querySelectorAll("[data-index]").forEach($n=>{const qs=$n.dataset.index;if(qs===void 0)return;const mn=Number(qs);if(!Number.isFinite(mn))return;const Ps=mn-Ue.headerOffset;if(Ps<0||Ps>=Ue.visibleItems.length)return;const ys=$n.getBoundingClientRect();if(ys.bottom<Sn||ys.top>Gt)return;kn.push(Ps);const Re=ys.top+(ys.bottom-ys.top)/2,Dt=Math.abs(Re-Ls);Dt<es&&(es=Dt,Pn=Ps)});const jn=SYe(Ue.visibleItems,kn,Ue.entryIndexById,Pn,Ue.turnIdByDisplayIndex);re($n=>($n==null?void 0:$n.startIndex)===(jn==null?void 0:jn.startIndex)&&($n==null?void 0:$n.endIndex)===(jn==null?void 0:jn.endIndex)&&($n==null?void 0:$n.currentIndex)===(jn==null?void 0:jn.currentIndex)?$n:jn)},[Gn]),is=f.useCallback(()=>{Ne.current!==null&&cancelAnimationFrame(Ne.current),Ne.current=requestAnimationFrame(()=>{Ne.current=null,Wi()})},[Wi]);f.useEffect(()=>()=>{Ne.current!==null&&(cancelAnimationFrame(Ne.current),Ne.current=null)},[]),f.useEffect(()=>{is()},[is,Ht,cn,Rn,hs.length,V]);const[tr,kr]=f.useState(null);f.useEffect(()=>{if(!tr)return;const _e=setTimeout(()=>kr(null),1600);return()=>clearTimeout(_e)},[tr]);const Br=f.useCallback((_e,Ue)=>{var Sn,Gt;lt.current=!0,bt(!1),De.current+=1;const zt=De.current;Ae.current=!0,Rn?Qs.scrollToIndex(_e,{align:"center"}):(Gt=(Sn=Mt.current)==null?void 0:Sn.querySelector(`[data-index="${_e}"]`))==null||Gt.scrollIntoView({block:"center"}),setTimeout(()=>{De.current===zt&&(Ae.current=!1,is(),gt())},150),kr(null),requestAnimationFrame(()=>kr(Ue))},[Rn,Qs,bt,is,gt]),gr=f.useRef({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});gr.current={visibleItems:It,displayItems:Y,headerOffset:dt,performScrollToRow:Br};const bs=f.useRef(null),ir=f.useCallback((_e,Ue)=>{const{visibleItems:zt,displayItems:Sn,headerOffset:Gt,performScrollToRow:Ls}=gr.current,kn=h2(zt,_e,Ue);if(kn>=0){const jn=zt[kn];return(jn==null?void 0:jn.type)==="turn_content"&&jn.collapsed?(bs.current={messageId:_e,callId:Ue},we($n=>{if($n.get(jn.turnId)===!0)return $n;const qs=new Map($n);return qs.set(jn.turnId,!0),qs}),!0):(bs.current=null,Ls(kn+Gt,{messageId:_e,callId:Ue}),!0)}const Pn=h2(Sn,_e,Ue);if(Pn<0)return!1;const es=Iie(Sn,Pn);return es?(bs.current={messageId:_e,callId:Ue},we(jn=>{if(jn.get(es)===!0)return jn;const $n=new Map(jn);return $n.set(es,!0),$n}),!0):!1},[]);f.useImperativeHandle(F,()=>({scrollToMessage:ir,scrollToBottom:br}),[ir,br]),f.useEffect(()=>{const _e=bs.current;if(!_e)return;const Ue=h2(It,_e.messageId,_e.callId);Ue<0||(bs.current=null,Br(Ue+dt,_e))},[It,dt,Br]);const or=f.useCallback(async(_e=!1)=>{const Ue=Mt.current;if(!Ue||!u||a||je.current||ln.current&&!_e)return;ln.current=!1,je.current=!0;const zt=Ue.scrollHeight,Sn=Ue.scrollTop;lt.current=!0;try{await u(),Tn({scrollHeight:zt,scrollTop:Sn})}catch{ln.current=!0,je.current=!1}},[a,u]),pe=f.useCallback(()=>{const _e=Gn();if(!_e)return;const Ue=_e.scrollTop;if(o&&Ue<=EH&&or(!0),Ae.current){pt.current=Ue;return}is();const zt=pt.current;pt.current=Ue;const Sn=_e.scrollHeight-Ue-_e.clientHeight;if(gt(),Ue<zt-1){const Gt=Sn<i8,Ls=Date.now()<=Et.current;Gt?(lt.current=!1,bt(!0)):Ls?(lt.current=!0,bt(!1)):lt.current||bt(!1);return}Sn<i8&&(lt.current=!1,bt(!0))},[Gn,o,or,gt,is,bt]);f.useEffect(()=>{const _e=Gn();if(_e)return _e.addEventListener("scroll",pe,{passive:!0}),()=>_e.removeEventListener("scroll",pe)},[Gn,pe]);const Oe=f.useCallback(()=>{if(!o||a||i||Ar)return;const _e=Gn();if(!_e||_e.scrollHeight>_e.clientHeight+1)return;const Ue=Ft.current;if(Ue!==null&&Ue.loader===u&&Ue.totalVirtualSize===cn){ln.current=!0;return}Ft.current={loader:u,totalVirtualSize:cn},or()},[i,Gn,o,or,a,u,Ar,cn]);f.useEffect(()=>{Oe()},[Oe,cn]),f.useEffect(()=>{const _e=Gn();if(!_e)return;const Ue=()=>{ln.current&&_e.scrollTop<=EH&&or(!0)},zt=kn=>{Bn(),kn.deltaY<0&&Ue()},Sn=()=>{Bn(),Ue()},Gt=kn=>{const Pn=_e.getBoundingClientRect(),es=20;(kn.clientX>=Pn.right-es||kn.clientY>=Pn.bottom-es)&&Bn()},Ls=kn=>{(kn.key==="ArrowUp"||kn.key==="ArrowDown"||kn.key==="PageUp"||kn.key==="PageDown"||kn.key==="Home"||kn.key==="End"||kn.key===" ")&&(Bn(),(kn.key==="ArrowUp"||kn.key==="PageUp"||kn.key==="Home")&&Ue())};return _e.addEventListener("wheel",zt,{passive:!0}),_e.addEventListener("touchstart",Sn,{passive:!0}),_e.addEventListener("pointerdown",Gt,{passive:!0}),_e.addEventListener("keydown",Ls,{passive:!0}),()=>{_e.removeEventListener("wheel",zt),_e.removeEventListener("touchstart",Sn),_e.removeEventListener("pointerdown",Gt),_e.removeEventListener("keydown",Ls)}},[Gn,or,Bn]),f.useEffect(()=>{const _e=Gn();if(!_e||typeof ResizeObserver>"u")return;const Ue=new ResizeObserver(()=>{gt(),Oe()});Ue.observe(_e);for(const Sn of Array.from(_e.children))Ue.observe(Sn);const zt=new MutationObserver(Sn=>{for(const Gt of Sn){for(const Ls of Array.from(Gt.addedNodes))Ls instanceof HTMLElement&&Ue.observe(Ls);for(const Ls of Array.from(Gt.removedNodes))Ls instanceof HTMLElement&&Ue.unobserve(Ls)}gt()});return zt.observe(_e,{childList:!0}),gt(),()=>{Ue.disconnect(),zt.disconnect()}},[Gn,Oe,gt]),f.useEffect(()=>{t.length===0&&(lt.current=!1,bt(!0),bs.current=null,we(_e=>_e.size?new Map:_e))},[t.length,bt]),f.useEffect(()=>{const _e=Mt.current;if(!_e)return;const Ue=new ResizeObserver(()=>{is(),!ke.current&&(lt.current||(bt(!0),requestAnimationFrame(()=>{!ke.current&&!lt.current&&wn()})))});return Ue.observe(_e),()=>Ue.disconnect()},[wn,is,bt]),f.useLayoutEffect(()=>{const _e=eYe(t);if(i||r||Le.current){Be.current=_e,Se.current=!0,le.current=!1,Le.current=r;return}if(Le.current=r,!Se.current){Be.current=_e,Se.current=!0,le.current=!1;return}const Ue=tYe(t);_e&&(Ue==null?void 0:Ue.role)==="user"&&_e!==Be.current?(lt.current=!1,bt(!0),bs.current=null,le.current=!0):le.current=!1,Be.current=_e},[t,i,r,bt]),f.useLayoutEffect(()=>{at.current&&!i&&(lt.current=!1,bt(!0),wn("auto")),at.current=i},[i,wn,bt]),f.useLayoutEffect(()=>{if(r){sn.current=!0;return}if(!sn.current||i||t.length===0)return;sn.current=!1,lt.current=!1,bt(!0),bs.current=null,Cn.current!==void 0&&window.cancelAnimationFrame(Cn.current),In.current!==void 0&&window.cancelAnimationFrame(In.current);const _e=()=>{ke.current||lt.current||(bt(!0),wn("auto"))};Cn.current=window.requestAnimationFrame(()=>{Cn.current=void 0,_e(),In.current=window.requestAnimationFrame(()=>{In.current=void 0,_e()})})},[i,r,t.length,wn,bt]),f.useLayoutEffect(()=>{const _e=_t.current!==w;_t.current=w,_e&&(i||lt.current||(bt(!0),requestAnimationFrame(()=>{!ke.current&&!lt.current&&wn("auto")})))},[w,i,wn,bt]);const rt=f.useMemo(()=>xYe(It),[It]);f.useLayoutEffect(()=>{if(!i){if(!rt){Te.current=null;return}rt!==Te.current&&(Te.current=rt,(Ve.current||!lt.current)&&requestAnimationFrame(()=>{lt.current||(bt(!0),wn())}))}},[i,rt,wn,bt]),f.useEffect(()=>{y&&Zn&&!Pe.current&&(lt.current=!1,bt(!0),requestAnimationFrame(()=>{lt.current||wn()})),Pe.current=Zn},[y,Zn,wn,bt]);const Ut=f.useCallback(_e=>{const Ue=(Gt,Ls)=>{if(Gt.type==="parallel_agents")return l.jsx(J7,{timestamp:Gt.timestamp,children:l.jsx("div",{className:m9(Gt,tr)?em.flash:void 0,children:l.jsx(aKe,{agents:Gt.agents,pendingApproval:n})})});if(Gt.type==="turn_outputs")return l.jsx(DGe,{changes:Gt.changes,turnId:Gt.turnId,artifacts:Gt.artifacts,scheduledTasks:Gt.scheduledTasks,workspaceCwd:g,onOpenRequest:O,onReviewChanges:M??e8,onOpenArtifact:P??e8,onOpenScheduledTask:E??e8});if(Gt.type==="turn_collapse")return l.jsx(PYe,{turnCollapse:Gt.turnCollapse,onToggleCollapse:gs});if(Gt.type==="turn_content")return l.jsx(OYe,{collapsed:Gt.collapsed,children:Gt.items.map(es=>l.jsx("div",{className:NH(es),children:Ue(es,!1)},SH(es)))});const kn=Gt.message.role==="assistant"?Z.get(Gt.message.id):void 0;let Pn;return Gt.message.role==="assistant"&&kn&&(Pn={turnId:kn,message:{id:Gt.message.id,content:Gt.message.content,isStreaming:Gt.message.isStreaming,timestamp:Gt.message.timestamp}}),l.jsx(KWe,{message:Gt.message,pendingApproval:n,onShowContextDetail:s,workspaceCwd:g,isLatest:Ls,showRetryHint:T,onRetryClick:_,onBranchSession:C,showAssistantActions:Gt.message.role==="assistant"&&Z.has(Gt.message.id),showAssistantBranch:Gt.message.role==="assistant"&&Gt.message.id===q,isLocateFlashing:m9(Gt,tr),assistantTurnFooterInfo:Pn,generateContent:z})};if(Ge&&_e===s8)return m;if(Zn&&_e===bn)return b;const zt=_e-dt,Sn=It[zt];return Sn?Ue(Sn,zt===It.length-1):null},[Ge,m,Zn,b,bn,n,s,z,dt,It,tr,Z,q,g,T,_,C,gs,P,E,M,O]),fn=f.useCallback(_e=>_e?NH(_e):void 0,[]);return f.useLayoutEffect(()=>{if(i)return;const _e=le.current;Ae.current&&!_e||ve.current&&!_e||(Ve.current||_e||!lt.current)&&(lt.current||bt(!0),wn(_e?"smooth":"auto"),le.current=!1)},[cn,t,Ht,i,wn,bt]),f.useLayoutEffect(()=>{gt()},[t,gt,Ht,cn]),l.jsxs("div",{ref:Mt,className:x4(ns.list,Ge&&p?ns.listWithWelcomeHeader:void 0),"data-web-shell-message-list":!0,onClickCapture:Qn,children:[Ar&&l.jsx(HYe,{label:B("editor.sessionLoading")}),a&&!Ar&&l.jsx("div",{className:ns.historyStatus,role:"status",children:B("history.loadingEarlier")}),c&&!Ar&&l.jsx("div",{className:ns.historyStatus,role:"status",children:B("history.capacityReached")}),l.jsx(zYe,{entries:se,currentTurnId:J,currentRange:ue,hidden:!V||!We,onSelect:ir}),Rn?l.jsx("div",{className:ns.virtualSizer,style:{height:cn},children:hs.map(_e=>l.jsx("div",{"data-index":_e.index,ref:Qs.measureElement,className:x4(ns.virtualRow,fn(It[_e.index-dt])),"data-web-shell-message-row":!0,style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${_e.start}px)`},children:Ut(_e.index)},_e.key))}):Array.from({length:Ht},(_e,Ue)=>{const zt=Dn(Ue),Sn=It[Ue-dt];return l.jsx("div",{"data-index":Ue,className:fn(Sn),"data-web-shell-message-row":!0,children:Ut(Ue)},zt)})]})}));/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */function qYe(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 MH(e){const t=new Set,n=[];for(const s of(e==null?void 0:e.providers)??[])for(const r of s.models??[]){const i=r.baseModelId;!i||r.isRuntime||!qYe(i)||t.has(i)||(t.add(i),n.push({id:i,...r.name?{label:r.name}:{},...s.authType?{authType:s.authType}:{},...r.baseUrl?{baseUrl:r.baseUrl}:{},...typeof r.contextLimit=="number"?{contextWindow:r.contextLimit}:{},modalities:{audio:!0}}))}return n}const UYe="_editorShell_pzgsb_1",VYe="_editorShellDropdownOpen_pzgsb_7",WYe="_container_pzgsb_11",GYe="_content_pzgsb_30",KYe="_dacAura_pzgsb_46",YYe="_dacHalo_pzgsb_47",XYe="_atPortalLayer_pzgsb_188",QYe="_slashPanel_pzgsb_226",JYe="_slashPanelBody_pzgsb_235",ZYe="_slashList_pzgsb_240",eXe="_slashEntry_pzgsb_267",tXe="_slashSection_pzgsb_273",nXe="_slashSectionHeader_pzgsb_279",sXe="_slashSectionCount_pzgsb_292",rXe="_slashItem_pzgsb_300",iXe="_slashItemActive_pzgsb_326",oXe="_slashCommand_pzgsb_330",aXe="_slashDetail_pzgsb_335",lXe="_slashDetailCommand_pzgsb_345",cXe="_slashDetailText_pzgsb_355",uXe="_slashDescription_pzgsb_375",dXe="_atPanel_pzgsb_386",hXe="_atPanelHeaderWrap_pzgsb_410",fXe="_atPanelHeader_pzgsb_410",mXe="_atBackButton_pzgsb_425",pXe="_atPanelTitle_pzgsb_447",gXe="_atTabsWrap_pzgsb_456",bXe="_atTabs_pzgsb_456",yXe="_atTab_pzgsb_456",xXe="_atTabScrollButton_pzgsb_480",vXe="_atTabActive_pzgsb_512",wXe="_atSearchInput_pzgsb_523",kXe="_atList_pzgsb_542",_Xe="_atItem_pzgsb_570",SXe="_atItemActive_pzgsb_592",CXe="_atItemSingleLine_pzgsb_596",TXe="_atItemMain_pzgsb_602",EXe="_atItemLeading_pzgsb_613",AXe="_atItemIcon_pzgsb_623",NXe="_atItemImageIcon_pzgsb_634",jXe="_atItemIconSpin_pzgsb_642",MXe="_atItemLabel_pzgsb_646",IXe="_atItemSubtitle_pzgsb_647",RXe="_atItemDescription_pzgsb_674",DXe="_atItemTrailing_pzgsb_685",LXe="_atEmpty_pzgsb_692",PXe="_attachments_pzgsb_710",OXe="_tags_pzgsb_720",BXe="_tag_pzgsb_720",$Xe="_tagContent_pzgsb_743",zXe="_tagTooltip_pzgsb_751",FXe="_tagLabel_pzgsb_775",HXe="_tagValue_pzgsb_776",qXe="_tagIcon_pzgsb_780",UXe="_tagRemove_pzgsb_815",VXe="_editorArea_pzgsb_835",WXe="_shellPrefix_pzgsb_863",GXe="_toolbar_pzgsb_901",KXe="_toolbarLeading_pzgsb_911",YXe="_toolbarStart_pzgsb_912",XXe="_toolbarEnd_pzgsb_913",QXe="_toolbarLeft_pzgsb_914",JXe="_toolbarRight_pzgsb_915",ZXe="_gitBranchChip_pzgsb_939",eQe="_gitBranchChipButton_pzgsb_956",tQe="_gitBranchIcon_pzgsb_976",nQe="_gitBranchText_pzgsb_988",sQe="_gitBranchIconWrap_pzgsb_1003",rQe="_gitBranchBadgeDot_pzgsb_1011",iQe="_gitBranchIndicators_pzgsb_1030",oQe="_gitBranchDirtyDot_pzgsb_1037",aQe="_gitBranchAheadBehind_pzgsb_1045",lQe="_gitBranchStash_pzgsb_1050",cQe="_gitBranchConflicted_pzgsb_1063",uQe="_gitBranchOperation_pzgsb_1077",dQe="_gitBranchTooltip_pzgsb_1085",hQe="_gitBranchTooltipTitle_pzgsb_1091",fQe="_gitBranchTooltipRow_pzgsb_1095",mQe="_workspaceChip_pzgsb_1101",pQe="_workspaceChipAccented_pzgsb_1120",gQe="_workspaceChipIcon_pzgsb_1124",bQe="_workspaceChipText_pzgsb_1140",yQe="_toolbarRightCustom_pzgsb_1152",xQe="_toolbarMeasurements_pzgsb_1158",vQe="_dropdownWrapper_pzgsb_1169",wQe="_dropdownWrapperCompact_pzgsb_1173",kQe="_dropdownList_pzgsb_1178",_Qe="_dropdownListConstrained_pzgsb_1188",SQe="_dropdownEmpty_pzgsb_1192",CQe="_dropdownItem_pzgsb_1199",TQe="_dropdownRich_pzgsb_1216",EQe="_dropdownCheck_pzgsb_1225",AQe="_dropdownItemActive_pzgsb_1237",NQe="_dropdownItemIcon_pzgsb_1242",jQe="_dropdownItemCheck_pzgsb_1243",MQe="_dropdownItemContent_pzgsb_1260",IQe="_dropdownItemLabel_pzgsb_1267",RQe="_dropdownItemDesc_pzgsb_1277",DQe="_toolBtn_pzgsb_1291",LQe="_modeToolBtn_pzgsb_1309",PQe="_modelToolBtn_pzgsb_1310",OQe="_workspaceSelectTrigger_pzgsb_1319",BQe="_workspaceSelectTooltipTrigger_pzgsb_1337",$Qe="_gitBranchChipCompact_pzgsb_1354",zQe="_workspaceChipCompact_pzgsb_1355",FQe="_workspaceSelectTriggerCompact_pzgsb_1356",HQe="_toolBtnCompact_pzgsb_1357",qQe="_workspaceSelectTooltipTriggerCompact_pzgsb_1367",UQe="_toolBtnText_pzgsb_1377",VQe="_toolBtnArrow_pzgsb_1378",WQe="_toolBtnIcon_pzgsb_1405",GQe="_widthModeBtn_pzgsb_1421",KQe="_quickActionsBtn_pzgsb_1430",YQe="_toolBtnModeIcon_pzgsb_1439",XQe="_toolBtnModelIcon_pzgsb_1440",QQe="_quickActionsPanel_pzgsb_1486",JQe="_quickActionsHeader_pzgsb_1499",ZQe="_quickActionsLayout_pzgsb_1506",eJe="_quickActionsGrid_pzgsb_1513",tJe="_quickAction_pzgsb_1430",nJe="_quickActionLabel_pzgsb_1544",sJe="_quickKeysGrid_pzgsb_1559",rJe="_quickKey_pzgsb_1559",iJe="_quickKeyLabel_pzgsb_1588",oJe="_sendBtn_pzgsb_1601",aJe="_sendBtnRunning_pzgsb_1639",lJe="_sendIcon_pzgsb_1652",cJe="_stopIcon_pzgsb_1658",uJe="_loadingIcon_pzgsb_1665",dJe="_sendBtnArmed_pzgsb_1677",hJe="_escLabel_pzgsb_1745",fJe="_srOnly_pzgsb_1753",mJe="_images_pzgsb_1775",pJe="_imageThumb_pzgsb_1783",gJe="_imageRemove_pzgsb_1798",bJe="_searchPanel_pzgsb_1819",yJe="_searchBar_pzgsb_1836",xJe="_searchLabel_pzgsb_1844",vJe="_searchInput_pzgsb_1849",wJe="_searchResults_pzgsb_1863",kJe="_searchResult_pzgsb_1863",_Je="_searchResultActive_pzgsb_1896",SJe="_searchResultMarker_pzgsb_1901",CJe="_searchResultText_pzgsb_1906",TJe="_searchEmpty_pzgsb_1913",ge={editorShell:UYe,editorShellDropdownOpen:VYe,container:WYe,content:GYe,dacAura:KYe,dacHalo:YYe,atPortalLayer:XYe,slashPanel:QYe,slashPanelBody:JYe,slashList:ZYe,slashEntry:eXe,slashSection:tXe,slashSectionHeader:nXe,slashSectionCount:sXe,slashItem:rXe,slashItemActive:iXe,slashCommand:oXe,slashDetail:aXe,slashDetailCommand:lXe,slashDetailText:cXe,slashDescription:uXe,atPanel:dXe,atPanelHeaderWrap:hXe,atPanelHeader:fXe,atBackButton:mXe,atPanelTitle:pXe,atTabsWrap:gXe,atTabs:bXe,atTab:yXe,atTabScrollButton:xXe,atTabActive:vXe,atSearchInput:wXe,atList:kXe,atItem:_Xe,atItemActive:SXe,atItemSingleLine:CXe,atItemMain:TXe,atItemLeading:EXe,atItemIcon:AXe,atItemImageIcon:NXe,atItemIconSpin:jXe,atItemLabel:MXe,atItemSubtitle:IXe,atItemDescription:RXe,atItemTrailing:DXe,atEmpty:LXe,attachments:PXe,tags:OXe,tag:BXe,tagContent:$Xe,tagTooltip:zXe,tagLabel:FXe,tagValue:HXe,tagIcon:qXe,tagRemove:UXe,editorArea:VXe,shellPrefix:WXe,toolbar:GXe,toolbarLeading:KXe,toolbarStart:YXe,toolbarEnd:XXe,toolbarLeft:QXe,toolbarRight:JXe,gitBranchChip:ZXe,gitBranchChipButton:eQe,gitBranchIcon:tQe,gitBranchText:nQe,gitBranchIconWrap:sQe,gitBranchBadgeDot:rQe,gitBranchIndicators:iQe,gitBranchDirtyDot:oQe,gitBranchAheadBehind:aQe,gitBranchStash:lQe,gitBranchConflicted:cQe,gitBranchOperation:uQe,gitBranchTooltip:dQe,gitBranchTooltipTitle:hQe,gitBranchTooltipRow:fQe,workspaceChip:mQe,workspaceChipAccented:pQe,workspaceChipIcon:gQe,workspaceChipText:bQe,toolbarRightCustom:yQe,toolbarMeasurements:xQe,dropdownWrapper:vQe,dropdownWrapperCompact:wQe,dropdownList:kQe,dropdownListConstrained:_Qe,dropdownEmpty:SQe,dropdownItem:CQe,dropdownRich:TQe,dropdownCheck:EQe,dropdownItemActive:AQe,dropdownItemIcon:NQe,dropdownItemCheck:jQe,dropdownItemContent:MQe,dropdownItemLabel:IQe,dropdownItemDesc:RQe,toolBtn:DQe,modeToolBtn:LQe,modelToolBtn:PQe,workspaceSelectTrigger:OQe,workspaceSelectTooltipTrigger:BQe,gitBranchChipCompact:$Qe,workspaceChipCompact:zQe,workspaceSelectTriggerCompact:FQe,toolBtnCompact:HQe,workspaceSelectTooltipTriggerCompact:qQe,toolBtnText:UQe,toolBtnArrow:VQe,toolBtnIcon:WQe,widthModeBtn:GQe,quickActionsBtn:KQe,toolBtnModeIcon:YQe,toolBtnModelIcon:XQe,quickActionsPanel:QQe,quickActionsHeader:JQe,quickActionsLayout:ZQe,quickActionsGrid:eJe,quickAction:tJe,quickActionLabel:nJe,quickKeysGrid:sJe,quickKey:rJe,quickKeyLabel:iJe,sendBtn:oJe,sendBtnRunning:aJe,sendIcon:lJe,stopIcon:cJe,loadingIcon:uJe,sendBtnArmed:dJe,escLabel:hJe,srOnly:fJe,images:mJe,imageThumb:pJe,imageRemove:gJe,searchPanel:bJe,searchBar:yJe,searchLabel:xJe,searchInput:vJe,searchResults:wJe,searchResult:kJe,searchResultActive:_Je,searchResultMarker:SJe,searchResultText:CJe,searchEmpty:TJe},EJe=["--chat-editor-accent-color","--chat-editor-text-primary","--accent","--background","--foreground","--muted-foreground","--chat-editor-border-color","--font-sans"];function AJe({menu:e,anchorRef:t,panelRef:n,onSelect:s,onAccept:r,onBack:i,onSearch:o,onSelectTab:a}){const c=oh(),{t:u}=ot(),d=f.useRef([]),h=f.useRef(null),m=f.useRef(null),[p,g]=f.useState(null),[b,v]=f.useState({});f.useEffect(()=>{var S;(S=d.current[e.selectedIndex])==null||S.scrollIntoView({block:"nearest"})},[e.level,e.selectedIndex]),f.useEffect(()=>{if(e.level!=="items"||e.inputMode!=="search"||document.activeElement===h.current)return;const S=()=>{var $;return($=h.current)==null?void 0:$.focus()},L=window.requestAnimationFrame(S),N=window.setTimeout(S,0);return()=>{window.cancelAnimationFrame(L),window.clearTimeout(N)}},[e.inputMode,e.level,e.selectedProviderId]),f.useLayoutEffect(()=>{const S=t.current;if(!S)return;const L=getComputedStyle(S);v(Object.fromEntries(EJe.map(N=>[N,L.getPropertyValue(N)])))},[t]),f.useLayoutEffect(()=>{const S=t.current;if(!S)return;let L=null;const N=()=>{var W;const P=S.getBoundingClientRect(),E=((W=n.current)==null?void 0:W.offsetWidth)??360,O=getComputedStyle(S),z=Number.parseFloat(O.getPropertyValue("--web-shell-popover-safe-top"))||48,F=Math.max(96,Math.min(300,P.top-z-8)),B={left:Math.max(12,Math.min(P.left+16,window.innerWidth-E-12)),bottom:window.innerHeight-P.top+8,width:P.width,maxHeight:F};g(I=>I&&I.left===B.left&&I.bottom===B.bottom&&I.width===B.width&&I.maxHeight===B.maxHeight?I:B)},$=()=>{L===null&&(L=window.requestAnimationFrame(()=>{L=null,N()}))};N();const M=new ResizeObserver($);return M.observe(S),window.addEventListener("resize",$),window.addEventListener("scroll",$,!0),()=>{L!==null&&window.cancelAnimationFrame(L),M.disconnect(),window.removeEventListener("resize",$),window.removeEventListener("scroll",$,!0)}},[t,n]);const x=e.level==="categories"?e.providers.map(S=>({id:S.id,label:S.label,labelTitle:S.textValue,description:S.description,trailing:"›",provider:S})):e.items.map(S=>({id:S.id,label:S.label,labelTitle:S.label,subtitle:S.subtitle,description:e.selectedProviderId===Ao?void 0:S.description??S.detail,icon:S.icon,iconMode:S.iconMode,iconColor:S.iconColor,iconSpin:S.iconSpin,iconTooltip:S.iconTooltip,trailing:S.kind==="directory"||S.kind==="mcp-server"?"›":"",item:S}));if(f.useEffect(()=>{d.current.length=x.length},[x.length]),!p)return null;const y=e.providers.find(S=>S.id===e.selectedProviderId),w=e.itemMode==="mcpResources"&&e.mcpServerName?Er(e.mcpServerName)??"[invalid]":(y==null?void 0:y.label)??"",k=e.itemMode==="mcpResources"&&e.mcpServerName?Er(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"),_="at-mention-listbox",C=e.selectedIndex>=0&&e.selectedIndex<x.length?`at-mention-option-${e.selectedIndex}`:void 0;return $u.createPortal(l.jsx("div",{className:ge.atPortalLayer,style:b,children:l.jsxs("div",{ref:n,className:ge.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:S=>{S.target instanceof HTMLInputElement||S.preventDefault()},children:[e.level==="items"&&l.jsxs("div",{className:ge.atPanelHeaderWrap,children:[l.jsxs("div",{className:ge.atPanelHeader,children:[l.jsx("button",{type:"button",className:ge.atBackButton,"aria-label":u("common.back"),onMouseDown:S=>{S.preventDefault(),S.stopPropagation()},onClick:S=>{S.preventDefault(),S.stopPropagation(),i()},children:"‹"}),l.jsx("span",{className:ge.atPanelTitle,title:k,children:w})]}),l.jsx("input",{ref:h,className:ge.atSearchInput,value:e.query,placeholder:u("common.search"),"aria-label":u("common.search"),"aria-controls":_,"aria-activedescendant":C,onMouseDown:S=>S.stopPropagation(),onClick:S=>S.stopPropagation(),onChange:S=>o(S.currentTarget.value),onKeyDown:S=>{if(!(S.nativeEvent.isComposing||S.nativeEvent.keyCode===229)){if(S.key==="Escape")S.preventDefault(),S.stopPropagation(),i();else if(S.key==="Enter")S.preventDefault(),S.stopPropagation(),r();else if(S.key==="Tab"&&!S.shiftKey&&!S.altKey&&!S.ctrlKey&&!S.metaKey)S.preventDefault(),S.stopPropagation(),r();else if(S.key==="ArrowUp"){if(S.preventDefault(),S.stopPropagation(),x.length===0)return;s(Math.max(0,e.selectedIndex-1))}else if(S.key==="ArrowDown"){if(S.preventDefault(),S.stopPropagation(),x.length===0)return;s(Math.min(x.length-1,e.selectedIndex+1))}}}}),e.tabs&&e.tabs.length>0&&l.jsxs("div",{className:ge.atTabsWrap,children:[l.jsx("button",{type:"button",className:ge.atTabScrollButton,"aria-label":"Previous tab",onClick:S=>{S.preventDefault(),S.stopPropagation(),IH(m.current,"previous")},children:"‹"}),l.jsx("div",{ref:m,className:ge.atTabs,role:"tablist",children:e.tabs.map(S=>{const L=S.id===e.selectedTabId,N=S.textValue??(typeof S.label=="string"?S.label:S.id);return l.jsx("button",{type:"button",role:"tab","aria-selected":L,disabled:S.disabled,className:`${ge.atTab} ${L?ge.atTabActive:""}`,title:N,onClick:$=>{$.preventDefault(),$.stopPropagation(),a(S.id)},children:S.label},S.id)})}),l.jsx("button",{type:"button",className:ge.atTabScrollButton,"aria-label":"Next tab",onClick:S=>{S.preventDefault(),S.stopPropagation(),IH(m.current,"next")},children:"›"})]})]}),l.jsx("div",{id:_,className:ge.atList,role:x.length>0?"listbox":void 0,"aria-label":x.length>0?T:void 0,children:e.loading&&x.length===0?l.jsx("div",{className:ge.atEmpty,role:"status","aria-live":"polite",children:u("common.loading")}):x.length===0?l.jsx("div",{className:ge.atEmpty,role:"status","aria-live":"polite",children:u("common.noResults")}):x.map((S,L)=>{const N=L===e.selectedIndex,$="item"in S?y==null?void 0:y.provider:S.provider.provider;let M;if("item"in S&&($!=null&&$.renderItem))try{M=$.renderItem({item:S.item,provider:$,selected:N})}catch(E){console.warn("[WebShell] at mention item render failed",E)}const P="icon"in S&&S.icon&&tb(S.icon)?S.icon:void 0;return l.jsxs("button",{ref:E=>{d.current[L]=E},type:"button",id:`at-mention-option-${L}`,role:"option","aria-selected":N,className:`${ge.atItem} ${N?ge.atItemActive:""} ${S.description?"":ge.atItemSingleLine}`,style:{"--at-item-main-template":NJe(jJe(S.label,S.labelTitle),"subtitle"in S?S.subtitle:void 0)},onMouseEnter:()=>s(L),onMouseDown:E=>{E.preventDefault(),E.stopPropagation()},onClick:E=>{E.preventDefault(),E.stopPropagation(),r(L)},children:[M??l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:ge.atItemMain,children:[l.jsxs("span",{className:ge.atItemLeading,children:["icon"in S&&P&&(S.iconMode==="image"?l.jsx("img",{className:ge.atItemImageIcon,src:P,title:S.iconTooltip,alt:"","aria-hidden":"true"}):l.jsx("span",{className:`${ge.atItemIcon} ${S.iconSpin?ge.atItemIconSpin:""}`,style:{...cf("--at-item-icon-url",P),color:S.iconColor},title:S.iconTooltip,"aria-hidden":"true"})),l.jsx("span",{className:ge.atItemLabel,title:S.labelTitle,children:S.label})]}),"subtitle"in S&&S.subtitle&&l.jsx("span",{className:ge.atItemSubtitle,title:S.subtitle,children:S.subtitle})]}),S.description&&l.jsx("span",{className:ge.atItemDescription,title:S.description,children:S.description})]}),S.trailing&&l.jsx("span",{className:ge.atItemTrailing,"aria-hidden":"true",children:S.trailing})]},S.id)})})]})}),c??document.body)}function IH(e,t){if(!e)return;const n=Math.max(96,e.clientWidth*.75);e.scrollBy({left:t==="previous"?-n:n,behavior:"smooth"})}function NJe(e,t){if(!t)return"minmax(0, 1fr)";const n=RH(e);return RH(t)<=12?"minmax(0, 1fr) max-content":n<=18?"max-content minmax(0, 1fr)":"minmax(0, 3fr) minmax(0, 2fr)"}function jJe(e,t){return typeof e=="string"?e:typeof e=="number"?String(e):t||""}function RH(e){return Array.from(e).reduce((t,n)=>t+(n.charCodeAt(0)>255?2:1),0)}const MJe="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",IJe="/assets/default-aEtf0G7-.svg",Pie="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",RJe="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",DJe="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",LJe="_icon_i7y0u_1",PJe={icon:LJe},OJe={auto:MJe,"auto-edit":Pie,default:IJe,plan:RJe,yolo:DJe};function Ey({mode:e}){const t=OJe[e];return t?l.jsx("span",{className:PJe.icon,style:cf("--mode-icon-url",t),"aria-hidden":"true"}):l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:l.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 BJe(e,t){const n=new Map;if(t==="command")for(const r of e)r.section&&n.set(r.section,(n.get(r.section)??0)+1);let s;return e.map((r,i)=>{const o=r.section,a=t==="command"&&o!==void 0&&o!==s,c=a&&i>0;return s=o??s,{showHeader:a,showDivider:c,count:a&&o?n.get(o)??0:0}})}function uf(e){return e.replace(/\([^()]+\)$/,"")}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const a8=16e3,$Je=4096,DH=6e4;function zJe(e){const t=new URL(e),n=t.pathname.replace(/\/?$/,"/"),s=new URL("voice/stream",`${t.origin}${n}`);return s.protocol=s.protocol==="https:"?"wss:":"ws:",s.toString()}const FJe="qwen-bearer.",HJe="qwen-ws";function qJe(e){const t=new TextEncoder().encode(e);let n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);const s=btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`${FJe}${s}`}function UJe(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 VJe(e){const t=new Int16Array(e.length);let n=0;for(let s=0;s<e.length;s++){let r=e[s];r>1?r=1:r<-1&&(r=-1),t[s]=r<0?r*32768:r*32767,n+=r*r}return{pcm:t.buffer,level:e.length?Math.sqrt(n/e.length):0}}function WJe(e){const{baseUrl:t,token:n,onFinal:s,onError:r}=e,[i,o]=f.useState("idle"),[a,c]=f.useState(""),[u,d]=f.useState(0),[h,m]=f.useState(void 0),p=f.useRef({}),g=f.useRef(!0),b=f.useRef(0),v=f.useRef("idle"),x=f.useRef(s);x.current=s;const y=f.useRef(r);y.current=r;const w=f.useCallback(M=>{v.current=M,o(M)},[]),k=f.useCallback(()=>{const M=p.current;M.transcribeTimeout&&(clearTimeout(M.transcribeTimeout),M.transcribeTimeout=void 0)},[]),T=f.useCallback(()=>{var P;const M=p.current;M.processor&&(M.processor.onaudioprocess=null);for(const E of[M.processor,M.source,M.sink])try{E==null||E.disconnect()}catch{}(P=M.stream)==null||P.getTracks().forEach(E=>E.stop()),M.context&&M.context.state!=="closed"&&M.context.close().catch(()=>{}),M.processor=void 0,M.sink=void 0,M.source=void 0,M.stream=void 0,M.context=void 0},[]),_=f.useCallback(()=>{b.current++,T();const M=p.current;if(k(),M.ws){try{M.ws.onmessage=null,M.ws.onerror=null,M.ws.onclose=null,M.ws.close()}catch{}M.ws=void 0}},[T,k]),C=f.useCallback((M,P)=>{var E;!g.current||P!==void 0&&b.current!==P||(_(),w("error"),c(""),d(0),m(M),(E=y.current)==null||E.call(y,M))},[_,w]),S=f.useCallback((M,P)=>{P!==void 0&&b.current!==P||(_(),g.current&&(w("idle"),c(""),d(0),x.current(M)))},[_,w]),L=f.useCallback(()=>{if(v.current!=="idle"&&v.current!=="error")return;m(void 0),c(""),w("connecting");const M=++b.current,P=()=>!g.current||b.current!==M;(async()=>{var E;try{if(!((E=navigator.mediaDevices)!=null&&E.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 O;try{O=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}})}catch(Y){throw new Error(UJe(Y))}if(P()){O.getTracks().forEach(Y=>Y.stop());return}p.current.stream=O;const z=new AudioContext({sampleRate:a8});if(z.sampleRate!==a8)throw O.getTracks().forEach(Y=>Y.stop()),z.close().catch(()=>{}),new Error(`Browser audio rate ${z.sampleRate} Hz is not the required ${a8} Hz.`);if(p.current.context=z,z.state==="suspended"&&await z.resume(),P()){O.getTracks().forEach(Y=>Y.stop()),z.close().catch(()=>{});return}const F=z.createMediaStreamSource(O),B=z.createScriptProcessor($Je,1,1),W=z.createGain();W.gain.value=0,p.current.source=F,p.current.processor=B,p.current.sink=W;const I=new WebSocket(zJe(t),n?[HJe,qJe(n)]:void 0);I.binaryType="arraybuffer",p.current.ws=I,B.onaudioprocess=Y=>{const{pcm:V,level:j}=VJe(Y.inputBuffer.getChannelData(0));g.current&&d(j),I.readyState===WebSocket.OPEN&&I.send(V)},I.onopen=()=>{if(P()){B.onaudioprocess=null;for(const V of[B,F,W])try{V.disconnect()}catch{}O.getTracks().forEach(V=>V.stop()),z.state!=="closed"&&z.close().catch(()=>{});const Y=p.current;Y.ws===I&&(Y.ws=void 0),Y.processor===B&&(Y.processor=void 0),Y.source===F&&(Y.source=void 0),Y.sink===W&&(Y.sink=void 0),Y.stream===O&&(Y.stream=void 0),Y.context===z&&(Y.context=void 0);try{I.close()}catch{}return}I.send(JSON.stringify({type:"start"})),F.connect(B),B.connect(W),W.connect(z.destination),k(),p.current.transcribeTimeout=setTimeout(()=>{v.current==="recording"&&C("No response from server. Check that the voice model is running.",M)},DH),g.current&&w("recording")},I.onmessage=Y=>{(v.current==="connecting"||v.current==="recording")&&k();let V;try{V=JSON.parse(String(Y.data))}catch{return}V.type==="interim"?g.current&&c(V.text??""):V.type==="final"?S(V.text??"",M):V.type==="error"&&C(V.message??V.text??"Voice transcription failed.",M)},I.onerror=()=>{},I.onclose=Y=>{if(g.current&&(v.current==="recording"||v.current==="connecting"||v.current==="transcribing")){const V=Y.code||1006,j=Y.reason||"none";C(`Voice connection closed (code=${V}, reason=${j}).`,M)}}}catch(O){C(O instanceof Error?O.message:String(O),M)}})()},[t,n,C,S,w,k]),N=f.useCallback(()=>{const M=p.current.ws;if(!M||M.readyState!==WebSocket.OPEN){_(),w("idle");return}T(),d(0),w("transcribing");const P=b.current;try{M.send(JSON.stringify({type:"stop"})),k(),p.current.transcribeTimeout=setTimeout(()=>{v.current==="transcribing"&&C("Transcription timed out.",P)},DH)}catch{C("Failed to finalize voice transcription.",P)}},[_,T,C,w,k]),$=f.useCallback(()=>{const M=p.current.ws;if(M&&M.readyState===WebSocket.OPEN)try{M.send(JSON.stringify({type:"abort"}))}catch{}_(),w("idle"),c(""),d(0)},[_,w]);return f.useEffect(()=>(g.current=!0,()=>{g.current=!1,_()}),[_]),{status:i,interimText:a,audioLevel:u,errorMessage:h,start:L,stop:N,abort:$}}const GJe="_root_9hwm9_7",KJe="_iconBtn_9hwm9_14",YJe="_error_9hwm9_47",XJe="_connecting_9hwm9_51",QJe="_pill_9hwm9_56",JJe="_transcribing_9hwm9_75",ZJe="_recDot_9hwm9_79",eZe="_wave_9hwm9_88",tZe="_bar_9hwm9_95",nZe="_time_9hwm9_103",sZe="_stop_9hwm9_111",rZe="_spinner_9hwm9_118",iZe="_interim_9hwm9_128",Xo={root:GJe,iconBtn:KJe,error:YJe,connecting:XJe,pill:QJe,transcribing:JJe,recDot:ZJe,wave:eZe,bar:tZe,time:nZe,stop:sZe,spinner:rZe,interim:iZe},oZe="voice_transcribe",LH=16,aZe=()=>l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:[l.jsx("path",{d:"M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3Z"}),l.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"})]}),lZe=()=>l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:l.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})});function cZe(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),s=String(t%60).padStart(2,"0");return`${n}:${s}`}function uZe({onInsert:e,disabled:t}){var F,B;const n=ol(),s=(F=qu())==null?void 0:F.settingsVersion,{t:r}=ot(),o=(((B=n.capabilities)==null?void 0:B.features)??[]).includes(oZe),[a,c]=f.useState(()=>({client:n.client,settingsVersion:s,enabled:!1}));f.useEffect(()=>{let W=!0;if(c({client:n.client,settingsVersion:s,enabled:!1}),!!o)return n.client.workspaceVoice().then(I=>{W&&c({client:n.client,settingsVersion:s,enabled:I.enabled===!0})}).catch(()=>{}),()=>{W=!1}},[o,s,n.client]);const u=o&&a.client===n.client&&a.settingsVersion===s&&a.enabled,[d,h]=f.useState(void 0),{status:m,interimText:p,audioLevel:g,errorMessage:b,start:v,stop:x,abort:y}=WJe({baseUrl:n.baseUrl,token:n.token,onFinal:W=>{const I=W.trim();I?(h(void 0),e(I)):h(r("voice.noSpeech"))}}),w=m==="recording",[k,T]=f.useState(()=>new Array(LH).fill(0));f.useEffect(()=>{if(!w){T(new Array(LH).fill(0));return}T(W=>[...W.slice(1),Math.min(1,g*8)])},[g,w]);const[_,C]=f.useState(0);f.useEffect(()=>{if(!w){C(0);return}const W=performance.now(),I=setInterval(()=>C(performance.now()-W),200);return()=>clearInterval(I)},[w]);const S=f.useRef(u);if(f.useEffect(()=>{const W=S.current;S.current=u,W&&!u&&(m==="recording"||m==="connecting"||m==="transcribing")&&y()},[y,m,u]),!u)return null;const L=m==="connecting",N=m==="transcribing",$=m==="error",M=!!d&&!$,P=w||L,E=w?r("voice.stopDictation"):N?r("voice.transcribing"):L?r("voice.starting"):$?r("voice.errorRetry",{message:b??""}):r(M?"voice.noSpeechRetry":"voice.startDictation");let O;if(w)O=l.jsxs("button",{type:"button",className:Xo.pill,onClick:()=>x(),"aria-label":E,title:E,children:[l.jsx("span",{className:Xo.recDot,"aria-hidden":"true"}),l.jsx("span",{className:Xo.wave,"aria-hidden":"true",children:k.map((W,I)=>l.jsx("span",{className:Xo.bar,style:{height:`${2+Math.round(W*14)}px`}},I))}),l.jsx("span",{className:Xo.time,children:cZe(_)}),l.jsx("span",{className:Xo.stop,"aria-hidden":"true",children:l.jsx(lZe,{})})]});else if(N)O=l.jsxs("span",{className:`${Xo.pill} ${Xo.transcribing}`,role:"status","aria-label":E,children:[l.jsx("span",{className:Xo.spinner,"aria-hidden":"true"}),l.jsx("span",{className:Xo.time,children:"…"})]});else{const W=[Xo.iconBtn,$?Xo.error:"",L?Xo.connecting:""].filter(Boolean).join(" ");O=l.jsx("button",{type:"button",className:W,onClick:()=>{if(L)y();else{if(t)return;h(void 0),v()}},disabled:!!t&&!P,"aria-label":E,title:b??d??E,children:l.jsx(aZe,{})})}const z=w&&p||$||M;return l.jsxs("span",{className:Xo.root,children:[O,z&&l.jsx("span",{role:"status","aria-live":"polite",className:`${Xo.interim}${$?` ${Xo.error}`:""}`,children:$?b||r("voice.error"):M?d:p})]})}function ob({delayDuration:e=0,...t}){return l.jsx(ste,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function ab({...e}){return l.jsx(rte,{"data-slot":"tooltip",...e})}function lb({...e}){return l.jsx(ite,{"data-slot":"tooltip-trigger",...e})}function cb({className:e,sideOffset:t=0,children:n,...s}){const r=oh();return l.jsx(ote,{container:r??void 0,children:l.jsxs(ate,{"data-slot":"tooltip-content",sideOffset:t,className:Wt("z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md border border-border bg-popover px-3 py-1.5 text-xs text-popover-foreground 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),...s,children:[n,l.jsx(pEe,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] fill-popover"})]})})}function dZe(){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[l.jsx("circle",{cx:"6",cy:"5",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),l.jsx("circle",{cx:"18",cy:"6",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),l.jsx("circle",{cx:"6",cy:"19",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),l.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 Oie(e){const t=(e==null?void 0:e.staged)??0,n=(e==null?void 0:e.unstaged)??0,s=(e==null?void 0:e.untracked)??0,r=(e==null?void 0:e.conflicted)??0;return{detached:(e==null?void 0:e.detached)??!1,staged:t,unstaged:n,untracked:s,conflicted:r,ahead:(e==null?void 0:e.ahead)??0,behind:(e==null?void 0:e.behind)??0,stashCount:(e==null?void 0:e.stashCount)??0,operation:e==null?void 0:e.operation,dirty:t+n+s+r>0}}function hZe(e){return e.conflicted>0?"error":e.operation||e.detached?"warning":e.dirty?"accent":null}function p9({branch:e,status:t,compact:n,worktree:s=!1}){const{t:r}=ot(),i=Oie(t),o=hZe(i);return l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:ge.gitBranchIconWrap,children:[l.jsx("span",{className:ge.gitBranchIcon,children:s?l.jsx(tS,{size:14,strokeWidth:1.5}):i.detached?l.jsx(vpe,{}):l.jsx(dZe,{})}),n&&o&&l.jsx("span",{className:ge.gitBranchBadgeDot,"data-tone":o,"aria-hidden":"true"})]}),l.jsx("span",{className:ge.gitBranchText,children:e}),!n&&l.jsxs("span",{className:ge.gitBranchIndicators,"aria-hidden":"true",children:[i.operation&&l.jsx("span",{className:ge.gitBranchOperation,children:r(`git.operation.${i.operation}`)}),i.conflicted>0&&l.jsxs("span",{className:ge.gitBranchConflicted,children:[l.jsx(N0e,{}),i.conflicted]}),i.dirty&&l.jsx("span",{className:ge.gitBranchDirtyDot}),i.ahead>0&&l.jsxs("span",{className:ge.gitBranchAheadBehind,children:["↑",i.ahead]}),i.behind>0&&l.jsxs("span",{className:ge.gitBranchAheadBehind,children:["↓",i.behind]}),i.stashCount>0&&l.jsxs("span",{className:ge.gitBranchStash,children:[l.jsx(Upe,{}),i.stashCount]})]})]})}function Bie({branch:e,status:t,compact:n=!1,onOpenDiff:s,worktree:r=!1}){const{t:i}=ot(),o=Oie(t),a=[];o.operation&&a.push(i(`git.operation.${o.operation}`)),o.detached&&a.push(i("git.detached")),o.conflicted>0&&a.push(i("git.conflicted",{count:o.conflicted})),o.staged>0&&a.push(i("git.staged",{count:o.staged})),o.unstaged>0&&a.push(i("git.unstaged",{count:o.unstaged})),o.untracked>0&&a.push(i("git.untracked",{count:o.untracked})),o.ahead>0&&a.push(i("git.ahead",{count:o.ahead})),o.behind>0&&a.push(i("git.behind",{count:o.behind})),o.stashCount>0&&a.push(i("git.stash",{count:o.stashCount}));const c=a.length>0?`${i("git.currentBranch",{branch:e})} — ${a.join(", ")}`:(t==null?void 0:t.computedAt)!==void 0?`${i("git.currentBranch",{branch:e})} — ${i("git.clean")}`:i("git.currentBranch",{branch:e}),u=`${ge.gitBranchChip} ${n?ge.gitBranchChipCompact:""} ${s?ge.gitBranchChipButton:""}`,d={"data-web-shell-git-branch":!0,"data-detached":o.detached?"true":void 0,"data-dirty":o.dirty?"true":void 0,"data-operation":o.operation??void 0,"data-clickable":s?"true":void 0,"data-worktree":r?"true":void 0},h=l.jsx(p9,{branch:e,status:t,compact:n,worktree:r});return l.jsx(ob,{delayDuration:300,children:l.jsxs(ab,{children:[l.jsx(lb,{asChild:!0,children:s?l.jsx("button",{type:"button",className:u,"aria-label":c,onClick:s,...d,children:h}):l.jsx("output",{className:u,"aria-label":c,...d,children:h})}),l.jsx(cb,{side:"top",children:l.jsxs("div",{className:ge.gitBranchTooltip,children:[l.jsx("div",{className:ge.gitBranchTooltipTitle,children:o.detached?`${i("git.detached")} (${e})`:e}),a.length>0?a.map(m=>l.jsx("div",{className:ge.gitBranchTooltipRow,children:m},m)):(t==null?void 0:t.computedAt)!==void 0?l.jsx("div",{className:ge.gitBranchTooltipRow,children:i("git.clean")}):null]})})]})})}const fZe="_red_179c6_21",mZe="_orange_179c6_24",pZe="_yellow_179c6_27",gZe="_green_179c6_30",bZe="_blue_179c6_33",yZe="_purple_179c6_36",JI={red:fZe,orange:mZe,yellow:pZe,green:gZe,blue:bZe,purple:yZe};function xZe(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:l.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 vZe({name:e,title:t,ariaLabel:n,color:s,compact:r=!1}){const i=[ge.workspaceChip,r?ge.workspaceChipCompact:"",s?JI[s]:"",s?ge.workspaceChipAccented:""].filter(Boolean).join(" ");return l.jsx(ob,{delayDuration:300,children:l.jsxs(ab,{children:[l.jsx(lb,{asChild:!0,children:l.jsxs("output",{className:i,"aria-label":n,"data-web-shell-workspace":!0,"data-web-shell-workspace-title":t,children:[l.jsx("span",{className:ge.workspaceChipIcon,children:l.jsx(xZe,{})}),l.jsx("span",{className:ge.workspaceChipText,children:e})]})}),l.jsx(cb,{side:"top",children:t})]})})}function wZe(e,t){const n=t.trim().toLocaleLowerCase();return n?e.filter(s=>`${s.label}
${s.searchText??""}`.toLocaleLowerCase().includes(n)):[...e]}function PH({availableWidth:e,items:t}){const n=Object.fromEntries(t.map(r=>[r.id,r.ready!==!1]));let s=t.reduce((r,i)=>r+(n[i.id]?i.expansionWidth:0),0);for(const r of t){if(s<=e)break;n[r.id]&&(n[r.id]=!1,s-=r.expansionWidth)}return n}function kZe({availableWidth:e,items:t,currentVisibility:n,expansionMargin:s}){const r=PH({availableWidth:e,items:t}),i=PH({availableWidth:Math.max(0,e-s),items:t});return Object.fromEntries(t.map(o=>[o.id,n[o.id]?r[o.id]:i[o.id]]))}function _Ze({toolbarWidth:e,leadingWidth:t,rightWidth:n,currentExpansionWidth:s,gap:r}){const i=Math.max(0,t-s);return Math.max(0,e-n-i-r)}function SZe({currentModelLabel:e,lastConfirmedModelLabel:t}){const n=e||t;return{modelLabel:n,modelLabelReady:!!n,nextConfirmedModelLabel:n}}const CZe=["approvalMode","gitBranch","model","widthMode","voice","workspace"],TZe=new Set(CZe),EZe={"&":{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 OH(){return typeof window>"u"?!1:typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches}function AZe({tag:e,content:t,tooltip:n,onActivate:s,onRemove:r}){const i=f.useRef(null),o=oh(),a=n!=null,c=l.jsx("span",{className:ge.tagContent,"data-web-shell-composer-tag-trigger":!0,role:s?"button":void 0,tabIndex:s||a?0:void 0,onClick:d=>{var h;s&&(d.stopPropagation(),s(((h=i.current)==null?void 0:h.getBoundingClientRect())??d.currentTarget.getBoundingClientRect()))},onKeyDown:d=>{var h;s&&(d.key!=="Enter"&&d.key!==" "||(d.preventDefault(),s(((h=i.current)==null?void 0:h.getBoundingClientRect())??d.currentTarget.getBoundingClientRect())))},children:t}),u=l.jsxs("span",{ref:i,className:ge.tag,"data-web-shell-composer-tag":!0,children:[a?l.jsx(ite,{asChild:!0,children:c}):c,r&&l.jsx("button",{type:"button",className:ge.tagRemove,"aria-label":`Remove ${LI(e)}`,onMouseDown:d=>d.preventDefault(),onClick:d=>{d.stopPropagation(),r()},onKeyDown:d=>{if(d.key==="Enter"||d.key===" "){d.stopPropagation();return}d.key!=="Backspace"&&d.key!=="Delete"||(d.preventDefault(),d.stopPropagation(),r())},children:"×"})]});return a?l.jsxs(rte,{disableHoverableContent:!1,children:[u,l.jsx(ote,{container:o??void 0,children:l.jsx(ate,{className:ge.tagTooltip,"data-web-shell-composer-tag-tooltip":!0,sideOffset:6,collisionPadding:8,avoidCollisions:!0,children:n})})]}):u}function NZe(){return l.jsx("svg",{className:ge.sendIcon,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:l.jsx("path",{d:"M10 15.5v-11M5.5 9 10 4.5 14.5 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function jZe(){return l.jsx("span",{className:ge.stopIcon,"aria-hidden":"true"})}function MZe(){return l.jsx("span",{className:ge.loadingIcon,"aria-hidden":"true"})}function IZe(){return l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[7,12,17].flatMap(e=>[7,12,17].map(t=>l.jsx("circle",{cx:t,cy:e,r:"1.35",fill:"currentColor"},`${t}-${e}`)))})}function RZe(e,t){let n,s,r,i,o=0,a=0;const c=(b,v)=>{e.style.setProperty("--dac-glow-on",b.toFixed(4)),e.style.setProperty("--dac-glow-pulse",v.toFixed(4))},u=b=>{n!==void 0&&window.cancelAnimationFrame(n);const v=o,x=b-v;if(Math.abs(x)<.001){o=b,c(b,a);return}const y=performance.now(),w=k=>{const T=Math.min((k-y)/220,1);o=v+x*(1-(1-T)**2),c(o,a),n=T<1?window.requestAnimationFrame(w):void 0};n=window.requestAnimationFrame(w)},d=()=>{s!==void 0&&window.cancelAnimationFrame(s);const b=a,v=performance.now(),x=y=>{const w=Math.min((y-v)/300,1);a=b*(1-w),c(o,a),s=w<1?window.requestAnimationFrame(x):void 0};s=window.requestAnimationFrame(x)},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=()=>{s!==void 0&&window.cancelAnimationFrame(s),r!==void 0&&window.clearTimeout(r),a=1,c(o,1),r=window.setTimeout(d,100),h(!0),i!==void 0&&window.clearTimeout(i),i=window.setTimeout(()=>h(!1),650)};return t.addEventListener("focus",m),t.addEventListener("blur",p),t.addEventListener("keydown",g),document.activeElement===t&&u(1),()=>{n!==void 0&&window.cancelAnimationFrame(n),s!==void 0&&window.cancelAnimationFrame(s),r!==void 0&&window.clearTimeout(r),i!==void 0&&window.clearTimeout(i),t.removeEventListener("focus",m),t.removeEventListener("blur",p),t.removeEventListener("keydown",g),c(0,0),h(!1)}}function DZe({mode:e}){return e==="wide"?l.jsxs("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:[l.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)"}),l.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)"})]}):l.jsx("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:l.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 l8(){return l.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[l.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"}),l.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 LZe(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 PZe=[{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 OZe(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"m3 8.3 3.1 3.1L13 4.6",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function $ie(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 BZe(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]??$ie(e,t)}function BH({open:e,items:t,activeId:n,onOpenChange:s,onSelect:r,trigger:i,tooltip:o,showCheck:a=!1,searchable:c=!1,searchLabel:u,noResultsLabel:d}){const[h,m]=f.useState(""),[p,g]=f.useState(null),b=f.useRef(!1),v=f.useRef(!1),x=f.useRef(null),y=t.some(T=>T.description||T.icon),w=c?wZe(t,h):t;f.useEffect(()=>{e||m("")},[e]);const k=y||a;return l.jsxs(Ux,{open:e,onOpenChange:T=>{var _;T&&(b.current=!1,v.current=!1,g(((_=x.current)==null?void 0:_.closest("[data-web-shell-root]"))??null)),s(T)},children:[o?l.jsx(ob,{delayDuration:300,children:l.jsxs(ab,{children:[l.jsx(lb,{asChild:!0,children:l.jsx(LS,{ref:x,asChild:!0,children:i})}),l.jsx(cb,{side:"top",children:o})]})}):l.jsx(LS,{ref:x,asChild:!0,children:i}),l.jsxs(Vx,{side:"top",align:"start",collisionPadding:8,collisionBoundary:p??void 0,"data-web-shell-toolbar-popover":!0,onClick:T=>T.stopPropagation(),onPointerDownOutside:T=>{const _=T.target;_ instanceof Element&&_.closest("[data-web-shell-toolbar-popover-trigger]")&&(v.current=!0)},onCloseAutoFocus:T=>{if(v.current){T.preventDefault(),v.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:[c&&l.jsx(ri,{type:"search",value:h,"aria-label":u,placeholder:u,autoComplete:"off",onChange:T=>m(T.target.value)}),l.jsxs("div",{className:`${ge.dropdownList} ${y?ge.dropdownRich:a?ge.dropdownCheck:""} ${c?ge.dropdownListConstrained:""}`,children:[w.map(T=>l.jsx("button",{type:"button",className:`${ge.dropdownItem} ${T.id===n?ge.dropdownItemActive:""}`,onClick:()=>{b.current=!0,r(T.id)},children:k?l.jsxs(l.Fragment,{children:[y&&l.jsx("span",{className:ge.dropdownItemIcon,children:T.icon}),l.jsxs("span",{className:ge.dropdownItemContent,children:[l.jsx("span",{className:ge.dropdownItemLabel,children:T.label}),T.description&&l.jsx("span",{className:ge.dropdownItemDesc,children:T.description})]}),l.jsx("span",{className:ge.dropdownItemCheck,children:T.id===n?l.jsx(OZe,{}):null})]}):T.label},T.id)),w.length===0&&d&&l.jsx("div",{className:ge.dropdownEmpty,role:"status",children:d(h)})]})]})]})}function $Ze({menu:e,anchorRef:t,panelRef:n,detailRef:s,onClose:r,onSelect:i,onAccept:o}){const a=f.useRef([]),c=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=BJe(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),v=b>0,x={"--slash-command-col":`${Math.min(Math.max(g+1,10),24)}ch`,"--slash-desc-col":v?`${Math.min(Math.max(b+1,18),36)}ch`:"0px","--slash-column-gap":v?"2ch":"0px"};return l.jsxs(l.Fragment,{children:[l.jsxs(Ux,{open:!0,onOpenChange:y=>{y||r()},children:[l.jsx(H$,{virtualRef:t}),l.jsx(Vx,{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:x,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=s.current)!=null&&T.contains(w))&&y.preventDefault()},onMouseDown:y=>y.preventDefault(),onMouseLeave:y=>{var k;const w=y.relatedTarget;w instanceof Node&&((k=s.current)!=null&&k.contains(w))||m(null)},children:l.jsx("div",{className:ge.slashPanel,children:l.jsx("div",{className:ge.slashPanelBody,children:l.jsx("div",{className:ge.slashList,onScroll:()=>m(null),children:e.items.map((y,w)=>{const k=p[w];return l.jsxs("div",{className:ge.slashEntry,children:[k.showHeader&&l.jsxs(l.Fragment,{children:[k.showDivider&&l.jsx("div",{className:ge.slashSection}),l.jsxs("div",{className:ge.slashSectionHeader,children:[l.jsx("span",{children:y.section}),k.count>0?l.jsx("span",{className:ge.slashSectionCount,children:k.count}):null]})]}),l.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:`${ge.slashItem} ${w===e.selectedIndex?ge.slashItemActive:""}`,onMouseEnter:T=>{if(i(w),!y.detail){m(null);return}c.current=T.currentTarget,m({label:y.label,detail:y.detail})},onMouseDown:T=>{T.preventDefault(),T.stopPropagation(),o(w)},children:[l.jsx("span",{className:ge.slashCommand,children:y.label}),y.detail&&l.jsx("span",{className:ge.slashDescription,children:y.detail})]})]},`${y.id}:${w}`)})})})})})]}),l.jsxs(Ux,{open:!!h,onOpenChange:y=>{y||m(null)},children:[l.jsx(H$,{virtualRef:c}),h&&l.jsx(Vx,{ref:s,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:l.jsxs("div",{className:ge.slashDetail,children:[l.jsx("div",{className:ge.slashDetailCommand,children:h.label}),l.jsx("div",{className:ge.slashDetailText,children:h.detail})]})})]})]})}function zZe({actions:e,onRun:t,onPressKey:n}){const{t:s}=ot();return l.jsxs("div",{className:ge.quickActionsPanel,onMouseDown:r=>r.stopPropagation(),onClick:r=>r.stopPropagation(),children:[l.jsx("div",{className:ge.quickActionsHeader,children:s("quickActions.title")}),l.jsxs("div",{className:ge.quickActionsLayout,children:[l.jsx("div",{className:ge.quickActionsGrid,children:e.map(r=>l.jsx("button",{type:"button",className:ge.quickAction,onClick:()=>t(r),children:l.jsx("span",{className:ge.quickActionLabel,children:r.label})},r.id))}),l.jsx("div",{className:ge.quickKeysGrid,children:PZe.map(r=>l.jsx("button",{type:"button",className:ge.quickKey,title:s(r.descriptionKey),onMouseDown:i=>i.preventDefault(),onClick:()=>n(r),children:l.jsx("span",{className:ge.quickKeyLabel,children:r.label})},r.id))})]})]})}const zie=f.memo(f.forwardRef(function(t,n){var ys;const{onSubmit:s,onInputTextChange:r,onCycleMode:i,onToggleShortcuts:o,onCancel:a,isRunning:c=!1,isPreparing:u=!1,cancelArmed:d=!1,disabled:h=!1,placeholderText:m="Type a message...",commands:p,skills:g=[],slashCommandCategoryOrder:b,queuedMessages:v=[],onPopQueuedMessages:x,currentMode:y="default",currentModel:w="",gitBranch:k,gitWorktree:T,gitStatus:_,onOpenGitDiff:C,workspaceName:S,workspaceTitle:L,workspaceColor:N,chatWidthMode:$="1000",showChatWidthToggle:M=!0,chatWidthToggleMin:P,visibleToolbarActions:E,availableModels:O=[],onSelectMode:z,onSelectModel:F,workspaces:B,selectedWorkspaceCwd:W,workspaceSelectionDisabled:I=!1,onSelectWorkspace:Y,atWorkspaceCwd:V,onChatWidthModeChange:j,onFocusFooter:ee,dialogOpen:se=!1,followupState:X,onAcceptFollowup:Q,onDismissFollowup:ue,sessionName:re,composerInput:J,composerInputVersion:q,builtinAtProviders:Z,atProviders:he,composerTagIcons:ye}=t,{renderComposerToolbarStart:oe,renderComposerToolbarEnd:we,renderComposerToolbarRight:Ve,renderComposerTag:lt,renderComposerTagTooltip:Et,onComposerTagClick:pt,parseUserMessageContent:je}=$c(),Ae=hBe({onSubmit:s,onInputTextChange:r,onCycleMode:i,onToggleShortcuts:o,disabled:h,placeholderText:m,commands:p,skills:g,slashCommandCategoryOrder:b,queuedMessages:v,onPopQueuedMessages:x,currentMode:y,onFocusFooter:ee,dialogOpen:se,followupState:X,onAcceptFollowup:Q,onDismissFollowup:ue,sessionName:re,composerInput:J,composerInputVersion:q,builtinAtProviders:Z,atProviders:he,atWorkspaceCwd:V,composerTagIcons:ye,parseUserMessageContent:je,renderComposerTag:lt,renderComposerTagTooltip:Et,onComposerTagClick:pt,editorTheme:EZe}),{t:De}=ot();f.useImperativeHandle(n,()=>Ae.handle,[Ae.handle]);const[Ne,tt]=f.useState(!1),[Se,Be]=f.useState(!1),[le,Le]=f.useState(!1),[sn,Cn]=f.useState(!1),[In,_t]=f.useState(OH),Te=f.useRef(null),at=f.useRef(null),ke=f.useRef(null),Pe=f.useRef(null),ve=f.useRef(null),Ke=f.useRef(null),me=f.useRef(null),qe=f.useRef(null),Mt=f.useRef(null),ln=f.useRef(null),Ft=f.useRef(null),st=f.useRef(null),Tn=f.useRef(!1),ne=f.useRef(!1),[gt,bt]=f.useState(!1),[It,Rt]=f.useState({workspaceSelect:!1,workspace:!1,gitBranch:!1,mode:!1,model:!1}),[We,Zn]=f.useState(""),Ar=Ae.slashMenu,Ge=Ae.closeSlashMenu,dt=Ae.atMenu,bn=Ae.closeAtMenu,Ht=!!Ar,Rn=!!dt,Gn=Ae.viewRef;f.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const Re=window.matchMedia("(hover: none), (pointer: coarse)"),Dt=()=>_t(OH());return Dt(),Re.addEventListener("change",Dt),()=>Re.removeEventListener("change",Dt)},[]),f.useEffect(()=>{In||Le(!1)},[In]),f.useEffect(()=>{if(!Ht&&!Rn)return;const Re=Dt=>{var nr,Js,vs;const zn=Dt.target,xs=Te.current;zn instanceof Node&&xs&&!xs.contains(zn)&&!((nr=at.current)!=null&&nr.contains(zn))&&!((Js=ke.current)!=null&&Js.contains(zn))&&!((vs=Pe.current)!=null&&vs.contains(zn))&&(Ge(),bn())};return window.addEventListener("mousedown",Re),window.addEventListener("touchstart",Re),()=>{window.removeEventListener("mousedown",Re),window.removeEventListener("touchstart",Re)}},[Rn,Ht,bn,Ge]),f.useEffect(()=>{var zn;const Re=Te.current,Dt=(zn=Gn.current)==null?void 0:zn.contentDOM;if(!(!Re||!Dt))return RZe(Re,Dt)},[Gn]),f.useEffect(()=>{const Re=Te.current,Dt=P;if(!Re||Dt===void 0){bt(!1);return}const zn=()=>{bt(Re.getBoundingClientRect().width>=Dt-50)};zn();const xs=new ResizeObserver(zn);return xs.observe(Re),()=>xs.disconnect()},[P]);const Or=f.useMemo(()=>W4.map(Re=>({id:Re,label:BZe(Re,De),description:De(`mode.desc.${Re}`),icon:l.jsx(Ey,{mode:Re})})),[De]),Bn=f.useMemo(()=>{if(!E)return null;const Re=E.filter(Dt=>TZe.has(Dt));return new Set(Re)},[E]),_n=Re=>Bn?Bn.has(Re):!0,gs=_n("approvalMode"),Qn=_n("model"),Dn=f.useMemo(()=>new Set(p.map(Re=>Re.name.replace(/^\/+/,""))),[p]),wn=f.useCallback(Re=>Dn.has(Re),[Dn]),br=f.useMemo(()=>[{id:"new",label:De("quickActions.new"),action:{type:"run",command:"/new"}},{id:"resume",label:De("quickActions.resume"),action:{type:"run",command:"/resume"}},{id:"delete",label:De("quickActions.delete"),action:{type:"run",command:"/delete"}},{id:"branch",label:De("quickActions.branch"),action:{type:"run",command:"/branch"}},{id:"rewind",label:De("quickActions.rewind"),action:{type:"run",command:"/rewind"}},{id:"history-search",label:De("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:De("quickActions.recap"),action:{type:"run",command:"/recap"}},{id:"stats",label:De("quickActions.stats"),action:{type:"run",command:"/stats"}},{id:"context",label:De("quickActions.context"),action:{type:"run",command:"/context"}},{id:"status",label:De("quickActions.status"),action:{type:"run",command:"/status"}},{id:"skills",label:De("quickActions.skills"),action:{type:"run",command:"/skills detail"}},{id:"tools",label:De("quickActions.tools"),action:{type:"run",command:"/tools desc"}},{id:"agents",label:De("quickActions.agents"),action:{type:"run",command:"/agents"}},{id:"mcp",label:De("quickActions.mcp"),action:{type:"run",command:"/mcp"}},{id:"memory",label:De("quickActions.memory"),action:{type:"run",command:"/memory"}},{id:"theme",label:De("quickActions.theme"),action:{type:"run",command:"/theme"}},{id:"shell",label:Ae.shellMode?De("quickActions.exitShellMode"):De("quickActions.shellMode"),action:{type:"shell"}},{id:"goal",label:De("quickActions.setGoal"),action:{type:"insert",text:"/goal "}}].filter(Re=>{const Dt=LZe(Re);return!Dt||wn(Dt)}),[Ae.shellMode,wn,De]),Qs=f.useMemo(()=>O.map(Re=>({id:Re.id,label:uf(Re.label||Re.id),searchText:`${Re.label??""}
${Re.id}`})),[O]),hs=f.useCallback(Re=>{z==null||z(Re),tt(!1),Ae.focus()},[z,Ae]),cn=f.useCallback(Re=>{F==null||F(Re),Be(!1),Ae.focus()},[F,Ae]),Jn=f.useCallback(Re=>{const Dt=Ae.viewRef.current;Dt&&(Dt.focus(),Dt.contentDOM.dispatchEvent(new KeyboardEvent("keydown",{...Re,bubbles:!0,cancelable:!0})))},[Ae]),Wi=f.useCallback(Re=>{if(Le(!1),tt(!1),Be(!1),Ae.closeSlashMenu(),Ae.closeAtMenu(),Re.action.type==="insert"){Ae.insertText(Re.action.text,{mode:"replace"});return}if(Re.action.type==="shell"){Ae.toggleShellMode();return}if(Re.action.type==="key"){Jn(Re.action.item.event);return}s(Re.action.command)},[Ae,Jn,s]),is=f.useCallback(Re=>{Jn(Re.event),Re.id==="ctrl-r"&&Le(!1)},[Jn]),{searchMode:tr,searchQuery:kr,searchMatches:Br,searchActiveIndex:gr,searchInputRef:bs,searchUiRef:ir,closeSearch:or,restoreSearchMatch:pe,handleSearchKeyDown:Oe,handleSearchInput:rt,handleSearchCompositionEnd:Ut}=Ae.searchState,fn=Re=>{const Dt=lt==null?void 0:lt({tag:Re,placement:"composer",readonly:!1});if(Dt!=null)return Dt;const zn=xC(Re),xs=vC(Re),nr=Re.kind?"":zn,Js=Re.icon??t0(Re.kind,ye),vs=Js&&(oj(Js)||tb(Js))?Js:void 0;return!nr&&!xs?l.jsx("span",{className:ge.tagLabel,children:Re.id}):l.jsxs(l.Fragment,{children:[vs&&l.jsx("span",{className:ge.tagIcon,style:cf("--composer-tag-icon-url",vs),"aria-hidden":"true"}),nr&&l.jsx("span",{className:ge.tagLabel,children:nr}),xs&&l.jsx("span",{className:ge.tagValue,children:xs})]})},un=$ie(y,De),_e=w?((ys=O.find(Re=>Re.id===w))==null?void 0:ys.label)??(w.startsWith("qwen-route:")?"":uf(w)):"",{modelLabel:Ue,modelLabelReady:zt}=SZe({currentModelLabel:_e,lastConfirmedModelLabel:We}),Sn=B==null?void 0:B.find(Re=>W?Re.cwd===W:Re.primary),Gt=(Sn==null?void 0:Sn.label)??"",Ls=!!(B&&B.length>1&&Y),kn=!!(S&&_n("workspace")),Pn=!!(k&&_n("gitBranch"));f.useLayoutEffect(()=>{_e&&_e!==We&&Zn(_e)},[_e,We]);const es=It.workspaceSelect,jn=It.workspace,$n=It.gitBranch,qs=It.mode,mn=It.model,Ps=c&&!Ae.hasContent;return f.useLayoutEffect(()=>{const Re=ve.current,Dt=Ke.current,zn=me.current,xs=Ft.current;if(!Re||!Dt||!zn||!xs)return;const nr=()=>{const $r=Qe=>{const Kt=xs.querySelector(`[data-toolbar-measure="${Qe}:collapsed"]`),At=xs.querySelector(`[data-toolbar-measure="${Qe}:expanded"]`);return Math.max(0,Math.ceil((At==null?void 0:At.getBoundingClientRect().width)??0)-Math.ceil((Kt==null?void 0:Kt.getBoundingClientRect().width)??0))},Ii=[...Ls?[{id:"workspaceSelect",expansionWidth:$r("workspaceSelect")}]:[],...kn?[{id:"workspace",expansionWidth:$r("workspace")}]:[],...Pn?[{id:"gitBranch",expansionWidth:$r("gitBranch")}]:[],...gs?[{id:"mode",expansionWidth:$r("mode")}]:[],...Qn?[{id:"model",expansionWidth:$r("model"),ready:zt}]:[]],qo=Ii.reduce((Qe,Kt)=>Qe+(It[Kt.id]?Kt.expansionWidth:0),0),ci=Dt.scrollWidth,Ri=Math.ceil(Number.parseFloat(getComputedStyle(Re).columnGap)||0),ae=_Ze({toolbarWidth:Math.floor(Re.getBoundingClientRect().width),leadingWidth:ci,rightWidth:Math.ceil(zn.getBoundingClientRect().width),currentExpansionWidth:qo,gap:Ri}),xe=kZe({availableWidth:ae,items:Ii,currentVisibility:It,expansionMargin:Ii.length}),ze={workspaceSelect:xe.workspaceSelect??!1,workspace:xe.workspace??!1,gitBranch:xe.gitBranch??!1,mode:xe.mode??!1,model:xe.model??!1};Rt(Qe=>Object.keys(ze).every(At=>Qe[At]===ze[At])?Qe:ze)};nr();const Js=new ResizeObserver(nr);Js.observe(Re),Js.observe(Dt),Js.observe(zn);for(const $r of xs.children)Js.observe($r);const vs=[qe.current,Mt.current,ln.current].filter($r=>$r!==null),Jr=()=>{for(const $r of vs){Js.observe($r);for(const Ii of $r.children)Js.observe(Ii)}};Jr();const Gi=new MutationObserver(()=>{Jr(),nr()});for(const $r of vs)Gi.observe($r,{attributes:!0,characterData:!0,childList:!0,subtree:!0});return()=>{Gi.disconnect(),Js.disconnect()}},[we,Ve,oe,h,k,Pn,c,Ue,zt,un,re,Qn,gs,It,kn,S,Ls,Gt]),l.jsxs("div",{className:`${ge.editorShell} ${Ne||Se?ge.editorShellDropdownOpen:""}`,"data-composer":!0,"data-web-shell-composer":!0,children:[l.jsxs("div",{ref:Te,className:ge.container,"data-web-shell-composer-surface":!0,"data-dac-glow":!0,onClick:()=>{tt(!1),Be(!1),Le(!1),Ae.focus()},children:[l.jsx("div",{className:ge.dacAura,"aria-hidden":"true"}),l.jsx("div",{className:ge.dacHalo,"aria-hidden":"true"}),tr&&l.jsxs("div",{ref:ir,className:ge.searchPanel,onMouseDown:Re=>Re.stopPropagation(),onClick:Re=>Re.stopPropagation(),children:[l.jsxs("div",{className:ge.searchBar,children:[l.jsx("span",{className:ge.searchLabel,children:De("editor.searchLabel")}),l.jsx("input",{ref:bs,className:ge.searchInput,value:kr,onChange:rt,onCompositionEnd:Ut,onKeyDown:Oe,placeholder:De("editor.searchPlaceholder")})]}),Br.length>0&&l.jsx("div",{className:ge.searchResults,children:Br.map((Re,Dt)=>l.jsxs("button",{type:"button",className:`${ge.searchResult} ${Dt===gr?ge.searchResultActive:""}`,onMouseDown:zn=>{zn.preventDefault(),pe?pe(Re):Ae.replaceEditorText(Re),or(!1)},children:[l.jsx("span",{className:ge.searchResultMarker,children:Dt===gr?"›":""}),l.jsx("span",{className:ge.searchResultText,children:Re})]},`${Re}-${Dt}`))}),Br.length===0&&l.jsx("div",{className:ge.searchEmpty,children:De("editor.noHistory")})]}),l.jsxs("div",{className:ge.content,children:[(Ae.composerTags.length>0||Ae.pastedImages.length>0)&&l.jsxs("div",{className:ge.attachments,"data-web-shell-composer-attachments":!0,children:[Ae.composerTags.length>0&&l.jsx(ste,{delayDuration:0,disableHoverableContent:!1,children:l.jsx("div",{className:ge.tags,children:Ae.composerTags.map(Re=>{const Dt={tag:Re,placement:"composer",readonly:!1};let zn;try{zn=Et==null?void 0:Et(Dt)}catch(xs){console.warn("[WebShell] composer tag tooltip render failed",xs)}return l.jsx(AZe,{tag:Re,content:fn(Re),tooltip:zn,onActivate:pt?xs=>pt({...Dt,anchorRect:xs}):void 0,onRemove:Re.removable!==!1?()=>{var xs;Ae.removeTopTag(Re.id),(xs=Ae.viewRef.current)==null||xs.focus()}:void 0},Re.id)})})}),Ae.pastedImages.length>0&&l.jsx("div",{className:ge.images,children:Ae.pastedImages.map((Re,Dt)=>l.jsxs("div",{className:ge.imageThumb,children:[l.jsx("img",{src:`data:${Re.media_type};base64,${Re.data}`,alt:""}),l.jsx("button",{className:ge.imageRemove,onClick:zn=>{zn.stopPropagation(),Ae.removeImage(Dt)},children:"×"})]},Dt))})]}),Ae.slashMenu&&l.jsx($Ze,{menu:Ae.slashMenu,anchorRef:Te,panelRef:at,detailRef:ke,onClose:Ae.closeSlashMenu,onSelect:Ae.selectSlashCompletion,onAccept:Ae.acceptSlashCompletion}),Ae.atMenu&&l.jsx(AJe,{menu:Ae.atMenu,anchorRef:Te,panelRef:Pe,onSelect:Ae.selectAtCompletion,onAccept:Ae.acceptAtCompletion,onBack:()=>{const Re=Ae.backAtCategories();return Re==="categories"&&window.setTimeout(()=>Ae.focus(),0),!!Re},onSearch:Ae.updateAtSearch,onSelectTab:Ae.selectAtTab}),l.jsxs("div",{className:ge.editorArea,children:[Ae.shellMode&&l.jsx("span",{className:ge.shellPrefix,"aria-hidden":"true",children:"!"}),l.jsx("div",{ref:Ae.containerRef,"data-web-shell-composer-editor":!0})]}),l.jsxs("div",{ref:ve,className:ge.toolbar,children:[l.jsxs("div",{ref:Ke,className:ge.toolbarLeading,children:[oe&&l.jsx("div",{ref:qe,className:ge.toolbarStart,children:l.jsx(oe,{disabled:h,isRunning:c,currentMode:y,currentModel:w,sessionName:re})}),l.jsxs("div",{className:ge.toolbarLeft,children:[Ls&&B&&Y&&l.jsxs(Hf,{value:Sn==null?void 0:Sn.id,disabled:I,onValueChange:Re=>{const Dt=B.find(zn=>zn.id===Re);Dt&&(Y(Dt.primary?void 0:Dt.cwd),Tn.current=!0,Cn(!1),requestAnimationFrame(()=>{var zn;(zn=st.current)==null||zn.blur()}))},children:[l.jsx(ob,{delayDuration:300,children:l.jsxs(ab,{open:sn,onOpenChange:Re=>{Re&&(Tn.current||!ne.current)||Cn(Re)},children:[l.jsx(lb,{asChild:!0,children:l.jsx("span",{className:`${ge.workspaceSelectTooltipTrigger} ${es?"":ge.workspaceSelectTooltipTriggerCompact}`,onPointerEnter:()=>{ne.current=!0},onPointerLeave:()=>{ne.current=!1,Tn.current=!1},onBlur:()=>{ne.current||(Tn.current=!1)},children:l.jsxs(Uf,{ref:st,size:"sm",className:`${ge.toolBtn} ${ge.workspaceSelectTrigger} ${es?"":ge.workspaceSelectTriggerCompact}`,"aria-label":De("sidebar.workspaceSelectLabel"),children:[l.jsx(z_,{size:16,strokeWidth:1.2}),l.jsx(qf,{})]})})}),l.jsx(cb,{side:"top",children:Gt})]})}),l.jsx(Vf,{position:"popper",align:"start",children:l.jsx(FM,{children:B.map(Re=>l.jsx(Nl,{value:Re.id,children:Re.label},Re.id))})})]}),kn&&S&&l.jsx(vZe,{name:S,title:L??S,color:N,compact:!jn,ariaLabel:De("workspace.paneLabel",{name:S})}),Pn&&k&&l.jsx(Bie,{branch:k,status:_,compact:!$n,onOpenDiff:C,worktree:T}),gs&&l.jsx("div",{className:`${ge.dropdownWrapper} ${qs?"":ge.dropdownWrapperCompact}`,children:l.jsx(BH,{open:Ne,items:Or,activeId:y,onOpenChange:Re=>{tt(Re),Re&&Be(!1)},onSelect:hs,tooltip:un,trigger:l.jsxs("button",{className:`${ge.toolBtn} ${ge.modeToolBtn} ${qs?"":ge.toolBtnCompact}`,"data-web-shell-mode-button":!0,"data-web-shell-toolbar-popover-trigger":!0,onClick:Re=>{Re.stopPropagation(),Ae.closeSlashMenu(),Ae.closeAtMenu(),Le(!1)},"aria-label":De("status.mode"),children:[l.jsx("span",{className:ge.toolBtnModeIcon,children:l.jsx(Ey,{mode:y})}),qs&&l.jsx("span",{className:ge.toolBtnText,children:un}),l.jsx("span",{className:ge.toolBtnArrow,children:l.jsx(Ql,{})})]})})}),Qn&&l.jsx("div",{className:`${ge.dropdownWrapper} ${mn?"":ge.dropdownWrapperCompact}`,children:l.jsx(BH,{open:Se,items:Qs,activeId:w,onOpenChange:Re=>{Be(Re),Re&&tt(!1)},onSelect:cn,tooltip:Ue,showCheck:!0,searchable:!0,searchLabel:De("common.search"),noResultsLabel:Re=>De("model.noMatch",{query:Re}),trigger:l.jsxs("button",{className:`${ge.toolBtn} ${ge.modelToolBtn} ${mn?"":ge.toolBtnCompact}`,"data-web-shell-model-button":!0,"data-web-shell-toolbar-popover-trigger":!0,onClick:Re=>{Re.stopPropagation(),Ae.closeSlashMenu(),Ae.closeAtMenu(),Le(!1)},"aria-label":De("model.select"),children:[l.jsx("span",{className:ge.toolBtnModelIcon,children:l.jsx(l8,{})}),mn&&l.jsx("span",{className:ge.toolBtnText,children:Ue}),l.jsx("span",{className:ge.toolBtnArrow,children:l.jsx(Ql,{})})]})})}),we&&l.jsx("div",{ref:Mt,className:ge.toolbarEnd,children:l.jsx(we,{disabled:h,isRunning:c,currentMode:y,currentModel:w,sessionName:re})})]})]}),l.jsxs("div",{ref:me,className:ge.toolbarRight,children:[In&&br.length>0&&l.jsx("button",{className:`${ge.toolBtn} ${ge.quickActionsBtn}`,onClick:Re=>{Re.stopPropagation(),Ae.closeSlashMenu(),Ae.closeAtMenu(),tt(!1),Be(!1),Le(Dt=>!Dt)},"aria-expanded":le,"aria-label":De("quickActions.open"),title:De("quickActions.open"),"data-tooltip":De("quickActions.open"),children:l.jsx("span",{className:ge.toolBtnIcon,children:l.jsx(IZe,{})})}),Ve&&l.jsx("div",{ref:ln,className:ge.toolbarRightCustom,children:l.jsx(Ve,{disabled:h,isRunning:c,currentMode:y,currentModel:w,sessionName:re})}),M&&gt&&_n("widthMode")&&l.jsx("button",{className:`${ge.toolBtn} ${ge.widthModeBtn}`,onClick:Re=>{Re.stopPropagation(),j==null||j($==="wide"?"1000":"wide")},disabled:!j,"aria-label":De($==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),title:De($==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),"data-tooltip":De($==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),children:l.jsx("span",{className:ge.toolBtnIcon,children:l.jsx(DZe,{mode:$})})}),_n("voice")&&l.jsx(uZe,{disabled:h,onInsert:Re=>{const Dt=Ae.getText(),zn=Dt&&!/\s$/.test(Dt)?" ":"";Ae.insertText(`${zn}${Re} `),Ae.focus()}}),l.jsx("button",{className:u||Ps?`${ge.sendBtn} ${ge.sendBtnRunning}${d?` ${ge.sendBtnArmed}`:""}`:ge.sendBtn,disabled:u?!0:Ps?!a:Ae.disabled||!Ae.hasContent,"data-web-shell-composer-submit":!0,onClick:Re=>{if(Re.stopPropagation(),!u){if(Ps){a==null||a();return}Ae.submitText()}},"aria-label":De(u?"common.loading":Ps?d?"stream.cancelArmed":"stream.cancel":"editor.send"),title:c&&d?De("stream.cancelArmed"):void 0,children:u?l.jsx(MZe,{}):Ps?d?l.jsx("span",{className:ge.escLabel,"aria-hidden":"true",children:"Esc"}):l.jsx(jZe,{}):l.jsx(NZe,{})}),l.jsx("span",{role:"status","aria-live":"polite",className:ge.srOnly,children:c&&d?De("stream.cancelArmed"):""})]})]}),l.jsxs("div",{ref:Ft,className:ge.toolbarMeasurements,"aria-hidden":"true",children:[Ls&&Sn&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{"data-toolbar-measure":"workspaceSelect:collapsed",className:`${ge.toolBtn} ${ge.workspaceSelectTrigger} ${ge.workspaceSelectTriggerCompact}`,children:[l.jsx(z_,{size:16,strokeWidth:1.2}),l.jsx("span",{className:ge.toolBtnText,children:Gt}),l.jsx("span",{className:ge.toolBtnArrow,children:l.jsx(Ql,{})})]}),l.jsxs("span",{"data-toolbar-measure":"workspaceSelect:expanded",className:`${ge.toolBtn} ${ge.workspaceSelectTrigger}`,children:[l.jsx(z_,{size:16,strokeWidth:1.2}),l.jsx("span",{className:ge.toolBtnText,children:Gt}),l.jsx("span",{className:ge.toolBtnArrow,children:l.jsx(Ql,{})})]})]}),kn&&S&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{"data-toolbar-measure":"workspace:collapsed",className:`${ge.workspaceChip} ${ge.workspaceChipCompact}`,children:[l.jsx("span",{className:ge.workspaceChipIcon}),l.jsx("span",{className:ge.workspaceChipText,children:S})]}),l.jsxs("span",{"data-toolbar-measure":"workspace:expanded",className:ge.workspaceChip,children:[l.jsx("span",{className:ge.workspaceChipIcon}),l.jsx("span",{className:ge.workspaceChipText,children:S})]})]}),Pn&&k&&l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-toolbar-measure":"gitBranch:collapsed",className:`${ge.gitBranchChip} ${ge.gitBranchChipCompact}`,children:l.jsx(p9,{branch:k,status:_,compact:!0,worktree:T})}),l.jsx("span",{"data-toolbar-measure":"gitBranch:expanded",className:ge.gitBranchChip,children:l.jsx(p9,{branch:k,status:_,compact:!1,worktree:T})})]}),l.jsxs("span",{"data-toolbar-measure":"mode:collapsed",className:`${ge.toolBtn} ${ge.modeToolBtn} ${ge.toolBtnCompact}`,children:[l.jsx("span",{className:ge.toolBtnModeIcon,children:l.jsx(Ey,{mode:y})}),l.jsx("span",{className:ge.toolBtnText,children:un}),l.jsx("span",{className:ge.toolBtnArrow,children:l.jsx(Ql,{})})]}),l.jsxs("span",{"data-toolbar-measure":"mode:expanded",className:`${ge.toolBtn} ${ge.modeToolBtn}`,children:[l.jsx("span",{className:ge.toolBtnModeIcon,children:l.jsx(Ey,{mode:y})}),l.jsx("span",{className:ge.toolBtnText,children:un}),l.jsx("span",{className:ge.toolBtnArrow,children:l.jsx(Ql,{})})]}),l.jsxs("span",{"data-toolbar-measure":"model:collapsed",className:`${ge.toolBtn} ${ge.modelToolBtn} ${ge.toolBtnCompact}`,children:[l.jsx("span",{className:ge.toolBtnModelIcon,children:l.jsx(l8,{})}),l.jsx("span",{className:ge.toolBtnText,children:Ue}),l.jsx("span",{className:ge.toolBtnArrow,children:l.jsx(Ql,{})})]}),l.jsxs("span",{"data-toolbar-measure":"model:expanded",className:`${ge.toolBtn} ${ge.modelToolBtn}`,children:[l.jsx("span",{className:ge.toolBtnModelIcon,children:l.jsx(l8,{})}),l.jsx("span",{className:ge.toolBtnText,children:Ue}),l.jsx("span",{className:ge.toolBtnArrow,children:l.jsx(Ql,{})})]})]})]})]}),In&&le&&br.length>0&&l.jsx(zZe,{actions:br,onRun:Wi,onPressKey:is})]})})),FZe="_bar_17p6f_1",HZe="_left_17p6f_12",qZe="_right_17p6f_13",UZe="_settingsButton_17p6f_23",VZe="_modeButton_17p6f_49",WZe="_modeHint_17p6f_62",GZe="_modeLabel_17p6f_67",KZe="_modeDefault_17p6f_71",YZe="_modePlan_17p6f_75",XZe="_modeAutoEdit_17p6f_79",QZe="_modeAuto_17p6f_79",JZe="_modeYolo_17p6f_87",ZZe="_shortcutsButton_17p6f_96",eet="_modelButton_17p6f_114",tet="_model_17p6f_114",net="_contextButton_17p6f_138",set="_context_17p6f_138",ret="_goal_17p6f_161",iet="_goalButton_17p6f_167",oet="_separator_17p6f_184",aet="_taskPill_17p6f_188",vi={bar:FZe,left:HZe,right:qZe,settingsButton:UZe,modeButton:VZe,modeHint:WZe,modeLabel:GZe,modeDefault:KZe,modePlan:YZe,modeAutoEdit:XZe,modeAuto:QZe,modeYolo:JZe,shortcutsButton:ZZe,modelButton:eet,model:tet,contextButton:net,context:set,goal:ret,goalButton:iet,separator:oet,taskPill:aet},cet=1e3;function uet(e,t){switch(e){case"default":return{label:t("mode.default"),className:vi.modeDefault};case"plan":return{label:t("mode.plan"),className:vi.modePlan};case"auto-edit":return{label:t("mode.auto-edit"),className:vi.modeAutoEdit};case"auto":return{label:t("mode.auto"),className:vi.modeAuto};case"yolo":return{label:t("mode.yolo"),className:vi.modeYolo};default:return null}}function det(){return l.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:[l.jsx("circle",{cx:"12",cy:"12",r:"3"}),l.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 c8(e,t,n,s){return s(e===1?t:n,{count:e})}function het(e,t){if(e.length===0)return"";const n=e.filter(r=>r.status==="running");if(n.length>0){const r={agent:0,shell:0,monitor:0};for(const o of n)r[o.kind]++;const i=[];return r.shell>0&&i.push(c8(r.shell,"tasks.pill.shell","tasks.pill.shells",t)),r.agent>0&&i.push(c8(r.agent,"tasks.pill.agent","tasks.pill.agents",t)),r.monitor>0&&i.push(c8(r.monitor,"tasks.pill.monitor","tasks.pill.monitors",t)),i.join(", ")}const s=e.filter(r=>r.kind==="agent"&&r.status==="paused");return s.length>0?t(s.length===1?"tasks.pill.agentPaused":"tasks.pill.agentsPaused",{count:s.length}):t(e.length===1?"tasks.pill.done":"tasks.pill.doneMany",{count:e.length})}function fet(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 met=f.forwardRef(function({onSelectMode:t,onSelectModel:n,onShowContext:s,onOpenSettings:r,onOpenTasks:i,onReturnToInput:o,tasks:a,activeGoal:c,onOpenGoals:u,hideSettings:d,onToggleShortcuts:h,compact:m=!1},p){const g=Dl(),b=g.status==="connected",v=g.currentModel??"",x=g.currentMode??"",y=g.tokenCount??0,w=g.contextWindow??0,{t:k}=ot(),_=(w>0?y/w*100:0).toFixed(1),C=uet(x,k),[,S]=f.useState(0),L=f.useRef(null);f.useEffect(()=>{if(!c)return;const F=setInterval(()=>S(B=>(B+1)%1e6),cet);return()=>clearInterval(F)},[c]);const N=f.useMemo(()=>het(a,k),[a,k]),$=!m&&(b||!!C),M=c?fet(Date.now()-c.setAt):"",P=c?`◎ ${k("goal.statusActive")}${M?` (${M})`:""}`:"",E=!!N||!m,O=!m&&!!v||!m&&w>0&&y>0||!!P;if(f.useImperativeHandle(p,()=>({focusTaskPill(){var F;return N?((F=L.current)==null||F.focus({preventScroll:!0}),!0):!1}}),[N]),!E&&!O)return null;const z=F=>{if(F.key==="Enter"||F.key==="ArrowDown"||F.key==="n"&&F.ctrlKey){F.preventDefault(),F.stopPropagation(),i==null||i();return}if(F.key==="ArrowUp"||F.key==="Escape"||F.key==="p"&&F.ctrlKey){F.preventDefault(),F.stopPropagation(),o==null||o();return}F.key.length===1&&!F.metaKey&&!F.ctrlKey&&!F.altKey&&(F.preventDefault(),F.stopPropagation(),o==null||o(F.key))};return l.jsxs("div",{className:vi.bar,children:[l.jsxs("div",{className:vi.left,children:[b&&!d&&!m&&l.jsx("button",{type:"button",className:vi.settingsButton,onClick:r,onMouseDown:F=>F.stopPropagation(),onTouchStart:F=>F.stopPropagation(),title:k("settings.title"),"aria-label":k("settings.title"),"aria-haspopup":"dialog",children:l.jsx(det,{})}),C&&!m&&l.jsxs("button",{type:"button",className:vi.modeButton,onClick:t,onMouseDown:F=>F.stopPropagation(),onTouchStart:F=>F.stopPropagation(),title:k("mode.select"),"aria-haspopup":"listbox",children:[l.jsx("span",{className:`${vi.modeLabel} ${C.className}`,children:C.label}),!m&&l.jsx("span",{className:vi.modeHint,children:k("status.modeHint")})]}),!m&&l.jsx(l.Fragment,{children:h?l.jsx("button",{type:"button",className:vi.shortcutsButton,onClick:h,onMouseDown:F=>F.stopPropagation(),onTouchStart:F=>F.stopPropagation(),"aria-haspopup":"dialog","aria-label":k("status.shortcuts"),children:k("status.shortcuts")}):l.jsx("span",{children:k("status.shortcuts")})}),N&&l.jsxs(l.Fragment,{children:[$&&l.jsx("span",{className:vi.separator,children:"·"}),l.jsx("button",{ref:L,type:"button",className:vi.taskPill,onClick:i,onKeyDown:z,disabled:!i,children:N})]})]}),l.jsxs("div",{className:vi.right,children:[!m&&v&&l.jsx("button",{type:"button",className:vi.modelButton,onClick:n,onMouseDown:F=>F.stopPropagation(),onTouchStart:F=>F.stopPropagation(),title:k("model.select"),"aria-haspopup":"listbox",children:l.jsx("span",{className:vi.model,children:v})}),!m&&w>0&&y>0&&l.jsx("button",{type:"button",className:vi.contextButton,onClick:s,title:k("contextUsage.title"),children:l.jsx("span",{className:vi.context,children:k("status.contextUsed",{pct:_})})}),P&&(u?l.jsx("button",{type:"button",className:vi.goalButton,onClick:u,title:c==null?void 0:c.condition,"aria-label":c!=null&&c.condition?`${k("sidebar.goals")}: ${c.condition}`:k("sidebar.goals"),children:l.jsx("span",{className:vi.goal,children:P})}):l.jsx("span",{className:vi.goal,title:c==null?void 0:c.condition,children:P}))]})]})}),pet=15e3,get=["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."],bet=["正在努力搬砖，请稍候...","老板在身后，快加载啊！","头发掉光前，一定能加载完...","服务器正在深呼吸，准备放大招...","正在向服务器投喂咖啡...","正在赋能全链路，寻找关键抓手...","正在降本增效，优化加载路径...","正在打破部门壁垒，沉淀方法论...","正在拥抱变化，迭代核心价值...","正在对齐颗粒度，打磨底层逻辑...","大力出奇迹，正在强行加载...","只要我不写代码，代码就没有 Bug...","正在把 Bug 转化为 Feature...","只要我不尴尬，Bug 就追不上我...","正在试图理解去年的自己写了什么...","正在猿力觉醒中，请耐心等待...","正在询问产品经理：这需求是真的吗？","正在给产品经理画饼，请稍等...","每一行代码，都在努力让世界变得更好一点点...","每一个伟大的想法，都值得这份耐心的等待...","别急，美好的事物总是需要一点时间去酝酿...","愿你的代码永无 Bug，愿你的梦想终将成真...","哪怕只有 0.1% 的进度，也是在向目标靠近...","加载的是字节，承载的是对技术的热爱..."];function $H(e){return(e??(typeof navigator<"u"?navigator.language.toLowerCase():"")).toLowerCase().startsWith("zh")?bet:get}function yet(){const e=X4(),t=jv(),n=e!=="idle",s=f.useRef(0),r=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 v=xet(b.rawOutput);v!==void 0&&!m.has(b.toolCallId)&&(d+=v,m.add(b.toolCallId))}}return{chars:u,agentTokens:d,isReceiving:h}},[t]),c=f.useRef(a);return c.current=a,a.chars<r.current&&(s.current=a.chars),r.current=a.chars,f.useEffect(()=>{if(!n){s.current=0,o({estimatedOutputTokens:0,isReceivingContent:!1});return}const u=setInterval(()=>{const{chars:d,agentTokens:h,isReceiving:m}=c.current;if(d<s.current){s.current=d,o({estimatedOutputTokens:h+Math.round(d/4),isReceivingContent:m});return}const p=d-s.current;if(p<=0){o(v=>{const x={estimatedOutputTokens:h+Math.round(s.current/4),isReceivingContent:m};return v.estimatedOutputTokens===x.estimatedOutputTokens&&v.isReceivingContent===x.isReceivingContent?v:x});return}let g;p<70?g=3:p<=200?g=Math.max(3,Math.round(p*.2)):g=50;const b=Math.min(s.current+g,d);s.current=b,o({estimatedOutputTokens:h+Math.round(b/4),isReceivingContent:m})},100);return()=>clearInterval(u)},[n]),i}function xet(e){if(typeof e!="object"||e===null||!("type"in e)||e.type!=="task_execution")return;const t=e,n=t.tokenCount;if(typeof n=="number"&&n>0)return n;const s=t.executionSummary;if(typeof s=="object"&&s!==null){const r=s.outputTokens;if(typeof r=="number"&&r>0)return r}}function vet(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.floor(e/1e3)}k`}function xg(e){const t=Math.round(e);return Math.abs(t)<1e6?t.toLocaleString():`${(t/1e6).toFixed(1)}M`}const wet="_status_zld2v_1",ket="_spinner_zld2v_11",_et="_label_zld2v_15",Cet="_meta_zld2v_19",i_={status:wet,spinner:ket,label:_et,meta:Cet},u8=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function Fie({startedAt:e,showPhrase:t=!0}){const n=X4(),{estimatedOutputTokens:s,isReceivingContent:r}=yet(),{language:i,t:o}=ot(),{loadingPhrases:a}=$c(),c=f.useRef(a);c.current=a;const u=f.useCallback(_=>{var C;try{return((C=c.current)==null?void 0:C.call(c,_))??$H(_)}catch(S){return console.warn("[web-shell] loadingPhrases resolver threw; using defaults",S),$H(_)}},[]),[d,h]=f.useState(0),m=f.useRef(Date.now()),[p,g]=f.useState(0),[b,v]=f.useState(()=>u(i)[0]??""),x=n!=="idle";if(f.useEffect(()=>{if(!x){h(0);return}m.current=e??Date.now(),h(zH(m.current));const _=setInterval(()=>{h(zH(m.current))},1e3);return()=>clearInterval(_)},[x,e]),f.useEffect(()=>{if(!t)return;if(n==="idle"){v(u(i)[0]??"");return}const _=()=>{const S=u(i),L=Math.floor(Math.random()*S.length);v(S[L]??"")};_();const C=setInterval(_,pet);return()=>clearInterval(C)},[i,n,u,t]),f.useEffect(()=>{if(n==="idle")return;const _=setInterval(()=>{g(C=>(C+1)%u8.length)},250);return()=>clearInterval(_)},[n]),n==="idle")return null;const y=u8[p%u8.length],w=r?"↓":"↑",k=d<60?`${d}s`:Tet(d*1e3),T=s>0?` · ${w} ${o("stream.tokens",{count:vet(s)})}`:"";return l.jsxs("div",{className:i_.status,children:[l.jsx("span",{className:i_.spinner,children:y}),t&&b&&l.jsx("span",{className:i_.label,children:b}),l.jsxs("span",{className:i_.meta,children:["(",k,T," · ",o("stream.cancel"),")"]})]})}function Tet(e){if(e<=0)return"0s";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/3600),s=Math.floor(t%3600/60),r=t%60,i=[];return n>0&&i.push(`${n}h`),s>0&&i.push(`${s}m`),r>0&&i.push(`${r}s`),i.length>0?i.join(" "):"0s"}function zH(e){return Math.max(0,Math.ceil((Date.now()-e)/1e3))}const Eet="_host_1scjy_1",Aet="_toast_1scjy_13",Net="_message_1scjy_31",jet="_close_1scjy_39",Met="_info_1scjy_58",Iet="_success_1scjy_62",Ret="_warning_1scjy_66",Det="_error_1scjy_70",Ay={host:Eet,toast:Aet,message:Net,close:jet,info:Met,success:Iet,warning:Ret,error:Det};function Let({toasts:e,onDismiss:t,autoDismissMs:n=5e3}){return e.length===0?null:l.jsx("div",{className:Ay.host,role:"status","aria-live":"polite","data-web-shell-toast-host":!0,children:e.map(s=>l.jsx(Pet,{toast:s,onDismiss:t,autoDismissMs:n},s.id))})}function Pet({toast:e,onDismiss:t,autoDismissMs:n}){const{t:s}=ot();return f.useEffect(()=>{const r=window.setTimeout(()=>t(e.id),n);return()=>window.clearTimeout(r)},[n,t,e.id]),l.jsxs("div",{className:`${Ay.toast} ${Ay[e.tone]}`,"data-web-shell-toast":!0,"data-tone":e.tone,children:[l.jsx("div",{className:Ay.message,children:e.message}),l.jsx("button",{type:"button",className:Ay.close,onClick:()=>t(e.id),"aria-label":s("toast.dismiss"),title:s("toast.dismissShort"),children:"x"})]})}const Oet="_panel_n876c_1",Bet="_summary_n876c_10",$et="_progressRing_n876c_27",zet="_stepText_n876c_41",Fet="_statusSegmentWrap_n876c_48",Het="_separator_n876c_55",qet="_statusSegment_n876c_48",Uet="_statusSegmentButton_n876c_61",Vet="_fullText_n876c_83",Wet="_compactText_n876c_87",Get="_detail_n876c_106",Ket="_item_n876c_138",Yet="_icon_n876c_148",Xet="_loadingIcon_n876c_156",Qet="_content_n876c_165",Jet="_completed_n876c_173",Zet="_inProgress_n876c_187",ett="_pending_n876c_192",po={panel:Oet,summary:Bet,progressRing:$et,stepText:zet,statusSegmentWrap:Fet,separator:Het,statusSegment:qet,statusSegmentButton:Uet,fullText:Vet,compactText:Wet,detail:Get,item:Ket,icon:Yet,loadingIcon:Xet,content:Qet,completed:Jet,inProgress:Zet,pending:ett};function ttt(e){switch(e){case"completed":return po.completed;case"in_progress":return po.inProgress;case"pending":return po.pending}}const ntt=f.memo(function({todos:t,title:n,statusItems:s=[]}){const{t:r}=ot();if(t.length===0&&s.length===0)return null;const i=t.length,o=i>0,a=t.findIndex(p=>p.status==="in_progress"),c=a>=0?a:t.findIndex(p=>p.status==="pending"),u=o?c>=0?c+1:i:0,d=o?u/i:0,h=s.map(p=>p.ariaLabel??p.title??(typeof p.label=="string"?p.label:void 0)).filter(Boolean).join(", ")||void 0,m=o?r("todo.stepProgress",{current:u,total:i}):h;return l.jsxs("section",{className:po.panel,"aria-label":n??(o?r("todo.title"):h),tabIndex:0,children:[l.jsxs("div",{className:po.summary,"aria-label":m,children:[o&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:po.progressRing,style:{"--todo-progress":String(d)},"aria-hidden":"true"}),l.jsxs("span",{className:po.stepText,children:[l.jsx("span",{className:po.fullText,children:r("todo.stepProgress",{current:u,total:i})}),l.jsx("span",{className:po.compactText,children:r("todo.stepFraction",{current:u,total:i})})]})]}),s.map((p,g)=>l.jsxs("span",{className:po.statusSegmentWrap,children:[(i>0||g>0)&&l.jsx("span",{className:po.separator,"aria-hidden":"true",children:"·"}),p.onClick?l.jsx("button",{type:"button",className:po.statusSegmentButton,title:p.title,"aria-label":p.ariaLabel,onClick:p.onClick,children:p.label}):l.jsx("span",{className:po.statusSegment,title:p.title,children:p.label})]},p.id))]}),i>0&&l.jsx("div",{className:po.detail,role:"tooltip",children:t.map((p,g)=>l.jsxs("div",{className:`${po.item} ${ttt(p.status)}`,children:[l.jsx("span",{className:po.icon,"aria-hidden":"true",children:p.status==="in_progress"?l.jsx("span",{className:po.loadingIcon}):m4(p.status)}),l.jsx("span",{className:po.content,title:p.content,children:p.content})]},`${p.id||g}:${p.content}`))})]})}),stt="_header_leiy3_1",rtt="_titleRow_leiy3_11",itt="_title_leiy3_11",ott="_subtitle_leiy3_31",o_={header:stt,titleRow:rtt,title:itt,subtitle:ott};function att(e){const{t}=ot();return l.jsxs("div",{className:o_.header,children:[l.jsxs("div",{className:o_.titleRow,children:[l.jsx("span",{children:t("welcome.titlePrefix")}),l.jsx("span",{className:o_.title,children:"Qwen Code"})]}),l.jsx("div",{className:o_.subtitle,children:t("welcome.prompt")})]})}const ltt="_themeDark_1tp31_1",ctt="_themeLight_1tp31_25",FH={themeDark:ltt,themeLight:ctt},utt={sm:"sm:max-w-[420px]",md:"sm:max-w-[560px]",lg:"sm:max-w-[720px]",xl:"sm:max-w-[900px]"},dtt=["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 HH(e){return e?Array.from(e.querySelectorAll(dtt)):[]}const vg=[],Hie=f.createContext(null);function g9(e){return e===null?!0:vg[vg.length-1]===e}function si({title:e,subtitle:t,size:n="md",allowFullscreen:s=!1,onClose:r,children:i}){const{t:o}=ot(),a=z1(),[c,u]=f.useState(!1),d=f.useRef(null),h=f.useRef(r);h.current=r;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;vg.push(k);const T=_=>{_.key!=="Escape"||!_.isComposing&&_.keyCode!==229||!g9(k)||(Object.defineProperty(_,"key",{configurable:!0,value:"Process"}),document.addEventListener("keydown",C=>{C===_&&Reflect.deleteProperty(_,"key")},{capture:!0,once:!0}))};return window.addEventListener("keydown",T,{capture:!0}),()=>{var N,$;window.removeEventListener("keydown",T,{capture:!0});const _=vg.indexOf(k);if(_>=0&&vg.splice(_,1),vg.length===0){(N=m==null?void 0:m.focus)==null||N.call(m);return}const C=Array.from(document.querySelectorAll("[data-keyboard-scope]")),S=C[C.length-1];($=HH(S).find(M=>!M.hasAttribute("data-dialog-close"))??S)==null||$.focus()}},[m]);const v=k=>{p.current=k.target===k.currentTarget,g.current=!1},x=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&&r()},w=a===qr.Light?FH.themeLight:FH.themeDark;return l.jsx(h1,{open:!0,onOpenChange:k=>{k||r()},children:l.jsx(Hie.Provider,{value:b.current,children:l.jsxs(f1,{ref:d,showCloseButton:!1,overlayProps:{onMouseDown:v,onMouseUp:x,onClick:y},className:`${w} ${a===qr.Dark?"dark":""} flex max-h-[min(80vh,calc(100vh-48px))] flex-col gap-0 overflow-hidden p-0 font-mono text-sm ${c?"h-[calc(100vh-32px)] max-h-[calc(100vh-32px)] max-w-[calc(100vw-32px)] sm:max-w-[calc(100vw-32px)]":utt[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||g9(b.current)&&(k.preventDefault(),h.current())},onOpenAutoFocus:k=>{var _;k.preventDefault(),(_=HH(d.current).find(C=>!C.hasAttribute("data-dialog-close"))??d.current)==null||_.focus()},onCloseAutoFocus:k=>k.preventDefault(),children:[l.jsxs(m1,{className:"flex-row items-center gap-2 border-b px-4 py-2.5 text-left",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx(g1,{children:e}),t&&l.jsx(qx,{className:"mt-0.5 text-xs",children:t})]}),s&&l.jsx(qn,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>u(k=>!k),"aria-label":o(c?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":c,title:o(c?"common.exitFullscreen":"common.fullscreen"),children:c?l.jsx(oK,{}):l.jsx(iK,{})}),l.jsx(tA,{asChild:!0,children:l.jsx(qn,{type:"button",variant:"ghost",size:"icon-sm","aria-label":o("common.close"),title:o("common.close"),"data-dialog-close":!0,children:l.jsx(J4,{})})})]}),l.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-4","data-dialog-fullscreen":c?"":void 0,children:i})]})})})}function a_(e,t){return t<=0||e<0?0:e>t-1?t-1:e}const htt=new Set(["button","submit","reset"]),ftt=new Set(["checkbox","radio","button","submit","reset","range","color","file"]);function qH(){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 htt.has(e.type);const n=e.getAttribute("role");return n==="button"||n==="link"||n==="menuitem"}function d8(){const e=typeof document<"u"?document.activeElement:null;if(!e)return!1;const t=e.tagName;return t==="TEXTAREA"?!0:t==="INPUT"?!ftt.has(e.type):e.isContentEditable===!0}function ym({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s,enabled:r=!0}){const i=f.useContext(Hie),o=f.useRef({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s});o.current={itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s};const[a,c]=f.useState(!1);return f.useEffect(()=>{if(!r)return;const u=()=>c(!0),d=()=>c(!1),h=m=>{if(!g9(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(a_(g+1,p));break;case"ArrowUp":m.preventDefault(),u(),o.current.onActiveIndexChange(a_(g-1,p));break;case"Home":if(d8())return;m.preventDefault(),u(),o.current.onActiveIndexChange(0);break;case"End":if(d8())return;m.preventDefault(),u(),o.current.onActiveIndexChange(p-1);break;case"Enter":{if(qH()||g<0)return;m.preventDefault(),o.current.onConfirm(a_(g,p));break}case" ":{if(qH()||d8()||g<0)return;m.preventDefault(),o.current.onConfirm(a_(g,p));break}}};return window.addEventListener("keydown",h),window.addEventListener("mousemove",d),()=>{window.removeEventListener("keydown",h),window.removeEventListener("mousemove",d)}},[i,r]),{keyboardMode:a}}const mtt="_picker_5cmbf_4",ptt="_selected_5cmbf_98",gtt="_disabled_5cmbf_114",btt={picker:mtt,"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:ptt,"picker-keyboard-only":"_picker-keyboard-only_5cmbf_106",disabled:gtt,"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 en(...e){return e.filter(t=>!!t).map(t=>btt[t]).filter(Boolean).join(" ")}const ytt="_list_jbgdx_1",xtt="_row_jbgdx_16",vtt="_selected_jbgdx_32",wtt="_keyboardOnly_jbgdx_39",ktt="_modeName_jbgdx_47",_tt="_modeIcon_jbgdx_51",Stt="_modeText_jbgdx_67",Ctt="_modeDesc_jbgdx_83",Lh={list:ytt,row:xtt,selected:vtt,keyboardOnly:wtt,modeName:ktt,modeIcon:_tt,modeText:Stt,modeDesc:Ctt};function Ttt({currentMode:e,onSelect:t}){const{t:n}=ot(),s=f.useRef(null),r=W4.map(m=>({id:m,name:n(`mode.listLabel.${m}`),description:n(`mode.desc.${m}`)})),i=r.findIndex(m=>m.id===e),[o,a]=f.useState(i>=0?i:0),c=f.useRef(!1);f.useEffect(()=>{c.current||i<0||a(i)},[i]);const u=m=>{c.current=!0,a(m)},d=m=>{const p=r[m];p&&t(p.id)},{keyboardMode:h}=ym({itemCount:r.length,activeIndex:o,onActiveIndexChange:u,onConfirm:d});return f.useEffect(()=>{var p;const m=(p=s.current)==null?void 0:p.children[o];m==null||m.scrollIntoView({block:"nearest"})},[o]),l.jsx("div",{className:`${Lh.list} ${h?Lh.keyboardOnly:""}`,ref:s,role:"listbox",tabIndex:0,"aria-activedescendant":r.length>0?`mode-opt-${o}`:void 0,"aria-label":n("mode.select"),"data-web-shell-approval-mode-dialog":!0,children:r.map((m,p)=>{const g=p===o,b=m.id===e;return l.jsxs("div",{id:`mode-opt-${p}`,role:"option","aria-selected":b,className:`${Lh.row} ${g?Lh.selected:""} ${b?en("dialog-current"):""}`,"data-web-shell-approval-mode-option":!0,"data-mode-id":m.id,onClick:()=>d(p),onMouseMove:()=>u(p),children:[l.jsx("span",{className:Lh.modeIcon,children:l.jsx(Ey,{mode:m.id})}),l.jsxs("span",{className:Lh.modeText,children:[l.jsx("span",{className:Lh.modeName,children:m.name}),l.jsx("span",{className:Lh.modeDesc,children:m.description})]})]},m.id)})})}function AC(e){const[t,n]=f.useState(""),[s,r]=f.useState(""),i=f.useRef(!1),o=f.useRef(""),a=f.useRef(e);a.current=e;const c=f.useCallback(m=>{var p;m!==o.current&&(o.current=m,r(m),(p=a.current)==null||p.call(a,m))},[]),u=f.useCallback(m=>{const p=m.target.value;n(p),i.current||c(p)},[c]),d=f.useCallback(()=>{i.current=!0},[]),h=f.useCallback(m=>{i.current=!1;const p=m.currentTarget.value;n(p),c(p)},[c]);return{filterValue:s,inputProps:{value:t,onChange:u,onCompositionStart:d,onCompositionEnd:h}}}function v4(e,t){const n=Date.now()-new Date(e).getTime(),s=Math.floor(n/6e4);if(s<1)return t("time.justNow");if(s<60)return t("time.minutesAgo",{count:s});const r=Math.floor(s/60);if(r<24)return t("time.hoursAgo",{count:r});const i=Math.floor(r/24);return i<7?t("time.daysAgo",{count:i}):new Date(e).toLocaleDateString()}function ZI({session:e,active:t,current:n,confirmed:s,disabled:r,currentLabel:i,optionId:o,ariaSelected:a,leading:c,trailing:u,resumeSelector:d,onClick:h,onActivate:m}){const{t:p}=ot(),g=e.updatedAt||e.createdAt;return l.jsxs("div",{id:o,role:"option","aria-selected":a??n,"aria-current":n?"true":void 0,"aria-disabled":r||void 0,className:en("picker-item","picker-session-item",t?"selected":void 0,n?"dialog-current":void 0,s?"picker-item-confirmed":void 0,r?"disabled":void 0),title:n?i:void 0,"data-web-shell-resume-session":d?"":void 0,"data-session-id":d?e.sessionId:void 0,onClick:h,onMouseMove:m,children:[l.jsxs("div",{className:en("picker-item-row"),children:[c,l.jsx("span",{className:en("picker-item-title"),children:e.displayName||e.sessionId.slice(0,8)}),u]}),l.jsxs("div",{className:en("picker-item-meta"),children:[l.jsx("span",{children:g&&v4(g,p)}),l.jsx("span",{className:en("picker-item-detail"),children:p("common.clients",{count:e.clientCount??0})}),e.hasActivePrompt&&l.jsx("span",{className:en("picker-item-detail"),children:p("resume.activePrompt")})]})]})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const wd=1e3,eR="session_organization",w4="default",qie=100,Uie=5e4;function rw(e,t={}){const{autoLoad:n=!1,enabled:s=!0,pageSize:r,archiveState:i,view:o,group:a}=t,c=$_({autoLoad:n,enabled:s&&!e,pageSize:r,archiveState:i,view:o,group:a,sourceType:w4}),{reload:u,deleteSession:d,deleteSessions:h}=c,m=ol(),p=f.useRef(0),[g,b]=f.useState({sessions:[],loading:!1}),v=f.useCallback(async()=>{if(!e||!s)return[];const T=++p.current;b(_=>({cwd:e,sessions:_.cwd===e?_.sessions:[],loading:!0}));try{const C=(await m.client.workspaceByCwd(e).listWorkspaceSessions({pageSize:r,archiveState:i,view:o,group:a,sourceType:w4})).map(S=>({...S,workspaceCwd:e}));return p.current===T&&b({cwd:e,sessions:C,loading:!1}),C}catch(_){const C=_ instanceof Error?_:new Error(String(_));throw p.current===T&&b({cwd:e,sessions:[],loading:!1,error:C}),C}},[i,s,a,r,o,m.client,e]);f.useEffect(()=>{if(e)return p.current+=1,b({cwd:e,sessions:[],loading:n&&s}),n&&s&&v().catch(()=>{}),()=>{p.current+=1}},[n,s,v,e]);const x=f.useCallback(()=>e?v():u(),[u,v,e]),y=f.useCallback(async T=>{if(!e)return h(T);const _=await m.client.workspaceByCwd(e).deleteSessionsData(T);return await v(),_},[h,v,m.client,e]),w=f.useCallback(async T=>{if(!e)return d(T);const _=await y([T]);if(_.errors.length>0)throw new Error(_.errors[0].error);return _.removed.length>0||_.notFound.length>0},[d,y,e]);if(!e)return c;const k=g.cwd===e?g:void 0;return{sessions:(k==null?void 0:k.sessions)??[],loading:(k==null?void 0:k.loading)??(n&&s),error:k==null?void 0:k.error,reload:x,deleteSession:w,deleteSessions:y,releaseSession:c.releaseSession}}const b9="resume-session-list",UH=e=>`${b9}-opt-${e}`;function Ett({onSelect:e,onClose:t,workspaceCwd:n}){const{t:s}=ot(),r=Dl(),{sessions:i,loading:o,error:a}=rw(n,{autoLoad:!0}),c=r.sessionId,[u,d]=f.useState(-1),{filterValue:h,inputProps:m}=AC(()=>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 v=y=>{const w=b[y];w&&(e(w.sessionId),t())},{keyboardMode:x}=ym({itemCount:b.length,activeIndex:u,onActiveIndexChange:d,onConfirm:v});return f.useEffect(()=>{var y;(y=g.current)==null||y.focus()},[]),l.jsxs("div",{className:en("picker","picker-in-shell"),"data-web-shell-resume-dialog":!0,children:[l.jsxs("div",{className:en("picker-search"),children:[l.jsxs("span",{className:en("picker-search-label"),children:[s("resume.search"),":"," "]}),l.jsx("input",{ref:g,className:en("picker-search-input"),"aria-label":s("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":b9,"aria-activedescendant":u>=0&&u<b.length?UH(u):void 0,...m,placeholder:""})]}),l.jsx("div",{className:en("picker-sep")}),l.jsxs("div",{id:b9,role:"listbox",className:en("picker-list",x?"picker-keyboard-only":void 0),ref:p,children:[o&&l.jsx("div",{className:en("picker-empty"),children:s("common.loading")}),!o&&a&&l.jsx("div",{className:en("picker-empty"),children:a.message||s("resume.failedToLoad")}),!o&&!a&&b.length===0&&l.jsx("div",{className:en("picker-empty"),children:h?s("resume.noMatch",{query:h}):s("resume.none")}),!o&&b.map((y,w)=>l.jsx(ZI,{session:y,optionId:UH(w),active:w===u,current:y.sessionId===c,currentLabel:s("resume.current"),resumeSelector:!0,onClick:()=>v(w),onActivate:()=>d(w)},y.sessionId))]})]})}const Att="_layout_1sigx_1",Ntt="_list_1sigx_9",jtt="_row_1sigx_23",Mtt="_selected_1sigx_39",Itt="_keyboardOnly_1sigx_46",Rtt="_label_1sigx_54",Dtt="_divider_1sigx_58",Ltt="_number_1sigx_65",Ptt="_provider_1sigx_71",Ott="_badge_1sigx_86",Btt="_detail_1sigx_92",$tt="_detailRow_1sigx_104",ztt="_detailLabel_1sigx_111",Ftt="_detailValue_1sigx_117",Htt="_empty_1sigx_122",ya={layout:Att,list:Ntt,row:jtt,selected:Mtt,keyboardOnly:Itt,label:Rtt,divider:Dtt,number:Ltt,provider:Ptt,badge:Ott,detail:Btt,detailRow:$tt,detailLabel:ztt,detailValue:Ftt,empty:Htt};function qtt(e,t){return e?`${e.toLocaleString()} ${t("contextUsage.tokens")}`:t("model.contextWindow.unknown")}function Utt(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 VH(e){if(e.authType)return e.authType;const t=e.id.match(/\(([^()]+)\)$/);return t==null?void 0:t[1]}function Vtt(e){return e.label?e.label:e.baseModelId?e.baseModelId:e.id.replace(/\([^()]+\)$/,"")}function Wtt(e){return[e.authType??"",e.id,e.baseUrl??"",e.envKey??""].join("\0")}function Gtt(e,t){return t?e.baseModelId??e.id.replace(/\([^()]+\)$/,""):e.id}function l_({label:e,value:t}){return l.jsxs("div",{className:ya.detailRow,children:[l.jsx("span",{className:ya.detailLabel,children:e}),l.jsx("span",{className:ya.detailValue,children:t})]})}function Ktt({mode:e="main",onSelect:t,models:n,currentModelId:s}){const r=Dl(),i=s??r.currentModel??"",o=f.useMemo(()=>n??r.models??[],[n,r.models]),{t:a}=ot(),c=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 v=k=>{b.current=!0,g(k)};f.useEffect(()=>{p>=o.length&&o.length>0&&g(o.length-1)},[o.length,p]);const x=o[p]??o[0],y=k=>{const T=o[k];T&&t(Gtt(T,u))},{keyboardMode:w}=ym({itemCount:o.length,activeIndex:p,onActiveIndexChange:v,onConfirm:y});return f.useEffect(()=>{var T;const k=(T=c.current)==null?void 0:T.children[p];k==null||k.scrollIntoView({block:"nearest"})},[p]),l.jsxs("div",{className:ya.layout,children:[l.jsxs("div",{className:`${ya.list} ${w?ya.keyboardOnly:""}`,ref:c,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?l.jsx("div",{className:ya.empty,children:a("model.none")}):null,o.map((k,T)=>{const _=T===p,C=T===m,S=VH(k);return l.jsxs("div",{id:`model-opt-${T}`,role:"option","aria-selected":C,className:`${ya.row} ${_?ya.selected:""} ${C?en("dialog-current"):""}`,"data-web-shell-model-option":!0,"data-model-id":k.id,onClick:()=>y(T),onMouseMove:()=>v(T),children:[l.jsxs("span",{className:ya.number,children:[T+1,"."]}),S?l.jsxs("span",{className:ya.provider,children:["[",S,"]"]}):null,l.jsx("span",{className:ya.label,children:Vtt(k)}),k.isRuntime?l.jsx("span",{className:ya.badge,children:a("common.runtime")}):null]},Wtt(k))})]}),x?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:ya.divider}),l.jsxs("div",{className:ya.detail,children:[l.jsx(l_,{label:a("model.modality"),value:Utt(x.modalities,a)}),l.jsx(l_,{label:a("model.contextWindow"),value:qtt(x.contextWindow,a)}),VH(x)!=="qwen-oauth"?l.jsxs(l.Fragment,{children:[l.jsx(l_,{label:a("model.baseUrl"),value:x.baseUrl??a("model.default")}),l.jsx(l_,{label:a("model.apiKey"),value:x.envKey??a("model.notSet")})]}):null]})]}):null]})}const Ytt="_body_2kfet_1",Xtt="_hint_2kfet_8",Qtt="_list_2kfet_13",Jtt="_empty_2kfet_21",Ztt="_row_2kfet_27",ent="_rowSelected_2kfet_51",tnt="_badge_2kfet_56",nnt="_label_2kfet_74",snt="_footer_2kfet_78",rnt="_count_2kfet_86",int="_actions_2kfet_91",ont="_cancel_2kfet_96",ant="_confirm_2kfet_97",dl={body:Ytt,hint:Xtt,list:Qtt,empty:Jtt,row:Ztt,rowSelected:ent,badge:tnt,label:nnt,footer:snt,count:rnt,actions:int,cancel:ont,confirm:ant};function lnt({models:e,current:t,max:n,onConfirm:s,onClose:r}){const{t:i}=ot(),[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}),c=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 l.jsxs("div",{className:dl.body,children:[l.jsx("div",{className:dl.hint,children:i("settings.models.fallbacks.hint",{max:n})}),l.jsxs("div",{className:dl.list,role:"group","aria-label":i("settings.models.fallbacks.title"),children:[c.length===0&&l.jsx("div",{className:dl.empty,children:i("settings.models.fallbacks.empty")}),c.map(d=>{const h=o.indexOf(d.baseId),m=h>=0,p=o.length>=n&&!m;return l.jsxs("button",{type:"button","aria-pressed":m,className:`${dl.row} ${m?dl.rowSelected:""}`,"aria-disabled":p||void 0,title:p?i("settings.models.fallbacks.limitReached",{max:n}):void 0,onClick:()=>u(d.baseId),children:[l.jsx("span",{className:dl.badge,children:m?h+1:""}),l.jsx("span",{className:dl.label,children:d.label})]},d.baseId)})]}),l.jsxs("div",{className:dl.footer,children:[l.jsxs("span",{className:dl.count,children:[o.length,"/",n]}),l.jsxs("div",{className:dl.actions,children:[l.jsx("button",{type:"button",className:dl.cancel,onClick:r,children:i("settings.models.cancel")}),l.jsx("button",{type:"button",className:dl.confirm,onClick:()=>s(o),children:i("settings.models.fallbacks.confirm")})]})]})]})}function ip(e){return e.replace(/[：:\s]+$/u,"")}const cnt="_panel_irhhk_1",unt="_embedded_irhhk_13",dnt="_footer_irhhk_21",hnt="_titleLine_irhhk_25",fnt="_icon_irhhk_32",mnt="_title_irhhk_25",pnt="_subtitle_irhhk_44",gnt="_text_irhhk_49",bnt="_options_irhhk_55",ynt="_option_irhhk_55",xnt="_optionActive_irhhk_77",vnt="_optionLabel_irhhk_81",wnt="_optionIcon_irhhk_86",knt="_optionContent_irhhk_119",_nt="_optionDesc_irhhk_129",Snt="_badge_irhhk_135",Cnt="_toolDetail_irhhk_170",Tnt="_toolDetailTitle_irhhk_175",Ent="_toolDetailBody_irhhk_180",Ant="_toolList_irhhk_181",Nnt="_textInput_irhhk_193",jnt="_textArea_irhhk_211",Mnt="_summary_irhhk_231",Int="_summaryRow_irhhk_238",Rnt="_summaryLabel_irhhk_244",Dnt="_summaryValue_irhhk_250",Lnt="_summaryBlockTitle_irhhk_255",Pnt="_summaryBlock_irhhk_255",Ont="_manageList_irhhk_295",Bnt="_manageItem_irhhk_301",$nt="_manageItemExpanded_irhhk_307",znt="_manageRow_irhhk_312",Fnt="_manageRowActive_irhhk_329",Hnt="_manageIcon_irhhk_333",qnt="_manageName_irhhk_362",Unt="_levelTag_irhhk_370",Vnt="_manageChevron_irhhk_380",Wnt="_manageChevronExpanded_irhhk_398",Gnt="_manageDetail_irhhk_402",Knt="_manageDetailInner_irhhk_409",Ynt="_manageDetailHeader_irhhk_419",Xnt="_manageActions_irhhk_426",Qnt="_manageButton_irhhk_433",Jnt="_dangerButton_irhhk_453",Znt="_deleteText_irhhk_457",est="_viewerRow_irhhk_487",tst="_viewerLabel_irhhk_500",nst="_viewerField_irhhk_507",sst="_viewerSectionTitle_irhhk_512",rst="_viewerBlock_irhhk_518",ist="_closed_irhhk_524",ost="_closedText_irhhk_528",ast="_loading_irhhk_534",lst="_error_irhhk_539",cst="_createWizard_irhhk_545",ust="_createSteps_irhhk_551",dst="_createStepPill_irhhk_559",hst="_createStepPillActive_irhhk_571",fst="_createStepPillDone_irhhk_576",mst="_createStepNumber_irhhk_580",pst="_createStepLabel_irhhk_591",gst="_createBody_irhhk_597",bst="_createActions_irhhk_601",ut={panel:cnt,embedded:unt,footer:dnt,titleLine:hnt,icon:fnt,title:mnt,subtitle:pnt,text:gnt,options:bnt,option:ynt,optionActive:xnt,optionLabel:vnt,optionIcon:wnt,optionContent:knt,optionDesc:_nt,badge:Snt,toolDetail:Cnt,toolDetailTitle:Tnt,toolDetailBody:Ent,toolList:Ant,textInput:Nnt,textArea:jnt,summary:Mnt,summaryRow:Int,summaryLabel:Rnt,summaryValue:Dnt,summaryBlockTitle:Lnt,summaryBlock:Pnt,manageList:Ont,manageItem:Bnt,manageItemExpanded:$nt,manageRow:znt,manageRowActive:Fnt,manageIcon:Hnt,manageName:qnt,levelTag:Unt,manageChevron:Vnt,manageChevronExpanded:Wnt,manageDetail:Gnt,manageDetailInner:Knt,manageDetailHeader:Ynt,manageActions:Xnt,manageButton:Qnt,dangerButton:Jnt,deleteText:Znt,viewerRow:est,viewerLabel:tst,viewerField:nst,viewerSectionTitle:sst,viewerBlock:rst,closed:ist,closedText:ost,loading:ast,error:lst,createWizard:cst,createSteps:ust,createStepPill:dst,createStepPillActive:hst,createStepPillDone:fst,createStepNumber:mst,createStepLabel:pst,createBody:gst,createActions:bst};function Vie(e){if(e==="project")return"workspace";if(e==="user")return"global"}function Wie(e){return Vie(e.level)!==void 0&&!e.isBuiltin&&e.level!=="extension"}function yst(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 ku=ip;function xst(e){return e.displayName||e.name}function Gie(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 Kie(e){const t=e.toLowerCase();return["edit","write","delete","move","patch","replace","create"].some(n=>t.includes(n))}function Yie(e){const t=e.toLowerCase();return["shell","exec","run","command","terminal","bash","spawn"].some(n=>t.includes(n))}function vst(e,t){if(!t||t.length===0)return 0;const n=new Set(t),s=e.findIndex(r=>r.id==="all"||r.tools.length!==n.size?!1:r.tools.every(i=>n.has(i)));return s>=0?s:0}function wst({mode:e,embedded:t=!1,onMessage:n,onClose:s}){const{t:r}=ot(),{agents:i,loading:o,reload:a,getAgent:c,createAgent:u,generateAgent:d,deleteAgent:h}=Rme({autoLoad:!0}),{tools:m}=eK({autoLoad:!0}),[p,g]=f.useState(!1),[b,v]=f.useState(()=>e==="manage"?"manage":e==="create"||e==="create-user"||e==="create-project"?"create":"menu"),[x,y]=f.useState(0),[w,k]=f.useState(0),[T,_]=f.useState(null),[C,S]=f.useState(null),[L,N]=f.useState(!1),[$,M]=f.useState(null),[P,E]=f.useState(1),[O,z]=f.useState(()=>e==="create-user"?"global":"workspace"),[F,B]=f.useState("manual"),[W,I]=f.useState(""),[Y,V]=f.useState(""),[j,ee]=f.useState(""),[se,X]=f.useState([]),[Q,ue]=f.useState(0),[re,J]=f.useState(!1),[q,Z]=f.useState(!1),he=f.useRef(0),ye=f.useCallback(()=>{g(!0),s()},[s]),oe=f.useMemo(()=>{const De=i.filter(Be=>Be.level==="project"),Ne=i.filter(Be=>Be.level==="user"),tt=i.filter(Be=>Be.level==="builtin"),Se=i.filter(Be=>Be.level==="extension");return{project:De,user:Ne,builtin:tt,extension:Se}},[i]),we=f.useMemo(()=>[...oe.project,...oe.user,...oe.builtin,...oe.extension],[oe]),Ve=f.useMemo(()=>{const De=m.filter(Be=>Be.enabled).map(xst).sort((Be,le)=>Be.localeCompare(le)),Ne=De.filter(Gie),tt=De.filter(Kie),Se=De.filter(Yie);return[{id:"all",label:r("agent.create.tools.all"),tools:[]},{id:"read",label:r("agent.create.tools.readOnly"),tools:Ne},{id:"edit",label:r("agent.create.tools.readEdit"),tools:[...new Set([...Ne,...tt])]},{id:"execute",label:r("agent.create.tools.readEditExecute"),tools:[...new Set([...Ne,...tt,...Se])]}]},[r,m]);f.useEffect(()=>{if(b!=="manage")return;const De=C!==null?we[C]:void 0;De&&c(De.name).then(_).catch(Ne=>M(Ne instanceof Error?Ne.message:String(Ne)))},[b,we,C,c]),f.useEffect(()=>{w>=we.length&&we.length>0&&k(we.length-1),C!==null&&C>=we.length&&S(null)},[C,we.length,w]);const lt=f.useCallback((De=w)=>{const Ne=we[De];if(!Ne||!Wie(Ne))return;const tt=Vie(Ne.level);tt&&(N(!0),h(Ne.name,tt).then(()=>{n(r("agent.deleted",{name:Ne.name})),_(null),S(null),k(0),a()}).catch(Se=>M(Se instanceof Error?Se.message:String(Se))).finally(()=>N(!1)))},[we,w,h,n,a,r]),Et=f.useCallback(()=>{if(!W.trim()||!Y.trim()||!j.trim()){M(r("agent.create.required"));return}N(!0),u({name:W.trim(),description:Y.trim(),systemPrompt:j.trim(),scope:O,tools:se}).then(De=>{n(r("agent.created",{name:De.agent.name})),ye()}).catch(De=>M(De instanceof Error?De.message:String(De))).finally(()=>N(!1))},[W,Y,j,O,se,u,n,ye,r]),pt=f.useCallback(async()=>{const De=Y.trim();if(!De||re)return;const Ne=he.current+1;he.current=Ne,J(!0),Z(!1),M(null);try{const tt=await d(De);if(he.current!==Ne)return;I(tt.name),V(tt.description),ee(tt.systemPrompt),E(F==="manual"?6:4),ue(0)}catch(tt){if(he.current!==Ne)return;M(r("agent.create.generateFailed",{error:tt instanceof Error?tt.message:String(tt)})),Z(!0)}finally{he.current===Ne&&J(!1)}},[Y,re,F,d,r]),je=f.useCallback(De=>{if(De==="name"&&W.trim())E(4),Z(!0);else if(De==="prompt"&&j.trim())E(5),Z(!0);else if(De==="desc"&&Y.trim()){if(F==="qwen"){pt();return}E(F==="manual"?6:4),ue(0),Z(!1)}},[W,Y,j,F,pt]);if(p)return l.jsx("div",{className:`${ut.panel} ${t?ut.embedded:""} ${ut.closed}`,children:l.jsx("div",{className:ut.closedText,children:r("agents.closed")})});if(o&&i.length===0)return l.jsxs("div",{className:`${ut.panel} ${t?ut.embedded:""}`,children:[l.jsxs("div",{className:ut.titleLine,children:[l.jsx("span",{className:ut.icon,children:"?"}),l.jsx("span",{className:ut.title,children:r("agents.title")})]}),l.jsx("div",{className:ut.loading,children:r("common.loading")})]});const Ae=r("agents.title");return l.jsxs("div",{className:`${ut.panel} ${t?ut.embedded:""}`,children:[!t&&b!=="create"&&l.jsxs("div",{className:ut.titleLine,children:[l.jsx("span",{className:ut.icon,children:"?"}),l.jsx("span",{className:ut.title,children:Ae}),l.jsx("span",{className:ut.subtitle,children:r("agent.count",{count:i.length})})]}),$&&l.jsx("div",{className:ut.error,children:$}),b==="menu"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:ut.text,children:r("agent.selectAction")}),l.jsxs("div",{className:ut.options,children:[l.jsx(op,{idx:0,active:x===0,label:r("agent.manage"),desc:r("agent.manage.desc"),onClick:()=>{y(0),v("manage")},onHover:()=>y(0)}),l.jsx(op,{idx:1,active:x===1,label:r("agent.create"),desc:r("agent.create.desc"),onClick:()=>{y(1),v("create")},onHover:()=>y(1)})]}),l.jsx("div",{className:ut.footer,children:r("agent.footer.nav")})]}),b==="manage"&&l.jsx(kst,{agents:we,expandedAgentIdx:C,selectedAgent:T,busy:L,onToggleAgent:De=>{k(De),S(Ne=>Ne===De?null:De),_(null)},onDelete:De=>{L||lt(De)},t:r}),b==="create"&&l.jsx(_st,{step:P,method:F,scope:O,name:W,desc:Y,prompt:j,tools:se,toolCategories:Ve,selIdx:Q,busy:L,generating:re,inputFocused:q,onSetName:I,onSetDesc:V,onSetPrompt:ee,onInputNext:je,onInputFocus:()=>Z(!0),onInputBlur:()=>Z(!1),onSetStep:E,onSetSelectedIndex:ue,onSelectLocation:De=>{ue(De),z(De===0?"workspace":"global")},onSelectMethod:De=>{ue(De),B(De===0?"qwen":"manual")},onSelectTools:De=>{var Ne;ue(De),X(((Ne=Ve[De])==null?void 0:Ne.tools)??[])},onSave:()=>{L||Et()},t:r})]})}function op({idx:e,active:t,label:n,desc:s,badge:r,numbered:i=!1,onClick:o,onHover:a}){return l.jsxs("div",{className:`${ut.option} ${t?ut.optionActive:""}`,onClick:o,onMouseEnter:a,children:[l.jsx("span",{className:ut.optionIcon,"aria-hidden":"true"}),l.jsxs("span",{className:ut.optionContent,children:[l.jsxs("span",{className:ut.optionLabel,children:[i?`${e+1}. `:"",n,r&&l.jsx("span",{className:ut.badge,children:r})]}),s&&l.jsx("span",{className:ut.optionDesc,children:s})]})]})}function kst({agents:e,expandedAgentIdx:t,selectedAgent:n,busy:s,onToggleAgent:r,onDelete:i,t:o}){const[a,c]=f.useState(null),u=f.useMemo(()=>new Set(e.filter(d=>d.level==="project").map(d=>d.name)),[e]);return e.length===0?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:ut.text,children:o("agent.empty")}),l.jsx("div",{className:ut.text,children:o("agent.createFirstHint")})]}):l.jsx("div",{className:ut.manageList,children:e.map((d,h)=>{const m=t===h,p=m&&(n==null?void 0:n.name)===d.name?n:null,g=Wie(d),b=(p==null?void 0:p.tools)??[],v=b.length===0||b.includes("*")?o("agent.create.tools.all"):b.join(", ");return l.jsxs("div",{className:`${ut.manageItem} ${m?ut.manageItemExpanded:""}`,children:[l.jsxs("button",{type:"button",className:`${ut.manageRow} ${m?ut.manageRowActive:""}`,onClick:()=>{c(null),r(h)},children:[l.jsx("span",{className:ut.manageIcon,"aria-hidden":"true"}),l.jsx("span",{className:ut.manageName,children:d.name}),l.jsx("span",{className:ut.levelTag,children:yst(d.level,o)}),d.level==="user"&&u.has(d.name)?l.jsx("span",{className:ut.levelTag,children:o("agent.overriddenBadge")}):null,l.jsx("span",{className:`${ut.manageChevron} ${m?ut.manageChevronExpanded:""}`})]}),m?l.jsx("div",{className:ut.manageDetail,children:p?l.jsxs("div",{className:ut.manageDetailInner,children:[l.jsx("div",{className:ut.manageDetailHeader,children:g?l.jsx("div",{className:ut.manageActions,children:a===h?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:ut.deleteText,children:s?o("agent.delete.loading"):o("agent.delete.confirm",{name:d.name})}),l.jsx("button",{type:"button",className:ut.manageButton,onClick:()=>c(null),disabled:s,children:o("common.cancel")}),l.jsx("button",{type:"button",className:`${ut.manageButton} ${ut.dangerButton}`,onClick:()=>i(h),disabled:s,children:o("agent.action.delete")})]}):l.jsx("button",{type:"button",className:`${ut.manageButton} ${ut.dangerButton}`,onClick:()=>c(h),disabled:s,children:o("agent.action.delete")})}):null}),l.jsxs("div",{className:ut.viewerField,children:[l.jsx("div",{className:ut.viewerSectionTitle,children:ku(o("agent.toolsLabel"))}),l.jsx("div",{className:ut.viewerBlock,children:v})]}),l.jsxs("div",{className:ut.viewerField,children:[l.jsx("div",{className:ut.viewerSectionTitle,children:ku(o("agent.filePathLabel"))}),l.jsx("div",{className:ut.viewerBlock,children:p.filePath||"—"})]}),p.model?l.jsxs("div",{className:ut.viewerRow,children:[l.jsx("span",{className:ut.viewerLabel,children:ku(o("agent.modelLabel"))}),l.jsx("span",{children:p.model})]}):null,l.jsxs("div",{className:ut.viewerField,children:[l.jsx("div",{className:ut.viewerSectionTitle,children:ku(o("agent.descriptionLabel"))}),l.jsx("div",{className:ut.viewerBlock,children:p.description||"—"})]}),l.jsxs("div",{className:ut.viewerField,children:[l.jsx("div",{className:ut.viewerSectionTitle,children:ku(o("agent.systemPromptLabel"))}),l.jsx("div",{className:ut.viewerBlock,children:p.systemPrompt||"—"})]})]}):l.jsx("div",{className:ut.loading,children:o("common.loading")})}):null]},`${d.level}:${d.name}`)})})}function _st({step:e,method:t,scope:n,name:s,desc:r,prompt:i,tools:o,toolCategories:a,selIdx:c,busy:u,generating:d,inputFocused:h,onSetName:m,onSetDesc:p,onSetPrompt:g,onInputNext:b,onInputFocus:v,onInputBlur:x,onSetStep:y,onSetSelectedIndex:w,onSelectLocation:k,onSelectMethod:T,onSelectTools:_,onSave:C,t:S}){const L=f.useRef(null),N=f.useRef(null),$=f.useRef(null);f.useEffect(()=>{var Y,V,j,ee;h&&(t==="manual"?e===3?(Y=L.current)==null||Y.focus():e===4?(V=$.current)==null||V.focus():e===5&&((j=N.current)==null||j.focus()):e===3&&((ee=N.current)==null||ee.focus()))},[e,t,h]);const M=t==="manual"?6:4,P=M+1,E=t==="manual"?[S("agent.create.location"),S("agent.create.method"),S("agent.create.name"),S("agent.create.prompt"),S("agent.create.description"),S("agent.create.toolsSelection")]:[S("agent.create.location"),S("agent.create.method"),S("agent.create.describeAgent"),S("agent.create.toolsSelection")],O=Y=>Y===1?n==="workspace"?0:1:Y===2?t==="qwen"?0:1:Y===M?vst(a,o):0,z=Y=>{y(Y),w(O(Y)),t==="manual"&&(Y===3||Y===4||Y===5)||t==="qwen"&&Y===3?v():x()},F=()=>{e<=1||d||z(e-1)},B=()=>{if(!d){if(e===1){z(2);return}if(e===2){z(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===M&&(_(c),z(P))}},W=d||t==="manual"&&e===3&&!s.trim()||t==="manual"&&e===4&&!i.trim()||t==="manual"&&e===5&&!r.trim()||t==="qwen"&&e===3&&!r.trim();let I=null;if(e===1&&(I=l.jsx(l.Fragment,{children:l.jsxs("div",{className:ut.options,children:[l.jsx(op,{idx:0,active:c===0,label:S("agent.create.project.cli"),numbered:!0,onClick:()=>k(0)}),l.jsx(op,{idx:1,active:c===1,label:S("agent.create.user.cli"),numbered:!0,onClick:()=>k(1)})]})})),e===2&&(I=l.jsx(l.Fragment,{children:l.jsxs("div",{className:ut.options,children:[l.jsx(op,{idx:0,active:c===0,label:S("agent.create.method.qwen.recommended"),numbered:!0,onClick:()=>T(0)}),l.jsx(op,{idx:1,active:c===1,label:S("agent.create.method.manual"),numbered:!0,onClick:()=>T(1)})]})})),t==="manual"&&e===3&&(I=l.jsxs(l.Fragment,{children:[l.jsx("div",{className:ut.text,children:S("agent.create.nameHelp")}),l.jsx("input",{ref:L,className:ut.textInput,value:s,onChange:Y=>m(Y.target.value),onFocus:v,onBlur:x,placeholder:S("agent.create.namePlaceholder"),autoFocus:!0})]})),t==="manual"&&e===4&&(I=l.jsxs(l.Fragment,{children:[l.jsx("div",{className:ut.text,children:S("agent.create.promptHelp")}),l.jsx("textarea",{ref:$,className:ut.textArea,value:i,onChange:Y=>g(Y.target.value),onFocus:v,onBlur:x,placeholder:S("agent.create.promptPlaceholder.cli"),autoFocus:!0})]})),t==="manual"&&e===5&&(I=l.jsxs(l.Fragment,{children:[l.jsx("div",{className:ut.text,children:S("agent.create.manualDescHelp")}),l.jsx("textarea",{ref:N,className:ut.textArea,value:r,onChange:Y=>p(Y.target.value),onFocus:v,onBlur:x,placeholder:S("agent.create.manualDescPlaceholder"),autoFocus:!0})]})),t==="qwen"&&e===3&&(I=l.jsxs(l.Fragment,{children:[l.jsx("div",{className:ut.text,children:S("agent.create.qwenHint")}),d?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:ut.text,children:S("agent.create.generatingConfig")}),l.jsx("div",{className:ut.footer,children:S("agent.footer.generating")})]}):l.jsx(l.Fragment,{children:l.jsx("textarea",{ref:N,className:ut.textArea,value:r,onChange:Y=>p(Y.target.value),onFocus:v,onBlur:x,placeholder:S("agent.create.qwenPlaceholder"),autoFocus:!0})})]})),e===M){const Y=a[c]??a[0],V=(Y==null?void 0:Y.tools)??[],j=(Y==null?void 0:Y.id)==="all"?S("agent.create.tools.allInfo"):V.length>0?V.join(", "):S("agent.create.tools.none"),ee=V.filter(Gie),se=V.filter(Kie),X=V.filter(Yie);I=l.jsxs(l.Fragment,{children:[l.jsx("div",{className:ut.options,children:a.map((Q,ue)=>l.jsx(op,{idx:ue,active:c===ue,label:Q.label,numbered:!0,onClick:()=>_(ue)},Q.id))}),l.jsx("div",{className:ut.toolDetail,children:(Y==null?void 0:Y.id)==="all"?l.jsx("div",{className:ut.toolDetailBody,children:j}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:ut.toolDetailTitle,children:S("agent.create.tools.selected")}),l.jsx("div",{className:ut.toolList,children:V.length===0?j:l.jsxs(l.Fragment,{children:[ee.length>0&&l.jsxs("div",{children:[S("agent.create.tools.readOnlyLabel")," ",ee.join(", ")]}),se.length>0&&l.jsxs("div",{children:[S("agent.create.tools.editLabel")," ",se.join(", ")]}),X.length>0&&l.jsxs("div",{children:[S("agent.create.tools.executionLabel")," ",X.join(", ")]})]})})]})})]})}if(e===P){const Y=o.length===0?"*":o.join(", ");I=l.jsx(l.Fragment,{children:l.jsxs("div",{className:ut.summary,children:[l.jsxs("div",{className:ut.summaryRow,children:[l.jsx("span",{className:ut.summaryLabel,children:ku(S("agent.create.name"))}),l.jsx("span",{className:ut.summaryValue,children:s||"—"})]}),l.jsxs("div",{className:ut.summaryRow,children:[l.jsx("span",{className:ut.summaryLabel,children:ku(S("agent.location"))}),l.jsx("span",{className:ut.summaryValue,children:S(n==="workspace"?"agent.create.project.cli":"agent.create.user.cli")})]}),l.jsxs("div",{className:ut.summaryRow,children:[l.jsx("span",{className:ut.summaryLabel,children:ku(S("agent.toolsLabel"))}),l.jsx("span",{className:ut.summaryValue,children:Y})]}),l.jsx("div",{className:ut.summaryBlockTitle,children:ku(S("agent.descriptionLabel"))}),l.jsx("div",{className:ut.summaryBlock,children:r||"—"}),l.jsx("div",{className:ut.summaryBlockTitle,children:ku(S("agent.systemPromptLabel"))}),l.jsx("div",{className:ut.summaryBlock,children:i||"—"})]})})}return l.jsxs("div",{className:ut.createWizard,children:[l.jsx("div",{className:ut.createSteps,children:E.map((Y,V)=>{const j=V+1;return l.jsxs("div",{className:`${ut.createStepPill} ${j===Math.min(e,M)?ut.createStepPillActive:""} ${j<Math.min(e,M)?ut.createStepPillDone:""}`,children:[l.jsx("span",{className:ut.createStepNumber,children:j}),l.jsx("span",{className:ut.createStepLabel,children:Y})]},`${j}:${Y}`)})}),l.jsx("div",{className:ut.createBody,children:I}),l.jsxs("div",{className:ut.createActions,children:[l.jsx("button",{type:"button",className:ut.manageButton,onClick:F,disabled:e<=1||d||u,children:S("common.previous")}),e===P?l.jsx("button",{type:"button",className:ut.manageButton,onClick:C,disabled:u,children:S(u?"agent.create.loading":"agent.create.save")}):l.jsx("button",{type:"button",className:ut.manageButton,onClick:B,disabled:W,children:S("common.next")})]})]})}const Sst="_page_1np31_1",Cst="_tabs_1np31_11",Tst="_memoryCard_1np31_19",Est="_memoryCardActive_1np31_35",Ast="_memoryTitle_1np31_44",Nst="_detailPath_1np31_48",jst="_status_1np31_49",Mst="_actionButton_1np31_54",Ist="_primaryButton_1np31_55",Rst="_secondaryButton_1np31_56",Dst="_detail_1np31_48",Lst="_detailHeader_1np31_79",Pst="_detailTitleWrap_1np31_87",Ost="_actions_1np31_91",Bst="_content_1np31_105",$st="_editor_1np31_106",zst="_editorFooter_1np31_127",Eo={page:Sst,tabs:Cst,memoryCard:Tst,memoryCardActive:Est,memoryTitle:Ast,detailPath:Nst,status:jst,actionButton:Mst,primaryButton:Ist,secondaryButton:Rst,detail:Dst,detailHeader:Lst,detailTitleWrap:Pst,actions:Ost,content:Bst,editor:$st,editorFooter:zst};function WH(e,t){return e.find(n=>n.scope===t)}function GH(e,t){return t(e==="global"?"memory.global":"memory.project")}function Fst({refreshSignal:e=0,addSignal:t=0,addScope:n="workspace",onMessage:s}){var I,Y;const{t:r}=ot(),{files:i,loading:o,error:a,readFile:c,reload:u,writeMemory:d}=Dme({autoLoad:!0}),h=f.useRef(null),m=f.useRef(0),[p,g]=f.useState("workspace"),[b,v]=f.useState("view"),[x,y]=f.useState(""),[w,k]=f.useState(""),[T,_]=f.useState(!1),[C,S]=f.useState(!1),[L,N]=f.useState(null),$=f.useRef(0),M=f.useMemo(()=>{const V=WH(i,"global"),j=WH(i,"workspace");return[{scope:"workspace",title:r("memory.project"),description:r("memory.project.desc"),fallbackPath:"QWEN.md",file:j},{scope:"global",title:r("memory.global"),description:r("memory.global.desc"),fallbackPath:"~/.qwen/QWEN.md",file:V}]},[i,r]),P=M.find(V=>V.scope===p)??M[0],E=f.useCallback((V,j)=>{const ee=++m.current;if(v(j),N(null),y(""),k(""),!(V!=null&&V.file)){j==="edit"&&requestAnimationFrame(()=>{var se;return(se=h.current)==null?void 0:se.focus()});return}_(!0),c(V.file.path).then(se=>{ee===m.current&&(y(se.content),k(se.content),se.truncated&&N(r("memory.fileTruncated")),requestAnimationFrame(()=>{var X;return(X=h.current)==null?void 0:X.focus()}))}).catch(se=>{if(ee!==m.current)return;const X=se instanceof Error?se.message:String(se);N(X),V.scope!=="global"&&(s==null||s(X,"error"))}).finally(()=>{ee===m.current&&_(!1)})},[s,c,r]);f.useEffect(()=>{P&&E(P,b)},[(I=P==null?void 0:P.file)==null?void 0:I.path,P==null?void 0:P.scope]),f.useEffect(()=>{a&&N(a.message)},[a]),f.useEffect(()=>{e<=0||u().then(()=>N(r("memory.refreshed"))).catch(V=>{const j=V instanceof Error?V.message:String(V);N(j),s==null||s(j,"error")})},[s,e,u,r]),f.useEffect(()=>{if(t<=0||$.current===t)return;$.current=t;const V=n==="global"?"global":"workspace";g(V);const j=M.find(ee=>ee.scope===V);E(j,"edit")},[n,t,M,E]);const O=V=>{g(V.scope),E(V,"view")},z=()=>{P&&E(P,"edit")},F=()=>{if(P){if(!w.trim()){N(r("memory.contentEmpty"));return}S(!0),N(null),d({scope:P.scope,mode:"replace",content:w}).then(V=>{const j=r("memory.saved",{scope:GH(P.scope,r),bytes:V.bytesWritten,path:V.filePath});y(w),v("view"),N(j),s==null||s(j,"status"),u().catch(()=>{})}).catch(V=>{const j=V instanceof Error?V.message:String(V);N(j),s==null||s(j,"error")}).finally(()=>S(!1))}},B=((Y=P==null?void 0:P.file)==null?void 0:Y.path)??(P==null?void 0:P.fallbackPath)??"",W=L??(o?r("memory.loading"):null);return l.jsxs("div",{className:Eo.page,children:[l.jsx("nav",{className:Eo.tabs,"aria-label":r("memory.menu"),children:M.map(V=>{const j=V.scope===p;return l.jsx("button",{type:"button",className:`${Eo.memoryCard} ${j?Eo.memoryCardActive:""}`,onClick:()=>O(V),children:l.jsx("span",{className:Eo.memoryTitle,children:V.title})},V.scope)})}),l.jsxs("section",{className:Eo.detail,children:[l.jsxs("header",{className:Eo.detailHeader,children:[l.jsx("div",{className:Eo.detailTitleWrap,children:l.jsx("div",{className:Eo.detailPath,children:B})}),l.jsx("div",{className:Eo.actions,children:l.jsx("button",{type:"button",className:Eo.actionButton,onClick:z,children:r("settings.action.edit")})})]}),W&&l.jsx("div",{className:Eo.status,children:W}),b==="edit"?l.jsxs(l.Fragment,{children:[l.jsx("textarea",{ref:h,className:Eo.editor,value:w,disabled:C||T,onChange:V=>k(V.target.value),placeholder:r("memory.placeholder",{scope:P?GH(P.scope,r):""})}),l.jsxs("div",{className:Eo.editorFooter,children:[l.jsx("button",{type:"button",className:Eo.secondaryButton,disabled:C,onClick:()=>{k(x),v("view")},children:r("common.cancel")}),l.jsx("button",{type:"button",className:Eo.primaryButton,disabled:C||T,onClick:F,children:r(C?"memory.saving":"memory.save")})]})]}):l.jsx("pre",{className:Eo.content,children:T?r("memory.loadingFile"):x||r("memory.noFiles")})]})]})}const Hst="_panel_cxp6w_1",qst="_steps_cxp6w_10",Ust="_stepPill_cxp6w_18",Vst="_stepPillActive_cxp6w_29",Wst="_stepPillDone_cxp6w_34",Gst="_stepNumber_cxp6w_38",Kst="_stepLabel_cxp6w_49",Yst="_body_cxp6w_55",Xst="_text_cxp6w_59",Qst="_muted_cxp6w_64",Jst="_options_cxp6w_68",Zst="_option_cxp6w_68",ert="_optionActive_cxp6w_90",trt="_label_cxp6w_94",nrt="_optionText_cxp6w_98",srt="_description_cxp6w_112",rrt="_input_cxp6w_119",irt="_preview_cxp6w_135",ort="_error_cxp6w_146",art="_link_cxp6w_150",lrt="_terms_cxp6w_161",crt="_actions_cxp6w_169",urt="_actionButton_cxp6w_177",lr={panel:Hst,steps:qst,stepPill:Ust,stepPillActive:Vst,stepPillDone:Wst,stepNumber:Gst,stepLabel:Kst,body:Yst,text:Xst,muted:Qst,options:Jst,option:Zst,optionActive:ert,label:trt,optionText:nrt,description:srt,input:rrt,preview:irt,error:ort,link:art,terms:lrt,actions:crt,actionButton:urt};function drt(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 oy(e){return e==="anthropic"?"https://api.anthropic.com/v1":e==="gemini"?"https://generativelanguage.googleapis.com":"https://api.openai.com/v1"}function KH(e){var t;return((t=e==null?void 0:e.models)==null?void 0:t.map(n=>n.id).join(", "))??""}function hrt(e,t,n){var s;return e==="protocol"?n("auth.step.protocol"):e==="baseUrl"?((s=t.uiLabels)==null?void 0:s.baseUrlStepTitle)??n("auth.step.baseUrl"):n(e==="apiKey"?"auth.step.apiKey":e==="models"?"auth.step.models":"auth.step.advanced")}function frt(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 h8(e){return[...new Set(e.split(",").map(t=>t.trim()).filter(t=>t.length>0))]}function mrt({onMessage:e,onClose:t}){const{t:n}=ot(),s=To(),[r,i]=f.useState("groups"),[o,a]=f.useState(0),[c,u]=f.useState(0),[d,h]=f.useState("providers"),[m,p]=f.useState(0),[g,b]=f.useState(),[v,x]=f.useState("alibaba"),[y,w]=f.useState(null),[k,T]=f.useState("openai"),[_,C]=f.useState(""),[S,L]=f.useState(""),[N,$]=f.useState(""),[M,P]=f.useState(!1),[E,O]=f.useState(!1),[z,F]=f.useState(!0),[B,W]=f.useState(!0),[I,Y]=f.useState(!1),[V,j]=f.useState(!1),[ee,se]=f.useState(""),[X,Q]=f.useState(!0),[ue,re]=f.useState(!1),[J,q]=f.useState(null);f.useEffect(()=>{s.getAuthProviders().then(ke=>{b(ke),Q(!1)}).catch(ke=>{q(ke instanceof Error?ke.message:String(ke)),Q(!1)})},[s]);const Z=f.useMemo(()=>(g==null?void 0:g.groups)??[],[g]),he=f.useMemo(()=>{var Pe;return(((Pe=Z.find(ve=>ve.id===v))==null?void 0:Pe.providerIds)??[]).map(ve=>g==null?void 0:g.providers.find(Ke=>Ke.id===ve)).filter(ve=>!!ve)},[g,v,Z]),ye=f.useMemo(()=>(y==null?void 0:y.steps)??[],[y==null?void 0:y.steps]),oe=ye[m],we=(y==null?void 0:y.showAdvancedConfig)===!0,Ve=f.useMemo(()=>E?["thinking","modality","image","video","audio","pdf","context"]:["thinking","modality","context"],[E]),lt=Ve.indexOf("context"),Et=oe==="apiKey"||oe==="models"||oe==="baseUrl"&&!Array.isArray(y==null?void 0:y.baseUrl),[pt,je]=f.useState(0),Ae=f.useCallback((ke,Pe="providers")=>{var Ke,me;w(ke),h(Pe);const ve=((Ke=ke.protocolOptions)==null?void 0:Ke[0])??ke.protocol;T(ve),typeof ke.baseUrl=="string"?C(ke.baseUrl):Array.isArray(ke.baseUrl)?C(((me=ke.baseUrl[0])==null?void 0:me.url)??""):C(oy(ve)),L(""),$(KH(ke)),P(!1),O(!1),F(!0),W(!0),Y(!1),j(!1),se(""),p(0),je(0),q(null),i(ke.steps.length>0?"step":"review")},[]),De=f.useCallback(()=>{if(q(null),r==="groups"){t();return}if(r==="providers"){i("groups");return}if(r==="review"){if(ye.length===0){i(d);return}i("step"),p(Math.max(0,ye.length-1));return}if(m>0){p(ke=>ke-1),je(0);return}i(d)},[t,d,m,ye.length,r]),Ne=f.useCallback(()=>{if(!y||ue)return;re(!0),q(null);const ke=Number(ee);s.installAuthProvider({providerId:y.id,protocol:k,baseUrl:_,apiKey:S,modelIds:h8(N),advancedConfig:M||E||Number.isFinite(ke)&&ke>0?{...M?{enableThinking:!0}:{},...E?{multimodal:{...z?{image:!0}:{},...B?{video:!0}:{},...I?{audio:!0}:{},...V?{pdf:!0}:{}}}:{},...Number.isFinite(ke)&&ke>0?{contextWindowSize:ke}:{}}:void 0}).then(Pe=>{e(Pe.message),t()}).catch(Pe=>{const ve=Pe instanceof Error?Pe.message:String(Pe);q(ve),e(ve,"error")}).finally(()=>re(!1))},[S,_,ee,E,I,z,V,B,N,t,e,k,y,ue,M,s]),tt=f.useCallback(()=>{if(y){if(oe==="baseUrl"){const ke=_.trim()||oy(k);if(!ke){q(n("auth.baseUrlRequired"));return}if(!/^https?:\/\//i.test(ke)){q(n("auth.baseUrlInvalid"));return}_.trim()||C(ke)}if(oe==="apiKey"&&S.trim().length===0){q(n("auth.apiKeyRequired"));return}if(oe==="models"&&h8(N).length===0){q(n("auth.modelsRequired"));return}q(null),m>=ye.length-1?we?i("review"):Ne():(p(ke=>ke+1),je(0))}},[S,_,oe,N,k,y,Ne,we,m,ye.length,n]),Se=f.useCallback(ke=>{switch(ke){case"thinking":P(Pe=>!Pe);return;case"modality":O(Pe=>!Pe);return;case"image":F(Pe=>!Pe);return;case"video":W(Pe=>!Pe);return;case"audio":Y(Pe=>!Pe);return;case"pdf":j(Pe=>!Pe);return;case"context":tt();return;default:return}},[tt]),Be=f.useCallback(()=>{if(r==="groups"){const ke=Z[o];if(!ke)return;if(ke.id==="custom"){const Pe=ke.providerIds.map(ve=>g==null?void 0:g.providers.find(Ke=>Ke.id===ve)).find(ve=>!!ve);Pe&&Ae(Pe,"groups");return}x(ke.id),u(0),i("providers");return}if(r==="providers"){const ke=he[c];ke&&Ae(ke,"providers");return}if(r==="review"){Ne();return}if(!(!y||!oe)){if(oe==="protocol"){const ke=(y.protocolOptions??[y.protocol])[pt];ke&&(T(ke),y.baseUrl||C(oy(ke))),tt();return}if(oe==="baseUrl"&&Array.isArray(y.baseUrl)){const ke=y.baseUrl[pt];ke&&C(ke.url),tt();return}if(oe==="advancedConfig"){Se(Ve[pt]);return}tt()}},[oe,g,tt,o,Z,pt,y,c,he,Ne,Ae,r,Se,Ve]),le=f.useCallback(ke=>{if(r==="groups"){const Pe=Z[ke];if(!Pe)return;if(Pe.id==="custom"){const ve=Pe.providerIds.map(Ke=>g==null?void 0:g.providers.find(me=>me.id===Ke)).find(Ke=>!!Ke);ve&&Ae(ve,"groups");return}x(Pe.id),u(0),i("providers");return}if(r==="providers"){const Pe=he[ke];Pe&&Ae(Pe,"providers");return}if(!y||!oe){r==="review"&&Ne();return}if(oe==="protocol"){const Pe=(y.protocolOptions??[y.protocol])[ke];Pe&&(T(Pe),y.baseUrl||C(oy(Pe))),tt();return}if(oe==="baseUrl"&&Array.isArray(y.baseUrl)){const Pe=y.baseUrl[ke];Pe&&C(Pe.url),tt();return}oe==="advancedConfig"&&Se(Ve[ke])},[oe,g,tt,Z,Se,Ve,y,he,Ne,Ae,r]),Le=(ke,Pe,ve)=>l.jsx("div",{className:lr.options,children:ke.map((Ke,me)=>l.jsx("button",{type:"button",className:`${lr.option} ${Pe===me?lr.optionActive:""}`,onClick:()=>{ve(me),le(me)},children:l.jsxs("div",{className:lr.optionText,children:[l.jsx("div",{className:lr.label,children:Ke.label}),Ke.description&&l.jsx("div",{className:lr.description,children:Ke.description})]})},Ke.value))}),sn=()=>{if(!y||!oe)return null;if(oe==="protocol"){const ve=y.protocolOptions??[y.protocol];return Le(drt(n).filter(Ke=>ve.includes(Ke.value)),pt,je)}if(oe==="baseUrl")return Array.isArray(y.baseUrl)?Le(y.baseUrl.map(ve=>({value:ve.url,label:ve.label,description:ve.url})),pt,je):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:lr.text,children:n("auth.baseUrlPrompt")}),l.jsx("input",{className:lr.input,value:_,placeholder:oy(k),onChange:ve=>{C(ve.target.value),q(null)},onKeyDown:ve=>{ve.key==="Enter"&&(ve.preventDefault(),ve.stopPropagation(),tt())},autoFocus:!0}),y.documentationUrl&&l.jsx("a",{className:lr.link,href:y.documentationUrl,target:"_blank",rel:"noreferrer",children:n("auth.documentation")})]});if(oe==="apiKey")return l.jsxs(l.Fragment,{children:[y.documentationUrl&&l.jsxs("a",{className:lr.link,href:y.documentationUrl,target:"_blank",rel:"noreferrer",children:[n("auth.documentation"),": ",y.documentationUrl]}),l.jsx("input",{className:lr.input,type:"password",value:S,placeholder:y.apiKeyPlaceholder??n("auth.apiKeyPlaceholder"),onChange:ve=>{L(ve.target.value),q(null)},onKeyDown:ve=>{ve.key==="Enter"&&(ve.preventDefault(),ve.stopPropagation(),tt())},autoFocus:!0})]});if(oe==="models"){const ve=KH(y);return l.jsxs(l.Fragment,{children:[ve&&l.jsx("div",{className:lr.muted,children:n("auth.modelsPrompt",{modelIds:ve})}),l.jsx("input",{className:lr.input,value:N,placeholder:ve||n("auth.modelsPlaceholder"),onChange:Ke=>{$(Ke.target.value),q(null)},onKeyDown:Ke=>{Ke.key==="Enter"&&(Ke.preventDefault(),Ke.stopPropagation(),tt())},autoFocus:!0})]})}const ke=ve=>ve?"◉":"○",Pe=[{value:"thinking",label:`${ke(M)} ${n("auth.advanced.thinking")}`,description:n("auth.advanced.thinkingDesc")},{value:"modality",label:`${ke(E)} ${n("auth.advanced.modality")}`,description:n("auth.advanced.modalityDesc")}];return E&&Pe.push({value:"image",label:`${ke(z)} ${n("auth.advanced.modalityImage")}`},{value:"video",label:`${ke(B)} ${n("auth.advanced.modalityVideo")}`},{value:"audio",label:`${ke(I)} ${n("auth.advanced.modalityAudio")}`},{value:"pdf",label:`${ke(V)} ${n("auth.advanced.modalityPdf")}`}),Pe.push({value:"context",label:`${n("auth.advanced.contextWindow")}: ${ee||"auto"}`,description:n("auth.advanced.contextDesc")}),l.jsxs(l.Fragment,{children:[l.jsx("div",{className:lr.text,children:n("auth.advanced.prompt")}),Le(Pe,pt,je),l.jsx("input",{className:lr.input,value:ee,placeholder:n("common.auto"),onChange:ve=>se(ve.target.value.replace(/[^0-9]/g,"")),onFocus:()=>je(lt),onKeyDown:ve=>{ve.key==="Enter"&&(ve.preventDefault(),ve.stopPropagation(),tt())}})]})},Cn=f.useMemo(()=>{if(!y)return"";const ke=y.envKey??`${k.toUpperCase()}_API_KEY`,Pe=h8(N),ve={};if(M&&(ve.extra_body={enable_thinking:!0}),E){const qe={};z&&(qe.image=!0),B&&(qe.video=!0),I&&(qe.audio=!0),V&&(qe.pdf=!0),Object.keys(qe).length>0&&(ve.modalities=qe)}const Ke=Number(ee);Number.isFinite(Ke)&&Ke>0&&(ve.contextWindowSize=Ke);const me=Object.keys(ve).length>0;return JSON.stringify({env:{[ke]:frt(S,n)},modelProviders:{[k]:Pe.map(qe=>({id:qe,name:qe,baseUrl:_.trim(),envKey:ke,...me?{generationConfig:ve}:{}}))},security:{auth:{selectedType:k}},model:{name:Pe[0]}},null,2)},[S,_,ee,E,I,z,V,B,N,k,y,n,M]),In=f.useMemo(()=>{const ke=[n("auth.step.group"),n("auth.step.provider")];return y&&(ke.push(...ye.map(Pe=>hrt(Pe,y,n))),we&&ke.push(n("auth.review"))),ke},[y,we,ye,n]),_t=f.useMemo(()=>r==="groups"?1:r==="providers"?2:r==="step"?Math.min(3+m,In.length):In.length,[m,In.length,r]),Te=X?l.jsx("div",{className:lr.muted,children:n("common.loading")}):r==="groups"?l.jsxs(l.Fragment,{children:[Le(Z.map(ke=>({value:ke.id,label:n(ke.label),description:n(ke.description)})),o,a),l.jsxs("div",{className:lr.terms,children:[l.jsxs("div",{children:[n("auth.termsTitle"),":"]}),l.jsx("a",{className:lr.link,href:"https://qwenlm.github.io/qwen-code-docs/en/users/support/tos-privacy/",target:"_blank",rel:"noreferrer",children:"https://qwenlm.github.io/qwen-code-docs/en/users/support/tos-privacy/"})]})]}):r==="providers"?Le(he.map(ke=>({value:ke.id,label:n(ke.label),description:n(ke.description)})),c,u):r==="step"?sn():l.jsxs(l.Fragment,{children:[l.jsx("div",{className:lr.text,children:n("auth.reviewText")}),l.jsx("div",{className:lr.preview,children:Cn})]}),at=()=>{if(r==="review"){Ne();return}if(Et||oe==="advancedConfig"){tt();return}Be()};return l.jsxs("div",{className:lr.panel,children:[l.jsx("div",{className:lr.steps,children:In.map((ke,Pe)=>{const ve=Pe+1;return l.jsxs("div",{className:`${lr.stepPill} ${ve===_t?lr.stepPillActive:""} ${ve<_t?lr.stepPillDone:""}`,children:[l.jsx("span",{className:lr.stepNumber,children:ve}),l.jsx("span",{className:lr.stepLabel,children:ke})]},`${ve}:${ke}`)})}),l.jsx("div",{className:lr.body,children:Te}),J&&l.jsx("div",{className:lr.error,children:J}),l.jsxs("div",{className:lr.actions,children:[l.jsx("button",{type:"button",className:lr.actionButton,onClick:De,disabled:r==="groups"||X||ue,children:n("common.previous")}),l.jsx("button",{type:"button",className:lr.actionButton,onClick:at,disabled:X||ue,children:n(r==="review"?ue?"auth.saving":"auth.save":"common.next")})]})]})}function prt(e){return e.displayName||e.name}const Xie="tools-list",YH=e=>`${Xie}-opt-${e}`;function grt(){const{t:e}=ot(),{status:t,tools:n,loading:s,error:r}=eK({autoLoad:!0}),[i,o]=f.useState(0),[a,c]=f.useState(null),[u,d]=f.useState(()=>new Set),h=f.useRef(null);f.useEffect(()=>{var b,v;r?c(r.message):(v=(b=t==null?void 0:t.errors)==null?void 0:b[0])!=null&&v.error?c(t.errors[0].error):t&&c(null)},[t,r]);const m=f.useCallback(b=>{d(v=>v.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 v;const b=(v=h.current)==null?void 0:v.children[i];b==null||b.scrollIntoView({block:"nearest"})},[i]);const{keyboardMode:p}=ym({itemCount:n.length,activeIndex:i,onActiveIndexChange:o,onConfirm:b=>{const v=n[b];v!=null&&v.description&&m(v)}}),g=f.useMemo(()=>{if(!t)return"";const b=n.filter(v=>v.enabled).length;return e("tools.summary",{enabled:b,total:n.length})},[t,n,e]);return l.jsxs("div",{className:en("picker","picker-in-shell"),children:[g&&l.jsx("div",{className:en("picker-search"),children:l.jsx("span",{className:en("picker-search-hint"),children:g})}),(a||s)&&l.jsx("div",{className:en("picker-search"),children:l.jsx("span",{className:en("picker-search-hint"),children:a||e("tools.loading")})}),l.jsx("div",{className:en("picker-sep")}),l.jsxs("div",{id:Xie,role:"listbox","aria-label":e("tools.title"),tabIndex:0,"aria-activedescendant":n.length>0?YH(i):void 0,className:en("picker-list",p?"picker-keyboard-only":void 0),ref:h,children:[!s&&n.length===0&&l.jsx("div",{className:en("picker-empty"),children:e("tools.empty")}),n.map((b,v)=>{const x=u.has(b.name),y=b.description??"";return l.jsxs("div",{id:YH(v),role:"option","aria-selected":!1,"aria-expanded":y?x:void 0,className:en("picker-item","picker-session-item","tools-picker-item",v===i?"selected":void 0,x?"tools-picker-item-expanded":void 0),onClick:()=>{o(v),b.description&&m(b)},onMouseMove:()=>o(v),children:[l.jsxs("div",{className:en("picker-item-row"),children:[l.jsx("span",{className:en("tools-item-icon"),"aria-hidden":"true"}),l.jsx("span",{className:en("picker-item-title"),children:prt(b)}),l.jsx("span",{className:en("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?l.jsx("svg",{className:en("tools-item-chevron",x?"tools-item-chevron-expanded":void 0),viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}):null]}),x&&y&&l.jsx("div",{className:en("tools-desc-expanded"),children:l.jsx("div",{className:en("tools-desc-body"),children:y})})]},b.name)})]})]})}const brt="_content_xihrz_1",yrt="_placeholder_xihrz_7",xrt="_fileList_xihrz_13",vrt="_file_xihrz_13",wrt="_fileHeader_xihrz_25",krt="_fileStats_xihrz_43",_rt="_statAdd_xihrz_51",Srt="_statDel_xihrz_55",Crt="_fileBinary_xihrz_59",Trt="_filePath_xihrz_63",Ert="_fileOldPath_xihrz_71",Art="_fileTag_xihrz_75",Nrt="_fileBody_xihrz_85",jrt="_filePlaceholder_xihrz_89",Mrt="_hiddenNote_xihrz_95",Irt="_diffLines_xihrz_101",Rrt="_diffLine_xihrz_101",Drt="_diffLineAdd_xihrz_113",Lrt="_diffLineDel_xihrz_117",Prt="_diffLineContext_xihrz_121",Ort="_diffLineMeta_xihrz_125",Brt="_diffOldNo_xihrz_131",$rt="_diffNewNo_xihrz_132",zrt="_diffMarker_xihrz_143",Frt="_diffContent_xihrz_159",Gs={content:brt,placeholder:yrt,fileList:xrt,file:vrt,fileHeader:wrt,fileStats:krt,statAdd:_rt,statDel:Srt,fileBinary:Crt,filePath:Trt,fileOldPath:Ert,fileTag:Art,fileBody:Nrt,filePlaceholder:jrt,hiddenNote:Mrt,diffLines:Irt,diffLine:Rrt,diffLineAdd:Drt,diffLineDel:Lrt,diffLineContext:Prt,diffLineMeta:Ort,diffOldNo:Brt,diffNewNo:$rt,diffMarker:zrt,diffContent:Frt},Hrt={add:Gs.diffLineAdd,del:Gs.diffLineDel,context:Gs.diffLineContext,meta:Gs.diffLineMeta};function qrt(e){return e===qr.Light?"github-light-default":"github-dark-default"}async function Urt(e,t,n){const{resolvedLang:s}=qM(mie(t));let r=null;if(s!=="text")try{r=await bQ(s)}catch{r=null}const i=[];for(const o of e){const a=[],c=[];for(const x of o.lines){const y=x[0],w=x.slice(1);y==="+"?a.push(w):y==="-"?c.push(w):y===" "&&(a.push(w),c.push(w))}const u=a.join(`
`),d=c.join(`
`);let h=null,m=null;if(r){const x=s;if(!FE(u))try{h=r.codeToTokens(u,{lang:x,theme:n}).tokens}catch{h=null}if(!FE(d))try{m=r.codeToTokens(d,{lang:x,theme:n}).tokens}catch{m=null}}let p=0,g=0,b=o.oldStart,v=o.newStart;for(const x of o.lines){const y=x[0],w=x.slice(1);y==="+"?(i.push({type:"add",oldNo:null,newNo:v,text:w,tokens:(h==null?void 0:h[p])??null}),p++,v++):y==="-"?(i.push({type:"del",oldNo:b,newNo:null,text:w,tokens:(m==null?void 0:m[g])??null}),g++,b++):y===" "?(i.push({type:"context",oldNo:b,newNo:v,text:w,tokens:(h==null?void 0:h[p])??null}),p++,g++,b++,v++):i.push({type:"meta",oldNo:null,newNo:null,text:x,tokens:null})}}return i}function Vrt(e){return!e.tokens||e.tokens.length===0?e.text:e.tokens.map((t,n)=>l.jsx("span",{style:t.color?{color:t.color}:void 0,children:t.content},n))}function Wrt({hunks:e,path:t}){const{t:n}=ot(),s=z1(),r=qrt(s),[i,o]=f.useState(null),[a,c]=f.useState(!1);return f.useEffect(()=>{let u=!1;return o(null),c(!1),Urt(e,t,r).then(d=>{u||o(d)}).catch(()=>{u||c(!0)}),()=>{u=!0}},[e,t,r]),a?l.jsx("div",{className:Gs.filePlaceholder,children:n("gitDiff.fileError")}):i===null?l.jsx("div",{className:Gs.filePlaceholder,children:n("gitDiff.loading")}):l.jsx("div",{className:Gs.diffLines,children:(i??[]).map((u,d)=>l.jsxs("div",{className:`${Gs.diffLine} ${Hrt[u.type]}`,children:[l.jsx("span",{className:Gs.diffOldNo,children:u.oldNo??""}),l.jsx("span",{className:Gs.diffNewNo,children:u.newNo??""}),l.jsx("span",{className:Gs.diffMarker,children:u.type==="add"?"+":u.type==="del"?"-":u.type==="meta"?"":" "}),l.jsx("code",{className:Gs.diffContent,children:Vrt(u)})]},d))})}function Grt({workspaceCwd:e,file:t}){const{t:n}=ot(),{client:s}=ol(),[r,i]=f.useState(!1),[o,a]=f.useState(null),[c,u]=f.useState(!1),[d,h]=f.useState(!1),[m,p]=f.useState(!1),g=f.useRef(!1);f.useEffect(()=>(g.current=!1,()=>{g.current=!0}),[]);const b=()=>{const x=!r;i(x),x&&o===null&&!d&&!t.isBinary&&(h(!0),p(!1),s.workspaceByCwd(e).workspaceGitDiffFile(t.path,t.oldPath).then(y=>{g.current||(a(y.hunks),u(y.truncated===!0))}).catch(()=>{g.current||p(!0)}).finally(()=>{g.current||h(!1)}))},v=u2(t.path);return l.jsxs("div",{className:Gs.file,children:[l.jsxs("button",{type:"button",className:Gs.fileHeader,onClick:b,"aria-expanded":r,"aria-label":n(r?"gitDiff.collapse":"gitDiff.expand",{path:t.oldPath?`${u2(t.oldPath)} → ${v}`:v}),children:[l.jsx("span",{className:Gs.fileStats,children:t.isBinary?l.jsx("span",{className:Gs.fileBinary,children:n("gitDiff.binary")}):l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:Gs.statAdd,children:["+",t.added??0]}),l.jsxs("span",{className:Gs.statDel,children:["-",t.removed??0]})]})}),l.jsxs("span",{className:Gs.filePath,title:v,children:[t.oldPath?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Gs.fileOldPath,children:u2(t.oldPath)})," → "]}):null,v]}),t.isUntracked&&l.jsx("span",{className:Gs.fileTag,children:n("gitDiff.untracked")}),t.isDeleted&&l.jsx("span",{className:Gs.fileTag,children:n("gitDiff.deleted")})]}),r&&l.jsx("div",{className:Gs.fileBody,children:t.isBinary?l.jsx("div",{className:Gs.filePlaceholder,children:n("gitDiff.binary")}):d?l.jsx("div",{className:Gs.filePlaceholder,children:n("gitDiff.loading")}):m?l.jsx("div",{className:Gs.filePlaceholder,children:n("gitDiff.fileError")}):o&&o.length>0?l.jsxs(l.Fragment,{children:[l.jsx(Wrt,{hunks:o,path:t.path}),c&&l.jsx("div",{className:Gs.filePlaceholder,role:"note",children:n("gitDiff.truncated")})]}):l.jsx("div",{className:Gs.filePlaceholder,children:n("gitDiff.noDiff")})})]})}function Krt({workspaceCwd:e,onSubtitleChange:t}){const{t:n}=ot(),{client:s}=ol(),[r,i]=f.useState(null),[o,a]=f.useState(!0),[c,u]=f.useState(!1);f.useEffect(()=>{let m=!1;return a(!0),u(!1),s.workspaceByCwd(e).workspaceGitDiff().then(p=>{m||i(p)}).catch(()=>{m||u(!0)}).finally(()=>{m||a(!1)}),()=>{m=!0}},[s,e]);const d=r&&r.available?n("gitDiff.summary",{count:r.filesCount,added:r.linesAdded,removed:r.linesRemoved}):void 0;f.useEffect(()=>{t==null||t(d)},[t,d]);let h;return o?h=l.jsx("div",{className:Gs.placeholder,children:n("gitDiff.loading")}):c?h=l.jsx("div",{className:Gs.placeholder,children:n("gitDiff.error")}):!r||!r.available?h=l.jsx("div",{className:Gs.placeholder,children:n("gitDiff.unavailable")}):r.files.length===0?h=l.jsx("div",{className:Gs.placeholder,children:n("gitDiff.empty")}):h=l.jsxs("div",{className:Gs.fileList,children:[r.files.map(m=>l.jsx(Grt,{workspaceCwd:e,file:m},`${e}:${m.path}`)),r.hiddenCount>0&&l.jsx("div",{className:Gs.hiddenNote,children:n("gitDiff.hidden",{count:r.hiddenCount})})]}),l.jsx("div",{className:Gs.content,children:h})}const Yrt="_content_18nyy_1",Xrt="_placeholder_18nyy_7",Qrt="_commitList_18nyy_13",Jrt="_commitRow_18nyy_18",Zrt="_commitHeader_18nyy_22",eit="_commitToggle_18nyy_32",tit="_commitSha_18nyy_47",nit="_copyBtn_18nyy_54",sit="_commitSubject_18nyy_78",rit="_commitMeta_18nyy_86",iit="_commitRefs_18nyy_93",oit="_refTag_18nyy_99",ait="_refHead_18nyy_109",lit="_mergeIcon_18nyy_114",cit="_commitDetail_18nyy_120",uit="_commitBody_18nyy_126",dit="_fileStats_18nyy_134",hit="_fileStatHeader_18nyy_140",fit="_fileStatRow_18nyy_146",mit="_statNums_18nyy_154",pit="_statAdd_18nyy_162",git="_statDel_18nyy_166",bit="_fileStatPath_18nyy_170",yit="_fileBinary_18nyy_178",xit="_hiddenNote_18nyy_182",vit="_detailError_18nyy_188",wit="_loadMore_18nyy_194",zs={content:Yrt,placeholder:Xrt,commitList:Qrt,commitRow:Jrt,commitHeader:Zrt,commitToggle:eit,commitSha:tit,copyBtn:nit,commitSubject:sit,commitMeta:rit,commitRefs:iit,refTag:oit,refHead:ait,mergeIcon:lit,commitDetail:cit,commitBody:uit,fileStats:dit,fileStatHeader:hit,fileStatRow:fit,statNums:mit,statAdd:pit,statDel:git,fileStatPath:bit,fileBinary:yit,hiddenNote:xit,detailError:vit,loadMore:wit},XH=50;function kit(e,t,n){const s=Math.max(0,Math.floor(t-e)),r=new Intl.RelativeTimeFormat(n,{numeric:"auto"});if(s<60)return r.format(0,"second");const i=Math.floor(s/60);if(i<60)return r.format(-i,"minute");const o=Math.floor(i/60);if(o<24)return r.format(-o,"hour");const a=Math.floor(o/24);if(a<7)return r.format(-a,"day");const c=Math.floor(a/7);if(c<5)return r.format(-c,"week");const u=Math.floor(a/30);return u<12?r.format(-u,"month"):r.format(-Math.max(1,Math.floor(a/365)),"year")}function _it(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean).slice(0,3).map(t=>{const n=t.startsWith("HEAD ->");return{label:n?t.replace("HEAD -> ",""):t,isHead:n}}):[]}function Sit({entry:e,workspaceCwd:t,now:n}){const{client:s}=ol(),{language:r,t:i}=ot(),[o,a]=f.useState(!1),[c,u]=f.useState(null),[d,h]=f.useState(!1),[m,p]=f.useState(!1),[g,b]=f.useState(!1),v=f.useRef(!1),x=()=>{navigator.clipboard.writeText(e.sha).then(()=>{b(!0),setTimeout(()=>b(!1),1500)}).catch(()=>{})};f.useEffect(()=>(v.current=!1,()=>{v.current=!0}),[]);const y=()=>{const _=!o;a(_),_&&c===null&&!d&&(h(!0),p(!1),s.workspaceByCwd(t).workspaceGitCommitDetail(e.sha).then(C=>{v.current||u(C)}).catch(()=>{v.current||p(!0)}).finally(()=>{v.current||h(!1)}))},w=_it(e.refs??""),k=e.parents.length>1;let T;return o&&(d?T=l.jsx("div",{className:zs.commitDetail,children:l.jsx("span",{className:zs.fileBinary,children:i("gitLog.loading")})}):m?T=l.jsx("div",{className:zs.commitDetail,children:l.jsx("span",{className:zs.detailError,children:i("gitLog.detailError")})}):c&&c.available?T=l.jsxs("div",{className:zs.commitDetail,children:[c.body&&l.jsx("pre",{className:zs.commitBody,children:c.body}),c.files&&l.jsxs("div",{className:zs.fileStats,children:[l.jsx("div",{className:zs.fileStatHeader,children:i("gitLog.files",{count:c.filesCount??0,added:c.linesAdded??0,removed:c.linesRemoved??0})}),c.files.map(_=>l.jsxs("div",{className:zs.fileStatRow,children:[_.isBinary?l.jsx("span",{className:zs.fileBinary,children:"~"}):l.jsxs("span",{className:zs.statNums,children:[l.jsxs("span",{className:zs.statAdd,children:["+",_.added]}),l.jsxs("span",{className:zs.statDel,children:["−",_.removed]})]}),l.jsx("span",{className:zs.fileStatPath,children:_.path})]},_.path)),(c.hiddenCount??0)>0&&l.jsx("div",{className:zs.hiddenNote,children:i("gitLog.hidden",{count:c.hiddenCount??0})})]})]}):c&&!c.available&&(T=l.jsx("div",{className:zs.commitDetail,children:l.jsx("span",{className:zs.detailError,children:i("gitLog.detailError")})}))),l.jsxs("div",{className:zs.commitRow,children:[l.jsxs("div",{className:zs.commitHeader,children:[l.jsxs("button",{type:"button",className:zs.commitToggle,onClick:y,"aria-expanded":o,children:[k&&l.jsx("span",{className:zs.mergeIcon,children:"⎇"}),l.jsx("span",{className:zs.commitSha,title:e.sha,children:e.shortSha}),l.jsx("span",{className:zs.commitSubject,children:e.subject}),w.length>0&&l.jsx("span",{className:zs.commitRefs,children:w.map(_=>l.jsx("span",{className:`${zs.refTag}${_.isHead?` ${zs.refHead}`:""}`,children:_.label},_.label))}),l.jsxs("span",{className:zs.commitMeta,children:[e.authorName," · ",kit(e.authorDate,n,r)]})]}),l.jsx("button",{type:"button",className:zs.copyBtn,onClick:x,"aria-label":i("gitLog.copySha",{sha:e.shortSha}),children:g?l.jsx(ZN,{size:12}):l.jsx(Tpe,{size:12})})]}),T]})}function Cit({workspaceCwd:e,onSubtitleChange:t}){const{client:n}=ol(),{t:s}=ot(),[r,i]=f.useState(null),[o,a]=f.useState(!0),[c,u]=f.useState(!1),[d,h]=f.useState(!1),[m,p]=f.useState(!1),[g,b]=f.useState(Date.now()/1e3),v=f.useRef(0);f.useEffect(()=>{const k=setInterval(()=>b(Date.now()/1e3),6e4);return()=>clearInterval(k)},[]),f.useEffect(()=>{let k=!1;return a(!0),u(!1),p(!1),v.current=0,n.workspaceByCwd(e).workspaceGitLog(XH,0).then(T=>{k||(v.current=T.entries.length,i(T))}).catch(()=>{k||u(!0)}).finally(()=>{k||a(!1)}),()=>{k=!0}},[n,e]);const x=f.useCallback(()=>{!r||d||(h(!0),n.workspaceByCwd(e).workspaceGitLog(XH,v.current).then(k=>{v.current+=k.entries.length,i(T=>{if(!T)return k;const _=new Set(T.entries.map(C=>C.sha));return{...T,entries:[...T.entries,...k.entries.filter(C=>!_.has(C.sha))],hasMore:k.hasMore}})}).catch(()=>{p(!0)}).finally(()=>{h(!1)}))},[n,e,r,d]),y=r!=null&&r.available?s("gitLog.subtitle",{count:r.entries.length}):void 0;f.useEffect(()=>{t==null||t(y)},[t,y]);let w;return o?w=l.jsx("div",{className:zs.placeholder,children:s("gitLog.loading")}):c?w=l.jsx("div",{className:zs.placeholder,children:s("gitLog.error")}):!r||!r.available?w=l.jsx("div",{className:zs.placeholder,children:s("gitLog.unavailable")}):r.entries.length===0?w=l.jsx("div",{className:zs.placeholder,children:s("gitLog.empty")}):w=l.jsxs(l.Fragment,{children:[l.jsx("div",{className:zs.commitList,children:r.entries.map(k=>l.jsx(Sit,{entry:k,workspaceCwd:e,now:g},k.sha))}),m&&l.jsx("div",{className:zs.placeholder,children:s("gitLog.error")}),r.hasMore&&l.jsx("button",{type:"button",className:zs.loadMore,onClick:()=>{p(!1),x()},disabled:d,children:s(d?"gitLog.loadingMore":"gitLog.loadMore")})]}),l.jsx("div",{className:zs.content,children:w})}const Tit="_content_96a7w_1",Eit="_tabBar_96a7w_7",Ait="_tab_96a7w_7",Nit="_tabActive_96a7w_27",jit="_tabPanel_96a7w_36",Um={content:Tit,tabBar:Eit,tab:Ait,tabActive:Nit,tabPanel:jit};function Mit({workspaceCwd:e,initialView:t,onClose:n}){const{t:s}=ot(),[r,i]=f.useState(t),[o,a]=f.useState(),c=f.useCallback(m=>{a(void 0),i(m)},[]),u=m=>{var p;c(m),(p=document.getElementById(`git-dialog-tab-${m}`))==null||p.focus()},d=m=>{if(m.key==="ArrowLeft"||m.key==="ArrowRight"){m.preventDefault(),u(r==="diff"?"log":"diff");return}if(m.key==="Home"){m.preventDefault(),u("diff");return}m.key==="End"&&(m.preventDefault(),u("log"))},h=s(r==="diff"?"gitDiff.title":"gitLog.title");return l.jsx(si,{title:h,subtitle:o,size:"xl",allowFullscreen:!0,onClose:n,children:l.jsxs("div",{className:Um.content,children:[l.jsxs("div",{className:Um.tabBar,role:"tablist",children:[l.jsx("button",{id:"git-dialog-tab-diff",type:"button",role:"tab","aria-selected":r==="diff","aria-controls":"git-dialog-panel",tabIndex:r==="diff"?0:-1,className:`${Um.tab}${r==="diff"?` ${Um.tabActive}`:""}`,onClick:()=>c("diff"),onKeyDown:d,children:s("gitDiff.title")}),l.jsx("button",{id:"git-dialog-tab-log",type:"button",role:"tab","aria-selected":r==="log","aria-controls":"git-dialog-panel",tabIndex:r==="log"?0:-1,className:`${Um.tab}${r==="log"?` ${Um.tabActive}`:""}`,onClick:()=>c("log"),onKeyDown:d,children:s("gitLog.title")})]}),l.jsx("div",{id:"git-dialog-panel",className:Um.tabPanel,role:"tabpanel","aria-labelledby":`git-dialog-tab-${r}`,children:r==="diff"?l.jsx(Krt,{workspaceCwd:e,onSubtitleChange:a}):l.jsx(Cit,{workspaceCwd:e,onSubtitleChange:a})})]})})}function Iit(e,t,n="all",s="all"){const r=t.trim().toLowerCase();return e.filter(i=>n!=="all"&&i.level!==n||s==="disabled"&&i.status!=="disabled"||s==="enabled"&&i.status==="disabled"?!1:r?i.name.toLowerCase().includes(r):!0)}function Rit(e,t){return e&&t.some(n=>n.name===e)?e:null}const Dit=i0("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 Ji({className:e,variant:t,...n}){return l.jsx("div",{"data-slot":"alert",role:"alert",className:Wt(Dit({variant:t}),e),...n})}function ap({className:e,...t}){return l.jsx("div",{"data-slot":"alert-title",className:Wt("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",e),...t})}function Zi({className:e,...t}){return l.jsx("div",{"data-slot":"alert-description",className:Wt("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})}const Lit=i0("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 Za({className:e,variant:t="default",asChild:n=!1,...s}){const r=n?eM:"span";return l.jsx(r,{"data-slot":"badge","data-variant":t,className:Wt(Lit({variant:t}),e),...s})}function E1({className:e,...t}){return l.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:Wt(e),...t})}function A1({className:e,...t}){return l.jsx("ol",{"data-slot":"breadcrumb-list",className:Wt("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground",e),...t})}function vo({className:e,...t}){return l.jsx("li",{"data-slot":"breadcrumb-item",className:Wt("inline-flex items-center gap-1",e),...t})}function df({asChild:e,className:t,...n}){const s=e?eM:"a";return l.jsx(s,{"data-slot":"breadcrumb-link",className:Wt("transition-colors hover:text-foreground",t),...n})}function rc({className:e,...t}){return l.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:Wt("font-normal text-foreground",e),...t})}function hf({children:e,className:t,...n}){return l.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:Wt("[&>svg]:size-3.5",t),...n,children:e??l.jsx(Q4,{})})}function ic({className:e,size:t="default",...n}){return l.jsx("div",{"data-slot":"card","data-size":t,className:Wt("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 Ad({className:e,...t}){return l.jsx("div",{"data-slot":"card-header",className:Wt("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 Nd({className:e,...t}){return l.jsx("div",{"data-slot":"card-title",className:Wt("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",e),...t})}function ff({className:e,...t}){return l.jsx("div",{"data-slot":"card-description",className:Wt("text-sm text-muted-foreground",e),...t})}function Pit({className:e,...t}){return l.jsx("div",{"data-slot":"card-action",className:Wt("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),...t})}function Tp({className:e,...t}){return l.jsx("div",{"data-slot":"card-content",className:Wt("px-(--card-spacing)",e),...t})}function Hd({className:e,...t}){return l.jsx("div",{"data-slot":"empty",className:Wt("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 qd({className:e,...t}){return l.jsx("div",{"data-slot":"empty-header",className:Wt("flex max-w-sm flex-col items-center gap-2",e),...t})}const Oit=i0("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 Ud({className:e,variant:t="default",...n}){return l.jsx("div",{"data-slot":"empty-icon","data-variant":t,className:Wt(Oit({variant:t,className:e})),...n})}function Vd({className:e,...t}){return l.jsx("div",{"data-slot":"empty-title",className:Wt("text-sm font-medium tracking-tight",e),...t})}function iw({className:e,...t}){return l.jsx("div",{"data-slot":"empty-description",className:Wt("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function Bit({className:e,...t}){return l.jsx("div",{"data-slot":"empty-content",className:Wt("flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance",e),...t})}function Hg({...e}){return l.jsx(E8e,{"data-slot":"dropdown-menu",...e})}function $it({container:e,...t}){const n=oh();return l.jsx(N8e,{"data-slot":"dropdown-menu-portal",container:e??n??void 0,...t})}function qg({...e}){return l.jsx(A8e,{"data-slot":"dropdown-menu-trigger",...e})}function Ug({className:e,align:t="start",sideOffset:n=4,...s}){return l.jsx($it,{children:l.jsx(j8e,{"data-slot":"dropdown-menu-content",sideOffset:n,align:t,className:Wt("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),...s})})}function N1({...e}){return l.jsx(M8e,{"data-slot":"dropdown-menu-group",...e})}function yo({className:e,inset:t,variant:n="default",...s}){return l.jsx(I8e,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:Wt("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),...s})}function zit({className:e,...t}){return l.jsx(R8e,{"data-slot":"dropdown-menu-separator",className:Wt("-mx-1 my-1 h-px bg-border",e),...t})}function QH({...e}){return l.jsx(D8e,{"data-slot":"dropdown-menu-sub",...e})}function JH({className:e,inset:t,children:n,...s}){return l.jsxs(L8e,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:Wt("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),...s,children:[n,l.jsx(Q4,{className:"ml-auto"})]})}function ZH({className:e,...t}){return l.jsx(P8e,{"data-slot":"dropdown-menu-sub-content",className:Wt("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 $o({className:e,...t}){return l.jsx(Kpe,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:Wt("size-4 animate-spin",e),...t})}function y9({...e}){return l.jsx(ITe,{"data-slot":"alert-dialog",...e})}function Fit({container:e,...t}){const n=oh();return l.jsx(RTe,{"data-slot":"alert-dialog-portal",container:e??n??void 0,...t})}const Hit=f.forwardRef(function({className:t,...n},s){return l.jsx(DTe,{ref:s,"data-slot":"alert-dialog-overlay",className:Wt("fixed inset-0 z-50 bg-black/10 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...n})}),x9=f.forwardRef(function({className:t,size:n="default",...s},r){return l.jsxs(Fit,{children:[l.jsx(Hit,{}),l.jsx(LTe,{ref:r,"data-slot":"alert-dialog-content","data-size":n,className:Wt("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),...s})]})});function v9({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-header",className:Wt("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 w9({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-footer",className:Wt("-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 k9({className:e,...t}){return l.jsx(BTe,{"data-slot":"alert-dialog-title",className:Wt("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 _9({className:e,...t}){return l.jsx($Te,{"data-slot":"alert-dialog-description",className:Wt("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function Qie({className:e,variant:t="default",size:n="default",...s}){return l.jsx(qn,{variant:t,size:n,asChild:!0,children:l.jsx(PTe,{"data-slot":"alert-dialog-action",className:Wt(e),...s})})}function S9({className:e,variant:t="outline",size:n="default",...s}){return l.jsx(qn,{variant:t,size:n,asChild:!0,children:l.jsx(OTe,{"data-slot":"alert-dialog-cancel",className:Wt(e),...s})})}const qit=i0("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"}}),Jie=f.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function Zie({className:e,variant:t,size:n,spacing:s=2,orientation:r="horizontal",children:i,...o}){return l.jsx(PM,{orientation:r,"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":s,"data-orientation":r,style:{"--gap":s},className:Wt("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:l.jsx(Jie.Provider,{value:{variant:t,size:n,spacing:s,orientation:r},children:i})})}function eoe({className:e,children:t,variant:n="default",size:s="default",...r}){const i=f.useContext(Jie);return l.jsx(Gee,{"data-slot":"toggle-group-item","data-variant":i.variant||n,"data-size":i.size||s,"data-spacing":i.spacing,className:Wt("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",qit({variant:i.variant||n,size:i.size||s}),e),...r,children:t})}function ow({className:e,orientation:t="horizontal",...n}){return l.jsx(W7e,{orientation:t,"data-slot":"tabs","data-orientation":t,className:Wt("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}const Uit=i0("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 aw({className:e,variant:t="default",...n}){return l.jsx(G7e,{"data-slot":"tabs-list","data-variant":t,className:Wt(Uit({variant:t}),e),...n})}function Do({className:e,...t}){return l.jsx(K7e,{"data-slot":"tabs-trigger",className:Wt("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 Ya({className:e,...t}){return l.jsx(Y7e,{"data-slot":"tabs-content",className:Wt("flex-1 text-sm outline-none",e),...t})}const Vit=6*1024*1024;function Wit(e,t){const n=e&&typeof e=="object"?e.body:void 0,s=n&&typeof n=="object"?n.code:void 0;return s==="invalid_skill_source"?t("skills.install.error.invalidSource"):s==="invalid_skill_scope"?t("skills.install.error.invalidScope"):s==="invalid_skill_name"?t("skills.install.error.invalidName"):s==="skill_manifest_missing"?t("skills.install.error.manifestMissing"):s==="invalid_skill_package"||s==="invalid_skill_manifest"||s==="skill_name_mismatch"||s==="unsafe_skill_path"?t("skills.install.error.invalidPackage"):s==="skill_package_too_large"?t("skills.install.error.zipTooLarge"):s==="invalid_skill_folder"?t("skills.install.error.invalidFolder"):s==="github_api_failed"||s==="github_skill_download_failed"?t("skills.install.error.githubFailed"):s==="skill_not_found"?t("skills.install.error.notFound"):s==="token_required"?t("skills.install.error.authentication"):s==="untrusted_workspace"?t("skills.install.error.untrusted"):ba(e)||t("skills.install.failed")}async function Git(e){const t=new Uint8Array(await e.arrayBuffer());let n="";for(let s=0;s<t.length;s+=32768)n+=String.fromCharCode(...t.subarray(s,s+32768));return btoa(n)}function Kit({open:e,onOpenChange:t,onInstall:n}){const{t:s}=ot(),[r,i]=f.useState(""),[o,a]=f.useState("workspace"),[c,u]=f.useState("github"),[d,h]=f.useState(""),[m,p]=f.useState(""),[g,b]=f.useState(null),[v,x]=f.useState(!1),[y,w]=f.useState(null);function k(){i(""),a("workspace"),u("github"),h(""),p(""),b(null),w(null)}async function T(){x(!0),w(null);try{if(!r.trim())throw new Error(s("skills.install.error.nameRequired"));let _;if(c==="github"){if(!d.trim())throw new Error(s("skills.install.error.githubRequired"));_={type:"github",url:d.trim()}}else if(c==="folder"){if(!m.trim())throw new Error(s("skills.install.error.folderRequired"));_={type:"folder",path:m.trim()}}else{if(!g)throw new Error(s("skills.install.selectZip"));if(g.size>Vit)throw new Error(s("skills.install.error.zipTooLarge"));_={type:"zip",contentBase64:await Git(g)}}await n({name:r.trim(),scope:o,source:_}),t(!1),k()}catch(_){w(Wit(_,s))}finally{x(!1)}}return l.jsx(h1,{open:e,onOpenChange:_=>{v||(t(_),_||k())},children:l.jsxs(f1,{className:"sm:max-w-lg",showCloseButton:!1,onPointerDownOutside:_=>_.preventDefault(),children:[l.jsxs(m1,{children:[l.jsx(g1,{children:s("skills.install.title")}),l.jsx(qx,{children:s("skills.install.description")})]}),l.jsxs("div",{className:"grid gap-4",children:[y?l.jsxs(Ji,{variant:"destructive",children:[l.jsx(Wa,{}),l.jsx(Zi,{children:y})]}):null,l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.name"),l.jsx(ri,{value:r,onChange:_=>i(_.target.value),placeholder:"my-skill",disabled:v})]}),l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.scope"),l.jsxs(Hf,{value:o,onValueChange:_=>a(_),disabled:v,children:[l.jsx(Uf,{className:"w-full",children:l.jsx(qf,{})}),l.jsxs(Vf,{children:[l.jsx(Nl,{value:"workspace",children:s("skills.install.scope.workspace")}),l.jsx(Nl,{value:"global",children:s("skills.install.scope.global")})]})]})]}),l.jsxs(ow,{value:c,onValueChange:_=>u(_),children:[l.jsxs(aw,{className:"grid w-full grid-cols-3",children:[l.jsx(Do,{value:"github",disabled:v,children:"GitHub"}),l.jsx(Do,{value:"folder",disabled:v,children:s("skills.install.folder")}),l.jsx(Do,{value:"zip",disabled:v,children:"ZIP"})]}),l.jsx(Ya,{value:"github",className:"pt-3",children:l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.githubUrl"),l.jsx(ri,{type:"url",value:d,onChange:_=>h(_.target.value),placeholder:"https://github.com/owner/repo/blob/main/skill/SKILL.md",disabled:v})]})}),l.jsx(Ya,{value:"folder",className:"pt-3",children:l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.folderPath"),l.jsx(ri,{value:m,onChange:_=>p(_.target.value),placeholder:"/absolute/path/to/my-skill",disabled:v})]})}),l.jsx(Ya,{value:"zip",className:"pt-3",children:l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ri,{type:"file",accept:".zip,application/zip",onChange:_=>{var S;const C=((S=_.target.files)==null?void 0:S[0])??null;b(C),C&&i(L=>L||C.name.replace(/\.zip$/i,""))},disabled:v}),g?l.jsx("div",{className:"text-xs text-muted-foreground",children:s("skills.install.zipSelected",{name:g.name})}):null]})})]})]}),l.jsxs(p1,{children:[l.jsx(qn,{variant:"outline",onClick:()=>{t(!1),k()},disabled:v,children:s("common.cancel")}),l.jsxs(qn,{onClick:()=>void T(),disabled:v,children:[v?l.jsx($o,{"data-icon":"inline-start"}):l.jsx(M0e,{"data-icon":"inline-start"}),s("skills.install.action")]})]})]})})}const Yit="_skillGrid_1hucr_1",Xit={skillGrid:Yit};function eq(e,t){return t(`skills.level.${e.level}`)}function tq(e,t){return t(e.status==="disabled"?"skills.status.disabled":"skills.status.enabled")}function nq(e){return e.status==="disabled"?"":"bg-[var(--success-bg)] text-[var(--success-color)]"}function Qit(e,t){const n=e&&typeof e=="object"?e.body:void 0,s=n&&typeof n=="object"?n.code:void 0;return s==="skill_inactive_extension"?t("skills.error.inactiveExtension"):s==="skill_not_toggleable"?t("skills.notToggleable"):e instanceof Error?e.message:t("skills.toggleFailed")}function L0({label:e,value:t}){return l.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[l.jsx("div",{className:"text-sm font-medium",children:e}),l.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function sq({compact:e=!1}){const{t}=ot();return l.jsx(ob,{delayDuration:300,children:l.jsxs(ab,{children:[l.jsx(lb,{asChild:!0,children:l.jsx(Za,{variant:"secondary",className:e?"text-[10px]":void 0,children:t("skills.manualReference")})}),l.jsx(cb,{children:t("skills.manualReferenceHint")})]})})}function toe({onClose:e,onUseSkill:t,embedded:n}){var q,Z,he,ye;const{t:s}=ot(),r=ol(),{status:i,skills:o,loading:a,error:c,reload:u,setEnabled:d,install:h,remove:m}=Lme({autoLoad:!0}),p=((q=r.capabilities)==null?void 0:q.features.includes("workspace_skill_toggle"))===!0,g=((Z=r.capabilities)==null?void 0:Z.features.includes("workspace_skill_manage"))===!0,[b,v]=f.useState(""),[x,y]=f.useState("all"),[w,k]=f.useState("enabled"),[T,_]=f.useState({}),[C,S]=f.useState(null),[L,N]=f.useState(null),[$,M]=f.useState(!1),[P,E]=f.useState(!1),[O,z]=f.useState(null),[F,B]=f.useState(null),W=f.useMemo(()=>o.map(oe=>({...oe,status:T[oe.name]??oe.status})),[o,T]),I=f.useMemo(()=>W.find(oe=>oe.name===C),[W,C]),Y=f.useMemo(()=>Iit(W,b,x,w),[W,x,b,w]),V=W.filter(oe=>oe.status==="disabled").length,j=(c==null?void 0:c.message)??((ye=(he=i==null?void 0:i.errors)==null?void 0:he[0])==null?void 0:ye.error),ee=[{value:"all",label:s("skills.filter.all")},{value:"user",label:s("skills.filter.user")},{value:"project",label:s("skills.filter.project")},{value:"extension",label:s("skills.filter.extension")},{value:"bundled",label:s("skills.filter.bundled")}];f.useEffect(()=>{S(oe=>Rit(oe,W))},[W]),f.useEffect(()=>{_(oe=>{const we={...oe};let Ve=!1;for(const lt of o)we[lt.name]===lt.status&&(delete we[lt.name],Ve=!0);return Ve?we:oe})},[o]),f.useEffect(()=>{n==null||n.onDetailChange(!!I)},[n,I]);async function se(oe){const we=oe.status==="disabled";N(oe.name),B(null);try{await d(oe.name,we),_(Ve=>({...Ve,[oe.name]:we?"ok":"disabled"})),await u(),B({skillName:oe.name,text:s(we?"skills.enabled":"skills.disabled"),error:!1})}catch(Ve){B({skillName:oe.name,text:Qit(Ve,s),error:!0})}finally{N(null)}}async function X(oe){z(null),await h(oe),z(s("skills.install.succeeded",{name:oe.name.trim()})),await u().catch(()=>{})}async function Q(){if(!I)return;const oe=I.level==="project"?"workspace":"global";N(I.name);try{await m(I.name,oe),E(!1),S(null),z(s("skills.delete.succeeded",{name:I.name})),await u().catch(()=>{})}catch(we){E(!1),B({skillName:I.name,text:we instanceof Error?we.message:s("skills.delete.failed"),error:!0})}finally{N(null)}}function ue(){S(null),u()}const re=l.jsx(E1,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(A1,{className:"text-base",children:[l.jsx(vo,{children:l.jsx(qn,{variant:"ghost",size:"icon",onClick:e,"aria-label":s("common.back"),children:l.jsx(JN,{})})}),l.jsx(vo,{children:I?l.jsx(df,{asChild:!0,children:l.jsx("button",{type:"button",onClick:ue,children:s("skills.title")})}):l.jsx(rc,{children:s("skills.title")})}),I?l.jsx(hf,{}):null,I?l.jsx(vo,{children:l.jsx(rc,{children:I.name})}):null]})}),J=n?I?l.jsx(E1,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(A1,{className:"h-8 text-sm",children:[l.jsx(vo,{children:l.jsx(df,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>{ue(),n.onDetailChange(!1)},children:s("skills.title")})})}),l.jsx(hf,{}),l.jsx(vo,{children:l.jsx(rc,{children:I.name})})]})}):null:re;if(I){const oe=`/${I.name}${I.argumentHint?` ${I.argumentHint}`:""}`;return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[J,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:l.jsx(F_,{})}),l.jsx("div",{className:"min-w-0 flex-1",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h1",{className:"break-words text-2xl font-semibold text-balance",children:I.name}),l.jsx(Za,{variant:"outline",children:eq(I,s)}),l.jsx(Za,{variant:"secondary",className:nq(I),children:tq(I,s)}),I.modelInvocable?null:l.jsx(sq,{})]})}),l.jsxs(qn,{disabled:I.status==="disabled",onClick:()=>t(I.name),children:[l.jsx(c0e,{"data-icon":"inline-start"}),s("skills.run")]}),l.jsxs(Hg,{children:[l.jsx(qg,{asChild:!0,children:l.jsx(qn,{variant:"ghost",size:"icon",disabled:L!==null,"aria-label":s("skills.actions"),"data-testid":"skill-actions",children:L===I.name?l.jsx($o,{}):l.jsx(Ng,{})})}),l.jsx(Ug,{align:"end",onCloseAutoFocus:we=>we.preventDefault(),children:l.jsxs(N1,{children:[l.jsx(yo,{disabled:L!==null||!p||I.userInvocable===!1,title:p?I.userInvocable===!1?s("skills.notToggleable"):void 0:s("skills.toggleUnsupported"),onSelect:()=>void se(I),children:s(I.status==="disabled"?"skills.enable":"skills.disable")}),g&&(I.level==="project"||I.level==="user")?l.jsx(yo,{variant:"destructive",disabled:L!==null,onSelect:()=>E(!0),children:s("skills.delete.action")}):null]})})]})]}),(F==null?void 0:F.skillName)===I.name?l.jsxs(Ji,{variant:F.error?"destructive":"default",children:[F.error?l.jsx(Wa,{}):l.jsx(Ex,{}),l.jsx(Zi,{children:F.text})]}):null,j||I.error?l.jsxs(Ji,{variant:"destructive",children:[l.jsx(Wa,{}),l.jsx(Zi,{children:I.error||j})]}):null,l.jsxs(ic,{children:[l.jsxs(Ad,{children:[l.jsx(Nd,{className:"text-sm",children:s("skills.details")}),l.jsx(ff,{children:I.description||s("skills.noDescription")})]}),l.jsxs(Tp,{className:"grid gap-6 sm:grid-cols-2",children:[l.jsx(L0,{label:s("skills.invocation"),value:oe}),l.jsx(L0,{label:s("skills.level"),value:eq(I,s)}),l.jsx(L0,{label:s("skills.modelAccess"),value:I.modelInvocable?s("skills.modelAccess.enabled"):s("skills.modelAccess.disabled")}),l.jsx(L0,{label:s("skills.model"),value:I.model||"-"}),l.jsx(L0,{label:s("skills.extension"),value:I.extensionName||"-"}),I.hint?l.jsx("div",{className:"sm:col-span-2",children:l.jsx(L0,{label:s("skills.hint"),value:I.hint})}):null]})]}),l.jsx(y9,{open:P,onOpenChange:we=>{!we&&L!==null||E(we)},children:l.jsxs(x9,{children:[l.jsxs(v9,{children:[l.jsx(k9,{children:s("skills.delete.title")}),l.jsx(_9,{children:s("skills.delete.description",{name:I.name})})]}),l.jsxs(w9,{children:[l.jsx(S9,{disabled:L!==null,children:s("common.cancel")}),l.jsxs(Qie,{variant:"destructive",disabled:L!==null,onClick:we=>{we.preventDefault(),Q()},children:[L?l.jsx($o,{"data-icon":"inline-start"}):null,s("skills.delete.action")]})]})]})})]})]})}return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[J,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl font-semibold text-balance",children:s("skills.title")}),l.jsx("p",{className:"mt-1 text-sm text-muted-foreground tabular-nums",children:s("skills.count",{count:o.length,enabled:o.length-V,disabled:V})})]}),l.jsxs("div",{className:"flex gap-2",children:[g?l.jsxs(qn,{onClick:()=>M(!0),children:[l.jsx(Ax,{"data-icon":"inline-start"}),s("skills.install.action")]}):null,l.jsxs(qn,{variant:"outline",disabled:a,onClick:()=>void u(),children:[a?l.jsx($o,{"data-icon":"inline-start"}):l.jsx(Yy,{"data-icon":"inline-start"}),s("common.refresh")]})]})]}),j?l.jsxs(Ji,{variant:"destructive",children:[l.jsx(Wa,{}),l.jsx(Zi,{children:j})]}):null,O?l.jsxs(Ji,{children:[l.jsx(Ex,{}),l.jsx(Zi,{children:O})]}):null,l.jsxs("div",{className:"relative",children:[l.jsx(Zd,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(ri,{name:"skill-search","aria-label":s("skills.search"),autoComplete:"off",value:b,onChange:oe=>v(oe.target.value),placeholder:s("skills.search"),className:"pl-9"})]}),l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[l.jsx(Zie,{type:"single",value:x,onValueChange:oe=>{oe&&y(oe)},variant:"outline",size:"sm","aria-label":s("skills.filter.label"),children:ee.map(oe=>l.jsx(eoe,{value:oe.value,children:oe.label},oe.value))}),l.jsxs(Hf,{value:w,onValueChange:oe=>k(oe),children:[l.jsx(Uf,{className:"w-32","aria-label":s("skills.filter.status.label"),children:l.jsx(qf,{})}),l.jsxs(Vf,{children:[l.jsx(Nl,{value:"all",children:s("skills.filter.status.all")}),l.jsx(Nl,{value:"enabled",children:s("skills.filter.status.enabled")}),l.jsx(Nl,{value:"disabled",children:s("skills.filter.status.disabled")})]})]})]}),Y.length?l.jsx("div",{className:Xit.skillGrid,"data-column-count":Math.min(Y.length,4),children:Y.map(oe=>l.jsx(ic,{size:"sm",role:"button",tabIndex:0,"aria-label":oe.name,className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>S(oe.name),onKeyDown:we=>{(we.key==="Enter"||we.key===" ")&&(we.preventDefault(),S(oe.name))},children:l.jsx(Ad,{className:"block",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:l.jsx(F_,{className:"size-5"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[l.jsx(Nd,{className:"min-w-0 flex-1 truncate",children:oe.name}),l.jsxs("div",{className:"flex shrink-0 gap-1",children:[l.jsx(Za,{variant:"secondary",className:`${nq(oe)} text-[10px]`,children:tq(oe,s)}),oe.modelInvocable?null:l.jsx(sq,{compact:!0})]})]}),l.jsx(ff,{className:"mt-1 min-w-0 text-xs",children:l.jsx(ob,{delayDuration:300,children:l.jsxs(ab,{children:[l.jsx(lb,{asChild:!0,children:l.jsx("span",{className:"block truncate",children:oe.description||s("skills.noDescription")})}),l.jsx(cb,{children:oe.description||s("skills.noDescription")})]})})})]})]})})},oe.name))}):l.jsx(Hd,{className:"border",children:l.jsxs(qd,{children:[l.jsx(Ud,{variant:"icon",children:b||x!=="all"||w!=="all"?l.jsx(Zd,{}):l.jsx(F_,{})}),l.jsx(Vd,{children:s(b||x!=="all"||w!=="all"?"skills.noMatches":"skills.empty")})]})})]}),l.jsx(Kit,{open:$,onOpenChange:M,onInstall:X})]})}const Jit="_chart_1xbk4_1",Zit="_plot_1xbk4_8",eot="_svg_1xbk4_13",tot="_cursor_1xbk4_30",not="_tooltip_1xbk4_40",sot="_tooltipBelow_1xbk4_62",rot="_tooltipTime_1xbk4_67",iot="_tooltipRow_1xbk4_73",oot="_tooltipLabel_1xbk4_79",aot="_tooltipValue_1xbk4_83",lot="_axis_1xbk4_91",cot="_legend_1xbk4_96",uot="_legendItem_1xbk4_105",dot="_swatch_1xbk4_112",hot="_legendLabel_1xbk4_118",fot="_legendValue_1xbk4_123",mot="_peak_1xbk4_131",ho={chart:Jit,plot:Zit,svg:eot,cursor:tot,tooltip:not,tooltipBelow:sot,tooltipTime:rot,tooltipRow:iot,tooltipLabel:oot,tooltipValue:aot,axis:lot,legend:cot,legendItem:uot,swatch:dot,legendLabel:hot,legendValue:fot,peak:mot},C9=320,Ny=64,Ha=3,c_=C9-Ha*2,u_=Ny-Ha*2;function rq(e,t){return Number.isFinite(e)?e:t}const pot=84;function got(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 bot(e){return new Date(e).toLocaleTimeString()}function noe({series:e,timestamps:t,format:n=a=>String(Math.round(a)),formatTime:s=bot,zeroBased:r=!0,ariaLabel:i,peakLabel:o="peak"}){const a=f.useRef(null),[c,u]=f.useState(null),[d,h]=f.useState(!1),m=f.useRef(void 0),{paths:p,maxV:g,maxLen:b,min:v,span:x}=f.useMemo(()=>{const N=e.reduce((F,B)=>Math.max(F,B.values.length),0);let $=0,M=r?0:Number.POSITIVE_INFINITY;for(const F of e)for(const B of F.values)Number.isFinite(B)&&(B>$&&($=B),B<M&&(M=B));Number.isFinite(M)||(M=0);const P=$-M||1,E=F=>N<=1?Ha+c_/2:Ha+F/(N-1)*c_,O=F=>Ha+u_-(rq(F,M)-M)/P*u_;return{paths:e.map(F=>{const B=F.values.map((Y,V)=>`${V===0?"M":"L"}${E(V).toFixed(1)},${O(Y).toFixed(1)}`).join(" "),W=F.values.length-1,I=W>=0?{cx:E(W),cy:O(F.values[W]),color:F.color}:void 0;return{key:F.label,d:B,color:F.color,dot:I}}),maxV:$,maxLen:N,min:M,span:P}},[e,r]),y=b>0,w=N=>b<=1?Ha+c_/2:Ha+N/(b-1)*c_,k=N=>Ha+u_-(rq(N,v)-v)/x*u_,T=N=>{const $=a.current;if(!$||b===0)return;const M=$.getBoundingClientRect();if(M.width===0)return;const P=(N.clientX-M.left)/M.width,E=Math.max(0,Math.min(b-1,Math.round(P*(b-1))));u(E),m.current===void 0&&(m.current=got($));const O=m.current,z=O?O.getBoundingClientRect().top:0;h(M.top-z<pot)},_=()=>u(null),C=c!=null&&c>=0&&c<b?c:null,S=C!=null?w(C):0,L=C!=null&&b>1?C/(b-1)*100:50;return l.jsxs("div",{className:ho.chart,children:[l.jsxs("div",{className:ho.plot,children:[l.jsxs("svg",{ref:a,viewBox:`0 0 ${C9} ${Ny}`,preserveAspectRatio:"none",role:"img","aria-label":i,className:ho.svg,onPointerMove:T,onPointerLeave:_,children:[l.jsx("line",{x1:Ha,y1:Ny-Ha,x2:C9-Ha,y2:Ny-Ha,className:ho.axis,vectorEffect:"non-scaling-stroke"}),p.map(N=>l.jsx("path",{d:N.d,fill:"none",stroke:N.color,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"},N.key)),C!=null&&l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:S,y1:Ha,x2:S,y2:Ny-Ha,className:ho.cursor,vectorEffect:"non-scaling-stroke"}),e.map(N=>C<N.values.length?l.jsx("circle",{cx:S,cy:k(N.values[C]),r:2.5,fill:N.color,vectorEffect:"non-scaling-stroke"},`${N.label}-hover`):null)]}),C==null&&p.map(N=>N.dot?l.jsx("circle",{cx:N.dot.cx,cy:N.dot.cy,r:2,fill:N.dot.color,vectorEffect:"non-scaling-stroke"},`${N.key}-dot`):null)]}),C!=null&&l.jsxs("div",{className:`${ho.tooltip} ${d?ho.tooltipBelow:""}`,style:{left:`${L}%`},role:"tooltip",children:[t&&t[C]!=null&&l.jsx("div",{className:ho.tooltipTime,children:s(t[C])}),e.map(N=>C<N.values.length?l.jsxs("div",{className:ho.tooltipRow,children:[l.jsx("svg",{className:ho.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:l.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:N.color})}),l.jsx("span",{className:ho.tooltipLabel,children:N.label}),l.jsx("span",{className:ho.tooltipValue,children:n(N.values[C])})]},N.label):null)]})]}),l.jsxs("div",{className:ho.legend,children:[e.map(N=>{const $=N.values.length?N.values[N.values.length-1]:void 0;return l.jsxs("span",{className:ho.legendItem,children:[l.jsx("svg",{className:ho.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:l.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:N.color})}),l.jsx("span",{className:ho.legendLabel,children:N.label}),$!==void 0&&l.jsx("span",{className:ho.legendValue,children:n($)})]},N.label)}),y&&l.jsx("span",{className:ho.peak,children:`${o} ${n(g)}`})]})]})}const yot="_wrap_1icv6_1",xot="_tooltip_1icv6_11",vot="_legend_1icv6_27",wot="_legendLabel_1icv6_35",kot="_scroll_1icv6_39",_ot="_grid_1icv6_44",Sot="_month_1icv6_51",Cot="_weekday_1icv6_59",Tot="_cell_1icv6_69",Eot="_legendCell_1icv6_75",Aot="_lvl0_1icv6_82",Not="_lvl1_1icv6_85",jot="_lvl2_1icv6_88",Mot="_lvl3_1icv6_91",Iot="_lvl4_1icv6_94",Rot="_today_1icv6_98",ga={wrap:yot,tooltip:xot,legend:vot,legendLabel:wot,scroll:kot,grid:_ot,month:Sot,weekday:Cot,cell:Tot,legendCell:Eot,lvl0:Aot,lvl1:Not,lvl2:jot,lvl3:Mot,lvl4:Iot,today:Rot},f8=864e5,Dot=4;function m8(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function iq(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${s}`}function Lot(e){const t=e.filter(s=>s>0).sort((s,r)=>s-r);if(t.length===0)return[0,0,0];const n=s=>t[Math.min(t.length-1,Math.floor(s*(t.length-1)))];return[n(.25),n(.5),n(.75)]}function Pot(e,[t,n,s]){return e<=0?0:e<=t?1:e<=n?2:e<=s?3:Dot}function Oot(e,t,n){const s=Math.max(1,Math.floor(t)),r=m8(Date.now()),i=m8(r.getTime()-(s-1)*f8),o=(i.getDay()+6)%7,a=m8(i.getTime()-o*f8),c=Math.round((r.getTime()-a.getTime())/f8)+1,u=[],d=[],h=iq(r),m=new Date(a.getTime());for(let w=0;w<c;w++){const k=iq(m),T=e[k],_=(T==null?void 0:T.tokens)??0;d.push(_),u.push({dateKey:k,tokens:_,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=Lot(d),g=u.map(w=>({...w,level:Pot(w.tokens,p)})),b=Math.ceil(c/7),v=[];let x=-1;const y=new Date(a.getTime());for(let w=0;w<b;w++){const k=y.getMonth();k!==x&&(v.push({week:w,text:y.toLocaleDateString(n,{month:"short"})}),x=k),y.setDate(y.getDate()+7)}return{cells:g,months:v,weeks:b}}function Bot({heatmap:e,days:t}){const{t:n,language:s}=ot(),r=f.useMemo(()=>Oot(e,t,s),[e,t,s]),i=f.useRef(null),[o,a]=f.useState(null),c={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"),v=h.getBoundingClientRect(),x=m.getBoundingClientRect();a({left:v.left-x.left+v.width/2,top:v.top-x.top,text:n("daemon.usage.cellTokens",{date:p,tokens:xg(g),cache:Math.round(b*100)})})};return l.jsxs("div",{className:ga.wrap,ref:i,children:[l.jsxs("div",{className:ga.legend,children:[l.jsx("span",{className:ga.legendLabel,children:n("daemon.usage.low")}),[0,1,2,3,4].map(d=>l.jsx("span",{className:`${ga.cell} ${ga.legendCell} ${ga[`lvl${d}`]}`},d)),l.jsx("span",{className:ga.legendLabel,children:n("daemon.usage.high")})]}),l.jsx("div",{className:ga.scroll,onMouseOver:u,onMouseLeave:()=>a(null),children:l.jsxs("div",{className:ga.grid,role:"img","aria-label":n("daemon.usage.heatmapTitle"),style:{gridTemplateColumns:`auto repeat(${r.weeks}, var(--hm-cell))`},children:[r.months.map(d=>l.jsx("div",{className:ga.month,style:{gridColumn:d.week+2,gridRow:1},children:d.text},`m-${d.week}`)),[0,2,4].map(d=>l.jsx("div",{className:ga.weekday,style:{gridColumn:1,gridRow:d+2},children:c[d]},`wd-${d}`)),r.cells.map(d=>l.jsx("div",{className:`${ga.cell} ${ga[`lvl${d.level}`]} ${d.isToday?ga.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&&l.jsx("div",{className:ga.tooltip,style:{left:o.left,top:o.top},role:"status",children:o.text})]})}const $ot="_usage_1kfmt_1",zot="_toolbar_1kfmt_9",Fot="_segmented_1kfmt_14",Hot="_segment_1kfmt_14",qot="_segmentActive_1kfmt_41",Uot="_hero_1kfmt_48",Vot="_heroMain_1kfmt_59",Wot="_heroLabel_1kfmt_63",Got="_heroNumber_1kfmt_71",Kot="_heroSub_1kfmt_82",Yot="_refresh_1kfmt_87",Xot="_stats_1kfmt_109",Qot="_stat_1kfmt_109",Jot="_statValue_1kfmt_121",Zot="_statLabel_1kfmt_130",eat="_section_1kfmt_139",tat="_sectionTitle_1kfmt_145",nat="_sectionSub_1kfmt_154",sat="_breakdown_1kfmt_161",rat="_metric_1kfmt_167",iat="_metricHead_1kfmt_173",oat="_tick_1kfmt_179",aat="_tick_input_1kfmt_186",lat="_tick_output_1kfmt_190",cat="_tick_cache_1kfmt_198",uat="_metricLabel_1kfmt_202",dat="_metricValue_1kfmt_209",hat="_metricHint_1kfmt_219",fat="_state_1kfmt_225",mat="_modelList_1kfmt_233",pat="_modelRow_1kfmt_239",gat="_modelHead_1kfmt_245",bat="_modelRank_1kfmt_251",yat="_modelMeta_1kfmt_262",xat="_modelName_1kfmt_267",vat="_modelSub_1kfmt_277",wat="_modelShare_1kfmt_282",kat="_modelTrack_1kfmt_289",_at="_modelFill_1kfmt_296",Sat="_modelFillCache_1kfmt_303",Cat="_skillTable_1kfmt_310",Tat="_right_1kfmt_334",Eat="_bars_1kfmt_339",Aat="_barsBody_1kfmt_345",Nat="_barCol_1kfmt_352",jat="_bar_1kfmt_339",Mat="_barsCaption_1kfmt_371",xn={usage:$ot,toolbar:zot,segmented:Fot,segment:Hot,segmentActive:qot,hero:Uot,heroMain:Vot,heroLabel:Wot,heroNumber:Got,heroSub:Kot,refresh:Yot,stats:Xot,stat:Qot,statValue:Jot,statLabel:Zot,section:eat,sectionTitle:tat,sectionSub:nat,breakdown:sat,metric:rat,metricHead:iat,tick:oat,tick_input:aat,tick_output:lat,tick_cache:cat,metricLabel:uat,metricValue:dat,metricHint:hat,state:fat,modelList:mat,modelRow:pat,modelHead:gat,modelRank:bat,modelMeta:yat,modelName:xat,modelSub:vat,modelShare:wat,modelTrack:kat,modelFill:_at,modelFillCache:Sat,skillTable:Cat,right:Tat,bars:Eat,barsBody:Aat,barCol:Nat,bar:jat,barsCaption:Mat},soe=12,Iat=Math.round(soe*30.44),Rat=["today","week","month"],Dat={today:"daemon.usage.today",week:"daemon.usage.period7d",month:"daemon.usage.period30d"},Lat={today:"daemon.usage.today",week:"daemon.usage.rangeWeek",month:"daemon.usage.rangeMonth"},Pat={today:"daemon.usage.rangeWordToday",week:"daemon.usage.rangeWordWeek",month:"daemon.usage.rangeWordMonth"},oq=["#3b82f6","#14b8a6","#f59e0b","#ef4444","#8b5cf6","#22c55e","#06b6d4","#ec4899"];function Oat(e){return new Date(`${e}T00:00:00`).getTime()}function p8(e,t){return new Date(`${e}T00:00:00`).toLocaleDateString(t,{month:"short",day:"numeric"})}function Bat(e,t){return new Date(e).toLocaleDateString(t,{month:"short",day:"numeric"})}function d_({label:e,value:t}){return l.jsxs("div",{className:xn.stat,children:[l.jsx("div",{className:xn.statValue,children:t.toLocaleString()}),l.jsx("div",{className:xn.statLabel,children:e})]})}function g8({accent:e,value:t,label:n,hint:s}){return l.jsxs("div",{className:xn.metric,children:[l.jsxs("div",{className:xn.metricHead,children:[l.jsx("span",{className:`${xn.tick} ${xn[`tick_${e}`]}`}),l.jsx("span",{className:xn.metricLabel,children:n})]}),l.jsx("div",{className:xn.metricValue,children:t}),l.jsx("div",{className:xn.metricHint,children:s})]})}function $at({rank:e,model:t,color:n}){const{t:s}=ot(),r=Math.max(0,Math.min(100,t.share*100)),i=Math.max(0,Math.min(100,t.cacheReadRate*100));return l.jsxs("div",{className:xn.modelRow,children:[l.jsxs("div",{className:xn.modelHead,children:[l.jsx("span",{className:xn.modelRank,style:{color:n},children:String(e).padStart(2,"0")}),l.jsxs("div",{className:xn.modelMeta,children:[l.jsx("div",{className:xn.modelName,children:t.model}),l.jsx("div",{className:xn.modelSub,children:s("daemon.usage.modelMeta",{tokens:xg(t.totalTokens),cache:Math.round(i)})})]}),l.jsxs("span",{className:xn.modelShare,style:{color:n},children:[Math.round(r),"%"]})]}),l.jsx("div",{className:xn.modelTrack,children:l.jsx("div",{className:xn.modelFill,style:{width:`${r}%`,background:n},children:l.jsx("div",{className:xn.modelFillCache,style:{width:`${i}%`}})})})]})}function zat({points:e,format:t,locale:n}){const s=Math.max(1,...e.map(r=>r.value));return l.jsxs("div",{className:xn.bars,children:[l.jsx("div",{className:xn.barsBody,children:e.map((r,i)=>l.jsx("div",{className:xn.barCol,title:`${p8(r.label,n)} · ${t(r.value)}`,children:l.jsx("div",{className:xn.bar,style:{height:`${r.value/s*100}%`}})},`${r.label}-${i}`))}),e.length>1&&l.jsxs("div",{className:xn.barsCaption,children:[l.jsx("span",{children:p8(e[0].label,n)}),l.jsx("span",{children:p8(e[e.length-1].label,n)})]})]})}function Fat(){const{t:e,language:t}=ot(),[n,s]=f.useState("today"),{dashboard:r,loading:i,error:o,reload:a}=Pme({range:n,heatmapDays:Iat,autoLoad:!0}),c=l.jsx("div",{className:xn.segmented,role:"group","aria-label":e("daemon.usage.rangeGroup"),children:Rat.map(y=>l.jsx("button",{type:"button",className:`${xn.segment} ${y===n?xn.segmentActive:""}`,"aria-pressed":y===n,onClick:()=>s(y),children:e(Dat[y])},y))});if(!r)return l.jsxs("div",{className:xn.usage,children:[l.jsx("div",{className:xn.toolbar,children:c}),i?l.jsx("div",{className:xn.state,children:e("daemon.usage.loading")}):o?l.jsxs("div",{className:xn.state,children:[e("daemon.usage.failed"),": ",o.message]}):l.jsx("div",{className:xn.state,children:e("daemon.usage.empty")})]});const{summary:u,models:d,skills:h,daily:m,heatmap:p,heatmapDays:g}=r,b=u.linesAdded+u.linesRemoved,v=u.totalTokens>0||Object.keys(p).length>0,x=e(Pat[r.range]);return l.jsxs("div",{className:xn.usage,"aria-busy":i,children:[l.jsx("div",{className:xn.toolbar,children:c}),l.jsxs("header",{className:xn.hero,children:[l.jsxs("div",{className:xn.heroMain,children:[l.jsx("div",{className:xn.heroLabel,children:e(Lat[r.range])}),l.jsx("div",{className:xn.heroNumber,children:xg(u.totalTokens)}),l.jsx("div",{className:xn.heroSub,children:e("daemon.usage.tokensConsumed")})]}),l.jsx("button",{type:"button",className:xn.refresh,onClick:()=>void a(),disabled:i,children:e("daemon.refresh")})]}),l.jsxs("div",{className:xn.stats,children:[l.jsx(d_,{label:e("daemon.usage.sessions"),value:u.sessions}),l.jsx(d_,{label:e("daemon.usage.requests"),value:u.requests}),l.jsx(d_,{label:e("daemon.usage.tools"),value:u.toolCalls}),l.jsx(d_,{label:e("daemon.usage.changes"),value:b})]}),l.jsxs("section",{className:xn.section,children:[l.jsx("h4",{className:xn.sectionTitle,children:e("daemon.usage.breakdownTitle")}),l.jsxs("div",{className:xn.breakdown,children:[l.jsx(g8,{accent:"input",value:xg(u.inputTokens),label:e("daemon.usage.inputTokens"),hint:e("daemon.usage.inputHint")}),l.jsx(g8,{accent:"output",value:xg(u.outputTokens+u.thoughtsTokens),label:e("daemon.usage.outputTokens"),hint:e("daemon.usage.outputHint")}),l.jsx(g8,{accent:"cache",value:`${Math.round(u.cacheReadRate*100)}%`,label:e("daemon.usage.cacheRead"),hint:e("daemon.usage.cacheHint")})]})]}),l.jsxs("section",{className:xn.section,children:[l.jsx("h4",{className:xn.sectionTitle,children:e("daemon.usage.heatmapTitle")}),l.jsx("div",{className:xn.sectionSub,children:e("daemon.usage.heatmapSub",{months:soe})}),v?l.jsx(Bot,{heatmap:p,days:g}):l.jsx("div",{className:xn.state,children:e("daemon.usage.empty")})]}),d.length>0&&l.jsxs("section",{className:xn.section,children:[l.jsxs("h4",{className:xn.sectionTitle,children:[x," ",e("daemon.usage.modelShareTitle")]}),l.jsx("div",{className:xn.sectionSub,children:e("daemon.usage.modelShareSub")}),l.jsx("div",{className:xn.modelList,children:d.map((y,w)=>l.jsx($at,{rank:w+1,model:y,color:oq[w%oq.length]},y.model))})]}),h.length>0&&l.jsxs("section",{className:xn.section,children:[l.jsxs("h4",{className:xn.sectionTitle,children:[x," ",e("daemon.usage.skillTitle")]}),l.jsx("div",{className:xn.sectionSub,children:e("daemon.usage.skillSub")}),l.jsxs("table",{className:xn.skillTable,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:e("daemon.usage.skillName")}),l.jsx("th",{className:xn.right,children:e("daemon.usage.skillCount")})]})}),l.jsx("tbody",{children:h.map(y=>l.jsxs("tr",{children:[l.jsx("td",{children:y.name}),l.jsx("td",{className:xn.right,children:y.count.toLocaleString()})]},y.name))})]})]}),m.length>1&&l.jsxs("section",{className:xn.section,children:[l.jsxs("h4",{className:xn.sectionTitle,children:[x," ",e("daemon.usage.dailyTokensTitle")]}),l.jsx("div",{className:xn.sectionSub,children:e("daemon.usage.dailyTokensSub")}),l.jsx(noe,{series:[{label:e("daemon.usage.tokensConsumed"),values:m.map(y=>y.tokens),color:"var(--agent-blue-400)"}],timestamps:m.map(y=>Oat(y.date)),format:xg,formatTime:y=>Bat(y,t),ariaLabel:e("daemon.usage.dailyTokensTitle"),peakLabel:e("daemon.charts.peak")})]}),m.length>1&&l.jsxs("section",{className:xn.section,children:[l.jsxs("h4",{className:xn.sectionTitle,children:[x," ",e("daemon.usage.dailySessionsTitle")]}),l.jsx("div",{className:xn.sectionSub,children:e("daemon.usage.dailySessionsSub")}),l.jsx(zat,{points:m.map(y=>({label:y.date,value:y.sessions})),format:y=>y.toLocaleString(),locale:t})]})]})}const Hat="_dialog_lw868_4",qat="_toolbar_lw868_12",Uat="_toolbarActions_lw868_19",Vat="_updatedAt_lw868_26",Wat="_refreshError_lw868_31",Gat="_refreshButton_lw868_36",Kat="_badge_lw868_51",Yat="_levelOk_lw868_61",Xat="_levelWarning_lw868_66",Qat="_levelError_lw868_71",Jat="_levelUnavailable_lw868_76",Zat="_tabs_lw868_81",elt="_tab_lw868_81",tlt="_tabActive_lw868_106",nlt="_grid_lw868_114",slt="_chartsGrid_lw868_113",rlt="_card_lw868_128",ilt="_cardTitle_lw868_135",olt="_cardHeader_lw868_147",alt="_infoHint_lw868_162",llt="_infoHintButton_lw868_168",clt="_infoHintTip_lw868_197",ult="_row_lw868_231",dlt="_rowLabel_lw868_240",hlt="_rowValue_lw868_244",flt="_pathRow_lw868_253",mlt="_pathValue_lw868_247",plt="_empty_lw868_274",glt="_issueRow_lw868_279",blt="_issueMessage_lw868_286",ylt="_featureChips_lw868_290",xlt="_featureChip_lw868_290",vlt="_summaryChip_lw868_311",wlt="_sessionRow_lw868_320",klt="_sessionName_lw868_329",_lt="_sessionMeta_lw868_335",Slt="_activePrompt_lw868_344",Clt="_workspaceRow_lw868_348",Tlt="_workspaceRowHead_lw868_357",Elt="_workspaceName_lw868_363",Alt="_workspaceDuration_lw868_367",Nlt="_workspaceError_lw868_374",jlt="_workspaceSummary_lw868_381",Mlt="_workspaceCell_lw868_388",Ilt="_workspaceCellLabel_lw868_397",Rlt="_workspaceCellMessage_lw868_402",an={dialog:Hat,toolbar:qat,toolbarActions:Uat,updatedAt:Vat,refreshError:Wat,refreshButton:Gat,badge:Kat,levelOk:Yat,levelWarning:Xat,levelError:Qat,levelUnavailable:Jat,tabs:Zat,tab:elt,tabActive:tlt,grid:nlt,chartsGrid:slt,card:rlt,cardTitle:ilt,cardHeader:olt,infoHint:alt,infoHintButton:llt,infoHintTip:clt,row:ult,rowLabel:dlt,rowValue:hlt,pathRow:flt,pathValue:mlt,empty:plt,issueRow:glt,issueMessage:blt,featureChips:ylt,featureChip:xlt,summaryChip:vlt,sessionRow:wlt,sessionName:klt,sessionMeta:_lt,activePrompt:Slt,workspaceRow:Clt,workspaceRowHead:Tlt,workspaceName:Elt,workspaceDuration:Alt,workspaceError:Nlt,workspaceSummary:jlt,workspaceCell:Mlt,workspaceCellLabel:Ilt,workspaceCellMessage:Rlt},Dlt=5e3,P0=[{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 roe(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/86400),s=Math.floor(t%86400/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}d ${s}h ${r}m`:s>0?`${s}h ${r}m ${i}s`:r>0?`${r}m ${i}s`:`${i}s`}function mf(e){return e=Math.max(0,e),e>=6e4?roe(e):e>=1e3?`${(e/1e3).toFixed(e%1e3===0?0:1)}s`:`${e}ms`}function k4(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 ay(e){const t=Math.round(e);return t>=1e4?`${(t/1e3).toFixed(t%1e3===0?0:1)}k`:t.toLocaleString()}function Llt(e){return`${e.toFixed(e>=100||e===0?0:1)}%`}function Plt(e){return e.exitCode!=null?`${e.state} (exit ${e.exitCode})`:e.signal?`${e.state} (${e.signal})`:e.state}function aq(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Olt=["cells","servers","errors","skills","tools","providers","hooks","extensions","budgets"];function Blt(e){if(!aq(e))return[];const t=[];for(const n of Olt){const s=e[n];if(Array.isArray(s))for(const r of s){if(!aq(r))continue;const i=r.status;if(i!=="warning"&&i!=="error")continue;const o=String(r.kind??r.name??r.serverName??n),a=typeof r.error=="string"?r.error:typeof r.hint=="string"?r.hint:void 0;t.push({label:o,status:i,message:a})}}return t}function T9(e){switch(e){case"ok":return an.levelOk;case"warning":return an.levelWarning;case"error":return an.levelError;default:return an.levelUnavailable}}function cr({label:e,value:t}){return l.jsxs("div",{className:an.row,children:[l.jsx("span",{className:an.rowLabel,children:e}),l.jsx("span",{className:an.rowValue,children:t})]})}function $lt({text:e}){return l.jsxs("span",{className:an.infoHint,children:[l.jsx("button",{type:"button",className:an.infoHintButton,"aria-label":e,children:l.jsx("span",{"aria-hidden":"true",children:"ⓘ"})}),l.jsx("span",{"aria-hidden":"true",className:an.infoHintTip,children:e})]})}function Jl({title:e,help:t,children:n}){return l.jsxs("section",{className:an.card,children:[t?l.jsxs("div",{className:an.cardHeader,children:[l.jsx("h3",{className:an.cardTitle,children:e}),l.jsx($lt,{text:t})]}):l.jsx("h3",{className:an.cardTitle,children:e}),n]})}function zlt({name:e,section:t}){const{t:n}=ot(),s=Object.entries(t.summary??{}),r=Blt(t.data);return l.jsxs("div",{className:an.workspaceRow,children:[l.jsxs("div",{className:an.workspaceRowHead,children:[l.jsx("span",{className:`${an.badge} ${T9(t.status)}`,children:n(`daemon.level.${t.status}`)}),l.jsx("span",{className:an.workspaceName,children:e}),l.jsx("span",{className:an.workspaceDuration,children:mf(t.durationMs)})]}),t.error&&l.jsx("div",{className:an.workspaceError,children:t.error.message}),r.map((i,o)=>l.jsxs("div",{className:an.workspaceCell,children:[l.jsx("span",{className:`${an.badge} ${T9(i.status)}`,children:n(`daemon.level.${i.status}`)}),l.jsx("span",{className:an.workspaceCellLabel,children:i.label}),i.message&&l.jsx("span",{className:an.workspaceCellMessage,children:i.message})]},`${i.label}-${o}`)),s.length>0&&l.jsx("div",{className:an.workspaceSummary,children:s.map(([i,o])=>l.jsxs("span",{className:an.summaryChip,children:[i,": ",o===null?n("common.na"):String(o)]},i))})]})}function Flt({report:e}){const{t}=ot(),n=e.full;if(!n)return null;const s=Object.entries(n.workspace).sort(([r],[i])=>r.localeCompare(i));return l.jsxs(l.Fragment,{children:[l.jsx(Jl,{title:t("daemon.full.sessions.title"),children:n.sessions.length===0?l.jsx("div",{className:an.empty,children:t("daemon.full.sessions.empty")}):n.sessions.map(r=>l.jsxs("div",{className:an.sessionRow,children:[l.jsx("div",{className:an.sessionName,children:r.displayName||r.sessionId}),l.jsxs("div",{className:an.sessionMeta,children:[l.jsx("span",{children:t("common.clients",{count:r.clientCount})}),l.jsx("span",{children:t("daemon.full.session.pendingPrompts",{count:r.pendingPromptCount})}),l.jsx("span",{children:t("daemon.full.session.pendingPermissions",{count:r.pendingPermissionCount})}),r.hasActivePrompt&&l.jsx("span",{className:an.activePrompt,children:t("daemon.full.session.prompting")})]})]},r.sessionId))}),l.jsx(Jl,{title:t("daemon.full.workspace.title"),children:s.length===0?l.jsx("div",{className:an.empty,children:t("daemon.full.workspace.empty")}):s.map(([r,i])=>l.jsx(zlt,{name:r,section:i},r))}),l.jsxs(Jl,{title:t("daemon.full.auth.title"),children:[l.jsx(cr,{label:t("daemon.full.auth.providers"),value:n.auth.supportedDeviceFlowProviders.join(", ")||t("daemon.none")}),l.jsx(cr,{label:t("daemon.full.auth.pending"),value:n.auth.pendingDeviceFlowCount}),l.jsx(cr,{label:t("daemon.full.acp.title"),value:n.acpConnections.length})]})]})}function Hlt({series:e}){const{t}=ot();if(e.length===0)return l.jsx(Jl,{title:t("daemon.charts.title"),children:l.jsx("div",{className:an.empty,children:t("daemon.charts.empty")})});const n=i=>e.map(i),s=e.map(i=>i.t),r=(i,o,a,c)=>l.jsx(Jl,{title:t(i),help:t(c),children:l.jsx(noe,{series:a,timestamps:s,format:o,ariaLabel:t(i),peakLabel:t("daemon.charts.peak")})});return l.jsxs("div",{className:`${an.grid} ${an.chartsGrid}`,children:[r("daemon.charts.concurrency",ay,[{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"),r("daemon.charts.requests",ay,[{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"),r("daemon.charts.apiLatency",mf,[{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"),r("daemon.charts.llmLatency",mf,[{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"),r("daemon.charts.apiHealth",ay,[{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"),r("daemon.charts.promptLatency",mf,[{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"),r("daemon.charts.eventLoop",mf,[{label:t("daemon.charts.eventLoopLag"),values:n(i=>i.eventLoopLagP99Ms),color:"var(--error-color)"}],"daemon.charts.eventLoop.help"),r("daemon.charts.cpu",Llt,[{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"),r("daemon.charts.memory",k4,[{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"),r("daemon.charts.pipe",k4,[{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"),r("daemon.charts.connections",ay,[{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"),r("daemon.charts.tokens",ay,[{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 qlt(){var S;const{t:e}=ot(),[t,n]=f.useState("overview"),s=f.useRef([]),r=(L,N)=>{var M;let $;if(L.key==="ArrowRight"||L.key==="ArrowDown")$=(N+1)%P0.length;else if(L.key==="ArrowLeft"||L.key==="ArrowUp")$=(N-1+P0.length)%P0.length;else if(L.key==="Home")$=0;else if(L.key==="End")$=P0.length-1;else return;L.preventDefault(),n(P0[$].id),(M=s.current[$])==null||M.focus()},i=G7({autoLoad:!0,detail:"summary"}),o=G7({autoLoad:!0,detail:"full"}),a=i.reload,c=o.reload,u=f.useRef(!1);f.useEffect(()=>{const L=window.setInterval(()=>{document.hidden||u.current||(u.current=!0,a().finally(()=>{u.current=!1}))},Dlt);return()=>window.clearInterval(L)},[a]);const d=f.useCallback(()=>{a(),c()},[a,c]),h=i.report??o.report,m=o.report,p=i.loading||o.loading,g=i.error??o.error;if(!h)return l.jsx("div",{className:an.dialog,children:l.jsx("div",{className:an.empty,children:g?`${e("daemon.loadFailed")}: ${g.message}`:e("daemon.loading")})});const b=m??h,{daemon:v,runtime:x,security:y,limits:w,capabilities:k}=h,T=x.transport.acp,_=Object.values(x.rateLimit.rejectedSinceStart).reduce((L,N)=>L+N,0),C=L=>L===null?e("daemon.limits.unlimited"):L;return l.jsxs("div",{className:an.dialog,children:[l.jsxs("div",{className:an.toolbar,children:[l.jsx("span",{role:"status","aria-label":`${e("daemon.title")}: ${e(`daemon.level.${b.status}`)}`,className:`${an.badge} ${T9(b.status)}`,children:e(`daemon.level.${b.status}`)}),l.jsx("span",{className:an.updatedAt,children:e("daemon.updatedAt",{time:new Date(h.generatedAt).toLocaleTimeString()})}),i.error&&i.report&&l.jsx("span",{className:an.refreshError,children:e("daemon.loadFailed")}),l.jsx("div",{className:an.toolbarActions,children:l.jsx("button",{type:"button",className:an.refreshButton,onClick:d,disabled:p,children:e("daemon.refresh")})})]}),b.issues.length>0&&l.jsx(Jl,{title:e("daemon.issues.title"),children:b.issues.map((L,N)=>l.jsxs("div",{className:an.issueRow,children:[l.jsx("span",{className:`${an.badge} ${L.severity==="error"?an.levelError:an.levelWarning}`,children:L.severity==="error"?e("daemon.level.error"):e("daemon.level.warning")}),l.jsx("span",{className:an.issueMessage,children:L.message})]},`${L.code}-${N}`))}),l.jsx("div",{className:an.tabs,role:"tablist","aria-label":e("daemon.title"),children:P0.map((L,N)=>l.jsx("button",{ref:$=>{s.current[N]=$},type:"button",role:"tab",id:`daemon-tab-${L.id}`,"aria-selected":L.id===t,"aria-controls":`daemon-tabpanel-${L.id}`,tabIndex:L.id===t?0:-1,className:`${an.tab} ${L.id===t?an.tabActive:""}`,onClick:()=>n(L.id),onKeyDown:$=>r($,N),children:e(L.labelKey)},L.id))}),t==="overview"&&l.jsxs("div",{role:"tabpanel",id:"daemon-tabpanel-overview","aria-labelledby":"daemon-tab-overview",tabIndex:0,className:an.grid,children:[l.jsxs(Jl,{title:e("daemon.overview.title"),children:[v.qwenCodeVersion&&l.jsx(cr,{label:e("daemon.overview.version"),value:v.qwenCodeVersion}),l.jsx(cr,{label:e("daemon.overview.pid"),value:v.pid}),l.jsx(cr,{label:e("daemon.overview.mode"),value:v.mode}),l.jsx(cr,{label:e("daemon.overview.uptime"),value:roe(v.uptimeMs)}),l.jsxs("div",{className:an.pathRow,children:[l.jsx("span",{className:an.rowLabel,children:e("daemon.overview.workspace")}),l.jsx("span",{className:an.pathValue,title:v.workspaceCwd,children:l.jsx("bdi",{children:v.workspaceCwd})})]})]}),l.jsxs(Jl,{title:e("daemon.runtime.title"),children:[x.error?l.jsxs("div",{className:an.workspaceError,children:[e("daemon.runtime.startFailed"),": ",x.error]}):x.loading?l.jsx("div",{className:an.empty,children:e("daemon.runtime.startingUp")}):null,l.jsx(cr,{label:e("daemon.runtime.activeSessions"),value:x.sessions.active}),x.activity&&l.jsxs(l.Fragment,{children:[l.jsx(cr,{label:e("daemon.runtime.activePrompts"),value:x.activity.activePrompts}),l.jsx(cr,{label:e("daemon.runtime.idle"),value:x.activity.idleSinceMs===null?e("daemon.runtime.noActivity"):mf(x.activity.idleSinceMs)})]}),l.jsx(cr,{label:e("daemon.runtime.pendingPermissions"),value:x.permissions.pending}),l.jsx(cr,{label:e("daemon.runtime.permissionPolicy"),value:x.permissions.policy}),l.jsx(cr,{label:e("daemon.runtime.channel"),value:x.channel.live?e("daemon.runtime.channelLive"):e("daemon.runtime.channelDown")}),x.channelWorker.enabled&&l.jsxs(l.Fragment,{children:[l.jsx(cr,{label:e("daemon.runtime.channelWorker"),value:Plt(x.channelWorker)}),x.channelWorker.error&&l.jsx("div",{className:an.workspaceError,children:x.channelWorker.error}),(x.channelWorker.restartCount??0)>0&&l.jsx(cr,{label:e("daemon.runtime.channelWorkerRestarts"),value:x.channelWorker.restartCount})]}),l.jsx(cr,{label:e("daemon.runtime.memory"),value:`${k4(x.process.rss)} / ${k4(x.process.heapUsed)}`})]}),l.jsxs(Jl,{title:e("daemon.transport.title"),children:[l.jsx(cr,{label:e("daemon.transport.restSse"),value:x.transport.restSseActive}),T.enabled?l.jsxs(l.Fragment,{children:[l.jsx(cr,{label:e("daemon.transport.acpConnections"),value:T.connections}),l.jsx(cr,{label:e("daemon.transport.acpStreams"),value:`${T.sessionStreams} / ${T.sseStreams} / ${T.wsStreams}`}),l.jsx(cr,{label:e("daemon.transport.pendingRequests"),value:T.pendingClientRequests})]}):l.jsx("div",{className:an.empty,children:e("daemon.transport.acpDisabled")}),l.jsx(cr,{label:e("daemon.transport.rateLimitRejected"),value:x.rateLimit.enabled?_:e("common.disabled")})]}),l.jsxs(Jl,{title:e("daemon.security.title"),children:[l.jsx(cr,{label:e("daemon.security.token"),value:y.tokenConfigured?e("daemon.security.configured"):e("daemon.security.notConfigured")}),l.jsx(cr,{label:e("daemon.security.requireAuth"),value:y.requireAuth?e("common.enabled"):e("common.disabled")}),l.jsx(cr,{label:e("daemon.security.loopback"),value:y.loopbackBind?e("common.enabled"):e("common.disabled")}),l.jsx(cr,{label:e("daemon.security.allowOrigin"),value:y.allowOriginMode}),l.jsx(cr,{label:e("daemon.security.shell"),value:y.sessionShellCommandEnabled?e("common.enabled"):e("common.disabled")})]}),l.jsxs(Jl,{title:e("daemon.limits.title"),children:[l.jsx(cr,{label:e("daemon.limits.maxSessions"),value:C(w.maxSessions)}),l.jsx(cr,{label:e("daemon.limits.maxPendingPrompts"),value:C(w.maxPendingPromptsPerSession)}),l.jsx(cr,{label:e("daemon.limits.maxConnections"),value:C(w.listenerMaxConnections)}),l.jsx(cr,{label:e("daemon.limits.eventRing"),value:w.eventRingSize}),l.jsx(cr,{label:e("daemon.limits.promptDeadline"),value:w.promptDeadlineMs===null?e("daemon.limits.unlimited"):mf(w.promptDeadlineMs)}),l.jsx(cr,{label:e("daemon.limits.sessionIdle"),value:mf(w.sessionIdleTimeoutMs)})]}),l.jsx(Jl,{title:k.features.length?e("daemon.capabilities.titleCount",{count:k.features.length}):e("daemon.capabilities.title"),children:k.features.length===0?l.jsx("span",{className:an.empty,children:e("daemon.none")}):l.jsx("div",{className:an.featureChips,children:[...k.features].sort().map(L=>l.jsx("span",{className:an.featureChip,children:L},L))})})]}),t==="usage"&&l.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-usage","aria-labelledby":"daemon-tab-usage",tabIndex:0,children:l.jsx(Jd,{label:"daemon-usage",fallback:l.jsx("div",{className:an.empty,children:e("daemon.usage.failed")}),children:l.jsx(Fat,{})})}),t==="metrics"&&l.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-metrics","aria-labelledby":"daemon-tab-metrics",tabIndex:0,children:l.jsx(Hlt,{series:((S=h.runtime.metrics)==null?void 0:S.series)??[]})}),t==="diagnostics"&&l.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-diagnostics","aria-labelledby":"daemon-tab-diagnostics",tabIndex:0,children:l.jsx(Jd,{label:"daemon-status-detail",fallback:l.jsx("div",{className:an.empty,children:e("daemon.details.failed")}),children:m!=null&&m.full?l.jsx(Flt,{report:m}):o.loading?l.jsx("div",{className:an.empty,children:e("daemon.details.loading")}):o.error?l.jsxs("div",{className:an.empty,children:[e("daemon.details.failed"),": ",o.error.message]}):l.jsx("div",{className:an.empty,children:e("daemon.details.failed")})})})]})}function Ult(){const{t:e}=ot();return l.jsx(Jd,{label:"daemon-status",fallback:t=>l.jsx("div",{className:an.dialog,children:l.jsxs("div",{className:an.empty,children:[e("daemon.loadFailed"),": ",t.message]})}),children:l.jsx(qlt,{})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const ioe="split",Af=6;function Vlt(e,t,n){const s=new URL(t);return s.pathname="/",s.searchParams.set(ioe,e.join(",")),n&&(s.hash=new URLSearchParams({token:n}).toString()),s.toString()}function Wlt(e){const t=new URLSearchParams(e).get(ioe);return t?t.split(",").map(n=>n.trim()).filter(Boolean):[]}const tR="qwen-webshell-split-sessions";function Glt(e){const t=Array.from(new Set(e.filter(Boolean))).slice(0,Af);try{sessionStorage.setItem(tR,JSON.stringify(t))}catch{}}function Klt(){try{const e=sessionStorage.getItem(tR);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?Array.from(new Set(t.filter(n=>typeof n=="string"&&n.length>0))).slice(0,Af):[]}catch{return[]}}function Ylt(){try{sessionStorage.removeItem(tR)}catch{}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function ooe(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function NC(e){var t;return((t=e.displayName)==null?void 0:t.trim())||ooe(e.cwd)}function jC(e,t){const n=t==null?void 0:t.find(s=>s.cwd===e);return n?NC(n):ooe(e)}function nR(e){var t;return(((t=e==null?void 0:e.workspaces)==null?void 0:t.length)??0)>1}function Xlt(e,t){return!!e&&!!t&&e!==t}function aoe(e,t){if(t.length===0)return e;const n=new Map;for(const s of e)n.set(s.sessionId,s);for(const s of t)n.has(s.sessionId)||n.set(s.sessionId,s);return[...n.values()]}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const h_=[];function loe(e=!0){var c;const t=ol(),n=t.client,s=e?(((c=t.capabilities)==null?void 0:c.workspaces)??[]).filter(u=>!u.primary&&u.trusted).map(u=>u.cwd).join(`
`):"",[r,i]=f.useState(h_),o=f.useCallback(async()=>{const u=s?s.split(`
`):[];if(u.length===0)return h_;const d=await Promise.allSettled(u.map(m=>n.listWorkspaceSessions(m,{pageSize:wd,archiveState:"active",sourceType:w4}))),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?h_:h},[n,s]),a=f.useCallback(async()=>{s&&i(await o())},[s,o]);return f.useEffect(()=>{if(!s){i(d=>d.length===0?d:h_);return}let u=!1;return o().then(d=>{u||i(d)}),()=>{u=!0}},[s,o]),{sessions:r,reload:a}}function Qlt(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search).get("daemon")||"";return e?rct(e):""}let Jm;const Jlt="qwen-daemon-auth",Zlt=2500,coe="qwen-daemon-token";function ect(){try{return window.sessionStorage.getItem(coe)||void 0}catch{return}}function tct(e){try{window.sessionStorage.setItem(coe,e)}catch{}}function uoe(){if(Jm)return Jm;if(typeof window>"u")return;const t=new URLSearchParams(window.location.hash.replace(/^#/,"")).get("token")||new URLSearchParams(window.location.search).get("token")||"";return t?(tct(t),Jm=t,Jm):(Jm=ect(),Jm)}function nct(e=Zlt){return typeof window>"u"||window.parent===window?Promise.resolve(void 0):new Promise(t=>{let n=!1;const s=o=>{n||(n=!0,window.removeEventListener("message",r),clearTimeout(i),Jm=o,t(o))},r=o=>{if(o.source!==window.parent||!o.origin.startsWith("chrome-extension://")&&!o.origin.startsWith("moz-extension://"))return;const a=o.data;if((a==null?void 0:a.type)!==Jlt)return;const c=typeof a.token=="string"?a.token:"";s(c.trim()||void 0)},i=setTimeout(()=>s(void 0),e);window.addEventListener("message",r)})}function sct(){if(typeof window>"u")return;const e=new URL(window.location.href);let t=!1;if(e.searchParams.has("token")&&(e.searchParams.delete("token"),t=!0),e.hash){const n=new URLSearchParams(e.hash.replace(/^#/,""));if(n.has("token")){n.delete("token");const s=n.toString();e.hash=s?`#${s}`:"",t=!0}}t&&window.history.replaceState(null,"",e)}function rct(e){try{const t=new URL(e,window.location.origin);if(!(t.protocol==="http:"||t.protocol==="https:"))return"";if(t.origin===window.location.origin)return t.origin;if(!(t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="::1"||t.hostname==="[::1]"))return"";const r=window.location.port||(window.location.protocol==="https:"?"443":"80");return(t.port||(t.protocol==="https:"?"443":"80"))!==r?"":t.origin}catch{return""}}const ict="_panel_1s6rs_1",oct="_toolbar_1s6rs_9",act="_count_1s6rs_16",lct="_selectAll_1s6rs_21",cct="_actionButton_1s6rs_30",uct="_refreshButton_1s6rs_50",dct="_notice_1s6rs_61",hct="_grid_1s6rs_71",fct="_card_1s6rs_80",mct="_cardCurrent_1s6rs_91",pct="_cardTop_1s6rs_96",gct="_cardCheckbox_1s6rs_103",bct="_colorDot_1s6rs_108",yct="_cardLabel_1s6rs_115",xct="_currentBadge_1s6rs_135",vct="_cardMeta_1s6rs_145",wct="_metaItem_1s6rs_153",kct="_statusBadge_1s6rs_162",_ct="_statusApproval_1s6rs_172",Sct="_statusRunning_1s6rs_181",Cct="_statusIdle_1s6rs_190",Tct="_workspaceBadge_1s6rs_202",Ect="_workspaceBadgeOther_1s6rs_218",Act="_empty_1s6rs_223",Nct="_colorRed_1s6rs_231",jct="_colorOrange_1s6rs_234",Mct="_colorYellow_1s6rs_237",Ict="_colorGreen_1s6rs_240",Rct="_colorBlue_1s6rs_243",Dct="_colorPurple_1s6rs_246",Es={panel:ict,toolbar:oct,count:act,selectAll:lct,actionButton:cct,refreshButton:uct,notice:dct,grid:hct,card:fct,cardCurrent:mct,cardTop:pct,cardCheckbox:gct,colorDot:bct,cardLabel:yct,currentBadge:xct,cardMeta:vct,metaItem:wct,statusBadge:kct,statusApproval:_ct,statusRunning:Sct,statusIdle:Cct,workspaceBadge:Tct,workspaceBadgeOther:Ect,empty:Act,colorRed:Nct,colorOrange:jct,colorYellow:Mct,colorGreen:Ict,colorBlue:Rct,colorPurple:Dct},Lct=3e3,Pct=1e4,lq={needsApproval:0,running:1,idle:2};function Oct(e,t,n,s){const r=new Map(t.map(o=>[o.sessionId,o])),i=e.map(o=>{var d,h;const a=r.get(o.sessionId),c=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":c?"running":"idle",clientCount:o.clientCount??(a==null?void 0:a.clientCount)??0,model:(h=a==null?void 0:a.currentModelId)!=null&&h.startsWith("qwen-route:")?void 0:a!=null&&a.currentModelId?uf(a.currentModelId):void 0,updatedAt:o.updatedAt||o.createdAt,color:o.color,isCurrent:o.sessionId===n,workspaceCwd:o.workspaceCwd,isNonPrimary:Xlt(o.workspaceCwd,s)}});return i.sort((o,a)=>{const c=lq[o.status]-lq[a.status];return c!==0?c:(a.updatedAt??"").localeCompare(o.updatedAt??"")}),i}function f_(...e){return e.filter(Boolean).join(" ")}function Bct(e){switch(e){case"red":return Es.colorRed;case"orange":return Es.colorOrange;case"yellow":return Es.colorYellow;case"green":return Es.colorGreen;case"blue":return Es.colorBlue;case"purple":return Es.colorPurple;default:return}}function cq(e){switch(e){case"needsApproval":return Es.statusApproval;case"running":return Es.statusRunning;default:return Es.statusIdle}}function $ct({onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n,workspaceCwd:s}){var I,Y,V;const{t:r}=ot(),i=Dl(),o=i.sessionId,a=((Y=(I=i.capabilities)==null?void 0:I.features)==null?void 0:Y.includes(eR))??!1,{sessions:c,loading:u,error:d,reload:h}=rw(s,{autoLoad:!0,pageSize:wd,archiveState:"active",...a?{view:"organized",group:"all"}:{}}),{sessions:m,reload:p}=loe(n&&!s),g=f.useMemo(()=>aoe(c,m),[c,m]),b=!s&&n&&nR(i.capabilities),v=G7({autoLoad:!0,detail:"full"}),x=v.reload,y=v.report,[w,k]=f.useState(()=>new Set),[T,_]=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}))},Lct);return()=>window.clearInterval(j)},[h,p]);const S=f.useRef(!1);f.useEffect(()=>{const j=window.setInterval(()=>{document.hidden||S.current||(S.current=!0,x().finally(()=>{S.current=!1}))},Pct);return()=>window.clearInterval(j)},[x]);const L=(V=i.capabilities)==null?void 0:V.workspaceCwd,N=f.useMemo(()=>{var j;return Oct(g,((j=y==null?void 0:y.full)==null?void 0:j.sessions)??[],o,L)},[g,y,o,L]),$=f.useCallback(j=>{k(ee=>{const se=new Set(ee);return se.has(j)?se.delete(j):se.add(j),se})},[]),M=N.map(j=>j.sessionId).filter(j=>w.has(j)),P=M.length,E=N.length>0&&P===N.length,O=M.slice(0,Af),z=P>Af,F=f.useCallback(()=>{k(j=>{const ee=N.map(X=>X.sessionId);return ee.length>0&&ee.every(X=>j.has(X))?new Set:new Set(ee)})},[N]);f.useEffect(()=>{k(j=>{if(j.size===0)return j;const ee=new Set(N.map(Q=>Q.sessionId));let se=!1;const X=new Set;for(const Q of j)ee.has(Q)?X.add(Q):se=!0;return se?X:j})},[N]);const B=f.useCallback(()=>{if(O.length===0)return;const j=Vlt(O,window.location.href,uoe()),ee=window.open(j,"_blank");ee&&(ee.opener=null,ee.focus()),_(!ee)},[O]),W=f.useCallback(()=>{h(),p(),x()},[h,p,x]);return N.length===0?l.jsx("div",{className:Es.panel,children:l.jsx("div",{className:Es.empty,children:u?r("sessionsOverview.loading"):d?`${r("sessionsOverview.loadFailed")}: ${d.message}`:r("sessionsOverview.empty")})}):l.jsxs("div",{className:Es.panel,children:[l.jsxs("div",{className:Es.toolbar,children:[l.jsx("span",{className:Es.count,children:r("sessionsOverview.count",{count:N.length})}),l.jsxs("label",{className:Es.selectAll,children:[l.jsx("input",{type:"checkbox",checked:E,onChange:F}),r("sessionsOverview.selectAll")]}),l.jsx("button",{type:"button",className:Es.actionButton,disabled:P===0,onClick:B,title:r("sessionsOverview.openInTabHint"),children:r("sessionsOverview.openInTab")}),t&&l.jsx("button",{type:"button",className:Es.actionButton,disabled:P===0,onClick:()=>t(O),title:r("sessionsOverview.openInSplitHint"),children:r("sessionsOverview.openInSplit")}),l.jsx("button",{type:"button",className:Es.refreshButton,onClick:W,children:r("sessionsOverview.refresh")})]}),z&&l.jsx("div",{className:Es.notice,role:"status",children:r("sessionsOverview.splitCap",{max:Af})}),T&&l.jsx("div",{className:Es.notice,role:"alert",children:r("sessionsOverview.popupBlocked")}),d&&l.jsxs("div",{className:Es.notice,role:"alert",children:[r("sessionsOverview.loadFailed"),": ",d.message]}),l.jsx("ul",{className:Es.grid,children:N.map(j=>{var ee;return l.jsxs("li",{className:f_(Es.card,cq(j.status),j.isCurrent&&Es.cardCurrent),children:[l.jsxs("div",{className:Es.cardTop,children:[l.jsx("input",{type:"checkbox",className:Es.cardCheckbox,checked:w.has(j.sessionId),onChange:()=>$(j.sessionId),"aria-label":r("sessionsOverview.selectSession",{name:j.label})}),j.color&&l.jsx("span",{className:f_(Es.colorDot,Bct(j.color)),"aria-hidden":"true"}),l.jsx("button",{type:"button",className:Es.cardLabel,onClick:()=>e(j.sessionId),title:j.label,children:j.label}),j.isCurrent&&l.jsx("span",{className:Es.currentBadge,children:r("sessionsOverview.current")})]}),l.jsxs("div",{className:Es.cardMeta,children:[l.jsx("span",{className:f_(Es.statusBadge,cq(j.status)),children:r(`sessionsOverview.status.${j.status}`)}),b&&l.jsx("span",{className:f_(Es.workspaceBadge,j.isNonPrimary&&Es.workspaceBadgeOther),title:j.workspaceCwd,children:jC(j.workspaceCwd,(ee=i.capabilities)==null?void 0:ee.workspaces)}),j.model&&l.jsx("span",{className:Es.metaItem,title:j.model,children:j.model}),j.clientCount>0&&l.jsx("span",{className:Es.metaItem,title:r("sessionsOverview.openElsewhere"),children:r("common.clients",{count:j.clientCount})}),j.updatedAt&&l.jsx("span",{className:Es.metaItem,children:v4(j.updatedAt,r)})]})]},j.sessionId)})})]})}function zct({onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n=!0,workspaceCwd:s}){const{t:r}=ot();return l.jsx(Jd,{label:"session-overview",fallback:i=>l.jsx("div",{className:Es.panel,children:l.jsxs("div",{className:Es.empty,children:[r("sessionsOverview.loadFailed"),": ",i.message]})}),children:l.jsx($ct,{onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n,workspaceCwd:s})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Fct(e){return e.startsWith("language_changed (unrecognized daemon event):")||e.startsWith("session_cwd_changed (unrecognized daemon event):")||e.startsWith("Model switched: ")}function Hct(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 qct(e,t){return e===void 0?{}:t?{data:{...sa(e)??{value:e},errorKind:t}}:{data:e}}function Uct(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 Vct(e){if(!e||typeof e!="object")return null;const t=e.messages;return Array.isArray(t)&&t.filter(s=>typeof s=="string").join(`
`).trim()||null}function Wct(e){const n=e.meta;return(n==null?void 0:n.source)==="background_notification"&&n.qwenDiscreteMessage===!0&&n.backgroundTask!==void 0}function Gct(e){return Wct(e)||!e.text&&!e.usage?null:e}function uq(e){return e.text.length===0}function Kct(e){const t=e.flatMap((n,s)=>{const r=sa(n),i=ka(r,"content");return i?[{id:ka(r,"id")??`plan-${s}`,content:i,status:eut(ka(r,"status")),...(()=>{const a=tut(ka(r,"priority"));return a?{priority:a}:{}})()}]:[]});return t.length>0?t:void 0}function dq(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 Yct(e,t={}){var u,d,h;const n=[],s=((u=t.labels)==null?void 0:u.promptCancelled)??"Request cancelled.",r=new Map,i=new Map;let o=null,a=null,c=!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,c=!1;const b=p,v=sa(b.meta),x=ka(v,"source"),y=Array.isArray(v==null?void 0:v.inputAnnotations)?v.inputAnnotations:void 0,w={id:p.id,role:"user",content:b.text,timestamp:g,...x?{source:x}:{},...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=Gct(p);if(!b)break;const v=b.parentToolCallId?r.get(b.parentToolCallId):void 0;if(v){hq(v,b.text);break}const x=mut(b.text);if(x){let w=null,k=!1,T=0,_=0;for(const C of x)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-${_++}`,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}),c=!0;break}const y=o!==null?n[o]:void 0;if(y&&y.role==="assistant"&&!c&&!uq(b)){const w=dq(y.usage,b.usage);n[o]={...y,content:y.content+b.text,isStreaming:b.streaming,...w?{usage:w}:{}},c=!1,a=null}else if(!uq(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,c=!1;else if(b.usage&&y&&y.role==="assistant"){const w=dq(y.usage,b.usage);n[o]={...y,...w?{usage:w}:{}}}break}case"thought":{const b=p,v=b.parentToolCallId?r.get(b.parentToolCallId):void 0;if(v){hq(v,b.text);break}const x=a!==null?n[a]:void 0;x&&x.role==="thinking"&&!c?(n[a]={...x,content:x.content+b.text,isStreaming:b.streaming},c=!1):(n.push({id:p.id,role:"thinking",content:b.text,isStreaming:b.streaming,timestamp:g}),a=n.length-1,c=!1),o=null;break}case"tool":{const v=nut(p),x=i.get(v.callId);x!=null&&x.title&&(v.title=x.title),!v.args&&(x!=null&&x.args)&&(v.args=x.args);const y=v.parentToolCallId?r.get(v.parentToolCallId):void 0,w=r.get(v.callId);if(w){fq(w,v);break}if(y){Xct(y,v),r.set(v.callId,v);break}b8(n,p.id,v,g),r.set(v.callId,v),o=null,a=null,c=!0;break}case"shell":{const b=p,v=n[n.length-1];if(v&&v.role==="tool_group"){const x=Qct(v.tools),y=v.tools[x];if(y){const w=typeof y.rawOutput=="string"?y.rawOutput:"",k={...y,rawOutput:w+b.text};n[n.length-1]={...v,tools:[...v.tools.slice(0,x),k,...v.tools.slice(x+1)]},r.get(y.callId)===y&&r.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}),c=!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}),c=!0;break}case"permission":{const b=p;rut(b,i);const v=sut(b);if(!v)break;const x=doe(v);if(!b.resolved)break;const y=r.get(v.callId);if(y){const w=y.status;v.toolName=y.toolName,b.resolved&&(y8(b.resolved)?v.status=x?v.status:"in_progress":(v.status="failed",v.endTime=b.updatedAt)),fq(y,v),b.resolved&&x&&y8(b.resolved)&&(y.status=w);break}if(b.resolved){y8(b.resolved)?(x||(v.status="in_progress"),b8(n,p.id,v,g),r.set(v.callId,v),c=!0):(v.status="failed",v.endTime=b.updatedAt,b8(n,p.id,v,g),r.set(v.callId,v),c=!0);break}break}case"status":case"debug":{const b=p,v=b.source==="session_branched"?Uct(b.data):null,x=b.source==="mid_turn_message_injected"?Vct(b.data):null,y=v&&((d=t.labels)!=null&&d.branchSuccess)?t.labels.branchSuccess(v):x&&((h=t.labels)!=null&&h.midTurnInserted)?t.labels.midTurnInserted(x):b.text;if(Fct(y))break;const w=Zct(y);if(w){n.push({id:p.id,role:"plan",todos:w,timestamp:g}),c=!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}:{}}),c=!0;break}case"error":{const b=p,v=b.errorKind;n.push({id:p.id,role:"system",content:Hct(b,t.labels),variant:"error",retryable:b.source==="turn_error",timestamp:g,...b.source?{source:b.source}:{},...qct(b.data,v)}),c=!0;break}case"prompt_cancelled":n.push({id:p.id,role:"system",content:s,variant:"info",source:"prompt_cancelled",timestamp:g}),c=!0;break}}return n}function Xct(e,t){e.subTools||(e.subTools=[]),e.subTools.push(t)}function hq(e,t){e.subContent=(e.subContent||"")+t}function b8(e,t,n,s){const r=o=>doe(o)||mh(o.toolName),i=e[e.length-1];if(i&&i.role==="tool_group"&&i.id.startsWith("tg-")&&!r(n)&&!i.tools.some(r)){i.tools.push(n);return}e.push({id:`tg-${t}`,role:"tool_group",tools:[n],timestamp:s})}function Qct(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 fq(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 doe(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||Jct(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function Jct(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function Zct(e){const t=e.startsWith("plan: ")?e.slice(6):void 0;if(t)try{const n=JSON.parse(t),s=sa(n);return(s==null?void 0:s.sessionUpdate)!=="plan"||!Array.isArray(s.entries)?void 0:Kct(s.entries)}catch{return}}function sa(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function ka(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function eut(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function tut(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function nut(e){const t=out(e),n=iut(e,t),s=aut(e.content),r={running:"in_progress",pending:"pending",confirming:"pending",background:"pending",completed:"completed",failed:"failed",cancelled:"completed",canceled:"completed",in_progress:"in_progress"},i=e.status==="completed"||e.status==="failed"||e.status==="cancelled"||e.status==="canceled";return{callId:e.toolCallId,toolName:e.toolName||"unknown",title:e.title,status:(n?"pending":r[e.status])||e.status||"in_progress",kind:foe(e.toolName,e.toolKind),rawOutput:t,args:e.rawInput,parentToolCallId:e.parentToolCallId,startTime:e.createdAt,endTime:i&&!n?e.updatedAt:void 0,...s?{content:s}:{}}}function sut(e){const t=sa(e.toolCall);if(!t)return;const n=hoe(t);if(Array.isArray(n==null?void 0:n.questions))return;const s=sa(t._meta),r=ka(t,"kind"),i=ka(s,"toolName")??ka(t,"toolName")??ka(t,"name")??(n!=null&&n.subagent_type?"agent":void 0)??(r==="fetch"?"web_fetch":r),o=ka(t,"toolCallId")??ka(t,"id");return!o||!i?void 0:{callId:o,toolName:i,title:ka(t,"title")??e.title,status:"pending",kind:foe(i,r),args:n,startTime:e.createdAt}}function rut(e,t){const n=sa(e.toolCall),s=ka(n,"toolCallId")??ka(n,"id");if(!s)return;const r=ka(n,"title")??e.title,i=n?hoe(n):void 0;Array.isArray(i==null?void 0:i.questions)&&t.set(s,{...r?{title:r}:{},...i?{args:i}:{}})}function y8(e){const[t="",n=""]=e.toLowerCase().split(":",2);return mq(t)?!0:t!=="selected"?!1:mq(n.trim())}function mq(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 hoe(e){return sa(e.rawInput)??sa(e.input)??sa(e.args)}function iut(e,t){var r;const n=(r=e.toolName)==null?void 0:r.toLowerCase();if(n!=="agent"&&n!=="task")return!1;const s=sa(t);return(s==null?void 0:s.status)==="background"}function out(e){return lut(e)&&e.status==="failed"?cut(e)??e.details??e.rawOutput:!uut(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 aut(e){if(!Array.isArray(e))return;const t=e.flatMap(n=>{const s=sa(n);if(!s)return[];const r=s.type;if(r==="content"){const i=sa(s.content);return!i||typeof i.type!="string"?[]:[{type:"content",content:{...i,type:i.type}}]}if(r==="diff"){const i=s.newText;if(typeof i!="string")return[];const o=s.path,a=s.oldText;return[{type:"diff",...typeof o=="string"?{path:o}:{},...typeof a=="string"?{oldText:a}:{},newText:i}]}if(r==="terminal"){const i=s.terminalId;return[{type:"terminal",...typeof i=="string"?{terminalId:i}:{}}]}return[]});return t.length>0?t:void 0}function lut(e){if(!e.toolName)return!1;const t=e.toolName.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function cut(e){if(!Array.isArray(e.content))return;const t=e.content.map(n=>{var s;return(s=n==null?void 0:n.content)==null?void 0:s.text}).filter(n=>!!n);if(!(!t||t.length===0))return t.join(`
`)}function uut(e){return e==="cancelled"||e==="canceled"}const dut=['"insight_progress":','"insight_ready":','"insight_error":'];function hut(e){try{const t=JSON.parse(e),n=sa(t.insight_progress);if(n&&typeof n.stage=="string"&&typeof n.progress=="number")return{type:"insight_progress",stage:n.stage,progress:n.progress,detail:typeof n.detail=="string"?n.detail:void 0};const s=sa(t.insight_ready);if(s&&typeof s.path=="string")return{type:"insight_ready",path:s.path};const r=sa(t.insight_error);if(r&&typeof r.error=="string")return{type:"insight_error",error:r.error}}catch{}return null}function fut(e,t){if(e[t]!=="{")return null;let n=0,s=!1,r=!1;for(let i=t;i<e.length;i++){const o=e[i];if(r){r=!1;continue}if(o==="\\"&&s){r=!0;continue}if(o==='"'){s=!s;continue}if(!s){if(o==="{")n++;else if(o==="}"&&(n--,n===0))return e.slice(t,i+1)}}return null}function mut(e){const t=[];let n=0,s=0,r=!1;for(;s<e.length;){const o=e.indexOf("{",s);if(o===-1)break;const a=e.slice(o+1).trimStart();if(!dut.some(m=>a.startsWith(m))){s=o+1;continue}const u=fut(e,o);if(!u){s=o+1;continue}const d=hut(u);if(!d){s=o+1;continue}r=!0;const h=e.slice(n,o).trim();h&&t.push({kind:"text",text:h}),t.push({kind:"insight",data:d}),n=o+u.length,s=n}if(!r)return null;const i=e.slice(n).trim();return i&&t.push({kind:"text",text:i}),t.length>0?t:null}function foe(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 put(e,t){return Yct(e,{labels:{promptCancelled:t("request.cancelled"),branchSuccess:n=>t("branch.success",{name:n}),midTurnInserted:n=>t("midTurn.inserted",{message:n}),modelStreamInterrupted:t("error.modelStreamInterrupted")}})}function moe(e){const t=jv();return f.useMemo(()=>put(t,e),[t,e])}const gut="session_artifacts";function poe(){var T,_;const e=B1(),t=Dl(),n=JG(),s=qu(),r=s==null?void 0:s.artifactsVersion,i=t.status==="connected",o=((_=(T=t.capabilities)==null?void 0:T.features)==null?void 0:_.includes(gut))??!1,a=t.sessionId,[c,u]=f.useState([]),[d,h]=f.useState(!1),[m,p]=f.useState(null),g=f.useRef(0),b=f.useRef(void 0),v=f.useRef(n),x=f.useRef(r),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 S=await e.loadArtifacts();if(g.current!==C)return;b.current=a,u(S.artifacts),p(null)}catch(S){if(g.current!==C)return;if(but(S)){p(null);return}p(S instanceof Error?S.message:String(S))}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=v.current;v.current=n,C!=="idle"&&n==="idle"&&w.current()},[n]),f.useEffect(()=>{const C=x.current;x.current=r,C!==void 0&&r!==void 0&&r!==C&&w.current()},[r]);const k=f.useMemo(()=>new Map(c.map(C=>[C.id,C])),[c]);return{artifacts:c,artifactById:k,loading:d,error:m,refresh:y}}function but(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 yut(e,t,n,s){const r=[...e];let i=!1;for(const o of t)if(o.sessionId===n&&!(o.originatorClientId!==void 0&&o.originatorClientId!==s))for(const a of o.messages){const c=r.findIndex(u=>u.text===a&&(!u.images||u.images.length===0));c>=0&&(r.splice(c,1),i=!0)}return i?r:null}function xut(e,t,n,s){return e?!0:(s.append(t),!1)}function goe(e){const t=e.trimStart();return t.startsWith("/")||t.startsWith("!")}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const vut=100;function wut(e,t){return e.trim()?e===t||e.startsWith(`${t}
`)?e:`${t}
${e}`:t}function pq(e,t){return e.length!==t.length?!1:e.every((n,s)=>{var i,o,a,c;const r=t[s];return r!==void 0&&n.id===r.id&&n.sessionId===r.sessionId&&n.text===r.text&&n.serverPromptId===r.serverPromptId&&n.serverState===r.serverState&&n.isEditing===r.isEditing&&n.isRemoving===r.isRemoving&&(((i=n.images)==null?void 0:i.length)??0)===(((o=r.images)==null?void 0:o.length)??0)&&(((a=n.inputAnnotations)==null?void 0:a.length)??0)===(((c=r.inputAnnotations)==null?void 0:c.length)??0)})}function gq(e){if(!(!e||e.length===0))return e.map(t=>({data:t.data,mimeType:t.media_type||"image/*"}))}function boe({connected:e,sessionId:t,clientId:n,streamingState:s,sessionActions:r,store:i,editorRef:o,reportError:a,notifySuccess:c,t:u}){const[d,h]=f.useState([]),m=f.useRef([]),p=f.useRef(1),g=f.useRef(t),b=f.useRef(null),v=f.useRef(new Set),x=f.useRef(new Set),y=f.useRef(new Set),w=f.useRef(new Map),k=f.useRef(new Set),T=f.useRef([]),_=f.useRef(s),C=f.useRef(0);g.current=t,_.current=s;const S=f.useMemo(()=>d.map(re=>re.text),[d]);f.useEffect(()=>{m.current=d},[d]),f.useEffect(()=>{var re;m.current=[],h([]),w.current.clear(),k.current.clear(),T.current=[];for(const J of v.current)J.abort();v.current.clear(),x.current.clear(),y.current.clear(),O.current=void 0,(re=b.current)==null||re.abort(),b.current=null},[t]);const L=f.useCallback((re,J)=>{const q=m.current.filter(Z=>Z.serverPromptId?re.some(he=>he.promptId===Z.serverPromptId):!0);for(const Z of re){if(x.current.has(Z.promptId))continue;const he=q.findIndex(we=>we.serverPromptId===Z.promptId),ye=y.current.has(Z.promptId);if(he!==-1){if(ye){q.splice(he,1);continue}q[he]={...q[he],text:Z.text,serverState:Z.state};continue}const oe=q.filter(we=>!we.serverPromptId&&we.serverState==="submitting"&&we.text===Z.text);if(oe.length===1){const we=q.indexOf(oe[0]);if(ye){q.splice(we,1);continue}q[we]={...oe[0],serverPromptId:Z.promptId,serverState:Z.state};continue}Z.state==="running"||ye||q.push({id:p.current++,sessionId:J,text:Z.text,serverPromptId:Z.promptId,serverState:Z.state})}pq(m.current,q)||(m.current=q,h(q))},[]),N=f.useCallback(async(re=t)=>{if(!e||!re||g.current!==re)return"skipped";const J=++C.current;try{const q=await r.getPendingPrompts({sessionId:re});return J!==C.current?"superseded":g.current!==re?"skipped":(L(q.pendingPrompts.filter(Z=>Z.state==="queued"||Z.state==="running"),re),"refreshed")}catch(q){return console.warn("Failed to refresh pending prompts",q),"failed"}},[e,r,t,L]),$=f.useCallback(re=>{const J=g.current,q=re.filter(oe=>oe.sessionId===void 0||oe.sessionId===J);if(q.length===0)return;const Z=new Set(m.current.map(oe=>oe.id)),he=q.filter(oe=>!Z.has(oe.id));if(he.length===0)return;const ye=[...m.current,...he].sort((oe,we)=>oe.id-we.id);m.current=ye,h(ye)},[]),M=f.useCallback((re,J,q)=>{var ye,oe,we,Ve;if(q!==void 0&&g.current!==q)return;const Z=((ye=o.current)==null?void 0:ye.getText())??"",he=wut(Z,re);he!==Z&&((oe=o.current)==null||oe.setText(he),J&&J.length>0&&((we=o.current)==null||we.restoreImages(J))),(Ve=o.current)==null||Ve.focus()},[o]),P=f.useSyncExternalStore(ome,ime),E=f.useRef(P),O=f.useRef(void 0);f.useEffect(()=>{if(!e||!t)return;const re=E.current!==P;if(E.current=P,!re){if(m.current.length>0||s==="idle"||O.current===t)return;O.current=t}N()},[P,e,t,s,N]);const z=f.useSyncExternalStore(ame,jP,jP);f.useEffect(()=>{var J;if(!t||z.length===0)return;const re=[];for(const q of z){if(q.data.sessionId!==t)continue;re.push(q);const Z=q.data.promptId;if(Z){if(q.type==="pending_prompt_started"){if(x.current.has(Z))continue;if((q.originatorClientId===void 0||q.originatorClientId===n)&&!y.current.has(Z)){const ye=typeof q.data.text=="string"?q.data.text:"",oe=m.current.find(Ve=>Ve.serverPromptId===Z)??m.current.find(Ve=>!Ve.serverPromptId&&Ve.serverState==="submitting"&&Ve.text===ye),we=(oe==null?void 0:oe.text)??"";we&&(y.current.add(Z),i.appendLocalUserMessage(we,gq(oe==null?void 0:oe.images),(J=oe==null?void 0:oe.inputAnnotations)!=null&&J.length?{inputAnnotations:oe.inputAnnotations}:void 0))}N()}else if(q.type==="turn_complete"){y.current.delete(Z);const he=w.current.get(Z);if(w.current.delete(Z),he)he();else if(!k.current.has(Z))for(k.current.add(Z),T.current.push(Z);T.current.length>vut;){const ye=T.current.shift();ye&&k.current.delete(ye)}}else if(q.type==="turn_error"||q.type==="pending_prompt_completed"&&q.data.state==="removed"){y.current.delete(Z);const he=w.current.get(Z);w.current.delete(Z),he==null||he(),k.current.delete(Z),T.current=T.current.filter(ye=>ye!==Z)}}}cme(re)},[z,t,n,i,N]);const F=f.useCallback((re,J)=>{if(k.current.delete(re)){T.current=T.current.filter(q=>q!==re),J();return}w.current.set(re,J)},[]),B=f.useCallback((re,J,q,Z)=>{const he=re.trim();if(!he)return!0;const ye=p.current++,oe=g.current,we=new AbortController;v.current.add(we);const Ve=J?[...J]:void 0,lt=Z?[...Z]:void 0,Et={id:ye,sessionId:oe,text:he,images:Ve,inputAnnotations:lt,onComplete:q,serverState:"submitting"};return m.current=[...m.current,Et],h(m.current),r.submitPrompt(he,{images:J,inputAnnotations:lt,optimisticUserMessage:!1,sessionId:oe,signal:we.signal}).then(pt=>{if(v.current.delete(we),g.current!==oe){r.removePendingPrompt(pt.promptId,{sessionId:oe}).catch(Ne=>{console.warn("[useQueuedPrompts] cleanup removePendingPrompt failed after session change",{targetSessionId:oe,promptId:pt.promptId,error:Ne})});return}if(_.current==="idle"){y.current.has(pt.promptId)||(y.current.add(pt.promptId),i.appendLocalUserMessage(he,gq(Ve),lt!=null&&lt.length?{inputAnnotations:lt}:void 0));const Ne=m.current.filter(tt=>tt.id!==ye);m.current=Ne,h(Ne),q&&F(pt.promptId,q);return}const je=m.current,Ae=je.findIndex(Ne=>Ne.id===ye);if(Ae===-1){r.removePendingPrompt(pt.promptId,{sessionId:oe}).then(Ne=>{Ne.removed||N(oe)},()=>{N(oe)});return}const De=[...je];De[Ae]={...De[Ae],serverPromptId:pt.promptId,serverState:"queued"},m.current=De,h(De),q&&F(pt.promptId,q)}).catch(pt=>{if(v.current.delete(we),g.current!==oe||!m.current.some(Ae=>Ae.id===ye))return;const je=m.current.filter(Ae=>Ae.id!==ye);m.current=je,h(je),M(he,Ve,oe),a(pt,u("queue.queueFailed"))}),!0},[N,a,M,r,F,i,u]);f.useEffect(()=>{if(s!=="idle")return;const re=b.current;re&&(re.abort(),b.current=null)},[s]);const W=f.useCallback(re=>{const J=m.current;if(J.length===0)return null;const q=re===void 0?J.length-1:J.findIndex(ye=>ye.id===re);if(q<0)return null;const Z=J[q],he=J.filter((ye,oe)=>oe!==q);return m.current=he,h(he),(Z==null?void 0:Z.text)??null},[]),I=f.useCallback((re,J)=>{const q=m.current.map(Z=>Z.id===re?{...Z,...J}:Z);pq(q,m.current)||(m.current=q,h(q))},[]),Y=f.useCallback(async(re,J,q)=>{if(!re.serverPromptId)return!0;if(re.serverState!=="queued"||x.current.has(re.serverPromptId))return!1;const Z=re.sessionId;x.current.add(re.serverPromptId),I(re.id,J);try{const he=await r.removePendingPrompt(re.serverPromptId,{sessionId:Z});return x.current.delete(re.serverPromptId),he.removed?(w.current.delete(re.serverPromptId),await N(Z)==="failed"&&(I(re.id,{isEditing:!1,isRemoving:!1}),a(new Error("Queue changed but pending prompts could not refresh"),q)),!0):(I(re.id,{isEditing:!1,isRemoving:!1}),await N(Z),a(new Error("Prompt could not be removed from queue"),q),!1)}catch(he){return x.current.delete(re.serverPromptId),I(re.id,{isEditing:!1,isRemoving:!1}),await N(Z)!=="refreshed"&&$([re]),a(he,q),!1}},[N,a,$,r,I]),V=f.useCallback(re=>{const J=m.current.find(q=>q.id===re);if((J==null?void 0:J.serverState)!=="submitting"&&J){if(!J.serverPromptId){const q=m.current.filter(Z=>Z.id!==re);m.current=q,h(q);return}Y(J,{isRemoving:!0},u("queue.deleteFailed"))}},[Y,u]),j=f.useCallback(async re=>{var oe;const J=m.current.find(we=>we.id===re);if(!J||(((oe=J.images)==null?void 0:oe.length)??0)>0||J.serverState==="submitting"||J.isEditing||J.isRemoving||goe(J.text))return;const q=J.serverPromptId?J.onComplete??w.current.get(J.serverPromptId):void 0,Z=()=>{J.serverPromptId&&w.current.delete(J.serverPromptId),q==null||q()};if(J.serverPromptId&&!await Y(J,{isRemoving:!0},u("queue.insertFailed")))return;let he=b.current;he||(he=new AbortController,b.current=he);let ye;try{ye=await r.enqueueMidTurnMessage(J.text,{signal:he.signal})}catch(we){J.serverPromptId&&(M(J.text,J.images,J.sessionId),Z()),a(we,u("queue.insertFailed"));return}if(!ye.accepted){J.serverPromptId&&(M(J.text,J.images,J.sessionId),Z()),a(new Error("Queued message was not accepted for insertion"),u("queue.insertFailed"));return}if(Z(),!J.serverPromptId){const we=m.current.filter(Ve=>Ve.id!==re);m.current=we,h(we)}c(u("queue.inserted"))},[Y,c,a,M,r,u]),ee=f.useCallback(async re=>{const J=m.current.find(Z=>Z.id===re);if(!J||J.serverState==="submitting"||J.isEditing||J.isRemoving)return;if(J.serverPromptId){if(!await Y(J,{isEditing:!0},u("queue.editFailed")))return;M(J.text,J.images,J.sessionId);return}const q=W(re);q&&M(q,J.images,J.sessionId)},[W,Y,M,u]),se=f.useCallback(()=>{const re=m.current;if(re.length===0)return!1;const J=re[re.length-1];if(!J)return!1;if(J.serverState==="submitting"||J.isEditing||J.isRemoving)return!0;if(!J.serverPromptId){const q=W(J.id);return q?(M(q,J.images,J.sessionId),!0):!1}return J.serverState!=="queued"?!1:((async()=>{await Y(J,{isEditing:!0},u("queue.editFailed"))&&M(J.text,J.images,J.sessionId)})().catch(q=>{a(q,u("queue.editFailed"))}),!0)},[W,Y,a,M,u]),X=f.useCallback(()=>{if(m.current.length===0)return!1;const re=g.current,J=m.current.filter(we=>we.serverState==="submitting"),q=m.current.filter(we=>we.serverState!=="submitting");for(const we of[...J].reverse())M(we.text,we.images,we.sessionId);for(const we of v.current)we.abort();const Z=q.filter(we=>we.serverPromptId);if(Z.length===0)return m.current=[],h([]),i.dispatch([{type:"status",text:u("queue.cleared")}]),!0;const he=new Set(m.current.map(we=>we.id)),ye=new Set(Z.map(we=>we.serverPromptId).filter(we=>!!we));for(const we of ye)x.current.add(we);const oe=m.current.filter(we=>!he.has(we.id)).concat(Z.map(we=>({...we,isRemoving:!0})));return m.current=oe,h(oe),(async()=>{var Et;const we=[];if(await Promise.all(Z.map(async pt=>{const je=pt.serverPromptId;try{if((await r.removePendingPrompt(je,{sessionId:pt.sessionId})).removed){w.current.delete(je);return}we.push(pt)}catch{we.push(pt)}finally{x.current.delete(je)}})),g.current!==re)return;const Ve=we.map(pt=>({...pt,isRemoving:!1})),lt=m.current.filter(pt=>pt.serverPromptId?!ye.has(pt.serverPromptId):!he.has(pt.id)).concat(Ve);if(m.current=lt,h(lt),we.length>0){a(new Error("Some prompts could not be removed from queue"),u("queue.deleteFailed")),N((Et=we[0])==null?void 0:Et.sessionId);return}i.dispatch([{type:"status",text:u("queue.cleared")}])})(),!0},[N,a,M,i,u,r]),{batches:Q,consume:ue}=Fme();return f.useEffect(()=>{if(!t||Q.length===0)return;const re=yut(m.current,Q,t,n);re&&(m.current=re,h(re)),ue(Q.filter(J=>J.sessionId===t))},[Q,t,n,ue]),{queuedPrompts:d,queuedTexts:S,enqueuePrompt:B,removeQueuedPrompt:V,insertQueuedPrompt:j,editQueuedPrompt:ee,editLastQueuedPrompt:se,clearQueuedPrompts:X}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function E9(e){var t;return!((t=e==null?void 0:e.rawInput)!=null&&t.questions)||!Array.isArray(e.rawInput.questions)?!1:e.toolName?qc(e.toolName):!0}const kut=3e4;function _4(e){return W4.includes(e)}async function _ut({sessionActions:e,modelId:t,modeId:n,workspaceCwd:s,worktree:r,onSessionCreated:i,onSessionAllocated:o,getCurrentSessionId:a,warn:c=console.warn}){const u=n&&_4(n)?n:void 0,{sessionId:d,worktree:h}=await e.createSession({workspaceCwd:s,sourceType:w4,...u?{approvalMode:u}:{},...r?{worktree:r}:{}});o==null||o(d);let m="prepare new session";try{if(i){m="run onSessionCreated";let b;try{await Promise.race([i(d),new Promise((v,x)=>{b=setTimeout(()=>x(new Error("onSessionCreated timed out")),kut)})])}finally{clearTimeout(b)}}m="verify session identity";const p=a();if(p!==void 0&&p!==d)throw new Error(`Session changed before attach: expected ${d}, found ${p}`);m="attach new session",await e.attachSession(),m="verify attached session";const g=a();if(g!==void 0&&g!==d)throw new Error(`Session changed while attaching: expected ${d}, found ${g}`)}catch(p){c(`[WebShell] failed to ${m}:`,p),await e.releaseSession(d).catch(b=>{c("[WebShell] failed to release unattached session:",b)});const g=a();throw g===void 0||g===d?await e.clearSession().catch(b=>{c("[WebShell] failed to clear unattached session:",b)}):c(`[WebShell] skipping clearSession: expected ${d}, found ${g}`),p}return t&&await e.setModel(t).catch(p=>{c("[WebShell] failed to set model for new session:",p)}),h?{worktree:h}:{}}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const Sut=new Set(["coder-model(qwen-oauth)"]);function jy(e){return!Sut.has(e.id)}function Cut({catchingUp:e,pendingApproval:t,isPreparingPrompt:n}){return!!(e||t||n)}function yoe({catchingUp:e,isPreparingPrompt:t,isStreaming:n}){return e?"loading":t||n?"processing":"idle"}function Tut(e){switch(yoe(e)){case"loading":return"common.loading";case"processing":return"editor.processing";case"idle":return"editor.placeholder"}}function xoe({connectionStatus:e,hasSession:t,restartSseOnPrompt:n}){return e==="error"?!0:e==="disconnected"&&(!n||!t)}const voe=/^\/([\w-]+)(?=\s|$)/;function woe(e,t,n){if(!t)return!1;const s=e.match(voe);if(!s)return!1;try{return t({command:s[1].toLowerCase(),args:e.slice(s[0].length).trim(),input:e})===!0}catch(r){return n(r,"onSlashCommand callback failed"),!1}}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const A9=["blue","green","purple","orange","yellow","red"];for(const e of A9){if(JI[e])continue;const t=`WorkspaceAccent.module.css is missing a class for the "${e}" accent`;console.error(t)}function Eut(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)}function Aut(e,t){if(!e)return;const s=((t==null?void 0:t.workspaces)??[]).findIndex(i=>i.cwd===e),r=s>=0?s:Eut(e);return A9[r%A9.length]}function koe(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:"diff",description:e("local.diff")},{name:"log",description:e("local.log")},{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 Nut={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"},jut={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 _oe(e){return jut[e]}function Soe(e,t){return e.map(n=>{const s=Nut[n.name];return!s||n.source&&n.source!=="builtin-command"?n:{...n,description:t(s)}})}function Coe(...e){const t=new Map;for(const n of e)for(const s of n){const r=t.get(s.name);r?t.set(s.name,{...r,...s,description:s.description||r.description,argumentHint:s.argumentHint??r.argumentHint}):t.set(s.name,s)}return[...t.values()]}const Mut="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",Iut="/assets/insert-DmRbh9Rv.svg",Rut="/assets/queue-DWpnpFgW.svg",Dut="_app_cfgrs_1",Lut="_appChat_cfgrs_43",Put="_appChatEmpty_cfgrs_49",Out="_appShell_cfgrs_54",But="_chatPane_cfgrs_62",$ut="_artifactResizeHandle_cfgrs_71",zut="_chatPaneShowingPage_cfgrs_91",Fut="_fullPage_cfgrs_97",Hut="_fullPageHeader_cfgrs_106",qut="_splitApprovalNotice_cfgrs_116",Uut="_fullPageBack_cfgrs_142",Vut="_fullPageTitle_cfgrs_159",Wut="_fullPageBody_cfgrs_164",Gut="_mobileDrawer_cfgrs_171",Kut="_mobileBackdrop_cfgrs_175",Yut="_mobileDrawerForced_cfgrs_182",Xut="_hamburgerButton_cfgrs_210",Qut="_mobileDrawerOpen_cfgrs_255",Jut="_hamburgerButtonFloating_cfgrs_290",Zut="_appWithSidebar_cfgrs_298",edt="_themeDark_cfgrs_334",tdt="_themeLight_cfgrs_402",ndt="_content_cfgrs_470",sdt="_contentHasMessages_cfgrs_478",rdt="_worktreeWelcomeToggle_cfgrs_487",idt="_worktreeToggleIcon_cfgrs_521",odt="_worktreeToggleText_cfgrs_541",adt="_worktreeToggleLabel_cfgrs_548",ldt="_worktreeToggleHint_cfgrs_555",cdt="_worktreeWelcomeBadge_cfgrs_561",udt="_worktreeBadgeIcon_cfgrs_579",ddt="_worktreeBadgeText_cfgrs_592",hdt="_worktreeWelcomeTitle_cfgrs_599",fdt="_worktreeWelcomeDesc_cfgrs_606",mdt="_worktreeWelcomeCancel_cfgrs_612",pdt="_missingSessionState_cfgrs_654",gdt="_missingSessionMessage_cfgrs_667",bdt="_missingSessionButton_cfgrs_674",ydt="_panelHost_cfgrs_709",xdt="_panelHeader_cfgrs_717",vdt="_panelBack_cfgrs_727",wdt="_panelTitle_cfgrs_753",kdt="_panelBody_cfgrs_762",_dt="_chatViewWrap_cfgrs_774",Sdt="_chatViewHidden_cfgrs_782",Cdt="_chatSubtree_cfgrs_786",Tdt="_chatSubtreeHidden_cfgrs_790",Edt="_footer_cfgrs_803",Adt="_bottomPanels_cfgrs_813",Ndt="_approvalOverlay_cfgrs_828",jdt="_scrollToBottomLayer_cfgrs_842",Mdt="_scrollToBottomLayerWithTodos_cfgrs_853",Idt="_scrollToBottomButton_cfgrs_860",Rdt="_scrollToBottomIcon_cfgrs_889",Ddt="_btwPanel_cfgrs_895",Ldt="_composer_cfgrs_902",Pdt="_composerHeader_cfgrs_907",Odt="_customFooter_cfgrs_911",Bdt="_escClearStatus_cfgrs_917",$dt="_composerActionTip_cfgrs_924",zdt="_composerActionTipIcon_cfgrs_934",Fdt="_composerActionTipText_cfgrs_941",Hdt="_composerActionTipActions_cfgrs_948",qdt="_composerActionTipButton_cfgrs_954",Udt="_composerActionTipButtonPrimary_cfgrs_971",Vdt="_emptyWelcomeFooter_cfgrs_990",Wdt="_mobileWelcomeFooterMiddle_cfgrs_994",Gdt="_mobileWelcomeGroup_cfgrs_998",Kdt="_chatPaneWithMobileComposerBottom_cfgrs_1003",Ydt="_chatViewWithMobileComposerBottom_cfgrs_1008",Xdt="_chatViewWithWelcomeMiddle_cfgrs_1021",Qdt="_footerWithCustomFooter_cfgrs_1021",Jdt="_desktopWelcomeFooter_cfgrs_1055",Zdt="_queuedPrompts_cfgrs_1064",eht="_queuedPrompt_cfgrs_1064",tht="_queuedPromptIcon_cfgrs_1094",nht="_queuedPromptMaskIcon_cfgrs_1104",sht="_queuedPromptActionIcon_cfgrs_1105",rht="_queuedPromptText_cfgrs_1118",iht="_queuedPromptState_cfgrs_1126",oht="_queuedPromptSpinner_cfgrs_1134",aht="_queuedPromptActions_cfgrs_1149",lht="_queuedPromptAction_cfgrs_1105",cht="_queuedHint_cfgrs_1194",xt={app:Dut,appChat:Lut,appChatEmpty:Put,appShell:Out,chatPane:But,artifactResizeHandle:$ut,chatPaneShowingPage:zut,fullPage:Fut,fullPageHeader:Hut,splitApprovalNotice:qut,fullPageBack:Uut,fullPageTitle:Vut,fullPageBody:Wut,mobileDrawer:Gut,mobileBackdrop:Kut,mobileDrawerForced:Yut,hamburgerButton:Xut,mobileDrawerOpen:Qut,hamburgerButtonFloating:Jut,appWithSidebar:Zut,themeDark:edt,themeLight:tdt,content:ndt,contentHasMessages:sdt,worktreeWelcomeToggle:rdt,worktreeToggleIcon:idt,worktreeToggleText:odt,worktreeToggleLabel:adt,worktreeToggleHint:ldt,worktreeWelcomeBadge:cdt,worktreeBadgeIcon:udt,worktreeBadgeText:ddt,worktreeWelcomeTitle:hdt,worktreeWelcomeDesc:fdt,worktreeWelcomeCancel:mdt,missingSessionState:pdt,missingSessionMessage:gdt,missingSessionButton:bdt,panelHost:ydt,panelHeader:xdt,panelBack:vdt,panelTitle:wdt,panelBody:kdt,chatViewWrap:_dt,chatViewHidden:Sdt,chatSubtree:Cdt,chatSubtreeHidden:Tdt,footer:Edt,bottomPanels:Adt,approvalOverlay:Ndt,scrollToBottomLayer:jdt,scrollToBottomLayerWithTodos:Mdt,scrollToBottomButton:Idt,scrollToBottomIcon:Rdt,btwPanel:Ddt,composer:Ldt,composerHeader:Pdt,customFooter:Odt,escClearStatus:Bdt,composerActionTip:$dt,composerActionTipIcon:zdt,composerActionTipText:Fdt,composerActionTipActions:Hdt,composerActionTipButton:qdt,composerActionTipButtonPrimary:Udt,emptyWelcomeFooter:Vdt,mobileWelcomeFooterMiddle:Wdt,mobileWelcomeGroup:Gdt,chatPaneWithMobileComposerBottom:Kdt,chatViewWithMobileComposerBottom:Ydt,chatViewWithWelcomeMiddle:Xdt,footerWithCustomFooter:Qdt,desktopWelcomeFooter:Jdt,queuedPrompts:Zdt,queuedPrompt:eht,queuedPromptIcon:tht,queuedPromptMaskIcon:nht,queuedPromptActionIcon:sht,queuedPromptText:rht,queuedPromptState:iht,queuedPromptSpinner:oht,queuedPromptActions:aht,queuedPromptAction:lht,queuedHint:cht},uht=240;function dht(e){var t,n;return((t=e.value)==null?void 0:t.trim())||((n=e.label)==null?void 0:n.trim())||e.id}function hht(e,t){if(e.inputAnnotations&&e.inputAnnotations.length>0)return mK(e.text,e.inputAnnotations).map(s=>s.type==="text"?s:{type:"tag",tag:s.tag,preserveCustomKindLabel:!0});const n=rj(e.text,t,"[WebShell] failed to parse queued prompt content",{requireSourcePreservation:!0});return n?n.map(s=>s.type==="text"?s:{type:"tag",tag:s.tag,preserveCustomKindLabel:!1}):[{type:"text",text:e.text}]}function fht(e){const t=[];let n=uht,s=!1;for(const i of e){if(i.type==="tag"){if(n<=0){s=!0;break}const a=dht(i.tag).length;if(a>n){s=!0;break}t.push(i),n-=a;continue}let o=i.text.replace(/\s+/g," ");if(t.length===0&&(o=o.trimStart()),!!o){if(o.length>n){n>0&&t.push({type:"text",text:o.slice(0,n)}),s=!0;break}t.push({type:"text",text:o}),n-=o.length}}const r=t[t.length-1];if((r==null?void 0:r.type)==="text"){const i=r.text.trimEnd();i?r.text=i:t.pop()}return{parts:t,truncated:s}}function Toe({prompts:e,t,onDelete:n,onInsert:s,onEdit:r}){const{parseUserMessageContent:i,composerTagIcons:o,renderComposerTag:a,renderComposerTagTooltip:c,onComposerTagClick:u}=$c();return e.length===0?null:l.jsxs("div",{className:xt.queuedPrompts,children:[e.map(d=>{var T;const h=fht(hht(d,i)),m=((T=d.images)==null?void 0:T.length)??0,p=goe(d.text),g=d.serverState==="submitting",b=d.serverState==="running",v=d.isRemoving===!0,x=g||b||d.isEditing===!0||v;let y=t("queue.insertTip");x?y=t("queue.submittingDisabled"):p&&(y=t("queue.insertCommandDisabled"));let w=t("queue.editTip");x&&(w=t("queue.submittingDisabled"));const k=t(x?"queue.submittingDisabled":"queue.deleteTip");return l.jsxs("div",{className:xt.queuedPrompt,children:[l.jsx("span",{className:xt.queuedPromptIcon,"aria-hidden":"true",children:l.jsx("span",{className:xt.queuedPromptMaskIcon,style:cf("--queued-icon-url",Rut)})}),l.jsxs("span",{className:xt.queuedPromptText,children:[h.parts.map((_,C)=>_.type==="text"?l.jsx(f.Fragment,{children:_.text},C):l.jsx(OI,{tag:_.tag,composerTagIcons:o,renderComposerTag:a,renderComposerTagTooltip:c,onComposerTagClick:u,preserveCustomKindLabel:_.preserveCustomKindLabel},`${_.tag.id}:${C}`)),h.truncated?"...":null,m>0?` ${t("queue.imageCount",{count:m})}`:"",g||d.isEditing||v?l.jsxs("span",{className:xt.queuedPromptState,children:[l.jsx("span",{className:xt.queuedPromptSpinner}),v?t("queue.removing"):d.isEditing?t("queue.editing"):t("queue.submitting")]}):null]}),l.jsxs("span",{className:xt.queuedPromptActions,children:[m===0&&l.jsxs("button",{type:"button",className:xt.queuedPromptAction,onClick:()=>s(d.id),disabled:p||x,title:y,children:[l.jsx("span",{className:xt.queuedPromptActionIcon,style:cf("--queued-icon-url",Iut),"aria-hidden":"true"}),t("queue.insert")]}),l.jsx("button",{type:"button",className:xt.queuedPromptAction,onClick:()=>n(d.id),disabled:x,"aria-label":t("queue.delete"),title:k,children:l.jsx("span",{className:xt.queuedPromptActionIcon,style:cf("--queued-icon-url",Mut),"aria-hidden":"true"})}),l.jsx("button",{type:"button",className:xt.queuedPromptAction,onClick:()=>r(d.id),disabled:x,"aria-label":t("queue.edit"),title:w,children:l.jsx("span",{className:xt.queuedPromptActionIcon,style:cf("--queued-icon-url",Pie),"aria-hidden":"true"})})]})]},d.id)}),l.jsx("div",{className:xt.queuedHint,children:t("queue.footer")})]})}const mht="_approval_5nswb_1",pht="_floating_5nswb_18",ght="_header_5nswb_31",bht="_icon_5nswb_41",yht="_name_5nswb_56",xht="_desc_5nswb_67",vht="_content_5nswb_87",wht="_code_5nswb_105",kht="_codeBlock_5nswb_113",_ht="_question_5nswb_136",Sht="_options_5nswb_148",Cht="_option_5nswb_148",Tht="_optionPlain_5nswb_183",Eht="_optionSecondary_5nswb_193",Aht="_optionPrimary_5nswb_200",Nht="_optionActive_5nswb_211",jht="_pointer_5nswb_215",Mht="_num_5nswb_219",Iht="_label_5nswb_223",Ti={approval:mht,floating:pht,header:ght,icon:bht,name:yht,desc:xht,content:vht,code:wht,codeBlock:kht,question:_ht,options:Sht,option:Cht,optionPlain:Tht,optionSecondary:Eht,optionPrimary:Aht,optionActive:Nht,pointer:jht,num:Mht,label:Iht};function Rht(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 Dht(e){const t=[];for(const n of e.content)n.type==="text"&&n.text&&t.push(n.text);return t.join(`
`)}function Lht(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 Pht(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 Oht(e){var n;const t=(n=e.rawInput)==null?void 0:n.description;return typeof t=="string"&&t.trim()?t.trim():e.title}function x8(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 bq(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 m_(e){return e.map((t,n)=>({option:t,index:n})).sort((t,n)=>{const s=bq(t.option)-bq(n.option);return s===0?t.index-n.index:s}).map(({option:t})=>t)}function Bht(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 $ht(e){return e.kind==="allow_once"?Ti.optionPrimary:e.kind==="allow_always"?Ti.optionSecondary:e.kind==="reject_once"||e.kind==="reject_always"?Ti.optionPlain:Ti.optionSecondary}function Eoe({request:e,onConfirm:t,variant:n="inline",keyboardActive:s=!0}){const{t:r}=ot(),i=f.useMemo(()=>m_(e.options),[e.options]),[o,a]=f.useState(()=>x8(m_(e.options))),c=f.useRef(e);c.current=e;const u=f.useRef(o);u.current=o;const d=f.useRef(!1),h=f.useRef([]),m=f.useId(),p=f.useId(),g=f.useId(),b=f.useId();f.useEffect(()=>{const z=x8(m_(c.current.options));d.current=!1,u.current=z,a(z)},[e.id]);const v=Rht(e.title),x=e.toolName||v.toolName||e.kind||"Tool",y=Pc(x,r),w=Oht(e),k=Dht(e),T=f.useCallback(z=>{d.current||(d.current=!0,t(c.current.id,z))},[t]),_=f.useCallback(z=>{const F=h.current[z];F&&(document.activeElement===F&&F.blur(),F.focus())},[]),C=f.useRef(!1),S=f.useRef(e.id);f.useEffect(()=>{const z=C.current,F=S.current;if(C.current=s,S.current=e.id,!s)return;const B=e.id!==F;z&&!B||_(B?x8(m_(c.current.options)):u.current)},[s,e.id,_]);const L=f.useCallback(z=>{const F=i.length,B=(u.current+z+F)%F;u.current=B,a(B),_(B)},[i.length,_]),N=f.useCallback(z=>{const F=i.length;if(z.key==="ArrowDown"||z.key==="j")z.preventDefault(),L(1);else if(z.key==="ArrowUp"||z.key==="k")z.preventDefault(),L(-1);else if(z.key==="Home")z.preventDefault(),u.current=0,a(0),_(0);else if(z.key==="End"){z.preventDefault();const B=F-1;u.current=B,a(B),_(B)}else if(z.key==="Escape"){z.preventDefault();const B=c.current.options.find(W=>W.kind==="reject_once"||W.kind==="reject_always");B&&T(B.id)}else if(z.key>="1"&&z.key<="9"){const B=parseInt(z.key,10)-1;B<F&&(z.preventDefault(),T(i[B].id))}},[i,L,T,_]),$=Lht(e),M=_de(e.toolName),P=Pht(e),E=!!($&&P||k&&k!==e.title),O=M?r("approval.launchAgentQuestion"):$?r("approval.execQuestion",{tool:y}):r("approval.changeQuestion");return l.jsxs("div",{className:n==="floating"?`${Ti.approval} ${Ti.floating}`:Ti.approval,"data-web-shell-permission-panel":!0,role:"alertdialog","aria-labelledby":m,"aria-describedby":[p,w?g:null,E?b:null].filter(Boolean).join(" "),onKeyDown:N,children:[l.jsxs("div",{className:Ti.header,children:[l.jsx("span",{className:Ti.icon,"aria-hidden":"true",children:"?"}),l.jsx("span",{className:Ti.name,id:m,children:y})]}),w&&l.jsx("div",{className:Ti.desc,id:g,title:w,children:w}),$&&P?l.jsx("div",{className:Ti.code,children:l.jsx("pre",{className:Ti.codeBlock,id:b,title:P,children:P})}):k&&k!==e.title?l.jsx("pre",{className:Ti.content,id:b,title:k,children:k}):null,l.jsx("div",{className:Ti.question,id:p,children:O}),l.jsx("div",{className:Ti.options,role:"radiogroup",children:i.map((z,F)=>{const B=F===o,W=Bht(z),I=W?r(W):z.label;return l.jsxs("button",{type:"button",ref:Y=>{h.current[F]=Y},className:`${Ti.option} ${$ht(z)} ${B?Ti.optionActive:""}`,"data-web-shell-permission-option":!0,"data-option-id":z.id,tabIndex:B?0:-1,role:"radio","aria-checked":B,"aria-keyshortcuts":F<9?String(F+1):void 0,onClick:()=>T(z.id),onFocus:()=>{u.current=F,a(F)},children:[l.jsx("span",{className:Ti.pointer,"aria-hidden":"true",children:B?"›":" "}),l.jsxs("span",{className:Ti.num,"aria-hidden":"true",children:[F+1,"."]}),l.jsx("span",{className:Ti.label,children:I})]},z.id)})})]})}const zht="_question_1paag_1",Fht="_floating_1paag_18",Hht="_titleLine_1paag_30",qht="_icon_1paag_38",Uht="_toolName_1paag_42",Vht="_toolDesc_1paag_46",Wht="_tabs_1paag_53",Ght="_topRight_1paag_63",Kht="_collapseButton_1paag_70",Yht="_collapseIcon_1paag_89",Xht="_collapseIconCollapsed_1paag_95",Qht="_collapsed_1paag_99",Jht="_tab_1paag_53",Zht="_tabActive_1paag_118",eft="_text_1paag_135",tft="_description_1paag_143",nft="_multiHint_1paag_151",sft="_options_1paag_157",rft="_option_1paag_157",ift="_optionActive_1paag_194",oft="_optionSelected_1paag_195",aft="_optionLabel_1paag_200",lft="_pointer_1paag_205",cft="_optionNum_1paag_209",uft="_editIcon_1paag_226",dft="_optionContent_1paag_258",hft="_optionPlaceholder_1paag_274",fft="_optionDesc_1paag_279",mft="_customInput_1paag_286",pft="_customTrigger_1paag_301",gft="_actions_1paag_327",bft="_button_1paag_335",yft="_submitButton_1paag_361",xft="_ignoreButton_1paag_367",ws={question:zht,floating:Fht,titleLine:Hht,icon:qht,toolName:Uht,toolDesc:Vht,tabs:Wht,topRight:Ght,collapseButton:Kht,collapseIcon:Yht,collapseIconCollapsed:Xht,collapsed:Qht,tab:Jht,tabActive:Zht,text:eft,description:tft,multiHint:nft,options:sft,option:rft,optionActive:ift,optionSelected:oft,optionLabel:aft,pointer:lft,optionNum:cft,editIcon:uft,optionContent:dft,optionPlaceholder:hft,optionDesc:fft,customInput:mft,customTrigger:pft,actions:gft,button:bft,submitButton:yft,ignoreButton:xft};function Aoe({request:e,onConfirm:t,variant:n="inline",keyboardActive:s=!0}){const{t:r}=ot(),i=f.useMemo(()=>{var q;return Array.isArray((q=e.rawInput)==null?void 0:q.questions)?e.rawInput.questions:[]},[e.rawInput]),[o,a]=f.useState(0),[c,u]=f.useState(null),[d,h]=f.useState({}),[m,p]=f.useState({}),[g,b]=f.useState({}),[v,x]=f.useState(!1),[y,w]=f.useState(!1),k=f.useRef(!1),T=f.useRef([]),_=f.useRef(null),C=f.useRef(c);C.current=c;const S=f.useId(),L=f.useId();f.useEffect(()=>{const q=i[0];k.current=!1,w(!1),a(0),C.current=q!=null&&q.options.length?0:null,u(q!=null&&q.options.length?0:null),h(q&&!q.multiSelect&&q.options[0]?{0:q.options[0].label}:{}),p({}),b(q!=null&&q.multiSelect&&q.options[0]?{0:[q.options[0].label]}:{}),x(!1)},[i,e.id]);const N=i[o],$=(N==null?void 0:N.multiSelect)??!1,M=f.useCallback(()=>{const q={};for(let Z=0;Z<i.length;Z++){const he=i[Z];if(he)if(he.multiSelect){const ye=g[Z]||[],oe=m[Z],we=oe?[...ye,oe]:ye;q[String(Z)]=we.join(", ")}else q[String(Z)]=d[Z]||m[Z]||""}return q},[i,g,m,d]),P=f.useCallback(()=>{if(k.current)return;const q=e.options.find(Z=>Z.kind==="allow_once");q&&(k.current=!0,t(e.id,q.id,M()))},[M,e,t]),E=f.useCallback(()=>{if(k.current)return;const q=e.options.find(Z=>Z.kind==="reject_once"||Z.kind==="reject_always");q&&(k.current=!0,t(e.id,q.id,void 0))},[e,t]),O=f.useCallback(q=>{q!==void 0&&p(Z=>({...Z,[o]:q})),$||h(Z=>{if(!(o in Z))return Z;const he={...Z};return delete he[o],he}),x(!0)},[o,$]),z=f.useCallback(q=>{if(!N)return;if(q===N.options.length){O();return}const he=N.options[q].label;if($){const ye=g[o]||[],oe=ye.includes(he)?ye.filter(we=>we!==he):[...ye,he];b({...g,[o]:oe})}else{const ye={...d,[o]:he};h(ye),p(oe=>{if(!(o in oe))return oe;const we={...oe};return delete we[o],we})}},[N,o,$,g,d,O]),F=f.useCallback(q=>{if(!N||!$)return;if(q===N.options.length){O();return}const Z=N.options[q].label,he=g[o]||[],ye=he.includes(Z)?he.filter(oe=>oe!==Z):[...he,Z];b({...g,[o]:ye})},[N,$,g,o,O]),B=f.useCallback(q=>{if(N){if(C.current=q,u(q),q===N.options.length){O();return}$?F(q):z(q)}},[N,$,O,F,z]),W=f.useCallback(q=>{var Z,he;N&&(C.current=q,u(q),q===N.options.length?((Z=_.current)==null||Z.focus(),$||h(ye=>{if(!(o in ye))return ye;const oe={...ye};return delete oe[o],oe})):((he=T.current[q])==null||he.focus(),$||z(q)))},[N,o,$,z]),I=f.useCallback(q=>{if(!N)return;const Z=N.options.length+1,he=C.current??0;W((he+q+Z)%Z)},[N,W]),Y=f.useCallback(q=>{if(Vp(q.target)||!q.target.closest("[data-web-shell-ask-option]")||!N)return;const Z=N.options.length+1;if(q.key==="ArrowDown"||q.key==="j")q.preventDefault(),I(1);else if(q.key==="ArrowUp"||q.key==="k")q.preventDefault(),I(-1);else if(q.key==="Home")q.preventDefault(),W(0);else if(q.key==="End")q.preventDefault(),W(Z-1);else if(q.key==="Escape")q.preventDefault(),E();else if(q.key>="1"&&q.key<="9"){const he=parseInt(q.key,10)-1;he<Z&&(q.preventDefault(),B(he))}},[N,I,W,E,B]),V=f.useRef(!1),j=f.useRef(e.id),ee=f.useRef((N==null?void 0:N.options.length)??0);if(ee.current=(N==null?void 0:N.options.length)??0,f.useEffect(()=>{var ye,oe;const q=V.current,Z=j.current;if(V.current=s,j.current=e.id,!s||q&&e.id===Z)return;const he=C.current??0;he===ee.current?(ye=_.current)==null||ye.focus():(oe=T.current[he])==null||oe.focus()},[s,e.id]),i.length===0)return null;const se=q=>{const Z=i[q];return Z?Z.multiSelect?(g[q]||[]).length>0||!!m[q]:!!d[q]||!!m[q]:!1},X=i.every((q,Z)=>se(Z)),Q=Math.min(o,i.length-1),ue=q=>{const Z=i[q];if(a(q),x(!1),!(Z!=null&&Z.options.length)){u(null);return}if(u(0),Z.multiSelect){b(he=>(he[q]||[]).length>0||m[q]?he:{...he,[q]:[Z.options[0].label]});return}h(he=>he[q]||m[q]?he:{...he,[q]:Z.options[0].label})},re=()=>{o<=0||ue(o-1)},J=()=>{o>=i.length-1||ue(o+1)};return l.jsxs("div",{className:`${ws.question} ${n==="floating"?ws.floating:""} ${y?ws.collapsed:""}`,"data-web-shell-ask-panel":!0,role:"alertdialog","aria-label":Pc("ask_user_question",r),"aria-labelledby":y?void 0:`${L} ${S}`,onKeyDown:Y,children:[l.jsxs("div",{className:ws.titleLine,children:[l.jsx("span",{className:ws.icon,"aria-hidden":"true",children:"?"}),l.jsx("span",{className:ws.toolName,id:L,children:Pc("ask_user_question",r)}),l.jsx("span",{className:ws.toolDesc,children:r("askUser.progress",{current:Q+1,total:i.length})}),l.jsxs("div",{className:ws.topRight,children:[l.jsx("div",{className:ws.tabs,children:i.map((q,Z)=>l.jsx("span",{className:`${ws.tab} ${Z===o?ws.tabActive:""}`,"aria-hidden":"true"},Z))}),l.jsx("button",{type:"button",className:ws.collapseButton,onClick:()=>w(q=>!q),"aria-expanded":!y,"aria-label":r(y?"common.expand":"common.collapse"),title:r(y?"common.expand":"common.collapse"),children:l.jsx("svg",{viewBox:"0 0 16 16",className:`${ws.collapseIcon} ${y?ws.collapseIconCollapsed:""}`,children:l.jsx("path",{d:"M4 6l4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})})]})]}),!y&&l.jsxs(l.Fragment,{children:[N?l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:ws.text,id:S,children:[N.question,$&&l.jsxs("span",{className:ws.multiHint,children:[" ","(",r("askUser.multiHint"),")"]})]}),l.jsx("p",{className:ws.description,children:r("askUser.selectAnswer")}),l.jsxs("div",{className:ws.options,role:$?"group":"radiogroup","aria-labelledby":S,children:[N.options.map((q,Z)=>{const he=Z===c,ye=$?(g[o]||[]).includes(q.label):d[o]===q.label;return l.jsxs("button",{type:"button",ref:oe=>{T.current[Z]=oe},className:`${ws.option} ${he?ws.optionActive:""} ${ye?ws.optionSelected:""}`,"data-web-shell-ask-option":!0,tabIndex:he?0:-1,role:$?void 0:"radio","aria-checked":$?void 0:ye,"aria-pressed":$?ye:void 0,"aria-keyshortcuts":Z<9?String(Z+1):void 0,onClick:()=>B(Z),onFocus:()=>u(Z),children:[l.jsx("span",{className:ws.pointer,"aria-hidden":"true",children:he?"›":" "}),l.jsx("span",{className:ws.optionNum,"aria-hidden":"true",children:Z+1}),l.jsxs("span",{className:ws.optionContent,children:[l.jsx("span",{className:ws.optionLabel,children:q.label}),q.description&&l.jsx("span",{className:ws.optionDesc,children:q.description})]})]},q.label)}),(()=>{const q=c===N.options.length,Z=!!m[o];return l.jsxs("div",{className:`${ws.option} ${q?ws.optionActive:""} ${Z?ws.optionSelected:""}`,onClick:()=>B(N.options.length),children:[l.jsx("span",{className:ws.pointer,"aria-hidden":"true",children:q?"›":" "}),l.jsx("span",{className:ws.editIcon,"aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 16 16",children:l.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"})})}),v?l.jsx("input",{type:"text",className:ws.customInput,placeholder:r("askUser.typePlaceholder"),value:m[o]||"","aria-label":r("askUser.typePlaceholder"),onChange:he=>p({...m,[o]:he.target.value}),onClick:he=>he.stopPropagation(),onFocus:()=>u(N.options.length),onBlur:()=>x(!1),autoFocus:!0}):l.jsx("button",{type:"button",ref:_,className:`${ws.customTrigger} ${m[o]?"":ws.optionPlaceholder}`,"data-web-shell-ask-option":!0,tabIndex:q?0:-1,role:$?void 0:"radio","aria-checked":$?void 0:Z,"aria-pressed":$?Z:void 0,"aria-keyshortcuts":N.options.length<9?String(N.options.length+1):void 0,onFocus:()=>u(N.options.length),children:m[o]||r("askUser.typePlaceholder")})]})})()]})]}):null,l.jsxs("div",{className:ws.actions,children:[l.jsx("button",{type:"button",className:ws.ignoreButton,onClick:E,children:r("askUser.ignore")}),i.length>1&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:ws.button,disabled:o<=0,onClick:re,children:r("common.previous")}),l.jsx("button",{type:"button",className:ws.button,disabled:o>=i.length-1,onClick:J,children:r("common.next")})]}),l.jsx("button",{type:"button",className:`${ws.button} ${ws.submitButton}`,disabled:!X,onClick:P,children:r("askUser.submit")})]})]})]})}const vft=1e6;function Noe(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 s of Noe(n))t.add(s);return Array.from(t)}function joe(e,t,n){const s=new Map,r=[];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 c of a.tools){for(const u of Noe(c))s.set(u,i);Moe(c,i,r)}}const o=new Map;for(const a of t){const c=wft(r,a,n);if(c.size===0&&a.toolCallId){const u=s.get(a.toolCallId);u&&c.add(u)}for(const u of c){const d=o.get(u);d?d.some(h=>h.id===a.id)||d.push(a):o.set(u,[a])}}return o}function Moe(e,t,n){e.toolName.toLowerCase()==="record_artifact"&&n.push({turnId:t,workspacePath:jd(e.args,"workspacePath"),managedId:jd(e.args,"managedId"),url:jd(e.args,"url")});for(const s of e.subTools??[])Moe(s,t,n)}function wft(e,t,n){const s=new Set;for(const r of e){if(r.workspacePath&&t.workspacePath&&$oe(r.workspacePath,t.workspacePath,n)){s.add(r.turnId);continue}if(r.managedId&&r.managedId===t.managedId){s.add(r.turnId);continue}r.url&&r.url===t.url&&s.add(r.turnId)}return s}function Ioe(e,t,n){const s=new Map;let r=null;for(const i of e){if(i.role==="user"||i.role==="user_shell"){r=i.id;continue}if(r||(r=i.id),i.role!=="tool_group")continue;const o=new Set((t.get(r)??[]).map(a=>Wp(a.workspacePath)).filter(a=>!!a));for(const a of i.tools)Loe(a,r,o,s,n)}return s}function Roe(e){const t=new Map;let n=null;for(const s of e){if(s.role==="user"||s.role==="user_shell"){n=s.id;continue}if(n||(n=s.id),s.role==="tool_group")for(const r of s.tools)Doe(r,n,t)}return t}function Doe(e,t,n){const s=kft(e);if(s){const r=n.get(t);r?r.push(s):n.set(t,[s])}for(const r of e.subTools??[])Doe(r,t,n)}function kft(e){if(e.status!=="completed"||e.toolName.toLowerCase()!=="cron_create")return null;const t=sR(e);if(t!=null&&t.error)return null;const n=jd(e.args,"cron"),s=jd(e.args,"prompt");if(!n||!s)return null;const r=jd(t,"returnDisplay")??jd(t,"llmContent")??(typeof e.rawOutput=="string"?e.rawOutput:void 0),i=r?Poe(r):void 0;return{id:r?Aft(r)??e.callId:e.callId,toolCallId:e.callId,title:Nft(s),cron:n,prompt:s,recurring:yq(e.args,"recurring")??!0,durable:yq(e.args,"durable")??!1,...i?{display:i}:{}}}function Loe(e,t,n,s,r){const i=_ft(e,n,r);if(i){const o=s.get(t);o?jft(o,i):s.set(t,[i])}for(const o of e.subTools??[])Loe(o,t,n,s,r)}function _ft(e,t,n){if(e.status!=="completed")return null;const s=e.toolName.toLowerCase();if(s!=="write_file"&&s!=="edit")return null;const r=Sft(e);if(!r)return null;const i=Wp(r),o=Cft(e),a=Eft(e),c=Tft(a);return{path:r,status:o,toolCallId:e.callId,isArtifact:Array.from(t).some(u=>$oe(i,u,n)),...c?{additions:c.additions,deletions:c.deletions}:{},diffs:a}}function Sft(e){var n,s;const t=f2(e.args,"file_path","filePath","path");if(t!==void 0&&t.length>0)return t;for(const r of e.content??[])if(r.path)return r.path;return(s=(n=e.locations)==null?void 0:n[0])==null?void 0:s.file}function jd(e,...t){if(e)for(const n of t){const s=e[n];if(typeof s=="string"&&s.trim())return s}}function f2(e,...t){if(e)for(const n of t){const s=e[n];if(typeof s=="string")return s}}function Cft(e){if(e.toolName.toLowerCase()==="write_file")return"created";const t=sR(e),n=(jd(t,"returnDisplay")??"").toLowerCase();return n.includes("created new file")||n.includes("successfully created")||n.includes("created and wrote")?"created":"modified"}function Tft(e){const t=Ooe(e);return t?Boe(t.oldText,t.newText):void 0}function Eft(e){const t=sR(e),n=f2(t,"originalContent"),s=f2(t,"newContent");if(n!==void 0||s!==void 0)return[{oldText:n??"",newText:s??"",fileDiff:jd(t,"fileDiff"),fullContent:!0}];const r=[];for(const i of e.content??[])i.type==="diff"&&r.push({oldText:i.oldText??"",newText:i.newText??""});if(r.length>0)return r;if(e.toolName.toLowerCase()==="write_file"){const i=f2(e.args,"content");return i!==void 0?[{oldText:"",newText:i,fullContent:!0}]:[]}return[]}function sR(e){return e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0}function yq(e,t){const n=e==null?void 0:e[t];return typeof n=="boolean"?n:void 0}function Poe(e){return e.split(/\r\n|\r|\n/).map(t=>t.trim()).find(Boolean)}function Aft(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 Nft(e){const t=Poe(e)??e.trim();return t.length>36?`${t.slice(0,36)}...`:t}function jft(e,t){const n=Wp(t.path),s=e.findIndex(h=>Wp(h.path)===n);if(s<0){e.push(t);return}const r=e[s],{additions:i,deletions:o,...a}=r,c=Mft(r.diffs,t.diffs),u=Ooe(c),d=u?Boe(u.oldText,u.newText):void 0;e[s]={...a,status:r.status==="created"||t.status==="created"?"created":"modified",isArtifact:r.isArtifact||t.isArtifact,...d?{additions:d.additions,deletions:d.deletions}:{},diffs:c}}function Mft(e,t){const n=[...e,...t];if(!n.every(i=>i.fullContent))return n;const s=n[0],r=n.at(-1);return!s||!r?n:[{oldText:s.oldText,newText:r.newText,fullContent:!0}]}function Ooe(e){const t=e.at(-1);return t!=null&&t.fullContent?t:void 0}function Boe(e,t){const n=xq(e),s=xq(t);if(n.length*s.length>vft)return;const r=Ift(n,s);return{additions:s.length-r,deletions:n.length-r}}function xq(e){return e?e.replace(/\r?\n$/,"").split(/\r\n|\r|\n/):[]}function Ift(e,t){const n=new Array(t.length+1).fill(0),s=new Array(t.length+1).fill(0);for(const r of e){for(let i=0;i<t.length;i++)s[i+1]=r===t[i]?n[i]+1:Math.max(n[i+1],s[i]);for(let i=0;i<s.length;i++)n[i]=s[i];s.fill(0)}return n[t.length]??0}function $oe(e,t,n){return Sie(e,t,n)}const Rft="_pane_4s0kf_1",Dft="_header_4s0kf_13",Lft="_workspaceTag_4s0kf_36",Pft="_workspaceTagDot_4s0kf_52",Oft="_workspaceTagText_4s0kf_60",Bft="_connectionError_4s0kf_69",$ft="_connectionErrorText_4s0kf_77",zft="_title_4s0kf_84",Fft="_closeButton_4s0kf_95",Hft="_maximizeButton_4s0kf_96",qft="_body_4s0kf_124",Uft="_footer_4s0kf_132",Vft="_approval_4s0kf_138",za={pane:Rft,header:Dft,workspaceTag:Lft,workspaceTagDot:Pft,workspaceTagText:Oft,connectionError:Bft,connectionErrorText:$ft,title:zft,closeButton:Fft,maximizeButton:Hft,body:qft,footer:Uft,approval:Vft},vq=["approvalMode","model","voice"];function Wft({title:e,workspaceCwd:t,onClose:n,onToggleMaximize:s,isMaximized:r=!1,onError:i,onSlashCommand:o,onRightPanelOpen:a,onPaneArtifactsChange:c,messageTurnOutputs:u,restartSseOnPrompt:d=!1}){var sn,Cn,In;const{t:h}=ot(),m=Dl(),p=B1(),g=To(),b=ol(),v=moe(h),x=jv(),y=QG(),w=Y4(),k=X4(),{artifacts:T}=poe();f.useEffect(()=>{const _t=m.sessionId;if(_t)return c==null||c(_t,T,g),()=>{c==null||c(_t,[],g)}},[T,m.sessionId,c,g]);const _=f.useRef(k);_.current=k;const C=f.useRef(null),{followupState:S,onAcceptFollowup:L,onDismissFollowup:N,clear:$}=nK({onAccept:_t=>{var Te;(Te=C.current)==null||Te.insertText(_t)}}),M=f.useCallback((_t,Te)=>{i?i(_t,Te):console.error(Te,_t)},[i]),P=f.useRef(o);P.current=o;const E=f.useCallback(_t=>w.dispatch([{type:"status",text:_t}]),[w]),O=f.useMemo(()=>Q7(x),[x]),z=E9(O),F=O&&!z?O:null,B=O&&z?O:null,W=f.useRef(F);W.current=F;const I=F!==null||B!==null,Y=k!=="idle",V=f.useMemo(()=>joe(v,T,m.workspaceCwd||""),[v,T,m.workspaceCwd]),j=f.useMemo(()=>Ioe(v,V,m.workspaceCwd||""),[v,V,m.workspaceCwd]),ee=f.useMemo(()=>Roe(v),[v]),se=f.useMemo(()=>new Set(u??Tie),[u]),{queuedPrompts:X,queuedTexts:Q,enqueuePrompt:ue,removeQueuedPrompt:re,insertQueuedPrompt:J,editQueuedPrompt:q,editLastQueuedPrompt:Z,clearQueuedPrompts:he}=boe({connected:m.status==="connected",sessionId:m.sessionId,clientId:m.clientId,streamingState:k,sessionActions:p,store:w,editorRef:C,reportError:M,notifySuccess:E,t:h}),ye=f.useMemo(()=>{if(Y)for(let _t=v.length-1;_t>=0;_t--){const Te=v[_t];if((Te==null?void 0:Te.role)==="user")return Te.timestamp}},[v,Y]),oe=f.useCallback((_t,Te,at,ke)=>{const Pe=_t.trim();if(!Pe)return!1;if(woe(_t,P.current,M))return!0;if(xoe({connectionStatus:m.status,hasSession:!!m.sessionId,restartSseOnPrompt:d}))return!1;const ve=ke==null?void 0:ke.inputAnnotations;return _.current==="idle"?(p.sendPrompt(Pe,{...Te&&Te.length?{images:Te}:{},...ve?{inputAnnotations:ve}:{},onAdmitted:()=>{$(),at==null||at()}}).catch(Ke=>M(Ke,"Failed to send prompt")),!1):ve?ue(Pe,Te,void 0,ve):ue(Pe,Te)},[p,$,m.sessionId,m.status,ue,M,d]),we=f.useCallback((_t,Te,at)=>{p.submitPermission(_t,Te,at).catch(ke=>M(ke,"Failed to submit permission choice"))},[p,M]),Ve=f.useCallback(()=>{p.cancel().catch(_t=>M(_t,"Failed to cancel request"))},[p,M]),lt=f.useCallback(_t=>{if(a){if(_t.kind==="artifact"||_t.kind==="scheduled_task"){a({..._t,workspaceActions:g});return}a(_t)}},[a,g]),Et=f.useMemo(()=>Soe(Coe(m.commands??[],koe(h)),h).map(_t=>{const Te=_oe(_t.name);return Te?{..._t,displayCategory:"skill",description:h(Te)}:_t}),[m.commands,h]),pt=f.useMemo(()=>(m.models??[]).filter(jy).map(_t=>({id:_t.id,label:uf(_t.label||_t.id)})),[m.models]),je=f.useCallback(_t=>{if(!_4(_t)){M(new Error(`Unsupported approval mode: ${_t}`),"Failed to set approval mode");return}p.setApprovalMode(_t).then(()=>{const Te=W.current;if(!Te||!(_t==="yolo"||_t==="auto-edit"&&Te.toolKind==="edit"))return;const ke=Te.options.find(Pe=>Pe.kind==="allow_once");ke&&p.submitPermission(Te.id,ke.id).catch(Pe=>M(Pe,"Failed to auto-approve tool call"))}).catch(Te=>M(Te,"Failed to set approval mode"))},[p,M]),Ae=f.useCallback(_t=>{p.setModel(_t).catch(Te=>M(Te,"Failed to switch model"))},[p,M]),De=e||m.displayName||((sn=m.sessionId)==null?void 0:sn.slice(0,8))||"",Ne=t??m.workspaceCwd,tt=nR(b.capabilities)&&!!Ne,Se=f.useMemo(()=>tt?[...vq,"workspace"]:vq,[tt]),Be=tt&&Ne?jC(Ne,(Cn=b.capabilities)==null?void 0:Cn.workspaces):void 0,le=tt?Aut(Ne,b.capabilities):void 0,Le=le?JI[le]:void 0;return l.jsxs("section",{className:za.pane,"data-testid":"chat-pane","aria-label":De,children:[l.jsxs("header",{className:`${za.header} ${Le??""}`.trim(),children:[Be&&l.jsxs("span",{role:"img",className:za.workspaceTag,title:Ne,"aria-label":h("workspace.paneLabel",{name:Be}),"data-web-shell-pane-workspace":!0,children:[l.jsx("span",{className:za.workspaceTagDot,"aria-hidden":"true"}),l.jsx("span",{className:za.workspaceTagText,children:Be})]}),l.jsx("span",{className:za.title,title:De,children:De}),s&&l.jsx("button",{type:"button",className:za.maximizeButton,onClick:s,"aria-pressed":r,"aria-label":h(r?"splitView.restorePane":"splitView.maximizePane"),title:h(r?"splitView.restorePane":"splitView.maximizePane"),children:r?l.jsx(oK,{size:16,"aria-hidden":!0}):l.jsx(iK,{size:16,"aria-hidden":!0})}),n&&l.jsx("button",{type:"button",className:za.closeButton,onClick:n,"aria-label":h("splitView.closePane"),title:h("splitView.closePane"),children:l.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:l.jsx("path",{d:"M6 6l12 12M18 6L6 18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),m.error&&l.jsx("div",{className:za.connectionError,role:"alert",children:l.jsxs("span",{className:za.connectionErrorText,children:[h("splitView.paneConnectionError"),": ",m.error]})}),l.jsx("div",{className:za.body,children:l.jsx(Lie,{messages:v,pendingApproval:F,loadingTranscript:m.loadingTranscript,catchingUp:m.catchingUp,hasOlderHistory:y.hasMore,loadingOlderHistory:y.loading,historyCapacityReached:y.capacityReached,onLoadOlderHistory:y.loadMore,isResponding:Y,workspaceCwd:m.workspaceCwd||"",hideSessionTimeline:!0,turnFileChanges:se.has("file")?j:void 0,turnArtifacts:se.has("artifact")?V:void 0,turnScheduledTasks:se.has("scheduled_task")?ee:void 0,onTurnOutputOpen:lt,generateContent:(In=m.capabilities)!=null&&In.features.includes("session_generation")?p.generateSessionContent:void 0})}),l.jsxs("div",{className:za.footer,children:[F&&l.jsx("div",{className:za.approval,"data-testid":"pane-approval",children:l.jsx(Eoe,{request:F,onConfirm:we,variant:"floating",keyboardActive:!1})}),B&&l.jsx("div",{className:za.approval,"data-testid":"pane-approval",children:l.jsx(Aoe,{request:B,onConfirm:we,variant:"floating",keyboardActive:!1})}),l.jsx(Fie,{startedAt:ye,showPhrase:!1}),l.jsx(Toe,{prompts:X,t:h,onDelete:re,onInsert:J,onEdit:q}),l.jsx(zie,{ref:C,onSubmit:oe,onCancel:Ve,isRunning:Y,commands:Et,queuedMessages:Q,onPopQueuedMessages:Z,onClearQueuedMessages:he,visibleToolbarActions:Se,workspaceName:tt?Be:void 0,workspaceTitle:Ne,workspaceColor:le,currentMode:m.currentMode??"default",currentModel:m.currentModel??"",availableModels:pt,onSelectMode:je,onSelectModel:Ae,dialogOpen:I,followupState:S,onAcceptFollowup:L,onDismissFollowup:N,placeholderText:h("splitView.composerPlaceholder")})]})]})}const Gft="_split_99j2q_1",Kft="_toolbar_99j2q_9",Yft="_backButton_99j2q_18",Xft="_title_99j2q_35",Qft="_count_99j2q_40",Jft="_addWrap_99j2q_45",Zft="_addButton_99j2q_50",emt="_picker_99j2q_70",tmt="_pickerItem_99j2q_87",nmt="_pickerItemLabel_99j2q_102",smt="_pickerItemWorkspace_99j2q_112",rmt="_panes_99j2q_131",imt="_paneSlot_99j2q_140",omt="_empty_99j2q_153",amt="_paneError_99j2q_162",lmt="_paneErrorTitle_99j2q_175",cmt="_paneErrorMessage_99j2q_180",umt="_paneErrorClose_99j2q_185",fo={split:Gft,toolbar:Kft,backButton:Yft,title:Xft,count:Qft,addWrap:Jft,addButton:Zft,picker:emt,pickerItem:tmt,pickerItemLabel:nmt,pickerItemWorkspace:smt,panes:rmt,paneSlot:imt,empty:omt,paneError:amt,paneErrorTitle:lmt,paneErrorMessage:cmt,paneErrorClose:umt},v8=Af;function dmt({sessionIds:e,onPanesChange:t,onExit:n,onError:s,onSlashCommand:r,onRightPanelOpen:i,onPaneArtifactsChange:o,messageTurnOutputs:a,sessionListReloadToken:c,includeOtherWorkspaces:u=!0,workspaceCwd:d,restartSseOnPrompt:h}){var ue,re;const{t:m}=ot(),p=Dl(),g=p.sessionId,b=((re=(ue=p.capabilities)==null?void 0:ue.features)==null?void 0:re.includes(eR))??!1,{sessions:v,reload:x}=rw(d,{autoLoad:!0,pageSize:wd,archiveState:"active",...b?{view:"organized",group:"all"}:{}}),{sessions:y,reload:w}=loe(u&&!d),k=f.useMemo(()=>aoe(v,y),[v,y]),T=!d&&u&&nR(p.capabilities),_=!!d||T,C=e!==void 0,S=f.useMemo(()=>Array.from(new Set((e??[]).filter(Boolean))).slice(0,v8),[e]),[L,N]=f.useState(()=>S.length>0?S:g?[g]:[]),[$,M]=f.useState(!1),[P,E]=f.useState(null),O=f.useRef(null),[z]=f.useState(()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2));f.useEffect(()=>{C&&N(J=>J.length===S.length&&J.every((q,Z)=>q===S[Z])?J:S)},[S,C]);const F=f.useRef(L);F.current=L,f.useEffect(()=>{if(!$)return;const J=Z=>{var he;(he=O.current)!=null&&he.contains(Z.target)||M(!1)},q=Z=>{Z.key==="Escape"&&M(!1)};return document.addEventListener("mousedown",J),document.addEventListener("keydown",q),()=>{document.removeEventListener("mousedown",J),document.removeEventListener("keydown",q)}},[$]),f.useEffect(()=>{$&&(x(),w())},[$,x,w]);const B=f.useRef(c);f.useEffect(()=>{c!==void 0&&c!==B.current&&(B.current=c,x(),w())},[c,x,w]);const W=f.useMemo(()=>{var q;const J=new Map;for(const Z of k)J.set(Z.sessionId,((q=Z.displayName)==null?void 0:q.trim())||Z.sessionId.slice(0,8));return J},[k]),I=f.useMemo(()=>{const J=new Map;for(const q of k)J.set(q.sessionId,q.workspaceCwd);return g&&p.workspaceCwd&&!J.has(g)&&J.set(g,p.workspaceCwd),J},[k,g,p.workspaceCwd]),Y=f.useCallback(J=>{const q=F.current;if(q.includes(J)||q.length>=v8){M(!1);return}const Z=[...q,J];E(null),C?t==null||t(Z):N(Z),M(!1)},[t,C]),V=f.useRef(!1);f.useEffect(()=>{L.length>0?V.current=!0:V.current&&n()},[L,n]),f.useEffect(()=>{C||t==null||t(L)},[L,t,C]);const j=f.useCallback(J=>{const q=F.current;if(!q.includes(J))return;const Z=q.filter(he=>he!==J);C?t==null||t(Z):N(Z)},[t,C]),ee=f.useCallback(J=>{E(q=>q===J?null:J)},[]);f.useEffect(()=>{P&&(L.length<2||!L.includes(P))&&E(null)},[L,P]),f.useEffect(()=>{if(!P)return;const J=q=>{q.key!=="Escape"||q.defaultPrevented||$||Vp(q.target)||E(null)};return document.addEventListener("keydown",J),()=>document.removeEventListener("keydown",J)},[P,$]);const se=f.useMemo(()=>k.filter(J=>!L.includes(J.sessionId)),[k,L]),X=L.length<v8&&se.length>0,Q=L.length>1;return l.jsxs("div",{className:fo.split,"data-testid":"split-view",children:[l.jsxs("header",{className:fo.toolbar,children:[l.jsx("button",{type:"button",className:fo.backButton,onClick:n,"aria-label":m("common.back"),title:m("common.back"),children:l.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",children:l.jsx("path",{d:"M15 18l-6-6 6-6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),l.jsx("span",{className:fo.title,children:m("splitView.title")}),l.jsx("span",{className:fo.count,children:m("splitView.count",{count:L.length})}),l.jsxs("div",{className:fo.addWrap,ref:O,children:[l.jsxs("button",{type:"button",className:fo.addButton,disabled:!X,"aria-haspopup":"listbox","aria-expanded":$,onClick:()=>M(J=>!J),children:["+ ",m("splitView.addPane")]}),$&&se.length>0&&l.jsx("ul",{className:fo.picker,role:"listbox",children:se.map(J=>{var q;return l.jsx("li",{role:"option","aria-selected":"false",children:l.jsxs("button",{type:"button",className:fo.pickerItem,onClick:()=>Y(J.sessionId),children:[l.jsx("span",{className:fo.pickerItemLabel,children:W.get(J.sessionId)??J.sessionId.slice(0,8)}),T&&l.jsx("span",{className:fo.pickerItemWorkspace,title:J.workspaceCwd,children:jC(J.workspaceCwd,(q=p.capabilities)==null?void 0:q.workspaces)})]})},J.sessionId)})})]})]}),l.jsx("div",{className:fo.panes,children:L.length===0?l.jsx("div",{className:fo.empty,children:m("splitView.empty")}):L.map(J=>{const q=I.get(J),Z=P===J,he=P!==null&&!Z;return l.jsx("div",{className:fo.paneSlot,"data-pane-hidden":he?"":void 0,children:l.jsx(Jd,{label:`split-pane:${J}`,resetKeys:[J],fallback:ye=>l.jsxs("div",{className:fo.paneError,role:"alert",children:[l.jsx("div",{className:fo.paneErrorTitle,children:W.get(J)??J.slice(0,8)}),l.jsxs("div",{className:fo.paneErrorMessage,children:[m("splitView.paneError"),": ",ye.message]}),l.jsx("button",{type:"button",className:fo.paneErrorClose,onClick:()=>j(J),children:m("splitView.closePane")})]}),children:l.jsx(XG,{sessionId:J,workspaceCwd:_?q??d:void 0,clientId:`split-pane:${z}:${J}`,historyPageSize:qie,maxBlocks:Uie,suppressOwnUserEcho:!0,restartEventStreamOnPrompt:h,children:l.jsx(Wft,{title:W.get(J),workspaceCwd:q,onClose:()=>j(J),onToggleMaximize:Q?()=>ee(J):void 0,isMaximized:Z,onError:s,onSlashCommand:r,onRightPanelOpen:i,onPaneArtifactsChange:o,messageTurnOutputs:a,restartSseOnPrompt:h})})})},_?`${J}:${q??""}`:J)})})]})}const hmt="_root_1l1wz_1",fmt="_intro_1l1wz_8",mmt="_toolbar_1l1wz_14",pmt="_count_1l1wz_22",gmt="_toolbarActions_1l1wz_28",bmt="_primaryButton_1l1wz_34",ymt="_secondaryButton_1l1wz_35",xmt="_formFields_1l1wz_73",vmt="_field_1l1wz_79",wmt="_fieldGrow_1l1wz_86",kmt="_fieldLabel_1l1wz_90",_mt="_required_1l1wz_96",Smt="_input_1l1wz_107",Cmt="_textarea_1l1wz_108",Tmt="_select_1l1wz_109",Emt="_promptEditorWrap_1l1wz_127",Amt="_promptEditor_1l1wz_127",Nmt="_promptPlaceholder_1l1wz_160",jmt="_promptTag_1l1wz_174",Mmt="_promptTagIcon_1l1wz_190",Imt="_promptTagValue_1l1wz_201",Rmt="_promptTagRemove_1l1wz_211",Dmt="_referencePopover_1l1wz_239",Lmt="_referenceBar_1l1wz_243",Pmt="_referenceButton_1l1wz_250",Omt="_referenceButtonActive_1l1wz_267",Bmt="_referenceButtonIcon_1l1wz_272",$mt="_referencePicker_1l1wz_282",zmt="_referenceItem_1l1wz_295",Fmt="_referenceItemLabel_1l1wz_318",Hmt="_referenceItemDescription_1l1wz_319",qmt="_referenceEmpty_1l1wz_336",Umt="_referenceError_1l1wz_337",Vmt="_scheduleRow_1l1wz_347",Wmt="_preview_1l1wz_359",Gmt="_previewLabel_1l1wz_367",Kmt="_previewCron_1l1wz_372",Ymt="_previewInvalid_1l1wz_382",Xmt="_formError_1l1wz_387",Qmt="_loadError_1l1wz_388",Jmt="_formActions_1l1wz_394",Zmt="_empty_1l1wz_402",ept="_list_1l1wz_409",tpt="_card_1l1wz_417",npt="_cardDisabled_1l1wz_428",spt="_cardHeader_1l1wz_432",rpt="_cardTitle_1l1wz_438",ipt="_cardMenu_1l1wz_449",opt="_iconAction_1l1wz_456",apt="_toggle_1l1wz_482",lpt="_toggleOn_1l1wz_501",cpt="_toggleKnob_1l1wz_505",upt="_cardPrompt_1l1wz_520",dpt="_cardFooter_1l1wz_533",hpt="_schedulePill_1l1wz_542",fpt="_clockIcon_1l1wz_554",mpt="_recurringTag_1l1wz_559",ppt="_workspacePill_1l1wz_567",gpt="_workspaceIcon_1l1wz_584",bpt="_countdown_1l1wz_589",ypt="_hourglassIcon_1l1wz_600",xpt="_lastFired_1l1wz_605",vpt="_runsToggle_1l1wz_613",wpt="_runsList_1l1wz_630",kpt="_runsItem_1l1wz_644",Fe={root:hmt,intro:fmt,toolbar:mmt,count:pmt,toolbarActions:gmt,primaryButton:bmt,secondaryButton:ymt,formFields:xmt,field:vmt,fieldGrow:wmt,fieldLabel:kmt,required:_mt,input:Smt,textarea:Cmt,select:Tmt,promptEditorWrap:Emt,promptEditor:Amt,promptPlaceholder:Nmt,promptTag:jmt,promptTagIcon:Mmt,promptTagValue:Imt,promptTagRemove:Rmt,referencePopover:Dmt,referenceBar:Lmt,referenceButton:Pmt,referenceButtonActive:Omt,referenceButtonIcon:Bmt,referencePicker:$mt,referenceItem:zmt,referenceItemLabel:Fmt,referenceItemDescription:Hmt,referenceEmpty:qmt,referenceError:Umt,scheduleRow:Vmt,preview:Wmt,previewLabel:Gmt,previewCron:Kmt,previewInvalid:Ymt,formError:Xmt,loadError:Qmt,formActions:Jmt,empty:Zmt,list:ept,card:tpt,cardDisabled:npt,cardHeader:spt,cardTitle:rpt,cardMenu:ipt,iconAction:opt,toggle:apt,toggleOn:lpt,toggleKnob:cpt,cardPrompt:upt,cardFooter:dpt,schedulePill:hpt,clockIcon:fpt,recurringTag:mpt,workspacePill:ppt,workspaceIcon:gpt,countdown:bpt,hourglassIcon:ypt,lastFired:xpt,runsToggle:vpt,runsList:wpt,runsItem:kpt},_pt="_panel_1ycr0_1",Spt="_header_1ycr0_11",Cpt="_tabs_1ycr0_28",Tpt="_tabItem_1ycr0_37",Ept="_tab_1ycr0_28",Apt="_tabIcon_1ycr0_67",Npt="_tabIconSvg_1ycr0_77",jpt="_tabActive_1ycr0_84",Mpt="_tabCloseButton_1ycr0_99",Ipt="_tabCloseIcon_1ycr0_119",Rpt="_iconButton_1ycr0_125",Dpt="_iconButtonActive_1ycr0_143",Lpt="_toolbarIcon_1ycr0_147",Ppt="_body_1ycr0_153",Opt="_empty_1ycr0_160",Bpt="_meta_1ycr0_198",$pt="_detail_1ycr0_203",zpt="_section_1ycr0_208",Fpt="_sectionTitle_1ycr0_213",Hpt="_description_1ycr0_220",qpt="_actionsRow_1ycr0_224",Upt="_fieldGrid_1ycr0_231",Vpt="_fieldLabel_1ycr0_238",Wpt="_fieldValue_1ycr0_247",Gpt="_link_1ycr0_252",Kpt="_review_1ycr0_261",Ypt="_reviewToolbar_1ycr0_268",Xpt="_reviewToolbarTitle_1ycr0_277",Qpt="_reviewToolbarActions_1ycr0_284",Jpt="_reviewTotalsButton_1ycr0_290",Zpt="_reviewContent_1ycr0_308",e0t="_reviewContentListOnly_1ycr0_318",t0t="_reviewContentStacked_1ycr0_322",n0t="_reviewList_1ycr0_327",s0t="_reviewListWithExpanded_1ycr0_335",r0t="_reviewSplitHandle_1ycr0_348",i0t="_reviewItem_1ycr0_363",o0t="_reviewItemExpanded_1ycr0_368",a0t="_reviewRow_1ycr0_375",l0t="_fileIcon_1ycr0_396",c0t="_reviewPath_1ycr0_410",u0t="_treeName_1ycr0_411",d0t="_pathPrefix_1ycr0_427",h0t="_pathFileName_1ycr0_433",f0t="_lineStats_1ycr0_441",m0t="_additions_1ycr0_450",p0t="_deletions_1ycr0_454",g0t="_chevron_1ycr0_458",b0t="_chevronOpen_1ycr0_464",y0t="_chevronIcon_1ycr0_468",x0t="_diffPreview_1ycr0_474",v0t="_codeMirrorDiff_1ycr0_484",w0t="_codeMirrorDiffWrap_1ycr0_492",k0t="_diffError_1ycr0_500",_0t="_codeMirrorFile_1ycr0_525",S0t="_diffEmpty_1ycr0_591",C0t="_tree_1ycr0_411",T0t="_treeNode_1ycr0_604",E0t="_treeChildren_1ycr0_608",A0t="_treeRow_1ycr0_622",N0t="_treeFolder_1ycr0_655",j0t="_treeFile_1ycr0_659",M0t="_treeTwisty_1ycr0_668",I0t="_treeChevronIcon_1ycr0_677",R0t="_treeChevron_1ycr0_677",D0t="_treeChevronClosed_1ycr0_688",L0t="_treeContent_1ycr0_692",P0t="_reviewBadge_1ycr0_715",O0t="_htmlPreviewWrap_1ycr0_728",B0t="_htmlPreview_1ycr0_728",$0t="_previewError_1ycr0_744",z0t="_filePreviewWrap_1ycr0_750",Xe={panel:_pt,header:Spt,tabs:Cpt,tabItem:Tpt,tab:Ept,tabIcon:Apt,tabIconSvg:Npt,tabActive:jpt,tabCloseButton:Mpt,tabCloseIcon:Ipt,iconButton:Rpt,iconButtonActive:Dpt,toolbarIcon:Lpt,body:Ppt,empty:Opt,meta:Bpt,detail:$pt,section:zpt,sectionTitle:Fpt,description:Hpt,actionsRow:qpt,fieldGrid:Upt,fieldLabel:Vpt,fieldValue:Wpt,link:Gpt,review:Kpt,reviewToolbar:Ypt,reviewToolbarTitle:Xpt,reviewToolbarActions:Qpt,reviewTotalsButton:Jpt,reviewContent:Zpt,reviewContentListOnly:e0t,reviewContentStacked:t0t,reviewList:n0t,reviewListWithExpanded:s0t,reviewSplitHandle:r0t,reviewItem:i0t,reviewItemExpanded:o0t,reviewRow:a0t,fileIcon:l0t,reviewPath:c0t,treeName:u0t,pathPrefix:d0t,pathFileName:h0t,lineStats:f0t,additions:m0t,deletions:p0t,chevron:g0t,chevronOpen:b0t,chevronIcon:y0t,diffPreview:x0t,codeMirrorDiff:v0t,codeMirrorDiffWrap:w0t,diffError:k0t,codeMirrorFile:_0t,diffEmpty:S0t,tree:C0t,treeNode:T0t,treeChildren:E0t,treeRow:A0t,treeFolder:N0t,treeFile:j0t,treeTwisty:M0t,treeChevronIcon:I0t,treeChevron:R0t,treeChevronClosed:D0t,treeContent:L0t,reviewBadge:P0t,htmlPreviewWrap:O0t,htmlPreview:B0t,previewError:$0t,filePreviewWrap:z0t},F0t=740,H0t=700,q0t=["daily","weekdays","weekly","hourly","minutes","custom"],U0t=[1,2,3,4,5,6,10,12,15,20,30];function V0t({artifacts:e,tabs:t,activeTabId:n,reviewChanges:s,selectedReviewPath:r,panelWidth:i,workspaceCwd:o,loading:a,error:c,onSelectTab:u,onCloseTab:d,onClose:h}){const m=t.find(b=>b.id===n)??t[0],p=To(),g=(m==null?void 0:m.kind)==="artifact"||(m==null?void 0:m.kind)==="scheduled_task"?m.workspaceActions??p:p;return l.jsxs("aside",{className:Xe.panel,style:i?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[l.jsxs("div",{className:Xe.header,children:[l.jsx("div",{className:Xe.tabs,role:"tablist","aria-label":"Right panel",children:t.map(b=>l.jsxs("div",{className:[Xe.tabItem,b.id===(m==null?void 0:m.id)?Xe.tabActive:""].filter(Boolean).join(" "),children:[l.jsxs("button",{type:"button",role:"tab","aria-selected":b.id===(m==null?void 0:m.id),className:Xe.tab,onClick:()=>u(b.id),title:b.title,children:[l.jsx("span",{className:Xe.tabIcon,"aria-hidden":"true",children:b.kind==="review"?l.jsx(G0t,{}):b.kind==="artifact"?l.jsx(K0t,{}):l.jsx(Y0t,{})}),b.title]}),l.jsx("button",{type:"button",className:Xe.tabCloseButton,onClick:()=>d(b.id),"aria-label":`Close ${b.title}`,title:"Close",children:l.jsx(W0t,{})})]},b.id))}),l.jsx("button",{type:"button",className:Xe.iconButton,onClick:h,"aria-label":"Close artifacts panel",title:"Close",children:"×"})]}),l.jsx("div",{className:Xe.body,children:m?m.kind==="review"?l.jsx(J0t,{changes:s,selectedPath:r,panelWidth:i,workspaceCwd:o}):m.kind==="artifact"?l.jsx(X0t,{artifacts:e,artifactId:m.artifactId,workspaceActions:g,previewContent:m.previewContent,loading:a,error:c}):l.jsx(Q0t,{task:m.task,actions:g},m.id):l.jsx("div",{className:Xe.empty,children:"No panel selected."})})]})}function W0t(){return l.jsx("svg",{className:Xe.tabCloseIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:l.jsx("path",{d:"m4.5 4.5 7 7M11.5 4.5l-7 7",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function G0t(){return l.jsxs("svg",{className:Xe.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[l.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),l.jsx("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),l.jsx("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function K0t(){return l.jsxs("svg",{className:Xe.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[l.jsx("rect",{x:"6",y:"4",width:"12",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"1.8"}),l.jsx("path",{d:"M9 10h6M9 14h4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function Y0t(){return l.jsxs("svg",{className:Xe.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[l.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),l.jsx("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function X0t({artifacts:e,artifactId:t,workspaceActions:n,previewContent:s,loading:r,error:i}){const o=e.find(a=>a.id===t);return o?l.jsx(ugt,{artifact:o,workspaceActions:n,previewContent:s}):r?l.jsx("div",{className:Xe.empty,children:"Loading artifact..."}):i?l.jsx("div",{className:Xe.empty,children:i}):l.jsx("div",{className:Xe.empty,children:"Artifact not found."})}function Q0t({task:e,actions:t}){const{t:n}=ot(),[s,r]=f.useState(null),[i,o]=f.useState(!0),[a,c]=f.useState(null),[u,d]=f.useState(""),[h,m]=f.useState(e.prompt),[p,g]=f.useState(()=>$h(e.cron)),[b,v]=f.useState(!1),[x,y]=f.useState(!1),[w,k]=f.useState(!1),[T,_]=f.useState(!1),[C,S]=f.useState(null),L=f.useCallback(async()=>{if(!e.durable){r(null),d(""),m(e.prompt),g($h(e.cron)),c(null),o(!1);return}o(!0),c(null);try{const X=(await t.listScheduledTasks()).find(Q=>Q.id===e.id)??null;r(X),X?(d(X.name??""),m(X.prompt),g($h(X.cron))):(d(""),m(e.prompt),g($h(e.cron)))}catch(se){c(se instanceof Error?se.message:String(se))}finally{o(!1)}},[t,e.cron,e.durable,e.id,e.prompt]);f.useEffect(()=>{L()},[L]);const N=!e.durable,$=e.durable&&!i&&!a&&!s,M=!!s,P=(s==null?void 0:s.name)||(s==null?void 0:s.prompt)||e.title,E=(s==null?void 0:s.prompt)??e.prompt,O=(s==null?void 0:s.cron)??e.cron,z=(s==null?void 0:s.recurring)??e.recurring,F=s==null?void 0:s.enabled,B=f.useCallback(()=>{s&&(d(s.name??""),m(s.prompt),g($h(s.cron)),S(null),v(!0))},[s]),W=f.useCallback(()=>{v(!1),S(null),s&&(d(s.name??""),m(s.prompt),g($h(s.cron)))},[s]),I=f.useCallback(async()=>{if(!s)return;const se=b4(p);if(!se){S(n("scheduledTasks.error.invalidSchedule"));return}if(h.trim().length===0){S(n("scheduledTasks.error.emptyPrompt"));return}_(!0),S(null);try{const X=await t.updateScheduledTask(s.id,{cron:se,prompt:h.trim(),name:u.trim()||null});r(X),d(X.name??""),m(X.prompt),g($h(X.cron)),v(!1)}catch(X){S(X instanceof Error?X.message:String(X))}finally{_(!1)}},[t,p,s,u,h,n]),Y=f.useCallback(async()=>{if(s){k(!0),S(null);try{const se=await t.updateScheduledTask(s.id,{enabled:!s.enabled});r(se)}catch(se){S(se instanceof Error?se.message:String(se))}finally{k(!1)}}},[t,s]),V=f.useCallback(async()=>{if(s){k(!0),S(null);try{await t.deleteScheduledTask(s.id),r(null),y(!1)}catch(se){S(se instanceof Error?se.message:String(se))}finally{k(!1)}}},[t,s]),j=b4(p),ee=j?pv(j,n):null;return l.jsxs("div",{className:Xe.detail,children:[i&&l.jsx("div",{className:Xe.empty,children:n("scheduledTasks.loading")}),a&&l.jsx("div",{className:Fe.loadError,children:a}),$&&l.jsx("div",{className:Xe.empty,children:n("scheduledTasks.deletedSnapshot")}),N&&l.jsx("div",{className:Xe.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!$&&l.jsx("div",{className:Xe.section,children:l.jsxs("div",{className:Xe.fieldGrid,children:[l.jsx("span",{className:Xe.fieldLabel,children:n("scheduledTasks.name")}),l.jsx("span",{className:Xe.fieldValue,children:P}),l.jsx("span",{className:Xe.fieldLabel,children:n("scheduledTasks.taskId")}),l.jsx("span",{className:Xe.fieldValue,children:e.id}),l.jsx("span",{className:Xe.fieldLabel,children:n("scheduledTasks.schedule")}),l.jsx("span",{className:Xe.fieldValue,children:pv(O,n)}),l.jsx("span",{className:Xe.fieldLabel,children:"Cron"}),l.jsx("span",{className:Xe.fieldValue,children:O}),l.jsx("span",{className:Xe.fieldLabel,children:n("scheduledTasks.type")}),l.jsx("span",{className:Xe.fieldValue,children:n(z?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),F!==void 0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Xe.fieldLabel,children:n("scheduledTasks.status")}),l.jsx("span",{className:Xe.fieldValue,children:n(F?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!$&&l.jsxs("div",{className:Xe.section,children:[l.jsx("div",{className:Xe.sectionTitle,children:"Prompt"}),l.jsx("div",{className:Xe.description,children:E})]}),C&&l.jsx("div",{className:Fe.formError,children:C}),l.jsxs("div",{className:Xe.actionsRow,children:[l.jsx("button",{type:"button",className:Fe.primaryButton,disabled:!M||w,onClick:B,children:n("scheduledTasks.edit")}),l.jsx("button",{type:"button",className:Fe.secondaryButton,disabled:!M||w,onClick:()=>void Y(),children:s!=null&&s.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),l.jsx("button",{type:"button",className:Fe.secondaryButton,disabled:!M||w,onClick:()=>y(!0),children:n("scheduledTasks.delete")})]}),x&&s&&l.jsx(si,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>y(!1),children:l.jsxs("div",{className:Fe.formFields,children:[l.jsx("div",{className:Xe.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),C&&l.jsx("div",{className:Fe.formError,children:C}),l.jsxs("div",{className:Fe.formActions,children:[l.jsx("button",{type:"button",className:Fe.secondaryButton,onClick:()=>y(!1),disabled:w,children:n("scheduledTasks.cancel")}),l.jsx("button",{type:"button",className:Fe.primaryButton,onClick:()=>void V(),disabled:w,children:n("scheduledTasks.delete")})]})]})}),b&&l.jsx(si,{title:n("scheduledTasks.editTitle"),size:"md",onClose:W,children:l.jsxs("div",{className:Fe.formFields,children:[l.jsxs("label",{className:Fe.field,children:[l.jsx("span",{className:Fe.fieldLabel,children:n("scheduledTasks.name")}),l.jsx("input",{className:Fe.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:se=>d(se.target.value)})]}),l.jsxs("label",{className:Fe.field,children:[l.jsxs("span",{className:Fe.fieldLabel,children:[n("scheduledTasks.prompt"),l.jsx("span",{className:Fe.required,children:"*"})]}),l.jsx("textarea",{className:Fe.textarea,value:h,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:se=>m(se.target.value)})]}),l.jsxs("div",{className:Fe.scheduleRow,children:[l.jsxs("label",{className:Fe.field,children:[l.jsx("span",{className:Fe.fieldLabel,children:n("scheduledTasks.frequency")}),l.jsx("select",{className:Fe.select,value:p.frequency,onChange:se=>{const X=se.target.value;g(Q=>({...Q,frequency:X,...X==="hourly"?{time:"00:00"}:{}}))},children:q0t.map(se=>l.jsx("option",{value:se,children:n(`scheduledTasks.freq.${se}`)},se))})]}),(p.frequency==="daily"||p.frequency==="weekdays"||p.frequency==="weekly")&&l.jsxs("label",{className:Fe.field,children:[l.jsx("span",{className:Fe.fieldLabel,children:n("scheduledTasks.time")}),l.jsx("input",{className:Fe.input,type:"time",value:p.time,onChange:se=>g(X=>({...X,time:se.target.value}))})]}),p.frequency==="weekly"&&l.jsxs("label",{className:Fe.field,children:[l.jsx("span",{className:Fe.fieldLabel,children:n("scheduledTasks.weekday")}),l.jsx("select",{className:Fe.select,value:p.weekday,onChange:se=>g(X=>({...X,weekday:Number(se.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((se,X)=>l.jsx("option",{value:X,children:se},X))})]}),p.frequency==="minutes"&&l.jsxs("label",{className:Fe.field,children:[l.jsx("span",{className:Fe.fieldLabel,children:n("scheduledTasks.interval")}),l.jsx("select",{className:Fe.select,value:p.minuteInterval,onChange:se=>g(X=>({...X,minuteInterval:Number(se.target.value)})),children:U0t.map(se=>l.jsx("option",{value:se,children:se},se))})]}),p.frequency==="custom"&&l.jsxs("label",{className:`${Fe.field} ${Fe.fieldGrow}`,children:[l.jsx("span",{className:Fe.fieldLabel,children:n("scheduledTasks.cron")}),l.jsx("input",{className:Fe.input,type:"text",value:p.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:se=>g(X=>({...X,customCron:se.target.value}))})]})]}),l.jsx("div",{className:Fe.preview,children:ee?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Fe.previewLabel,children:ee}),l.jsx("code",{className:Fe.previewCron,children:j})]}):l.jsx("span",{className:Fe.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),C&&l.jsx("div",{className:Fe.formError,children:C}),l.jsxs("div",{className:Fe.formActions,children:[l.jsx("button",{type:"button",className:Fe.secondaryButton,onClick:W,disabled:T,children:n("scheduledTasks.cancel")}),l.jsx("button",{type:"button",className:Fe.primaryButton,onClick:()=>void I(),disabled:T,children:n(T?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function J0t({changes:e,selectedPath:t,panelWidth:n,workspaceCwd:s}){const{t:r}=ot(),[i,o]=f.useState(()=>!n||n>=F0t),[a,c]=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),[v,x]=f.useState(null),y=i,w=f.useMemo(()=>lgt(e,s),[e,s]);f.useEffect(()=>{x(t)},[t]),f.useEffect(()=>{p.current=h},[h]),f.useEffect(()=>{const C=g.current;if(!C)return;const S=()=>{d(C.clientWidth<H0t)};S();const L=new ResizeObserver(S);return L.observe(C),()=>L.disconnect()},[a]),f.useEffect(()=>()=>{var C;return(C=b.current)==null?void 0:C.call(b)},[]);const k=f.useCallback(C=>{const S=g.current;if(!S)return;C.preventDefault();const L=C.currentTarget;L.setPointerCapture(C.pointerId);const N=C.clientX,$=p.current,M=S.getBoundingClientRect().width,P=Math.max(180,M-180),E=document.body.style.cursor,O=document.body.style.userSelect;let z=$,F=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const B=()=>{F=null,m(z)},W=V=>{z=Math.min(P,Math.max(180,$+(V.clientX-N))),F===null&&(F=window.requestAnimationFrame(B))};let I=()=>{};const Y=V=>{b.current=null,F!==null&&(window.cancelAnimationFrame(F),F=null),V&&m(z),L.hasPointerCapture(C.pointerId)&&L.releasePointerCapture(C.pointerId),document.body.style.cursor=E,document.body.style.userSelect=O,window.removeEventListener("pointermove",W),window.removeEventListener("pointerup",I),window.removeEventListener("pointercancel",I)};I=()=>Y(!0),b.current=()=>Y(!1),window.addEventListener("pointermove",W),window.addEventListener("pointerup",I),window.addEventListener("pointercancel",I)},[]);if(e.length===0)return l.jsx("div",{className:Xe.empty,children:"No file changes to review."});const T=Cie(e),_=C=>{x(S=>S===C?null:C)};return l.jsxs("div",{className:Xe.review,children:[l.jsxs("div",{className:Xe.reviewToolbar,children:[l.jsxs("div",{className:Xe.reviewToolbarTitle,children:[l.jsx("span",{children:r("turnOutputs.previousTurn")}),l.jsx(y4,{additions:T==null?void 0:T.additions,deletions:T==null?void 0:T.deletions,className:Xe.lineStats,additionsClassName:Xe.additions,deletionsClassName:Xe.deletions})]}),l.jsxs("div",{className:Xe.reviewToolbarActions,children:[l.jsxs("button",{type:"button",className:Xe.reviewTotalsButton,onClick:()=>c(C=>!C),"aria-expanded":a,children:[l.jsx("span",{children:r("turnOutputs.fileCount",{count:e.length})}),l.jsx("span",{className:[Xe.chevron,a?Xe.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:l.jsx(kq,{})})]}),l.jsx("button",{type:"button",className:[Xe.iconButton,i?Xe.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>o(C=>!C),"aria-label":r(i?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:r(i?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:i?l.jsx(ogt,{}):l.jsx(igt,{})})]})]}),a&&l.jsxs("div",{ref:g,className:[Xe.reviewContent,y?"":Xe.reviewContentListOnly,y&&u?Xe.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${h}px`},children:[l.jsx("div",{className:[Xe.reviewList,v?Xe.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(C=>{const S=v===C.path;return l.jsxs("div",{className:[Xe.reviewItem,S?Xe.reviewItemExpanded:""].filter(Boolean).join(" "),children:[l.jsxs("button",{type:"button",className:Xe.reviewRow,"data-selected":C.path===t||void 0,onClick:()=>_(C.path),children:[l.jsx("span",{className:Xe.fileIcon,children:qoe(C.path)}),l.jsx(ngt,{path:YI(C.path,s),title:C.path}),l.jsx(y4,{additions:C.additions,deletions:C.deletions,className:Xe.lineStats,additionsClassName:Xe.additions,deletionsClassName:Xe.deletions}),l.jsx("span",{className:[Xe.chevron,S?Xe.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:l.jsx(kq,{})})]}),S&&l.jsx(Z0t,{change:C})]},`${C.toolCallId}:${C.path}`)})}),y&&!u&&l.jsx("div",{className:Xe.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:k}),y&&l.jsx("div",{className:Xe.tree,children:w.children.map(C=>l.jsx(zoe,{node:C,depth:0,selectedPath:t},C.path))})]})]})}function Z0t({change:e}){if(e.diffs.length===0)return l.jsx("div",{className:Xe.diffEmpty,children:"No diff available."});const t=egt(e.diffs);return l.jsx("div",{className:Xe.diffPreview,children:t.map((n,s)=>l.jsx(tgt,{oldText:n.oldText,newText:n.newText},s))})}function egt(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 tgt({oldText:e,newText:t}){const n=f.useRef(null),[s,r]=f.useState(null),[i,o]=f.useState(null);return f.useEffect(()=>{const a=n.current;if(!a)return;const c=()=>r(a.clientWidth>=720);c();const u=new ResizeObserver(c);return u.observe(a),()=>u.disconnect()},[]),f.useEffect(()=>{const a=n.current;if(!a||s===null)return;a.replaceChildren(),o(null);let c=!1,u=null;const d=[Are,Nt.editable.of(!1),Ks.readOnly.of(!0),Nt.lineWrapping],h={scanLimit:1e3,timeout:500},m={margin:3,minSize:8};return ie(async()=>{const{MergeView:p,unifiedMergeView:g}=await import("./index-Cl8d-1bK.js");return{MergeView:p,unifiedMergeView:g}},[]).then(({MergeView:p,unifiedMergeView:g})=>{if(!c)try{if(s){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 Nt({doc:t,extensions:[...d,g({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:m,diffConfig:h})],parent:a})}catch(b){c||o(b instanceof Error?b.message:String(b))}}).catch(p=>{c||o(p instanceof Error?p.message:String(p))}),()=>{c=!0,u==null||u.destroy()}},[s,t,e]),l.jsxs("div",{className:Xe.codeMirrorDiffWrap,children:[l.jsx("div",{ref:n,className:Xe.codeMirrorDiff}),i&&l.jsxs("div",{className:Xe.diffError,children:["Diff unavailable: ",i]})]})}function zoe({node:e,depth:t,selectedPath:n}){var d,h;const s=!!e.file,[r,i]=f.useState(!0),o=[Xe.treeRow,s?Xe.treeFile:Xe.treeFolder].filter(Boolean).join(" "),a={paddingLeft:10+t*18,"--tree-row-line-left":`${19+Math.max(0,t-1)*18}px`},c={"--tree-children-line-left":`${19+t*18}px`},u=l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Xe.treeTwisty,children:!s&&l.jsx("span",{className:[Xe.treeChevron,r?"":Xe.treeChevronClosed].filter(Boolean).join(" "),children:l.jsx(agt,{})})}),l.jsxs("span",{className:Xe.treeContent,children:[s&&l.jsx("span",{className:Xe.fileIcon,children:qoe(e.path)}),l.jsx("span",{className:Xe.treeName,children:e.name})]}),((d=e.file)==null?void 0:d.isArtifact)&&l.jsx("span",{className:Xe.reviewBadge,children:"artifact"})]});return l.jsxs("div",{className:Xe.treeNode,children:[s?l.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}):l.jsx("button",{type:"button",className:o,"data-depth":t,style:a,title:e.path,"aria-expanded":r,onClick:()=>i(m=>!m),children:u}),!s&&r&&e.children.length>0&&l.jsx("div",{className:Xe.treeChildren,style:c,children:e.children.map(m=>l.jsx(zoe,{node:m,depth:t+1,selectedPath:n},m.path))})]})}function ngt({path:e,title:t}){const n=f.useRef(null),[s,r]=f.useState(()=>Foe(e));return f.useLayoutEffect(()=>{const i=n.current;if(!i)return;const o=()=>r(sgt(e,i));o();const a=new ResizeObserver(o);return a.observe(i),()=>a.disconnect()},[e]),l.jsxs("span",{ref:n,className:Xe.reviewPath,title:t??e,children:[s.prefix&&l.jsx("span",{className:Xe.pathPrefix,children:s.prefix}),l.jsx("span",{className:Xe.pathFileName,children:s.leaf})]})}function Foe(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let wq=null;function sgt(e,t){const n=Foe(e),s=t.clientWidth;if(s<=0)return n;const r=rgt(t);if(r(e)<=s)return n;const i=e.split("/").filter(Boolean),o=i.at(-1)??e,a=r(o);if(i.length<=1||a+r(".../")>s)return{prefix:"",leaf:o};let c=".../";for(let u=1;u<i.length;u++){const h=`.../${i.slice(i.length-1-u,-1).join("/")}/`;if(r(h)+a>s)break;c=h}return{prefix:c,leaf:o}}function rgt(e){wq??(wq=document.createElement("canvas"));const t=wq.getContext("2d"),n=window.getComputedStyle(e);return t&&(t.font=[n.fontStyle,n.fontVariant,n.fontWeight,n.fontSize,n.fontFamily].join(" ")),s=>(t==null?void 0:t.measureText(s).width)??s.length*8}function igt(){return l.jsxs("svg",{className:Xe.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[l.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"}),l.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 ogt(){return l.jsxs("svg",{className:Xe.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[l.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"}),l.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 kq(){return l.jsx("svg",{className:Xe.chevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:l.jsx("path",{d:"m6 4 4 4-4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function agt(){return l.jsx("svg",{className:Xe.treeChevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:l.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function lgt(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=YI(s.path,t).split("/").filter(Boolean);let i=n;for(let o=0;o<r.length;o++){const a=r[o],c=r.slice(0,o+1).join("/");let u=i.children.find(d=>d.name===a);u||(u={name:a,path:c,children:[]},i.children.push(u)),o===r.length-1&&(u.file=s),i=u}}return Hoe(n),n}function Hoe(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)Hoe(t)}function cgt(e){return Wp(e).split("/").filter(Boolean).at(-1)??e}function qoe(e){var r;const t=cgt(e),n=t.includes(".")?(r=t.split(".").pop())==null?void 0:r.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 ugt({artifact:e,workspaceActions:t,previewContent:n}){var c;const s=iGe(e),r=Ate(e.url)?e.url:void 0,i=((c=e.metadata)==null?void 0:c.artifactType)==="automation_snapshot",o=e.storage==="workspace"&&!!e.workspacePath;return o&&e.workspacePath&&dgt(e)&&e.workspacePath?l.jsx(hgt,{workspacePath:e.workspacePath,artifactVersion:e.updatedAt,workspaceActions:t,previewContent:n}):o&&e.workspacePath?l.jsx(fgt,{workspacePath:e.workspacePath,artifactVersion:e.updatedAt,workspaceActions:t}):l.jsxs("div",{className:Xe.detail,children:[l.jsxs("div",{className:Xe.section,children:[l.jsx("div",{className:Xe.sectionTitle,children:i?"Automation Snapshot":"Artifact"}),l.jsxs("div",{className:Xe.fieldGrid,children:[l.jsx(fu,{label:"Type",value:kie(e.kind)}),l.jsx(fu,{label:"Storage",value:e.storage}),l.jsx(fu,{label:"Status",value:e.status}),l.jsx(fu,{label:"Source",value:e.source}),l.jsx(fu,{label:"Size",value:_ie(e.sizeBytes)}),l.jsx(fu,{label:"Created",value:e.createdAt}),l.jsx(fu,{label:"Updated",value:e.updatedAt}),e.toolName&&l.jsx(fu,{label:"Tool",value:e.toolName}),e.toolCallId&&l.jsx(fu,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&l.jsxs("div",{className:Xe.section,children:[l.jsx("div",{className:Xe.sectionTitle,children:"Description"}),l.jsx("div",{className:Xe.description,children:e.description})]}),i&&e.metadata&&l.jsxs("div",{className:Xe.section,children:[l.jsx("div",{className:Xe.sectionTitle,children:"Details"}),l.jsxs("div",{className:Xe.fieldGrid,children:[O0(e.metadata,"automationId","Automation ID"),O0(e.metadata,"schedule","Schedule"),O0(e.metadata,"timezone","Timezone"),O0(e.metadata,"status","Status"),O0(e.metadata,"nextRunAt","Next run"),O0(e.metadata,"prompt","Prompt")]})]}),(s||r)&&l.jsxs("div",{className:Xe.section,children:[l.jsx("div",{className:Xe.sectionTitle,children:"Location"}),r?l.jsx("a",{className:Xe.link,href:r,target:"_blank",rel:"noreferrer",children:r}):l.jsx("div",{className:Xe.meta,children:s})]})]})}function dgt(e){var n;const t=((n=e.workspacePath)==null?void 0:n.toLowerCase())??"";return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")}function hgt({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s}){const[r,i]=f.useState(s??null),[o,a]=f.useState(null);return f.useEffect(()=>{let c=!1;return i(s??null),a(null),n.readWorkspaceFile(e).then(u=>{c||(i(u.content),u.truncated&&a("Preview is truncated because the file is too large."))}).catch(u=>{c||a(u instanceof Error?u.message:String(u))}),()=>{c=!0}},[t,s,n,e]),l.jsxs("div",{className:Xe.htmlPreviewWrap,children:[r===null?l.jsx("div",{className:Xe.empty,children:"Loading preview..."}):l.jsx("iframe",{className:Xe.htmlPreview,referrerPolicy:"no-referrer",sandbox:"",srcDoc:oGe(r),title:`Preview ${e}`}),o&&l.jsx("div",{className:Xe.previewError,children:o})]})}function fgt({workspacePath:e,artifactVersion:t,workspaceActions:n}){const s=f.useRef(null),[r,i]=f.useState(null),[o,a]=f.useState(null);return f.useEffect(()=>{let c=!1;return i(null),a(null),n.readWorkspaceFile(e).then(u=>{c||(i(u.content),u.truncated&&a("File is truncated because it is too large."))}).catch(u=>{c||a(u instanceof Error?u.message:String(u))}),()=>{c=!0}},[t,n,e]),f.useEffect(()=>{const c=s.current;if(!c||r===null)return;c.replaceChildren();let u;try{u=new Nt({doc:r,extensions:[Are,Nt.editable.of(!1),Ks.readOnly.of(!0),Nt.lineWrapping],parent:c})}catch(d){a(d instanceof Error?d.message:String(d));return}return()=>u.destroy()},[r]),l.jsxs("div",{className:Xe.filePreviewWrap,children:[r===null?l.jsx("div",{className:Xe.empty,children:"Loading file..."}):l.jsx("div",{ref:s,className:Xe.codeMirrorFile}),o&&l.jsx("div",{className:Xe.previewError,children:o})]})}function fu({label:e,value:t}){return t?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Xe.fieldLabel,children:e}),l.jsx("span",{className:Xe.fieldValue,children:t})]}):null}function O0(e,t,n){const s=e[t];return s==null||s===""?null:l.jsx(fu,{label:n,value:String(s)},t)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const mgt="(min-width: 1024px)";function _q(e=mgt){const[t,n]=f.useState(()=>pgt(e));return f.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const s=window.matchMedia(e);n(s.matches);const r=i=>n(i.matches);return s.addEventListener("change",r),()=>s.removeEventListener("change",r)},[e]),t}function pgt(e){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches}function Uoe(e){try{return new Date(e).toLocaleString()}catch{return String(e)}}function ggt(e,t){const n=e.kind==="catch-up"?` · ${t("scheduledTasks.runKind.catchUp")}`:e.kind==="manual"?` · ${t("scheduledTasks.runKind.manual")}`:"",s=e.withheld?` · ${t("scheduledTasks.runKind.withheld")}`:"";return`${Uoe(e.at)}${n}${s}`}function Ph(e){return`${e.workspaceId??""}:${e.id}`}const bgt=["daily","weekdays","weekly","hourly","minutes","custom"],ygt=[1,2,3,4,5,6,10,12,15,20,30],xgt=2147483647,vgt=3,wgt=3e4,gv=1e5,kgt=/[^\p{L}\p{N}_.-]/gu,Sq=/(^|[\s])(@(?:ext|mcp):(?:\\.[^\s\\]*|[^\s\\])+|\/(?:\\.[^\s\\/]*|[^\s\\/])+)(?=$|\s)/gu,_gt=["--background","--foreground","--muted","--muted-foreground","--border","--error-color","--font-mono"];function w8(e){return e.replace(kgt,"\\$&")}function k8(e){return e.replace(/\\(.)/g,"$1")}function Sgt(e){if(e.startsWith("@ext:")){const t=k8(e.slice(5));return{id:`extension:${t}`,kind:"extension",label:t,insertText:e}}if(e.startsWith("@mcp:")){const t=k8(e.slice(5));return{id:`mcp:${t}`,kind:"mcp",label:t,insertText:e}}if(e.startsWith("/")){const t=k8(e.slice(1));return t?{id:`skill:${t}`,kind:"skill",label:t,insertText:e}:null}return null}function Cgt(e){return e.displayName&&e.displayName!==e.name?e.displayName:e.description}function Tgt(e){return e.description||e.argumentHint||e.level}function Egt(e){return e.description||e.mcpStatus}function Voe(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(s=>{n+=Voe(s)}),e.tagName==="DIV"||e.tagName==="P"?`${n}
`:n}function Woe(e){let t="";return e.childNodes.forEach(n=>{t+=Voe(n)}),t}function Goe(e){return e.replace(/\u00a0/g," ").replace(/\n$/,"")}function MC(e){return Goe(Woe(e))}function Agt(e){return Goe(Woe(e))}function rR(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function _8(e,t){t&&e.appendChild(document.createTextNode(t))}function Koe(e,t,n){if(rR(e),!t)return;t.split(`
`).forEach((r,i)=>{i>0&&e.appendChild(document.createElement("br")),Ngt(e,r,n)})}function S8(e,t){let n=MC(e);return n.length>gv?(n=n.slice(0,gv),Koe(e,n,t)):n.trim().length===0&&(rR(e),n=""),n}function Cq(e,t){const n=gv-MC(e).length;n<=0||document.execCommand("insertText",!1,t.slice(0,n))}function Tq(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:Agt(n.cloneContents())}:null}function Yoe(e,t){const n=document.createElement("span");n.className=Fe.promptTag,n.contentEditable="false",n.dataset.promptTagSerialized=e.insertText.trim();const s=t0(e.kind);if(s){const o=document.createElement("span");o.className=Fe.promptTagIcon,o.style.setProperty("--composer-tag-icon-url",yC(s)),o.setAttribute("aria-hidden","true"),n.appendChild(o)}const r=document.createElement("span");r.className=Fe.promptTagValue,r.textContent=e.tagLabel??e.label,n.appendChild(r);const i=document.createElement("span");return i.className=Fe.promptTagRemove,i.setAttribute("role","button"),i.tabIndex=-1,i.dataset.promptTagRemove="",i.setAttribute("aria-label",`${t} ${e.label}`),n.appendChild(i),n}function Ngt(e,t,n){let s=0;Sq.lastIndex=0;for(const r of t.matchAll(Sq)){const[i,o,a]=r,c=r.index??0,u=Sgt(a);u&&(_8(e,t.slice(s,c)),_8(e,o),e.appendChild(Yoe(u,n)),s=c+i.length)}_8(e,t.slice(s))}function jgt(e,t,n){var c;const s=window.getSelection(),r=Yoe(t,n),i=document.createTextNode(" ");MC(e).trim().length===0&&rR(e);const o=((c=e.lastChild)==null?void 0:c.textContent)??"";e.childNodes.length>0&&!/\s$/.test(o)&&e.appendChild(document.createTextNode(" ")),e.appendChild(r),e.appendChild(i);const a=document.createRange();a.setStartAfter(i),a.collapse(!0),s==null||s.removeAllRanges(),s==null||s.addRange(a)}function Mgt(e){const t=e.parentElement,n=e.previousSibling,s=e.nextSibling;e.remove(),(s==null?void 0:s.nodeType)===Node.TEXT_NODE&&/^[ \u00a0]/.test(s.textContent??"")?s.textContent=(s.textContent??"").slice(1):(n==null?void 0:n.nodeType)===Node.TEXT_NODE&&/[ \u00a0]$/.test(n.textContent??"")&&(n.textContent=(n.textContent??"").slice(0,-1)),t==null||t.normalize()}function Igt({value:e,label:t,placeholder:n,onChange:s,insertItem:r,onInserted:i}){const{t:o}=ot(),a=o("scheduledTasks.reference.remove"),c=f.useRef(null),u=f.useRef(""),d=f.useRef("");return f.useEffect(()=>{const h=c.current;h&&(e===u.current&&a===d.current||(Koe(h,e,a),u.current=e,d.current=a))},[a,e]),f.useEffect(()=>{const h=c.current;if(!h||!r)return;jgt(h,r,a);const m=MC(h);u.current=m,s(m),h.focus(),i()},[r,s,i,a]),l.jsxs("div",{className:Fe.promptEditorWrap,children:[l.jsx("div",{ref:c,className:Fe.promptEditor,contentEditable:!0,role:"textbox","aria-label":t,"aria-multiline":"true","aria-placeholder":n,onMouseDown:h=>{h.target instanceof Element&&h.target.closest("[data-prompt-tag-remove]")&&h.preventDefault()},onClick:h=>{if(!(h.target instanceof Element))return;const m=h.target.closest("[data-prompt-tag-remove]"),p=m==null?void 0:m.closest("[data-prompt-tag-serialized]");if(!p||!h.currentTarget.contains(p))return;Mgt(p);const g=S8(h.currentTarget,a);u.current=g,s(g),h.currentTarget.focus()},onInput:h=>{const m=S8(h.currentTarget,a);u.current=m,s(m)},onPaste:h=>{h.preventDefault(),Cq(h.currentTarget,h.clipboardData.getData("text/plain"))},onDrop:h=>{h.preventDefault(),Cq(h.currentTarget,h.dataTransfer.getData("text/plain"))},onCopy:h=>{const m=Tq(h.currentTarget);m&&(h.preventDefault(),h.clipboardData.setData("text/plain",m.text))},onCut:h=>{const m=Tq(h.currentTarget);if(!m)return;h.preventDefault(),h.clipboardData.setData("text/plain",m.text),m.selection.deleteFromDocument();const p=S8(h.currentTarget,a);u.current=p,s(p)}}),e.trim().length===0&&l.jsx("div",{className:Fe.promptPlaceholder,children:n})]})}function Rgt({onRunPrompt:e,onCreateViaChat:t,onOpenSession:n,workspaces:s,lockedWorkspace:r,onError:i}){const{t:o}=ot(),a=To(),c=f.useMemo(()=>s??[],[s]),u=!r&&c.length>1,d=f.useMemo(()=>c.filter(me=>me.primary||me.trusted),[c]),h=f.useCallback(me=>me.primary?void 0:me.id,[]),m=r?h(r):void 0,[p,g]=f.useState(null),[b,v]=f.useState(null),[x,y]=f.useState(null),[w,k]=f.useState(null),[T,_]=f.useState(!1),[C,S]=f.useState(null),[L,N]=f.useState(m),[$,M]=f.useState(""),[P,E]=f.useState(""),[O,z]=f.useState(gu),[F,B]=f.useState(!1),[W,I]=f.useState(null),[Y,V]=f.useState(null),[j,ee]=f.useState([]),[se,X]=f.useState(!1),[Q,ue]=f.useState(null),[re,J]=f.useState(null),q=f.useRef(null),Z=f.useRef(null),[he,ye]=f.useState(null),[oe,we]=f.useState({}),[Ve,lt]=f.useState(null),[Et,pt]=f.useState(()=>Date.now()),je=f.useRef(!0),Ae=f.useRef(0),De=f.useRef(0);f.useEffect(()=>(je.current=!0,()=>{je.current=!1}),[]);const Ne=f.useCallback(async()=>{const me=++Ae.current;try{let qe,Mt=null;if(r?qe=(await a.listScheduledTasks(m)).map(Ft=>({...Ft,workspaceId:m,workspaceCwd:r.cwd})):u?qe=(await Promise.all(d.map(async st=>{try{return(await a.listScheduledTasks(h(st))).map(ne=>({...ne,workspaceId:h(st),workspaceCwd:st.cwd}))}catch(Tn){return Mt||(Mt=Tn instanceof Error?Tn.message:String(Tn)),[]}}))).flat():qe=await a.listScheduledTasks(),!je.current||me!==Ae.current)return;const ln=[...qe].sort((Ft,st)=>st.createdAt-Ft.createdAt);g(ln),v(Mt)}catch(qe){if(!je.current||me!==Ae.current)return;v(qe instanceof Error?qe.message:String(qe)),g(Mt=>Mt??[])}},[a,u,r,m,d,h]);f.useEffect(()=>{Ne()},[Ne]);const tt=!!(p!=null&&p.some(me=>me.nextRunAt!=null));f.useEffect(()=>{if(!tt)return;const me=window.setInterval(()=>pt(Date.now()),1e3);return()=>window.clearInterval(me)},[tt]);const Se=f.useRef(0);f.useEffect(()=>{if(!p)return;let me=1/0;for(const Ft of p)Ft.nextRunAt!=null&&Ft.nextRunAt<me&&(me=Ft.nextRunAt);if(!Number.isFinite(me))return;const qe=me-Date.now();let Mt;qe>0?(Se.current=0,Mt=Math.min(qe+2e3,xgt)):Mt=Se.current++<vgt?1e3:wgt;const ln=window.setTimeout(()=>void Ne(),Mt);return()=>window.clearTimeout(ln)},[p,Ne]);const Be=b4(O),le=Be?pv(Be,o):null,Le=f.useCallback(()=>{const me=q.current;if(!me){ye(null);return}const qe=getComputedStyle(me);we(Object.fromEntries(_gt.map(ne=>[ne,qe.getPropertyValue(ne)])));const Mt=me.getBoundingClientRect(),ln=Math.min(420,window.innerWidth-24),Ft=Math.max(12,Math.min(Mt.left,window.innerWidth-ln-12)),st=Mt.bottom+6,Tn=Math.max(140,Math.min(320,window.innerHeight-st-12));ye(ne=>{const gt={left:Ft,top:st,width:ln,maxHeight:Tn};return ne&&ne.left===gt.left&&ne.top===gt.top&&ne.width===gt.width&&ne.maxHeight===gt.maxHeight?ne:gt})},[]),sn=f.useCallback(()=>{De.current+=1,V(null),ee([]),X(!1),ue(null),J(null),ye(null),we({})},[]),Cn=f.useCallback(async me=>{const qe=++De.current;if(Y===me){sn();return}Le(),V(me),X(!0),ue(null),ee([]);try{let Mt;if(me==="extension"?Mt=((await a.loadExtensionsStatus()).extensions??[]).filter(Ft=>Ft.isActive).map(Ft=>({id:Ft.id||Ft.name,kind:me,label:Ft.name,tagLabel:Er(Ft.displayName??"")||Ft.name,description:Cgt(Ft),insertText:`@ext:${w8(Ft.name)} `})):me==="skill"?Mt=((await a.loadSkillsStatus()).skills??[]).filter(Ft=>Ft.modelInvocable).map(Ft=>({id:Ft.name,kind:me,label:Ft.name,description:Tgt(Ft),insertText:`/${w8(Ft.name)} `})):Mt=((await a.loadMcpStatus()).servers??[]).filter(Ft=>!Ft.disabled).map(Ft=>({id:Ft.name,kind:me,label:Ft.name,description:Egt(Ft),insertText:`@mcp:${w8(Ft.name)} `})),!je.current||qe!==De.current)return;ee(Mt)}catch(Mt){if(!je.current||qe!==De.current)return;ue(Mt instanceof Error?Mt.message:String(Mt))}finally{je.current&&qe===De.current&&X(!1)}},[a,Y,sn,Le]);f.useEffect(()=>{if(!Y)return;Le();const me=ln=>{const Ft=q.current,st=Z.current;Ft!=null&&Ft.contains(ln.target)||st!=null&&st.contains(ln.target)||sn()},qe=ln=>{ln.key==="Escape"&&(ln.preventDefault(),ln.stopPropagation(),sn())},Mt=()=>Le();return document.addEventListener("pointerdown",me),document.addEventListener("keydown",qe,!0),window.addEventListener("resize",Mt),window.addEventListener("scroll",Mt,!0),()=>{document.removeEventListener("pointerdown",me),document.removeEventListener("keydown",qe,!0),window.removeEventListener("resize",Mt),window.removeEventListener("scroll",Mt,!0)}},[Y,sn,Le]);const In=f.useCallback(()=>{M(""),E(""),z(gu),I(null),_(!1),S(null),N(m),sn()},[m,sn]),_t=f.useCallback(()=>{S(null),N(m),M(""),E(""),z(gu),I(null),sn(),_(!0)},[m,sn]),Te=f.useCallback(me=>{S(me.id),N(me.workspaceId),M(me.name??""),E(me.prompt),z($h(me.cron)),I(null),sn(),_(!0)},[sn]),at=f.useCallback(async()=>{const me=b4(O);if(!me){I(o("scheduledTasks.error.invalidSchedule"));return}if(P.trim().length===0){I(o("scheduledTasks.error.emptyPrompt"));return}if(P.length>gv){I(o("scheduledTasks.error.promptTooLong",{max:gv}));return}B(!0),I(null);try{if(C?await a.updateScheduledTask(C,{cron:me,prompt:P.trim(),name:$.trim()||null},L):await a.createScheduledTask({cron:me,prompt:P.trim(),name:$.trim()||null,recurring:!0,enabled:!0},L),!je.current)return;In(),await Ne()}catch(qe){if(!je.current)return;I(qe instanceof Error?qe.message:String(qe))}finally{je.current&&B(!1)}},[a,O,C,L,$,P,Ne,In,o]),ke=f.useCallback(async me=>{y(Ph(me));try{await a.updateScheduledTask(me.id,{enabled:!me.enabled},me.workspaceId),await Ne()}catch(qe){i(qe,o("scheduledTasks.error.toggleFailed"))}finally{je.current&&y(null)}},[a,i,Ne,o]),Pe=f.useCallback(async me=>{if(!(!me.enabled||w!==null)){k(me.id);try{const qe=(await a.listScheduledTasks(me.workspaceId)).find(Mt=>Mt.id===me.id);if(!qe||!qe.enabled){await Ne().catch(()=>{}),i(new Error("This task is no longer runnable."),o("scheduledTasks.error.runFailed"));return}if(qe.recurring){await e(qe.prompt,qe.sessionId);try{await a.runScheduledTask(qe.id,me.workspaceId),await Ne()}catch(Mt){i(Mt,o("scheduledTasks.error.runFailed"))}}else{await a.runScheduledTask(qe.id,me.workspaceId),await Ne();try{await e(qe.prompt,qe.sessionId)}catch(Mt){i(Mt,o("scheduledTasks.error.oneShotConsumedButFailed"));return}}}catch(qe){i(qe,o("scheduledTasks.error.runFailed"))}finally{k(null)}}},[a,i,e,Ne,w,o]),ve=f.useCallback(async me=>{const qe=me.name||me.prompt,Mt=qe.length>60?`${qe.slice(0,57)}…`:qe;if(window.confirm(o("scheduledTasks.deleteConfirm",{name:Mt}))){y(Ph(me));try{await a.deleteScheduledTask(me.id,me.workspaceId),await Ne()}catch(ln){i(ln,o("scheduledTasks.error.deleteFailed"))}finally{je.current&&y(null)}}},[a,i,Ne,o]),Ke=Y&&he?$u.createPortal(l.jsx("div",{ref:Z,className:Fe.referencePicker,role:"listbox","aria-label":o("scheduledTasks.referencePicker"),style:{...oe,left:he.left,top:he.top,width:he.width,maxHeight:he.maxHeight},onWheel:me=>{me.stopPropagation()},onTouchMove:me=>me.stopPropagation(),children:se?l.jsx("div",{className:Fe.referenceEmpty,children:o("scheduledTasks.reference.loading")}):Q?l.jsx("div",{className:Fe.referenceError,children:Q}):j.length===0?l.jsx("div",{className:Fe.referenceEmpty,children:o("scheduledTasks.reference.empty")}):j.map(me=>l.jsxs("button",{type:"button",className:Fe.referenceItem,role:"option","aria-selected":"false",onMouseDown:qe=>qe.preventDefault(),onClick:()=>{J(me),V(null)},children:[l.jsx("span",{className:Fe.referenceItemLabel,children:me.label}),me.description&&l.jsx("span",{className:Fe.referenceItemDescription,children:me.description})]},`${me.kind}:${me.id}`))}),document.body):null;return l.jsxs("div",{className:Fe.root,children:[l.jsx("div",{className:Fe.intro,children:o("scheduledTasks.subtitle")}),l.jsxs("div",{className:Fe.toolbar,children:[l.jsx("div",{className:Fe.count,children:p===null?o("scheduledTasks.loading"):o("scheduledTasks.count",{count:p.length})}),l.jsxs("div",{className:Fe.toolbarActions,children:[l.jsx("button",{type:"button",className:Fe.secondaryButton,onClick:()=>void Ne(),children:o("scheduledTasks.refresh")}),l.jsx("button",{type:"button",className:Fe.secondaryButton,onClick:t,children:o("scheduledTasks.createViaChat")}),l.jsx("button",{type:"button",className:Fe.primaryButton,onClick:_t,children:o("scheduledTasks.new")})]})]}),T&&l.jsx(si,{title:o(C?"scheduledTasks.editTitle":"scheduledTasks.new"),size:"md",onClose:In,children:l.jsxs("div",{className:Fe.formFields,children:[u&&l.jsxs("label",{className:Fe.field,children:[l.jsx("span",{className:Fe.fieldLabel,children:o("scheduledTasks.workspace")}),l.jsx("select",{className:Fe.select,value:L??"",disabled:!!C||d.length<=1,onChange:me=>N(me.target.value||void 0),children:d.map(me=>l.jsx("option",{value:h(me)??"",children:NC(me)},me.id))})]}),l.jsxs("label",{className:Fe.field,children:[l.jsx("span",{className:Fe.fieldLabel,children:o("scheduledTasks.name")}),l.jsx("input",{className:Fe.input,type:"text",value:$,maxLength:200,placeholder:o("scheduledTasks.namePlaceholder"),onChange:me=>M(me.target.value)})]}),l.jsxs("label",{className:Fe.field,children:[l.jsxs("span",{className:Fe.fieldLabel,children:[o("scheduledTasks.prompt"),l.jsx("span",{className:Fe.required,children:"*"})]}),l.jsx(Igt,{value:P,label:o("scheduledTasks.prompt"),placeholder:o("scheduledTasks.promptPlaceholder"),onChange:E,insertItem:re,onInserted:()=>J(null)})]}),l.jsx("div",{ref:q,className:Fe.referencePopover,children:l.jsx("div",{className:Fe.referenceBar,children:["extension","skill","mcp"].map(me=>{const qe=t0(me);return l.jsxs("button",{type:"button",className:`${Fe.referenceButton} ${Y===me?Fe.referenceButtonActive:""}`,"aria-expanded":Y===me,onClick:()=>void Cn(me),children:[qe&&l.jsx("span",{className:Fe.referenceButtonIcon,style:{"--composer-tag-icon-url":yC(qe)},"aria-hidden":!0}),o(`scheduledTasks.reference.${me}`)]},me)})})}),l.jsxs("div",{className:Fe.scheduleRow,children:[l.jsxs("label",{className:Fe.field,children:[l.jsx("span",{className:Fe.fieldLabel,children:o("scheduledTasks.frequency")}),l.jsx("select",{className:Fe.select,value:O.frequency,onChange:me=>{const qe=me.target.value;z(Mt=>({...Mt,frequency:qe,...qe==="hourly"?{time:"00:00"}:{}}))},children:bgt.map(me=>l.jsx("option",{value:me,children:o(`scheduledTasks.freq.${me}`)},me))})]}),(O.frequency==="daily"||O.frequency==="weekdays"||O.frequency==="weekly")&&l.jsxs("label",{className:Fe.field,children:[l.jsx("span",{className:Fe.fieldLabel,children:o("scheduledTasks.time")}),l.jsx("input",{className:Fe.input,type:"time",value:O.time,onChange:me=>z(qe=>({...qe,time:me.target.value}))})]}),O.frequency==="weekly"&&l.jsxs("label",{className:Fe.field,children:[l.jsx("span",{className:Fe.fieldLabel,children:o("scheduledTasks.weekday")}),l.jsx("select",{className:Fe.select,value:O.weekday,onChange:me=>z(qe=>({...qe,weekday:Number(me.target.value)})),children:o("scheduledTasks.weekdayNames").split(",").map((me,qe)=>l.jsx("option",{value:qe,children:me},qe))})]}),O.frequency==="minutes"&&l.jsxs("label",{className:Fe.field,children:[l.jsx("span",{className:Fe.fieldLabel,children:o("scheduledTasks.interval")}),l.jsx("select",{className:Fe.select,value:O.minuteInterval,onChange:me=>z(qe=>({...qe,minuteInterval:Number(me.target.value)})),children:ygt.map(me=>l.jsx("option",{value:me,children:me},me))})]}),O.frequency==="custom"&&l.jsxs("label",{className:`${Fe.field} ${Fe.fieldGrow}`,children:[l.jsx("span",{className:Fe.fieldLabel,children:o("scheduledTasks.cron")}),l.jsx("input",{className:Fe.input,type:"text",value:O.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:me=>z(qe=>({...qe,customCron:me.target.value}))})]})]}),l.jsx("div",{className:Fe.preview,children:le?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Fe.previewLabel,children:le}),l.jsx("code",{className:Fe.previewCron,children:Be})]}):l.jsx("span",{className:Fe.previewInvalid,children:o("scheduledTasks.error.invalidSchedule")})}),W&&l.jsx("div",{className:Fe.formError,children:W}),l.jsxs("div",{className:Fe.formActions,children:[l.jsx("button",{type:"button",className:Fe.secondaryButton,onClick:In,disabled:F,children:o("scheduledTasks.cancel")}),l.jsx("button",{type:"button",className:Fe.primaryButton,onClick:()=>void at(),disabled:F,children:o(F?C?"scheduledTasks.saving":"scheduledTasks.creating":C?"scheduledTasks.save":"scheduledTasks.create")})]})]})}),Ke,b&&l.jsx("div",{className:Fe.loadError,children:b}),p!==null&&p.length===0&&!b&&l.jsx("div",{className:Fe.empty,children:o("scheduledTasks.empty")}),l.jsx("div",{className:Fe.list,children:(p??[]).map(me=>{const qe=me.name||me.prompt,Mt=x===Ph(me);return l.jsxs("div",{className:`${Fe.card} ${me.enabled?"":Fe.cardDisabled}`,children:[l.jsxs("div",{className:Fe.cardHeader,children:[l.jsx("button",{type:"button",role:"switch","aria-checked":me.enabled,"aria-label":me.enabled?o("scheduledTasks.disable"):o("scheduledTasks.enable"),className:`${Fe.toggle} ${me.enabled?Fe.toggleOn:""}`,onClick:()=>void ke(me),disabled:Mt,children:l.jsx("span",{className:Fe.toggleKnob})}),l.jsx("div",{className:Fe.cardTitle,title:qe,children:qe}),l.jsxs("div",{className:Fe.cardMenu,children:[l.jsx("button",{type:"button",className:Fe.iconAction,onClick:()=>void Pe(me),disabled:!me.enabled||w!==null,title:o("scheduledTasks.runNow"),"aria-label":o("scheduledTasks.runNow"),children:"▶"}),l.jsx("button",{type:"button",className:Fe.iconAction,onClick:()=>Te(me),disabled:Mt,title:o("scheduledTasks.edit"),"aria-label":o("scheduledTasks.edit"),children:"✎"}),l.jsx("button",{type:"button",className:Fe.iconAction,onClick:()=>void ve(me),disabled:Mt,title:o("scheduledTasks.delete"),"aria-label":o("scheduledTasks.delete"),children:"✕"})]})]}),me.name&&l.jsx("div",{className:Fe.cardPrompt,title:me.prompt,children:me.prompt}),l.jsxs("div",{className:Fe.cardFooter,children:[u&&me.workspaceCwd&&l.jsxs("span",{className:Fe.workspacePill,title:me.workspaceCwd,children:[l.jsx("span",{className:Fe.workspaceIcon,"aria-hidden":"true",children:"⌂"}),jC(me.workspaceCwd,c)]}),l.jsxs("span",{className:Fe.schedulePill,children:[l.jsx("span",{className:Fe.clockIcon,"aria-hidden":"true",children:"◷"}),pv(me.cron,o)]}),l.jsx("span",{className:Fe.recurringTag,children:o(me.recurring?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),me.nextRunAt!=null&&l.jsxs("span",{className:Fe.countdown,"data-testid":"scheduled-task-next-run",title:o("scheduledTasks.nextRunTooltip",{when:Uoe(me.nextRunAt)}),children:[l.jsx("span",{className:Fe.hourglassIcon,"aria-hidden":"true",children:"⏳"}),sGe(me.nextRunAt-Et,o)]}),l.jsx("span",{className:Fe.lastFired,children:rGe(me,o)}),me.sessionId&&n?l.jsx("button",{type:"button",className:Fe.runsToggle,onClick:()=>n(me.sessionId),title:o("scheduledTasks.viewHistoryHint"),children:me.runs.length>0?o("scheduledTasks.viewHistory",{count:me.runs.length}):o("scheduledTasks.viewHistoryEmpty")}):me.runs.length>0&&l.jsx("button",{type:"button",className:Fe.runsToggle,"aria-expanded":Ve===Ph(me),onClick:()=>lt(ln=>ln===Ph(me)?null:Ph(me)),children:o("scheduledTasks.runHistory",{count:me.runs.length})})]}),Ve===Ph(me)&&me.runs.length>0&&l.jsx("ul",{className:Fe.runsList,children:[...me.runs].reverse().map((ln,Ft)=>l.jsx("li",{className:Fe.runsItem,children:ggt(ln,o)},`${ln.at}-${Ft}`))})]},Ph(me))})})]})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Dgt=new Set(["clear","stop","off","reset","none","cancel"]);function N9(e){return e.replace(/^\/goal\b/i,"").trim()}function Lgt(e){return/^\/goal\b/i.test(e.trim())?iR(N9(e.trim())):!1}function iR(e){return Dgt.has(e.trim().toLowerCase())}const Pgt="_root_v50oc_1",Ogt="_intro_v50oc_8",Bgt="_toolbar_v50oc_14",$gt="_count_v50oc_22",zgt="_toolbarActions_v50oc_28",Fgt="_primaryButton_v50oc_34",Hgt="_secondaryButton_v50oc_35",qgt="_formFields_v50oc_80",Ugt="_field_v50oc_86",Vgt="_fieldLabel_v50oc_93",Wgt="_required_v50oc_102",Ggt="_textarea_v50oc_59",Kgt="_formHint_v50oc_126",Ygt="_formError_v50oc_132",Xgt="_loadError_v50oc_133",Qgt="_degraded_v50oc_140",Jgt="_formActions_v50oc_148",Zgt="_empty_v50oc_156",e1t="_list_v50oc_163",t1t="_card_v50oc_169",n1t="_cardHeader_v50oc_180",s1t="_statusDot_v50oc_188",r1t="_statusDotRunning_v50oc_196",i1t="_cardTitle_v50oc_200",o1t="_cardMenu_v50oc_211",a1t="_iconAction_v50oc_218",l1t="_cardReason_v50oc_250",c1t="_reasonLabel_v50oc_262",u1t="_cardFooter_v50oc_266",d1t="_statusPill_v50oc_274",h1t="_meta_v50oc_285",f1t="_sessionLink_v50oc_290",Vs={root:Pgt,intro:Ogt,toolbar:Bgt,count:$gt,toolbarActions:zgt,primaryButton:Fgt,secondaryButton:Hgt,formFields:qgt,field:Ugt,fieldLabel:Vgt,required:Wgt,textarea:Ggt,formHint:Kgt,formError:Ygt,loadError:Xgt,degraded:Qgt,formActions:Jgt,empty:Zgt,list:e1t,card:t1t,cardHeader:n1t,statusDot:s1t,statusDotRunning:r1t,cardTitle:i1t,cardMenu:o1t,iconAction:a1t,cardReason:l1t,reasonLabel:c1t,cardFooter:u1t,statusPill:d1t,meta:h1t,sessionLink:f1t},m1t=1e4,p1t=1e3;function g1t({onCreateGoal:e,onOpenSession:t,onError:n}){const{t:s}=ot(),r=To(),[i,o]=f.useState(null),[a,c]=f.useState(0),[u,d]=f.useState(null),[h,m]=f.useState(null),[p,g]=f.useState(!1),[b,v]=f.useState(""),[x,y]=f.useState(!1),[w,k]=f.useState(null),[T,_]=f.useState(()=>Date.now()),C=f.useRef(!0),S=f.useRef(0);f.useEffect(()=>(C.current=!0,()=>{C.current=!1}),[]);const L=f.useCallback(async()=>{const E=++S.current;try{const O=await r.listGoals();if(!C.current||E!==S.current)return;o(O.goals),c(O.droppedCount),d(null)}catch(O){if(!C.current||E!==S.current)return;d(O instanceof Error?O.message:String(O)),o(z=>z??[]),c(0)}},[r]);f.useEffect(()=>{let E=!1,O=0;const z=async()=>{await L(),!E&&(O=window.setTimeout(()=>void z(),m1t))};return z(),()=>{E=!0,window.clearTimeout(O)}},[L]);const N=!!(i!=null&&i.length);f.useEffect(()=>{if(!N)return;const E=window.setInterval(()=>_(Date.now()),p1t);return()=>window.clearInterval(E)},[N]);const $=f.useCallback(()=>{v(""),k(null),g(!1)},[]),M=f.useCallback(async()=>{const E=b.trim();if(E.length===0){k(s("goals.error.emptyCondition"));return}if(iR(E)){k(s("goals.error.clearKeyword",{word:E}));return}y(!0),k(null);try{const O=await e(E);if(!C.current||O===!1)return;$()}catch(O){if(!C.current){n(O,s("goals.error.createFailed"));return}k(O instanceof Error?O.message:String(O))}finally{C.current&&y(!1)}},[b,e,n,$,s]),P=f.useCallback(async E=>{const O=E.condition.length>60?`${E.condition.slice(0,57)}…`:E.condition;if(window.confirm(s("goals.clearConfirm",{condition:O}))){m(E.sessionId);try{await r.clearGoal(E.sessionId),await L()}catch(z){n(z,s("goals.error.clearFailed"))}finally{C.current&&m(null)}}},[r,n,L,s]);return l.jsxs("div",{className:Vs.root,children:[l.jsx("div",{className:Vs.intro,children:s("goals.subtitle")}),l.jsxs("div",{className:Vs.toolbar,children:[l.jsx("div",{className:Vs.count,children:i===null?s("goals.loading"):s("goals.count",{count:i.length})}),l.jsxs("div",{className:Vs.toolbarActions,children:[l.jsx("button",{type:"button",className:Vs.secondaryButton,onClick:()=>void L(),children:s("goals.refresh")}),l.jsx("button",{type:"button",className:Vs.primaryButton,onClick:()=>{v(""),k(null),g(!0)},children:s("goals.new")})]})]}),p&&l.jsx(si,{title:s("goals.new"),size:"md",onClose:$,children:l.jsxs("div",{className:Vs.formFields,children:[l.jsxs("label",{className:Vs.field,children:[l.jsxs("span",{className:Vs.fieldLabel,children:[s("goals.condition"),l.jsx("span",{className:Vs.required,children:"*"})]}),l.jsx("textarea",{className:Vs.textarea,value:b,rows:4,placeholder:s("goals.conditionPlaceholder"),onChange:E=>v(E.target.value)})]}),l.jsx("div",{className:Vs.formHint,children:s("goals.newHint")}),w&&l.jsx("div",{className:Vs.formError,role:"alert",children:w}),l.jsxs("div",{className:Vs.formActions,children:[l.jsx("button",{type:"button",className:Vs.secondaryButton,onClick:$,disabled:x,children:s("goals.cancel")}),l.jsx("button",{type:"button",className:Vs.primaryButton,onClick:()=>void M(),disabled:x,children:s(x?"goals.creating":"goals.create")})]})]})}),u&&l.jsx("div",{className:Vs.loadError,role:"alert",children:u}),a>0&&l.jsx("div",{className:Vs.degraded,"data-testid":"goals-dropped",children:s("goals.dropped",{count:a})}),i!==null&&i.length===0&&!u&&l.jsx("div",{className:Vs.empty,children:s("goals.empty")}),l.jsx("div",{className:Vs.list,role:"list",children:(i??[]).map(E=>{const O=h===E.sessionId;return l.jsxs("div",{className:Vs.card,role:"listitem",children:[l.jsxs("div",{className:Vs.cardHeader,children:[l.jsx("span",{className:`${Vs.statusDot} ${E.hasActivePrompt?Vs.statusDotRunning:""}`,"aria-hidden":"true"}),l.jsx("div",{className:Vs.cardTitle,title:E.condition,children:E.condition}),l.jsx("div",{className:Vs.cardMenu,children:l.jsx("button",{type:"button",className:Vs.iconAction,onClick:()=>void P(E),disabled:O,title:s("goals.clear"),"aria-label":s("goals.clear"),children:"✕"})})]}),E.lastReason&&l.jsxs("div",{className:Vs.cardReason,children:[l.jsxs("span",{className:Vs.reasonLabel,children:[s("goal.lastCheck"),":"]})," ",E.lastReason]}),l.jsxs("div",{className:Vs.cardFooter,children:[l.jsx("span",{className:Vs.statusPill,children:s(E.hasActivePrompt?"goals.running":"goals.idle")}),l.jsx("span",{className:Vs.meta,children:E.iterations>0?s(E.iterations===1?"goal.turn":"goal.turns",{count:E.iterations}):s("goals.notYetEvaluated")}),l.jsx("span",{className:Vs.meta,"data-testid":"goal-elapsed",children:h4(Math.max(0,T-E.setAt))}),l.jsx("button",{type:"button",className:Vs.sessionLink,onClick:()=>t(E.sessionId),title:s("goals.openSessionHint"),"aria-label":`${s("goals.openSessionHint")}: ${E.displayName||E.sessionId}`,children:E.displayName||E.sessionId})]})]},E.sessionId)})})]})}const b1t="_extensionGrid_1aki4_1",y1t={extensionGrid:b1t};function x1t(e,t){return e&&t.some(n=>n.name===e)?e:null}function v1t(e,t){const n=t.trim().toLowerCase();return n?e.filter(s=>[s.name,s.displayName,s.description].filter(r=>!!r).some(r=>r.toLowerCase().includes(n))):[...e]}function w1t({className:e,...t}){return l.jsx(BZ,{"data-slot":"radio-group",className:Wt("grid w-full gap-2",e),...t})}function k1t({className:e,...t}){return l.jsx(FZ,{"data-slot":"radio-group-item",className:Wt("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:l.jsx(qZ,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:l.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 Xoe({className:e,orientation:t="horizontal",decorative:n=!0,...s}){return l.jsx($7e,{"data-slot":"separator",decorative:n,orientation:t,className:Wt("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",e),...s})}const Eq="update available";function ly(e){return e.displayName||e.name}function C8(e,t){return e.isActive?t("extensions.manage.status.enabled"):t("extensions.manage.status.disabled")}function T8(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 p_(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 _1t(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 pd({label:e,value:t}){return l.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[l.jsx("div",{className:"text-sm font-medium",children:ip(e)}),l.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function cy({items:e,empty:t,icon:n}){return e.length?l.jsx(ic,{children:l.jsx(Tp,{className:"flex flex-col",children:e.map((s,r)=>l.jsxs("div",{children:[r>0?l.jsx(Xoe,{}):null,l.jsxs("div",{className:"flex min-w-0 items-center gap-3 py-3 [contain-intrinsic-size:auto_44px] [content-visibility:auto]",children:[l.jsx(n,{className:"size-4 shrink-0 text-muted-foreground"}),l.jsx("span",{className:"min-w-0 break-words",children:s})]})]},s))})}):l.jsx(Hd,{className:"border",children:l.jsxs(qd,{children:[l.jsx(Ud,{variant:"icon",children:l.jsx(n,{})}),l.jsx(Vd,{children:t})]})})}function Aq({pendingInteraction:e,submitting:t,selectedPlugin:n,interactionValue:s,setSelectedPlugin:r,setInteractionValue:i,submit:o,t:a}){return l.jsx(h1,{open:!!e,onOpenChange:c=>{!c&&e&&!t&&o({cancelled:!0})},children:l.jsxs(f1,{showCloseButton:!1,className:"max-h-[calc(100vh-2rem)] overflow-y-auto sm:max-w-3xl",children:[l.jsxs(m1,{className:"items-start px-3 text-left",children:[l.jsx(g1,{children:(e==null?void 0:e.interaction.kind)==="setting"?e.interaction.setting.name:a("extensions.manage.selectExtension")}),l.jsx(qx,{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"?l.jsx(w1t,{"aria-label":a("extensions.manage.selectExtension"),value:n,onValueChange:r,className:"flex flex-col gap-2 px-3",children:e.interaction.plugins.map(c=>{var d;const u=`marketplace-plugin-${c.name}`;return l.jsxs("div",{className:"flex items-start gap-3 rounded-md border border-border p-3 has-data-[state=checked]:bg-accent/50",children:[l.jsx(k1t,{id:u,value:c.name,disabled:t,className:"mt-0.5"}),l.jsxs("label",{htmlFor:u,className:"flex min-w-0 flex-1 cursor-pointer flex-col gap-1",children:[l.jsx("span",{className:"font-medium",children:c.name}),l.jsx("span",{className:"text-sm text-muted-foreground",children:c.description??c.category??(c.source==="."||c.source==="./"?a("extensions.manage.marketplaceRoot"):c.source)??a("extensions.manage.noDescription")}),(d=c.tags)!=null&&d.length?l.jsx("span",{className:"text-xs text-muted-foreground",children:c.tags.join(" · ")}):null]})]},c.name)})}):null,(e==null?void 0:e.interaction.kind)==="marketplace_plugin"?l.jsxs(p1,{children:[l.jsx(qn,{variant:"outline",disabled:t,onClick:()=>o({cancelled:!0}),children:a("common.cancel")}),l.jsxs(qn,{disabled:t||!n,onClick:()=>o({pluginName:n}),children:[t?l.jsx($o,{}):null,e.owner==="mutation"?a("extensions.manage.update"):a("extensions.manage.install")]})]}):(e==null?void 0:e.interaction.kind)==="setting"?l.jsxs(l.Fragment,{children:[l.jsx(ri,{autoComplete:"off","aria-label":e.interaction.setting.name,type:e.interaction.setting.sensitive?"password":"text",value:s,onChange:c=>i(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!t&&(c.preventDefault(),o({value:s}))}}),l.jsxs(p1,{children:[l.jsx(qn,{variant:"outline",disabled:t,onClick:()=>o({cancelled:!0}),children:a("common.cancel")}),l.jsxs(qn,{disabled:t,onClick:()=>o({value:s}),children:[t?l.jsx($o,{}):null,e.owner==="mutation"?a("extensions.manage.update"):a("extensions.manage.install")]})]})]}):null]})})}function Qoe({onClose:e,initialFocusRef:t,embedded:n}){const{t:s}=ot(),r=Dl(),i=To(),o=qu(),[a,c]=f.useState([]),[u,d]=f.useState(null),[h,m]=f.useState(""),[p,g]=f.useState({}),[b,v]=f.useState(!1),[x,y]=f.useState(null),[w,k]=f.useState(null),[T,_]=f.useState(null),[C,S]=f.useState(null),[L,N]=f.useState(!1),[$,M]=f.useState(null),[P,E]=f.useState(!1),[O,z]=f.useState(""),[F,B]=f.useState(!1),[W,I]=f.useState(null),[Y,V]=f.useState(null),j=f.useRef(null),[ee,se]=f.useState(""),[X,Q]=f.useState(""),[ue,re]=f.useState(!1),[J,q]=f.useState(!1),Z=f.useRef(!1),he=f.useRef(null),ye=f.useRef(null),oe=f.useRef(new Map),we=f.useRef(null),[Ve,lt]=f.useState(null),Et=f.useCallback(Te=>{Te&&ye.current!==Te||(ye.current=null,j.current=null,V(null),se(""),Q(""))},[]),pt=f.useCallback((Te,at,ke)=>{j.current!==at.id&&(se(""),Q(""),j.current=at.id),ye.current=Te,V({operationId:Te,interaction:at,owner:ke})},[]),je=f.useCallback((Te=!1)=>(v(!0),i.loadExtensionsStatus().then(at=>{var Pe,ve;const ke=at.extensions??[];c(Ke=>{const me=he.current;if(!me||ke.some(Mt=>Mt.name===me))return ke;const qe=Ke.find(Mt=>Mt.name===me);return qe?[...ke,qe]:ke}),Te||_(((ve=(Pe=at.errors)==null?void 0:Pe[0])==null?void 0:ve.error)??null),d(Ke=>Ke&&he.current===Ke?Ke:x1t(Ke,ke))}).catch(at=>{_(at instanceof Error?at.message:String(at))}).finally(()=>v(!1))),[i]),Ae=f.useCallback(()=>i.checkExtensionUpdates(r.clientId).then(Te=>g(Te.states)).catch(Te=>{_(Te instanceof Error?Te.message:String(Te))}),[i,r.clientId]);f.useEffect(()=>{je()},[je]),f.useEffect(()=>{let Te=!1,at,ke=2e3;const Pe=async()=>{try{const{operations:ve}=await i.activeExtensionOperations();if(Te)return;const Ke=ve.filter(qe=>qe.operation==="install").sort((qe,Mt)=>Mt.createdAt-qe.createdAt)[0];Ke&&I(qe=>qe??{operationId:Ke.operationId,source:Ke.source??Ke.name??"extension"});const me=ve.find(qe=>qe.operation!=="install");me&&(Z.current=!0,me.operation==="uninstall"&&(he.current=me.name??"extension"),lt(qe=>qe??{operationId:me.operationId,name:me.name??"extension",operation:me.operation}),k(qe=>qe??me.name??null)),S(null),q(!0)}catch(ve){Te||(S(ve instanceof Error?ve.message:String(ve)),at=setTimeout(()=>void Pe(),ke),ke=Math.min(ke*2,3e4))}};return Pe(),()=>{Te=!0,at&&clearTimeout(at)}},[i]);const De=f.useRef((o==null?void 0:o.extensionsVersion)??0);f.useEffect(()=>{const Te=(o==null?void 0:o.extensionsVersion)??0;Te!==De.current&&(De.current=Te,g({}),je(!0))},[je,o==null?void 0:o.extensionsVersion]),f.useEffect(()=>{a.length!==0&&Ae()},[Ae,a]),f.useEffect(()=>{if(!W)return;let Te=!1,at,ke=1e3;const Pe=async()=>{var ve,Ke;try{const me=await i.extensionOperationStatus(W.operationId);if(Te)return;if(ke=1e3,me.status==="waiting_for_input"){me.interaction?(pt(me.operationId,me.interaction,"install"),at=setTimeout(()=>void Pe(),5e3)):(_(s("extensions.manage.operationFailed")),Et(W.operationId),I(null));return}if(me.status==="failed"){_(s("extensions.install.failed",{source:W.source,error:me.error??""})),Et(W.operationId),I(null);return}if(me.status==="succeeded"||me.status==="succeeded_with_refresh_error"){_(me.status==="succeeded_with_refresh_error"?s("extensions.manage.refreshFailed",{error:((ve=me.result)==null?void 0:ve.error)??""}):s("extensions.install.installed",{name:((Ke=me.result)==null?void 0:Ke.name)??W.source})),Et(W.operationId),I(null),je(!0);return}_(s("extensions.install.started",{source:W.source})),at=setTimeout(()=>void Pe(),1e3)}catch(me){if(Te)return;if(_(me instanceof Error?me.message:String(me)),me instanceof yc&&me.status===404){Et(W.operationId),I(null);return}at=setTimeout(()=>void Pe(),ke),ke=Math.min(ke*2,3e4)}};return Pe(),()=>{Te=!0,at&&clearTimeout(at)}},[i,Et,je,W,pt,s]);const Ne=f.useCallback(Te=>{if(!Y)return;const at=Y.owner,ke=()=>{at==="install"?I(Pe=>Pe&&{...Pe}):lt(Pe=>Pe&&{...Pe})};re(!0),i.respondToExtensionInteraction(Y.operationId,Y.interaction.id,Te,r.clientId).then(()=>{Et(Y.operationId),ke()}).catch(Pe=>{_(Pe instanceof Error?Pe.message:String(Pe)),Et(Y.operationId),ke()}).finally(()=>re(!1))},[i,Et,r.clientId,Y]);f.useEffect(()=>{if(!Ve)return;let Te=!1,at,ke=1e3;const Pe=async()=>{var ve;try{const Ke=await i.extensionOperationStatus(Ve.operationId);if(Te)return;if(ke=1e3,Ke.status==="waiting_for_input"){Ke.interaction?(pt(Ke.operationId,Ke.interaction,"mutation"),at=setTimeout(()=>void Pe(),5e3)):(_(s("extensions.manage.operationFailed")),Et(Ve.operationId),lt(null),k(null),Z.current=!1,Ve.operation==="uninstall"&&(he.current=null,je(!0)));return}if(Ke.status==="failed"){_(Ke.error??s("extensions.manage.operationFailed")),Et(Ve.operationId),lt(null),k(null),Z.current=!1,Ke.operation==="uninstall"&&(he.current=null,je(!0));return}if(Ke.status==="succeeded"||Ke.status==="succeeded_with_refresh_error"){Ke.status==="succeeded_with_refresh_error"?_(s("extensions.manage.refreshFailed",{error:((ve=Ke.result)==null?void 0:ve.error)??""})):Ke.operation==="uninstall"?_(null):_(_1t(Ke.operation,Ve.name,s)),Et(Ve.operationId),lt(null),k(null),Z.current=!1,Ke.operation==="uninstall"&&(he.current=null,d(null)),Ke.operation==="update"&&g(me=>{const qe={...me};return delete qe[Ve.name],qe}),je(!0);return}_(p_(Ke.operation,Ve.name,s)),at=setTimeout(()=>void Pe(),1e3)}catch(Ke){if(Te)return;if(_(Ke instanceof Error?Ke.message:String(Ke)),Ke instanceof yc&&Ke.status===404){Et(Ve.operationId),lt(null),k(null),Z.current=!1,Ve.operation==="uninstall"&&(he.current=null,je(!0));return}at=setTimeout(()=>void Pe(),ke),ke=Math.min(ke*2,3e4)}};return Pe(),()=>{Te=!0,at&&clearTimeout(at)}},[i,Et,je,Ve,pt,s]);const tt=f.useCallback(()=>{_(null),je()},[je]),Se=f.useCallback(Te=>{y(Te),_(null),g(at=>({...at,[Te]:"checking for updates"})),i.checkExtensionUpdates(r.clientId).then(at=>{g(at.states),_(T8(at.states[Te],s))}).catch(at=>{g(ke=>({...ke,[Te]:"error"})),_(at instanceof Error?at.message:String(at))}).finally(()=>y(null))},[i,r.clientId,s]),Be=f.useCallback(()=>{const Te=O.trim(),at=r.clientId;!Te||!J||W||Ve||Z.current||(B(!0),_(null),i.installExtension({source:Te,consent:!0},at).then(ke=>{I({operationId:ke.operationId,source:Te}),z(""),E(!1)}).catch(ke=>{_(ke instanceof Error?ke.message:String(ke))}).finally(()=>B(!1)))},[i,r.clientId,O,J,W,Ve]),le=f.useCallback((Te,at,ke={})=>{const Pe=r.clientId;if(!J||W||Ve||x||Z.current)return!1;Z.current=!0,ke.operation==="uninstall"&&(he.current=Te),k(Te),_(ke.startMessage??null);let ve=!1;return at(Pe).then(Ke=>{const me=Ke&&typeof Ke=="object"&&"operationId"in Ke&&typeof Ke.operationId=="string"?Ke.operationId:void 0;if(me){ve=!0,lt({operationId:me,name:Te,operation:ke.operation});return}_(s("extensions.manage.queued",{name:Te}))}).catch(Ke=>{_(Ke instanceof Error?Ke.message:String(Ke))}).finally(()=>{ve||(Z.current=!1,k(null),ke.operation==="uninstall"&&(he.current=null),je(!0))}),!0},[r.clientId,x,je,J,W,Ve,s]),Le=f.useMemo(()=>a.find(Te=>Te.name===u),[a,u]);f.useEffect(()=>{n==null||n.onDetailChange(!!Le)},[n,Le]);const sn=f.useMemo(()=>v1t(a,h),[a,h]),Cn=f.useCallback(()=>{we.current=u,d(null)},[u]);f.useEffect(()=>{var Te;u||!we.current||((Te=oe.current.get(we.current))==null||Te.focus(),we.current=null)},[u]);const In=l.jsx(E1,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(A1,{className:"text-base",children:[l.jsx(vo,{children:l.jsx(qn,{variant:"ghost",size:"icon",onClick:e,"aria-label":s("common.back"),children:l.jsx(JN,{})})}),l.jsx(vo,{children:Le?l.jsx(df,{asChild:!0,children:l.jsx("button",{type:"button",onClick:Cn,children:s("extensions.manage.title")})}):l.jsx(rc,{children:s("extensions.manage.title")})}),Le?l.jsx(hf,{}):null,Le?l.jsx(vo,{children:l.jsx(rc,{children:ly(Le)})}):null]})}),_t=n?Le?l.jsx(E1,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(A1,{className:"h-8 text-sm",children:[l.jsx(vo,{children:l.jsx(df,{asChild:!0,children:l.jsx("button",{type:"button",onClick:n.onRoot,children:s("extensions.manage.title")})})}),l.jsx(hf,{}),l.jsx(vo,{children:l.jsx(rc,{children:ly(Le)})})]})}):null:In;if(Le){const Te=Le.details,at=p[Le.name]??Le.updateState,ke=!J||W!==null||w!==null||Ve!==null,Pe=x===Le.name,ve=Le.isActive?"disable":"enable",Ke=st=>le(Le.name,Tn=>ve==="enable"?i.enableExtension(Le.name,{scope:st},Tn):i.disableExtension(Le.name,{scope:st},Tn),{operation:ve,startMessage:p_(ve,Le.name,s)}),me=(Te==null?void 0:Te.commands)??[],qe=(Te==null?void 0:Te.skills)??[],Mt=(Te==null?void 0:Te.agents)??[],ln=(Te==null?void 0:Te.mcpServers)??[],Ft=(Te==null?void 0:Te.contextFiles)??[];return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[_t,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:l.jsx(BP,{})}),l.jsx("div",{className:"min-w-0 flex-1",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h1",{className:"break-words text-2xl font-semibold",children:ly(Le)}),l.jsxs(Za,{variant:"outline",children:["v",Le.version]}),l.jsx(Za,{variant:"secondary",className:Le.isActive?"bg-[var(--success-bg)] text-[var(--success-color)]":void 0,children:C8(Le,s)})]})}),l.jsxs(Hg,{open:L,onOpenChange:N,children:[l.jsx(qg,{asChild:!0,children:l.jsx(qn,{variant:"ghost",size:"icon",disabled:ke||Pe,"aria-label":s("extensions.manage.actions"),children:ke||Pe?l.jsx($o,{}):l.jsx(Ng,{})})}),l.jsxs(Ug,{align:"end",children:[l.jsxs(N1,{children:[l.jsx(yo,{disabled:ke||x!==null,onSelect:()=>Se(Le.name),children:s("extensions.manage.checkUpdates")}),l.jsx(yo,{disabled:ke||Pe||at!==Eq,onSelect:()=>le(Le.name,st=>i.updateExtension(Le.name,st),{operation:"update",startMessage:p_("update",Le.name,s)}),children:s("extensions.manage.update")}),l.jsxs(yo,{disabled:ke||Pe,onSelect:()=>Ke("user"),children:[s(ve==="enable"?"extensions.manage.enable":"extensions.manage.disable"),"· ",s("settings.scope.user")]}),l.jsxs(yo,{disabled:ke||Pe,onSelect:()=>Ke("workspace"),children:[s(ve==="enable"?"extensions.manage.enable":"extensions.manage.disable"),"· ",s("settings.scope.workspace")]})]}),l.jsx(zit,{}),l.jsx(N1,{children:l.jsx(yo,{variant:"destructive",disabled:ke||Pe,onSelect:st=>{st.preventDefault(),N(!1),M(Le.name)},children:s("extensions.manage.uninstallAction")})})]})]})]}),T||C?l.jsxs(Ji,{children:[l.jsx(Wa,{}),l.jsx(Zi,{className:"break-words",children:T??C})]}):null,l.jsxs(ow,{defaultValue:"overview",children:[l.jsxs(aw,{className:"max-w-full overflow-x-auto",children:[l.jsx(Do,{value:"overview",children:s("extensions.manage.overview")}),l.jsxs(Do,{value:"commands",children:[ip(s("extensions.manage.commands"))," ",me.length]}),l.jsxs(Do,{value:"skills",children:[ip(s("extensions.manage.skills"))," ",qe.length]}),l.jsxs(Do,{value:"agents",children:[ip(s("extensions.manage.agents"))," ",Mt.length]}),l.jsxs(Do,{value:"mcp",children:[ip(s("extensions.manage.mcpServers"))," ",ln.length]}),l.jsxs(Do,{value:"context",children:[ip(s("extensions.manage.contextFiles"))," ",Ft.length]})]}),l.jsx(Ya,{value:"overview",className:"pt-4",children:l.jsxs(ic,{children:[l.jsxs(Ad,{children:[l.jsx(Nd,{children:s("extensions.manage.overview")}),Le.description?l.jsx(ff,{children:Le.description}):null]}),l.jsxs(Tp,{className:"grid gap-6 sm:grid-cols-2",children:[l.jsx(pd,{label:s("extensions.manage.name"),value:Le.name}),l.jsx(pd,{label:s("extensions.manage.version"),value:Le.version}),l.jsx(pd,{label:s("extensions.manage.status"),value:C8(Le,s)}),l.jsx(pd,{label:s("extensions.manage.source"),value:Le.source??"-"}),l.jsx(pd,{label:s("extensions.manage.path"),value:Le.path}),l.jsx(pd,{label:s("extensions.manage.updateStatus"),value:T8(at,s)}),l.jsx(pd,{label:s("extensions.manage.installType"),value:Le.installType??"-"}),l.jsx(pd,{label:s("extensions.manage.origin"),value:Le.originSource??"-"}),l.jsx(pd,{label:s("extensions.manage.settings"),value:((Te==null?void 0:Te.settings)??[]).join(", ")||"-"})]})]})}),l.jsx(Ya,{value:"commands",className:"pt-4",children:l.jsx(cy,{items:me,empty:s("extensions.manage.emptyCommands"),icon:Spe})}),l.jsx(Ya,{value:"skills",className:"pt-4",children:l.jsx(cy,{items:qe,empty:s("extensions.manage.emptySkills"),icon:F_})}),l.jsx(Ya,{value:"agents",className:"pt-4",children:l.jsx(cy,{items:Mt,empty:s("extensions.manage.emptyAgents"),icon:rK})}),l.jsx(Ya,{value:"mcp",className:"pt-4",children:l.jsx(cy,{items:ln,empty:s("extensions.manage.emptyMcpServers"),icon:jg})}),l.jsx(Ya,{value:"context",className:"pt-4",children:l.jsx(cy,{items:Ft,empty:s("extensions.manage.emptyContextFiles"),icon:Mpe})})]})]}),l.jsx(y9,{open:$===Le.name,onOpenChange:st=>{st||M(null)},children:l.jsxs(x9,{children:[l.jsxs(v9,{className:"place-items-start text-left",children:[l.jsx(k9,{children:s("extensions.manage.uninstallAction")}),l.jsx(_9,{children:s("extensions.manage.uninstallConfirm",{name:Le.name})})]}),l.jsxs(w9,{children:[l.jsx(S9,{children:s("common.cancel")}),l.jsx(Qie,{variant:"destructive",onClick:()=>{$&&le($,st=>i.uninstallExtension($,st),{operation:"uninstall",startMessage:p_("uninstall",$,s)})&&M(null)},children:s("extensions.manage.uninstallAction")})]})]})}),l.jsx(Aq,{pendingInteraction:Y,submitting:ue,selectedPlugin:X,interactionValue:ee,setSelectedPlugin:Q,setInteractionValue:se,submit:Ne,t:s})]})}return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[_t,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{ref:t,tabIndex:-1,className:"text-2xl font-semibold outline-none",children:s("extensions.manage.title")}),l.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:s("extensions.manage.count",{count:a.length})})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[l.jsxs(qn,{variant:"outline",disabled:b,onClick:tt,children:[b?l.jsx($o,{}):l.jsx(Yy,{"data-icon":"inline-start"}),s("common.refresh")]}),l.jsxs(qn,{disabled:!J||!!(W||Ve||w),onClick:()=>E(!0),children:[l.jsx(Ax,{"data-icon":"inline-start"}),s("extensions.manage.add")]})]})]}),T||C?l.jsxs(Ji,{children:[l.jsx(Wa,{}),l.jsx(Zi,{className:"break-words",children:T??C})]}):null,l.jsxs("div",{className:"relative",children:[l.jsx(Zd,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(ri,{name:"extension-search","aria-label":s("extensions.manage.search"),autoComplete:"off",value:h,onChange:Te=>m(Te.target.value),placeholder:s("extensions.manage.search"),className:"pl-9"})]}),sn.length?l.jsx("div",{className:y1t.extensionGrid,"data-column-count":Math.min(sn.length,4),children:sn.map(Te=>{const at=p[Te.name]??Te.updateState;return l.jsx(ic,{ref:ke=>{ke?oe.current.set(Te.name,ke):oe.current.delete(Te.name)},size:"sm",role:"button",tabIndex:0,"aria-label":ly(Te),className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>d(Te.name),onKeyDown:ke=>{(ke.key==="Enter"||ke.key===" ")&&(ke.preventDefault(),d(Te.name))},children:l.jsx(Ad,{className:"block",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:l.jsx(BP,{className:"size-5"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[l.jsx(Nd,{className:"min-w-0 truncate",children:ly(Te)}),l.jsx("div",{className:"flex shrink-0 justify-end",children:l.jsx(Za,{variant:"secondary",className:Te.isActive?"bg-[var(--success-bg)] text-[10px] text-[var(--success-color)]":"text-[10px]",children:C8(Te,s)})})]}),at===Eq?l.jsx("div",{className:"mt-1",children:l.jsx(Za,{className:"text-[10px]",children:T8(at,s)})}):null,l.jsx(ff,{className:"mt-1 truncate text-xs",children:Te.description||s("extensions.manage.noDescription")})]})]})})},Te.id||Te.name)})}):l.jsx(Hd,{className:"border",children:l.jsxs(qd,{children:[l.jsx(Ud,{variant:"icon",children:h?l.jsx(Zd,{}):l.jsx(upe,{})}),l.jsx(Vd,{children:s(h?"extensions.manage.noMatches":"extensions.manage.empty")}),h?null:l.jsx(iw,{children:s("extensions.manage.emptyDescription")})]})})]}),l.jsx(y9,{open:P,onOpenChange:Te=>{(Te||!F)&&E(Te)},children:l.jsxs(x9,{size:"middle",children:[l.jsxs(v9,{className:"place-items-start text-left",children:[l.jsx(k9,{children:s("extensions.manage.add")}),l.jsx(_9,{children:s("extensions.manage.installDescription")})]}),l.jsx(ri,{id:"extension-source",name:"extension-source","aria-label":s("extensions.manage.installDescription"),autoComplete:"off",value:O,onChange:Te=>z(Te.target.value),placeholder:s("extensions.manage.sourcePlaceholder")}),l.jsxs(w9,{children:[l.jsx(S9,{disabled:F,children:s("common.cancel")}),l.jsxs(qn,{disabled:F||!J||!!(W||Ve||w)||!O.trim(),onClick:Be,children:[F?l.jsx($o,{}):null,s("extensions.manage.install")]})]})]})}),l.jsx(Aq,{pendingInteraction:Y,submitting:ue,selectedPlugin:X,interactionValue:ee,setSelectedPlugin:Q,setInteractionValue:se,submit:Ne,t:s})]})}const S1t="_connectedBadge_1erz5_1",C1t="_serverGrid_1erz5_6",Joe={connectedBadge:S1t,serverGrid:C1t};function T1t({className:e,...t}){return l.jsx("textarea",{"data-slot":"textarea",className:Wt("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 g_=`{
  "command": "",
  "args": []
}`;function IC(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 m2(e){const t=IC(e);return t==="workspace_settings"?"workspace":t==="extension"?"extension":"user"}function E1t(e){const t=IC(e);return t==="extension"||t==="workspace_settings"||t==="user_settings"}function Nq(e,t){const n=m2(e);return t(n==="workspace"?"mcp.source.workspace":n==="extension"?"mcp.source.extension":"mcp.source.user")}function jq(e,t){var s;const n=(s=e.settings.find(r=>r.key==="mcpServers"))==null?void 0:s.values[t];return!n||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n))}function Mq(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"?Joe.connectedBadge:""}function A1t(e,t){var s;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} ${((s=n.args)==null?void 0:s.join(" "))??""} (stdio)`.trim():e.transport?`(${e.transport})`:t("mcp.status.unknown")}function N1t(e,t){const n=[],s=!!e.approvalState,r=IC(e);return(r==="user_settings"||r==="workspace_settings")&&n.push({id:"edit",label:t("mcp.action.edit")}),!e.disabled&&!s&&!e.requiresAuth&&e.mcpStatus==="disconnected"&&n.push({id:"reconnect",label:t("mcp.action.reconnect")}),!e.disabled&&s&&n.push({id:"approve",label:t("mcp.action.approve")}),(r!=="extension"||e.disabled)&&n.push({id:e.disabled?"enable":"disable",label:e.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),!e.disabled&&!s&&(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 E8(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,t("mcp.oauth.starting",{name:e}),n].filter(Boolean).join(`
`)}function j1t(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function M1t(e,t){const n=e.annotations??{},s=[];return n.destructiveHint&&s.push(t("mcp.annotation.destructive")),n.readOnlyHint&&s.push(t("mcp.annotation.readOnly")),n.openWorldHint&&s.push(t("mcp.annotation.openWorld")),n.idempotentHint&&s.push(t("mcp.annotation.idempotent")),s.join(", ")}function yl({label:e,value:t}){return l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("div",{className:"text-sm font-medium",children:e}),l.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function I1t({tool:e,t}){var i;const n=M1t(e,t),s=e.schema,r=(s==null?void 0:s.parametersJsonSchema)??(s==null?void 0:s.parameters)??s;return l.jsxs("div",{className:"flex flex-col gap-5",children:[e.isValid?null:l.jsxs(Ji,{variant:"destructive",children:[l.jsx(Wa,{}),l.jsx(ap,{children:t("mcp.invalidToolWarning")}),l.jsxs(Zi,{children:[e.invalidReason||t("mcp.status.unknown"),l.jsx("span",{className:"mt-1 block",children:t("mcp.invalidToolHelp")})]})]}),l.jsx(yl,{label:t("mcp.description"),value:((i=e.description)==null?void 0:i.trim())||t("mcp.noDescription")}),n?l.jsx(yl,{label:t("mcp.annotations"),value:n}):null,l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("div",{className:"text-sm font-medium",children:t("mcp.inputSchema")}),r?l.jsx("pre",{className:"max-h-96 overflow-auto rounded-lg bg-muted p-4 text-xs leading-relaxed",children:JSON.stringify(r,null,2)}):l.jsx("div",{className:"text-sm text-muted-foreground",children:t("mcp.noSchema")})]})]})}function R1t({resource:e,t}){const n=e.title||e.name||"";return l.jsxs("div",{className:"flex flex-col gap-5",children:[l.jsx(yl,{label:t("mcp.resource.uriLabel"),value:e.uri}),n&&n!==e.uri?l.jsx(yl,{label:t("mcp.resource.nameLabel"),value:n}):null,e.mimeType?l.jsx(yl,{label:t("mcp.resource.mimeTypeLabel"),value:e.mimeType}):null,typeof e.size=="number"?l.jsx(yl,{label:t("mcp.resource.sizeLabel"),value:t("mcp.resource.bytes",{count:e.size})}):null,e.description?l.jsx(yl,{label:t("mcp.description"),value:e.description.trim()}):null]})}function Zoe({message:e,onClose:t,embedded:n}){var ln,Ft,st,Tn;const{t:s}=ot(),r=ZG({autoLoad:!1}),i=tK({autoLoad:!1}),[o,a]=f.useState(e.status),[c,u]=f.useState(e.toolsByServer),[d,h]=f.useState(e.resourcesByServer??{}),[m,p]=f.useState(null),[g,b]=f.useState(null),[v,x]=f.useState(null),[y,w]=f.useState("overview"),[k,T]=f.useState(""),[_,C]=f.useState("all"),[S,L]=f.useState(null),[N,$]=f.useState(!1),[M,P]=f.useState(!1),[E,O]=f.useState(!1),[z,F]=f.useState(null),[B,W]=f.useState(""),[I,Y]=f.useState(""),[V,j]=f.useState("workspace"),[ee,se]=f.useState(g_),[X,Q]=f.useState(!1),[ue,re]=f.useState(null),[J,q]=f.useState(null),[Z,he]=f.useState(null),[ye,oe]=f.useState({}),we=f.useRef(e.status.discoveryState==="completed"),Ve=f.useRef(!0);f.useEffect(()=>(Ve.current=!0,()=>{Ve.current=!1}),[]);const lt=f.useCallback(async()=>(await new Promise(ne=>window.setTimeout(ne,1500)),Ve.current),[]),Et=f.useCallback(async(ne,gt=!0,bt=!1)=>{var It;if(await(ne==="initialize"?r.initialize():r.reloadConfig()),!Ve.current)return!1;for(let Rt=0;Rt<40;Rt+=1){if(!await lt())return!1;const We=await r.reload();if(!Ve.current)return!1;if(We){if((!bt||We.discoveryState==="completed")&&a(Zn=>gt&&We.servers.length===0&&Zn.servers.length>0?{...We,servers:Zn.servers}:We),(It=We.errors)!=null&&It.length)return gt&&he({text:We.errors.map(Zn=>Zn.error||Zn.hint||Zn.kind).join(`
`),error:!0}),!1;if(We.discoveryState==="completed")return gt&&he(null),!0;if(We.initialized&&We.discoveryState==="not_started"&&We.servers.length===0)return bt&&a(We),gt&&he({text:s("mcp.discovery.empty")}),!0}}return gt&&he({text:s("mcp.discovery.timeout"),error:!0}),!1},[r,s,lt]);f.useEffect(()=>{we.current||(we.current=!0,$(!0),Et("initialize").catch(ne=>{Ve.current&&he({text:ba(ne),error:!0})}).finally(()=>{Ve.current&&$(!1)}))},[Et]);const pt=f.useMemo(()=>(o.servers??[]).filter(E1t),[o.servers]),je=pt.find(ne=>ne.name===m)??null,Ae=je?((ln=c[je.name])==null?void 0:ln.tools)??[]:[],De=je?((Ft=d[je.name])==null?void 0:Ft.resources)??[]:[],Ne=Ae.find(ne=>ne.name===g)??null,tt=De.find(ne=>ne.uri===v)??null;f.useEffect(()=>{n==null||n.onDetailChange(!!je)},[n,je]);const Se=f.useMemo(()=>{const ne=k.trim().toLowerCase();return pt.filter(gt=>{var Rt,We;const bt=_==="all"||m2(gt)===_,It=!ne||gt.name.toLowerCase().includes(ne)||((Rt=gt.description)==null?void 0:Rt.toLowerCase().includes(ne))||((We=gt.extensionName)==null?void 0:We.toLowerCase().includes(ne));return bt&&!!It})},[k,pt,_]),Be=f.useCallback(async ne=>{const gt=[],[bt,It]=await Promise.allSettled([r.loadTools(ne.name),ne.resourceCount?r.loadResources(ne.name):Promise.resolve(null)]);if(bt.status==="fulfilled")u(Rt=>({...Rt,[ne.name]:bt.value})),oe(Rt=>({...Rt,[ne.name]:{...Rt[ne.name],tools:void 0}}));else{gt.push(bt.reason);const Rt=ba(bt.reason);oe(We=>({...We,[ne.name]:{...We[ne.name],tools:Rt}}))}if(It.status==="fulfilled"&&It.value!==null){const Rt=It.value;h(We=>({...We,[ne.name]:Rt})),oe(We=>({...We,[ne.name]:{...We[ne.name],resources:void 0}}))}else if(It.status==="rejected"){gt.push(It.reason);const Rt=ba(It.reason);oe(We=>({...We,[ne.name]:{...We[ne.name],resources:Rt}}))}else h(Rt=>{if(!(ne.name in Rt))return Rt;const We={...Rt};return delete We[ne.name],We}),oe(Rt=>({...Rt,[ne.name]:{...Rt[ne.name],resources:void 0}}));if(gt.length>0)throw new AggregateError(gt,`${ne.name}: ${gt.map(ba).join("; ")}`)},[r]),le=f.useCallback(async()=>{if(!M){P(!0),he(null);try{const ne=await r.reload();if(!ne)return;a(ne)}catch(ne){he({text:ba(ne),error:!0})}finally{P(!1)}}},[r,M]),Le=f.useCallback(async()=>{const ne=B.trim(),gt=z!==null;if(!ne){re(s("mcp.add.nameRequired"));return}let bt;try{const Rt=JSON.parse(ee);if(!Rt||typeof Rt!="object"||Array.isArray(Rt))throw new Error(s("mcp.add.configInvalid"));const We=I.trim();bt={...Rt,...We?{description:We}:{}}}catch(Rt){re(ba(Rt));return}re(null),Q(!0);let It=!1;try{await i.setValue(V,"mcpServers",bt,{mcpServerMutation:{operation:"set",name:ne}}),It=!0,he(null);const Rt=await Et("reload",!1).catch(()=>!1);he({...gt?{serverName:ne}:{},text:Rt?s(gt?"mcp.edit.done":"mcp.add.done",{name:ne}):s("mcp.runtime.notUpdated"),error:!Rt}),O(!1),F(null),W(""),Y(""),se(g_)}catch(Rt){It?(he({...gt?{serverName:ne}:{},text:s("mcp.runtime.notUpdated"),error:!0}),O(!1),F(null),W(""),Y(""),se(g_)):re(ba(Rt))}finally{Q(!1)}},[r,z,ee,I,B,V,i,Et,s]),sn=f.useCallback(async()=>{if(!J)return;L(J.name);let ne=!1;try{const gt=await i.reload();if(!gt){he({serverName:J.name,text:s("mcp.add.settingsUnavailable"),error:!0});return}const bt=m2(J)==="workspace"?"workspace":"user",It=jq(gt,bt);if(!(J.name in It)){he({serverName:J.name,text:s("mcp.remove.notWorkspace"),error:!0});return}await i.setValue(bt,"mcpServers",{},{mcpServerMutation:{operation:"remove",name:J.name}}),ne=!0,q(null),he({serverName:J.name,text:s("mcp.action.running",{action:s("mcp.action.remove")})}),await Et("reload",!1,!0).catch(()=>!1)?(p(null),b(null),x(null),he(null)):he({serverName:J.name,text:s("mcp.runtime.removeNotUpdated"),error:!0})}catch(gt){he({serverName:J.name,text:ne?s("mcp.runtime.removeNotUpdated"):s("mcp.action.failed",{error:ba(gt)}),error:!0})}finally{L(null)}},[J,i,Et,s]),Cn=f.useCallback(async ne=>{if(S)return;const gt=IC(ne);if(gt!=="user_settings"&&gt!=="workspace_settings")return;const bt=gt==="workspace_settings"?"workspace":"user";L(ne.name),he(null);try{const It=await i.reload();if(!It)throw new Error(s("mcp.add.settingsUnavailable"));const Rt=jq(It,bt)[ne.name];if(!Rt||typeof Rt!="object"||Array.isArray(Rt))throw new Error(s("mcp.edit.notFound"));const We={...Rt},Zn=We.description;delete We.description,F(ne),W(ne.name),j(bt),Y(typeof Zn=="string"?Zn:""),se(JSON.stringify(We,null,2)),re(null),O(!0)}catch(It){he({serverName:ne.name,text:s("mcp.action.failed",{error:ba(It)}),error:!0})}finally{L(null)}},[S,i,s]),In=f.useCallback(async(ne,gt)=>{var bt,It,Rt,We;if(!S){if(gt.id==="remove"){q(ne);return}if(gt.id==="edit"){await Cn(ne);return}L(ne.name),he({serverName:ne.name,text:gt.id==="authenticate"?E8(ne.name,s):s("mcp.action.running",{action:gt.label})});try{let Zn="",Ar,Ge=!1;if(gt.id==="reconnect"){const bn=await r.restartServer(ne.name);if(!Ve.current)return;if("restarted"in bn&&!bn.restarted)throw bn.reason==="authentication_required"?new Error(s("mcp.reconnect.authenticationRequired")):new Error(s("mcp.reconnect.skipped",{reason:bn.reason}));if("entries"in bn&&(bn.entries.length===0||bn.entries.every(Ht=>!Ht.restarted)))throw new Error(s("mcp.reconnect.skipped",{reason:bn.entries.map(Ht=>Ht.reason).filter(Boolean).join(", ")||"not connected"}))}else{const bn=await r.manageServer(ne.name,gt.id);if(!Ve.current)return;Ar=bn.authUrl,Zn=[...bn.messages??[]].join(`
`),Ge=gt.id==="authenticate"&&bn.pending===!0,Ge&&he({serverName:ne.name,text:E8(ne.name,s,Zn),...Ar?{authUrl:Ar}:{}})}let dt;if(Ge){for(let bn=0;bn<400;bn+=1){if(!await lt())return;const Ht=await r.reload();if(!Ve.current)return;if(!Ht)continue;a(Ht);const Rn=(bt=Ht.errors)==null?void 0:bt[0];if(Rn)throw new Error(Rn.error||Rn.hint||s("mcp.oauth.statusFailed"));const Gn=(It=Ht.servers)==null?void 0:It.find(Or=>Or.name===ne.name);if(!Gn)throw new Error(s("mcp.oauth.serverRemoved"));if(Gn.authenticationState==="failed")throw new Error(Gn.authenticationError||s("mcp.oauth.authenticationFailed"));if(Gn.authenticationState==="succeeded"||Gn.authenticationState===void 0&&Gn.mcpStatus==="connected"){dt=Ht;break}}if(!dt)throw new Error(s("mcp.oauth.timeout"))}else{if(dt=await r.reload(),!Ve.current)return;for(let bn=0;(dt==null?void 0:dt.discoveryState)!==void 0&&dt.discoveryState!=="completed"&&!((Rt=dt.errors)!=null&&Rt.length)&&bn<40;bn+=1){if(!await lt())return;const Ht=await r.reload();if(!Ve.current)return;Ht&&(dt=Ht,a(Ht))}}if(dt){a(dt);const bn=(We=dt.servers)==null?void 0:We.find(Ht=>Ht.name===ne.name);if(bn&&(dt.discoveryState===void 0||dt.discoveryState==="completed")){try{await Be(bn)}catch{}if(!Ve.current)return}}he({serverName:ne.name,text:Ge?s("mcp.action.done",{action:gt.label}):gt.id==="authenticate"&&Zn?E8(ne.name,s,Zn):Zn||s("mcp.action.done",{action:gt.label}),...!Ge&&Ar?{authUrl:Ar}:{}})}catch(Zn){Ve.current&&he({serverName:ne.name,text:s("mcp.action.failed",{error:ba(Zn)}),error:!0})}finally{Ve.current&&L(null)}}},[S,Be,r,Cn,s,lt]),_t=ne=>{p(ne.name),w("overview"),b(null),x(null),he(null),!ne.approvalState&&Be(ne).catch(gt=>{he({serverName:ne.name,text:s("mcp.action.failed",{error:ba(gt)}),error:!0})})},Te=()=>{S===null&&(p(null),b(null),x(null),P(!0),r.reload().then(ne=>{ne&&a(ne)}).catch(ne=>{he({text:ba(ne),error:!0})}).finally(()=>P(!1)))},at=()=>{b(null),x(null)},ke=l.jsx(E1,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(A1,{className:"text-base",children:[l.jsx(vo,{children:l.jsx(qn,{variant:"ghost",size:"icon",disabled:S!==null,onClick:t,"aria-label":s("common.back"),children:l.jsx(JN,{})})}),l.jsx(vo,{children:je?l.jsx(df,{asChild:!0,children:l.jsx("button",{type:"button",disabled:S!==null,onClick:Te,children:s("mcp.title")})}):l.jsx(rc,{children:s("mcp.title")})}),je?l.jsx(hf,{}):null,je?l.jsx(vo,{children:Ne||tt?l.jsx(df,{asChild:!0,children:l.jsx("button",{type:"button",onClick:at,children:je.name})}):l.jsx(rc,{children:je.name})}):null,Ne||tt?l.jsx(hf,{}):null,Ne?l.jsx(vo,{children:l.jsx(rc,{children:Ne.name})}):null,tt?l.jsx(vo,{children:l.jsx(rc,{children:tt.title||tt.name||tt.uri})}):null]})}),Pe=Ne?Ne.name:tt?tt.title||tt.name||tt.uri:je==null?void 0:je.name,ve=n?je?l.jsx(E1,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(A1,{className:"h-8 text-sm",children:[l.jsx(vo,{children:l.jsx(df,{asChild:!0,children:l.jsx("button",{type:"button",disabled:S!==null,onClick:Te,children:s("mcp.title")})})}),l.jsx(hf,{}),l.jsx(vo,{children:Ne||tt?l.jsx(df,{asChild:!0,children:l.jsx("button",{type:"button",onClick:at,children:je.name})}):l.jsx(rc,{children:je.name})}),Ne||tt?l.jsx(hf,{}):null,Ne||tt?l.jsx(vo,{children:l.jsx(rc,{children:Pe})}):null]})}):null:ke,Ke=l.jsx(h1,{open:J!==null,onOpenChange:ne=>!ne&&q(null),children:l.jsxs(f1,{showCloseButton:!1,children:[l.jsxs(m1,{children:[l.jsx(g1,{children:s("mcp.remove.title")}),l.jsx(qx,{children:s(J&&m2(J)==="workspace"?"mcp.remove.description":"mcp.remove.description.global",{name:(J==null?void 0:J.name)??""})})]}),l.jsxs(p1,{children:[l.jsx(qn,{variant:"outline",onClick:()=>q(null),disabled:S!==null,children:s("common.cancel")}),l.jsxs(qn,{variant:"destructive",onClick:()=>void sn(),disabled:S!==null,children:[S?l.jsx($o,{"data-icon":"inline-start"}):l.jsx(hg,{"data-icon":"inline-start"}),s("mcp.action.remove")]})]})]})}),me=l.jsx(h1,{open:E,onOpenChange:ne=>{X||(O(ne),ne||F(null))},children:l.jsxs(f1,{className:"sm:max-w-lg",showCloseButton:!1,children:[l.jsxs(m1,{children:[l.jsx(g1,{children:s(z?"mcp.edit.title":"mcp.add.title")}),l.jsx(qx,{children:s(z?"mcp.edit.description":"mcp.add.description")})]}),l.jsxs("div",{className:"grid gap-4",children:[ue?l.jsxs(Ji,{variant:"destructive",children:[l.jsx(Wa,{}),l.jsx(Zi,{children:ue})]}):null,l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.name"),l.jsx(ri,{value:B,onChange:ne=>W(ne.target.value),placeholder:"my-mcp-server",disabled:X||z!==null})]}),l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.serverDescription"),l.jsx(ri,{value:I,onChange:ne=>Y(ne.target.value),placeholder:s("mcp.add.serverDescriptionPlaceholder"),disabled:X})]}),l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.scope"),l.jsxs(Hf,{value:V,onValueChange:ne=>j(ne),disabled:X||z!==null,children:[l.jsx(Uf,{className:"w-full",children:l.jsx(qf,{})}),l.jsxs(Vf,{children:[l.jsx(Nl,{value:"workspace",children:s("settings.scope.workspace")}),l.jsx(Nl,{value:"user",children:s("mcp.add.scope.global")})]})]})]}),l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.config"),l.jsx(T1t,{className:"min-h-44 font-mono text-xs",value:ee,onChange:ne=>se(ne.target.value),disabled:X})]})]}),l.jsxs(p1,{children:[l.jsx(qn,{variant:"outline",onClick:()=>{O(!1),F(null)},disabled:X,children:s("common.cancel")}),l.jsxs(qn,{onClick:()=>void Le(),disabled:X,children:[X?l.jsx($o,{"data-icon":"inline-start"}):null,s(X?z?"mcp.edit.saving":"mcp.add.adding":z?"mcp.edit.save":"mcp.add.button")]})]})]})});if(Ne&&je)return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ve,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-xl bg-muted",children:l.jsx(X7,{})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h1",{className:"break-words text-2xl font-semibold",children:Ne.name}),l.jsx("p",{className:"text-sm text-muted-foreground",children:Ne.serverToolName||je.name})]})]}),l.jsx(ic,{children:l.jsx(Tp,{children:l.jsx(I1t,{tool:Ne,t:s})})})]})]}),me]});if(tt&&je)return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ve,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-xl bg-muted",children:l.jsx(K7,{})}),l.jsx("h1",{className:"min-w-0 break-words text-2xl font-semibold",children:tt.title||tt.name||tt.uri})]}),l.jsx(ic,{children:l.jsx(Tp,{children:l.jsx(R1t,{resource:tt,t:s})})})]})]}),me]});if(je){const ne=Ae,gt=De,bt=ye[je.name],It=N1t(je,s);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ve,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:l.jsx(jg,{})}),l.jsx("div",{className:"min-w-0 flex-1",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h1",{className:"break-words text-2xl font-semibold",children:je.name}),l.jsx(Za,{variant:"secondary",className:Iq(je),children:Mq(je,s)}),l.jsx(Za,{variant:"outline",children:Nq(je,s)})]})}),l.jsxs(Hg,{children:[l.jsx(qg,{asChild:!0,children:l.jsx(qn,{variant:"ghost",size:"icon",disabled:S!==null,"aria-label":s("mcp.actions"),"data-testid":"mcp-server-actions",children:S===je.name?l.jsx($o,{}):l.jsx(Ng,{})})}),l.jsx(Ug,{align:"end",onCloseAutoFocus:Rt=>Rt.preventDefault(),children:l.jsx(N1,{children:It.map(Rt=>l.jsx(yo,{"data-testid":`mcp-server-action-${Rt.id}`,variant:Rt.id==="remove"?"destructive":"default",disabled:S!==null,onSelect:()=>void In(je,Rt),children:Rt.label},Rt.id))})})]})]}),(Z==null?void 0:Z.serverName)===je.name?l.jsxs(Ji,{variant:Z.error?"destructive":"default",children:[Z.error?l.jsx(Wa,{}):l.jsx(Ex,{}),l.jsxs(Zi,{className:"whitespace-pre-wrap break-words",children:[l.jsx("p",{children:Z.text}),Z.authUrl&&j1t(Z.authUrl)?l.jsx("a",{className:"mt-2 inline-block underline underline-offset-3",href:Z.authUrl,target:"_blank",rel:"noreferrer",children:s("mcp.oauth.open")}):null]})]}):null,l.jsxs(ow,{value:y,onValueChange:w,children:[l.jsxs(aw,{children:[l.jsx(Do,{value:"overview",children:s("mcp.basicInfo")}),l.jsxs(Do,{value:"tools",children:[s("mcp.tools")," ",ne.length]}),l.jsxs(Do,{value:"resources",children:[s("mcp.resources")," ",je.resourceCount??gt.length]})]}),l.jsx(Ya,{value:"overview",className:"pt-4",children:l.jsxs(ic,{children:[l.jsxs(Ad,{children:[l.jsx(Nd,{className:"text-sm",children:s("mcp.descriptionTitle")}),l.jsx(ff,{children:((st=je.description)==null?void 0:st.trim())||"-"})]}),l.jsxs(Tp,{className:"grid gap-6 sm:grid-cols-2",children:[l.jsx(yl,{label:s("mcp.source"),value:Nq(je,s)}),l.jsx(yl,{label:s("mcp.transport"),value:je.transport}),l.jsx(yl,{label:s("mcp.command"),value:A1t(je,s)}),l.jsx(yl,{label:s("mcp.workingDirectory"),value:((Tn=je.config)==null?void 0:Tn.cwd)||o.workspaceCwd}),je.error?l.jsx(yl,{label:s("mcp.invalidReasonLabel"),value:je.error}):null,je.hint?l.jsx(yl,{label:s("mcp.description"),value:je.hint}):null]})]})}),l.jsx(Ya,{value:"tools",className:"pt-4",children:bt!=null&&bt.tools?l.jsxs(Ji,{variant:"destructive",children:[l.jsx(Wa,{}),l.jsx(ap,{children:s("mcp.loadingTools")}),l.jsx(Zi,{children:bt.tools})]}):ne.length?l.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:ne.map(Rt=>l.jsx(ic,{size:"sm",role:"button",tabIndex:0,className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>b(Rt.name),onKeyDown:We=>{(We.key==="Enter"||We.key===" ")&&(We.preventDefault(),b(Rt.name))},children:l.jsxs(Ad,{children:[l.jsx(Nd,{className:"break-words",children:Rt.name}),l.jsx(ff,{className:"line-clamp-2 text-xs",children:Rt.description||s("mcp.noDescription")}),Rt.isValid?null:l.jsx(Pit,{children:l.jsx(Za,{variant:"destructive",children:s("mcp.status.blocked")})})]})},Rt.name))}):l.jsx(Hd,{className:"rounded-xl border border-dashed",children:l.jsxs(qd,{children:[l.jsx(Ud,{variant:"icon",children:l.jsx(X7,{})}),l.jsx(Vd,{children:s("mcp.emptyTools")})]})})}),l.jsx(Ya,{value:"resources",className:"pt-4",children:bt!=null&&bt.resources?l.jsxs(Ji,{variant:"destructive",children:[l.jsx(Wa,{}),l.jsx(ap,{children:s("mcp.resourcesUnavailable")}),l.jsx(Zi,{children:bt.resources})]}):gt.length?l.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:gt.map(Rt=>l.jsx(ic,{size:"sm",role:"button",tabIndex:0,className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>x(Rt.uri),onKeyDown:We=>{(We.key==="Enter"||We.key===" ")&&(We.preventDefault(),x(Rt.uri))},children:l.jsxs(Ad,{children:[l.jsx(Nd,{className:"break-words",children:Rt.title||Rt.name||Rt.uri}),l.jsx(ff,{className:"break-all",children:Rt.uri})]})},Rt.uri))}):l.jsx(Hd,{className:"rounded-xl border border-dashed",children:l.jsxs(qd,{children:[l.jsx(Ud,{variant:"icon",children:l.jsx(K7,{})}),l.jsx(Vd,{children:s("mcp.noResources")})]})})})]})]})]}),Ke,me]})}const qe=pt.filter(ne=>!ne.disabled&&ne.mcpStatus==="connecting").length,Mt=[{value:"all",label:s("mcp.source.all")},{value:"user",label:s("mcp.source.user")},{value:"workspace",label:s("mcp.source.workspace")},{value:"extension",label:s("mcp.source.extension")}];return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ve,l.jsxs("div",{className:"flex w-full flex-col gap-6",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl font-semibold text-balance",children:s("mcp.title")}),l.jsx("p",{className:"mt-1 text-sm text-muted-foreground tabular-nums",children:s("mcp.servers",{count:pt.length})})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(qn,{variant:"outline",onClick:()=>void le(),disabled:M,children:[M?l.jsx($o,{"data-icon":"inline-start"}):l.jsx(Yy,{"data-icon":"inline-start"}),s("common.refresh")]}),l.jsxs(qn,{onClick:()=>{F(null),W(""),Y(""),j("workspace"),se(g_),re(null),O(!0)},disabled:X,children:[l.jsx(Ax,{"data-icon":"inline-start"}),s("mcp.add.button")]})]})]}),N&&qe===0?l.jsxs(Ji,{children:[l.jsx(Yy,{className:"animate-spin"}),l.jsx(ap,{children:s("mcp.discovery.initializing")}),l.jsx(Zi,{children:s("mcp.startingNote")})]}):qe>0?l.jsxs(Ji,{children:[l.jsx(Yy,{}),l.jsx(ap,{children:s("mcp.starting",{count:qe})}),l.jsx(Zi,{children:s("mcp.startingNote")})]}):null,Z&&!Z.serverName?l.jsxs(Ji,{variant:Z.error?"destructive":"default",children:[l.jsx(Wa,{}),l.jsx(Zi,{children:Z.text})]}):null,(o.errors??[]).map((ne,gt)=>l.jsxs(Ji,{variant:"destructive",children:[l.jsx(Wa,{}),l.jsx(ap,{children:ne.kind}),l.jsx(Zi,{children:ne.error||ne.hint||s("mcp.status.unknown")})]},`${ne.kind}-${gt}`)),o.budgetMode&&o.budgetMode!=="off"?l.jsxs(Ji,{children:[l.jsx(Wa,{}),l.jsx(Zi,{children:s("mcp.clientBudget",{count:o.clientCount??0,budget:o.clientBudget??"∞"})})]}):null,l.jsxs("div",{className:"relative",children:[l.jsx(Zd,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(ri,{className:"pl-9",value:k,onChange:ne=>T(ne.target.value),placeholder:`${s("common.search")} MCP…`})]}),l.jsx(Zie,{type:"single",value:_,onValueChange:ne=>{ne&&C(ne)},variant:"outline",size:"sm","aria-label":s("mcp.source"),children:Mt.map(ne=>l.jsx(eoe,{value:ne.value,children:ne.label},ne.value))}),Se.length?l.jsx("div",{className:Joe.serverGrid,"data-column-count":Math.min(Se.length,4),children:Se.map(ne=>{var gt;return l.jsx(ic,{size:"sm",role:"button",tabIndex:0,"aria-label":ne.name,className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>_t(ne),onKeyDown:bt=>{(bt.key==="Enter"||bt.key===" ")&&(bt.preventDefault(),_t(ne))},children:l.jsx(Ad,{className:"block",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:l.jsx(jg,{className:"size-5"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[l.jsx(Nd,{className:"min-w-0 flex-1 truncate",children:ne.name}),l.jsx(Za,{variant:"secondary",className:`${Iq(ne)} shrink-0 text-[10px]`,children:Mq(ne,s)})]}),l.jsx(ff,{className:"mt-1 truncate text-xs",children:((gt=ne.description)==null?void 0:gt.trim())||"-"})]})]})})},ne.name)})}):l.jsx(Hd,{className:"border",children:l.jsxs(qd,{children:[l.jsx(Ud,{variant:"icon",children:k||_!=="all"?l.jsx(Zd,{}):l.jsx(jg,{})}),l.jsx(Vd,{children:s(k||_!=="all"?"mcp.noMatches":"mcp.empty")}),!k&&_==="all"?l.jsx(iw,{children:s("mcp.emptyDescription")}):null]})})]}),me]})}function D1t({mcpMessage:e,loadMcpMessage:t,onClose:n,onUseSkill:s,initialFocusRef:r}){const{t:i}=ot(),[o,a]=f.useState("extensions"),[c,u]=f.useState(!1),[d,h]=f.useState(0),[m,p]=f.useState(!1),[g,b]=f.useState(null),v=f.useCallback(()=>{p(!1),b(null),t().then(()=>p(!0)).catch(k=>{b(k instanceof Error?k.message:String(k))})},[t]),x=f.useCallback(()=>{u(!1),h(k=>k+1)},[]),y=f.useMemo(()=>({onRoot:x,onDetailChange:u}),[x]),w=k=>{const T=k;a(T),u(!1),h(_=>_+1),T==="mcp"&&v()};return l.jsxs(ow,{value:o,onValueChange:w,className:"w-full",children:[c?null:l.jsx("div",{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(aw,{className:"h-8","aria-label":i("plugins.sections"),children:[l.jsx(Do,{ref:r,value:"extensions",children:i("plugins.extensions")}),l.jsx(Do,{value:"mcp",children:i("plugins.mcp")}),l.jsx(Do,{value:"skills",children:i("plugins.skills")})]})}),l.jsx(Ya,{value:o,className:"mt-0",children:o==="extensions"?l.jsx(Qoe,{onClose:n,embedded:y},`extensions-${d}`):o==="skills"?l.jsx(toe,{onClose:n,onUseSkill:s,embedded:y},`skills-${d}`):g?l.jsxs(Ji,{variant:"destructive",className:"mt-4",children:[l.jsx(ap,{children:i("plugins.mcpLoadFailed")}),l.jsxs(Zi,{className:"space-y-3",children:[l.jsx("p",{children:g}),l.jsx(qn,{variant:"outline",size:"sm",onClick:v,children:i("common.retry")})]})]}):e&&m?l.jsx(Zoe,{message:e,onClose:n,embedded:y},`mcp-${d}`):l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8 pt-4",children:[l.jsxs("div",{className:"relative",children:[l.jsx(Zd,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(ri,{"aria-label":i("common.search"),readOnly:!0,className:"pl-9",placeholder:`${i("common.search")} MCP…`})]}),l.jsx(Hd,{className:"border",children:l.jsxs(qd,{children:[l.jsx(Ud,{variant:"icon",children:l.jsx(jg,{})}),l.jsx(Vd,{children:i("mcp.empty")}),l.jsx(iw,{children:i("mcp.emptyDescription")})]})})]})})]})}const L1t="_section_1ghly_1",P1t="_header_1ghly_12",O1t="_title_1ghly_19",B1t="_addButton_1ghly_24",$1t="_hint_1ghly_38",z1t="_empty_1ghly_39",F1t="_provider_1ghly_45",H1t="_providerName_1ghly_51",q1t="_modelRow_1ghly_59",U1t="_modelInfo_1ghly_70",V1t="_modelName_1ghly_78",W1t="_modelBaseUrl_1ghly_84",G1t="_currentBadge_1ghly_91",K1t="_runtimeBadge_1ghly_99",Y1t="_modelActions_1ghly_107",X1t="_actionButton_1ghly_114",Q1t="_deleteButton_1ghly_115",J1t="_confirmButton_1ghly_116",Pi={section:L1t,header:P1t,title:O1t,addButton:B1t,hint:$1t,empty:z1t,provider:F1t,providerName:H1t,modelRow:q1t,modelInfo:U1t,modelName:V1t,modelBaseUrl:W1t,currentBadge:G1t,runtimeBadge:K1t,modelActions:Y1t,actionButton:X1t,deleteButton:Q1t,confirmButton:J1t};function p2(e,t){return`${e.authType}:${t.modelId}:${t.baseUrl??""}`}function Z1t(e,t){const n=e.flatMap(r=>r.models.map(i=>({provider:r,model:i})));if(t){const r=n.find(({model:o})=>o.modelId===t);if(r)return p2(r.provider,r.model);const i=n.filter(({model:o})=>o.baseModelId===t);if(i.length===1)return p2(i[0].provider,i[0].model)}const s=n.find(({model:r})=>r.isCurrent);return s?p2(s.provider,s.model):void 0}function ebt({providers:e,currentModelId:t,loading:n,error:s,busy:r,onSelectModel:i,onDeleteModel:o,onAddModel:a}){const{t:c}=ot(),[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=Z1t(e,t);return l.jsxs("div",{className:Pi.section,"data-testid":"model-management",children:[l.jsxs("div",{className:Pi.header,children:[l.jsx("span",{className:Pi.title,children:c("settings.models.title")}),l.jsx("button",{type:"button",className:Pi.addButton,disabled:r,onClick:a,children:c("settings.models.add")})]}),s&&l.jsx("div",{className:Pi.hint,children:s.message}),n&&!h&&l.jsx("div",{className:Pi.hint,children:c("settings.models.loading")}),!n&&!h&&!s&&l.jsx("div",{className:Pi.empty,children:c("settings.models.empty")}),e.map((p,g)=>p.models.length===0?null:l.jsxs("div",{className:Pi.provider,children:[l.jsx("div",{className:Pi.providerName,children:p.authType}),p.models.map(b=>{const v=p2(p,b),x=v===m,y=u===v,w=b.name||b.baseModelId;return l.jsxs("div",{className:Pi.modelRow,children:[l.jsxs("div",{className:Pi.modelInfo,children:[l.jsx("span",{className:Pi.modelName,children:b.name||b.baseModelId}),x&&l.jsx("span",{className:Pi.currentBadge,children:c("settings.models.current")}),b.isRuntime&&l.jsx("span",{className:Pi.runtimeBadge,children:c("settings.models.runtime")}),b.baseUrl&&l.jsx("span",{className:Pi.modelBaseUrl,children:b.baseUrl})]}),l.jsxs("div",{className:Pi.modelActions,children:[!x&&l.jsx("button",{type:"button",className:Pi.actionButton,disabled:r,"aria-label":`${c("settings.models.setCurrent")} ${w}`,onClick:()=>i(b.modelId),children:c("settings.models.setCurrent")}),!b.isRuntime&&(y?l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:Pi.confirmButton,disabled:r,"aria-label":`${c("settings.models.confirmDelete")} ${w}`,onClick:()=>{d(null),o({authType:p.authType,modelId:b.baseModelId,...b.baseUrl?{baseUrl:b.baseUrl}:{}})},children:c("settings.models.confirmDelete")}),l.jsx("button",{type:"button",className:Pi.actionButton,disabled:r,"aria-label":`${c("settings.models.cancel")} ${w}`,onClick:()=>d(null),children:c("settings.models.cancel")})]}):l.jsx("button",{type:"button",className:Pi.deleteButton,disabled:r,"aria-label":`${c("settings.models.delete")} ${w}`,onClick:()=>d(v),children:c("settings.models.delete")}))]})]},v)})]},`${p.authType}:${g}`))]})}function oR({className:e,...t}){return l.jsx("div",{"data-slot":"field-group",className:Wt("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 tbt=i0("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 Ep({className:e,orientation:t="vertical",...n}){return l.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:Wt(tbt({orientation:t}),e),...n})}function eae({className:e,...t}){return l.jsx("div",{"data-slot":"field-content",className:Wt("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...t})}function Vg({className:e,...t}){return l.jsx(nA,{"data-slot":"field-label",className:Wt("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 nbt({className:e,...t}){return l.jsx("div",{"data-slot":"field-label",className:Wt("flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50",e),...t})}function g2({className:e,...t}){return l.jsx("p",{"data-slot":"field-description",className:Wt("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 sbt({className:e,children:t,errors:n,...s}){const r=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:l.jsx("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:i.map((a,c)=>(a==null?void 0:a.message)&&l.jsx("li",{children:a.message},c))})},[t,n]);return r?l.jsx("div",{role:"alert","data-slot":"field-error",className:Wt("text-sm font-normal text-destructive",e),...s,children:r}):null}function tae({className:e,size:t="default",...n}){return l.jsx(See,{"data-slot":"switch","data-size":t,className:Wt("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:l.jsx(Tee,{"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 rbt=new Set(["fastModel","visionModel","voiceModel","modelFallbacks"]),ibt=new Set(["ui.hideTips","ui.enableUserFeedback","ui.compactMode","ui.compactInline","mcpServers"]);function RC(e,t,n){const s=e(t);return s===t?n:s}function Rq(e,t){return RC(t,`settings.category.${e}`,e)}function B0(e,t){return RC(t,`settings.label.${e.key}`,e.label)}function obt(e,t){if(e.description)return RC(t,`settings.description.${e.key}`,e.description)}function nae(e,t,n,s){return RC(s,`settings.option.${e.key}.${String(t)}`,n)}function abt(e,t,n){const s=rae(e,t);if(s==null)return"";if(e.key===lp){const i=aj(s,qr.Dark);return n(`theme.${i}`)}if(e.key===sS){const i=tj(s);return i?nj(i):String(s)}if(e.type==="boolean")return n(s===!0?"settings.value.on":"settings.value.off");if(e.type==="enum"&&e.options){const i=e.options.find(o=>o.value===s);return i?nae(e,i.value,i.label,n):String(s)}const r=String(s);return r.length>24?`${r.slice(0,21)}…`:r}function sae(e,t){return(t==="user"?e.values.user:e.values.workspace)!==void 0}function lbt(e,t){if(t==="workspace"?e.values.user!==void 0:e.values.workspace!==void 0)return sae(e,t)?"settings.alsoModifiedIn":"settings.modifiedIn"}function rae(e,t){const n=t==="user"?e.values.user:e.values.workspace;return n!==void 0?n:e.values.effective}function cbt(e){const t=new Map;for(const n of e){let s=t.get(n.category);s||(s=[],t.set(n.category,s)),s.push(n)}return Array.from(t.entries()).map(([n,s])=>({category:n,items:s}))}function Dq({category:e}){const t=e.toLowerCase(),n=t.includes("ui")?t0e:t.includes("tool")?X7:t.includes("context")?K7:t.includes("privacy")?y0e:t.includes("model")?rK:t.includes("daemon")?jg:t.includes("advanced")?v0e:t.includes("experimental")?Rpe:aK;return l.jsx(n,{"data-icon":"inline-start","aria-hidden":"true"})}function Lq({title:e,description:t,metadata:n,control:s}){return l.jsxs(Ep,{orientation:"responsive",className:"min-h-20 gap-6 px-5 py-4 max-md:px-4",children:[l.jsxs(eae,{className:"min-w-0",children:[l.jsxs(nbt,{children:[e,n]}),t&&l.jsx(g2,{className:"max-w-3xl",children:t})]}),l.jsx("div",{className:"flex min-w-0 justify-end max-md:justify-start",children:s})]})}function ubt({name:e,label:t,type:n,value:s,disabled:r,onCommit:i,onInvalid:o}){const a=String(s??""),[c,u]=f.useState(a);f.useEffect(()=>u(a),[a]);const d=()=>{if(n==="number"){const h=c.trim(),m=Number(h);if(!h||!Number.isFinite(m)){u(a),o();return}m!==s&&i(m);return}c!==a&&i(c)};return l.jsx(ri,{type:n,name:e,autoComplete:"off","aria-label":t,value:c,disabled:r,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 dbt({settingsState:e,onLanguageChange:t,onSubDialog:n,onThemeChange:s,chatWidthMode:r,onChatWidthModeChange:i,modelManagement:o,embedded:a=!1}){const{language:c,t:u}=ot(),d=z1(),{status:h,settings:m,loading:p,error:g,reload:b,setValue:v}=e,[x,y]=f.useState("workspace"),[w,k]=f.useState(""),[T,_]=f.useState(null),[C,S]=f.useState(null),[L,N]=f.useState(!1),$=p&&!h,M=f.useMemo(()=>{const B=m.filter(V=>!ibt.has(V.key)),W=cbt(B).map(V=>({id:V.category,label:Rq(V.category,u),items:V.items.map(j=>({type:"setting",setting:j}))})),I={type:"local",localKey:"chatWidth"},Y=W.find(V=>V.items.some(j=>j.type==="setting"&&j.setting.key===lp));if(Y){const V=Y.items.findIndex(j=>j.type==="setting"&&j.setting.key===lp);Y.items.splice(V+1,0,I)}else W.push({id:"UI",label:Rq("UI",u),items:[I]});return W},[m,u]);f.useEffect(()=>{M.length!==0&&(M.some(B=>B.id===w)||k(M[0].id))},[w,M]),f.useEffect(()=>{var B;g?S(g.message):(B=h==null?void 0:h.warnings)!=null&&B.length?S(h.warnings.map(W=>u("settings.corrupted",{recovered:W.recovered?"true":"false"})).join("; ")):m.length>0&&S(null)},[g,m,h,u]);const P=f.useCallback((B,W)=>{L||S(null),_(B),v(x,B,W).then(async I=>{try{await b()}catch{}I!=null&&I.requiresRestart&&B!==sS&&N(!0)}).catch(I=>{S(I instanceof Error?I.message:String(I))}).finally(()=>_(null))},[b,L,x,v]),E=M.find(B=>B.id===w)??M[0],O=E==null?void 0:E.items.some(B=>B.type==="setting"&&B.setting.category==="Model"),z=(B,W,I,Y,V=!1)=>l.jsxs(Hf,{value:B,disabled:V,onValueChange:W,children:[l.jsx(Uf,{size:"sm","aria-label":Y,className:"w-[min(160px,50vw)] bg-background max-md:w-full",children:l.jsx(qf,{})}),l.jsx(Vf,{position:"popper",align:"end",children:l.jsx(FM,{children:I.map(j=>l.jsx(Nl,{value:j.value,children:j.label},j.value))})})]}),F=B=>{var V;const W=rae(B,x),Y=T===B.key;if(B.key===lp)return z(aj(W)??d,j=>{const ee=j;s(ee),P(lp,bK(ee))},pK.map(j=>({value:j,label:u(`theme.${j}`)})),B0(B,u),Y);if(B.key===sS)return z(tj(W)??c,j=>t(j,x),tge.map(j=>({value:j,label:nj(j)})),B0(B,u),Y);if(rbt.has(B.key))return l.jsx(qn,{type:"button",variant:"outline",size:"sm",disabled:Y,className:"max-w-[260px] truncate",onClick:()=>n(B.key,x),children:abt(B,x,u)||u("settings.action.select")});if(B.type==="boolean"){const j=W===!0;return l.jsx(tae,{checked:j,disabled:Y,onCheckedChange:ee=>P(B.key,ee),"aria-label":B0(B,u)})}if(B.type==="enum"&&((V=B.options)!=null&&V.length)){const j=B.options.findIndex(ee=>ee.value===W);return z(j>=0?String(j):"",ee=>{var X;const se=(X=B.options)==null?void 0:X[Number(ee)];se&&P(B.key,se.value)},B.options.map((ee,se)=>({value:String(se),label:nae(B,ee.value,ee.label,u)})),B0(B,u),Y)}return l.jsx(ubt,{name:B.key,label:B0(B,u),type:B.type==="number"?"number":"text",value:W,disabled:Y,onCommit:j=>P(B.key,j),onInvalid:()=>S(u("settings.invalidNumber"))})};return l.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&&l.jsx("div",{className:"flex items-center justify-between border-b border-border px-5 py-4",children:l.jsxs("div",{children:[l.jsx("h2",{className:"text-base font-semibold text-balance",children:u("settings.title")}),l.jsx("div",{className:"mt-0.5 text-xs text-muted-foreground",children:u("settings.scope.workspace")})]})}),(C||$)&&l.jsxs(Ji,{className:"mx-4 mt-3 w-auto",children:[$&&l.jsx($o,{}),l.jsx(Zi,{children:C||u("settings.loading")})]}),l.jsxs(ow,{value:x,className:"flex min-h-0 flex-1 flex-col gap-0",onValueChange:B=>{y(B)},children:[l.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-border px-3 py-2",children:[l.jsxs(aw,{className:"p-0",children:[l.jsx(Do,{value:"workspace",children:u("settings.scope.workspace")}),l.jsx(Do,{value:"user",children:u("settings.scope.user")})]}),L&&l.jsx(Za,{variant:"secondary",children:u("settings.requiresRestart")})]}),l.jsxs(Ya,{value:x,forceMount:!0,className:"grid min-h-0 flex-1 grid-cols-[190px_minmax(0,1fr)] outline-none max-md:grid-cols-1",children:[l.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:M.map(B=>l.jsxs(qn,{type:"button",variant:B.id===w?"secondary":"ghost",size:"sm","aria-current":B.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(B.id),children:[l.jsx(Dq,{category:B.id}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:B.label}),l.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:B.items.length})]},B.id))}),l.jsxs("section",{className:"min-h-0 min-w-0 overflow-y-auto bg-background p-5 max-md:p-3",children:[!p&&!E&&l.jsx(Hd,{className:"min-h-60",children:l.jsxs(qd,{children:[l.jsx(Ud,{variant:"icon",children:l.jsx(aK,{})}),l.jsx(Vd,{children:u("settings.empty")}),l.jsx(iw,{children:u("settings.empty")})]})}),E&&l.jsxs("div",{className:"mx-auto w-full max-w-5xl",children:[l.jsxs(ic,{children:[l.jsx(Ad,{children:l.jsxs(Nd,{className:"flex items-center gap-2",children:[l.jsx(Dq,{category:E.id}),E.label]})}),l.jsx(Tp,{className:"-mb-(--card-spacing) p-0",children:l.jsx(oR,{className:"gap-0",children:E.items.map((B,W)=>{const I=W>0&&l.jsx(Xoe,{className:"mx-5 w-auto max-md:mx-4"});if(B.type==="local")return l.jsxs("div",{children:[I,l.jsx(Lq,{title:u("settings.label.ui.chatWidth"),description:u("settings.description.ui.chatWidth"),control:z(r,X=>i(X),[{value:"1000",label:u("settings.option.ui.chatWidth.1000")},{value:"wide",label:u("settings.option.ui.chatWidth.wide")}],u("settings.label.ui.chatWidth"),!1)})]},B.localKey);const Y=B.setting,V=obt(Y,u),j=lbt(Y,x),ee=sae(Y,x),se=j?u(j,{scope:u(x==="workspace"?"settings.scope.user":"settings.scope.workspace")}):void 0;return l.jsxs("div",{children:[I,l.jsx(Lq,{title:B0(Y,u),description:[V,se].filter(Boolean).join(" · ")||void 0,metadata:ee?l.jsx(Za,{variant:"secondary",children:u(x==="workspace"?"settings.scope.workspace":"settings.scope.user")}):void 0,control:T===Y.key?l.jsx($o,{}):F(Y)})]},Y.key)})})})]}),O&&o&&l.jsx("div",{className:"mt-4",children:l.jsx(ebt,{...o})})]})]})]})]}),!a&&l.jsx("div",{className:"border-t border-border px-5 py-3 text-xs text-muted-foreground",children:u("settings.footer")})]})}const hbt="_dialog_1ymqd_1",fbt="_toolbar_1ymqd_12",mbt="_tabs_1ymqd_21",pbt="_tab_1ymqd_21",gbt="_tabActive_1ymqd_39",bbt="_search_1ymqd_48",ybt="_general_1ymqd_60",xbt="_shortcuts_1ymqd_67",vbt="_shortcut_1ymqd_67",wbt="_shortcutKey_1ymqd_87",kbt="_shortcutDesc_1ymqd_95",_bt="_commandList_1ymqd_101",Sbt="_commandCard_1ymqd_108",Cbt="_commandCardExpanded_1ymqd_115",Tbt="_commandRow_1ymqd_119",Ebt="_commandName_1ymqd_135",Abt="_commandTag_1ymqd_142",Nbt="_chevron_1ymqd_152",jbt="_chevronExpanded_1ymqd_160",Mbt="_commandDetail_1ymqd_164",Ibt="_commandDescription_1ymqd_174",Rbt="_commandSubcommands_1ymqd_175",Dbt="_empty_1ymqd_182",mi={dialog:hbt,toolbar:fbt,tabs:mbt,tab:pbt,tabActive:gbt,search:bbt,general:ybt,shortcuts:xbt,shortcut:vbt,shortcutKey:wbt,shortcutDesc:kbt,commandList:_bt,commandCard:Sbt,commandCardExpanded:Cbt,commandRow:Tbt,commandName:Ebt,commandTag:Abt,chevron:Nbt,chevronExpanded:jbt,commandDetail:Mbt,commandDescription:Ibt,commandSubcommands:Rbt,empty:Dbt},Lbt=[{id:"general",labelKey:"help.tab.general"},{id:"commands",labelKey:"help.tab.commands"},{id:"custom-commands",labelKey:"help.tab.custom"}],Pbt=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"]),Obt=[["@","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 Bbt(e){return[`/${e.name}`,e.argumentHint].filter(Boolean).join(" ")}function j9(e){return!Pbt.has(e.name)}function $bt(e,t){return j9(e)?t("help.commandMeta.custom"):t("help.commandMeta.builtIn")}function zbt(e,t,n){const s=n.trim().toLowerCase();return e.filter(r=>r.name&&r.description!==void 0).filter(r=>t==="commands"?!j9(r):t==="custom-commands"?j9(r):!0).filter(r=>s?r.name.toLowerCase().includes(s)||(r.description??"").toLowerCase().includes(s)||(r.argumentHint??"").toLowerCase().includes(s):!0).sort((r,i)=>r.name.localeCompare(i.name))}function Fbt(){const{t:e}=ot();return l.jsx("div",{className:mi.general,children:l.jsx("div",{className:mi.shortcuts,children:Obt.map(([t,n])=>l.jsxs("div",{className:mi.shortcut,children:[l.jsx("span",{className:mi.shortcutDesc,children:e(n)}),l.jsx("span",{className:mi.shortcutKey,children:t})]},t))})})}function Hbt({commands:e,tab:t,query:n}){const{t:s}=ot(),[r,i]=f.useState(null),o=f.useMemo(()=>zbt(e,t,n),[e,n,t]);return o.length===0?l.jsx("div",{className:mi.empty,children:s(t==="custom-commands"?"help.emptyCustom":"help.empty")}):l.jsx("div",{className:mi.commandList,children:o.map(a=>{var u;const c=r===a.name;return l.jsxs("article",{className:`${mi.commandCard} ${c?mi.commandCardExpanded:""}`,children:[l.jsxs("button",{type:"button",className:mi.commandRow,onClick:()=>i(c?null:a.name),"aria-expanded":c,children:[l.jsx("span",{className:mi.commandName,children:Bbt(a)}),l.jsx("span",{className:mi.commandTag,children:$bt(a,s)}),l.jsx("svg",{className:`${mi.chevron} ${c?mi.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]}),c&&l.jsxs("div",{className:mi.commandDetail,children:[a.description&&l.jsx("div",{className:mi.commandDescription,children:a.description}),!!((u=a.subcommands)!=null&&u.length)&&l.jsxs("div",{className:mi.commandSubcommands,children:[s("help.subcommands"),": ",a.subcommands.join(", ")]})]})]},a.name)})})}function qbt({commands:e}){const{t}=ot(),[n,s]=f.useState("general"),{filterValue:r,inputProps:i}=AC(),o=n!=="general";return l.jsxs("div",{className:mi.dialog,children:[l.jsxs("div",{className:mi.toolbar,children:[l.jsx("div",{className:mi.tabs,children:Lbt.map(a=>l.jsx("button",{type:"button",className:`${mi.tab} ${a.id===n?mi.tabActive:""}`,onClick:()=>s(a.id),children:t(a.labelKey)},a.id))}),o&&l.jsx("input",{className:mi.search,...i,placeholder:t("help.search")})]}),n==="general"?l.jsx(Fbt,{}):l.jsx(Hbt,{commands:e,tab:n,query:r})]})}function Ubt({currentTheme:e,onSelect:t,onClose:n}){const{t:s}=ot(),r=pK.map(d=>({id:d,label:s(`theme.${d}`),description:s(`theme.${d}.desc`)})),[i,o]=f.useState(()=>{const d=r.findIndex(h=>h.id===e);return d>=0?d:0}),a=f.useRef(null),c=d=>{const h=r[d];h&&(t(h.id),n())},{keyboardMode:u}=ym({itemCount:r.length,activeIndex:i,onActiveIndexChange:o,onConfirm:c});return f.useEffect(()=>{var h;const d=(h=a.current)==null?void 0:h.children[i];d==null||d.scrollIntoView({block:"nearest"})},[i]),l.jsx("div",{className:en("picker-list","picker-list-compact",u?"picker-keyboard-only":void 0),ref:a,role:"listbox","aria-label":s("theme.title"),tabIndex:0,"aria-activedescendant":r.length>0?`theme-opt-${i}`:void 0,"data-web-shell-theme-dialog":!0,children:r.map((d,h)=>{const m=d.id===e;return l.jsxs("div",{id:`theme-opt-${h}`,role:"option","aria-selected":m,className:en("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:()=>c(h),onMouseMove:()=>o(h),children:[l.jsx("div",{className:en("picker-item-row"),children:l.jsx("span",{className:en("picker-item-title"),children:d.label})}),l.jsx("div",{className:en("picker-item-meta"),children:d.description})]},d.id)})})}const M9="delete-session-list",Pq=e=>`${M9}-opt-${e}`;function Vbt({onDeleted:e,onError:t,onClose:n,workspaceCwd:s}){const{t:r}=ot(),i=Dl(),{sessions:o,loading:a,error:c,deleteSession:u,deleteSessions:d}=rw(s,{autoLoad:!0}),h=i.sessionId,[m,p]=f.useState(!1),[g,b]=f.useState(-1),[v,x]=f.useState(new Set),{filterValue:y,inputProps:w}=AC(()=>{b(-1),x(new Set)}),[k,T]=f.useState(null),_=f.useRef(null),C=f.useRef(null);f.useEffect(()=>{c&&T(c.message)},[c]);const S=f.useMemo(()=>y?o.filter(E=>{const O=y.toLowerCase();return(E.displayName||"").toLowerCase().includes(O)||E.sessionId.toLowerCase().includes(O)}):o,[o,y]),L=f.useCallback(E=>{E!==h&&x(O=>{const z=new Set(O);return z.has(E)?z.delete(E):z.add(E),z})},[h]);f.useEffect(()=>{if(v.size===0)return;const E=new Set(S.map(O=>O.sessionId));x(O=>{const z=new Set([...O].filter(F=>E.has(F)));return z.size===O.size?O:z})},[S,v.size]),f.useEffect(()=>{g>=S.length&&S.length>0&&b(S.length-1)},[S.length,g]),f.useEffect(()=>{var O;const E=(O=_.current)==null?void 0:O.children[g];E==null||E.scrollIntoView({block:"nearest"})},[g]),f.useEffect(()=>{var E;(E=C.current)==null||E.focus()},[]);const{keyboardMode:N}=ym({itemCount:S.length,activeIndex:g,onActiveIndexChange:b,onConfirm:E=>{const O=S[E];O&&L(O.sessionId)}}),$=f.useCallback(()=>{if(m)return;if(v.size>0){const O=new Set(S.map(F=>F.sessionId)),z=Array.from(v).filter(F=>O.has(F));if(z.length===0)return;p(!0),d(z).then(F=>{const B=F.removed.length+F.notFound.length,W=F.errors.length;if(W>0&&B>0){t(new Error(r("delete.partialFail",{removed:B,failed:W,detail:F.errors[0].error}))),n();return}if(W>0){T(r("delete.allFailed",{count:W,reason:F.errors[0].error})),p(!1),x(new Set);return}if(B===0){T(r("delete.nonRemoved")),p(!1),x(new Set);return}e([...F.removed,...F.notFound]),n()}).catch(F=>{t(F),p(!1)});return}const E=S[g];if(E){if(E.sessionId===h){T(r("delete.cannotCurrent"));return}p(!0),u(E.sessionId).then(O=>{if(!O){T(r("delete.notFound")),p(!1);return}e([E.sessionId]),n()}).catch(O=>{t(O),p(!1)})}},[h,u,d,m,S,n,e,t,g,v,r]),M=v.size>0,P=!m&&!a&&M;return l.jsxs("div",{className:en("picker","picker-in-shell"),children:[l.jsxs("div",{className:en("picker-search"),children:[l.jsxs("span",{className:en("picker-search-label"),children:[r("resume.search"),":"," "]}),l.jsx("input",{ref:C,className:en("picker-search-input"),"aria-label":r("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":M9,"aria-activedescendant":g>=0&&g<S.length?Pq(g):void 0,...w,placeholder:""}),l.jsx("span",{className:en("picker-search-hint"),children:k||(m?r("delete.deleting"):a?r("common.loading"):M?r("delete.selected",{count:v.size}):y?r("delete.matches",{count:S.length}):"")})]}),l.jsx("div",{className:en("picker-sep")}),l.jsxs("div",{id:M9,role:"listbox","aria-multiselectable":"true",className:en("picker-list",N?"picker-keyboard-only":void 0),ref:_,children:[a&&l.jsx("div",{className:en("picker-empty"),children:r("common.loading")}),!a&&c&&l.jsx("div",{className:en("picker-empty"),children:c.message}),!a&&!c&&S.length===0&&l.jsx("div",{className:en("picker-empty"),children:y?r("delete.noMatch",{query:y}):r("delete.none")}),!a&&S.map((E,O)=>{const z=E.sessionId===h,F=v.has(E.sessionId);return l.jsx(ZI,{session:E,optionId:Pq(O),active:O===g,ariaSelected:F,current:!1,disabled:z,leading:l.jsx("span",{className:en("picker-item-checkbox",F?"picker-item-checkbox-checked":void 0),children:F?"[x] ":"[ ] "}),trailing:z?l.jsx("span",{className:en("picker-item-badge"),children:r("resume.current")}):void 0,onClick:()=>{b(O),z||L(E.sessionId)},onActivate:()=>b(O)},E.sessionId)})]}),l.jsx("div",{className:en("picker-sep")}),l.jsxs("div",{className:en("dialog-footer-actions"),children:[l.jsx("button",{type:"button",className:en("dialog-inline-button"),onClick:n,disabled:m,children:r("common.cancel")}),l.jsx("button",{type:"button",className:en("dialog-danger-button"),onClick:$,disabled:!P,children:r(m?"delete.deleting":"delete.action")})]})]})}const I9="release-session-list",Oq=e=>`${I9}-opt-${e}`;function Wbt({onReleased:e,onError:t,onClose:n,workspaceCwd:s}){const{t:r}=ot(),i=Dl(),{sessions:o,loading:a,error:c,releaseSession:u}=rw(s,{autoLoad:!0}),d=i.sessionId,[h,m]=f.useState(!1),[p,g]=f.useState(-1),[b,v]=f.useState(null),{filterValue:x,inputProps:y}=AC(()=>{g(-1),v(null)}),[w,k]=f.useState(null),T=f.useRef(null),_=f.useRef(null);f.useEffect(()=>{c&&k(c.message)},[c]);const C=x?o.filter(E=>{const O=x.toLowerCase();return(E.displayName||"").toLowerCase().includes(O)||E.sessionId.toLowerCase().includes(O)}):o,S=E=>{const O=C[E];if(!O)return;const z=O.sessionId===d,F=(O.clientCount??0)>0||O.hasActivePrompt===!0;z||!F||(g(E),v(O.sessionId))};f.useEffect(()=>{p>=C.length&&C.length>0&&g(C.length-1)},[C.length,p]),f.useEffect(()=>{var O;const E=(O=T.current)==null?void 0:O.children[p];E==null||E.scrollIntoView({block:"nearest"})},[p]),f.useEffect(()=>{var E;(E=_.current)==null||E.focus()},[]);const{keyboardMode:L}=ym({itemCount:C.length,activeIndex:p,onActiveIndexChange:g,onConfirm:S}),N=f.useCallback(E=>{const O=E??C.find(F=>F.sessionId===b)??void 0;if(!O||h)return;if(!((O.clientCount??0)>0||O.hasActivePrompt===!0)){k(r("release.inactive"));return}if(O.sessionId===d){k(r("release.cannotCurrent"));return}u&&(m(!0),u(O.sessionId).then(()=>{e(O.sessionId),n()}).catch(F=>{t(F),m(!1)}))},[d,h,C,n,t,e,u,b,r]),$=C.find(E=>E.sessionId===b)??void 0,M=$&&(($.clientCount??0)>0||$.hasActivePrompt===!0),P=!h&&!a&&!!$&&$.sessionId!==d&&!!M;return l.jsxs("div",{className:en("picker","picker-in-shell"),children:[l.jsxs("div",{className:en("picker-search"),children:[l.jsxs("span",{className:en("picker-search-label"),children:[r("resume.search"),":"," "]}),l.jsx("input",{ref:_,className:en("picker-search-input"),"aria-label":r("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":I9,"aria-activedescendant":p>=0&&p<C.length?Oq(p):void 0,...y,placeholder:""}),l.jsx("span",{className:en("picker-search-hint"),children:w||(h?r("release.releasing"):a?r("common.loading"):x?r("release.matches",{count:C.length}):"")})]}),l.jsx("div",{className:en("picker-sep")}),l.jsxs("div",{id:I9,role:"listbox",className:en("picker-list",L?"picker-keyboard-only":void 0),ref:T,children:[a&&l.jsx("div",{className:en("picker-empty"),children:r("common.loading")}),!a&&C.length===0&&l.jsx("div",{className:en("picker-empty"),children:x?r("release.noMatch",{query:x}):r("release.none")}),!a&&C.map((E,O)=>{const z=E.sessionId===d,F=(E.clientCount??0)>0||E.hasActivePrompt===!0,B=z||!F;return l.jsx(ZI,{session:E,optionId:Oq(O),active:O===p,confirmed:E.sessionId===b,ariaSelected:E.sessionId===b,current:!1,disabled:B,trailing:z?l.jsx("span",{className:en("picker-item-badge"),children:r("resume.current")}):F?void 0:l.jsx("span",{className:en("picker-item-badge"),children:r("release.inactiveBadge")}),onClick:()=>S(O),onActivate:()=>g(O)},E.sessionId)})]}),l.jsx("div",{className:en("picker-sep")}),l.jsxs("div",{className:en("dialog-footer-actions"),children:[l.jsx("button",{type:"button",className:en("dialog-inline-button"),onClick:n,disabled:h,children:r("common.cancel")}),l.jsx("button",{type:"button",className:en("dialog-danger-button"),onClick:()=>N(),disabled:!P,children:r(h?"release.releasing":"release.action")})]})]})}const Gbt="_root_ieg2d_1",Kbt="_list_ieg2d_8",Ybt="_item_ieg2d_21",Xbt="_itemCursor_ieg2d_42",Qbt="_itemSelected_ieg2d_49",Jbt="_prompt_ieg2d_61",Zbt="_keyboardOnly_ieg2d_68",eyt="_itemDisabled_ieg2d_77",tyt="_turn_ieg2d_91",nyt="_time_ieg2d_96",syt="_footer_ieg2d_102",ryt="_footerMessage_ieg2d_112",iyt="_dangerButton_ieg2d_118",hl={root:Gbt,list:Kbt,item:Ybt,itemCursor:Xbt,itemSelected:Qbt,prompt:Jbt,keyboardOnly:Zbt,itemDisabled:eyt,turn:tyt,time:nyt,footer:syt,footerMessage:ryt,dangerButton:iyt},oyt="rewind-snapshot-list",Bq=e=>`${oyt}-opt-${e}`;function ayt(e,t){let n=0;for(const s of e)if(s.kind==="user"){if(n===t)return s.text.trim();n+=1}return""}function lyt(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function cyt({blocks:e,loadSnapshots:t,rewind:n,onError:s,onClose:r}){const{t:i}=ot(),[o,a]=f.useState([]),[c,u]=f.useState(!0),[d,h]=f.useState(null),[m,p]=f.useState(0),[g,b]=f.useState(null),[v,x]=f.useState(null);f.useEffect(()=>{let S=!0;return u(!0),t().then(L=>{S&&a(L.snapshots)}).catch(L=>{S&&s(L)}).finally(()=>{S&&u(!1)}),()=>{S=!1}},[t,s]);const y=f.useMemo(()=>o.map(S=>({snapshot:S,promptText:ayt(e,S.turnIndex)})).sort((S,L)=>S.snapshot.turnIndex-L.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=S=>{!S||d||(h(S),x(null),n(S).then(()=>{r()}).catch(L=>{s(L),x(i("rewind.failed",{reason:L instanceof Error?L.message:String(L)})),h(null)}))},_=S=>{const L=y[S];L&&(p(S),b(L.snapshot.promptId))},{keyboardMode:C}=ym({itemCount:y.length,activeIndex:m,onActiveIndexChange:p,onConfirm:_,enabled:!k});return f.useEffect(()=>{var L;const S=(L=w.current)==null?void 0:L.children[m];S==null||S.scrollIntoView({block:"nearest"})},[m]),f.useEffect(()=>{var L;if(c||y.length===0)return;const S=document.activeElement;(S==null?void 0:S.getAttribute("role"))==="dialog"&&((L=w.current)==null||L.focus())},[c,y.length]),c?l.jsx("div",{className:en("picker-empty"),children:i("rewind.loading")}):y.length===0?l.jsx("div",{className:en("picker-empty"),children:i("rewind.empty")}):l.jsxs("div",{className:hl.root,children:[l.jsx("div",{className:`${hl.list} ${C?hl.keyboardOnly:""}`,ref:w,role:"listbox","aria-label":i("rewind.title"),tabIndex:0,"aria-activedescendant":y.length>0?Bq(m):void 0,children:y.map(({snapshot:S,promptText:L},N)=>{const $=N===m,M=g===S.promptId,P=L||i("rewind.promptFallback",{id:S.promptId.slice(-8)});return l.jsxs("div",{id:Bq(N),role:"option","aria-selected":M,"aria-disabled":k||void 0,className:`${hl.item} ${$?hl.itemCursor:""} ${M?hl.itemSelected:""} ${k?hl.itemDisabled:""}`,onClick:()=>{k||_(N)},onMouseMove:()=>p(N),children:[l.jsxs("div",{className:hl.prompt,title:P,children:[l.jsxs("span",{className:hl.turn,children:["#",S.turnIndex+1]})," ",P]}),l.jsx("div",{className:hl.time,children:lyt(S.timestamp)})]},S.promptId)})}),l.jsxs("div",{className:hl.footer,children:[v&&l.jsx("span",{className:hl.footerMessage,role:"alert",children:v}),l.jsx("button",{type:"button",className:en("dialog-inline-button"),onClick:r,disabled:d!==null,children:i("common.cancel")}),l.jsx("button",{type:"button",className:`${en("dialog-danger-button")} ${hl.dangerButton}`,onClick:()=>T(g),disabled:!g||d!==null,children:i(d?"rewind.rewinding":"rewind.confirm")})]})]})}const A8="add-workspace-hint",$q="add-workspace-display-name-hint",zq="add-workspace-error",b_="add-workspace-suggestions",uyt=150;function Fq(e){return e.startsWith("/")||/^[A-Za-z]:[\\/]/.test(e)}function dyt({onClose:e,onAdd:t,displayNameEnabled:n=!1,onSuggest:s}){const{t:r}=ot(),[i,o]=f.useState(""),[a,c]=f.useState(""),[u,d]=f.useState(null),[h,m]=f.useState(!1),[p,g]=f.useState(!0),[b,v]=f.useState([]),[x,y]=f.useState(!1),[w,k]=f.useState(-1),[T,_]=f.useState("/"),C=f.useRef(null),S=f.useRef(!1);S.current=x&&b.length>0;const L=f.useRef(0),N=f.useRef(!1);f.useEffect(()=>{var z;(z=C.current)==null||z.focus()},[]);const $=f.useCallback(()=>{y(!1),k(-1)},[]);f.useEffect(()=>{if(!s)return;if(!Fq(i)){v([]),$();return}const z=++L.current,F=!N.current;N.current=!1;const B=setTimeout(()=>{s(i).then(W=>{z===L.current&&(v(W.suggestions),_(W.sep||"/"),k(-1),(F||S.current)&&y(W.suggestions.length>0))},()=>{z===L.current&&(v([]),$())})},uyt);return()=>clearTimeout(B)},[i,s,$]),f.useEffect(()=>{const z=F=>{F.key!=="Escape"||!S.current||F.isComposing||F.keyCode===229||(F.preventDefault(),$())};return window.addEventListener("keydown",z,{capture:!0}),()=>window.removeEventListener("keydown",z,{capture:!0})},[$]);const M=f.useCallback(z=>{var F;N.current=!1,o(z.path+T),d(null),$(),(F=C.current)==null||F.focus()},[T,$]),P=f.useCallback(z=>{const F=x&&b.length>0;if(z.key==="ArrowDown"){if(z.preventDefault(),!F){b.length>0&&y(!0);return}k(B=>(B+1)%b.length);return}if(z.key==="ArrowUp"){if(!F)return;z.preventDefault(),k(B=>(B<=0?b.length:B)-1);return}if(z.key==="Tab"&&F&&!z.shiftKey){const B=w>=0?b[w]:b.length===1?b[0]:void 0;B&&(z.preventDefault(),M(B));return}z.key==="Enter"&&F&&w>=0&&(z.preventDefault(),M(b[w]))},[x,b,w,M]),E=f.useCallback(async z=>{z.preventDefault();const F=i.trim();if(F){if(!Fq(F)){d(r("sidebar.addWorkspaceAbsError"));return}d(null),m(!0),$();try{const B=n?a.trim():"";B?await t(F,p,B):await t(F,p),e()}catch(B){d(B instanceof Error?B.message:r("sidebar.addWorkspaceError"))}finally{m(!1)}}},[i,a,n,p,t,e,$,r]),O=x&&b.length>0;return l.jsx(si,{title:r("sidebar.addWorkspaceTitle"),size:"md",onClose:e,children:l.jsxs("form",{className:"flex flex-col gap-6",onSubmit:E,children:[l.jsxs(oR,{children:[l.jsxs(Ep,{"data-invalid":u?!0:void 0,children:[l.jsx(Vg,{htmlFor:"add-workspace-path",children:r("sidebar.addWorkspacePath")}),l.jsxs("div",{className:"relative",children:[l.jsx(ri,{ref:C,id:"add-workspace-path",type:"text",placeholder:"/absolute/path/to/project",value:i,onChange:z=>{o(z.target.value),u&&d(null)},onKeyDown:P,onBlur:()=>{setTimeout(()=>{N.current=!0,$()},100)},disabled:h,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1,role:"combobox","aria-expanded":O,"aria-controls":O?b_:void 0,"aria-activedescendant":O&&w>=0?`${b_}-${w}`:void 0,"aria-describedby":u?`${zq} ${A8}`:A8,"aria-invalid":u?!0:void 0}),O&&l.jsx("ul",{id:b_,role:"listbox","aria-label":r("sidebar.addWorkspaceSuggestions"),className:"absolute inset-x-0 top-full z-50 mt-1 max-h-56 overflow-y-auto rounded-md border bg-popover py-1 text-popover-foreground shadow-md",children:b.map((z,F)=>l.jsxs("li",{id:`${b_}-${F}`,role:"option","aria-selected":F===w,className:`cursor-pointer truncate px-3 py-1.5 ${F===w?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onMouseDown:B=>{B.preventDefault(),M(z)},onMouseEnter:()=>k(F),children:[z.name,l.jsx("span",{className:"text-muted-foreground",children:T})]},z.path))})]}),l.jsx(g2,{id:A8,children:r("sidebar.addWorkspaceHint")}),u&&l.jsx(sbt,{id:zq,children:u})]}),n&&l.jsxs(Ep,{children:[l.jsx(Vg,{htmlFor:"add-workspace-display-name",children:r("sidebar.addWorkspaceDisplayName")}),l.jsx(ri,{id:"add-workspace-display-name",type:"text",value:a,onChange:z=>c(z.target.value),disabled:h,maxLength:256,autoComplete:"off","aria-describedby":$q}),l.jsx(g2,{id:$q,children:r("sidebar.addWorkspaceDisplayNameHint")})]}),l.jsxs(Ep,{orientation:"horizontal",children:[l.jsxs(eae,{children:[l.jsx(Vg,{htmlFor:"add-workspace-persist",children:r("sidebar.addWorkspacePersist")}),l.jsx(g2,{children:r("sidebar.addWorkspacePersistHint")})]}),l.jsx(tae,{id:"add-workspace-persist",checked:p,onCheckedChange:g,disabled:h})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(qn,{type:"button",variant:"outline",onClick:e,disabled:h,children:r("sidebar.addWorkspaceCancel")}),l.jsx(qn,{type:"submit",disabled:h||!i.trim(),children:r(h?"sidebar.addWorkspaceAdding":"sidebar.addWorkspaceRegister")})]})]})})}const iae="qwen-code-web-shell-collapsed-session-groups",lw="ws:";function Hq(e){return!e.startsWith(lw)}function hyt(e,t){return`${lw}${e}|group:${t}`}function oae(e){return`${lw}${e}|ungrouped`}function fyt(e,t){return t.startsWith(`${lw}${e}|`)}function aR(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(iae);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 myt(e){try{window.localStorage.setItem(iae,JSON.stringify(Array.from(e).sort()))}catch{}}function aae(e,t){const n=aR(),s=new Set(Array.from(n).filter(r=>!t(r)));for(const r of e)s.add(r);myt(s)}function pyt(e){const t=aR(),n=new Set,s=`${lw}${e}|group:`,r=oae(e);for(const i of t)i===r?n.add("ungrouped"):i.startsWith(s)&&n.add(i.slice(s.length));return n}function gyt(e,t){const n=new Set;for(const s of t)n.add(s==="ungrouped"?oae(e):hyt(e,s));aae(n,s=>fyt(e,s))}const byt="_sidebar_fodia_1",yyt="_resizing_fodia_20",xyt="_collapsed_fodia_24",vyt="_newChatButton_fodia_30",wyt="_pluginButton_fodia_31",kyt="_footerButton_fodia_32",_yt="_collapseButton_fodia_33",Syt="_projectRow_fodia_34",Cyt="_sessionRow_fodia_35",Tyt="_sessionGroupHeader_fodia_36",Eyt="_sessionGroupActionButton_fodia_37",Ayt="_retry_fodia_38",Nyt="_iconButton_fodia_39",jyt="_projectIconButton_fodia_40",Myt="_sessionActionButton_fodia_41",Iyt="_groupMenuItem_fodia_42",Ryt="_secondaryButton_fodia_43",Dyt="_dangerButton_fodia_44",Lyt="_primaryNav_fodia_80",Pyt="_navIcon_fodia_129",Oyt="_topRow_fodia_155",Byt="_brandLogo_fodia_170",$yt="_brandName_fodia_186",zyt="_workspacePicker_fodia_206",Fyt="_workspacePickerLabel_fodia_213",Hyt="_workspacePickerHeader_fodia_220",qyt="_workspaceAddIconButton_fodia_227",Uyt="_workspaceList_fodia_247",Vyt="_workspaceSessionBody_fodia_253",Wyt="_projectsHeader_fodia_257",Gyt="_pinnedSessionList_fodia_267",Kyt="_projectsHeaderToggle_fodia_275",Yyt="_projectsHeaderAction_fodia_276",Xyt="_projectsHeaderActions_fodia_284",Qyt="_projectSearch_fodia_335",Jyt="_addWorkspaceButton_fodia_357",Zyt="_body_fodia_377",ext="_sectionTitle_fodia_387",txt="_projectRowExpanded_fodia_402",nxt="_workspaceHeaderActions_fodia_428",sxt="_workspaceHeaderAction_fodia_428",rxt="_projectName_fodia_471",ixt="_sessionText_fodia_472",oxt="_sessionBadgeIcon_fodia_479",axt="_projectHoverAction_fodia_495",lxt="_sessionList_fodia_504",cxt="_sessionGroupSection_fodia_519",uxt="_sessionGroupHeaderRow_fodia_525",dxt="_sessionGroupDot_fodia_561",hxt="_sessionGroupDotMuted_fodia_568",fxt="_sessionGroupTitle_fodia_572",mxt="_sessionGroupCount_fodia_579",pxt="_sessionGroupChevron_fodia_584",gxt="_sessionGroupHeaderActions_fodia_605",bxt="_sessionGroupList_fodia_635",yxt="_currentSession_fodia_653",xxt="_busySession_fodia_658",vxt="_floatingTooltip_fodia_663",wxt="_tooltipContent_fodia_693",kxt="_tooltipTitle_fodia_699",_xt="_tooltipTags_fodia_706",Sxt="_tooltipTag_fodia_706",Cxt="_tooltipTagRunning_fodia_726",Txt="_tooltipTagNew_fodia_731",Ext="_tooltipMeta_fodia_736",Axt="_sessionStatusSlot_fodia_751",Nxt="_sessionStatusDot_fodia_763",jxt="_sidebarPulse_fodia_1",Mxt="_sessionTitlePin_fodia_773",Ixt="_sessionMetaSlot_fodia_805",Rxt="_sessionAttention_fodia_815",Dxt="_sessionAttentionUserInput_fodia_829",Lxt="_sessionLoading_fodia_834",Pxt="_sessionTime_fodia_844",Oxt="_sidebarSpin_fodia_1",Bxt="_runningSession_fodia_863",$xt="_sessionActions_fodia_879",zxt="_activeSessionActionButton_fodia_945",Fxt="_searchInput_fodia_964",Hxt="_renameInput_fodia_978",qxt="_dialogSelect_fodia_984",Uxt="_dialogInput_fodia_994",Vxt="_groupMenu_fodia_42",Wxt="_groupMenuItemActive_fodia_1036",Gxt="_groupMenuName_fodia_1042",Kxt="_groupMenuDot_fodia_1050",Yxt="_groupMenuEmptyDot_fodia_1051",Xxt="_groupMenuIcon_fodia_1052",Qxt="_groupMenuCheck_fodia_1080",Jxt="_groupMenuSeparator_fodia_1087",Zxt="_groupColorRed_fodia_1093",evt="_groupColorOrange_fodia_1097",tvt="_groupColorYellow_fodia_1101",nvt="_groupColorGreen_fodia_1105",svt="_groupColorBlue_fodia_1109",rvt="_groupColorPurple_fodia_1113",ivt="_groupColorCustom_fodia_1117",ovt="_renameForm_fodia_1127",avt="_notice_fodia_1143",lvt="_confirmContent_fodia_1158",cvt="_confirmDescription_fodia_1164",uvt="_workspaceRemovalActivityList_fodia_1171",dvt="_confirmActions_fodia_1179",hvt="_groupForm_fodia_1185",fvt="_fieldStack_fodia_1192",mvt="_groupCustomColorRow_fodia_1220",pvt="_groupColorPicker_fodia_1227",gvt="_groupHexField_fodia_1237",bvt="_groupColorError_fodia_1247",yvt="_footer_fodia_32",xvt="_footerPrimary_fodia_1302",vvt="_footerActions_fodia_1303",wvt="_footerButtonLabel_fodia_1319",kvt="_footerCompact_fodia_1326",_vt="_footerTight_fodia_1327",Svt="_version_fodia_1362",Cvt="_resizeHandle_fodia_1405",Tvt="_sessionActionButtonActive_fodia_1433",Evt="_menuActive_fodia_1439",Avt="_actionMenu_fodia_1443",Nvt="_actionMenuItem_fodia_1460",jvt="_actionMenuItemDanger_fodia_1491",Mvt="_actionMenuIcon_fodia_1501",Ivt="_actionMenuLabel_fodia_1520",Rvt="_archivedSection_fodia_1528",Dvt="_archivedHeader_fodia_1535",Lvt="_archivedChevron_fodia_1561",Pvt="_archivedTitle_fodia_1580",Ovt="_archivedCount_fodia_1589",Bvt="_archivedList_fodia_1604",$vt="_archivedRow_fodia_1611",zvt="_mobileOpen_fodia_1620",Ee={sidebar:byt,resizing:yyt,collapsed:xyt,newChatButton:vyt,pluginButton:wyt,footerButton:kyt,collapseButton:_yt,projectRow:Syt,sessionRow:Cyt,sessionGroupHeader:Tyt,sessionGroupActionButton:Eyt,retry:Ayt,iconButton:Nyt,projectIconButton:jyt,sessionActionButton:Myt,groupMenuItem:Iyt,secondaryButton:Ryt,dangerButton:Dyt,primaryNav:Lyt,navIcon:Pyt,topRow:Oyt,brandLogo:Byt,brandName:$yt,workspacePicker:zyt,workspacePickerLabel:Fyt,workspacePickerHeader:Hyt,workspaceAddIconButton:qyt,workspaceList:Uyt,workspaceSessionBody:Vyt,projectsHeader:Wyt,pinnedSessionList:Gyt,projectsHeaderToggle:Kyt,projectsHeaderAction:Yyt,projectsHeaderActions:Xyt,projectSearch:Qyt,addWorkspaceButton:Jyt,body:Zyt,sectionTitle:ext,projectRowExpanded:txt,workspaceHeaderActions:nxt,workspaceHeaderAction:sxt,projectName:rxt,sessionText:ixt,sessionBadgeIcon:oxt,projectHoverAction:axt,sessionList:lxt,sessionGroupSection:cxt,sessionGroupHeaderRow:uxt,sessionGroupDot:dxt,sessionGroupDotMuted:hxt,sessionGroupTitle:fxt,sessionGroupCount:mxt,sessionGroupChevron:pxt,sessionGroupHeaderActions:gxt,sessionGroupList:bxt,currentSession:yxt,busySession:xxt,floatingTooltip:vxt,tooltipContent:wxt,tooltipTitle:kxt,tooltipTags:_xt,tooltipTag:Sxt,tooltipTagRunning:Cxt,tooltipTagNew:Txt,tooltipMeta:Ext,sessionStatusSlot:Axt,sessionStatusDot:Nxt,sidebarPulse:jxt,sessionTitlePin:Mxt,sessionMetaSlot:Ixt,sessionAttention:Rxt,sessionAttentionUserInput:Dxt,sessionLoading:Lxt,sessionTime:Pxt,sidebarSpin:Oxt,runningSession:Bxt,sessionActions:$xt,activeSessionActionButton:zxt,searchInput:Fxt,renameInput:Hxt,dialogSelect:qxt,dialogInput:Uxt,groupMenu:Vxt,groupMenuItemActive:Wxt,groupMenuName:Gxt,groupMenuDot:Kxt,groupMenuEmptyDot:Yxt,groupMenuIcon:Xxt,groupMenuCheck:Qxt,groupMenuSeparator:Jxt,groupColorRed:Zxt,groupColorOrange:evt,groupColorYellow:tvt,groupColorGreen:nvt,groupColorBlue:svt,groupColorPurple:rvt,groupColorCustom:ivt,renameForm:ovt,notice:avt,confirmContent:lvt,confirmDescription:cvt,workspaceRemovalActivityList:uvt,confirmActions:dvt,groupForm:hvt,fieldStack:fvt,groupCustomColorRow:mvt,groupColorPicker:pvt,groupHexField:gvt,groupColorError:bvt,footer:yvt,footerPrimary:xvt,footerActions:vvt,footerButtonLabel:wvt,footerCompact:kvt,footerTight:_vt,version:Svt,resizeHandle:Cvt,sessionActionButtonActive:Tvt,menuActive:Evt,actionMenu:Avt,actionMenuItem:Nvt,actionMenuItemDanger:jvt,actionMenuIcon:Mvt,actionMenuLabel:Ivt,archivedSection:Rvt,archivedHeader:Dvt,archivedChevron:Lvt,archivedTitle:Pvt,archivedCount:Ovt,archivedList:Bvt,archivedRow:$vt,mobileOpen:zvt};function R9({label:e,count:t,expanded:n,color:s,children:r,onToggle:i,onRename:o,onDelete:a,renameLabel:c,deleteLabel:u,actionsDisabled:d}){const h=s!=null&&s.startsWith("#")?Ee.groupColorCustom:s?Ee[`groupColor${s[0].toUpperCase()}${s.slice(1)}`]:Ee.sessionGroupDotMuted,m=s!=null&&s.startsWith("#")?{"--session-group-custom-color":s}:void 0;return l.jsxs("section",{className:Ee.sessionGroupSection,"aria-label":e,children:[l.jsxs("div",{className:Ee.sessionGroupHeaderRow,children:[l.jsxs("button",{type:"button",className:Ee.sessionGroupHeader,"aria-expanded":n,onClick:i,children:[l.jsx("span",{className:`${Ee.sessionGroupDot} ${h}`,style:m,"aria-hidden":"true"}),l.jsx("span",{className:Ee.sessionGroupTitle,children:e}),l.jsxs("span",{className:Ee.sessionGroupCount,children:["· ",t]}),l.jsx("span",{className:Ee.sessionGroupChevron,"aria-hidden":"true",children:n?l.jsx(Ql,{}):l.jsx(Q4,{})})]}),(o||a)&&l.jsxs("div",{className:Ee.sessionGroupHeaderActions,children:[o&&l.jsx("button",{className:Ee.sessionGroupActionButton,type:"button",title:c,"aria-label":c,disabled:d,onClick:o,children:l.jsx(Y7,{})}),a&&l.jsx("button",{className:Ee.sessionGroupActionButton,type:"button",title:u,"aria-label":u,disabled:d,onClick:a,children:l.jsx(hg,{})})]})]}),n&&l.jsx("div",{className:Ee.sessionGroupList,children:r})]})}const Fvt="_section_kbnw6_1",Hvt="_headerRow_kbnw6_6",qvt="_header_kbnw6_6",Uvt="_headerDisabled_kbnw6_34",Vvt="_headerContent_kbnw6_42",Wvt="_chevron_kbnw6_50",Gvt="_folderIcon_kbnw6_55",Kvt="_chevronOpen_kbnw6_59",Yvt="_name_kbnw6_63",Xvt="_badge_kbnw6_71",Qvt="_gitPill_kbnw6_85",Jvt="_sessions_kbnw6_107",Zvt="_empty_kbnw6_114",ewt="_error_kbnw6_120",twt="_sessionItemReadOnly_kbnw6_126",nwt="_sessionName_kbnw6_137",swt="_sessionTime_kbnw6_144",mo={section:Fvt,headerRow:Hvt,header:qvt,headerDisabled:Uvt,headerContent:Vvt,chevron:Wvt,folderIcon:Gvt,chevronOpen:Kvt,name:Yvt,badge:Xvt,gitPill:Qvt,sessions:Jvt,empty:Zvt,error:ewt,sessionItemReadOnly:twt,sessionName:nwt,sessionTime:swt};function qq(...e){return e.filter(Boolean).join(" ")}function rwt(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-zA-Z]:[\\/]/.test(e)}function iwt(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function owt({open:e}){const t=e?Bpe:z_;return l.jsx(t,{className:mo.folderIcon,size:16,strokeWidth:1.2,"aria-hidden":"true"})}function awt({workspace:e,renderHeader:t,client:n,reloadToken:s,untrustedLabel:r,readOnlyLabel:i,trustToOpenLabel:o,noSessionsLabel:a,loadErrorLabel:c,organizationEnabled:u,ungroupedLabel:d,formatTime:h,searchQuery:m="",expanded:p,autoExpandKey:g,onExpandedChange:b,renderSessions:v=!0,renderSession:x,headerActions:y,onRenameGroup:w,onDeleteGroup:k,renameGroupLabel:T,deleteGroupLabel:_,groupActionsDisabled:C,excludePinned:S=!1,onOpenGitDiff:L}){const{t:N}=ot(),[$,M]=f.useState([]),[P,E]=f.useState([]),[O,z]=f.useState(!1),[F,B]=f.useState(!1),[W,I]=f.useState(()=>pyt(e.id)),[Y,V]=f.useState(!1),[j,ee]=f.useState(),se=p??F,X=!e.primary&&!e.trusted,Q=e.primary&&!e.trusted;f.useEffect(()=>{p===void 0&&B(!1)},[p,e.id]),f.useEffect(()=>{gyt(e.id,W)},[W,e.id]),f.useEffect(()=>{p===void 0&&g&&B(!0)},[g,p]);const ue=f.useCallback(async()=>{if(!Q)try{const ye=await n.workspaceByCwd(e.cwd).listWorkspaceSessions({pageSize:wd,archiveState:"active",...u?{view:"organized",group:"all"}:{}});M(ye),z(!1)}catch(ye){console.warn("[WorkspaceSection] session poll failed:",ye),z(!0)}},[n,Q,u,e.cwd]);f.useEffect(()=>{if(!v||Q||!u){E([]);return}let ye=!1;return n.workspaceByCwd(e.cwd).listSessionGroups().then(oe=>{ye||E(oe.groups)}).catch(oe=>{console.warn("[WorkspaceSection] group catalog load failed:",oe)}),()=>{ye=!0}},[n,Q,u,s,v,e.cwd]),f.useEffect(()=>{if(!v||!se&&!m.trim()||(ue(),X))return;const ye=setInterval(()=>void ue(),1e4);return()=>clearInterval(ye)},[se,ue,X,s,v,m]);const re=rwt(e.cwd)?e.cwd:void 0,J=f.useRef(!1),q=f.useCallback(async()=>{if(!(!L||!e.trusted||!re))try{const ye=await n.workspaceByCwd(re).workspaceGit();J.current=!1,ee(ye)}catch(ye){J.current||(console.warn("[WorkspaceSection] git status poll failed:",ye),J.current=!0)}},[n,re,L,e.trusted]);f.useEffect(()=>{if(!L||!e.trusted||!re){ee(void 0);return}q();const ye=()=>void q();window.addEventListener("focus",ye);const oe=window.setInterval(()=>{document.visibilityState==="visible"&&q()},6e4);return()=>{window.removeEventListener("focus",ye),window.clearInterval(oe)}},[re,q,L,s,e.trusted]);const Z=f.useMemo(()=>{const ye=m.trim().toLowerCase();return $.filter(oe=>S&&oe.isPinned?!1:ye?(oe.displayName||"").toLowerCase().includes(ye)||oe.sessionId.toLowerCase().includes(ye):!0)},[S,m,$]),he=f.useMemo(()=>{if(!u||P.length===0)return null;const ye=new Set;return{sections:P.map(we=>{const Ve=Z.filter(lt=>lt.groupId===we.id);return Ve.forEach(lt=>ye.add(lt.sessionId)),{group:we,sessions:Ve}}),ungrouped:Z.filter(we=>!ye.has(we.sessionId))}},[P,u,Z]);return l.jsxs("div",{className:mo.section,children:[l.jsxs("div",{className:qq(mo.headerRow,Q&&mo.headerDisabled),onMouseEnter:()=>V(!0),onMouseLeave:()=>V(!1),onFocus:()=>V(!0),onBlur:ye=>{ye.currentTarget.contains(ye.relatedTarget)||V(!1)},children:[l.jsx("button",{className:mo.header,type:"button",disabled:Q,"aria-expanded":se,onClick:()=>{const ye=!se;B(ye),b==null||b(ye)},children:t?t(se):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:qq(mo.chevron,se&&mo.chevronOpen),children:l.jsx(owt,{open:se})}),l.jsx("span",{className:mo.headerContent,children:l.jsx("span",{className:mo.name,children:NC(e)})}),!e.trusted&&l.jsx("span",{className:mo.badge,children:r}),X&&l.jsx("span",{className:mo.badge,children:i})]})}),L&&e.trusted&&(j==null?void 0:j.branch)&&l.jsx("button",{type:"button",className:mo.gitPill,"aria-label":`${N("gitDiff.title")} — ${j.branch}`,onClick:()=>L(e.cwd),children:l.jsx(Bie,{branch:j.branch,status:j,compact:!0})}),y==null?void 0:y(Y)]}),v&&(se||!!m.trim())&&!Q&&l.jsx("div",{className:mo.sessions,children:O?l.jsx("div",{className:mo.error,role:"status",children:c}):Z.length===0?l.jsx("div",{className:mo.empty,children:a}):he?l.jsxs(l.Fragment,{children:[he.sections.map(({group:ye,sessions:oe})=>l.jsx(R9,{id:`group:${ye.id}`,label:ye.name,count:oe.length,color:ye.color,expanded:!W.has(ye.id),onToggle:()=>{I(we=>{const Ve=new Set(we);return Ve.has(ye.id)?Ve.delete(ye.id):Ve.add(ye.id),Ve})},onRename:w?()=>w(ye,e.cwd):void 0,onDelete:k?()=>k(ye,e.cwd):void 0,renameLabel:T,deleteLabel:_,actionsDisabled:C,children:oe.map(we=>x(we))},ye.id)),he.ungrouped.length>0&&l.jsx(R9,{id:"ungrouped",label:d,count:he.ungrouped.length,expanded:!W.has("ungrouped"),onToggle:()=>{I(ye=>{const oe=new Set(ye);return oe.has("ungrouped")?oe.delete("ungrouped"):oe.add("ungrouped"),oe})},children:he.ungrouped.map(ye=>x(ye))})]}):Z.map(ye=>{if(!X)return x(ye);const oe=iwt(ye),we=ye.createdAt?h(ye.createdAt):"";return l.jsxs("div",{className:mo.sessionItemReadOnly,role:"note","aria-label":`${oe}${we?`, ${we}`:""}. ${o}`,children:[l.jsx("span",{className:mo.sessionName,children:oe}),we&&l.jsx("span",{className:mo.sessionTime,children:we})]},ye.sessionId)})})]})}const lae="qwen-code-web-shell-sidebar-width",y_=260,lwt=220,cae=420,cwt=344,uwt=250,uae=200,dwt=56,Uq=uae-dwt,hwt=2e3,fwt=3e4,Vq=96,mwt="recent",N8=240,$0=8,j8="__custom__",z0="#416ef5";function Vm(e,t){return`${t??""}\0${e}`}const pwt=["settings","version","theme","sessionsOverview","splitView","daemonStatus","collapse"],gwt=["newTask","plugins","scheduledTasks","goals"],bwt=["details","rename","group","export","delete","pin","archive"],ywt=["pin","archive"],F0=["red","orange","yellow","green","blue","purple"];function fl(...e){return e.filter(Boolean).join(" ")}function Wq(e){return e instanceof DOMException&&e.name==="AbortError"}function xwt(e){return e?e.split(/[\\/]+/).filter(Boolean).at(-1)??e:""}function b2(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function vwt(e){const t=b2(e).replace(/\s+/g," ").trim();return t.length<=Vq?t:`${t.slice(0,Vq-3).trimEnd()}...`}function wwt(e){if(!e.createdAt)return 0;const t=Date.parse(e.createdAt);return Number.isFinite(t)?t:0}function x_(e){return e[0]??"blue"}function D9(e){const t=e.trim();if(/^#[0-9a-f]{6}$/i.test(t))return t.toLowerCase()}function Gq(e,t){const n=e.trim();return t.includes(n)?n:D9(n)}function Kq(e){if(e.startsWith("#"))return Ee.groupColorCustom;switch(e){case"red":return Ee.groupColorRed;case"orange":return Ee.groupColorOrange;case"yellow":return Ee.groupColorYellow;case"green":return Ee.groupColorGreen;case"blue":return Ee.groupColorBlue;case"purple":return Ee.groupColorPurple}}function kwt(e){return e.startsWith("#")?{backgroundColor:e}:void 0}function S4(e){return Math.min(cae,Math.max(lwt,e))}function _wt(e){return Math.min(cae,Math.max(uae,e))}function Swt(){if(typeof window>"u")return y_;try{const e=window.localStorage.getItem(lae),t=e?Number(e):y_;return Number.isFinite(t)?S4(t):y_}catch{return y_}}function Yq(e){try{window.localStorage.setItem(lae,String(S4(e)))}catch{}}function Cwt(){return l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{d:"M12 5v14M5 12h14"})})}function Twt(){return l.jsx("svg",{viewBox:"0 0 141.38 140","aria-hidden":"true",children:l.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 l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?l.jsx("path",{d:"m6 9 6 6 6-6"}):l.jsx("path",{d:"m9 6 6 6-6 6"})})}function Ewt({collapsed:e,onCollapsedChange:t,onOpenSettings:n,onOpenPlugins:s,onOpenDaemonStatus:r,onOpenScheduledTasks:i,onOpenGoals:o,onOpenSessions:a,canOpenSessionsOverview:c,onOpenSplitView:u,canOpenSplitView:d,onNewSession:h,onLoadSession:m,onSelectCurrentSession:p,onError:g,theme:b,onThemeChange:v,mobileOpen:x,sessionListReloadToken:y,selectedWorkspaceCwd:w,onSelectWorkspace:k,onOpenGitDiff:T,workspaces:_,lockedWorkspaceCwd:C,lockedWorkspace:S,branding:L,primaryNav:N,hideProjectHeader:$,sessionActions:M,footer:P}){var td,wm,yh,xh,h0,km,f0,Hl,co,vh,gw,m0,bw,yb,_m,bi,La,xb,Vo,wh;const{t:E}=ot(),O=Dl(),z=B1(),F=To(),B=ol(),W=f.useMemo(()=>new Set(P===!1?[]:(P==null?void 0:P.items)??pwt),[P]),I=f.useMemo(()=>new Set((N==null?void 0:N.items)??gwt),[N==null?void 0:N.items]),Y=f.useMemo(()=>new Set((M==null?void 0:M.items)??bwt),[M==null?void 0:M.items]),V=f.useMemo(()=>new Set((M==null?void 0:M.inlineItems)??ywt),[M==null?void 0:M.inlineItems]),j=L!==!1&&!(x&&((L==null?void 0:L.hideWhenCompact)??!0)),ee=!!((wm=(td=O.capabilities)==null?void 0:td.features)!=null&&wm.includes(eR)),se=!!((xh=(yh=O.capabilities)==null?void 0:yh.features)!=null&&xh.includes("session_archive")),X=!!((km=(h0=O.capabilities)==null?void 0:h0.features)!=null&&km.includes("workspace_qualified_rest_core")),Q=f.useMemo(()=>{var G;return _??((G=B.capabilities)==null?void 0:G.workspaces)??[]},[_,(f0=B.capabilities)==null?void 0:f0.workspaces]),ue=((Hl=Q.find(G=>G.primary))==null?void 0:Hl.cwd)??((co=B.capabilities)==null?void 0:co.workspaceCwd)??O.workspaceCwd,re=C?Q.find(G=>G.cwd===C):void 0,J=!C||(re==null?void 0:re.primary)===!0,{sessions:q,loading:Z,error:he,data:ye,reload:oe,deleteSession:we,exportSession:Ve,archiveSession:lt}=$_({autoLoad:!0,enabled:J,pageSize:wd,archiveState:"active",...ee?{view:"organized",group:"all"}:{}}),Et=!ee||!J||ye!==void 0,{sessions:pt,reload:je}=$_({autoLoad:ee,enabled:ee&&J,pageSize:wd,archiveState:"active",view:"organized",group:"pinned"}),[Ae,De]=f.useState(!1),[Ne,tt]=f.useState(!0),[Se,Be]=f.useState([]),{sessions:le,loading:Le,error:sn,reload:Cn,deleteSession:In,unarchiveSession:_t}=$_({autoLoad:!0,enabled:se&&Ae&&J,pageSize:wd,archiveState:"archived",...ee?{view:"organized",group:"all"}:{}}),[Te,at]=f.useState([]),[ke,Pe]=f.useState(!1),[ve,Ke]=f.useState(!1),[me,qe]=f.useState(0),[Mt,ln]=f.useState([]),[Ft,st]=f.useState([]),[Tn,ne]=f.useState([]),[gt,bt]=f.useState(!1),[It,Rt]=f.useState(null),[We,Zn]=f.useState(""),[Ar,Ge]=f.useState(()=>new Set),dt=f.useRef(new Set),[bn,Ht]=f.useState(()=>new Set),Rn=f.useRef(new Set),[Gn,Or]=f.useState(!1),Bn=f.useRef(!1),[_n,gs]=f.useState(null),[Qn,Dn]=f.useState(null),[wn,br]=f.useState(null),[Qs,hs]=f.useState(""),[cn,Jn]=f.useState("blue"),[Wi,is]=f.useState(z0),[tr,kr]=f.useState(null),[Br,gr]=f.useState(()=>new Set(Array.from(aR()).filter(Hq))),bs=f.useRef(new Set),ir=f.useRef(!0),[or,pe]=f.useState(!ee),[Oe,rt]=f.useState(ee);Oe!==ee&&(rt(ee),pe(!ee));const[Ut,fn]=f.useState(Swt),[un,_e]=f.useState(!1),[Ue,zt]=f.useState(!0),[Sn,Gt]=f.useState(!1),[Ls,kn]=f.useState(!1),[Pn,es]=f.useState(null),[jn,$n]=f.useState(null),[qs,mn]=f.useState(!1),Ps=f.useRef(!1),ys=f.useRef(!1),[Re,Dt]=f.useState(!1),[zn,xs]=f.useState(0),[nr,Js]=f.useState(null),vs=f.useCallback(()=>{xs(G=>G+1)},[]);f.useEffect(()=>(Ps.current=!0,()=>{Ps.current=!1,ys.current=!0}),[]);const[Jr,Gi]=f.useState(""),[$r,Ii]=f.useState(!1),[qo,ci]=f.useState(()=>new Set),Ri=f.useRef(null),ae=f.useRef(!1),xe=f.useRef(null),ze=f.useRef(null),Qe=f.useRef(!1),Kt=f.useRef(null),At=O.sessionId,Un=!!((gw=(vh=O.capabilities)==null?void 0:vh.features)!=null&&gw.includes("workspace_runtime_removal")),Os=!!((bw=(m0=O.capabilities)==null?void 0:m0.features)!=null&&bw.includes("workspace_display_name")),Ss=((_m=(yb=O.capabilities)==null?void 0:yb.features)==null?void 0:_m.includes("session_export"))??!1,yr=((La=(bi=O.capabilities)==null?void 0:bi.features)==null?void 0:La.includes("workspace_archived_session_export"))??!1,Zr=At?Vm(At,O.workspaceCwd):null,_c=xwt(O.workspaceCwd)||E("sidebar.projectFallback"),xr=f.useMemo(()=>{const G=Q.length>0?Q:[{id:"primary",cwd:O.workspaceCwd||_c,primary:!0,trusted:!0}];return C?G.filter(Ce=>Ce.cwd===C):G},[O.workspaceCwd,C,_c,Q]),ua=f.useMemo(()=>{const G=new Map;for(const Ce of[...J?pt:[],...Se])G.set(Vm(Ce.sessionId,Ce.workspaceCwd||ue),Ce);return[...G.values()]},[J,ue,pt,Se]),Nr=f.useCallback(G=>{const Ce=xr.find(Ie=>Ie.cwd===G.workspaceCwd);return!Ce||Ce.primary?F:B.client.workspaceByCwd(Ce.cwd)},[xr,B.client,F]),gi=f.useCallback(G=>{var Ce;return!G||((Ce=xr.find(Ie=>Ie.cwd===G))==null?void 0:Ce.primary)!==!1},[xr]),sr=f.useCallback(G=>Vm(G.sessionId,G.workspaceCwd||ue),[ue]),Je=f.useCallback(G=>Zr===sr(G),[Zr,sr]),Lt=f.useCallback(G=>{const Ce=xr.find(Ie=>Ie.cwd===G.workspaceCwd);return(Ce==null?void 0:Ce.trusted)===!1?!1:se&&((Ce==null?void 0:Ce.primary)!==!1||X)},[xr,se,X]),Yt=f.useCallback(G=>{const Ce=G.workspaceCwd||ue,Ie=xr.find(nt=>nt.cwd===Ce);return yr&&(Ie==null?void 0:Ie.trusted)===!0?Ie.cwd:void 0},[yr,xr,ue]);f.useEffect(()=>{if(!ee){Be([]);return}const G=xr.filter(Ie=>!Ie.primary&&Ie.trusted);let Ce=!1;return Promise.allSettled(G.map(async Ie=>(await B.client.workspaceByCwd(Ie.cwd).listWorkspaceSessions({pageSize:wd,archiveState:"active",view:"organized",group:"pinned"})).map(ht=>({...ht,workspaceCwd:Ie.cwd})))).then(Ie=>{Ce||Be(Ie.flatMap(nt=>nt.status==="fulfilled"?nt.value:[]))}),()=>{Ce=!0}},[xr,ee,B.client,zn]);const Nn=f.useMemo(()=>{const G=new Map;for(const Ce of[...J?le:[],...Te])G.set(sr(Ce),Ce);return[...G.values()]},[le,sr,J,Te]),Hn=J&&Le||ke,He=J&&!!sn||ve;f.useEffect(()=>{if(!Ae)return;if(!se||!X){at([]),Pe(!1),Ke(!1);return}const G=xr.filter(Ie=>!Ie.primary&&Ie.trusted);if(G.length===0){at([]),Pe(!1),Ke(!1);return}let Ce=!1;return Pe(!0),Promise.allSettled(G.map(async Ie=>(await B.client.workspaceByCwd(Ie.cwd).listWorkspaceSessions({pageSize:wd,archiveState:"archived",...ee?{view:"organized",group:"all"}:{}})).map(ht=>({...ht,workspaceCwd:Ie.cwd})))).then(Ie=>{if(Ce)return;const nt=Ie.filter(ht=>ht.status==="rejected");at(Ie.flatMap(ht=>ht.status==="fulfilled"?ht.value:[])),Ke(nt.length>0);for(const ht of nt)console.warn("[WebShellSidebar] archived session load failed:",ht.reason)}).finally(()=>{Ce||Pe(!1)}),()=>{Ce=!0}},[Ae,xr,ee,me,se,B.client,X,zn]);const pn=((xb=O.capabilities)==null?void 0:xb.qwenCodeVersion)||"",js=pn?/^\d/.test(pn)?`v${pn}`:pn:"",ls=!e&&Ut<cwt,Cs=!e&&Ut<uwt,Di={"--web-shell-sidebar-width":`${Ut}px`},lo=Gn;f.useEffect(()=>{var Ie;if(!At)return;const G=xr.find(nt=>nt.cwd===O.workspaceCwd)??(xr.length===1&&((Ie=xr[0])!=null&&Ie.primary)?xr[0]:void 0);if(!G)return;const Ce=`session:${At}:${G.id}`;ze.current!==Ce&&(ze.current=Ce,zt(!0),G.primary?_e(!0):Js({id:G.id,key:Ce}))},[O.workspaceCwd,At,xr]),f.useEffect(()=>{if(At||w!==void 0||!B.capabilities)return;const G=Q.find(Ie=>Ie.cwd===O.workspaceCwd),Ce=`new:${(G==null?void 0:G.id)??"primary"}`;if(ze.current!==Ce){if(ze.current=Ce,zt(!0),G&&!G.primary){_e(!1),Js({id:G.id,key:Ce}),k==null||k(G.cwd);return}_e(!0)}},[O.workspaceCwd,At,k,w,B.capabilities,Q]);const Bs=f.useCallback((G,Ce,Ie)=>{const nt=Vm(G,Ie||ue),ht=new Set(dt.current);Ce?ht.add(nt):ht.delete(nt),dt.current=ht,Ge(ht)},[ue]),Si=f.useCallback(async()=>{if(!ee){ln([]),ne([]),pe(!0);return}try{const G=await F.listSessionGroups();ln(G.groups),st(G.groups),ne(G.colorOptions),pe(!0)}catch(G){g(G,E("sidebar.groupsLoadFailed"))}},[g,ee,E,F]);f.useEffect(()=>{if(!ee){ln([]),ne([]),pe(!0);return}pe(!1),Si()},[ee,Si]),f.useEffect(()=>{if(!Qn)return;const G=Ie=>{var nt;(nt=Ri.current)!=null&&nt.contains(Ie.target)||Dn(null)},Ce=Ie=>{Ie.key==="Escape"&&Dn(null)};return document.addEventListener("mousedown",G),document.addEventListener("keydown",Ce),()=>{document.removeEventListener("mousedown",G),document.removeEventListener("keydown",Ce)}},[Qn]),f.useEffect(()=>{if(!Qn)return;const G=window.requestAnimationFrame(()=>{var nt;const Ce=Array.from(((nt=Ri.current)==null?void 0:nt.querySelectorAll("button:not(:disabled)"))??[]),Ie=Ce.find(ht=>ht.getAttribute("aria-checked")==="true")??Ce[0];Ie==null||Ie.focus()});return()=>window.cancelAnimationFrame(G)},[Qn]);const ui=f.useCallback(G=>{var Vn,Ln;const Ce=Array.from(((Vn=Ri.current)==null?void 0:Vn.querySelectorAll("button:not(:disabled)"))??[]);if(Ce.length===0)return;const Ie=Ce.indexOf(document.activeElement),nt=Ie>=0?Ie:-1;let ht;if(G.key==="ArrowDown")ht=(nt+1)%Ce.length;else if(G.key==="ArrowUp")ht=(nt-1+Ce.length)%Ce.length;else if(G.key==="Home")ht=0;else if(G.key==="End")ht=Ce.length-1;else if(G.key==="Escape"){G.preventDefault(),Dn(null);return}ht!==void 0&&(G.preventDefault(),(Ln=Ce[ht])==null||Ln.focus())},[]);f.useEffect(()=>()=>{var G;(G=Kt.current)==null||G.call(Kt,!1)},[]),f.useEffect(()=>{e&&(_e(!1),Gt(!1),Gi(""))},[e]);const Kn=f.useMemo(()=>q.some(G=>G.hasActivePrompt),[q]);f.useEffect(()=>{if(!un&&!Kn)return;const G=Kn&&!he?hwt:fwt,Ce=window.setInterval(()=>{document.hidden||Qe.current||(Qe.current=!0,oe().finally(()=>{Qe.current=!1}))},G);return()=>window.clearInterval(Ce)},[he,Kn,un,oe]);const Ts=f.useRef(y);f.useEffect(()=>{y!==void 0&&y!==Ts.current&&!document.hidden&&!Qe.current&&(Ts.current=y,Qe.current=!0,oe().finally(()=>{Qe.current=!1}))},[y,oe]),f.useEffect(()=>{const G=new Map(q.map(Ie=>[sr(Ie),!!Ie.hasActivePrompt])),Ce=xe.current;xe.current=G,Ce!==null&&ci(Ie=>{const nt=new Set(Ie);let ht=!1;for(const[Vn,Ln]of Ce){const cs=G.get(Vn);Ln&&cs===!1&&Vn!==Zr&&!nt.has(Vn)&&(nt.add(Vn),ht=!0)}for(const Vn of nt)(Vn===Zr||!G.has(Vn)||G.get(Vn))&&(nt.delete(Vn),ht=!0);return ht?nt:Ie})},[Zr,sr,q]);const Bl=f.useCallback(async(G,Ce,Ie)=>{var ht;const nt=await F.addWorkspace(G,{persist:Ce,...Ie?{displayName:Ie}:{}});if(Ce&&nt.persisted!==!0)throw new Error(E("sidebar.addWorkspacePersistenceError"));try{await((ht=B.refreshCapabilities)==null?void 0:ht.call(B))}catch{}},[E,F,B]),Li=f.useCallback(G=>F.suggestWorkspacePaths(G),[F]),di=f.useCallback(async G=>{var Ce;if(Ps.current){w===G.cwd&&(k==null||k(void 0)),xs(Ie=>Ie+1);try{await((Ce=B.refreshCapabilities)==null?void 0:Ce.call(B))}catch{}Ps.current&&(es(null),$n(null),Dt(!1),oe().catch(()=>{}),Cn().catch(()=>{}))}},[k,oe,Cn,w,B]),$l=f.useCallback(G=>{qs||(ys.current=!1,$n(null),Dt(!1),es(G))},[qs]),Uc=f.useCallback(async()=>{const G=Pn;if(!G||qs)return;const Ce=jn!==null;if(!(Ce&&O.sessionId&&O.workspaceCwd===G.cwd)){mn(!0);try{await F.removeWorkspace(G.id,{force:Ce}),await di(G)}catch(Ie){if(!Ps.current)return;if(Ie instanceof yc){const nt=Ie.body;if(Ie.status===409&&(nt==null?void 0:nt.code)==="workspace_busy"&&nt.activity){$n(nt.activity);return}if(Ie.status===400&&(nt==null?void 0:nt.code)==="workspace_mismatch"){await di(G);return}if(Ie.status===409&&((nt==null?void 0:nt.code)==="workspace_removal_in_progress"||(nt==null?void 0:nt.code)==="workspace_registration_in_progress")){Dt(!0);let ht=Ie,Vn=!0;for(let Ln=0;Ln<20;Ln++){if(!Ps.current||ys.current||(await new Promise(cs=>window.setTimeout(cs,250)),!Ps.current||ys.current))return;try{await F.removeWorkspace(G.id,{force:Ce}),await di(G);return}catch(cs){if(!Ps.current)return;if(ht=cs,cs instanceof yc){const Zs=cs.body;if(cs.status===400&&(Zs==null?void 0:Zs.code)==="workspace_mismatch"){await di(G);return}if(cs.status===409&&(Zs==null?void 0:Zs.code)==="workspace_busy"&&Zs.activity){Dt(!1),$n(Zs.activity);return}if(cs.status===409&&((Zs==null?void 0:Zs.code)==="workspace_removal_in_progress"||(Zs==null?void 0:Zs.code)==="workspace_registration_in_progress"))continue}Vn=!1;break}}if(!Ps.current||ys.current)return;Dt(!1),g(Vn?new Error("Workspace removal remained in progress after retries."):ht,E("sidebar.removeWorkspaceError"));return}}g(Ie,E("sidebar.removeWorkspaceError"))}finally{Ps.current&&mn(!1)}}},[O.sessionId,O.workspaceCwd,g,di,E,F,jn,Pn,qs]),Xu=f.useCallback(G=>{Bn.current||(Bn.current=!0,Or(!0),(async()=>{try{await h(G)&&(oe().catch(()=>{}),vs())}catch(Ce){Wq(Ce)||g(Ce,E("sidebar.newSessionFailed"))}finally{Bn.current=!1,Or(!1)}})())},[vs,g,h,oe,E]),zr=f.useCallback((G,Ce)=>{const Ie=Vm(G,Ce||ue);if(Ie===Zr){p==null||p();return}dt.current.has(Ie)||(ci(nt=>{if(!nt.has(Ie))return nt;const ht=new Set(nt);return ht.delete(Ie),ht}),Bs(G,!0,Ce),(async()=>{try{await m(G,Ce)}catch(nt){Wq(nt)||g(nt,E("sidebar.switchFailed"))}finally{Bs(G,!1,Ce)}})())},[Zr,g,m,p,ue,Bs,E]),Ra=f.useCallback(G=>{Rt(G.sessionId),Zn(b2(G))},[]),zl=f.useCallback(()=>{Rt(null),Zn("")},[]),Qu=f.useCallback(()=>{const G=We.trim();if(!G||It!==At){zl();return}const Ce=It;dt.current.has(Vm(Ce,O.workspaceCwd))||(Bs(Ce,!0,O.workspaceCwd),z.renameSession(G).then(()=>{zl(),oe(),vs()}).catch(Ie=>{g(Ie,E("sidebar.renameFailed")),zl()}).finally(()=>{Bs(Ce,!1,O.workspaceCwd)}))},[z,vs,zl,O.workspaceCwd,At,We,It,g,oe,Bs,E]),Uo=f.useCallback(G=>{Je(G)||gs(G)},[Je]),xm=f.useCallback((G,Ce,Ie)=>{const nt=Vm(G,Ie||ue),ht=new Set(Rn.current);Ce?ht.add(nt):ht.delete(nt),Rn.current=ht,Ht(ht)},[ue]),ph=f.useCallback(G=>{const Ce=G.sessionId,Ie=sr(G),nt=G.isArchived===!0;(nt?!Yt(G):!Ss)||Rn.current.has(Ie)||(xm(Ce,!0,G.workspaceCwd),(async()=>{try{let ht;if(nt){const cs=Yt(G);if(!cs)return;ht=await B.client.workspaceByCwd(cs).exportArchivedSession(Ce,{format:"html"})}else ht=await Ve(Ce,"html");const Vn=new Blob([ht.content],{type:ht.mimeType||"text/html"}),Ln=URL.createObjectURL(Vn);try{const cs=document.createElement("a");cs.href=Ln,cs.download=ht.filename,document.body.appendChild(cs),cs.click(),cs.remove()}finally{URL.revokeObjectURL(Ln)}}catch(ht){g(ht,E("sidebar.exportFailed"))}finally{xm(Ce,!1,G.workspaceCwd)}})())},[Ss,Ve,Yt,sr,g,xm,E,B.client]),ub=f.useCallback(()=>{if(!_n)return;const G=_n.sessionId,Ce=sr(_n);if(Je(_n)){gs(null);return}const Ie=!!_n.isArchived;if(gs(null),dt.current.has(Ce))return;Bs(G,!0,_n.workspaceCwd),(gi(_n.workspaceCwd)?Ie?In:we:ht=>B.client.workspaceByCwd(_n.workspaceCwd).deleteSessionsData([ht]))(G).then(()=>{oe(),Cn(),vs()}).catch(ht=>g(ht,E("sidebar.deleteFailed"))).finally(()=>{Bs(G,!1,_n.workspaceCwd)})},[vs,In,_n,we,sr,Je,gi,g,oe,Cn,Bs,E,B.client]),Sc=f.useCallback(G=>{Je(G)&&Ra(G)},[Je,Ra]),cw=f.useCallback(()=>{Dn(null),hs(""),Jn(x_(Tn)),is(z0),br({mode:"create"})},[Tn]),uw=f.useCallback(G=>{(async()=>{try{const Ce=await B.client.workspaceByCwd(G).listSessionGroups();Dn(null),hs(""),Jn(x_(Ce.colorOptions)),is(z0),br({mode:"create",workspaceCwd:G})}catch(Ce){g(Ce,E("sidebar.groupsLoadFailed"))}})()},[g,E,B.client]),db=f.useCallback(G=>{Dn(null),hs(""),Jn(x_(Tn)),is(z0),br({mode:"create",targetSession:G,workspaceCwd:G.workspaceCwd})},[Tn]),Vr=f.useCallback((G,Ce)=>{hs(G.name),Jn(G.color),is(D9(G.color)??z0),br({mode:"edit",group:G,workspaceCwd:Ce})},[]),hb=f.useCallback(()=>{gt||(br(null),hs(""),Jn(x_(Tn)),is(z0))},[Tn,gt]),DC=f.useCallback(()=>{if(!wn)return;const G=Qs.trim(),Ce=Gq(cn,Tn.length>0?Tn:F0);!G||!Ce||(async()=>{bt(!0);try{const Ie=gi(wn.workspaceCwd)?F:B.client.workspaceByCwd(wn.workspaceCwd),nt=wn.mode==="create"?await Ie.createSessionGroup({name:G,color:Ce}):await Ie.updateSessionGroup(wn.group.id,{name:G,color:Ce});if(wn.mode==="create"&&wn.targetSession)try{await Ie.updateSessionOrganization(wn.targetSession.sessionId,{groupId:nt.id,color:null}),wn.workspaceCwd||oe().catch(()=>{}),vs()}catch(ht){br(null),hs(""),wn.workspaceCwd||Si().catch(()=>{}),g(ht,E("sidebar.groupAssignFailedAfterCreate"));return}br(null),hs(""),wn.workspaceCwd?vs():Si().catch(()=>{})}catch(Ie){g(Ie,wn.mode==="create"?E("sidebar.groupCreateFailed"):E("sidebar.groupUpdateFailed"))}finally{bt(!1)}})()},[vs,Tn,cn,wn,Qs,gi,g,oe,Si,E,F,B.client]),fb=f.useCallback((G,Ce)=>{kr({group:G,workspaceCwd:Ce})},[]),dw=f.useCallback(()=>{if(!tr)return;bt(!0),(gi(tr.workspaceCwd)?F:B.client.workspaceByCwd(tr.workspaceCwd)).deleteSessionGroup(tr.group.id).then(()=>{kr(null),tr.workspaceCwd?vs():oe().catch(()=>{})}).catch(Ce=>g(Ce,E("sidebar.groupDeleteFailed"))).then(()=>tr.workspaceCwd?void 0:Si().catch(()=>{})).finally(()=>bt(!1))},[tr,gi,g,oe,Si,E,vs,B.client,F]),d0=f.useCallback(G=>{const Ce=G.sessionId,Ie=sr(G);if(!ee||dt.current.has(Ie))return;Bs(Ce,!0,G.workspaceCwd),Nr(G).updateSessionOrganization(Ce,{isPinned:!G.isPinned}).then(()=>{oe().catch(()=>{}),je().catch(()=>{}),vs()}).catch(ht=>g(ht,E("sidebar.organizationFailed"))).finally(()=>{Bs(Ce,!1,G.workspaceCwd)})},[vs,sr,Nr,g,ee,oe,je,Bs,E]),Da=f.useCallback(G=>{const Ce=G.sessionId,Ie=sr(G);!Lt(G)||Je(G)||dt.current.has(Ie)||(Bs(Ce,!0,G.workspaceCwd),(async()=>{try{if(gi(G.workspaceCwd))await lt(Ce);else{const ht=(await B.client.workspaceByCwd(G.workspaceCwd).archiveSessionsData([Ce])).errors.find(Vn=>Vn.sessionId===Ce);ht&&g(new Error(ht.error),E("sidebar.archiveFailed"))}}catch(nt){g(nt,E("sidebar.archiveFailed"))}finally{oe().catch(()=>{}),Cn().catch(()=>{}),vs(),Bs(Ce,!1,G.workspaceCwd)}})())},[lt,vs,Lt,sr,gi,Je,g,oe,Cn,Bs,E,B.client]),hw=f.useCallback(G=>{const Ce=G.sessionId,Ie=sr(G);Lt(G)&&(dt.current.has(Ie)||(Bs(Ce,!0,G.workspaceCwd),(async()=>{try{if(gi(G.workspaceCwd))await _t(Ce);else{const ht=(await B.client.workspaceByCwd(G.workspaceCwd).unarchiveSessionsData([Ce])).errors.find(Vn=>Vn.sessionId===Ce);ht&&g(new Error(ht.error),E("sidebar.unarchiveFailed"))}}catch(nt){g(nt,E("sidebar.unarchiveFailed"))}finally{oe().catch(()=>{}),Cn().catch(()=>{}),vs(),Bs(Ce,!1,G.workspaceCwd)}})()))},[vs,Lt,sr,gi,g,oe,Cn,Bs,E,_t,B.client]),vm=f.useCallback(async(G,Ce)=>{let Ie=0;try{const da=await Nr(Ce).listSessionGroups();st(da.groups),ne(da.colorOptions),Ie=da.groups.length}catch(da){g(da,E("sidebar.groupsLoadFailed"));return}if(!G.isConnected)return;const nt=G.getBoundingClientRect(),ht=typeof window>"u"?nt.right+N8:window.innerWidth,Vn=typeof window>"u"?nt.top+320:window.innerHeight,Ln=Math.min(320,34*(Ie+F0.length+2)+25),cs=nt.right+$0+N8<=ht?nt.right+$0:Math.max($0,nt.left-N8-$0),Zs=Math.max($0,Math.min(nt.top,Vn-Ln-$0));Dn({session:Ce,top:Zs,left:cs})},[Nr,g,E]),Ju=f.useCallback((G,Ce)=>{const Ie=G.sessionId,nt=sr(G);if(!ee||dt.current.has(nt))return;Dn(null),Bs(Ie,!0,G.workspaceCwd),Nr(G).updateSessionOrganization(Ie,{groupId:Ce,color:null}).then(()=>{oe().catch(()=>{}),vs()}).catch(Vn=>g(Vn,E("sidebar.organizationFailed"))).finally(()=>{Bs(Ie,!1,G.workspaceCwd)})},[vs,sr,Nr,g,ee,oe,Bs,E]),LC=f.useCallback((G,Ce)=>{const Ie=G.sessionId,nt=sr(G);if(!ee||dt.current.has(nt))return;Dn(null),Bs(Ie,!0,G.workspaceCwd),Nr(G).updateSessionOrganization(Ie,{color:Ce,groupId:null}).then(()=>{oe().catch(()=>{}),vs()}).catch(Vn=>g(Vn,E("sidebar.organizationFailed"))).finally(()=>{Bs(Ie,!1,G.workspaceCwd)})},[vs,sr,Nr,g,ee,oe,Bs,E]),Zu=f.useMemo(()=>{const G=Jr.trim().toLowerCase(),Ce=q.filter(ht=>!ht.isPinned),Ie=G?Ce.filter(ht=>b2(ht).toLowerCase().includes(G)||ht.sessionId.toLowerCase().includes(G)):Ce.slice();if(ee)return Ie;const nt=new Map(Ie.map(ht=>[ht.sessionId,wwt(ht)]));return Ie.sort((ht,Vn)=>(nt.get(Vn.sessionId)??0)-(nt.get(ht.sessionId)??0))},[ee,Jr,q]),Vc=f.useMemo(()=>{if(!ee)return[];const G=Jr.trim().length>0,Ce=new Set(Mt.map(Ln=>Ln.id)),Ie=new Map,nt=new Map;for(const Ln of Mt)nt.set(Ln.id,[]);const ht=[];for(const Ln of Zu){if(Ln.color&&F0.includes(Ln.color)){const Zs=Ie.get(Ln.color)??[];Zs.push(Ln),Ie.set(Ln.color,Zs);continue}const cs=Ln.groupId&&Ce.has(Ln.groupId)?nt.get(Ln.groupId):void 0;cs?cs.push(Ln):ht.push(Ln)}const Vn=[];for(const Ln of F0){const cs=Ie.get(Ln);!cs||cs.length===0||Vn.push({id:`color:${Ln}`,kind:"color",label:E(`sidebar.groupColor.${Ln}`),countLabel:String(cs.length),color:Ln,sessions:cs})}for(const Ln of Mt){const cs=nt.get(Ln.id)??[];G&&cs.length===0||Vn.push({id:`group:${Ln.id}`,kind:"group",label:Ln.name,countLabel:String(cs.length),color:Ln.color,group:Ln,sessions:cs})}return ht.length>0&&Vn.length>0&&Vn.push({id:mwt,kind:"recent",label:E("sidebar.groupUngrouped"),countLabel:String(ht.length),sessions:ht}),Vn},[Zu,Mt,ee,Jr,E]);f.useEffect(()=>{if(!ee||!or||!Et)return;const G=Vc.map(Ie=>Ie.id).filter(Ie=>!bs.current.has(Ie));if(ir.current){ir.current=!1;for(const Ie of G)bs.current.add(Ie);return}if(G.length!==0){for(const Ie of G)bs.current.add(Ie);gr(Ie=>{const nt=new Set(Ie);for(const ht of G)nt.add(ht);return nt})}},[or,ee,Vc,Et]),f.useEffect(()=>{aae(Br,Hq)},[Br]);const mb=f.useCallback(G=>{gr(Ce=>{const Ie=new Set(Ce);return Ie.has(G)?Ie.delete(G):Ie.add(G),Ie})},[]),PC=f.useCallback(G=>{var Sm;if(e)return;G.preventDefault(),(Sm=Kt.current)==null||Sm.call(Kt,!0),Ii(!0);const Ce=G.clientX,Ie=Ut,nt=document.body.style.cursor,ht=document.body.style.userSelect;let Vn=!1,Ln=()=>{};document.body.style.cursor="col-resize",document.body.style.userSelect="none";try{G.currentTarget.setPointerCapture(G.pointerId)}catch{}function cs(Wo){return Ie+Wo-Ce}function Zs(){const Wo=S4(Ie);fn(Wo),Yq(Wo)}function da(){Vn||(Vn=!0,Zs(),Ln(!0),t(!0))}function nd(Wo){const ha=cs(Wo.clientX);if(ha<=Uq){da();return}fn(_wt(ha))}Ln=function(ha){document.body.style.cursor=nt,document.body.style.userSelect=ht,window.removeEventListener("pointermove",nd),window.removeEventListener("pointerup",kh),window.removeEventListener("pointercancel",Wr),Kt.current=null,ha&&Ii(!1)};function kh(Wo){const ha=cs(Wo.clientX);if(ha<=Uq){da();return}const $s=S4(ha);fn($s),Yq($s),Ln(!0)}function Wr(){Ln(!0)}Kt.current=Ln,window.addEventListener("pointermove",nd),window.addEventListener("pointerup",kh,{once:!0}),window.addEventListener("pointercancel",Wr,{once:!0})},[e,t,Ut]),OC=_n?vwt(_n):"",pb=Qn!=null&&Qn.session.color&&F0.includes(Qn.session.color)?Qn.session.color:null,gb=!pb&&(Qn!=null&&Qn.session.groupId)&&Ft.some(G=>G.id===Qn.session.groupId)?Qn.session.groupId:null,fw=Tn.length>0?Tn:F0,Wc=gb===null&&pb===null,BC=(tr==null?void 0:tr.group.name)??"",bb=Tn.length>0?Tn:["blue"],gh=Gq(cn,bb),bh=!bb.includes(cn),ar=Qs.trim().length>0&&gh!==void 0&&!gt,ed=(wn==null?void 0:wn.mode)==="create"?E("sidebar.groupCreate"):E("sidebar.groupRename"),Fl=f.useCallback((G,Ce={})=>{const{isArchived:Ie=!1,readOnly:nt=!1}=Ce,ht=sr(G),Vn=b2(G),Ln=G.updatedAt||G.createdAt,cs=Ln?v4(Ln,E):"",Zs=Ar.has(ht),da=bn.has(ht),nd=!Je(G)&&qo.has(ht),kh=l.jsxs("div",{className:Ee.tooltipContent,children:[l.jsx("div",{className:Ee.tooltipTitle,children:Vn}),l.jsxs("div",{className:Ee.tooltipTags,children:[G.hasActivePrompt&&l.jsx("span",{className:fl(Ee.tooltipTag,Ee.tooltipTagRunning),children:E("sidebar.running")}),nd&&l.jsx("span",{className:fl(Ee.tooltipTag,Ee.tooltipTagNew),children:E("sidebar.completedUnread")}),l.jsx("span",{className:Ee.tooltipTag,children:E("sidebar.clients",{count:G.clientCount??0})})]}),l.jsx("div",{className:Ee.tooltipMeta,children:G.sessionId})]});if(Ie)return l.jsxs("div",{className:fl(Ee.sessionRow,Ee.archivedRow,Zs&&Ee.busySession),children:[l.jsx("span",{className:Ee.sessionText,children:Vn}),l.jsxs("div",{className:Ee.sessionMetaSlot,children:[l.jsx("span",{className:Ee.sessionTime,children:cs}),l.jsx("div",{className:Ee.sessionActions,onClick:$s=>$s.stopPropagation(),onKeyDown:$s=>$s.stopPropagation(),children:l.jsxs(Hg,{children:[l.jsx(qg,{asChild:!0,children:l.jsx("button",{className:Ee.sessionActionButton,type:"button","aria-label":E("sidebar.moreActions"),title:E("sidebar.moreActions"),children:l.jsx(Ng,{})})}),l.jsx(Ug,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{ae.current=!0},onCloseAutoFocus:$s=>{ae.current&&(ae.current=!1,$s.preventDefault())},children:l.jsxs(N1,{children:[l.jsxs(QH,{children:[l.jsxs(JH,{children:[l.jsx(Ex,{}),E("sidebar.details")]}),l.jsx(ZH,{className:"min-w-64 p-3",children:kh})]}),Yt(G)&&l.jsxs(yo,{disabled:da,onSelect:()=>ph(G),children:[l.jsx(f5,{}),E("sidebar.export")]}),Lt(G)&&l.jsxs(yo,{onSelect:()=>hw(G),children:[l.jsx(spe,{}),E("sidebar.unarchive")]}),l.jsxs(yo,{variant:"destructive",onSelect:()=>Uo(G),children:[l.jsx(hg,{}),E("sidebar.delete")]})]})})]})})]})]},ht);const Wr=Je(G),Sm=Wr&&It===G.sessionId,Wo=!G.isWaitingForPermission&&G.isWaitingForUserQuestion,ha=G.isWaitingForPermission?E("sidebar.waitingForApproval"):Wo?E("sidebar.userInputNeeded"):null;return l.jsx("div",{className:fl(Ee.sessionRow,Wr&&Ee.currentSession,G.isPinned&&Ee.pinnedSession,G.hasActivePrompt&&Ee.runningSession,Zs&&Ee.busySession),role:"button",tabIndex:0,"aria-current":Wr?"page":void 0,onClick:()=>zr(G.sessionId,G.workspaceCwd),onDoubleClick:()=>{!nt&&Wr&&!e&&Ra(G)},onKeyDown:$s=>{$s.key==="Enter"&&zr(G.sessionId,G.workspaceCwd)},children:!e&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Ee.sessionStatusSlot,children:nd?l.jsx("span",{className:Ee.sessionStatusDot,"aria-hidden":"true"}):null}),Sm&&!nt?l.jsx("form",{className:Ee.renameForm,onClick:$s=>$s.stopPropagation(),onSubmit:$s=>{$s.preventDefault(),Qu()},children:l.jsx("input",{autoFocus:!0,className:Ee.renameInput,value:We,onChange:$s=>Zn($s.target.value),onBlur:zl,onKeyDown:$s=>{$s.key==="Escape"&&($s.preventDefault(),zl())}})}):l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:Ee.sessionText,children:[G.worktree&&l.jsx(tS,{size:11,strokeWidth:1.5,className:Ee.sessionBadgeIcon,"aria-label":E("sidebar.newWorktreeTask")}),Vn]}),l.jsxs("div",{className:Ee.sessionMetaSlot,children:[ha&&l.jsx("span",{className:fl(Ee.sessionAttention,Wo&&Ee.sessionAttentionUserInput),"aria-label":ha,children:ha}),G.hasActivePrompt?l.jsx("span",{className:Ee.sessionLoading,"aria-label":E("sidebar.running")}):ha?null:l.jsx("span",{className:Ee.sessionTime,children:cs}),nt&&Lt(G)&&Y.has("archive")&&l.jsx("div",{className:Ee.sessionActions,onClick:$s=>$s.stopPropagation(),onKeyDown:$s=>$s.stopPropagation(),children:l.jsx("button",{className:Ee.sessionActionButton,type:"button",disabled:Zs||Wr,"aria-label":E("sidebar.archive"),title:E(Wr?"sidebar.archiveCurrentDisabled":"sidebar.archive"),onClick:()=>Da(G),children:l.jsx(h5,{})})}),!nt&&l.jsxs("div",{className:Ee.sessionActions,onClick:$s=>$s.stopPropagation(),onKeyDown:$s=>$s.stopPropagation(),children:[[{key:"pin",icon:l.jsx($P,{size:16,strokeWidth:1.2}),label:G.isPinned?E("sidebar.unpin"):E("sidebar.pin"),disabled:Zs,active:G.isPinned,visible:ee&&Y.has("pin")&&V.has("pin"),onClick:()=>d0(G)},{key:"archive",icon:l.jsx(h5,{size:16,strokeWidth:1.2}),label:E("sidebar.archive"),disabled:Zs||Wr,title:E(Wr?"sidebar.archiveCurrentDisabled":"sidebar.archive"),visible:Lt(G)&&Y.has("archive")&&V.has("archive"),onClick:()=>Da(G)},{key:"rename",icon:l.jsx(Y7,{size:16,strokeWidth:1.2}),label:E("sidebar.rename"),disabled:!Wr,title:Wr?void 0:E("sidebar.renameCurrentOnly"),visible:Y.has("rename")&&V.has("rename"),onClick:()=>Sc(G)},{key:"export",icon:l.jsx(f5,{size:16,strokeWidth:1.2}),label:E("sidebar.export"),disabled:da,visible:Ss&&Y.has("export")&&V.has("export"),onClick:()=>ph(G)},{key:"delete",icon:l.jsx(hg,{size:16,strokeWidth:1.2}),label:E("sidebar.delete"),disabled:Wr,destructive:!0,title:Wr?E("sidebar.currentDeleteDisabled"):void 0,visible:Y.has("delete")&&V.has("delete"),onClick:()=>Uo(G)}].filter(Go=>Go.visible).map(Go=>l.jsx("button",{className:fl(Ee.sessionActionButton,Go.active&&Ee.activeSessionActionButton),type:"button",disabled:Go.disabled,"aria-label":Go.label,title:Go.title??Go.label,onClick:Go.onClick,style:Go.destructive&&!Go.disabled?{color:"var(--destructive, #dc2626)"}:void 0,children:Go.icon??l.jsx("span",{style:{fontSize:12},children:Go.label})},Go.key)),ee&&Y.has("pin")&&!V.has("pin")||Lt(G)&&Y.has("archive")&&!V.has("archive")||Y.has("details")||Y.has("rename")&&!V.has("rename")||ee&&Y.has("group")||Ss&&Y.has("export")&&!V.has("export")||Y.has("delete")&&!V.has("delete")?l.jsxs(Hg,{children:[l.jsx(qg,{asChild:!0,children:l.jsx("button",{className:Ee.sessionActionButton,type:"button","aria-label":E("sidebar.moreActions"),title:E("sidebar.moreActions"),children:l.jsx(Ng,{})})}),l.jsx(Ug,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{ae.current=!0},onCloseAutoFocus:$s=>{ae.current&&(ae.current=!1,$s.preventDefault())},children:l.jsxs(N1,{children:[ee&&Y.has("pin")&&!V.has("pin")&&l.jsxs(yo,{disabled:Zs,onSelect:()=>d0(G),children:[l.jsx($P,{}),G.isPinned?E("sidebar.unpin"):E("sidebar.pin")]}),Lt(G)&&Y.has("archive")&&!V.has("archive")&&l.jsxs(yo,{disabled:Zs||Wr,title:Wr?E("sidebar.archiveCurrentDisabled"):void 0,onSelect:()=>Da(G),children:[l.jsx(h5,{}),E("sidebar.archive")]}),Y.has("details")&&l.jsxs(QH,{children:[l.jsxs(JH,{children:[l.jsx(Ex,{}),E("sidebar.details")]}),l.jsx(ZH,{className:"min-w-64 p-3",children:kh})]}),Y.has("rename")&&!V.has("rename")&&l.jsxs(yo,{disabled:!Wr,title:Wr?void 0:E("sidebar.renameCurrentOnly"),onSelect:()=>Sc(G),children:[l.jsx(Y7,{}),E("sidebar.rename")]}),ee&&Y.has("group")&&l.jsxs(yo,{disabled:Zs,onSelect:$s=>vm($s.currentTarget,G),children:[l.jsx(Ppe,{}),E("sidebar.sessionGroup")]}),Ss&&Y.has("export")&&!V.has("export")&&l.jsxs(yo,{disabled:da,onSelect:()=>ph(G),children:[l.jsx(f5,{}),E("sidebar.export")]}),Y.has("delete")&&!V.has("delete")&&l.jsxs(yo,{variant:"destructive",disabled:Wr,title:Wr?E("sidebar.currentDeleteDisabled"):void 0,onSelect:()=>Uo(G),children:[l.jsx(hg,{}),E("sidebar.delete")]})]})})]}):null]})]})]})]})},ht)},[Ar,Lt,Ss,zl,e,qo,We,It,bn,Yt,sr,Da,Uo,ph,zr,Sc,d0,hw,Je,vm,ee,Qu,Y,V,Ra,E]),mw=f.useMemo(()=>Z&&q.length===0?l.jsx("div",{className:Ee.notice,children:E("sidebar.loadingSessions")}):he&&q.length===0?l.jsx("button",{className:Ee.retry,type:"button",onClick:oe,children:E("sidebar.loadFailed")}):Zu.length===0&&(Jr.trim()||!ee||Vc.length===0)?l.jsx("div",{className:Ee.notice,children:E("sidebar.searchEmpty")}):ee?Vc.length===0?Zu.map(G=>Fl(G)):Vc.map(G=>{const Ce=!Br.has(G.id),Ie=G.group;return l.jsx(R9,{id:G.id,label:G.label,count:G.sessions.length,color:G.color,expanded:Ce,onToggle:()=>mb(G.id),onRename:G.kind==="group"&&Ie?()=>Vr(Ie):void 0,onDelete:G.kind==="group"&&Ie?()=>fb(Ie):void 0,renameLabel:E("sidebar.groupRename"),deleteLabel:E("sidebar.groupDelete"),actionsDisabled:gt,children:G.sessions.map(nt=>Fl(nt))},G.id)}):Zu.map(G=>Fl(G)),[Br,he,Zu,gt,fb,Vr,Z,ee,oe,Fl,Jr,Vc,q.length,E,mb]),pw=f.useMemo(()=>{if(!se||e||Jr.trim())return null;const G=l.jsxs("button",{type:"button",className:Ee.archivedHeader,"aria-expanded":Ae,onClick:()=>De(nt=>!nt),children:[l.jsx("span",{className:Ee.archivedTitle,style:{flex:"0 1 auto"},children:E("sidebar.archivedTitle")}),l.jsx("span",{className:Ee.archivedChevron,"aria-hidden":"true",children:Ae?l.jsx(Ql,{}):l.jsx(Q4,{})}),Ae&&Nn.length>0&&l.jsx("span",{className:Ee.archivedCount,children:Nn.length})]});if(!Ae)return l.jsx("div",{className:Ee.archivedSection,children:G});const Ce=l.jsx("button",{className:Ee.retry,type:"button",onClick:()=>{Cn(),qe(nt=>nt+1)},children:E("sidebar.loadFailed")});let Ie;return Hn&&Nn.length===0?Ie=l.jsx("div",{className:Ee.notice,children:E("sidebar.loadingSessions")}):He&&Nn.length===0?Ie=Ce:Nn.length===0?Ie=l.jsx("div",{className:Ee.notice,children:E("sidebar.archivedEmpty")}):Ie=l.jsxs(l.Fragment,{children:[Nn.map(nt=>Fl(nt,{isArchived:!0})),He&&Ce]}),l.jsxs("div",{className:Ee.archivedSection,children:[G,l.jsx("div",{className:Ee.archivedList,children:Ie})]})},[Ae,Nn,e,He,Hn,Cn,Fl,Jr,se,qe,E]);return l.jsxs(l.Fragment,{children:[l.jsxs("aside",{className:fl(Ee.sidebar,e&&Ee.collapsed,$r&&Ee.resizing,x&&Ee.mobileOpen),"aria-label":E("sidebar.label"),style:Di,children:[Qn&&l.jsxs("div",{ref:Ri,className:Ee.groupMenu,role:"menu","aria-label":E("sidebar.sessionGroup"),style:{top:Qn.top,left:Qn.left},onClick:G=>G.stopPropagation(),onKeyDown:ui,onMouseDown:G=>G.stopPropagation(),children:[l.jsxs("button",{className:fl(Ee.groupMenuItem,Wc&&Ee.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":Wc,onClick:()=>Ju(Qn.session,null),children:[l.jsx("span",{className:Ee.groupMenuEmptyDot}),l.jsx("span",{className:Ee.groupMenuName,children:E("sidebar.groupUngrouped")}),Wc&&l.jsx("span",{className:Ee.groupMenuCheck,children:"✓"})]}),fw.map(G=>{const Ce=pb===G;return l.jsxs("button",{className:fl(Ee.groupMenuItem,Ce&&Ee.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":Ce,onClick:()=>LC(Qn.session,G),children:[l.jsx("span",{className:fl(Ee.groupMenuDot,Kq(G))}),l.jsx("span",{className:Ee.groupMenuName,children:E(`sidebar.groupColor.${G}`)}),Ce&&l.jsx("span",{className:Ee.groupMenuCheck,children:"✓"})]},`color:${G}`)}),Ft.map(G=>{const Ce=gb===G.id;return l.jsxs("button",{className:fl(Ee.groupMenuItem,Ce&&Ee.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":Ce,onClick:()=>Ju(Qn.session,G.id),children:[l.jsx("span",{className:fl(Ee.groupMenuDot,Kq(G.color)),style:kwt(G.color)}),l.jsx("span",{className:Ee.groupMenuName,children:G.name}),Ce&&l.jsx("span",{className:Ee.groupMenuCheck,children:"✓"})]},G.id)}),l.jsx("div",{className:Ee.groupMenuSeparator}),l.jsxs("button",{className:Ee.groupMenuItem,type:"button",role:"menuitem",onClick:()=>db(Qn.session),children:[l.jsx("span",{className:Ee.groupMenuIcon,children:l.jsx(Cwt,{})}),l.jsx("span",{className:Ee.groupMenuName,children:E("sidebar.groupCreate")})]})]}),_n&&l.jsx(si,{title:E("delete.title"),size:"sm",onClose:()=>gs(null),children:l.jsxs("div",{className:Ee.confirmContent,children:[l.jsx("p",{className:Ee.confirmDescription,children:E("sidebar.deleteConfirmDescription",{name:OC})}),l.jsxs("div",{className:Ee.confirmActions,children:[l.jsx("button",{className:Ee.secondaryButton,type:"button",onClick:()=>gs(null),children:E("common.cancel")}),l.jsx("button",{className:Ee.dangerButton,type:"button",onClick:ub,children:E("sidebar.delete")})]})]})}),Pn&&l.jsx(si,{title:E("sidebar.removeWorkspaceTitle"),size:"sm",onClose:()=>{(!qs||Re)&&(ys.current=!0,es(null),$n(null),Dt(!1))},children:l.jsxs("div",{className:Ee.confirmContent,children:[l.jsx("p",{className:Ee.confirmDescription,children:jn?E("sidebar.removeWorkspaceBusy",{name:Pn.cwd}):E("sidebar.removeWorkspaceConfirm",{name:Pn.cwd})}),jn&&l.jsxs("ul",{className:Ee.workspaceRemovalActivityList,children:[l.jsx("li",{children:E("sidebar.removeWorkspaceSessions",{count:jn.sessions})}),l.jsx("li",{children:E("sidebar.removeWorkspacePrompts",{count:jn.activePrompts})}),l.jsx("li",{children:E("sidebar.removeWorkspaceStarts",{count:jn.pendingSessionStarts})}),l.jsx("li",{children:E("sidebar.removeWorkspaceConnections",{count:jn.acpConnections})}),l.jsx("li",{children:E("sidebar.removeWorkspaceMemoryTasks",{count:jn.memoryTasks})}),l.jsx("li",{children:E("sidebar.removeWorkspaceWorkers",{count:jn.channelWorkers})}),l.jsx("li",{children:E("sidebar.removeWorkspaceVoiceSessions",{count:jn.voiceSessions??0})})]}),jn&&O.sessionId&&O.workspaceCwd===Pn.cwd&&l.jsx("p",{className:Ee.confirmDescription,children:E("sidebar.removeWorkspaceCurrentSession")}),Re&&l.jsx("p",{className:Ee.confirmDescription,children:E("sidebar.removeWorkspaceInProgress")}),l.jsxs("div",{className:Ee.confirmActions,children:[l.jsx("button",{className:Ee.secondaryButton,type:"button",disabled:qs&&!Re,onClick:()=>{ys.current=!0,es(null),$n(null),Dt(!1)},children:E("common.cancel")}),l.jsx("button",{className:Ee.dangerButton,type:"button",disabled:qs||Re||jn!==null&&!!O.sessionId&&O.workspaceCwd===Pn.cwd,onClick:()=>void Uc(),children:E(jn?"sidebar.forceRemoveWorkspace":"sidebar.removeWorkspace")})]})]})}),wn&&l.jsx(si,{title:ed,size:"sm",onClose:hb,children:l.jsxs("form",{className:"flex flex-col gap-6",onSubmit:G=>{G.preventDefault(),DC()},children:[l.jsxs(oR,{children:[l.jsxs(Ep,{children:[l.jsx(Vg,{htmlFor:"session-group-name",children:E("sidebar.groupNamePrompt")}),l.jsx(ri,{id:"session-group-name",value:Qs,autoFocus:!0,maxLength:64,onChange:G=>hs(G.target.value)})]}),l.jsxs(Ep,{children:[l.jsx(Vg,{htmlFor:"session-group-color",children:E("sidebar.groupColor")}),l.jsxs(Hf,{value:bh?j8:cn,onValueChange:G=>{Jn(G===j8?Wi:G)},children:[l.jsx(Uf,{id:"session-group-color",className:"w-full",children:l.jsx(qf,{})}),l.jsx(Vf,{children:l.jsxs(FM,{children:[bb.map(G=>l.jsx(Nl,{value:G,children:E(`sidebar.groupColor.${G}`)},G)),l.jsx(Nl,{value:j8,children:E("sidebar.groupColor.custom")})]})})]})]}),bh&&l.jsxs(Ep,{children:[l.jsx(Vg,{htmlFor:"session-group-hex-color",children:E("sidebar.groupColor.hex")}),l.jsxs("div",{className:Ee.groupCustomColorRow,children:[l.jsx(ri,{className:Ee.groupColorPicker,type:"color",value:Wi,"aria-label":E("sidebar.groupColor.picker"),onChange:G=>{const Ce=G.target.value.toLowerCase();is(Ce),Jn(Ce)}}),l.jsx(ri,{id:"session-group-hex-color",value:cn,maxLength:7,spellCheck:!1,"aria-invalid":gh===void 0,onChange:G=>{const Ce=G.target.value,Ie=Ce.trim(),nt=Ie&&!Ie.startsWith("#")?`#${Ie}`:Ce;Jn(nt);const ht=D9(nt);ht&&is(ht)}})]}),gh===void 0&&l.jsx("span",{className:Ee.groupColorError,role:"alert",children:E("sidebar.groupColor.invalid")})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(qn,{type:"button",variant:"outline",disabled:gt,onClick:hb,children:E("common.cancel")}),l.jsx(qn,{type:"submit",disabled:!ar,children:E("common.save")})]})]})}),tr&&l.jsx(si,{title:E("sidebar.groupDelete"),size:"sm",onClose:()=>{gt||kr(null)},children:l.jsxs("div",{className:Ee.confirmContent,children:[l.jsx("p",{className:Ee.confirmDescription,children:E("sidebar.groupDeleteConfirm",{name:BC})}),l.jsxs("div",{className:Ee.confirmActions,children:[l.jsx("button",{className:Ee.secondaryButton,type:"button",disabled:gt,onClick:()=>kr(null),children:E("common.cancel")}),l.jsx("button",{className:Ee.dangerButton,type:"button",disabled:gt,onClick:dw,children:E("sidebar.groupDelete")})]})]})}),j&&l.jsx("div",{className:Ee.topRow,children:L!=null&&L.render?L.render():l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Ee.brandLogo,"aria-hidden":"true",children:l.jsx(Twt,{})}),!e&&l.jsx("span",{className:Ee.brandName,children:"Qwen Code"})]})}),l.jsxs("div",{className:Ee.primaryNav,children:[I.has("newTask")&&l.jsxs("button",{className:Ee.newChatButton,type:"button",title:E("sidebar.newTask"),"aria-label":E("sidebar.newTask"),disabled:lo,onClick:()=>Xu(),children:[l.jsx("span",{className:Ee.navIcon,children:l.jsx(zP,{size:16,strokeWidth:1.2})}),!e&&l.jsx("span",{children:E("sidebar.newTask")})]}),I.has("plugins")&&l.jsxs("button",{className:Ee.pluginButton,type:"button",title:E("sidebar.plugins"),"aria-label":E("sidebar.plugins"),onClick:s,children:[l.jsx("span",{className:Ee.navIcon,children:l.jsx(ape,{size:16,strokeWidth:1.2})}),!e&&l.jsx("span",{children:E("sidebar.plugins")})]}),I.has("scheduledTasks")&&l.jsxs("button",{className:Ee.pluginButton,type:"button",title:E("sidebar.scheduledTasks"),"aria-label":E("sidebar.scheduledTasks"),onClick:i,children:[l.jsx("span",{className:Ee.navIcon,children:l.jsx(hpe,{size:16,strokeWidth:1.2})}),!e&&l.jsx("span",{children:E("sidebar.scheduledTasks")})]}),I.has("goals")&&l.jsxs("button",{className:Ee.pluginButton,type:"button",title:E("sidebar.goals"),"aria-label":E("sidebar.goals"),onClick:o,children:[l.jsx("span",{className:Ee.navIcon,children:l.jsx(T0e,{size:16,strokeWidth:1.2})}),!e&&l.jsx("span",{children:E("sidebar.goals")})]}),(Vo=N==null?void 0:N.render)==null?void 0:Vo.call(N)]}),l.jsx("div",{className:Ee.body,children:l.jsxs("div",{className:Ee.sessionList,children:[!e&&ua.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Ee.projectsHeader,children:l.jsxs("button",{className:Ee.projectsHeaderToggle,type:"button","aria-expanded":Ne,onClick:()=>tt(G=>!G),children:[l.jsx("span",{children:E("sidebar.pinnedSessions")}),l.jsx(Xq,{expanded:Ne})]})}),Ne&&l.jsx("div",{className:Ee.pinnedSessionList,children:ua.map(G=>Fl(G))})]}),!e&&!$&&l.jsxs("div",{className:Ee.projectsHeader,children:[l.jsxs("button",{className:Ee.projectsHeaderToggle,type:"button","aria-expanded":Ue,onClick:()=>zt(G=>!G),children:[l.jsx("span",{children:E("sidebar.project")}),l.jsx(Xq,{expanded:Ue})]}),l.jsxs("div",{className:Ee.projectsHeaderActions,children:[l.jsx("button",{className:Ee.projectsHeaderAction,type:"button",title:E("sidebar.search"),"aria-label":E("sidebar.search"),onClick:()=>{Gt(G=>(G&&Gi(""),!G)),zt(!0)},children:l.jsx(Zd,{})}),!C&&l.jsx("button",{className:Ee.projectsHeaderAction,type:"button",title:E("sidebar.addWorkspace"),"aria-label":E("sidebar.addWorkspace"),onClick:()=>{kn(!0)},children:l.jsx(Ax,{})})]})]}),Sn&&!e&&!$&&l.jsxs("div",{className:Ee.projectSearch,children:[l.jsx(Zd,{"aria-hidden":"true"}),l.jsx(ri,{value:Jr,placeholder:E("sidebar.searchPlaceholder"),"aria-label":E("sidebar.search"),autoFocus:!0,onChange:G=>Gi(G.target.value),onKeyDown:G=>{G.key==="Escape"&&(Gi(""),Gt(!1))}})]}),(e||Ue)&&l.jsx(l.Fragment,{children:!e&&l.jsx("div",{className:Ee.workspacePicker,children:l.jsx("div",{className:Ee.workspaceList,children:xr.map(G=>l.jsxs(f.Fragment,{children:[l.jsx(awt,{workspace:G,renderHeader:C&&(S!=null&&S.render)?Ce=>{var Ie;return(Ie=S.render)==null?void 0:Ie.call(S,G,{expanded:Ce})}:void 0,client:B.client,reloadToken:zn,untrustedLabel:E("sidebar.workspaceUntrusted"),readOnlyLabel:E("sidebar.workspaceReadOnly"),trustToOpenLabel:E("sidebar.workspaceTrustToOpen"),noSessionsLabel:E("sidebar.noSessions"),loadErrorLabel:E("sidebar.loadFailed"),organizationEnabled:ee,ungroupedLabel:E("sidebar.groupUngrouped"),onRenameGroup:Vr,onDeleteGroup:fb,renameGroupLabel:E("sidebar.groupRename"),deleteGroupLabel:E("sidebar.groupDelete"),groupActionsDisabled:gt,excludePinned:!0,onOpenGitDiff:T,formatTime:Ce=>v4(Ce,E),searchQuery:Jr,expanded:G.primary?un:void 0,autoExpandKey:(nr==null?void 0:nr.id)===G.id?nr==null?void 0:nr.key:void 0,onExpandedChange:G.primary?_e:void 0,renderSessions:!G.primary,renderSession:Ce=>Fl({...Ce,workspaceCwd:G.cwd},{readOnly:!G.primary}),headerActions:Ce=>{if(C&&(S!=null&&S.render))return null;const Ie=!C&&Un&&!G.primary&&G.removable===!0;if(!G.trusted&&!Ie)return null;const nt=G.primary?void 0:G.cwd;return l.jsxs("div",{className:Ee.workspaceHeaderActions,style:{visibility:Ce?"visible":"hidden"},children:[G.trusted&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:Ee.workspaceHeaderAction,type:"button","aria-label":E("sidebar.groupCreate"),onClick:ht=>{ht.preventDefault(),ht.stopPropagation(),G.primary?cw():uw(G.cwd)},children:l.jsx(Ax,{size:16,strokeWidth:1.2})}),l.jsx("button",{className:Ee.workspaceHeaderAction,type:"button",title:E("sidebar.newTask"),"aria-label":E("sidebar.newTask"),onClick:ht=>{ht.preventDefault(),ht.stopPropagation(),Xu(nt)},children:l.jsx(zP,{size:16,strokeWidth:1.2})})]}),Ie&&l.jsxs(Hg,{children:[l.jsx(qg,{asChild:!0,children:l.jsx("button",{className:Ee.workspaceHeaderAction,type:"button","aria-label":E("sidebar.workspaceActions"),disabled:qs&&(Pn==null?void 0:Pn.id)===G.id,children:l.jsx(Ng,{size:16,strokeWidth:1.2})})}),l.jsx(Ug,{align:"end",children:l.jsxs(yo,{variant:"destructive","aria-label":`${E("sidebar.removeWorkspace")}: ${G.cwd}`,onSelect:()=>$l(G),children:[l.jsx(hg,{}),E("sidebar.removeWorkspace")]})})]})]})}}),G.primary&&(un||Jr.trim())?l.jsx("div",{className:Ee.workspaceSessionBody,children:mw}):null]},G.id))})})}),pw]})}),P!==!1&&l.jsxs("div",{className:fl(Ee.footer,ls&&Ee.footerCompact,Cs&&Ee.footerTight),children:[l.jsxs("div",{className:Ee.footerPrimary,children:[P&&typeof P=="object"&&((wh=P.render)==null?void 0:wh.call(P)),W.has("settings")&&l.jsxs("button",{className:Ee.footerButton,type:"button",title:E("sidebar.settings"),"aria-label":E("sidebar.settings"),onClick:n,children:[l.jsx("span",{className:`${Ee.navIcon} ${Ee.settingsIcon}`,children:l.jsx(g0e,{size:16,strokeWidth:1.2})}),!e&&!ls&&l.jsx("span",{className:Ee.footerButtonLabel,children:E("sidebar.settings")})]}),!e&&!Cs&&js&&W.has("version")&&l.jsx("span",{className:Ee.version,title:`Qwen Code ${js}`,children:js})]}),l.jsxs("div",{className:Ee.footerActions,children:[W.has("theme")&&l.jsx("button",{className:Ee.collapseButton,type:"button",title:b===qr.Dark?E("sidebar.themeLight"):E("sidebar.themeDark"),"aria-label":b===qr.Dark?E("sidebar.themeLight"):E("sidebar.themeDark"),onClick:()=>v(b===qr.Dark?qr.Light:qr.Dark),children:b===qr.Dark?l.jsx(S0e,{size:16,strokeWidth:1.2}):l.jsx(Jpe,{size:16,strokeWidth:1.2})}),c&&W.has("sessionsOverview")&&l.jsx("button",{className:Ee.collapseButton,type:"button",title:E("sidebar.sessionsOverview"),"aria-label":E("sidebar.sessionsOverview"),onClick:a,children:l.jsx(Wpe,{size:16,strokeWidth:1.2})}),d&&W.has("splitView")&&l.jsx("button",{className:Ee.collapseButton,type:"button",title:E("sidebar.splitView"),"aria-label":E("sidebar.splitView"),onClick:u,children:l.jsx(kpe,{size:16,strokeWidth:1.2})}),W.has("daemonStatus")&&l.jsx("button",{className:Ee.collapseButton,type:"button",title:E("sidebar.daemonStatus"),"aria-label":E("sidebar.daemonStatus"),onClick:r,children:l.jsx(tpe,{size:16,strokeWidth:1.2})}),!x&&W.has("collapse")&&l.jsx("button",{className:Ee.collapseButton,type:"button",title:E(e?"sidebar.expand":"sidebar.collapse"),"aria-label":E(e?"sidebar.expand":"sidebar.collapse"),onClick:()=>t(!e),children:e?l.jsx(i0e,{size:16,strokeWidth:1.2}):l.jsx(s0e,{size:16,strokeWidth:1.2})})]})]}),l.jsx("div",{className:Ee.resizeHandle,role:"separator","aria-orientation":"vertical",onPointerDown:PC})]}),!C&&Ls&&l.jsx(dyt,{onClose:()=>kn(!1),onAdd:Bl,displayNameEnabled:Os,onSuggest:Li})]})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Awt(e){return e.key!=="b"&&e.key!=="B"||e.altKey||e.shiftKey?!1:e.metaKey!==e.ctrlKey}function Nwt(e){const[t,n]=f.useState(e);return f.useEffect(()=>{const s=window.requestAnimationFrame(()=>{n(e)});return()=>window.cancelAnimationFrame(s)},[e]),t}const jwt=3e3,Mwt=2;function Qq(e){return e.some(t=>t.status==="running"||t.status==="paused")}function Iwt(e,t,n=0){const s=B1(),[r,i]=f.useState([]),[o,a]=f.useState(!1),[c,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(c||!t||!o)return;let p=!1;const g=()=>{h.current||(h.current=!0,s.getTasks().then(v=>{if(!p){if(i(v.tasks),v.tasks.length===0){d.current+=1,d.current>=Mwt&&a(!1);return}d.current=0,Qq(v.tasks)||a(!1)}}).catch(v=>{p||console.warn("[web-shell] failed to refresh tasks:",v)}).finally(()=>{h.current=!1}))};g();const b=setInterval(g,jwt);return()=>{p=!0,clearInterval(b)}},[s,t,o,c]);const m=f.useRef(r);return m.current=r,f.useEffect(()=>{const p=g=>{const b=g.detail,v=(b==null?void 0:b.active)===!0;u(v),!v&&Qq(m.current)&&a(!0)};return window.addEventListener(mv,p),()=>window.removeEventListener(mv,p)},[]),r}function Rwt(e,t){if(e===t)return!0;if(e==null||t==null||typeof e!="object"||typeof t!="object")return!1;if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.every((i,o)=>i===t[o]);const n=Object.keys(e),s=t,r=e;return n.length!==Object.keys(s).length?!1:n.every(i=>{const o=r[i],a=s[i];return o===a?!0:Array.isArray(o)&&Array.isArray(a)?o.length===a.length&&o.every((c,u)=>c===a[u]):!1})}function Dwt(e){const t=f.useRef(e);return Rwt(t.current,e)||(t.current=e),t.current}function Lwt(e,t){const n=f.useRef(e);return e.length!==n.current.length?(n.current=e,e):(e.some((r,i)=>t(r)!==t(n.current[i]))&&(n.current=e),n.current)}const Qi={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"},Jq=1024,Pwt=new RegExp(String.raw`(?<![\w$])\$(?![\s\d$])(?=[^$\n]{1,${Jq}}\S\$)([^$\n]{1,${Jq}})\$(?![\w$])`,"g");function Owt(e){var u,d,h;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=new Map;let i=null,o=null,a=null,c=[];for(const m of n){const p=m.match(s);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=(r.get(o)??0)+1;r.set(o,g),a=g}else a=null;c=[]}continue}if(p&&((h=p[1])!=null&&h.startsWith(i[0]??""))&&p[1].length>=i.length){t.push({lang:o,content:c.join(`
`),index:t.length+1,langIndex:a}),i=null,o=null,a=null,c=[];continue}c.push(m)}return t}function Bwt(e){var c;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=/^ *\$\$ *$/;let i=null,o=!1,a=[];for(const u of n){const d=u.match(s);if(i){d&&((c=d[1])!=null&&c.startsWith(i[0]??""))&&d[1].length>=i.length&&(i=null);continue}if(!o){if(d){i=d[1]??null;continue}r.test(u)&&(o=!0,a=[]);continue}if(r.test(u)){t.push({content:a.join(`
`),index:t.length+1}),o=!1,a=[];continue}a.push(u)}return t}function $wt(e){var a;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=/^ *\$\$ *$/;let i=null,o=!1;for(const c of n){const u=c.match(s);if(i){u&&((a=u[1])!=null&&a.startsWith(i[0]??""))&&u[1].length>=i.length&&(i=null);continue}if(o){r.test(c)&&(o=!1);continue}if(u){i=u[1]??null;continue}if(r.test(c)){o=!0;continue}for(const d of c.matchAll(Pwt)){const h=d[1];h&&t.push({content:h,index:t.length+1})}}return t}function Zq(e,t){return t&&e.langIndex!==null?`${t} code block ${e.langIndex}`:`Code block ${e.index}`}function zwt(e,t){var d;const n=t.trim().split(/\s+/).filter(Boolean),s=(d=n[0])==null?void 0:d.toLowerCase();if(!s)return;const r=Owt(e);if(r.length===0)return null;let i=null,o=null;const a=s==="code"?n.slice(1):n.map(h=>h);s!=="code"&&(i=s);for(const h of a)/^\d+$/.test(h)?o=Number(h):h.toLowerCase()!=="code"&&(i=h.toLowerCase());const c=i?r.filter(h=>h.lang===i):r;if(c.length===0)return null;if(o!==null){const h=i?c.find(m=>m.langIndex===o):r.find(m=>m.index===o);return h?{content:h.content,label:Zq(h,i)}:null}const u=c[c.length-1];return u?{content:u.content,label:Zq(u,i)}:null}function eU(e,t){const n=$wt(e);if(n.length===0)return null;let s=null;for(const i of t)/^\d+$/.test(i)&&(s=Number(i));const r=s!==null?n.find(i=>i.index===s):n[n.length-1];return r?{content:r.content,label:`Inline LaTeX expression ${r.index}`}:null}function Fwt(e,t){var u;const n=t.trim().split(/\s+/).filter(Boolean),s=(u=n[0])==null?void 0:u.toLowerCase();if(s!=="latex"&&s!=="math"&&s!=="inline-latex")return;if(s==="inline-latex")return eU(e,n.slice(1));const r=n.slice(1),i=r.findIndex(d=>d.toLowerCase()==="inline");if(i!==-1)return eU(e,r.filter((d,h)=>h!==i));const o=Bwt(e);if(o.length===0)return null;let a=null;for(const d of r)/^\d+$/.test(d)&&(a=Number(d));const c=a!==null?o.find(d=>d.index===a):o[o.length-1];return c?{content:c.content,label:`LaTeX block ${c.index}`}:null}function Hwt(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 qwt(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 Uwt(e,t,n=qwt){const s=Hwt(e);if(s===null)return{status:"info",message:Qi.NO_OUTPUT};if(!s)return{status:"info",message:Qi.NO_TEXT};try{const r=Fwt(s,t);if(r===null)return{status:"info",message:t.trim().split(/\s+/).some(c=>c==="inline")||t.trim().toLowerCase().startsWith("inline-latex")?Qi.INLINE_LATEX_MISSING:Qi.LATEX_MISSING};if(r!==void 0)return await n(r.content),{status:"info",message:`${r.label}${Qi.COPIED_SUFFIX}`};const i=zwt(s,t);if(i===null)return{status:"info",message:Qi.CODE_MISSING};const o=(i==null?void 0:i.content)??s;return await n(o),{status:"info",message:i?`${i.label}${Qi.COPIED_SUFFIX}`:Qi.OUTPUT_COPIED}}catch(r){const i=r instanceof Error?r.message:String(r);return{status:"error",message:`${Qi.CLIPBOARD_PREFIX}${i}`}}}function Vwt(e){return typeof e=="object"&&e!==null}function dae(e){const t="Model switched: ";return e.startsWith(t)?e.slice(t.length).trim().replace(/\([^()]+\)$/,""):null}function lR(e){return e.role==="system"&&e.variant==="info"&&e.source==="model_switch_summary"}function Wwt(e){if(!lR(e)||!Vwt(e.data))return null;const t=e.data.modelId;return typeof t=="string"&&t?t:null}function Gwt(e){const t=new Set;for(const n of e){if(!lR(n))continue;const s=Wwt(n);s&&t.add(s)}return t.size===0?[...e]:e.filter(n=>{if(n.role!=="system"||n.variant!=="info")return!0;const s=dae(n.content);return!s||!t.has(s)})}function Kwt(e){return e.role!=="system"||e.variant!=="info"?!1:dae(e.content)!==null||lR(e)}function Ywt(e){const t=e.findIndex(n=>!Kwt(n));return t<0?[]:e.slice(t)}function tU(e){return Ywt(Gwt(e))}function Xwt(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 nU(e,t){const n={nodeVersion:"",npmVersion:"",authSource:"",platform:"",arch:"",sandbox:"",proxy:"",memoryUsage:""};if(e)for(const s of e.cells){const r=s.detail;s.kind==="node_version"&&(r!=null&&r.version)?n.nodeVersion=r.version:s.kind==="npm"&&(r!=null&&r.version)?n.npmVersion=String(r.version).replace(/^npm\s*/i,""):s.kind==="auth"&&(r!=null&&r.source)&&(n.authSource=r.source)}if(t)for(const s of t.cells)s.kind==="platform"?(n.platform=s.name,s.value&&(n.arch=s.value)):s.kind==="sandbox"&&s.name==="SANDBOX"?n.sandbox=s.value||"":s.kind==="proxy"&&s.present&&s.value?n.proxy=`${s.name}: ${s.value}`:s.kind==="memory"&&s.value&&(n.memoryUsage=s.value);return n}function Qwt(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?`${t[2]}:${t[1]}`:e}function sU(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?t[1]:e}function Jwt(e){const t=e.indexOf("\0"),n=t>=0?e.slice(0,t):e,s=n.indexOf(":");return s>0?`${n.slice(s+1)}(${n.slice(0,s)})`:n}const Zwt=12,ekt=8,tkt=.35,nkt=2,skt=.1,rkt=700,ikt=10*60*1e3,okt=.75,akt=280,lkt=[/^继续[吧呢]?$/,/^行[吧吗]?$/,/^好的?$/,/^再[看试说解释改跑补].*/,/^顺手.*/,/^上面.*/,/^刚才.*/,/^这个报错.*/,/^那你.*/,/^帮我修.*/,/^帮我看下.*/,/^跑(一下)?(测试|看看).*/,/^这个实现.*/,/^这个 PR.*/i,/^继续当前.*/,/^continue$/i,/^ok(?:ay)?$/i,/^retry$/i,/^fix (?:that|this|it)/i,/^run (?:the )?tests?/i],ckt=[/新的?(功能|任务|方向|话题)/,/写(一篇)?(设计文档|文档|spec|方案)/i,/产品方案/,/脑爆/,/另一个(功能|方向|任务|主题)/,/不继续当前/,/切到(一个)?新的?(任务|方向|话题)/,/start (a )?new/i,/new (feature|task|design|spec|doc|workflow)/i,/product (design|plan|spec)/i,/brainstorm/i];function ukt(e){const t=e.trim();return lkt.some(n=>n.test(t))}function dkt(e){const t=e.trim();return ckt.some(n=>n.test(t))}function hkt(e){return e.filter(n=>(n.role==="user"||n.role==="assistant")&&typeof n.content=="string"&&n.content.trim().length>0).slice(-8).map(n=>({role:n.role,text:n.content.trim().slice(0,akt)}))}function fkt(e){const t=e.recentMessages.map((n,s)=>`${s+1}. ${n.role}: ${n.text}`).join(`
`);return["You are deciding whether a user's new message still belongs in the current coding session.","Suggest starting a new session only when the new message is clearly a different task or topic, and continuing in the current session would likely add context noise or wasted token usage.","Be conservative. When in doubt, keep the current session.","Do NOT suggest a new session for follow-up questions, implementation continuations, debugging iterations, review follow-ups, or adjacent design discussion about the same repo, PR, bug, or feature.","Return JSON only with keys: shouldSuggestNewSession (boolean) and confidence (0-1 number).","",`Context usage ratio: ${e.contextUsageRatio.toFixed(2)}`,`Visible message count: ${e.messageCount}`,"","Recent visible messages:",t||"(none)","","Current user input:",e.currentInput].join(`
`)}function rU(e){try{const t=JSON.parse(e);return typeof t.shouldSuggestNewSession!="boolean"||typeof t.confidence!="number"?null:{shouldSuggestNewSession:t.shouldSuggestNewSession,confidence:t.confidence}}catch{return null}}function mkt(e){const t=rU(e);if(t)return t;const n=e.indexOf("{"),s=e.lastIndexOf("}");if(n===-1||s<=n)return null;const r=e.slice(n,s+1);return r===e?null:rU(r)}function pkt({enabled:e,inputText:t,messages:n,sessionId:s,contextUsageRatio:r,isRunning:i,dialogOpen:o,generateContent:a}){const[c,u]=f.useState(null),d=f.useRef(null),h=f.useRef(null),m=f.useRef(0),p=f.useRef(s),g=f.useMemo(()=>hkt(n),[n]),b=f.useCallback(()=>{var y;d.current&&(clearTimeout(d.current),d.current=null),(y=h.current)==null||y.abort(),h.current=null},[]),v=f.useCallback(()=>{u(null),b()},[b]),x=f.useCallback(()=>{m.current=Date.now()+ikt,u(null),b()},[b]);return f.useEffect(()=>{p.current!==s&&(u(null),b(),p.current=s)},[b,s]),f.useEffect(()=>{if(b(),!e||!a||!s){u(null);return}const y=t.trim();if(y.length<Zwt){u(null);return}if(ukt(y)){u(null);return}const w=dkt(y);if(i||o){u(null);return}if(w?g.length<nkt&&r<skt:g.length<ekt&&r<tkt){u(null);return}if(Date.now()<m.current){u(null);return}return u(null),d.current=setTimeout(()=>{const k=new AbortController;h.current=k;const T=fkt({recentMessages:g,currentInput:y,contextUsageRatio:r,messageCount:g.length});(async()=>{let _="";try{for await(const S of a(T,{signal:k.signal})){if(h.current!==k)return;if(S.type==="delta")_+=S.text;else if(S.type==="error"){h.current===k&&u(null);return}}if(h.current!==k)return;const C=mkt(_.trim());if(C&&C.shouldSuggestNewSession&&C.confidence>=okt){u({isVisible:!0,classifiedInput:y});return}u(null)}catch{k.signal.aborted||u(null)}finally{h.current===k&&(h.current=null)}})()},rkt),()=>{b()}},[b,r,o,e,a,t,i,g,s]),{suggestion:c,dismiss:v,suppress:x}}const Kp=f.createContext(!1),cR=f.createContext(new Map),hae=f.createContext(new Map);function gkt({timeline:e,details:t,children:n}){return l.jsx(cR.Provider,{value:e,children:l.jsx(hae.Provider,{value:t,children:n})})}const uy=W4,M8=760,H0=320,v_=500,bkt=20,ykt=3e4;function xkt(e){return(e.skills??[]).filter(t=>t.status==="ok").map(t=>({name:t.name,description:t.description??"",...t.argumentHint?{argumentHint:t.argumentHint}:{}})).sort((t,n)=>t.name.localeCompare(n.name))}const vkt="ui.compactMode",wkt="ui.hideTips",kkt={main:"model.select",fast:"model.setFast",voice:"model.setVoice",vision:"model.setVision"};function I8(e){return e.trim().replace(/^\/+/,"").toLowerCase()}function _kt(e){const t=e;return t.source!=="goal"?null:f4(t.data)??f4(t.text)}function Skt(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind!=="status")continue;const s=_kt(n);if(s)return s.kind==="set"||s.kind==="checking"?{condition:s.condition,setAt:s.setAt??n.serverTimestamp??n.createdAt}:null}return null}const iU={insertText:()=>{},setText:()=>{},addTags:()=>{},removeTag:()=>{},clear:()=>{},submit:()=>{}},Ckt=[],fae=1e3,oU=6,aU=40,mae="qwen-code-web-shell-chat-width",Tkt=40,pae="qwen-code-web-shell-sidebar-collapsed";function Ekt(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,primaryNav:e.primaryNav,hideProjectHeader:e.hideProjectHeader,sessionActions:e.sessionActions,footer:e.footer,lockedWorkspace:e.lockedWorkspace}:{enabled:!1,defaultCollapsed:!1,showCompactToggle:!0}}function Akt(e){if(typeof window>"u")return e;try{const t=window.localStorage.getItem(pae);if(t==="true")return!0;if(t==="false")return!1}catch{}return e}function lU(e){try{window.localStorage.setItem(pae,String(e))}catch{}}function y2(){return`${fae}`}function Nkt(){if(typeof window>"u")return y2();try{return window.localStorage.getItem(mae)==="wide"?"wide":y2()}catch{return y2()}}function jkt(e){try{window.localStorage.setItem(mae,e)}catch{}}function gae(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:fae}function Mkt(e,t){const n=`${gae(t)}px`,s=`calc(${n} + ${Tkt}px)`;return{"--chat-regular-content-width":n,"--chat-regular-shell-width":s,"--chat-content-width":e==="wide"?"100%":n,"--chat-shell-width":e==="wide"?"100%":s}}function cU(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function uU(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function Ikt(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}function Rkt(){if(typeof window>"u")return"en";const e=new URLSearchParams(window.location.search);return Dd(e.get("language")??e.get("lang")??navigator.language)}function Dkt(e,t){return e instanceof Error?e.message:t}function R8(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function q0(e){return typeof e=="object"&&e!==null&&e._alreadyDispatched===!0}function Lkt(e){return e.category==="validation"||e.category==="user_action"||e.category==="system"}function Pkt(e){return e.severity==="warning"?"warning":e.severity==="info"?"info":"error"}function D8(e){return typeof e=="object"&&e!==null}function Okt(e){if(!D8(e))return null;const t=e._meta;if(!D8(t))return null;const n=t.qwenModelSwitch;if(!D8(n))return null;const s=n.authType,r=n.modelId,i=n.baseUrl,o=n.apiKey;return typeof s!="string"||typeof r!="string"||typeof i!="string"||typeof o!="string"?null:{authType:s,modelId:r,baseUrl:i,apiKey:o,...typeof n.isRuntime=="boolean"?{isRuntime:n.isRuntime}:{}}}function Bkt(e,t){return t("model.usingModel",{isRuntime:e.isRuntime?1:0,modelId:e.modelId})}function $kt(e){return e.toolKind==="edit"}function zkt(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 Fkt(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 Hkt(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const s of n.tools)(uK(s)||Fkt(s))&&t.push(`${s.callId}:${s.status}`);return t.join("|")}function qkt(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 Ukt(e,t){return e===Qi.NO_OUTPUT?t("copy.noOutput"):e===Qi.NO_TEXT?t("copy.noText"):e===Qi.CODE_MISSING?t("copy.codeMissing"):e===Qi.LATEX_MISSING?t("copy.latexMissing"):e===Qi.INLINE_LATEX_MISSING?t("copy.inlineLatexMissing"):e===Qi.OUTPUT_COPIED?t("copy.outputCopied"):e.startsWith(Qi.CLIPBOARD_PREFIX)?`${t("copy.failedFallback")}. ${e.slice(Qi.CLIPBOARD_PREFIX.length)}`:e.endsWith(Qi.COPIED_SUFFIX)?t("copy.toClipboard",{label:e.slice(0,-Qi.COPIED_SUFFIX.length)}):e}function w_(e,t,n){const s=e.find(r=>r.key===n);if(s)return t==="user"?s.values.user:s.values.workspace}function Vkt({onSessionIdChange:e,onSessionCreated:t,theme:n,onThemeChange:s,language:r,onLanguageChange:i,className:o,style:a,onConnectionChange:c,onStreamingStateChange:u,onError:d,onBugReport:h,hiddenSlashCommands:m,slashCommandCategoryOrder:p,onSlashCommand:g,builtinAtProviders:b,atProviders:v,composerTagIcons:x,renderToolHeaderExtra:y,renderWelcomeHeader:w,renderWelcomeFooter:k,mobileWelcomeFooterMiddle:T=!1,parseUserMessageContent:_,renderUserMessageContent:C,renderComposerTag:S,renderComposerTagTooltip:L,onComposerTagClick:N,renderAssistantTurnFooter:$,renderComposerToolbarStart:M,renderComposerToolbarEnd:P,renderComposerToolbarRight:E,renderComposerHeader:O,renderFooter:z,bottomStatusItems:F,chatMaxWidth:B,sidebar:W,splitSessionIds:I,onSplitSessionIdsChange:Y,onRightPanelOpen:V,messageTurnOutputs:j,shellRef:ee,composerToolbarActions:se,composerPlaceholders:X,compactThinking:Q=!1,collapseCompletedTurns:ue=!0,markdownTableMode:re="basic",virtualScrollThreshold:J,markdown:q,loadingPhrases:Z,onTranscriptChange:he,onToast:ye,composerRef:oe,onComposerReady:we,composerInput:Ve,composerInputVersion:lt,onSessionChange:Et,onSubmitBefore:pt,restartSseOnPrompt:je,lockedWorkspaceCwd:Ae,lockedWorkspaceCapability:De}={}){var gD,bD,yD,xD,vD,wD;const[Ne,tt]=f.useState(Nkt),[Se,Be]=f.useState(()=>r===void 0?Rkt():Dd(r)),le=f.useMemo(()=>sj(Se),[Se]),Le=f.useMemo(()=>Ekt(W),[W]),[sn,Cn]=f.useState(()=>Akt(Le.defaultCollapsed)),[In,_t]=f.useState(null),[Te,at]=f.useState(!1),[ke,Pe]=f.useState(!1),ve=f.useCallback(()=>{at(!1),Pe(!1)},[]),Ke=_q(),me=_q("(min-width: 1200px)");f.useEffect(()=>{Le.enabled||ve()},[ve,Le.enabled]),f.useEffect(()=>{const R=window.matchMedia("(max-width: 760px)"),H=te=>{te.matches||ve()};return R.addEventListener("change",H),()=>R.removeEventListener("change",H)},[ve]),f.useEffect(()=>{if(!Te)return;const R=fe=>{if(fe.key!=="Escape"||Lt.current)return;const $e=fe.target;Vp($e)&&!($e!=null&&$e.closest("[data-sidebar-shell]"))||(fe.stopPropagation(),fe.preventDefault(),ve())},H=document.body.style.overflow;document.body.style.overflow="hidden";const te=fe=>{const $e=fe.target;$e!=null&&$e.closest("[data-sidebar-shell]")&&!$e.closest(`.${xt.mobileBackdrop}`)||fe.preventDefault()};return document.addEventListener("touchmove",te,{passive:!1}),window.addEventListener("keydown",R,!0),()=>{document.body.style.overflow=H,document.removeEventListener("touchmove",te),window.removeEventListener("keydown",R,!0)}},[Te,ve]);const qe=f.useCallback(R=>{Cn(R),lU(R)},[]);f.useEffect(()=>{if(!Le.enabled)return;const R=H=>{if(!Awt(H))return;const te=H.target;if(Vp(te)&&!(te!=null&&te.closest("[data-web-shell-composer-editor]")))return;if(H.preventDefault(),ke||window.matchMedia("(max-width: 760px)").matches){Te?(at(!1),Pe(!1)):at(!0);return}const fe=!sn;Cn(fe),lU(fe)};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[Le.enabled,Te,ke,sn]);const Mt=f.useMemo(()=>({composerTagIcons:x,renderToolHeaderExtra:y,renderWelcomeHeader:w,renderWelcomeFooter:k,parseUserMessageContent:_,renderUserMessageContent:C,renderComposerTag:S,renderComposerTagTooltip:L,onComposerTagClick:N,renderAssistantTurnFooter:$,renderComposerToolbarStart:M,renderComposerToolbarEnd:P,renderComposerToolbarRight:E,renderComposerHeader:O,renderFooter:z,compactThinking:Q,collapseCompletedTurns:ue,markdownTableMode:re,markdown:q,loadingPhrases:Z}),[x,y,w,k,_,C,S,L,N,$,M,P,E,O,z,Q,ue,re,q,Z]),ln=z,Ft=O,st=Y4(),Tn=jv(),ne=Dl(),gt=QG(),bt=ol(),It=f.useMemo(()=>{var H;const R=((H=bt.capabilities)==null?void 0:H.workspaces)??[];return De&&!R.some(te=>te.cwd===De.cwd)?[...R,De]:R},[De,(gD=bt.capabilities)==null?void 0:gD.workspaces]),Rt=f.useMemo(()=>Ae?It.filter(R=>R.cwd===Ae):It,[Ae,It]),We=B1(),{notices:Zn,dismissNotice:Ar}=Eme(),Ge=To(),[dt,bn]=f.useState(void 0),Ht=f.useRef(dt);Ht.current=dt;const[Rn,Gn]=f.useState(void 0),Or=f.useRef(void 0),[Bn,_n]=f.useState(void 0),gs=f.useRef(void 0);f.useEffect(()=>{const R=ne.sessionId;if(gs.current=R,!R){_n(void 0);return}bt.client.sessionStatus(R).then(H=>{gs.current===R&&_n(H.worktree)}).catch(()=>{gs.current===R&&_n(void 0)})},[ne.sessionId,bt.client]);const Qn=f.useMemo(()=>{var R;return ne.sessionId?ne.workspaceCwd:Ae??dt??((R=It.find(H=>H.primary))==null?void 0:R.cwd)},[ne.sessionId,ne.workspaceCwd,Ae,dt,It]);f.useEffect(()=>{if(!Qn){Or.current=void 0,Gn(void 0);return}const R=(Bn==null?void 0:Bn.path)??Qn;Or.current!==R&&(Or.current=R,Gn(void 0));let H=!1;const te=()=>{bt.client.workspaceByCwd(Qn).workspaceGit(Bn==null?void 0:Bn.path).then(wt=>{H||Gn(wt)}).catch(()=>{H||Gn(void 0)})};te();const fe=()=>te();window.addEventListener("focus",fe);const $e=window.setInterval(()=>{document.visibilityState==="visible"&&te()},3e4);return()=>{H=!0,window.removeEventListener("focus",fe),window.clearInterval($e)}},[Qn,ne.gitBranch,bt.client,Bn]);const Dn=f.useRef(ye);Dn.current=ye;const wn=f.useRef(0),[br,Qs]=f.useState([]),hs=f.useCallback(R=>{Qs(H=>H.filter(te=>te.id!==R))},[]),cn=f.useCallback((R,H)=>{if(Dn.current){Dn.current(R,H);return}const te={id:`web-shell-toast-${Date.now()}-${++wn.current}`,tone:R,message:H};Qs(fe=>[...fe.filter(wt=>wt.tone!==R||wt.message!==H),te].slice(-4))},[]),Jn=moe(le),Wi=f.useRef(Jn);Wi.current=Jn;const[is,tr]=f.useState(null),[kr,Br]=f.useState(null),gr=f.useRef(1),bs=f.useRef(1),ir=f.useRef(null),or=f.useRef(null),pe=f.useRef(ne.sessionId),Oe=f.useRef(void 0),rt=f.useRef(void 0),Ut=f.useRef(void 0),fn=f.useRef(ne.sessionId),un=f.useMemo(()=>{const R=[is].filter(te=>te!==null);if(R.length===0)return tU(Jn);const H=[...Jn];for(const te of R.sort((fe,$e)=>fe.anchorIndex-$e.anchorIndex)){const fe=te.anchorAfterId?H.findIndex(wt=>wt.id===te.anchorAfterId):-1,$e=fe>=0?fe+1:Math.min(te.anchorIndex,H.length);H.splice($e,0,te.message)}return tU(H)},[Jn,is]),{artifacts:_e,loading:Ue,error:zt}=poe(),[Sn,Gt]=f.useState([]),[Ls,kn]=f.useState(()=>new Map),[Pn,es]=f.useState([]);f.useEffect(()=>{if(Sn.length===0||_e.length===0)return;const R=new Set(_e.map(te=>te.id)),H=new Set(Pn.filter(te=>te.kind==="artifact"&&te.workspaceActions).map(te=>te.kind==="artifact"?te.artifactId:""));Gt(te=>{const fe=te.filter($e=>!R.has($e.id)||H.has($e.id));return fe.length===te.length?te:fe})},[_e,Sn.length,Pn]);const jn=f.useMemo(()=>Array.from(Ls.values()).flatMap(R=>[...R.artifacts]),[Ls]),$n=f.useMemo(()=>{if(Sn.length===0&&jn.length===0)return _e;const R=[..._e];for(const H of[...Sn,...jn])R.findIndex(fe=>fe.id===H.id)<0&&R.push(H);return R},[_e,Sn,jn]),qs=f.useCallback((R,H,te)=>{kn($e=>{const wt=$e.get(R);if((wt==null?void 0:wt.workspaceActions)===te&&wt.artifacts.length===H.length&&wt.artifacts.every((qt,ft)=>{const yt=H[ft];return(yt==null?void 0:yt.id)===qt.id&&yt.updatedAt===qt.updatedAt&&yt.sizeBytes===qt.sizeBytes}))return $e;const Jt=new Map($e);return H.length===0?Jt.delete(R):Jt.set(R,{artifacts:[...H],workspaceActions:te}),Jt});const fe=new Set(H.map($e=>$e.id));es($e=>{let wt=!1;const On=$e.map(Jt=>{if(Jt.kind!=="artifact"||!fe.has(Jt.artifactId))return Jt;const qt={id:Jt.id,kind:"artifact",title:Jt.title,artifactId:Jt.artifactId,workspaceActions:Jt.workspaceActions??te};return Jt.previewContent!==void 0&&(wt=!0),Jt.workspaceActions||(wt=!0),qt});return wt?On:$e})},[]),mn=f.useMemo(()=>joe(un,_e,ne.workspaceCwd||""),[un,_e,ne.workspaceCwd]),Ps=f.useMemo(()=>Ioe(un,mn,ne.workspaceCwd||""),[un,mn,ne.workspaceCwd]),ys=f.useMemo(()=>Roe(un),[un]),Re=f.useMemo(()=>new Set(j??Tie),[j]),[Dt,zn]=f.useState(!1),xs=f.useRef(Dt);xs.current=Dt;const[nr,Js]=f.useState(null),vs=f.useRef(nr);vs.current=nr;const[Jr,Gi]=f.useState([]),[$r,Ii]=f.useState(null),[qo,ci]=f.useState(M8),Ri=f.useRef(null),ae=f.useRef(null),xe=f.useRef(new Map),ze=f.useRef(ne.sessionId);ae.current={open:Dt,tabs:Pn,activeTabId:nr,reviewChanges:Jr,selectedReviewPath:$r,extraArtifacts:Sn,width:qo},f.useEffect(()=>{const R=ze.current;if(R){const fe=ae.current;if(fe&&(xe.current.set(R,fe),xe.current.size>bkt)){const $e=xe.current.keys().next().value;$e&&xe.current.delete($e)}}const H=ne.sessionId;ze.current=H;const te=H?xe.current.get(H):void 0;if(!te){zn(!1),es([]),Js(null),Gi([]),Ii(null),Gt([]),kn(new Map),ci(M8);return}zn(te.open),es(te.tabs),Js(te.activeTabId),Gi(te.reviewChanges),Ii(te.selectedReviewPath),Gt(te.extraArtifacts),kn(new Map),ci(te.width)},[ne.sessionId]);const Qe=f.useCallback(()=>{var H;const R=(H=or.current)==null?void 0:H.getBoundingClientRect().width;return R?Math.max(H0,qo+R-v_):Math.max(H0,window.innerWidth-v_)},[qo]),Kt=f.useCallback(()=>{var te;const R=((te=or.current)==null?void 0:te.getBoundingClientRect().width)??window.innerWidth,H=Math.max(H0,R-v_);return Math.min(H,Math.max(M8,Math.round(R*.56)))},[]),At=f.useCallback((R,H)=>{if(!R)return;const te=$n.find($e=>$e.id===R),fe={id:`artifact:${R}`,kind:"artifact",artifactId:R,title:(te==null?void 0:te.title)??"Artifact",...H!==void 0?{previewContent:H}:{}};es($e=>$e.some(wt=>wt.id===fe.id)?$e.map(wt=>wt.id===fe.id?{...wt,...fe}:wt):[...$e,fe]),Js(fe.id),ci($e=>xs.current?$e:Kt()),zn(!0)},[$n,Kt]),Un=f.useCallback((R,H)=>{const te={id:"review",kind:"review",title:le("turnOutputs.review")};es(fe=>fe.some($e=>$e.id===te.id)?fe:[te,...fe]),Js(te.id),Gi(R),Ii(H??null),ci(fe=>xs.current?fe:Kt()),zn(!0)},[Kt,le]),Os=f.useCallback((R,H)=>{const te={id:`scheduled-task:${R.toolCallId}`,kind:"scheduled_task",title:le("scheduledTasks.title"),task:R,...H?{workspaceActions:H}:{}};es(fe=>fe.some($e=>$e.id===te.id)?fe.map($e=>$e.id===te.id?te:$e):[...fe,te]),Js(te.id),ci(fe=>xs.current?fe:Kt()),zn(!0)},[Kt,le]),Ss=f.useCallback(R=>{if(V){V(R);return}if(R.kind==="review"){Un(R.changes,R.selectedPath);return}if(R.kind==="scheduled_task"){Os(R.task,R.workspaceActions);return}R.workspaceActions||Gt(te=>{const fe=te.findIndex(wt=>wt.id===R.artifact.id);if(fe<0)return[...te,R.artifact];const $e=[...te];return $e[fe]=R.artifact,$e});const H={id:R.id,kind:"artifact",title:R.title,artifactId:R.artifactId,...R.workspaceActions?{workspaceActions:R.workspaceActions}:{},...R.previewContent!==void 0?{previewContent:R.previewContent}:{}};es(te=>te.some(fe=>fe.id===H.id)?te.map(fe=>fe.id===H.id?{...fe,...H}:fe):[...te,H]),Js(H.id),ci(te=>xs.current?te:Kt()),zn(!0)},[Kt,V,Un,Os]),yr=f.useCallback(()=>{zn(!1),es([]),Js(null),Gi([]),Ii(null),Gt([]),kn(new Map)},[]);f.useLayoutEffect(()=>{if(!Dt)return;const R=()=>{ci(fe=>{var On;const $e=((On=or.current)==null?void 0:On.getBoundingClientRect().width)??window.innerWidth-fe,wt=Math.max(H0,fe+$e-v_);return Math.min(fe,wt)})};R(),window.addEventListener("resize",R);const H=or.current,te=new ResizeObserver(R);return H&&te.observe(H),()=>{window.removeEventListener("resize",R),te.disconnect()}},[Dt]);const Zr=f.useCallback(R=>{es(H=>{const te=H.filter(fe=>fe.id!==R);if(te.length===0)return zn(!1),Js(null),Gi([]),Ii(null),Gt([]),kn(new Map),te;if(vs.current===R){const fe=H.findIndex(wt=>wt.id===R),$e=te[Math.min(fe,te.length-1)]??te[0];Js($e.id)}return te})},[]),_c=f.useCallback(R=>{R.preventDefault();const H=R.currentTarget;H.setPointerCapture(R.pointerId);const te=R.clientX,fe=qo,$e=Qe(),wt=document.body.style.cursor,On=document.body.style.userSelect;let Jt=fe,qt=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const ft=()=>{qt=null,ci(Jt)},yt=Fr=>{Jt=Math.min($e,Math.max(H0,fe-(Fr.clientX-te))),qt===null&&(qt=window.requestAnimationFrame(ft))};let ms=()=>{};const us=Fr=>{Ri.current=null,qt!==null&&(window.cancelAnimationFrame(qt),qt=null),Fr&&ci(Jt),H.hasPointerCapture(R.pointerId)&&H.releasePointerCapture(R.pointerId),document.body.style.cursor=wt,document.body.style.userSelect=On,window.removeEventListener("pointermove",yt),window.removeEventListener("pointerup",ms),window.removeEventListener("pointercancel",ms)};ms=()=>us(!0),Ri.current=()=>us(!1),window.addEventListener("pointermove",yt),window.addEventListener("pointerup",ms),window.addEventListener("pointercancel",ms)},[qo,Qe]);f.useEffect(()=>()=>{var R;return(R=Ri.current)==null?void 0:R.call(Ri)},[]);const xr=Nwt(Tn),ua=f.useMemo(()=>Q7(xr),[xr]),Nr=Dwt(ua),gi=!(ne.catchingUp&&In!==null),sr=E9(Nr)&&gi?Nr:null,Je=Nr&&!E9(Nr)&&gi?Nr:null,Lt=f.useRef(Nr);Lt.current=gi?Nr:null;const Yt=Je!==null||sr!==null,Nn=f.useRef(Yt);Nn.current=Yt||gi&&Q7(Tn)!==null;const Hn=f.useMemo(()=>GUe(Jn),[Jn]),He=f.useRef(null),pn=f.useMemo(()=>{const R=YUe(Jn),H=He.current;if(H&&H.signature===R)return H.timeline;const te=KUe(Jn);return He.current={signature:R,timeline:te},te},[Jn]),js=f.useRef(null),ls=f.useMemo(()=>{const R=XUe(Jn),H=js.current;if(H&&H.signature===R)return H.details;const te=nVe(Jn);return js.current={signature:R,details:te},te},[Jn]),Cs=Lwt(Hn.todos,R=>`${R.id}:${R.status}:${R.content}`),Di=Hn.allCompleted,[lo,Bs]=f.useState("hidden"),Si=ne.catchingUp||Cs.length===0||Di?"hidden":"active";Si!==lo&&Bs(Si);const ui=Si!=="hidden",Kn=F??Ckt,Ts=ui||Kn.length>0,Bl=f.useRef(null),Li=f.useRef(null),[di,$l]=f.useState(null),Uc=f.useRef(new Set),Xu=f.useRef(null),[zr,Ra]=f.useState(0),[zl,Qu]=f.useState(0);f.useLayoutEffect(()=>{if(!Ts){Ra(0),Qu(0);return}const R=Xu.current;if(!R){Ra(aU),Qu(0);return}const H=()=>{const fe=Bl.current,$e=R.getBoundingClientRect(),wt=fe==null?void 0:fe.getBoundingClientRect(),On=Math.ceil($e.height),Jt=wt?Math.max(0,wt.top-$e.top):On+oU;Qu(On),Ra(Math.max(aU,Math.ceil(Jt)))};if(H(),typeof ResizeObserver>"u")return;const te=new ResizeObserver(H);return te.observe(R),Bl.current&&te.observe(Bl.current),()=>te.disconnect()},[Ts]);const Uo=f.useMemo(()=>({"--web-shell-bottom-panel-inset":`${zr}px`,"--web-shell-bottom-panel-height":`${zl}px`,"--web-shell-bottom-panel-gap":`${oU}px`}),[zl,zr]),xm=f.useMemo(()=>Hkt(Jn),[Jn]),[ph,ub]=f.useState(0),Sc=Iwt(xm,ne.status==="connected",ph),cw=f.useMemo(()=>z?Sc.map(qkt):[],[Sc,z]),uw=f.useRef(null),db=f.useRef(null),Vr=f.useRef(null),hb=f.useRef(null),[DC,fb]=f.useState(!1),dw=f.useRef(null),d0=f.useRef(!1),Da=f.useCallback((R="smooth")=>{requestAnimationFrame(()=>{var H;(H=db.current)==null||H.scrollToBottom(R),requestAnimationFrame(()=>{var te;(te=db.current)==null||te.scrollToBottom(R)})})},[]),hw=f.useCallback(R=>{Vr.current=R,cU(oe,R??iU),R&&hb.current!==R&&(hb.current=R,we==null||we(R))},[oe,we]);f.useEffect(()=>{cU(oe,Vr.current??iU)},[oe]);const[vm,Ju]=f.useState(null),[LC,Zu]=f.useState(!1),Vc=f.useRef(!1),mb=f.useRef(null);mb.current=vm;const{followupState:PC,onAcceptFollowup:OC,onDismissFollowup:pb,clear:gb}=nK({onAccept:R=>{var H;(H=Vr.current)==null||H.insertText(R)}}),fw=f.useRef(""),Wc=f.useRef(null),[BC,bb]=f.useState(""),[gh,bh]=f.useState(!1),ar=X4(),ed=f.useRef(ar),Fl=f.useRef(Date.now()),mw=f.useRef(ar);mw.current==="idle"&&ar!=="idle"&&(Fl.current=Date.now()),mw.current=ar;const pw=f.useMemo(()=>{if(ar!=="idle"){for(let R=un.length-1;R>=0;R--){const H=un[R];if((H==null?void 0:H.role)==="user")return H.timestamp??Fl.current}return Fl.current}},[un,ar]),td=f.useRef(""),wm=f.useRef(void 0),yh=f.useRef(null),xh=f.useRef(null),[h0,km]=f.useState(!1),f0=f.useRef(h0);f0.current=h0;const Hl=ne.status==="connected",co=qu(),[vh,gw]=f.useState([]),[m0,bw]=f.useState(!1),yb=f.useRef(0),_m=f.useCallback(async R=>{const H=++yb.current;try{const te=R&&bt.client?await bt.client.workspaceByCwd(R).workspaceSkills():await Ge.loadSkillsStatus();if(H!==yb.current)return;gw(xkt(te)),bw(!0)}catch{return}},[bt.client,Ge]);f.useEffect(()=>{Hl&&_m(ne.workspaceCwd)},[Hl,ne.workspaceCwd,_m]);const[bi,La]=f.useState(null),xb=f.useRef(bi),[Vo,wh]=f.useState("workspace"),[G,Ce]=f.useState(!1),Ie=f.useRef(G),[nt,ht]=f.useState([]),[Vn,Ln]=f.useState(!1),[cs,Zs]=f.useState(!1),[da,nd]=f.useState(!1),[kh,Wr]=f.useState(!1),[Sm,Wo]=f.useState(!1),[ha,$s]=f.useState(!1),[Go,$C]=f.useState(!1),[uR,dR]=f.useState(!1),[p0,vb]=f.useState(void 0),[Gr,Ci]=f.useState("chat"),[sd,zC]=f.useState([]),FC=f.useRef(sd);FC.current=sd;const[yw,HC]=f.useState(null),[fs,rd]=f.useState(null),Ki=f.useCallback(()=>rd(null),[]),hR=f.useCallback(R=>{Ki(),window.setTimeout(()=>{var H,te;(H=Vr.current)==null||H.setText(`/${R} `),(te=Vr.current)==null||te.focus()},0)},[Ki]),Pa=f.useCallback(R=>{Ci("chat"),rd(R)},[]),vae=f.useCallback(async()=>{const R=await Ge.loadMcpStatus();HC({status:R,toolsByServer:{},resourcesByServer:{},showDescriptions:!1,showSchema:!1,showTips:!1})},[Ge]),qC=f.useCallback(()=>{rd(null),Ci("scheduledTasks")},[]),g0=f.useCallback(()=>{rd(null),Ci("goals")},[]),fR=f.useCallback(()=>{Le.enabled&&(rd(null),Ci("chat"),Pe(!0),at(!0))},[Le.enabled]),Cm=f.useCallback(R=>{rd(null),zC(H=>{const te=Array.from(new Set((R??[]).filter(Boolean))).slice(0,Af);return te.length>0?te:H.length>0?H:ne.sessionId?[ne.sessionId]:[]}),Ci("split")},[ne.sessionId]),UC=f.useMemo(()=>Array.from(new Set((I??[]).filter(Boolean))).slice(0,Af).join("\0"),[I]),Ko=I!==void 0,Gc=f.useRef(Y);Gc.current=Y;const mR=f.useCallback(()=>{var H;if(!Ko){Cm();return}const R=sd.length>0?sd:ne.sessionId?[ne.sessionId]:[];(H=Gc.current)==null||H.call(Gc,R)},[ne.sessionId,Ko,Cm,sd]);f.useEffect(()=>{if(!Ko)return;const R=UC?UC.split("\0"):[];zC(H=>Ikt(H,R)?H:R),R.length>0?(rd(H=>H===null?H:null),Ci(H=>H==="split"?H:"split")):Ci(H=>H==="split"?"chat":H)},[Ko,UC]);const wae=f.useCallback(R=>{var H;Ko||zC(R),(H=Gc.current)==null||H.call(Gc,R)},[Ko]),xw=f.useCallback(()=>{var R;Ko&&((R=Gc.current)==null||R.call(Gc,[]))},[Ko]),kae=f.useCallback(()=>{xw(),Ylt(),Pa("sessions")},[xw,Pa]);f.useEffect(()=>{const R=Wlt(window.location.search);if(R.length>0){const te=new URL(window.location.href);te.searchParams.delete("split"),window.history.replaceState(null,"",te),Ko||Cm(R);return}if(Ko)return;const H=Klt();H.length>0&&Cm(H)},[Ko,Cm]),f.useEffect(()=>{Ko||Gr==="split"&&sd.length>0&&Glt(sd)},[Gr,sd,Ko]);const VC=f.useRef(!1),WC=f.useRef(!1);f.useEffect(()=>{if(Ke){WC.current&&(WC.current=!1,!Ko&&FC.current.length>0&&Ci(R=>R==="chat"?"split":R));return}if(fs==="sessions"&&rd(null),Gr==="split"&&(xw(),Ci("chat"),VC.current=!0,!Ko)){WC.current=!0;const R=FC.current[0];R&&!pe.current&&We.loadSession(R).catch(()=>{})}},[Ke,fs,Gr,xw,Ko,We]),f.useEffect(()=>{var R;Gr!=="chat"||!VC.current||(VC.current=!1,!fs&&!Yt&&((R=Vr.current)==null||R.focus()))},[Gr,fs,Yt]);const pR=f.useRef(null),gR=f.useRef(null),bR=f.useRef(null),yR=f.useRef(fs),xR=f.useRef(Yt);f.useEffect(()=>{var te,fe,$e,wt,On;const R=yR.current,H=xR.current;if(yR.current=fs,xR.current=Yt,fs){if(fs==="extensions"){(te=gR.current)==null||te.focus();return}if(fs==="plugins"){(fe=bR.current)==null||fe.focus();return}($e=pR.current)==null||$e.focus()}else R?Yt||(wt=Vr.current)==null||wt.focus():H&&!Yt&&((On=Vr.current)==null||On.focus())},[fs,Yt]),f.useEffect(()=>{Yt&&(fs&&rd(null),bi&&La(null),Vn&&Ln(!1),(Gr==="scheduledTasks"||Gr==="goals")&&Ci("chat"))},[Yt,fs,bi,Vn,Gr]);const _ae=Je!==null&&!fs&&bi===null&&!Vn&&Gr==="chat",Sae=sr!==null&&!fs&&bi===null&&!Vn&&Gr==="chat",[vR,wR]=f.useState(!1),[Tm,GC]=f.useState(!1),kR=f.useRef(Tm),[Cae,Tae]=f.useState(0),[Eae,Aae]=f.useState(0),[Nae,_R]=f.useState(0),jae=f.useCallback(()=>{let R=!1;return _R(H=>H+1),()=>{R||(R=!0,_R(H=>Math.max(0,H-1)))}},[]),SR=f.useRef((co==null?void 0:co.extensionsVersion)??0);f.useEffect(()=>{const R=(co==null?void 0:co.extensionsVersion)??0;if(R!==SR.current){SR.current=R;const H=co==null?void 0:co.lastExtensionChange;if((H==null?void 0:H.status)==="failed"){st.dispatch([{type:"error",text:le("extensions.action.failed",{name:H.name??"",source:H.source??"",error:H.error??le("error.unknown")})}]);return}if((H==null?void 0:H.status)==="installed"){const te=H.name??H.source??le("extensions.label");st.dispatch([{type:"status",text:H.version?le("extensions.install.installedWithVersion",{name:te,version:H.version}):le("extensions.install.installed",{name:te})}])}else if(H!=null&&H.status){const te=H.name??H.source??le("extensions.label"),fe=H.status==="updated"&&H.version?"extensions.manage.updatedWithVersion":`extensions.manage.${H.status}`;st.dispatch([{type:"status",text:le(fe,{name:te,version:H.version??""})}])}We.refreshCommands().catch(()=>{st.dispatch([{type:"error",text:le("extensions.commands.refreshFailed")}])})}},[co==null?void 0:co.extensionsVersion,co==null?void 0:co.lastExtensionChange,We,st,le]);const[Mae,Iae]=f.useState("workspace"),[wb,KC]=f.useState(null),[Rae,CR]=f.useState(!1),[Dae,TR]=f.useState(!1),vw=f.useRef(null),b0=f.useRef(null),[YC,ww]=f.useState(null),[Em,XC]=f.useState(n??qr.Dark),[_h,ER]=f.useState(""),kw=f.useRef(_h);kw.current=_h;const y0=f.useCallback(R=>{kw.current=R,ER(R)},[]),Us=f.useRef(ne);Us.current=ne;const uo=f.useCallback(()=>Us.current.sessionId?!0:(cn("info",le("localCommand.noSession")),!1),[cn,le]),AR=ne.displayName,[ql,QC]=f.useState("default"),JC=f.useRef(ql);JC.current=ql;const kb=f.useCallback(R=>{JC.current=R,QC(R)},[]),[ZC,Am]=f.useState(!1),_b=f.useRef(null),eT=f.useRef(null),x0=f.useRef(void 0),[tT,Sb]=f.useState(!1),NR=f.useRef(0),Kc=f.useRef(null),jR=f.useRef(t);jR.current=t;const _w=f.useRef(void 0);f.useEffect(()=>{Gr!=="goals"&&(_w.current=void 0)},[Gr]);const MR=f.useCallback(()=>{const R=Us.current.sessionId;if(_b.current)return!R||R===eT.current?_b.current:Promise.resolve();if(R)return Promise.resolve();const H=(async()=>{var On;const fe=kw.current||Us.current.currentModel,$e=JC.current||Us.current.currentMode,wt=(On=It.find(Jt=>Jt.primary))==null?void 0:On.cwd;await _ut({sessionActions:We,modelId:fe,modeId:$e,workspaceCwd:Ae??Ht.current??wt,worktree:x0.current,onSessionCreated:jR.current,onSessionAllocated:Jt=>{eT.current=Jt},getCurrentSessionId:()=>Us.current.sessionId}).then(Jt=>{Jt.worktree&&_n(Jt.worktree),x0.current=void 0,Sb(!1)}),bn(void 0)})();_b.current=H;const te=()=>{_b.current===H&&(_b.current=null,eT.current=null)};return H.then(te,te),H},[Ae,We,It]),id=f.useRef(pt);id.current=pt;const IR=f.useRef(g);IR.current=g;const[RR,DR]=f.useState(0),Cb=f.useRef(null);f.useEffect(()=>()=>{Cb.current!==null&&clearTimeout(Cb.current)},[]);const LR=f.useCallback(R=>{Et==null||Et(R),DR(H=>H+1)},[Et]),Yo=f.useRef(LR);Yo.current=LR;const fa=f.useCallback(async(R,H,te)=>{var us,Fr;const fe=!R.trimStart().startsWith("/"),$e=td.current,wt=wm.current,On=xh.current,Jt=f0.current;!(te!=null&&te.retry)&&fe&&(td.current=R,wm.current=H,xh.current=null),km(!1);const qt=!Us.current.sessionId;if(id.current){Am(!0);try{await id.current({sessionId:Us.current.sessionId,prompt:R})}catch(ei){console.warn("[web-shell] onSubmitBefore rejected, prompt cancelled",ei),Am(!1),td.current=$e,wm.current=wt,xh.current=On,km(Jt);return}qt||Am(!1)}!id.current&&qt&&Am(!0),gb();try{await MR()}finally{qt&&Am(!1)}const ft={images:H,inputAnnotations:te==null?void 0:te.inputAnnotations,optimisticUserMessage:te==null?void 0:te.optimisticUserMessage,retry:te==null?void 0:te.retry,...te!=null&&te.onAdmitted?{onAdmitted:te.onAdmitted}:{}};te!=null&&te.commitComposerAccepted?te.commitComposerAccepted():te!=null&&te.clearComposerOnPromptStart&&((us=Vr.current)==null||us.clear());const yt=Us.current.sessionId;return yt&&R.trim()&&((Fr=Yo.current)==null||Fr.call(Yo,{type:"submit",sessionId:yt,prompt:R,queued:!1}),Cb.current!==null&&clearTimeout(Cb.current),Cb.current=setTimeout(()=>{DR(ei=>ei+1)},2e3)),await We.sendPrompt(R,ft)},[gb,MR,We]),Lae=f.useMemo(()=>(ne.models??[]).filter(jy).map(R=>({id:R.id,label:uf(R.label||R.id)})),[ne.models]),Nm=Qn,Yc=cs||da||kh||Sm||ha||Go||uR||p0!==void 0||bi!==null||Vn||YC!==null||yw!==null||wb!==null||vR||Tm||Nae>0||fs!==null||Gr!=="chat",dn=f.useCallback((R,H)=>{if(R8(R)||bG(R)||q0(R))return;const te=Dkt(R,H);console.error("[web-shell]",te,R),cn("error",te)},[cn]),Pae=f.useCallback(R=>cn("success",R),[cn]),{queuedPrompts:Oae,queuedTexts:Bae,enqueuePrompt:nT,removeQueuedPrompt:$ae,insertQueuedPrompt:zae,editQueuedPrompt:Fae,editLastQueuedPrompt:Hae,clearQueuedPrompts:qae}=boe({connected:Hl,sessionId:ne.sessionId,clientId:ne.clientId,streamingState:ar,sessionActions:We,store:st,editorRef:Vr,reportError:dn,notifySuccess:Pae,t:le}),jm=f.useCallback((R,H,te,fe,$e)=>{var Jt;if(id.current)return id.current({sessionId:Us.current.sessionId,prompt:R}).then(()=>{var yt,ms;nT(R,H,te,$e)!==!1&&(fe?fe():(yt=Vr.current)==null||yt.clear());const ft=Us.current.sessionId;ft&&R.trim()&&((ms=Yo.current)==null||ms.call(Yo,{type:"submit",sessionId:ft,prompt:R,queued:!0}))}).catch(qt=>{console.warn("[web-shell] onSubmitBefore rejected queued prompt, cancelled",qt)}),!1;const wt=nT(R,H,te,$e),On=Us.current.sessionId;return On&&R.trim()&&((Jt=Yo.current)==null||Jt.call(Yo,{type:"submit",sessionId:On,prompt:R,queued:!0})),wt},[nT]);f.useEffect(()=>{for(const R of Zn)Lkt(R)?cn(Pkt(R),R.message):R.category!=="lifecycle"&&console.warn("[web-shell] daemon notice",R),Ar(R.id)},[Ar,Zn,cn]);const sT=f.useRef(h);sT.current=h,f.useEffect(()=>{var R;pe.current=ne.sessionId,(R=ir.current)==null||R.abort(),ir.current=null,tr(null),Br(null),ww(null),Nw.current=0},[ne.sessionId]);const PR=f.useCallback(()=>{var $e;if(!uo())return;const R=`local-recap-${gr.current++}`,H=Jn.length,te=($e=Jn.at(-1))==null?void 0:$e.id,fe=ne.sessionId;tr({anchorAfterId:te,anchorIndex:H,message:{id:R,role:"system",content:`※ ${le("recap.label")}: ${le("recap.loading")}`,variant:"info",source:"recap"}}),We.recapSession().then(wt=>{pe.current===fe&&tr({anchorAfterId:te,anchorIndex:H,message:{id:R,role:"system",content:wt.recap?`※ ${le("recap.label")}: ${wt.recap}`:le("recap.empty"),variant:"info",source:"recap"}})},wt=>{pe.current===fe&&(tr(null),!R8(wt)&&!q0(wt)&&console.warn("[web-shell] unhandled recap failure",wt))})},[ne.sessionId,Jn,uo,We,le]),OR=f.useCallback(R=>{var wt;const H=R.trim();if(!H){cn("error",le("btw.empty"));return}if(!uo())return;const te=`local-btw-${bs.current++}`,fe=ne.sessionId;(wt=ir.current)==null||wt.abort();const $e=new AbortController;ir.current=$e,Br({id:te,role:"btw",question:H,answer:"",isPending:!0}),We.btwSession(H,{signal:$e.signal}).then(On=>{pe.current===fe&&ir.current===$e&&(ir.current=null,Br({id:te,role:"btw",question:H,answer:On.answer||le("btw.emptyAnswer"),isPending:!1}))},On=>{pe.current===fe&&ir.current===$e&&(ir.current=null,Br(null),!R8(On)&&!q0(On)&&console.warn("[web-shell] unhandled btw failure",On))})},[ne.sessionId,cn,uo,We,le]),BR=f.useCallback(()=>{var R;(R=ir.current)==null||R.abort(),ir.current=null,Br(null)},[]);f.useEffect(()=>{const R=H=>{var On;if(Yc||Nr)return;const te=kr;if(!te||te.role!=="btw")return;const fe=H.key.toLowerCase(),$e=H.key==="Escape"&&!H.ctrlKey&&!H.metaKey&&!H.altKey&&!H.shiftKey,wt=H.ctrlKey&&!H.metaKey&&!H.altKey&&!H.shiftKey&&(fe==="c"||fe==="d");if(te.isPending){if(!$e&&!wt)return}else{const Jt=((On=Vr.current)==null?void 0:On.hasInput())??!1;if(!(!H.ctrlKey&&!H.metaKey&&!H.altKey&&!H.shiftKey&&(H.key==="Escape"||!Jt&&(H.key==="Enter"||H.key===" "))))return}H.preventDefault(),H.stopPropagation(),BR()};return window.addEventListener("keydown",R,!0),()=>window.removeEventListener("keydown",R,!0)},[Yc,kr,BR,Nr]);const od=f.useCallback((R,H)=>xut(ed.current!=="idle",R,H,{append:te=>st.appendLocalUserMessage(te)}),[st]),Xc=f.useCallback(()=>(cn("error",le("queue.commandBlocked")),!1),[cn,le]),Tb=f.useCallback(R=>{XC(R),s==null||s(R)},[s]),v0=f.useCallback(R=>{Be(R),i==null||i(R)},[i]),$R=f.useCallback(()=>{$s(!0)},[]),zR=tK({autoLoad:!0}),Sw=Ome({autoLoad:!0}),Cw=Sw.reload,[Uae,Tw]=f.useState(!1),{settings:Sh,setValue:Ul,reload:Ch}=zR,w0=Sh.find(R=>R.key===lp),k0=Sh.find(R=>R.key===wkt),_0=Sh.find(R=>R.key===sS),Vae=(()=>{const R=w_(Sh,Vo,"voiceModel");return typeof R=="string"&&R.trim()?R.trim():void 0})(),Wae=(()=>{const R=w_(Sh,Vo,"visionModel");if(!(typeof R!="string"||!R.trim()))return Jwt(R.trim())})(),Gae=(()=>{const R=w_(Sh,Vo,"fastModel");return typeof R=="string"&&R.trim()?R.trim():void 0})(),Kae=f.useMemo(()=>{const R=w_(Sh,Vo,"modelFallbacks");return typeof R=="string"?R.split(",").map(H=>H.trim()).filter(Boolean):[]},[Sh,Vo]),Yae=f.useMemo(()=>{const R=new Set,H=[];for(const te of(ne.models??[]).filter(jy).filter(fe=>!fe.isRuntime)){const fe=te.baseModelId??sU(te.id);R.has(fe)||(R.add(fe),H.push({baseId:fe,label:uf(te.label||te.baseModelId||te.id)}))}return H},[ne.models]),[Ew,FR]=f.useState(!1),rT=f.useRef(Ew);rT.current=Ew,f.useEffect(()=>{if(n){XC(n);return}const R=aj(w0==null?void 0:w0.values.effective);R&&XC(R)},[n,w0==null?void 0:w0.values.effective]),f.useEffect(()=>{if(r!==void 0){Be(Dd(r));return}const R=tj(_0==null?void 0:_0.values.effective);R&&Be(R)},[r,_0==null?void 0:_0.values.effective]);const Xae=f.useCallback((R,H="user")=>{const te=Se,$e=`/language ui ${R}${H==="workspace"?" --project":" --global"}`;v0(R);const wt=()=>Promise.all([We.refreshCommands(),Ch()]);if(ed.current!=="idle"){v0(te),Xc();return}fa($e,void 0).then(wt).catch(On=>{v0(te),dn(On,"Failed to sync /language command")})},[Xc,v0,Ch,dn,fa,Se,We]),HR=f.useCallback(()=>{if(ed.current!=="idle"){st.dispatch([{type:"status",text:le("clear.blocked")}]);return}st.reset()},[st,le]),qR=f.useCallback(()=>{const R=rT.current,H=!rT.current;FR(H),Ul("workspace",vkt,H).catch(te=>{FR(R),dn(te,le("compact.saveFailed"))})},[dn,Ul,le]),Th=f.useCallback(R=>{if(!_4(R)){dn(new Error(`Unsupported approval mode: ${R}`),le("local.approvalMode"));return}if(!Us.current.sessionId){kb(R);return}We.setApprovalMode(R).then(H=>{const te=H.mode||R;QC(te);const fe=Lt.current;if(!fe)return;if(R==="yolo"||R==="auto-edit"&&$kt(fe)){const wt=fe.options.find(On=>On.kind==="allow_once");if(wt){const On=fe.title||"";st.dispatch([{type:"status",text:le("mode.autoApproved",{tool:On})}]),We.submitPermission(fe.id,wt.id).catch(Jt=>{dn(Jt,"Failed to auto-approve tool call")})}}}).catch(H=>{dn(H,le("local.approvalMode"))})},[We,dn,st,le,kb]);f.useEffect(()=>{ed.current=ar},[ar]),f.useEffect(()=>{xb.current=bi,Ie.current=G,kR.current=Tm},[bi,G,Tm]),f.useEffect(()=>{let R=null;for(let te=Tn.length-1;te>=0;te--){const fe=Tn[te];if((fe==null?void 0:fe.kind)==="user")break;if((fe==null?void 0:fe.kind)==="error"&&fe.source==="turn_error"){R=fe.id;break}if((fe==null?void 0:fe.kind)!=="debug")break}const H=Hl&&R!==null&&R!==xh.current&&td.current.length>0;yh.current=H?R:null,km(H)},[Tn,Hl]),f.useEffect(()=>{u==null||u(ar)},[ar,u]);const UR=f.useRef(ar),VR=f.useRef(void 0);f.useEffect(()=>{var H;const R=UR.current;if(UR.current=ar,ar!=="idle"&&(VR.current=Us.current.sessionId),R!=="idle"&&ar==="idle"){const te=Us.current.sessionId;if(!te||te!==VR.current)return;const fe=yh.current!=null?new Error(`Turn error (block ${yh.current})`):void 0;(H=Yo.current)==null||H.call(Yo,{type:"turn_complete",sessionId:te,error:fe})}},[ar]),f.useEffect(()=>{c==null||c(ne.status)},[ne.status,c]),f.useEffect(()=>{he==null||he(Tn)},[Tn,he]),f.useEffect(()=>{if(ne.error){const R=new Error(ne.error);d==null||d(R)}},[ne.error,d]),f.useEffect(()=>{ER(ne.currentModel??"")},[ne.currentModel,ne.sessionId]),f.useEffect(()=>{QC(ne.currentMode??"default")},[ne.currentMode,ne.sessionId]),f.useEffect(()=>{const R=fn.current;if(ne.sessionId&&ne.sessionId!==R&&Ju(null),fn.current=ne.sessionId,!ne.sessionId&&ne.missingSession){Oe.current=ne.sessionId,rt.current=void 0,Ut.current=void 0;return}const H=It.find(fe=>fe.cwd===ne.workspaceCwd);if(ne.sessionId&&!bt.capabilities)return;const te=H&&!H.primary?H.id:void 0;Oe.current===ne.sessionId&&rt.current===te&&Ut.current===ne.workspaceCwd||(Oe.current=ne.sessionId,rt.current=te,Ut.current=ne.workspaceCwd,e==null||e(ne.sessionId,te,ne.workspaceCwd))},[ne.missingSession,ne.sessionId,ne.workspaceCwd,e,bt.capabilities,It]);const WR=f.useRef(void 0),iT=f.useRef(void 0);f.useEffect(()=>{var te;const R=ne.sessionId,H=ne.displayName;if(!(!R||!H)){if(R!==WR.current){WR.current=R,iT.current=H;return}H!==iT.current&&(iT.current=H,(te=Yo.current)==null||te.call(Yo,{type:"rename",sessionId:R,newName:H}))}},[ne.sessionId,ne.displayName]),f.useEffect(()=>{const R=Skt(Tn);Ju(H=>R?(H==null?void 0:H.condition)===R.condition&&H.setAt===R.setAt?H:R:H&&null)},[Tn]),f.useEffect(()=>{const R=H=>{const te=H.detail;if(!(te!=null&&te.active)){Ju(null);return}te.condition&&Ju({condition:te.condition,setAt:te.setAt??Date.now()})};return window.addEventListener(l9,R),()=>window.removeEventListener(l9,R)},[]);const Aw=f.useRef(null),Nw=f.useRef(0);f.useEffect(()=>{Nw.current=0},[ne.sessionId]),f.useEffect(()=>{function te(){if(document.hidden){Aw.current===null&&(Aw.current=Date.now());return}const fe=Aw.current;if(Aw.current=null,fe===null||Date.now()-fe<18e4||ed.current!=="idle"||!ne.sessionId)return;const $e=st.getSnapshot().blocks.length;$e-Nw.current<4||(Nw.current=$e,We.recapSession().then(wt=>{wt.recap&&st.dispatch([{type:"status",text:`※ ${le("recap.label")}: ${wt.recap}`,source:"recap"}])},wt=>{console.error("[auto-recap] failed:",wt)}))}return document.addEventListener("visibilitychange",te),()=>document.removeEventListener("visibilitychange",te)},[ne.sessionId,We,st,le]);const oT=f.useCallback(()=>{const R=_4(ql)?uy.indexOf(ql):-1,H=uy[(R+1)%uy.length];Th(H)},[ql,Th]),Eb=f.useCallback((R,H)=>{uo()&&(od(R)||We.getContextUsage({detail:H}).then(te=>{st.dispatch([{type:"status",text:z$e(te)}]),Da("smooth")}).catch(te=>{dn(te,"Failed to load context usage")}))},[od,st,uo,We,dn,Da]),Qae=f.useCallback(()=>{Eb("/context detail",!0)},[Eb]),jw=f.useCallback(R=>{uo()&&We.branchSession(R||void 0).then(H=>{st.dispatch([{type:"status",text:le("branch.success",{name:H.displayName})}])}).catch(H=>{dn(H,le("branch.failed"))})},[dn,uo,We,st,le]),Jae=f.useCallback(()=>{jw()},[jw]),Ab=f.useRef(0),Mw=f.useCallback(R=>{const H=++Ab.current;return window.setTimeout(()=>{var te;H!==Ab.current||Nn.current||R!==void 0&&Us.current.sessionId!==R||(te=Vr.current)==null||te.focus()},0),H},[]),Vl=f.useCallback(async(R,H)=>{const te=Ae??R;Ht.current=te,bn(te),x0.current=void 0,Sb(!1),ve(),Ki(),H!=null&&H.keepView||Ci("chat");let fe;try{const $e=We.clearSession();return fe=Mw(),await Promise.all([$e,_m(te)]),_n(void 0),!0}catch($e){return Ab.current===fe&&(Ab.current+=1),dn($e,"Failed to start a new chat"),!1}},[ve,Ki,Ae,dn,_m,Mw,We]);f.useEffect(()=>()=>{Wc.current&&clearTimeout(Wc.current)},[]);const Zae=f.useCallback(R=>{fw.current=R,Wc.current&&clearTimeout(Wc.current),Wc.current=setTimeout(()=>{bb(R),Wc.current=null},120)},[]),{suggestion:Nb,dismiss:GR,suppress:KR}=pkt({enabled:((bD=ne.capabilities)==null?void 0:bD.features.includes("session_generation"))===!0,inputText:BC,messages:Jn,sessionId:ne.sessionId,contextUsageRatio:(ne.contextWindow??0)>0?(ne.tokenCount??0)/(ne.contextWindow??0):0,isRunning:ar!=="idle",dialogOpen:Yc||Yt,generateContent:We.generateSessionContent}),Iw=f.useCallback(R=>{const H=Kc.current;if(!H||R!==void 0&&H.token!==R)return;const te=Us.current.sessionId;if(H.sourceSessionId!==void 0&&te!==void 0&&te!==H.sourceSessionId){Kc.current=null,bh(!1);return}H.sessionClearCompleted&&te===void 0&&(H.submitScheduled||(Kc.current={...H,submitScheduled:!0},window.setTimeout(()=>{var $e,wt;const fe=Kc.current;if(!(!fe||fe.token!==H.token)){if(Us.current.sessionId!==void 0){Kc.current=null,bh(!1);return}Kc.current=null,($e=Vr.current)==null||$e.submit(),(wt=Vr.current)==null||wt.focus(),bh(!1)}},0)))},[]);f.useEffect(()=>{Iw()},[ne.sessionId,Iw]);const ele=f.useCallback(()=>{const R=fw.current.trim();if(!R||gh)return;if((Nb==null?void 0:Nb.classifiedInput)!==R){GR();return}KR(),bh(!0);const H=NR.current+1;NR.current=H,Kc.current={token:H,sourceSessionId:Us.current.sessionId,sessionClearCompleted:!1,submitScheduled:!1},Vl().then(te=>{const fe=Kc.current;if(!te||(fe==null?void 0:fe.token)!==H){(fe==null?void 0:fe.token)===H&&(Kc.current=null),bh(!1);return}Kc.current={...fe,sessionClearCompleted:!0},e==null||e(void 0),Iw(H)})},[Vl,GR,Iw,gh,Nb,e,KR]),YR=f.useMemo(()=>({openSplitView:()=>{ve(),mR()},openSessionOverview:()=>{ve(),Pa("sessions")},openSessionDrawer:fR,createNewSession:()=>Vl()}),[ve,Vl,Pa,fR,mR]);f.useEffect(()=>{uU(ee,YR)},[YR,ee]),f.useEffect(()=>()=>{uU(ee,null)},[ee]);const tle=f.useCallback(async()=>{if(!Vc.current){Vc.current=!0,Zu(!0);try{await Vl()&&(e==null||e(void 0))}finally{Vc.current=!1,Zu(!1)}}},[Vl,e]),Mm=f.useCallback(async(R,H)=>{Ab.current+=1,_t(R),x0.current=void 0,Sb(!1),_n(void 0),ve(),Ki();try{await We.loadSession(R,{workspaceCwd:H})}catch(te){throw _t(fe=>fe===R?null:fe),te}},[ve,Ki,We]),aT=f.useCallback(R=>{Ci("chat"),Mm(R).catch(H=>{dn(H,"Failed to open session")})},[Mm,dn]);f.useEffect(()=>{const R=H=>{const te=H.detail;typeof te=="string"&&te&&aT(te)};return window.addEventListener("qwen:open-session",R),()=>window.removeEventListener("qwen:open-session",R)},[aT]),f.useEffect(()=>{In!==null&&ne.sessionId===In&&!ne.loadingTranscript&&!ne.catchingUp&&(_t(null),Mw(In))},[ne.catchingUp,ne.loadingTranscript,ne.sessionId,Mw,In]);const Im=f.useRef(null),lT=f.useCallback(R=>{const H=Im.current;H&&H.sessionId===R&&(clearTimeout(H.timer),Im.current=null)},[]),Rw=f.useCallback(R=>new Promise((H,te)=>{let fe=!1;fa(R,void 0,{onAdmitted:()=>{fe||(fe=!0,H())}}).then(()=>{fe||te(new Error("Run was cancelled before it started"))},wt=>{fe||te(wt)})}),[fa]),Dw=f.useCallback(()=>{const R=Im.current,H=Us.current;!R||H.sessionId!==R.sessionId||H.loadingTranscript||H.catchingUp||(clearTimeout(R.timer),Im.current=null,Rw(R.prompt).then(()=>R.resolve(),te=>R.reject(te)))},[Rw]),nle=f.useCallback((R,H)=>{if(Ci("chat"),!H)return Rw(R);const te=Im.current;return te&&(clearTimeout(te.timer),Im.current=null,te.reject(new Error("superseded by another run"))),new Promise((fe,$e)=>{const wt=setTimeout(()=>{lT(H),$e(new Error("Timed out switching to the task session"))},ykt);Im.current={sessionId:H,prompt:R,resolve:fe,reject:$e,timer:wt},Mm(H).then(()=>Dw()).catch(On=>{lT(H),$e(On)})})},[Rw,Mm,lT,Dw]);f.useEffect(()=>{Dw()},[ne.sessionId,ne.loadingTranscript,ne.catchingUp,Dw]);const cT=f.useCallback(()=>{uo()&&We.getTasks().then(R=>{ww({snapshot:R})}).catch(R=>{dn(R,"Failed to load tasks")})},[dn,uo,We]),XR=f.useCallback((R,H)=>{Ju({condition:R,setAt:H}),st.dispatch([{type:"status",text:lH({kind:"set",condition:R,setAt:H})}])},[st]),QR=f.useCallback(R=>{R&&(st.dispatch([{type:"status",text:lH({kind:"cleared",condition:R.condition,durationMs:Date.now()-R.setAt})}]),Ju(null))},[st]),Lw=f.useCallback(R=>uo()?(st.appendLocalUserMessage(R),We.clearGoal().catch(H=>{dn(H,"Failed to clear /goal")}),!0):!1,[dn,uo,We,st]),sle=f.useCallback(()=>We.getRewindSnapshots(),[We]),rle=f.useCallback(R=>We.rewindSession(R,{rewindFiles:!1}).then(()=>{}),[We]),ile=f.useCallback(R=>{if(q0(R))return;const H=R instanceof Error?R.message:String(R);cn("error",le("rewind.failed",{reason:H}))},[cn,le]),JR=f.useCallback((R,H,te)=>{const fe=N9(R),$e=(te==null?void 0:te.sendToDaemon)??!0,wt=()=>{const On=!!id.current,Jt=!Us.current.sessionId||On;return fa(R,H,{clearComposerOnPromptStart:Jt,commitComposerAccepted:On?te==null?void 0:te.commitComposerAccepted:void 0}).catch(qt=>{dn(qt,"Failed to send /goal command")}),!Jt};return fe&&iR(fe)?$e?Lw(R):(st.appendLocalUserMessage(R),QR(mb.current),!0):fe?$e?wt():(st.appendLocalUserMessage(R),XR(fe,Date.now()),!0):(g0(),!0)},[QR,XR,Lw,g0,dn,fa,st,Us]),jb=f.useMemo(()=>new Set((m??[]).map(I8).filter(Boolean)),[m]),ole=jb.has("settings"),ZR=f.useCallback((R,H,te,fe)=>{var On;if(woe(R,IR.current,dn))return!0;if(Us.current.loadingTranscript)return cn("warning",le("editor.sessionLoading")),!1;if(xoe({connectionStatus:Us.current.status,hasSession:!!Us.current.sessionId,restartSseOnPrompt:!!je}))return cn("warning",le("editor.connectionDisconnected")),!1;const $e=ed.current!=="idle",wt=(Jt,qt,ft,yt)=>{const ms=!!id.current,us=!Us.current.sessionId||ms;return fa(Jt,qt,{...yt,clearComposerOnPromptStart:us,commitComposerAccepted:ms?te:void 0}).catch(Fr=>dn(Fr,ft)),!us};if(R.startsWith("/")){const Jt=R.match(voe);if(Jt){const qt=Jt[1];if(jb.has(I8(qt)))return $e?jm(R,H,void 0,te,fe==null?void 0:fe.inputAnnotations):wt(R,H,"Failed to send hidden slash command",{inputAnnotations:fe==null?void 0:fe.inputAnnotations});if(qt==="help")return $s(!0),!0;if(qt==="diff")return Nm?(vb({workspaceCwd:Nm,view:"diff"}),!0):(cn("info",le("localCommand.diffNoWorkspace")),!0);if(qt==="log")return Nm?(vb({workspaceCwd:Nm,view:"log"}),!0):(cn("info",le("localCommand.logNoWorkspace")),!0);if(qt==="tasks")return cT(),!0;if(qt==="goal")return N9(R)?$e?Lgt(R)?Lw(R):Xc():JR(R,H,{commitComposerAccepted:te}):(g0(),!0);if(qt==="theme"){const ft=R.slice(Jt[0].length).trim().toLowerCase();return ft==="dark"||ft==="light"?Tb(ft):ft?cn("error",le("error.unsupportedTheme")):$C(!0),!0}if(qt==="language"){const ft=R.slice(Jt[0].length).trim(),[yt,ms]=ft.split(/\s+/);if(!ft)return st.dispatch([{type:"status",text:[le("language.current",{language:nj(Se)}),le("language.usage"),le("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;if((yt==null?void 0:yt.toLowerCase())==="ui"){if(!ms)return st.dispatch([{type:"status",text:[le("language.set"),"",le("language.usage"),"",le("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;const us=ms.toLowerCase();if(!["en","zh","zh-cn","zh_cn"].includes(us))return cn("error",le("language.invalid")),!0;const ei=Dd(ms);if(v0(ei),!$e){const ll=!!id.current,Qc=!Us.current.sessionId||ll;return fa(`/language ui ${ei}`,void 0,{clearComposerOnPromptStart:Qc,commitComposerAccepted:ll?te:void 0}).then(()=>We.refreshCommands()).catch(Gl=>{dn(Gl,"Failed to sync /language command")}),!Qc}return!0}}if(qt==="copy"){const ft=R.slice(Jt[0].length).trim();return Uwt(Wi.current,ft).then(yt=>{st.dispatch([{type:yt.status==="error"?"error":"status",text:Ukt(yt.message,le)}])}).catch(yt=>{dn(yt,le("copy.failedFallback"))}),!0}if(qt==="delete")return nd(!0),!0;if(qt==="release")return Wr(!0),!0;if(qt==="rewind")return uo()?(Wo(!0),!0):!1;if(qt==="branch"){if($e)return Xc();const ft=R.slice(Jt[0].length).trim();return jw(ft||void 0),!0}if(qt==="fork"){if($e)return Xc();if(!uo())return!1;const ft=R.slice(Jt[0].length).trim();return ft?(We.forkSession(ft).then(yt=>{if(!yt.launched){cn("warning",le("fork.notStarted"));return}ub(ms=>ms+1),cn("success",le("fork.started",{name:yt.description}))}).catch(yt=>{const ms=yt instanceof Error?yt.message:String(yt);dn(yt,le("fork.failed",{reason:ms}))}),!0):(cn("error",le("fork.empty")),!0)}if(qt==="auth")return GC(!0),!0;if(qt==="model"){const ft=R.slice(Jt[0].length).trim();if(ft==="--fast")return La("fast"),!0;if(ft.startsWith("--fast "))return $e?jm(R,H,void 0,te,fe==null?void 0:fe.inputAnnotations):wt(R,H,"Failed to send /model --fast",{inputAnnotations:fe==null?void 0:fe.inputAnnotations});if(ft==="--voice")return od(R,H)||Ge.loadProviders().then(yt=>{ht(MH(yt)),La("voice")}).catch(yt=>dn(yt,le("model.setVoice"))),!0;if(ft.startsWith("--voice ")){const yt=ft.replace(/^--voice\s+/,"");return Ul("workspace","voiceModel",yt).catch(ms=>dn(ms,le("model.setVoice"))),!0}if(ft==="--vision")return La("vision"),!0;if(ft.startsWith("--vision ")){const yt=ft.replace(/^--vision\s+/,"");return Ul("workspace","visionModel",yt).catch(ms=>dn(ms,le("model.setVision"))),!0}if(ft){if(!Us.current.sessionId)return y0(ft),!0;We.setModel(ft).then(()=>{y0(ft)}).catch(yt=>{dn(yt,le("model.switch"))})}else La("main");return!0}if(qt==="plan"){if($e)return Xc();const ft=R.slice(Jt[0].length).trim();return Us.current.sessionId?(ft&&Am(!0),We.setApprovalMode("plan").then(()=>{if(kb("plan"),ft)return fa(ft,H,{clearComposerOnPromptStart:!0,inputAnnotations:fe==null?void 0:fe.inputAnnotations}).catch(yt=>dn(yt,"Failed to send plan prompt"))}).catch(yt=>{dn(yt,le("mode.plan"))}).finally(()=>{ft&&Am(!1)}),!ft):(kb("plan"),ft?wt(ft,H,"Failed to send plan prompt",{inputAnnotations:fe==null?void 0:fe.inputAnnotations}):!0)}if(qt==="approval-mode"){const ft=R.slice(Jt[0].length).trim();return ft?Th(ft):Ln(!0),!0}if(qt==="mcp"){const ft=R.slice(Jt[0].length).trim().toLowerCase();return Ge.loadMcpStatus().then(yt=>{HC({status:yt,toolsByServer:{},resourcesByServer:{},showDescriptions:ft==="desc",showSchema:ft==="schema",showTips:!ft}),Pa("mcp")}).catch(yt=>{dn(yt,"Failed to load MCP status")}),!0}if(qt==="skills"){const ft=R.slice(Jt[0].length).trim();if(!ft||ft==="detail"||ft==="details")Pa("skills");else return $e?jm(R,H,void 0,te,fe==null?void 0:fe.inputAnnotations):wt(R,H,"Failed to send /skills command",{inputAnnotations:fe==null?void 0:fe.inputAnnotations});return!0}if(qt==="tools"){const ft=R.slice(Jt[0].length).trim().toLowerCase();if(ft==="desc"||ft==="descriptions")dR(!0);else{if(od(R,H))return!0;Ge.loadToolsStatus().then(yt=>{const ms=(yt==null?void 0:yt.tools)??[];if(ms.length===0)st.dispatch([{type:"status",text:le("tools.none")}]);else{const us=ms.map(Fr=>`- ${Fr.displayName||Fr.name}`).join(`
`);st.dispatch([{type:"status",text:`${le("tools.available")}

${us}`}])}Da("smooth")}).catch(yt=>{dn(yt,"Failed to load tools")})}return!0}if(qt==="settings")return Pa("settings"),!0;if(qt==="schedule")return qC(),!0;if(qt==="context"){const ft=R.slice(Jt[0].length).trim().toLowerCase();if(ft===""||ft==="detail"||ft==="-d")return Eb(R,ft==="detail"||ft==="-d"),!0}if(qt==="memory"){const ft=R.slice(Jt[0].length).trim().toLowerCase();if(ft==="refresh")Tae(yt=>yt+1);else if(ft==="add"||ft.startsWith("add ")){const yt=ft.slice(3).trim();Iae(yt==="user"||yt==="global"?"global":"workspace"),Aae(ms=>ms+1)}return wR(!0),!0}if(qt==="agents"){const ft=R.slice(Jt[0].length).trim().toLowerCase();let yt="menu";return ft==="create"?yt="create":ft==="create user"||ft==="create global"?yt="create-user":ft==="create project"||ft==="create workspace"?yt="create-project":ft==="manage"&&(yt="manage"),KC(yt),!0}if(qt==="extensions"){const ft=R.slice(Jt[0].length).trim(),yt=(On=ft.split(/\s+/)[0])==null?void 0:On.toLowerCase();if(!yt||yt==="manage")return Pa("extensions"),!0;if(yt==="install"){if($e)return Xc();const ms=ft.slice(7).trim().split(/\s+/);let us="",Fr,ei,ll,Qc,Gl=null;for(let Kl=0;Kl<ms.length;Kl++){const ma=ms[Kl];if(ma)if(ma==="--auto-update")ll=!0;else if(ma==="--pre-release"||ma==="--allow-pre-release")Qc=!0;else if(ma==="--ref"||ma==="--registry"){const Rm=ms[Kl+1];if(!Rm||Rm.startsWith("--")){Gl=le("extensions.install.missingOptionValue",{option:ma});break}ma==="--ref"?Fr=Rm:ei=Rm,Kl+=1}else if(ma.startsWith("--")){Gl=le("extensions.install.unknownOption",{option:ma});break}else if(!us)us=ma;else{Gl=le("extensions.install.usage");break}}if(Gl)return st.appendLocalUserMessage(R),st.dispatch([{type:"error",text:Gl}]),!0;if(!us)return st.appendLocalUserMessage(R),st.dispatch([{type:"error",text:le("extensions.install.usage")}]),!0;const Jc=Us.current.clientId;return Jc?(st.appendLocalUserMessage(R),st.dispatch([{type:"status",text:le("extensions.install.started",{source:us})}]),Ge.installExtension({source:us,...Fr?{ref:Fr}:{},...ei?{registry:ei}:{},...ll!==void 0?{autoUpdate:ll}:{},...Qc!==void 0?{allowPreRelease:Qc}:{},consent:!0},Jc).then(()=>{}).catch(Kl=>{dn(Kl,le("extensions.install.requestFailed"))}),!0):(cn("warning",le("extensions.install.waitForSession")),!0)}return od(R,H)||st.dispatch([{type:"error",text:le("extensions.install.usage")}]),!0}if(qt==="clear"||qt==="new"||qt==="reset")return Vl(),!0;if(qt==="rename"){const ft=zkt(R.slice(Jt[0].length));if(ft.type==="auto"||ft.type==="delegate")return $e?jm(R,H,void 0,te,fe==null?void 0:fe.inputAnnotations):wt(R,H,"Failed to send /rename command",{inputAnnotations:fe==null?void 0:fe.inputAnnotations});const yt=ft.displayName;return yt?uo()?(We.renameSession(yt).then(()=>{st.dispatch([{type:"status",text:le("rename.success",{name:yt})}])}).catch(ms=>{dn(ms,"Failed to rename session")}),!0):!1:(cn("error",le("rename.empty")),!0)}if(qt==="resume"){const ft=R.slice(Jt[0].length).trim();return ft?(ve(),Ki(),We.loadSession(ft).catch(yt=>{dn(yt,"Failed to load session")})):(ve(),Zs(!0)),!0}if(qt==="recap")return PR(),!0;if(qt==="btw")return OR(R.slice(Jt[0].length)),!0;if(qt==="stats"){const ft=R.slice(Jt[0].length).trim().toLowerCase();let yt="overview";return ft==="model"?yt="model":ft==="tools"&&(yt="tools"),uo()?(od(R,H)||We.getStats().then(ms=>{st.dispatch([{type:"status",text:Aze(ms,yt)}]),Da("smooth")}).catch(()=>{}),!0):!1}if(qt==="status"||qt==="about")return od(R,H)||Promise.all([Ge.loadPreflight().catch(()=>null),Ge.loadProviders().catch(()=>null),Ge.loadEnv().catch(()=>null)]).then(([ft,yt,ms])=>{var Rm,kD,_D,SD,CD,TD;const us=nU(ft,ms);let Fr=us.authSource;!Fr&&((Rm=yt==null?void 0:yt.current)!=null&&Rm.authType)&&(Fr=yt.current.authType);const ei=[];us.nodeVersion&&ei.push(`Node.js v${us.nodeVersion}`),us.npmVersion&&ei.push(`npm ${us.npmVersion}`);let ll="";Fr&&(Fr.startsWith("oauth")||Fr==="qwen-oauth"?ll="Qwen OAuth":ll=`API Key - ${Fr}`);const Qc=`${us.platform} ${us.arch}`.trim(),Gl=kw.current,Jc=Us.current,ma={cliVersion:((kD=Jc.capabilities)==null?void 0:kD.qwenCodeVersion)||"",runtime:ei.join(" / "),platform:Qc,auth:ll,baseUrl:((_D=yt==null?void 0:yt.current)==null?void 0:_D.baseUrl)||"",model:Gl||Jc.currentModel||((SD=yt==null?void 0:yt.current)==null?void 0:SD.modelId)||"",fastModel:((CD=yt==null?void 0:yt.current)==null?void 0:CD.fastModelId)||Gl||Jc.currentModel||((TD=yt==null?void 0:yt.current)==null?void 0:TD.modelId)||"",sessionId:Jc.sessionId||"",sandbox:us.sandbox,proxy:us.proxy,memoryUsage:us.memoryUsage};st.dispatch([{type:"status",text:Vze(ma)}]),Da("smooth")}),!0;if(qt==="bug"){const ft=R.slice(Jt[0].length).trim();return od(R,H)||Promise.all([Ge.loadPreflight().catch(()=>null),Ge.loadEnv().catch(()=>null)]).then(([yt,ms])=>{var ll;const us=nU(yt,ms),Fr=((ll=Us.current.capabilities)==null?void 0:ll.qwenCodeVersion)||"",ei={};if(Fr&&(ei.cliVersion=Fr),us.nodeVersion&&(ei.nodeVersion=us.nodeVersion),us.npmVersion&&(ei.npmVersion=us.npmVersion),us.platform&&(ei.platform=us.platform),us.arch&&(ei.arch=us.arch),us.sandbox&&(ei.sandbox=us.sandbox),us.memoryUsage&&(ei.memoryUsage=us.memoryUsage),sT.current)sT.current({title:ft,systemInfo:ei}),st.dispatch([{type:"status",text:le("bug.submitted")}]);else{const Qc=Object.entries(ei).filter(([,Kl])=>Kl).map(([Kl,ma])=>`${Kl}: ${ma}`).join(`
`),Gl=`https://github.com/QwenLM/qwen-code/issues/new?template=bug_report.yml&title=${encodeURIComponent(ft)}&info=${encodeURIComponent(`
`+Qc+`
`)}`,Jc=window.open(Gl,"_blank");Jc?(Jc.opener=null,st.dispatch([{type:"status",text:le("bug.submitted")}])):cn("error",le("bug.popupBlocked"))}}).catch(yt=>{dn(yt,le("bug.failed"))}),!0}}return $e?jm(R,H,void 0,te,fe==null?void 0:fe.inputAnnotations):wt(R,H,"Failed to send command",{inputAnnotations:fe==null?void 0:fe.inputAnnotations})}else if(R.startsWith("!")){if($e)return cn("error",le("queue.shellBlocked")),!1;const Jt=R.slice(1).trim();return!Jt||!uo()?!1:(We.sendShellCommand(Jt).catch(qt=>{dn(qt,"Failed to execute shell command")}),!0)}else return $e?jm(R,H,void 0,te,fe==null?void 0:fe.inputAnnotations):wt(R,H,"Failed to send message",{inputAnnotations:fe==null?void 0:fe.inputAnnotations})},[fa,We,st,jm,od,jw,ve,Ki,Pa,qC,g0,Vl,Nm,Lw,JR,Tb,Th,v0,Xc,cT,jb,cn,dn,PR,OR,uo,je,Da,Se,y0,kb,Ul,Eb,le,Ge]),ale=f.useCallback((R,H,te,fe)=>{const $e=ZR(R,H,te,fe);return $e!==!1&&Da("smooth"),$e},[ZR,Da]),eD=f.useCallback((R,H,te)=>{We.submitPermission(R,H,te).catch(fe=>{dn(fe,"Failed to submit permission choice")})},[We,dn]),uT=f.useCallback(()=>{We.cancel().catch(R=>{dn(R,"Failed to cancel request")})},[We,dn]),lle=f.useCallback(()=>{var R;return Yc?!1:((R=uw.current)==null?void 0:R.focusTaskPill())??!1},[Yc]),cle=f.useCallback(R=>{var H,te;if(R){(H=Vr.current)==null||H.insertText(R);return}(te=Vr.current)==null||te.focus()},[]),ule=f.useCallback(R=>{fb(R)},[]),dT=f.useCallback(()=>{f0.current&&Hl&&ed.current==="idle"&&yh.current&&td.current?(xh.current=yh.current,km(!1),fa(td.current,wm.current,{optimisticUserMessage:!1,retry:!0}).catch(R=>dn(R,"Failed to retry prompt"))):st.dispatch([{type:"status",text:le("retry.none")}])},[Hl,fa,dn,st,le]);f.useEffect(()=>{const R=H=>{if(!Yc&&H.ctrlKey&&!H.metaKey&&!H.altKey&&!H.shiftKey){if(H.key==="l"){H.preventDefault(),HR();return}if(H.key==="o"){H.preventDefault(),qR();return}if(H.key==="y"){H.preventDefault(),dT();return}}};return window.addEventListener("keydown",R,!0),()=>window.removeEventListener("keydown",R,!0)},[Yc,HR,qR,dT,st,le]);const Eh=f.useCallback(()=>{vw.current=null,CR(!1),TR(!1),b0.current&&(clearTimeout(b0.current),b0.current=null)},[]),tD=f.useRef({streamingState:ar,pendingApproval:Nr,interactionBlocked:Yc,activePanel:fs,closePanel:Ki,handleCancel:uT,handleCycleMode:oT});tD.current={streamingState:ar,pendingApproval:Nr,interactionBlocked:Yc,activePanel:fs,closePanel:Ki,handleCancel:uT,handleCycleMode:oT};const dle=ar!=="idle";f.useEffect(()=>{Eh()},[dle,Eh]),f.useEffect(()=>{const te=($e,wt)=>{vw.current=$e,$e==="cancel"?TR(!0):CR(!0),b0.current&&clearTimeout(b0.current),b0.current=setTimeout(Eh,wt)},fe=$e=>{var Jt,qt;if($e.defaultPrevented||$e.isComposing)return;const wt=tD.current;if($e.key==="Escape"&&wt.activePanel){const ft=$e.target;ft!=null&&ft.closest("[data-sidebar-shell]")||($e.preventDefault(),wt.closePanel());return}if($e.key!=="Escape"){vw.current!==null&&Eh(),$e.key==="Tab"&&$e.shiftKey&&!wt.interactionBlocked&&($e.preventDefault(),wt.handleCycleMode());return}const On=Xwt({blocked:!!wt.pendingApproval||wt.interactionBlocked,streaming:wt.streamingState!=="idle",hasInput:!!((Jt=Vr.current)!=null&&Jt.hasInput()),armed:vw.current});if(On.kind!=="ignore")switch($e.preventDefault(),On.kind){case"cancel":wt.handleCancel(),Eh();break;case"clear":(qt=Vr.current)==null||qt.clear(),Eh();break;case"arm":te(On.action,On.action==="cancel"?2e3:500);break}};return window.addEventListener("keydown",fe),()=>{window.removeEventListener("keydown",fe),Eh()}},[Eh]);const nD=Cut({catchingUp:!!ne.catchingUp,pendingApproval:Nr!==null,isPreparingPrompt:ZC}),sD={catchingUp:!!ne.catchingUp,isPreparingPrompt:ZC,isStreaming:ar!=="idle"},hle=yoe(sD),Pw=X==null?void 0:X[hle],fle=Pw!=null&&Pw.trim()?Pw:le(Tut(sD)),Mb=f.useCallback(R=>{if(!Us.current.sessionId){y0(R);return}Tw(!0),We.setModel(R).then(H=>{const te=Okt(H);y0((te==null?void 0:te.modelId)??R),te&&st.dispatch({type:"debug",text:Bkt(te,le),source:"model_switch_summary",data:te})}).catch(H=>{dn(H,le("model.switch"))}).finally(()=>Tw(!1))},[We,st,dn,le,y0]),mle=f.useCallback(R=>{Tw(!0),Ge.deleteModel(R).then(H=>{H!=null&&H.requiresRestart&&st.dispatch([{type:"status",text:le("settings.requiresRestart")}]),Cw().catch(te=>{console.warn("[web-shell] failed to reload providers after delete",te)}),Ch().catch(te=>{console.warn("[web-shell] failed to reload settings after delete",te)})}).catch(H=>{dn(H,le("settings.models.deleteFailed"))}).finally(()=>Tw(!1))},[Ge,Cw,Ch,dn,st,le]),rD=f.useCallback(()=>{GC(!1),Cw().catch(R=>{console.warn("[web-shell] failed to reload providers after auth dialog close",R)})},[Cw]),ple=f.useCallback(R=>{Ce(!1),Ul(Vo,"modelFallbacks",R.join(",")).then(H=>{H!=null&&H.requiresRestart&&st.dispatch([{type:"status",text:le("settings.requiresRestart")}]),Ch().catch(te=>{console.warn("[web-shell] failed to reload settings after fallbacks save",te)})}).catch(H=>dn(H,le("settings.models.fallbacks.saveFailed")))},[Vo,Ul,Ch,dn,st,le]),gle=f.useCallback(R=>{if(ar!=="idle"){Xc();return}Ki(),fa(`/model --fast ${R}${Vo==="user"?" --global":" --project"}`).then(()=>{Ch().catch(te=>{console.warn("[web-shell] failed to reload workspace settings after fast-model switch",te)})}).catch(te=>{dn(te,"Failed to switch fast model")})},[Xc,Ki,fa,ar,dn,Ch,Vo]),ble=f.useCallback(R=>{const H=sU(R);Ul(Vo,"voiceModel",H).catch(te=>dn(te,le("model.setVoice")))},[Vo,dn,Ul,le]),yle=f.useCallback(R=>{const H=Qwt(R);Ul(Vo,"visionModel",H).catch(te=>dn(te,le("model.setVision")))},[Vo,dn,Ul,le]),xle={main:Mb,fast:gle,voice:ble,vision:yle};f.useEffect(()=>{!bi&&!G&&!Tm&&wh("workspace")},[bi,G,Tm]);const iD=f.useMemo(()=>{const R=new Set((ne.skills??[]).map(fe=>fe.toLowerCase())),H=m0?(ne.commands??[]).filter(fe=>fe.source!=="skill"&&!R.has(fe.name.toLowerCase())):ne.commands??[],te=m0?vh.map(fe=>({name:fe.name,description:fe.description,...fe.argumentHint?{argumentHint:fe.argumentHint}:{},source:"skill",displayCategory:"skill"})):[];return Soe(Coe(H,te,koe(le)),le).filter(fe=>!jb.has(I8(fe.name))).map(fe=>{const $e=_oe(fe.name);return $e?{...fe,displayCategory:"skill",description:le($e)}:fe})},[ne.commands,ne.skills,jb,vh,m0,le]),Ib=f.useMemo(()=>{var R;return{version:((R=ne.capabilities)==null?void 0:R.qwenCodeVersion)||"",cwd:ne.workspaceCwd||"",currentModel:_h,currentMode:ql,hideTips:(k0==null?void 0:k0.values.effective)===!0}},[(yD=ne.capabilities)==null?void 0:yD.qwenCodeVersion,ne.workspaceCwd,_h,ql,k0==null?void 0:k0.values.effective]),oD=!!((xD=It.find(R=>R.cwd===Qn))!=null&&xD.trusted&&(Rn!=null&&Rn.branch)),aD=f.useRef(null),lD=f.useRef(null),Rb=f.useRef(null),cD=f.useCallback(()=>{x0.current={},Sb(!0),Rb.current="cancel"},[]),uD=f.useCallback(()=>{x0.current=void 0,Sb(!1),Rb.current="toggle"},[]);f.useEffect(()=>{var H,te;if(!Rb.current)return;const R=Rb.current;Rb.current=null,R==="cancel"?(H=lD.current)==null||H.focus():(te=aD.current)==null||te.focus()},[tT]);const vle=f.useMemo(()=>l.jsxs(l.Fragment,{children:[w?w(Ib):l.jsx(att,{...Ib}),tT?l.jsxs("div",{className:xt.worktreeWelcomeBadge,children:[l.jsx("span",{className:xt.worktreeBadgeIcon,children:l.jsx(tS,{size:18,strokeWidth:1.8})}),l.jsxs("span",{className:xt.worktreeBadgeText,children:[l.jsx("span",{className:xt.worktreeWelcomeTitle,children:le("worktree.welcomeTitle")}),l.jsx("span",{className:xt.worktreeWelcomeDesc,children:le("worktree.welcomeDesc")})]}),l.jsx("button",{ref:lD,type:"button",className:xt.worktreeWelcomeCancel,"aria-label":le("worktree.cancel"),"data-testid":"worktree-welcome-cancel",onClick:uD,children:l.jsx(J4,{size:14,strokeWidth:2})})]}):oD&&l.jsxs("button",{ref:aD,type:"button",className:xt.worktreeWelcomeToggle,"data-testid":"worktree-welcome-toggle",onClick:cD,children:[l.jsx("span",{className:xt.worktreeToggleIcon,children:l.jsx(tS,{size:16,strokeWidth:1.8})}),l.jsxs("span",{className:xt.worktreeToggleText,children:[l.jsx("span",{className:xt.worktreeToggleLabel,children:le("worktree.welcomeTitle")}),l.jsx("span",{className:xt.worktreeToggleHint,children:le("worktree.toggleHint")})]})]})]}),[w,Ib,tT,oD,cD,uD,le]),Ow=f.useMemo(()=>k==null?void 0:k(Ib),[k,Ib]),Wl=!ne.sessionId&&un.length===0&&!ui&&!Nr&&!kr,dD=Wl&&T,Db=dD&&!!Ow,wle=Wl&&Db,hT=Wl&&dD,hD=ne.status!=="connecting"&&!ne.sessionId&&ne.missingSession===!0&&!fs&&Gr==="chat",fT=Wl?y2():Ne,kle=gae(B),fD=[xt.app,xt.appChat,Wl?xt.appChatEmpty:void 0,Le.enabled?xt.appWithSidebar:void 0,Em===qr.Light?xt.themeLight:xt.themeDark,Em===qr.Dark?"dark":void 0,o].filter(Boolean).join(" "),mD=f.useMemo(()=>({...a,...Mkt(fT,B)}),[B,fT,a]),pD=f.useCallback(R=>{tt(R),jkt(R)},[]);return f.useLayoutEffect(()=>{const R=Bl.current;if(!R)return;const H=dw.current,te=d0.current,fe=R.getBoundingClientRect();if(te&&!Wl&&H){const $e=H.top-fe.top;Math.abs($e)>1&&(R.style.transition="width 320ms ease",R.style.transform=`translateY(${$e}px)`,requestAnimationFrame(()=>{R.style.transition="width 320ms ease, transform 280ms ease",R.style.transform=""}),window.setTimeout(()=>{R.style.transition=""},320))}dw.current=fe,d0.current=Wl},[Wl]),f.useLayoutEffect(()=>{const R=document.createElement("div");return R.dataset.webShellPortalRoot="",R.dataset.webShellShadcn="",document.body.appendChild(R),$l(R),()=>{R.remove(),$l(null)}},[]),f.useLayoutEffect(()=>{const R=Li.current;if(!R||!di)return;let H=null;const te=()=>{H=null;const On=getComputedStyle(R),Jt=new Set;di.dataset.webShellShadcn="",di.classList.toggle("dark",Em===qr.Dark),di.lang=Se;for(let qt=0;qt<On.length;qt+=1){const ft=On[qt];ft.startsWith("--")&&(Jt.add(ft),di.style.setProperty(ft,On.getPropertyValue(ft)))}for(const qt of Uc.current)Jt.has(qt)||di.style.removeProperty(qt);Uc.current=Jt},fe=()=>{H===null&&(H=requestAnimationFrame(te))};te();const $e=new MutationObserver(fe);let wt=R;for(;wt;)$e.observe(wt,{attributes:!0,attributeFilter:["class","style","data-theme","lang"]}),wt=wt.parentElement;return window.addEventListener("resize",fe),()=>{$e.disconnect(),window.removeEventListener("resize",fe),H!==null&&cancelAnimationFrame(H)}},[fD,mD,di,Se,Em]),l.jsx(Cge,{value:Em,children:l.jsx(ige,{language:Se,children:l.jsx(fK.Provider,{value:di,children:l.jsxs("div",{ref:Li,className:fD,style:mD,"data-web-shell-root":!0,"data-web-shell-shadcn":!0,lang:Se,children:[!ye&&l.jsx(Let,{toasts:br,onDismiss:hs}),cs&&l.jsx(si,{title:le("resume.title"),size:"lg",onClose:()=>Zs(!1),children:l.jsx(Ett,{workspaceCwd:Ae,onSelect:R=>{ve(),Ki(),We.loadSession(R).catch(H=>{dn(H,"Failed to load session")})},onClose:()=>Zs(!1)})}),bi&&l.jsx(si,{title:le(kkt[bi]),size:"lg",onClose:()=>La(null),children:l.jsx(Ktt,{mode:bi,models:bi==="voice"?nt:void 0,currentModelId:bi==="voice"?Vae:bi==="vision"?Wae:bi==="fast"?Gae:void 0,onSelect:R=>{bi&&xle[bi](R),La(null)}})}),Vn&&l.jsx(si,{title:le("mode.select"),size:"sm",onClose:()=>Ln(!1),children:l.jsx(Ttt,{currentMode:ql,onSelect:R=>{Th(R),Ln(!1)}})}),uR&&l.jsx(si,{title:le("tools.title"),size:"lg",onClose:()=>dR(!1),children:l.jsx(grt,{})}),p0&&l.jsx(Mit,{workspaceCwd:p0.workspaceCwd,initialView:p0.view,onClose:()=>vb(void 0)},`${p0.workspaceCwd}:${p0.view}`),YC&&l.jsx(si,{title:le("tasks.title"),size:"lg",onClose:()=>ww(null),children:l.jsx(oie,{message:YC,embedded:!0,manageActiveEvent:!1,onClose:()=>ww(null)})}),wb&&l.jsx(si,{title:le(wb==="manage"?"agent.manage":wb==="menu"?"agents.title":"agent.create"),size:"lg",onClose:()=>KC(null),children:l.jsx(wst,{mode:wb,embedded:!0,onMessage:R=>st.dispatch([{type:"status",text:R}]),onClose:()=>KC(null)})}),vR&&l.jsx(si,{title:le("memory.menu"),size:"lg",onClose:()=>wR(!1),children:l.jsx(Fst,{refreshSignal:Cae,addSignal:Eae,addScope:Mae,onMessage:(R,H="status")=>{st.dispatch([{type:H,text:R}])}})}),ha&&l.jsx(si,{title:le("help.title"),size:"md",onClose:()=>$s(!1),children:l.jsx(qbt,{commands:iD})}),Go&&l.jsx(si,{title:le("theme.title"),size:"sm",onClose:()=>$C(!1),children:l.jsx(Ubt,{currentTheme:Em,onSelect:Tb,onClose:()=>$C(!1)})}),Tm&&l.jsx(si,{title:le("auth.title"),size:"lg",onClose:rD,children:l.jsx(mrt,{onMessage:(R,H="status")=>{st.dispatch([H==="error"?{type:"error",text:R}:{type:"status",text:R}])},onClose:rD})}),G&&l.jsx(si,{title:le("settings.models.fallbacks.title"),size:"md",onClose:()=>Ce(!1),children:l.jsx(lnt,{models:Yae,current:Kae,max:3,onConfirm:ple,onClose:()=>Ce(!1)})}),da&&l.jsx(si,{title:le("delete.title"),size:"lg",onClose:()=>nd(!1),children:l.jsx(Vbt,{workspaceCwd:Ae,onDeleted:R=>{st.dispatch([{type:"status",text:R.length===1?`${le("delete.deleted")} (${R[0].slice(0,8)})`:le("delete.deletedCount",{count:R.length})}])},onError:R=>{if(q0(R))return;const H=R instanceof Error?R.message:String(R);cn("error",le("delete.failed",{reason:H}))},onClose:()=>nd(!1)})}),kh&&l.jsx(si,{title:le("release.title"),size:"lg",onClose:()=>Wr(!1),children:l.jsx(Wbt,{workspaceCwd:Ae,onReleased:R=>{st.dispatch([{type:"status",text:`${le("release.released")} (${R.slice(0,8)})`}])},onError:R=>{if(q0(R))return;const H=R instanceof Error?R.message:String(R);cn("error",le("release.failed",{reason:H}))},onClose:()=>Wr(!1)})}),Sm&&l.jsx(si,{title:le("rewind.title"),subtitle:le("rewind.subtitle"),size:"lg",onClose:()=>Wo(!1),children:l.jsx(cyt,{blocks:Tn,loadSnapshots:sle,rewind:rle,onError:ile,onClose:()=>Wo(!1)})}),l.jsxs("div",{className:xt.appShell,children:[Le.enabled&&l.jsxs("div",{"data-sidebar-shell":"",...Te?{role:"dialog","aria-modal":"true"}:{},"aria-label":le("sidebar.label"),className:[xt.mobileDrawer,Te?xt.mobileDrawerOpen:void 0,ke?xt.mobileDrawerForced:void 0].filter(Boolean).join(" "),children:[l.jsx("div",{className:xt.mobileBackdrop,onClick:ve,"aria-hidden":"true"}),l.jsx(Ewt,{collapsed:(sn||Gr==="split"&&!me)&&!Te,onCollapsedChange:qe,onOpenSettings:()=>{ve(),Pa("settings")},onOpenPlugins:()=>{ve(),Pa("plugins")},onOpenDaemonStatus:()=>{ve(),Pa("status")},onOpenScheduledTasks:()=>{ve(),qC()},onOpenGoals:()=>{ve(),g0()},onOpenSessions:()=>{ve(),Pa("sessions")},canOpenSessionsOverview:Ke,onOpenSplitView:()=>{ve(),Cm()},canOpenSplitView:Ke,theme:Em,onThemeChange:R=>{Tb(R),Ul("workspace",lp,bK(R))},onNewSession:R=>Vl(R),onLoadSession:(R,H)=>(Ci("chat"),Mm(R,H)),onSelectCurrentSession:()=>{ve(),Ci("chat"),Ki()},onError:dn,mobileOpen:Te,sessionListReloadToken:RR,selectedWorkspaceCwd:dt,onSelectWorkspace:bn,onOpenGitDiff:R=>vb({workspaceCwd:R,view:"diff"}),workspaces:It,lockedWorkspaceCwd:Ae,lockedWorkspace:Le.lockedWorkspace,branding:Le.branding,primaryNav:Le.primaryNav,hideProjectHeader:Le.hideProjectHeader,sessionActions:Le.sessionActions,footer:Le.footer})]}),l.jsxs("div",{ref:or,className:[xt.chatPane,Gr!=="chat"?xt.chatPaneShowingPage:void 0,hT?xt.chatPaneWithMobileComposerBottom:void 0].filter(Boolean).join(" "),children:[Le.enabled&&Le.showCompactToggle&&!fs&&Gr==="chat"&&l.jsx("button",{type:"button",className:[xt.hamburgerButton,Wl?xt.hamburgerButtonFloating:void 0].filter(Boolean).join(" "),onClick:()=>{Pe(!1),at(R=>!R)},"aria-label":le("sidebar.toggleMenu"),"aria-expanded":Te,children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),l.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),l.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),fs&&l.jsxs("section",{className:xt.panelHost,role:"region","data-testid":"inline-panel","aria-label":le(fs==="settings"?"settings.title":fs==="status"?"daemon.title":fs==="extensions"?"extensions.manage.title":fs==="mcp"?"mcp.title":fs==="skills"?"skills.title":fs==="plugins"?"plugins.title":"sessionsOverview.title"),children:[fs!=="extensions"&&fs!=="mcp"&&fs!=="skills"&&fs!=="plugins"&&l.jsxs("div",{className:xt.panelHeader,children:[l.jsx("button",{ref:pR,type:"button",className:xt.panelBack,"data-testid":"panel-back",onClick:Ki,"aria-label":le("common.back"),title:le("common.back"),children:l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{d:"M15 5l-7 7 7 7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),l.jsx("div",{className:xt.panelTitle,children:le(fs==="settings"?"settings.title":fs==="status"?"daemon.title":"sessionsOverview.title")})]}),l.jsx("div",{className:xt.panelBody,children:fs==="settings"?l.jsx(dbt,{settingsState:zR,embedded:!0,onLanguageChange:Xae,onThemeChange:Tb,chatWidthMode:Ne,onChatWidthModeChange:pD,modelManagement:{providers:Sw.providers,currentModelId:ne.currentModel??void 0,loading:Sw.loading,error:Sw.error,busy:Uae,onSelectModel:Mb,onDeleteModel:mle,onAddModel:()=>GC(!0)},onSubDialog:(R,H)=>{R==="fastModel"?(wh(H),La("fast")):R==="visionModel"?(wh(H),La("vision")):R==="voiceModel"?Ge.loadProviders().then(te=>{ht(MH(te)),xb.current===null&&!Ie.current&&!kR.current&&(wh(H),La("voice"))}).catch(te=>dn(te,le("model.setVoice"))):R==="modelFallbacks"?(wh(H),Ce(!0)):R==="tools.approvalMode"&&Ln(!0)}}):fs==="status"?l.jsx(Ult,{}):fs==="extensions"?l.jsx(Qoe,{onClose:Ki,initialFocusRef:gR}):fs==="mcp"&&yw?l.jsx(Zoe,{message:yw,onClose:()=>{HC(null),Ki()}}):fs==="skills"?l.jsx(toe,{onClose:Ki,onUseSkill:hR}):fs==="plugins"?l.jsx(D1t,{mcpMessage:yw,loadMcpMessage:async()=>{try{await vae()}catch(R){throw dn(R,"Failed to load MCP status"),R}},onClose:Ki,onUseSkill:hR,initialFocusRef:bR}):l.jsx(zct,{onOpenSession:aT,onOpenSplit:Cm,includeOtherWorkspaces:!Ae,workspaceCwd:Ae})},fs)]}),Gr==="scheduledTasks"&&l.jsxs("div",{className:xt.fullPage,"data-testid":"scheduled-tasks-page",children:[l.jsxs("div",{className:xt.fullPageHeader,children:[l.jsx("button",{type:"button",className:xt.fullPageBack,onClick:()=>Ci("chat"),"aria-label":le("common.back"),title:le("common.back"),children:l.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:l.jsx("path",{d:"M15 18l-6-6 6-6"})})}),l.jsx("div",{className:xt.fullPageTitle,children:le("scheduledTasks.title")})]}),l.jsx("div",{className:xt.fullPageBody,children:l.jsx(Rgt,{onRunPrompt:nle,workspaces:Ae?Rt:It,lockedWorkspace:De,onCreateViaChat:()=>{Vl().then(R=>{R&&(e==null||e(void 0),window.setTimeout(()=>{var H,te;(H=Vr.current)==null||H.insertText(le("scheduledTasks.chatStarter"),{mode:"replace"}),(te=Vr.current)==null||te.focus()},0))})},onOpenSession:R=>{Ci("chat"),Mm(R).catch(H=>{dn(H,"Failed to open session")})},onError:dn})})]}),Gr==="goals"&&l.jsxs("div",{className:xt.fullPage,"data-testid":"goals-page",children:[l.jsxs("div",{className:xt.fullPageHeader,children:[l.jsx("button",{type:"button",className:xt.fullPageBack,onClick:()=>Ci("chat"),"aria-label":le("common.back"),title:le("common.back"),children:l.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:l.jsx("path",{d:"M15 18l-6-6 6-6"})})}),l.jsx("div",{className:xt.fullPageTitle,children:le("goals.title")})]}),l.jsx("div",{className:xt.fullPageBody,children:l.jsx(g1t,{onCreateGoal:async R=>{const H=_w.current;if(!(H!==void 0&&Us.current.sessionId===H)){if(!await Vl(void 0,{keepView:!0}))return!1;e==null||e(void 0)}try{await fa(`/goal ${R}`,void 0,{clearComposerOnPromptStart:!0})}catch(fe){throw _w.current=Us.current.sessionId,fe}_w.current=void 0,Ci("chat")},onOpenSession:R=>{Ci("chat"),Mm(R).catch(H=>{dn(H,"Failed to open session")})},onError:dn})})]}),Gr==="split"&&l.jsxs("div",{className:xt.fullPage,"data-testid":"split-view-page",children:[Yt&&l.jsxs("div",{className:xt.splitApprovalNotice,role:"status","data-testid":"split-approval-notice",children:[l.jsx("span",{children:le("splitView.outerApprovalPending")}),l.jsx("button",{type:"button",onClick:()=>Ci("chat"),children:le("splitView.goToApproval")})]}),l.jsx(UP,{value:Mt,children:l.jsx(Kp.Provider,{value:Ew,children:l.jsx(dmt,{sessionIds:sd,onPanesChange:wae,sessionListReloadToken:RR,includeOtherWorkspaces:!Ae,workspaceCwd:Ae,onExit:kae,onError:dn,onSlashCommand:g,onRightPanelOpen:Ss,onPaneArtifactsChange:qs,messageTurnOutputs:j,restartSseOnPrompt:je})})})]}),l.jsxs("div",{className:[xt.chatViewWrap,hT?xt.chatViewWithMobileComposerBottom:void 0,wle?xt.chatViewWithWelcomeMiddle:void 0,fs||Gr!=="chat"?xt.chatViewHidden:void 0].filter(Boolean).join(" "),"aria-hidden":fs||Gr!=="chat"?!0:void 0,children:[hD&&l.jsxs("div",{className:xt.missingSessionState,children:[l.jsx("div",{className:xt.missingSessionMessage,children:le("session.missing")}),l.jsx("button",{type:"button",className:xt.missingSessionButton,disabled:LC,onClick:tle,children:le("session.new")})]}),l.jsx("div",{className:hD?xt.chatSubtreeHidden:xt.chatSubtree,children:l.jsxs(UP,{value:Mt,children:[l.jsx(Kp.Provider,{value:Ew,children:l.jsx(gkt,{timeline:pn,details:ls,children:l.jsx(yQ.Provider,{value:jae,children:(()=>{var fe;const R=[xt.content,ui||un.length>0||Nr?xt.contentHasMessages:void 0].filter(Boolean).join(" "),H=l.jsx(Lie,{ref:db,messages:un,pendingApproval:Je,onShowContextDetail:Qae,loadingTranscript:ne.loadingTranscript,catchingUp:ne.catchingUp,hasOlderHistory:gt.hasMore,loadingOlderHistory:gt.loading,historyCapacityReached:gt.capacityReached,onLoadOlderHistory:gt.loadMore,isResponding:ar!=="idle",activeTurnStartedAt:pw,workspaceCwd:ne.workspaceCwd||"",hideSessionTimeline:fT==="wide",showRetryHint:h0,onRetryClick:dT,onBranchSession:Jae,bottomOverlayInset:zr,welcomeHeader:Wl?vle:void 0,centerWelcomeHeader:Db||void 0,tailContent:void 0,tailKey:void 0,onCanScrollToBottomChange:ule,virtualScrollThreshold:J,turnFileChanges:Re.has("file")?Ps:void 0,turnArtifacts:Re.has("artifact")?mn:void 0,turnScheduledTasks:Re.has("scheduled_task")?ys:void 0,onTurnOutputOpen:Ss,onReviewChanges:Un,onOpenArtifact:At,onOpenScheduledTask:Os,generateContent:(fe=ne.capabilities)!=null&&fe.features.includes("session_generation")?We.generateSessionContent:void 0}),te=!Db&&(kr==null?void 0:kr.role)==="btw"?l.jsx("div",{className:xt.btwPanel,children:l.jsx(vie,{question:kr.question,answer:kr.answer,isPending:kr.isPending})}):null;return Db?l.jsxs("div",{className:xt.mobileWelcomeGroup,children:[l.jsxs("div",{style:Uo,className:R,children:[H,te]}),l.jsx("div",{className:xt.mobileWelcomeFooterMiddle,children:Ow})]}):l.jsxs("div",{style:Uo,className:R,children:[H,te]})})()})})}),l.jsxs("div",{ref:Bl,style:Uo,className:ln?`${xt.footer} ${xt.footerWithCustomFooter}`:xt.footer,children:[DC&&l.jsx("div",{className:Ts?`${xt.scrollToBottomLayer} ${xt.scrollToBottomLayerWithTodos}`:xt.scrollToBottomLayer,children:l.jsx("button",{type:"button",className:xt.scrollToBottomButton,"aria-label":le("chat.scrollToBottom"),onClick:()=>Da("smooth"),children:l.jsx("svg",{className:xt.scrollToBottomIcon,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{d:"M12 5v13M6.5 12.5 12 18l5.5-5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})})}),Ts&&l.jsx("div",{ref:Xu,className:xt.bottomPanels,children:l.jsx(ntt,{todos:ui?Cs:[],statusItems:Kn})}),Je&&Gr==="chat"&&l.jsx("div",{"data-testid":"approval-overlay",className:xt.approvalOverlay,children:l.jsx(Eoe,{request:Je,onConfirm:eD,variant:"floating",keyboardActive:_ae})}),sr&&Gr==="chat"&&l.jsx("div",{"data-testid":"approval-overlay",className:xt.approvalOverlay,children:l.jsx(Aoe,{request:sr,onConfirm:eD,variant:"floating",keyboardActive:Sae})}),l.jsxs("div",{className:xt.composer,children:[ar!=="idle"?l.jsx(Fie,{startedAt:pw}):Nb?l.jsxs("div",{className:xt.composerActionTip,role:"status","data-testid":"new-session-suggestion",children:[l.jsx("span",{className:xt.composerActionTipIcon,"aria-hidden":"true",children:"✦"}),l.jsx("span",{className:xt.composerActionTipText,children:le("editor.newSessionSuggestionTitle")}),l.jsx("div",{className:xt.composerActionTipActions,children:l.jsx("button",{type:"button",className:`${xt.composerActionTipButton} ${xt.composerActionTipButtonPrimary}`,"data-testid":"new-session-suggestion-start",onMouseDown:R=>R.preventDefault(),onClick:ele,children:le("editor.newSessionSuggestionStart")})})]}):Rae&&ar==="idle"?l.jsx("div",{className:xt.escClearStatus,role:"status",children:le("editor.escClearHint")}):null,l.jsx(Toe,{prompts:Oae,t:le,onDelete:$ae,onInsert:zae,onEdit:Fae}),Ft&&l.jsx("div",{className:xt.composerHeader,children:l.jsx(Ft,{disabled:nD,isRunning:ar!=="idle",currentMode:ql,currentModel:_h,sessionName:AR})}),l.jsx(zie,{ref:hw,onSubmit:ale,onInputTextChange:Zae,onCycleMode:oT,onToggleShortcuts:$R,onCancel:uT,isRunning:ar!=="idle",isPreparing:ZC||gh,cancelArmed:Dae,disabled:nD||gh,commands:iD,skills:vh,slashCommandCategoryOrder:p,builtinAtProviders:b,atProviders:v,composerTagIcons:x,queuedMessages:Bae,onFocusFooter:lle,onPopQueuedMessages:Hae,onClearQueuedMessages:qae,currentMode:ql,currentModel:_h,gitBranch:Bn?(Rn==null?void 0:Rn.branch)??Bn.branch:ne.sessionId?ne.gitBranch:(Rn==null?void 0:Rn.branch)??void 0,gitWorktree:!!Bn,gitStatus:Rn,onOpenGitDiff:Nm&&!Bn?()=>vb({workspaceCwd:Nm,view:"diff"}):void 0,chatWidthMode:Ne,showChatWidthToggle:!Wl,chatWidthToggleMin:kle,visibleToolbarActions:se,availableModels:Lae,onSelectMode:Th,onSelectModel:Mb,workspaces:!Ae&&It.length>1?It.map(R=>({id:R.id,cwd:R.cwd,label:NC(R),primary:R.primary})):void 0,selectedWorkspaceCwd:ne.sessionId?(vD=It.find(R=>R.cwd===ne.workspaceCwd))!=null&&vD.primary?void 0:ne.workspaceCwd:dt,workspaceSelectionDisabled:!!ne.sessionId,atWorkspaceCwd:Ae??(ne.sessionId?ne.workspaceCwd:dt??((wD=It.find(R=>R.primary))==null?void 0:wD.cwd)),onSelectWorkspace:R=>{Ht.current=R,bn(R)},onChatWidthModeChange:pD,sessionName:AR,dialogOpen:Yc||Yt,followupState:PC,onAcceptFollowup:OC,onDismissFollowup:pb,composerInput:Ve,composerInputVersion:lt,placeholderText:fle})]}),ln?hT?l.jsx("div",{className:xt.customFooter,children:l.jsx(ln,{connected:Hl,mode:ql,model:_h,streamingState:ar,contextUsageRatio:(ne.contextWindow??0)>0?(ne.tokenCount??0)/(ne.contextWindow??0):0,activeGoal:vm,tasks:cw,availableModes:uy,availableModels:(ne.models??[]).filter(jy).map(R=>({id:R.id,label:uf(R.label||R.id),contextWindow:R.contextWindow})),skills:vh,onSelectMode:Th,onSelectModel:Mb})}):l.jsx(ln,{connected:Hl,mode:ql,model:_h,streamingState:ar,contextUsageRatio:(ne.contextWindow??0)>0?(ne.tokenCount??0)/(ne.contextWindow??0):0,activeGoal:vm,tasks:cw,availableModes:uy,availableModels:(ne.models??[]).filter(jy).map(R=>({id:R.id,label:uf(R.label||R.id),contextWindow:R.contextWindow})),skills:vh,onSelectMode:Th,onSelectModel:Mb}):l.jsx(met,{onSelectMode:()=>Ln(R=>!R),onSelectModel:()=>La(R=>R?null:"main"),onShowContext:()=>Eb("/context",!1),onOpenSettings:()=>Pa("settings"),ref:uw,onOpenTasks:()=>cT(),onReturnToInput:cle,tasks:Sc,activeGoal:vm,onOpenGoals:g0,hideSettings:ole,onToggleShortcuts:$R,compact:!0}),Wl&&Ow&&l.jsx("div",{className:[xt.emptyWelcomeFooter,Db?xt.desktopWelcomeFooter:void 0].filter(Boolean).join(" "),children:Ow})]})]})})]})]}),Dt&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:xt.artifactResizeHandle,role:"separator","aria-orientation":"vertical","aria-valuemin":H0,"aria-valuemax":Qe(),"aria-valuenow":qo,onPointerDown:_c}),l.jsx(V0t,{artifacts:$n,tabs:Pn,activeTabId:nr,reviewChanges:Jr,selectedReviewPath:$r,panelWidth:qo,workspaceCwd:ne.workspaceCwd||"",loading:Ue,error:zt,onSelectTab:Js,onCloseTab:Zr,onClose:yr})]})]})]})})})})}function L8({title:e,description:t,actionLabel:n,onAction:s,theme:r,icon:i}){return l.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 ${r==="dark"?"dark":""}`,children:l.jsxs(Hd,{className:"border",children:[l.jsxs(qd,{children:[l.jsx(Ud,{variant:"icon",children:i??l.jsx(zpe,{})}),l.jsx(Vd,{children:e}),l.jsx(iw,{children:t})]}),l.jsx(Bit,{children:l.jsx(qn,{onClick:s,children:n})})]})})}function Wkt({sessionId:e,workspaceId:t,workspaceCwd:n,lockWorkspaceCwd:s,clientId:r,restartSseOnPrompt:i,webShellProps:o}){var C,S,L,N;const a=ol(),c=To(),[u,d]=f.useState(!1),[h,m]=f.useState(),[p,g]=f.useState(),b=f.useRef(void 0);f.useEffect(()=>d(!1),[e,s,n,t]);const v=u?void 0:e,x=u?void 0:s??n,y=x?void 0:t,w=f.useMemo(()=>{var M,P,E;const $=(P=(M=a.capabilities)==null?void 0:M.workspaces)==null?void 0:P.find(O=>O.cwd===x);if($)return $;if(x&&x===((E=a.capabilities)==null?void 0:E.workspaceCwd))return{id:"primary",cwd:x,primary:!0,trusted:!0}},[x,(C=a.capabilities)==null?void 0:C.workspaceCwd,(S=a.capabilities)==null?void 0:S.workspaces]),k=s&&(h==null?void 0:h.requestedCwd)===s?h.workspace:void 0,T=x?w??k:(N=(L=a.capabilities)==null?void 0:L.workspaces)==null?void 0:N.find($=>$.id===y),_=f.useMemo(()=>sj(Dd(o.language)),[o.language]);return f.useEffect(()=>{var M;if(!s||!a.capabilities||w||(h==null?void 0:h.requestedCwd)===s||p===s)return;((M=b.current)==null?void 0:M.cwd)!==s&&(b.current={cwd:s,promise:c.addWorkspace(s,{persist:!0}).then(P=>{if(P.persisted!==!0)throw new Error("Workspace registration was not persisted");return P})});let $=!1;return b.current.promise.then(async P=>{var E;if(!$){m({requestedCwd:s,workspace:P}),g(void 0);try{await((E=a.refreshCapabilities)==null?void 0:E.call(a))}catch{}}}).catch(()=>{$||g(s)}),()=>{$=!0}},[w,h,p,a,a.capabilities,a.refreshCapabilities,c,s]),(x||y)&&a.status==="error"?l.jsx(L8,{title:_("workspace.loadFailed"),description:_("workspace.loadFailedDescription"),actionLabel:_("common.retry"),theme:o.theme,icon:l.jsx(FP,{}),onAction:()=>{var $;($=a.refreshCapabilities)==null||$.call(a).catch(()=>{})}}):(x||y)&&!a.capabilities?l.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 ${o.theme==="dark"?"dark":""}`,role:"status","aria-live":"polite",children:[l.jsx($o,{}),l.jsx("span",{children:_("common.loading")})]}):s&&p===s?l.jsx(L8,{title:_("workspace.loadFailed"),description:_("workspace.loadFailedDescription"),actionLabel:_("common.retry"),theme:o.theme,icon:l.jsx(FP,{}),onAction:()=>{b.current=void 0,g(void 0)}}):s&&!T?l.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 ${o.theme==="dark"?"dark":""}`,role:"status","aria-live":"polite",children:[l.jsx($o,{}),l.jsx("span",{children:_("common.loading")})]}):(x||y)&&!T?l.jsx(L8,{title:_("workspace.notFound"),description:_("workspace.notFoundDescription"),actionLabel:_("session.new"),theme:o.theme,onAction:()=>{var $;d(!0),($=o.onSessionIdChange)==null||$.call(o,void 0,void 0)}}):l.jsx(XG,{sessionId:v,workspaceCwd:T==null?void 0:T.cwd,clientId:r,historyPageSize:qie,maxBlocks:Uie,suppressOwnUserEcho:!0,restartEventStreamOnPrompt:i,children:l.jsx(Vkt,{...o,restartSseOnPrompt:i,lockedWorkspaceCwd:s?T==null?void 0:T.cwd:void 0,lockedWorkspaceCapability:s?T:void 0})},`${(T==null?void 0:T.id)??y??"primary"}:${v??"new"}`)}const Gkt=Qlt(),bae="qwen-code-web-shell-language",yae="qwen-code-web-shell-theme";function xae(e){if(e===qr.Dark||e===qr.Light)return e}function Kkt(){const e=new URLSearchParams(window.location.search).get("theme");return xae(e)}function Ykt(){try{return xae(window.localStorage.getItem(yae))}catch{return}}function Xkt(e){try{window.localStorage.setItem(yae,e)}catch{}}function Qkt(){return Kkt()??Ykt()??qr.Dark}function Jkt(){try{const e=window.localStorage.getItem(bae);return e?Dd(e):void 0}catch{return}}function Zkt(e){try{window.localStorage.setItem(bae,e)}catch{}}function e_t(){const e=new URLSearchParams(window.location.search),t=e.get("language")??e.get("lang");return Dd(t||(Jkt()??navigator.language))}function t_t(){const e=window.location.pathname.match(/\/session\/([^/]+)/);if(e)try{return decodeURIComponent(e[1])}catch{return}}function n_t(){return new URLSearchParams(window.location.search).get("workspace")||void 0}function s_t(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 r_t({daemonToken:e}){const[t,n]=f.useState(()=>Qkt()),[s,r]=f.useState(()=>e_t()),[i]=f.useState(()=>t_t()),[o]=f.useState(()=>n_t()),a=Gkt||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===qr.Dark);const m=document.querySelector('meta[name="theme-color"]');m&&m.setAttribute("content",t==="light"?"#ffffff":"#0d0d0d")},[t]);const c=f.useCallback(h=>{n(h),Xkt(h)},[]),u=f.useCallback(h=>{r(h),Zkt(h)},[]),d=f.useCallback((h,m)=>{s_t(h,m)},[]);return l.jsx(Jd,{label:"web-shell-root",fallback:(h,m)=>l.jsx(Gme,{error:h,onRetry:m,language:s}),children:l.jsx(Yfe,{baseUrl:a,token:e,children:l.jsx(Wkt,{sessionId:i,workspaceId:o,webShellProps:{theme:t,onThemeChange:c,language:s,onLanguageChange:u,onSessionIdChange:d,sidebar:!0,compactThinking:!0,markdownTableMode:"advanced"}})})})}async function i_t(){const e=uoe()??await nct();sct(),wde.createRoot(document.getElementById("root")).render(l.jsx(vU.StrictMode,{children:l.jsx(r_t,{daemonToken:e})}))}i_t();export{c0 as C,vn as D,Nt as E,on as F,sh as G,gm as P,Rs as R,Ho as S,rr as T,ai as V,Ol as W,ie as _,rs as a,Ks as b,to as c,Gf as d,Ou as e,j_t as f,SIe as g,XIe as h,x2 as i,C4 as j,f_t as k,Jf as l};
