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 Khe=Object.defineProperty;var Yhe=(e,t,n)=>t in e?Khe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var qe=(e,t,n)=>Yhe(e,typeof t!="symbol"?t+"":t,n);function Xhe(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 S4=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function M3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var WG={exports:{}},I3={};/**
 * @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 Qhe=Symbol.for("react.transitional.element"),Jhe=Symbol.for("react.fragment");function VG(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:Qhe,type:e,key:s,ref:t!==void 0?t:null,props:n}}I3.Fragment=Jhe;I3.jsx=VG;I3.jsxs=VG;WG.exports=I3;var l=WG.exports,GG={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 d9=Symbol.for("react.transitional.element"),Zhe=Symbol.for("react.portal"),efe=Symbol.for("react.fragment"),tfe=Symbol.for("react.strict_mode"),nfe=Symbol.for("react.profiler"),sfe=Symbol.for("react.consumer"),rfe=Symbol.for("react.context"),ife=Symbol.for("react.forward_ref"),ofe=Symbol.for("react.suspense"),afe=Symbol.for("react.memo"),KG=Symbol.for("react.lazy"),lfe=Symbol.for("react.activity"),AO=Symbol.iterator;function cfe(e){return e===null||typeof e!="object"?null:(e=AO&&e[AO]||e["@@iterator"],typeof e=="function"?e:null)}var YG={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},XG=Object.assign,QG={};function Ub(e,t,n){this.props=e,this.context=t,this.refs=QG,this.updater=n||YG}Ub.prototype.isReactComponent={};Ub.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")};Ub.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function JG(){}JG.prototype=Ub.prototype;function h9(e,t,n){this.props=e,this.context=t,this.refs=QG,this.updater=n||YG}var f9=h9.prototype=new JG;f9.constructor=h9;XG(f9,Ub.prototype);f9.isPureReactComponent=!0;var NO=Array.isArray;function uj(){}var Ei={H:null,A:null,T:null,S:null},ZG=Object.prototype.hasOwnProperty;function m9(e,t,n){var s=n.ref;return{$$typeof:d9,type:e,key:t,ref:s!==void 0?s:null,props:n}}function ufe(e,t){return m9(e.type,t,e.props)}function p9(e){return typeof e=="object"&&e!==null&&e.$$typeof===d9}function dfe(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var MO=/\/+/g;function P6(e,t){return typeof e=="object"&&e!==null&&e.key!=null?dfe(""+e.key):t.toString(36)}function hfe(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(uj,uj):(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 f1(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 d9:case Zhe:o=!0;break;case KG:return o=e._init,f1(o(e._payload),t,n,s,r)}}if(o)return r=r(e),o=s===""?"."+P6(e,0):s,NO(r)?(n="",o!=null&&(n=o.replace(MO,"$&/")+"/"),f1(r,t,n,"",function(u){return u})):r!=null&&(p9(r)&&(r=ufe(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(MO,"$&/")+"/")+o)),t.push(r)),1;o=0;var a=s===""?".":s+":";if(NO(e))for(var c=0;c<e.length;c++)s=e[c],i=a+P6(s,c),o+=f1(s,t,n,i,r);else if(c=cfe(e),typeof c=="function")for(e=c.call(e),c=0;!(s=e.next()).done;)s=s.value,i=a+P6(s,c++),o+=f1(s,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return f1(hfe(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 P_(e,t,n){if(e==null)return e;var s=[],r=0;return f1(e,s,"","",function(i){return t.call(n,i,r++)}),s}function ffe(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 IO=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)},mfe={map:P_,forEach:function(e,t,n){P_(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P_(e,function(){t++}),t},toArray:function(e){return P_(e,function(t){return t})||[]},only:function(e){if(!p9(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};As.Activity=lfe;As.Children=mfe;As.Component=Ub;As.Fragment=efe;As.Profiler=nfe;As.PureComponent=h9;As.StrictMode=tfe;As.Suspense=ofe;As.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ei;As.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Ei.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=XG({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!ZG.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 m9(e.type,r,s)};As.createContext=function(e){return e={$$typeof:rfe,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:sfe,_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)ZG.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 m9(e,i,r)};As.createRef=function(){return{current:null}};As.forwardRef=function(e){return{$$typeof:ife,render:e}};As.isValidElement=p9;As.lazy=function(e){return{$$typeof:KG,_payload:{_status:-1,_result:e},_init:ffe}};As.memo=function(e,t){return{$$typeof:afe,type:e,compare:t===void 0?null:t}};As.startTransition=function(e){var t=Ei.T,n={};Ei.T=n;try{var s=e(),r=Ei.S;r!==null&&r(n,s),typeof s=="object"&&s!==null&&typeof s.then=="function"&&s.then(uj,IO)}catch(i){IO(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),Ei.T=t}};As.unstable_useCacheRefresh=function(){return Ei.H.useCacheRefresh()};As.use=function(e){return Ei.H.use(e)};As.useActionState=function(e,t,n){return Ei.H.useActionState(e,t,n)};As.useCallback=function(e,t){return Ei.H.useCallback(e,t)};As.useContext=function(e){return Ei.H.useContext(e)};As.useDebugValue=function(){};As.useDeferredValue=function(e,t){return Ei.H.useDeferredValue(e,t)};As.useEffect=function(e,t){return Ei.H.useEffect(e,t)};As.useEffectEvent=function(e){return Ei.H.useEffectEvent(e)};As.useId=function(){return Ei.H.useId()};As.useImperativeHandle=function(e,t,n){return Ei.H.useImperativeHandle(e,t,n)};As.useInsertionEffect=function(e,t){return Ei.H.useInsertionEffect(e,t)};As.useLayoutEffect=function(e,t){return Ei.H.useLayoutEffect(e,t)};As.useMemo=function(e,t){return Ei.H.useMemo(e,t)};As.useOptimistic=function(e,t){return Ei.H.useOptimistic(e,t)};As.useReducer=function(e,t,n){return Ei.H.useReducer(e,t,n)};As.useRef=function(e){return Ei.H.useRef(e)};As.useState=function(e){return Ei.H.useState(e)};As.useSyncExternalStore=function(e,t,n){return Ei.H.useSyncExternalStore(e,t,n)};As.useTransition=function(){return Ei.H.useTransition()};As.version="19.2.4";GG.exports=As;var h=GG.exports;const kn=M3(h),R3=Xhe({__proto__:null,default:kn},[h]);var eK={exports:{}},D3={},tK={exports:{}},nK={};/**
 * @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(B,j){var H=B.length;B.push(j);e:for(;0<H;){var Q=H-1>>>1,I=B[Q];if(0<r(I,j))B[Q]=j,B[H]=I,H=Q;else break e}}function n(B){return B.length===0?null:B[0]}function s(B){if(B.length===0)return null;var j=B[0],H=B.pop();if(H!==j){B[0]=H;e:for(var Q=0,I=B.length,J=I>>>1;Q<J;){var W=2*(Q+1)-1,P=B[W],V=W+1,ee=B[V];if(0>r(P,H))V<I&&0>r(ee,P)?(B[Q]=ee,B[V]=H,Q=V):(B[Q]=P,B[W]=H,Q=W);else if(V<I&&0>r(ee,H))B[Q]=ee,B[V]=H,Q=V;else break e}}return j}function r(B,j){var H=B.sortIndex-j.sortIndex;return H!==0?H:B.id-j.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,f=null,m=3,p=!1,g=!1,b=!1,v=!1,y=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;function k(B){for(var j=n(u);j!==null;){if(j.callback===null)s(u);else if(j.startTime<=B)s(u),j.sortIndex=j.expirationTime,t(c,j);else break;j=n(u)}}function C(B){if(b=!1,k(B),!g)if(n(c)!==null)g=!0,T||(T=!0,M());else{var j=n(u);j!==null&&z(C,j.startTime-B)}}var T=!1,_=-1,S=5,R=-1;function A(){return v?!0:!(e.unstable_now()-R<S)}function O(){if(v=!1,T){var B=e.unstable_now();R=B;var j=!0;try{e:{g=!1,b&&(b=!1,w(_),_=-1),p=!0;var H=m;try{t:{for(k(B),f=n(c);f!==null&&!(f.expirationTime>B&&A());){var Q=f.callback;if(typeof Q=="function"){f.callback=null,m=f.priorityLevel;var I=Q(f.expirationTime<=B);if(B=e.unstable_now(),typeof I=="function"){f.callback=I,k(B),j=!0;break t}f===n(c)&&s(c),k(B)}else s(c);f=n(c)}if(f!==null)j=!0;else{var J=n(u);J!==null&&z(C,J.startTime-B),j=!1}}break e}finally{f=null,m=H,p=!1}j=void 0}}finally{j?M():T=!1}}}var M;if(typeof x=="function")M=function(){x(O)};else if(typeof MessageChannel<"u"){var D=new MessageChannel,$=D.port2;D.port1.onmessage=O,M=function(){$.postMessage(null)}}else M=function(){y(O,0)};function z(B,j){_=y(function(){B(e.unstable_now())},j)}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(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):S=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(B){switch(m){case 1:case 2:case 3:var j=3;break;default:j=m}var H=m;m=j;try{return B()}finally{m=H}},e.unstable_requestPaint=function(){v=!0},e.unstable_runWithPriority=function(B,j){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var H=m;m=B;try{return j()}finally{m=H}},e.unstable_scheduleCallback=function(B,j,H){var Q=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?Q+H:Q):H=Q,B){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=H+I,B={id:d++,callback:j,priorityLevel:B,startTime:H,expirationTime:I,sortIndex:-1},H>Q?(B.sortIndex=H,t(u,B),n(c)===null&&B===n(u)&&(b?(w(_),_=-1):b=!0,z(C,H-Q))):(B.sortIndex=I,t(c,B),g||p||(g=!0,T||(T=!0,M()))),B},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(B){var j=m;return function(){var H=m;m=j;try{return B.apply(this,arguments)}finally{m=H}}}})(nK);tK.exports=nK;var pfe=tK.exports,sK={exports:{}},El={};/**
 * @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 gfe=h;function rK(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 Lf(){}var wl={d:{f:Lf,r:function(){throw Error(rK(522))},D:Lf,C:Lf,L:Lf,m:Lf,X:Lf,S:Lf,M:Lf},p:0,findDOMNode:null},bfe=Symbol.for("react.portal");function yfe(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:bfe,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}var Jw=gfe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function P3(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}El.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=wl;El.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(rK(299));return yfe(e,t,null,n)};El.flushSync=function(e){var t=Jw.T,n=wl.p;try{if(Jw.T=null,wl.p=2,e)return e()}finally{Jw.T=t,wl.p=n,wl.d.f()}};El.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,wl.d.C(e,t))};El.prefetchDNS=function(e){typeof e=="string"&&wl.d.D(e)};El.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,s=P3(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?wl.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:s,integrity:r,fetchPriority:i}):n==="script"&&wl.d.X(e,{crossOrigin:s,integrity:r,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};El.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=P3(t.as,t.crossOrigin);wl.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&&wl.d.M(e)};El.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,s=P3(n,t.crossOrigin);wl.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})}};El.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=P3(t.as,t.crossOrigin);wl.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 wl.d.m(e)};El.requestFormReset=function(e){wl.d.r(e)};El.unstable_batchedUpdates=function(e,t){return e(t)};El.useFormState=function(e,t,n){return Jw.H.useFormState(e,t,n)};El.useFormStatus=function(){return Jw.H.useHostTransitionStatus()};El.version="19.2.4";function iK(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(iK)}catch(e){console.error(e)}}iK(),sK.exports=El;var Wu=sK.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 Xo=pfe,oK=h,wfe=Wu;function pt(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 aK(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Wx(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 lK(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 cK(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 RO(e){if(Wx(e)!==e)throw Error(pt(188))}function vfe(e){var t=e.alternate;if(!t){if(t=Wx(e),t===null)throw Error(pt(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 RO(r),e;if(i===s)return RO(r),t;i=i.sibling}throw Error(pt(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(pt(189))}}if(n.alternate!==s)throw Error(pt(190))}if(n.tag!==3)throw Error(pt(188));return n.stateNode.current===n?e:t}function uK(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=uK(e),t!==null)return t;e=e.sibling}return null}var ji=Object.assign,xfe=Symbol.for("react.element"),L_=Symbol.for("react.transitional.element"),Nw=Symbol.for("react.portal"),S1=Symbol.for("react.fragment"),dK=Symbol.for("react.strict_mode"),dj=Symbol.for("react.profiler"),hK=Symbol.for("react.consumer"),Oh=Symbol.for("react.context"),g9=Symbol.for("react.forward_ref"),hj=Symbol.for("react.suspense"),fj=Symbol.for("react.suspense_list"),b9=Symbol.for("react.memo"),Yf=Symbol.for("react.lazy"),mj=Symbol.for("react.activity"),kfe=Symbol.for("react.memo_cache_sentinel"),DO=Symbol.iterator;function Qy(e){return e===null||typeof e!="object"?null:(e=DO&&e[DO]||e["@@iterator"],typeof e=="function"?e:null)}var _fe=Symbol.for("react.client.reference");function pj(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===_fe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S1:return"Fragment";case dj:return"Profiler";case dK:return"StrictMode";case hj:return"Suspense";case fj:return"SuspenseList";case mj:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case Nw:return"Portal";case Oh:return e.displayName||"Context";case hK:return(e._context.displayName||"Context")+".Consumer";case g9:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case b9:return t=e.displayName||null,t!==null?t:pj(e.type)||"Memo";case Yf:t=e._payload,e=e._init;try{return pj(e(t))}catch{}}return null}var Mw=Array.isArray,ms=oK.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Lr=wfe.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T0={pending:!1,data:null,method:null,action:null},gj=[],C1=-1;function Gd(e){return{current:e}}function fa(e){0>C1||(e.current=gj[C1],gj[C1]=null,C1--)}function vi(e,t){C1++,gj[C1]=e.current,e.current=t}var zd=Gd(null),Pv=Gd(null),km=Gd(null),C4=Gd(null);function T4(e,t){switch(vi(km,t),vi(Pv,e),vi(zd,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?z$(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=z$(t),e=IX(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}fa(zd),vi(zd,e)}function fb(){fa(zd),fa(Pv),fa(km)}function bj(e){e.memoizedState!==null&&vi(C4,e);var t=zd.current,n=IX(t,e.type);t!==n&&(vi(Pv,e),vi(zd,n))}function E4(e){Pv.current===e&&(fa(zd),fa(Pv)),C4.current===e&&(fa(C4),Vv._currentValue=T0)}var L6,PO;function r0(e){if(L6===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);L6=t&&t[1]||"",PO=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+L6+e+PO}var O6=!1;function $6(e,t){if(!e||O6)return"";O6=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var f=function(){throw Error()};if(Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(p){var m=p}Reflect.construct(e,[],f)}else{try{f.call()}catch(p){m=p}e.call(f.prototype)}}else{try{throw Error()}catch(p){m=p}(f=e())&&typeof f.catch=="function"&&f.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{O6=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?r0(n):""}function Sfe(e,t){switch(e.tag){case 26:case 27:case 5:return r0(e.type);case 16:return r0("Lazy");case 13:return e.child!==t&&t!==null?r0("Suspense Fallback"):r0("Suspense");case 19:return r0("SuspenseList");case 0:case 15:return $6(e.type,!1);case 11:return $6(e.type.render,!1);case 1:return $6(e.type,!0);case 31:return r0("Activity");default:return""}}function LO(e){try{var t="",n=null;do t+=Sfe(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
Error generating stack: `+s.message+`
`+s.stack}}var yj=Object.prototype.hasOwnProperty,y9=Xo.unstable_scheduleCallback,B6=Xo.unstable_cancelCallback,Cfe=Xo.unstable_shouldYield,Tfe=Xo.unstable_requestPaint,Cc=Xo.unstable_now,Efe=Xo.unstable_getCurrentPriorityLevel,fK=Xo.unstable_ImmediatePriority,mK=Xo.unstable_UserBlockingPriority,j4=Xo.unstable_NormalPriority,jfe=Xo.unstable_LowPriority,pK=Xo.unstable_IdlePriority,Afe=Xo.log,Nfe=Xo.unstable_setDisableYieldValue,Vx=null,Tc=null;function am(e){if(typeof Afe=="function"&&Nfe(e),Tc&&typeof Tc.setStrictMode=="function")try{Tc.setStrictMode(Vx,e)}catch{}}var Ec=Math.clz32?Math.clz32:Rfe,Mfe=Math.log,Ife=Math.LN2;function Rfe(e){return e>>>=0,e===0?32:31-(Mfe(e)/Ife|0)|0}var O_=256,$_=262144,B_=4194304;function i0(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 L3(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=i0(s):(o&=a,o!==0?r=i0(o):n||(n=a&~e,n!==0&&(r=i0(n))))):(a=s&~i,a!==0?r=i0(a):o!==0?r=i0(o):n||(n=s&~e,n!==0&&(r=i0(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 Gx(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Dfe(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 gK(){var e=B_;return B_<<=1,!(B_&62914560)&&(B_=4194304),e}function z6(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Kx(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Pfe(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-Ec(n),f=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&=~f}s!==0&&bK(e,s,0),i!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=i&~(o&~t))}function bK(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-Ec(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function yK(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Ec(n),r=1<<s;r&t|e[s]&t&&(e[s]|=t),n&=~r}}function wK(e,t){var n=t&-t;return n=n&42?1:w9(n),n&(e.suspendedLanes|t)?0:n}function w9(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 v9(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function vK(){var e=Lr.p;return e!==0?e:(e=window.event,e===void 0?32:qX(e.type))}function OO(e,t){var n=Lr.p;try{return Lr.p=e,t()}finally{Lr.p=n}}var pp=Math.random().toString(36).slice(2),Ta="__reactFiber$"+pp,Zl="__reactProps$"+pp,Wb="__reactContainer$"+pp,wj="__reactEvents$"+pp,Lfe="__reactListeners$"+pp,Ofe="__reactHandles$"+pp,$O="__reactResources$"+pp,Yx="__reactMarker$"+pp;function x9(e){delete e[Ta],delete e[Zl],delete e[wj],delete e[Lfe],delete e[Ofe]}function T1(e){var t=e[Ta];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Wb]||n[Ta]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=W$(e);e!==null;){if(n=e[Ta])return n;e=W$(e)}return t}e=n,n=e.parentNode}return null}function Vb(e){if(e=e[Ta]||e[Wb]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Iw(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(pt(33))}function U1(e){var t=e[$O];return t||(t=e[$O]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ua(e){e[Yx]=!0}var xK=new Set,kK={};function rg(e,t){mb(e,t),mb(e+"Capture",t)}function mb(e,t){for(kK[e]=t,e=0;e<t.length;e++)xK.add(t[e])}var $fe=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]*$"),BO={},zO={};function Bfe(e){return yj.call(zO,e)?!0:yj.call(BO,e)?!1:$fe.test(e)?zO[e]=!0:(BO[e]=!0,!1)}function j2(e,t,n){if(Bfe(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 z_(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 vh(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 tu(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function _K(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function zfe(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 vj(e){if(!e._valueTracker){var t=_K(e)?"checked":"value";e._valueTracker=zfe(e,t,""+e[t])}}function SK(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=_K(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function A4(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 Ffe=/[\n"\\]/g;function au(e){return e.replace(Ffe,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function xj(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=""+tu(t)):e.value!==""+tu(t)&&(e.value=""+tu(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?kj(e,o,tu(t)):n!=null?kj(e,o,tu(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=""+tu(a):e.removeAttribute("name")}function CK(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)){vj(e);return}n=n!=null?""+tu(n):"",t=t!=null?""+tu(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),vj(e)}function kj(e,t,n){t==="number"&&A4(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function W1(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=""+tu(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 TK(e,t,n){if(t!=null&&(t=""+tu(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+tu(n):""}function EK(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(pt(92));if(Mw(s)){if(1<s.length)throw Error(pt(93));s=s[0]}n=s}n==null&&(n=""),t=n}n=tu(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),vj(e)}function pb(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Hfe=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 FO(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||Hfe.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function jK(e,t,n){if(t!=null&&typeof t!="object")throw Error(pt(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&&FO(e,r,s)}else for(var i in t)t.hasOwnProperty(i)&&FO(e,i,t[i])}function k9(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 qfe=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"]]),Ufe=/^[\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 A2(e){return Ufe.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function $h(){}var _j=null;function _9(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var E1=null,V1=null;function HO(e){var t=Vb(e);if(t&&(e=t.stateNode)){var n=e[Zl]||null;e:switch(e=t.stateNode,t.type){case"input":if(xj(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="'+au(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var r=s[Zl]||null;if(!r)throw Error(pt(90));xj(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&&SK(s)}break e;case"textarea":TK(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&W1(e,!!n.multiple,t,!1)}}}var F6=!1;function AK(e,t,n){if(F6)return e(t,n);F6=!0;try{var s=e(t);return s}finally{if(F6=!1,(E1!==null||V1!==null)&&(K3(),E1&&(t=E1,e=V1,V1=E1=null,HO(t),e)))for(t=0;t<e.length;t++)HO(e[t])}}function Lv(e,t){var n=e.stateNode;if(n===null)return null;var s=n[Zl]||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(pt(231,t,typeof n));return n}var rf=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Sj=!1;if(rf)try{var Jy={};Object.defineProperty(Jy,"passive",{get:function(){Sj=!0}}),window.addEventListener("test",Jy,Jy),window.removeEventListener("test",Jy,Jy)}catch{Sj=!1}var lm=null,S9=null,N2=null;function NK(){if(N2)return N2;var e,t=S9,n=t.length,s,r="value"in lm?lm.value:lm.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 N2=r.slice(e,1<s?1-s:void 0)}function M2(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 F_(){return!0}function qO(){return!1}function tc(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)?F_:qO,this.isPropagationStopped=qO,this}return ji(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=F_)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=F_)},persist:function(){},isPersistent:F_}),t}var ig={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},O3=tc(ig),Xx=ji({},ig,{view:0,detail:0}),Wfe=tc(Xx),H6,q6,Zy,$3=ji({},Xx,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:C9,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!==Zy&&(Zy&&e.type==="mousemove"?(H6=e.screenX-Zy.screenX,q6=e.screenY-Zy.screenY):q6=H6=0,Zy=e),H6)},movementY:function(e){return"movementY"in e?e.movementY:q6}}),UO=tc($3),Vfe=ji({},$3,{dataTransfer:0}),Gfe=tc(Vfe),Kfe=ji({},Xx,{relatedTarget:0}),U6=tc(Kfe),Yfe=ji({},ig,{animationName:0,elapsedTime:0,pseudoElement:0}),Xfe=tc(Yfe),Qfe=ji({},ig,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Jfe=tc(Qfe),Zfe=ji({},ig,{data:0}),WO=tc(Zfe),eme={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},tme={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"},nme={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function sme(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=nme[e])?!!t[e]:!1}function C9(){return sme}var rme=ji({},Xx,{key:function(e){if(e.key){var t=eme[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=M2(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?tme[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:C9,charCode:function(e){return e.type==="keypress"?M2(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?M2(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ime=tc(rme),ome=ji({},$3,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),VO=tc(ome),ame=ji({},Xx,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:C9}),lme=tc(ame),cme=ji({},ig,{propertyName:0,elapsedTime:0,pseudoElement:0}),ume=tc(cme),dme=ji({},$3,{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}),hme=tc(dme),fme=ji({},ig,{newState:0,oldState:0}),mme=tc(fme),pme=[9,13,27,32],T9=rf&&"CompositionEvent"in window,Zw=null;rf&&"documentMode"in document&&(Zw=document.documentMode);var gme=rf&&"TextEvent"in window&&!Zw,MK=rf&&(!T9||Zw&&8<Zw&&11>=Zw),GO=" ",KO=!1;function IK(e,t){switch(e){case"keyup":return pme.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function RK(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var j1=!1;function bme(e,t){switch(e){case"compositionend":return RK(t);case"keypress":return t.which!==32?null:(KO=!0,GO);case"textInput":return e=t.data,e===GO&&KO?null:e;default:return null}}function yme(e,t){if(j1)return e==="compositionend"||!T9&&IK(e,t)?(e=NK(),N2=S9=lm=null,j1=!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 MK&&t.locale!=="ko"?null:t.data;default:return null}}var wme={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 YO(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!wme[e.type]:t==="textarea"}function DK(e,t,n,s){E1?V1?V1.push(s):V1=[s]:E1=s,t=G4(t,"onChange"),0<t.length&&(n=new O3("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var ev=null,Ov=null;function vme(e){AX(e,0)}function B3(e){var t=Iw(e);if(SK(t))return e}function XO(e,t){if(e==="change")return t}var PK=!1;if(rf){var W6;if(rf){var V6="oninput"in document;if(!V6){var QO=document.createElement("div");QO.setAttribute("oninput","return;"),V6=typeof QO.oninput=="function"}W6=V6}else W6=!1;PK=W6&&(!document.documentMode||9<document.documentMode)}function JO(){ev&&(ev.detachEvent("onpropertychange",LK),Ov=ev=null)}function LK(e){if(e.propertyName==="value"&&B3(Ov)){var t=[];DK(t,Ov,e,_9(e)),AK(vme,t)}}function xme(e,t,n){e==="focusin"?(JO(),ev=t,Ov=n,ev.attachEvent("onpropertychange",LK)):e==="focusout"&&JO()}function kme(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return B3(Ov)}function _me(e,t){if(e==="click")return B3(t)}function Sme(e,t){if(e==="input"||e==="change")return B3(t)}function Cme(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Mc=typeof Object.is=="function"?Object.is:Cme;function $v(e,t){if(Mc(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(!yj.call(t,r)||!Mc(e[r],t[r]))return!1}return!0}function ZO(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function e$(e,t){var n=ZO(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=ZO(n)}}function OK(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?OK(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $K(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=A4(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=A4(e.document)}return t}function E9(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 Tme=rf&&"documentMode"in document&&11>=document.documentMode,A1=null,Cj=null,tv=null,Tj=!1;function t$(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Tj||A1==null||A1!==A4(s)||(s=A1,"selectionStart"in s&&E9(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}),tv&&$v(tv,s)||(tv=s,s=G4(Cj,"onSelect"),0<s.length&&(t=new O3("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=A1)))}function Wp(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var N1={animationend:Wp("Animation","AnimationEnd"),animationiteration:Wp("Animation","AnimationIteration"),animationstart:Wp("Animation","AnimationStart"),transitionrun:Wp("Transition","TransitionRun"),transitionstart:Wp("Transition","TransitionStart"),transitioncancel:Wp("Transition","TransitionCancel"),transitionend:Wp("Transition","TransitionEnd")},G6={},BK={};rf&&(BK=document.createElement("div").style,"AnimationEvent"in window||(delete N1.animationend.animation,delete N1.animationiteration.animation,delete N1.animationstart.animation),"TransitionEvent"in window||delete N1.transitionend.transition);function og(e){if(G6[e])return G6[e];if(!N1[e])return e;var t=N1[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in BK)return G6[e]=t[n];return e}var zK=og("animationend"),FK=og("animationiteration"),HK=og("animationstart"),Eme=og("transitionrun"),jme=og("transitionstart"),Ame=og("transitioncancel"),qK=og("transitionend"),UK=new Map,Ej="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(" ");Ej.push("scrollEnd");function Vu(e,t){UK.set(e,t),rg(t,[e])}var N4=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)},Zc=[],M1=0,j9=0;function z3(){for(var e=M1,t=j9=M1=0;t<e;){var n=Zc[t];Zc[t++]=null;var s=Zc[t];Zc[t++]=null;var r=Zc[t];Zc[t++]=null;var i=Zc[t];if(Zc[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&&WK(n,r,i)}}function F3(e,t,n,s){Zc[M1++]=e,Zc[M1++]=t,Zc[M1++]=n,Zc[M1++]=s,j9|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function A9(e,t,n,s){return F3(e,t,n,s),M4(e)}function ag(e,t){return F3(e,null,null,t),M4(e)}function WK(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-Ec(n),e=i.hiddenUpdates,s=e[r],s===null?e[r]=[t]:s.push(t),t.lane=n|536870912),i):null}function M4(e){if(50<uv)throw uv=0,Kj=null,Error(pt(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var I1={};function Nme(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 vc(e,t,n,s){return new Nme(e,t,n,s)}function N9(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Vh(e,t){var n=e.alternate;return n===null?(n=vc(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 VK(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 I2(e,t,n,s,r,i){var o=0;if(s=e,typeof e=="function")N9(e)&&(o=1);else if(typeof e=="string")o=Ppe(e,n,zd.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case mj:return e=vc(31,n,t,r),e.elementType=mj,e.lanes=i,e;case S1:return E0(n.children,r,i,t);case dK:o=8,r|=24;break;case dj:return e=vc(12,n,t,r|2),e.elementType=dj,e.lanes=i,e;case hj:return e=vc(13,n,t,r),e.elementType=hj,e.lanes=i,e;case fj:return e=vc(19,n,t,r),e.elementType=fj,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Oh:o=10;break e;case hK:o=9;break e;case g9:o=11;break e;case b9:o=14;break e;case Yf:o=16,s=null;break e}o=29,n=Error(pt(130,e===null?"null":typeof e,"")),s=null}return t=vc(o,n,t,r),t.elementType=e,t.type=s,t.lanes=i,t}function E0(e,t,n,s){return e=vc(7,e,s,t),e.lanes=n,e}function K6(e,t,n){return e=vc(6,e,null,t),e.lanes=n,e}function GK(e){var t=vc(18,null,null,0);return t.stateNode=e,t}function Y6(e,t,n){return t=vc(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var n$=new WeakMap;function lu(e,t){if(typeof e=="object"&&e!==null){var n=n$.get(e);return n!==void 0?n:(t={value:e,source:t,stack:LO(t)},n$.set(e,t),t)}return{value:e,source:t,stack:LO(t)}}var R1=[],D1=0,I4=null,Bv=0,nu=[],su=0,$m=null,Ad=1,Nd="";function Mh(e,t){R1[D1++]=Bv,R1[D1++]=I4,I4=e,Bv=t}function KK(e,t,n){nu[su++]=Ad,nu[su++]=Nd,nu[su++]=$m,$m=e;var s=Ad;e=Nd;var r=32-Ec(s)-1;s&=~(1<<r),n+=1;var i=32-Ec(t)+r;if(30<i){var o=r-r%5;i=(s&(1<<o)-1).toString(32),s>>=o,r-=o,Ad=1<<32-Ec(t)+r|n<<r|s,Nd=i+e}else Ad=1<<i|n<<r|s,Nd=e}function M9(e){e.return!==null&&(Mh(e,1),KK(e,1,0))}function I9(e){for(;e===I4;)I4=R1[--D1],R1[D1]=null,Bv=R1[--D1],R1[D1]=null;for(;e===$m;)$m=nu[--su],nu[su]=null,Nd=nu[--su],nu[su]=null,Ad=nu[--su],nu[su]=null}function YK(e,t){nu[su++]=Ad,nu[su++]=Nd,nu[su++]=$m,Ad=t.id,Nd=t.overflow,$m=e}var Ea=null,Ci=null,hr=!1,_m=null,cu=!1,jj=Error(pt(519));function Bm(e){var t=Error(pt(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw zv(lu(t,e)),jj}function s$(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[Ta]=e,t[Zl]=s,n){case"dialog":Zs("cancel",t),Zs("close",t);break;case"iframe":case"object":case"embed":Zs("load",t);break;case"video":case"audio":for(n=0;n<Uv.length;n++)Zs(Uv[n],t);break;case"source":Zs("error",t);break;case"img":case"image":case"link":Zs("error",t),Zs("load",t);break;case"details":Zs("toggle",t);break;case"input":Zs("invalid",t),CK(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Zs("invalid",t);break;case"textarea":Zs("invalid",t),EK(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||MX(t.textContent,n)?(s.popover!=null&&(Zs("beforetoggle",t),Zs("toggle",t)),s.onScroll!=null&&Zs("scroll",t),s.onScrollEnd!=null&&Zs("scrollend",t),s.onClick!=null&&(t.onclick=$h),t=!0):t=!1,t||Bm(e,!0)}function r$(e){for(Ea=e.return;Ea;)switch(Ea.tag){case 5:case 31:case 13:cu=!1;return;case 27:case 3:cu=!0;return;default:Ea=Ea.return}}function Wg(e){if(e!==Ea)return!1;if(!hr)return r$(e),hr=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Zj(e.type,e.memoizedProps)),n=!n),n&&Ci&&Bm(e),r$(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(pt(317));Ci=U$(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(pt(317));Ci=U$(e)}else t===27?(t=Ci,gp(e.type)?(e=sA,sA=null,Ci=e):Ci=t):Ci=Ea?gu(e.stateNode.nextSibling):null;return!0}function P0(){Ci=Ea=null,hr=!1}function X6(){var e=_m;return e!==null&&(Fl===null?Fl=e:Fl.push.apply(Fl,e),_m=null),e}function zv(e){_m===null?_m=[e]:_m.push(e)}var Aj=Gd(null),lg=null,Bh=null;function tm(e,t,n){vi(Aj,t._currentValue),t._currentValue=n}function Gh(e){e._currentValue=Aj.current,fa(Aj)}function Nj(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 Mj(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),Nj(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(pt(341));o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),Nj(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 Gb(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(pt(387));if(o=o.memoizedProps,o!==null){var a=r.type;Mc(r.pendingProps.value,o.value)||(e!==null?e.push(a):e=[a])}}else if(r===C4.current){if(o=r.alternate,o===null)throw Error(pt(387));o.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(Vv):e=[Vv])}r=r.return}e!==null&&Mj(t,e,n,s),t.flags|=262144}function R4(e){for(e=e.firstContext;e!==null;){if(!Mc(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function L0(e){lg=e,Bh=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Aa(e){return XK(lg,e)}function H_(e,t){return lg===null&&L0(e),XK(e,t)}function XK(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Bh===null){if(e===null)throw Error(pt(308));Bh=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Bh=Bh.next=t;return n}var Mme=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()})}},Ime=Xo.unstable_scheduleCallback,Rme=Xo.unstable_NormalPriority,jo={$$typeof:Oh,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function R9(){return{controller:new Mme,data:new Map,refCount:0}}function Qx(e){e.refCount--,e.refCount===0&&Ime(Rme,function(){e.controller.abort()})}var nv=null,Ij=0,gb=0,G1=null;function Dme(e,t){if(nv===null){var n=nv=[];Ij=0,gb=rI(),G1={status:"pending",value:void 0,then:function(s){n.push(s)}}}return Ij++,t.then(i$,i$),t}function i$(){if(--Ij===0&&nv!==null){G1!==null&&(G1.status="fulfilled");var e=nv;nv=null,gb=0,G1=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Pme(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 o$=ms.S;ms.S=function(e,t){uX=Cc(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Dme(e,t),o$!==null&&o$(e,t)};var j0=Gd(null);function D9(){var e=j0.current;return e!==null?e:hi.pooledCache}function R2(e,t){t===null?vi(j0,j0.current):vi(j0,t.pool)}function QK(){var e=D9();return e===null?null:{parent:jo._currentValue,pool:e}}var Kb=Error(pt(460)),P9=Error(pt(474)),H3=Error(pt(542)),D4={then:function(){}};function a$(e){return e=e.status,e==="fulfilled"||e==="rejected"}function JK(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then($h,$h),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,c$(e),e;default:if(typeof t.status=="string")t.then($h,$h);else{if(e=hi,e!==null&&100<e.shellSuspendCounter)throw Error(pt(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,c$(e),e}throw A0=t,Kb}}function o0(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(A0=n,Kb):n}}var A0=null;function l$(){if(A0===null)throw Error(pt(459));var e=A0;return A0=null,e}function c$(e){if(e===Kb||e===H3)throw Error(pt(483))}var K1=null,Fv=0;function q_(e){var t=Fv;return Fv+=1,K1===null&&(K1=[]),JK(K1,e,t)}function ew(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function U_(e,t){throw t.$$typeof===xfe?Error(pt(525)):(e=Object.prototype.toString.call(t),Error(pt(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function ZK(e){function t(y,w){if(e){var x=y.deletions;x===null?(y.deletions=[w],y.flags|=16):x.push(w)}}function n(y,w){if(!e)return null;for(;w!==null;)t(y,w),w=w.sibling;return null}function s(y){for(var w=new Map;y!==null;)y.key!==null?w.set(y.key,y):w.set(y.index,y),y=y.sibling;return w}function r(y,w){return y=Vh(y,w),y.index=0,y.sibling=null,y}function i(y,w,x){return y.index=x,e?(x=y.alternate,x!==null?(x=x.index,x<w?(y.flags|=67108866,w):x):(y.flags|=67108866,w)):(y.flags|=1048576,w)}function o(y){return e&&y.alternate===null&&(y.flags|=67108866),y}function a(y,w,x,k){return w===null||w.tag!==6?(w=K6(x,y.mode,k),w.return=y,w):(w=r(w,x),w.return=y,w)}function c(y,w,x,k){var C=x.type;return C===S1?d(y,w,x.props.children,k,x.key):w!==null&&(w.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Yf&&o0(C)===w.type)?(w=r(w,x.props),ew(w,x),w.return=y,w):(w=I2(x.type,x.key,x.props,null,y.mode,k),ew(w,x),w.return=y,w)}function u(y,w,x,k){return w===null||w.tag!==4||w.stateNode.containerInfo!==x.containerInfo||w.stateNode.implementation!==x.implementation?(w=Y6(x,y.mode,k),w.return=y,w):(w=r(w,x.children||[]),w.return=y,w)}function d(y,w,x,k,C){return w===null||w.tag!==7?(w=E0(x,y.mode,k,C),w.return=y,w):(w=r(w,x),w.return=y,w)}function f(y,w,x){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return w=K6(""+w,y.mode,x),w.return=y,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case L_:return x=I2(w.type,w.key,w.props,null,y.mode,x),ew(x,w),x.return=y,x;case Nw:return w=Y6(w,y.mode,x),w.return=y,w;case Yf:return w=o0(w),f(y,w,x)}if(Mw(w)||Qy(w))return w=E0(w,y.mode,x,null),w.return=y,w;if(typeof w.then=="function")return f(y,q_(w),x);if(w.$$typeof===Oh)return f(y,H_(y,w),x);U_(y,w)}return null}function m(y,w,x,k){var C=w!==null?w.key:null;if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return C!==null?null:a(y,w,""+x,k);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case L_:return x.key===C?c(y,w,x,k):null;case Nw:return x.key===C?u(y,w,x,k):null;case Yf:return x=o0(x),m(y,w,x,k)}if(Mw(x)||Qy(x))return C!==null?null:d(y,w,x,k,null);if(typeof x.then=="function")return m(y,w,q_(x),k);if(x.$$typeof===Oh)return m(y,w,H_(y,x),k);U_(y,x)}return null}function p(y,w,x,k,C){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return y=y.get(x)||null,a(w,y,""+k,C);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case L_:return y=y.get(k.key===null?x:k.key)||null,c(w,y,k,C);case Nw:return y=y.get(k.key===null?x:k.key)||null,u(w,y,k,C);case Yf:return k=o0(k),p(y,w,x,k,C)}if(Mw(k)||Qy(k))return y=y.get(x)||null,d(w,y,k,C,null);if(typeof k.then=="function")return p(y,w,x,q_(k),C);if(k.$$typeof===Oh)return p(y,w,x,H_(w,k),C);U_(w,k)}return null}function g(y,w,x,k){for(var C=null,T=null,_=w,S=w=0,R=null;_!==null&&S<x.length;S++){_.index>S?(R=_,_=null):R=_.sibling;var A=m(y,_,x[S],k);if(A===null){_===null&&(_=R);break}e&&_&&A.alternate===null&&t(y,_),w=i(A,w,S),T===null?C=A:T.sibling=A,T=A,_=R}if(S===x.length)return n(y,_),hr&&Mh(y,S),C;if(_===null){for(;S<x.length;S++)_=f(y,x[S],k),_!==null&&(w=i(_,w,S),T===null?C=_:T.sibling=_,T=_);return hr&&Mh(y,S),C}for(_=s(_);S<x.length;S++)R=p(_,y,S,x[S],k),R!==null&&(e&&R.alternate!==null&&_.delete(R.key===null?S:R.key),w=i(R,w,S),T===null?C=R:T.sibling=R,T=R);return e&&_.forEach(function(O){return t(y,O)}),hr&&Mh(y,S),C}function b(y,w,x,k){if(x==null)throw Error(pt(151));for(var C=null,T=null,_=w,S=w=0,R=null,A=x.next();_!==null&&!A.done;S++,A=x.next()){_.index>S?(R=_,_=null):R=_.sibling;var O=m(y,_,A.value,k);if(O===null){_===null&&(_=R);break}e&&_&&O.alternate===null&&t(y,_),w=i(O,w,S),T===null?C=O:T.sibling=O,T=O,_=R}if(A.done)return n(y,_),hr&&Mh(y,S),C;if(_===null){for(;!A.done;S++,A=x.next())A=f(y,A.value,k),A!==null&&(w=i(A,w,S),T===null?C=A:T.sibling=A,T=A);return hr&&Mh(y,S),C}for(_=s(_);!A.done;S++,A=x.next())A=p(_,y,S,A.value,k),A!==null&&(e&&A.alternate!==null&&_.delete(A.key===null?S:A.key),w=i(A,w,S),T===null?C=A:T.sibling=A,T=A);return e&&_.forEach(function(M){return t(y,M)}),hr&&Mh(y,S),C}function v(y,w,x,k){if(typeof x=="object"&&x!==null&&x.type===S1&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case L_:e:{for(var C=x.key;w!==null;){if(w.key===C){if(C=x.type,C===S1){if(w.tag===7){n(y,w.sibling),k=r(w,x.props.children),k.return=y,y=k;break e}}else if(w.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Yf&&o0(C)===w.type){n(y,w.sibling),k=r(w,x.props),ew(k,x),k.return=y,y=k;break e}n(y,w);break}else t(y,w);w=w.sibling}x.type===S1?(k=E0(x.props.children,y.mode,k,x.key),k.return=y,y=k):(k=I2(x.type,x.key,x.props,null,y.mode,k),ew(k,x),k.return=y,y=k)}return o(y);case Nw:e:{for(C=x.key;w!==null;){if(w.key===C)if(w.tag===4&&w.stateNode.containerInfo===x.containerInfo&&w.stateNode.implementation===x.implementation){n(y,w.sibling),k=r(w,x.children||[]),k.return=y,y=k;break e}else{n(y,w);break}else t(y,w);w=w.sibling}k=Y6(x,y.mode,k),k.return=y,y=k}return o(y);case Yf:return x=o0(x),v(y,w,x,k)}if(Mw(x))return g(y,w,x,k);if(Qy(x)){if(C=Qy(x),typeof C!="function")throw Error(pt(150));return x=C.call(x),b(y,w,x,k)}if(typeof x.then=="function")return v(y,w,q_(x),k);if(x.$$typeof===Oh)return v(y,w,H_(y,x),k);U_(y,x)}return typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint"?(x=""+x,w!==null&&w.tag===6?(n(y,w.sibling),k=r(w,x),k.return=y,y=k):(n(y,w),k=K6(x,y.mode,k),k.return=y,y=k),o(y)):n(y,w)}return function(y,w,x,k){try{Fv=0;var C=v(y,w,x,k);return K1=null,C}catch(_){if(_===Kb||_===H3)throw _;var T=vc(29,_,null,y.mode);return T.lanes=k,T.return=y,T}finally{}}}var O0=ZK(!0),eY=ZK(!1),Xf=!1;function L9(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Rj(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 Sm(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Cm(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,Rr&2){var r=s.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),s.pending=t,t=M4(e),WK(e,null,n),t}return F3(e,s,t,n),M4(e)}function sv(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,yK(e,n)}}function Q6(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 Dj=!1;function rv(){if(Dj){var e=G1;if(e!==null)throw e}}function iv(e,t,n,s){Dj=!1;var r=e.updateQueue;Xf=!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 f=r.baseState;o=0,d=u=c=null,a=i;do{var m=a.lane&-536870913,p=m!==a.lane;if(p?(or&m)===m:(s&m)===m){m!==0&&m===gb&&(Dj=!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"){f=g.call(v,f,m);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=b.payload,m=typeof g=="function"?g.call(v,f,m):g,m==null)break e;f=ji({},f,m);break e;case 2:Xf=!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=f):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=f),r.baseState=c,r.firstBaseUpdate=u,r.lastBaseUpdate=d,i===null&&(r.shared.lanes=0),Fm|=o,e.lanes=o,e.memoizedState=f}}function tY(e,t){if(typeof e!="function")throw Error(pt(191,e));e.call(t)}function nY(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)tY(n[e],t)}var bb=Gd(null),P4=Gd(0);function u$(e,t){e=cf,vi(P4,e),vi(bb,t),cf=e|t.baseLanes}function Pj(){vi(P4,cf),vi(bb,bb.current)}function O9(){cf=P4.current,fa(bb),fa(P4)}var Ic=Gd(null),pu=null;function nm(e){var t=e.alternate;vi(go,go.current&1),vi(Ic,e),pu===null&&(t===null||bb.current!==null||t.memoizedState!==null)&&(pu=e)}function Lj(e){vi(go,go.current),vi(Ic,e),pu===null&&(pu=e)}function sY(e){e.tag===22?(vi(go,go.current),vi(Ic,e),pu===null&&(pu=e)):sm()}function sm(){vi(go,go.current),vi(Ic,Ic.current)}function yc(e){fa(Ic),pu===e&&(pu=null),fa(go)}var go=Gd(0);function L4(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||tA(n)||nA(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 of=0,Is=null,Zr=null,To=null,O4=!1,Y1=!1,$0=!1,$4=0,Hv=0,X1=null,Lme=0;function Zi(){throw Error(pt(321))}function $9(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Mc(e[n],t[n]))return!1;return!0}function B9(e,t,n,s,r,i){return of=i,Is=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ms.H=e===null||e.memoizedState===null?DY:X9,$0=!1,i=n(s,r),$0=!1,Y1&&(i=iY(t,n,s,r)),rY(e),i}function rY(e){ms.H=qv;var t=Zr!==null&&Zr.next!==null;if(of=0,To=Zr=Is=null,O4=!1,Hv=0,X1=null,t)throw Error(pt(300));e===null||Mo||(e=e.dependencies,e!==null&&R4(e)&&(Mo=!0))}function iY(e,t,n,s){Is=e;var r=0;do{if(Y1&&(X1=null),Hv=0,Y1=!1,25<=r)throw Error(pt(301));if(r+=1,To=Zr=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}ms.H=PY,i=t(n,s)}while(Y1);return i}function Ome(){var e=ms.H,t=e.useState()[0];return t=typeof t.then=="function"?Jx(t):t,e=e.useState()[0],(Zr!==null?Zr.memoizedState:null)!==e&&(Is.flags|=1024),t}function z9(){var e=$4!==0;return $4=0,e}function F9(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function H9(e){if(O4){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}O4=!1}of=0,To=Zr=Is=null,Y1=!1,Hv=$4=0,X1=null}function cl(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return To===null?Is.memoizedState=To=e:To=To.next=e,To}function wo(){if(Zr===null){var e=Is.alternate;e=e!==null?e.memoizedState:null}else e=Zr.next;var t=To===null?Is.memoizedState:To.next;if(t!==null)To=t,Zr=e;else{if(e===null)throw Is.alternate===null?Error(pt(467)):Error(pt(310));Zr=e,e={memoizedState:Zr.memoizedState,baseState:Zr.baseState,baseQueue:Zr.baseQueue,queue:Zr.queue,next:null},To===null?Is.memoizedState=To=e:To=To.next=e}return To}function q3(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Jx(e){var t=Hv;return Hv+=1,X1===null&&(X1=[]),e=JK(X1,e,t),t=Is,(To===null?t.memoizedState:To.next)===null&&(t=t.alternate,ms.H=t===null||t.memoizedState===null?DY:X9),e}function U3(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Jx(e);if(e.$$typeof===Oh)return Aa(e)}throw Error(pt(438,String(e)))}function q9(e){var t=null,n=Is.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=Is.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=q3(),Is.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]=kfe;return t.index++,n}function af(e,t){return typeof t=="function"?t(e):t}function D2(e){var t=wo();return U9(t,Zr,e)}function U9(e,t,n){var s=e.queue;if(s===null)throw Error(pt(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 f=u.lane&-536870913;if(f!==u.lane?(or&f)===f:(of&f)===f){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}),f===gb&&(d=!0);else if((of&m)===m){u=u.next,m===gb&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},c===null?(a=c=f,o=i):c=c.next=f,Is.lanes|=m,Fm|=m;f=u.action,$0&&n(i,f),i=u.hasEagerState?u.eagerState:n(i,f)}else m={lane:f,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,Is.lanes|=f,Fm|=f;u=u.next}while(u!==null&&u!==t);if(c===null?o=i:c.next=a,!Mc(i,e.memoizedState)&&(Mo=!0,d&&(n=G1,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 J6(e){var t=wo(),n=t.queue;if(n===null)throw Error(pt(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);Mc(i,t.memoizedState)||(Mo=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,s]}function oY(e,t,n){var s=Is,r=wo(),i=hr;if(i){if(n===void 0)throw Error(pt(407));n=n()}else n=t();var o=!Mc((Zr||r).memoizedState,n);if(o&&(r.memoizedState=n,Mo=!0),r=r.queue,W9(cY.bind(null,s,r,e),[e]),r.getSnapshot!==t||o||To!==null&&To.memoizedState.tag&1){if(s.flags|=2048,yb(9,{destroy:void 0},lY.bind(null,s,r,n,t),null),hi===null)throw Error(pt(349));i||of&127||aY(s,t,n)}return n}function aY(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Is.updateQueue,t===null?(t=q3(),Is.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function lY(e,t,n,s){t.value=n,t.getSnapshot=s,uY(t)&&dY(e)}function cY(e,t,n){return n(function(){uY(t)&&dY(e)})}function uY(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Mc(e,n)}catch{return!0}}function dY(e){var t=ag(e,2);t!==null&&Xl(t,e,2)}function Oj(e){var t=cl();if(typeof e=="function"){var n=e;if(e=n(),$0){am(!0);try{n()}finally{am(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:af,lastRenderedState:e},t}function hY(e,t,n,s){return e.baseState=n,U9(e,Zr,typeof s=="function"?s:af)}function $me(e,t,n,s,r){if(V3(e))throw Error(pt(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)}};ms.T!==null?n(!0):i.isTransition=!1,s(i),n=t.pending,n===null?(i.next=t.pending=i,fY(t,i)):(i.next=n.next,t.pending=n.next=i)}}function fY(e,t){var n=t.action,s=t.payload,r=e.state;if(t.isTransition){var i=ms.T,o={};ms.T=o;try{var a=n(r,s),c=ms.S;c!==null&&c(o,a),d$(e,t,a)}catch(u){$j(e,t,u)}finally{i!==null&&o.types!==null&&(i.types=o.types),ms.T=i}}else try{i=n(r,s),d$(e,t,i)}catch(u){$j(e,t,u)}}function d$(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){h$(e,t,s)},function(s){return $j(e,t,s)}):h$(e,t,n)}function h$(e,t,n){t.status="fulfilled",t.value=n,mY(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,fY(e,n)))}function $j(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,mY(t),t=t.next;while(t!==s)}e.action=null}function mY(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function pY(e,t){return t}function f$(e,t){if(hr){var n=hi.formState;if(n!==null){e:{var s=Is;if(hr){if(Ci){t:{for(var r=Ci,i=cu;r.nodeType!==8;){if(!i){r=null;break t}if(r=gu(r.nextSibling),r===null){r=null;break t}}i=r.data,r=i==="F!"||i==="F"?r:null}if(r){Ci=gu(r.nextSibling),s=r.data==="F!";break e}}Bm(s)}s=!1}s&&(t=n[0])}}return n=cl(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pY,lastRenderedState:t},n.queue=s,n=MY.bind(null,Is,s),s.dispatch=n,s=Oj(!1),i=Y9.bind(null,Is,!1,s.queue),s=cl(),r={state:t,dispatch:null,action:e,pending:null},s.queue=r,n=$me.bind(null,Is,r,i,n),r.dispatch=n,s.memoizedState=e,[t,n,!1]}function m$(e){var t=wo();return gY(t,Zr,e)}function gY(e,t,n){if(t=U9(e,t,pY)[0],e=D2(af)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Jx(t)}catch(o){throw o===Kb?H3:o}else s=t;t=wo();var r=t.queue,i=r.dispatch;return n!==t.memoizedState&&(Is.flags|=2048,yb(9,{destroy:void 0},Bme.bind(null,r,n),null)),[s,i,e]}function Bme(e,t){e.action=t}function p$(e){var t=wo(),n=Zr;if(n!==null)return gY(t,n,e);wo(),t=t.memoizedState,n=wo();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function yb(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=Is.updateQueue,t===null&&(t=q3(),Is.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 bY(){return wo().memoizedState}function P2(e,t,n,s){var r=cl();Is.flags|=e,r.memoizedState=yb(1|t,{destroy:void 0},n,s===void 0?null:s)}function W3(e,t,n,s){var r=wo();s=s===void 0?null:s;var i=r.memoizedState.inst;Zr!==null&&s!==null&&$9(s,Zr.memoizedState.deps)?r.memoizedState=yb(t,i,n,s):(Is.flags|=e,r.memoizedState=yb(1|t,i,n,s))}function g$(e,t){P2(8390656,8,e,t)}function W9(e,t){W3(2048,8,e,t)}function zme(e){Is.flags|=4;var t=Is.updateQueue;if(t===null)t=q3(),Is.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function yY(e){var t=wo().memoizedState;return zme({ref:t,nextImpl:e}),function(){if(Rr&2)throw Error(pt(440));return t.impl.apply(void 0,arguments)}}function wY(e,t){return W3(4,2,e,t)}function vY(e,t){return W3(4,4,e,t)}function xY(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 kY(e,t,n){n=n!=null?n.concat([e]):null,W3(4,4,xY.bind(null,t,e),n)}function V9(){}function _Y(e,t){var n=wo();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&$9(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function SY(e,t){var n=wo();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&$9(t,s[1]))return s[0];if(s=e(),$0){am(!0);try{e()}finally{am(!1)}}return n.memoizedState=[s,t],s}function G9(e,t,n){return n===void 0||of&1073741824&&!(or&261930)?e.memoizedState=t:(e.memoizedState=n,e=hX(),Is.lanes|=e,Fm|=e,n)}function CY(e,t,n,s){return Mc(n,t)?n:bb.current!==null?(e=G9(e,n,s),Mc(e,t)||(Mo=!0),e):!(of&42)||of&1073741824&&!(or&261930)?(Mo=!0,e.memoizedState=n):(e=hX(),Is.lanes|=e,Fm|=e,t)}function TY(e,t,n,s,r){var i=Lr.p;Lr.p=i!==0&&8>i?i:8;var o=ms.T,a={};ms.T=a,Y9(e,!1,t,n);try{var c=r(),u=ms.S;if(u!==null&&u(a,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=Pme(c,s);ov(e,t,d,jc(e))}else ov(e,t,s,jc(e))}catch(f){ov(e,t,{then:function(){},status:"rejected",reason:f},jc())}finally{Lr.p=i,o!==null&&a.types!==null&&(o.types=a.types),ms.T=o}}function Fme(){}function Bj(e,t,n,s){if(e.tag!==5)throw Error(pt(476));var r=EY(e).queue;TY(e,r,t,T0,n===null?Fme:function(){return jY(e),n(s)})}function EY(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:T0,baseState:T0,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:af,lastRenderedState:T0},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:af,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function jY(e){var t=EY(e);t.next===null&&(t=e.alternate.memoizedState),ov(e,t.next.queue,{},jc())}function K9(){return Aa(Vv)}function AY(){return wo().memoizedState}function NY(){return wo().memoizedState}function Hme(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=jc();e=Sm(n);var s=Cm(t,e,n);s!==null&&(Xl(s,t,n),sv(s,t,n)),t={cache:R9()},e.payload=t;return}t=t.return}}function qme(e,t,n){var s=jc();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},V3(e)?IY(t,n):(n=A9(e,t,n,s),n!==null&&(Xl(n,e,s),RY(n,t,s)))}function MY(e,t,n){var s=jc();ov(e,t,n,s)}function ov(e,t,n,s){var r={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(V3(e))IY(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,Mc(a,o))return F3(e,t,r,0),hi===null&&z3(),!1}catch{}finally{}if(n=A9(e,t,r,s),n!==null)return Xl(n,e,s),RY(n,t,s),!0}return!1}function Y9(e,t,n,s){if(s={lane:2,revertLane:rI(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},V3(e)){if(t)throw Error(pt(479))}else t=A9(e,n,s,2),t!==null&&Xl(t,e,2)}function V3(e){var t=e.alternate;return e===Is||t!==null&&t===Is}function IY(e,t){Y1=O4=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function RY(e,t,n){if(n&4194048){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,yK(e,n)}}var qv={readContext:Aa,use:U3,useCallback:Zi,useContext:Zi,useEffect:Zi,useImperativeHandle:Zi,useLayoutEffect:Zi,useInsertionEffect:Zi,useMemo:Zi,useReducer:Zi,useRef:Zi,useState:Zi,useDebugValue:Zi,useDeferredValue:Zi,useTransition:Zi,useSyncExternalStore:Zi,useId:Zi,useHostTransitionStatus:Zi,useFormState:Zi,useActionState:Zi,useOptimistic:Zi,useMemoCache:Zi,useCacheRefresh:Zi};qv.useEffectEvent=Zi;var DY={readContext:Aa,use:U3,useCallback:function(e,t){return cl().memoizedState=[e,t===void 0?null:t],e},useContext:Aa,useEffect:g$,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,P2(4194308,4,xY.bind(null,t,e),n)},useLayoutEffect:function(e,t){return P2(4194308,4,e,t)},useInsertionEffect:function(e,t){P2(4,2,e,t)},useMemo:function(e,t){var n=cl();t=t===void 0?null:t;var s=e();if($0){am(!0);try{e()}finally{am(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=cl();if(n!==void 0){var r=n(t);if($0){am(!0);try{n(t)}finally{am(!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=qme.bind(null,Is,e),[s.memoizedState,e]},useRef:function(e){var t=cl();return e={current:e},t.memoizedState=e},useState:function(e){e=Oj(e);var t=e.queue,n=MY.bind(null,Is,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:V9,useDeferredValue:function(e,t){var n=cl();return G9(n,e,t)},useTransition:function(){var e=Oj(!1);return e=TY.bind(null,Is,e.queue,!0,!1),cl().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=Is,r=cl();if(hr){if(n===void 0)throw Error(pt(407));n=n()}else{if(n=t(),hi===null)throw Error(pt(349));or&127||aY(s,t,n)}r.memoizedState=n;var i={value:n,getSnapshot:t};return r.queue=i,g$(cY.bind(null,s,i,e),[e]),s.flags|=2048,yb(9,{destroy:void 0},lY.bind(null,s,i,n,t),null),n},useId:function(){var e=cl(),t=hi.identifierPrefix;if(hr){var n=Nd,s=Ad;n=(s&~(1<<32-Ec(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=$4++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Lme++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:K9,useFormState:f$,useActionState:f$,useOptimistic:function(e){var t=cl();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Y9.bind(null,Is,!0,n),n.dispatch=t,[e,t]},useMemoCache:q9,useCacheRefresh:function(){return cl().memoizedState=Hme.bind(null,Is)},useEffectEvent:function(e){var t=cl(),n={impl:e};return t.memoizedState=n,function(){if(Rr&2)throw Error(pt(440));return n.impl.apply(void 0,arguments)}}},X9={readContext:Aa,use:U3,useCallback:_Y,useContext:Aa,useEffect:W9,useImperativeHandle:kY,useInsertionEffect:wY,useLayoutEffect:vY,useMemo:SY,useReducer:D2,useRef:bY,useState:function(){return D2(af)},useDebugValue:V9,useDeferredValue:function(e,t){var n=wo();return CY(n,Zr.memoizedState,e,t)},useTransition:function(){var e=D2(af)[0],t=wo().memoizedState;return[typeof e=="boolean"?e:Jx(e),t]},useSyncExternalStore:oY,useId:AY,useHostTransitionStatus:K9,useFormState:m$,useActionState:m$,useOptimistic:function(e,t){var n=wo();return hY(n,Zr,e,t)},useMemoCache:q9,useCacheRefresh:NY};X9.useEffectEvent=yY;var PY={readContext:Aa,use:U3,useCallback:_Y,useContext:Aa,useEffect:W9,useImperativeHandle:kY,useInsertionEffect:wY,useLayoutEffect:vY,useMemo:SY,useReducer:J6,useRef:bY,useState:function(){return J6(af)},useDebugValue:V9,useDeferredValue:function(e,t){var n=wo();return Zr===null?G9(n,e,t):CY(n,Zr.memoizedState,e,t)},useTransition:function(){var e=J6(af)[0],t=wo().memoizedState;return[typeof e=="boolean"?e:Jx(e),t]},useSyncExternalStore:oY,useId:AY,useHostTransitionStatus:K9,useFormState:p$,useActionState:p$,useOptimistic:function(e,t){var n=wo();return Zr!==null?hY(n,Zr,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:q9,useCacheRefresh:NY};PY.useEffectEvent=yY;function Z6(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:ji({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var zj={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=jc(),r=Sm(s);r.payload=t,n!=null&&(r.callback=n),t=Cm(e,r,s),t!==null&&(Xl(t,e,s),sv(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=jc(),r=Sm(s);r.tag=1,r.payload=t,n!=null&&(r.callback=n),t=Cm(e,r,s),t!==null&&(Xl(t,e,s),sv(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=jc(),s=Sm(n);s.tag=2,t!=null&&(s.callback=t),t=Cm(e,s,n),t!==null&&(Xl(t,e,n),sv(t,e,n))}};function b$(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?!$v(n,s)||!$v(r,i):!0}function y$(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&&zj.enqueueReplaceState(t,t.state,null)}function B0(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=ji({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}function LY(e){N4(e)}function OY(e){console.error(e)}function $Y(e){N4(e)}function B4(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function w$(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 Fj(e,t,n){return n=Sm(n),n.tag=3,n.payload={element:null},n.callback=function(){B4(e,t)},n}function BY(e){return e=Sm(e),e.tag=3,e}function zY(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(){w$(t,n,s)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){w$(t,n,s),typeof r!="function"&&(Tm===null?Tm=new Set([this]):Tm.add(this));var a=s.stack;this.componentDidCatch(s.value,{componentStack:a!==null?a:""})})}function Ume(e,t,n,s,r){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&Gb(t,n,r,!0),n=Ic.current,n!==null){switch(n.tag){case 31:case 13:return pu===null?U4():n.alternate===null&&so===0&&(so=3),n.flags&=-257,n.flags|=65536,n.lanes=r,s===D4?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),u8(e,s,r)),!1;case 22:return n.flags|=65536,s===D4?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)),u8(e,s,r)),!1}throw Error(pt(435,n.tag))}return u8(e,s,r),U4(),!1}if(hr)return t=Ic.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=r,s!==jj&&(e=Error(pt(422),{cause:s}),zv(lu(e,n)))):(s!==jj&&(t=Error(pt(423),{cause:s}),zv(lu(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,s=lu(s,n),r=Fj(e.stateNode,s,r),Q6(e,r),so!==4&&(so=2)),!1;var i=Error(pt(520),{cause:s});if(i=lu(i,n),cv===null?cv=[i]:cv.push(i),so!==4&&(so=2),t===null)return!0;s=lu(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=Fj(n.stateNode,s,e),Q6(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"&&(Tm===null||!Tm.has(i))))return n.flags|=65536,r&=-r,n.lanes|=r,r=BY(r),zY(r,e,n,s),Q6(n,r),!1}n=n.return}while(n!==null);return!1}var Q9=Error(pt(461)),Mo=!1;function xa(e,t,n,s){t.child=e===null?eY(t,null,n,s):O0(t,e.child,n,s)}function v$(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 L0(t),s=B9(e,t,n,o,i,r),a=z9(),e!==null&&!Mo?(F9(e,t,r),lf(e,t,r)):(hr&&a&&M9(t),t.flags|=1,xa(e,t,s,r),t.child)}function x$(e,t,n,s,r){if(e===null){var i=n.type;return typeof i=="function"&&!N9(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,FY(e,t,i,s,r)):(e=I2(n.type,null,s,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!J9(e,r)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:$v,n(o,s)&&e.ref===t.ref)return lf(e,t,r)}return t.flags|=1,e=Vh(i,s),e.ref=t.ref,e.return=t,t.child=e}function FY(e,t,n,s,r){if(e!==null){var i=e.memoizedProps;if($v(i,s)&&e.ref===t.ref)if(Mo=!1,t.pendingProps=s=i,J9(e,r))e.flags&131072&&(Mo=!0);else return t.lanes=e.lanes,lf(e,t,r)}return Hj(e,t,n,s,r)}function HY(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 k$(e,t,i,n,s)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&R2(t,i!==null?i.cachePool:null),i!==null?u$(t,i):Pj(),sY(t);else return s=t.lanes=536870912,k$(e,t,i!==null?i.baseLanes|n:n,n,s)}else i!==null?(R2(t,i.cachePool),u$(t,i),sm(),t.memoizedState=null):(e!==null&&R2(t,null),Pj(),sm());return xa(e,t,r,n),t.child}function Rw(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function k$(e,t,n,s,r){var i=D9();return i=i===null?null:{parent:jo._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&R2(t,null),Pj(),sY(t),e!==null&&Gb(e,t,s,!0),t.childLanes=r,null}function L2(e,t){return t=z4({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function _$(e,t,n){return O0(t,e.child,null,n),e=L2(t,t.pendingProps),e.flags|=2,yc(t),t.memoizedState=null,e}function Wme(e,t,n){var s=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(hr){if(s.mode==="hidden")return e=L2(t,s),t.lanes=536870912,Rw(null,e);if(Lj(t),(e=Ci)?(e=DX(e,cu),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:$m!==null?{id:Ad,overflow:Nd}:null,retryLane:536870912,hydrationErrors:null},n=GK(e),n.return=t,t.child=n,Ea=t,Ci=null)):e=null,e===null)throw Bm(t);return t.lanes=536870912,null}return L2(t,s)}var i=e.memoizedState;if(i!==null){var o=i.dehydrated;if(Lj(t),r)if(t.flags&256)t.flags&=-257,t=_$(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(pt(558));else if(Mo||Gb(e,t,n,!1),r=(n&e.childLanes)!==0,Mo||r){if(s=hi,s!==null&&(o=wK(s,n),o!==0&&o!==i.retryLane))throw i.retryLane=o,ag(e,o),Xl(s,e,o),Q9;U4(),t=_$(e,t,n)}else e=i.treeContext,Ci=gu(o.nextSibling),Ea=t,hr=!0,_m=null,cu=!1,e!==null&&YK(t,e),t=L2(t,s),t.flags|=4096;return t}return e=Vh(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function O2(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(pt(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Hj(e,t,n,s,r){return L0(t),n=B9(e,t,n,s,void 0,r),s=z9(),e!==null&&!Mo?(F9(e,t,r),lf(e,t,r)):(hr&&s&&M9(t),t.flags|=1,xa(e,t,n,r),t.child)}function S$(e,t,n,s,r,i){return L0(t),t.updateQueue=null,n=iY(t,s,n,r),rY(e),s=z9(),e!==null&&!Mo?(F9(e,t,i),lf(e,t,i)):(hr&&s&&M9(t),t.flags|=1,xa(e,t,n,i),t.child)}function C$(e,t,n,s,r){if(L0(t),t.stateNode===null){var i=I1,o=n.contextType;typeof o=="object"&&o!==null&&(i=Aa(o)),i=new n(s,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=zj,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=s,i.state=t.memoizedState,i.refs={},L9(t),o=n.contextType,i.context=typeof o=="object"&&o!==null?Aa(o):I1,i.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o=="function"&&(Z6(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&&zj.enqueueReplaceState(i,i.state,null),iv(t,s,i,r),rv(),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=B0(n,a);i.props=c;var u=i.context,d=n.contextType;o=I1,typeof d=="object"&&d!==null&&(o=Aa(d));var f=n.getDerivedStateFromProps;d=typeof f=="function"||typeof i.getSnapshotBeforeUpdate=="function",a=t.pendingProps!==a,d||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a||u!==o)&&y$(t,i,s,o),Xf=!1;var m=t.memoizedState;i.state=m,iv(t,s,i,r),rv(),u=t.memoizedState,a||m!==u||Xf?(typeof f=="function"&&(Z6(t,n,f,s),u=t.memoizedState),(c=Xf||b$(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,Rj(e,t),o=t.memoizedProps,d=B0(n,o),i.props=d,f=t.pendingProps,m=i.context,u=n.contextType,c=I1,typeof u=="object"&&u!==null&&(c=Aa(u)),a=n.getDerivedStateFromProps,(u=typeof a=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o!==f||m!==c)&&y$(t,i,s,c),Xf=!1,m=t.memoizedState,i.state=m,iv(t,s,i,r),rv();var p=t.memoizedState;o!==f||m!==p||Xf||e!==null&&e.dependencies!==null&&R4(e.dependencies)?(typeof a=="function"&&(Z6(t,n,a,s),p=t.memoizedState),(d=Xf||b$(t,n,d,s,m,p,c)||e!==null&&e.dependencies!==null&&R4(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,O2(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=O0(t,e.child,null,r),t.child=O0(t,null,n,r)):xa(e,t,n,r),t.memoizedState=i.state,e=t.child):e=lf(e,t,r),e}function T$(e,t,n,s){return P0(),t.flags|=256,xa(e,t,n,s),t.child}var e8={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function t8(e){return{baseLanes:e,cachePool:QK()}}function n8(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=kc),e}function qY(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:(go.current&2)!==0),o&&(r=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(hr){if(r?nm(t):sm(),(e=Ci)?(e=DX(e,cu),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:$m!==null?{id:Ad,overflow:Nd}:null,retryLane:536870912,hydrationErrors:null},n=GK(e),n.return=t,t.child=n,Ea=t,Ci=null)):e=null,e===null)throw Bm(t);return nA(e)?t.lanes=32:t.lanes=536870912,null}var a=s.children;return s=s.fallback,r?(sm(),r=t.mode,a=z4({mode:"hidden",children:a},r),s=E0(s,r,n,null),a.return=t,s.return=t,a.sibling=s,t.child=a,s=t.child,s.memoizedState=t8(n),s.childLanes=n8(e,o,n),t.memoizedState=e8,Rw(null,s)):(nm(t),qj(t,a))}var c=e.memoizedState;if(c!==null&&(a=c.dehydrated,a!==null)){if(i)t.flags&256?(nm(t),t.flags&=-257,t=s8(e,t,n)):t.memoizedState!==null?(sm(),t.child=e.child,t.flags|=128,t=null):(sm(),a=s.fallback,r=t.mode,s=z4({mode:"visible",children:s.children},r),a=E0(a,r,n,null),a.flags|=2,s.return=t,a.return=t,s.sibling=a,t.child=s,O0(t,e.child,null,n),s=t.child,s.memoizedState=t8(n),s.childLanes=n8(e,o,n),t.memoizedState=e8,t=Rw(null,s));else if(nm(t),nA(a)){if(o=a.nextSibling&&a.nextSibling.dataset,o)var u=o.dgst;o=u,s=Error(pt(419)),s.stack="",s.digest=o,zv({value:s,source:null,stack:null}),t=s8(e,t,n)}else if(Mo||Gb(e,t,n,!1),o=(n&e.childLanes)!==0,Mo||o){if(o=hi,o!==null&&(s=wK(o,n),s!==0&&s!==c.retryLane))throw c.retryLane=s,ag(e,s),Xl(o,e,s),Q9;tA(a)||U4(),t=s8(e,t,n)}else tA(a)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,Ci=gu(a.nextSibling),Ea=t,hr=!0,_m=null,cu=!1,e!==null&&YK(t,e),t=qj(t,s.children),t.flags|=4096);return t}return r?(sm(),a=s.fallback,r=t.mode,c=e.child,u=c.sibling,s=Vh(c,{mode:"hidden",children:s.children}),s.subtreeFlags=c.subtreeFlags&65011712,u!==null?a=Vh(u,a):(a=E0(a,r,n,null),a.flags|=2),a.return=t,s.return=t,s.sibling=a,t.child=s,Rw(null,s),s=t.child,a=e.child.memoizedState,a===null?a=t8(n):(r=a.cachePool,r!==null?(c=jo._currentValue,r=r.parent!==c?{parent:c,pool:c}:r):r=QK(),a={baseLanes:a.baseLanes|n,cachePool:r}),s.memoizedState=a,s.childLanes=n8(e,o,n),t.memoizedState=e8,Rw(e.child,s)):(nm(t),n=e.child,e=n.sibling,n=Vh(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 qj(e,t){return t=z4({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function z4(e,t){return e=vc(22,e,null,t),e.lanes=0,e}function s8(e,t,n){return O0(t,e.child,null,n),e=qj(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function E$(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Nj(e.return,t,n)}function r8(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 UY(e,t,n){var s=t.pendingProps,r=s.revealOrder,i=s.tail;s=s.children;var o=go.current,a=(o&2)!==0;if(a?(o=o&1|2,t.flags|=128):o&=1,vi(go,o),xa(e,t,s,n),s=hr?Bv:0,!a&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&E$(e,n,t);else if(e.tag===19)E$(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&&L4(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),r8(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&&L4(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}r8(t,!0,n,null,i,s);break;case"together":r8(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function lf(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Fm|=t.lanes,!(n&t.childLanes))if(e!==null){if(Gb(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(pt(153));if(t.child!==null){for(e=t.child,n=Vh(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Vh(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function J9(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&R4(e)))}function Vme(e,t,n){switch(t.tag){case 3:T4(t,t.stateNode.containerInfo),tm(t,jo,e.memoizedState.cache),P0();break;case 27:case 5:bj(t);break;case 4:T4(t,t.stateNode.containerInfo);break;case 10:tm(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Lj(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(nm(t),t.flags|=128,null):n&t.child.childLanes?qY(e,t,n):(nm(t),e=lf(e,t,n),e!==null?e.sibling:null);nm(t);break;case 19:var r=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(Gb(e,t,n,!1),s=(n&t.childLanes)!==0),r){if(s)return UY(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),vi(go,go.current),s)break;return null;case 22:return t.lanes=0,HY(e,t,n,t.pendingProps);case 24:tm(t,jo,e.memoizedState.cache)}return lf(e,t,n)}function WY(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Mo=!0;else{if(!J9(e,n)&&!(t.flags&128))return Mo=!1,Vme(e,t,n);Mo=!!(e.flags&131072)}else Mo=!1,hr&&t.flags&1048576&&KK(t,Bv,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=o0(t.elementType),t.type=e,typeof e=="function")N9(e)?(s=B0(e,s),t.tag=1,t=C$(null,t,e,s,n)):(t.tag=0,t=Hj(null,t,e,s,n));else{if(e!=null){var r=e.$$typeof;if(r===g9){t.tag=11,t=v$(null,t,e,s,n);break e}else if(r===b9){t.tag=14,t=x$(null,t,e,s,n);break e}}throw t=pj(e)||e,Error(pt(306,t,""))}}return t;case 0:return Hj(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,r=B0(s,t.pendingProps),C$(e,t,s,r,n);case 3:e:{if(T4(t,t.stateNode.containerInfo),e===null)throw Error(pt(387));s=t.pendingProps;var i=t.memoizedState;r=i.element,Rj(e,t),iv(t,s,null,n);var o=t.memoizedState;if(s=o.cache,tm(t,jo,s),s!==i.cache&&Mj(t,[jo],n,!0),rv(),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=T$(e,t,s,n);break e}else if(s!==r){r=lu(Error(pt(424)),t),zv(r),t=T$(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(Ci=gu(e.firstChild),Ea=t,hr=!0,_m=null,cu=!0,n=eY(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(P0(),s===r){t=lf(e,t,n);break e}xa(e,t,s,n)}t=t.child}return t;case 26:return O2(e,t),e===null?(n=G$(t.type,null,t.pendingProps,null))?t.memoizedState=n:hr||(n=t.type,e=t.pendingProps,s=K4(km.current).createElement(n),s[Ta]=t,s[Zl]=e,Ma(s,n,e),ua(s),t.stateNode=s):t.memoizedState=G$(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return bj(t),e===null&&hr&&(s=t.stateNode=PX(t.type,t.pendingProps,km.current),Ea=t,cu=!0,r=Ci,gp(t.type)?(sA=r,Ci=gu(s.firstChild)):Ci=r),xa(e,t,t.pendingProps.children,n),O2(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&hr&&((r=s=Ci)&&(s=kpe(s,t.type,t.pendingProps,cu),s!==null?(t.stateNode=s,Ea=t,Ci=gu(s.firstChild),cu=!1,r=!0):r=!1),r||Bm(t)),bj(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,Zj(r,i)?s=null:o!==null&&Zj(r,o)&&(t.flags|=32),t.memoizedState!==null&&(r=B9(e,t,Ome,null,null,n),Vv._currentValue=r),O2(e,t),xa(e,t,s,n),t.child;case 6:return e===null&&hr&&((e=n=Ci)&&(n=_pe(n,t.pendingProps,cu),n!==null?(t.stateNode=n,Ea=t,Ci=null,e=!0):e=!1),e||Bm(t)),null;case 13:return qY(e,t,n);case 4:return T4(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=O0(t,null,s,n):xa(e,t,s,n),t.child;case 11:return v$(e,t,t.type,t.pendingProps,n);case 7:return xa(e,t,t.pendingProps,n),t.child;case 8:return xa(e,t,t.pendingProps.children,n),t.child;case 12:return xa(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,tm(t,t.type,s.value),xa(e,t,s.children,n),t.child;case 9:return r=t.type._context,s=t.pendingProps.children,L0(t),r=Aa(r),s=s(r),t.flags|=1,xa(e,t,s,n),t.child;case 14:return x$(e,t,t.type,t.pendingProps,n);case 15:return FY(e,t,t.type,t.pendingProps,n);case 19:return UY(e,t,n);case 31:return Wme(e,t,n);case 22:return HY(e,t,n,t.pendingProps);case 24:return L0(t),s=Aa(jo),e===null?(r=D9(),r===null&&(r=hi,i=R9(),r.pooledCache=i,i.refCount++,i!==null&&(r.pooledCacheLanes|=n),r=i),t.memoizedState={parent:s,cache:r},L9(t),tm(t,jo,r)):(e.lanes&n&&(Rj(e,t),iv(t,null,null,n),rv()),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),tm(t,jo,s)):(s=i.cache,tm(t,jo,s),s!==r.cache&&Mj(t,[jo],n,!0))),xa(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(pt(156,t.tag))}function xh(e){e.flags|=4}function i8(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(pX())e.flags|=8192;else throw A0=D4,P9}else e.flags&=-16777217}function j$(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!$X(t))if(pX())e.flags|=8192;else throw A0=D4,P9}function W_(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?gK():536870912,e.lanes|=t,wb|=t)}function tw(e,t){if(!hr)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 Si(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 Gme(e,t,n){var s=t.pendingProps;switch(I9(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Si(t),null;case 1:return Si(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Gh(jo),fb(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Wg(t)?xh(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,X6())),Si(t),null;case 26:var r=t.type,i=t.memoizedState;return e===null?(xh(t),i!==null?(Si(t),j$(t,i)):(Si(t),i8(t,r,null,s,n))):i?i!==e.memoizedState?(xh(t),Si(t),j$(t,i)):(Si(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&xh(t),Si(t),i8(t,r,e,s,n)),null;case 27:if(E4(t),n=km.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&xh(t);else{if(!s){if(t.stateNode===null)throw Error(pt(166));return Si(t),null}e=zd.current,Wg(t)?s$(t):(e=PX(r,s,n),t.stateNode=e,xh(t))}return Si(t),null;case 5:if(E4(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&xh(t);else{if(!s){if(t.stateNode===null)throw Error(pt(166));return Si(t),null}if(i=zd.current,Wg(t))s$(t);else{var o=K4(km.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[Ta]=t,i[Zl]=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(Ma(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&&xh(t)}}return Si(t),i8(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&xh(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(pt(166));if(e=km.current,Wg(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,r=Ea,r!==null)switch(r.tag){case 27:case 5:s=r.memoizedProps}e[Ta]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||MX(e.nodeValue,n)),e||Bm(t,!0)}else e=K4(e).createTextNode(s),e[Ta]=t,t.stateNode=e}return Si(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=Wg(t),n!==null){if(e===null){if(!s)throw Error(pt(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(pt(557));e[Ta]=t}else P0(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Si(t),e=!1}else n=X6(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(yc(t),t):(yc(t),null);if(t.flags&128)throw Error(pt(558))}return Si(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Wg(t),s!==null&&s.dehydrated!==null){if(e===null){if(!r)throw Error(pt(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(pt(317));r[Ta]=t}else P0(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Si(t),r=!1}else r=X6(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(yc(t),t):(yc(t),null)}return yc(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),W_(t,t.updateQueue),Si(t),null);case 4:return fb(),e===null&&iI(t.stateNode.containerInfo),Si(t),null;case 10:return Gh(t.type),Si(t),null;case 19:if(fa(go),s=t.memoizedState,s===null)return Si(t),null;if(r=(t.flags&128)!==0,i=s.rendering,i===null)if(r)tw(s,!1);else{if(so!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=L4(e),i!==null){for(t.flags|=128,tw(s,!1),e=i.updateQueue,t.updateQueue=e,W_(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)VK(n,e),n=n.sibling;return vi(go,go.current&1|2),hr&&Mh(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Cc()>H4&&(t.flags|=128,r=!0,tw(s,!1),t.lanes=4194304)}else{if(!r)if(e=L4(i),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,W_(t,e),tw(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!hr)return Si(t),null}else 2*Cc()-s.renderingStartTime>H4&&n!==536870912&&(t.flags|=128,r=!0,tw(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=Cc(),e.sibling=null,n=go.current,vi(go,r?n&1|2:n&1),hr&&Mh(t,s.treeForkCount),e):(Si(t),null);case 22:case 23:return yc(t),O9(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?n&536870912&&!(t.flags&128)&&(Si(t),t.subtreeFlags&6&&(t.flags|=8192)):Si(t),n=t.updateQueue,n!==null&&W_(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&&fa(j0),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Gh(jo),Si(t),null;case 25:return null;case 30:return null}throw Error(pt(156,t.tag))}function Kme(e,t){switch(I9(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Gh(jo),fb(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return E4(t),null;case 31:if(t.memoizedState!==null){if(yc(t),t.alternate===null)throw Error(pt(340));P0()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(yc(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(pt(340));P0()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return fa(go),null;case 4:return fb(),null;case 10:return Gh(t.type),null;case 22:case 23:return yc(t),O9(),e!==null&&fa(j0),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Gh(jo),null;case 25:return null;default:return null}}function VY(e,t){switch(I9(t),t.tag){case 3:Gh(jo),fb();break;case 26:case 27:case 5:E4(t);break;case 4:fb();break;case 31:t.memoizedState!==null&&yc(t);break;case 13:yc(t);break;case 19:fa(go);break;case 10:Gh(t.type);break;case 22:case 23:yc(t),O9(),e!==null&&fa(j0);break;case 24:Gh(jo)}}function Zx(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){Gr(t,t.return,a)}}function zm(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){Gr(r,c,d)}}}s=s.next}while(s!==i)}}catch(d){Gr(t,t.return,d)}}function GY(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{nY(t,n)}catch(s){Gr(e,e.return,s)}}}function KY(e,t,n){n.props=B0(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){Gr(e,t,s)}}function av(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){Gr(e,t,r)}}function Md(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(r){Gr(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){Gr(e,t,r)}else n.current=null}function YY(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){Gr(e,e.return,r)}}function o8(e,t,n){try{var s=e.stateNode;gpe(s,e.type,n,t),s[Zl]=t}catch(r){Gr(e,e.return,r)}}function XY(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&gp(e.type)||e.tag===4}function a8(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||XY(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&&gp(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 Uj(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=$h));else if(s!==4&&(s===27&&gp(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Uj(e,t,n),e=e.sibling;e!==null;)Uj(e,t,n),e=e.sibling}function F4(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&&gp(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(F4(e,t,n),e=e.sibling;e!==null;)F4(e,t,n),e=e.sibling}function QY(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);Ma(t,s,n),t[Ta]=e,t[Zl]=n}catch(i){Gr(e,e.return,i)}}var Rh=!1,Eo=!1,l8=!1,A$=typeof WeakSet=="function"?WeakSet:Set,la=null;function Yme(e,t){if(e=e.containerInfo,Qj=J4,e=$K(e),E9(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,f=e,m=null;t:for(;;){for(var p;f!==n||r!==0&&f.nodeType!==3||(a=o+r),f!==i||s!==0&&f.nodeType!==3||(c=o+s),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)m=f,f=p;for(;;){if(f===e)break t;if(m===n&&++u===r&&(a=o),m===i&&++d===s&&(c=o),(p=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=p}n=a===-1||c===-1?null:{start:a,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Jj={focusedElem:e,selectionRange:n},J4=!1,la=t;la!==null;)if(t=la,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,la=e;else for(;la!==null;){switch(t=la,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=B0(n.type,r);e=s.getSnapshotBeforeUpdate(g,i),s.__reactInternalSnapshotBeforeUpdate=e}catch(b){Gr(n,n.return,b)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)eA(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":eA(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(pt(163))}if(e=t.sibling,e!==null){e.return=t.return,la=e;break}la=t.return}}function JY(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:_h(e,n),s&4&&Zx(5,n);break;case 1:if(_h(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(o){Gr(n,n.return,o)}else{var r=B0(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){Gr(n,n.return,o)}}s&64&&GY(n),s&512&&av(n,n.return);break;case 3:if(_h(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{nY(e,t)}catch(o){Gr(n,n.return,o)}}break;case 27:t===null&&s&4&&QY(n);case 26:case 5:_h(e,n),t===null&&s&4&&YY(n),s&512&&av(n,n.return);break;case 12:_h(e,n);break;case 31:_h(e,n),s&4&&tX(e,n);break;case 13:_h(e,n),s&4&&nX(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=rpe.bind(null,n),Spe(e,n))));break;case 22:if(s=n.memoizedState!==null||Rh,!s){t=t!==null&&t.memoizedState!==null||Eo,r=Rh;var i=Eo;Rh=s,(Eo=t)&&!i?Nh(e,n,(n.subtreeFlags&8772)!==0):_h(e,n),Rh=r,Eo=i}break;case 30:break;default:_h(e,n)}}function ZY(e){var t=e.alternate;t!==null&&(e.alternate=null,ZY(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&x9(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 Mi=null,zl=!1;function kh(e,t,n){for(n=n.child;n!==null;)eX(e,t,n),n=n.sibling}function eX(e,t,n){if(Tc&&typeof Tc.onCommitFiberUnmount=="function")try{Tc.onCommitFiberUnmount(Vx,n)}catch{}switch(n.tag){case 26:Eo||Md(n,t),kh(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Eo||Md(n,t);var s=Mi,r=zl;gp(n.type)&&(Mi=n.stateNode,zl=!1),kh(e,t,n),dv(n.stateNode),Mi=s,zl=r;break;case 5:Eo||Md(n,t);case 6:if(s=Mi,r=zl,Mi=null,kh(e,t,n),Mi=s,zl=r,Mi!==null)if(zl)try{(Mi.nodeType===9?Mi.body:Mi.nodeName==="HTML"?Mi.ownerDocument.body:Mi).removeChild(n.stateNode)}catch(i){Gr(n,t,i)}else try{Mi.removeChild(n.stateNode)}catch(i){Gr(n,t,i)}break;case 18:Mi!==null&&(zl?(e=Mi,H$(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),_b(e)):H$(Mi,n.stateNode));break;case 4:s=Mi,r=zl,Mi=n.stateNode.containerInfo,zl=!0,kh(e,t,n),Mi=s,zl=r;break;case 0:case 11:case 14:case 15:zm(2,n,t),Eo||zm(4,n,t),kh(e,t,n);break;case 1:Eo||(Md(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&KY(n,t,s)),kh(e,t,n);break;case 21:kh(e,t,n);break;case 22:Eo=(s=Eo)||n.memoizedState!==null,kh(e,t,n),Eo=s;break;default:kh(e,t,n)}}function tX(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{_b(e)}catch(n){Gr(t,t.return,n)}}}function nX(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{_b(e)}catch(n){Gr(t,t.return,n)}}function Xme(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new A$),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new A$),t;default:throw Error(pt(435,e.tag))}}function V_(e,t){var n=Xme(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var r=ipe.bind(null,e,s);s.then(r,r)}})}function Pl(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(gp(a.type)){Mi=a.stateNode,zl=!1;break e}break;case 5:Mi=a.stateNode,zl=!1;break e;case 3:case 4:Mi=a.stateNode.containerInfo,zl=!0;break e}a=a.return}if(Mi===null)throw Error(pt(160));eX(i,o,r),Mi=null,zl=!1,i=r.alternate,i!==null&&(i.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)sX(t,e),t=t.sibling}var Ru=null;function sX(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Pl(t,e),Ll(e),s&4&&(zm(3,e,e.return),Zx(3,e),zm(5,e,e.return));break;case 1:Pl(t,e),Ll(e),s&512&&(Eo||n===null||Md(n,n.return)),s&64&&Rh&&(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=Ru;if(Pl(t,e),Ll(e),s&512&&(Eo||n===null||Md(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[Yx]||i[Ta]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=r.createElement(s),r.head.insertBefore(i,r.querySelector("head > title"))),Ma(i,s,n),i[Ta]=e,ua(i),s=i;break e;case"link":var o=Y$("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),Ma(i,s,n),r.head.appendChild(i);break;case"meta":if(o=Y$("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),Ma(i,s,n),r.head.appendChild(i);break;default:throw Error(pt(468,s))}i[Ta]=e,ua(i),s=i}e.stateNode=s}else X$(r,e.type,e.stateNode);else e.stateNode=K$(r,s,e.memoizedProps);else i!==s?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,s===null?X$(r,e.type,e.stateNode):K$(r,s,e.memoizedProps)):s===null&&e.stateNode!==null&&o8(e,e.memoizedProps,n.memoizedProps)}break;case 27:Pl(t,e),Ll(e),s&512&&(Eo||n===null||Md(n,n.return)),n!==null&&s&4&&o8(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Pl(t,e),Ll(e),s&512&&(Eo||n===null||Md(n,n.return)),e.flags&32){r=e.stateNode;try{pb(r,"")}catch(g){Gr(e,e.return,g)}}s&4&&e.stateNode!=null&&(r=e.memoizedProps,o8(e,r,n!==null?n.memoizedProps:r)),s&1024&&(l8=!0);break;case 6:if(Pl(t,e),Ll(e),s&4){if(e.stateNode===null)throw Error(pt(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(g){Gr(e,e.return,g)}}break;case 3:if(z2=null,r=Ru,Ru=Y4(t.containerInfo),Pl(t,e),Ru=r,Ll(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{_b(t.containerInfo)}catch(g){Gr(e,e.return,g)}l8&&(l8=!1,rX(e));break;case 4:s=Ru,Ru=Y4(e.stateNode.containerInfo),Pl(t,e),Ll(e),Ru=s;break;case 12:Pl(t,e),Ll(e);break;case 31:Pl(t,e),Ll(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,V_(e,s)));break;case 13:Pl(t,e),Ll(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(G3=Cc()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,V_(e,s)));break;case 22:r=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,u=Rh,d=Eo;if(Rh=u||r,Eo=d||c,Pl(t,e),Eo=d,Rh=u,Ll(e),s&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(n===null||c||Rh||Eo||a0(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 f=c.memoizedProps.style,m=f!=null&&f.hasOwnProperty("display")?f.display:null;a.style.display=m==null||typeof m=="boolean"?"":(""+m).trim()}}catch(g){Gr(c,c.return,g)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=r?"":c.memoizedProps}catch(g){Gr(c,c.return,g)}}}else if(t.tag===18){if(n===null){c=t;try{var p=c.stateNode;r?q$(p,!0):q$(c.stateNode,!1)}catch(g){Gr(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,V_(e,n))));break;case 19:Pl(t,e),Ll(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,V_(e,s)));break;case 30:break;case 21:break;default:Pl(t,e),Ll(e)}}function Ll(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(XY(s)){n=s;break}s=s.return}if(n==null)throw Error(pt(160));switch(n.tag){case 27:var r=n.stateNode,i=a8(e);F4(e,i,r);break;case 5:var o=n.stateNode;n.flags&32&&(pb(o,""),n.flags&=-33);var a=a8(e);F4(e,a,o);break;case 3:case 4:var c=n.stateNode.containerInfo,u=a8(e);Uj(e,u,c);break;default:throw Error(pt(161))}}catch(d){Gr(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function rX(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;rX(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function _h(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)JY(e,t.alternate,t),t=t.sibling}function a0(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:zm(4,t,t.return),a0(t);break;case 1:Md(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&KY(t,t.return,n),a0(t);break;case 27:dv(t.stateNode);case 26:case 5:Md(t,t.return),a0(t);break;case 22:t.memoizedState===null&&a0(t);break;case 30:a0(t);break;default:a0(t)}e=e.sibling}}function Nh(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:Nh(r,i,n),Zx(4,i);break;case 1:if(Nh(r,i,n),s=i,r=s.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(u){Gr(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++)tY(c[r],a)}catch(u){Gr(s,s.return,u)}}n&&o&64&&GY(i),av(i,i.return);break;case 27:QY(i);case 26:case 5:Nh(r,i,n),n&&s===null&&o&4&&YY(i),av(i,i.return);break;case 12:Nh(r,i,n);break;case 31:Nh(r,i,n),n&&o&4&&tX(r,i);break;case 13:Nh(r,i,n),n&&o&4&&nX(r,i);break;case 22:i.memoizedState===null&&Nh(r,i,n),av(i,i.return);break;case 30:break;default:Nh(r,i,n)}t=t.sibling}}function Z9(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&&Qx(n))}function eI(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Qx(e))}function ju(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)iX(e,t,n,s),t=t.sibling}function iX(e,t,n,s){var r=t.flags;switch(t.tag){case 0:case 11:case 15:ju(e,t,n,s),r&2048&&Zx(9,t);break;case 1:ju(e,t,n,s);break;case 3:ju(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&&Qx(e)));break;case 12:if(r&2048){ju(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){Gr(t,t.return,c)}}else ju(e,t,n,s);break;case 31:ju(e,t,n,s);break;case 13:ju(e,t,n,s);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,t.memoizedState!==null?i._visibility&2?ju(e,t,n,s):lv(e,t):i._visibility&2?ju(e,t,n,s):(i._visibility|=2,m1(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),r&2048&&Z9(o,t);break;case 24:ju(e,t,n,s),r&2048&&eI(t.alternate,t);break;default:ju(e,t,n,s)}}function m1(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:m1(i,o,a,c,r),Zx(8,o);break;case 23:break;case 22:var d=o.stateNode;o.memoizedState!==null?d._visibility&2?m1(i,o,a,c,r):lv(i,o):(d._visibility|=2,m1(i,o,a,c,r)),r&&u&2048&&Z9(o.alternate,o);break;case 24:m1(i,o,a,c,r),r&&u&2048&&eI(o.alternate,o);break;default:m1(i,o,a,c,r)}t=t.sibling}}function lv(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:lv(n,s),r&2048&&Z9(s.alternate,s);break;case 24:lv(n,s),r&2048&&eI(s.alternate,s);break;default:lv(n,s)}t=t.sibling}}var Dw=8192;function Vg(e,t,n){if(e.subtreeFlags&Dw)for(e=e.child;e!==null;)oX(e,t,n),e=e.sibling}function oX(e,t,n){switch(e.tag){case 26:Vg(e,t,n),e.flags&Dw&&e.memoizedState!==null&&Lpe(n,Ru,e.memoizedState,e.memoizedProps);break;case 5:Vg(e,t,n);break;case 3:case 4:var s=Ru;Ru=Y4(e.stateNode.containerInfo),Vg(e,t,n),Ru=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Dw,Dw=16777216,Vg(e,t,n),Dw=s):Vg(e,t,n));break;default:Vg(e,t,n)}}function aX(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 nw(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];la=s,cX(s,e)}aX(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)lX(e),e=e.sibling}function lX(e){switch(e.tag){case 0:case 11:case 15:nw(e),e.flags&2048&&zm(9,e,e.return);break;case 3:nw(e);break;case 12:nw(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,$2(e)):nw(e);break;default:nw(e)}}function $2(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];la=s,cX(s,e)}aX(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:zm(8,t,t.return),$2(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,$2(t));break;default:$2(t)}e=e.sibling}}function cX(e,t){for(;la!==null;){var n=la;switch(n.tag){case 0:case 11:case 15:zm(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:Qx(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,la=s;else e:for(n=e;la!==null;){s=la;var r=s.sibling,i=s.return;if(ZY(s),s===n){la=null;break e}if(r!==null){r.return=i,la=r;break e}la=i}}}var Qme={getCacheForType:function(e){var t=Aa(jo),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Aa(jo).controller.signal}},Jme=typeof WeakMap=="function"?WeakMap:Map,Rr=0,hi=null,er=null,or=0,Vr=0,pc=null,cm=!1,Yb=!1,tI=!1,cf=0,so=0,Fm=0,N0=0,nI=0,kc=0,wb=0,cv=null,Fl=null,Wj=!1,G3=0,uX=0,H4=1/0,q4=null,Tm=null,Ko=0,Em=null,vb=null,Kh=0,Vj=0,Gj=null,dX=null,uv=0,Kj=null;function jc(){return Rr&2&&or!==0?or&-or:ms.T!==null?rI():vK()}function hX(){if(kc===0)if(!(or&536870912)||hr){var e=$_;$_<<=1,!($_&3932160)&&($_=262144),kc=e}else kc=536870912;return e=Ic.current,e!==null&&(e.flags|=32),kc}function Xl(e,t,n){(e===hi&&(Vr===2||Vr===9)||e.cancelPendingCommit!==null)&&(xb(e,0),um(e,or,kc,!1)),Kx(e,n),(!(Rr&2)||e!==hi)&&(e===hi&&(!(Rr&2)&&(N0|=n),so===4&&um(e,or,kc,!1)),Kd(e))}function fX(e,t,n){if(Rr&6)throw Error(pt(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Gx(e,t),r=s?tpe(e,t):c8(e,t,!0),i=s;do{if(r===0){Yb&&!s&&um(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!Zme(n)){r=c8(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=cv;var c=a.current.memoizedState.isDehydrated;if(c&&(xb(a,o).flags|=256),o=c8(a,o,!1),o!==2){if(tI&&!c){a.errorRecoveryDisabledLanes|=i,N0|=i,r=4;break e}i=Fl,Fl=r,i!==null&&(Fl===null?Fl=i:Fl.push.apply(Fl,i))}r=o}if(i=!1,r!==2)continue}}if(r===1){xb(e,0),um(e,t,0,!0);break}e:{switch(s=e,i=r,i){case 0:case 1:throw Error(pt(345));case 4:if((t&4194048)!==t)break;case 6:um(s,t,kc,!cm);break e;case 2:Fl=null;break;case 3:case 5:break;default:throw Error(pt(329))}if((t&62914560)===t&&(r=G3+300-Cc(),10<r)){if(um(s,t,kc,!cm),L3(s,0,!0)!==0)break e;Kh=t,s.timeoutHandle=RX(N$.bind(null,s,n,Fl,q4,Wj,t,kc,N0,wb,cm,i,"Throttled",-0,0),r);break e}N$(s,n,Fl,q4,Wj,t,kc,N0,wb,cm,i,null,-0,0)}}break}while(!0);Kd(e)}function N$(e,t,n,s,r,i,o,a,c,u,d,f,m,p){if(e.timeoutHandle=-1,f=t.subtreeFlags,f&8192||(f&16785408)===16785408){f={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:$h},oX(t,i,f);var g=(i&62914560)===i?G3-Cc():(i&4194048)===i?uX-Cc():0;if(g=Ope(f,g),g!==null){Kh=i,e.cancelPendingCommit=g(I$.bind(null,e,t,i,n,s,r,o,a,c,d,f,null,m,p)),um(e,i,o,!u);return}}I$(e,t,i,n,s,r,o,a,c)}function Zme(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(!Mc(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 um(e,t,n,s){t&=~nI,t&=~N0,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var r=t;0<r;){var i=31-Ec(r),o=1<<i;s[i]=-1,r&=~o}n!==0&&bK(e,n,t)}function K3(){return Rr&6?!0:(ek(0),!1)}function sI(){if(er!==null){if(Vr===0)var e=er.return;else e=er,Bh=lg=null,H9(e),K1=null,Fv=0,e=er;for(;e!==null;)VY(e.alternate,e),e=e.return;er=null}}function xb(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,wpe(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Kh=0,sI(),hi=e,er=n=Vh(e.current,null),or=t,Vr=0,pc=null,cm=!1,Yb=Gx(e,t),tI=!1,wb=kc=nI=N0=Fm=so=0,Fl=cv=null,Wj=!1,t&8&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var r=31-Ec(s),i=1<<r;t|=e[r],s&=~i}return cf=t,z3(),n}function mX(e,t){Is=null,ms.H=qv,t===Kb||t===H3?(t=l$(),Vr=3):t===P9?(t=l$(),Vr=4):Vr=t===Q9?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,pc=t,er===null&&(so=1,B4(e,lu(t,e.current)))}function pX(){var e=Ic.current;return e===null?!0:(or&4194048)===or?pu===null:(or&62914560)===or||or&536870912?e===pu:!1}function gX(){var e=ms.H;return ms.H=qv,e===null?qv:e}function bX(){var e=ms.A;return ms.A=Qme,e}function U4(){so=4,cm||(or&4194048)!==or&&Ic.current!==null||(Yb=!0),!(Fm&134217727)&&!(N0&134217727)||hi===null||um(hi,or,kc,!1)}function c8(e,t,n){var s=Rr;Rr|=2;var r=gX(),i=bX();(hi!==e||or!==t)&&(q4=null,xb(e,t)),t=!1;var o=so;e:do try{if(Vr!==0&&er!==null){var a=er,c=pc;switch(Vr){case 8:sI(),o=6;break e;case 3:case 2:case 9:case 6:Ic.current===null&&(t=!0);var u=Vr;if(Vr=0,pc=null,P1(e,a,c,u),n&&Yb){o=0;break e}break;default:u=Vr,Vr=0,pc=null,P1(e,a,c,u)}}epe(),o=so;break}catch(d){mX(e,d)}while(!0);return t&&e.shellSuspendCounter++,Bh=lg=null,Rr=s,ms.H=r,ms.A=i,er===null&&(hi=null,or=0,z3()),o}function epe(){for(;er!==null;)yX(er)}function tpe(e,t){var n=Rr;Rr|=2;var s=gX(),r=bX();hi!==e||or!==t?(q4=null,H4=Cc()+500,xb(e,t)):Yb=Gx(e,t);e:do try{if(Vr!==0&&er!==null){t=er;var i=pc;t:switch(Vr){case 1:Vr=0,pc=null,P1(e,t,i,1);break;case 2:case 9:if(a$(i)){Vr=0,pc=null,M$(t);break}t=function(){Vr!==2&&Vr!==9||hi!==e||(Vr=7),Kd(e)},i.then(t,t);break e;case 3:Vr=7;break e;case 4:Vr=5;break e;case 7:a$(i)?(Vr=0,pc=null,M$(t)):(Vr=0,pc=null,P1(e,t,i,7));break;case 5:var o=null;switch(er.tag){case 26:o=er.memoizedState;case 5:case 27:var a=er;if(o?$X(o):a.stateNode.complete){Vr=0,pc=null;var c=a.sibling;if(c!==null)er=c;else{var u=a.return;u!==null?(er=u,Y3(u)):er=null}break t}}Vr=0,pc=null,P1(e,t,i,5);break;case 6:Vr=0,pc=null,P1(e,t,i,6);break;case 8:sI(),so=6;break e;default:throw Error(pt(462))}}npe();break}catch(d){mX(e,d)}while(!0);return Bh=lg=null,ms.H=s,ms.A=r,Rr=n,er!==null?0:(hi=null,or=0,z3(),so)}function npe(){for(;er!==null&&!Cfe();)yX(er)}function yX(e){var t=WY(e.alternate,e,cf);e.memoizedProps=e.pendingProps,t===null?Y3(e):er=t}function M$(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=S$(n,t,t.pendingProps,t.type,void 0,or);break;case 11:t=S$(n,t,t.pendingProps,t.type.render,t.ref,or);break;case 5:H9(t);default:VY(n,t),t=er=VK(t,cf),t=WY(n,t,cf)}e.memoizedProps=e.pendingProps,t===null?Y3(e):er=t}function P1(e,t,n,s){Bh=lg=null,H9(t),K1=null,Fv=0;var r=t.return;try{if(Ume(e,r,t,n,or)){so=1,B4(e,lu(n,e.current)),er=null;return}}catch(i){if(r!==null)throw er=r,i;so=1,B4(e,lu(n,e.current)),er=null;return}t.flags&32768?(hr||s===1?e=!0:Yb||or&536870912?e=!1:(cm=e=!0,(s===2||s===9||s===3||s===6)&&(s=Ic.current,s!==null&&s.tag===13&&(s.flags|=16384))),wX(t,e)):Y3(t)}function Y3(e){var t=e;do{if(t.flags&32768){wX(t,cm);return}e=t.return;var n=Gme(t.alternate,t,cf);if(n!==null){er=n;return}if(t=t.sibling,t!==null){er=t;return}er=t=e}while(t!==null);so===0&&(so=5)}function wX(e,t){do{var n=Kme(e.alternate,e);if(n!==null){n.flags&=32767,er=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){er=e;return}er=e=n}while(e!==null);so=6,er=null}function I$(e,t,n,s,r,i,o,a,c){e.cancelPendingCommit=null;do X3();while(Ko!==0);if(Rr&6)throw Error(pt(327));if(t!==null){if(t===e.current)throw Error(pt(177));if(i=t.lanes|t.childLanes,i|=j9,Pfe(e,n,i,o,a,c),e===hi&&(er=hi=null,or=0),vb=t,Em=e,Kh=n,Vj=i,Gj=r,dX=s,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,ope(j4,function(){return SX(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,t.subtreeFlags&13878||s){s=ms.T,ms.T=null,r=Lr.p,Lr.p=2,o=Rr,Rr|=4;try{Yme(e,t,n)}finally{Rr=o,Lr.p=r,ms.T=s}}Ko=1,vX(),xX(),kX()}}function vX(){if(Ko===1){Ko=0;var e=Em,t=vb,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=ms.T,ms.T=null;var s=Lr.p;Lr.p=2;var r=Rr;Rr|=4;try{sX(t,e);var i=Jj,o=$K(e.containerInfo),a=i.focusedElem,c=i.selectionRange;if(o!==a&&a&&a.ownerDocument&&OK(a.ownerDocument.documentElement,a)){if(c!==null&&E9(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 f=a.ownerDocument||document,m=f&&f.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 y=e$(a,b),w=e$(a,v);if(y&&w&&(p.rangeCount!==1||p.anchorNode!==y.node||p.anchorOffset!==y.offset||p.focusNode!==w.node||p.focusOffset!==w.offset)){var x=f.createRange();x.setStart(y.node,y.offset),p.removeAllRanges(),b>v?(p.addRange(x),p.extend(w.node,w.offset)):(x.setEnd(w.node,w.offset),p.addRange(x))}}}}for(f=[],p=a;p=p.parentNode;)p.nodeType===1&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<f.length;a++){var k=f[a];k.element.scrollLeft=k.left,k.element.scrollTop=k.top}}J4=!!Qj,Jj=Qj=null}finally{Rr=r,Lr.p=s,ms.T=n}}e.current=t,Ko=2}}function xX(){if(Ko===2){Ko=0;var e=Em,t=vb,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=ms.T,ms.T=null;var s=Lr.p;Lr.p=2;var r=Rr;Rr|=4;try{JY(e,t.alternate,t)}finally{Rr=r,Lr.p=s,ms.T=n}}Ko=3}}function kX(){if(Ko===4||Ko===3){Ko=0,Tfe();var e=Em,t=vb,n=Kh,s=dX;t.subtreeFlags&10256||t.flags&10256?Ko=5:(Ko=0,vb=Em=null,_X(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(Tm=null),v9(n),t=t.stateNode,Tc&&typeof Tc.onCommitFiberRoot=="function")try{Tc.onCommitFiberRoot(Vx,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=ms.T,r=Lr.p,Lr.p=2,ms.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{ms.T=t,Lr.p=r}}Kh&3&&X3(),Kd(e),r=e.pendingLanes,n&261930&&r&42?e===Kj?uv++:(uv=0,Kj=e):uv=0,ek(0)}}function _X(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Qx(t)))}function X3(){return vX(),xX(),kX(),SX()}function SX(){if(Ko!==5)return!1;var e=Em,t=Vj;Vj=0;var n=v9(Kh),s=ms.T,r=Lr.p;try{Lr.p=32>n?32:n,ms.T=null,n=Gj,Gj=null;var i=Em,o=Kh;if(Ko=0,vb=Em=null,Kh=0,Rr&6)throw Error(pt(331));var a=Rr;if(Rr|=4,lX(i.current),iX(i,i.current,o,n),Rr=a,ek(0,!1),Tc&&typeof Tc.onPostCommitFiberRoot=="function")try{Tc.onPostCommitFiberRoot(Vx,i)}catch{}return!0}finally{Lr.p=r,ms.T=s,_X(e,t)}}function R$(e,t,n){t=lu(n,t),t=Fj(e.stateNode,t,2),e=Cm(e,t,2),e!==null&&(Kx(e,2),Kd(e))}function Gr(e,t,n){if(e.tag===3)R$(e,e,n);else for(;t!==null;){if(t.tag===3){R$(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Tm===null||!Tm.has(s))){e=lu(n,e),n=BY(2),s=Cm(t,n,2),s!==null&&(zY(n,s,t,e),Kx(s,2),Kd(s));break}}t=t.return}}function u8(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new Jme;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)||(tI=!0,r.add(n),e=spe.bind(null,e,t,n),t.then(e,e))}function spe(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,hi===e&&(or&n)===n&&(so===4||so===3&&(or&62914560)===or&&300>Cc()-G3?!(Rr&2)&&xb(e,0):nI|=n,wb===or&&(wb=0)),Kd(e)}function CX(e,t){t===0&&(t=gK()),e=ag(e,t),e!==null&&(Kx(e,t),Kd(e))}function rpe(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),CX(e,n)}function ipe(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(pt(314))}s!==null&&s.delete(t),CX(e,n)}function ope(e,t){return y9(e,t)}var W4=null,p1=null,Yj=!1,V4=!1,d8=!1,dm=0;function Kd(e){e!==p1&&e.next===null&&(p1===null?W4=p1=e:p1=p1.next=e),V4=!0,Yj||(Yj=!0,lpe())}function ek(e,t){if(!d8&&V4){d8=!0;do for(var n=!1,s=W4;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-Ec(42|e)+1)-1,i&=r&~(o&~a),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,D$(s,i))}else i=or,i=L3(s,s===hi?i:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),!(i&3)||Gx(s,i)||(n=!0,D$(s,i));s=s.next}while(n);d8=!1}}function ape(){TX()}function TX(){V4=Yj=!1;var e=0;dm!==0&&ype()&&(e=dm);for(var t=Cc(),n=null,s=W4;s!==null;){var r=s.next,i=EX(s,t);i===0?(s.next=null,n===null?W4=r:n.next=r,r===null&&(p1=n)):(n=s,(e!==0||i&3)&&(V4=!0)),s=r}Ko!==0&&Ko!==5||ek(e),dm!==0&&(dm=0)}function EX(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,r=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var o=31-Ec(i),a=1<<o,c=r[o];c===-1?(!(a&n)||a&s)&&(r[o]=Dfe(a,t)):c<=t&&(e.expiredLanes|=a),i&=~a}if(t=hi,n=or,n=L3(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&&B6(s),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Gx(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&B6(s),v9(n)){case 2:case 8:n=mK;break;case 32:n=j4;break;case 268435456:n=pK;break;default:n=j4}return s=jX.bind(null,e),n=y9(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&B6(s),e.callbackPriority=2,e.callbackNode=null,2}function jX(e,t){if(Ko!==0&&Ko!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(X3()&&e.callbackNode!==n)return null;var s=or;return s=L3(e,e===hi?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(fX(e,s,t),EX(e,Cc()),e.callbackNode!=null&&e.callbackNode===n?jX.bind(null,e):null)}function D$(e,t){if(X3())return null;fX(e,t,!0)}function lpe(){vpe(function(){Rr&6?y9(fK,ape):TX()})}function rI(){if(dm===0){var e=gb;e===0&&(e=O_,O_<<=1,!(O_&261888)&&(O_=256)),dm=e}return dm}function P$(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:A2(""+e)}function L$(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 cpe(e,t,n,s,r){if(t==="submit"&&n&&n.stateNode===r){var i=P$((r[Zl]||null).action),o=s.submitter;o&&(t=(t=o[Zl]||null)?P$(t.formAction):o.getAttribute("formAction"),t!==null&&(i=t,o=null));var a=new O3("action","action",null,s,r);e.push({event:a,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(dm!==0){var c=o?L$(r,o):new FormData(r);Bj(n,{pending:!0,data:c,method:r.method,action:i},null,c)}}else typeof i=="function"&&(a.preventDefault(),c=o?L$(r,o):new FormData(r),Bj(n,{pending:!0,data:c,method:r.method,action:i},i,c))},currentTarget:r}]})}}for(var h8=0;h8<Ej.length;h8++){var f8=Ej[h8],upe=f8.toLowerCase(),dpe=f8[0].toUpperCase()+f8.slice(1);Vu(upe,"on"+dpe)}Vu(zK,"onAnimationEnd");Vu(FK,"onAnimationIteration");Vu(HK,"onAnimationStart");Vu("dblclick","onDoubleClick");Vu("focusin","onFocus");Vu("focusout","onBlur");Vu(Eme,"onTransitionRun");Vu(jme,"onTransitionStart");Vu(Ame,"onTransitionCancel");Vu(qK,"onTransitionEnd");mb("onMouseEnter",["mouseout","mouseover"]);mb("onMouseLeave",["mouseout","mouseover"]);mb("onPointerEnter",["pointerout","pointerover"]);mb("onPointerLeave",["pointerout","pointerover"]);rg("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));rg("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));rg("onBeforeInput",["compositionend","keypress","textInput","paste"]);rg("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));rg("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));rg("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Uv="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(" "),hpe=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Uv));function AX(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){N4(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){N4(d)}r.currentTarget=null,i=c}}}}function Zs(e,t){var n=t[wj];n===void 0&&(n=t[wj]=new Set);var s=e+"__bubble";n.has(s)||(NX(t,e,2,!1),n.add(s))}function m8(e,t,n){var s=0;t&&(s|=4),NX(n,e,s,t)}var G_="_reactListening"+Math.random().toString(36).slice(2);function iI(e){if(!e[G_]){e[G_]=!0,xK.forEach(function(n){n!=="selectionchange"&&(hpe.has(n)||m8(n,!1,e),m8(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[G_]||(t[G_]=!0,m8("selectionchange",!1,t))}}function NX(e,t,n,s){switch(qX(t)){case 2:var r=zpe;break;case 8:r=Fpe;break;default:r=cI}n=r.bind(null,t,n,e),r=void 0,!Sj||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 p8(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=T1(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}AK(function(){var u=i,d=_9(n),f=[];e:{var m=UK.get(e);if(m!==void 0){var p=O3,g=e;switch(e){case"keypress":if(M2(n)===0)break e;case"keydown":case"keyup":p=ime;break;case"focusin":g="focus",p=U6;break;case"focusout":g="blur",p=U6;break;case"beforeblur":case"afterblur":p=U6;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=UO;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Gfe;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=lme;break;case zK:case FK:case HK:p=Xfe;break;case qK:p=ume;break;case"scroll":case"scrollend":p=Wfe;break;case"wheel":p=hme;break;case"copy":case"cut":case"paste":p=Jfe;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=VO;break;case"toggle":case"beforetoggle":p=mme}var b=(t&4)!==0,v=!b&&(e==="scroll"||e==="scrollend"),y=b?m!==null?m+"Capture":null:m;b=[];for(var w=u,x;w!==null;){var k=w;if(x=k.stateNode,k=k.tag,k!==5&&k!==26&&k!==27||x===null||y===null||(k=Lv(w,y),k!=null&&b.push(Wv(w,k,x))),v)break;w=w.return}0<b.length&&(m=new p(m,g,null,n,d),f.push({event:m,listeners:b}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",m&&n!==_j&&(g=n.relatedTarget||n.fromElement)&&(T1(g)||g[Wb]))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?T1(g):null,g!==null&&(v=Wx(g),b=g.tag,g!==v||b!==5&&b!==27&&b!==6)&&(g=null)):(p=null,g=u),p!==g)){if(b=UO,k="onMouseLeave",y="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(b=VO,k="onPointerLeave",y="onPointerEnter",w="pointer"),v=p==null?m:Iw(p),x=g==null?m:Iw(g),m=new b(k,w+"leave",p,n,d),m.target=v,m.relatedTarget=x,k=null,T1(d)===u&&(b=new b(y,w+"enter",g,n,d),b.target=x,b.relatedTarget=v,k=b),v=k,p&&g)t:{for(b=fpe,y=p,w=g,x=0,k=y;k;k=b(k))x++;k=0;for(var C=w;C;C=b(C))k++;for(;0<x-k;)y=b(y),x--;for(;0<k-x;)w=b(w),k--;for(;x--;){if(y===w||w!==null&&y===w.alternate){b=y;break t}y=b(y),w=b(w)}b=null}else b=null;p!==null&&O$(f,m,p,b,!1),g!==null&&v!==null&&O$(f,v,g,b,!0)}}e:{if(m=u?Iw(u):window,p=m.nodeName&&m.nodeName.toLowerCase(),p==="select"||p==="input"&&m.type==="file")var T=XO;else if(YO(m))if(PK)T=Sme;else{T=kme;var _=xme}else p=m.nodeName,!p||p.toLowerCase()!=="input"||m.type!=="checkbox"&&m.type!=="radio"?u&&k9(u.elementType)&&(T=XO):T=_me;if(T&&(T=T(e,u))){DK(f,T,n,d);break e}_&&_(e,m,u),e==="focusout"&&u&&m.type==="number"&&u.memoizedProps.value!=null&&kj(m,"number",m.value)}switch(_=u?Iw(u):window,e){case"focusin":(YO(_)||_.contentEditable==="true")&&(A1=_,Cj=u,tv=null);break;case"focusout":tv=Cj=A1=null;break;case"mousedown":Tj=!0;break;case"contextmenu":case"mouseup":case"dragend":Tj=!1,t$(f,n,d);break;case"selectionchange":if(Tme)break;case"keydown":case"keyup":t$(f,n,d)}var S;if(T9)e:{switch(e){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else j1?IK(e,n)&&(R="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(R="onCompositionStart");R&&(MK&&n.locale!=="ko"&&(j1||R!=="onCompositionStart"?R==="onCompositionEnd"&&j1&&(S=NK()):(lm=d,S9="value"in lm?lm.value:lm.textContent,j1=!0)),_=G4(u,R),0<_.length&&(R=new WO(R,e,null,n,d),f.push({event:R,listeners:_}),S?R.data=S:(S=RK(n),S!==null&&(R.data=S)))),(S=gme?bme(e,n):yme(e,n))&&(R=G4(u,"onBeforeInput"),0<R.length&&(_=new WO("onBeforeInput","beforeinput",null,n,d),f.push({event:_,listeners:R}),_.data=S)),cpe(f,e,u,n,d)}AX(f,t)})}function Wv(e,t,n){return{instance:e,listener:t,currentTarget:n}}function G4(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=Lv(e,n),r!=null&&s.unshift(Wv(e,r,i)),r=Lv(e,t),r!=null&&s.push(Wv(e,r,i))),e.tag===3)return s;e=e.return}return[]}function fpe(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function O$(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=Lv(n,i),u!=null&&o.unshift(Wv(n,u,c))):r||(u=Lv(n,i),u!=null&&o.push(Wv(n,u,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var mpe=/\r\n?/g,ppe=/\u0000|\uFFFD/g;function $$(e){return(typeof e=="string"?e:""+e).replace(mpe,`
`).replace(ppe,"")}function MX(e,t){return t=$$(t),$$(e)===t}function Qr(e,t,n,s,r,i){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||pb(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&pb(e,""+s);break;case"className":z_(e,"class",s);break;case"tabIndex":z_(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":z_(e,n,s);break;case"style":jK(e,s,i);break;case"data":if(t!=="object"){z_(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=A2(""+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"&&Qr(e,t,"name",r.name,r,null),Qr(e,t,"formEncType",r.formEncType,r,null),Qr(e,t,"formMethod",r.formMethod,r,null),Qr(e,t,"formTarget",r.formTarget,r,null)):(Qr(e,t,"encType",r.encType,r,null),Qr(e,t,"method",r.method,r,null),Qr(e,t,"target",r.target,r,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=A2(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=$h);break;case"onScroll":s!=null&&Zs("scroll",e);break;case"onScrollEnd":s!=null&&Zs("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(pt(61));if(n=s.__html,n!=null){if(r.children!=null)throw Error(pt(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=A2(""+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":Zs("beforetoggle",e),Zs("toggle",e),j2(e,"popover",s);break;case"xlinkActuate":vh(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":vh(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":vh(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":vh(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":vh(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":vh(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":vh(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":vh(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":vh(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":j2(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=qfe.get(n)||n,j2(e,n,s))}}function Xj(e,t,n,s,r,i){switch(n){case"style":jK(e,s,i);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(pt(61));if(n=s.__html,n!=null){if(r.children!=null)throw Error(pt(60));e.innerHTML=n}}break;case"children":typeof s=="string"?pb(e,s):(typeof s=="number"||typeof s=="bigint")&&pb(e,""+s);break;case"onScroll":s!=null&&Zs("scroll",e);break;case"onScrollEnd":s!=null&&Zs("scrollend",e);break;case"onClick":s!=null&&(e.onclick=$h);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!kK.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[Zl]||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,""):j2(e,n,s)}}}function Ma(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Zs("error",e),Zs("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(pt(137,t));default:Qr(e,t,i,o,n,null)}}r&&Qr(e,t,"srcSet",n.srcSet,n,null),s&&Qr(e,t,"src",n.src,n,null);return;case"input":Zs("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(pt(137,t));break;default:Qr(e,t,s,d,n,null)}}CK(e,i,a,c,u,o,r,!1);return;case"select":Zs("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:Qr(e,t,r,a,n,null)}t=i,n=o,e.multiple=!!s,t!=null?W1(e,!!s,t,!1):n!=null&&W1(e,!!s,n,!0);return;case"textarea":Zs("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(pt(91));break;default:Qr(e,t,o,a,n,null)}EK(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:Qr(e,t,c,s,n,null)}return;case"dialog":Zs("beforetoggle",e),Zs("toggle",e),Zs("cancel",e),Zs("close",e);break;case"iframe":case"object":Zs("load",e);break;case"video":case"audio":for(s=0;s<Uv.length;s++)Zs(Uv[s],e);break;case"image":Zs("error",e),Zs("load",e);break;case"details":Zs("toggle",e);break;case"embed":case"source":case"link":Zs("error",e),Zs("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(pt(137,t));default:Qr(e,t,u,s,n,null)}return;default:if(k9(t)){for(d in n)n.hasOwnProperty(d)&&(s=n[d],s!==void 0&&Xj(e,t,d,s,n,void 0));return}}for(a in n)n.hasOwnProperty(a)&&(s=n[a],s!=null&&Qr(e,t,a,s,n,null))}function gpe(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 f=n[p];if(n.hasOwnProperty(p)&&f!=null)switch(p){case"checked":break;case"value":break;case"defaultValue":c=f;default:s.hasOwnProperty(p)||Qr(e,t,p,null,s,f)}}for(var m in s){var p=s[m];if(f=n[m],s.hasOwnProperty(m)&&(p!=null||f!=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(pt(137,t));break;default:p!==f&&Qr(e,t,m,p,s,f)}}xj(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)||Qr(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&&Qr(e,t,r,i,s,c)}t=a,n=o,s=p,m!=null?W1(e,!!n,m,!1):!!s!=!!n&&(t!=null?W1(e,!!n,t,!0):W1(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:Qr(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(pt(91));break;default:r!==i&&Qr(e,t,o,r,s,i)}TK(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:Qr(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:Qr(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)&&Qr(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(pt(137,t));break;default:Qr(e,t,u,m,s,p)}return;default:if(k9(t)){for(var v in n)m=n[v],n.hasOwnProperty(v)&&m!==void 0&&!s.hasOwnProperty(v)&&Xj(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||Xj(e,t,d,m,s,p);return}}for(var y in n)m=n[y],n.hasOwnProperty(y)&&m!=null&&!s.hasOwnProperty(y)&&Qr(e,t,y,null,s,m);for(f in s)m=s[f],p=n[f],!s.hasOwnProperty(f)||m===p||m==null&&p==null||Qr(e,t,f,m,s,p)}function B$(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function bpe(){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&&B$(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,f=c.initiatorType;d&&B$(f)&&(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 Qj=null,Jj=null;function K4(e){return e.nodeType===9?e:e.ownerDocument}function z$(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 IX(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 Zj(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 g8=null;function ype(){var e=window.event;return e&&e.type==="popstate"?e===g8?!1:(g8=e,!0):(g8=null,!1)}var RX=typeof setTimeout=="function"?setTimeout:void 0,wpe=typeof clearTimeout=="function"?clearTimeout:void 0,F$=typeof Promise=="function"?Promise:void 0,vpe=typeof queueMicrotask=="function"?queueMicrotask:typeof F$<"u"?function(e){return F$.resolve(null).then(e).catch(xpe)}:RX;function xpe(e){setTimeout(function(){throw e})}function gp(e){return e==="head"}function H$(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),_b(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")dv(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,dv(n);for(var i=n.firstChild;i;){var o=i.nextSibling,a=i.nodeName;i[Yx]||a==="SCRIPT"||a==="STYLE"||a==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}else n==="body"&&dv(e.ownerDocument.body);n=r}while(n);_b(t)}function q$(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 eA(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":eA(n),x9(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function kpe(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[Yx])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=gu(e.nextSibling),e===null)break}return null}function _pe(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=gu(e.nextSibling),e===null))return null;return e}function DX(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=gu(e.nextSibling),e===null))return null;return e}function tA(e){return e.data==="$?"||e.data==="$~"}function nA(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Spe(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 gu(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 sA=null;function U$(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return gu(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function W$(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 PX(e,t,n){switch(t=K4(n),e){case"html":if(e=t.documentElement,!e)throw Error(pt(452));return e;case"head":if(e=t.head,!e)throw Error(pt(453));return e;case"body":if(e=t.body,!e)throw Error(pt(454));return e;default:throw Error(pt(451))}}function dv(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);x9(e)}var wu=new Map,V$=new Set;function Y4(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var wf=Lr.d;Lr.d={f:Cpe,r:Tpe,D:Epe,C:jpe,L:Ape,m:Npe,X:Ipe,S:Mpe,M:Rpe};function Cpe(){var e=wf.f(),t=K3();return e||t}function Tpe(e){var t=Vb(e);t!==null&&t.tag===5&&t.type==="form"?jY(t):wf.r(e)}var Xb=typeof document>"u"?null:document;function LX(e,t,n){var s=Xb;if(s&&typeof t=="string"&&t){var r=au(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n=="string"&&(r+='[crossorigin="'+n+'"]'),V$.has(r)||(V$.add(r),e={rel:e,crossOrigin:n,href:t},s.querySelector(r)===null&&(t=s.createElement("link"),Ma(t,"link",e),ua(t),s.head.appendChild(t)))}}function Epe(e){wf.D(e),LX("dns-prefetch",e,null)}function jpe(e,t){wf.C(e,t),LX("preconnect",e,t)}function Ape(e,t,n){wf.L(e,t,n);var s=Xb;if(s&&e&&t){var r='link[rel="preload"][as="'+au(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+au(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+au(n.imageSizes)+'"]')):r+='[href="'+au(e)+'"]';var i=r;switch(t){case"style":i=kb(e);break;case"script":i=Qb(e)}wu.has(i)||(e=ji({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),wu.set(i,e),s.querySelector(r)!==null||t==="style"&&s.querySelector(tk(i))||t==="script"&&s.querySelector(nk(i))||(t=s.createElement("link"),Ma(t,"link",e),ua(t),s.head.appendChild(t)))}}function Npe(e,t){wf.m(e,t);var n=Xb;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+au(s)+'"][href="'+au(e)+'"]',i=r;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=Qb(e)}if(!wu.has(i)&&(e=ji({rel:"modulepreload",href:e},t),wu.set(i,e),n.querySelector(r)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(nk(i)))return}s=n.createElement("link"),Ma(s,"link",e),ua(s),n.head.appendChild(s)}}}function Mpe(e,t,n){wf.S(e,t,n);var s=Xb;if(s&&e){var r=U1(s).hoistableStyles,i=kb(e);t=t||"default";var o=r.get(i);if(!o){var a={loading:0,preload:null};if(o=s.querySelector(tk(i)))a.loading=5;else{e=ji({rel:"stylesheet",href:e,"data-precedence":t},n),(n=wu.get(i))&&oI(e,n);var c=o=s.createElement("link");ua(c),Ma(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,B2(o,t,s)}o={type:"stylesheet",instance:o,count:1,state:a},r.set(i,o)}}}function Ipe(e,t){wf.X(e,t);var n=Xb;if(n&&e){var s=U1(n).hoistableScripts,r=Qb(e),i=s.get(r);i||(i=n.querySelector(nk(r)),i||(e=ji({src:e,async:!0},t),(t=wu.get(r))&&aI(e,t),i=n.createElement("script"),ua(i),Ma(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},s.set(r,i))}}function Rpe(e,t){wf.M(e,t);var n=Xb;if(n&&e){var s=U1(n).hoistableScripts,r=Qb(e),i=s.get(r);i||(i=n.querySelector(nk(r)),i||(e=ji({src:e,async:!0,type:"module"},t),(t=wu.get(r))&&aI(e,t),i=n.createElement("script"),ua(i),Ma(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},s.set(r,i))}}function G$(e,t,n,s){var r=(r=km.current)?Y4(r):null;if(!r)throw Error(pt(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=kb(n.href),n=U1(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=kb(n.href);var i=U1(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(tk(e)))&&!i._p&&(o.instance=i,o.state.loading=5),wu.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},wu.set(e,n),i||Dpe(r,e,n,o.state))),t&&s===null)throw Error(pt(528,""));return o}if(t&&s!==null)throw Error(pt(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Qb(n),n=U1(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(pt(444,e))}}function kb(e){return'href="'+au(e)+'"'}function tk(e){return'link[rel="stylesheet"]['+e+"]"}function OX(e){return ji({},e,{"data-precedence":e.precedence,precedence:null})}function Dpe(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}),Ma(t,"link",n),ua(t),e.head.appendChild(t))}function Qb(e){return'[src="'+au(e)+'"]'}function nk(e){return"script[async]"+e}function K$(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+au(n.href)+'"]');if(s)return t.instance=s,ua(s),s;var r=ji({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),ua(s),Ma(s,"style",r),B2(s,n.precedence,e),t.instance=s;case"stylesheet":r=kb(n.href);var i=e.querySelector(tk(r));if(i)return t.state.loading|=4,t.instance=i,ua(i),i;s=OX(n),(r=wu.get(r))&&oI(s,r),i=(e.ownerDocument||e).createElement("link"),ua(i);var o=i;return o._p=new Promise(function(a,c){o.onload=a,o.onerror=c}),Ma(i,"link",s),t.state.loading|=4,B2(i,n.precedence,e),t.instance=i;case"script":return i=Qb(n.src),(r=e.querySelector(nk(i)))?(t.instance=r,ua(r),r):(s=n,(r=wu.get(i))&&(s=ji({},n),aI(s,r)),e=e.ownerDocument||e,r=e.createElement("script"),ua(r),Ma(r,"link",s),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(pt(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(s=t.instance,t.state.loading|=4,B2(s,n.precedence,e));return t.instance}function B2(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 oI(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function aI(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var z2=null;function Y$(e,t,n){if(z2===null){var s=new Map,r=z2=new Map;r.set(n,s)}else r=z2,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[Yx]||i[Ta]||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 X$(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Ppe(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 $X(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function Lpe(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=kb(s.href),i=t.querySelector(tk(r));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=X4.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,ua(i);return}i=t.ownerDocument||t,s=OX(s),(r=wu.get(r))&&oI(s,r),i=i.createElement("link"),ua(i);var o=i;o._p=new Promise(function(a,c){o.onload=a,o.onerror=c}),Ma(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=X4.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var b8=0;function Ope(e,t){return e.stylesheets&&e.count===0&&F2(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&F2(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&b8===0&&(b8=62500*bpe());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&F2(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>b8?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(r)}}:null}function X4(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)F2(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Q4=null;function F2(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Q4=new Map,t.forEach($pe,e),Q4=null,X4.call(e))}function $pe(e,t){if(!(t.state.loading&4)){var n=Q4.get(e);if(n)var s=n.get(null);else{n=new Map,Q4.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=X4.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 Vv={$$typeof:Oh,Provider:null,Consumer:null,_currentValue:T0,_currentValue2:T0,_threadCount:0};function Bpe(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=z6(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=z6(0),this.hiddenUpdates=z6(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 BX(e,t,n,s,r,i,o,a,c,u,d,f){return e=new Bpe(e,t,n,o,c,u,d,f,a),t=1,i===!0&&(t|=24),i=vc(3,null,null,t),e.current=i,i.stateNode=e,t=R9(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:s,isDehydrated:n,cache:t},L9(i),e}function zX(e){return e?(e=I1,e):I1}function FX(e,t,n,s,r,i){r=zX(r),s.context===null?s.context=r:s.pendingContext=r,s=Sm(t),s.payload={element:n},i=i===void 0?null:i,i!==null&&(s.callback=i),n=Cm(e,s,t),n!==null&&(Xl(n,e,t),sv(n,e,t))}function Q$(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lI(e,t){Q$(e,t),(e=e.alternate)&&Q$(e,t)}function HX(e){if(e.tag===13||e.tag===31){var t=ag(e,67108864);t!==null&&Xl(t,e,67108864),lI(e,67108864)}}function J$(e){if(e.tag===13||e.tag===31){var t=jc();t=w9(t);var n=ag(e,t);n!==null&&Xl(n,e,t),lI(e,t)}}var J4=!0;function zpe(e,t,n,s){var r=ms.T;ms.T=null;var i=Lr.p;try{Lr.p=2,cI(e,t,n,s)}finally{Lr.p=i,ms.T=r}}function Fpe(e,t,n,s){var r=ms.T;ms.T=null;var i=Lr.p;try{Lr.p=8,cI(e,t,n,s)}finally{Lr.p=i,ms.T=r}}function cI(e,t,n,s){if(J4){var r=rA(s);if(r===null)p8(e,t,s,Z4,n),Z$(e,s);else if(qpe(r,e,t,n,s))s.stopPropagation();else if(Z$(e,s),t&4&&-1<Hpe.indexOf(e)){for(;r!==null;){var i=Vb(r);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var o=i0(i.pendingLanes);if(o!==0){var a=i;for(a.pendingLanes|=2,a.entangledLanes|=2;o;){var c=1<<31-Ec(o);a.entanglements[1]|=c,o&=~c}Kd(i),!(Rr&6)&&(H4=Cc()+500,ek(0))}}break;case 31:case 13:a=ag(i,2),a!==null&&Xl(a,i,2),K3(),lI(i,2)}if(i=rA(s),i===null&&p8(e,t,s,Z4,n),i===r)break;r=i}r!==null&&s.stopPropagation()}else p8(e,t,s,null,n)}}function rA(e){return e=_9(e),uI(e)}var Z4=null;function uI(e){if(Z4=null,e=T1(e),e!==null){var t=Wx(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=lK(t),e!==null)return e;e=null}else if(n===31){if(e=cK(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 Z4=e,null}function qX(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(Efe()){case fK:return 2;case mK:return 8;case j4:case jfe:return 32;case pK:return 268435456;default:return 32}default:return 32}}var iA=!1,jm=null,Am=null,Nm=null,Gv=new Map,Kv=new Map,rm=[],Hpe="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 Z$(e,t){switch(e){case"focusin":case"focusout":jm=null;break;case"dragenter":case"dragleave":Am=null;break;case"mouseover":case"mouseout":Nm=null;break;case"pointerover":case"pointerout":Gv.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Kv.delete(t.pointerId)}}function sw(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=Vb(t),t!==null&&HX(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function qpe(e,t,n,s,r){switch(t){case"focusin":return jm=sw(jm,e,t,n,s,r),!0;case"dragenter":return Am=sw(Am,e,t,n,s,r),!0;case"mouseover":return Nm=sw(Nm,e,t,n,s,r),!0;case"pointerover":var i=r.pointerId;return Gv.set(i,sw(Gv.get(i)||null,e,t,n,s,r)),!0;case"gotpointercapture":return i=r.pointerId,Kv.set(i,sw(Kv.get(i)||null,e,t,n,s,r)),!0}return!1}function UX(e){var t=T1(e.target);if(t!==null){var n=Wx(t);if(n!==null){if(t=n.tag,t===13){if(t=lK(n),t!==null){e.blockedOn=t,OO(e.priority,function(){J$(n)});return}}else if(t===31){if(t=cK(n),t!==null){e.blockedOn=t,OO(e.priority,function(){J$(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 H2(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=rA(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);_j=s,n.target.dispatchEvent(s),_j=null}else return t=Vb(n),t!==null&&HX(t),e.blockedOn=n,!1;t.shift()}return!0}function eB(e,t,n){H2(e)&&n.delete(t)}function Upe(){iA=!1,jm!==null&&H2(jm)&&(jm=null),Am!==null&&H2(Am)&&(Am=null),Nm!==null&&H2(Nm)&&(Nm=null),Gv.forEach(eB),Kv.forEach(eB)}function K_(e,t){e.blockedOn===t&&(e.blockedOn=null,iA||(iA=!0,Xo.unstable_scheduleCallback(Xo.unstable_NormalPriority,Upe)))}var Y_=null;function tB(e){Y_!==e&&(Y_=e,Xo.unstable_scheduleCallback(Xo.unstable_NormalPriority,function(){Y_===e&&(Y_=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(uI(s||n)===null)continue;break}var i=Vb(n);i!==null&&(e.splice(t,3),t-=3,Bj(i,{pending:!0,data:r,method:n.method,action:s},s,r))}}))}function _b(e){function t(c){return K_(c,e)}jm!==null&&K_(jm,e),Am!==null&&K_(Am,e),Nm!==null&&K_(Nm,e),Gv.forEach(t),Kv.forEach(t);for(var n=0;n<rm.length;n++){var s=rm[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<rm.length&&(n=rm[0],n.blockedOn===null);)UX(n),n.blockedOn===null&&rm.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[Zl]||null;if(typeof i=="function")o||tB(n);else if(o){var a=null;if(i&&i.hasAttribute("formAction")){if(r=i,o=i[Zl]||null)a=o.formAction;else if(uI(r)!==null)continue}else a=o.action;typeof a=="function"?n[s+1]=a:(n.splice(s,3),s-=3),tB(n)}}}function WX(){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 dI(e){this._internalRoot=e}Q3.prototype.render=dI.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(pt(409));var n=t.current,s=jc();FX(n,s,e,t,null,null)};Q3.prototype.unmount=dI.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;FX(e.current,2,null,e,null,null),K3(),t[Wb]=null}};function Q3(e){this._internalRoot=e}Q3.prototype.unstable_scheduleHydration=function(e){if(e){var t=vK();e={blockedOn:null,target:e,priority:t};for(var n=0;n<rm.length&&t!==0&&t<rm[n].priority;n++);rm.splice(n,0,e),n===0&&UX(e)}};var nB=oK.version;if(nB!=="19.2.4")throw Error(pt(527,nB,"19.2.4"));Lr.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(pt(188)):(e=Object.keys(e).join(","),Error(pt(268,e)));return e=vfe(t),e=e!==null?uK(e):null,e=e===null?null:e.stateNode,e};var Wpe={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:ms,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var X_=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!X_.isDisabled&&X_.supportsFiber)try{Vx=X_.inject(Wpe),Tc=X_}catch{}}D3.createRoot=function(e,t){if(!aK(e))throw Error(pt(299));var n=!1,s="",r=LY,i=OY,o=$Y;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=BX(e,1,!1,null,null,n,s,null,r,i,o,WX),e[Wb]=t.current,iI(e),new dI(t)};D3.hydrateRoot=function(e,t,n){if(!aK(e))throw Error(pt(299));var s=!1,r="",i=LY,o=OY,a=$Y,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=BX(e,1,!0,t,n??null,s,r,c,i,o,a,WX),t.context=zX(null),n=t.current,s=jc(),s=w9(s),r=Sm(s),r.callback=null,Cm(n,r,s),n=s,t.current.lanes=n,Kx(t,n),Kd(t),e[Wb]=t.current,iI(e),new Q3(t)};D3.version="19.2.4";function VX(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(VX)}catch(e){console.error(e)}}VX(),eK.exports=D3;var oA=eK.exports;const Vpe=M3(oA);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Gpe="agent";function Kpe(e){return e===Gpe}var Ype=3e4,Xpe=new Set(["authorized","expired","error","cancelled"]),Qpe=class{constructor(t){this.client=t}async start(t){let n=await this.client.startDeviceFlow(t),s=this.client;return{deviceFlowId:n.deviceFlowId,providerId:n.providerId,userCode:n.userCode,verificationUri:n.verificationUri,verificationUriComplete:n.verificationUriComplete,expiresAt:n.expiresAt,intervalMs:n.intervalMs,attached:n.attached,cancel:()=>s.cancelDeviceFlow(n.deviceFlowId,{clientId:t.clientId}),awaitCompletion:async(r={})=>await Jpe(s,n,t.clientId,r)}}status(t,n){return this.client.getDeviceFlow(t,n)}cancel(t,n){return this.client.cancelDeviceFlow(t,n)}};async function Jpe(e,t,n,s){return await Zpe(e,t,n,s)}async function sB(e,t,n,s){try{return await e.getDeviceFlow(t.deviceFlowId,{clientId:n,signal:s})}catch(r){if(r instanceof Rc&&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 rB(e,t={}){if(e!==void 0&&Number.isFinite(e)&&!(t.allowZero?e<0:e<=0))return e}async function Zpe(e,t,n,s){var d;let r=s.signal,i=rB(s.timeoutMs,{allowZero:!0}),o=rB(s.pollOverrideMs),a=i!==void 0?Date.now()+i:t.expiresAt+Ype,c=Math.max(1e3,o??t.intervalMs??5e3),u=c;for(;;){if(r!=null&&r.aborted)throw aA(r);if(Date.now()>=a)return await sB(e,t,n,r);let f=await sB(e,t,n,r);if(f.intervalMs&&f.intervalMs!==u&&(u=f.intervalMs,c=f.intervalMs,(d=s.onThrottled)==null||d.call(s,f.intervalMs)),Xpe.has(f.status))return f;await e0e(c,r)}}async function e0e(e,t){if(t!=null&&t.aborted)throw aA(t);await new Promise((n,s)=>{let r=setTimeout(()=>{o(),n()},e),i=()=>{o(),s(aA(t))};function o(){clearTimeout(r),t==null||t.removeEventListener("abort",i)}t&&t.addEventListener("abort",i,{once:!0})})}function aA(e){let t=e==null?void 0:e.reason;return t instanceof Error?t:typeof t=="string"?new Error(t):new Error("aborted")}var Rc=class extends Error{constructor(n,s,r){super(r);qe(this,"status");qe(this,"body");this.name="DaemonHttpError",this.status=n,this.body=s}},iB=class extends Error{constructor(e){super(e??"Transport connection closed"),this.name="DaemonTransportClosedError"}},t0e=class extends Error{constructor(e){super(e),this.name="SseFramingError"}},oB=16*1024*1024;async function*GX(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=aB(r);for(let d of u.frames){let f=y8(d);f&&(yield f)}if(u.tail.length>0){let d=y8(u.tail);d&&(yield d)}}return}if(r+=s.decode(o,{stream:!0}),r.length>oB)throw new t0e(`parseSseStream: unread buffer exceeded ${oB} UTF-16 code units without a frame separator — upstream likely not SSE`);let c=aB(r);if(c.frames.length>0)for(let u of c.frames){let d=y8(u);d&&(yield d)}r=c.tail}}finally{t&&i&&t.removeEventListener("abort",i);try{await n.cancel()}catch{}}}function aB(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 y8(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 n0e=class{constructor(e,t,n){qe(this,"baseUrl");qe(this,"token");qe(this,"_fetch");qe(this,"activeSseRequests",new Set);qe(this,"_disposed",!1);qe(this,"type","rest");qe(this,"supportsReplay",!0);qe(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 iB;return this._fetch(e,t)}async*subscribeEvents(e,t={}){var s,r;if(this._disposed)throw new iB;let n=new AbortController;this.activeSseRequests.add(n);try{let i={Accept:"text/event-stream"};this.token&&(i.Authorization=`Bearer ${this.token}`),t.lastEventId!==void 0&&(i["Last-Event-ID"]=String(t.lastEventId),t.epoch!==void 0&&(i["X-Qwen-Event-Epoch"]=t.epoch));let o=t.signal?s0e([t.signal,n.signal]):n.signal,a=`${this.baseUrl}/session/${encodeURIComponent(e)}/events`;t.maxQueued!==void 0&&(a+=`?maxQueued=${encodeURIComponent(String(t.maxQueued))}`);let c,u=t.connectTimeoutMs;u&&Number.isFinite(u)&&(c=setTimeout(()=>n.abort(new DOMException("Initial connect timed out","TimeoutError")),u),typeof c=="object"&&c&&"unref"in c&&c.unref());let d;try{d=await this._fetch(a,{headers:i,signal:o})}finally{c!==void 0&&clearTimeout(c)}if(!d.ok){let p;try{let b=await d.text();try{p=JSON.parse(b)}catch{p=b}}catch{}let g=p&&typeof p=="object"&&"error"in p?String(p.error):`HTTP ${d.status}`;throw new Rc(d.status,p,`GET /session/:id/events: ${g}`)}let f=d.headers.get("content-type")??"";if(!f.toLowerCase().includes("text/event-stream")){try{await((s=d.body)==null?void 0:s.cancel())}catch{}throw new Rc(d.status,f,`GET /session/:id/events: expected content-type text/event-stream, got "${f}"`)}if(!d.body)throw new Error("No SSE body");let m=d.headers.get("x-qwen-event-epoch");m&&((r=t.onEpoch)==null||r.call(t,m)),yield*GX(d.body,o)}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 s0e(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 r0e=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.`);qe(this,"capability");this.name="DaemonCapabilityMissingError",this.capability=t}},i0e=["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"],Jb=["plan","default","auto-edit","auto","yolo"],Q_="/workspace/memory/remember",J_="/workspace/memory/forget",Z_="/workspace/memory/dream";function lB(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 eC=20,o0e=3e4,a0e=65e3,l0e=9e4,KX=35e3,cB=2147483647,c0e=5,g1=33e4,u0e="X-Qwen-Client-Id",Ze=encodeURIComponent;function YX(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 uB(e){let t=e.trim();if(!t)throw new Error("rule must be a non-empty string");return t}function XX(e){if(e===void 0)return c0e;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 d0e(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}function h0e(){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 dB=class extends Error{constructor(t,n,s){super(`Pending prompts full: "${t}" (${s}/${n})`),this.name="DaemonPendingPromptLimitError",this.sessionId=t,this.limit=n,this.pendingCount=s}};function QX(e){return typeof e=="object"&&e!==null&&e._daemonTurnError===!0}var lA=class{constructor(e){qe(this,"baseUrl");qe(this,"token");qe(this,"_fetch");qe(this,"fetchTimeoutMs");qe(this,"promptLimit");qe(this,"promptCounts",Object.create(null));qe(this,"transport");qe(this,"_authFlow");var n;this.baseUrl=d0e(e.baseUrl),this.token=e.token??h0e(),this._fetch=e.fetch??((n=e.transport)==null?void 0:n.restFetch)??globalThis.fetch.bind(globalThis);let t=e.fetchTimeoutMs??o0e;this.fetchTimeoutMs=Number.isFinite(t)&&t>0?t:0,this.promptLimit=XX(e.maxPendingPromptsPerSession),this.transport=e.transport??new n0e(this.baseUrl,this.token,this._fetch)}get auth(){return this._authFlow||(this._authFlow=new Qpe(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 dB(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?w8([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[u0e]=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 dB(typeof i.sessionId=="string"?i.sessionId:n,typeof i.limit=="number"?i.limit:0,typeof i.pendingCount=="number"?i.pendingCount:0)}return new Rc(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=${Ze(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 hB(this,Ze(e))}workspaceByCwd(e){return new hB(this,Ze(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 notify(e,t){return await this.jsonRequest("/workspace/notify","POST /workspace/notify",{method:"POST",body:e,timeoutMs:(t==null?void 0:t.timeoutMs)??KX,mode:"rest"})}async requireCapability(e){if(!(await this.capabilities()).features.includes(e))throw new r0e(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(e={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/reload`,{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/mcp/reload");return await t.json()})}async workspaceGit(e){return await this.jsonRequest(`/workspace/git${e!=null&&e.wait?"?wait=1":""}`,"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=${Ze(e)}`+(t!=null?`&oldPath=${Ze(t)}`:"");return await this.jsonRequest(n,"GET /workspace/git/diff/file",{mode:"rest"})}async workspaceGitLog(e,t,n){let s=new URLSearchParams;e!=null&&s.set("limit",String(e)),t!=null&&s.set("skip",String(t)),n&&s.set("range",n);let r=s.toString();return await this.jsonRequest(`/workspace/git/log${r?`?${r}`:""}`,"GET /workspace/git/log",{mode:"rest"})}async workspaceGitCommitDetail(e){return await this.jsonRequest(`/workspace/git/log/commit?sha=${Ze(e)}`,"GET /workspace/git/log/commit",{mode:"rest"})}async workspaceGitBranches(){return await this.jsonRequest("/workspace/git/branches","GET /workspace/git/branches",{mode:"rest"})}async workspaceGitCheckout(e){return await this.jsonRequest("/workspace/git/checkout","POST /workspace/git/checkout",{method:"POST",body:{ref:e},mode:"rest"})}async workspaceGitCreateBranch(e,t){return await this.jsonRequest("/workspace/git/branch","POST /workspace/git/branch",{method:"POST",body:{name:e,startPoint:t},mode:"rest"})}async workspaceGitPush(e){return await this.jsonRequest("/workspace/git/push","POST /workspace/git/push",{method:"POST",body:e??{},mode:"rest"})}async workspaceGitPull(e){return await this.jsonRequest("/workspace/git/pull","POST /workspace/git/pull",{method:"POST",body:e??{},mode:"rest"})}async workspaceGitCommit(e,t){return await this.jsonRequest("/workspace/git/commit","POST /workspace/git/commit",{method:"POST",body:{message:e,...t},mode:"rest"})}async workspaceMcpTools(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${Ze(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/${Ze(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/${Ze(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/${Ze(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/${Ze(e)}/interactions/${Ze(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/${Ze(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/${Ze(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/${Ze(e)}/update`,"POST /workspace/extensions/:name/update",{method:"POST",body:{},clientId:t,mode:"rest"})}async uninstallExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${Ze(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/${Ze(e)}/update`,"POST /extensions/:extensionId/update",{method:"POST",body:{},clientId:t,mode:"rest"})}async uninstallUserExtension(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/extensions/${Ze(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/${Ze(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/${Ze(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 f=new AbortController,m=t.signal?w8([t.signal,f.signal]):f.signal,p,g=new Promise((b,v)=>{let y=()=>{let x=o();v(x),f.abort(x)},w=()=>{let x=i-Date.now();if(x<=0){y();return}p=setTimeout(()=>{Date.now()>=i?y():w()},Math.min(x,cB))};w()});try{u=await Promise.race([this.extensionOperation(e.operationId,m),g])}finally{p!==void 0&&clearTimeout(p),f.abort()}}if(u.status!=="queued"&&u.status!=="running")return u;let d=i-Date.now();if(d<=0)throw o();await new Promise((f,m)=>{var b,v;let p=setTimeout(()=>{var y;(y=t.signal)==null||y.removeEventListener("abort",g),f()},Math.min(n,d,cB)),g=()=>{var y,w;clearTimeout(p),(y=t.signal)==null||y.removeEventListener("abort",g),m(((w=t.signal)==null?void 0:w.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 workspaceDirectoryPicker(){return await this.jsonRequest("/workspace-directory-picker","POST /workspace-directory-picker",{method:"POST",body:{},timeoutMs:31e4,mode:"rest"})}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(Q_,`POST ${Q_}`,{method:"POST",body:{content:e,contextMode:t.contextMode??"workspace"},clientId:t.clientId})}async getWorkspaceMemoryRememberTask(e,t){return await this.jsonRequest(`${Q_}/${Ze(e)}`,`GET ${Q_}/:taskId`,{clientId:t==null?void 0:t.clientId})}async forgetWorkspaceMemory(e,t={}){return await this.jsonRequest(J_,`POST ${J_}`,{method:"POST",body:{query:e},clientId:t.clientId})}async getWorkspaceMemoryForgetTask(e,t){return await this.jsonRequest(`${J_}/${Ze(e)}`,`GET ${J_}/:taskId`,{clientId:t==null?void 0:t.clientId})}async dreamWorkspaceMemory(e={}){return await this.jsonRequest(Z_,`POST ${Z_}`,{method:"POST",body:{},clientId:e.clientId})}async getWorkspaceMemoryDreamTask(e,t){return await this.jsonRequest(`${Z_}/${Ze(e)}`,`GET ${Z_}/: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()},g1)}async*generateContentEvents(e,t,n,s,r,i){var c;let o=await this.transport.fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.headers({"Content-Type":"application/json",Accept:"text/event-stream"},s==null?void 0:s.clientId),body:JSON.stringify(n),signal:s==null?void 0:s.signal});if(!o.ok)throw await this.failOnError(o,t);if(!o.body)throw new Error("Generation response body is missing");let a=!1;for await(let u of GX(o.body,s==null?void 0:s.signal)){let d=r(u);if(d&&(a=d.type==="done"||d.type==="error",yield d,i&&a))return}if(i&&!((c=s==null?void 0:s.signal)!=null&&c.aborted)&&!a)throw new Error("Stream ended without terminal event")}async*generateWorkspaceContent(e,t){yield*this.generateContentEvents("/workspace/generate","POST /workspace/generate",{prompt:e},t,lB,!0)}async getWorkspaceAgent(e,t={}){let n=t.scope?`${this.baseUrl}/workspace/agents/${Ze(e)}?scope=${Ze(t.scope)}`:`${this.baseUrl}/workspace/agents/${Ze(e)}`;return await this.fetchWithTimeout(n,{headers:this.headers()},async s=>{if(!s.ok)throw await this.failOnError(s,"GET /workspace/agents/:agentType");return await s.json()})}async updateWorkspaceAgent(e,t,n={},s){let r=n.scope?`${this.baseUrl}/workspace/agents/${Ze(e)}?scope=${Ze(n.scope)}`:`${this.baseUrl}/workspace/agents/${Ze(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/${Ze(e)}?scope=${Ze(t.scope)}`:`${this.baseUrl}/workspace/agents/${Ze(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}:{},...e.branch!==void 0?{branch:e.branch}:{}})},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)??eC,s=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(n)?n:eC))),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/${Ze(e)}/sessions?${r.toString()}`,"GET /workspace/sessions")}async listSessionGroups(e){return await this.jsonRequest(`/workspace/${Ze(e)}/session-groups`,"GET /workspace/session-groups")}async createSessionGroup(e,t){return(await this.jsonRequest(`/workspace/${Ze(e)}/session-groups`,"POST /workspace/session-groups",{method:"POST",body:t})).group}async updateSessionGroup(e,t,n){return(await this.jsonRequest(`/workspace/${Ze(e)}/session-groups/${Ze(t)}`,"PATCH /workspace/session-groups/:groupId",{method:"PATCH",body:n})).group}async deleteSessionGroup(e,t){return await this.jsonRequest(`/workspace/${Ze(e)}/session-groups/${Ze(t)}`,"DELETE /workspace/session-groups/:groupId",{method:"DELETE"})}async updateSessionOrganization(e,t,n){return await this.jsonRequest(`/session/${Ze(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/${Ze(e)}/export`,"GET /session/:id/export",t)}async getSessionTranscriptPage(e,t={}){return await this.jsonRequest(`/session/${Ze(e)}/transcript${YX(t)}`,"GET /session/:id/transcript",{clientId:t.clientId,mode:"rest"})}async resolveSubagentSession(e,t,n){return await this.jsonRequest(`/session/${Ze(e)}/subagents/${Ze(t)}`,"GET /session/:id/subagents/:toolCallId",{clientId:n,mode:"rest"})}async cancelSubagentSession(e,t,n){return await this.jsonRequest(`/session/${Ze(e)}/subagents/${Ze(t)}/cancel`,"POST /session/:id/subagents/:toolCallId/cancel",{clientId:n,mode:"rest",method:"POST"})}async resumeSession(e,t={},n){return this.restoreSession("resume",e,t,n)}async branchSession(e,t={},n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Ze(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/${Ze(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/${Ze(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/${Ze(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/${Ze(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/${Ze(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/${Ze(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/${Ze(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/${Ze(e)}/tasks/${Ze(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/${Ze(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/${Ze(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/${Ze(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/${Ze(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/${Ze(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/${Ze(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/${Ze(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){yield*this.generateContentEvents(`/session/${Ze(e)}/generate`,"POST /session/:id/generate",{prompt:t},n,lB,!1)}async btwSession(e,t,n){let s=await this.transport.fetch(`${this.baseUrl}/session/${Ze(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/${Ze(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/${Ze(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/${Ze(e)}/pending-prompts/${Ze(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/${Ze(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/${Ze(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/${Ze(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/${Ze(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??a0e,"rest")}async workspaceTrust(e){let t=(e==null?void 0:e.statusVersion)===2?"?statusVersion=2":"";return await this.fetchWithTimeout(`${this.baseUrl}/workspace/trust${t}`,{method:"GET",headers:this.headers({},e==null?void 0:e.clientId)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /workspace/trust");return await n.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=uB(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=uB(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=${Ze(String(t.entryIndex))}`;return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${Ze(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)??g1)}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)}workspaceChannelTypes(e){return this.jsonRequest("/workspace/channel-types","GET /workspace/channel-types",{clientId:e==null?void 0:e.clientId,timeoutMs:e==null?void 0:e.timeoutMs,mode:"rest"})}workspaceChannels(e){return this.jsonRequest("/workspace/channels","GET /workspace/channels",{clientId:e==null?void 0:e.clientId,timeoutMs:e==null?void 0:e.timeoutMs,mode:"rest"})}upsertWorkspaceChannel(e,t,n){return this.jsonRequest(`/workspace/channels/${Ze(e)}`,"PUT /workspace/channels/:name",{method:"PUT",body:t,clientId:n==null?void 0:n.clientId,timeoutMs:(n==null?void 0:n.timeoutMs)??213e4,mode:"rest"})}deleteWorkspaceChannel(e,t,n){return this.jsonRequest(`/workspace/channels/${Ze(e)}`,"DELETE /workspace/channels/:name",{method:"DELETE",body:t,clientId:n==null?void 0:n.clientId,timeoutMs:(n==null?void 0:n.timeoutMs)??213e4,mode:"rest"})}setWorkspaceChannelStartup(e,t,n){return this.jsonRequest(`/workspace/channels/${Ze(e)}/startup`,"PUT /workspace/channels/:name/startup",{method:"PUT",body:t,clientId:n==null?void 0:n.clientId,timeoutMs:(n==null?void 0:n.timeoutMs)??213e4,mode:"rest"})}startWorkspaceChannel(e,t){return this.workspaceChannelAction(e,"start",t)}stopWorkspaceChannel(e,t){return this.workspaceChannelAction(e,"stop",t)}restartWorkspaceChannel(e,t){return this.workspaceChannelAction(e,"restart",t)}workspaceChannelPairingRequests(e,t){return this.jsonRequest(`/workspace/channels/${Ze(e)}/pairing-requests`,"GET /workspace/channels/:name/pairing-requests",{clientId:t==null?void 0:t.clientId,timeoutMs:t==null?void 0:t.timeoutMs,mode:"rest"})}approveWorkspaceChannelPairing(e,t,n){return this.jsonRequest(`/workspace/channels/${Ze(e)}/pairing-requests/approve`,"POST /workspace/channels/:name/pairing-requests/approve",{method:"POST",body:t,clientId:n==null?void 0:n.clientId,timeoutMs:(n==null?void 0:n.timeoutMs)??213e4,mode:"rest"})}workspaceChannelAction(e,t,n){return this.jsonRequest(`/workspace/channels/${Ze(e)}/${t}`,`POST /workspace/channels/:name/${t}`,{method:"POST",body:{},clientId:n==null?void 0:n.clientId,timeoutMs:(n==null?void 0:n.timeoutMs)??213e4,mode:"rest"})}async manageMcpServer(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${Ze(e)}/${Ze(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)??g1)}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)??g1)}async removeRuntimeMcpServer(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/servers/${Ze(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)??g1)}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:l0e})}async setSessionModel(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Ze(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/${Ze(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/${Ze(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,a.eventEpoch)}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/${Ze(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,i){let o=new AbortController,a=s?w8([s,o.signal]):o.signal;try{let c=this.subscribeEvents(e,{lastEventId:n,...i!==void 0?{epoch:i}:{},signal:a});for await(let u of c){let d=hI(u,t);if(d!==void 0)return d}throw new Error("SSE stream ended")}catch(c){throw s!=null&&s.aborted&&c instanceof DOMException&&c.name==="AbortError"&&this.cancel(e,r).catch(()=>{}),c}finally{o.signal.aborted||o.abort()}}async heartbeat(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Ze(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/${Ze(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,epoch:t.epoch,onEpoch:t.onEpoch,maxQueued:t.maxQueued,signal:t.signal,connectTimeoutMs:this.fetchTimeoutMs||void 0})}async respondToPermission(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/permission/${Ze(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/${Ze(e)}/permission/${Ze(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/${Ze(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/${Ze(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/${Ze(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/${Ze(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(Ze(e),"","PATCH /workspaces/:workspace",{method:"PATCH",body:t,mode:"rest"})}async addScratchWorkspace(){return await this.fetchWithTimeout(`${this.baseUrl}/workspaces`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:JSON.stringify({kind:"scratch"})},async e=>{if(!e.ok)throw await this.failOnError(e,"POST /workspaces");return await e.json()})}dispose(){this.transport.dispose()}async listSessionArtifacts(e,t){return await this.jsonRequest(`/session/${Ze(e)}/artifacts`,"GET /session/:id/artifacts",{clientId:t})}async addSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${Ze(e)}/artifacts`,"POST /session/:id/artifacts",{method:"POST",body:t,clientId:n})}async removeSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${Ze(e)}/artifacts/${Ze(t)}`,"DELETE /session/:id/artifacts/:artifactId",{method:"DELETE",clientId:n})}async updateSessionMetadata(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Ze(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")})}},hB=class{constructor(e,t){this.client=e,this.workspaceSelector=t}workspaceMcp(){return this.get("/mcp","GET /workspaces/:workspace/mcp")}notify(e,t){return this.client.workspaceJsonRequest(this.workspaceSelector,"/notify","POST /workspaces/:workspace/notify",{method:"POST",body:e,timeoutMs:(t==null?void 0:t.timeoutMs)??KX,mode:"rest"})}workspaceChannelTypes(e){return this.channelRequest("/channel-types","GET /workspaces/:workspace/channel-types",void 0,e)}workspaceChannels(e){return this.channelRequest("/channels","GET /workspaces/:workspace/channels",void 0,e)}upsertWorkspaceChannel(e,t,n){return this.channelRequest(`/channels/${Ze(e)}`,"PUT /workspaces/:workspace/channels/:name",{method:"PUT",body:t},n)}deleteWorkspaceChannel(e,t,n){return this.channelRequest(`/channels/${Ze(e)}`,"DELETE /workspaces/:workspace/channels/:name",{method:"DELETE",body:t},n)}setWorkspaceChannelStartup(e,t,n){return this.channelRequest(`/channels/${Ze(e)}/startup`,"PUT /workspaces/:workspace/channels/:name/startup",{method:"PUT",body:t},n)}startWorkspaceChannel(e,t){return this.channelAction(e,"start",t)}stopWorkspaceChannel(e,t){return this.channelAction(e,"stop",t)}restartWorkspaceChannel(e,t){return this.channelAction(e,"restart",t)}workspaceChannelPairingRequests(e,t){return this.channelRequest(`/channels/${Ze(e)}/pairing-requests`,"GET /workspaces/:workspace/channels/:name/pairing-requests",void 0,t)}approveWorkspaceChannelPairing(e,t,n){return this.channelRequest(`/channels/${Ze(e)}/pairing-requests/approve`,"POST /workspaces/:workspace/channels/:name/pairing-requests/approve",{method:"POST",body:t},n)}channelAction(e,t,n){return this.channelRequest(`/channels/${Ze(e)}/${t}`,`POST /workspaces/:workspace/channels/:name/${t}`,{method:"POST",body:{}},n)}channelRequest(e,t,n,s){return this.client.workspaceJsonRequest(this.workspaceSelector,e,t,{...n??{},clientId:s==null?void 0:s.clientId,timeoutMs:(s==null?void 0:s.timeoutMs)??(n?213e4:void 0),mode:"rest"})}initializeWorkspaceMcp(){return this.post("/mcp/initialize","POST /workspaces/:workspace/mcp/initialize",{})}reloadWorkspaceMcp(e={}){return this.post("/mcp/reload","POST /workspaces/:workspace/mcp/reload",e)}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=new URLSearchParams;e!=null&&e.cwd&&t.set("cwd",e.cwd),e!=null&&e.wait&&t.set("wait","1");let n=t.toString(),s=n?`/git?${n}`:"/git";return this.client.workspaceJsonRequest(this.workspaceSelector,s,"GET /workspaces/:workspace/git",{mode:"rest"})}workspaceGitDiff(e){let t=e!=null?`/git/diff?cwd=${Ze(e)}`:"/git/diff";return this.client.workspaceJsonRequest(this.workspaceSelector,t,"GET /workspaces/:workspace/git/diff",{mode:"rest"})}workspaceGitDiffFile(e,t,n){let s=`/git/diff/file?path=${Ze(e)}`+(t!=null?`&oldPath=${Ze(t)}`:"")+(n!=null?`&cwd=${Ze(n)}`:"");return this.client.workspaceJsonRequest(this.workspaceSelector,s,"GET /workspaces/:workspace/git/diff/file",{mode:"rest"})}workspaceGitLog(e,t,n,s){let r=new URLSearchParams;e!=null&&r.set("limit",String(e)),t!=null&&r.set("skip",String(t)),n!=null&&r.set("cwd",n),s&&r.set("range",s);let i=r.toString();return this.client.workspaceJsonRequest(this.workspaceSelector,`/git/log${i?`?${i}`:""}`,"GET /workspaces/:workspace/git/log",{mode:"rest"})}workspaceGitCommitDetail(e,t){let n=`/git/log/commit?sha=${Ze(e)}`+(t!=null?`&cwd=${Ze(t)}`:"");return this.client.workspaceJsonRequest(this.workspaceSelector,n,"GET /workspaces/:workspace/git/log/commit",{mode:"rest"})}workspaceGitBranches(e){let t=e!=null?`/git/branches?cwd=${Ze(e)}`:"/git/branches";return this.client.workspaceJsonRequest(this.workspaceSelector,t,"GET /workspaces/:workspace/git/branches",{mode:"rest"})}workspaceGitCheckout(e,t){let n=t!=null?`/git/checkout?cwd=${Ze(t)}`:"/git/checkout";return this.client.workspaceJsonRequest(this.workspaceSelector,n,"POST /workspaces/:workspace/git/checkout",{method:"POST",body:{ref:e},mode:"rest"})}workspaceGitCreateBranch(e,t,n){let s=n!=null?`/git/branch?cwd=${Ze(n)}`:"/git/branch";return this.client.workspaceJsonRequest(this.workspaceSelector,s,"POST /workspaces/:workspace/git/branch",{method:"POST",body:{name:e,startPoint:t},mode:"rest"})}workspaceGitPush(e,t){let n=t!=null?`/git/push?cwd=${Ze(t)}`:"/git/push";return this.client.workspaceJsonRequest(this.workspaceSelector,n,"POST /workspaces/:workspace/git/push",{method:"POST",body:e??{},mode:"rest"})}workspaceGitPull(e,t){let n=t!=null?`/git/pull?cwd=${Ze(t)}`:"/git/pull";return this.client.workspaceJsonRequest(this.workspaceSelector,n,"POST /workspaces/:workspace/git/pull",{method:"POST",body:e??{},mode:"rest"})}workspaceGitCommit(e,t,n){let s=n!=null?`/git/commit?cwd=${Ze(n)}`:"/git/commit";return this.client.workspaceJsonRequest(this.workspaceSelector,s,"POST /workspaces/:workspace/git/commit",{method:"POST",body:{message:e,...t},mode:"rest"})}workspaceGitHubPullRequests(){return this.client.workspaceJsonRequest(this.workspaceSelector,"/github/prs","GET /workspaces/:workspace/github/prs",{mode:"rest"})}workspaceGitHubCreatePullRequest(e,t){let n=t!=null?`/github/prs/create?cwd=${Ze(t)}`:"/github/prs/create";return this.client.workspaceJsonRequest(this.workspaceSelector,n,"POST /workspaces/:workspace/github/prs/create",{method:"POST",body:e,mode:"rest"})}workspaceGitHubDefaultBranch(){return this.client.workspaceJsonRequest(this.workspaceSelector,"/github/default-branch","GET /workspaces/:workspace/github/default-branch",{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/${Ze(e)}`,"GET /workspaces/:workspace/agents/:agentType")}updateWorkspaceAgent(e,t,n={}){let s=n.scope?`?scope=${Ze(n.scope)}`:"";return this.post(`/agents/${Ze(e)}${s}`,"POST /workspaces/:workspace/agents/:agentType",t,n.clientId)}async deleteWorkspaceAgent(e,t={}){let n=t.scope?`?scope=${Ze(t.scope)}`:"";return await this.client.workspaceNoContentRequest(this.workspaceSelector,`/agents/${Ze(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)??eC,n=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(t)?t:eC))),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/${Ze(e)}/transcript${YX(t)}`,"GET /workspaces/:workspace/session/:id/transcript",{clientId:t.clientId,mode:"rest"})}exportSession(e,t={}){return this.client.sessionExportRequest(`/workspaces/${this.workspaceSelector}/session/${Ze(e)}/export`,"GET /workspaces/:workspace/session/:id/export",t)}exportArchivedSession(e,t={}){return this.client.sessionExportRequest(`/workspaces/${this.workspaceSelector}/session/${Ze(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/${Ze(e)}`,"PATCH /workspaces/:workspace/session-groups/:groupId",{method:"PATCH",body:t})).group}deleteSessionGroup(e){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session-groups/${Ze(e)}`,"DELETE /workspaces/:workspace/session-groups/:groupId",{method:"DELETE"})}updateSessionOrganization(e,t,n){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session/${Ze(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((e==null?void 0:e.statusVersion)===2?"/trust?statusVersion=2":"/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/${Ze(e)}/enable`,"POST /workspaces/:workspace/tools/:name/enable",{enabled:t},n==null?void 0:n.clientId)}setWorkspaceSkillEnabled(e,t,n){return this.post(`/skills/${Ze(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=${Ze(String(t.entryIndex))}`;return this.post(`/mcp/${Ze(e)}/restart${n}`,"POST /workspaces/:workspace/mcp/:server/restart",{},t==null?void 0:t.clientId,(t==null?void 0:t.timeoutMs)??g1)}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/${Ze(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/${Ze(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 w8(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 hI(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 Rc(500,n.code??"turn_error",n.message??"Prompt failed"),{_daemonTurnError:!0})}}function fB(e){return"promptId"in e&&"lastEventId"in e}var rw=class q2{constructor(t){qe(this,"client");qe(this,"session");qe(this,"state");qe(this,"replaySnapshot");qe(this,"hasActivePrompt");qe(this,"historyHasMore");qe(this,"historyAnchorRecordId");qe(this,"replayDegraded");qe(this,"lastSeenEventId");qe(this,"lastSeenEpoch");qe(this,"subscriptionActive",!1);qe(this,"reattaching");qe(this,"promptLimit");qe(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.historyAnchorRecordId=t.historyAnchorRecordId,this.replayDegraded=t.replayDegraded??!1,this.replaySnapshot=t.replaySnapshot??{compactedReplay:[],liveJournal:[]},this.lastSeenEventId=eS(t.lastEventId),this.lastSeenEpoch=t.eventEpoch,this.promptLimit=t.maxPendingPromptsPerSession===void 0?t.client.maxPendingPromptsPerSession:XX(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 q2({client:t,session:r,hasActivePrompt:r.hasActivePrompt,lastEventId:i,eventEpoch:r.eventEpoch})}static async load(t,n,s={},r){let{state:i,hasActivePrompt:o,compactedReplay:a,liveJournal:c,historyHasMore:u,historyAnchorRecordId:d,replayDegraded:f,lastEventId:m,eventEpoch:p,...g}=await t.loadSession(n,s,r);return new q2({client:t,session:g,hasActivePrompt:o,state:i,lastEventId:m??0,eventEpoch:p,replaySnapshot:{compactedReplay:a??[],liveJournal:c??[]},historyHasMore:u,historyAnchorRecordId:d,replayDegraded:f})}static async resume(t,n,s={},r){let{state:i,hasActivePrompt:o,lastEventId:a,eventEpoch:c,...u}=await t.resumeSession(n,s,r);return new q2({client:t,session:u,hasActivePrompt:o,state:i,lastEventId:a??0,eventEpoch:c})}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 branch(){return this.session.branch}get lastEventId(){return this.lastSeenEventId}setLastEventId(t){this.lastSeenEventId=eS(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)),!fB(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(!fB(s))throw new Error("Expected non-blocking prompt acceptance");return s}async withClientIdSelfHeal(t){try{return await t()}catch(n){if(!f0e(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=eS(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),o=r.epoch??(s?this.lastSeenEpoch:void 0),a=r.onEpoch;for await(let c of this.client.subscribeEvents(this.sessionId,{...r,lastEventId:i,...o!==void 0?{epoch:o}:{},onEpoch:u=>{this.lastSeenEpoch=u,a==null||a(u)}}))this._dispatchTurnEvent(c),yield c,c.id!==void 0&&(this.lastSeenEventId=Math.max(this.lastSeenEventId??0,eS(c.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=hI(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 eS(e){if(e!==void 0){if(!Number.isInteger(e)||e<0)throw new TypeError("invalid lastEventId");return e}}function f0e(e){return e instanceof Rc&&e.status===400&&typeof e.body=="object"&&e.body!==null&&e.body.code==="invalid_client_id"}var JX="mid_turn_message_injected",fI="pending_prompt_added",mI="pending_prompt_started",pI="pending_prompt_completed",m0e=["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",JX,fI,mI,pI,"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","channel_delivery_result","user_shell_command","user_shell_result","turn_complete","turn_error","session_rewound","session_branched","session_snapshot","git_branch_changed","git_status_changed"];new Set(m0e);var cA="daemon-plan";function Xt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function dt(e,t){if(!Xt(e))return;let n=e[t];return typeof n=="string"?n:void 0}function jr(e,t){if(Xt(e))for(let n of t){let s=e[n];if(typeof s=="string"&&s.trim().length>0)return s}}function Hm(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 uf(e){return Hm(zh(e))}function zh(e,t=0){return t>16?"[truncated]":Array.isArray(e)?e.map(n=>zh(n,t+1)):Xt(e)?Object.fromEntries(Object.entries(e).map(([n,s])=>[n,ZX(n)?"[redacted]":zh(s,t+1)])):e}function ZX(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 v8(e){if(typeof e=="string")return e;if(!Xt(e))return"";let t=e.text;return typeof t=="string"?t:""}function p0e(e){if(typeof e=="string")return{kind:"text",text:e};if(!Xt(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=Xt(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=Xt(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 g0e=64;function tC(e,t=0){if(t>g0e)return"[output truncated]";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(s=>tC(s,t+1)).filter(Boolean).join(`
`);if(!Xt(e))return e===void 0?"":Hm(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=tC(n,t+1);if(s)return s}return Hm(e)}var b0e=new Set(i0e),eQ=new Set(["qwen","qwen-oauth"]),y0e=new Set(["in_flight","disabled","budget_would_exceed","authentication_required"]),mB="malformed memory_changed payload",pB=4096,gB="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 w0e(e,t={}){let n=E0e(e,t);switch(e.type){case"session_update":return A0e(e,n,t);case"shell_output":{let s=tC(e.data),r=dA(e.data),i=hA(e.data);return s?[{...n,type:i==="user-shell"?"user.shell.output":"shell.output",text:s,...r?{stream:r}:{}}]:[]}case"permission_request":return O0e(e,n);case"permission_resolved":case"permission_already_resolved":return $0e(e,n);case"model_switched":return[{...n,type:"model.changed",modelId:dt(e.data,"modelId")??"unknown"}];case"model_switch_failed":return[{...n,type:"error",recoverable:!0,text:dt(e.data,"error")??"Model switch failed (no details available)"}];case"session_died":{let s=x8(dt(e.data,"errorKind"));return[{...n,type:"error",recoverable:!1,...s?{errorKind:s}:{},text:dt(e.data,"reason")??"Session died (no details available)"}]}case"session_closed":return[{...n,type:"status",text:`Session closed: ${dt(e.data,"reason")??"closed"}`}];case"session_recording_degraded":return!dt(e.data,"sessionId")||dt(e.data,"reason")!=="write_failed"?ar(e,n,"malformed recording state"):[{...n,type:"error",recoverable:!0,code:"session_recording_degraded",text:gB}];case"session_snapshot":{if(!Xt(e.data)||!dt(e.data,"sessionId"))return ar(e,n,"malformed recording snapshot");let s=e.data.recordingDegraded;return s!==void 0&&typeof s!="boolean"?ar(e,n,"malformed recording snapshot"):s===!0?[{...n,type:"error",recoverable:!0,code:"session_recording_degraded",text:gB}]:[]}case"client_evicted":return[{...n,type:"error",recoverable:!0,text:dt(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=x8(dt(e.data,"errorKind"));return[{...n,type:"error",recoverable:!0,...s?{errorKind:s}:{},text:dt(e.data,"error")??"SSE stream error (no details available)"}]}case"turn_error":{let s=dt(e.data,"code"),r=x8(dt(e.data,"errorKind")),i=dt(e.data,"promptId");return[{...n,type:"error",source:"turn_error",recoverable:!0,...s?{code:s}:{},...r?{errorKind:r}:{},...i?{promptId:i}:{},text:dt(e.data,"message")??"Prompt failed (no details available)"}]}case"state_resync_required":return x0e(e,n);case"history_truncated":return k0e(e,n);case"session_rewound":return _0e(e,n);case"session_branched":return S0e(e,n);case"prompt_cancelled":{let s=uge(e.data,"reason");return[{...n,type:"prompt.cancelled",...s?{reason:s}:{}}]}case"followup_suggestion":return C0e(e,n);case"mid_turn_message_injected":return T0e(e,n);case"pending_prompt_added":case"pending_prompt_started":case"pending_prompt_completed":return[];case"user_shell_command":{let s=dt(e.data,"command"),r=dt(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=ui(e.data,"exitCode"),r=Xt(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=ui(e.data,"replayedCount")??0,r=ui(e.data,"lastReplayedEventId")??ui(e.data,"lastEventId");return[{...n,type:"session.replay_complete",replayedCount:s,...r!==void 0?{lastReplayedEventId:r}:{}}]}case"session_metadata_updated":return H0e(e,n);case"approval_mode_changed":return U0e(e,n);case"git_branch_changed":return[];case"git_status_changed":return[];case"memory_changed":return W0e(e,n);case"agent_changed":return V0e(e,n);case"tool_toggled":return G0e(e,n);case"settings_changed":return K0e(e,n);case"settings_reloaded":return Y0e(e,n);case"trust_change_requested":return Q0e(e,n);case"workspace_initialized":return X0e(e,n);case"github_setup_completed":return J0e(e,n);case"mcp_budget_warning":return Z0e(e,n);case"mcp_child_refused_batch":return ege(e,n);case"mcp_server_restarted":return tge(e,n);case"mcp_server_restart_refused":return nge(e,n);case"mcp_server_added":return k8(e,n,"added");case"mcp_server_removed":return k8(e,n,"removed");case"mcp_server_changed":return k8(e,n);case"extensions_changed":return sge(e,n);case"artifact_changed":return q0e(e,n);case"auth_device_flow_started":return rge(e,n);case"auth_device_flow_throttled":return ige(e,n);case"auth_device_flow_authorized":return oge(e,n);case"auth_device_flow_failed":return age(e,n);case"auth_device_flow_cancelled":return cge(e,n);default:return v0e(e,n)}}function v0e(e,t){return[{...t,type:"debug",text:`${e.type} (unrecognized daemon event): ${uf(e.data)}`}]}function x0e(e,t){let n=dt(e.data,"reason"),s=ui(e.data,"lastDeliveredId"),r=ui(e.data,"earliestAvailableId");return!n||s===void 0||r===void 0?ar(e,t,"malformed state_resync_required payload"):[{...t,type:"session.state_resync_required",reason:n,lastDeliveredId:s,earliestAvailableId:r}]}function k0e(e,t){let n=dt(e.data,"reason"),s=ui(e.data,"truncatedEvents"),r=ui(e.data,"retainedEvents"),i=ui(e.data,"maxBytes");return n!=="replay_window_exceeded"||s===void 0||r===void 0||i===void 0||!Xt(e.data)||typeof e.data.fullTranscriptAvailable!="boolean"?ar(e,t,"malformed history_truncated payload"):[{...t,type:"status",text:`History truncated: retained ${r}, dropped ${s} (window ${i} bytes).`,source:"history_truncated"}]}function _0e(e,t){let n=dt(e.data,"promptId"),s=ui(e.data,"targetTurnIndex");if(!n||s===void 0)return ar(e,t,"malformed session_rewound payload");let r=dt(e.data,"sessionId");return[{...t,type:"session.rewound",promptId:n,targetTurnIndex:s,...r?{sessionId:r}:{}}]}function S0e(e,t){let n=dt(e.data,"sourceSessionId"),s=dt(e.data,"newSessionId"),r=dt(e.data,"displayName");return!n||!s||!r?ar(e,t,"malformed session_branched payload"):[{...t,type:"session.branched",sourceSessionId:n,newSessionId:s,displayName:r}]}function C0e(e,t){let n=dt(e.data,"sessionId"),s=dt(e.data,"suggestion"),r=dt(e.data,"promptId");return!n||!s||!r?ar(e,t,"malformed followup_suggestion payload"):[{...t,type:"followup.suggestion",sessionId:n,suggestion:s,promptId:r}]}function T0e(e,t){if(!Xt(e.data))return ar(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?ar(e,t,"malformed mid_turn_message_injected"):[{...t,type:"status",text:`Inserted message: ${n.join(`
`)}`,source:"mid_turn_message_injected",data:e.data}]}function E0e(e,t){let n=tQ(e),s=N0e(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:zh(e.data)}}:{}}}function tQ(e){let t=e.serverTimestamp;if(typeof t=="number"&&Number.isFinite(t))return t;let n=e._meta;if(Xt(n)){let s=n.serverTimestamp;if(typeof s=="number"&&Number.isFinite(s))return s}if(Xt(e.data)){let s=e.data._meta,r=e.data.update,i=Xt(r)?r._meta:void 0;if(Xt(s)){let a=s.serverTimestamp;if(typeof a=="number"&&Number.isFinite(a))return a}if(Xt(i)){let a=i.serverTimestamp;if(typeof a=="number"&&Number.isFinite(a))return a}let o=[Xt(i)?i.timestamp:void 0,Xt(r)?r.timestamp:void 0,Xt(s)?s.timestamp:void 0,e.data.timestamp];for(let a of o){let c=j0e(a);if(c!==void 0)return c}}}function j0e(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e!="string")return;if(/^\d+$/.test(e)){let n=Number(e);return Number.isFinite(n)?n:void 0}let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function A0e(e,t,n){let s=nQ(e.data);if(!s)return[{...t,type:"debug",text:`session_update: ${uf(e.data)}`}];let r=dt(s,"sessionUpdate");switch(r){case"user_message_chunk":{if(n.suppressOwnUserEcho&&n.clientId&&e.originatorClientId===n.clientId)return[];let i=yB(s),o=s.content,a=p0e(o);if(a){if(a.kind==="image"){let u=a.source.data,d=a.mediaType||"image/*";if(d==="image/*"&&u){let f=(u.startsWith("data:")?u.split(",")[1]??"":u).slice(0,10);f.startsWith("iVBORw0KGg")?d="image/png":f.startsWith("/9j/")?d="image/jpeg":f.startsWith("R0lGOD")?d="image/gif":f.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=v8(o);return c?[{...t,type:"user.text.delta",text:c,...i?{meta:i}:{}}]:[]}case"agent_message_chunk":{let i=v8(s.content),o=bB(s),a=yB(s),c=[];i&&c.push({...t,type:"assistant.text.delta",text:i,...o?{parentToolCallId:o}:{},...a?{meta:a}:{}});let u=M0e(s);return u&&c.push({...t,type:"assistant.usage",usage:u,...o?{parentToolCallId:o}:{}}),c}case"agent_thought_chunk":{let i=v8(s.content);if(!i)return[];let o=bB(s);return[{...t,type:"thought.text.delta",text:i,...o?{parentToolCallId:o}:{}}]}case"tool_call":case"tool_call_update":{let i=Xt(s._meta)?s._meta:void 0;return dt(s,"status")==="in_progress"&&dt(s,"kind")===void 0&&(i==null?void 0:i.shellProgress)!==void 0?[]:[I0e(s,t)]}case"shell_output":case"tool_output":{let i=tC(s),o=dA(s)??dA(e.data),a=hA(s)??hA(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(Xt);return[{...t,type:"session.available_commands",count:i.length,commands:i}]}case"plan":return[R0e(s,t)];case"current_mode_update":return[];default:return[{...t,type:"debug",text:`${r??"session_update"}: ${uf(s)}`}]}}function bB(e){let t=Xt(e._meta)?e._meta:void 0;return t?dt(t,"parentToolCallId"):void 0}function yB(e){let t=Xt(e._meta)?e._meta:void 0;if(!t)return;let{qwenTranscript:n,...s}=t;return Object.keys(s).length>0?s:void 0}function N0e(e){var i;if(!Xt(e.data))return;let t=nQ(e.data),n=t&&Xt(t._meta)?t._meta:void 0,s=(i=n&&Xt(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 M0e(e){let t=Xt(e._meta)?e._meta:void 0,n=t&&Xt(t.usage)?t.usage:void 0;if(!n)return;let s=ui(n,"inputTokens"),r=ui(n,"outputTokens");if(s===void 0&&r===void 0)return;let i=ui(n,"cachedReadTokens");return{inputTokens:s??0,outputTokens:r??0,...i!==void 0?{cachedTokens:i}:{}}}function I0e(e,t){let n=Xt(e._meta)?e._meta:void 0,s=dt(e,"toolName")??dt(e,"name")??(n?dt(n,"toolName"):void 0)??(n?dt(n,"name"):void 0),r=dt(e,"kind"),i=dt(e,"title")??(dt(e,"sessionUpdate")==="tool_call"?s??r:void 0),o=e.rawInput??e.input??e.args,a=e.rawOutput??e.output??e.result,c=o!==void 0?zh(o):void 0,u=a!==void 0?zh(a):void 0,d=e.content!==void 0?zh(e.content):void 0,f=e.locations!==void 0?zh(e.locations):void 0,m=dt(e,"toolCallId"),p=dt(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}=L0e(e,s),v=dt(e,"parentToolCallId")??(n?dt(n,"parentToolCallId"):void 0),y=v&&v!==m?v:void 0,w=dt(e,"subagentType")??(n?dt(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}:{},...f!==void 0?{locations:f}:{},...g?{provenance:g}:{},...b?{serverId:b}:{},...y?{parentToolCallId:y}:{},...w?{subagentType:w}:{},...c!==void 0?{rawInput:c}:{},...u!==void 0?{rawOutput:u}:{},...c!==void 0?{details:uA(uf(c))}:u!==void 0?{details:uA(uf(u))}:{}}}function R0e(e,t){let n=Array.isArray(e.entries)?e.entries:[],s=uA(D0e(n)),r=Xt(e._meta)?e._meta:void 0,i=r&&Xt(r.qwenTranscript)?r.qwenTranscript:void 0,o=dt(i,"planToolCallId")??(t.eventId!==void 0?`${cA}-${t.eventId}`:cA),a=r&&Xt(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 D0e(e){return e.flatMap(t=>{if(!Xt(t))return[];let n=dt(t,"content");return n?[`- [${P0e(dt(t,"status"))}] ${n}`]:[]}).join(`
`)}function P0e(e){switch(e){case"completed":return"x";case"in_progress":return"-";default:return" "}}function L0e(e,t){let n=dt(e,"provenance"),s=dt(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 x8(e){if(e)return b0e.has(e)?e:void 0}function uA(e){return e.length<=pB?e:`${e.slice(0,pB)}... [truncated]`}function O0e(e,t){if(!Xt(e.data))return[{...t,type:"debug",text:`permission_request: ${uf(e.data)}`}];let n=dt(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`permission_request: ${uf(e.data)}`}];let s=e.data.toolCall!==void 0?zh(e.data.toolCall):void 0;return[{...t,type:"permission.request",requestId:n,sessionId:dt(e.data,"sessionId"),title:F0e(s),options:B0e(e.data.options),toolCall:s}]}function $0e(e,t){let n=dt(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`${e.type}: ${uf(e.data)}`}];let s=dt(e.data,"voterClientId")??t.originatorClientId;return[{...t,type:"permission.resolved",requestId:n,outcome:z0e(e.data),...s?{voterClientId:s}:{}}]}function nQ(e){if(!Xt(e))return;let t=e.update;return Xt(t)?t:e}function B0e(e){return Array.isArray(e)?e.flatMap(t=>{if(!Xt(t))return[];let n=dt(t,"optionId");return n?[{optionId:n,label:dt(t,"label")??dt(t,"title")??dt(t,"name")??n,...dt(t,"description")?{description:dt(t,"description")}:{},raw:t}]:[]}):[]}function z0e(e){if(!Xt(e))return Hm(e);let t=e.outcome;if(typeof t=="string")return t;if(Xt(t)){let n=dt(t,"outcome")??"selected",s=dt(t,"optionId");return s?`${n}:${s}`:n}return jr(e,["status","reason"])??Hm(e)}function F0e(e){return Xt(e)?dt(e,"title")??dt(e,"name")??dt(e,"kind")??dt(e,"toolName")??"Tool permission":"Tool permission"}function dA(e){let t=dt(e,"stream");return t==="stdout"||t==="stderr"?t:void 0}function hA(e){if(!Xt(e))return;let t=dt(e,"source");if(t)return t;let n=e._meta;return Xt(n)?dt(n,"source"):void 0}function ar(e,t,n){return[{...t,type:"debug",text:`${e.type}: ${n}`}]}function H0e(e,t){let n=dt(e.data,"sessionId");if(!n)return ar(e,t,"missing sessionId");let s=dt(e.data,"displayName");return[{...t,type:"session.metadata.changed",sessionId:n,...s!==void 0?{displayName:s}:{}}]}function q0e(e,t){let n=dt(e.data,"sessionId"),s=Xt(e.data)?e.data.change:void 0;if(!n||!Xt(s))return ar(e,t,"malformed artifact_changed payload");let r=dt(s,"action"),i=dt(s,"artifactId");return!r||!i?ar(e,t,"missing action or artifactId"):[{...t,type:"session.artifact.changed",sessionId:n,change:s}]}function U0e(e,t){let n=dt(e.data,"sessionId"),s=dt(e.data,"previous"),r=dt(e.data,"next");if(!n||!s||!r)return ar(e,t,"missing sessionId / previous / next");let i=Xt(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 W0e(e,t){var o;let n=dt(e.data,"scope");if(n==="managed"){let a=dt(e.data,"source"),c=dt(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")?ar(e,t,mB):[{...t,type:"workspace.memory.changed",scope:n,source:a,taskId:c,touchedScopes:u}]}let s=dt(e.data,"filePath"),r=dt(e.data,"mode"),i=ui(Xt(e.data)?e.data:void 0,"bytesWritten");return n!=="workspace"&&n!=="global"||!s||r!=="append"&&r!=="replace"||i===void 0?ar(e,t,mB):[{...t,type:"workspace.memory.changed",scope:n,filePath:s,mode:r,bytesWritten:i}]}function V0e(e,t){let n=dt(e.data,"change"),s=dt(e.data,"name"),r=dt(e.data,"level");return n!=="created"&&n!=="updated"&&n!=="deleted"||!s||r!=="project"&&r!=="user"?ar(e,t,"malformed agent_changed payload"):[{...t,type:"workspace.agent.changed",change:n,name:s,level:r}]}function G0e(e,t){let n=dt(e.data,"toolName"),s=Xt(e.data)&&typeof e.data.enabled=="boolean"?e.data.enabled:void 0;return!n||s===void 0?ar(e,t,"malformed tool_toggled payload"):[{...t,type:"workspace.tool.toggled",toolName:n,enabled:s}]}function K0e(e,t){let n=dt(e.data,"key"),s=dt(e.data,"scope");return n?[{...t,type:"workspace.settings.changed",key:n,scope:s??"workspace",value:Xt(e.data)?e.data.value:void 0}]:ar(e,t,"malformed settings_changed payload")}function Y0e(e,t){return Xt(e.data)?[{...t,type:"workspace.settings.changed",key:"settings_reloaded",scope:"workspace",value:e.data}]:ar(e,t,"malformed settings_reloaded payload")}function X0e(e,t){let n=dt(e.data,"path"),s=dt(e.data,"action");return!n||s!=="created"&&s!=="overwrote"&&s!=="noop"?ar(e,t,"malformed workspace_initialized payload"):[{...t,type:"workspace.initialized",path:n,action:s}]}function Q0e(e,t){let n=dt(e.data,"workspaceCwd"),s=dt(e.data,"desiredState"),r=dt(e.data,"reason");return!n||s!=="trusted"&&s!=="untrusted"?ar(e,t,"bad trust_change_requested payload"):[{...t,type:"workspace.trust.change.requested",workspaceCwd:n,desiredState:s,...r!==void 0?{reason:r}:{}}]}function J0e(e,t){let n=dt(e.data,"releaseTag"),s=dt(e.data,"readmeUrl");if(!n||!s||!Xt(e.data))return ar(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 Z0e(e,t){if(!Xt(e.data))return ar(e,t,"non-object payload");let n=ui(e.data,"liveCount"),s=ui(e.data,"reservedCount"),r=ui(e.data,"budget"),i=ui(e.data,"thresholdRatio"),o=dt(e.data,"mode");return n===void 0||s===void 0||r===void 0||i===void 0||o!=="warn"&&o!=="enforce"?ar(e,t,"malformed mcp_budget_warning payload"):[{...t,type:"workspace.mcp.budget_warning",liveCount:n,reservedCount:s,budget:r,thresholdRatio:i,mode:o}]}function ege(e,t){if(!Xt(e.data))return ar(e,t,"non-object payload");let n=Array.isArray(e.data.refusedServers)?e.data.refusedServers.filter(Xt).map(o=>{let a=dt(o,"name"),c=dt(o,"transport"),u=dt(o,"reason");return!a||!c||u!=="budget_exhausted"?null:{name:a,transport:c,reason:"budget_exhausted"}}).filter(o=>o!==null):[],s=ui(e.data,"budget"),r=ui(e.data,"liveCount"),i=ui(e.data,"reservedCount");return n.length===0||s===void 0||r===void 0||i===void 0?ar(e,t,"malformed mcp_child_refused_batch payload"):[{...t,type:"workspace.mcp.child_refused",refusedServers:n,budget:s,liveCount:r,reservedCount:i}]}function tge(e,t){let n=dt(e.data,"serverName"),s=ui(e.data,"durationMs");return!n||s===void 0?ar(e,t,"malformed mcp_server_restarted payload"):[{...t,type:"workspace.mcp.server_restarted",serverName:n,durationMs:s}]}function nge(e,t){let n=dt(e.data,"serverName"),s=dt(e.data,"reason");return!n||!s||!y0e.has(s)?ar(e,t,"malformed mcp_server_restart_refused payload"):[{...t,type:"workspace.mcp.server_restart_refused",serverName:n,reason:s}]}function k8(e,t,n){let s=dt(e.data,n?"name":"serverName"),r=n??dt(e.data,"action");return!s||!r||!["added","removed","approve","enable","disable","authenticate","clear-auth"].includes(r)?ar(e,t,`malformed ${e.type} payload`):[{...t,type:"workspace.mcp.server_changed",serverName:s,action:r}]}function sge(e,t){let n=ui(e.data,"refreshed"),s=ui(e.data,"failed"),r=dt(e.data,"status"),i=dt(e.data,"source"),o=dt(e.data,"name"),a=dt(e.data,"version"),c=dt(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"?ar(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 rge(e,t){let n=dt(e.data,"deviceFlowId"),s=dt(e.data,"providerId"),r=ui(e.data,"expiresAt");return!n||!s||!eQ.has(s)||r===void 0?ar(e,t,"malformed auth_device_flow_started payload"):[{...t,type:"auth.device_flow.started",deviceFlowId:n,providerId:s,expiresAt:r}]}function ige(e,t){let n=dt(e.data,"deviceFlowId"),s=ui(e.data,"intervalMs");return!n||s===void 0?ar(e,t,"malformed auth_device_flow_throttled payload"):[{...t,type:"auth.device_flow.throttled",deviceFlowId:n,intervalMs:s}]}function oge(e,t){let n=dt(e.data,"deviceFlowId"),s=dt(e.data,"providerId");if(!n||!s||!eQ.has(s))return ar(e,t,"malformed auth_device_flow_authorized payload");let r=ui(e.data,"expiresAt"),i=dt(e.data,"accountAlias");return[{...t,type:"auth.device_flow.authorized",deviceFlowId:n,providerId:s,...r!==void 0?{expiresAt:r}:{},...i?{accountAlias:i}:{}}]}function age(e,t){let n=dt(e.data,"deviceFlowId"),s=dt(e.data,"errorKind");if(!n||!lge(s))return ar(e,t,"malformed auth_device_flow_failed payload");let r=dt(e.data,"hint");return[{...t,type:"auth.device_flow.failed",deviceFlowId:n,errorKind:s,...r?{hint:r}:{}}]}function lge(e){return typeof e=="string"&&e.trim().length>0}function cge(e,t){let n=dt(e.data,"deviceFlowId");return n?[{...t,type:"auth.device_flow.cancelled",deviceFlowId:n}]:ar(e,t,"malformed auth_device_flow_cancelled payload")}function ui(e,t){if(!Xt(e))return;let n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function uge(e,t){if(!Xt(e))return;let n=e[t];return typeof n=="string"&&n.length>0?n:void 0}var dge=8;function nC(e,t={},n=0){if(n>dge){let g=t.title??t.toolName??t.toolKind;return{kind:"generic",...g?{summary:g}:{}}}if(Xt(e)){let g=e.rawInput??e.input??e.args;if(g!==void 0&&g!==e){let b=nC(g,{title:t.title??jr(e,["title"]),toolName:t.toolName??jr(e,["toolName","name"]),toolKind:t.toolKind??jr(e,["kind"])},n+1);if(b.kind!=="generic"||!b.summary)return b}}let s=gge(e);if(s.length>0)return{kind:"ask_user_question",questions:s};let r=pge(e,t);if(r)return r;let i=vge(e,t);if(i)return i;let o=xge(e,t);if(o)return o;let a=kge(e,t);if(a)return a;let c=hge(e,t);if(c)return c;let u=fge(e,t);if(u)return u;let d=mge(e);if(d)return d;let f=_ge(e,t);if(f)return f;let m=Sge(e);if(m)return m;if(Xt(e)){let g=jr(e,["command","cmd"]);if(g){let v=jr(e,["cwd","directory","workingDirectory"]);return{kind:"command",command:g,...v?{cwd:v}:{}}}let b=yge(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 hge(e,t={}){if(!Xt(e))return;let n=jr(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let s=jr(e,["oldText","old_text","old_str","oldString"]),r=jr(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?jr(e,["content"]):void 0,c=r??a,u=jr(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 fge(e,t){if(!Xt(e))return;let n=jr(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let s=t.toolName??jr(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 mge(e){if(!Xt(e))return;let t=jr(e,["url","uri","href"]);if(!t||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t))return;let n=jr(e,["method","httpMethod"]);return{kind:"web_fetch",url:t,...n?{method:n}:{}}}function pge(e,t){let n=t.toolName??(Xt(e)?jr(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(Xt(e)){let c=e.arguments??e.args??e;if(Xt(c)){let u=Object.entries(c).filter(([d])=>d!=="name"&&d!=="toolName").slice(0,1).map(([d,f])=>{let m=typeof f=="string"?f:JSON.stringify(f),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 gge(e){return!Xt(e)||!Array.isArray(e.questions)?[]:e.questions.filter(Xt).map(t=>{let n=jr(t,["header","title","label"]),s=jr(t,["question","prompt","text"])??"Question",r=Array.isArray(t.options)?t.options.filter(Xt).map(bge):[];return{...n?{header:n}:{},question:s,options:r,raw:t}})}function bge(e){let t=jr(e,["label","title","value"])??"Option",n=jr(e,["description","detail","text"]);return{label:t,...n?{description:n}:{},raw:e}}function yge(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=jr(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)||Xt(r)||t.push({label:s,value:ZX(s)?"[redacted]":uf(r)});return t}var wB=50,wge=5;function vge(e,t){let n=t.toolName??"";if(!(/^task$/i.test(n)||/(?:^|_)(?:delegate|subagent|spawn[_-]?task)$/i.test(n)||/agent/i.test(t.toolKind??""))||!Xt(e))return;let s=jr(e,["subagent_type","agent","agentName","agent_name","subagent"]),r=jr(e,["prompt","task","description","instruction","query"]);if(!s&&!r)return;let i=jr(e,["parentDelegationId","parent_delegation_id","parent_id"]);return{kind:"subagent_delegation",agentName:s??"subagent",task:r??"(no task description)",...i?{parentDelegationId:i}:{}}}function xge(e,t){if(!Xt(e))return;let n=jr(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,wge).map(a=>typeof a=="string"?a:Xt(a)?jr(a,["path","file","name","title","text"])??Hm(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 kge(e,t){let n=t.toolName??"";if(!/(image[_-]?gen|generate[_-]?image|diffusion|dalle|imagen|flux|stable[_-]?diffusion|midjourney|sora)/i.test(n)||!Xt(e))return;let s=jr(e,["prompt","description","query"]);if(!s)return;let r=jr(e,["thumbnailUrl","thumbnail","url","imageUrl","preview"]),i=jr(e,["model","modelId","model_name"]);return{kind:"image_generation",prompt:s,...r?{thumbnailUrl:r}:{},...i?{model:i}:{}}}function _ge(e,t){if(!Xt(e))return;let n=jr(e,["code","snippet","source"]);if(!n)return;let s=jr(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=jr(e,["origin","source_location","path"]);return{kind:"code_block",code:n,...s?{language:s}:{},...o?{origin:o}:{}}}function Sge(e){if(!Xt(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,wB).map(o=>Array.isArray(o)?o.map(a=>typeof a=="string"?a:Hm(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&&Xt(s[0])){let r=Object.keys(s[0]).slice(0,30);if(r.length===0)return;let i=s.slice(0,wB).map(o=>{let a=o;return r.map(c=>{let u=a[c];return typeof u=="string"?u:Hm(u).slice(0,80)})});return{kind:"tabular",columns:r,rows:i,...s.length>i.length?{totalRows:s.length}:{}}}}var Cge=1e3,Mm="__trimmed_tool_block__",J3="__trimmed_permission_block__",fA=1e5,vB=`
[truncated]
`,Tge=16,Yv=new WeakMap;function Ege(e={}){let t={blocks:[],blockIndexById:Ao(),toolBlockByCallId:Ao(),trimmedToolNotificationByCallId:Ao(),permissionBlockByRequestId:Ao(),activeAssistantBlockByParent:Ao(),activeThoughtBlockByParent:Ao(),toolProgress:Ao(),awaitingResync:!1,resyncRequiredCount:0,nextOrdinal:1,now:e.now??Date.now(),maxBlocks:e.maxBlocks??Cge,retainSubagentBlocks:e.retainSubagentBlocks??!0};return e.onTruncation&&Yv.set(t,e.onTruncation),t}var gI=new Set(["pending","confirming","running","in_progress"]),jge=new Set(["completed","success","failed","error","canceled","cancelled"]),Age=new Set(["session.state_resync_required","assistant.done","status","debug","error"]);function Nge(e,t,n={}){let s=oQ(e,n);wI(s);let r=vI(s,"user",t,void 0,void 0,n.meta);return n.images&&n.images.length>0&&(r.images=[...n.images]),Yd(s,r),s.activeUserBlockId=r.id,aQ(s)}function Mge(e,t,n={}){if(t.length===0)return e;let s=oQ(e,n);for(let i of t)Ige(s,i);return aQ(s)}function Z3(e){let t=Ao();return e.forEach((n,s)=>{t[n.id]=s}),t}function Ige(e,t){var n;if(t.eventId!==void 0&&(e.lastEventId=Math.max(e.lastEventId??0,t.eventId)),e.awaitingResync&&!Age.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),_8(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"||!cQ(r.sourceRecordIds,t.sourceRecordIds)){let i=vI(e,"user","",t.eventId,t.serverTimestamp,void 0,t.sourceRecordIds);i.images=[{data:t.data,mimeType:t.mimeType}],Yd(e,i),e.activeUserBlockId=i.id}else{let i=Dc(e,e.activeUserBlockId);i&&i.kind==="user"&&(i.images=[...i.images??[],{data:t.data,mimeType:t.mimeType}])}break}case"assistant.text.delta":if(t.parentToolCallId&&!e.retainSubagentBlocks)break;_8(e,"assistant","activeAssistantBlockId",t.text,t);break;case"assistant.done":wI(e,t),(t.reason==="cancelled"||t.reason==="error")&&mA(e);break;case"assistant.usage":t.parentToolCallId&&!e.retainSubagentBlocks?Lge(e,t):Pge(e,t);break;case"thought.text.delta":if(t.parentToolCallId&&!e.retainSubagentBlocks)break;_8(e,"thought","activeThoughtBlockId",t.text,t);break;case"tool.update":if(t.parentToolCallId&&!e.retainSubagentBlocks){$ge(e,t.toolCallId);break}iQ(e,t);break;case"shell.output":Fge(e,t);break;case"user.shell.output":Hge(e,t);break;case"permission.request":qge(e,t);break;case"permission.resolved":Uge(e,t);break;case"model.changed":hv(e,"status",`Model switched: ${t.modelId}`,t);break;case"status":case"debug":case"error":hv(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":Rge(e,t);break;case"prompt.cancelled":mA(e),t.reason!=="forward_failed"&&Wge(e,t);break;case"followup.suggestion":e.lastFollowupSuggestion={suggestion:t.suggestion,promptId:t.promptId};break;case"session.replay_complete":break;case"session.rewound":Gge(e,t.targetTurnIndex);break;case"session.branched":hv(e,"status",`Branched conversation "${t.displayName}". You are now in the branch.`,t);break}}function Rge(e,t){e.awaitingResync=!0,e.resyncRequiredCount+=1,e.lastResyncRequired={reason:t.reason,lastDeliveredId:t.lastDeliveredId,earliestAvailableId:t.earliestAvailableId},mA(e),hv(e,"error",`State resync required: ${Dge(t.lastDeliveredId,t.earliestAvailableId)}.`,t)}function Dge(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 eT(e,t,n){let s=Dc(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 sQ(e,t){eT(e,e.activeAssistantBlockId,t),e.activeAssistantBlockId=void 0}function Pge(e,t){let n=Dc(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 Lge(e,t){if(!t.parentToolCallId)return;let n=Dc(e,e.toolBlockByCallId[t.parentToolCallId]);if((n==null?void 0:n.kind)!=="tool")return;let s=Xt(n.rawOutput)?n.rawOutput:void 0,r=Xt(s==null?void 0:s.executionSummary)?s.executionSummary:void 0,i=Iu(r==null?void 0:r.inputTokens)+t.usage.inputTokens,o=Iu(r==null?void 0:r.outputTokens)+t.usage.outputTokens,a=Iu(r==null?void 0:r.cachedTokens)+(t.usage.cachedTokens??0);n.rawOutput={...s??{type:"task_execution",status:"running"},executionSummary:{...r??{},inputTokens:i,outputTokens:o,cachedTokens:a,totalTokens:i+o}},n.updatedAt=e.now}function Iu(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function rQ(e,t){eT(e,e.activeThoughtBlockId,t),e.activeThoughtBlockId=void 0}function bI(e,t,n){eT(e,e.activeAssistantBlockByParent[t],n),delete e.activeAssistantBlockByParent[t]}function yI(e,t,n){eT(e,e.activeThoughtBlockByParent[t],n),delete e.activeThoughtBlockByParent[t]}function _8(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=Dc(e,a);if(c&&c.kind===t&&Oge(c,r)){c.text=xI(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=vI(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),Yd(e,u),o&&i!=null?o[i]=u.id:e[n]=u.id,i!=null?(t==="assistant"&&yI(e,i),t==="thought"&&bI(e,i)):(t!=="user"&&(e.activeUserBlockId=void 0),t!=="assistant"&&sQ(e),t!=="thought"&&rQ(e))}function Oge(e,t){var n,s;return e.kind!=="user"&&e.kind!=="assistant"&&e.kind!=="thought"||((n=e.meta)==null?void 0:n.qwenDiscreteMessage)===!0||!cQ(e.sourceRecordIds,t.sourceRecordIds)?!1:!("meta"in t)||((s=t.meta)==null?void 0:s.qwenDiscreteMessage)!==!0}function wI(e,t){sQ(e,t);for(let n of Object.keys(e.activeAssistantBlockByParent))bI(e,n,t);for(let n of Object.keys(e.activeThoughtBlockByParent))yI(e,n,t);rQ(e,t)}function iQ(e,t){let n=!e.retainSubagentBlocks&&Xt(t.rawOutput)&&t.rawOutput.type==="task_execution",s=Bge(t.rawOutput,e.retainSubagentBlocks),r=e.toolBlockByCallId[t.toolCallId];if(r===Mm){if(Vge(t))return delete e.toolBlockByCallId[t.toolCallId],delete e.trimmedToolNotificationByCallId[t.toolCallId],iQ(e,t);e.trimmedToolNotificationByCallId[t.toolCallId]||(e.trimmedToolNotificationByCallId[t.toolCallId]=!0,hv(e,"error",`Tool ${t.toolCallId} output trimmed (max blocks reached)`,t,{clearActiveText:!1}));return}let i=Dc(e,r);if((i==null?void 0:i.kind)==="tool"){if(t.title!==void 0&&(i.title=t.title),t.status!==void 0&&(i.status=t.status),t.rawInput!==void 0&&(i.preview=nC(t.rawInput,{title:t.title,toolName:t.toolName,toolKind:t.toolKind})),i.updatedAt=e.now,t.eventId!==void 0&&(i.eventId=t.eventId),t.details&&(i.details=t.details),n?delete i.content:t.content!==void 0&&(i.content=t.content),t.locations!==void 0&&(i.locations=t.locations),t.rawInput!==void 0&&(i.rawInput=t.rawInput),s!==void 0){if(n&&Xt(s)&&Xt(i.rawOutput)){let c=Xt(i.rawOutput.executionSummary)?i.rawOutput.executionSummary:void 0,u=Xt(s.executionSummary)?s.executionSummary:void 0;if(c&&u){let d=Math.max(Iu(c.inputTokens),Iu(u.inputTokens)),f=Math.max(Iu(c.outputTokens),Iu(u.outputTokens));s={...s,executionSummary:{...u,inputTokens:d,outputTokens:f,cachedTokens:Math.max(Iu(c.cachedTokens),Iu(u.cachedTokens)),totalTokens:Math.max(Iu(c.totalTokens),Iu(u.totalTokens),d+f)}}}else c&&(s={...s,executionSummary:{...c}})}i.rawOutput=s}if(i.sourceRecordIds=Xge(i.sourceRecordIds,t.sourceRecordIds),t.toolName&&(i.toolName=t.toolName),t.toolKind&&(i.toolKind=t.toolKind),t.parentToolCallId&&!i.parentToolCallId&&(i.parentToolCallId=t.parentToolCallId),i.parentToolCallId&&!i.parentBlockId){let c=e.toolBlockByCallId[i.parentToolCallId];c&&c!==Mm&&(i.parentBlockId=c)}t.subagentType&&!i.subagentType&&(i.subagentType=t.subagentType),xB(e,t.toolCallId,t.status);return}let o=t.parentToolCallId&&e.toolBlockByCallId[t.parentToolCallId]!==Mm?e.toolBlockByCallId[t.parentToolCallId]:void 0,a={id:bp(e,"tool"),kind:"tool",toolCallId:t.toolCallId,title:t.title??t.toolName??t.toolKind??"Tool",status:t.status??"pending",preview:nC(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}:{},...!n&&t.content!==void 0?{content:t.content}:{},...t.locations!==void 0?{locations:t.locations}:{},...t.rawInput!==void 0?{rawInput:t.rawInput}:{},...s!==void 0?{rawOutput:s}:{},...t.toolName?{toolName:t.toolName}:{},...t.toolKind?{toolKind:t.toolKind}:{},...t.parentToolCallId?{parentToolCallId:t.parentToolCallId}:{},...t.subagentType?{subagentType:t.subagentType}:{},...o?{parentBlockId:o}:{}};Yd(e,a),e.toolBlockByCallId[t.toolCallId]=a.id;for(let c of e.blocks)if(c.kind==="tool"&&c.parentToolCallId===t.toolCallId&&!c.parentBlockId){let u=Dc(e,c.id);(u==null?void 0:u.kind)==="tool"&&(u.parentBlockId=a.id)}xB(e,t.toolCallId,t.status??"pending"),cg(e,t.parentToolCallId)}function $ge(e,t){let n=e.toolBlockByCallId[t];!n||n===Mm||(tT(e),e.blocks=e.blocks.filter(s=>s.id!==n),e.blockIndexById=Z3(e.blocks),delete e.toolBlockByCallId[t],delete e.toolProgress[t],e.currentToolCallId===t&&(e.currentToolCallId=void 0))}function Bge(e,t){if(t||!Xt(e)||e.type!=="task_execution")return e;let n={type:"task_execution"};for(let s of["subagentName","subagentColor","taskDescription","status","terminateReason","tokenCount","executionSummary"])e[s]!==void 0&&(n[s]=e[s]);return n}function xB(e,t,n){if(n!==void 0){if(gI.has(n)){e.currentToolCallId=t;return}if(jge.has(n)){e.currentToolCallId===t&&(e.currentToolCallId=zge(e));return}}}function zge(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"&&gI.has(n.status))return n.toolCallId}}function mA(e){for(let t of Object.values(e.toolBlockByCallId)){if(t===Mm)continue;let n=Dc(e,t);!n||n.kind!=="tool"||gI.has(n.status)&&(n.status="cancelled",n.updatedAt=e.now)}e.currentToolCallId=void 0}function Fge(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=Dc(e,n.id);(i==null?void 0:i.kind)==="shell"&&(i.text=xI(e,i,t.text),i.updatedAt=e.now,t.eventId!==void 0&&(i.eventId=t.eventId));return}let s=bp(e,"shell"),r={id:s,kind:"shell",text:sk(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}:{}};Yd(e,r),cg(e)}function Hge(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=Dc(e,n.id);(a==null?void 0:a.kind)==="user_shell"&&(a.text=xI(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=bp(e,"user-shell"),o={id:i,kind:"user_shell",text:sk(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,Yd(e,o),cg(e)}function qge(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===J3)return;let s=Dc(e,n),r=nC(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:bp(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}:{}};Yd(e,i),e.permissionBlockByRequestId[t.requestId]=i.id,cg(e)}function Uge(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===void 0||n===J3)return;let s=Dc(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:bp(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}:{}};Yd(e,r),e.permissionBlockByRequestId[t.requestId]=r.id,cg(e)}function hv(e,t,n,s,r={}){let i=bp(e,t),o={id:i,kind:t,text:sk(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}}:{}};Yd(e,o),r.clearActiveText!==!1&&cg(e)}function Wge(e,t){let n={id:bp(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}:{}};Yd(e,n),cg(e)}function vI(e,t,n,s,r,i,o){let a=bp(e,t);return{id:a,kind:t,text:sk(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 oQ(e,t){let n={...e,now:t.now??Date.now(),maxBlocks:t.maxBlocks??e.maxBlocks,retainSubagentBlocks:t.retainSubagentBlocks??e.retainSubagentBlocks,blocks:e.blocks,blockIndexById:e.blockIndexById,toolBlockByCallId:Ao(e.toolBlockByCallId),activeAssistantBlockByParent:Ao(e.activeAssistantBlockByParent),activeThoughtBlockByParent:Ao(e.activeThoughtBlockByParent),trimmedToolNotificationByCallId:Ao(e.trimmedToolNotificationByCallId),permissionBlockByRequestId:Ao(e.permissionBlockByRequestId),toolProgress:Ao(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??Yv.get(e);return s&&Yv.set(n,s),n}function aQ(e){var s;if(e.blocks.length<=e.maxBlocks)return e;(s=Yv.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=Z3(t),sC.set(e,e.blocks);for(let[r,i]of Object.entries(e.toolBlockByCallId))n.has(i)||(e.toolBlockByCallId[r]=Mm);Qge(e);for(let[r]of Object.entries(e.trimmedToolNotificationByCallId))e.toolBlockByCallId[r]!==Mm&&delete e.trimmedToolNotificationByCallId[r];for(let[r,i]of Object.entries(e.permissionBlockByRequestId))n.has(i)||(e.permissionBlockByRequestId[r]=J3);Jge(e);for(let r of e.blocks)if(r.kind==="tool"&&r.parentBlockId&&!n.has(r.parentBlockId)){let i=Dc(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 Vge(e){return e.toolCallId===cA||e.toolKind==="updated_plan"}var sC=new WeakMap;function tT(e){sC.get(e)!==e.blocks&&(e.blocks=[...e.blocks],e.blockIndexById=Ao(e.blockIndexById),sC.set(e,e.blocks))}function Gge(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){kB(e,i);return}n+=1}s>=0&&t>=n&&kB(e,s)}function kB(e,t){tT(e),e.blocks=e.blocks.slice(0,t),sC.set(e,e.blocks),Kge(e)}function Kge(e){e.blockIndexById=Z3(e.blocks),e.toolBlockByCallId=Ao(),e.permissionBlockByRequestId=Ao(),e.trimmedToolNotificationByCallId=Ao(),e.activeUserBlockId=void 0,e.activeAssistantBlockId=void 0,e.activeThoughtBlockId=void 0,e.activeAssistantBlockByParent=Ao(),e.activeThoughtBlockByParent=Ao(),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 Yd(e,t){tT(e),e.blockIndexById[t.id]=e.blocks.length,e.blocks.push(t)}function Dc(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=Yge(s);return tT(e),e.blocks[n]=r,r}function Yge(e){return e.kind==="permission"?{...e,options:e.options.map(t=>xd(t)),toolCall:xd(e.toolCall),preview:xd(e.preview)}:e.kind==="tool"?{...e,preview:xd(e.preview),content:xd(e.content),locations:xd(e.locations),rawInput:xd(e.rawInput),rawOutput:xd(e.rawOutput)}:{...e}}function bp(e,t){let n=`${t}-${e.nextOrdinal}`;return e.nextOrdinal+=1,n}function cg(e,t){t?(bI(e,t),yI(e,t)):(wI(e),e.activeUserBlockId=void 0)}function xI(e,t,n){let s="text"in t?t.text:"";return s.length>=fA?(n&&lQ(e,t.id,t.sourceRecordIds),s):sk(e,t.id,t.sourceRecordIds,s+n)}function sk(e,t,n,s){if(s.length<=fA)return s;lQ(e,t,n);let r=Math.max(0,fA-vB.length);return`${s.slice(0,r)}${vB}`}function lQ(e,t,n){var s;(s=Yv.get(e))==null||s({kind:"text",blockId:t,sourceRecordIds:n})}function Ao(e){return Object.assign(Object.create(null),e)}function cQ(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,s)=>n===t[s])}function Xge(e,t){if(!(!e&&!t))return[...new Set([...e??[],...t??[]])]}function Qge(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.toolBlockByCallId).filter(([,r])=>r===Mm).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 Jge(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.permissionBlockByRequestId).filter(([,r])=>r===J3).map(([r])=>r),s=n.length-t;if(!(s<=0))for(let r of n.slice(0,s))delete e.permissionBlockByRequestId[r]}function xd(e,t=0){return t>Tge?e:Array.isArray(e)?e.map(n=>xd(n,t+1)):Xt(e)?Object.fromEntries(Object.entries(e).map(([n,s])=>[n,xd(s,t+1)])):e}function pA(e={}){let t=_B(e),n=new Set,s=!1,r=()=>{for(let o of n)try{o()}catch(a){Zge(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=Mge(t,a),i())},appendLocalUserMessage(o,a,c){t=Nge(t,o,{images:a,meta:c}),i()},reset(o={}){t=_B({maxBlocks:o.maxBlocks??t.maxBlocks,retainSubagentBlocks:o.retainSubagentBlocks??t.retainSubagentBlocks,...o}),i()},clearAwaitingResync(){t.awaitingResync&&(t={...t,awaitingResync:!1},i())},clearFollowupSuggestion(){t.lastFollowupSuggestion!==void 0&&(t={...t,lastFollowupSuggestion:void 0},i())}}}function Zge(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 _B(e){let t=e.blocks?[...e.blocks]:[];return{...Ege({maxBlocks:e.maxBlocks,now:e.now}),...e,blocks:t,blockIndexById:Z3(t),toolBlockByCallId:Gg(e.toolBlockByCallId),trimmedToolNotificationByCallId:Gg(e.trimmedToolNotificationByCallId),permissionBlockByRequestId:Gg(e.permissionBlockByRequestId),toolProgress:Gg(e.toolProgress),activeAssistantBlockByParent:Gg(e.activeAssistantBlockByParent),activeThoughtBlockByParent:Gg(e.activeThoughtBlockByParent),lastResyncRequired:e.lastResyncRequired!==void 0?{...e.lastResyncRequired}:void 0,lastFollowupSuggestion:e.lastFollowupSuggestion!==void 0?{...e.lastFollowupSuggestion}:void 0}}function Gg(e){return Object.assign(Object.create(null),e)}var e1e="web-shell:goal-status:v1:";/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function SB(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 t1e(e){var t;const n=ca((t=e==null?void 0:e.state)==null?void 0:t.models);if(!n)return;const s=Ki(n,"currentModelId")??Ki(n,"currentModel"),r=n.availableModels,i=[];let o;if(Array.isArray(r))for(const a of r){const c=ca(a),u=Ki(c,"modelId")??Ki(c,"id")??Ki(c,"value");if(!u)continue;const d=ca(c==null?void 0:c._meta),f=Pw(d,"contextLimit")??Pw(d,"contextWindow")??Pw(c,"contextLimit")??Pw(c,"contextWindow");o===void 0&&s!==void 0&&u===s&&(o=f),i.push({id:u,baseModelId:Ki(c,"baseModelId")??o1e(u),label:Ki(c,"name")??Ki(c,"label")??u,...f!==void 0?{contextWindow:f}:{}})}if(!(!s&&i.length===0))return{models:i,currentModel:s,contextWindow:o}}function uQ(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}:{},...fQ(s._meta),raw:s}}),n=e.availableSkills.map(s=>({name:s,description:"",raw:{name:s,description:"",input:null,_meta:{source:"skill"}}}));return{commands:dQ(t,n),skills:e.availableSkills}}function CB(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 dQ(...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 n1e(e,t){var n;if(e.type==="session_update"){const s=ca((n=ca(e.data))==null?void 0:n.update),r=hQ(s);if(r&&t(i=>({...i,tokenUsage:r,tokenCount:kI(r)})),Ki(s,"sessionUpdate")==="available_commands_update"){const{commands:i,skills:o}=i1e(s);t(a=>({...a,commands:i,skills:o}))}return}switch(e.type){case"git_branch_changed":{const s=ca(e.data),r=Ki(s,"workspaceCwd"),i=Ki(s,"branch");t(o=>r&&r!==o.workspaceCwd?o:{...o,gitBranch:i});break}case"git_status_changed":{const s=ca(e.data),r=Ki(s,"workspaceCwd");t(i=>r&&r!==i.workspaceCwd?i:{...i,gitStatus:s});break}case"session_metadata_updated":{const s=ca(e.data);Object.prototype.hasOwnProperty.call(s??{},"displayName")&&t(r=>({...r,displayName:Ki(s,"displayName")}));break}case"model_switched":{const s=Ki(ca(e.data),"modelId");s&&t(r=>({...r,currentModel:s}));break}case"approval_mode_changed":{const s=ca(e.data),r=Ki(s,"next")??Ki(s,"mode");r&&t(i=>({...i,currentMode:r}));break}}}function TB(e){const t=Ki(e,"displayName");return t!=null&&t.trim()?t:void 0}function s1e(e){var t;const n=ca((t=e==null?void 0:e.state)==null?void 0:t.modes);return Ki(n,"currentModeId")??Ki(n,"currentMode")}function kI(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 r1e(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=ca((t=ca(s.data))==null?void 0:t.update),i=hQ(r);if(i)return i}catch{}}function hQ(e){const t=ca(e==null?void 0:e._meta);if((t==null?void 0:t.parentToolCallId)!==void 0)return;const n=ca(t==null?void 0:t.usage),s={...iw(n,"inputTokens"),...iw(n,"outputTokens"),...iw(n,"totalTokens"),...iw(n,"thoughtTokens"),...iw(n,"cachedReadTokens")};return kI(s)!==void 0?s:void 0}function iw(e,t){const n=Pw(e,t);return n!==void 0&&n>=0?{[t]:n}:{}}function i1e(e){if(!e)return{commands:[],skills:[]};const n=(Array.isArray(e.availableCommands)?e.availableCommands:[]).flatMap(i=>{var o;const a=ca(i),c=Ki(a,"name");if(!c)return[];const u=ca(a==null?void 0:a.input),d={name:c,description:Ki(a,"description")??"",input:u?{hint:Ki(u,"hint")??""}:null,_meta:ca(a==null?void 0:a._meta)??null};return[{name:c,description:d.description??"",...(o=d.input)!=null&&o.hint?{argumentHint:d.input.hint}:{},...fQ(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:dQ(n,r),skills:s}}function fQ(e){const n=Ki(e??void 0,"source");return{...n?{source:n}:{}}}function ca(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Ki(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function Pw(e,t){const n=e==null?void 0:e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function o1e(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 EB(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 a1e=3e4;function l1e(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 bt(e,t,n=a1e){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 c1e(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 uo(e){e.current!==void 0&&(clearTimeout(e.current),e.current=void 0)}function u1e(e,t,n="replay",s=80,r){uo(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 d1e="qwen-code-webui-client-id:session:";function S8(e,t){if(e)return e;if(typeof window>"u")return C8();try{if(t){const n=window.sessionStorage.getItem(mQ(t));if(n)return n}return C8()}catch{return C8()}}function U2(e,t){if(!(!e||!t||typeof window>"u"))try{window.sessionStorage.setItem(mQ(t),e)}catch{}}async function jB(e){if(!e.clientId)return;const t={"X-Qwen-Client-Id":e.clientId};e.token&&(t.Authorization=`Bearer ${e.token}`);const n=`${h1e(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 C8(){return`webui_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function mQ(e){return`${d1e}${encodeURIComponent(e)}`}function h1e(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 f1e(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 m1e({store:e,sessionRef:t,activePromptsRef:n,settledPromptsRef:s,pendingSessionLoadRef:r,pendingSessionLoadIdRef:i,heartbeatSupportedRef:o,manualSessionClearRef:a,skipNextCleanupDetachSessionIdRef:c,passiveAssistantDoneTimerRef:u,getCreateSessionRequest:d,createDetachedSession:f,getConnection:m,hasSessionActivePrompt:p,resetCurrentSessionActivePrompt:g,restartEventStream:b,addNotice:v,setConnection:y,setPromptStatus:w,setRestoreSessionId:x,setRestoreWorkspaceCwd:k,setRestoreMode:C,setRestoreSessionNonce:T,setAttachSessionNonce:_,setNewSessionNonce:S}){function R(){for(const[,M]of n.current)M.controller.abort();n.current.clear(),s.current.clear(),w("idle"),uo(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(),x(void 0),k(void 0)}function A(M,D,$){const z=i.current+1;return i.current=z,r.current&&(clearTimeout(r.current.timeout),r.current.reject(new DOMException(`Session ${D} superseded by a newer request`,"AbortError"))),new Promise((j,H)=>{const Q=setTimeout(()=>{var I;((I=r.current)==null?void 0:I.id)===z&&(r.current=void 0,H(Br(v,`${w1e(D)} session failed`,new Error(`Session ${D} timed out`),v1e(D))))},3e4);r.current={id:z,sessionId:M,mode:D,timeout:Q,resolve:j,reject:H,...$?{signal:$}:{}}})}function O(M,D,$,z){var B;if(z!=null&&z.aborted)return Promise.reject(new DOMException("Session load cancelled","AbortError"));a.current=!1;const j=A(M,D,z),H=t.current,Q=H==null?void 0:H.sessionId,I=Q?n.current.get(Q):void 0;(B=I==null?void 0:I.reject)==null||B.call(I,new DOMException("Session switch interrupted prompt wait","AbortError")),Q&&n.current.delete(Q),g();const J=D==="load"&&Q===M;if(H){const W=()=>H.detach().catch(P=>{console.warn("[DaemonSessionActions] detach before session switch failed:",P)});J?(c.current=M,j.then(W,()=>{})):W()}return J||(t.current=void 0),J||y(W=>({...W,status:"connecting",sessionId:M,clientId:void 0,displayName:void 0,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0,catchingUp:void 0})),w("idle"),s.current.clear(),uo(u),J||e.reset(),C(D),x(M),k($??m().workspaceCwd),T(W=>W+1),j.catch(W=>{throw Lw(W)||y(P=>({...P,loadingTranscript:void 0,catchingUp:void 0})),W})}return{async sendPrompt(M,D){var $,z,B,j,H;const Q=Xr(v,t.current,"Prompt failed","send_prompt"),I=Q.sessionId;if(n.current.has(I))throw Br(v,"Prompt failed","A prompt is already in progress","send_prompt");uo(u),w("waiting");const J=new AbortController;n.current.set(I,{controller:J});try{const W=((D==null?void 0:D.images)??[]).map(q=>({data:q.data,mimeType:q.mimeType||q.mediaType||q.media_type||"image/*"})),P=D!=null&&D.inputAnnotations&&D.inputAnnotations.length>0?D.inputAnnotations:void 0;(D==null?void 0:D.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(M,W,P?{inputAnnotations:P}:void 0);const V={prompt:EB(M,W)};P&&(V._meta={inputAnnotations:P}),D!=null&&D.retry&&(V.retry=!0);const ee=await Q.submitPrompt(V,J.signal);return(($=n.current.get(I))==null?void 0:$.controller)===J&&b(I),(z=D==null?void 0:D.onAdmitted)==null||z.call(D),await p1e(n.current,s.current,I,J,ee.promptId)}catch(W){if(Lw(W))return((B=t.current)==null?void 0:B.sessionId)===I&&e.dispatch({type:"assistant.done",reason:"cancelled"}),{stopReason:"cancelled"};throw QX(W)?W:(((j=t.current)==null?void 0:j.sessionId)===I&&e.dispatch({type:"assistant.done",reason:"error"}),Br(v,"Prompt failed",W,"send_prompt"))}finally{const W=n.current.get(I);(W==null?void 0:W.controller)===J&&n.current.delete(I),((H=t.current)==null?void 0:H.sessionId)===I&&!p()&&w("idle")}},async submitPrompt(M,D){var $;const z=Xr(v,t.current,"Prompt failed","send_prompt");if(D!=null&&D.sessionId&&z.sessionId!==D.sessionId)throw new Error("Session changed before prompt submission");const B=((D==null?void 0:D.images)??[]).map(I=>({data:I.data,mimeType:I.mimeType||I.mediaType||I.media_type||"image/*"})),j=D!=null&&D.inputAnnotations&&D.inputAnnotations.length>0?D.inputAnnotations:void 0;(D==null?void 0:D.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(M,B,j?{inputAnnotations:j}:void 0);const H={prompt:EB(M,B)};j&&(H._meta={inputAnnotations:j}),D!=null&&D.retry&&(H.retry=!0);const Q=await z.submitPrompt(H);if(($=D==null?void 0:D.signal)!=null&&$.aborted)throw await z.removePendingPrompt(Q.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})}),D.signal.reason??new DOMException("Aborted","AbortError");return{promptId:Q.promptId}},async cancel(){var M,D;const $=Xr(v,t.current,"Cancel failed","cancel_prompt"),z=n.current.get($.sessionId);z==null||z.controller.abort(),uo(u);const B=z?new AbortController:void 0;B&&n.current.set($.sessionId,{controller:B});try{await bt($.cancel(),"Cancel timed out")}catch(j){throw Br(v,"Cancel failed",j,"cancel_prompt")}finally{B&&((M=n.current.get($.sessionId))==null?void 0:M.controller)===B&&n.current.delete($.sessionId),((D=t.current)==null?void 0:D.sessionId)===$.sessionId&&!p()&&w("idle")}},async setModel(M){const D=Xr(v,t.current,"Set model failed","switch_model");try{const $=await bt(D.setModel(M),"Set model timed out");return y(z=>({...z,currentModel:M})),$}catch($){throw Br(v,"Set model failed",$,"switch_model")}},async setApprovalMode(M,D){const $=Xr(v,t.current,"Set approval mode failed","set_approval_mode");try{const z=await bt($.client.setSessionApprovalMode($.sessionId,M,{persist:D==null?void 0:D.persist,clientId:$.clientId}),"Set approval mode timed out");return y(B=>({...B,currentMode:z.mode||M})),z}catch(z){throw Br(v,"Set approval mode failed",z,"set_approval_mode")}},async respondToPermission(M,D){const $=Xr(v,t.current,"Permission response failed","submit_permission");try{return await bt($.respondToSessionPermission(M,D),"Permission response timed out")}catch(z){throw Br(v,"Permission response failed",z,"submit_permission")}},async submitPermission(M,D,$){const z=Xr(v,t.current,"Permission response failed","submit_permission"),B=D!==void 0&&D.length>0?{outcome:{outcome:"selected",optionId:D},...$?{answers:$}:{}}:{outcome:{outcome:"cancelled"},...$?{answers:$}:{}};try{return await bt(z.respondToSessionPermission(M,B),"Permission response timed out")}catch(j){throw Br(v,"Permission response failed",j,"submit_permission")}},async heartbeat(){const M=t.current;if(!(!M||!o.current))return bt(M.heartbeat(),"Heartbeat timed out")},async listSessions(M){const D=t.current;if(!D)return[];try{return await bt(D.client.listWorkspaceSessions(D.workspaceCwd,M),"List sessions timed out")}catch($){throw Br(v,"List sessions failed",$,"list_sessions")}},async loadSession(M,D){return O(M,"load",D==null?void 0:D.workspaceCwd)},async reloadSession(M){const D=Xr(v,t.current,"Reload session failed","load_session");return O(D.sessionId,"load",D.workspaceCwd,M)},async resumeSession(M,D){return O(M,"resume",D==null?void 0:D.workspaceCwd)},async createSession(M){try{a.current=!1;const D={...(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}:{},...(M==null?void 0:M.branch)!==void 0?{branch:M.branch}:{}},$=t.current,z=$&&m().sessionId===$.sessionId?$:void 0;if(z){const j=await bt(z.client.createOrAttachSession({...d(),...(M==null?void 0:M.workspaceCwd)!==void 0?{workspaceCwd:M.workspaceCwd}:{},...D}),"Create session timed out");return U2(j.clientId,j.sessionId),j}const B=await bt(f(M==null?void 0:M.workspaceCwd,D),"Create session timed out");if(a.current){try{await bt(B.detach(),"Detach cleared session timed out")}catch(j){console.warn("[DaemonSessionActions] detach after interrupted create failed:",j)}throw new DOMException("Session creation interrupted","AbortError")}return U2(B.clientId,B.sessionId),t.current=B,c.current=B.sessionId,y(j=>({...j,status:"connected",sessionId:B.sessionId,...B.clientId?{clientId:B.clientId}:{},workspaceCwd:B.workspaceCwd,error:void 0,errorStatus:void 0,missingSession:!1})),B}catch(D){throw Br(v,`Create session failed${M!=null&&M.workspaceCwd?` (workspace: ${M.workspaceCwd})`:""}`,D,"create_session")}},async attachSession(){const M=Xr(v,t.current,"Attach session failed","attach_session"),D=A(M.sessionId,"attach");return _($=>$+1),D},async clearSession(){const M=t.current;if(a.current=!0,R(),t.current=void 0,y(D=>f1e(D,M==null?void 0:M.sessionId)),M)try{await bt(M.detach(),"Clear session timed out")}catch(D){console.warn("[DaemonSessionActions] detach on clear failed:",D)}},async newSession(){a.current=!1,R(),y(M=>({...M,missingSession:!1,error:void 0,errorStatus:void 0})),S(M=>M+1)},async releaseSession(M){try{const D=Xr(v,t.current,"Release session failed","release_session");await bt(D.client.closeSession(M),"Release session timed out")}catch(D){throw Br(v,"Release session failed",D,"release_session")}},async closeSession(){const M=Xr(v,t.current,"Close session failed","close_session");try{await bt(M.close(),"Close session timed out")}catch(D){throw Br(v,"Close session failed",D,"close_session")}},async refreshCommands(){const M=Xr(v,t.current,"Refresh commands failed","refresh_commands");try{const D=await bt(M.supportedCommands(),"Refresh commands timed out"),{commands:$,skills:z}=uQ(D);y(B=>({...B,commands:$,skills:z,supportedCommands:D}))}catch(D){throw Br(v,"Refresh commands failed",D,"refresh_commands")}},async getContext(){const M=Xr(v,t.current,"Load context failed","load_context");try{const D=await bt(M.context(),"Load context timed out");return y($=>({...$,context:D,currentMode:g1e(D)??$.currentMode,currentModel:b1e(D)??$.currentModel})),D}catch(D){throw Br(v,"Load context failed",D,"load_context")}},async getContextUsage(M){const D=Xr(v,t.current,"Load context usage failed","load_context_usage");try{return await bt(D.contextUsage(M),"Load context usage timed out")}catch($){throw Br(v,"Load context usage failed",$,"load_context_usage")}},async renameSession(M){const D=Xr(v,t.current,"Rename session failed","rename_session");try{return await bt(D.updateMetadata({displayName:M}),"Rename session timed out")}catch($){throw Br(v,"Rename session failed",$,"rename_session")}},async recapSession(){const M=Xr(v,t.current,"Recap session failed","recap_session");try{return await bt(M.recap(),"Recap session timed out")}catch(D){throw Br(v,"Recap session failed",D,"recap_session")}},async*generateSessionContent(M,D){yield*Xr(v,t.current,"Generate content failed","generate_session_content").generateContent(M,D)},async getRewindSnapshots(){const M=Xr(v,t.current,"Load rewind snapshots failed","rewind_snapshots");try{return await bt(M.getRewindSnapshots(),"Load rewind snapshots timed out")}catch(D){throw Br(v,"Load rewind snapshots failed",D,"rewind_snapshots")}},async rewindSession(M,D){const $=Xr(v,t.current,"Rewind session failed","rewind_session");try{return await bt($.rewind(M,D),"Rewind session timed out")}catch(z){throw Br(v,"Rewind session failed",z,"rewind_session")}},async btwSession(M,D){var $;const z=Xr(v,t.current,"Side question failed","btw_session");try{return await bt(z.btw(M,D),"Side question timed out")}catch(B){throw($=D==null?void 0:D.signal)!=null&&$.aborted||Lw(B)?B:Br(v,"Side question failed",B,"btw_session")}},async enqueueMidTurnMessage(M,D){const $=t.current;if(!$)return{accepted:!1};try{return await $.enqueueMidTurnMessage(M,D)}catch(z){return z instanceof DOMException&&z.name==="AbortError"||console.debug("[enqueueMidTurnMessage] push failed; kept for next turn",z),{accepted:!1}}},async getPendingPrompts(M){const D=t.current;if(!D)return{pendingPrompts:[]};if(M!=null&&M.sessionId&&D.sessionId!==M.sessionId)throw new Error("Session changed before pending prompts refresh");return await D.getPendingPrompts()},async removePendingPrompt(M,D){const $=t.current;return $?D!=null&&D.sessionId&&$.sessionId!==D.sessionId?await $.client.removePendingPrompt(D.sessionId,M):await $.removePendingPrompt(M):{removed:!1}},async sendShellCommand(M){var D,$;const z=Xr(v,t.current,"Shell command failed","send_shell_command"),B=`${z.sessionId}:shell`;w("waiting");const j=new AbortController;n.current.set(B,{controller:j});try{return await z.shellCommand(M,j.signal)}catch(H){throw Br(v,"Shell command failed",H,"send_shell_command")}finally{((D=n.current.get(B))==null?void 0:D.controller)===j&&n.current.delete(B),(($=t.current)==null?void 0:$.sessionId)===z.sessionId&&!p()&&w("idle")}},async getTasks(){const M=Xr(v,t.current,"Get tasks failed","load_tasks");try{return await bt(M.tasks(),"Get tasks timed out")}catch(D){throw Br(v,"Get tasks failed",D,"load_tasks")}},async cancelTask(M,D){const $=Xr(v,t.current,"Cancel task failed","cancel_task");try{return await bt($.cancelTask(M,D),"Cancel task timed out")}catch(z){throw Br(v,"Cancel task failed",z,"cancel_task")}},async clearGoal(){const M=Xr(v,t.current,"Clear goal failed","clear_goal");try{return await bt(M.clearGoal(),"Clear goal timed out")}catch(D){throw Br(v,"Clear goal failed",D,"clear_goal")}},async getStats(){const M=Xr(v,t.current,"Load stats failed","load_stats");try{return await bt(M.stats(),"Load stats timed out")}catch(D){throw Br(v,"Load stats failed",D,"load_stats")}},async loadArtifacts(){const M=t.current;if(!M)throw new Error("Daemon session is not connected");return bt(M.artifacts(),"Load artifacts timed out")},async respondToGlobalPermission(M,D){const $=Xr(v,t.current,"Global permission response failed","submit_permission");try{return await bt($.client.respondToPermission(M,D),"Global permission response timed out")}catch(z){throw Br(v,"Global permission response failed",z,"submit_permission")}},async branchSession(M){const D=Xr(v,t.current,"Branch session failed","branch_session");try{const $=await bt(D.client.branchSession(D.sessionId,{name:M},D.clientId),"Branch session timed out");return U2($.clientId,$.sessionId),O($.sessionId,"load").catch(z=>{Lw(z)||Br(v,"Branch session failed",z,"branch_session")}),{sessionId:$.sessionId,displayName:$.displayName}}catch($){throw Br(v,"Branch session failed",$,"branch_session")}},async forkSession(M){const D=Xr(v,t.current,"Fork session failed","fork_session");try{return await bt(D.fork(M),"Fork session timed out")}catch($){throw Br(v,"Fork session failed",$,"fork_session")}}}}function p1e(e,t,n,s,r){return new Promise((i,o)=>{const a=gA(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",f)},f=()=>{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",f,{once:!0})})}function gA(e,t){return JSON.stringify([e,t])}function g1e(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 b1e(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 Xr(e,t,n,s){if(!t)throw Br(e,n,"Daemon session is not connected",s);return t}function Br(e,t,n,s){if(Lw(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}),y1e(n instanceof Error?n:new Error(r))}function Lw(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function y1e(e){return Object.assign(e,{_alreadyDispatched:!0})}function w1e(e){return e.charAt(0).toUpperCase()+e.slice(1)}function v1e(e){return e==="resume"?"resume_session":e==="attach"?"attach_session":"load_session"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const x1e=33e4;function k1e({getClient:e,getWorkspaceCwd:t,baseUrl:n,token:s}){return{async listSessions(r){const i=Yt(e,"List sessions failed"),o=t();return o?bt(i.listWorkspaceSessionsPage(o,r).then(a=>a.sessions),"List sessions timed out"):[]},async listSessionsPage(r){const i=Yt(e,"List sessions failed"),o=t();return o?bt(i.listWorkspaceSessionsPage(o,r),"List sessions timed out"):{sessions:[]}},async listSessionGroups(){const r=Yt(e,"List session groups failed"),i=t();return i?bt(r.listSessionGroups(i),"List session groups timed out"):{groups:[],colorOptions:[]}},async createSessionGroup(r){const i=Yt(e,"Create session group failed"),o=W2(t);return bt(i.createSessionGroup(o,r),"Create session group timed out")},async updateSessionGroup(r,i){const o=Yt(e,"Update session group failed"),a=W2(t);return bt(o.updateSessionGroup(a,r,i),"Update session group timed out")},async deleteSessionGroup(r){const i=Yt(e,"Delete session group failed"),o=W2(t);return bt(i.deleteSessionGroup(o,r),"Delete session group timed out")},async updateSessionOrganization(r,i){const o=Yt(e,"Update session organization failed");return bt(o.updateSessionOrganization(r,i),"Update session organization timed out")},async deleteSession(r){const i=Yt(e,"Delete session failed"),o=await bt(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=Yt(e,"Delete sessions failed");return bt(i.deleteSessionsData(r),"Delete sessions timed out")},async exportSession(r,i="html"){const o=Yt(e,"Export session failed");return bt(o.exportSession(r,{format:i}),"Export session timed out")},async archiveSession(r){const i=Yt(e,"Archive session failed"),o=await bt(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=Yt(e,"Unarchive session failed"),o=await bt(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 loadChannels(){const r=Sh(e,t,"Load channels failed"),[i,o]=await bt(Promise.all([r.workspaceChannelTypes(),r.workspaceChannels()]),"Load channels timed out");return{catalog:i,snapshot:o}},async upsertChannel(r,i){return Sh(e,t,"Update channel failed").upsertWorkspaceChannel(r,i)},async removeChannel(r,i){return Sh(e,t,"Remove channel failed").deleteWorkspaceChannel(r,i)},async setChannelStartup(r,i){return Sh(e,t,"Update channel startup failed").setWorkspaceChannelStartup(r,i)},async startChannel(r){return Sh(e,t,"Start channel failed").startWorkspaceChannel(r)},async stopChannel(r){return Sh(e,t,"Stop channel failed").stopWorkspaceChannel(r)},async restartChannel(r){return Sh(e,t,"Restart channel failed").restartWorkspaceChannel(r)},channelPairing:{async list(r){const i=Sh(e,t,"Load channel pairing requests failed");return bt(i.workspaceChannelPairingRequests(r),"Load channel pairing requests timed out")},async approve(r,i){return Sh(e,t,"Approve channel pairing failed").approveWorkspaceChannelPairing(r,{code:i})}},async loadMcpStatus(){const r=Yt(e,"Load MCP status failed");return bt(r.workspaceMcp(),"Load MCP status timed out")},async initializeMcp(){const r=Yt(e,"Initialize MCP failed");return bt(r.initializeWorkspaceMcp(),"Initialize MCP timed out")},async reloadMcp(){const r=Yt(e,"Reload MCP failed");return bt(r.reloadWorkspaceMcp(),"Reload MCP timed out")},async loadMcpTools(r){const i=Yt(e,"Load MCP tools failed");try{return await bt(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=Yt(e,"Load MCP resources failed");try{return await bt(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=Yt(e,"Restart MCP server failed");return bt(i.restartMcpServer(r),"Restart MCP server timed out",5*6e4)},async manageMcpServer(r,i){const o=Yt(e,"Manage MCP server failed"),a=i==="authenticate"?10*6e4:5*6e4;return bt(o.manageMcpServer(r,i),"Manage MCP server timed out",a)},async addRuntimeMcpServer(r){const i=Yt(e,"Add MCP server failed");return bt(i.addRuntimeMcpServer(r),"Add MCP server timed out",5*6e4)},async removeRuntimeMcpServer(r){const i=Yt(e,"Remove MCP server failed");return bt(i.removeRuntimeMcpServer(r),"Remove MCP server timed out",5*6e4)},async loadDaemonStatus(r){const i=Yt(e,"Load daemon status failed");return bt(i.daemonStatus(r),"Load daemon status timed out")},async loadUsageDashboard(r){const i=Yt(e,"Load usage dashboard failed");return bt(i.usageDashboard(r),"Load usage dashboard timed out")},async loadSkillsStatus(){const r=Yt(e,"Load skills failed");return bt(r.workspaceSkills(),"Load skills timed out")},async setWorkspaceSkillEnabled(r,i){const o=Yt(e,"Set skill enabled failed");return bt(o.setWorkspaceSkillEnabled(r,i),"Set skill enabled timed out")},async installWorkspaceSkill(r){const i=Yt(e,"Install skill failed");return bt(i.installWorkspaceSkill(r),"Install skill timed out")},async deleteWorkspaceSkill(r,i){const o=Yt(e,"Delete skill failed");return bt(o.deleteWorkspaceSkill(r,i),"Delete skill timed out")},async loadExtensionsStatus(){const r=Yt(e,"Load extensions failed");return bt(r.workspaceExtensions(),"Load extensions timed out")},async loadToolsStatus(){const r=Yt(e,"Load tools failed");return bt(r.workspaceTools(),"Load tools timed out")},async preheatAcp(r){const i=Yt(e,"Preheat ACP failed");return bt(i.workspaceAcpPreheat(r),"Preheat ACP timed out",r===void 0?void 0:r+2e3)},async setWorkspaceToolEnabled(r,i){const o=Yt(e,"Set tool enabled failed");return bt(o.setWorkspaceToolEnabled(r,i),"Set tool enabled timed out")},async loadSettingsStatus(){const r=Yt(e,"Load settings failed");return bt(r.workspaceSettings(),"Load settings timed out")},async setWorkspaceSetting(r,i,o,a){const c=Yt(e,"Set setting failed");return bt(c.setWorkspaceSetting(r,i,o,a),"Set setting timed out")},async loadMemoryStatus(){const r=Yt(e,"Load memory failed");return bt(r.workspaceMemory(),"Load memory timed out")},async readWorkspaceFile(r){const i=Yt(e,"Read workspace file failed");return bt(i.readWorkspaceFile(r),"Read workspace file timed out")},async writeMemory(r){const i=Yt(e,"Write memory failed");return bt(i.writeWorkspaceMemory(r),"Write memory timed out")},async*generateContent(r,i){yield*Yt(e,"Generate content failed").generateWorkspaceContent(r,{signal:i==null?void 0:i.signal})},async listAgents(){const r=Yt(e,"List agents failed");return bt(r.listWorkspaceAgents(),"List agents timed out")},async getAgent(r,i){const o=Yt(e,"Get agent failed");return bt(o.getWorkspaceAgent(r,i?{scope:i}:{}),"Get agent timed out")},async createAgent(r){const i=Yt(e,"Create agent failed");return bt(i.createWorkspaceAgent(r),"Create agent timed out")},async generateAgent(r){const i=Yt(e,"Generate agent failed");return bt(i.generateWorkspaceAgent(r),"Generate agent timed out",x1e)},async deleteAgent(r,i){const o=Yt(e,"Delete agent failed");return bt(o.deleteWorkspaceAgent(r,i?{scope:i}:{}),"Delete agent timed out")},async globWorkspace(r,i){Yt(e,"Glob workspace failed");const o=od(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 bt(fetch(ad(o,n),{headers:Kg(s)}),"Glob workspace timed out");if(!a.ok)throw new Error(await ld(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=Yt(e,"Load providers failed");return bt(r.workspaceProviders(),"Load providers timed out")},async readFileBytes(r,i){const o=Yt(e,"Read file bytes failed");return bt(o.readWorkspaceFileBytes(r,i??{}),"Read file bytes timed out")},async writeFile(r){const i=Yt(e,"Write file failed");return bt(i.writeWorkspaceFile(r),"Write file timed out")},async editFile(r){const i=Yt(e,"Edit file failed");return bt(i.editWorkspaceFile(r),"Edit file timed out")},async stat(r){Yt(e,"Stat file failed");const i=od(n,"/stat");i.searchParams.set("path",r);const o=await bt(fetch(ad(i,n),{headers:Kg(s)}),"Stat file timed out");if(!o.ok)throw new Error(await ld(o,"GET /stat"));return await o.json()},async listDirectory(r){Yt(e,"List directory failed");const i=od(n,"/list");i.searchParams.set("path",r);const o=await bt(fetch(ad(i,n),{headers:Kg(s)}),"List directory timed out");if(!o.ok)throw new Error(await ld(o,"GET /list"));return await o.json()},async listScheduledTasks(r){Yt(e,"List scheduled tasks failed");const i=ow(r),o=od(n,i),a=await bt(fetch(ad(o,n),{headers:Kg(s)}),"List scheduled tasks timed out");if(!a.ok)throw new Error(await ld(a,`GET ${i}`));const c=await a.json();return Array.isArray(c.tasks)?c.tasks:[]},async createScheduledTask(r,i){Yt(e,"Create scheduled task failed");const o=ow(i),a=od(n,o),c=await bt(fetch(ad(a,n),{method:"POST",headers:tS(s),body:JSON.stringify(r)}),"Create scheduled task timed out");if(!c.ok)throw new Error(await ld(c,`POST ${o}`));return await c.json()},async updateScheduledTask(r,i,o){Yt(e,"Update scheduled task failed");const a=ow(o,`/${encodeURIComponent(r)}`),c=od(n,a),u=await bt(fetch(ad(c,n),{method:"PATCH",headers:tS(s),body:JSON.stringify(i)}),"Update scheduled task timed out");if(!u.ok)throw new Error(await ld(u,`PATCH ${a}`));return await u.json()},async runScheduledTask(r,i){Yt(e,"Run scheduled task failed");const o=ow(i,`/${encodeURIComponent(r)}/run`),a=od(n,o),c=await bt(fetch(ad(a,n),{method:"POST",headers:tS(s)}),"Run scheduled task timed out");if(!c.ok)throw new Error(await ld(c,`POST ${o}`));return await c.json()},async deleteScheduledTask(r,i){Yt(e,"Delete scheduled task failed");const o=ow(i,`/${encodeURIComponent(r)}`),a=od(n,o),c=await bt(fetch(ad(a,n),{method:"DELETE",headers:Kg(s)}),"Delete scheduled task timed out");if(!c.ok)throw new Error(await ld(c,`DELETE ${o}`))},async listGoals(){Yt(e,"List goals failed");const r=od(n,"/goals"),i=await bt(fetch(ad(r,n),{headers:Kg(s)}),"List goals timed out");if(!i.ok)throw new Error(await ld(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){Yt(e,"Clear goal failed");const i=od(n,`/session/${encodeURIComponent(r)}/goal/clear`),o=await bt(fetch(ad(i,n),{method:"POST",headers:tS(s),body:"{}"}),"Clear goal timed out");if(!o.ok)throw new Error(await ld(o,`POST /session/${r}/goal/clear`));return await o.json()},async loadEnv(){const r=Yt(e,"Load env failed");return bt(r.workspaceEnv(),"Load env timed out")},async loadPreflight(){const r=Yt(e,"Load preflight failed");return bt(r.workspacePreflight(),"Load preflight timed out")},async initWorkspace(r){const i=Yt(e,"Init workspace failed");return bt(i.initWorkspace(r),"Init workspace timed out")},async updateAgent(r,i,o){const a=Yt(e,"Update agent failed");return bt(a.updateWorkspaceAgent(r,i,o?{scope:o}:{}),"Update agent timed out")},async installExtension(r,i){const o=Yt(e,"Install extension failed");return bt(o.installExtension(r,i),"Install extension timed out")},async extensionOperationStatus(r){const i=Yt(e,"Load extension operation failed");return bt(i.extensionOperationStatus(r),"Load extension operation timed out")},async activeExtensionOperations(){const r=Yt(e,"Load active extension operations failed");return bt(r.activeExtensionOperations(),"Load active extension operations timed out")},async respondToExtensionInteraction(r,i,o,a){const c=Yt(e,"Respond to extension interaction failed");return bt(c.respondToExtensionInteraction(r,i,o,a),"Respond to extension interaction timed out")},async checkExtensionUpdates(r){const i=Yt(e,"Check extension updates failed");return bt(i.checkExtensionUpdates(r),"Check extension updates timed out")},async refreshExtensions(r){const i=Yt(e,"Refresh extensions failed");return bt(i.refreshExtensions(r),"Refresh extensions timed out")},async enableExtension(r,i,o){const a=Yt(e,"Enable extension failed");return bt(a.enableExtension(r,i,o),"Enable extension timed out")},async disableExtension(r,i,o){const a=Yt(e,"Disable extension failed");return bt(a.disableExtension(r,i,o),"Disable extension timed out")},async updateExtension(r,i){const o=Yt(e,"Update extension failed");return bt(o.updateExtension(r,i),"Update extension timed out")},async uninstallExtension(r,i){const o=Yt(e,"Uninstall extension failed");return bt(o.uninstallExtension(r,i),"Uninstall extension timed out")},async startDeviceFlow(r){const i=Yt(e,"Start device flow failed");return bt(i.startDeviceFlow({providerId:r}),"Start device flow timed out")},async getDeviceFlow(r,i){const o=Yt(e,"Get device flow failed");return bt(o.getDeviceFlow(r,i),"Get device flow timed out")},async cancelDeviceFlow(r){const i=Yt(e,"Cancel device flow failed");return bt(i.cancelDeviceFlow(r),"Cancel device flow timed out")},async getAuthStatus(){const r=Yt(e,"Get auth status failed");return bt(r.getAuthStatus(),"Get auth status timed out")},async getAuthProviders(){const r=Yt(e,"Get auth providers failed");return bt(r.getAuthProviders(),"Get auth providers timed out")},async installAuthProvider(r){const i=Yt(e,"Install auth provider failed");return bt(i.installAuthProvider(r),"Install auth provider timed out")},async deleteModel(r){const i=Yt(e,"Delete model failed");return bt(i.deleteModel(r),"Delete model timed out")},async addWorkspace(r,i){const o=Yt(e,"Add workspace failed");return bt(o.addWorkspace(r,i),"Add workspace timed out")},async addScratchWorkspace(){const r=Yt(e,"Add scratch workspace failed");return bt(r.addScratchWorkspace(),"Add scratch workspace timed out")},async suggestWorkspacePaths(r){const i=Yt(e,"Suggest workspace paths failed");return await bt(i.workspacePathSuggestions(r),"Suggest workspace paths timed out")},async pickWorkspaceDirectory(){const r=Yt(e,"Open directory picker failed");return await bt(r.workspaceDirectoryPicker(),"Open directory picker timed out",32e4)},async updateWorkspace(r,i){const o=Yt(e,"Update workspace failed");return bt(o.updateWorkspace(r,i),"Update workspace timed out")},async removeWorkspace(r,i){const a=Yt(e,"Remove workspace failed").workspaceById(r).remove(i);return(i==null?void 0:i.timeoutMs)===0?a:bt(a,"Remove workspace timed out",i==null?void 0:i.timeoutMs)}}}function Yt(e,t){const n=e();if(!n)throw new Error(`${t}: DaemonClient is not connected`);return n}function W2(e){const t=e();if(!t)throw new Error("Daemon workspace is not connected");return t}function Sh(e,t,n){return Yt(e,n).workspaceByCwd(W2(t))}function ow(e,t=""){return e?`/workspaces/${encodeURIComponent(e)}/scheduled-tasks${t}`:`/scheduled-tasks${t}`}function Kg(e){const t={};return e&&(t.Authorization=`Bearer ${e}`),t}function tS(e){const t={"Content-Type":"application/json"};return e&&(t.Authorization=`Bearer ${e}`),t}function od(e,t){const n=pQ(e),s=typeof window>"u"?"http://localhost":window.location.origin;return new URL(`${n}${t}`,s)}function ad(e,t){return pQ(t)?e.toString():`${e.pathname}${e.search}`}function pQ(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 ld(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 _I=h.createContext(void 0);let aw;function _1e({baseUrl:e,token:t,workspaceCwd:n,autoConnect:s=!0,transport:r,children:i}){const o=h.useMemo(()=>s?new lA({baseUrl:e,token:t,transport:r}):void 0,[s,e,t,r]),a=h.useRef(o);a.current=o;const c=h.useRef(void 0),u=h.useRef(void 0),d=h.useRef(0),f=h.useRef(n),[m,p]=h.useState(void 0),[g,b]=h.useState(s?"connecting":"idle"),[v,y]=h.useState(void 0),w=h.useCallback(()=>{if(!o)return Promise.reject(new Error("Daemon workspace client unavailable"));if(c.current!==o&&(c.current=o,u.current=void 0,d.current++),!u.current){const T=o.capabilities().catch(_=>{throw u.current===T&&(u.current=void 0),_});u.current=T}return u.current},[o]),x=h.useCallback(()=>{if(!o)return Promise.reject(new Error("Daemon workspace client unavailable"));c.current!==o&&(c.current=o,d.current++);const T=++d.current,_=()=>{const R=u.current;return c.current===o&&R&&d.current!==T?R:Promise.reject(new Error("Capabilities refresh was superseded by a client change"))},S=o.capabilities().then(R=>c.current!==o||d.current!==T?_():(p(R),b("connected"),y(void 0),R),R=>{if(c.current!==o||d.current!==T)return _();throw y(R instanceof Error?R:new Error(String(R))),b("error"),R});return u.current=S,S},[o]);h.useEffect(()=>{if(!o)return;b("connecting"),y(void 0),p(void 0),aw===o&&(aw=void 0);let T=!1;const _=w();return _.then(S=>{!T&&c.current===o&&u.current===_&&(p(S),b("connected"))}).catch(S=>{!T&&c.current===o&&u.current===_&&(y(S instanceof Error?S:new Error(String(S))),b("error"))}),()=>{T=!0,aw=o,queueMicrotask(()=>{aw===o&&(aw=void 0,o.dispose())})}},[o,w]),f.current=(m==null?void 0:m.workspaceCwd)??n;const k=h.useMemo(()=>k1e({getClient:()=>a.current,getWorkspaceCwd:()=>f.current,baseUrl:e,token:t}),[e,t]),C=h.useMemo(()=>{if(o)return{client:o,token:t,baseUrl:e,workspaceCwd:(m==null?void 0:m.workspaceCwd)??n,status:g,error:v,capabilities:m,getCapabilities:w,refreshCapabilities:x,actions:k}},[o,t,e,n,g,v,m,w,x,k]);return l.jsx(_I.Provider,{value:C,children:i})}function io(){const e=h.useContext(_I);if(!e)throw new Error("useDaemonWorkspace must be used within DaemonWorkspaceProvider");return e}function pa(){return io().actions}function gQ(){return h.useContext(_I)}function S1e(e){if(e.length===0)return"idle";const t=e[e.length-1];if((t==null?void 0:t.kind)==="thought"&&AB(t))return"thinking";if((t==null?void 0:t.kind)==="assistant"&&AB(t)||(t==null?void 0:t.kind)==="tool"&&NB(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"&&NB(s))return"responding"}return"idle"}function C1e(e,t){const n=S1e(e);return t==="idle"?"idle":n!=="idle"||t===void 0?n:t==="waiting"?"waiting":"responding"}function AB(e){return e.streaming===!0}function NB(e){return e.status==="running"||e.status==="in_progress"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const bA=new Set;let rC;function MB(){return rC}function T1e(e){return bA.add(e),()=>{bA.delete(e)}}function E1e(e){rC={...e},bQ()}function nS(){rC!==void 0&&(rC=void 0,bQ())}function bQ(){for(const e of bA)e()}function j1e(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 yA=new Set,yQ=Object.freeze([]),T8=64;let hm=yQ;function IB(){return hm}function A1e(e){return yA.add(e),()=>{yA.delete(e)}}function N1e(e){const t=[...hm,{sessionId:e.sessionId,messages:[...e.messages],...e.originatorClientId?{originatorClientId:e.originatorClientId}:{}}];if(t.length>T8){const n=t.length-T8;console.debug(`[mid-turn] sidechannel buffer over ${T8}; evicting ${n} oldest batch(es)`),hm=t.slice(n)}else hm=t;wQ()}function M1e(e){if(e.length===0||hm.length===0)return;const t=new Set(e),n=hm.filter(s=>!t.has(s));n.length!==hm.length&&(hm=n.length===0?yQ:n,wQ())}function wQ(){for(const e of yA)e()}function I1e(e){if(!e||typeof e!="object")return;const t=e;if(t.type!==JX)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 wA=new Set,vA=new Set;let vQ=0,Q1=[];function R1e(){return vQ}function RB(){return Q1}function D1e(e){return wA.add(e),()=>{wA.delete(e)}}function P1e(e){return vA.add(e),()=>{vA.delete(e)}}function L1e(){vQ++;for(const e of wA)try{e()}catch(t){console.error("[pendingPromptVersion] listener error",t)}}function xQ(){for(const e of vA)try{e()}catch(t){console.error("[pendingPromptEvents] listener error",t)}}function O1e(e){if(e.length===0)return;const t=new Set(e),n=Q1.filter(s=>!t.has(s));n.length!==Q1.length&&(Q1=n,xQ())}function $1e(e){const t=kQ(e);return t?(Q1=[...Q1,t].slice(-200),xQ(),(t.type===fI||t.type===mI||t.type===pI)&&L1e(),!0):!1}function B1e(e){return kQ(e)!==void 0}function kQ(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===fI||n===mI||n===pI)&&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 _Q=[404,410],z1e=new Set(_Q);function fv(e){return e!==void 0&&z1e.has(e)}function cd(e,t){return fv(t)&&!fv(e)?t:e}const DB="session_transcript_pagination",F1e="workspace_acp_preheat",H1e="workspace_acp_status";function Qf(e,t){const n=tQ(e);return{type:"assistant.done",reason:t,eventId:e.id,...n!==void 0?{serverTimestamp:n}:{}}}function PB(e){if(e.type==="history_truncated")try{return po(e.data)?bu(e.data,"recordId"):void 0}catch{return}if(e.type==="session_update")try{if(!po(e.data))return;const t=e.data.update,n=po(t)?t._meta:e.data._meta;return po(n)?bu(n,"qwen.session.recordId"):void 0}catch{return}}function SQ(e){return e.type==="history_truncated"&&po(e.data)&&e.data.fullTranscriptAvailable===!0}function q1e(e,t,n){const s=e.getSnapshot(),r=new Set;for(const c of s.blocks)for(const u of c.sourceRecordIds??[])r.add(u);const i=r.size===0?t:t.filter(c=>{var u;return!((u=c.sourceRecordIds)!=null&&u.some(d=>r.has(d)))}),o=pA({maxBlocks:Number.MAX_SAFE_INTEGER,nextOrdinal:s.nextOrdinal,retainSubagentBlocks:s.retainSubagentBlocks});o.dispatch(i);const a=o.getSnapshot();return a.blocks.length+s.blocks.length>n?!1:(e.reset({...s,blocks:[...a.blocks,...s.blocks],nextOrdinal:a.nextOrdinal,toolBlockByCallId:{...a.toolBlockByCallId,...s.toolBlockByCallId},permissionBlockByRequestId:{...a.permissionBlockByRequestId,...s.permissionBlockByRequestId}}),!0)}function Vp(e,t){if(!(typeof e!="string"||e.length===0))return e.length<=t?e:`${e.slice(0,t)}…`}function U1e(e){var t;const n=po(e.rawInput)?e.rawInput:void 0,s=po(e.rawOutput)?e.rawOutput:void 0,r=(t=e.toolName)==null?void 0:t.toLowerCase();if(!(r==="agent"||r==="task"||typeof(n==null?void 0:n.subagent_type)=="string"||(s==null?void 0:s.type)==="task_execution"))return e;const o=po(s==null?void 0:s.executionSummary)?s.executionSummary:void 0,a=Vp(n==null?void 0:n.subagent_type,120),c=Vp(n==null?void 0:n.prompt,240),u=Vp(n==null?void 0:n.description,240),d=Vp(s==null?void 0:s.subagentName,120),f=Vp(s==null?void 0:s.taskDescription,240),m=Vp(s==null?void 0:s.status,80),p=Vp(s==null?void 0:s.terminateReason,240),g=n?{...a?{subagent_type:a}:{},...c?{prompt:c}:{},...u?{description:u}:{},...n.run_in_background===!0?{run_in_background:!0}:{}}:void 0,b=s?{...s.type==="task_execution"?{type:"task_execution"}:{},...d?{subagentName:d}:{},...f?{taskDescription:f}:{},...m?{status:m}:{},...p?{terminateReason:p}:{},...typeof s.tokenCount=="number"?{tokenCount:s.tokenCount}:{},...o?{executionSummary:{...typeof o.totalToolCalls=="number"?{totalToolCalls:o.totalToolCalls}:{},...typeof o.totalDurationMs=="number"?{totalDurationMs:o.totalDurationMs}:{},...typeof o.outputTokens=="number"?{outputTokens:o.outputTokens}:{},...typeof o.inputTokens=="number"?{inputTokens:o.inputTokens}:{},...typeof o.cachedTokens=="number"?{cachedTokens:o.cachedTokens}:{},...typeof o.totalTokens=="number"?{totalTokens:o.totalTokens}:{}}}:{}}:void 0;return{...e,...g&&Object.keys(g).length>0?{rawInput:g}:{rawInput:void 0},...b&&Object.keys(b).length>0?{rawOutput:b}:{rawOutput:void 0},content:void 0,details:void 0}}function E8(e){const t=[];for(const n of e)"parentToolCallId"in n&&n.parentToolCallId&&n.type!=="assistant.usage"||t.push(n.type==="tool.update"?U1e(n):n);return t}const CQ=h.createContext(void 0),TQ=h.createContext(void 0),SI=h.createContext(void 0),EQ=h.createContext(void 0),jQ=h.createContext(void 0),AQ=h.createContext(void 0),NQ=h.createContext(void 0),CI=new Set([401,403]),W1e=new Set([...CI,..._Q]),V1e=2e5,G1e={memoryVersion:0,agentsVersion:0,toolsVersion:0,settingsVersion:0,mcpVersion:0,extensionsVersion:0,artifactsVersion:0,initVersion:0,authVersion:0},K1e=Symbol("unhandled session");function TI(e){const{baseUrl:t,token:n,workspaceCwd:s,sessionId:r,clientId:i,createSessionRequest:o,maxQueued:a=1024,maxBlocks:c=V1e,historyPageSize:u,subagentTranscriptMode:d="full",suppressOwnUserEcho:f=!0,includeRawEvent:m=!1,autoConnect:p=!0,autoReconnect:g=!0,restartEventStreamOnPrompt:b=!1,reconnectDelayMs:v=1e3,maxReconnectDelayMs:y=1e4,heartbeatIntervalMs:w=3e4,heartbeatFailureThreshold:x=3,loadWarnings:k,children:C}=e,T=gQ(),_=t??(T==null?void 0:T.baseUrl),S=n??(T==null?void 0:T.token),R=s??(T==null?void 0:T.workspaceCwd),A=h.useRef(T==null?void 0:T.client);A.current=T==null?void 0:T.client;const O=h.useRef(T==null?void 0:T.capabilities);O.current=T==null?void 0:T.capabilities;const M=h.useRef(T==null?void 0:T.getCapabilities);M.current=T==null?void 0:T.getCapabilities;const D=h.useRef(!1),z=h.useRef(r).current,B=z===void 0,j=h.useRef(R);j.current=R;const H=h.useRef(R);R&&(H.current=R);const Q=h.useMemo(()=>pA({maxBlocks:c,retainSubagentBlocks:d==="full"}),[c,d]),I=h.useRef(void 0),J=h.useRef({hasMore:!1,loading:!1,capacityReached:!1,paginationError:!1}),[W,P]=h.useState({hasMore:!1,loading:!1,capacityReached:!1,paginationError:!1}),V=h.useRef(void 0),ee=h.useRef(void 0),q=h.useRef(new Map),K=h.useRef(new Map),de=h.useRef(void 0),re=h.useRef(0),ne=h.useRef(void 0),U=h.useRef(!1),Z=h.useRef({consecutiveFailures:0}),ge=h.useRef(!1),ce=h.useRef(void 0),ue=h.useRef(new WeakSet),be=h.useRef({suppressOwnUserEcho:f,includeRawEvent:m}),rt=h.useRef({reconnectDelayMs:v,maxReconnectDelayMs:y}),le=h.useRef(k),Me=h.useRef(u),We=h.useRef(d),at=h.useRef(void 0);(!at.current||i)&&(at.current=S8(i)),be.current={suppressOwnUserEcho:f,includeRawEvent:m},rt.current={reconnectDelayMs:v,maxReconnectDelayMs:y},le.current=k,Me.current=u,We.current=d;const ze=o==null?void 0:o.modelServiceId,rn=o==null?void 0:o.sessionScope,Wt=h.useRef(o);Wt.current=o;const[zt,ae]=h.useState("idle"),[je,it]=h.useState(z),[gt,wt]=h.useState(void 0),[Ke,un]=h.useState("load"),[me,ht]=h.useState(0),[Oe,Ne]=h.useState(0),[St,Ue]=h.useState(0),[ve,Fe]=h.useState({status:p?"connecting":"idle",...z?{sessionId:z}:{}}),ie=h.useRef(ve);ie.current=ve,h.useEffect(()=>{T!=null&&T.capabilities&&Fe(Ve=>Ve.capabilities===T.capabilities?Ve:{...Ve,capabilities:T.capabilities})},[T==null?void 0:T.capabilities]);const Pe=h.useRef(0),[et,He]=h.useState([]),Ae=h.useCallback(Ve=>{const ft={...Ve,id:Ve.id??`daemon-notice-${Date.now()}-${++Pe.current}`,createdAt:Ve.createdAt??Date.now()};return He(Lt=>Lt.some(gn=>gn.id===ft.id)?Lt:[...Lt.slice(-49),ft]),ft},[]),vt=h.useCallback(Ve=>{He(ft=>ft.filter(Lt=>Lt.id!==Ve))},[]),vn=h.useCallback(()=>{He([])},[]),Ce=h.useMemo(()=>({notices:et,dismissNotice:vt,clearNotices:vn}),[vn,vt,et]),[yt,Ft]=h.useState(G1e),De=h.useRef(()=>!1),Xe=h.useRef(!1);h.useEffect(()=>(Xe.current=!0,()=>{Xe.current=!1}),[]),h.useEffect(()=>{var Ve;if(!p)return;if(!A.current&&!_){Fe({status:"error",error:"DaemonSessionProvider requires a baseUrl prop or an ancestor DaemonWorkspaceProvider."});return}const ft=new AbortController;let Lt=!1;const gn=Ke==="load"&&je!==void 0&&je===((Ve=I.current)==null?void 0:Ve.sessionId)&&je===ce.current;let Tn=[],Xn;const _r=()=>{if(Xn=void 0,Tn.length===0)return;const gs=Tn;Tn=[];try{Q.dispatch(gs)}catch(qn){console.error("[DaemonSessionProvider] batched transcript dispatch failed",{eventCount:gs.length,error:qn})}},zr=()=>{Xn!==void 0&&(clearTimeout(Xn),Xn=void 0)},Ar=gs=>{if(gs.length!==0){for(const qn of gs)Tn.push(qn);Xn===void 0&&(Xn=setTimeout(_r,0))}},jt=()=>{zr(),_r()},Sn=gs=>{jt(),Q.dispatch(gs)},Hn=()=>{zr(),Tn=[]};return(async()=>{var gs,qn,Dn,Rs,ts,Bs,Sr,Nr,pi,lr,Ds,gi,xe,Ye,st;const Et=A.current??new lA({baseUrl:_,token:S});let Mt,cs,bs=je,sr=!je&&St>0,Qn=0,br=!1,Ns=()=>!1,Fr=!1;for(;!Lt&&!ft.signal.aborted;){const yr=br;br=!1;let Mr=!1,Pn,Gs;const vo=()=>{Gs==null||Gs(),Gs=void 0,V.current===Pn&&(V.current=void 0)};try{let Jn=!1,xi=!1,qs=!1,wr=!1,Hr,Ir;if(!Mt){const fe=I.current;fe&&!je&&!bs&&!sr&&(Mt=fe,bs=fe.sessionId,ee.current=fe.sessionId,wr=!0)}if(!Mt){gn||Fe(vr=>({...vr,status:"connecting",error:void 0,errorStatus:cd(void 0,vr.errorStatus)}));const fe=M.current,Qe=O.current??(fe?await fe():await Et.capabilities());if(Lt||ft.signal.aborted)return;cs=Qe;const tn=Array.isArray(Qe.features)&&Qe.features.includes(DB);U.current=Array.isArray(Qe.features)&&Qe.features.includes("client_heartbeat");const ct=gt??j.current??Qe.workspaceCwd;H.current=ct;const Dt=Array.isArray(Qe.features)?Qe.features:[],Vn=ct===Qe.workspaceCwd&&Dt.includes(F1e),ps=Vn&&Dt.includes(H1e);if((B||ge.current)&&!je&&!bs&&!sr){const[vr,Ur,Os,ko]=await Promise.allSettled([Et.workspaceProviders(),Et.workspaceSkills(),ps?Et.workspaceAcpStatus():Promise.resolve(void 0),ct?Et.workspaceByCwd(ct).workspaceGit():Et.workspaceGit()]);vr.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceProviders failed in deferred connect:",vr.reason),Ur.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceSkills failed in deferred connect:",Ur.reason),ps&&Os.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceAcpStatus failed in deferred connect:",Os.reason);const ba=vr.status==="fulfilled"?vr.value:void 0,Oo=SB(ba),{commands:sc,skills:Al}=CB(Ur.status==="fulfilled"?Ur.value:void 0),kt=Ur.status==="rejected"||ge.current&&sc.length===0;Fe(cn=>({...cn,status:"connected",workspaceCwd:ct,gitBranch:ko.status==="fulfilled"?ko.value.branch??void 0:void 0,models:Oo.models,currentModel:Oo.currentModel,currentMode:Oo.currentMode,contextWindow:Oo.contextWindow,providers:ba,capabilities:Qe,commands:kt?cn.commands:sc,skills:kt?cn.skills:Al})),Vn&&!(Os.status==="fulfilled"&&((gs=Os.value)==null?void 0:gs.channelLive)===!0)&&!D.current&&(D.current=!0,(async()=>{try{const cn=await Et.workspaceAcpPreheat(5e3);if(Lt||ft.signal.aborted||!cn.ready||ie.current.sessionId)return;const En=await Et.workspaceSkills();if(Lt||ft.signal.aborted||ie.current.sessionId)return;const{commands:jn,skills:Yn}=CB(En);Fe(rs=>rs.sessionId?rs:{...rs,commands:jn,skills:Yn})}catch(cn){console.warn("[DaemonSessionProvider] ACP preheat for workspace skills failed:",cn)}finally{D.current=!1}})());return}const Ts=je&&Ke==="resume"?rw.resume:rw.load,hs=je??bs,$r=i?at.current:S8(void 0,hs);Mr=!!je,hs&&!gn&&Fe(vr=>({...vr,sessionId:hs,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0}));const Cs=((qn=de.current)==null?void 0:qn.sessionId)===hs?de.current:void 0,es=je?await Ts(Et,je,{workspaceCwd:ct,...tn&&Ke==="load"&&Me.current!==void 0?{historyPageSize:Me.current}:{}},$r):bs?await rw.load(Et,bs,{workspaceCwd:ct,...tn&&Me.current!==void 0?{historyPageSize:Me.current}:{}},$r):await rw.createOrAttach(Et,{...ze!==void 0?{modelServiceId:ze}:{},...sr?{sessionScope:"thread"}:rn!==void 0?{sessionScope:rn}:{},workspaceCwd:ct},$r);if(Mr=!1,!i&&es.clientId&&(at.current=es.clientId,U2(es.clientId,es.sessionId)),Lt||ft.signal.aborted){jB({baseUrl:_,token:S,sessionId:es.sessionId,clientId:es.clientId}).catch(vr=>console.warn("[DaemonSessionProvider] detach failed:",vr));return}if(gn&&(Cs==null?void 0:Cs.sessionId)===es.sessionId&&((Dn=Cs.signal)!=null&&Dn.aborted||de.current!==Cs)){const vr=I.current;if(es!==vr&&await es.detach().catch(Ur=>{console.warn("[DaemonSessionProvider] detach cancelled reload failed:",Ur)}),de.current===Cs&&(de.current=void 0,clearTimeout(Cs.timeout),Cs.reject(new DOMException("Session load cancelled","AbortError"))),ce.current===es.sessionId&&(ce.current=void 0),Mr=!1,(vr==null?void 0:vr.sessionId)===es.sessionId){Mt=vr,bs=vr.sessionId,Qn=0,br=!0;continue}return}const xs=ee.current;xs!==es.sessionId&&vn(),xs!==void 0&&es.sessionId!==xs?(ae("idle"),uo(ne),qs=!0):xs!==void 0&&(es.replaySnapshot.compactedReplay.length+es.replaySnapshot.liveJournal.length>0?(ae("idle"),uo(ne),qs=!0):(Q.dispatch({type:"assistant.done",reason:"reconnected"}),Q.getSnapshot().awaitingResync&&Q.clearAwaitingResync())),Jn=xs!==void 0&&xs===es.sessionId,xi=es.replaySnapshot.compactedReplay.length>0||es.replaySnapshot.liveJournal.length>0;const La=[...es.replaySnapshot.compactedReplay,...es.replaySnapshot.liveJournal];Hr=r1e(La),Ir=kI(Hr),Mt=es,bs=Mt.sessionId,sr=!1,ee.current=Mt.sessionId,I.current=Mt}const _t=Mt,Zn=ue.current.has(_t);let ds=_t.hasActivePrompt===!0&&!Zn;const Kr=()=>{ue.current.add(_t),ds=!1},_e=()=>ds||q.current.has(_t.sessionId);Ns=_e,De.current=_e,ae(_e()?"streaming":"idle");const Je=de.current,qt=(Je==null?void 0:Je.sessionId)===_t.sessionId?Je:void 0,{compactedReplay:On,liveJournal:on}=_t.replaySnapshot,Le=[...On,...on],Qt=Le.filter(fe=>fe.type==="session_update").map(PB).find(fe=>fe!==void 0)??Le.filter(fe=>fe.type==="history_truncated").map(PB).find(fe=>fe!==void 0)??_t.historyAnchorRecordId,Un=Le.some(SQ),Kn=Array.isArray(cs==null?void 0:cs.features)&&cs.features.includes(DB)&&(_t.historyHasMore||Un)&&Qt!==void 0;J.current={sessionId:_t.sessionId,...Qt!==void 0?{beforeRecordId:Qt}:{},hasMore:Kn,loading:!1,capacityReached:!1,paginationError:!1},P({hasMore:Kn,loading:!1,capacityReached:!1,paginationError:!1});const zs=xi&&Le.length>0;if(qs&&!zs&&Q.reset(),zs){const fe={...be.current,suppressOwnUserEcho:!1},Qe=[];for(const ct of Le)try{const Dt=j8(ct,_t.clientId,fe,Fe,{updateConnection:!1}),Vn=A8(ct,Dt,Ae,vt,{hideHistoryTruncation:Kn});if(Qe.push(...We.current==="summary"?E8(Vn):Vn),ct.type==="turn_complete"){const ps=((Rs=ct.data)==null?void 0:Rs.stopReason)??"end_turn";Qe.push(Qf(ct,ps))}else ct.type==="turn_error"&&Qe.push(Qf(ct,"error"))}catch(Dt){const Vn=Dt instanceof Error?Dt.message:String(Dt);Ae({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed replay event",debugMessage:Vn,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed replay event:",Dt)}let tn=!1;if(qs||Q.getSnapshot().blocks.length===0){const ct=pA({maxBlocks:Number.MAX_SAFE_INTEGER,retainSubagentBlocks:We.current==="full"});ct.dispatch(Qe);const Dt=ct.getSnapshot();tn=Dt.blocks.length>c,Q.reset({...Dt,maxBlocks:Math.max(c,Dt.blocks.length)})}else Qe.length>0&&Q.dispatch(Qe);Qe.length>0&&$B(Qe,Ft),tn&&Kn&&(J.current.hasMore=!1,J.current.capacityReached=!0,P({hasMore:!1,loading:!1,capacityReached:!0,paginationError:!1}));for(const ct of Le)LB(q.current,K.current,_t.sessionId,ct,Q,ae,ne,{requireBoundPromptId:!0});Fe(ct=>({...ct,catchingUp:void 0}))}Fe(fe=>({...fe,status:"connected",sessionId:_t.sessionId,..._t.clientId?{clientId:_t.clientId}:{},workspaceCwd:_t.workspaceCwd,displayName:TB(_t.state)??(fe.sessionId===_t.sessionId?fe.displayName:void 0),tokenUsage:Hr!==void 0?Hr:fe.sessionId===_t.sessionId?fe.tokenUsage:void 0,tokenCount:Ir!==void 0?Ir:fe.sessionId===_t.sessionId?fe.tokenCount??0:0,loadingTranscript:void 0,catchingUp:zs?fe.catchingUp:Jn||_t.lastEventId!=null||void 0})),qt&&(de.current=void 0,clearTimeout(qt.timeout),ce.current===_t.sessionId&&(ce.current=void 0),qt.resolve());const ns=yr||wr&&ie.current.commands!==void 0&&ie.current.skills!==void 0&&ie.current.supportedCommands!==void 0&&ie.current.context!==void 0,si=yr?Promise.resolve({branch:ie.current.gitBranch}):_t.workspaceCwd?Et.workspaceByCwd(_t.workspaceCwd).workspaceGit():Et.workspaceGit(),[Ys,Ps,Xs,Ai]=await Promise.allSettled([ns?Promise.resolve(void 0):Et.workspaceProviders(),ns?Promise.resolve(void 0):_t.supportedCommands(),ns?Promise.resolve(void 0):_t.context(),si]),oo=(Ys==null?void 0:Ys.status)==="fulfilled"?Ys.value:void 0,xo=(Ps==null?void 0:Ps.status)==="fulfilled"?Ps.value:void 0,ki=(Xs==null?void 0:Xs.status)==="fulfilled"?Xs.value:void 0,Pa=(Ai==null?void 0:Ai.status)==="fulfilled"?Ai.value.branch??void 0:void 0,Yr=[(Ys==null?void 0:Ys.status)==="rejected"?(ts=le.current)==null?void 0:ts.models:void 0,(Ps==null?void 0:Ps.status)==="rejected"?(Bs=le.current)==null?void 0:Bs.commands:void 0,(Xs==null?void 0:Xs.status)==="rejected"?(Sr=le.current)==null?void 0:Sr.context:void 0].filter(fe=>!!fe),pr=SB(oo),os=t1e(ki),_i=os&&os.models.length>0?os.models:pr.models,ri=(os==null?void 0:os.currentModel)??pr.currentModel,Cu=ri===pr.currentModel?pr.contextWindow:(Nr=pr.models.find(fe=>fe.id===ri))==null?void 0:Nr.contextWindow,Ju=(os==null?void 0:os.contextWindow)??((pi=_i.find(fe=>fe.id===ri))==null?void 0:pi.contextWindow)??Cu,{commands:Fc,skills:ga}=uQ(xo),rr=s1e(ki)??pr.currentMode;Fe(fe=>fe.sessionId!==_t.sessionId?fe:{...fe,status:"connected",sessionId:_t.sessionId,..._t.clientId?{clientId:_t.clientId}:{},workspaceCwd:_t.workspaceCwd,commands:xo!==void 0?Fc:fe.commands,skills:xo!==void 0?ga:fe.skills,models:_i.length>0?_i:fe.models,currentModel:ri??fe.currentModel,currentMode:rr??fe.currentMode,displayName:TB(_t.state)??fe.displayName,contextWindow:Ju??fe.contextWindow,providers:oo??fe.providers,supportedCommands:xo??fe.supportedCommands,context:ki??fe.context,gitBranch:Ai.status==="fulfilled"?Pa:fe.gitBranch,capabilities:cs??fe.capabilities,loadingTranscript:void 0,catchingUp:zs?fe.catchingUp:Jn||_t.lastEventId!=null||void 0}),Yr.length>0&&Q.dispatch(Yr.map(fe=>({type:"status",text:fe})));let ii=!1,Bi=!1;const el=()=>{const fe=q.current.get(_t.sessionId);fe==null||fe.controller.abort(),q.current.delete(_t.sessionId),ds&&Kr(),uo(ne),ae("idle"),Hn(),Q.reset(),_t.setLastEventId(0),bs=_t.sessionId,Bi=!0,Mt=void 0,I.current=void 0,De.current=()=>!1,Fe(Qe=>({...Qe,status:"connecting",error:void 0,errorStatus:cd(void 0,Qe.errorStatus)}))},qr=new AbortController;Pn={sessionId:_t.sessionId,controller:qr,restartRequested:!1},V.current=Pn;const se=()=>qr.abort(ft.signal.reason);ft.signal.addEventListener("abort",se,{once:!0}),Gs=()=>ft.signal.removeEventListener("abort",se);for await(const fe of _t.events({signal:qr.signal,maxQueued:a})){if(((lr=I.current)==null?void 0:lr.sessionId)!==_t.sessionId)break;ii||(ii=!0,Qn=0);try{const Qe=j1e(fe);if(Qe){E1e(Qe);continue}const tn=I1e(fe);tn&&N1e(tn),B1e(fe)&&($1e(fe),fe.type==="pending_prompt_started"&&(uo(ne),ae("waiting")));const ct=j8(fe,_t.clientId,be.current,Fe),Dt=A8(fe,ct,Ae,vt),Vn=We.current==="summary"?E8(Dt):Dt;if(fe.type==="state_resync_required"&&(typeof fe.data=="object"&&fe.data!==null?fe.data.reason:void 0)==="epoch_reset"){el();break}if($B(Dt,Ft),Dt.length>0){const es=N8(Dt);ae(xs=>xs==="waiting"||xs==="idle"&&es?"streaming":xs)}(fe.type==="turn_complete"||fe.type==="turn_error")&&jt();const ps=LB(q.current,K.current,_t.sessionId,fe,Q,ae,ne);let Ts=!1;if(!ps&&ds&&(fe.type==="turn_complete"||fe.type==="turn_error")){Kr(),Ts=!0,uo(ne);const es=fe.type==="turn_complete"?((Ds=fe.data)==null?void 0:Ds.stopReason)??"end_turn":"error";Sn(Qf(fe,es)),_e()||ae("idle")}!_e()&&Dt.some(es=>es.type==="debug")&&jt();const $r=!_e()&&Q.getSnapshot().activeAssistantBlockId!=null?Vn.filter(es=>es.type!=="debug"):Vn;Ar($r);for(const es of Dt)if(es.type==="prompt.cancelled"&&(ds||es.originatorClientId!==_t.clientId)){Sn(Qf(fe,"cancelled"));const xs=ds;Kr(),Ts=!0,uo(ne),xs||q.current.delete(_t.sessionId),_e()||ae("idle")}else es.type==="session.replay_complete"&&(jt(),Fe(xs=>({...xs,catchingUp:void 0})),Q.getSnapshot().awaitingResync&&Q.clearAwaitingResync(),_e()||(uo(ne),Sn({type:"assistant.done",reason:"replay_complete"}),ae("idle")));const Cs=!ps&&!Ts&&!_e();if(Cs&&(Dt.some(xs=>xs.type==="user.text.delta")?ae("waiting"):N8(Dt)&&ae(xs=>xs==="idle"?"streaming":xs)),Cs&&fe.type==="turn_complete"){uo(ne);const es=((gi=fe.data)==null?void 0:gi.stopReason)??"end_turn";Sn(Qf(fe,es)),ae("idle")}else Cs&&fe.type==="turn_error"?(uo(ne),Sn(Qf(fe,"error")),ae("idle")):Cs&&N8(Dt)&&u1e(Q,ne,"passive_observer",3e3,()=>ae("idle"));if(fe.type==="state_resync_required"&&(typeof fe.data=="object"&&fe.data!==null?fe.data.reason:void 0)!=="epoch_reset"){_e()||(ae("idle"),uo(ne)),Hn(),Q.reset(),console.warn("[DaemonSessionProvider] ring eviction detected, reloading session (sessionId=%s)",_t.sessionId),Bi=!0,Mt=void 0,I.current=void 0,De.current=()=>!1,Fe(xs=>({...xs,status:"connecting",error:void 0,errorStatus:cd(void 0,xs.errorStatus)}));break}if(fe.type==="session_closed"&&((xe=fe.data)==null?void 0:xe.reason)==="client_close"){Fr=!0;const es=_t.sessionId,xs=q.current.get(es);xs==null||xs.controller.abort(),q.current.delete(es),Mt=void 0,I.current=void 0;break}}catch(Qe){const tn=Qe instanceof Error?Qe.message:String(Qe);Ae({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.event_malformed",message:"Skipped malformed daemon event",debugMessage:tn,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed daemon event:",Qe)}}jt();const ye=Pn.restartRequested;if(vo(),ye){Qn=0,br=!0;continue}if(Fr){Sn({type:"assistant.done",reason:"cancelled"}),ae("idle"),uo(ne),Fe(fe=>({...fe,status:"disconnected",sessionId:void 0,error:void 0,errorStatus:void 0,missingSession:!1}));return}if(ge.current){Mt=void 0,I.current=void 0,De.current=()=>!1;return}!Lt&&!ft.signal.aborted&&!Bi&&(((Ye=I.current)==null?void 0:Ye.sessionId)===_t.sessionId&&(console.debug("[DaemonSessionProvider] SSE stream ended"),_e()||(uo(ne),ae("idle"),Sn({type:"assistant.done",reason:"stream_ended"}))),Fe(fe=>({...fe,status:fe.status==="error"?"error":"disconnected",error:fe.status==="error"?fe.error:void 0,errorStatus:cd(void 0,fe.errorStatus)})))}catch(Jn){const xi=(Pn==null?void 0:Pn.restartRequested)===!0;if(vo(),xi&&!Lt&&!ft.signal.aborted){jt(),Qn=0,br=!0;continue}if(Lt||ft.signal.aborted)return;jt();const qs=Jn instanceof Error?Jn.message:String(Jn),wr=iC(Jn),Hr=Mt==null?void 0:Mt.sessionId,Ir=obe(Jn),_t=ibe(Jn);if(Hr&&(Ir||_t)){const ds=q.current.get(Hr);ds==null||ds.controller.abort(),q.current.delete(Hr)}(Ir||_t||!Ns())&&(uo(ne),ae("idle"));const Zn=de.current;if(Zn&&(Zn.sessionId===je||Zn.sessionId===bs)&&(ce.current===Zn.sessionId&&(ce.current=void 0),de.current=void 0,clearTimeout(Zn.timeout),Zn.reject(Jn)),Ir||_t){if(Mt=void 0,I.current=void 0,Ir){Fe(Kr=>({...Kr,status:"error",sessionId:void 0,error:qs,errorStatus:cd(wr,Kr.errorStatus),missingSession:!1,capabilities:cs??Kr.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}const ds=Mr&&fv(wr);console.warn("[DaemonSessionProvider] terminal session error (sessionId=%s, status=%d, message=%s)",Hr,wr,qs),Fe(Kr=>({...Kr,status:"disconnected",sessionId:void 0,error:qs,errorStatus:cd(wr,Kr.errorStatus),missingSession:ds||Kr.missingSession===!0,capabilities:cs??Kr.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}else if(gn&&Mt===void 0&&(Zn==null?void 0:Zn.sessionId)===je&&((st=I.current)==null?void 0:st.sessionId)===je){Mt=I.current,bs=Mt.sessionId,Qn=0,br=!0;continue}else console.debug("[DaemonSessionProvider] retriable SSE error, preserving session for delta resume (sessionId=%s)",Mt==null?void 0:Mt.sessionId);if(!g){Mt=void 0,I.current=void 0,Fe(ds=>({...ds,status:"error",error:qs,errorStatus:cd(wr,ds.errorStatus),missingSession:!1}));return}Fe(ds=>({...ds,status:"disconnected",error:qs,errorStatus:cd(wr,ds.errorStatus),missingSession:!1,loadingTranscript:void 0}))}if(!g){I.current=void 0,Fe(Jn=>({...Jn,status:"disconnected",loadingTranscript:void 0,catchingUp:void 0}));return}Qn+=1;const Ks=rt.current,bi=l1e(Qn,Ks.reconnectDelayMs,Ks.maxReconnectDelayMs);Fe(Jn=>({...Jn,status:"disconnected",error:`Reconnecting in ${bi}ms`})),await c1e(bi,ft.signal)}})(),()=>{const gs=I.current;Lt=!0,ft.abort(),jt(),De.current=()=>!1,ae("idle"),uo(ne);const qn=(gs==null?void 0:gs.sessionId)===ce.current,Dn=!Xe.current;de.current&&(!qn||Dn)&&(clearTimeout(de.current.timeout),de.current.reject(new DOMException("Session load interrupted by cleanup","AbortError")),de.current=void 0),(!qn||Dn)&&(gs!=null&&gs.clientId)&&jB({baseUrl:_,token:S,sessionId:gs.sessionId,clientId:gs.clientId}).catch(Rs=>console.warn("[DaemonSessionProvider] detach failed:",Rs)),(!qn||Dn)&&(I.current=void 0)}},[p,g,_,S,s,ze,rn,a,c,Q,je,gt,Ke,me,Oe,St,i,B,vn,Ae,vt]),h.useEffect(()=>{if(!U.current||ve.status!=="connected"||w<=0||x<=0||!ve.sessionId)return;Z.current.sessionId!==ve.sessionId&&(Z.current={sessionId:ve.sessionId,consecutiveFailures:0});const Ve=Z.current;let ft=!1;const Lt=setInterval(()=>{const gn=I.current;gn&&gn.heartbeat().then(()=>{ft||(Ve.consecutiveFailures>=x&&Fe(Tn=>Tn.sessionId===gn.sessionId?{...Tn,status:"connected",error:void 0,errorStatus:void 0}:Tn),Ve.consecutiveFailures=0,Ve.lastHttpError=void 0)}).catch(Tn=>{var Xn,_r,zr,Ar,jt;if(ft)return;Ve.consecutiveFailures+=1;const Sn=Tn instanceof Error?Tn.message:"Session heartbeat failed",Hn=iC(Tn);if(Hn!==void 0){const Rs=(Xn=Ve.lastHttpError)==null?void 0:Xn.status;Ve.lastHttpError={status:cd(Hn,Rs)??Hn,message:fv(Rs)?((_r=Ve.lastHttpError)==null?void 0:_r.message)??Sn:Sn}}if(Ve.consecutiveFailures<x)return;const Ln=(zr=Ve.lastHttpError)==null?void 0:zr.status,gs=((Ar=Ve.lastHttpError)==null?void 0:Ar.message)??Sn,qn=Ln!==void 0&&CI.has(Ln),Dn=fv(Ln);if(qn||Dn){const Rs=gn.sessionId;console.warn(Dn?"[DaemonSessionProvider] heartbeat detected missing session (sessionId=%s, status=%d)":"[DaemonSessionProvider] heartbeat auth failure (sessionId=%s, status=%d)",Rs,Ln);const ts=q.current.get(Rs);ts==null||ts.controller.abort(),q.current.delete(Rs),uo(ne),ae("idle"),((jt=I.current)==null?void 0:jt.sessionId)===Rs&&(Dn&&(ge.current=!0),I.current=void 0)}Fe(Rs=>Rs.sessionId===gn.sessionId?{...Rs,status:qn?"error":"disconnected",error:gs,errorStatus:cd(Ln,Rs.errorStatus),missingSession:Dn,...qn||Dn?{sessionId:void 0,loadingTranscript:void 0,catchingUp:void 0}:{}}:Rs)})},w);return()=>{ft=!0,clearInterval(Lt)}},[ve.sessionId,ve.status,x,w]);const $e=h.useMemo(()=>m1e({store:Q,sessionRef:I,activePromptsRef:q,settledPromptsRef:K,pendingSessionLoadRef:de,pendingSessionLoadIdRef:re,heartbeatSupportedRef:U,manualSessionClearRef:ge,skipNextCleanupDetachSessionIdRef:ce,passiveAssistantDoneTimerRef:ne,hasSessionActivePrompt:()=>De.current(),resetCurrentSessionActivePrompt:()=>{De.current=()=>!1},restartEventStream:Ve=>{if(!b)return;const ft=V.current;(ft==null?void 0:ft.sessionId)===Ve&&(ft.restartRequested=!0,ft.controller.abort())},getCreateSessionRequest:()=>{var Ve;return{...Wt.current,sessionScope:"thread",workspaceCwd:H.current??((Ve=I.current)==null?void 0:Ve.workspaceCwd)}},createDetachedSession:(Ve,ft)=>{var Lt;const gn=A.current??new lA({baseUrl:_,token:S}),Tn={...Wt.current,sessionScope:"thread",workspaceCwd:Ve??H.current??((Lt=I.current)==null?void 0:Lt.workspaceCwd),...(ft==null?void 0:ft.approvalMode)!==void 0?{approvalMode:ft.approvalMode}:{},...(ft==null?void 0:ft.sourceType)!==void 0?{sourceType:ft.sourceType}:{},...(ft==null?void 0:ft.worktree)!==void 0?{worktree:ft.worktree}:{},...(ft==null?void 0:ft.branch)!==void 0?{branch:ft.branch}:{}},Xn=i?at.current:S8(void 0);return rw.createOrAttach(gn,Tn,Xn)},getConnection:()=>ie.current,addNotice:Ae,setConnection:Fe,setPromptStatus:ae,setRestoreSessionId:it,setRestoreWorkspaceCwd:wt,setRestoreMode:un,setRestoreSessionNonce:ht,setAttachSessionNonce:Ne,setNewSessionNonce:Ue}),[Ae,i,_,S,b,Q]),Ht=h.useCallback(async()=>{const Ve=J.current,ft=I.current;if(!Ve.hasMore||Ve.loading||Ve.paginationError||!ft||ft.sessionId!==Ve.sessionId)return;Ve.loading=!0,P({hasMore:!0,loading:!0,capacityReached:!1,paginationError:!1});let Lt=!1;try{const gn=await ft.client.getSessionTranscriptPage(ft.sessionId,{...Ve.cursor!==void 0?{cursor:Ve.cursor}:Ve.beforeRecordId!==void 0?{beforeRecordId:Ve.beforeRecordId}:{},limit:Me.current??100,clientId:ft.clientId});if(I.current!==ft||J.current!==Ve)return;if(gn.partial||gn.replayError)throw Lt=!0,new Error(gn.replayError??"Earlier session history was only partially read");const Tn={...be.current,suppressOwnUserEcho:!1},Xn=[];for(const zr of gn.events)try{const Ar=A8(zr,j8(zr,ft.clientId,Tn,Fe,{updateConnection:!1}),Ae,vt);Xn.push(...We.current==="summary"?E8(Ar):Ar)}catch(Ar){const jt=Ar instanceof Error?Ar.message:String(Ar);Ae({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed history event",debugMessage:jt,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed history event:",Ar)}if(Xn.length>0&&!q1e(Q,Xn,c)){Ve.hasMore=!1,Ve.loading=!1,Ve.capacityReached=!0,P({hasMore:!1,loading:!1,capacityReached:!0,paginationError:!1});return}const _r=Q.getSnapshot().blocks.length<c;Ve.capacityReached=gn.hasMore&&!_r,Ve.cursor=gn.nextCursor,Ve.beforeRecordId=void 0,Ve.hasMore=gn.hasMore&&_r,Ve.loading=!1,P({hasMore:Ve.hasMore,loading:!1,capacityReached:Ve.capacityReached,paginationError:!1})}catch(gn){if(I.current!==ft||J.current!==Ve)return;const Tn=!Lt&&(!(gn instanceof Rc)||gn.status>=500||gn.status===408||gn.status===429);throw Ve.hasMore=Tn,Ve.loading=!1,Ve.capacityReached=!1,Ve.paginationError=!Tn,P({hasMore:Tn,loading:!1,capacityReached:!1,paginationError:!Tn}),Tn&&Ae({severity:"warning",category:"user_action",operation:"load_session",code:"daemon.transcript_history.failed",message:"Failed to load earlier session history",debugMessage:gn instanceof Error?gn.message:String(gn),recoverable:Tn}),gn}},[Ae,vt,c,Q]),ke=h.useMemo(()=>{var Ve;const ft=ve.sessionId===J.current.sessionId&&((Ve=I.current)==null?void 0:Ve.sessionId)===J.current.sessionId;return{hasMore:ft&&W.hasMore,loading:ft&&W.loading,capacityReached:ft&&W.capacityReached,paginationError:ft&&W.paginationError,loadMore:Ht}},[ve.sessionId,Ht,W]),Fn=h.useRef(K1e);return h.useEffect(()=>{if(Fn.current===r)return;Fn.current=r;const Ve=ie.current.sessionId;if(r===Ve)return;const ft=r?$e.loadSession(r):Ve?$e.clearSession():void 0;ft&&ft.catch(Lt=>{console.warn("[DaemonSessionProvider] controlled session transition failed:",Lt)})},[$e,r]),l.jsx(CQ.Provider,{value:Q,children:l.jsx(TQ.Provider,{value:ve,children:l.jsx(jQ.Provider,{value:zt,children:l.jsx(AQ.Provider,{value:Ce,children:l.jsx(NQ.Provider,{value:yt,children:l.jsx(SI.Provider,{value:$e,children:l.jsx(EQ.Provider,{value:ke,children:C})})})})})})})}function LB(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;uo(o);try{const f=hI(s,u);if(!f)return!1;r.dispatch(Qf(s,f.stopReason)),i("idle"),d.resolve?(e.delete(n),d.resolve(f)):(e.delete(n),t.set(gA(n,u),{status:"resolved",result:f}))}catch(f){r.dispatch(Qf(s,"error")),i("idle"),d.reject?(e.delete(n),d.reject(f)):(e.delete(n),t.set(gA(n,u),{status:"rejected",error:f}))}return!0}function Y1e(e){return e.type==="turn_complete"}function j8(e,t,n,s,r={}){X1e(e),r.updateConnection!==!1&&n1e(e,s);const i=w0e(e,{clientId:t,suppressOwnUserEcho:n.suppressOwnUserEcho,includeRawEvent:n.includeRawEvent}),o=nbe(e);return Y1e(e)?o?[o]:[]:o?[...i,o]:i}function X1e(e){e.type==="settings_reloaded"&&console.debug("[DaemonSessionProvider] settings reloaded:",Q1e(e))}function Q1e(e){const t={};if(e.id!==void 0&&(t.eventId=e.id),!po(e.data))return t.payload="non-object",t;const n=J1e(e.data.env),s=mv(e.data.changedKeys),r=mv(e.data.sessionsRefreshed),i=mv(e.data.sessionsSkipped),o=e.data.childReloaded,a=bu(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 J1e(e){if(po(e))return{updatedKeys:mv(e.updatedKeys)??[],removedKeys:mv(e.removedKeys)??[]}}function mv(e){if(Array.isArray(e))return e.filter(t=>typeof t=="string")}function A8(e,t,n,s,r={}){if(r.hideHistoryTruncation&&SQ(e))return[];if(e.type==="session_snapshot"&&po(e.data)&&e.data.recordingDegraded===!1){const o=bu(e.data,"sessionId");o&&s(`daemon.session_recording_degraded:${o}`)}const i=[];for(const o of t){if(o.type!=="error"){i.push(o);continue}if(e.type==="turn_error"){i.push(o);continue}const a=n(Z1e(e,o));(a.category==="protocol"||a.category==="connection")&&console.warn("[DaemonSessionProvider] daemon notice:",a)}return i}function Z1e(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=po(e.data)?bu(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 nT(){const e=h.useContext(CQ);if(!e)throw new Error("useDaemonTranscriptStore must be used within DaemonSessionProvider");return e}function MQ(){const e=h.useContext(EQ);if(!e)throw new Error("useDaemonTranscriptHistory must be used within DaemonSessionProvider");return e}function rk(){const e=nT(),t=h.useCallback(()=>e.getSnapshot().blocks,[e]);return h.useSyncExternalStore(e.subscribe,t,t)}function sT(){const e=rk(),t=IQ();return h.useMemo(()=>C1e(e,t),[e,t])}function ug(){const e=h.useContext(SI);if(!e)throw new Error("useDaemonActions must be used within DaemonSessionProvider");return e}function ebe(){return h.useContext(SI)}function Xd(){return h.useContext(NQ)}function IQ(){const e=h.useContext(jQ);if(!e)throw new Error("useDaemonPromptStatus must be used within DaemonSessionProvider");return e}function Ra(){const e=h.useContext(TQ);if(!e)throw new Error("useDaemonConnection must be used within DaemonSessionProvider");return e}function tbe(){const e=h.useContext(AQ);if(!e)throw new Error("useDaemonSessionNotices must be used within DaemonSessionProvider");return e}function N8(e){return e.some(t=>t.type==="assistant.text.delta"||t.type==="thought.text.delta"||t.type==="tool.update")}function nbe(e){if(e.type!=="session_update")return null;const t=po(e.data)?e.data:void 0,n=po(t==null?void 0:t.update)?t.update:po(e.data)?e.data:void 0;if(!n||n.sessionUpdate!=="agent_message_chunk")return null;const s=n._meta;if(!po(s))return null;const r=sbe(s.goalStatus);if(r)return OB(e,r);const i=rbe(s.goalTerminal);if(i)return OB(e,i);const o=s.stopHookLoop;if(!po(o))return null;const a=o.goal;return!po(a)||!bu(a,"condition"),null}function OB(e,t){return{type:"status",...e.id!==void 0?{eventId:e.id}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},text:"",source:"goal",data:t}}function sbe(e){if(!po(e))return null;const t=bu(e,"kind");if(t!=="set"&&t!=="cleared"&&t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=bu(e,"condition");if(!n)return null;const s=pv(e,"iterations"),r=pv(e,"durationMs"),i=pv(e,"setAt"),o=bu(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 rbe(e){if(!po(e))return null;const t=bu(e,"kind");if(t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=bu(e,"condition");if(!n)return null;const s=pv(e,"iterations"),r=pv(e,"durationMs"),i=bu(e,"lastReason");return{kind:t,condition:n,...s!==void 0?{iterations:s}:{},...r!==void 0?{durationMs:r}:{},...i?{lastReason:i}:{}}}function bu(e,t){const n=e[t];return typeof n=="string"?n:void 0}function pv(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function $B(e,t){let n=0,s=0,r=0,i=0,o=0,a=0,c=0,u,d=0,f=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":f+=1;break}n+s+r+i+o+a+c+d+f!==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+f}))}function ibe(e){const t=iC(e);return t!==void 0&&W1e.has(t)}function obe(e){const t=iC(e);return t!==void 0&&CI.has(t)}function iC(e){if(e instanceof Rc||po(e)&&typeof e.status=="number")return e.status}function po(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Gu(e,t){const{autoLoad:n=!1,enabled:s=!0}=t,[r,i]=h.useState({data:void 0,loading:!1,error:void 0}),o=h.useRef(0),a=h.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(f=>({...f,loading:!1,error:d}));return}},[s,e]);return h.useEffect(()=>{!n||!s||a()},[n,s,a]),{...r,reload:a}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Zb(e,t,n){const s=h.useRef(!1);h.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 RQ(e={}){var t;const n=pa(),s=h.useCallback(()=>n.listAgents(),[n]),r=Gu(s,e),i=Xd();return Zb(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,generateContent:n.generateContent,deleteAgent:n.deleteAgent,updateAgent:n.updateAgent}}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function abe(e={}){var t;const{actions:n,workspaceCwd:s}=io(),r=e.enabled!==!1&&s!==void 0,i=h.useCallback(async()=>{if(!s)throw new Error("Channel management requires a workspace.");return{...await n.loadChannels(),workspaceCwd:s}},[n,s]),o=Gu(i,{...e,autoLoad:!1,enabled:r}),a=o.reload,c=h.useRef(!1),u=h.useRef(s),d=h.useCallback(async()=>(c.current=!0,a()),[a]),f=h.useRef(d);f.current=d,h.useEffect(()=>{const k=u.current!==s;!r||e.autoLoad!==!0&&!(k&&c.current)||(u.current=s,d())},[r,e.autoLoad,d,s]);const m=h.useCallback(async k=>{const C=await k();return await f.current(),C},[]),p=h.useCallback((k,C)=>m(()=>n.upsertChannel(k,C)),[n,m]),g=h.useCallback((k,C)=>m(()=>n.removeChannel(k,C)),[n,m]),b=h.useCallback((k,C)=>m(()=>n.setChannelStartup(k,C)),[n,m]),v=h.useCallback(k=>m(()=>n.startChannel(k)),[n,m]),y=h.useCallback(k=>m(()=>n.stopChannel(k)),[n,m]),w=h.useCallback(k=>m(()=>n.restartChannel(k)),[n,m]),x=((t=o.data)==null?void 0:t.workspaceCwd)===s?o.data:void 0;return{data:x?{catalog:x.catalog,snapshot:x.snapshot}:void 0,loading:o.loading,error:o.error,reload:d,catalog:(x==null?void 0:x.catalog)??[],snapshot:x==null?void 0:x.snapshot,channels:(x==null?void 0:x.snapshot.instances)??{},createOrUpdate:p,remove:g,setStartup:b,start:v,stop:y,restart:w,pairing:n.channelPairing}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function EI(e={}){const t=pa(),n=h.useCallback(()=>t.loadMcpStatus(),[t]),s=Gu(n,e),r=Xd();return Zb(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 lbe(e={}){var t;const n=pa(),s=h.useCallback(()=>n.loadMemoryStatus(),[n]),r=Gu(s,e),i=Xd();return Zb(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 V2(e={}){const{pageSize:t,cursor:n,archiveState:s,view:r,group:i,sourceType:o,...a}=e,c=io(),u=ebe(),d=h.useCallback(()=>{const T={...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(T)},[s,n,i,t,o,r,c.actions]),f=!!c.workspaceCwd,m=Gu(d,{...a,enabled:(a.enabled??!0)&&f}),p=m.reload,g=h.useCallback(async()=>{const T=await p();return T==null?void 0:T.sessions},[p]),b=m.data,v=(b==null?void 0:b.sessions)??[],y=h.useCallback(async T=>{const _=await c.actions.deleteSession(T);return _&&g(),_},[c.actions,g]),w=h.useCallback(async T=>{const _=await c.actions.deleteSessions(T);return(_.removed.length>0||_.notFound.length>0)&&g(),_},[c.actions,g]),x=h.useCallback((T,_="html")=>c.actions.exportSession(T,_),[c.actions]),k=h.useCallback(async T=>{const _=await c.actions.archiveSession(T);return _&&g(),_},[c.actions,g]),C=h.useCallback(async T=>{const _=await c.actions.unarchiveSession(T);return _&&g(),_},[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:y,deleteSessions:w,exportSession:x,archiveSession:k,unarchiveSession:C}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function cbe(e={}){var t;const n=pa(),s=h.useCallback(()=>n.loadSkillsStatus(),[n]),r=Gu(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 xA(e={}){const{detail:t="summary",...n}=e,s=pa(),r=h.useCallback(()=>s.loadDaemonStatus(t),[s,t]),i=Gu(r,n);return{...i,report:i.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function ube(e={}){const{range:t,heatmapDays:n,...s}=e,r=pa(),i=h.useCallback(()=>r.loadUsageDashboard({range:t,heatmapDays:n}),[r,t,n]),o=Gu(i,s);return{...o,dashboard:o.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function DQ(e={}){var t;const n=pa(),s=h.useCallback(()=>n.loadToolsStatus(),[n]),r=Gu(s,e),i=Xd();return Zb(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)??[],preheat:n.preheatAcp,setEnabled:n.setWorkspaceToolEnabled}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function jI(e={}){var t;const n=pa(),s=h.useCallback(()=>n.loadSettingsStatus(),[n]),r=Gu(s,e),i=Xd();return Zb(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 dbe(e={}){var t,n;const s=pa(),r=h.useCallback(()=>s.loadProviders(),[s]),i=Gu(r,e),o=Xd();return Zb(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 hbe=300,fbe=100,b1=Object.freeze({suggestion:null,isVisible:!1,shownAt:0});function M8(e){var t;const n=e;(t=n.clearFollowupSuggestion)==null||t.call(n)}function mbe(e){const{enabled:t=!0,onStateChange:n,getOnAccept:s,getOnOutcome:r}=e;let i=b1,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(b1);return}t&&(o=setTimeout(()=>{u({suggestion:v,isVisible:!0,shownAt:Date.now()})},hbe))},accept:(v,y)=>{var w;if(a)return;o&&(clearTimeout(o),o=null),a=!0;const x=i.suggestion,{shownAt:k}=i;if(!x){a=!1;return}try{(w=r())==null||w({outcome:"accepted",accept_method:v,time_ms:k>0?Date.now()-k:0,suggestion_length:x.length})}catch(C){console.error("[followup] onOutcome callback threw:",C)}u(b1),queueMicrotask(()=>{var C;try{y!=null&&y.skipOnAccept||(C=s())==null||C(x)}catch(T){console.error("[followup] onAccept callback threw:",T)}finally{c&&clearTimeout(c),c=setTimeout(()=>{a=!1},fbe)}})},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(y){console.error("[followup] onOutcome callback threw:",y)}u(b1)}},clear:()=>{d(),a=!1,u(b1)},cleanup:()=>{d(),a=!1}}}function PQ(e={}){const{enabled:t=!0,onAccept:n,onOutcome:s}=e,r=nT(),i=Ra().sessionId,[o,a]=h.useState(b1),c=h.useRef(n);c.current=n;const u=h.useRef(s);u.current=s;const d=h.useSyncExternalStore(r.subscribe,()=>r.getSnapshot().lastFollowupSuggestion,()=>r.getSnapshot().lastFollowupSuggestion),f=h.useSyncExternalStore(T1e,MB,MB),m=(f==null?void 0:f.sessionId)===i?f:d,p=h.useMemo(()=>mbe({enabled:t,onStateChange:a,getOnAccept:()=>c.current,getOnOutcome:()=>u.current}),[t]),{setSuggestion:g}=p;h.useEffect(()=>(t||p.clear(),()=>p.cleanup()),[p,t]);const b=h.useRef(void 0),v=h.useRef(i);h.useEffect(()=>{const k=v.current;v.current=i,k!==void 0&&i!==void 0&&k!==i&&(p.clear(),nS(),b.current=void 0)},[p,i]),h.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 y=h.useCallback(()=>{p.clear(),M8(r),nS(),b.current=void 0},[p,r]),w=h.useCallback((k,C)=>{p.accept(k,C),M8(r),nS(),b.current=void 0},[p,r]),x=h.useCallback(()=>{p.dismiss(),M8(r),nS(),b.current=void 0},[p,r]);return h.useMemo(()=>({followupState:o,onAcceptFollowup:w,onDismissFollowup:x,clear:y}),[o,w,x,y])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function pbe(){const e=h.useSyncExternalStore(A1e,IB,IB),t=h.useCallback(n=>M1e(n),[]);return{batches:e,consume:t}}const BB=[];function gbe(e,t){return e===t?!1:e.length!==t.length?!0:e.some((n,s)=>!Object.is(n,t[s]))}class df extends h.Component{constructor(){super(...arguments);qe(this,"state",{error:null,resetKeys:this.props.resetKeys??BB});qe(this,"reset",()=>{this.setState({error:null})})}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,s){const r=n.resetKeys??BB;return gbe(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 zB={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:"重试"}},bbe={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},ybe={margin:0,fontSize:"1rem",fontWeight:600},wbe={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},vbe={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 xbe({error:e,onRetry:t,language:n="en"}){const s=zB[n]??zB.en;return l.jsxs("div",{role:"alert",style:bbe,"data-web-shell-error":!0,children:[l.jsx("p",{style:ybe,children:s.title}),l.jsx("p",{style:wbe,children:s.body}),!1,l.jsx("button",{type:"button",style:vbe,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 LQ=(...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 kbe=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 _be=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 FB=e=>{const t=_be(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 I8={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 Sbe=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},Cbe=h.createContext({}),Tbe=()=>h.useContext(Cbe),Ebe=h.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:f=!1,color:m="currentColor",className:p=""}=Tbe()??{},g=s??f?Number(n??d)*24/Number(t??u):n??d;return h.createElement("svg",{ref:c,...I8,width:t??u??I8.width,height:t??u??I8.height,stroke:e??m,strokeWidth:g,className:LQ("lucide",p,r),...!i&&!Sbe(a)&&{"aria-hidden":"true"},...a},[...o.map(([b,v])=>h.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 sn=(e,t)=>{const n=h.forwardRef(({className:s,...r},i)=>h.createElement(Ebe,{ref:i,iconNode:t,className:LQ(`lucide-${kbe(FB(e))}`,`lucide-${e}`,s),...r}));return n.displayName=FB(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 jbe=[["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"}]],Abe=sn("activity",jbe);/**
 * @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 Nbe=[["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"}]],Mbe=sn("archive-restore",Nbe);/**
 * @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 Ibe=[["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"}]],sS=sn("archive",Ibe);/**
 * @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 Rbe=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],Dbe=sn("arrow-down-to-line",Rbe);/**
 * @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 Pbe=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ik=sn("arrow-left",Pbe);/**
 * @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 Lbe=[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]],Obe=sn("arrow-up-from-line",Lbe);/**
 * @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 $be=[["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"}]],Bbe=sn("blocks",$be);/**
 * @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 zbe=[["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"}]],gv=sn("bot",zbe);/**
 * @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 Fbe=[["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"}]],Hbe=sn("box",Fbe);/**
 * @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 qbe=[["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"}]],Ube=sn("calendar-clock",qbe);/**
 * @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 Wbe=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],dg=sn("check",Wbe);/**
 * @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 Vbe=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],gc=sn("chevron-down",Vbe);/**
 * @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 Gbe=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ok=sn("chevron-right",Gbe);/**
 * @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 Kbe=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ybe=sn("chevron-up",Kbe);/**
 * @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 Xbe=[["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"}]],ja=sn("circle-alert",Xbe);/**
 * @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 Qbe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],AI=sn("circle-check",Qbe);/**
 * @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 Jbe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],OQ=sn("circle-dot",Jbe);/**
 * @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 Zbe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],eye=sn("circle-minus",Zbe);/**
 * @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 tye=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],nye=sn("circle-x",tye);/**
 * @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 sye=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],rye=sn("clock",sye);/**
 * @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 iye=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],oye=sn("columns-2",iye);/**
 * @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 aye=[["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"}]],lye=sn("command",aye);/**
 * @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 cye=[["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"}]],uye=sn("copy",cye);/**
 * @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 dye=[["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"}]],kA=sn("database",dye);/**
 * @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 hye=[["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"}]],R8=sn("download",hye);/**
 * @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 fye=[["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"}]],fm=sn("ellipsis-vertical",fye);/**
 * @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 mye=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],pye=sn("eye",mye);/**
 * @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 gye=[["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:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]],bye=sn("file-diff",gye);/**
 * @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 yye=[["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"}]],wye=sn("file-text",yye);/**
 * @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 vye=[["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"}]],xye=sn("flask-conical",vye);/**
 * @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 kye=[["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"}]],oC=sn("folder-closed",kye);/**
 * @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 _ye=[["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"}]],Sye=sn("folder-input",_ye);/**
 * @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 Cye=[["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"}]],$Q=sn("folder-open",Cye);/**
 * @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 Tye=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["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"}]],Eye=sn("folder-plus",Tye);/**
 * @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 jye=[["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"}]],Aye=sn("folder-x",jye);/**
 * @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 Nye=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],aC=sn("git-branch",Nye);/**
 * @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 Mye=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],Iye=sn("git-commit-horizontal",Mye);/**
 * @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 Rye=[["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"}]],lC=sn("git-fork",Rye);/**
 * @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 Dye=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M18 6V5",key:"1oao2s"}],["path",{d:"M18 11v-1",key:"11c8tz"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]],Pye=sn("git-pull-request-draft",Dye);/**
 * @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 Lye=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]],Oye=sn("git-pull-request",Lye);/**
 * @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 $ye=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],cC=sn("info",$ye);/**
 * @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 Bye=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],HB=sn("key-round",Bye);/**
 * @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 zye=[["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"}]],Fye=sn("layers",zye);/**
 * @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 Hye=[["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"}]],qye=sn("layout-grid",Hye);/**
 * @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 Uye=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],J1=sn("loader-circle",Uye);/**
 * @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 Wye=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Vye=sn("lock",Wye);/**
 * @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 Gye=[["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"}]],BQ=sn("maximize-2",Gye);/**
 * @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 Kye=[["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"}]],zQ=sn("minimize-2",Kye);/**
 * @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 Yye=[["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"}]],Xye=sn("moon",Yye);/**
 * @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 Qye=[["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"}]],qB=sn("package",Qye);/**
 * @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 Jye=[["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"}]],Zye=sn("palette",Jye);/**
 * @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 ewe=[["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"}]],twe=sn("panel-left-close",ewe);/**
 * @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 nwe=[["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"}]],swe=sn("panel-left-open",nwe);/**
 * @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 rwe=[["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"}]],Sb=sn("pencil",rwe);/**
 * @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 iwe=[["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"}]],UB=sn("pin",iwe);/**
 * @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 owe=[["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"}]],awe=sn("play",owe);/**
 * @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 lwe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],z0=sn("plus",lwe);/**
 * @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 cwe=[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]],FQ=sn("radio-tower",cwe);/**
 * @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 uwe=[["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"}]],ak=sn("refresh-cw",uwe);/**
 * @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 dwe=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],hwe=sn("rotate-cw",dwe);/**
 * @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 fwe=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Pc=sn("search",fwe);/**
 * @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 mwe=[["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"}]],Z1=sn("server",mwe);/**
 * @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 pwe=[["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"}]],HQ=sn("settings-2",pwe);/**
 * @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 gwe=[["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"}]],bwe=sn("settings",gwe);/**
 * @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 ywe=[["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"}]],wwe=sn("shield",ywe);/**
 * @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 vwe=[["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"}]],xwe=sn("sliders-horizontal",vwe);/**
 * @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 kwe=[["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"}]],eb=sn("sparkles",kwe);/**
 * @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 _we=[["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"}]],WB=sn("square-pen",_we);/**
 * @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 Swe=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Cwe=sn("star",Swe);/**
 * @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 Twe=[["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"}]],Ewe=sn("sun",Twe);/**
 * @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 jwe=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],VB=sn("tag",jwe);/**
 * @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 Awe=[["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"}]],Nwe=sn("target",Awe);/**
 * @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 Mwe=[["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"}]],mm=sn("trash-2",Mwe);/**
 * @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 Iwe=[["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"}]],Rwe=sn("triangle-alert",Iwe);/**
 * @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 Dwe=[["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"}]],Pwe=sn("upload",Dwe);/**
 * @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 Lwe=[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],Owe=sn("users-round",Lwe);/**
 * @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 $we=[["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"}]],GB=sn("wifi-off",$we);/**
 * @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 Bwe=[["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"}]],_A=sn("wrench",Bwe);/**
 * @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 zwe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ey=sn("x",zwe);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Dh=1e3,NI="session_organization",qQ="session_transcript_pagination",Fwe="session_monitor_tool_correlation",uC="default",UQ=100,Hwe=500,WQ=5e4;function SA(e){for(const t of e){if(!qwe(t))continue;const n=t;if(n.resolved)continue;const s=L1(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=L1(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:Wwe(c.raw)})),rawInput:Uwe(n.toolCall)}}return null}function qwe(e){return e.kind==="permission"}function Uwe(e){const t=L1(e);return t?L1(t.rawInput)??L1(t.input)??L1(t.args)??t:void 0}function L1(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Wwe(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 Vwe(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 Yg(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 KB(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Gwe=(e,t)=>Math.abs(e-t)<1.01,Kwe=(e,t,n)=>{let s;return function(...r){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,r),n)}};let lw;const D8=()=>{if(lw!==void 0)return lw;if(typeof navigator>"u")return lw=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return lw=!0;const e=navigator.maxTouchPoints;return lw=navigator.platform==="MacIntel"&&e!==void 0&&e>0},YB=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Ywe=e=>e,Xwe=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},Qwe=(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(YB(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(YB(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},dC={passive:!0},Jwe=typeof window>"u"?!0:"onscrollend"in window,Zwe=(e,t,n)=>{const s=e.scrollElement;if(!s)return;const r=e.targetWindow;if(!r)return;const i=e.options.useScrollendEvent&&Jwe;let o=0;const a=i?null:Kwe(r,()=>t(o,!1),e.options.isScrollingResetDelay),c=f=>()=>{o=n(s),a==null||a(),t(o,f)},u=c(!0),d=c(!1);return s.addEventListener("scroll",u,dC),i&&s.addEventListener("scrollend",d,dC),()=>{s.removeEventListener("scroll",u),i&&s.removeEventListener("scrollend",d)}},eve=(e,t)=>Zwe(e,t,n=>{const{horizontal:s,isRtl:r}=e.options;return s?n.scrollLeft*(r&&-1||1):n.scrollTop}),tve=(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"]},nve=(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})},sve=nve;class rve{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:Ywe,rangeExtractor:Xwe,onChange:()=>{},measureElement:tve,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 x=m>0?this.getVirtualItemForOffset(this.getScrollOffset())??g[0]:null;x&&(a=[x.key,this.getScrollOffset()-x.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,f=0;if(a&&this.scrollOffset!==null){const[m,p]=a,g=this.getMeasurements(),{count:b,getItemKey:v}=this.options;let y=0;for(;y<b&&v(y)!==m;)y++;if(y<b){const w=g[y];if(w){const x=w.start+p;x!==this.scrollOffset&&(f=x-this.scrollOffset,this.scrollOffset=x,d=!0)}}}(d||c)&&(this.pendingScrollAnchor=[d?a[0]:null,d?a[1]:0,c,f])},this.notify=n=>{var s,r;(r=(s=this.options).onChange)==null||r.call(s,this,n)},this.maybeNotify=Yg(()=>(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,!(!D8()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",o,dC),i.addEventListener("touchend",a,dC),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&&(D8()&&(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=Yg(()=>[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=Yg(()=>[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 f=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 x=new Float64Array(b);v&&f>0&&x.set(v.subarray(0,f*2)),v=x,this._flatMeasurements=v}let y;if(f===0)y=s+r;else{const x=f-1;y=v[x*2]+v[x*2+1]+g}for(let x=f;x<n;x++){const k=i(x),C=d.get(k),T=typeof C=="number"?C:this.options.estimateSize(x);v[x*2]=y,v[x*2+1]=T,y+=T+g}const w=Vwe(n,v,i);return this.measurementsCache=w,w}const m=this.measurementsCache.slice(0,f),p=new Array(a).fill(void 0);for(let g=0;g<f;g++){const b=m[g];b&&(p[b.lane]=g)}for(let g=f;g<n;g++){const b=i(g),v=this.laneAssignments.get(g);let y,w;const x=c==="estimate"||d.has(b);if(v!==void 0&&this.options.lanes>1){y=v;const _=p[y],S=_!==void 0?m[_]:void 0;w=S?S.end+this.options.gap:s+r}else{const _=this.options.lanes===1?m[g-1]:this.getFurthestMeasurement(m,g);w=_?_.end+this.options.gap:s+r,y=_?_.lane:g%this.options.lanes,this.options.lanes>1&&x&&this.laneAssignments.set(g,y)}const k=d.get(b),C=typeof k=="number"?k:this.options.estimateSize(g),T=w+C;m[g]={index:g,start:w,size:C,end:T,key:b,lane:y},p[y]=g}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Yg(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,r,i)=>this.range=n.length>0&&s>0?ive({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=Yg(()=>{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,f=s-d;if(f!==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},f,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(f),this.notify(!1)}},this.getVirtualItems=Yg(()=>[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=VQ(0,s.length-1,i?a=>r[a*2]:a=>KB(s[a]).start,n);return KB(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&&(D8()&&(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&&Gwe(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 VQ=(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 ive({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=VQ(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 f=Array(s).fill(n+t);for(;c>=0&&f.some(m=>m>=n);){const m=e[c];f[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 P8=typeof document<"u"?h.useLayoutEffect:h.useEffect;function ove({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...s}){const r=h.useReducer(u=>u+1,0)[1],i=h.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 f=u.getTotalSize();if(d.container&&f!==d.lastSize){d.lastSize=f;const y=u.options.horizontal?"width":"height";d.container.style[y]=`${f}px`}const m=!!u.options.horizontal,p=d.mode==="transform",g=m?"left":"top",b=u.options.scrollMargin,v=u.getVirtualItems();for(const y of v){const w=y.start-b,x=u.elementsCache.get(y.key);x&&d.lastPositions.get(x)!==w&&(d.lastPositions.set(x,w),p?x.style.transform=m?`translate3d(${w}px, 0, 0)`:`translate3d(0, ${w}px, 0)`:x.style[g]=`${w}px`)}},a={...s,onChange:(u,d)=>{var f;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?Wu.flushSync(r):r()),(f=s.onChange)==null||f.call(s,u,d)}},[c]=h.useState(()=>{const u=new rve(a);return Object.assign(u,{containerRef:d=>{const f=i.current;if(f.container=d,f.lastSize=null,d&&f.enabled){const m=u.getTotalSize();f.lastSize=m;const p=u.options.horizontal?"width":"height";d.style[p]=`${m}px`}}})});return c.setOptions(a),P8(()=>c._didMount(),[]),P8(()=>c._willUpdate()),P8(()=>{o(c)}),c}function ave(e){return ove({observeElementRect:Qwe,observeElementOffset:eve,scrollToFn:sve,...e})}function GQ(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function lve(e){var t;return((t=GQ(e))==null?void 0:t.type)==="task_execution"}function ty(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||lve(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function hf(e){if(!ty(e))return!1;const t=GQ(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 KQ=h.createContext({}),XB=KQ.Provider;function ku(){return h.useContext(KQ)}const cve=["en","zh-CN"],MI={"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`,"branchPicker.label":"Git","branchPicker.search":"Search for branches and actions","branchPicker.loading":"Loading branches…","branchPicker.noBranches":"No branches","branchPicker.noTags":"No tags","branchPicker.action.pull":"Update Project","branchPicker.action.push":"Push","branchPicker.action.commit":"Commit","branchPicker.action.newBranch":"New Branch…","branchPicker.action.checkoutRef":"Checkout Tag or Revision…","branchPicker.action.viewChanges":"View Changes","branchPicker.newBranchPlaceholder":"Branch name","branchPicker.invalidBranchName":"Invalid branch name — avoid spaces, ~, ^, :, ? * and leading -","branchPicker.checkoutRefPlaceholder":"Tag name or commit SHA","branchPicker.section.recent":"Recent","branchPicker.section.local":"Local","branchPicker.section.remote":"Remote","branchPicker.section.tags":"Tags","branchPicker.checkedOut":e=>`Checked out ${(e==null?void 0:e.branch)??""}`,"branchPicker.createdBranch":e=>`Created branch ${(e==null?void 0:e.branch)??""}`,"branchPicker.pushSuccess":"Pushed successfully","branchPicker.pullSuccess":"Updated successfully","gitCommit.title":"Commit","gitCommit.messagePlaceholder":"Commit message (⌘/Ctrl+Enter to commit)","gitCommit.generating":"Generating commit message…","gitCommit.genFailed":"Auto-generation failed — write your message","gitCommit.prLogUnavailable":"Could not load commits for the selected base branch.","gitCommit.prPushFirst":"Push your branch to a remote before creating a pull request.","gitCommit.commit":"Commit","gitCommit.commitAndPush":"Commit and Push","gitCommit.createPr":"Create Pull Request","gitCommit.prTitlePlaceholder":"Pull request title","gitCommit.prBodyPlaceholder":"Description (optional)","gitCommit.prEdit":"Edit","gitCommit.prPreview":"Preview","gitCommit.prSubmit":"Create","gitCommit.prCreated":e=>`Pull Request #${(e==null?void 0:e.number)??""} created`,"gitCommit.commitSuccess":e=>`Committed ${(e==null?void 0:e.sha)??""}`,"gitCommit.commitPushSuccess":e=>`Committed & pushed ${(e==null?void 0:e.sha)??""}`,"gitCommit.commitSuccessPushFailed":e=>`Committed ${(e==null?void 0:e.sha)??""} — push failed: ${(e==null?void 0:e.error)??"unknown"}`,"branchSelect.baseBranch":"Base branch","branchSelect.search":"Search branches…","branchSelect.loading":"Loading…","branchSelect.noMatches":"No matches","branchSelect.error":"Failed to load branches","branchSelect.retry":"Retry","branchSelect.local":"local","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"}`,"gitMode.title":"Git mode","gitMode.current":"Current branch","gitMode.currentDesc":e=>`Develop directly on ${(e==null?void 0:e.branch)??"main"}`,"gitMode.branch":"New branch","gitMode.branchDesc":e=>`Create a new branch from ${(e==null?void 0:e.branch)??"main"}`,"gitMode.branchPlaceholder":"feat/my-feature","gitMode.branchLabel":"Branch name","gitMode.branchConflictWarning":"Only one branch session per workspace at a time","gitMode.branchHint":"Switches the working directory to a new branch","gitMode.branchInvalidName":"Invalid branch name","gitMode.worktree":"Worktree","gitMode.worktreeDesc":"Isolated copy · can run in parallel","gitMode.confirmBranch":"Create branch","gitMode.confirmWorktree":"Create worktree","gitMode.resetToCurrent":"Reset to current branch","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)??""}`,"githubPrs.title":"Pull requests","githubPrs.subtitle":e=>`${(e==null?void 0:e.count)??0} open`,"githubPrs.loading":"Loading pull requests…","githubPrs.empty":"No open pull requests","githubPrs.unavailable":"This workspace is not a git repository","githubPrs.error":"Failed to load pull requests","githubPrs.cliUnavailable":"The GitHub CLI (gh) is not installed on the daemon host.\nInstall it and run `gh auth login`, then try again.","githubPrs.reviewApproved":"Approved","githubPrs.reviewChanges":"Changes requested","githubPrs.reviewRequired":"Review required","githubPrs.checksPassing":"Checks passing","githubPrs.checksFailing":"Checks failing","githubPrs.checksPending":"Checks pending","githubPrs.open":e=>`Open pull request #${(e==null?void 0:e.number)??""} on GitHub`,"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 requirements","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.generate":"Generate","agent.create.generatedDescription":"Description","agent.create.generatedSystemPrompt":"System prompt","agent.create.generatingConfig":"Generating subagent configuration...","agent.create.generatingPrompt":"Generating...","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 the description and system prompt","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":"Workspace","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":"Explain the responsibilities, usage scenarios, and important constraints, then generate each field separately.","agent.create.qwenPlaceholder":"> e.g., Expert code reviewer that reviews code based on best practices...","agent.create.regenerate":"Regenerate draft","agent.create.required":"Name, description, and system prompt are required.","agent.create.tools":"Allowed tools","agent.create.toolsHelp":"Enter canonical tool names separated by commas or lines. MCP tools use mcp__server__tool; leave blank to inherit all tools.","agent.create.disallowedTools":"Disallowed tools","agent.create.model":"Model","agent.create.approvalMode":"Approval mode","agent.create.maxTurns":"Maximum execution turns","agent.create.maxTurnsHelp":"Limits the model reasoning rounds for a single task. Execution stops at the limit; leave blank for no agent-specific limit.","agent.create.maxTurnsInvalid":"Maximum execution turns must be a positive integer.","agent.create.mcpServers":"MCP servers","agent.create.mcpServers.empty":"No MCP servers are available.","agent.create.mcpServers.select":"Select an MCP Server","agent.create.mcpServers.noneSelected":"No MCP Servers selected.","agent.create.modelGenerate":"Generate with model","agent.create.modelGenerate.description":"Describe what you need, then generate and review the description and system prompt separately.","agent.create.color":"Color","agent.create.jsonObjectHelp":"Enter a JSON object, or leave blank.","agent.create.save":"Save Agent","agent.create.scope":"Category","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.tools.builtin":"Built-in tools","agent.create.tools.empty":"No tools are available.","agent.create.tools.mcp":"MCP tools","agent.create.tools.type":"Tool type","agent.create.tools.selectServer":"Select an MCP Server","agent.create.tools.selectTool":"Select a tool","agent.create.tools.noneSelected":"No tools selected.","agent.create.tools.initializing":"Initializing tool catalogs...","agent.create.tools.preheatFailed":"ACP preheating did not complete.","agent.create.tools.loadFailed":"Failed to load built-in tools.","agent.create.removeSelection":e=>`Remove ${(e==null?void 0:e.name)??""}`,"agent.create.toolsSelectHelp":"Select the tools this subagent may use. Leave all unchecked to inherit all tools.","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":"Global","agent.create.user.desc":"Create a user-level subagent","agent.create.useGenerated":"Use this draft","agent.approval.inherit":"Default","agent.approval.default":"Default approval","agent.approval.plan":"Plan only","agent.approval.auto-edit":"Automatically approve edits","agent.approval.yolo":"Automatically approve all actions","agent.approval.bubble":"Bubble approval","agent.approval.desc.inherit":"Use the subagent's default approval rules.","agent.approval.desc.bubble":"Forward tool approval requests to the parent session.","agent.createFirstHint":"Use '/agents create' to create your first subagent.","agent.created":e=>`Created ${(e==null?void 0:e.name)??""}`,"agent.edit.save":"Save changes","agent.updated":e=>`Updated ${(e==null?void 0:e.name)??""}`,"agent.turnsBadge":e=>`${(e==null?void 0:e.count)??0} turns`,"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.level.filter":"Filter by agent level","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.level.label":"Level","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.mcp":"MCP","agent.detail.hooks":"Hooks","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","subagent.background":"background task","subagent.completed":"completed","subagent.failed":"failed","subagent.cancelled":"cancelled","subagent.paused":"paused","subagent.detailsLoading":"Loading agent details…","subagent.detailsLoadFailed":"Failed to load agent details.","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.add":"add","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.","history.paginationError":"Earlier history could not be loaded.","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","editor.btwSuggestionTitle":"This looks like a side question","editor.btwSuggestionSend":"Ask with BTW","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.preview":"Preview","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.channels":"Channels","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.newWorkspace":"New workspace","sidebar.startFromScratch":"Start from scratch","sidebar.useExistingFolder":"Use an existing folder…","sidebar.scratchOutcomeUnknownTitle":"Check workspace creation","sidebar.scratchOutcomeUnknown":"The daemon response was interrupted. Check the refreshed workspace list before creating another workspace.","sidebar.scratchOutcomeRefresh":"Refresh workspace list","sidebar.scratchOutcomeAcknowledge":"I checked the workspace list","sidebar.addWorkspaceTitle":"Add Workspace","sidebar.addWorkspacePath":"Directory path","sidebar.addWorkspaceBrowse":"Browse…","sidebar.addWorkspaceBrowseError":"Unable to open the system folder picker. Enter an absolute path instead.","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.addWorkspaceBusyError":"Another workspace operation is in progress","sidebar.addWorkspacePersistenceError":"The daemon did not confirm persistent workspace registration","sidebar.addWorkspaceRefreshError":"Workspace added, but the workspace list could not be refreshed","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.shellQueued":"Shell command queued — it will run after the current turn finishes.","queue.shellDropped":e=>{const t=(e==null?void 0:e.count)??0;return t===1?"1 queued shell command will not run.":`${t} queued shell commands will not run.`},"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.","system.taskNotification":"Task notification","system.taskCompleted":"Background task completed","system.taskFailed":"Background task failed","system.taskCancelled":"Background task cancelled","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.","localCommand.prsNoWorkspace":"No workspace is available yet to show pull requests for.","localCommand.prsUnsupported":"This daemon does not support listing pull requests.","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.prs":"Show open GitHub pull requests 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.setting.disabled":"Disabled","extensions.manage.setting.default":"Default","extensions.manage.setting.enabled":"Enabled","extensions.manage.setting.unknown":"Unavailable","extensions.manage.setting.unavailableDescription":"The service did not return scoped extension settings. Restart qwen serve and try again.","extensions.manage.userSetting":"Global setting","extensions.manage.userSettingDescription":"Applies to your workspaces unless a workspace setting overrides it.","extensions.manage.workspaceSetting":"Workspace setting","extensions.manage.workspaceSettingDescription":"Applies only to the current workspace.","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.inherited":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" now uses the global setting.`,"extensions.manage.inheriting":e=>`Resetting extension "${(e==null?void 0:e.name)??"extension"}" to the global setting…`,"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.eventCount":"Events","tasks.detail.pid":"PID","tasks.detail.lastEvent":"Last event","tasks.detail.droppedCount":"Dropped","tasks.detail.exitCode":"Exit code","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","channels.title":"Channels","channels.summary":e=>`${(e==null?void 0:e.workspace)??""} · ${(e==null?void 0:e.count)??0} configured`,"channels.workspace.current":"Current workspace","channels.loading":"Loading channels","channels.configured":"Configured channels","channels.availablePlatforms":"Available platforms","channels.availablePlatforms.description":"Channel management is currently available for these platforms only.","channels.platform.available":"Available","channels.platform.configure":"Configure","channels.platform.configureNamed":e=>`Configure ${(e==null?void 0:e.platform)??"Channel"}`,"channels.status.stopped":"Stopped","channels.status.starting":"Starting","channels.status.connected":"Connected","channels.status.partial":"Partially connected","channels.status.error":"Error","channels.startsWithServe":"Start with serve","channels.unsupported.title":"Channel management is not supported","channels.unsupported.description":"Update Qwen Code to a version that supports Channel management.","channels.readOnly.title":"Channel management is read-only","channels.readOnly.description":"Restart Qwen Code with a bearer token to control channels.","channels.loadError.title":"Channels could not be loaded","channels.empty.title":"No supported channels configured","channels.empty.description":"Configure DingTalk, WeCom, or Feishu to receive messages in this workspace.","channels.runtimeError":"Channel runtime error","channels.action.back":"Back","channels.action.start":"Start","channels.action.stop":"Stop","channels.action.restart":"Restart","channels.action.retry":"Retry","channels.action.edit":"Edit","channels.action.editNamed":e=>`Edit ${(e==null?void 0:e.name)??"Channel"}`,"channels.action.delete":"Delete","channels.action.deleteNamed":e=>`Delete ${(e==null?void 0:e.name)??"Channel"}`,"channels.action.startWithServeNamed":e=>`Start ${(e==null?void 0:e.name)??""} with serve`,"channels.delete.title":e=>`Delete ${(e==null?void 0:e.name)??"Channel"}?`,"channels.delete.description":"The Channel will be stopped and removed from this workspace. This action cannot be undone.","channels.delete.error":"Channel was not deleted","channels.editor.addTitle":e=>`Configure ${(e==null?void 0:e.platform)??"Channel"}`,"channels.editor.editTitle":e=>`Edit ${(e==null?void 0:e.platform)??"Channel"}`,"channels.editor.addDescription":"Connect this workspace with an existing platform application.","channels.editor.editDescription":"Update public settings or explicitly change stored credentials.","channels.editor.section.identity":"Identity","channels.editor.section.credentials":"Credentials","channels.editor.section.access":"Access policy","channels.editor.instanceName":"Instance name","channels.editor.instanceNamePlaceholder":"e.g. release-bot","channels.editor.environmentReference":"$ENV_VAR supported","channels.editor.field.dingtalk.clientId":"Client ID (AppKey)","channels.editor.field.dingtalk.clientSecret":"Client Secret (AppSecret)","channels.editor.field.wecom.botId":"Bot ID","channels.editor.field.wecom.secret":"Bot Secret","channels.editor.field.wecom.wsUrl":"WebSocket URL","channels.editor.field.feishu.clientId":"App ID","channels.editor.field.feishu.clientSecret":"App Secret","channels.editor.secret.environment":"Stored in environment","channels.editor.secret.stored":"Stored securely","channels.editor.secret.preserve":"Keep","channels.editor.secret.replace":"Replace","channels.editor.secret.clear":"Clear","channels.editor.secret.placeholder":e=>`Enter ${(e==null?void 0:e.label)??"secret"}`,"channels.editor.secret.clearHint":"This credential will be removed when you save.","channels.editor.policy.pairing.title":"Pairing","channels.editor.policy.pairing.description":"People receive a pairing code and can chat after you approve them.","channels.editor.pairing.title":"Pending requests","channels.editor.pairing.description":"Match the code shared by the person before approving access.","channels.editor.pairing.refresh":"Refresh pairing requests","channels.editor.pairing.approve":"Approve","channels.editor.pairing.approved":e=>`${(e==null?void 0:e.sender)??"This person"} can now use this Channel.`,"channels.editor.pairing.error":"Pairing requests were not updated","channels.editor.pairing.retry":"Try again","channels.editor.pairing.empty.title":"No pending requests","channels.editor.pairing.empty.description":"New requests appear here after someone messages the bot.","channels.editor.pairing.saveFirst.title":"Save pairing mode first","channels.editor.pairing.saveFirst.description":"Pending requests will appear here after this Channel is saved in pairing mode.","channels.editor.policy.open.title":"Open","channels.editor.policy.open.description":"Anyone who can reach the bot can start a conversation.","channels.editor.validation.required":e=>`${(e==null?void 0:e.label)??"This field"} is required.`,"channels.editor.validation.duplicate":"A Channel with this name already exists.","channels.editor.validation.invalidName":"Choose a different instance name.","channels.editor.validation.number":"Enter a valid number.","channels.editor.validation.policy":"Choose an access policy.","channels.editor.saveError":"Changes were not saved","channels.editor.reloadLatest":"Reload latest","channels.editor.cancel":"Cancel","channels.editor.save":"Save","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:"},uve={...MI,"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`,"branchPicker.label":"Git","branchPicker.search":"搜索分支和操作","branchPicker.loading":"加载分支中…","branchPicker.noBranches":"无分支","branchPicker.noTags":"无标签","branchPicker.action.pull":"更新项目","branchPicker.action.push":"推送","branchPicker.action.commit":"提交","branchPicker.action.newBranch":"新建分支…","branchPicker.action.checkoutRef":"检出标签或修订…","branchPicker.action.viewChanges":"查看变更","branchPicker.newBranchPlaceholder":"分支名称","branchPicker.invalidBranchName":"无效的分支名称 — 避免空格、~、^、:、? * 以及以 - 开头","branchPicker.checkoutRefPlaceholder":"标签名或提交 SHA","branchPicker.section.recent":"最近","branchPicker.section.local":"本地","branchPicker.section.remote":"远程","branchPicker.section.tags":"标签","branchPicker.checkedOut":e=>`已检出 ${(e==null?void 0:e.branch)??""}`,"branchPicker.createdBranch":e=>`已创建分支 ${(e==null?void 0:e.branch)??""}`,"branchPicker.pushSuccess":"推送成功","branchPicker.pullSuccess":"更新成功","gitCommit.title":"提交","gitCommit.messagePlaceholder":"提交信息（⌘/Ctrl+Enter 提交）","gitCommit.generating":"正在生成提交信息…","gitCommit.genFailed":"自动生成失败 — 请手动输入提交信息","gitCommit.prLogUnavailable":"无法加载所选目标分支的提交记录。","gitCommit.prPushFirst":"请先将分支推送到远程仓库，再创建合并请求。","gitCommit.commit":"提交","gitCommit.commitAndPush":"提交并推送","gitCommit.createPr":"创建合并请求","gitCommit.prTitlePlaceholder":"合并请求标题","gitCommit.prBodyPlaceholder":"描述（可选）","gitCommit.prEdit":"编辑","gitCommit.prPreview":"预览","gitCommit.prSubmit":"创建","gitCommit.prCreated":e=>`合并请求 #${(e==null?void 0:e.number)??""} 已创建`,"gitCommit.commitSuccess":e=>`已提交 ${(e==null?void 0:e.sha)??""}`,"gitCommit.commitPushSuccess":e=>`已提交并推送 ${(e==null?void 0:e.sha)??""}`,"gitCommit.commitSuccessPushFailed":e=>`已提交 ${(e==null?void 0:e.sha)??""} — 推送失败：${(e==null?void 0:e.error)??"未知错误"}`,"branchSelect.baseBranch":"目标分支","branchSelect.search":"搜索分支…","branchSelect.loading":"加载中…","branchSelect.noMatches":"无匹配","branchSelect.error":"分支加载失败","branchSelect.retry":"重试","branchSelect.local":"本地","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)??"文件"} 的变更`,"gitMode.title":"Git 模式","gitMode.current":"当前分支","gitMode.currentDesc":e=>`直接在 ${(e==null?void 0:e.branch)??"main"} 上开发`,"gitMode.branch":"新建分支","gitMode.branchDesc":e=>`从 ${(e==null?void 0:e.branch)??"main"} 创建新分支`,"gitMode.branchPlaceholder":"feat/my-feature","gitMode.branchLabel":"分支名","gitMode.branchConflictWarning":"同一 workspace 同时只能有一个分支会话","gitMode.branchHint":"在工作目录中切换到新分支","gitMode.branchInvalidName":"分支名不合法","gitMode.worktree":"Worktree 隔离","gitMode.worktreeDesc":"独立副本 · 可并行","gitMode.confirmBranch":"创建分支","gitMode.confirmWorktree":"创建 Worktree","gitMode.resetToCurrent":"恢复当前分支","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)??""}`,"githubPrs.title":"拉取请求","githubPrs.subtitle":e=>`${(e==null?void 0:e.count)??0} 个开放`,"githubPrs.loading":"加载拉取请求中…","githubPrs.empty":"没有开放的拉取请求","githubPrs.unavailable":"当前工作区不是 git 仓库","githubPrs.error":"加载拉取请求失败","githubPrs.cliUnavailable":"daemon 所在主机未安装 GitHub CLI(gh)。\n请先安装并运行 `gh auth login`,然后重试。","githubPrs.reviewApproved":"已批准","githubPrs.reviewChanges":"要求修改","githubPrs.reviewRequired":"需要审查","githubPrs.checksPassing":"检查通过","githubPrs.checksFailing":"检查失败","githubPrs.checksPending":"检查进行中","githubPrs.open":e=>`在 GitHub 上打开拉取请求 #${(e==null?void 0:e.number)??""}`,"workspace.paneLabel":e=>`工作区：${(e==null?void 0:e.name)??""}`,"toolName.edit":"编辑","toolName.write_file":"写入文件","toolName.read_file":"读取文件","toolName.zoom_image":"图片放大","toolName.grep":"搜索内容","toolName.grep_search":"搜索内容","toolName.glob":"Glob","toolName.run_shell_command":"运行命令","toolName.todo_write":"任务清单","toolName.get_goal":"目标","toolName.update_goal":"更新目标","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.list_agents":"列出 Agent","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.image_gen":"生成图片","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.generate":"生成","agent.create.generatedDescription":"描述","agent.create.generatedSystemPrompt":"系统提示词","agent.create.generatingConfig":"正在生成子智能体配置...","agent.create.generatingPrompt":"生成中...","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":"工作区","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.regenerate":"重新生成草稿","agent.create.required":"名称、描述和系统提示词均为必填项。","agent.create.tools":"允许的工具","agent.create.toolsHelp":"使用逗号或换行分隔 canonical 工具名称；MCP 工具使用 mcp__server__tool，留空表示继承全部工具。","agent.create.disallowedTools":"禁用的工具","agent.create.model":"模型","agent.create.approvalMode":"审批模式","agent.create.maxTurns":"最大执行轮次","agent.create.maxTurnsHelp":"限制智能体完成单次任务时的模型调用轮数，达到上限后将停止执行。留空表示不设置智能体层级的限制。","agent.create.maxTurnsInvalid":"最大执行轮次必须是正整数。","agent.create.mcpServers":"MCP Server","agent.create.mcpServers.empty":"暂无可用的 MCP Server。","agent.create.mcpServers.select":"选择 MCP Server","agent.create.mcpServers.noneSelected":"尚未选择 MCP Server。","agent.create.modelGenerate":"模型生成","agent.create.modelGenerate.description":"描述你的需求，然后分别生成并检查描述和系统提示词。","agent.create.color":"颜色","agent.create.jsonObjectHelp":"请输入 JSON 对象，或留空。","agent.create.save":"保存智能体","agent.create.scope":"类别","agent.create.manualDescHelp":"描述此子智能体应该在何时以及如何使用。","agent.create.manualDescPlaceholder":"例如：根据最佳实践和潜在 bug 审查代码。","agent.create.tools.builtin":"内置工具","agent.create.tools.empty":"暂无可用工具。","agent.create.tools.mcp":"MCP 工具","agent.create.tools.type":"工具类型","agent.create.tools.selectServer":"选择 MCP Server","agent.create.tools.selectTool":"选择工具","agent.create.tools.noneSelected":"尚未选择工具。","agent.create.tools.initializing":"正在初始化工具目录...","agent.create.tools.preheatFailed":"ACP 预热未完成。","agent.create.tools.loadFailed":"内置工具加载失败。","agent.create.removeSelection":e=>`移除 ${(e==null?void 0:e.name)??""}`,"agent.create.toolsSelectHelp":"选择此子智能体可以使用的工具；全部不选表示继承所有工具。","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":"全局","agent.create.user.desc":"创建用户级智能体","agent.create.useGenerated":"确认使用","agent.approval.inherit":"默认","agent.approval.default":"默认审批","agent.approval.plan":"仅规划","agent.approval.auto-edit":"自动批准编辑","agent.approval.yolo":"自动批准所有操作","agent.approval.bubble":"气泡审批","agent.approval.desc.inherit":"使用智能体默认的审批规则。","agent.approval.desc.bubble":"将工具审批请求转交给父会话处理。","agent.createFirstHint":"使用 '/agents create' 创建第一个智能体。","agent.created":e=>`已创建 ${(e==null?void 0:e.name)??""}`,"agent.edit.save":"保存修改","agent.updated":e=>`已更新 ${(e==null?void 0:e.name)??""}`,"agent.turnsBadge":e=>`${(e==null?void 0:e.count)??0} 轮`,"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.level.filter":"按智能体级别筛选","agent.manage":"管理","agent.manage.desc":"管理已有智能体","agent.modelLabel":"模型：","agent.overriddenBadge":"（已被项目级智能体覆盖）","agent.readonly":"该智能体是只读的。","agent.select":"请选择一个智能体。","agent.selectAction":"选择操作","agent.descriptionLabel":"描述：","agent.systemPromptLabel":"系统提示词：","agent.level.label":"级别","agent.step":e=>`步骤 ${(e==null?void 0:e.n)??""}`,"agent.tools":"工具","agent.toolsLabel":"工具：","agent.detail.overview":"基本信息","agent.detail.tools":"工具","agent.detail.mcp":"MCP","agent.detail.hooks":"Hooks","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":"运行中","subagent.background":"后台任务","subagent.completed":"已完成","subagent.failed":"失败","subagent.cancelled":"已取消","subagent.paused":"已暂停","subagent.detailsLoading":"正在加载子智能体详情…","subagent.detailsLoadFailed":"子智能体详情加载失败。","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.add":"添加","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":"已达到历史显示上限，更早消息仍保存在会话中。","history.paginationError":"无法加载更早的历史记录。","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":"在新会话发送","editor.btwSuggestionTitle":"这条消息看起来像顺带一问","editor.btwSuggestionSend":"用 BTW 提问","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.preview":"预览","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.channels":"频道","sidebar.project":"项目","sidebar.pinnedSessions":"置顶","sidebar.workspaceSelectLabel":"工作区","sidebar.details":"详情","sidebar.workspaceUntrusted":"未信任","sidebar.workspaceReadOnly":"只读","sidebar.workspaceTrustToOpen":"信任此工作区后才能打开会话。","sidebar.addWorkspace":"添加工作区","sidebar.newWorkspace":"新建工作区","sidebar.startFromScratch":"从空目录开始","sidebar.useExistingFolder":"使用已有目录…","sidebar.scratchOutcomeUnknownTitle":"确认工作区创建结果","sidebar.scratchOutcomeUnknown":"守护进程响应已中断。再次创建前，请检查刷新后的工作区列表。","sidebar.scratchOutcomeRefresh":"刷新工作区列表","sidebar.scratchOutcomeAcknowledge":"我已检查工作区列表","sidebar.addWorkspaceTitle":"添加工作区","sidebar.addWorkspacePath":"目录路径","sidebar.addWorkspaceBrowse":"浏览…","sidebar.addWorkspaceBrowseError":"无法打开系统文件夹选择器，请改为输入绝对路径。","sidebar.addWorkspaceDisplayName":"展示名称（可选）","sidebar.addWorkspaceDisplayNameHint":"用于 Web Shell 展示；目录路径仍是工作区身份。","sidebar.addWorkspaceRegister":"注册","sidebar.addWorkspaceCancel":"取消","sidebar.addWorkspaceError":"添加工作区失败","sidebar.addWorkspaceBusyError":"另一个工作区操作正在进行中","sidebar.addWorkspacePersistenceError":"守护进程未确认工作区已持久化注册","sidebar.addWorkspaceRefreshError":"工作区已添加，但无法刷新工作区列表","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.shellQueued":"Shell 命令已排队，将在当前回合结束后执行。","queue.shellDropped":e=>`${(e==null?void 0:e.count)??0} 条排队的 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":"没有可重试的失败请求。","system.taskNotification":"后台任务通知","system.taskCompleted":"后台任务执行完成","system.taskFailed":"后台任务执行失败","system.taskCancelled":"后台任务已取消","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":"当前还没有可用于查看历史的工作区。","localCommand.prsNoWorkspace":"当前还没有可用于查看拉取请求的工作区。","localCommand.prsUnsupported":"当前 daemon 不支持查看拉取请求。","local.agents":"管理智能体","local.bug":"提交错误报告","local.compress":"将上下文压缩为摘要","local.compressFast":"无需 AI 的快速上下文压缩","local.config":"通过点分路径键获取或设置配置项","local.diff":"显示工作区相对 HEAD 的改动统计","local.log":"显示工作区的提交历史","local.prs":"显示工作区开放的 GitHub 拉取请求","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.setting.disabled":"禁用","extensions.manage.setting.default":"默认","extensions.manage.setting.enabled":"启用","extensions.manage.setting.unknown":"状态不可用","extensions.manage.setting.unavailableDescription":"当前服务未返回扩展的全局和工作区设置，请重启 qwen serve 后重试。","extensions.manage.userSetting":"全局设置","extensions.manage.userSettingDescription":"适用于用户工作区，工作区设置可单独覆盖。","extensions.manage.workspaceSetting":"工作区设置","extensions.manage.workspaceSettingDescription":"仅适用于当前工作区。","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.inherited":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已恢复为全局设置。`,"extensions.manage.inheriting":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.eventCount":"事件数","tasks.detail.pid":"PID","tasks.detail.lastEvent":"最近事件","tasks.detail.droppedCount":"丢弃行数","tasks.detail.exitCode":"退出码","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":"设置","channels.title":"频道","channels.summary":e=>`${(e==null?void 0:e.workspace)??""} · 已配置 ${(e==null?void 0:e.count)??0} 个`,"channels.workspace.current":"当前工作区","channels.loading":"正在加载频道","channels.configured":"已配置频道","channels.availablePlatforms":"可连接平台","channels.availablePlatforms.description":"频道管理目前仅开放以下平台。","channels.platform.available":"已开放","channels.platform.configure":"配置","channels.platform.configureNamed":e=>`配置${(e==null?void 0:e.platform)??"频道"}`,"channels.status.stopped":"已停止","channels.status.starting":"启动中","channels.status.connected":"已连接","channels.status.partial":"部分连接","channels.status.error":"错误","channels.startsWithServe":"随服务启动","channels.unsupported.title":"当前版本不支持频道管理","channels.unsupported.description":"请升级 Qwen Code 到支持频道管理的版本。","channels.readOnly.title":"频道管理为只读模式","channels.readOnly.description":"请使用 bearer token 重启 Qwen Code，以控制频道。","channels.loadError.title":"无法加载频道","channels.empty.title":"尚未配置支持的频道","channels.empty.description":"配置钉钉、企业微信或飞书，让当前工作区接收消息。","channels.runtimeError":"频道运行时错误","channels.action.back":"返回","channels.action.start":"启动","channels.action.stop":"停止","channels.action.restart":"重启","channels.action.retry":"重试","channels.action.edit":"编辑","channels.action.editNamed":e=>`编辑${(e==null?void 0:e.name)??"频道"}`,"channels.action.delete":"删除","channels.action.deleteNamed":e=>`删除${(e==null?void 0:e.name)??"频道"}`,"channels.action.startWithServeNamed":e=>`让 ${(e==null?void 0:e.name)??""} 随服务启动`,"channels.delete.title":e=>`删除${(e==null?void 0:e.name)??"频道"}？`,"channels.delete.description":"该频道将停止运行，并从当前工作区移除。此操作无法撤销。","channels.delete.error":"未能删除频道","channels.editor.addTitle":e=>`配置${(e==null?void 0:e.platform)??"频道"}`,"channels.editor.editTitle":e=>`编辑${(e==null?void 0:e.platform)??"频道"}`,"channels.editor.addDescription":"连接当前工作区与已有的平台应用。","channels.editor.editDescription":"更新公开配置，或明确更改已保存的凭据。","channels.editor.section.identity":"频道标识","channels.editor.section.credentials":"应用凭据","channels.editor.section.access":"准入策略","channels.editor.instanceName":"实例名称","channels.editor.instanceNamePlaceholder":"例如 release-bot","channels.editor.environmentReference":"支持 $ENV_VAR","channels.editor.field.dingtalk.clientId":"Client ID（原 AppKey）","channels.editor.field.dingtalk.clientSecret":"Client Secret（原 AppSecret）","channels.editor.field.wecom.botId":"Bot ID","channels.editor.field.wecom.secret":"Bot Secret","channels.editor.field.wecom.wsUrl":"WebSocket URL","channels.editor.field.feishu.clientId":"App ID","channels.editor.field.feishu.clientSecret":"App Secret","channels.editor.secret.environment":"已保存在环境变量中","channels.editor.secret.stored":"已安全保存","channels.editor.secret.preserve":"保留","channels.editor.secret.replace":"替换","channels.editor.secret.clear":"清除","channels.editor.secret.placeholder":e=>`请输入${(e==null?void 0:e.label)??"密钥"}`,"channels.editor.secret.clearHint":"保存后将移除此凭据。","channels.editor.policy.pairing.title":"配对模式","channels.editor.policy.pairing.description":"用户会收到配对码，经您批准后才能开始对话。","channels.editor.pairing.title":"待处理的配对请求","channels.editor.pairing.description":"批准前，请核对用户提供的配对码是否一致。","channels.editor.pairing.refresh":"刷新配对请求","channels.editor.pairing.approve":"允许","channels.editor.pairing.approved":e=>`${(e==null?void 0:e.sender)??"该用户"}现在可以使用此频道。`,"channels.editor.pairing.error":"未能更新配对请求","channels.editor.pairing.retry":"重试","channels.editor.pairing.empty.title":"暂无待处理请求","channels.editor.pairing.empty.description":"用户向机器人发送消息后，新的配对请求会显示在这里。","channels.editor.pairing.saveFirst.title":"请先保存配对模式","channels.editor.pairing.saveFirst.description":"频道以配对模式保存后，待处理请求会显示在这里。","channels.editor.policy.open.title":"开放模式","channels.editor.policy.open.description":"所有能够访问机器人的用户均可直接开始对话。","channels.editor.validation.required":e=>`${(e==null?void 0:e.label)??"此字段"}为必填项。`,"channels.editor.validation.duplicate":"已存在同名频道。","channels.editor.validation.invalidName":"请使用其他实例名称。","channels.editor.validation.number":"请输入有效数字。","channels.editor.validation.policy":"请选择准入策略。","channels.editor.saveError":"未能保存更改","channels.editor.reloadLatest":"加载最新配置","channels.editor.cancel":"取消","channels.editor.save":"保存","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":"提示："},dve={en:MI,"zh-CN":uve},hve={en:"English [en]","zh-CN":"中文 [zh-CN]"},YQ=h.createContext({language:"en",t:e=>e});function Yh(e){const t=e==null?void 0:e.trim().toLowerCase();return t&&(t==="zh"||t==="zh-cn"||t==="zh_cn")?"zh-CN":"en"}function II(e){if(typeof e!="string")return;const t=e.trim().toLowerCase().replace(/_/g,"-");if(t){if(t==="auto")return Yh(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 RI(e){return hve[e]}function DI(e){const t=dve[e];return(n,s)=>{const r=t[n]??MI[n]??n;return typeof r=="function"?r(s):r}}function fve({language:e,children:t}){const n=h.useMemo(()=>({language:e,t:DI(e)}),[e]);return l.jsx(YQ.Provider,{value:n,children:t})}function lt(){return h.useContext(YQ)}const XQ=h.createContext(null);function _u(){return h.useContext(XQ)}const mve="_row_19m4s_1",pve="_tip_19m4s_13",gve="_chatRow_19m4s_35",bve="_chatTip_19m4s_43",yve="_chatActions_19m4s_56",wve="_copyButton_19m4s_71",Of={row:mve,tip:pve,chatRow:gve,chatTip:bve,chatActions:yve,copyButton:wve};function CA({timestamp:e,children:t,chatMode:n=!1,copyText:s,copyTitle:r="Copy"}){const[i,o]=h.useState(!1),a=h.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:Of.copyButton,title:r,"aria-label":r,onClick:a,children:i?l.jsx(xve,{}):l.jsx(vve,{})}):null;return e===void 0?l.jsxs("div",{className:n?Of.chatRow:Of.row,children:[t,c]}):l.jsxs("div",{className:n?Of.chatRow:Of.row,children:[t,n?l.jsxs("span",{className:Of.chatActions,children:[l.jsx("span",{className:Of.chatTip,"aria-hidden":"true",children:Cb(e)}),c]}):l.jsx("span",{className:Of.tip,"aria-hidden":"true",children:Cb(e)})]})}function vve(){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 xve(){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 Cb(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 kve="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",_ve="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",Sve="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",Cve="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 Tve(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 Eve(e){if(!e||typeof e!="object")return!1;const t=e;return t.type==="text"?typeof t.text=="string":t.type!=="tag"?!1:Tve(t.tag)}function PI(e,t,n,s={}){if(!t)return null;try{const r=t(e);return!Array.isArray(r)||r.length===0||!r.every(Eve)||s.requireSourcePreservation&&r.map(i=>i.type==="text"?i.text:rT(i.tag)).join("")!==e?null:r}catch(r){return console.warn(n,r),null}}const LI={extension:kve,file:_ve,mcp:Sve,skill:Cve},jve=new Set(Object.values(LI));function TA(e,t){if(!e||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return typeof n=="string"?n:void 0}function rT(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 hg(e,t){if(e)return TA(t,e)??TA(LI,e)}function OI(e){return e!==void 0&&jve.has(e)}function Ave(e,t){const n=[];let s=0;for(const r of t){const i=rT(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 QQ(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 Nve(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?TA(LI,e.kind):void 0)?"":n,tagValue:s,fallback:e.id,iconUrl:hg(e.kind,t)}}const Mve="modulepreload",Ive=function(e){return"/"+e},QB={},he=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=Ive(c),c in QB)return;QB[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":Mve,u||(f.as="script"),f.crossOrigin="",f.href=c,a&&f.setAttribute("nonce",a),document.head.appendChild(f),u)return new Promise((m,p)=>{f.addEventListener("load",m),f.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)})},ei={Dark:"dark",Light:"light"},JQ=[ei.Dark,ei.Light],ZQ=h.createContext(ei.Dark),Rve=ZQ.Provider;function ny(){return h.useContext(ZQ)}const y0="ui.theme",hC="general.language";function $I(e,t){return e===ei.Light||e==="Qwen Light"?ei.Light:e===ei.Dark||e==="Qwen Dark"?ei.Dark:t}function eJ(e){return e===ei.Light?"Qwen Light":"Qwen Dark"}const tJ=h.createContext("interactive");tJ.Provider;function BI(){return h.useContext(tJ)}function JB(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 nJ(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Dve=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Pve=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Lve={};function ZB(e,t){return(Lve.jsx?Pve:Dve).test(e)}const Ove=/[ \t\n\f\r]/g;function iT(e){return typeof e=="object"?e.type==="text"?ez(e.value):!1:ez(e)}function ez(e){return e.replace(Ove,"")===""}class lk{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}lk.prototype.normal={};lk.prototype.property={};lk.prototype.space=void 0;function sJ(e,t){const n={},s={};for(const r of e)Object.assign(n,r.property),Object.assign(s,r.normal);return new lk(n,s,t)}function Xv(e){return e.toLowerCase()}class nc{constructor(t,n){this.attribute=n,this.property=t}}nc.prototype.attribute="";nc.prototype.booleanish=!1;nc.prototype.boolean=!1;nc.prototype.commaOrSpaceSeparated=!1;nc.prototype.commaSeparated=!1;nc.prototype.defined=!1;nc.prototype.mustUseProperty=!1;nc.prototype.number=!1;nc.prototype.overloadedBoolean=!1;nc.prototype.property="";nc.prototype.spaceSeparated=!1;nc.prototype.space=void 0;let $ve=0;const ks=fg(),So=fg(),EA=fg(),$t=fg(),li=fg(),M0=fg(),fc=fg();function fg(){return 2**++$ve}const jA=Object.freeze(Object.defineProperty({__proto__:null,boolean:ks,booleanish:So,commaOrSpaceSeparated:fc,commaSeparated:M0,number:$t,overloadedBoolean:EA,spaceSeparated:li},Symbol.toStringTag,{value:"Module"})),L8=Object.keys(jA);class zI extends nc{constructor(t,n,s,r){let i=-1;if(super(t,n),tz(this,"space",r),typeof s=="number")for(;++i<L8.length;){const o=L8[i];tz(this,L8[i],(s&jA[o])===jA[o])}}}zI.prototype.defined=!0;function tz(e,t,n){n&&(e[t]=n)}function sy(e){const t={},n={};for(const[s,r]of Object.entries(e.properties)){const i=new zI(s,e.transform(e.attributes||{},s),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,n[Xv(s)]=s,n[Xv(i.attribute)]=s}return new lk(t,n,e.space)}const rJ=sy({properties:{ariaActiveDescendant:null,ariaAtomic:So,ariaAutoComplete:null,ariaBusy:So,ariaChecked:So,ariaColCount:$t,ariaColIndex:$t,ariaColSpan:$t,ariaControls:li,ariaCurrent:null,ariaDescribedBy:li,ariaDetails:null,ariaDisabled:So,ariaDropEffect:li,ariaErrorMessage:null,ariaExpanded:So,ariaFlowTo:li,ariaGrabbed:So,ariaHasPopup:null,ariaHidden:So,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:li,ariaLevel:$t,ariaLive:null,ariaModal:So,ariaMultiLine:So,ariaMultiSelectable:So,ariaOrientation:null,ariaOwns:li,ariaPlaceholder:null,ariaPosInSet:$t,ariaPressed:So,ariaReadOnly:So,ariaRelevant:null,ariaRequired:So,ariaRoleDescription:li,ariaRowCount:$t,ariaRowIndex:$t,ariaRowSpan:$t,ariaSelected:So,ariaSetSize:$t,ariaSort:null,ariaValueMax:$t,ariaValueMin:$t,ariaValueNow:$t,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function iJ(e,t){return t in e?e[t]:t}function oJ(e,t){return iJ(e,t.toLowerCase())}const Bve=sy({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:M0,acceptCharset:li,accessKey:li,action:null,allow:null,allowFullScreen:ks,allowPaymentRequest:ks,allowUserMedia:ks,alpha:ks,alt:null,as:null,async:ks,autoCapitalize:null,autoComplete:li,autoFocus:ks,autoPlay:ks,blocking:li,capture:null,charSet:null,checked:ks,cite:null,className:li,closedBy:null,colorSpace:null,cols:$t,colSpan:$t,command:null,commandFor:null,content:null,contentEditable:So,controls:ks,controlsList:li,coords:$t|M0,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ks,defer:ks,dir:null,dirName:null,disabled:ks,download:EA,draggable:So,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ks,formTarget:null,headers:li,height:$t,hidden:EA,high:$t,href:null,hrefLang:null,htmlFor:li,httpEquiv:li,id:null,imageSizes:null,imageSrcSet:null,inert:ks,inputMode:null,integrity:null,is:null,isMap:ks,itemId:null,itemProp:li,itemRef:li,itemScope:ks,itemType:li,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ks,low:$t,manifest:null,max:null,maxLength:$t,media:null,method:null,min:null,minLength:$t,multiple:ks,muted:ks,name:null,nonce:null,noModule:ks,noValidate:ks,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:ks,optimum:$t,pattern:null,ping:li,placeholder:null,playsInline:ks,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ks,referrerPolicy:null,rel:li,required:ks,reversed:ks,rows:$t,rowSpan:$t,sandbox:li,scope:null,scoped:ks,seamless:ks,selected:ks,shadowRootClonable:ks,shadowRootCustomElementRegistry:ks,shadowRootDelegatesFocus:ks,shadowRootMode:null,shadowRootSerializable:ks,shape:null,size:$t,sizes:null,slot:null,span:$t,spellCheck:So,src:null,srcDoc:null,srcLang:null,srcSet:null,start:$t,step:null,style:null,tabIndex:$t,target:null,title:null,translate:null,type:null,typeMustMatch:ks,useMap:null,value:So,width:$t,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:li,axis:null,background:null,bgColor:null,border:$t,borderColor:null,bottomMargin:$t,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ks,declare:ks,event:null,face:null,frame:null,frameBorder:null,hSpace:$t,leftMargin:$t,link:null,longDesc:null,lowSrc:null,marginHeight:$t,marginWidth:$t,noResize:ks,noHref:ks,noShade:ks,noWrap:ks,object:null,profile:null,prompt:null,rev:null,rightMargin:$t,rules:null,scheme:null,scrolling:So,standby:null,summary:null,text:null,topMargin:$t,valueType:null,version:null,vAlign:null,vLink:null,vSpace:$t,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:ks,disablePictureInPicture:ks,disableRemotePlayback:ks,exportParts:M0,part:li,prefix:null,property:null,results:$t,security:null,unselectable:null},space:"html",transform:oJ}),zve=sy({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:fc,accentHeight:$t,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:$t,amplitude:$t,arabicForm:null,ascent:$t,attributeName:null,attributeType:null,azimuth:$t,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:$t,by:null,calcMode:null,capHeight:$t,className:li,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:$t,diffuseConstant:$t,direction:null,display:null,dur:null,divisor:$t,dominantBaseline:null,download:ks,dx:null,dy:null,edgeMode:null,editable:null,elevation:$t,enableBackground:null,end:null,event:null,exponent:$t,externalResourcesRequired:null,fill:null,fillOpacity:$t,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:M0,g2:M0,glyphName:M0,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:$t,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:$t,horizOriginX:$t,horizOriginY:$t,id:null,ideographic:$t,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:$t,k:$t,k1:$t,k2:$t,k3:$t,k4:$t,kernelMatrix:fc,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:$t,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:$t,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:$t,overlineThickness:$t,paintOrder:null,panose1:null,path:null,pathLength:$t,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:li,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:$t,pointsAtY:$t,pointsAtZ:$t,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:fc,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:fc,rev:fc,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:fc,requiredFeatures:fc,requiredFonts:fc,requiredFormats:fc,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:$t,specularExponent:$t,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:$t,strikethroughThickness:$t,string:null,stroke:null,strokeDashArray:fc,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:$t,strokeOpacity:$t,strokeWidth:null,style:null,surfaceScale:$t,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:fc,tabIndex:$t,tableValues:null,target:null,targetX:$t,targetY:$t,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:fc,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:$t,underlineThickness:$t,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:$t,values:null,vAlphabetic:$t,vMathematical:$t,vectorEffect:null,vHanging:$t,vIdeographic:$t,version:null,vertAdvY:$t,vertOriginX:$t,vertOriginY:$t,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:$t,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:iJ}),aJ=sy({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()}}),lJ=sy({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:oJ}),cJ=sy({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Fve={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"},Hve=/[A-Z]/g,nz=/-[a-z]/g,qve=/^data[-\w.:]+$/i;function FI(e,t){const n=Xv(t);let s=t,r=nc;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&qve.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(nz,Wve);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!nz.test(i)){let o=i.replace(Hve,Uve);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}r=zI}return new r(s,t)}function Uve(e){return"-"+e.toLowerCase()}function Wve(e){return e.charAt(1).toUpperCase()}const HI=sJ([rJ,Bve,aJ,lJ,cJ],"html"),ry=sJ([rJ,zve,aJ,lJ,cJ],"svg");function sz(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function uJ(e){return e.join(" ").trim()}var qI={},rz=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Vve=/\n/g,Gve=/^\s*/,Kve=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Yve=/^:\s*/,Xve=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Qve=/^[;\s]*/,Jve=/^\s+|\s+$/g,Zve=`
`,iz="/",oz="*",h0="",exe="comment",txe="declaration";function nxe(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(Vve);b&&(n+=b.length);var v=g.lastIndexOf(Zve);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(Gve)}function d(g){var b;for(g=g||[];b=f();)b!==!1&&g.push(b);return g}function f(){var g=i();if(!(iz!=e.charAt(0)||oz!=e.charAt(1))){for(var b=2;h0!=e.charAt(b)&&(oz!=e.charAt(b)||iz!=e.charAt(b+1));)++b;if(b+=2,h0===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:exe,comment:v})}}function m(){var g=i(),b=c(Kve);if(b){if(f(),!c(Yve))return a("property missing ':'");var v=c(Xve),y=g({type:txe,property:az(b[0].replace(rz,h0)),value:v?az(v[0].replace(rz,h0)):h0});return c(Qve),y}}function p(){var g=[];d(g);for(var b;b=m();)b!==!1&&(g.push(b),d(g));return g}return u(),p()}function az(e){return e?e.replace(Jve,h0):h0}var sxe=nxe,rxe=S4&&S4.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(qI,"__esModule",{value:!0});qI.default=oxe;const ixe=rxe(sxe);function oxe(e,t){let n=null;if(!e||typeof e!="string")return n;const s=(0,ixe.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 oT={};Object.defineProperty(oT,"__esModule",{value:!0});oT.camelCase=void 0;var axe=/^--[a-zA-Z0-9_-]+$/,lxe=/-([a-z])/g,cxe=/^[^-]+$/,uxe=/^-(webkit|moz|ms|o|khtml)-/,dxe=/^-(ms)-/,hxe=function(e){return!e||cxe.test(e)||axe.test(e)},fxe=function(e,t){return t.toUpperCase()},lz=function(e,t){return"".concat(t,"-")},mxe=function(e,t){return t===void 0&&(t={}),hxe(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(dxe,lz):e=e.replace(uxe,lz),e.replace(lxe,fxe))};oT.camelCase=mxe;var pxe=S4&&S4.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},gxe=pxe(qI),bxe=oT;function AA(e,t){var n={};return!e||typeof e!="string"||(0,gxe.default)(e,function(s,r){s&&r&&(n[(0,bxe.camelCase)(s,t)]=r)}),n}AA.default=AA;var yxe=AA;const wxe=M3(yxe),dJ=hJ("end"),UI=hJ("start");function hJ(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 vxe(e){const t=UI(e),n=dJ(e);if(t&&n)return{start:t,end:n}}function bv(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?cz(e.position):"start"in e||"end"in e?cz(e):"line"in e||"column"in e?NA(e):""}function NA(e){return uz(e&&e.line)+":"+uz(e&&e.column)}function cz(e){return NA(e&&e.start)+"-"+NA(e&&e.end)}function uz(e){return e&&typeof e=="number"?e:1}class Ya 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=bv(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}}Ya.prototype.file="";Ya.prototype.name="";Ya.prototype.reason="";Ya.prototype.message="";Ya.prototype.stack="";Ya.prototype.column=void 0;Ya.prototype.line=void 0;Ya.prototype.ancestors=void 0;Ya.prototype.cause=void 0;Ya.prototype.fatal=void 0;Ya.prototype.place=void 0;Ya.prototype.ruleId=void 0;Ya.prototype.source=void 0;const WI={}.hasOwnProperty,xxe=new Map,kxe=/[A-Z]/g,_xe=new Set(["table","tbody","thead","tfoot","tr"]),Sxe=new Set(["td","th"]),fJ="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Cxe(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=Rxe(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=Ixe(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"?ry:HI,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=mJ(r,e,void 0);return i&&typeof i!="string"?i:r.create(e,r.Fragment,{children:i||void 0},void 0)}function mJ(e,t,n){if(t.type==="element")return Txe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Exe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Axe(e,t,n);if(t.type==="mdxjsEsm")return jxe(e,t);if(t.type==="root")return Nxe(e,t,n);if(t.type==="text")return Mxe(e,t)}function Txe(e,t,n){const s=e.schema;let r=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(r=ry,e.schema=r),e.ancestors.push(t);const i=gJ(e,t.tagName,!1),o=Dxe(e,t);let a=GI(e,t);return _xe.has(t.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!iT(c):!0})),pJ(e,o,i,t),VI(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function Exe(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)}Qv(e,t.position)}function jxe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Qv(e,t.position)}function Axe(e,t,n){const s=e.schema;let r=s;t.name==="svg"&&s.space==="html"&&(r=ry,e.schema=r),e.ancestors.push(t);const i=t.name===null?e.Fragment:gJ(e,t.name,!0),o=Pxe(e,t),a=GI(e,t);return pJ(e,o,i,t),VI(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function Nxe(e,t,n){const s={};return VI(s,GI(e,t)),e.create(t,e.Fragment,s,n)}function Mxe(e,t){return t.value}function pJ(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function VI(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Ixe(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 Rxe(e,t){return n;function n(s,r,i,o){const a=Array.isArray(i.children),c=UI(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 Dxe(e,t){const n={};let s,r;for(r in t.properties)if(r!=="children"&&WI.call(t.properties,r)){const i=Lxe(e,r,t.properties[r]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&Sxe.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 Pxe(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 Qv(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 Qv(e,t.position);else i=s.value===null?!0:s.value;n[r]=i}return n}function GI(e,t){const n=[];let s=-1;const r=e.passKeys?new Map:xxe;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=mJ(e,i,o);a!==void 0&&n.push(a)}return n}function Lxe(e,t,n){const s=FI(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?nJ(n):uJ(n)),s.property==="style"){let r=typeof n=="object"?n:Oxe(e,String(n));return e.stylePropertyNameCase==="css"&&(r=$xe(r)),["style",r]}return[e.elementAttributeNameCase==="react"&&s.space?Fve[s.property]||s.property:s.attribute,n]}}function Oxe(e,t){try{return wxe(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,r=new Ya("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=fJ+"#cannot-parse-style-attribute",r}}function gJ(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=ZB(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=ZB(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const r=s.value;return WI.call(e.components,r)?e.components[r]:r}if(e.evaluater)return e.evaluater.evaluateExpression(s);Qv(e)}function Qv(e,t){const n=new Ya("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=fJ+"#cannot-handle-mdx-estrees-without-createevaluater",n}function $xe(e){const t={};let n;for(n in e)WI.call(e,n)&&(t[Bxe(n)]=e[n]);return t}function Bxe(e){let t=e.replace(kxe,zxe);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function zxe(e){return"-"+e.toLowerCase()}const O8={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"]},Fxe={};function KI(e,t){const n=Fxe,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,r=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return bJ(e,s,r)}function bJ(e,t,n){if(Hxe(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 dz(e.children,t,n)}return Array.isArray(e)?dz(e,t,n):""}function dz(e,t,n){const s=[];let r=-1;for(;++r<e.length;)s[r]=bJ(e[r],t,n);return s.join("")}function Hxe(e){return!!(e&&typeof e=="object")}const hz=document.createElement("i");function YI(e){const t="&"+e+";";hz.innerHTML=t;const n=hz.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ac(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 ru(e,t){return e.length>0?(Ac(e,e.length,0,t),e):t}const fz={}.hasOwnProperty;function yJ(e){const t={};let n=-1;for(;++n<e.length;)qxe(t,e[n]);return t}function qxe(e,t){let n;for(n in t){const r=(fz.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){fz.call(r,o)||(r[o]=[]);const a=i[o];Uxe(r[o],Array.isArray(a)?a:a?[a]:[])}}}function Uxe(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);Ac(e,0,0,s)}function wJ(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 Ou(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const pl=yp(/[A-Za-z]/),Va=yp(/[\dA-Za-z]/),Wxe=yp(/[#-'*+\--9=?A-Z^-~]/);function fC(e){return e!==null&&(e<32||e===127)}const MA=yp(/\d/),Vxe=yp(/[\dA-Fa-f]/),Gxe=yp(/[!-/:-@[-`{-~]/);function zn(e){return e!==null&&e<-2}function fi(e){return e!==null&&(e<0||e===32)}function nr(e){return e===-2||e===-1||e===32}const aT=yp(new RegExp("\\p{P}|\\p{S}","u")),F0=yp(/\s/);function yp(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function iy(e){const t=[];let n=-1,s=0,r=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&Va(e.charCodeAt(n+1))&&Va(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 Vs(e,t,n,s){const r=s?s-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return nr(c)?(e.enter(n),a(c)):t(c)}function a(c){return nr(c)&&i++<r?(e.consume(c),a):(e.exit(n),t(c))}}const Kxe={tokenize:Yxe};function Yxe(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"),Vs(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 zn(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const Xxe={tokenize:Qxe},mz={tokenize:Jxe};function Qxe(e){const t=this,n=[];let s=0,r,i,o;return a;function a(x){if(s<n.length){const k=n[s];return t.containerState=k[1],e.attempt(k[0].continuation,c,u)(x)}return u(x)}function c(x){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&w();const k=t.events.length;let C=k,T;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){T=t.events[C][1].end;break}y(s);let _=k;for(;_<t.events.length;)t.events[_][1].end={...T},_++;return Ac(t.events,C+1,0,t.events.slice(k)),t.events.length=_,u(x)}return a(x)}function u(x){if(s===n.length){if(!r)return m(x);if(r.currentConstruct&&r.currentConstruct.concrete)return g(x);t.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(mz,d,f)(x)}function d(x){return r&&w(),y(s),m(x)}function f(x){return t.parser.lazy[t.now().line]=s!==n.length,o=t.now().offset,g(x)}function m(x){return t.containerState={},e.attempt(mz,p,g)(x)}function p(x){return s++,n.push([t.currentConstruct,t.containerState]),m(x)}function g(x){if(x===null){r&&w(),y(0),e.consume(x);return}return r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:i}),b(x)}function b(x){if(x===null){v(e.exit("chunkFlow"),!0),y(0),e.consume(x);return}return zn(x)?(e.consume(x),v(e.exit("chunkFlow")),s=0,t.interrupt=void 0,a):(e.consume(x),b)}function v(x,k){const C=t.sliceStream(x);if(k&&C.push(null),x.previous=i,i&&(i.next=x),i=x,r.defineSkip(x.start),r.write(C),t.parser.lazy[x.start.line]){let T=r.events.length;for(;T--;)if(r.events[T][1].start.offset<o&&(!r.events[T][1].end||r.events[T][1].end.offset>o))return;const _=t.events.length;let S=_,R,A;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){if(R){A=t.events[S][1].end;break}R=!0}for(y(s),T=_;T<t.events.length;)t.events[T][1].end={...A},T++;Ac(t.events,S+1,0,t.events.slice(_)),t.events.length=T}}function y(x){let k=n.length;for(;k-- >x;){const C=n[k];t.containerState=C[1],C[0].exit.call(t,e)}n.length=x}function w(){r.write([null]),i=void 0,r=void 0,t.containerState._closeFlow=void 0}}function Jxe(e,t,n){return Vs(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Tb(e){if(e===null||fi(e)||F0(e))return 1;if(aT(e))return 2}function lT(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 IA={name:"attention",resolveAll:Zxe,tokenize:eke};function Zxe(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 f={...e[s][1].end},m={...e[n][1].start};pz(f,-c),pz(m,c),o={type:c>1?"strongSequence":"emphasisSequence",start:f,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=ru(u,[["enter",e[s][1],t],["exit",e[s][1],t]])),u=ru(u,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=ru(u,lT(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),u=ru(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=ru(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Ac(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 eke(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,r=Tb(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=Tb(c),f=!d||d===2&&r||n.includes(c),m=!r||r===2&&d||n.includes(s);return u._open=!!(i===42?f:f&&(r||!m)),u._close=!!(i===42?m:m&&(d||!f)),t(c)}}function pz(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const tke={name:"autolink",tokenize:nke};function nke(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 pl(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||Va(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||Va(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||fC(p)?n(p):(e.consume(p),c)}function u(p){return p===64?(e.consume(p),d):Wxe(p)?(e.consume(p),u):n(p)}function d(p){return Va(p)?f(p):n(p)}function f(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||Va(p))&&s++<63){const g=p===45?m:f;return e.consume(p),g}return n(p)}}const ck={partial:!0,tokenize:ske};function ske(e,t,n){return s;function s(i){return nr(i)?Vs(e,r,"linePrefix")(i):r(i)}function r(i){return i===null||zn(i)?t(i):n(i)}}const vJ={continuation:{tokenize:ike},exit:oke,name:"blockQuote",tokenize:rke};function rke(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 nr(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function ike(e,t,n){const s=this;return r;function r(o){return nr(o)?Vs(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(vJ,t,n)(o)}}function oke(e){e.exit("blockQuote")}const xJ={name:"characterEscape",tokenize:ake};function ake(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 Gxe(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const kJ={name:"characterReference",tokenize:lke};function lke(e,t,n){const s=this;let r=0,i,o;return a;function a(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),c}function c(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=Va,d(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=Vxe,d):(e.enter("characterReferenceValue"),i=7,o=MA,d(f))}function d(f){if(f===59&&r){const m=e.exit("characterReferenceValue");return o===Va&&!YI(s.sliceSerialize(m))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(f)&&r++<i?(e.consume(f),d):n(f)}}const gz={partial:!0,tokenize:uke},bz={concrete:!0,name:"codeFenced",tokenize:cke};function cke(e,t,n){const s=this,r={partial:!0,tokenize:C};let i=0,o=0,a;return c;function c(T){return u(T)}function u(T){const _=s.events[s.events.length-1];return i=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,a=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(T)}function d(T){return T===a?(o++,e.consume(T),d):o<3?n(T):(e.exit("codeFencedFenceSequence"),nr(T)?Vs(e,f,"whitespace")(T):f(T))}function f(T){return T===null||zn(T)?(e.exit("codeFencedFence"),s.interrupt?t(T):e.check(gz,b,k)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(T))}function m(T){return T===null||zn(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(T)):nr(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Vs(e,p,"whitespace")(T)):T===96&&T===a?n(T):(e.consume(T),m)}function p(T){return T===null||zn(T)?f(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||zn(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(T)):T===96&&T===a?n(T):(e.consume(T),g)}function b(T){return e.attempt(r,k,v)(T)}function v(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),y}function y(T){return i>0&&nr(T)?Vs(e,w,"linePrefix",i+1)(T):w(T)}function w(T){return T===null||zn(T)?e.check(gz,b,k)(T):(e.enter("codeFlowValue"),x(T))}function x(T){return T===null||zn(T)?(e.exit("codeFlowValue"),w(T)):(e.consume(T),x)}function k(T){return e.exit("codeFenced"),t(T)}function C(T,_,S){let R=0;return A;function A(z){return T.enter("lineEnding"),T.consume(z),T.exit("lineEnding"),O}function O(z){return T.enter("codeFencedFence"),nr(z)?Vs(T,M,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):M(z)}function M(z){return z===a?(T.enter("codeFencedFenceSequence"),D(z)):S(z)}function D(z){return z===a?(R++,T.consume(z),D):R>=o?(T.exit("codeFencedFenceSequence"),nr(z)?Vs(T,$,"whitespace")(z):$(z)):S(z)}function $(z){return z===null||zn(z)?(T.exit("codeFencedFence"),_(z)):S(z)}}}function uke(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 $8={name:"codeIndented",tokenize:hke},dke={partial:!0,tokenize:fke};function hke(e,t,n){const s=this;return r;function r(u){return e.enter("codeIndented"),Vs(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):zn(u)?e.attempt(dke,o,c)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||zn(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),a)}function c(u){return e.exit("codeIndented"),t(u)}}function fke(e,t,n){const s=this;return r;function r(o){return s.parser.lazy[s.now().line]?n(o):zn(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r):Vs(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):zn(o)?r(o):n(o)}}const mke={name:"codeText",previous:gke,resolve:pke,tokenize:bke};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==="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 gke(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function bke(e,t,n){let s=0,r,i;return o;function o(f){return e.enter("codeText"),e.enter("codeTextSequence"),a(f)}function a(f){return f===96?(e.consume(f),s++,a):(e.exit("codeTextSequence"),c(f))}function c(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),c):f===96?(i=e.enter("codeTextSequence"),r=0,d(f)):zn(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||zn(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),u)}function d(f){return f===96?(e.consume(f),r++,d):r===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}class yke{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&&cw(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),cw(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),cw(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);cw(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);cw(this.left,n.reverse())}}}function cw(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 _J(e){const t={};let n=-1,s,r,i,o,a,c,u;const d=new yke(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,wke(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 Ac(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function wke(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,f,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),f&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),f=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 y=a.slice(v[m],v[m+1]),w=i.pop();c.push([w,w+y.length-1]),e.splice(w,2,y)}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 vke={resolve:kke,tokenize:_ke},xke={partial:!0,tokenize:Ske};function kke(e){return _J(e),e}function _ke(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):zn(a)?e.check(xke,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 Ske(e,t,n){const s=this;return r;function r(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Vs(e,i,"linePrefix")}function i(o){if(o===null||zn(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 SJ(e,t,n,s,r,i,o,a,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(y){return y===60?(e.enter(s),e.enter(r),e.enter(i),e.consume(y),e.exit(i),m):y===null||y===32||y===41||fC(y)?n(y):(e.enter(s),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),b(y))}function m(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(r),e.exit(s),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(a),m(y)):y===null||y===60||zn(y)?n(y):(e.consume(y),y===92?g:p)}function g(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function b(y){return!d&&(y===null||y===41||fi(y))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(s),t(y)):d<u&&y===40?(e.consume(y),d++,b):y===41?(e.consume(y),d--,b):y===null||y===32||y===40||fC(y)?n(y):(e.consume(y),y===92?v:b)}function v(y){return y===40||y===41||y===92?(e.consume(y),b):b(y)}}function CJ(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):zn(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||zn(p)||a++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!nr(p)),p===92?m:f)}function m(p){return p===91||p===92||p===93?(e.consume(p),a++,f):f(p)}}function TJ(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):zn(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Vs(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===o||m===null||zn(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?f:d)}function f(m){return m===o||m===92?(e.consume(m),d):d(m)}}function yv(e,t){let n;return s;function s(r){return zn(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),n=!0,s):nr(r)?Vs(e,s,n?"linePrefix":"lineSuffix")(r):t(r)}}const Cke={name:"definition",tokenize:Eke},Tke={partial:!0,tokenize:jke};function Eke(e,t,n){const s=this;let r;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return CJ.call(s,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return r=Ou(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 fi(p)?yv(e,u)(p):u(p)}function u(p){return SJ(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(Tke,f,f)(p)}function f(p){return nr(p)?Vs(e,m,"whitespace")(p):m(p)}function m(p){return p===null||zn(p)?(e.exit("definition"),s.parser.defined.push(r),t(p)):n(p)}}function jke(e,t,n){return s;function s(a){return fi(a)?yv(e,r)(a):n(a)}function r(a){return TJ(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return nr(a)?Vs(e,o,"whitespace")(a):o(a)}function o(a){return a===null||zn(a)?t(a):n(a)}}const Ake={name:"hardBreakEscape",tokenize:Nke};function Nke(e,t,n){return s;function s(i){return e.enter("hardBreakEscape"),e.consume(i),r}function r(i){return zn(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const Mke={name:"headingAtx",resolve:Ike,tokenize:Rke};function Ike(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"},Ac(e,s,n-s+1,[["enter",r,t],["enter",i,t],["exit",i,t],["exit",r,t]])),e}function Rke(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||fi(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||zn(d)?(e.exit("atxHeading"),t(d)):nr(d)?Vs(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||fi(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),u)}}const Dke=["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"],yz=["pre","script","style","textarea"],Pke={concrete:!0,name:"htmlFlow",resolveTo:$ke,tokenize:Bke},Lke={partial:!0,tokenize:Fke},Oke={partial:!0,tokenize:zke};function $ke(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 Bke(e,t,n){const s=this;let r,i,o,a,c;return u;function u(P){return d(P)}function d(P){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(P),f}function f(P){return P===33?(e.consume(P),m):P===47?(e.consume(P),i=!0,b):P===63?(e.consume(P),r=3,s.interrupt?t:I):pl(P)?(e.consume(P),o=String.fromCharCode(P),v):n(P)}function m(P){return P===45?(e.consume(P),r=2,p):P===91?(e.consume(P),r=5,a=0,g):pl(P)?(e.consume(P),r=4,s.interrupt?t:I):n(P)}function p(P){return P===45?(e.consume(P),s.interrupt?t:I):n(P)}function g(P){const V="CDATA[";return P===V.charCodeAt(a++)?(e.consume(P),a===V.length?s.interrupt?t:M:g):n(P)}function b(P){return pl(P)?(e.consume(P),o=String.fromCharCode(P),v):n(P)}function v(P){if(P===null||P===47||P===62||fi(P)){const V=P===47,ee=o.toLowerCase();return!V&&!i&&yz.includes(ee)?(r=1,s.interrupt?t(P):M(P)):Dke.includes(o.toLowerCase())?(r=6,V?(e.consume(P),y):s.interrupt?t(P):M(P)):(r=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(P):i?w(P):x(P))}return P===45||Va(P)?(e.consume(P),o+=String.fromCharCode(P),v):n(P)}function y(P){return P===62?(e.consume(P),s.interrupt?t:M):n(P)}function w(P){return nr(P)?(e.consume(P),w):A(P)}function x(P){return P===47?(e.consume(P),A):P===58||P===95||pl(P)?(e.consume(P),k):nr(P)?(e.consume(P),x):A(P)}function k(P){return P===45||P===46||P===58||P===95||Va(P)?(e.consume(P),k):C(P)}function C(P){return P===61?(e.consume(P),T):nr(P)?(e.consume(P),C):x(P)}function T(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),c=P,_):nr(P)?(e.consume(P),T):S(P)}function _(P){return P===c?(e.consume(P),c=null,R):P===null||zn(P)?n(P):(e.consume(P),_)}function S(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||fi(P)?C(P):(e.consume(P),S)}function R(P){return P===47||P===62||nr(P)?x(P):n(P)}function A(P){return P===62?(e.consume(P),O):n(P)}function O(P){return P===null||zn(P)?M(P):nr(P)?(e.consume(P),O):n(P)}function M(P){return P===45&&r===2?(e.consume(P),B):P===60&&r===1?(e.consume(P),j):P===62&&r===4?(e.consume(P),J):P===63&&r===3?(e.consume(P),I):P===93&&r===5?(e.consume(P),Q):zn(P)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(Lke,W,D)(P)):P===null||zn(P)?(e.exit("htmlFlowData"),D(P)):(e.consume(P),M)}function D(P){return e.check(Oke,$,W)(P)}function $(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),z}function z(P){return P===null||zn(P)?D(P):(e.enter("htmlFlowData"),M(P))}function B(P){return P===45?(e.consume(P),I):M(P)}function j(P){return P===47?(e.consume(P),o="",H):M(P)}function H(P){if(P===62){const V=o.toLowerCase();return yz.includes(V)?(e.consume(P),J):M(P)}return pl(P)&&o.length<8?(e.consume(P),o+=String.fromCharCode(P),H):M(P)}function Q(P){return P===93?(e.consume(P),I):M(P)}function I(P){return P===62?(e.consume(P),J):P===45&&r===2?(e.consume(P),I):M(P)}function J(P){return P===null||zn(P)?(e.exit("htmlFlowData"),W(P)):(e.consume(P),J)}function W(P){return e.exit("htmlFlow"),t(P)}}function zke(e,t,n){const s=this;return r;function r(o){return zn(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 Fke(e,t,n){return s;function s(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(ck,t,n)}}const Hke={name:"htmlText",tokenize:qke};function qke(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),C):I===63?(e.consume(I),x):pl(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):pl(I)?(e.consume(I),w):n(I)}function d(I){return I===45?(e.consume(I),p):n(I)}function f(I){return I===null?n(I):I===45?(e.consume(I),m):zn(I)?(o=f,j(I)):(e.consume(I),f)}function m(I){return I===45?(e.consume(I),p):f(I)}function p(I){return I===62?B(I):I===45?m(I):f(I)}function g(I){const J="CDATA[";return I===J.charCodeAt(i++)?(e.consume(I),i===J.length?b:g):n(I)}function b(I){return I===null?n(I):I===93?(e.consume(I),v):zn(I)?(o=b,j(I)):(e.consume(I),b)}function v(I){return I===93?(e.consume(I),y):b(I)}function y(I){return I===62?B(I):I===93?(e.consume(I),y):b(I)}function w(I){return I===null||I===62?B(I):zn(I)?(o=w,j(I)):(e.consume(I),w)}function x(I){return I===null?n(I):I===63?(e.consume(I),k):zn(I)?(o=x,j(I)):(e.consume(I),x)}function k(I){return I===62?B(I):x(I)}function C(I){return pl(I)?(e.consume(I),T):n(I)}function T(I){return I===45||Va(I)?(e.consume(I),T):_(I)}function _(I){return zn(I)?(o=_,j(I)):nr(I)?(e.consume(I),_):B(I)}function S(I){return I===45||Va(I)?(e.consume(I),S):I===47||I===62||fi(I)?R(I):n(I)}function R(I){return I===47?(e.consume(I),B):I===58||I===95||pl(I)?(e.consume(I),A):zn(I)?(o=R,j(I)):nr(I)?(e.consume(I),R):B(I)}function A(I){return I===45||I===46||I===58||I===95||Va(I)?(e.consume(I),A):O(I)}function O(I){return I===61?(e.consume(I),M):zn(I)?(o=O,j(I)):nr(I)?(e.consume(I),O):R(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,D):zn(I)?(o=M,j(I)):nr(I)?(e.consume(I),M):(e.consume(I),$)}function D(I){return I===r?(e.consume(I),r=void 0,z):I===null?n(I):zn(I)?(o=D,j(I)):(e.consume(I),D)}function $(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||fi(I)?R(I):(e.consume(I),$)}function z(I){return I===47||I===62||fi(I)?R(I):n(I)}function B(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function j(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),H}function H(I){return nr(I)?Vs(e,Q,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):Q(I)}function Q(I){return e.enter("htmlTextData"),o(I)}}const XI={name:"labelEnd",resolveAll:Gke,resolveTo:Kke,tokenize:Yke},Uke={tokenize:Xke},Wke={tokenize:Qke},Vke={tokenize:Jke};function Gke(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&&Ac(e,0,e.length,n),e}function Kke(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=ru(a,e.slice(i+1,i+s+3)),a=ru(a,[["enter",d,t]]),a=ru(a,lT(t.parser.constructs.insideSpan.null,e.slice(i+s+4,o-3),t)),a=ru(a,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),a=ru(a,e.slice(o+1)),a=ru(a,[["exit",c,t]]),Ac(e,i,e.length,a),e}function Yke(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?f(m):(o=s.parser.defined.includes(Ou(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(Uke,d,o?d:f)(m):m===91?e.attempt(Wke,d,o?u:f)(m):o?d(m):f(m)}function u(m){return e.attempt(Vke,d,f)(m)}function d(m){return t(m)}function f(m){return i._balanced=!0,n(m)}}function Xke(e,t,n){return s;function s(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),r}function r(f){return fi(f)?yv(e,i)(f):i(f)}function i(f){return f===41?d(f):SJ(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function o(f){return fi(f)?yv(e,c)(f):d(f)}function a(f){return n(f)}function c(f){return f===34||f===39||f===40?TJ(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return fi(f)?yv(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function Qke(e,t,n){const s=this;return r;function r(a){return CJ.call(s,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return s.parser.defined.includes(Ou(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function Jke(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 Zke={name:"labelStartImage",resolveAll:XI.resolveAll,tokenize:e_e};function e_e(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 t_e={name:"labelStartLink",resolveAll:XI.resolveAll,tokenize:n_e};function n_e(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 B8={name:"lineEnding",tokenize:s_e};function s_e(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Vs(e,t,"linePrefix")}}const G2={name:"thematicBreak",tokenize:r_e};function r_e(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||zn(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===r?(e.consume(u),s++,c):(e.exit("thematicBreakSequence"),nr(u)?Vs(e,a,"whitespace")(u):a(u))}}const $l={continuation:{tokenize:l_e},exit:u_e,name:"list",tokenize:a_e},i_e={partial:!0,tokenize:d_e},o_e={partial:!0,tokenize:c_e};function a_e(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:MA(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(G2,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 MA(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(ck,s.interrupt?n:d,e.attempt(i_e,m,f))}function d(p){return s.containerState.initialBlankLine=!0,i++,m(p)}function f(p){return nr(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 l_e(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(ck,r,i);function r(a){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Vs(e,t,"listItemIndent",s.containerState.size+1)(a)}function i(a){return s.containerState.furtherBlankLines||!nr(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(o_e,t,o)(a))}function o(a){return s.containerState._closeFlow=!0,s.interrupt=void 0,Vs(e,e.attempt($l,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function c_e(e,t,n){const s=this;return Vs(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 u_e(e){e.exit(this.containerState.type)}function d_e(e,t,n){const s=this;return Vs(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!nr(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const wz={name:"setextUnderline",resolveTo:h_e,tokenize:f_e};function h_e(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 f_e(e,t,n){const s=this;let r;return i;function i(u){let d=s.events.length,f;for(;d--;)if(s.events[d][1].type!=="lineEnding"&&s.events[d][1].type!=="linePrefix"&&s.events[d][1].type!=="content"){f=s.events[d][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||f)?(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"),nr(u)?Vs(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||zn(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const m_e={tokenize:p_e};function p_e(e){const t=this,n=e.attempt(ck,s,e.attempt(this.parser.constructs.flowInitial,r,Vs(e,e.attempt(this.parser.constructs.flow,r,e.attempt(vke,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 g_e={resolveAll:jJ()},b_e=EJ("string"),y_e=EJ("text");function EJ(e){return{resolveAll:jJ(e==="text"?w_e: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 f=r[d];let m=-1;if(f)for(;++m<f.length;){const p=f[m];if(!p.previous||p.previous.call(s,s.previous))return!0}return!1}}}function jJ(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 w_e(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 v_e={42:$l,43:$l,45:$l,48:$l,49:$l,50:$l,51:$l,52:$l,53:$l,54:$l,55:$l,56:$l,57:$l,62:vJ},x_e={91:Cke},k_e={[-2]:$8,[-1]:$8,32:$8},__e={35:Mke,42:G2,45:[wz,G2],60:Pke,61:wz,95:G2,96:bz,126:bz},S_e={38:kJ,92:xJ},C_e={[-5]:B8,[-4]:B8,[-3]:B8,33:Zke,38:kJ,42:IA,60:[tke,Hke],91:t_e,92:[Ake,xJ],93:XI,95:IA,96:mke},T_e={null:[IA,g_e]},E_e={null:[42,95]},j_e={null:[]},A_e=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:E_e,contentInitial:x_e,disable:j_e,document:v_e,flow:__e,flowInitial:k_e,insideSpan:T_e,string:S_e,text:C_e},Symbol.toStringTag,{value:"Module"}));function N_e(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),check:_(T),consume:w,enter:x,exit:k,interrupt:_(T,{interrupt:!0})},u={code:null,containerState:{},defineSkip:b,events:[],now:g,parser:e,previous:null,sliceSerialize:m,sliceStream:p,write:f};let d=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function f(O){return o=ru(o,O),v(),o[o.length-1]!==null?[]:(S(t,0),u.events=lT(i,u.events,u),u.events)}function m(O,M){return I_e(p(O),M)}function p(O){return M_e(o,O)}function g(){const{_bufferIndex:O,_index:M,line:D,column:$,offset:z}=s;return{_bufferIndex:O,_index:M,line:D,column:$,offset:z}}function b(O){r[O.line]=O.column,A()}function v(){let O;for(;s._index<o.length;){const M=o[s._index];if(typeof M=="string")for(O=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===O&&s._bufferIndex<M.length;)y(M.charCodeAt(s._bufferIndex));else y(M)}}function y(O){d=d(O)}function w(O){zn(O)?(s.line++,s.column=1,s.offset+=O===-3?2:1,A()):O!==-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=O}function x(O,M){const D=M||{};return D.type=O,D.start=g(),u.events.push(["enter",D,u]),a.push(D),D}function k(O){const M=a.pop();return M.end=g(),u.events.push(["exit",M,u]),M}function C(O,M){S(O,M.from)}function T(O,M){M.restore()}function _(O,M){return D;function D($,z,B){let j,H,Q,I;return Array.isArray($)?W($):"tokenize"in $?W([$]):J($);function J(q){return K;function K(de){const re=de!==null&&q[de],ne=de!==null&&q.null,U=[...Array.isArray(re)?re:re?[re]:[],...Array.isArray(ne)?ne:ne?[ne]:[]];return W(U)(de)}}function W(q){return j=q,H=0,q.length===0?B:P(q[H])}function P(q){return K;function K(de){return I=R(),Q=q,q.partial||(u.currentConstruct=q),q.name&&u.parser.constructs.disable.null.includes(q.name)?ee():q.tokenize.call(M?Object.assign(Object.create(u),M):u,c,V,ee)(de)}}function V(q){return O(Q,I),z}function ee(q){return I.restore(),++H<j.length?P(j[H]):B}}}function S(O,M){O.resolveAll&&!i.includes(O)&&i.push(O),O.resolve&&Ac(u.events,M,u.events.length-M,O.resolve(u.events.slice(M),u)),O.resolveTo&&(u.events=O.resolveTo(u.events,u))}function R(){const O=g(),M=u.previous,D=u.currentConstruct,$=u.events.length,z=Array.from(a);return{from:$,restore:B};function B(){s=O,u.previous=M,u.currentConstruct=D,u.events.length=$,a=z,A()}}function A(){s.line in r&&s.column<2&&(s.column=r[s.line],s.offset+=r[s.line]-1)}}function M_e(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 I_e(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 R_e(e){const s={constructs:yJ([A_e,...(e||{}).extensions||[]]),content:r(Kxe),defined:[],document:r(Xxe),flow:r(m_e),lazy:{},string:r(b_e),text:r(y_e)};return s;function r(i){return o;function o(a){return N_e(s,i,a)}}}function D_e(e){for(;!_J(e););return e}const vz=/[\0\t\n\r]/g;function P_e(){let e=1,t="",n=!0,s;return r;function r(i,o,a){const c=[];let u,d,f,m,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(vz.lastIndex=f,u=vz.exec(i),m=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(m),!u){t=i.slice(f);break}if(p===10&&f===m&&s)c.push(-3),s=void 0;else switch(s&&(c.push(-5),s=void 0),f<m&&(c.push(i.slice(f,m)),e+=m-f),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}f=m+1}return a&&(s&&c.push(-5),t&&c.push(t),c.push(null)),c}}const L_e=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function O_e(e){return e.replace(L_e,$_e)}function $_e(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const r=n.charCodeAt(1),i=r===120||r===88;return wJ(n.slice(i?2:1),i?16:10)}return YI(n)||e}const AJ={}.hasOwnProperty;function B_e(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),z_e(n)(D_e(R_e(n).document().write(P_e()(e,t,!0))))}function z_e(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Me),autolinkProtocol:R,autolinkEmail:R,atxHeading:i(ue),blockQuote:i(ne),characterEscape:R,characterReference:R,codeFenced:i(U),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(U,o),codeText:i(Z,o),codeTextData:R,data:R,codeFlowValue:R,definition:i(ge),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(ce),hardBreakEscape:i(be),hardBreakTrailing:i(be),htmlFlow:i(rt,o),htmlFlowData:R,htmlText:i(rt,o),htmlTextData:R,image:i(le),label:o,link:i(Me),listItem:i(at),listItemValue:m,listOrdered:i(We,f),listUnordered:i(We),paragraph:i(ze),reference:P,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(ue),strong:i(rn),thematicBreak:i(zt)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:re,autolinkProtocol:de,blockQuote:c(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:q,characterReference:K,codeFenced:c(v),codeFencedFence:b,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:A,codeIndented:c(y),codeText:c(z),codeTextData:A,data:A,definition:c(),definitionDestinationString:k,definitionLabelString:w,definitionTitleString:x,emphasis:c(),hardBreakEscape:c(M),hardBreakTrailing:c(M),htmlFlow:c(D),htmlFlowData:A,htmlText:c($),htmlTextData:A,image:c(j),label:Q,labelText:H,lineEnding:O,link:c(B),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:V,resourceDestinationString:I,resourceTitleString:J,resource:W,setextHeading:c(S),setextHeadingLineSequence:_,setextHeadingText:T,strong:c(),thematicBreak:c()}};NJ(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ae){let je={type:"root",children:[]};const it={stack:[je],tokenStack:[],config:t,enter:a,exit:u,buffer:o,resume:d,data:n},gt=[];let wt=-1;for(;++wt<ae.length;)if(ae[wt][1].type==="listOrdered"||ae[wt][1].type==="listUnordered")if(ae[wt][0]==="enter")gt.push(wt);else{const Ke=gt.pop();wt=r(ae,Ke,wt)}for(wt=-1;++wt<ae.length;){const Ke=t[ae[wt][0]];AJ.call(Ke,ae[wt][1].type)&&Ke[ae[wt][1].type].call(Object.assign({sliceSerialize:ae[wt][2].sliceSerialize},it),ae[wt][1])}if(it.tokenStack.length>0){const Ke=it.tokenStack[it.tokenStack.length-1];(Ke[1]||xz).call(it,void 0,Ke[0])}for(je.position={start:$f(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:$f(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},wt=-1;++wt<t.transforms.length;)je=t.transforms[wt](je)||je;return je}function r(ae,je,it){let gt=je-1,wt=-1,Ke=!1,un,me,ht,Oe;for(;++gt<=it;){const Ne=ae[gt];switch(Ne[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ne[0]==="enter"?wt++:wt--,Oe=void 0;break}case"lineEndingBlank":{Ne[0]==="enter"&&(un&&!Oe&&!wt&&!ht&&(ht=gt),Oe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Oe=void 0}if(!wt&&Ne[0]==="enter"&&Ne[1].type==="listItemPrefix"||wt===-1&&Ne[0]==="exit"&&(Ne[1].type==="listUnordered"||Ne[1].type==="listOrdered")){if(un){let St=gt;for(me=void 0;St--;){const Ue=ae[St];if(Ue[1].type==="lineEnding"||Ue[1].type==="lineEndingBlank"){if(Ue[0]==="exit")continue;me&&(ae[me][1].type="lineEndingBlank",Ke=!0),Ue[1].type="lineEnding",me=St}else if(!(Ue[1].type==="linePrefix"||Ue[1].type==="blockQuotePrefix"||Ue[1].type==="blockQuotePrefixWhitespace"||Ue[1].type==="blockQuoteMarker"||Ue[1].type==="listItemIndent"))break}ht&&(!me||ht<me)&&(un._spread=!0),un.end=Object.assign({},me?ae[me][1].start:Ne[1].end),ae.splice(me||gt,0,["exit",un,Ne[2]]),gt++,it++}if(Ne[1].type==="listItemPrefix"){const St={type:"listItem",_spread:!1,start:Object.assign({},Ne[1].start),end:void 0};un=St,ae.splice(gt,0,["enter",St,Ne[2]]),gt++,it++,ht=void 0,Oe=!0}}}return ae[je][1]._spread=Ke,it}function i(ae,je){return it;function it(gt){a.call(this,ae(gt),gt),je&&je.call(this,gt)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(ae,je,it){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([je,it||void 0]),ae.position={start:$f(je.start),end:void 0}}function c(ae){return je;function je(it){ae&&ae.call(this,it),u.call(this,it)}}function u(ae,je){const it=this.stack.pop(),gt=this.tokenStack.pop();if(gt)gt[0].type!==ae.type&&(je?je.call(this,ae,gt[0]):(gt[1]||xz).call(this,ae,gt[0]));else throw new Error("Cannot close `"+ae.type+"` ("+bv({start:ae.start,end:ae.end})+"): it’s not open");it.position.end=$f(ae.end)}function d(){return KI(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function m(ae){if(this.data.expectingFirstListItemValue){const je=this.stack[this.stack.length-2];je.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function p(){const ae=this.resume(),je=this.stack[this.stack.length-1];je.lang=ae}function g(){const ae=this.resume(),je=this.stack[this.stack.length-1];je.meta=ae}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const ae=this.resume(),je=this.stack[this.stack.length-1];je.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const ae=this.resume(),je=this.stack[this.stack.length-1];je.value=ae.replace(/(\r?\n|\r)$/g,"")}function w(ae){const je=this.resume(),it=this.stack[this.stack.length-1];it.label=je,it.identifier=Ou(this.sliceSerialize(ae)).toLowerCase()}function x(){const ae=this.resume(),je=this.stack[this.stack.length-1];je.title=ae}function k(){const ae=this.resume(),je=this.stack[this.stack.length-1];je.url=ae}function C(ae){const je=this.stack[this.stack.length-1];if(!je.depth){const it=this.sliceSerialize(ae).length;je.depth=it}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function _(ae){const je=this.stack[this.stack.length-1];je.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function S(){this.data.setextHeadingSlurpLineEnding=void 0}function R(ae){const it=this.stack[this.stack.length-1].children;let gt=it[it.length-1];(!gt||gt.type!=="text")&&(gt=Wt(),gt.position={start:$f(ae.start),end:void 0},it.push(gt)),this.stack.push(gt)}function A(ae){const je=this.stack.pop();je.value+=this.sliceSerialize(ae),je.position.end=$f(ae.end)}function O(ae){const je=this.stack[this.stack.length-1];if(this.data.atHardBreak){const it=je.children[je.children.length-1];it.position.end=$f(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(je.type)&&(R.call(this,ae),A.call(this,ae))}function M(){this.data.atHardBreak=!0}function D(){const ae=this.resume(),je=this.stack[this.stack.length-1];je.value=ae}function $(){const ae=this.resume(),je=this.stack[this.stack.length-1];je.value=ae}function z(){const ae=this.resume(),je=this.stack[this.stack.length-1];je.value=ae}function B(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const je=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=je,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function j(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const je=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=je,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function H(ae){const je=this.sliceSerialize(ae),it=this.stack[this.stack.length-2];it.label=O_e(je),it.identifier=Ou(je).toLowerCase()}function Q(){const ae=this.stack[this.stack.length-1],je=this.resume(),it=this.stack[this.stack.length-1];if(this.data.inReference=!0,it.type==="link"){const gt=ae.children;it.children=gt}else it.alt=je}function I(){const ae=this.resume(),je=this.stack[this.stack.length-1];je.url=ae}function J(){const ae=this.resume(),je=this.stack[this.stack.length-1];je.title=ae}function W(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function V(ae){const je=this.resume(),it=this.stack[this.stack.length-1];it.label=je,it.identifier=Ou(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function ee(ae){this.data.characterReferenceType=ae.type}function q(ae){const je=this.sliceSerialize(ae),it=this.data.characterReferenceType;let gt;it?(gt=wJ(je,it==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):gt=YI(je);const wt=this.stack[this.stack.length-1];wt.value+=gt}function K(ae){const je=this.stack.pop();je.position.end=$f(ae.end)}function de(ae){A.call(this,ae);const je=this.stack[this.stack.length-1];je.url=this.sliceSerialize(ae)}function re(ae){A.call(this,ae);const je=this.stack[this.stack.length-1];je.url="mailto:"+this.sliceSerialize(ae)}function ne(){return{type:"blockquote",children:[]}}function U(){return{type:"code",lang:null,meta:null,value:""}}function Z(){return{type:"inlineCode",value:""}}function ge(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ce(){return{type:"emphasis",children:[]}}function ue(){return{type:"heading",depth:0,children:[]}}function be(){return{type:"break"}}function rt(){return{type:"html",value:""}}function le(){return{type:"image",title:null,url:"",alt:null}}function Me(){return{type:"link",title:null,url:"",children:[]}}function We(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function at(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function ze(){return{type:"paragraph",children:[]}}function rn(){return{type:"strong",children:[]}}function Wt(){return{type:"text",value:""}}function zt(){return{type:"thematicBreak"}}}function $f(e){return{line:e.line,column:e.column,offset:e.offset}}function NJ(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?NJ(e,s):F_e(e,s)}}function F_e(e,t){let n;for(n in t)if(AJ.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 xz(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+bv({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+bv({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+bv({start:t.start,end:t.end})+") is still open")}function H_e(e){const t=this;t.parser=n;function n(s){return B_e(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function q_e(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 U_e(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function W_e(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 V_e(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function G_e(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function K_e(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),r=iy(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 Y_e(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 X_e(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function MJ(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 Q_e(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return MJ(e,t);const r={src:iy(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 J_e(e,t){const n={src:iy(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 Z_e(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 eSe(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return MJ(e,t);const r={href:iy(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 tSe(e,t){const n={href:iy(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 nSe(e,t,n){const s=e.all(t),r=n?sSe(n):IJ(t),i={},o=[];if(typeof t.checked=="boolean"){const d=s[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},s.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.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 sSe(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=IJ(n[s])}return t}function IJ(e){const t=e.spread;return t??e.children.length>1}function rSe(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 iSe(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function oSe(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function aSe(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lSe(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=UI(t.children[1]),c=dJ(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 cSe(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 f=t.children[c],m={},p=o?o[c]:void 0;p&&(m.align=p);let g={type:"element",tagName:i,properties:m,children:[]};f&&(g.children=e.all(f),e.patch(f,g),g=e.applyData(f,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 uSe(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const kz=9,_z=32;function dSe(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),r=0;const i=[];for(;s;)i.push(Sz(t.slice(r,s.index),r>0,!0),s[0]),r=s.index+s[0].length,s=n.exec(t);return i.push(Sz(t.slice(r),r>0,!1)),i.join("")}function Sz(e,t,n){let s=0,r=e.length;if(t){let i=e.codePointAt(s);for(;i===kz||i===_z;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(r-1);for(;i===kz||i===_z;)r--,i=e.codePointAt(r-1)}return r>s?e.slice(s,r):""}function hSe(e,t){const n={type:"text",value:dSe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function fSe(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const mSe={blockquote:q_e,break:U_e,code:W_e,delete:V_e,emphasis:G_e,footnoteReference:K_e,heading:Y_e,html:X_e,imageReference:Q_e,image:J_e,inlineCode:Z_e,linkReference:eSe,link:tSe,listItem:nSe,list:rSe,paragraph:iSe,root:oSe,strong:aSe,table:lSe,tableCell:uSe,tableRow:cSe,text:hSe,thematicBreak:fSe,toml:rS,yaml:rS,definition:rS,footnoteDefinition:rS};function rS(){}const RJ=-1,cT=0,wv=1,mC=2,QI=3,JI=4,ZI=5,eR=6,DJ=7,PJ=8,Cz=typeof self=="object"?self:globalThis,pSe=(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 cT:case RJ:return n(o,r);case wv:{const a=n([],r);for(const c of o)a.push(s(c));return a}case mC:{const a=n({},r);for(const[c,u]of o)a[s(c)]=s(u);return a}case QI:return n(new Date(o),r);case JI:{const{source:a,flags:c}=o;return n(new RegExp(a,c),r)}case ZI:{const a=n(new Map,r);for(const[c,u]of o)a.set(s(c),s(u));return a}case eR:{const a=n(new Set,r);for(const c of o)a.add(s(c));return a}case DJ:{const{name:a,message:c}=o;return n(new Cz[a](c),r)}case PJ: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 Cz[i](o),r)};return s},Tz=e=>pSe(new Map,e)(0),Xg="",{toString:gSe}={},{keys:bSe}=Object,uw=e=>{const t=typeof e;if(t!=="object"||!e)return[cT,t];const n=gSe.call(e).slice(8,-1);switch(n){case"Array":return[wv,Xg];case"Object":return[mC,Xg];case"Date":return[QI,Xg];case"RegExp":return[JI,Xg];case"Map":return[ZI,Xg];case"Set":return[eR,Xg];case"DataView":return[wv,n]}return n.includes("Array")?[wv,n]:n.includes("Error")?[DJ,n]:[mC,n]},iS=([e,t])=>e===cT&&(t==="function"||t==="symbol"),ySe=(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]=uw(o);switch(a){case cT:{let d=o;switch(c){case"bigint":a=PJ,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return r([RJ],o)}return r([a,d],o)}case wv:{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=[],f=r([a,d],o);for(const m of o)d.push(i(m));return f}case mC:{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=[],f=r([a,d],o);for(const m of bSe(o))(e||!iS(uw(o[m])))&&d.push([i(m),i(o[m])]);return f}case QI:return r([a,o.toISOString()],o);case JI:{const{source:d,flags:f}=o;return r([a,{source:d,flags:f}],o)}case ZI:{const d=[],f=r([a,d],o);for(const[m,p]of o)(e||!(iS(uw(m))||iS(uw(p))))&&d.push([i(m),i(p)]);return f}case eR:{const d=[],f=r([a,d],o);for(const m of o)(e||!iS(uw(m)))&&d.push(i(m));return f}}const{message:u}=o;return r([a,{name:c,message:u}],o)};return i},Ez=(e,{json:t,lossy:n}={})=>{const s=[];return ySe(!(t||n),!!t,new Map,s)(e),s},pC=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Tz(Ez(e,t)):structuredClone(e):(e,t)=>Tz(Ez(e,t));function wSe(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 vSe(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function xSe(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||wSe,s=e.options.footnoteBackLabel||vSe,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),f=String(u.identifier).toUpperCase(),m=iy(f.toLowerCase());let p=0;const g=[],b=e.footnoteCounts.get(f);for(;b!==void 0&&++p<=b;){g.length>0&&g.push({type:"text",value:" "});let w=typeof n=="string"?n:n(c,p);typeof w=="string"&&(w={type:"text",value:w}),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(w)?w:[w]})}const v=d[d.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const w=v.children[v.children.length-1];w&&w.type==="text"?w.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...g)}else d.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(u,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...pC(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 uk=function(e){if(e==null)return CSe;if(typeof e=="function")return uT(e);if(typeof e=="object")return Array.isArray(e)?kSe(e):_Se(e);if(typeof e=="string")return SSe(e);throw new Error("Expected function, string, or object as test")};function kSe(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=uk(e[n]);return uT(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function _Se(e){const t=e;return uT(n);function n(s){const r=s;let i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function SSe(e){return uT(t);function t(n){return n&&n.type===e}}function uT(e){return t;function t(n,s,r){return!!(TSe(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function CSe(){return!0}function TSe(e){return e!==null&&typeof e=="object"&&"type"in e}const LJ=[],ESe=!0,RA=!1,OJ="skip";function tR(e,t,n,s){let r;typeof t=="function"&&typeof n!="function"?(s=n,n=t):r=t;const i=uk(r),o=s?-1:1;a(e,void 0,[])();function a(c,u,d){const f=c&&typeof c=="object"?c:{};if(typeof f.type=="string"){const p=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return m;function m(){let p=LJ,g,b,v;if((!t||i(c,u,d[d.length-1]||void 0))&&(p=jSe(n(c,d)),p[0]===RA))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==OJ)for(b=(s?y.children.length:-1)+o,v=d.concat(y);b>-1&&b<y.children.length;){const w=y.children[b];if(g=a(w,b,v)(),g[0]===RA)return g;b=typeof g[1]=="number"?g[1]:b+o}}return p}}}function jSe(e){return Array.isArray(e)?e:typeof e=="number"?[ESe,e]:e==null?LJ:[e]}function nR(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),tR(e,i,a,r);function a(c,u){const d=u[u.length-1],f=d?d.children.indexOf(c):void 0;return o(c,f,d)}}const DA={}.hasOwnProperty,ASe={};function NSe(e,t){const n=t||ASe,s=new Map,r=new Map,i=new Map,o={...mSe,...n.handlers},a={all:u,applyData:ISe,definitionById:s,footnoteById:r,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:MSe,wrap:DSe};return nR(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=d.type==="definition"?s:r,m=String(d.identifier).toUpperCase();f.has(m)||f.set(m,d)}}),a;function c(d,f){const m=d.type,p=a.handlers[m];if(DA.call(a.handlers,m)&&p)return p(a,d,f);if(a.options.passThrough&&a.options.passThrough.includes(m)){if("children"in d){const{children:b,...v}=d,y=pC(v);return y.children=a.all(d),y}return pC(d)}return(a.options.unknownHandler||RSe)(a,d,f)}function u(d){const f=[];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=jz(g.value)),!Array.isArray(g)&&g.type==="element")){const b=g.children[0];b&&b.type==="text"&&(b.value=jz(b.value))}Array.isArray(g)?f.push(...g):f.push(g)}}}return f}}function MSe(e,t){e.position&&(t.position=vxe(e))}function ISe(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,pC(i)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function RSe(e,t){const n=t.data||{},s="value"in t&&!(DA.call(n,"hProperties")||DA.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 DSe(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 jz(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Az(e,t){const n=NSe(e,t),s=n.one(e,void 0),r=xSe(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return r&&i.children.push({type:"text",value:`
`},r),i}function PSe(e,t){return e&&"run"in e?async function(n,s){const r=Az(n,{file:s,...t});await e.run(r,s)}:function(n,s){return Az(n,{file:s,...e||t})}}function Nz(e){if(e)throw e}var K2=Object.prototype.hasOwnProperty,$J=Object.prototype.toString,Mz=Object.defineProperty,Iz=Object.getOwnPropertyDescriptor,Rz=function(t){return typeof Array.isArray=="function"?Array.isArray(t):$J.call(t)==="[object Array]"},Dz=function(t){if(!t||$J.call(t)!=="[object Object]")return!1;var n=K2.call(t,"constructor"),s=t.constructor&&t.constructor.prototype&&K2.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!s)return!1;var r;for(r in t);return typeof r>"u"||K2.call(t,r)},Pz=function(t,n){Mz&&n.name==="__proto__"?Mz(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Lz=function(t,n){if(n==="__proto__")if(K2.call(t,n)){if(Iz)return Iz(t,n).value}else return;return t[n]},LSe=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=Lz(a,n),r=Lz(t,n),a!==r&&(d&&r&&(Dz(r)||(i=Rz(r)))?(i?(i=!1,o=s&&Rz(s)?s:[]):o=s&&Dz(s)?s:{},Pz(a,{name:n,newValue:e(d,o,r)})):typeof r<"u"&&Pz(a,{name:n,newValue:r}));return a};const z8=M3(LSe);function PA(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 OSe(){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 f=-1;if(c){o(c);return}for(;++f<r.length;)(u[f]===null||u[f]===void 0)&&(u[f]=r[f]);r=u,d?$Se(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 $Se(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 kd={basename:BSe,dirname:zSe,extname:FSe,join:HSe,sep:"/"};function BSe(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');dk(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 zSe(e){if(dk(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 FSe(e){dk(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 HSe(...e){let t=-1,n;for(;++t<e.length;)dk(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":qSe(n)}function qSe(e){dk(e);const t=e.codePointAt(0)===47;let n=USe(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function USe(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 dk(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const WSe={cwd:VSe};function VSe(){return"/"}function LA(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function GSe(e){if(typeof e=="string")e=new URL(e);else if(!LA(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 KSe(e)}function KSe(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 F8=["history","path","basename","stem","extname","dirname"];class BJ{constructor(t){let n;t?LA(t)?n={path:t}:typeof t=="string"||YSe(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":WSe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<F8.length;){const i=F8[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)F8.includes(r)||(this[r]=n[r])}get basename(){return typeof this.path=="string"?kd.basename(this.path):void 0}set basename(t){q8(t,"basename"),H8(t,"basename"),this.path=kd.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?kd.dirname(this.path):void 0}set dirname(t){Oz(this.basename,"dirname"),this.path=kd.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?kd.extname(this.path):void 0}set extname(t){if(H8(t,"extname"),Oz(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=kd.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){LA(t)&&(t=GSe(t)),q8(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?kd.basename(this.path,this.extname):void 0}set stem(t){q8(t,"stem"),H8(t,"stem"),this.path=kd.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 Ya(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 H8(e,t){if(e&&e.includes(kd.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+kd.sep+"`")}function q8(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Oz(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function YSe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const XSe=function(e){const s=this.constructor.prototype,r=s[e],i=function(){return r.apply(i,arguments)};return Object.setPrototypeOf(i,s),i},QSe={}.hasOwnProperty;class sR extends XSe{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=OSe()}copy(){const t=new sR;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(z8(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(V8("data",this.frozen),this.namespace[t]=n,this):QSe.call(this.namespace,t)&&this.namespace[t]||void 0:t?(V8("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=oS(t),s=this.parser||this.Parser;return U8("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),U8("process",this.parser||this.Parser),W8("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(i,o){const a=oS(t),c=s.parse(a);s.run(c,a,function(d,f,m){if(d||!f||!m)return u(d);const p=f,g=s.stringify(p,m);e2e(g)?m.value=g:m.result=g,u(d,m)});function u(d,f){d||!f?o(d):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,s;return this.freeze(),U8("processSync",this.parser||this.Parser),W8("processSync",this.compiler||this.Compiler),this.process(t,r),Bz("processSync","process",n),s;function r(i,o){n=!0,Nz(i),s=o}}run(t,n,s){$z(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=oS(n);r.run(t,c,u);function u(d,f,m){const p=f||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),Bz("runSync","run",s),r;function i(o,a){Nz(o),r=a,s=!0}}stringify(t,n){this.freeze();const s=oS(n),r=this.compiler||this.Compiler;return W8("stringify",r),$z(t),r(t,s)}use(t,...n){const s=this.attachers,r=this.namespace;if(V8("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,...f]=u;c(d,f)}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=z8(!0,r.settings,u.settings))}function a(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let f=-1,m=-1;for(;++f<s.length;)if(s[f][0]===u){m=f;break}if(m===-1)s.push([u,...d]);else if(d.length>0){let[p,...g]=d;const b=s[m][1];PA(b)&&PA(p)&&(p=z8(!0,b,p)),s[m]=[u,p,...g]}}}}const JSe=new sR().freeze();function U8(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function W8(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function V8(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 $z(e){if(!PA(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Bz(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function oS(e){return ZSe(e)?e:new BJ(e)}function ZSe(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function e2e(e){return typeof e=="string"||t2e(e)}function t2e(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const n2e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",zz=[],Fz={allowDangerousHtml:!0},s2e=/^(https?|ircs?|mailto|xmpp)$/i,r2e=[{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 i2e(e){const t=o2e(e),n=a2e(e);return l2e(t.runSync(t.parse(n),n),e)}function o2e(e){const t=e.rehypePlugins||zz,n=e.remarkPlugins||zz,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Fz}:Fz;return JSe().use(H_e).use(n).use(PSe,s).use(t)}function a2e(e){const t=e.children||"",n=new BJ;return typeof t=="string"&&(n.value=t),n}function l2e(e,t){const n=t.allowedElements,s=t.allowElement,r=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,c=t.urlTransform||zJ;for(const d of r2e)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+n2e+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),nR(e,u),Cxe(e,{Fragment:l.Fragment,components:r,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function u(d,f,m){if(d.type==="raw"&&m&&typeof f=="number")return o?m.children.splice(f,1):m.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in O8)if(Object.hasOwn(O8,p)&&Object.hasOwn(d.properties,p)){const g=d.properties[p],b=O8[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 f=="number"&&(p=!s(d,f,m)),p&&m&&typeof f=="number")return a&&d.children?m.children.splice(f,1,...d.children):m.children.splice(f,1),f}}}function zJ(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||s2e.test(e.slice(0,t))?e:""}function gC(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 c2e(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function u2e(e,t,n){const r=uk((n||{}).ignore||[]),i=d2e(t);let o=-1;for(;++o<i.length;)tR(e,"text",a);function a(u,d){let f=-1,m;for(;++f<d.length;){const p=d[f],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 f=d[d.length-1],m=i[o][0],p=i[o][1];let g=0;const v=f.children.indexOf(u);let y=!1,w=[];m.lastIndex=0;let x=m.exec(u.value);for(;x;){const k=x.index,C={index:x.index,input:x.input,stack:[...d,u]};let T=p(...x,C);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?m.lastIndex=k+1:(g!==k&&w.push({type:"text",value:u.value.slice(g,k)}),Array.isArray(T)?w.push(...T):T&&w.push(T),g=k+x[0].length,y=!0),!m.global)break;x=m.exec(u.value)}return y?(g<u.value.length&&w.push({type:"text",value:u.value.slice(g)}),f.children.splice(v,1,...w)):w=[u],v+w.length}}function d2e(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([h2e(r[0]),f2e(r[1])])}return t}function h2e(e){return typeof e=="string"?new RegExp(c2e(e),"g"):e}function f2e(e){return typeof e=="function"?e:function(){return e}}const G8="phrasing",K8=["autolink","link","image","label"];function m2e(){return{transforms:[x2e],enter:{literalAutolink:g2e,literalAutolinkEmail:Y8,literalAutolinkHttp:Y8,literalAutolinkWww:Y8},exit:{literalAutolink:v2e,literalAutolinkEmail:w2e,literalAutolinkHttp:b2e,literalAutolinkWww:y2e}}}function p2e(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:G8,notInConstruct:K8},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:G8,notInConstruct:K8},{character:":",before:"[ps]",after:"\\/",inConstruct:G8,notInConstruct:K8}]}}function g2e(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Y8(e){this.config.enter.autolinkProtocol.call(this,e)}function b2e(e){this.config.exit.autolinkProtocol.call(this,e)}function y2e(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 w2e(e){this.config.exit.autolinkEmail.call(this,e)}function v2e(e){this.exit(e)}function x2e(e){u2e(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,k2e],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),_2e]],{ignore:["link","linkReference"]})}function k2e(e,t,n,s,r){let i="";if(!FJ(r)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!S2e(n)))return!1;const o=C2e(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 _2e(e,t,n,s){return!FJ(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function S2e(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 C2e(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=gC(e,"(");let i=gC(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 FJ(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||F0(n)||aT(n))&&(!t||n!==47)}HJ.peek=D2e;function T2e(){this.buffer()}function E2e(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function j2e(){this.buffer()}function A2e(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function N2e(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ou(this.sliceSerialize(e)).toLowerCase(),n.label=t}function M2e(e){this.exit(e)}function I2e(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ou(this.sliceSerialize(e)).toLowerCase(),n.label=t}function R2e(e){this.exit(e)}function D2e(){return"["}function HJ(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 P2e(){return{enter:{gfmFootnoteCallString:T2e,gfmFootnoteCall:E2e,gfmFootnoteDefinitionLabelString:j2e,gfmFootnoteDefinition:A2e},exit:{gfmFootnoteCallString:N2e,gfmFootnoteCall:M2e,gfmFootnoteDefinitionLabelString:I2e,gfmFootnoteDefinition:R2e}}}function L2e(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:HJ},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?qJ:O2e))),u(),c}}function O2e(e,t,n){return t===0?e:qJ(e,t,n)}function qJ(e,t,n){return(n?"":"    ")+e}const $2e=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];UJ.peek=q2e;function B2e(){return{canContainEols:["delete"],enter:{strikethrough:F2e},exit:{strikethrough:H2e}}}function z2e(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:$2e}],handlers:{delete:UJ}}}function F2e(e){this.enter({type:"delete",children:[]},e)}function H2e(e){this.exit(e)}function UJ(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 q2e(){return"~"}function U2e(e){return e.length}function W2e(e,t){const n=t||{},s=(n.align||[]).concat(),r=n.stringLength||U2e,i=[],o=[],a=[],c=[];let u=0,d=-1;for(;++d<e.length;){const b=[],v=[];let y=-1;for(e[d].length>u&&(u=e[d].length);++y<e[d].length;){const w=V2e(e[d][y]);if(n.alignDelimiters!==!1){const x=r(w);v[y]=x,(c[y]===void 0||x>c[y])&&(c[y]=x)}b.push(w)}o[d]=b,a[d]=v}let f=-1;if(typeof s=="object"&&"length"in s)for(;++f<u;)i[f]=Hz(s[f]);else{const b=Hz(s);for(;++f<u;)i[f]=b}f=-1;const m=[],p=[];for(;++f<u;){const b=i[f];let v="",y="";b===99?(v=":",y=":"):b===108?v=":":b===114&&(y=":");let w=n.alignDelimiters===!1?1:Math.max(1,c[f]-v.length-y.length);const x=v+"-".repeat(w)+y;n.alignDelimiters!==!1&&(w=v.length+w+y.length,w>c[f]&&(c[f]=w),p[f]=w),m[f]=x}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];f=-1;const y=[];for(;++f<u;){const w=b[f]||"";let x="",k="";if(n.alignDelimiters!==!1){const C=c[f]-(v[f]||0),T=i[f];T===114?x=" ".repeat(C):T===99?C%2?(x=" ".repeat(C/2+.5),k=" ".repeat(C/2-.5)):(x=" ".repeat(C/2),k=x):k=" ".repeat(C)}n.delimiterStart!==!1&&!f&&y.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&w==="")&&(n.delimiterStart!==!1||f)&&y.push(" "),n.alignDelimiters!==!1&&y.push(x),y.push(w),n.alignDelimiters!==!1&&y.push(k),n.padding!==!1&&y.push(" "),(n.delimiterEnd!==!1||f!==u-1)&&y.push("|")}g.push(n.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return g.join(`
`)}function V2e(e){return e==null?"":String(e)}function Hz(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 qz={}.hasOwnProperty;function G2e(e,t){const n=t||{};function s(r,...i){let o=s.invalid;const a=s.handlers;if(r&&qz.call(r,e)){const c=String(r[e]);o=qz.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 K2e(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()),Y2e);return r(),o}function Y2e(e,t,n){return">"+(n?"":" ")+e}function X2e(e,t){return Uz(e,t.inConstruct,!0)&&!Uz(e,t.notInConstruct,!1)}function Uz(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 Wz(e,t,n,s){let r=-1;for(;++r<n.unsafe.length;)if(n.unsafe[r].character===`
`&&X2e(n.stack,n.unsafe[r]))return/[ \t]/.test(s.before)?"":" ";return`\\
`}function WJ(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 Q2e(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 J2e(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 Z2e(e,t,n,s){const r=J2e(n),i=e.value||"",o=r==="`"?"GraveAccent":"Tilde";if(Q2e(e,n)){const f=n.enter("codeIndented"),m=n.indentLines(i,e4e);return f(),m}const a=n.createTracker(s),c=r.repeat(Math.max(WJ(i,r)+1,3)),u=n.enter("codeFenced");let d=a.move(c);if(e.lang){const f=n.enter(`codeFencedLang${o}`);d+=a.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...a.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${o}`);d+=a.move(" "),d+=a.move(n.safe(e.meta,{before:d,after:`
`,encode:["`"],...a.current()})),f()}return d+=a.move(`
`),i&&(d+=a.move(i+`
`)),d+=a.move(c),u(),d}function e4e(e,t,n){return(n?"":"    ")+e}function rR(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 t4e(e,t,n,s){const r=rR(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 n4e(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 Jv(e){return"&#x"+e.toString(16).toUpperCase()+";"}function bC(e,t,n){const s=Tb(e),r=Tb(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}}VJ.peek=s4e;function VJ(e,t,n,s){const r=n4e(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=bC(s.before.charCodeAt(s.before.length-1),u,r);d.inside&&(c=Jv(u)+c.slice(1));const f=c.charCodeAt(c.length-1),m=bC(s.after.charCodeAt(0),f,r);m.inside&&(c=c.slice(0,-1)+Jv(f));const p=o.move(r);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},a+c+p}function s4e(e,t,n){return n.options.emphasis||"*"}function r4e(e,t){let n=!1;return nR(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,RA}),!!((!e.depth||e.depth<3)&&KI(e)&&(t.options.setext||n))}function i4e(e,t,n,s){const r=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(s);if(r4e(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),m=n.containerPhrasing(e,{...i.current(),before:`
`,after:`
`});return f(),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=Jv(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),a(),u}GJ.peek=o4e;function GJ(e){return e.value||""}function o4e(){return"<"}KJ.peek=a4e;function KJ(e,t,n,s){const r=rR(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 a4e(){return"!"}YJ.peek=l4e;function YJ(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 f=n.safe(n.associationId(e),{before:c,after:"]",...a.current()});return o(),n.stack=d,i(),r==="full"||!u||u!==f?c+=a.move(f+"]"):r==="shortcut"?c=c.slice(0,-1):c+=a.move("]"),c}function l4e(){return"!"}XJ.peek=c4e;function XJ(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 c4e(){return"`"}function QJ(e,t){const n=KI(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))}JJ.peek=u4e;function JJ(e,t,n,s){const r=rR(n),i=r==='"'?"Quote":"Apostrophe",o=n.createTracker(s);let a,c;if(QJ(e,n)){const d=n.stack;n.stack=[],a=n.enter("autolink");let f=o.move("<");return f+=o.move(n.containerPhrasing(e,{before:f,after:">",...o.current()})),f+=o.move(">"),a(),n.stack=d,f}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 u4e(e,t,n){return QJ(e,n)?"<":"["}ZJ.peek=d4e;function ZJ(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 f=n.safe(n.associationId(e),{before:c,after:"]",...a.current()});return o(),n.stack=d,i(),r==="full"||!u||u!==f?c+=a.move(f+"]"):r==="shortcut"?c=c.slice(0,-1):c+=a.move("]"),c}function d4e(){return"["}function iR(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 h4e(e){const t=iR(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 f4e(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 eZ(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 m4e(e,t,n,s){const r=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?f4e(n):iR(n);const a=e.ordered?o==="."?")":".":h4e(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),eZ(n)===o&&d){let f=-1;for(;++f<e.children.length;){const m=e.children[f];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 p4e(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 g4e(e,t,n,s){const r=p4e(n);let i=n.bulletCurrent||iR(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(f,m,p){return m?(p?"":" ".repeat(o))+f:(p?i:i+" ".repeat(o-i.length))+f}}function b4e(e,t,n,s){const r=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,s);return i(),r(),o}const y4e=uk(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function w4e(e,t,n,s){return(e.children.some(function(o){return y4e(o)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function v4e(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}tZ.peek=x4e;function tZ(e,t,n,s){const r=v4e(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=bC(s.before.charCodeAt(s.before.length-1),u,r);d.inside&&(c=Jv(u)+c.slice(1));const f=c.charCodeAt(c.length-1),m=bC(s.after.charCodeAt(0),f,r);m.inside&&(c=c.slice(0,-1)+Jv(f));const p=o.move(r+r);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},a+c+p}function x4e(e,t,n){return n.options.strong||"*"}function k4e(e,t,n,s){return n.safe(e.value,s)}function _4e(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 S4e(e,t,n){const s=(eZ(n)+(n.options.ruleSpaces?" ":"")).repeat(_4e(n));return n.options.ruleSpaces?s.slice(0,-1):s}const nZ={blockquote:K2e,break:Wz,code:Z2e,definition:t4e,emphasis:VJ,hardBreak:Wz,heading:i4e,html:GJ,image:KJ,imageReference:YJ,inlineCode:XJ,link:JJ,linkReference:ZJ,list:m4e,listItem:g4e,paragraph:b4e,root:w4e,strong:tZ,text:k4e,thematicBreak:S4e};function C4e(){return{enter:{table:T4e,tableData:Vz,tableHeader:Vz,tableRow:j4e},exit:{codeText:A4e,table:E4e,tableData:X8,tableHeader:X8,tableRow:X8}}}function T4e(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 E4e(e){this.exit(e),this.data.inTable=void 0}function j4e(e){this.enter({type:"tableRow",children:[]},e)}function X8(e){this.exit(e)}function Vz(e){this.enter({type:"tableCell",children:[]},e)}function A4e(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,N4e));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function N4e(e,t){return t==="|"?t:e}function M4e(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 y=f(p,b,v),w=u([y]);return w.slice(0,w.indexOf(`
`))}function c(p,g,b,v){const y=b.enter("tableCell"),w=b.enter("phrasing"),x=b.containerPhrasing(p,{...v,before:i,after:i});return w(),y(),x}function u(p,g){return W2e(p,{align:g,alignDelimiters:s,padding:n,stringLength:r})}function d(p,g,b){const v=p.children;let y=-1;const w=[],x=g.enter("table");for(;++y<v.length;)w[y]=f(v[y],g,b);return x(),w}function f(p,g,b){const v=p.children;let y=-1;const w=[],x=g.enter("tableRow");for(;++y<v.length;)w[y]=c(v[y],p,g,b);return x(),w}function m(p,g,b){let v=nZ.inlineCode(p,g,b);return b.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function I4e(){return{exit:{taskListCheckValueChecked:Gz,taskListCheckValueUnchecked:Gz,paragraph:D4e}}}function R4e(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:P4e}}}function Gz(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function D4e(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 P4e(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=nZ.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 L4e(){return[m2e(),P2e(),B2e(),C4e(),I4e()]}function O4e(e){return{extensions:[p2e(),L2e(e),z2e(),M4e(e),R4e()]}}const $4e={tokenize:U4e,partial:!0},sZ={tokenize:W4e,partial:!0},rZ={tokenize:V4e,partial:!0},iZ={tokenize:G4e,partial:!0},B4e={tokenize:K4e,partial:!0},oZ={name:"wwwAutolink",tokenize:H4e,previous:lZ},aZ={name:"protocolAutolink",tokenize:q4e,previous:cZ},vf={name:"emailAutolink",tokenize:F4e,previous:uZ},Qd={};function z4e(){return{text:Qd}}let Gp=48;for(;Gp<123;)Qd[Gp]=vf,Gp++,Gp===58?Gp=65:Gp===91&&(Gp=97);Qd[43]=vf;Qd[45]=vf;Qd[46]=vf;Qd[95]=vf;Qd[72]=[vf,aZ];Qd[104]=[vf,aZ];Qd[87]=[vf,oZ];Qd[119]=[vf,oZ];function F4e(e,t,n){const s=this;let r,i;return o;function o(f){return!OA(f)||!uZ.call(s,s.previous)||oR(s.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(f))}function a(f){return OA(f)?(e.consume(f),a):f===64?(e.consume(f),c):n(f)}function c(f){return f===46?e.check(B4e,d,u)(f):f===45||f===95||Va(f)?(i=!0,e.consume(f),c):d(f)}function u(f){return e.consume(f),r=!0,c}function d(f){return i&&r&&pl(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function H4e(e,t,n){const s=this;return r;function r(o){return o!==87&&o!==119||!lZ.call(s,s.previous)||oR(s.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check($4e,e.attempt(sZ,e.attempt(rZ,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function q4e(e,t,n){const s=this;let r="",i=!1;return o;function o(f){return(f===72||f===104)&&cZ.call(s,s.previous)&&!oR(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),r+=String.fromCodePoint(f),e.consume(f),a):n(f)}function a(f){if(pl(f)&&r.length<5)return r+=String.fromCodePoint(f),e.consume(f),a;if(f===58){const m=r.toLowerCase();if(m==="http"||m==="https")return e.consume(f),c}return n(f)}function c(f){return f===47?(e.consume(f),i?u:(i=!0,c)):n(f)}function u(f){return f===null||fC(f)||fi(f)||F0(f)||aT(f)?n(f):e.attempt(sZ,e.attempt(rZ,d),n)(f)}function d(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function U4e(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 W4e(e,t,n){let s,r,i;return o;function o(u){return u===46||u===95?e.check(iZ,c,a)(u):u===null||fi(u)||F0(u)||u!==45&&aT(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 V4e(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(iZ,t,i)(o):o===null||fi(o)||F0(o)?t(o):(e.consume(o),r)}function i(o){return o===41&&s++,e.consume(o),r}}function G4e(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||fi(a)||F0(a)?t(a):n(a)}function r(a){return a===null||a===40||a===91||fi(a)||F0(a)?t(a):s(a)}function i(a){return pl(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),s):pl(a)?(e.consume(a),o):n(a)}}function K4e(e,t,n){return s;function s(i){return e.consume(i),r}function r(i){return Va(i)?n(i):t(i)}}function lZ(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||fi(e)}function cZ(e){return!pl(e)}function uZ(e){return!(e===47||OA(e))}function OA(e){return e===43||e===45||e===46||e===95||Va(e)}function oR(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 Y4e={tokenize:sCe,partial:!0};function X4e(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:eCe,continuation:{tokenize:tCe},exit:nCe}},text:{91:{name:"gfmFootnoteCall",tokenize:Z4e},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Q4e,resolveTo:J4e}}}}function Q4e(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=Ou(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 J4e(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 Z4e(e,t,n){const s=this,r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i=0,o;return a;function a(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),c}function c(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(i>999||f===93&&!o||f===null||f===91||fi(f))return n(f);if(f===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return r.includes(Ou(s.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return fi(f)||(o=!0),i++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),i++,u):u(f)}}function eCe(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||fi(g))return n(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return i=Ou(s.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return fi(g)||(a=!0),o++,e.consume(g),g===92?f:d}function f(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),Vs(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return t(g)}}function tCe(e,t,n){return e.check(ck,t,e.attempt(Y4e,t,n))}function nCe(e){e.exit("gfmFootnoteDefinition")}function sCe(e,t,n){const s=this;return Vs(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 rCe(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)},f={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",f,a]],p=a.parser.constructs.insideSpan.null;p&&Ac(m,m.length,0,lT(p,o.slice(u+1,c),a)),Ac(m,m.length,0,[["exit",f,a],["enter",o[c][1],a],["exit",o[c][1],a],["exit",d,a]]),Ac(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 f=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=Tb(u);if(g===126)return f>1?c(g):(o.consume(g),f++,p);if(f<2&&!n)return c(g);const v=o.exit("strikethroughSequenceTemporary"),y=Tb(g);return v._open=!y||y===2&&!!b,v._close=!b||b===2&&!!y,a(g)}}}class iCe{constructor(){this.map=[]}add(t,n,s){oCe(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 oCe(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 aCe(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 lCe(){return{flow:{null:{name:"table",tokenize:cCe,resolveAll:uCe}}}}function cCe(e,t,n){const s=this;let r=0,i=0,o;return a;function a(A){let O=s.events.length-1;for(;O>-1;){const $=s.events[O][1].type;if($==="lineEnding"||$==="linePrefix")O--;else break}const M=O>-1?s.events[O][1].type:null,D=M==="tableHead"||M==="tableRow"?T:c;return D===T&&s.parser.lazy[s.now().line]?n(A):D(A)}function c(A){return e.enter("tableHead"),e.enter("tableRow"),u(A)}function u(A){return A===124||(o=!0,i+=1),d(A)}function d(A){return A===null?n(A):zn(A)?i>1?(i=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),p):n(A):nr(A)?Vs(e,d,"whitespace")(A):(i+=1,o&&(o=!1,r+=1),A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),f(A)))}function f(A){return A===null||A===124||fi(A)?(e.exit("data"),d(A)):(e.consume(A),A===92?m:f)}function m(A){return A===92||A===124?(e.consume(A),f):f(A)}function p(A){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(A):(e.enter("tableDelimiterRow"),o=!1,nr(A)?Vs(e,g,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):g(A))}function g(A){return A===45||A===58?v(A):A===124?(o=!0,e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),b):C(A)}function b(A){return nr(A)?Vs(e,v,"whitespace")(A):v(A)}function v(A){return A===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),y):A===45?(i+=1,y(A)):A===null||zn(A)?k(A):C(A)}function y(A){return A===45?(e.enter("tableDelimiterFiller"),w(A)):C(A)}function w(A){return A===45?(e.consume(A),w):A===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(A))}function x(A){return nr(A)?Vs(e,k,"whitespace")(A):k(A)}function k(A){return A===124?g(A):A===null||zn(A)?!o||r!==i?C(A):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(A)):C(A)}function C(A){return n(A)}function T(A){return e.enter("tableRow"),_(A)}function _(A){return A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),_):A===null||zn(A)?(e.exit("tableRow"),t(A)):nr(A)?Vs(e,_,"whitespace")(A):(e.enter("data"),S(A))}function S(A){return A===null||A===124||fi(A)?(e.exit("data"),_(A)):(e.consume(A),A===92?R:S)}function R(A){return A===92||A===124?(e.consume(A),S):S(A)}}function uCe(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,f;const m=new iCe;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(a=!1,c!==0&&(Kz(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,f=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],f=aS(m,t,i,r,void 0,f),i=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(s?s=!1:(i[1]!==0&&(o[0]=o[1],f=aS(m,t,i,r,void 0,f)),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],f=aS(m,t,i,r,n,f)):o[1]!==0&&(f=aS(m,t,o,r,n,f)),r=0):r&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&Kz(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=aCe(t.events,n))}return e}function aS(e,t,n,s,r,i){const o=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},y1(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=y1(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=y1(t.events,n[2]),d=y1(t.events,n[3]),f={type:a,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",f,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",f,t]])}return r!==void 0&&(i.end=Object.assign({},y1(t.events,r)),e.add(r,0,[["exit",i,t]]),i=void 0),i}function Kz(e,t,n,s,r){const i=[],o=y1(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 y1(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const dCe={name:"tasklistCheck",tokenize:fCe};function hCe(){return{text:{91:dCe}}}function fCe(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 fi(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 zn(c)?t(c):nr(c)?e.check({tokenize:mCe},t,n)(c):n(c)}}function mCe(e,t,n){return Vs(e,s,"whitespace");function s(r){return r===null?n(r):t(r)}}function pCe(e){return yJ([z4e(),X4e(),rCe(e),lCe(),hCe()])}const gCe={};function Yz(e){const t=this,n=e||gCe,s=t.data(),r=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);r.push(pCe(n)),i.push(L4e()),o.push(O4e(n))}function bCe(){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 f=d.data.hChildren[0];f.type,f.tagName,f.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 yCe(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),f="$".repeat(Math.max(WJ(u,"$")+1,2)),m=a.enter("mathFlow");let p=d.move(f);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(f),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 f=-1;for(;++f<a.unsafe.length;){const m=a.unsafe[f];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 wCe={tokenize:vCe,concrete:!0,name:"mathFlow"},Xz={tokenize:xCe,partial:!0};function vCe(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(w){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),c(w)}function c(w){return w===36?(e.consume(w),o++,c):o<2?n(w):(e.exit("mathFlowFenceSequence"),Vs(e,u,"whitespace")(w))}function u(w){return w===null||zn(w)?f(w):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(w))}function d(w){return w===null||zn(w)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),f(w)):w===36?n(w):(e.consume(w),d)}function f(w){return e.exit("mathFlowFence"),s.interrupt?t(w):e.attempt(Xz,m,v)(w)}function m(w){return e.attempt({tokenize:y,partial:!0},v,p)(w)}function p(w){return(i?Vs(e,g,"linePrefix",i+1):g)(w)}function g(w){return w===null?v(w):zn(w)?e.attempt(Xz,m,v)(w):(e.enter("mathFlowValue"),b(w))}function b(w){return w===null||zn(w)?(e.exit("mathFlowValue"),g(w)):(e.consume(w),b)}function v(w){return e.exit("mathFlow"),t(w)}function y(w,x,k){let C=0;return Vs(w,T,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function T(R){return w.enter("mathFlowFence"),w.enter("mathFlowFenceSequence"),_(R)}function _(R){return R===36?(C++,w.consume(R),_):C<o?k(R):(w.exit("mathFlowFenceSequence"),Vs(w,S,"whitespace")(R))}function S(R){return R===null||zn(R)?(w.exit("mathFlowFence"),x(R)):k(R)}}}function xCe(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 kCe(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:s,resolve:_Ce,previous:SCe,name:"mathText"};function s(r,i,o){let a=0,c,u;return d;function d(b){return r.enter("mathText"),r.enter("mathTextSequence"),f(b)}function f(b){return b===36?(r.consume(b),a++,f):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):zn(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||zn(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 _Ce(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 SCe(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function CCe(e){return{flow:{36:wCe},text:{36:kCe(e)}}}class Pt 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,Pt.prototype),this.position=r,r!=null&&i!=null&&(this.length=i-r),this.rawMessage=t}}var TCe=/([A-Z])/g,ECe=e=>e.replace(TCe,"-$1").toLowerCase(),jCe={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},ACe=/[&><"']/g,Ga=e=>String(e).replace(ACe,t=>jCe[t]),Y2=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?Y2(e.body[0]):e:e.type==="font"?Y2(e.body):e,NCe=new Set(["mathord","textord","atom"]),xf=e=>NCe.has(Y2(e).type),MCe=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"},yC={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 ICe(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 RCe(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return ICe(t)}function DCe(e,t,n,s){var r=n[t];e[t]=r!==void 0?s.processor?s.processor(r):r:RCe(s)}class aR{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(yC)){var s=yC[n];s&&DCe(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 Pt("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=MCe(t.url);if(n==null)return!1;t.protocol=n}var s=typeof this.trust=="function"?this.trust(t):this.trust;return!!s}}let Bf=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 Sd[PCe[this.id]]}sub(){return Sd[LCe[this.id]]}fracNum(){return Sd[OCe[this.id]]}fracDen(){return Sd[$Ce[this.id]]}cramp(){return Sd[BCe[this.id]]}text(){return Sd[zCe[this.id]]}isTight(){return this.size>=2}};var lR=0,wC=1,tb=2,Xh=3,Zv=4,uu=5,Eb=6,vl=7,Sd=[new Bf(lR,0,!1),new Bf(wC,0,!0),new Bf(tb,1,!1),new Bf(Xh,1,!0),new Bf(Zv,2,!1),new Bf(uu,2,!0),new Bf(Eb,3,!1),new Bf(vl,3,!0)],PCe=[Zv,uu,Zv,uu,Eb,vl,Eb,vl],LCe=[uu,uu,uu,uu,vl,vl,vl,vl],OCe=[tb,Xh,Zv,uu,Eb,vl,Eb,vl],$Ce=[Xh,Xh,uu,uu,vl,vl,vl,vl],BCe=[wC,wC,Xh,Xh,uu,uu,vl,vl],zCe=[lR,wC,tb,Xh,tb,Xh,tb,Xh],_s={DISPLAY:Sd[lR],TEXT:Sd[tb],SCRIPT:Sd[Zv],SCRIPTSCRIPT:Sd[Eb]},$A=[{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 FCe(e){for(var t=0;t<$A.length;t++)for(var n=$A[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 X2=[];$A.forEach(e=>e.blocks.forEach(t=>X2.push(...t)));function dZ(e){for(var t=0;t<X2.length;t+=2)if(e>=X2[t]&&e<=X2[t+1])return!0;return!1}var Uo=e=>e+" "+e,Qg=80,HCe=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"},qCe=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"},UCe=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"},WCe=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"},VCe=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"},GCe=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},KCe=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"},YCe=function(t,n,s){n=1e3*n;var r="";switch(t){case"sqrtMain":r=HCe(n,Qg);break;case"sqrtSize1":r=qCe(n,Qg);break;case"sqrtSize2":r=UCe(n,Qg);break;case"sqrtSize3":r=WCe(n,Qg);break;case"sqrtSize4":r=VCe(n,Qg);break;case"sqrtTall":r=KCe(n,Qg,s)}return r},XCe=function(t,n){switch(t){case"⎜":return Uo("M291 0 H417 V"+n+" H291z");case"∣":return Uo("M145 0 H188 V"+n+" H145z");case"∥":return Uo("M145 0 H188 V"+n+" H145z")+Uo("M367 0 H410 V"+n+" H367z");case"⎟":return Uo("M457 0 H583 V"+n+" H457z");case"⎢":return Uo("M319 0 H403 V"+n+" H319z");case"⎥":return Uo("M263 0 H347 V"+n+" H263z");case"⎪":return Uo("M384 0 H504 V"+n+" H384z");case"⏐":return Uo("M312 0 H355 V"+n+" H312z");case"‖":return Uo("M257 0 H300 V"+n+" H257z")+Uo("M478 0 H521 V"+n+" H478z");default:return""}},Qz={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:Uo("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:Uo("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:Uo("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:Uo("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:Uo("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:Uo("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:Uo("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:Uo("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`},QCe=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 JCe(e){return"toText"in e}let oy=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(JCe(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}};var BA={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},ZCe={ex:!0,em:!0,mu:!0},hZ=function(t){return typeof t!="string"&&(t=t.unit),t in BA||t in ZCe||t==="ex"},Xi=function(t,n){var s;if(t.unit in BA)s=BA[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 Pt("Invalid unit: '"+t.unit+"'");r!==n&&(s*=r.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*s,n.maxSize)},Gt=function(t){return+t.toFixed(4)+"em"},qm=function(t){return t.filter(n=>n).join(" ")},cR=function(t){var n="";for(var s of Object.keys(t)){var r=t[s];r!==void 0&&(n+=ECe(s)+":"+r+";")}return n},fZ=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)}},mZ=function(t){var n=document.createElement(t);n.className=qm(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},e3e=/[\s"'>/=\x00-\x1f]/,pZ=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+Ga(qm(this.classes))+'"');var s=cR(this.style);s&&(n+=' style="'+Ga(s)+'"');for(var r of Object.keys(this.attributes)){if(e3e.test(r))throw new Pt("Invalid attribute name '"+r+"'");n+=" "+r+'="'+Ga(this.attributes[r])+'"'}n+=">";for(var i=0;i<this.children.length;i++)n+=this.children[i].toMarkup();return n+="</"+t+">",n};class ay{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,fZ.call(this,t,s,r),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return mZ.call(this,"span")}toMarkup(){return pZ.call(this,"span")}}let dT=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,fZ.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 mZ.call(this,"a")}toMarkup(){return pZ.call(this,"a")}};class t3e{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="'+Ga(this.src)+'"'+(' alt="'+Ga(this.alt)+'"'),n=cR(this.style);return n&&(t+=' style="'+Ga(n)+'"'),t+="'/>",t}}var n3e={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Lc{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=FCe(this.text.charCodeAt(0));u&&this.classes.push(u+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=n3e[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=Gt(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=qm(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+=Ga(qm(this.classes)),n+='"');var s="";this.italic>0&&(s+="margin-right:"+Gt(this.italic)+";"),s+=cR(this.style),s&&(t=!0,n+=' style="'+Ga(s)+'"');var r=Ga(this.text);return t?(n+=">",n+=r,n+="</span>",n):r}}class ff{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+'="'+Ga(this.attributes[n])+'"';t+=">";for(var s=0;s<this.children.length;s++)t+=this.children[s].toMarkup();return t+="</svg>",t}}class Um{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",Qz[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+Ga(this.alternate)+'"/>':'<path d="'+Ga(Qz[this.pathName])+'"/>'}}class zA{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+'="'+Ga(this.attributes[n])+'"';return t+="/>",t}}function s3e(e){if(e instanceof Lc)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function r3e(e){if(e instanceof ay)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var i3e=e=>e instanceof ay||e instanceof dT||e instanceof oy,Id={"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]}},lS={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]},Jz={Å:"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 gZ(e,t){Id[e]=t}function uR(e,t,n){if(!Id[t])throw new Error("Font metrics not found for font: "+t+".");var s=e.charCodeAt(0),r=Id[t][s];if(!r&&e[0]in Jz&&(s=Jz[e[0]].charCodeAt(0),r=Id[t][s]),!r&&n==="text"&&dZ(s)&&(r=Id[t][77]),r)return{depth:r[0],height:r[1],italic:r[2],skew:r[3],width:r[4]}}var Q8={};function o3e(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!Q8[t]){var n=Q8[t]={cssEmPerMu:lS.quad[t]/18};for(var s in lS)lS.hasOwnProperty(s)&&(n[s]=lS[s][t])}return Q8[t]}var Li={math:{},text:{}};function N(e,t,n,s,r,i){Li[e][r]={font:t,group:n,replace:s},i&&s&&(Li[e][s]=Li[e][r])}var L="math",Tt="text",Y="main",pe="ams",$i="accent-token",_n="bin",jl="close",ly="inner",ss="mathord",Lo="op-token",$c="open",hk="punct",we="rel",kf="spacing",Ee="textord";N(L,Y,we,"≡","\\equiv",!0);N(L,Y,we,"≺","\\prec",!0);N(L,Y,we,"≻","\\succ",!0);N(L,Y,we,"∼","\\sim",!0);N(L,Y,we,"⊥","\\perp");N(L,Y,we,"⪯","\\preceq",!0);N(L,Y,we,"⪰","\\succeq",!0);N(L,Y,we,"≃","\\simeq",!0);N(L,Y,we,"∣","\\mid",!0);N(L,Y,we,"≪","\\ll",!0);N(L,Y,we,"≫","\\gg",!0);N(L,Y,we,"≍","\\asymp",!0);N(L,Y,we,"∥","\\parallel");N(L,Y,we,"⋈","\\bowtie",!0);N(L,Y,we,"⌣","\\smile",!0);N(L,Y,we,"⊑","\\sqsubseteq",!0);N(L,Y,we,"⊒","\\sqsupseteq",!0);N(L,Y,we,"≐","\\doteq",!0);N(L,Y,we,"⌢","\\frown",!0);N(L,Y,we,"∋","\\ni",!0);N(L,Y,we,"∝","\\propto",!0);N(L,Y,we,"⊢","\\vdash",!0);N(L,Y,we,"⊣","\\dashv",!0);N(L,Y,we,"∋","\\owns");N(L,Y,hk,".","\\ldotp");N(L,Y,hk,"⋅","\\cdotp");N(L,Y,hk,"⋅","·");N(Tt,Y,Ee,"⋅","·");N(L,Y,Ee,"#","\\#");N(Tt,Y,Ee,"#","\\#");N(L,Y,Ee,"&","\\&");N(Tt,Y,Ee,"&","\\&");N(L,Y,Ee,"ℵ","\\aleph",!0);N(L,Y,Ee,"∀","\\forall",!0);N(L,Y,Ee,"ℏ","\\hbar",!0);N(L,Y,Ee,"∃","\\exists",!0);N(L,Y,Ee,"∇","\\nabla",!0);N(L,Y,Ee,"♭","\\flat",!0);N(L,Y,Ee,"ℓ","\\ell",!0);N(L,Y,Ee,"♮","\\natural",!0);N(L,Y,Ee,"♣","\\clubsuit",!0);N(L,Y,Ee,"℘","\\wp",!0);N(L,Y,Ee,"♯","\\sharp",!0);N(L,Y,Ee,"♢","\\diamondsuit",!0);N(L,Y,Ee,"ℜ","\\Re",!0);N(L,Y,Ee,"♡","\\heartsuit",!0);N(L,Y,Ee,"ℑ","\\Im",!0);N(L,Y,Ee,"♠","\\spadesuit",!0);N(L,Y,Ee,"§","\\S",!0);N(Tt,Y,Ee,"§","\\S");N(L,Y,Ee,"¶","\\P",!0);N(Tt,Y,Ee,"¶","\\P");N(L,Y,Ee,"†","\\dag");N(Tt,Y,Ee,"†","\\dag");N(Tt,Y,Ee,"†","\\textdagger");N(L,Y,Ee,"‡","\\ddag");N(Tt,Y,Ee,"‡","\\ddag");N(Tt,Y,Ee,"‡","\\textdaggerdbl");N(L,Y,jl,"⎱","\\rmoustache",!0);N(L,Y,$c,"⎰","\\lmoustache",!0);N(L,Y,jl,"⟯","\\rgroup",!0);N(L,Y,$c,"⟮","\\lgroup",!0);N(L,Y,_n,"∓","\\mp",!0);N(L,Y,_n,"⊖","\\ominus",!0);N(L,Y,_n,"⊎","\\uplus",!0);N(L,Y,_n,"⊓","\\sqcap",!0);N(L,Y,_n,"∗","\\ast");N(L,Y,_n,"⊔","\\sqcup",!0);N(L,Y,_n,"◯","\\bigcirc",!0);N(L,Y,_n,"∙","\\bullet",!0);N(L,Y,_n,"‡","\\ddagger");N(L,Y,_n,"≀","\\wr",!0);N(L,Y,_n,"⨿","\\amalg");N(L,Y,_n,"&","\\And");N(L,Y,we,"⟵","\\longleftarrow",!0);N(L,Y,we,"⇐","\\Leftarrow",!0);N(L,Y,we,"⟸","\\Longleftarrow",!0);N(L,Y,we,"⟶","\\longrightarrow",!0);N(L,Y,we,"⇒","\\Rightarrow",!0);N(L,Y,we,"⟹","\\Longrightarrow",!0);N(L,Y,we,"↔","\\leftrightarrow",!0);N(L,Y,we,"⟷","\\longleftrightarrow",!0);N(L,Y,we,"⇔","\\Leftrightarrow",!0);N(L,Y,we,"⟺","\\Longleftrightarrow",!0);N(L,Y,we,"↦","\\mapsto",!0);N(L,Y,we,"⟼","\\longmapsto",!0);N(L,Y,we,"↗","\\nearrow",!0);N(L,Y,we,"↩","\\hookleftarrow",!0);N(L,Y,we,"↪","\\hookrightarrow",!0);N(L,Y,we,"↘","\\searrow",!0);N(L,Y,we,"↼","\\leftharpoonup",!0);N(L,Y,we,"⇀","\\rightharpoonup",!0);N(L,Y,we,"↙","\\swarrow",!0);N(L,Y,we,"↽","\\leftharpoondown",!0);N(L,Y,we,"⇁","\\rightharpoondown",!0);N(L,Y,we,"↖","\\nwarrow",!0);N(L,Y,we,"⇌","\\rightleftharpoons",!0);N(L,pe,we,"≮","\\nless",!0);N(L,pe,we,"","\\@nleqslant");N(L,pe,we,"","\\@nleqq");N(L,pe,we,"⪇","\\lneq",!0);N(L,pe,we,"≨","\\lneqq",!0);N(L,pe,we,"","\\@lvertneqq");N(L,pe,we,"⋦","\\lnsim",!0);N(L,pe,we,"⪉","\\lnapprox",!0);N(L,pe,we,"⊀","\\nprec",!0);N(L,pe,we,"⋠","\\npreceq",!0);N(L,pe,we,"⋨","\\precnsim",!0);N(L,pe,we,"⪹","\\precnapprox",!0);N(L,pe,we,"≁","\\nsim",!0);N(L,pe,we,"","\\@nshortmid");N(L,pe,we,"∤","\\nmid",!0);N(L,pe,we,"⊬","\\nvdash",!0);N(L,pe,we,"⊭","\\nvDash",!0);N(L,pe,we,"⋪","\\ntriangleleft");N(L,pe,we,"⋬","\\ntrianglelefteq",!0);N(L,pe,we,"⊊","\\subsetneq",!0);N(L,pe,we,"","\\@varsubsetneq");N(L,pe,we,"⫋","\\subsetneqq",!0);N(L,pe,we,"","\\@varsubsetneqq");N(L,pe,we,"≯","\\ngtr",!0);N(L,pe,we,"","\\@ngeqslant");N(L,pe,we,"","\\@ngeqq");N(L,pe,we,"⪈","\\gneq",!0);N(L,pe,we,"≩","\\gneqq",!0);N(L,pe,we,"","\\@gvertneqq");N(L,pe,we,"⋧","\\gnsim",!0);N(L,pe,we,"⪊","\\gnapprox",!0);N(L,pe,we,"⊁","\\nsucc",!0);N(L,pe,we,"⋡","\\nsucceq",!0);N(L,pe,we,"⋩","\\succnsim",!0);N(L,pe,we,"⪺","\\succnapprox",!0);N(L,pe,we,"≆","\\ncong",!0);N(L,pe,we,"","\\@nshortparallel");N(L,pe,we,"∦","\\nparallel",!0);N(L,pe,we,"⊯","\\nVDash",!0);N(L,pe,we,"⋫","\\ntriangleright");N(L,pe,we,"⋭","\\ntrianglerighteq",!0);N(L,pe,we,"","\\@nsupseteqq");N(L,pe,we,"⊋","\\supsetneq",!0);N(L,pe,we,"","\\@varsupsetneq");N(L,pe,we,"⫌","\\supsetneqq",!0);N(L,pe,we,"","\\@varsupsetneqq");N(L,pe,we,"⊮","\\nVdash",!0);N(L,pe,we,"⪵","\\precneqq",!0);N(L,pe,we,"⪶","\\succneqq",!0);N(L,pe,we,"","\\@nsubseteqq");N(L,pe,_n,"⊴","\\unlhd");N(L,pe,_n,"⊵","\\unrhd");N(L,pe,we,"↚","\\nleftarrow",!0);N(L,pe,we,"↛","\\nrightarrow",!0);N(L,pe,we,"⇍","\\nLeftarrow",!0);N(L,pe,we,"⇏","\\nRightarrow",!0);N(L,pe,we,"↮","\\nleftrightarrow",!0);N(L,pe,we,"⇎","\\nLeftrightarrow",!0);N(L,pe,we,"△","\\vartriangle");N(L,pe,Ee,"ℏ","\\hslash");N(L,pe,Ee,"▽","\\triangledown");N(L,pe,Ee,"◊","\\lozenge");N(L,pe,Ee,"Ⓢ","\\circledS");N(L,pe,Ee,"®","\\circledR");N(Tt,pe,Ee,"®","\\circledR");N(L,pe,Ee,"∡","\\measuredangle",!0);N(L,pe,Ee,"∄","\\nexists");N(L,pe,Ee,"℧","\\mho");N(L,pe,Ee,"Ⅎ","\\Finv",!0);N(L,pe,Ee,"⅁","\\Game",!0);N(L,pe,Ee,"‵","\\backprime");N(L,pe,Ee,"▲","\\blacktriangle");N(L,pe,Ee,"▼","\\blacktriangledown");N(L,pe,Ee,"■","\\blacksquare");N(L,pe,Ee,"⧫","\\blacklozenge");N(L,pe,Ee,"★","\\bigstar");N(L,pe,Ee,"∢","\\sphericalangle",!0);N(L,pe,Ee,"∁","\\complement",!0);N(L,pe,Ee,"ð","\\eth",!0);N(Tt,Y,Ee,"ð","ð");N(L,pe,Ee,"╱","\\diagup");N(L,pe,Ee,"╲","\\diagdown");N(L,pe,Ee,"□","\\square");N(L,pe,Ee,"□","\\Box");N(L,pe,Ee,"◊","\\Diamond");N(L,pe,Ee,"¥","\\yen",!0);N(Tt,pe,Ee,"¥","\\yen",!0);N(L,pe,Ee,"✓","\\checkmark",!0);N(Tt,pe,Ee,"✓","\\checkmark");N(L,pe,Ee,"ℶ","\\beth",!0);N(L,pe,Ee,"ℸ","\\daleth",!0);N(L,pe,Ee,"ℷ","\\gimel",!0);N(L,pe,Ee,"ϝ","\\digamma",!0);N(L,pe,Ee,"ϰ","\\varkappa");N(L,pe,$c,"┌","\\@ulcorner",!0);N(L,pe,jl,"┐","\\@urcorner",!0);N(L,pe,$c,"└","\\@llcorner",!0);N(L,pe,jl,"┘","\\@lrcorner",!0);N(L,pe,we,"≦","\\leqq",!0);N(L,pe,we,"⩽","\\leqslant",!0);N(L,pe,we,"⪕","\\eqslantless",!0);N(L,pe,we,"≲","\\lesssim",!0);N(L,pe,we,"⪅","\\lessapprox",!0);N(L,pe,we,"≊","\\approxeq",!0);N(L,pe,_n,"⋖","\\lessdot");N(L,pe,we,"⋘","\\lll",!0);N(L,pe,we,"≶","\\lessgtr",!0);N(L,pe,we,"⋚","\\lesseqgtr",!0);N(L,pe,we,"⪋","\\lesseqqgtr",!0);N(L,pe,we,"≑","\\doteqdot");N(L,pe,we,"≓","\\risingdotseq",!0);N(L,pe,we,"≒","\\fallingdotseq",!0);N(L,pe,we,"∽","\\backsim",!0);N(L,pe,we,"⋍","\\backsimeq",!0);N(L,pe,we,"⫅","\\subseteqq",!0);N(L,pe,we,"⋐","\\Subset",!0);N(L,pe,we,"⊏","\\sqsubset",!0);N(L,pe,we,"≼","\\preccurlyeq",!0);N(L,pe,we,"⋞","\\curlyeqprec",!0);N(L,pe,we,"≾","\\precsim",!0);N(L,pe,we,"⪷","\\precapprox",!0);N(L,pe,we,"⊲","\\vartriangleleft");N(L,pe,we,"⊴","\\trianglelefteq");N(L,pe,we,"⊨","\\vDash",!0);N(L,pe,we,"⊪","\\Vvdash",!0);N(L,pe,we,"⌣","\\smallsmile");N(L,pe,we,"⌢","\\smallfrown");N(L,pe,we,"≏","\\bumpeq",!0);N(L,pe,we,"≎","\\Bumpeq",!0);N(L,pe,we,"≧","\\geqq",!0);N(L,pe,we,"⩾","\\geqslant",!0);N(L,pe,we,"⪖","\\eqslantgtr",!0);N(L,pe,we,"≳","\\gtrsim",!0);N(L,pe,we,"⪆","\\gtrapprox",!0);N(L,pe,_n,"⋗","\\gtrdot");N(L,pe,we,"⋙","\\ggg",!0);N(L,pe,we,"≷","\\gtrless",!0);N(L,pe,we,"⋛","\\gtreqless",!0);N(L,pe,we,"⪌","\\gtreqqless",!0);N(L,pe,we,"≖","\\eqcirc",!0);N(L,pe,we,"≗","\\circeq",!0);N(L,pe,we,"≜","\\triangleq",!0);N(L,pe,we,"∼","\\thicksim");N(L,pe,we,"≈","\\thickapprox");N(L,pe,we,"⫆","\\supseteqq",!0);N(L,pe,we,"⋑","\\Supset",!0);N(L,pe,we,"⊐","\\sqsupset",!0);N(L,pe,we,"≽","\\succcurlyeq",!0);N(L,pe,we,"⋟","\\curlyeqsucc",!0);N(L,pe,we,"≿","\\succsim",!0);N(L,pe,we,"⪸","\\succapprox",!0);N(L,pe,we,"⊳","\\vartriangleright");N(L,pe,we,"⊵","\\trianglerighteq");N(L,pe,we,"⊩","\\Vdash",!0);N(L,pe,we,"∣","\\shortmid");N(L,pe,we,"∥","\\shortparallel");N(L,pe,we,"≬","\\between",!0);N(L,pe,we,"⋔","\\pitchfork",!0);N(L,pe,we,"∝","\\varpropto");N(L,pe,we,"◀","\\blacktriangleleft");N(L,pe,we,"∴","\\therefore",!0);N(L,pe,we,"∍","\\backepsilon");N(L,pe,we,"▶","\\blacktriangleright");N(L,pe,we,"∵","\\because",!0);N(L,pe,we,"⋘","\\llless");N(L,pe,we,"⋙","\\gggtr");N(L,pe,_n,"⊲","\\lhd");N(L,pe,_n,"⊳","\\rhd");N(L,pe,we,"≂","\\eqsim",!0);N(L,Y,we,"⋈","\\Join");N(L,pe,we,"≑","\\Doteq",!0);N(L,pe,_n,"∔","\\dotplus",!0);N(L,pe,_n,"∖","\\smallsetminus");N(L,pe,_n,"⋒","\\Cap",!0);N(L,pe,_n,"⋓","\\Cup",!0);N(L,pe,_n,"⩞","\\doublebarwedge",!0);N(L,pe,_n,"⊟","\\boxminus",!0);N(L,pe,_n,"⊞","\\boxplus",!0);N(L,pe,_n,"⋇","\\divideontimes",!0);N(L,pe,_n,"⋉","\\ltimes",!0);N(L,pe,_n,"⋊","\\rtimes",!0);N(L,pe,_n,"⋋","\\leftthreetimes",!0);N(L,pe,_n,"⋌","\\rightthreetimes",!0);N(L,pe,_n,"⋏","\\curlywedge",!0);N(L,pe,_n,"⋎","\\curlyvee",!0);N(L,pe,_n,"⊝","\\circleddash",!0);N(L,pe,_n,"⊛","\\circledast",!0);N(L,pe,_n,"⋅","\\centerdot");N(L,pe,_n,"⊺","\\intercal",!0);N(L,pe,_n,"⋒","\\doublecap");N(L,pe,_n,"⋓","\\doublecup");N(L,pe,_n,"⊠","\\boxtimes",!0);N(L,pe,we,"⇢","\\dashrightarrow",!0);N(L,pe,we,"⇠","\\dashleftarrow",!0);N(L,pe,we,"⇇","\\leftleftarrows",!0);N(L,pe,we,"⇆","\\leftrightarrows",!0);N(L,pe,we,"⇚","\\Lleftarrow",!0);N(L,pe,we,"↞","\\twoheadleftarrow",!0);N(L,pe,we,"↢","\\leftarrowtail",!0);N(L,pe,we,"↫","\\looparrowleft",!0);N(L,pe,we,"⇋","\\leftrightharpoons",!0);N(L,pe,we,"↶","\\curvearrowleft",!0);N(L,pe,we,"↺","\\circlearrowleft",!0);N(L,pe,we,"↰","\\Lsh",!0);N(L,pe,we,"⇈","\\upuparrows",!0);N(L,pe,we,"↿","\\upharpoonleft",!0);N(L,pe,we,"⇃","\\downharpoonleft",!0);N(L,Y,we,"⊶","\\origof",!0);N(L,Y,we,"⊷","\\imageof",!0);N(L,pe,we,"⊸","\\multimap",!0);N(L,pe,we,"↭","\\leftrightsquigarrow",!0);N(L,pe,we,"⇉","\\rightrightarrows",!0);N(L,pe,we,"⇄","\\rightleftarrows",!0);N(L,pe,we,"↠","\\twoheadrightarrow",!0);N(L,pe,we,"↣","\\rightarrowtail",!0);N(L,pe,we,"↬","\\looparrowright",!0);N(L,pe,we,"↷","\\curvearrowright",!0);N(L,pe,we,"↻","\\circlearrowright",!0);N(L,pe,we,"↱","\\Rsh",!0);N(L,pe,we,"⇊","\\downdownarrows",!0);N(L,pe,we,"↾","\\upharpoonright",!0);N(L,pe,we,"⇂","\\downharpoonright",!0);N(L,pe,we,"⇝","\\rightsquigarrow",!0);N(L,pe,we,"⇝","\\leadsto");N(L,pe,we,"⇛","\\Rrightarrow",!0);N(L,pe,we,"↾","\\restriction");N(L,Y,Ee,"‘","`");N(L,Y,Ee,"$","\\$");N(Tt,Y,Ee,"$","\\$");N(Tt,Y,Ee,"$","\\textdollar");N(L,Y,Ee,"%","\\%");N(Tt,Y,Ee,"%","\\%");N(L,Y,Ee,"_","\\_");N(Tt,Y,Ee,"_","\\_");N(Tt,Y,Ee,"_","\\textunderscore");N(L,Y,Ee,"∠","\\angle",!0);N(L,Y,Ee,"∞","\\infty",!0);N(L,Y,Ee,"′","\\prime");N(L,Y,Ee,"△","\\triangle");N(L,Y,Ee,"Γ","\\Gamma",!0);N(L,Y,Ee,"Δ","\\Delta",!0);N(L,Y,Ee,"Θ","\\Theta",!0);N(L,Y,Ee,"Λ","\\Lambda",!0);N(L,Y,Ee,"Ξ","\\Xi",!0);N(L,Y,Ee,"Π","\\Pi",!0);N(L,Y,Ee,"Σ","\\Sigma",!0);N(L,Y,Ee,"Υ","\\Upsilon",!0);N(L,Y,Ee,"Φ","\\Phi",!0);N(L,Y,Ee,"Ψ","\\Psi",!0);N(L,Y,Ee,"Ω","\\Omega",!0);N(L,Y,Ee,"A","Α");N(L,Y,Ee,"B","Β");N(L,Y,Ee,"E","Ε");N(L,Y,Ee,"Z","Ζ");N(L,Y,Ee,"H","Η");N(L,Y,Ee,"I","Ι");N(L,Y,Ee,"K","Κ");N(L,Y,Ee,"M","Μ");N(L,Y,Ee,"N","Ν");N(L,Y,Ee,"O","Ο");N(L,Y,Ee,"P","Ρ");N(L,Y,Ee,"T","Τ");N(L,Y,Ee,"X","Χ");N(L,Y,Ee,"¬","\\neg",!0);N(L,Y,Ee,"¬","\\lnot");N(L,Y,Ee,"⊤","\\top");N(L,Y,Ee,"⊥","\\bot");N(L,Y,Ee,"∅","\\emptyset");N(L,pe,Ee,"∅","\\varnothing");N(L,Y,ss,"α","\\alpha",!0);N(L,Y,ss,"β","\\beta",!0);N(L,Y,ss,"γ","\\gamma",!0);N(L,Y,ss,"δ","\\delta",!0);N(L,Y,ss,"ϵ","\\epsilon",!0);N(L,Y,ss,"ζ","\\zeta",!0);N(L,Y,ss,"η","\\eta",!0);N(L,Y,ss,"θ","\\theta",!0);N(L,Y,ss,"ι","\\iota",!0);N(L,Y,ss,"κ","\\kappa",!0);N(L,Y,ss,"λ","\\lambda",!0);N(L,Y,ss,"μ","\\mu",!0);N(L,Y,ss,"ν","\\nu",!0);N(L,Y,ss,"ξ","\\xi",!0);N(L,Y,ss,"ο","\\omicron",!0);N(L,Y,ss,"π","\\pi",!0);N(L,Y,ss,"ρ","\\rho",!0);N(L,Y,ss,"σ","\\sigma",!0);N(L,Y,ss,"τ","\\tau",!0);N(L,Y,ss,"υ","\\upsilon",!0);N(L,Y,ss,"ϕ","\\phi",!0);N(L,Y,ss,"χ","\\chi",!0);N(L,Y,ss,"ψ","\\psi",!0);N(L,Y,ss,"ω","\\omega",!0);N(L,Y,ss,"ε","\\varepsilon",!0);N(L,Y,ss,"ϑ","\\vartheta",!0);N(L,Y,ss,"ϖ","\\varpi",!0);N(L,Y,ss,"ϱ","\\varrho",!0);N(L,Y,ss,"ς","\\varsigma",!0);N(L,Y,ss,"φ","\\varphi",!0);N(L,Y,_n,"∗","*",!0);N(L,Y,_n,"+","+");N(L,Y,_n,"−","-",!0);N(L,Y,_n,"⋅","\\cdot",!0);N(L,Y,_n,"∘","\\circ",!0);N(L,Y,_n,"÷","\\div",!0);N(L,Y,_n,"±","\\pm",!0);N(L,Y,_n,"×","\\times",!0);N(L,Y,_n,"∩","\\cap",!0);N(L,Y,_n,"∪","\\cup",!0);N(L,Y,_n,"∖","\\setminus",!0);N(L,Y,_n,"∧","\\land");N(L,Y,_n,"∨","\\lor");N(L,Y,_n,"∧","\\wedge",!0);N(L,Y,_n,"∨","\\vee",!0);N(L,Y,Ee,"√","\\surd");N(L,Y,$c,"⟨","\\langle",!0);N(L,Y,$c,"∣","\\lvert");N(L,Y,$c,"∥","\\lVert");N(L,Y,jl,"?","?");N(L,Y,jl,"!","!");N(L,Y,jl,"⟩","\\rangle",!0);N(L,Y,jl,"∣","\\rvert");N(L,Y,jl,"∥","\\rVert");N(L,Y,we,"=","=");N(L,Y,we,":",":");N(L,Y,we,"≈","\\approx",!0);N(L,Y,we,"≅","\\cong",!0);N(L,Y,we,"≥","\\ge");N(L,Y,we,"≥","\\geq",!0);N(L,Y,we,"←","\\gets");N(L,Y,we,">","\\gt",!0);N(L,Y,we,"∈","\\in",!0);N(L,Y,we,"","\\@not");N(L,Y,we,"⊂","\\subset",!0);N(L,Y,we,"⊃","\\supset",!0);N(L,Y,we,"⊆","\\subseteq",!0);N(L,Y,we,"⊇","\\supseteq",!0);N(L,pe,we,"⊈","\\nsubseteq",!0);N(L,pe,we,"⊉","\\nsupseteq",!0);N(L,Y,we,"⊨","\\models");N(L,Y,we,"←","\\leftarrow",!0);N(L,Y,we,"≤","\\le");N(L,Y,we,"≤","\\leq",!0);N(L,Y,we,"<","\\lt",!0);N(L,Y,we,"→","\\rightarrow",!0);N(L,Y,we,"→","\\to");N(L,pe,we,"≱","\\ngeq",!0);N(L,pe,we,"≰","\\nleq",!0);N(L,Y,kf," ","\\ ");N(L,Y,kf," ","\\space");N(L,Y,kf," ","\\nobreakspace");N(Tt,Y,kf," ","\\ ");N(Tt,Y,kf," "," ");N(Tt,Y,kf," ","\\space");N(Tt,Y,kf," ","\\nobreakspace");N(L,Y,kf,"","\\nobreak");N(L,Y,kf,"","\\allowbreak");N(L,Y,hk,",",",");N(L,Y,hk,";",";");N(L,pe,_n,"⊼","\\barwedge",!0);N(L,pe,_n,"⊻","\\veebar",!0);N(L,Y,_n,"⊙","\\odot",!0);N(L,Y,_n,"⊕","\\oplus",!0);N(L,Y,_n,"⊗","\\otimes",!0);N(L,Y,Ee,"∂","\\partial",!0);N(L,Y,_n,"⊘","\\oslash",!0);N(L,pe,_n,"⊚","\\circledcirc",!0);N(L,pe,_n,"⊡","\\boxdot",!0);N(L,Y,_n,"△","\\bigtriangleup");N(L,Y,_n,"▽","\\bigtriangledown");N(L,Y,_n,"†","\\dagger");N(L,Y,_n,"⋄","\\diamond");N(L,Y,_n,"⋆","\\star");N(L,Y,_n,"◃","\\triangleleft");N(L,Y,_n,"▹","\\triangleright");N(L,Y,$c,"{","\\{");N(Tt,Y,Ee,"{","\\{");N(Tt,Y,Ee,"{","\\textbraceleft");N(L,Y,jl,"}","\\}");N(Tt,Y,Ee,"}","\\}");N(Tt,Y,Ee,"}","\\textbraceright");N(L,Y,$c,"{","\\lbrace");N(L,Y,jl,"}","\\rbrace");N(L,Y,$c,"[","\\lbrack",!0);N(Tt,Y,Ee,"[","\\lbrack",!0);N(L,Y,jl,"]","\\rbrack",!0);N(Tt,Y,Ee,"]","\\rbrack",!0);N(L,Y,$c,"(","\\lparen",!0);N(L,Y,jl,")","\\rparen",!0);N(Tt,Y,Ee,"<","\\textless",!0);N(Tt,Y,Ee,">","\\textgreater",!0);N(L,Y,$c,"⌊","\\lfloor",!0);N(L,Y,jl,"⌋","\\rfloor",!0);N(L,Y,$c,"⌈","\\lceil",!0);N(L,Y,jl,"⌉","\\rceil",!0);N(L,Y,Ee,"\\","\\backslash");N(L,Y,Ee,"∣","|");N(L,Y,Ee,"∣","\\vert");N(Tt,Y,Ee,"|","\\textbar",!0);N(L,Y,Ee,"∥","\\|");N(L,Y,Ee,"∥","\\Vert");N(Tt,Y,Ee,"∥","\\textbardbl");N(Tt,Y,Ee,"~","\\textasciitilde");N(Tt,Y,Ee,"\\","\\textbackslash");N(Tt,Y,Ee,"^","\\textasciicircum");N(L,Y,we,"↑","\\uparrow",!0);N(L,Y,we,"⇑","\\Uparrow",!0);N(L,Y,we,"↓","\\downarrow",!0);N(L,Y,we,"⇓","\\Downarrow",!0);N(L,Y,we,"↕","\\updownarrow",!0);N(L,Y,we,"⇕","\\Updownarrow",!0);N(L,Y,Lo,"∐","\\coprod");N(L,Y,Lo,"⋁","\\bigvee");N(L,Y,Lo,"⋀","\\bigwedge");N(L,Y,Lo,"⨄","\\biguplus");N(L,Y,Lo,"⋂","\\bigcap");N(L,Y,Lo,"⋃","\\bigcup");N(L,Y,Lo,"∫","\\int");N(L,Y,Lo,"∫","\\intop");N(L,Y,Lo,"∬","\\iint");N(L,Y,Lo,"∭","\\iiint");N(L,Y,Lo,"∏","\\prod");N(L,Y,Lo,"∑","\\sum");N(L,Y,Lo,"⨂","\\bigotimes");N(L,Y,Lo,"⨁","\\bigoplus");N(L,Y,Lo,"⨀","\\bigodot");N(L,Y,Lo,"∮","\\oint");N(L,Y,Lo,"∯","\\oiint");N(L,Y,Lo,"∰","\\oiiint");N(L,Y,Lo,"⨆","\\bigsqcup");N(L,Y,Lo,"∫","\\smallint");N(Tt,Y,ly,"…","\\textellipsis");N(L,Y,ly,"…","\\mathellipsis");N(Tt,Y,ly,"…","\\ldots",!0);N(L,Y,ly,"…","\\ldots",!0);N(L,Y,ly,"⋯","\\@cdots",!0);N(L,Y,ly,"⋱","\\ddots",!0);N(L,Y,Ee,"⋮","\\varvdots");N(Tt,Y,Ee,"⋮","\\varvdots");N(L,Y,$i,"ˊ","\\acute");N(L,Y,$i,"ˋ","\\grave");N(L,Y,$i,"¨","\\ddot");N(L,Y,$i,"~","\\tilde");N(L,Y,$i,"ˉ","\\bar");N(L,Y,$i,"˘","\\breve");N(L,Y,$i,"ˇ","\\check");N(L,Y,$i,"^","\\hat");N(L,Y,$i,"⃗","\\vec");N(L,Y,$i,"˙","\\dot");N(L,Y,$i,"˚","\\mathring");N(L,Y,ss,"","\\@imath");N(L,Y,ss,"","\\@jmath");N(L,Y,Ee,"ı","ı");N(L,Y,Ee,"ȷ","ȷ");N(Tt,Y,Ee,"ı","\\i",!0);N(Tt,Y,Ee,"ȷ","\\j",!0);N(Tt,Y,Ee,"ß","\\ss",!0);N(Tt,Y,Ee,"æ","\\ae",!0);N(Tt,Y,Ee,"œ","\\oe",!0);N(Tt,Y,Ee,"ø","\\o",!0);N(Tt,Y,Ee,"Æ","\\AE",!0);N(Tt,Y,Ee,"Œ","\\OE",!0);N(Tt,Y,Ee,"Ø","\\O",!0);N(Tt,Y,$i,"ˊ","\\'");N(Tt,Y,$i,"ˋ","\\`");N(Tt,Y,$i,"ˆ","\\^");N(Tt,Y,$i,"˜","\\~");N(Tt,Y,$i,"ˉ","\\=");N(Tt,Y,$i,"˘","\\u");N(Tt,Y,$i,"˙","\\.");N(Tt,Y,$i,"¸","\\c");N(Tt,Y,$i,"˚","\\r");N(Tt,Y,$i,"ˇ","\\v");N(Tt,Y,$i,"¨",'\\"');N(Tt,Y,$i,"˝","\\H");N(Tt,Y,$i,"◯","\\textcircled");var bZ={"--":!0,"---":!0,"``":!0,"''":!0};N(Tt,Y,Ee,"–","--",!0);N(Tt,Y,Ee,"–","\\textendash");N(Tt,Y,Ee,"—","---",!0);N(Tt,Y,Ee,"—","\\textemdash");N(Tt,Y,Ee,"‘","`",!0);N(Tt,Y,Ee,"‘","\\textquoteleft");N(Tt,Y,Ee,"’","'",!0);N(Tt,Y,Ee,"’","\\textquoteright");N(Tt,Y,Ee,"“","``",!0);N(Tt,Y,Ee,"“","\\textquotedblleft");N(Tt,Y,Ee,"”","''",!0);N(Tt,Y,Ee,"”","\\textquotedblright");N(L,Y,Ee,"°","\\degree",!0);N(Tt,Y,Ee,"°","\\degree");N(Tt,Y,Ee,"°","\\textdegree",!0);N(L,Y,Ee,"£","\\pounds");N(L,Y,Ee,"£","\\mathsterling",!0);N(Tt,Y,Ee,"£","\\pounds");N(Tt,Y,Ee,"£","\\textsterling",!0);N(L,pe,Ee,"✠","\\maltese");N(Tt,pe,Ee,"✠","\\maltese");var Zz='0123456789/@."';for(var J8=0;J8<Zz.length;J8++){var eF=Zz.charAt(J8);N(L,Y,Ee,eF,eF)}var tF='0123456789!@*()-=+";:?/.,';for(var Z8=0;Z8<tF.length;Z8++){var nF=tF.charAt(Z8);N(Tt,Y,Ee,nF,nF)}var vC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var e7=0;e7<vC.length;e7++){var cS=vC.charAt(e7);N(L,Y,ss,cS,cS),N(Tt,Y,Ee,cS,cS)}N(L,pe,Ee,"C","ℂ");N(Tt,pe,Ee,"C","ℂ");N(L,pe,Ee,"H","ℍ");N(Tt,pe,Ee,"H","ℍ");N(L,pe,Ee,"N","ℕ");N(Tt,pe,Ee,"N","ℕ");N(L,pe,Ee,"P","ℙ");N(Tt,pe,Ee,"P","ℙ");N(L,pe,Ee,"Q","ℚ");N(Tt,pe,Ee,"Q","ℚ");N(L,pe,Ee,"R","ℝ");N(Tt,pe,Ee,"R","ℝ");N(L,pe,Ee,"Z","ℤ");N(Tt,pe,Ee,"Z","ℤ");N(L,Y,ss,"h","ℎ");N(Tt,Y,ss,"h","ℎ");var fs;for(var ol=0;ol<vC.length;ol++){var Ji=vC.charAt(ol);fs=String.fromCharCode(55349,56320+ol),N(L,Y,ss,Ji,fs),N(Tt,Y,Ee,Ji,fs),fs=String.fromCharCode(55349,56372+ol),N(L,Y,ss,Ji,fs),N(Tt,Y,Ee,Ji,fs),fs=String.fromCharCode(55349,56424+ol),N(L,Y,ss,Ji,fs),N(Tt,Y,Ee,Ji,fs),fs=String.fromCharCode(55349,56580+ol),N(L,Y,ss,Ji,fs),N(Tt,Y,Ee,Ji,fs),fs=String.fromCharCode(55349,56684+ol),N(L,Y,ss,Ji,fs),N(Tt,Y,Ee,Ji,fs),fs=String.fromCharCode(55349,56736+ol),N(L,Y,ss,Ji,fs),N(Tt,Y,Ee,Ji,fs),fs=String.fromCharCode(55349,56788+ol),N(L,Y,ss,Ji,fs),N(Tt,Y,Ee,Ji,fs),fs=String.fromCharCode(55349,56840+ol),N(L,Y,ss,Ji,fs),N(Tt,Y,Ee,Ji,fs),fs=String.fromCharCode(55349,56944+ol),N(L,Y,ss,Ji,fs),N(Tt,Y,Ee,Ji,fs),ol<26&&(fs=String.fromCharCode(55349,56632+ol),N(L,Y,ss,Ji,fs),N(Tt,Y,Ee,Ji,fs),fs=String.fromCharCode(55349,56476+ol),N(L,Y,ss,Ji,fs),N(Tt,Y,Ee,Ji,fs))}fs="𝕜";N(L,Y,ss,"k",fs);N(Tt,Y,Ee,"k",fs);for(var Kp=0;Kp<10;Kp++){var zf=Kp.toString();fs=String.fromCharCode(55349,57294+Kp),N(L,Y,ss,zf,fs),N(Tt,Y,Ee,zf,fs),fs=String.fromCharCode(55349,57314+Kp),N(L,Y,ss,zf,fs),N(Tt,Y,Ee,zf,fs),fs=String.fromCharCode(55349,57324+Kp),N(L,Y,ss,zf,fs),N(Tt,Y,Ee,zf,fs),fs=String.fromCharCode(55349,57334+Kp),N(L,Y,ss,zf,fs),N(Tt,Y,Ee,zf,fs)}var FA="ÐÞþ";for(var t7=0;t7<FA.length;t7++){var uS=FA.charAt(t7);N(L,Y,ss,uS,uS),N(Tt,Y,Ee,uS,uS)}var HA={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},sF={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},rF={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},a3e={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},f0={mathClass:"",textClass:"",font:""},iF={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},oF={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},aF={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},qA={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},UA={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},lF={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},WA={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},cF=[HA,HA,sF,sF,rF,rF,a3e,f0,f0,f0,iF,iF,oF,oF,aF,aF,qA,qA,UA,UA,lF,lF,f0,f0,WA,WA],l3e=[HA,f0,qA,UA,WA],c3e=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 cF[r]}else if(120782<=s&&s<=120831){var i=Math.floor((s-120782)/10);return l3e[i]}else{if(s===120485||s===120486)return cF[0];if(120486<s&&s<120782)return f0;throw new Pt("Unsupported character: "+e)}},hT=function(t,n,s){if(Li[s][t]){var r=Li[s][t].replace;r&&(t=r)}return{value:t,metrics:uR(t,n,s)}},ul=function(t,n,s,r,i){var o=hT(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 Lc(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 Lc(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},dR=function(t,n,s,r){return r===void 0&&(r=[]),s.font==="boldsymbol"&&hT(t,"Main-Bold",n).metrics?ul(t,"Main-Bold",n,s,r.concat(["mathbf"])):t==="\\"||Li[n][t].font==="main"?ul(t,"Main-Regular",n,s,r):ul(t,"AMS-Regular",n,s,r.concat(["amsrm"]))},u3e=function(t,n,s){return s!=="textord"&&hT(t,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},fT=function(t,n,s){var r=t.mode,i=t.text,o=["mord"],{font:a,fontFamily:c,fontWeight:u,fontShape:d}=n,f=r==="math"||r==="text"&&!!a,m=f?a:c,p="",g="";if(i.charCodeAt(0)===55349){var b=c3e(i);p=b.font,g=b[r+"Class"]}if(p)return ul(i,p,r,n,o.concat(g));if(m){var v,y;if(m==="boldsymbol"){var w=u3e(i,r,s);v=w.fontName,y=[w.fontClass]}else f?(v=VA[a].fontName,y=[a]):(v=dS(c,u,d),y=[c,u,d]);if(hT(i,v,r).metrics)return ul(i,v,r,n,o.concat(y));if(bZ.hasOwnProperty(i)&&v.slice(0,10)==="Typewriter"){for(var x=[],k=0;k<i.length;k++)x.push(ul(i[k],v,r,n,o.concat(y)));return _f(x)}}if(s==="mathord")return ul(i,"Math-Italic",r,n,o.concat(["mathnormal"]));if(s==="textord"){var C=Li[r][i]&&Li[r][i].font;if(C==="ams"){var T=dS("amsrm",u,d);return ul(i,T,r,n,o.concat("amsrm",u,d))}else if(C==="main"||!C){var _=dS("textrm",u,d);return ul(i,_,r,n,o.concat(u,d))}else{var S=dS(C,u,d);return ul(i,S,r,n,o.concat(S,u,d))}}else throw new Error("unexpected type: "+s+" in makeOrd")},d3e=(e,t)=>{if(qm(e.classes)!==qm(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},yZ=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],s=e[t+1];n instanceof Lc&&s instanceof Lc&&d3e(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},hR=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},Nt=function(t,n,s,r){var i=new ay(t,n,s,r);return hR(i),i},Wm=(e,t,n,s)=>new ay(e,t,n,s),jb=function(t,n,s){var r=Nt([t],[],n);return r.height=Math.max(s||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),r.style.borderBottomWidth=Gt(r.height),r.maxFontSize=1,r},h3e=function(t,n,s,r){var i=new dT(t,n,s,r);return hR(i),i},_f=function(t){var n=new oy(t);return hR(n),n},Ab=function(t,n){return t instanceof oy?Nt([],[t],n):t},f3e=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,f=0;f<t.children.length;f++){var m=t.children[f];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}},Dr=function(t,n){for(var{children:s,depth:r}=f3e(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=Nt(["pstrut"],[]);u.style.height=Gt(i);for(var d=[],f=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,y=b.wrapperClasses||[],w=b.wrapperStyle||{},x=Nt(y,[u,v],void 0,w);x.style.top=Gt(-i-p-v.depth),b.marginLeft&&(x.style.marginLeft=b.marginLeft),b.marginRight&&(x.style.marginRight=b.marginRight),d.push(x),p+=v.height+v.depth}f=Math.min(f,p),m=Math.max(m,p)}var k=Nt(["vlist"],d);k.style.height=Gt(m);var C;if(f<0){var T=Nt([],[]),_=Nt(["vlist"],[T]);_.style.height=Gt(-f);var S=Nt(["vlist-s"],[new Lc("​")]);C=[Nt(["vlist-r"],[k,S]),Nt(["vlist-r"],[_])]}else C=[Nt(["vlist-r"],[k])];var R=Nt(["vlist-t"],C);return C.length===2&&R.classes.push("vlist-t2"),R.height=m,R.depth=-f,R},wZ=(e,t)=>{var n=Nt(["mspace"],[],t),s=Xi(e,t);return n.style.marginRight=Gt(s),n},dS=(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},VA={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"}},vZ={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},xZ=function(t,n){var[s,r,i]=vZ[t],o=new Um(s),a=new ff([o],{width:Gt(r),height:Gt(i),style:"width:"+Gt(r),viewBox:"0 0 "+1e3*r+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),c=Wm(["overlay"],[a],n);return c.height=i,c.style.height=Gt(i),c.style.width=Gt(r),c},qi={number:3,unit:"mu"},Yp={number:4,unit:"mu"},Ch={number:5,unit:"mu"},m3e={mord:{mop:qi,mbin:Yp,mrel:Ch,minner:qi},mop:{mord:qi,mop:qi,mrel:Ch,minner:qi},mbin:{mord:Yp,mop:Yp,mopen:Yp,minner:Yp},mrel:{mord:Ch,mop:Ch,mopen:Ch,minner:Ch},mopen:{},mclose:{mop:qi,mbin:Yp,mrel:Ch,minner:qi},mpunct:{mord:qi,mop:qi,mrel:Ch,mopen:qi,mclose:qi,mpunct:qi,minner:qi},minner:{mord:qi,mop:qi,mbin:Yp,mrel:Ch,mopen:qi,mpunct:qi,minner:qi}},p3e={mord:{mop:qi},mop:{mord:qi,mop:qi},mbin:{},mrel:{},mopen:{},mclose:{mop:qi},mpunct:{},minner:{mop:qi}},kZ={},xC={},kC={};function pn(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)kZ[n[c]]=a;t&&(i&&(xC[t]=i),o&&(kC[t]=o))}function mg(e){var{type:t,htmlBuilder:n,mathmlBuilder:s}=e;pn({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:s})}var _C=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},Io=function(t){return t.type==="ordgroup"?t.body:[t]},g3e=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),b3e=new Set(["rightmost","mrel","mclose","mpunct"]),y3e={display:_s.DISPLAY,text:_s.TEXT,script:_s.SCRIPT,scriptscript:_s.SCRIPTSCRIPT},w3e={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Qo=function(t,n,s,r){r===void 0&&(r=[null,null]);for(var i=[],o=0;o<t.length;o++){var a=Or(t[o],n);if(a instanceof oy){var c=a.children;i.push(...c)}else i.push(a)}if(yZ(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(y3e[d.style]))}var f=Nt([r[0]||"leftmost"],[],n),m=Nt([r[1]||"rightmost"],[],n),p=s==="root";return GA(i,(g,b)=>{var v=b.classes[0],y=g.classes[0];v==="mbin"&&b3e.has(y)?b.classes[0]="mord":y==="mbin"&&g3e.has(v)&&(g.classes[0]="mord")},{node:f},m,p),GA(i,(g,b)=>{var v,y,w=YA(b),x=YA(g),k=w&&x?g.hasClass("mtight")?(v=p3e[w])==null?void 0:v[x]:(y=m3e[w])==null?void 0:y[x]:null;if(k)return wZ(k,u)},{node:f},m,p),i},GA=function(t,n,s,r,i){r&&t.push(r);for(var o=0;o<t.length;o++){var a=t[o],c=_Z(a);if(c){GA(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=Nt(["leftmost"])),s.insertAfter=(f=>m=>{t.splice(f+1,0,m),o++})(o)}r&&t.pop()},_Z=function(t){return t instanceof oy||t instanceof dT||t instanceof ay&&t.hasClass("enclosing")?t:null},KA=function(t,n){var s=_Z(t);if(s){var r=s.children;if(r.length){if(n==="right")return KA(r[r.length-1],"right");if(n==="left")return KA(r[0],"left")}}return t},YA=function(t,n){if(!t)return null;n&&(t=KA(t,n));var s=t.classes[0];return w3e[s]||null},ex=function(t,n){var s=["nulldelimiter"].concat(t.baseSizingClasses());return Nt(n.concat(s))},Or=function(t,n,s){if(!t)return Nt();if(xC[t.type]){var r=xC[t.type](t,n);if(s&&n.size!==s.size){r=Nt(n.sizingClasses(s),[r],n);var i=n.sizeMultiplier/s.sizeMultiplier;r.height*=i,r.depth*=i}return r}else throw new Pt("Got group of unknown type: '"+t.type+"'")};function hS(e,t){var n=Nt(["base"],e,t),s=Nt(["strut"]);return s.style.height=Gt(n.height+n.depth),n.depth&&(s.style.verticalAlign=Gt(-n.depth)),n.children.unshift(s),n}function XA(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var s=Qo(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(hS(o,t)),o=[])}else s[a].hasClass("newline")&&(o.pop(),o.length>0&&(i.push(hS(o,t)),o=[]),i.push(s[a]));o.length>0&&i.push(hS(o,t));var u;n?(u=hS(Qo(n,t,!0),t),u.classes=["tag"],i.push(u)):r&&i.push(r);var d=Nt(["katex-html"],i);if(d.setAttribute("aria-hidden","true"),u){var f=u.children[0];f.style.height=Gt(d.height+d.depth),d.depth&&(f.style.verticalAlign=Gt(-d.depth))}return d}function SZ(e){return new oy(e)}class Bt{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=qm(this.classes));for(var s=0;s<this.children.length;s++)if(this.children[s]instanceof Ro&&this.children[s+1]instanceof Ro){for(var r=this.children[s].toText()+this.children[++s].toText();this.children[s+1]instanceof Ro;)r+=this.children[++s].toText();t.appendChild(new Ro(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+=Ga(this.attributes[n]),t+='"');this.classes.length>0&&(t+=' class ="'+Ga(qm(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 Ro=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return Ga(this.toText())}toText(){return this.text}};class CZ{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",Gt(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Gt(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var v3e=new Set(["\\imath","\\jmath"]),x3e=new Set(["mrow","mtable"]),vu=function(t,n,s){return Li[n][t]&&Li[n][t].replace&&t.charCodeAt(0)!==55349&&!(bZ.hasOwnProperty(t)&&s&&(s.fontFamily&&s.fontFamily.slice(4,6)==="tt"||s.font&&s.font.slice(4,6)==="tt"))&&(t=Li[n][t].replace),new Ro(t)},fR=function(t){return t.length===1?t[0]:new Bt("mrow",t)},k3e={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"},mR=(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=k3e[n];if(r)return typeof r=="function"?r(e):r;var i=e.text;if(v3e.has(i))return null;if(Li[s][i]){var o=Li[s][i].replace;o&&(i=o)}var a=VA[n].fontName;return uR(i,a,s)?VA[n].variant:null};function n7(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof Ro&&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 Ro&&n.text===","}else return!1}var Bc=function(t,n,s){if(t.length===1){var r=mi(t[0],n);return s&&r instanceof Bt&&r.type==="mo"&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}for(var i=[],o,a=0;a<t.length;a++){var c=mi(t[a],n);if(c instanceof Bt&&o instanceof Bt){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(n7(c)&&o.type==="mn"){o.children.push(...c.children);continue}else if(c.type==="mn"&&n7(o))c.children=[...o.children,...c.children],i.pop();else if((c.type==="msup"||c.type==="msub")&&c.children.length>=1&&(o.type==="mn"||n7(o))){var u=c.children[0];u instanceof Bt&&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 Ro&&d.text==="̸"&&(c.type==="mo"||c.type==="mi"||c.type==="mn")){var f=c.children[0];f instanceof Ro&&f.text.length>0&&(f.text=f.text.slice(0,1)+"̸"+f.text.slice(1),i.pop())}}}i.push(c),o=c}return i},Vm=function(t,n,s){return fR(Bc(t,n,s))},mi=function(t,n){if(!t)return new Bt("mrow");if(kC[t.type])return kC[t.type](t,n);throw new Pt("Got group of unknown type: '"+t.type+"'")};function uF(e,t,n,s,r){var i=Bc(e,n),o;i.length===1&&i[0]instanceof Bt&&x3e.has(i[0].type)?o=i[0]:o=new Bt("mrow",i);var a=new Bt("annotation",[new Ro(t)]);a.setAttribute("encoding","application/x-tex");var c=new Bt("semantics",[o,a]),u=new Bt("math",[c]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),s&&u.setAttribute("display","block");var d=r?"katex":"katex-mathml";return Nt([d],[u])}var _3e=[[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]],dF=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],hF=function(t,n){return n.size<2?t:_3e[t-1][n.size-1]};class Ih{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||Ih.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=dF[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 Ih(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:hF(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:dF[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=hF(Ih.BASESIZE,t);return this.size===n&&this.textSize===Ih.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!==Ih.BASESIZE?["sizing","reset-size"+this.size,"size"+Ih.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=o3e(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Ih.BASESIZE=6;var TZ=function(t){return new Ih({style:t.displayMode?_s.DISPLAY:_s.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},EZ=function(t,n){if(n.displayMode){var s=["katex-display"];n.leqno&&s.push("leqno"),n.fleqn&&s.push("fleqn"),t=Nt(s,[t])}return t},S3e=function(t,n,s){var r=TZ(s),i;if(s.output==="mathml")return uF(t,n,r,s.displayMode,!0);if(s.output==="html"){var o=XA(t,r);i=Nt(["katex"],[o])}else{var a=uF(t,n,r,s.displayMode,!1),c=XA(t,r);i=Nt(["katex"],[a,c])}return EZ(i,s)},C3e=function(t,n,s){var r=TZ(s),i=XA(t,r),o=Nt(["katex"],[i]);return EZ(o,s)},T3e={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":"="},mT=function(t){var n=new Bt("mo",[new Ro(T3e[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},E3e={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]},j3e=new Set(["widehat","widecheck","widetilde","utilde"]),pT=function(t,n){function s(){var a=4e5,c=t.label.slice(1);if(j3e.has(c)&&"base"in t){var u=t.base.type==="ordgroup"?t.base.body.length:1,d,f,m;if(u>5)c==="widehat"||c==="widecheck"?(d=420,a=2364,m=.42,f=c+"4"):(d=312,a=2340,m=.34,f="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],f=c+p):(a=[0,600,1033,2339,2340][p],d=[0,260,286,306,312][p],m=[0,.26,.286,.3,.306,.34][p],f="tilde"+p)}var g=new Um(f),b=new ff([g],{width:"100%",height:Gt(m),viewBox:"0 0 "+a+" "+d,preserveAspectRatio:"none"});return{span:Wm([],[b],n),minWidth:0,height:m}}else{var v=[],y=E3e[c];if(!y)throw new Error('No SVG data for "'+c+'".');var[w,x,k]=y,C=k/1e3,T=w.length,_,S;if(T===1){if(y.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+c+'".');_=["hide-tail"],S=[y[3]]}else if(T===2)_=["halfarrow-left","halfarrow-right"],S=["xMinYMin","xMaxYMin"];else if(T===3)_=["brace-left","brace-center","brace-right"],S=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+T+" children.");for(var R=0;R<T;R++){var A=new Um(w[R]),O=new ff([A],{width:"400em",height:Gt(C),viewBox:"0 0 "+a+" "+k,preserveAspectRatio:S[R]+" slice"}),M=Wm([_[R]],[O],n);if(T===1)return{span:M,minWidth:x,height:C};M.style.height=Gt(C),v.push(M)}return{span:Nt(["stretchy"],v,n),minWidth:x,height:C}}}var{span:r,minWidth:i,height:o}=s();return r.height=o,r.style.height=Gt(o),i>0&&(r.style.minWidth=Gt(i)),r},A3e=function(t,n,s,r,i){var o,a=t.height+t.depth+s+r;if(/fbox|color|angl/.test(n)){if(o=Nt(["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 zA({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&u.push(new zA({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var d=new ff(u,{width:"100%",height:Gt(a)});o=Wm([],[d],i)}return o.height=a,o.style.height=Gt(a),o},N3e={bin:1,close:1,inner:1,open:1,punct:1,rel:1},M3e={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function I3e(e){return e in N3e}function Ls(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 gT(e){var t=bT(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 bT(e){return e&&(e.type==="atom"||M3e.hasOwnProperty(e.type))?e:null}var jZ=e=>{if(e instanceof Lc)return e;if(i3e(e)&&e.children.length===1)return jZ(e.children[0])},pR=(e,t)=>{var n,s,r;e&&e.type==="supsub"?(s=Ls(e.base,"accent"),n=s.base,e.base=n,r=r3e(Or(e,t)),e.base=s):(s=Ls(e,"accent"),n=s.base);var i=Or(n,t.havingCrampedStyle()),o=s.isShifty&&xf(n),a=0;if(o){var c,u;a=(c=(u=jZ(i))==null?void 0:u.skew)!=null?c:0}var d=s.label==="\\c",f=d?i.height+i.depth:Math.min(i.height,t.fontMetrics().xHeight),m;if(s.isStretchy)m=pT(s,t),m=Dr({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:m,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+Gt(2*a)+")",marginLeft:Gt(2*a)}:void 0}]});else{var p,g;s.label==="\\vec"?(p=xZ("vec",t),g=vZ.vec[1]):(p=fT({mode:s.mode,text:s.label},t,"textord"),p=s3e(p),p.italic=0,g=p.width,d&&(f+=p.depth)),m=Nt(["accent-body"],[p]);var b=s.label==="\\textcircled";b&&(m.classes.push("accent-full"),f=i.height);var v=a;b||(v-=g/2),m.style.left=Gt(v),s.label==="\\textcircled"&&(m.style.top=".2em"),m=Dr({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-f},{type:"elem",elem:m}]})}var y=Nt(["mord","accent"],[m],t);return r?(r.children[0]=y,r.height=Math.max(y.height,r.height),r.classes[0]="mord",r):y},AZ=(e,t)=>{var n=e.isStretchy?mT(e.label):new Bt("mo",[vu(e.label,e.mode)]),s=new Bt("mover",[mi(e.base,t),n]);return s.setAttribute("accent","true"),s},R3e=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));pn({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=_C(t[0]),s=!R3e.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:pR,mathmlBuilder:AZ});pn({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:pR,mathmlBuilder:AZ});pn({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=Or(e.base,t),s=pT(e,t),r=e.label==="\\utilde"?.12:0,i=Dr({positionType:"top",positionData:n.height,children:[{type:"elem",elem:s,wrapperClasses:["svg-align"]},{type:"kern",size:r},{type:"elem",elem:n}]});return Nt(["mord","accentunder"],[i],t)},mathmlBuilder:(e,t)=>{var n=mT(e.label),s=new Bt("munder",[mi(e.base,t),n]);return s.setAttribute("accentunder","true"),s}});var fS=e=>{var t=new Bt("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};pn({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=Ab(Or(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=Ab(Or(e.below,s,t),t),o.classes.push(i+"-arrow-pad"));var a=pT(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 f=-t.fontMetrics().axisHeight+o.height+.5*a.height+.111;d=Dr({positionType:"individualShift",children:[{type:"elem",elem:r,shift:u},{type:"elem",elem:a,shift:c,wrapperClasses:["svg-align"]},{type:"elem",elem:o,shift:f}]})}else d=Dr({positionType:"individualShift",children:[{type:"elem",elem:r,shift:u},{type:"elem",elem:a,shift:c,wrapperClasses:["svg-align"]}]});return Nt(["mrel","x-arrow"],[d],t)},mathmlBuilder(e,t){var n=mT(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var s;if(e.body){var r=fS(mi(e.body,t));if(e.below){var i=fS(mi(e.below,t));s=new Bt("munderover",[n,i,r])}else s=new Bt("mover",[n,r])}else if(e.below){var o=fS(mi(e.below,t));s=new Bt("munder",[n,o])}else s=fS(),s=new Bt("mover",[n,s]);return s}});function NZ(e,t){var n=Qo(e.body,t,!0);return Nt([e.mclass],n,t)}function MZ(e,t){var n,s=Bc(e.body,t);return e.mclass==="minner"?n=new Bt("mpadded",s):e.mclass==="mord"?e.isCharacterBox?(n=s[0],n.type="mi"):n=new Bt("mi",s):(e.isCharacterBox?(n=s[0],n.type="mo"):n=new Bt("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}pn({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:Io(r),isCharacterBox:xf(r)}},htmlBuilder:NZ,mathmlBuilder:MZ});var yT=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"};pn({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:yT(t[0]),body:Io(t[1]),isCharacterBox:xf(t[1])}}});pn({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=yT(r):o="mrel";var a={type:"op",mode:r.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:s!=="\\stackrel",body:Io(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:xf(c)}},htmlBuilder:NZ,mathmlBuilder:MZ});pn({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:yT(t[0]),body:Io(t[0])}},htmlBuilder(e,t){var n=Qo(e.body,t,!0),s=Nt([e.mclass],n,t);return s.style.textShadow="0.02em 0.01em 0.04px",s},mathmlBuilder(e,t){var n=Bc(e.body,t),s=new Bt("mstyle",n);return s.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),s}});var D3e={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},fF=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),mF=e=>e.type==="textord"&&e.text==="@",P3e=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function L3e(e,t,n){var s=D3e[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 O3e(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 Pt("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var s=[],r=[s],i=0;i<t.length;i++){for(var o=t[i],a=fF(),c=0;c<o.length;c++)if(!mF(o[c]))a.body.push(o[c]);else{s.push(a),c+=1;var u=gT(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 f=0;f<2;f++){for(var m=!0,p=c+1;p<o.length;p++){if(P3e(o[p],u)){m=!1,c=p;break}if(mF(o[p]))throw new Pt("Missing a "+u+" character to complete a CD arrow.",o[p]);d[f].body.push(o[p])}if(m)throw new Pt("Missing a "+u+" character to complete a CD arrow.",o[c])}else throw new Pt('Expected one of "<>AV=|." after @',o[c]);var g=L3e(u,d,e),b={type:"styling",body:[g],mode:"math",style:"display",resetFont:!0};s.push(b),a=fF()}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([])}}pn({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=Ab(Or(e.label,n,t),t);return s.classes.push("cd-label-"+e.side),s.style.bottom=Gt(.8-s.depth),s.height=0,s.depth=0,s},mathmlBuilder(e,t){var n=new Bt("mrow",[mi(e.label,t)]);return n=new Bt("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Bt("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});pn({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=Ab(Or(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new Bt("mrow",[mi(e.fragment,t)])}});pn({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,s=Ls(t[0],"ordgroup"),r=s.body,i="",o=0;o<r.length;o++){var a=Ls(r[o],"textord");i+=a.text}var c=parseInt(i),u;if(isNaN(c))throw new Pt("\\@char has non-numeric argument "+i);if(c<0||c>=1114111)throw new Pt("\\@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 IZ=(e,t)=>{var n=Qo(e.body,t.withColor(e.color),!1);return _f(n)},RZ=(e,t)=>{var n=Bc(e.body,t.withColor(e.color)),s=new Bt("mstyle",n);return s.setAttribute("mathcolor",e.color),s};pn({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,s=Ls(t[0],"color-token").color,r=t[1];return{type:"color",mode:n.mode,color:s,body:Io(r)}},htmlBuilder:IZ,mathmlBuilder:RZ});pn({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:s}=e,r=Ls(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:IZ,mathmlBuilder:RZ});pn({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&&Ls(r,"size").value}},htmlBuilder(e,t){var n=Nt(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=Gt(Xi(e.size,t)))),n},mathmlBuilder(e,t){var n=new Bt("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",Gt(Xi(e.size,t)))),n}});var QA={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},DZ=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new Pt("Expected a control sequence",e);return t},$3e=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},PZ=(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)};pn({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(QA[s.text])return(n==="\\global"||n==="\\\\globallong")&&(s.text=QA[s.text]),Ls(t.parseFunction(),"internal");throw new Pt("Invalid token after macro prefix",s)}});pn({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 Pt("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 Pt('Invalid argument number "'+s.text+'"');if(parseInt(s.text)!==i+1)throw new Pt('Argument number "'+s.text+'" out of order');i++,a.push([])}else{if(s.text==="EOF")throw new Pt("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===QA[n]),{type:"internal",mode:t.mode}}});pn({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=DZ(t.gullet.popToken());t.gullet.consumeSpaces();var r=$3e(t);return PZ(t,s,r,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});pn({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=DZ(t.gullet.popToken()),r=t.gullet.popToken(),i=t.gullet.popToken();return PZ(t,s,i,n==="\\\\globalfuture"),t.gullet.pushToken(i),t.gullet.pushToken(r),{type:"internal",mode:t.mode}}});var Ow=function(t,n,s){var r=Li.math[t]&&Li.math[t].replace,i=uR(r||t,n,s);if(!i)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return i},gR=function(t,n,s,r){var i=s.havingBaseStyle(n),o=Nt(r.concat(i.sizingClasses(s)),[t],s),a=i.sizeMultiplier/s.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=i.sizeMultiplier,o},LZ=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=Gt(i),t.height-=i,t.depth+=i},B3e=function(t,n,s,r,i,o){var a=ul(t,"Main-Regular",i,r),c=gR(a,n,r,o);return LZ(c,r,n),c},z3e=function(t,n,s,r){return ul(t,"Size"+n+"-Regular",s,r)},OZ=function(t,n,s,r,i,o){var a=z3e(t,n,i,r),c=gR(Nt(["delimsizing","size"+n],[a],r),_s.TEXT,r,o);return s&&LZ(c,r,_s.TEXT),c},s7=function(t,n,s){var r;n==="Size1-Regular"?r="delim-size1":r="delim-size4";var i=Nt(["delimsizinginner",r],[Nt([],[ul(t,n,s)])]);return{type:"elem",elem:i}},r7=function(t,n,s){var r=Id["Size4-Regular"][t.charCodeAt(0)]?Id["Size4-Regular"][t.charCodeAt(0)][4]:Id["Size1-Regular"][t.charCodeAt(0)][4],i=new Um("inner",XCe(t,Math.round(1e3*n))),o=new ff([i],{width:Gt(r),height:Gt(n),style:"width:"+Gt(r),viewBox:"0 0 "+1e3*r+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),a=Wm([],[o],s);return a.height=n,a.style.height=Gt(n),a.style.width=Gt(r),{type:"elem",elem:a}},JA=.008,mS={type:"kern",size:-1*JA},F3e=new Set(["|","\\lvert","\\rvert","\\vert"]),H3e=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),$Z=function(t,n,s,r,i,o){var a,c,u,d,f="",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"):F3e.has(t)?(u="∣",f="vert",m=333):H3e.has(t)?(u="∥",f="doublevert",m=556):t==="["||t==="\\lbrack"?(a="⎡",u="⎢",d="⎣",p="Size4-Regular",f="lbrack",m=667):t==="]"||t==="\\rbrack"?(a="⎤",u="⎥",d="⎦",p="Size4-Regular",f="rbrack",m=667):t==="\\lfloor"||t==="⌊"?(u=a="⎢",d="⎣",p="Size4-Regular",f="lfloor",m=667):t==="\\lceil"||t==="⌈"?(a="⎡",u=d="⎢",p="Size4-Regular",f="lceil",m=667):t==="\\rfloor"||t==="⌋"?(u=a="⎥",d="⎦",p="Size4-Regular",f="rfloor",m=667):t==="\\rceil"||t==="⌉"?(a="⎤",u=d="⎥",p="Size4-Regular",f="rceil",m=667):t==="("||t==="\\lparen"?(a="⎛",u="⎜",d="⎝",p="Size4-Regular",f="lparen",m=875):t===")"||t==="\\rparen"?(a="⎞",u="⎟",d="⎠",p="Size4-Regular",f="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=Ow(a,p,i),b=g.height+g.depth,v=Ow(u,p,i),y=v.height+v.depth,w=Ow(d,p,i),x=w.height+w.depth,k=0,C=1;if(c!==null){var T=Ow(c,p,i);k=T.height+T.depth,C=2}var _=b+x+k,S=Math.max(0,Math.ceil((n-_)/(C*y))),R=_+S*C*y,A=r.fontMetrics().axisHeight;s&&(A*=r.sizeMultiplier);var O=R/2-A,M=[];if(f.length>0){var D=R-b-x,$=Math.round(R*1e3),z=QCe(f,Math.round(D*1e3)),B=new Um(f,z),j=Gt(m/1e3),H=Gt($/1e3),Q=new ff([B],{width:j,height:H,viewBox:"0 0 "+m+" "+$}),I=Wm([],[Q],r);I.height=$/1e3,I.style.width=j,I.style.height=H,M.push({type:"elem",elem:I})}else{if(M.push(s7(d,p,i)),M.push(mS),c===null){var J=R-b-x+2*JA;M.push(r7(u,J,r))}else{var W=(R-b-x-k)/2+2*JA;M.push(r7(u,W,r)),M.push(mS),M.push(s7(c,p,i)),M.push(mS),M.push(r7(u,W,r))}M.push(mS),M.push(s7(a,p,i))}var P=r.havingBaseStyle(_s.TEXT),V=Dr({positionType:"bottom",positionData:O,children:M});return gR(Nt(["delimsizing","mult"],[V],P),_s.TEXT,r,o)},i7=80,o7=.08,a7=function(t,n,s,r,i){var o=YCe(t,r,s),a=new Um(t,o),c=new ff([a],{width:"400em",height:Gt(n),viewBox:"0 0 400000 "+s,preserveAspectRatio:"xMinYMin slice"});return Wm(["hide-tail"],[c],i)},q3e=function(t,n){var s=n.havingBaseSizing(),r=qZ("\\surd",t*s.sizeMultiplier,HZ,s),i=s.sizeMultiplier,o=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),a,c,u,d,f;return r.type==="small"?(d=1e3+1e3*o+i7,t<1?i=1:t<1.4&&(i=.7),c=(1+o+o7)/i,u=(1+o)/i,a=a7("sqrtMain",c,d,o,n),a.style.minWidth="0.853em",f=.833/i):r.type==="large"?(d=(1e3+i7)*vv[r.size],u=(vv[r.size]+o)/i,c=(vv[r.size]+o+o7)/i,a=a7("sqrtSize"+r.size,c,d,o,n),a.style.minWidth="1.02em",f=1/i):(c=t+o+o7,u=t+o,d=Math.floor(1e3*t+o)+i7,a=a7("sqrtTall",c,d,o,n),a.style.minWidth="0.742em",f=1.056),a.height=u,a.style.height=Gt(c),{span:a,advanceWidth:f,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*i}},BZ=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),U3e=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),zZ=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),vv=[0,1.2,1.8,2.4,3],FZ=function(t,n,s,r,i){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),BZ.has(t)||zZ.has(t))return OZ(t,n,!1,s,r,i);if(U3e.has(t))return $Z(t,vv[n],!1,s,r,i);throw new Pt("Illegal delimiter: '"+t+"'")},W3e=[{type:"small",style:_s.SCRIPTSCRIPT},{type:"small",style:_s.SCRIPT},{type:"small",style:_s.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],V3e=[{type:"small",style:_s.SCRIPTSCRIPT},{type:"small",style:_s.SCRIPT},{type:"small",style:_s.TEXT},{type:"stack"}],HZ=[{type:"small",style:_s.SCRIPTSCRIPT},{type:"small",style:_s.SCRIPT},{type:"small",style:_s.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],G3e=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.")},qZ=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=Ow(t,G3e(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]},ZA=function(t,n,s,r,i,o){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var a;zZ.has(t)?a=W3e:BZ.has(t)?a=HZ:a=V3e;var c=qZ(t,n,a,r);return c.type==="small"?B3e(t,c.style,s,r,i,o):c.type==="large"?OZ(t,c.size,s,r,i,o):$Z(t,n,s,r,i,o)},l7=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),f=Math.max(d/500*c,2*d-u);return ZA(t,f,!0,r,i,o)},pF={"\\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}},K3e=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 gF(e){return"isMiddle"in e}function wT(e,t){var n=bT(e);if(n&&K3e.has(n.text))return n;throw n?new Pt("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new Pt("Invalid delimiter type '"+e.type+"'",e)}pn({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=wT(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:pF[e.funcName].size,mclass:pF[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?Nt([e.mclass]):FZ(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(vu(e.delim,e.mode));var n=new Bt("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var s=Gt(vv[e.size]);return n.setAttribute("minsize",s),n.setAttribute("maxsize",s),n}});function bF(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}pn({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 Pt("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:wT(t[0],e).text,color:n}}});pn({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=wT(t[0],e),s=e.parser;++s.leftrightDepth;var r=s.parseExpression(!1);--s.leftrightDepth,s.expect("\\right",!1);var i=Ls(s.parseFunction(),"leftright-right");return{type:"leftright",mode:s.mode,body:r,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{bF(e);for(var n=Qo(e.body,t,!0,["mopen","mclose"]),s=0,r=0,i=!1,o=0;o<n.length;o++){var a=n[o];gF(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=ex(t,["mopen"]):c=l7(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(gF(d)){var f=d.isMiddle;n[u]=l7(f.delim,s,r,f.options,e.mode,[])}}var m;if(e.right===".")m=ex(t,["mclose"]);else{var p=e.rightColor?t.withColor(e.rightColor):t;m=l7(e.right,s,r,p,e.mode,["mclose"])}return n.push(m),Nt(["minner"],n,t)},mathmlBuilder:(e,t)=>{bF(e);var n=Bc(e.body,t);if(e.left!=="."){var s=new Bt("mo",[vu(e.left,e.mode)]);s.setAttribute("fence","true"),n.unshift(s)}if(e.right!=="."){var r=new Bt("mo",[vu(e.right,e.mode)]);r.setAttribute("fence","true"),e.rightColor&&r.setAttribute("mathcolor",e.rightColor),n.push(r)}return fR(n)}});pn({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=wT(t[0],e);if(!e.parser.leftrightDepth)throw new Pt("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return e.delim==="."?n=ex(t,[]):(n=FZ(e.delim,1,t,e.mode,[]),n.isMiddle={delim:e.delim,options:t}),n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?vu("|","text"):vu(e.delim,e.mode),s=new Bt("mo",[n]);return s.setAttribute("fence","true"),s.setAttribute("lspace","0.05em"),s.setAttribute("rspace","0.05em"),s}});var vT=(e,t)=>{var n=Ab(Or(e.body,t),t),s=e.label.slice(1),r=t.sizeMultiplier,i,o,a=xf(e.body);if(s==="sout")i=Nt(["stretchy","sout"]),i.height=t.fontMetrics().defaultRuleThickness/r,o=-.5*t.fontMetrics().xHeight;else if(s==="phase"){var c=Xi({number:.6,unit:"pt"},t),u=Xi({number:.35,unit:"ex"},t),d=t.havingBaseSizing();r=r/d.sizeMultiplier;var f=n.height+n.depth+c+u;n.style.paddingLeft=Gt(f/2+c);var m=Math.floor(1e3*f*r),p=GCe(m),g=new ff([new Um("phase",p)],{width:"400em",height:Gt(m/1e3),viewBox:"0 0 400000 "+m,preserveAspectRatio:"xMinYMin slice"});i=Wm(["hide-tail"],[g],t),i.style.height=Gt(f),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,y=0;/box/.test(s)?(y=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),b=t.fontMetrics().fboxsep+(s==="colorbox"?0:y),v=b):s==="angl"?(y=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),b=4*y,v=Math.max(0,.25-n.depth)):(b=a?.2:0,v=b),i=A3e(n,s,b,v,t),/fbox|boxed|fcolorbox/.test(s)?(i.style.borderStyle="solid",i.style.borderWidth=Gt(y)):s==="angl"&&y!==.049&&(i.style.borderTopWidth=Gt(y),i.style.borderRightWidth=Gt(y)),o=n.depth+v,e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor,e.borderColor&&(i.style.borderColor=e.borderColor))}var w;if(e.backgroundColor)w=Dr({positionType:"individualShift",children:[{type:"elem",elem:i,shift:o},{type:"elem",elem:n,shift:0}]});else{var x=/cancel|phase/.test(s)?["svg-align"]:[];w=Dr({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:o,wrapperClasses:x}]})}return/cancel/.test(s)&&(w.height=n.height,w.depth=n.depth),/cancel/.test(s)&&!a?Nt(["mord","cancel-lap"],[w],t):Nt(["mord"],[w],t)},xT=(e,t)=>{var n,s=new Bt(e.label.includes("colorbox")?"mpadded":"menclose",[mi(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: "+Gt(r)+" solid "+e.borderColor)}break;case"\\xcancel":s.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&s.setAttribute("mathbackground",e.backgroundColor),s};pn({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,n){var{parser:s,funcName:r}=e,i=Ls(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:s.mode,label:r,backgroundColor:i,body:o}},htmlBuilder:vT,mathmlBuilder:xT});pn({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,n){var{parser:s,funcName:r}=e,i=Ls(t[0],"color-token").color,o=Ls(t[1],"color-token").color,a=t[2];return{type:"enclose",mode:s.mode,label:r,backgroundColor:o,borderColor:i,body:a}},htmlBuilder:vT,mathmlBuilder:xT});pn({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]}}});pn({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:vT,mathmlBuilder:xT});pn({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:vT,mathmlBuilder:xT});pn({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 UZ={};function Jd(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)UZ[n[c]]=a;i&&(xC[t]=i),o&&(kC[t]=o)}var WZ={};function te(e,t){WZ[e]=t}class ql{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 ql(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}}class Nc{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 Nc(n,ql.range(this,t))}}function yF(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 kT=e=>{var t=e.parser.settings;if(!t.displayMode)throw new Pt("{"+e.envName+"} can be used only in display mode.")},Y3e=new Set(["gather","gather*"]);function bR(e){if(!e.includes("ed"))return!e.includes("*")}function wp(e,t,n){var{hskipBeforeAndAfter:s,addJot:r,cols:i,arraystretch:o,colSeparationType:a,autoTag:c,singleRow:u,emptySingleRow:d,maxNumCols:f,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 Pt("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var g=[],b=[g],v=[],y=[],w=c!=null?[]:void 0;function x(){c&&e.gullet.macros.set("\\@eqnsw","1",!0)}function k(){w&&(e.gullet.macros.get("\\df@tag")?(w.push(e.subparse([new Nc("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):w.push(!!c&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(x(),y.push(yF(e));;){var C=e.parseExpression(!1,u?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var T={type:"ordgroup",mode:e.mode,body:C};n&&(T={type:"styling",mode:e.mode,style:n,resetFont:!0,body:[T]}),g.push(T);var _=e.fetch().text;if(_==="&"){if(f&&g.length===f){if(u||a)throw new Pt("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(_==="\\end"){k(),g.length===1&&T.type==="styling"&&T.body.length===1&&T.body[0].type==="ordgroup"&&T.body[0].body.length===0&&(b.length>1||!d)&&b.pop(),y.length<b.length+1&&y.push([]);break}else if(_==="\\\\"){e.consume();var S=void 0;e.gullet.future().text!==" "&&(S=e.parseSizeGroup(!0)),v.push(S?S.value:null),k(),y.push(yF(e)),g=[],b.push(g),x()}else throw new Pt("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:y,colSeparationType:a,tags:w,leqno:m}}function yR(e){return e.slice(0,1)==="d"?"display":"text"}var Zd=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),f=1/n.fontMetrics().ptPerEm,m=5*f;if(t.colSeparationType&&t.colSeparationType==="small"){var p=n.havingStyle(_s.SCRIPT).sizeMultiplier;m=.2778*(p/n.sizeMultiplier)}var g=t.colSeparationType==="CD"?Xi({number:3,unit:"ex"},n):12*f,b=3*f,v=t.arraystretch*g,y=.7*v,w=.3*v,x=0;function k(it){for(var gt=0;gt<it.length;++gt)gt>0&&(x+=.25),u.push({pos:x,isDashed:it[gt]})}for(k(o[0]),s=0;s<t.body.length;++s){var C=t.body[s],T=y,_=w;a<C.length&&(a=C.length);var S={cells:new Array(C.length),height:0,depth:0,pos:0};for(r=0;r<C.length;++r){var R=Or(C[r],n);_<R.depth&&(_=R.depth),T<R.height&&(T=R.height),S.cells[r]=R}var A=t.rowGaps[s],O=0;A&&(O=Xi(A,n),O>0&&(O+=w,_<O&&(_=O),O=0)),t.addJot&&s<t.body.length-1&&(_+=b),S.height=T,S.depth=_,x+=T,S.pos=x,x+=_+O,c[s]=S,k(o[s+1])}var M=x/2+n.fontMetrics().axisHeight,D=t.cols||[],$=[],z,B,j=[];if(t.tags&&t.tags.some(it=>it))for(s=0;s<i;++s){var H=c[s],Q=H.pos-M,I=t.tags[s],J=void 0;I===!0?J=Nt(["eqn-num"],[],n):I===!1?J=Nt([],[],n):J=Nt([],Qo(I,n,!0),n),J.depth=H.depth,J.height=H.height,j.push({type:"elem",elem:J,shift:Q})}for(r=0,B=0;r<a||B<D.length;++r,++B){for(var W,P=D[B],V=!0;((ee=P)==null?void 0:ee.type)==="separator";){var ee;if(V||(z=Nt(["arraycolsep"],[]),z.style.width=Gt(n.fontMetrics().doubleRuleSep),$.push(z)),P.separator==="|"||P.separator===":"){var q=P.separator==="|"?"solid":"dashed",K=Nt(["vertical-separator"],[],n);K.style.height=Gt(x),K.style.borderRightWidth=Gt(d),K.style.borderRightStyle=q,K.style.margin="0 "+Gt(-d/2);var de=x-M;de&&(K.style.verticalAlign=Gt(-de)),$.push(K)}else throw new Pt("Invalid separator type: "+P.separator);B++,P=D[B],V=!1}if(!(r>=a)){var re=void 0;if(r>0||t.hskipBeforeAndAfter){var ne,U;re=(ne=(U=P)==null?void 0:U.pregap)!=null?ne:m,re!==0&&(z=Nt(["arraycolsep"],[]),z.style.width=Gt(re),$.push(z))}var Z=[];for(s=0;s<i;++s){var ge=c[s],ce=ge.cells[r];if(ce){var ue=ge.pos-M;ce.depth=ge.depth,ce.height=ge.height,Z.push({type:"elem",elem:ce,shift:ue})}}var be=Dr({positionType:"individualShift",children:Z}),rt=Nt(["col-align-"+(((W=P)==null?void 0:W.align)||"c")],[be]);if($.push(rt),r<a-1||t.hskipBeforeAndAfter){var le,Me;re=(le=(Me=P)==null?void 0:Me.postgap)!=null?le:m,re!==0&&(z=Nt(["arraycolsep"],[]),z.style.width=Gt(re),$.push(z))}}}var We=Nt(["mtable"],$);if(u.length>0){for(var at=jb("hline",n,d),ze=jb("hdashline",n,d),rn=[{type:"elem",elem:We,shift:0}];u.length>0;){var Wt=u.pop(),zt=Wt.pos-M;Wt.isDashed?rn.push({type:"elem",elem:ze,shift:zt}):rn.push({type:"elem",elem:at,shift:zt})}We=Dr({positionType:"individualShift",children:rn})}if(j.length===0)return Nt(["mord"],[We],n);var ae=Dr({positionType:"individualShift",children:j}),je=Nt(["tag"],[ae],n);return _f([We,je])},X3e={c:"center ",l:"left ",r:"right "},eh=function(t,n){for(var s=[],r=new Bt("mtd",[],["mtr-glue"]),i=new Bt("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 Bt("mtd",[mi(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 Bt("mtr",c))}var d=new Bt("mtable",s),f=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);d.setAttribute("rowspacing",Gt(f));var m="",p="";if(t.cols&&t.cols.length>0){var g=t.cols,b="",v=!1,y=0,w=g.length;g[0].type==="separator"&&(m+="top ",y=1),g[g.length-1].type==="separator"&&(m+="bottom ",w-=1);for(var x=y;x<w;x++){var k=g[x];k.type==="align"?(p+=X3e[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 C=t.cols||[],T="",_=1;_<C.length;_++)T+=_%2?"0em ":"1em ";d.setAttribute("columnspacing",T.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="",R=t.hLinesBeforeRow;m+=R[0].length>0?"left ":"",m+=R[R.length-1].length>0?"right ":"";for(var A=1;A<R.length-1;A++)S+=R[A].length===0?"none ":R[A][0]?"dashed ":"solid ";return/[sd]/.test(S)&&d.setAttribute("rowlines",S.trim()),m!==""&&(d=new Bt("menclose",[d]),d.setAttribute("notation",m.trim())),t.arraystretch&&t.arraystretch<1&&(d=new Bt("mstyle",[d]),d.setAttribute("scriptlevel","1")),d},VZ=function(t,n){t.envName.includes("ed")||kT(t);var s=[],r=t.envName.includes("at")?"alignat":"align",i=t.envName==="split",o=wp(t.parser,{cols:s,addJot:!0,autoTag:i?void 0:bR(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="",f=0;f<n[0].body.length;f++){var m=Ls(n[0].body[f],"textord");d+=m.text}a=Number(d),c=a*2}var p=!c;o.body.forEach(function(y){for(var w=1;w<y.length;w+=2){var x=Ls(y[w],"styling"),k=Ls(x.body[0],"ordgroup");k.body.unshift(u)}if(p)c<y.length&&(c=y.length);else{var C=y.length/2;if(a<C)throw new Pt("Too many math in a row: "+("expected "+a+", but got "+C),y[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};Jd({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=bT(t[0]),s=n?[t[0]]:Ls(t[0],"ordgroup").body,r=s.map(function(o){var a=gT(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 Pt("Unknown column alignment: "+c,o)}),i={cols:r,hskipBeforeAndAfter:!0,maxNumCols:r.length};return wp(e.parser,i,yR(e.envName))},htmlBuilder:Zd,mathmlBuilder:eh});Jd({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 Pt("Expected l or c or r",r.nextToken);r.consume(),r.consumeSpaces(),r.expect("]"),r.consume(),s.cols=[{type:"align",align:n}]}}var i=wp(e.parser,s,yR(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:Zd,mathmlBuilder:eh});Jd({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=wp(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:Zd,mathmlBuilder:eh});Jd({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=bT(t[0]),s=n?[t[0]]:Ls(t[0],"ordgroup").body,r=s.map(function(a){var c=gT(a),u=c.text;if("lc".includes(u))return{type:"align",align:u};throw new Pt("Unknown column alignment: "+u,a)});if(r.length>1)throw new Pt("{subarray} can contain only one column");var i={cols:r,hskipBeforeAndAfter:!1,arraystretch:.5},o=wp(e.parser,i,"script");if(o.body.length>0&&o.body[0].length>1)throw new Pt("{subarray} can contain only one column");return o},htmlBuilder:Zd,mathmlBuilder:eh});Jd({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=wp(e.parser,t,yR(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Zd,mathmlBuilder:eh});Jd({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:VZ,htmlBuilder:Zd,mathmlBuilder:eh});Jd({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){Y3e.has(e.envName)&&kT(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:bR(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return wp(e.parser,t,"display")},htmlBuilder:Zd,mathmlBuilder:eh});Jd({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:VZ,htmlBuilder:Zd,mathmlBuilder:eh});Jd({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){kT(e);var t={autoTag:bR(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return wp(e.parser,t,"display")},htmlBuilder:Zd,mathmlBuilder:eh});Jd({type:"array",names:["CD"],props:{numArgs:0},handler(e){return kT(e),O3e(e.parser)},htmlBuilder:Zd,mathmlBuilder:eh});te("\\nonumber","\\gdef\\@eqnsw{0}");te("\\notag","\\nonumber");pn({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new Pt(e.funcName+" valid only within array environment")}});var wF=UZ;pn({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 Pt("Invalid environment name",r);for(var i="",o=0;o<r.body.length;++o)i+=Ls(r.body[o],"textord").text;if(s==="\\begin"){if(!wF.hasOwnProperty(i))throw new Pt("No such environment: "+i,r);var a=wF[i],{args:c,optArgs:u}=n.parseArguments("\\begin{"+i+"}",a),d={mode:n.mode,envName:i,parser:n},f=a.handler(d,c,u);n.expect("\\end",!1);var m=n.nextToken,p=Ls(n.parseFunction(),"environment");if(p.name!==i)throw new Pt("Mismatch: \\begin{"+i+"} matched by \\end{"+p.name+"}",m);return f}return{type:"environment",mode:n.mode,name:i,nameGroup:r}}});var GZ=(e,t)=>{var n=e.font,s=t.withFont(n);return Or(e.body,s)},KZ=(e,t)=>{var n=e.font,s=t.withFont(n);return mi(e.body,s)},vF={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};pn({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=_C(t[0]),i=s;return i in vF&&(i=vF[i]),{type:"font",mode:n.mode,font:i.slice(1),body:r}},htmlBuilder:GZ,mathmlBuilder:KZ});pn({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:yT(s),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:s}],isCharacterBox:xf(s)}}});pn({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:GZ,mathmlBuilder:KZ});var Q3e=(e,t)=>{var n=t.style,s=n.fracNum(),r=n.fracDen(),i;i=t.havingStyle(s);var o=Or(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=Or(e.denom,i,t),d,f,m;e.hasBarLine?(e.barSize?(f=Xi(e.barSize,t),d=jb("frac-line",t,f)):d=jb("frac-line",t),f=d.height,m=d.height):(d=null,f=0,m=t.fontMetrics().defaultRuleThickness);var p,g,b;n.size===_s.DISPLAY.size?(p=t.fontMetrics().num1,f>0?g=3*m:g=7*m,b=t.fontMetrics().denom1):(f>0?(p=t.fontMetrics().num2,g=m):(p=t.fontMetrics().num3,g=3*m),b=t.fontMetrics().denom2);var v;if(d){var w=t.fontMetrics().axisHeight;p-o.depth-(w+.5*f)<g&&(p+=g-(p-o.depth-(w+.5*f))),w-.5*f-(u.height-b)<g&&(b+=g-(w-.5*f-(u.height-b)));var x=-(w-.5*f);v=Dr({positionType:"individualShift",children:[{type:"elem",elem:u,shift:b},{type:"elem",elem:d,shift:x},{type:"elem",elem:o,shift:-p}]})}else{var y=p-o.depth-(u.height-b);y<g&&(p+=.5*(g-y),b+=.5*(g-y)),v=Dr({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===_s.DISPLAY.size?k=t.fontMetrics().delim1:n.size===_s.SCRIPTSCRIPT.size?k=t.havingStyle(_s.SCRIPT).fontMetrics().delim2:k=t.fontMetrics().delim2;var C,T;return e.leftDelim==null?C=ex(t,["mopen"]):C=ZA(e.leftDelim,k,!0,t.havingStyle(n),e.mode,["mopen"]),e.continued?T=Nt([]):e.rightDelim==null?T=ex(t,["mclose"]):T=ZA(e.rightDelim,k,!0,t.havingStyle(n),e.mode,["mclose"]),Nt(["mord"].concat(i.sizingClasses(t)),[C,Nt(["mfrac"],[v]),T],t)},J3e=(e,t)=>{var n=new Bt("mfrac",[mi(e.numer,t),mi(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var s=Xi(e.barSize,t);n.setAttribute("linethickness",Gt(s))}if(e.leftDelim!=null||e.rightDelim!=null){var r=[];if(e.leftDelim!=null){var i=new Bt("mo",[new Ro(e.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),r.push(i)}if(r.push(n),e.rightDelim!=null){var o=new Bt("mo",[new Ro(e.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),r.push(o)}return fR(r)}return n},YZ=(e,t)=>{if(!t)return e;var n={type:"styling",mode:e.mode,style:t,body:[e]};return n};pn({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"),YZ({type:"genfrac",mode:n.mode,numer:r,denom:i,continued:u,hasBarLine:o,leftDelim:a,rightDelim:c,barSize:null},d)},htmlBuilder:Q3e,mathmlBuilder:J3e});pn({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 xF=["display","text","script","scriptscript"],kF=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};pn({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=_C(t[0]),o=i.type==="atom"&&i.family==="open"?kF(i.text):null,a=_C(t[1]),c=a.type==="atom"&&a.family==="close"?kF(a.text):null,u=Ls(t[2],"size"),d,f=null;u.isBlank?d=!0:(f=u.value,d=f.number>0);var m=null,p=t[3];if(p.type==="ordgroup"){if(p.body.length>0){var g=Ls(p.body[0],"textord");m=xF[Number(g.text)]}}else p=Ls(p,"textord"),m=xF[Number(p.text)];return YZ({type:"genfrac",mode:n.mode,numer:s,denom:r,continued:!1,hasBarLine:d,barSize:f,leftDelim:o,rightDelim:c},m)}});pn({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:Ls(t[0],"size").value,token:r}}});pn({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0],i=Ls(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 XZ=(e,t)=>{var n=t.style,s,r;e.type==="supsub"?(s=e.sup?Or(e.sup,t.havingStyle(n.sup()),t):Or(e.sub,t.havingStyle(n.sub()),t),r=Ls(e.base,"horizBrace")):r=Ls(e,"horizBrace");var i=Or(r.base,t.havingBaseStyle(_s.DISPLAY)),o=pT(r,t),a;if(r.isOver?a=Dr({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:o,wrapperClasses:["svg-align"]}]}):a=Dr({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=Nt(["minner",r.isOver?"mover":"munder"],[a],t);r.isOver?a=Dr({positionType:"firstBaseline",children:[{type:"elem",elem:c},{type:"kern",size:.2},{type:"elem",elem:s}]}):a=Dr({positionType:"bottom",positionData:c.depth+.2+s.height+s.depth,children:[{type:"elem",elem:s},{type:"kern",size:.2},{type:"elem",elem:c}]})}return Nt(["minner",r.isOver?"mover":"munder"],[a],t)},Z3e=(e,t)=>{var n=mT(e.label);return new Bt(e.isOver?"mover":"munder",[mi(e.base,t),n])};pn({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:XZ,mathmlBuilder:Z3e});pn({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=t[1],r=Ls(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:r})?{type:"href",mode:n.mode,href:r,body:Io(s)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=Qo(e.body,t,!1);return h3e(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=Vm(e.body,t);return n instanceof Bt||(n=new Bt("mrow",[n])),n.setAttribute("href",e.href),n}});pn({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=Ls(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:Io(a)}}});pn({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:Io(t[0])}},htmlBuilder(e,t){var n=Qo(e.body,t.withFont(""),!1);return _f(n)},mathmlBuilder(e,t){return new Bt("mrow",Bc(e.body,t.withFont("")))}});pn({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=Ls(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 f=u[d],m=f.indexOf("=");if(m<0)throw new Pt("\\htmlData key/value '"+f+"' missing equals sign");var p=f.slice(0,m),g=f.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:Io(o)}:n.formatUnsupportedCmd(s)},htmlBuilder:(e,t)=>{var n=Qo(e.body,t,!1),s=["enclosing"];e.attributes.class&&s.push(...e.attributes.class.trim().split(/\s+/));var r=Nt(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)=>Vm(e.body,t)});pn({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:Io(t[0]),mathml:Io(t[1])}},htmlBuilder:(e,t)=>{var n=Qo(e.html,t,!1);return _f(n)},mathmlBuilder:(e,t)=>Vm(e.mathml,t)});var c7=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 Pt("Invalid size: '"+t+"' in \\includegraphics");var s={number:+(n[1]+n[2]),unit:n[3]};if(!hZ(s))throw new Pt("Invalid unit: '"+s.unit+"' in \\includegraphics.");return s};pn({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=Ls(n[0],"raw").string,u=c.split(","),d=0;d<u.length;d++){var f=u[d].split("=");if(f.length===2){var m=f[1].trim();switch(f[0].trim()){case"alt":a=m;break;case"width":r=c7(m);break;case"height":i=c7(m);break;case"totalheight":o=c7(m);break;default:throw new Pt("Invalid key: '"+f[0]+"' in \\includegraphics.")}}}var p=Ls(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=Xi(e.height,t),s=0;e.totalheight.number>0&&(s=Xi(e.totalheight,t)-n);var r=0;e.width.number>0&&(r=Xi(e.width,t));var i={height:Gt(n+s)};r>0&&(i.width=Gt(r)),s>0&&(i.verticalAlign=Gt(-s));var o=new t3e(e.src,e.alt,i);return o.height=n,o.depth=s,o},mathmlBuilder:(e,t)=>{var n=new Bt("mglyph",[]);n.setAttribute("alt",e.alt);var s=Xi(e.height,t),r=0;if(e.totalheight.number>0&&(r=Xi(e.totalheight,t)-s,n.setAttribute("valign",Gt(-r))),n.setAttribute("height",Gt(s+r)),e.width.number>0){var i=Xi(e.width,t);n.setAttribute("width",Gt(i))}return n.setAttribute("src",e.src),n}});pn({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=Ls(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 wZ(e.dimension,t)},mathmlBuilder(e,t){var n=Xi(e.dimension,t);return new CZ(n)}});pn({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=Nt([],[Or(e.body,t)]),n=Nt(["inner"],[n],t)):n=Nt(["inner"],[Or(e.body,t)]);var s=Nt(["fix"],[]),r=Nt([e.alignment],[n,s],t),i=Nt(["strut"]);return i.style.height=Gt(r.height+r.depth),r.depth&&(i.style.verticalAlign=Gt(-r.depth)),r.children.unshift(i),r=Nt(["thinbox"],[r],t),Nt(["mord","vbox"],[r],t)},mathmlBuilder:(e,t)=>{var n=new Bt("mpadded",[mi(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}});pn({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}}});pn({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new Pt("Mismatched "+e.funcName)}});var _F=(e,t)=>{switch(t.style.size){case _s.DISPLAY.size:return e.display;case _s.TEXT.size:return e.text;case _s.SCRIPT.size:return e.script;case _s.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};pn({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:Io(t[0]),text:Io(t[1]),script:Io(t[2]),scriptscript:Io(t[3])}},htmlBuilder:(e,t)=>{var n=_F(e,t),s=Qo(n,t,!1);return _f(s)},mathmlBuilder:(e,t)=>{var n=_F(e,t);return Vm(n,t)}});var QZ=(e,t,n,s,r,i,o)=>{e=Nt([],[e]);var a=n&&xf(n),c,u;if(t){var d=Or(t,s.havingStyle(r.sup()),s);u={elem:d,kern:Math.max(s.fontMetrics().bigOpSpacing1,s.fontMetrics().bigOpSpacing3-d.depth)}}if(n){var f=Or(n,s.havingStyle(r.sub()),s);c={elem:f,kern:Math.max(s.fontMetrics().bigOpSpacing2,s.fontMetrics().bigOpSpacing4-f.height)}}var m;if(u&&c){var p=s.fontMetrics().bigOpSpacing5+c.elem.height+c.elem.depth+c.kern+e.depth+o;m=Dr({positionType:"bottom",positionData:p,children:[{type:"kern",size:s.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Gt(-i)},{type:"kern",size:c.kern},{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:Gt(i)},{type:"kern",size:s.fontMetrics().bigOpSpacing5}]})}else if(c){var g=e.height-o;m=Dr({positionType:"top",positionData:g,children:[{type:"kern",size:s.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Gt(-i)},{type:"kern",size:c.kern},{type:"elem",elem:e}]})}else if(u){var b=e.depth+o;m=Dr({positionType:"bottom",positionData:b,children:[{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:Gt(i)},{type:"kern",size:s.fontMetrics().bigOpSpacing5}]})}else return e;var v=[m];if(c&&i!==0&&!a){var y=Nt(["mspace"],[],s);y.style.marginRight=Gt(i),v.unshift(y)}return Nt(["mop","op-limits"],v,s)},JZ=new Set(["\\smallint"]),cy=(e,t)=>{var n,s,r=!1,i;e.type==="supsub"?(n=e.sup,s=e.sub,i=Ls(e.base,"op"),r=!0):i=Ls(e,"op");var o=t.style,a=!1;o.size===_s.DISPLAY.size&&i.symbol&&!JZ.has(i.name)&&(a=!0);var c,u;if(i.symbol){var d=a?"Size2-Regular":"Size1-Regular",f="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(f=i.name.slice(1),i.name=f==="oiint"?"\\iint":"\\iiint"),c=ul(i.name,d,"math",t,["mop","op-symbol",a?"large-op":"small-op"]),u=c.italic,f.length>0){var m=xZ(f+"Size"+(a?"2":"1"),t);c=Dr({positionType:"individualShift",children:[{type:"elem",elem:c,shift:0},{type:"elem",elem:m,shift:a?.08:0}]}),i.name="\\"+f,c.classes.unshift("mop"),c.italic=u}}else if(i.body){var p=Qo(i.body,t,!0);p.length===1&&p[0]instanceof Lc?(c=p[0],c.classes[0]="mop"):c=Nt(["mop"],p,t)}else{for(var g=[],b=1;b<i.name.length;b++)g.push(dR(i.name[b],i.mode,t));c=Nt(["mop"],g,t)}var v=0,y=0;if((c instanceof Lc||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift){var w;v=(c.height-c.depth)/2-t.fontMetrics().axisHeight,y=(w=c.italic)!=null?w:0}return r?QZ(c,n,s,t,o,y,v):(v&&(c.style.position="relative",c.style.top=Gt(v)),c)},fk=(e,t)=>{var n;if(e.symbol)n=new Bt("mo",[vu(e.name,e.mode)]),JZ.has(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new Bt("mo",Bc(e.body,t));else{n=new Bt("mi",[new Ro(e.name.slice(1))]);var s=new Bt("mo",[vu("⁡","text")]);e.parentIsSupSub?n=new Bt("mrow",[n,s]):n=SZ([n,s])}return n},eTe={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};pn({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=eTe[r]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:cy,mathmlBuilder:fk});pn({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:Io(s)}},htmlBuilder:cy,mathmlBuilder:fk});var tTe={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};pn({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:cy,mathmlBuilder:fk});pn({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:cy,mathmlBuilder:fk});pn({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=tTe[s]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:cy,mathmlBuilder:fk});var ZZ=(e,t)=>{var n,s,r=!1,i;e.type==="supsub"?(n=e.sup,s=e.sub,i=Ls(e.base,"operatorname"),r=!0):i=Ls(e,"operatorname");var o;if(i.body.length>0){for(var a=i.body.map(f=>{var m="text"in f?f.text:void 0;return typeof m=="string"?{type:"textord",mode:f.mode,text:m}:f}),c=Qo(a,t.withFont("mathrm"),!0),u=0;u<c.length;u++){var d=c[u];d instanceof Lc&&(d.text=d.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=Nt(["mop"],c,t)}else o=Nt(["mop"],[],t);return r?QZ(o,n,s,t,t.style,0,0):o},nTe=(e,t)=>{for(var n=Bc(e.body,t.withFont("mathrm")),s=!0,r=0;r<n.length;r++){var i=n[r];if(!(i instanceof CZ))if(i instanceof Bt)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 Ro?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 Ro(a)]}var c=new Bt("mi",n);c.setAttribute("mathvariant","normal");var u=new Bt("mo",[vu("⁡","text")]);return e.parentIsSupSub?new Bt("mrow",[c,u]):SZ([c,u])};pn({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:Io(r),alwaysHandleSupSub:s==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:ZZ,mathmlBuilder:nTe});te("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");mg({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?_f(Qo(e.body,t,!1)):Nt(["mord"],Qo(e.body,t,!0),t)},mathmlBuilder(e,t){return Vm(e.body,t,!0)}});pn({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=Or(e.body,t.havingCrampedStyle()),s=jb("overline-line",t),r=t.fontMetrics().defaultRuleThickness,i=Dr({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*r},{type:"elem",elem:s},{type:"kern",size:r}]});return Nt(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new Bt("mo",[new Ro("‾")]);n.setAttribute("stretchy","true");var s=new Bt("mover",[mi(e.body,t),n]);return s.setAttribute("accent","true"),s}});pn({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:Io(s)}},htmlBuilder:(e,t)=>{var n=Qo(e.body,t.withPhantom(),!1);return _f(n)},mathmlBuilder:(e,t)=>{var n=Bc(e.body,t);return new Bt("mphantom",n)}});te("\\hphantom","\\smash{\\phantom{#1}}");pn({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=Nt(["inner"],[Or(e.body,t.withPhantom())]),s=Nt(["fix"],[]);return Nt(["mord","rlap"],[n,s],t)},mathmlBuilder:(e,t)=>{var n=Bc(Io(e.body),t),s=new Bt("mphantom",n),r=new Bt("mpadded",[s]);return r.setAttribute("width","0px"),r}});pn({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,s=Ls(t[0],"size").value,r=t[1];return{type:"raisebox",mode:n.mode,dy:s,body:r}},htmlBuilder(e,t){var n=Or(e.body,t),s=Xi(e.dy,t);return Dr({positionType:"shift",positionData:-s,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Bt("mpadded",[mi(e.body,t)]),s=e.dy.number+e.dy.unit;return n.setAttribute("voffset",s),n}});pn({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});pn({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=Ls(t[0],"size"),o=Ls(t[1],"size");return{type:"rule",mode:s.mode,shift:r&&Ls(r,"size").value,width:i.value,height:o.value}},htmlBuilder(e,t){var n=Nt(["mord","rule"],[],t),s=Xi(e.width,t),r=Xi(e.height,t),i=e.shift?Xi(e.shift,t):0;return n.style.borderRightWidth=Gt(s),n.style.borderTopWidth=Gt(r),n.style.bottom=Gt(i),n.width=s,n.height=r+i,n.depth=-i,n.maxFontSize=r*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=Xi(e.width,t),s=Xi(e.height,t),r=e.shift?Xi(e.shift,t):0,i=t.color&&t.getColor()||"black",o=new Bt("mspace");o.setAttribute("mathbackground",i),o.setAttribute("width",Gt(n)),o.setAttribute("height",Gt(s));var a=new Bt("mpadded",[o]);return r>=0?a.setAttribute("height",Gt(r)):(a.setAttribute("height",Gt(r)),a.setAttribute("depth",Gt(-r))),a.setAttribute("voffset",Gt(r)),a}});function eee(e,t,n){for(var s=Qo(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 _f(s)}var SF=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],sTe=(e,t)=>{var n=t.havingSize(e.size);return eee(e.body,n,t)};pn({type:"sizing",names:SF,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:SF.indexOf(s)+1,body:i}},htmlBuilder:sTe,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),s=Bc(e.body,n),r=new Bt("mstyle",s);return r.setAttribute("mathsize",Gt(n.sizeMultiplier)),r}});pn({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]&&Ls(n[0],"ordgroup");if(o)for(var a,c=0;c<o.body.length;++c){var u=o.body[c];if(a=gT(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=Nt([],[Or(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 Nt(["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=Dr({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return Nt(["mord"],[r],t)},mathmlBuilder:(e,t)=>{var n=new Bt("mpadded",[mi(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});pn({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=Or(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=Ab(n,t);var s=t.fontMetrics(),r=s.defaultRuleThickness,i=r;t.style.id<_s.TEXT.id&&(i=t.fontMetrics().xHeight);var o=r+i/4,a=n.height+n.depth+o+r,{span:c,ruleWidth:u,advanceWidth:d}=q3e(a,t),f=c.height-u;f>n.height+n.depth+o&&(o=(o+f-n.height-n.depth)/2);var m=c.height-n.height-o-u;n.style.paddingLeft=Gt(d);var p=Dr({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(_s.SCRIPTSCRIPT),b=Or(e.index,g,t),v=.6*(p.height-p.depth),y=Dr({positionType:"shift",positionData:-v,children:[{type:"elem",elem:b}]}),w=Nt(["root"],[y]);return Nt(["mord","sqrt"],[w,p],t)}else return Nt(["mord","sqrt"],[p],t)},mathmlBuilder(e,t){var{body:n,index:s}=e;return s?new Bt("mroot",[mi(n,t),mi(s,t)]):new Bt("msqrt",[mi(n,t)])}});var eN={display:_s.DISPLAY,text:_s.TEXT,script:_s.SCRIPT,scriptscript:_s.SCRIPTSCRIPT};function rTe(e){return e in eN}pn({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(!rTe(o))throw new Error("Unknown style: "+o);return{type:"styling",mode:r.mode,style:o,body:i}},htmlBuilder(e,t){var n=eN[e.style],s=t.havingStyle(n);return e.resetFont&&(s=s.withFont("")),eee(e.body,s,t)},mathmlBuilder(e,t){var n=eN[e.style],s=t.havingStyle(n);e.resetFont&&(s=s.withFont(""));var r=Bc(e.body,s),i=new Bt("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 iTe=function(t,n){var s=t.base;if(s)if(s.type==="op"){var r=s.limits&&(n.style.size===_s.DISPLAY.size||s.alwaysHandleSupSub);return r?cy:null}else if(s.type==="operatorname"){var i=s.alwaysHandleSupSub&&(n.style.size===_s.DISPLAY.size||s.limits);return i?ZZ:null}else{if(s.type==="accent")return xf(s.base)?pR:null;if(s.type==="horizBrace"){var o=!t.sub;return o===s.isOver?XZ:null}else return null}else return null};mg({type:"supsub",htmlBuilder(e,t){var n=iTe(e,t);if(n)return n(e,t);var{base:s,sup:r,sub:i}=e,o=Or(s,t),a,c,u=t.fontMetrics(),d=0,f=0,m=s&&xf(s);if(r){var p=t.havingStyle(t.style.sup());a=Or(r,p,t),m||(d=o.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(i){var g=t.havingStyle(t.style.sub());c=Or(i,g,t),m||(f=o.depth+g.fontMetrics().subDrop*g.sizeMultiplier/t.sizeMultiplier)}var b;t.style===_s.DISPLAY?b=u.sup1:t.style.cramped?b=u.sup3:b=u.sup2;var v=t.sizeMultiplier,y=Gt(.5/u.ptPerEm/v),w=null;if(c){var x=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(o instanceof Lc||x){var k;w=Gt(-((k=o.italic)!=null?k:0))}}var C;if(a&&c){d=Math.max(d,b,a.depth+.25*u.xHeight),f=Math.max(f,u.sub2);var T=u.defaultRuleThickness,_=4*T;if(d-a.depth-(c.height-f)<_){f=_-(d-a.depth)+c.height;var S=.8*u.xHeight-(d-a.depth);S>0&&(d+=S,f-=S)}var R=[{type:"elem",elem:c,shift:f,marginRight:y,marginLeft:w},{type:"elem",elem:a,shift:-d,marginRight:y}];C=Dr({positionType:"individualShift",children:R})}else if(c){f=Math.max(f,u.sub1,c.height-.8*u.xHeight);var A=[{type:"elem",elem:c,marginLeft:w,marginRight:y}];C=Dr({positionType:"shift",positionData:f,children:A})}else if(a)d=Math.max(d,b,a.depth+.25*u.xHeight),C=Dr({positionType:"shift",positionData:-d,children:[{type:"elem",elem:a,marginRight:y}]});else throw new Error("supsub must have either sup or sub.");var O=YA(o,"right")||"mord";return Nt([O],[o,Nt(["msupsub"],[C])],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=[mi(e.base,t)];e.sub&&i.push(mi(e.sub,t)),e.sup&&i.push(mi(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===_s.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(t.style===_s.DISPLAY||u.limits)?o="munderover":o="msubsup"}else{var c=e.base;c&&c.type==="op"&&c.limits&&(t.style===_s.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||t.style===_s.DISPLAY)?o="munder":o="msub"}else{var a=e.base;a&&a.type==="op"&&a.limits&&(t.style===_s.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||t.style===_s.DISPLAY)?o="mover":o="msup"}return new Bt(o,i)}});mg({type:"atom",htmlBuilder(e,t){return dR(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new Bt("mo",[vu(e.text,e.mode)]);if(e.family==="bin"){var s=mR(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 tee={mi:"italic",mn:"normal",mtext:"normal"};mg({type:"mathord",htmlBuilder(e,t){return fT(e,t,"mathord")},mathmlBuilder(e,t){var n=new Bt("mi",[vu(e.text,e.mode,t)]),s=mR(e,t)||"italic";return s!==tee[n.type]&&n.setAttribute("mathvariant",s),n}});mg({type:"textord",htmlBuilder(e,t){return fT(e,t,"textord")},mathmlBuilder(e,t){var n=vu(e.text,e.mode,t),s=mR(e,t)||"normal",r;return e.mode==="text"?r=new Bt("mtext",[n]):/[0-9]/.test(e.text)?r=new Bt("mn",[n]):e.text==="\\prime"?r=new Bt("mo",[n]):r=new Bt("mi",[n]),s!==tee[r.type]&&r.setAttribute("mathvariant",s),r}});var u7={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},d7={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};mg({type:"spacing",htmlBuilder(e,t){if(d7.hasOwnProperty(e.text)){var n=d7[e.text].className||"";if(e.mode==="text"){var s=fT(e,t,"textord");return s.classes.push(n),s}else return Nt(["mspace",n],[dR(e.text,e.mode,t)],t)}else{if(u7.hasOwnProperty(e.text))return Nt(["mspace",u7[e.text]],[],t);throw new Pt('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(d7.hasOwnProperty(e.text))n=new Bt("mtext",[new Ro(" ")]);else{if(u7.hasOwnProperty(e.text))return new Bt("mspace");throw new Pt('Unknown type of space "'+e.text+'"')}return n}});var CF=()=>{var e=new Bt("mtd",[]);return e.setAttribute("width","50%"),e};mg({type:"tag",mathmlBuilder(e,t){var n=new Bt("mtable",[new Bt("mtr",[CF(),new Bt("mtd",[Vm(e.body,t)]),CF(),new Bt("mtd",[Vm(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var TF={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},EF={"\\textbf":"textbf","\\textmd":"textmd"},oTe={"\\textit":"textit","\\textup":"textup"},jF=(e,t)=>{var n=e.font;if(n){if(TF[n])return t.withTextFontFamily(TF[n]);if(EF[n])return t.withTextFontWeight(EF[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(oTe[n])};pn({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:Io(r),font:s}},htmlBuilder(e,t){var n=jF(e,t),s=Qo(e.body,n,!0);return Nt(["mord","text"],s,n)},mathmlBuilder(e,t){var n=jF(e,t);return Vm(e.body,n)}});pn({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=Or(e.body,t),s=jb("underline-line",t),r=t.fontMetrics().defaultRuleThickness,i=Dr({positionType:"top",positionData:n.height,children:[{type:"kern",size:r},{type:"elem",elem:s},{type:"kern",size:3*r},{type:"elem",elem:n}]});return Nt(["mord","underline"],[i],t)},mathmlBuilder(e,t){var n=new Bt("mo",[new Ro("‾")]);n.setAttribute("stretchy","true");var s=new Bt("munder",[mi(e.body,t),n]);return s.setAttribute("accentunder","true"),s}});pn({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=Or(e.body,t),s=t.fontMetrics().axisHeight,r=.5*(n.height-s-(n.depth+s));return Dr({positionType:"shift",positionData:r,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Bt("mpadded",[mi(e.body,t)],["vcenter"]);return new Bt("mrow",[n])}});pn({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new Pt("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=AF(e),s=[],r=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var o=n[i];o==="~"&&(o="\\textasciitilde"),s.push(ul(o,"Typewriter-Regular",e.mode,r,["mord","texttt"]))}return Nt(["mord","text"].concat(r.sizingClasses(t)),yZ(s),r)},mathmlBuilder(e,t){var n=new Ro(AF(e)),s=new Bt("mtext",[n]);return s.setAttribute("mathvariant","monospace"),s}});var AF=e=>e.body.replace(/ /g,e.star?"␣":" "),pm=kZ,nee=`[ \r
	]`,aTe="\\\\[a-zA-Z@]+",lTe="\\\\[^\uD800-\uDFFF]",cTe="("+aTe+")"+nee+"*",uTe=`\\\\(
|[ \r	]+
?)[ \r	]*`,tN="[̀-ͯ]",dTe=new RegExp(tN+"+$"),hTe="("+nee+"+)|"+(uTe+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(tN+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(tN+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+cTe)+("|"+lTe+")");class NF{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(hTe,"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 Nc("EOF",new ql(this,n,n));var s=this.tokenRegex.exec(t);if(s===null||s.index!==n)throw new Pt("Unexpected character: '"+t[n]+"'",new Nc(t[n],new ql(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 Nc(r,new ql(this,n,this.tokenRegex.lastIndex))}}class fTe{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 Pt("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 mTe=WZ;te("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});te("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});te("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});te("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});te("\\@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}});te("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");te("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var MF={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};te("\\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 Pt("\\char` missing argument");s=t.text.charCodeAt(0)}else n=10;if(n){if(s=MF[t.text],s==null||s>=n)throw new Pt("Invalid base-"+n+" digit "+t.text);for(var r;(r=MF[e.future().text])!=null&&r<n;)s*=n,s+=r,e.popToken()}return"\\@char{"+s+"}"});var wR=(e,t,n,s)=>{var r=e.consumeArg().tokens;if(r.length!==1)throw new Pt("\\newcommand's first argument must be a macro name");var i=r[0].text,o=e.isDefined(i);if(o&&!t)throw new Pt("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!o&&!n)throw new Pt("\\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 Pt("Invalid number of arguments: "+c);a=parseInt(c),r=e.consumeArg().tokens}return o&&s||e.macros.set(i,{tokens:r,numArgs:a}),""};te("\\newcommand",e=>wR(e,!1,!0,!1));te("\\renewcommand",e=>wR(e,!0,!1,!1));te("\\providecommand",e=>wR(e,!0,!0,!0));te("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(n=>n.text).join("")),""});te("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(n=>n.text).join("")),""});te("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),pm[n],Li.math[n],Li.text[n]),""});te("\\bgroup","{");te("\\egroup","}");te("~","\\nobreakspace");te("\\lq","`");te("\\rq","'");te("\\aa","\\r a");te("\\AA","\\r A");te("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");te("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");te("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");te("ℬ","\\mathscr{B}");te("ℰ","\\mathscr{E}");te("ℱ","\\mathscr{F}");te("ℋ","\\mathscr{H}");te("ℐ","\\mathscr{I}");te("ℒ","\\mathscr{L}");te("ℳ","\\mathscr{M}");te("ℛ","\\mathscr{R}");te("ℭ","\\mathfrak{C}");te("ℌ","\\mathfrak{H}");te("ℨ","\\mathfrak{Z}");te("\\Bbbk","\\Bbb{k}");te("\\llap","\\mathllap{\\textrm{#1}}");te("\\rlap","\\mathrlap{\\textrm{#1}}");te("\\clap","\\mathclap{\\textrm{#1}}");te("\\mathstrut","\\vphantom{(}");te("\\underbar","\\underline{\\text{#1}}");te("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');te("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");te("\\ne","\\neq");te("≠","\\neq");te("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");te("∉","\\notin");te("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");te("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");te("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");te("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");te("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");te("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");te("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");te("⟂","\\perp");te("‼","\\mathclose{!\\mkern-0.8mu!}");te("∌","\\notni");te("⌜","\\ulcorner");te("⌝","\\urcorner");te("⌞","\\llcorner");te("⌟","\\lrcorner");te("©","\\copyright");te("®","\\textregistered");te("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');te("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');te("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');te("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');te("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");te("⋮","\\vdots");te("\\varGamma","\\mathit{\\Gamma}");te("\\varDelta","\\mathit{\\Delta}");te("\\varTheta","\\mathit{\\Theta}");te("\\varLambda","\\mathit{\\Lambda}");te("\\varXi","\\mathit{\\Xi}");te("\\varPi","\\mathit{\\Pi}");te("\\varSigma","\\mathit{\\Sigma}");te("\\varUpsilon","\\mathit{\\Upsilon}");te("\\varPhi","\\mathit{\\Phi}");te("\\varPsi","\\mathit{\\Psi}");te("\\varOmega","\\mathit{\\Omega}");te("\\substack","\\begin{subarray}{c}#1\\end{subarray}");te("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");te("\\boxed","\\fbox{$\\displaystyle{#1}$}");te("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");te("\\implies","\\DOTSB\\;\\Longrightarrow\\;");te("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");te("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");te("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var IF={",":"\\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"},pTe=new Set(["bin","rel"]);te("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in IF?t=IF[n]:(n.slice(0,4)==="\\not"||n in Li.math&&pTe.has(Li.math[n].group))&&(t="\\dotsb"),t});var vR={")":!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};te("\\dotso",function(e){var t=e.future().text;return t in vR?"\\ldots\\,":"\\ldots"});te("\\dotsc",function(e){var t=e.future().text;return t in vR&&t!==","?"\\ldots\\,":"\\ldots"});te("\\cdots",function(e){var t=e.future().text;return t in vR?"\\@cdots\\,":"\\@cdots"});te("\\dotsb","\\cdots");te("\\dotsm","\\cdots");te("\\dotsi","\\!\\cdots");te("\\dotsx","\\ldots\\,");te("\\DOTSI","\\relax");te("\\DOTSB","\\relax");te("\\DOTSX","\\relax");te("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");te("\\,","\\tmspace+{3mu}{.1667em}");te("\\thinspace","\\,");te("\\>","\\mskip{4mu}");te("\\:","\\tmspace+{4mu}{.2222em}");te("\\medspace","\\:");te("\\;","\\tmspace+{5mu}{.2777em}");te("\\thickspace","\\;");te("\\!","\\tmspace-{3mu}{.1667em}");te("\\negthinspace","\\!");te("\\negmedspace","\\tmspace-{4mu}{.2222em}");te("\\negthickspace","\\tmspace-{5mu}{.277em}");te("\\enspace","\\kern.5em ");te("\\enskip","\\hskip.5em\\relax");te("\\quad","\\hskip1em\\relax");te("\\qquad","\\hskip2em\\relax");te("\\tag","\\@ifstar\\tag@literal\\tag@paren");te("\\tag@paren","\\tag@literal{({#1})}");te("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new Pt("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});te("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");te("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");te("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");te("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");te("\\newline","\\\\\\relax");te("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var see=Gt(Id["Main-Regular"][84][1]-.7*Id["Main-Regular"][65][1]);te("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+see+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");te("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+see+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");te("\\hspace","\\@ifstar\\@hspacer\\@hspace");te("\\@hspace","\\hskip #1\\relax");te("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");te("\\ordinarycolon",":");te("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");te("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');te("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');te("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');te("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');te("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');te("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');te("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');te("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');te("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');te("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');te("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');te("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');te("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');te("∷","\\dblcolon");te("∹","\\eqcolon");te("≔","\\coloneqq");te("≕","\\eqqcolon");te("⩴","\\Coloneqq");te("\\ratio","\\vcentcolon");te("\\coloncolon","\\dblcolon");te("\\colonequals","\\coloneqq");te("\\coloncolonequals","\\Coloneqq");te("\\equalscolon","\\eqqcolon");te("\\equalscoloncolon","\\Eqqcolon");te("\\colonminus","\\coloneq");te("\\coloncolonminus","\\Coloneq");te("\\minuscolon","\\eqcolon");te("\\minuscoloncolon","\\Eqcolon");te("\\coloncolonapprox","\\Colonapprox");te("\\coloncolonsim","\\Colonsim");te("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");te("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");te("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");te("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");te("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");te("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");te("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");te("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");te("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");te("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");te("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");te("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");te("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");te("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");te("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");te("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");te("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");te("\\nleqq","\\html@mathml{\\@nleqq}{≰}");te("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");te("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");te("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");te("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");te("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");te("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");te("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");te("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");te("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");te("\\imath","\\html@mathml{\\@imath}{ı}");te("\\jmath","\\html@mathml{\\@jmath}{ȷ}");te("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");te("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");te("⟦","\\llbracket");te("⟧","\\rrbracket");te("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");te("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");te("⦃","\\lBrace");te("⦄","\\rBrace");te("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");te("⦵","\\minuso");te("\\darr","\\downarrow");te("\\dArr","\\Downarrow");te("\\Darr","\\Downarrow");te("\\lang","\\langle");te("\\rang","\\rangle");te("\\uarr","\\uparrow");te("\\uArr","\\Uparrow");te("\\Uarr","\\Uparrow");te("\\N","\\mathbb{N}");te("\\R","\\mathbb{R}");te("\\Z","\\mathbb{Z}");te("\\alef","\\aleph");te("\\alefsym","\\aleph");te("\\Alpha","\\mathrm{A}");te("\\Beta","\\mathrm{B}");te("\\bull","\\bullet");te("\\Chi","\\mathrm{X}");te("\\clubs","\\clubsuit");te("\\cnums","\\mathbb{C}");te("\\Complex","\\mathbb{C}");te("\\Dagger","\\ddagger");te("\\diamonds","\\diamondsuit");te("\\empty","\\emptyset");te("\\Epsilon","\\mathrm{E}");te("\\Eta","\\mathrm{H}");te("\\exist","\\exists");te("\\harr","\\leftrightarrow");te("\\hArr","\\Leftrightarrow");te("\\Harr","\\Leftrightarrow");te("\\hearts","\\heartsuit");te("\\image","\\Im");te("\\infin","\\infty");te("\\Iota","\\mathrm{I}");te("\\isin","\\in");te("\\Kappa","\\mathrm{K}");te("\\larr","\\leftarrow");te("\\lArr","\\Leftarrow");te("\\Larr","\\Leftarrow");te("\\lrarr","\\leftrightarrow");te("\\lrArr","\\Leftrightarrow");te("\\Lrarr","\\Leftrightarrow");te("\\Mu","\\mathrm{M}");te("\\natnums","\\mathbb{N}");te("\\Nu","\\mathrm{N}");te("\\Omicron","\\mathrm{O}");te("\\plusmn","\\pm");te("\\rarr","\\rightarrow");te("\\rArr","\\Rightarrow");te("\\Rarr","\\Rightarrow");te("\\real","\\Re");te("\\reals","\\mathbb{R}");te("\\Reals","\\mathbb{R}");te("\\Rho","\\mathrm{P}");te("\\sdot","\\cdot");te("\\sect","\\S");te("\\spades","\\spadesuit");te("\\sub","\\subset");te("\\sube","\\subseteq");te("\\supe","\\supseteq");te("\\Tau","\\mathrm{T}");te("\\thetasym","\\vartheta");te("\\weierp","\\wp");te("\\Zeta","\\mathrm{Z}");te("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");te("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");te("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");te("\\bra","\\mathinner{\\langle{#1}|}");te("\\ket","\\mathinner{|{#1}\\rangle}");te("\\braket","\\mathinner{\\langle{#1}\\rangle}");te("\\Bra","\\left\\langle#1\\right|");te("\\Ket","\\left|#1\\right\\rangle");var ree=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=f=>m=>{e&&(m.macros.set("|",o),r.length&&m.macros.set("\\|",a));var p=f;if(!f&&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}};te("\\bra@ket",ree(!1));te("\\bra@set",ree(!0));te("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");te("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");te("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");te("\\angln","{\\angl n}");te("\\blue","\\textcolor{##6495ed}{#1}");te("\\orange","\\textcolor{##ffa500}{#1}");te("\\pink","\\textcolor{##ff00af}{#1}");te("\\red","\\textcolor{##df0030}{#1}");te("\\green","\\textcolor{##28ae7b}{#1}");te("\\gray","\\textcolor{gray}{#1}");te("\\purple","\\textcolor{##9d38bd}{#1}");te("\\blueA","\\textcolor{##ccfaff}{#1}");te("\\blueB","\\textcolor{##80f6ff}{#1}");te("\\blueC","\\textcolor{##63d9ea}{#1}");te("\\blueD","\\textcolor{##11accd}{#1}");te("\\blueE","\\textcolor{##0c7f99}{#1}");te("\\tealA","\\textcolor{##94fff5}{#1}");te("\\tealB","\\textcolor{##26edd5}{#1}");te("\\tealC","\\textcolor{##01d1c1}{#1}");te("\\tealD","\\textcolor{##01a995}{#1}");te("\\tealE","\\textcolor{##208170}{#1}");te("\\greenA","\\textcolor{##b6ffb0}{#1}");te("\\greenB","\\textcolor{##8af281}{#1}");te("\\greenC","\\textcolor{##74cf70}{#1}");te("\\greenD","\\textcolor{##1fab54}{#1}");te("\\greenE","\\textcolor{##0d923f}{#1}");te("\\goldA","\\textcolor{##ffd0a9}{#1}");te("\\goldB","\\textcolor{##ffbb71}{#1}");te("\\goldC","\\textcolor{##ff9c39}{#1}");te("\\goldD","\\textcolor{##e07d10}{#1}");te("\\goldE","\\textcolor{##a75a05}{#1}");te("\\redA","\\textcolor{##fca9a9}{#1}");te("\\redB","\\textcolor{##ff8482}{#1}");te("\\redC","\\textcolor{##f9685d}{#1}");te("\\redD","\\textcolor{##e84d39}{#1}");te("\\redE","\\textcolor{##bc2612}{#1}");te("\\maroonA","\\textcolor{##ffbde0}{#1}");te("\\maroonB","\\textcolor{##ff92c6}{#1}");te("\\maroonC","\\textcolor{##ed5fa6}{#1}");te("\\maroonD","\\textcolor{##ca337c}{#1}");te("\\maroonE","\\textcolor{##9e034e}{#1}");te("\\purpleA","\\textcolor{##ddd7ff}{#1}");te("\\purpleB","\\textcolor{##c6b9fc}{#1}");te("\\purpleC","\\textcolor{##aa87ff}{#1}");te("\\purpleD","\\textcolor{##7854ab}{#1}");te("\\purpleE","\\textcolor{##543b78}{#1}");te("\\mintA","\\textcolor{##f5f9e8}{#1}");te("\\mintB","\\textcolor{##edf2df}{#1}");te("\\mintC","\\textcolor{##e0e5cc}{#1}");te("\\grayA","\\textcolor{##f6f7f7}{#1}");te("\\grayB","\\textcolor{##f0f1f2}{#1}");te("\\grayC","\\textcolor{##e3e5e6}{#1}");te("\\grayD","\\textcolor{##d6d8da}{#1}");te("\\grayE","\\textcolor{##babec2}{#1}");te("\\grayF","\\textcolor{##888d93}{#1}");te("\\grayG","\\textcolor{##626569}{#1}");te("\\grayH","\\textcolor{##3b3e40}{#1}");te("\\grayI","\\textcolor{##21242c}{#1}");te("\\kaBlue","\\textcolor{##314453}{#1}");te("\\kaGreen","\\textcolor{##71B307}{#1}");var iee={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class gTe{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 fTe(mTe,n.macros),this.mode=s,this.stack=[]}feed(t){this.lexer=new NF(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 Nc("EOF",s.loc)),this.pushTokens(r),new Nc("",ql.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 Pt("Extra }",i)}else if(i.text==="EOF")throw new Pt("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 Pt("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 Pt("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 Pt("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 Pt("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 Pt("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 Pt("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 Nc(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 NF(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)||pm.hasOwnProperty(t)||Li.math.hasOwnProperty(t)||Li.text.hasOwnProperty(t)||iee.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:pm.hasOwnProperty(t)&&!pm[t].primitive}}var RF=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,pS=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),h7={"́":{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"}},DF={á:"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 oee=class aee{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 gTe(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 Pt("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 Nc("}")),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(aee.endOfExpression.has(r.text)||n&&r.text===n||t&&pm[r.text]&&pm[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 Pt("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 Pt("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 Pt("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(s)throw new Pt("Double superscript",i);s=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(r)throw new Pt("Double subscript",i);r=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(s)throw new Pt("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(pS[i.text]){var u=RF.test(i.text),d=[];for(d.push(new Nc(pS[i.text])),this.consume();;){var f=this.fetch().text;if(!pS[f]||RF.test(f)!==u)break;d.unshift(new Nc(pS[f])),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=pm[r];if(!i)return null;if(this.consume(),n&&n!=="atom"&&!i.allowedInArgument)throw new Pt("Got function '"+r+"' with no arguments"+(n?" as "+n:""),s);if(this.mode==="text"&&!i.allowedInText)throw new Pt("Can't use function '"+r+"' in text mode",s);if(this.mode==="math"&&i.allowedInMath===!1)throw new Pt("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=pm[t];if(a&&a.handler)return a.handler(o,n,s);throw new Pt("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 Pt("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 Pt("A primitive argument cannot be optional");var o=this.parseGroup(t);if(o==null)throw new Pt("Expected group as "+t,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(s);default:throw new Pt("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 Pt("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 Pt("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 Pt("Invalid size: '"+n.text+"'",n);var i={number:+(r[1]+r[2]),unit:r[3]};if(!hZ(i))throw new Pt("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:ql.range(s,c),body:a,semisimple:r==="\\begingroup"||void 0}}else if(i=this.parseFunction(n,t)||this.parseSymbol(),i==null&&r[0]==="\\"&&!iee.hasOwnProperty(r)){if(this.settings.throwOnError)throw new Pt("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:ql.range(r,a),text:"---"}),n-=2):(t.splice(s,2,{type:"textord",mode:"text",loc:ql.range(r,o),text:"--"}),n-=1)}(i==="'"||i==="`")&&o.text===i&&(t.splice(s,2,{type:"textord",mode:"text",loc:ql.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 Pt(`\\verb assertion failed --
                    please report what input caused this bug`);return s=s.slice(1,-1),{type:"verb",mode:"text",body:s,star:r}}DF.hasOwnProperty(n[0])&&!Li[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=DF[n[0]]+n.slice(1));var i=dTe.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if(Li[this.mode][n]){this.settings.strict&&this.mode==="math"&&FA.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var a=Li[this.mode][n].group,c=ql.range(t),u;I3e(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&&(dZ(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:ql.range(t),text:n};else return null;if(this.consume(),i)for(var d=0;d<i[0].length;d++){var f=i[0][d];if(!h7[f])throw new Pt("Unknown accent ' "+f+"'",t);var m=h7[f][this.mode]||h7[f].text;if(!m)throw new Pt("Accent "+f+" unsupported in "+this.mode+" mode",t);o={type:"accent",mode:this.mode,loc:ql.range(t),label:m,isStretchy:!1,isShifty:!0,base:o}}return o}};oee.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var xR=function(t,n){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var s=new oee(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 Pt("\\tag works only in display equations");r=[{type:"tag",mode:"text",body:r,tag:s.subparse([new Nc("\\df@tag")])}]}return r},kR=function(t,n,s){n.textContent="";var r=_T(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."),kR=function(){throw new Pt("KaTeX doesn't work in quirks mode.")});var lee=function(t,n){var s=_T(t,n).toMarkup();return s},cee=function(t,n){var s=new aR(n);return xR(t,s)},uee=function(t,n,s){if(s.throwOnError||!(t instanceof Pt))throw t;var r=Nt(["katex-error"],[new Lc(n)]);return r.setAttribute("title",t.toString()),r.setAttribute("style","color:"+s.errorColor),r},_T=function(t,n){var s=new aR(n);try{var r=xR(t,s);return S3e(r,t,s)}catch(i){return uee(i,t,s)}},dee=function(t,n){var s=new aR(n);try{var r=xR(t,s);return C3e(r,t,s)}catch(i){return uee(i,t,s)}},hee="0.16.47",fee={Span:ay,Anchor:dT,SymbolNode:Lc,SvgNode:ff,PathNode:Um,LineNode:zA},nN={version:hee,render:kR,renderToString:lee,ParseError:Pt,SETTINGS_SCHEMA:yC,__parse:cee,__renderToDomTree:_T,__renderToHTMLTree:dee,__setFontMetrics:gZ,__defineSymbol:N,__defineFunction:pn,__defineMacro:te,__domTree:fee};const J8t=Object.freeze(Object.defineProperty({__proto__:null,ParseError:Pt,SETTINGS_SCHEMA:yC,__defineFunction:pn,__defineMacro:te,__defineSymbol:N,__domTree:fee,__parse:cee,__renderToDomTree:_T,__renderToHTMLTree:dee,__setFontMetrics:gZ,default:nN,get render(){return kR},renderToString:lee,version:hee},Symbol.toStringTag,{value:"Module"})),bTe={};function PF(e){const t=this,n=e||bTe,s=t.data(),r=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);r.push(CCe(n)),i.push(bCe()),o.push(yCe(n))}const LF=/[#.]/g;function yTe(e,t){const n=e||"",s={};let r=0,i,o;for(;r<n.length;){LF.lastIndex=r;const a=LF.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 mee(e,t,n){const s=n?kTe(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=yTe(i,t);const u=c.tagName.toLowerCase(),d=s?s.get(u):void 0;if(c.tagName=d||u,wTe(o))a.unshift(o);else for(const[f,m]of Object.entries(o))vTe(e,c.properties,f,m)}for(const u of a)sN(c.children,u);return c.type==="element"&&c.tagName==="template"&&(c.content={type:"root",children:c.children},c.children=[]),c}return r}function wTe(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 vTe(e,t,n,s){const r=FI(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=sz(s):r.commaSeparated?i=JB(s):r.commaOrSpaceSeparated?i=sz(JB(s).join(" ")):i=OF(r,r.property,s):Array.isArray(s)?i=[...s]:i=r.property==="style"?xTe(s):String(s);if(Array.isArray(i)){const o=[];for(const a of i)o.push(OF(r,r.property,a));i=o}r.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[r.property]=i}}function sN(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)sN(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?sN(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function OF(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||Xv(n)===Xv(t)))return!0}return n}function xTe(e){const t=[];for(const[n,s]of Object.entries(e))t.push([n,s].join(": "));return t.join("; ")}function kTe(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const _Te=["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"],STe=mee(HI,"div"),CTe=mee(ry,"g",_Te),f7={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function TTe(e,t){return pee(e,{})||{type:"root",children:[]}}function pee(e,t){const n=ETe(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function ETe(e,t){switch(e.nodeType){case 1:return MTe(e,t);case 3:return ATe(e);case 8:return NTe(e);case 9:return $F(e,t);case 10:return jTe();case 11:return $F(e,t);default:return}}function $F(e,t){return{type:"root",children:gee(e,t)}}function jTe(){return{type:"doctype"}}function ATe(e){return{type:"text",value:e.nodeValue||""}}function NTe(e){return{type:"comment",value:e.nodeValue||""}}function MTe(e,t){const n=e.namespaceURI,s=n===f7.svg?CTe:STe,r=n===f7.html?e.tagName.toLowerCase():e.tagName,i=n===f7.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,gee(i,t))}function gee(e,t){const n=e.childNodes,s=[];let r=-1;for(;++r<n.length;){const i=pee(n[r],t);i!==void 0&&s.push(i)}return s}new DOMParser;function ITe(e,t){const n=RTe(e);return TTe(n)}function RTe(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const BF=function(e,t,n){const s=uk(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]},pg=function(e){if(e==null)return LTe;if(typeof e=="string")return PTe(e);if(typeof e=="object")return DTe(e);if(typeof e=="function")return _R(e);throw new Error("Expected function, string, or array as `test`")};function DTe(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=pg(e[n]);return _R(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function PTe(e){return _R(t);function t(n){return n.tagName===e}}function _R(e){return t;function t(n,s,r){return!!(OTe(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function LTe(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function OTe(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const zF=/\n/g,FF=/[\t ]+/g,rN=pg("br"),HF=pg(WTe),$Te=pg("p"),qF=pg("tr"),BTe=pg(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",UTe,VTe]),bee=pg(["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 zTe(e,t){const n=t||{},s="children"in e?e.children:[],r=bee(e),i=vee(e,{whitespace:n.whitespace||"normal"}),o=[];(e.type==="text"||e.type==="comment")&&o.push(...wee(e,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<s.length;)o.push(...yee(s[a],e,{whitespace:i,breakBefore:a?void 0:r,breakAfter:a<s.length-1?rN(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 yee(e,t,n){return e.type==="element"?FTe(e,t,n):e.type==="text"?n.whitespace==="normal"?wee(e,n):HTe(e):[]}function FTe(e,t,n){const s=vee(e,n),r=e.children||[];let i=-1,o=[];if(BTe(e))return o;let a,c;for(rN(e)||qF(e)&&BF(t,e,qF)?c=`
`:$Te(e)?(a=2,c=2):bee(e)&&(a=1,c=1);++i<r.length;)o=o.concat(yee(r[i],e,{whitespace:s,breakBefore:i?void 0:a,breakAfter:i<r.length-1?rN(r[i+1]):c}));return HF(e)&&BF(t,e,HF)&&o.push("	"),a&&o.unshift(a),c&&o.push(c),o}function wee(e,t){const n=String(e.value),s=[],r=[];let i=0;for(;i<=n.length;){zF.lastIndex=i;const c=zF.exec(n),u=c&&"index"in c?c.index:n.length;s.push(qTe(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 HTe(e){return[String(e.value)]}function qTe(e,t,n){const s=[];let r=0,i;for(;r<e.length;){FF.lastIndex=r;const o=FF.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 vee(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 UTe(e){return!!(e.properties||{}).hidden}function WTe(e){return e.tagName==="td"||e.tagName==="th"}function VTe(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const GTe={},KTe=[];function UF(e){const t=e||GTe;return function(n,s){tR(n,"element",function(r,i){const o=Array.isArray(r.properties.className)?r.properties.className:KTe,a=o.includes("language-math"),c=o.includes("math-display"),u=o.includes("math-inline");let d=c;if(!a&&!c&&!u)return;let f=i[i.length-1],m=r;if(r.tagName==="code"&&a&&f&&f.type==="element"&&f.tagName==="pre"&&(m=f,f=i[i.length-2],d=!0),!f)return;const p=zTe(m,{whitespace:"pre"});let g;try{g=nN.renderToString(p,{...t,displayMode:d,throwOnError:!0})}catch(v){const y=v,w=y.name.toLowerCase();s.message("Could not render math with KaTeX",{ancestors:[...i,r],cause:y,place:r.position,ruleId:w,source:"rehype-katex"});try{g=nN.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=ITe(g).children);const b=f.children.indexOf(m);return f.children.splice(b,1,...g),OJ})}}const xee=[{id:"abap",name:"ABAP",import:()=>he(()=>import("./abap-DsBKuouk.js"),[])},{id:"actionscript-3",name:"ActionScript",import:()=>he(()=>import("./actionscript-3-D_z4Izcz.js"),[])},{id:"ada",name:"Ada",import:()=>he(()=>import("./ada-727ZlQH0.js"),[])},{id:"angular-html",name:"Angular HTML",import:()=>he(()=>import("./angular-html-LfdN0zeE.js").then(e=>e.f),__vite__mapDeps([0,1,2,3]))},{id:"angular-ts",name:"Angular TypeScript",import:()=>he(()=>import("./angular-ts-CKsD7JZE.js"),__vite__mapDeps([4,0,1,2,3,5]))},{id:"apache",name:"Apache Conf",import:()=>he(()=>import("./apache-Dn00JSTd.js"),[])},{id:"apex",name:"Apex",import:()=>he(()=>import("./apex-COJ4H7py.js"),[])},{id:"apl",name:"APL",import:()=>he(()=>import("./apl-BBq3IX1j.js"),__vite__mapDeps([6,1,2,3,7,8,9]))},{id:"applescript",name:"AppleScript",import:()=>he(()=>import("./applescript-Bu5BbsvL.js"),[])},{id:"ara",name:"Ara",import:()=>he(()=>import("./ara-7O62HKoU.js"),[])},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>he(()=>import("./asciidoc-BPT9niGB.js"),[])},{id:"asm",name:"Assembly",import:()=>he(()=>import("./asm-Dhn9LcZ4.js"),[])},{id:"astro",name:"Astro",import:()=>he(()=>import("./astro-CqkE3fuf.js"),__vite__mapDeps([10,9,2,11,3,12]))},{id:"awk",name:"AWK",import:()=>he(()=>import("./awk-eg146-Ew.js"),[])},{id:"ballerina",name:"Ballerina",import:()=>he(()=>import("./ballerina-Du268qiB.js"),[])},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>he(()=>import("./bat-fje9CFhw.js"),[])},{id:"beancount",name:"Beancount",import:()=>he(()=>import("./beancount-BwXTMy5W.js"),[])},{id:"berry",name:"Berry",aliases:["be"],import:()=>he(()=>import("./berry-3xVqZejG.js"),[])},{id:"bibtex",name:"BibTeX",import:()=>he(()=>import("./bibtex-xW4inM5L.js"),[])},{id:"bicep",name:"Bicep",import:()=>he(()=>import("./bicep-DHo0CJ0O.js"),[])},{id:"blade",name:"Blade",import:()=>he(()=>import("./blade-a8OxSdnT.js"),__vite__mapDeps([13,1,2,3,7,8,14,9]))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>he(()=>import("./bsl-Dgyn0ogV.js"),__vite__mapDeps([15,16]))},{id:"c",name:"C",import:()=>he(()=>import("./c-C3t2pwGQ.js"),[])},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>he(()=>import("./cadence-DNquZEk8.js"),[])},{id:"cairo",name:"Cairo",import:()=>he(()=>import("./cairo--RitsXJZ.js"),__vite__mapDeps([17,18]))},{id:"clarity",name:"Clarity",import:()=>he(()=>import("./clarity-BHOwM8T6.js"),[])},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>he(()=>import("./clojure-DxSadP1t.js"),[])},{id:"cmake",name:"CMake",import:()=>he(()=>import("./cmake-DbXoA79R.js"),[])},{id:"cobol",name:"COBOL",import:()=>he(()=>import("./cobol-PTqiYgYu.js"),__vite__mapDeps([19,1,2,3,8]))},{id:"codeowners",name:"CODEOWNERS",import:()=>he(()=>import("./codeowners-Bp6g37R7.js"),[])},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>he(()=>import("./codeql-sacFqUAJ.js"),[])},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>he(()=>import("./coffee-dyiR41kL.js"),__vite__mapDeps([20,2]))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>he(()=>import("./common-lisp-C7gG9l05.js"),[])},{id:"coq",name:"Coq",import:()=>he(()=>import("./coq-Dsg_Bt_b.js"),[])},{id:"cpp",name:"C++",aliases:["c++"],import:()=>he(()=>import("./cpp-BksuvNSY.js"),__vite__mapDeps([21,22,23,24,14]))},{id:"crystal",name:"Crystal",import:()=>he(()=>import("./crystal-DtDmRg-F.js"),__vite__mapDeps([25,1,2,3,14,24,26]))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>he(()=>import("./csharp-D9R-vmeu.js"),[])},{id:"css",name:"CSS",import:()=>he(()=>import("./css-BPhBrDlE.js"),[])},{id:"csv",name:"CSV",import:()=>he(()=>import("./csv-B0qRVHPH.js"),[])},{id:"cue",name:"CUE",import:()=>he(()=>import("./cue-DtFQj3wx.js"),[])},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>he(()=>import("./cypher-m2LEI-9-.js"),[])},{id:"d",name:"D",import:()=>he(()=>import("./d-BoXegm-a.js"),[])},{id:"dart",name:"Dart",import:()=>he(()=>import("./dart-B9wLZaAG.js"),[])},{id:"dax",name:"DAX",import:()=>he(()=>import("./dax-ClGRhx96.js"),[])},{id:"desktop",name:"Desktop",import:()=>he(()=>import("./desktop-DEIpsLCJ.js"),[])},{id:"diff",name:"Diff",import:()=>he(()=>import("./diff-BgYniUM_.js"),[])},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>he(()=>import("./docker-COcR7UxN.js"),[])},{id:"dotenv",name:"dotEnv",import:()=>he(()=>import("./dotenv-BjQB5zDj.js"),[])},{id:"dream-maker",name:"Dream Maker",import:()=>he(()=>import("./dream-maker-C-nORZOA.js"),[])},{id:"edge",name:"Edge",import:()=>he(()=>import("./edge-D5gP-w-T.js"),__vite__mapDeps([27,11,1,2,3,28]))},{id:"elixir",name:"Elixir",import:()=>he(()=>import("./elixir-CLiX3zqd.js"),__vite__mapDeps([29,1,2,3]))},{id:"elm",name:"Elm",import:()=>he(()=>import("./elm-CmHSxxaM.js"),__vite__mapDeps([30,23,24]))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>he(()=>import("./emacs-lisp-BX77sIaO.js"),[])},{id:"erb",name:"ERB",import:()=>he(()=>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:()=>he(()=>import("./erlang-B-DoSBHF.js"),[])},{id:"fennel",name:"Fennel",import:()=>he(()=>import("./fennel-bCA53EVm.js"),[])},{id:"fish",name:"Fish",import:()=>he(()=>import("./fish-w-ucz2PV.js"),[])},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>he(()=>import("./fluent-Dayu4EKP.js"),[])},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>he(()=>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:()=>he(()=>import("./fortran-free-form-DKXYxT9g.js"),[])},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>he(()=>import("./fsharp-XplgxFYe.js"),__vite__mapDeps([41,42]))},{id:"gdresource",name:"GDResource",import:()=>he(()=>import("./gdresource-BHYsBjWJ.js"),__vite__mapDeps([43,44,45]))},{id:"gdscript",name:"GDScript",import:()=>he(()=>import("./gdscript-DfxzS6Rs.js"),[])},{id:"gdshader",name:"GDShader",import:()=>he(()=>import("./gdshader-SKMF96pI.js"),[])},{id:"genie",name:"Genie",import:()=>he(()=>import("./genie-ajMbGru0.js"),[])},{id:"gherkin",name:"Gherkin",import:()=>he(()=>import("./gherkin--30QC5Em.js"),[])},{id:"git-commit",name:"Git Commit Message",import:()=>he(()=>import("./git-commit-i4q6IMui.js"),__vite__mapDeps([46,47]))},{id:"git-rebase",name:"Git Rebase Message",import:()=>he(()=>import("./git-rebase-B-v9cOL2.js"),__vite__mapDeps([48,26]))},{id:"gleam",name:"Gleam",import:()=>he(()=>import("./gleam-B430Bg39.js"),[])},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>he(()=>import("./glimmer-js-D-cwc0-E.js"),__vite__mapDeps([49,2,11,3,1]))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>he(()=>import("./glimmer-ts-pgjy16dm.js"),__vite__mapDeps([50,11,3,2,1]))},{id:"glsl",name:"GLSL",import:()=>he(()=>import("./glsl-DBO2IWDn.js"),__vite__mapDeps([23,24]))},{id:"gnuplot",name:"Gnuplot",import:()=>he(()=>import("./gnuplot-CM8KxXT1.js"),[])},{id:"go",name:"Go",import:()=>he(()=>import("./go-B1SYOhNW.js"),[])},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>he(()=>import("./graphql-cDcHW_If.js"),__vite__mapDeps([34,2,11,35,36]))},{id:"groovy",name:"Groovy",import:()=>he(()=>import("./groovy-DkBy-JyN.js"),[])},{id:"hack",name:"Hack",import:()=>he(()=>import("./hack-D1yCygmZ.js"),__vite__mapDeps([51,1,2,3,14]))},{id:"haml",name:"Ruby Haml",import:()=>he(()=>import("./haml-B2EZWmdv.js"),__vite__mapDeps([33,2,3]))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>he(()=>import("./handlebars-BQGss363.js"),__vite__mapDeps([52,1,2,3,38]))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>he(()=>import("./haskell-BILxekzW.js"),[])},{id:"haxe",name:"Haxe",import:()=>he(()=>import("./haxe-C5wWYbrZ.js"),[])},{id:"hcl",name:"HashiCorp HCL",import:()=>he(()=>import("./hcl-HzYwdGDm.js"),[])},{id:"hjson",name:"Hjson",import:()=>he(()=>import("./hjson-T-Tgc4AT.js"),[])},{id:"hlsl",name:"HLSL",import:()=>he(()=>import("./hlsl-ifBTmRxC.js"),[])},{id:"html",name:"HTML",import:()=>he(()=>import("./html-C2L_23MC.js"),__vite__mapDeps([1,2,3]))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>he(()=>import("./html-derivative-CSfWNPLT.js"),__vite__mapDeps([28,1,2,3]))},{id:"http",name:"HTTP",import:()=>he(()=>import("./http-FRrOvY1W.js"),__vite__mapDeps([53,26,9,7,8,34,2,11,35,36]))},{id:"hxml",name:"HXML",import:()=>he(()=>import("./hxml-TIA70rKU.js"),__vite__mapDeps([54,55]))},{id:"hy",name:"Hy",import:()=>he(()=>import("./hy-BMj5Y0dO.js"),[])},{id:"imba",name:"Imba",import:()=>he(()=>import("./imba-bv_oIlVt.js"),__vite__mapDeps([56,11]))},{id:"ini",name:"INI",aliases:["properties"],import:()=>he(()=>import("./ini-BjABl1g7.js"),[])},{id:"java",name:"Java",import:()=>he(()=>import("./java-xI-RfyKK.js"),[])},{id:"javascript",name:"JavaScript",aliases:["js"],import:()=>he(()=>import("./javascript-ySlJ1b_l.js"),[])},{id:"jinja",name:"Jinja",import:()=>he(()=>import("./jinja-DGy0s7-h.js"),__vite__mapDeps([57,1,2,3]))},{id:"jison",name:"Jison",import:()=>he(()=>import("./jison-BqZprYcd.js"),__vite__mapDeps([58,2]))},{id:"json",name:"JSON",import:()=>he(()=>import("./json-BQoSv7ci.js"),[])},{id:"json5",name:"JSON5",import:()=>he(()=>import("./json5-w8dY5SsB.js"),[])},{id:"jsonc",name:"JSON with Comments",import:()=>he(()=>import("./jsonc-TU54ms6u.js"),[])},{id:"jsonl",name:"JSON Lines",import:()=>he(()=>import("./jsonl-DREVFZK8.js"),[])},{id:"jsonnet",name:"Jsonnet",import:()=>he(()=>import("./jsonnet-BfivnA6A.js"),[])},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>he(()=>import("./jssm-P4WzXJd0.js"),[])},{id:"jsx",name:"JSX",import:()=>he(()=>import("./jsx-BAng5TT0.js"),[])},{id:"julia",name:"Julia",aliases:["jl"],import:()=>he(()=>import("./julia-BBuGR-5E.js"),__vite__mapDeps([59,21,22,23,24,14,18,2,60]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>he(()=>import("./kotlin-B5lbUyaz.js"),[])},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>he(()=>import("./kusto-mebxcVVE.js"),[])},{id:"latex",name:"LaTeX",import:()=>he(()=>import("./latex-C-cWTeAZ.js"),__vite__mapDeps([61,62,60]))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>he(()=>import("./lean-XBlWyCtg.js"),[])},{id:"less",name:"Less",import:()=>he(()=>import("./less-BfCpw3nA.js"),[])},{id:"liquid",name:"Liquid",import:()=>he(()=>import("./liquid-D3W5UaiH.js"),__vite__mapDeps([63,1,2,3,9]))},{id:"log",name:"Log file",import:()=>he(()=>import("./log-Cc5clBb7.js"),[])},{id:"logo",name:"Logo",import:()=>he(()=>import("./logo-IuBKFhSY.js"),[])},{id:"lua",name:"Lua",import:()=>he(()=>import("./lua-CvWAzNxB.js"),__vite__mapDeps([37,24]))},{id:"luau",name:"Luau",import:()=>he(()=>import("./luau-Du5NY7AG.js"),[])},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>he(()=>import("./make-Bvotw-X0.js"),[])},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>he(()=>import("./markdown-UIAJJxZW.js"),[])},{id:"marko",name:"Marko",import:()=>he(()=>import("./marko-z0MBrx5-.js"),__vite__mapDeps([64,3,65,5,2]))},{id:"matlab",name:"MATLAB",import:()=>he(()=>import("./matlab-D9-PGadD.js"),[])},{id:"mdc",name:"MDC",import:()=>he(()=>import("./mdc-DB_EDNY_.js"),__vite__mapDeps([66,42,38,28,1,2,3]))},{id:"mdx",name:"MDX",import:()=>he(()=>import("./mdx-sdHcTMYB.js"),[])},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>he(()=>import("./mermaid-Ci6OQyBP.js"),[])},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>he(()=>import("./mipsasm-BC5c_5Pe.js"),[])},{id:"mojo",name:"Mojo",import:()=>he(()=>import("./mojo-Tz6hzZYG.js"),[])},{id:"move",name:"Move",import:()=>he(()=>import("./move-DB_GagMm.js"),[])},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>he(()=>import("./narrat-DLbgOhZU.js"),[])},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>he(()=>import("./nextflow-B0XVJmRM.js"),[])},{id:"nginx",name:"Nginx",import:()=>he(()=>import("./nginx-D_VnBJ67.js"),__vite__mapDeps([67,37,24]))},{id:"nim",name:"Nim",import:()=>he(()=>import("./nim-ZlGxZxc3.js"),__vite__mapDeps([68,24,1,2,3,7,8,23,42]))},{id:"nix",name:"Nix",import:()=>he(()=>import("./nix-shcSOmrb.js"),[])},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>he(()=>import("./nushell-D4Tzg5kh.js"),[])},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>he(()=>import("./objective-c-Deuh7S70.js"),[])},{id:"objective-cpp",name:"Objective-C++",import:()=>he(()=>import("./objective-cpp-BUEGK8hf.js"),[])},{id:"ocaml",name:"OCaml",import:()=>he(()=>import("./ocaml-BNioltXt.js"),[])},{id:"pascal",name:"Pascal",import:()=>he(()=>import("./pascal-JqZropPD.js"),[])},{id:"perl",name:"Perl",import:()=>he(()=>import("./perl-CHQXSrWU.js"),__vite__mapDeps([69,1,2,3,7,8,14]))},{id:"php",name:"PHP",import:()=>he(()=>import("./php-B5ebYQev.js"),__vite__mapDeps([70,1,2,3,7,8,14,9]))},{id:"plsql",name:"PL/SQL",import:()=>he(()=>import("./plsql-LKU2TuZ1.js"),[])},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>he(()=>import("./po-BFLt1xDp.js"),[])},{id:"polar",name:"Polar",import:()=>he(()=>import("./polar-DKykz6zU.js"),[])},{id:"postcss",name:"PostCSS",import:()=>he(()=>import("./postcss-B3ZDOciz.js"),[])},{id:"powerquery",name:"PowerQuery",import:()=>he(()=>import("./powerquery-CSHBycmS.js"),[])},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>he(()=>import("./powershell-BIEUsx6d.js"),[])},{id:"prisma",name:"Prisma",import:()=>he(()=>import("./prisma-B48N-Iqd.js"),[])},{id:"prolog",name:"Prolog",import:()=>he(()=>import("./prolog-BY-TUvya.js"),[])},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>he(()=>import("./proto-zocC4JxJ.js"),[])},{id:"pug",name:"Pug",aliases:["jade"],import:()=>he(()=>import("./pug-CM9l7STV.js"),__vite__mapDeps([71,2,3,1]))},{id:"puppet",name:"Puppet",import:()=>he(()=>import("./puppet-Cza_XSSt.js"),[])},{id:"purescript",name:"PureScript",import:()=>he(()=>import("./purescript-Bg-kzb6g.js"),[])},{id:"python",name:"Python",aliases:["py"],import:()=>he(()=>import("./python-DhUJRlN_.js"),[])},{id:"qml",name:"QML",import:()=>he(()=>import("./qml-D8XfuvdV.js"),__vite__mapDeps([72,2]))},{id:"qmldir",name:"QML Directory",import:()=>he(()=>import("./qmldir-C8lEn-DE.js"),[])},{id:"qss",name:"Qt Style Sheets",import:()=>he(()=>import("./qss-DhMKtDLN.js"),[])},{id:"r",name:"R",import:()=>he(()=>import("./r-CwjWoCRV.js"),[])},{id:"racket",name:"Racket",import:()=>he(()=>import("./racket-CzouJOBO.js"),[])},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>he(()=>import("./raku-B1bQXN8T.js"),[])},{id:"razor",name:"ASP.NET Razor",import:()=>he(()=>import("./razor-CNLDkMZG.js"),__vite__mapDeps([73,1,2,3,74]))},{id:"reg",name:"Windows Registry Script",import:()=>he(()=>import("./reg-5LuOXUq_.js"),[])},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>he(()=>import("./regexp-DWJ3fJO_.js"),[])},{id:"rel",name:"Rel",import:()=>he(()=>import("./rel-DJlmqQ1C.js"),[])},{id:"riscv",name:"RISC-V",import:()=>he(()=>import("./riscv-QhoSD0DR.js"),[])},{id:"rst",name:"reStructuredText",import:()=>he(()=>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:()=>he(()=>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:()=>he(()=>import("./rust-Be6lgOlo.js"),[])},{id:"sas",name:"SAS",import:()=>he(()=>import("./sas-BmTFh92c.js"),__vite__mapDeps([77,14]))},{id:"sass",name:"Sass",import:()=>he(()=>import("./sass-BJ4Li9vH.js"),[])},{id:"scala",name:"Scala",import:()=>he(()=>import("./scala-DQVVAn-B.js"),[])},{id:"scheme",name:"Scheme",import:()=>he(()=>import("./scheme-BJGe-b2p.js"),[])},{id:"scss",name:"SCSS",import:()=>he(()=>import("./scss-C31hgJw-.js"),__vite__mapDeps([5,3]))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>he(()=>import("./sdbl-BLhTXw86.js"),[])},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>he(()=>import("./shaderlab-B7qAK45m.js"),__vite__mapDeps([78,79]))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>he(()=>import("./shellscript-atvbtKCR.js"),[])},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>he(()=>import("./shellsession-C_rIy8kc.js"),__vite__mapDeps([80,26]))},{id:"smalltalk",name:"Smalltalk",import:()=>he(()=>import("./smalltalk-DkLiglaE.js"),[])},{id:"solidity",name:"Solidity",import:()=>he(()=>import("./solidity-C1w2a3ep.js"),[])},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>he(()=>import("./soy-C-lX7w71.js"),__vite__mapDeps([81,1,2,3]))},{id:"sparql",name:"SPARQL",import:()=>he(()=>import("./sparql-bYkjHRlG.js"),__vite__mapDeps([82,83]))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>he(()=>import("./splunk-Cf8iN4DR.js"),[])},{id:"sql",name:"SQL",import:()=>he(()=>import("./sql-COK4E0Yg.js"),[])},{id:"ssh-config",name:"SSH Config",import:()=>he(()=>import("./ssh-config-BknIz3MU.js"),[])},{id:"stata",name:"Stata",import:()=>he(()=>import("./stata-DorPZHa4.js"),__vite__mapDeps([84,14]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>he(()=>import("./stylus-BeQkCIfX.js"),[])},{id:"svelte",name:"Svelte",import:()=>he(()=>import("./svelte-MSaWC3Je.js"),__vite__mapDeps([85,2,11,3,12]))},{id:"swift",name:"Swift",import:()=>he(()=>import("./swift-BSxZ-RaX.js"),[])},{id:"system-verilog",name:"SystemVerilog",import:()=>he(()=>import("./system-verilog-C7L56vO4.js"),[])},{id:"systemd",name:"Systemd Units",import:()=>he(()=>import("./systemd-CUnW07Te.js"),[])},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>he(()=>import("./talonscript-C1XDQQGZ.js"),[])},{id:"tasl",name:"Tasl",import:()=>he(()=>import("./tasl-CQjiPCtT.js"),[])},{id:"tcl",name:"Tcl",import:()=>he(()=>import("./tcl-DQ1-QYvQ.js"),[])},{id:"templ",name:"Templ",import:()=>he(()=>import("./templ-dwX3ZSMB.js"),__vite__mapDeps([86,87,2,3]))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>he(()=>import("./terraform-BbSNqyBO.js"),[])},{id:"tex",name:"TeX",import:()=>he(()=>import("./tex-rYs2v40G.js"),__vite__mapDeps([62,60]))},{id:"toml",name:"TOML",import:()=>he(()=>import("./toml-CB2ApiWb.js"),[])},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>he(()=>import("./ts-tags-CipyTH0X.js"),__vite__mapDeps([88,11,3,2,23,24,1,14,7,8]))},{id:"tsv",name:"TSV",import:()=>he(()=>import("./tsv-B_m7g4N7.js"),[])},{id:"tsx",name:"TSX",import:()=>he(()=>import("./tsx-B6W0miNI.js"),[])},{id:"turtle",name:"Turtle",import:()=>he(()=>import("./turtle-BMR_PYu6.js"),[])},{id:"twig",name:"Twig",import:()=>he(()=>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:()=>he(()=>import("./typescript-Dj6nwHGl.js"),[])},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>he(()=>import("./typespec-BpWG_bgh.js"),[])},{id:"typst",name:"Typst",aliases:["typ"],import:()=>he(()=>import("./typst-BVUVsWT6.js"),[])},{id:"v",name:"V",import:()=>he(()=>import("./v-CAQ2eGtk.js"),[])},{id:"vala",name:"Vala",import:()=>he(()=>import("./vala-BFOHcciG.js"),[])},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>he(()=>import("./vb-CdO5JTpU.js"),[])},{id:"verilog",name:"Verilog",import:()=>he(()=>import("./verilog-CJaU5se_.js"),[])},{id:"vhdl",name:"VHDL",import:()=>he(()=>import("./vhdl-DYoNaHQp.js"),[])},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>he(()=>import("./viml-m4uW47V2.js"),[])},{id:"vue",name:"Vue",import:()=>he(()=>import("./vue-BuYVFjOK.js"),__vite__mapDeps([90,1,2,3,11,9,28]))},{id:"vue-html",name:"Vue HTML",import:()=>he(()=>import("./vue-html-xdeiXROB.js"),__vite__mapDeps([91,90,1,2,3,11,9,28]))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>he(()=>import("./vyper-nyqBNV6O.js"),[])},{id:"wasm",name:"WebAssembly",import:()=>he(()=>import("./wasm-C6j12Q_x.js"),[])},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>he(()=>import("./wenyan-7A4Fjokl.js"),[])},{id:"wgsl",name:"WGSL",import:()=>he(()=>import("./wgsl-CB0Krxn9.js"),[])},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>he(()=>import("./wikitext-DCE3LsBG.js"),[])},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>he(()=>import("./wolfram-C3FkfJm5.js"),[])},{id:"xml",name:"XML",import:()=>he(()=>import("./xml-e3z08dGr.js"),__vite__mapDeps([7,8]))},{id:"xsl",name:"XSL",import:()=>he(()=>import("./xsl-Dd0NUgwM.js"),__vite__mapDeps([92,7,8]))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>he(()=>import("./yaml-CVw76BM1.js"),[])},{id:"zenscript",name:"ZenScript",import:()=>he(()=>import("./zenscript-HnGAYVZD.js"),[])},{id:"zig",name:"Zig",import:()=>he(()=>import("./zig-BVz_zdnA.js"),[])}],YTe=Object.fromEntries(xee.map(e=>[e.id,e.import])),XTe=Object.fromEntries(xee.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),QTe={...YTe,...XTe},JTe=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>he(()=>import("./andromeeda-C3khCPGq.js"),[])},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>he(()=>import("./aurora-x-D-2ljcwZ.js"),[])},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>he(()=>import("./ayu-dark-Cv9koXgw.js"),[])},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>he(()=>import("./catppuccin-frappe-CD_QflpE.js"),[])},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>he(()=>import("./catppuccin-latte-DRW-0cLl.js"),[])},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>he(()=>import("./catppuccin-macchiato-C-_shW-Y.js"),[])},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>he(()=>import("./catppuccin-mocha-LGGdnPYs.js"),[])},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>he(()=>import("./dark-plus-C3mMm8J8.js"),[])},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>he(()=>import("./dracula-BzJJZx-M.js"),[])},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>he(()=>import("./dracula-soft-BXkSAIEj.js"),[])},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>he(()=>import("./everforest-dark-BgDCqdQA.js"),[])},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>he(()=>import("./everforest-light-C8M2exoo.js"),[])},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>he(()=>import("./github-dark-DHJKELXO.js"),[])},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>he(()=>import("./github-dark-default-Cuk6v7N8.js"),[])},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>he(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[])},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>he(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[])},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>he(()=>import("./github-light-DAi9KRSo.js"),[])},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>he(()=>import("./github-light-default-D7oLnXFd.js"),[])},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>he(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[])},{id:"houston",displayName:"Houston",type:"dark",import:()=>he(()=>import("./houston-DnULxvSX.js"),[])},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>he(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[])},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>he(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[])},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>he(()=>import("./kanagawa-wave-DWedfzmr.js"),[])},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>he(()=>import("./laserwave-DUszq2jm.js"),[])},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>he(()=>import("./light-plus-B7mTdjB0.js"),[])},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>he(()=>import("./material-theme-D5KoaKCx.js"),[])},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>he(()=>import("./material-theme-darker-BfHTSMKl.js"),[])},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>he(()=>import("./material-theme-lighter-B0m2ddpp.js"),[])},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>he(()=>import("./material-theme-ocean-CyktbL80.js"),[])},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>he(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[])},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>he(()=>import("./min-dark-CafNBF8u.js"),[])},{id:"min-light",displayName:"Min Light",type:"light",import:()=>he(()=>import("./min-light-CTRr51gU.js"),[])},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>he(()=>import("./monokai-D4h5O-jR.js"),[])},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>he(()=>import("./night-owl-C39BiMTA.js"),[])},{id:"nord",displayName:"Nord",type:"dark",import:()=>he(()=>import("./nord-Ddv68eIx.js"),[])},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>he(()=>import("./one-dark-pro-GBQ2dnAY.js"),[])},{id:"one-light",displayName:"One Light",type:"light",import:()=>he(()=>import("./one-light-PoHY5YXO.js"),[])},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>he(()=>import("./plastic-3e1v2bzS.js"),[])},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>he(()=>import("./poimandres-CS3Unz2-.js"),[])},{id:"red",displayName:"Red",type:"dark",import:()=>he(()=>import("./red-bN70gL4F.js"),[])},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>he(()=>import("./rose-pine-CmCqftbK.js"),[])},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>he(()=>import("./rose-pine-dawn-Ds-gbosJ.js"),[])},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>he(()=>import("./rose-pine-moon-CjDtw9vr.js"),[])},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>he(()=>import("./slack-dark-BthQWCQV.js"),[])},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>he(()=>import("./slack-ochin-DqwNpetd.js"),[])},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>he(()=>import("./snazzy-light-Bw305WKR.js"),[])},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>he(()=>import("./solarized-dark-DXbdFlpD.js"),[])},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>he(()=>import("./solarized-light-L9t79GZl.js"),[])},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>he(()=>import("./synthwave-84-CbfX1IO0.js"),[])},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>he(()=>import("./tokyo-night-DBQeEorK.js"),[])},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>he(()=>import("./vesper-BEBZ7ncR.js"),[])},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>he(()=>import("./vitesse-black-Bkuqu6BP.js"),[])},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>he(()=>import("./vitesse-dark-D0r3Knsf.js"),[])},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>he(()=>import("./vitesse-light-CVO1_9PV.js"),[])}],ZTe=Object.fromEntries(JTe.map(e=>[e.id,e.import]));let Qh=class extends Error{constructor(t){super(t),this.name="ShikiError"}},SR=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function e5e(){return 2147483648}function t5e(){return typeof performance<"u"?performance.now():Date.now()}const n5e=(e,t)=>e+(t-e%t)%t;async function s5e(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=e5e();if(p>b)return!1;for(let v=1;v<=4;v*=2){let y=g*(1+.2/v);y=Math.min(y,p+100663296);const w=Math.min(b,n5e(Math.max(p,y),65536));if(o(w))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 y=g;for(;p[y]&&!(y>=v);)++y;if(y-g>16&&p.buffer&&c)return c.decode(p.subarray(g,y));let w="";for(;g<y;){let x=p[g++];if(!(x&128)){w+=String.fromCharCode(x);continue}const k=p[g++]&63;if((x&224)===192){w+=String.fromCharCode((x&31)<<6|k);continue}const C=p[g++]&63;if((x&240)===224?x=(x&15)<<12|k<<6|C:x=(x&7)<<18|k<<12|C<<6|p[g++]&63,x<65536)w+=String.fromCharCode(x);else{const T=x-65536;w+=String.fromCharCode(55296|T>>10,56320|T&1023)}}return w}function d(p,g){return p?u(s.HEAPU8,p,g):""}const f={emscripten_get_now:t5e,emscripten_memcpy_big:i,emscripten_resize_heap:a,fd_write:()=>0};async function m(){const g=await e({env:f,wasi_snapshot_preview1:f});t=g.memory,r(t.buffer),Object.assign(s,g),s.UTF8ToString=d}return await m(),s}var r5e=Object.defineProperty,i5e=(e,t,n)=>t in e?r5e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vo=(e,t,n)=>(i5e(e,typeof t!="symbol"?t+"":t,n),n);let aa=null;function o5e(e){throw new SR(e.UTF8ToString(e.getLastOnigError()))}class ST{constructor(t){Vo(this,"utf16Length"),Vo(this,"utf8Length"),Vo(this,"utf16Value"),Vo(this,"utf8Value"),Vo(this,"utf16OffsetToUtf8"),Vo(this,"utf8OffsetToUtf16");const n=t.length,s=ST._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 f=d,m=!1;if(d>=55296&&d<=56319&&u+1<n){const p=t.charCodeAt(u+1);p>=56320&&p<=57343&&(f=(d-55296<<10)+65536|p-56320,m=!0)}r&&(i[u]=c,m&&(i[u+1]=c),f<=127?o[c+0]=u:f<=2047?(o[c+0]=u,o[c+1]=u):f<=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)),f<=127?a[c++]=f:f<=2047?(a[c++]=192|(f&1984)>>>6,a[c++]=128|(f&63)>>>0):f<=65535?(a[c++]=224|(f&61440)>>>12,a[c++]=128|(f&4032)>>>6,a[c++]=128|(f&63)>>>0):(a[c++]=240|(f&1835008)>>>18,a[c++]=128|(f&258048)>>>12,a[c++]=128|(f&4032)>>>6,a[c++]=128|(f&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 bd=class{constructor(e){if(Vo(this,"id",++bd.LAST_ID),Vo(this,"_onigBinding"),Vo(this,"content"),Vo(this,"utf16Length"),Vo(this,"utf8Length"),Vo(this,"utf16OffsetToUtf8"),Vo(this,"utf8OffsetToUtf16"),Vo(this,"ptr"),!aa)throw new SR("Must invoke loadWasm first.");this._onigBinding=aa,this.content=e;const t=new ST(e);this.utf16Length=t.utf16Length,this.utf8Length=t.utf8Length,this.utf16OffsetToUtf8=t.utf16OffsetToUtf8,this.utf8OffsetToUtf16=t.utf8OffsetToUtf16,this.utf8Length<1e4&&!bd._sharedPtrInUse?(bd._sharedPtr||(bd._sharedPtr=aa.omalloc(1e4)),bd._sharedPtrInUse=!0,aa.HEAPU8.set(t.utf8Value,bd._sharedPtr),this.ptr=bd._sharedPtr):this.ptr=t.createString(aa)}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===bd._sharedPtr?bd._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let mk=bd;Vo(mk,"LAST_ID",0);Vo(mk,"_sharedPtr",0);Vo(mk,"_sharedPtrInUse",!1);class a5e{constructor(t){if(Vo(this,"_onigBinding"),Vo(this,"_ptr"),!aa)throw new SR("Must invoke loadWasm first.");const n=[],s=[];for(let a=0,c=t.length;a<c;a++){const u=new ST(t[a]);n[a]=u.createString(aa),s[a]=u.utf8Length}const r=aa.omalloc(4*t.length);aa.HEAPU32.set(n,r/4);const i=aa.omalloc(4*t.length);aa.HEAPU32.set(s,i/4);const o=aa.createOnigScanner(r,i,t.length);for(let a=0,c=t.length;a<c;a++)aa.ofree(n[a]);aa.ofree(i),aa.ofree(r),o===0&&o5e(aa),this._onigBinding=aa,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 mk(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++],f=[];for(let m=0;m<d;m++){const p=t.convertUtf8OffsetToUtf16(a[c++]),g=t.convertUtf8OffsetToUtf16(a[c++]);f[m]={start:p,end:g,length:g-p}}return{index:u,captureIndices:f}}}function l5e(e){return typeof e.instantiator=="function"}function c5e(e){return typeof e.default=="function"}function u5e(e){return typeof e.data<"u"}function d5e(e){return typeof Response<"u"&&e instanceof Response}function h5e(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 gS;function f5e(e){if(gS)return gS;async function t(){aa=await s5e(async n=>{let s=e;return s=await s,typeof s=="function"&&(s=await s(n)),typeof s=="function"&&(s=await s(n)),l5e(s)?s=await s.instantiator(n):c5e(s)?s=await s.default(n):(u5e(s)&&(s=s.data),d5e(s)?typeof WebAssembly.instantiateStreaming=="function"?s=await m5e(s)(n):s=await p5e(s)(n):h5e(s)?s=await m7(s)(n):s instanceof WebAssembly.Module?s=await m7(s)(n):"default"in s&&s.default instanceof WebAssembly.Module&&(s=await m7(s.default)(n))),"instance"in s&&(s=s.instance),"exports"in s&&(s=s.exports),s})}return gS=t(),gS}function m7(e){return t=>WebAssembly.instantiate(e,t)}function m5e(e){return t=>WebAssembly.instantiateStreaming(e,t)}function p5e(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let g5e;function b5e(){return g5e}async function kee(e){return e&&await f5e(e),{createScanner(t){return new a5e(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new mk(t)}}}function y5e(e){return CR(e)}function CR(e){return Array.isArray(e)?w5e(e):e instanceof RegExp?e:typeof e=="object"?v5e(e):e}function w5e(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=CR(e[n]);return t}function v5e(e){let t={};for(let n in e)t[n]=CR(e[n]);return t}function _ee(e,...t){return t.forEach(n=>{for(let s in n)e[s]=n[s]}),e}function See(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?See(e.substring(0,e.length-1)):e.substr(~t+1)}var p7=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,bS=class{static hasCaptures(e){return e===null?!1:(p7.lastIndex=0,p7.test(e))}static replaceCaptures(e,t,n){return e.replace(p7,(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 Cee(e,t){return e<t?-1:e>t?1:0}function Tee(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=Cee(e[r],t[r]);if(i!==0)return i}return 0}return n-s}function WF(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 Eee(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var jee=class{constructor(e){qe(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}},SC=class{constructor(e,t,n){qe(this,"_cachedMatchRoot",new jee(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(_5e(e),t)}static createFromParsedTheme(e,t){return C5e(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=>x5e(e.parent,r.parentScopes));return s?new Aee(s.fontStyle,s.foreground,s.background):null}},g7=class Q2{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const s of n)t=new Q2(t,s);return t}static from(...t){let n=null;for(let s=0;s<t.length;s++)n=new Q2(n,t[s]);return n}push(t){return new Q2(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 x5e(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&&!k5e(e.scopeName,s);){if(r)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function k5e(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Aee=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function _5e(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 f=o.scope;f=f.replace(/^[,]+/,""),f=f.replace(/[,]+$/,""),a=f.split(",")}else Array.isArray(o.scope)?a=o.scope:a=[""];let c=-1;if(typeof o.settings.fontStyle=="string"){c=0;let f=o.settings.fontStyle.split(" ");for(let m=0,p=f.length;m<p;m++)switch(f[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"&&WF(o.settings.foreground)&&(u=o.settings.foreground);let d=null;typeof o.settings.background=="string"&&WF(o.settings.background)&&(d=o.settings.background);for(let f=0,m=a.length;f<m;f++){let g=a[f].trim().split(" "),b=g[g.length-1],v=null;g.length>1&&(v=g.slice(0,g.length-1),v.reverse()),n[s++]=new S5e(b,v,r,c,u,d)}}return n}var S5e=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}},Fh=(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))(Fh||{});function C5e(e,t){e.sort((c,u)=>{let d=Cee(c.scope,u.scope);return d!==0||(d=Tee(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 T5e(t),o=new Aee(n,i.getId(s),i.getId(r)),a=new j5e(new iN(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 SC(i,o,a)}var T5e=class{constructor(e){qe(this,"_isFrozen");qe(this,"_lastColorId");qe(this,"_id2color");qe(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)}},E5e=Object.freeze([]),iN=class Nee{constructor(t,n,s,r,i){qe(this,"scopeDepth");qe(this,"parentScopes");qe(this,"fontStyle");qe(this,"foreground");qe(this,"background");this.scopeDepth=t,this.parentScopes=n||E5e,this.fontStyle=s,this.foreground=r,this.background=i}clone(){return new Nee(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)}},j5e=class oN{constructor(t,n=[],s={}){qe(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(oN._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 oN(this._mainRule.clone(),iN.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(Tee(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 iN(t,n,s,r,i))}},Nb=class Qc{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=Qc.getLanguageId(t),s=Qc.getTokenType(t),r=Qc.getFontStyle(t),i=Qc.getForeground(t),o=Qc.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=Qc.getLanguageId(t),u=Qc.getTokenType(t),d=Qc.containsBalancedBrackets(t)?1:0,f=Qc.getFontStyle(t),m=Qc.getForeground(t),p=Qc.getBackground(t);return n!==0&&(c=n),s!==8&&(u=s),r!==null&&(d=r?1:0),i!==-1&&(f=i),o!==0&&(m=o),a!==0&&(p=a),(c<<0|u<<8|d<<10|f<<11|m<<15|p<<24)>>>0}};function CC(e,t){const n=[],s=A5e(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(VF(r)){const c=[];do c.push(r),r=s.next();while(VF(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(f=>f(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(f=>f(d))}}function VF(e){return!!e&&!!e.match(/[\w\.:]+/)}function A5e(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 Mee(e){typeof e.dispose=="function"&&e.dispose()}var tx=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},N5e=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},M5e=class{constructor(){qe(this,"_references",[]);qe(this,"_seenReferenceKeys",new Set);qe(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))}},I5e=class{constructor(e,t){qe(this,"seenFullScopeRequests",new Set);qe(this,"seenPartialScopeRequests",new Set);qe(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new tx(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new M5e;for(const n of e)R5e(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof tx){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 R5e(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 tx?J2({baseGrammar:i,selfGrammar:r},s):aN(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 tx(a))}function aN(e,t,n){if(t.repository&&t.repository[e]){const s=t.repository[e];TC([s],t,n)}}function J2(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&TC(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&TC(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function TC(e,t,n){for(const s of e){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const r=s.repository?_ee({},t.repository,s.repository):t.repository;Array.isArray(s.patterns)&&TC(s.patterns,{...t,repository:r},n);const i=s.include;if(!i)continue;const o=Iee(i);switch(o.kind){case 0:J2({...t,selfGrammar:t.baseGrammar},n);break;case 1:J2(t,n);break;case 2:aN(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?aN(o.ruleName,c,n):J2(c,n)}else o.kind===4?n.add(new N5e(o.scopeName,o.ruleName)):n.add(new tx(o.scopeName));break}}}var D5e=class{constructor(){qe(this,"kind",0)}},P5e=class{constructor(){qe(this,"kind",1)}},L5e=class{constructor(e){qe(this,"kind",2);this.ruleName=e}},O5e=class{constructor(e){qe(this,"kind",3);this.scopeName=e}},$5e=class{constructor(e,t){qe(this,"kind",4);this.scopeName=e,this.ruleName=t}};function Iee(e){if(e==="$base")return new D5e;if(e==="$self")return new P5e;const t=e.indexOf("#");if(t===-1)return new O5e(e);if(t===0)return new L5e(e.substring(1));{const n=e.substring(0,t),s=e.substring(t+1);return new $5e(n,s)}}var B5e=/\\(\d+)/,GF=/\\(\d+)/g,z5e=-1,Ree=-2;var pk=class{constructor(t,n,s,r){qe(this,"$location");qe(this,"id");qe(this,"_nameIsCapturing");qe(this,"_name");qe(this,"_contentNameIsCapturing");qe(this,"_contentName");this.$location=t,this.id=n,this._name=s||null,this._nameIsCapturing=bS.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=bS.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${See(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:bS.replaceCaptures(this._name,t,n)}getContentName(t,n){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:bS.replaceCaptures(this._contentName,t,n)}},F5e=class extends pk{constructor(t,n,s,r,i){super(t,n,s,r);qe(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!")}},H5e=class extends pk{constructor(t,n,s,r,i){super(t,n,s,null);qe(this,"_match");qe(this,"captures");qe(this,"_cachedCompiledPatterns");this._match=new nx(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 sx,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},KF=class extends pk{constructor(t,n,s,r,i){super(t,n,s,r);qe(this,"hasMissingPatterns");qe(this,"patterns");qe(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 sx,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},lN=class extends pk{constructor(t,n,s,r,i,o,a,c,u,d){super(t,n,s,r);qe(this,"_begin");qe(this,"beginCaptures");qe(this,"_end");qe(this,"endHasBackReferences");qe(this,"endCaptures");qe(this,"applyEndPatternLast");qe(this,"hasMissingPatterns");qe(this,"patterns");qe(this,"_cachedCompiledPatterns");this._begin=new nx(i,this.id),this.beginCaptures=o,this._end=new nx(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 sx;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}},EC=class extends pk{constructor(t,n,s,r,i,o,a,c,u){super(t,n,s,r);qe(this,"_begin");qe(this,"beginCaptures");qe(this,"whileCaptures");qe(this,"_while");qe(this,"whileHasBackReferences");qe(this,"hasMissingPatterns");qe(this,"patterns");qe(this,"_cachedCompiledPatterns");qe(this,"_cachedCompiledWhilePatterns");this._begin=new nx(i,this.id),this.beginCaptures=o,this.whileCaptures=c,this._while=new nx(a,Ree),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 sx;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 sx,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},Dee=class qa{static createCaptureRule(t,n,s,r,i){return t.registerRule(o=>new F5e(n,o,s,r,i))}static getCompiledRuleId(t,n,s){return t.id||n.registerRule(r=>{if(t.id=r,t.match)return new H5e(t.$vscodeTextmateLocation,t.id,t.name,t.match,qa._compileCaptures(t.captures,n,s));if(typeof t.begin>"u"){t.repository&&(s=_ee({},s,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new KF(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,qa._compilePatterns(i,n,s))}return t.while?new EC(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,qa._compileCaptures(t.beginCaptures||t.captures,n,s),t.while,qa._compileCaptures(t.whileCaptures||t.captures,n,s),qa._compilePatterns(t.patterns,n,s)):new lN(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,qa._compileCaptures(t.beginCaptures||t.captures,n,s),t.end,qa._compileCaptures(t.endCaptures||t.captures,n,s),t.applyEndPatternLast,qa._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=qa.getCompiledRuleId(t[o],n,s)),r[a]=qa.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=Iee(a.include);switch(u.kind){case 0:case 1:c=qa.getCompiledRuleId(s[a.include],n,s);break;case 2:let d=s[u.ruleName];d&&(c=qa.getCompiledRuleId(d,n,s));break;case 3:case 4:const f=u.scopeName,m=u.kind===4?u.ruleName:null,p=n.getExternalGrammar(f,s);if(p)if(m){let g=p.repository[m];g&&(c=qa.getCompiledRuleId(g,n,p.repository))}else c=qa.getCompiledRuleId(p.repository.$self,n,p.repository);break}}else c=qa.getCompiledRuleId(a,n,s);if(c!==-1){const u=n.getRule(c);let d=!1;if((u instanceof KF||u instanceof lN||u instanceof EC)&&u.hasMissingPatterns&&u.patterns.length===0&&(d=!0),d)continue;r.push(c)}}return{patterns:r,hasMissingPatterns:(t?t.length:0)!==r.length}}},nx=class Pee{constructor(t,n){qe(this,"source");qe(this,"ruleId");qe(this,"hasAnchor");qe(this,"hasBackReferences");qe(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=B5e.test(this.source):this.hasBackReferences=!1}clone(){return new Pee(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 GF.lastIndex=0,this.source.replace(GF,(r,i)=>Eee(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}},sx=class{constructor(){qe(this,"_items");qe(this,"_hasAnchors");qe(this,"_cached");qe(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 YF(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 YF(e,s,this._items.map(r=>r.ruleId))}},YF=class{constructor(e,t,n){qe(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}},b7=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Lh,q5e=(Lh=class{constructor(t,n){qe(this,"_defaultAttributes");qe(this,"_embeddedLanguagesMatcher");qe(this,"_getBasicScopeAttributes",new jee(t=>{const n=this._scopeToLanguage(t),s=this._toStandardTokenType(t);return new b7(n,s)}));this._defaultAttributes=new b7(t,8),this._embeddedLanguagesMatcher=new U5e(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?Lh._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(Lh.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!")}},qe(Lh,"_NULL_SCOPE_METADATA",new b7(0,0)),qe(Lh,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),Lh),U5e=class{constructor(e){qe(this,"values");qe(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,s])=>Eee(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])}},XF=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Lee(e,t,n,s,r,i,o,a){const c=t.content.length;let u=!1,d=-1;if(o){const p=W5e(e,t,n,s,r,i);r=p.stack,s=p.linePos,n=p.isFirstLine,d=p.anchorPosition}const f=Date.now();for(;!u;){if(a!==0&&Date.now()-f>a)return new XF(r,!0);m()}return new XF(r,!1);function m(){const p=V5e(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===z5e){const y=r.getRule(e);i.produce(r,g[0].start),r=r.withContentNameScopesList(r.nameScopesList),$w(e,t,n,r,i,y.endCaptures,g),i.produce(r,g[0].end);const w=r;if(r=r.parent,d=w.getAnchorPos(),!v&&w.getEnterPos()===s){r=w,i.produce(r,c),u=!0;return}}else{const y=e.getRule(b);i.produce(r,g[0].start);const w=r,x=y.getName(t.content,g),k=r.contentNameScopesList.pushAttributed(x,e);if(r=r.push(b,s,d,g[0].end===c,null,k,k),y instanceof lN){const C=y;$w(e,t,n,r,i,C.beginCaptures,g),i.produce(r,g[0].end),d=g[0].end;const T=C.getContentName(t.content,g),_=k.pushAttributed(T,e);if(r=r.withContentNameScopesList(_),C.endHasBackReferences&&(r=r.withEndRule(C.getEndWithResolvedBackReferences(t.content,g))),!v&&w.hasSameRuleAs(r)){r=r.pop(),i.produce(r,c),u=!0;return}}else if(y instanceof EC){const C=y;$w(e,t,n,r,i,C.beginCaptures,g),i.produce(r,g[0].end),d=g[0].end;const T=C.getContentName(t.content,g),_=k.pushAttributed(T,e);if(r=r.withContentNameScopesList(_),C.whileHasBackReferences&&(r=r.withEndRule(C.getWhileWithResolvedBackReferences(t.content,g))),!v&&w.hasSameRuleAs(r)){r=r.pop(),i.produce(r,c),u=!0;return}}else if($w(e,t,n,r,i,y.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 W5e(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 EC&&a.push({rule:u,stack:c})}for(let c=a.pop();c;c=a.pop()){const{ruleScanner:u,findOptions:d}=Y5e(c.rule,e,c.stack.endRule,n,s===o),f=u.findNextMatchSync(t,s,d);if(f){if(f.ruleId!==Ree){r=c.stack.pop();break}f.captureIndices&&f.captureIndices.length&&(i.produce(c.stack,f.captureIndices[0].start),$w(e,t,n,c.stack,i,c.rule.whileCaptures,f.captureIndices),i.produce(c.stack,f.captureIndices[0].end),o=f.captureIndices[0].end,f.captureIndices[0].end>s&&(s=f.captureIndices[0].end,n=!1))}else{r=c.stack.pop();break}}return{stack:r,linePos:s,anchorPosition:o,isFirstLine:n}}function V5e(e,t,n,s,r,i){const o=G5e(e,t,n,s,r,i),a=e.getInjections();if(a.length===0)return o;const c=K5e(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 G5e(e,t,n,s,r,i){const o=r.getRule(e),{ruleScanner:a,findOptions:c}=Oee(o,e,r.endRule,n,s===i),u=a.findNextMatchSync(t,s,c);return u?{captureIndices:u.captureIndices,matchedRuleId:u.ruleId}:null}function K5e(e,t,n,s,r,i,o){let a=Number.MAX_VALUE,c=null,u,d=0;const f=i.contentNameScopesList.getScopeNames();for(let m=0,p=e.length;m<p;m++){const g=e[m];if(!g.matcher(f))continue;const b=t.getRule(g.ruleId),{ruleScanner:v,findOptions:y}=Oee(b,t,null,s,r===o),w=v.findNextMatchSync(n,r,y);if(!w)continue;const x=w.captureIndices[0].start;if(!(x>=a)&&(a=x,c=w.captureIndices,u=w.ruleId,d=g.priority,a===r))break}return c?{priorityMatch:d===-1,captureIndices:c,matchedRuleId:u}:null}function Oee(e,t,n,s,r){return{ruleScanner:e.compileAG(t,n,s,r),findOptions:0}}function Y5e(e,t,n,s,r){return{ruleScanner:e.compileWhileAG(t,n,s,r),findOptions:0}}function $w(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 f=0;f<c;f++){const m=i[f];if(m===null)continue;const p=o[f];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),y=m.getContentName(a,o),w=v.pushAttributed(y,e),x=s.push(m.retokenizeCapturedWithRuleId,p.start,-1,!1,null,v,w),k=e.createOnigString(a.substring(0,p.end));Lee(e,k,n&&p.start===0,p.start,x,r,!1,0),Mee(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 X5e(v,p.end))}}for(;u.length>0;)r.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var X5e=class{constructor(e,t){qe(this,"scopes");qe(this,"endPos");this.scopes=e,this.endPos=t}};function Q5e(e,t,n,s,r,i,o,a){return new Z5e(e,t,n,s,r,i,o,a)}function QF(e,t,n,s,r){const i=CC(t,jC),o=Dee.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 jC(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(J5e(t[r],s))return n=r+1,!0;return!1})}function J5e(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 Z5e=class{constructor(e,t,n,s,r,i,o,a){qe(this,"_rootId");qe(this,"_lastRuleId");qe(this,"_ruleId2desc");qe(this,"_includedGrammars");qe(this,"_grammarRepository");qe(this,"_grammar");qe(this,"_injections");qe(this,"_basicScopeAttributesProvider");qe(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new q5e(n,s),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=JF(t,null),this._injections=null,this._tokenTypeMatchers=[],r)for(const c of Object.keys(r)){const u=CC(c,jC);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)QF(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&&QF(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]=JF(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=Dee.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let r;if(!t||t===cN.NULL){r=!0;const u=this._basicScopeAttributesProvider.getDefaultAttributes(),d=this.themeProvider.getDefaults(),f=Nb.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=xv.createRootAndLookUpScopeName(m,f,this):p=xv.createRoot("unknown",f),t=new cN(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 t6e(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Lee(this,i,r,0,t,a,!0,s);return Mee(i),{lineLength:o,lineTokens:a,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function JF(e,t){return e=y5e(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 xv=class yd{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=g7.push(r,i.scopeNames),s=new yd(s,r,i.encodedTokenAttributes);return s}static createRoot(t,n){return new yd(null,new g7(null,t),n)}static createRootAndLookUpScopeName(t,n,s){const r=s.getMetadataForScope(t),i=new g7(null,t),o=s.themeProvider.themeMatch(i),a=yd.mergeAttributes(n,r,o);return new yd(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return yd.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),Nb.set(t,n.languageId,n.tokenType,null,r,i,o)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return yd._pushAttributed(this,t,n);const s=t.split(/ /g);let r=this;for(const i of s)r=yd._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=yd.mergeAttributes(t.tokenAttributes,r,o);return new yd(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}},ou,cN=(ou=class{constructor(t,n,s,r,i,o,a,c){qe(this,"_stackElementBrand");qe(this,"_enterPos");qe(this,"_anchorPos");qe(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:ou._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?xv.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(){ou._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,s,r,i,o,a){return new ou(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 ou(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=xv.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new ou(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,xv.fromExtension(s,n.contentNameScopesList))}},qe(ou,"NULL",new ou(null,0,0,0,!1,null,null,null)),ou),e6e=class{constructor(e,t){qe(this,"balancedBracketScopes");qe(this,"unbalancedBracketScopes");qe(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):CC(n,jC).map(s=>s.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>CC(n,jC).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}},t6e=class{constructor(e,t,n,s){qe(this,"_emitBinaryTokens");qe(this,"_lineText");qe(this,"_tokens");qe(this,"_binaryTokens");qe(this,"_lastTokenEndIndex");qe(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=Nb.set(r,0,a.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(o))}if(i&&(r=Nb.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}},n6e=class{constructor(e,t){qe(this,"_grammars",new Map);qe(this,"_rawGrammars",new Map);qe(this,"_injectionGrammars",new Map);qe(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,Q5e(e,i,t,n,s,r,this,this._onigLib))}return this._grammars.get(e)}},s6e=class{constructor(t){qe(this,"_options");qe(this,"_syncRegistry");qe(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new n6e(SC.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(SC.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 e6e(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,s,r,i){const o=new I5e(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)}},uN=cN.NULL;const r6e=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],i6e=/["&'<>`]/g,o6e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,a6e=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,l6e=/[|\\{}()[\]^$+*?.]/g,ZF=new WeakMap;function c6e(e,t){if(e=e.replace(t.subset?u6e(t.subset):i6e,s),t.subset||t.escapeOnly)return e;return e.replace(o6e,n).replace(a6e,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 u6e(e){let t=ZF.get(e);return t||(t=d6e(e),ZF.set(e,t)),t}function d6e(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(l6e,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const h6e=/[\dA-Fa-f]/;function f6e(e,t,n){const s="&#x"+e.toString(16).toUpperCase();return n&&t&&!h6e.test(String.fromCharCode(t))?s:s+";"}const m6e=/\d/;function p6e(e,t,n){const s="&#"+String(e);return n&&t&&!m6e.test(String.fromCharCode(t))?s:s+";"}const g6e=["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"],y7={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:"€"},b6e=["cent","copy","divide","gt","lt","not","para","times"],$ee={}.hasOwnProperty,dN={};let yS;for(yS in y7)$ee.call(y7,yS)&&(dN[y7[yS]]=yS);const y6e=/[^\dA-Za-z]/;function w6e(e,t,n,s){const r=String.fromCharCode(e);if($ee.call(dN,r)){const i=dN[r],o="&"+i;return n&&g6e.includes(i)&&!b6e.includes(i)&&(!s||t&&t!==61&&y6e.test(String.fromCharCode(t)))?o:o+";"}return""}function v6e(e,t,n){let s=f6e(e,t,n.omitOptionalSemicolons),r;if((n.useNamedReferences||n.useShortestReferences)&&(r=w6e(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const i=p6e(e,t,n.omitOptionalSemicolons);i.length<s.length&&(s=i)}return r&&(!n.useShortestReferences||r.length<s.length)?r:s}function nb(e,t){return c6e(e,Object.assign({format:v6e},t))}const x6e=/^>|^->|<!--|-->|--!>|<!-$/g,k6e=[">"],_6e=["<",">"];function S6e(e,t,n,s){return s.settings.bogusComments?"<?"+nb(e.value,Object.assign({},s.settings.characterReferences,{subset:k6e}))+">":"<!--"+e.value.replace(x6e,r)+"-->";function r(i){return nb(i,Object.assign({},s.settings.characterReferences,{subset:_6e}))}}function C6e(e,t,n,s){return"<!"+(s.settings.upperDoctype?"DOCTYPE":"doctype")+(s.settings.tightDoctype?"":" ")+"html>"}const Jo=zee(1),Bee=zee(-1),T6e=[];function zee(e){return t;function t(n,s,r){const i=n?n.children:T6e;let o=(s||0)+e,a=i[o];if(!r)for(;a&&iT(a);)o+=e,a=i[o];return a}}const E6e={}.hasOwnProperty;function Fee(e){return t;function t(n,s,r){return E6e.call(e,n.tagName)&&e[n.tagName](n,s,r)}}const TR=Fee({body:A6e,caption:w7,colgroup:w7,dd:R6e,dt:I6e,head:w7,html:j6e,li:M6e,optgroup:D6e,option:P6e,p:N6e,rp:eH,rt:eH,tbody:O6e,td:tH,tfoot:$6e,th:tH,thead:L6e,tr:B6e});function w7(e,t,n){const s=Jo(n,t,!0);return!s||s.type!=="comment"&&!(s.type==="text"&&iT(s.value.charAt(0)))}function j6e(e,t,n){const s=Jo(n,t);return!s||s.type!=="comment"}function A6e(e,t,n){const s=Jo(n,t);return!s||s.type!=="comment"}function N6e(e,t,n){const s=Jo(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 M6e(e,t,n){const s=Jo(n,t);return!s||s.type==="element"&&s.tagName==="li"}function I6e(e,t,n){const s=Jo(n,t);return!!(s&&s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd"))}function R6e(e,t,n){const s=Jo(n,t);return!s||s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd")}function eH(e,t,n){const s=Jo(n,t);return!s||s.type==="element"&&(s.tagName==="rp"||s.tagName==="rt")}function D6e(e,t,n){const s=Jo(n,t);return!s||s.type==="element"&&s.tagName==="optgroup"}function P6e(e,t,n){const s=Jo(n,t);return!s||s.type==="element"&&(s.tagName==="option"||s.tagName==="optgroup")}function L6e(e,t,n){const s=Jo(n,t);return!!(s&&s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot"))}function O6e(e,t,n){const s=Jo(n,t);return!s||s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot")}function $6e(e,t,n){return!Jo(n,t)}function B6e(e,t,n){const s=Jo(n,t);return!s||s.type==="element"&&s.tagName==="tr"}function tH(e,t,n){const s=Jo(n,t);return!s||s.type==="element"&&(s.tagName==="td"||s.tagName==="th")}const z6e=Fee({body:q6e,colgroup:U6e,head:H6e,html:F6e,tbody:W6e});function F6e(e){const t=Jo(e,-1);return!t||t.type!=="comment"}function H6e(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 q6e(e){const t=Jo(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&iT(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function U6e(e,t,n){const s=Bee(n,t),r=Jo(e,-1,!0);return n&&s&&s.type==="element"&&s.tagName==="colgroup"&&TR(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="col")}function W6e(e,t,n){const s=Bee(n,t),r=Jo(e,-1);return n&&s&&s.type==="element"&&(s.tagName==="thead"||s.tagName==="tbody")&&TR(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="tr")}const wS={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 V6e(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=ry);const u=G6e(s,e.properties),d=s.all(r.space==="html"&&e.tagName==="template"?e.content:e);return s.schema=r,d&&(o=!1),(u||!i||!z6e(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||!TR(e,t,n))&&a.push("</"+e.tagName+">"),a.join("")}function G6e(e,t){const n=[];let s=-1,r;if(t){for(r in t)if(t[r]!==null&&t[r]!==void 0){const i=K6e(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 K6e(e,t,n){const s=FI(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=nb(s.attribute,Object.assign({},e.settings.characterReferences,{subset:wS.name[r][i]}));return n===!0||(n=Array.isArray(n)?(s.commaSeparated?nJ:uJ)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(a=nb(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:wS.unquoted[r][i]}))),a!==n&&(e.settings.quoteSmart&&gC(n,o)>gC(n,e.alternative)&&(o=e.alternative),a=o+nb(n,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?wS.single:wS.double)[r][i],attribute:!0}))+o),c+(a&&"="+a))}const Y6e=["<","&"];function Hee(e,t,n,s){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:nb(e.value,Object.assign({},s.settings.characterReferences,{subset:Y6e}))}function X6e(e,t,n,s){return s.settings.allowDangerousHtml?e.value:Hee(e,t,n,s)}function Q6e(e,t,n,s){return s.all(e)}const J6e=G2e("type",{invalid:Z6e,unknown:e8e,handlers:{comment:S6e,doctype:C6e,element:V6e,raw:X6e,root:Q6e,text:Hee}});function Z6e(e){throw new Error("Expected node, not `"+e+"`")}function e8e(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const t8e={},n8e={},s8e=[];function r8e(e,t){const n=t8e,s=n.quote||'"',r=s==='"'?"'":'"';if(s!=='"'&&s!=="'")throw new Error("Invalid quote `"+s+"`, expected `'` or `\"`");return{one:i8e,all:o8e,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||r6e,characterReferences:n.characterReferences||n8e,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?ry:HI,quote:s,alternative:r}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function i8e(e,t,n){return J6e(e,t,n,this)}function o8e(e){const t=[],n=e&&e.children||s8e;let s=-1;for(;++s<n.length;)t[s]=this.one(n[s],s,e);return t.join("")}function a8e(e){return Array.isArray(e)?e:[e]}function CT(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 ER(e){return!e||["plaintext","txt","text","plain"].includes(e)}function qee(e){return e==="ansi"||ER(e)}function jR(e){return e==="none"}function Uee(e){return jR(e)}function Wee(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 l8e(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 c8e(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?l8e(r,i):r})):e}async function Vee(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function AC(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 w0(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function Gee(e){const t={};return e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle&&(e.fontStyle&Fh.Italic&&(t["font-style"]="italic"),e.fontStyle&Fh.Bold&&(t["font-weight"]="bold"),e.fontStyle&Fh.Underline&&(t["text-decoration"]="underline")),t}function u8e(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function d8e(e){const t=CT(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 hl extends Error{constructor(t){super(t),this.name="ShikiError"}}const Kee=new WeakMap;function TT(e,t){Kee.set(e,t)}function rx(e){return Kee.get(e)}class uy{constructor(...t){qe(this,"_stacks",{});qe(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 uy(Object.fromEntries(a8e(n).map(s=>[s,uN])),t)}getInternalStack(t=this.theme){return this._stacks[t]}get scopes(){return nH(this._stacks[this.theme])}getScopes(t=this.theme){return nH(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function nH(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 h8e(e,t){if(!(e instanceof uy))throw new hl("Invalid grammar state");return e.getInternalStack(t)}function f8e(){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 hl(`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 hl(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${r.lines.length}`);if(o.character<0||o.character>a.length)throw new hl(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${a.length}`);return{...o,offset:r.posToIndex(o.line,o.character)}}};const r=d8e(n.source),i=(n.options.decorations||[]).map(o=>({...o,start:s(o.start),end:s(o.end)}));m8e(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 c8e(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(f=>f.type==="element"&&f.tagName==="span");if(r.length!==s.converter.lines.length)throw new hl(`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(f,m,p,g){const b=r[f];let v="",y=-1,w=-1;if(m===0&&(y=0),p===0&&(w=0),p===Number.POSITIVE_INFINITY&&(w=b.children.length),y===-1||w===-1)for(let k=0;k<b.children.length;k++)v+=Yee(b.children[k]),y===-1&&v.length===m&&(y=k+1),w===-1&&v.length===p&&(w=k+1);if(y===-1)throw new hl(`Failed to find start index for decoration ${JSON.stringify(g.start)}`);if(w===-1)throw new hl(`Failed to find end index for decoration ${JSON.stringify(g.end)}`);const x=b.children.slice(y,w);if(!g.alwaysWrap&&x.length===b.children.length)a(b,g,"line");else if(!g.alwaysWrap&&x.length===1&&x[0].type==="element")a(x[0],g,"token");else{const k={type:"element",tagName:"span",properties:{},children:x};a(k,g,"wrapper"),b.children.splice(y,x.length,k)}}function o(f,m){r[f]=a(r[f],m,"line")}function a(f,m,p){var v;const g=m.properties||{},b=m.transform||(y=>y);return f.tagName=m.tagName||"span",f.properties={...f.properties,...g,class:f.properties.class},(v=m.properties)!=null&&v.class&&Wee(f,m.properties.class),f=b(f,p)||f,f}const c=[],u=s.decorations.sort((f,m)=>m.start.offset-f.start.offset);for(const f of u){const{start:m,end:p}=f;if(m.line===p.line)i(m.line,m.character,p.character,f);else if(m.line<p.line){i(m.line,m.character,Number.POSITIVE_INFINITY,f);for(let g=m.line+1;g<p.line;g++)c.unshift(()=>o(g,f));i(p.line,0,p.character,f)}}c.forEach(f=>f())}}}function m8e(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new hl(`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 hl(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(r.start)} intersect.`)}}}}function Yee(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(Yee).join(""):""}const p8e=[f8e()];function NC(e){return[...e.transformers||[],...p8e]}var v0=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],v7={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function g8e(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 sH(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 b8e(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)v7[r]&&t.push({type:"setDecoration",value:v7[r]});else if(r<=29){const i=v7[r-20];i&&t.push({type:"resetDecoration",value:i})}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:v0[r-30]}});else if(r===38){const[i,o]=sH(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:v0[r-40]}});else if(r===48){const[i,o]=sH(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:v0[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:v0[r-100+8]}})}return t}function y8e(){let e=null,t=null,n=new Set;return{parse(s){const r=[];let i=0;do{const o=g8e(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=b8e(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 w8e={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 v8e(e=w8e){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<v0.length;u++)s.push(t(v0[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 f=0;f<6;f++)s.push(n([a[u],a[d],a[f]]));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 x8e(e,t,n){const s=AC(e,n),r=CT(t),i=v8e(Object.fromEntries(v0.map(a=>{var c;return[a,(c=e.colors)==null?void 0:c[`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`]]}))),o=y8e();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=w0(u,s),d=w0(d,s),c.decorations.has("dim")&&(u=k8e(u));let f=Fh.None;return c.decorations.has("bold")&&(f|=Fh.Bold),c.decorations.has("italic")&&(f|=Fh.Italic),c.decorations.has("underline")&&(f|=Fh.Underline),{content:c.value,offset:a[1],color:u,bgColor:d,fontStyle:f}}))}function k8e(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 AR(e,t,n={}){const{lang:s="text",theme:r=e.getLoadedThemes()[0]}=n;if(ER(s)||jR(r))return CT(t).map(c=>[{content:c[0],offset:c[1]}]);const{theme:i,colorMap:o}=e.setTheme(r);if(s==="ansi")return x8e(i,t,n);const a=e.getLanguage(s);if(n.grammarState){if(n.grammarState.lang!==a.name)throw new Qh(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(i.name))throw new Qh(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return S8e(t,a,i,o,n)}function _8e(...e){if(e.length===2)return rx(e[1]);const[t,n,s={}]=e,{lang:r="text",theme:i=t.getLoadedThemes()[0]}=s;if(ER(r)||jR(i))throw new Qh("Plain language does not have grammar state");if(r==="ansi")throw new Qh("ANSI language does not have grammar state");const{theme:o,colorMap:a}=t.setTheme(i),c=t.getLanguage(r);return new uy(MC(n,c,o,a,s).stateStack,c.name,o.name)}function S8e(e,t,n,s,r){const i=MC(e,t,n,s,r),o=new uy(MC(e,t,n,s,r).stateStack,t.name,n.name);return TT(i.tokens,o),i.tokens}function MC(e,t,n,s,r){const i=AC(n,r),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500}=r,c=CT(e);let u=r.grammarState?h8e(r.grammarState,n.name)??uN:r.grammarContextCode!=null?MC(r.grammarContextCode,t,n,s,{...r,grammarState:void 0,grammarContextCode:void 0}).stateStack:uN,d=[];const f=[];for(let m=0,p=c.length;m<p;m++){const[g,b]=c[m];if(g===""){d=[],f.push([]);continue}if(o>0&&g.length>=o){d=[],f.push([{content:g,offset:b,color:"",fontStyle:0}]);continue}let v,y,w;r.includeExplanation&&(v=t.tokenizeLine(g,u),y=v.tokens,w=0);const x=t.tokenizeLine2(g,u,a),k=x.tokens.length/2;for(let C=0;C<k;C++){const T=x.tokens[2*C],_=C+1<k?x.tokens[2*C+2]:g.length;if(T===_)continue;const S=x.tokens[2*C+1],R=w0(s[Nb.getForeground(S)],i),A=Nb.getFontStyle(S),O={content:g.substring(T,_),offset:b+T,color:R,fontStyle:A};if(r.includeExplanation){const M=[];if(r.includeExplanation!=="scopeName")for(const $ of n.settings){let z;switch(typeof $.scope){case"string":z=$.scope.split(/,/).map(B=>B.trim());break;case"object":z=$.scope;break;default:continue}M.push({settings:$,selectors:z.map(B=>B.split(/ /))})}O.explanation=[];let D=0;for(;T+D<_;){const $=y[w],z=g.substring($.startIndex,$.endIndex);D+=z.length,O.explanation.push({content:z,scopes:r.includeExplanation==="scopeName"?C8e($.scopes):T8e(M,$.scopes)}),w+=1}}d.push(O)}f.push(d),d=[],u=x.ruleStack}return{tokens:f,stateStack:u}}function C8e(e){return e.map(t=>({scopeName:t}))}function T8e(e,t){const n=[];for(let s=0,r=t.length;s<r;s++){const i=t[s];n[s]={scopeName:i,themeMatches:j8e(e,i,t.slice(0,s))}}return n}function rH(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function E8e(e,t,n){if(!rH(e[e.length-1],t))return!1;let s=e.length-2,r=n.length-1;for(;s>=0&&r>=0;)rH(e[s],n[r])&&(s-=1),r-=1;return s===-1}function j8e(e,t,n){const s=[];for(const{selectors:r,settings:i}of e)for(const o of r)if(E8e(o,t,n)){s.push(i);break}return s}function Xee(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=AR(e,t,{...n,theme:c.theme}),d=rx(u),f=typeof c.theme=="string"?c.theme:c.theme.name;return{tokens:u,state:d,theme:f}}),i=A8e(...r.map(c=>c.tokens)),o=i[0].map((c,u)=>c.map((d,f)=>{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:y,...w}=p[u][f];m.variants[s[g].color]=w}),m})),a=r[0].state?new uy(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&&TT(o,a),o}function A8e(...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 IC(e,t,n){let s,r,i,o,a,c;if("themes"in n){const{defaultColor:u="light",cssVariablePrefix:d="--shiki-"}=n,f=Object.entries(n.themes).filter(v=>v[1]).map(v=>({color:v[0],theme:v[1]})).sort((v,y)=>v.color===u?-1:y.color===u?1:0);if(f.length===0)throw new Qh("`themes` option must not be empty");const m=Xee(e,t,n);if(c=rx(m),u&&!f.find(v=>v.color===u))throw new Qh(`\`themes\` option must contain the defaultColor key \`${u}\``);const p=f.map(v=>e.getTheme(v.theme)),g=f.map(v=>v.color);i=m.map(v=>v.map(y=>N8e(y,g,d,u))),c&&TT(i,c);const b=f.map(v=>AC(v.theme,n));r=f.map((v,y)=>(y===0&&u?"":`${d+v.color}:`)+(w0(p[y].fg,b[y])||"inherit")).join(";"),s=f.map((v,y)=>(y===0&&u?"":`${d+v.color}-bg:`)+(w0(p[y].bg,b[y])||"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=AC(n.theme,n);i=AR(e,t,n);const d=e.getTheme(n.theme);s=w0(d.bg,u),r=w0(d.fg,u),o=d.name,c=rx(i)}else throw new Qh("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:r,bg:s,themeName:o,rootStyle:a,grammarState:c}}function N8e(e,t,n,s){const r={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(c=>Gee(e.variants[c])),o=new Set(i.flatMap(c=>Object.keys(c))),a={};return i.forEach((c,u)=>{for(const d of o){const f=c[d]||"inherit";if(u===0&&s)a[d]=f;else{const m=d==="color"?"":d==="background-color"?"-bg":`-${d}`,p=n+t[u]+(d==="color"?"":m);a[p]=f}}}),r.htmlStyle=a,r}function RC(e,t,n,s={meta:{},options:n,codeToHast:(r,i)=>RC(e,r,i),codeToTokens:(r,i)=>IC(e,r,i)}){var p,g;let r=t;for(const b of NC(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}=IC(e,r,n);const{mergeWhitespaces:f=!0}=n;f===!0?i=I8e(i):f==="never"&&(i=R8e(i));const m={...s,get source(){return r}};for(const b of NC(n))i=((g=b.tokens)==null?void 0:g.call(m,i))||i;return M8e(i,{...n,fg:o,bg:a,themeName:c,rootStyle:u},m,d)}function M8e(e,t,n,s=rx(e)){var g,b,v;const r=NC(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(([y])=>!y.startsWith("_")))},children:[]},d={type:"element",tagName:"code",properties:{},children:i};const f=[],m={...n,structure:a,addClassToHast:Wee,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 f}};if(e.forEach((y,w)=>{var C,T;w&&(a==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&i.push({type:"text",value:`
`}));let x={type:"element",tagName:"span",properties:{class:"line"},children:[]},k=0;for(const _ of y){let S={type:"element",tagName:"span",properties:{..._.htmlAttrs},children:[{type:"text",value:_.content}]};_.htmlStyle;const R=u8e(_.htmlStyle||Gee(_));R&&(S.properties.style=R);for(const A of r)S=((C=A==null?void 0:A.span)==null?void 0:C.call(m,S,w+1,k,x,_))||S;a==="inline"?o.children.push(S):a==="classic"&&x.children.push(S),k+=_.content.length}if(a==="classic"){for(const _ of r)x=((T=_==null?void 0:_.line)==null?void 0:T.call(m,x,w+1))||x;f.push(x),i.push(x)}}),a==="classic"){for(const y of r)d=((g=y==null?void 0:y.code)==null?void 0:g.call(m,d))||d;u.children.push(d);for(const y of r)u=((b=y==null?void 0:y.pre)==null?void 0:b.call(m,u))||u;o.children.push(u)}let p=o;for(const y of r)p=((v=y==null?void 0:y.root)==null?void 0:v.call(m,p))||p;return s&&TT(p,s),p}function I8e(e){return e.map(t=>{const n=[];let s="",r=0;return t.forEach((i,o)=>{const c=!(i.fontStyle&&i.fontStyle&Fh.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 R8e(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 D8e(e,t,n){var i;const s={meta:{},options:n,codeToHast:(o,a)=>RC(e,o,a),codeToTokens:(o,a)=>IC(e,o,a)};let r=r8e(RC(e,t,n,s));for(const o of NC(n))r=((i=o.postprocess)==null?void 0:i.call(s,r,n))||r;return r}const iH={light:"#333333",dark:"#bbbbbb"},oH={light:"#fffffe",dark:"#1e1e1e"},aH="__shiki_resolved";function NR(e){var a,c,u,d,f;if(e!=null&&e[aH])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"?iH.light:iH.dark),n||(n=t.type==="light"?oH.light:oH.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,y;const p=((v=m.settings)==null?void 0:v.foreground)&&!m.settings.foreground.startsWith("#"),g=((y=m.settings)==null?void 0:y.background)&&!m.settings.background.startsWith("#");if(!p&&!g)return m;const b={...m,settings:{...m.settings}};if(p){const w=o(m.settings.foreground);t.colorReplacements[w]=m.settings.foreground,b.settings.foreground=w}if(g){const w=o(m.settings.background);t.colorReplacements[w]=m.settings.background,b.settings.background=w}return b});for(const m of Object.keys(t.colors||{}))if((m==="editor.foreground"||m==="editor.background"||m.startsWith("terminal.ansi"))&&!((f=t.colors[m])!=null&&f.startsWith("#"))){const p=o(t.colors[m]);t.colorReplacements[p]=t.colors[m],t.colors[m]=p}return Object.defineProperty(t,aH,{enumerable:!1,writable:!1,value:!0}),t}async function Qee(e){return Array.from(new Set((await Promise.all(e.filter(t=>!qee(t)).map(async t=>await Vee(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function Jee(e){return(await Promise.all(e.map(async n=>Uee(n)?null:NR(await Vee(n))))).filter(n=>!!n)}class P8e extends s6e{constructor(n,s,r,i={}){super(n);qe(this,"_resolvedThemes",new Map);qe(this,"_resolvedGrammars",new Map);qe(this,"_langMap",new Map);qe(this,"_langGraph",new Map);qe(this,"_textmateThemeCache",new WeakMap);qe(this,"_loadedThemesCache",null);qe(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=NR(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=SC.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 hl(`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 f;return(f=d.embeddedLangsLazy)==null?void 0:f.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 hl(`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 L8e{constructor(t,n){qe(this,"_langs",new Map);qe(this,"_scopeToLang",new Map);qe(this,"_injections",new Map);qe(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 dw=0;function O8e(e){dw+=1,e.warnings!==!1&&dw>=10&&dw%10===0&&console.warn(`[Shiki] ${dw} 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 hl("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),s=(e.themes||[]).flat(1).map(NR),r=new L8e(e.engine,n),i=new P8e(r,s,n,e.langAlias);let o;function a(w){v();const x=i.getGrammar(typeof w=="string"?w:w.name);if(!x)throw new hl(`Language \`${w}\` not found, you may need to load it first`);return x}function c(w){if(w==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};v();const x=i.getTheme(w);if(!x)throw new hl(`Theme \`${w}\` not found, you may need to load it first`);return x}function u(w){v();const x=c(w);o!==w&&(i.setTheme(x),o=w);const k=i.getColorMap();return{theme:x,colorMap:k}}function d(){return v(),i.getLoadedThemes()}function f(){return v(),i.getLoadedLanguages()}function m(...w){v(),i.loadLanguages(w.flat(1))}async function p(...w){return m(await Qee(w))}function g(...w){v();for(const x of w.flat(1))i.loadTheme(x)}async function b(...w){return v(),g(await Jee(w))}function v(){if(t)throw new hl("Shiki instance has been disposed")}function y(){t||(t=!0,i.dispose(),dw-=1)}return{setTheme:u,getTheme:c,getLanguage:a,getLoadedThemes:d,getLoadedLanguages:f,loadLanguage:p,loadLanguageSync:m,loadTheme:b,loadThemeSync:g,dispose:y,[Symbol.dispose]:y}}async function $8e(e={}){e.loadWasm;const[t,n,s]=await Promise.all([Jee(e.themes||[]),Qee(e.langs||[]),e.engine||kee(e.loadWasm||b5e())]);return O8e({...e,themes:t,langs:n,engine:s})}async function B8e(e={}){const t=await $8e(e);return{getLastGrammarState:(...n)=>_8e(t,...n),codeToTokensBase:(n,s)=>AR(t,n,s),codeToTokensWithThemes:(n,s)=>Xee(t,n,s),codeToTokens:(n,s)=>IC(t,n,s),codeToHast:(n,s)=>RC(t,n,s),codeToHtml:(n,s)=>D8e(t,n,s),...t,getInternalContext:()=>t}}function z8e(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(qee(p))return[];const g=s[p];if(!g)throw new Qh(`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(Uee(p))return"none";if(typeof p=="string"){const g=r[p];if(!g)throw new Qh(`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)),f=(a.langs??[]).map(p=>c(p)),m=await B8e({engine:a.engine??i(),...a,themes:d,langs:f});return{...m,loadLanguage(...p){return m.loadLanguage(...p.map(c))},loadTheme(...p){return m.loadTheme(...p.map(u))}}}return o}const F8e=z8e({langs:QTe,themes:ZTe,engine:()=>kee(he(()=>import("./wasm-CG6Dc4jp.js"),[]))});/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const H8e=["github-light-default","github-dark-default"];let vS=null,hN=null;const fN=new Set,x7=new Map,lH=new Set,q8e=128,Bw=new Map;function Zee(e,t,n){return`${t}\0${n}\0${e}`}function U8e(e,t){if(Bw.size>=q8e){const n=Bw.keys().next().value;n!==void 0&&Bw.delete(n)}Bw.set(e,t)}function W8e(e,t,n){return Bw.get(Zee(e,t,n))??null}function V8e(){return vS||(vS=F8e({langs:[],themes:H8e}).then(e=>(hN=e,e)).catch(e=>{throw vS=null,e})),vS}async function ete(e){const t=await V8e();if(fN.has(e))return t;if(lH.has(e))throw new Error(`shiki: language "${e}" previously failed to load`);let n=x7.get(e);return n||(n=t.loadLanguage(e).then(()=>{fN.add(e)}).catch(s=>{throw lH.add(e),s}).finally(()=>{x7.delete(e)}),x7.set(e,n)),await n,t}const G8e=1e5,K8e=2e4;function mN(e){if(e.length>G8e)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>K8e)return!0;t=s+1}return!1}function cH(e,t,n,s=!0){if(hN&&fN.has(t))try{const r=hN.codeToHtml(e,{lang:t,theme:n});return s&&U8e(Zee(e,t,n),r),r}catch(r){return console.warn("[web-shell] sync highlight failed for lang=%s",t,r),null}return null}const Y8e=()=>{},X8e=()=>Y8e,tte=h.createContext(X8e);function Q8e(){return h.useContext(tte)}function nte(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=nte(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function ste(){for(var e,t,n=0,s="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=nte(e))&&(s&&(s+=" "),s+=t);return s}const uH=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,dH=ste,gg=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return dH(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],f=i==null?void 0:i[u];if(d===null)return null;const m=uH(d)||uH(f);return r[u][m]}),a=n&&Object.entries(n).reduce((u,d)=>{let[f,m]=d;return m===void 0||(u[f]=m),u},{}),c=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((u,d)=>{let{class:f,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,f,m]:u},[]);return dH(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)};function hH(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function J8e(...e){return t=>{let n=!1;const s=e.map(r=>{const i=hH(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():hH(e[r],null)}}}}function js(...e){return h.useCallback(J8e(...e),e)}function Gm(e){const t=h.forwardRef((n,s)=>{let{children:r,...i}=n,o=null,a=!1;const c=[];fH(r)&&typeof xS=="function"&&(r=xS(r._payload)),h.Children.forEach(r,m=>{var p;if(s7e(m)){a=!0;const g=m;let b="child"in g.props?g.props.child:g.props.children;fH(b)&&typeof xS=="function"&&(b=xS(b._payload)),o=e7e(g,b),c.push((p=o==null?void 0:o.props)==null?void 0:p.children)}else c.push(m)}),o?o=h.cloneElement(o,void 0,c):!a&&h.Children.count(r)===1&&h.isValidElement(r)&&(o=r);const u=o?n7e(o):void 0,d=js(s,u);if(!o){if(r||r===0)throw new Error(a?a7e(e):o7e(e));return r}const f=t7e(i,o.props??{});return o.type!==h.Fragment&&(f.ref=s?d:u),h.cloneElement(o,f)});return t.displayName=`${e}.Slot`,t}var MR=Gm("Slot"),rte=Symbol.for("radix.slottable");function Z8e(e){const t=n=>"child"in n?n.children(n.child):n.children;return t.displayName=`${e}.Slottable`,t.__radixId=rte,t}var e7e=(e,t)=>{if("child"in e.props){const n=e.props.child;return h.isValidElement(n)?h.cloneElement(n,void 0,e.props.children(n.props.children)):null}return h.isValidElement(t)?t:null};function t7e(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 n7e(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 s7e(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===rte}var r7e=Symbol.for("react.lazy");function fH(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===r7e&&"_payload"in e&&i7e(e._payload)}function i7e(e){return typeof e=="object"&&e!==null&&"then"in e}var o7e=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,a7e=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,xS=R3[" use ".trim().toString()],l7e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Wn=l7e.reduce((e,t)=>{const n=Gm(`Primitive.${t}`),s=h.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 ite(e,t){e&&Wu.flushSync(()=>e.dispatchEvent(t))}var ote=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"}),c7e="VisuallyHidden",ate=h.forwardRef((e,t)=>l.jsx(Wn.span,{...e,ref:t,style:{...ote,...e.style}}));ate.displayName=c7e;var u7e=ate;function Xa(e,t=[]){let n=[];function s(i,o){const a=h.createContext(o);a.displayName=i+"Context";const c=n.length;n=[...n,o];const u=f=>{var y;const{scope:m,children:p,...g}=f,b=((y=m==null?void 0:m[e])==null?void 0:y[c])||a,v=h.useMemo(()=>g,Object.values(g));return l.jsx(b.Provider,{value:v,children:p})};u.displayName=i+"Provider";function d(f,m,p={}){var y;const{optional:g=!1}=p,b=((y=m==null?void 0:m[e])==null?void 0:y[c])||a,v=h.useContext(b);if(v)return v;if(o!==void 0)return o;if(!g)throw new Error(`\`${f}\` must be used within \`${i}\``)}return[u,d]}const r=()=>{const i=n.map(o=>h.createContext(o));return function(a){const c=(a==null?void 0:a[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return r.scopeName=e,[s,d7e(r,...t)]}function d7e(...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 f=c(i)[`__scope${u}`];return{...a,...f}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function IR(e){const t=e+"CollectionProvider",[n,s]=Xa(t),[r,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=b=>{const{scope:v,children:y}=b,w=h.useRef(null),x=h.useRef(new Map).current;return l.jsx(r,{scope:v,itemMap:x,collectionRef:w,children:y})};o.displayName=t;const a=e+"CollectionSlot",c=Gm(a),u=h.forwardRef((b,v)=>{const{scope:y,children:w}=b,x=i(a,y),k=js(v,x.collectionRef);return l.jsx(c,{ref:k,children:w})});u.displayName=a;const d=e+"CollectionItemSlot",f="data-radix-collection-item",m=Gm(d),p=h.forwardRef((b,v)=>{const{scope:y,children:w,...x}=b,k=h.useRef(null),C=js(v,k),T=i(d,y);return h.useEffect(()=>(T.itemMap.set(k,{ref:k,...x}),()=>void T.itemMap.delete(k))),l.jsx(m,{[f]:"",ref:C,children:w})});p.displayName=d;function g(b){const v=i(e+"CollectionConsumer",b);return h.useCallback(()=>{const w=v.collectionRef.current;if(!w)return[];const x=Array.from(w.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((T,_)=>x.indexOf(T.ref.current)-x.indexOf(_.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:u,ItemSlot:p},g,s]}function ln(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 ma=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},h7e=R3[" useInsertionEffect ".trim().toString()]||ma;function Tl({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[r,i,o]=f7e({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:r;{const d=h.useRef(e!==void 0);h.useEffect(()=>{const f=d.current;f!==a&&console.warn(`${s} is changing from ${f?"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=h.useCallback(d=>{var f;if(a){const m=m7e(d)?d(e):d;m!==e&&((f=o.current)==null||f.call(o,m))}else i(d)},[a,e,i,o]);return[c,u]}function f7e({defaultProp:e,onChange:t}){const[n,s]=h.useState(e),r=h.useRef(n),i=h.useRef(t);return h7e(()=>{i.current=t},[t]),h.useEffect(()=>{var o;r.current!==n&&((o=i.current)==null||o.call(i,n),r.current=n)},[n,r]),[n,s,i]}function m7e(e){return typeof e=="function"}function p7e(e,t){return h.useReducer((n,s)=>t[n][s]??n,e)}var Qa=e=>{const{present:t,children:n}=e,s=g7e(t),r=typeof n=="function"?n({present:s.isPresent}):h.Children.only(n),i=b7e(s.ref,y7e(r));return typeof n=="function"||s.isPresent?h.cloneElement(r,{ref:i}):null};Qa.displayName="Presence";function g7e(e){const[t,n]=h.useState(),s=h.useRef(null),r=h.useRef(e),i=h.useRef("none"),o=h.useRef(void 0),a=e?"mounted":"unmounted",[c,u]=p7e(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{c==="mounted"?(i.current=o.current??hw(s.current),o.current=void 0):i.current="none"},[c]),ma(()=>{const d=s.current,f=r.current;if(f!==e){const p=i.current,g=hw(d);e?(o.current=g,u("MOUNT")):g==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(f&&p!==g?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,u]),ma(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,m=g=>{const v=hw(s.current).includes(CSS.escape(g.animationName));if(g.target===t&&v&&(u("ANIMATION_END"),!r.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},p=g=>{g.target===t&&(i.current=hw(s.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{f.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:h.useCallback(d=>{if(d){const f=getComputedStyle(d);s.current=f,o.current=hw(f)}else s.current=null;n(d)},[])}}function mH(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function b7e(...e){const t=h.useRef(e);return t.current=e,h.useCallback(n=>{const s=t.current;let r=!1;const i=s.map(o=>{const a=mH(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():mH(s[o],null)}}},[])}function hw(e){return(e==null?void 0:e.animationName)||"none"}function y7e(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 w7e=R3[" useId ".trim().toString()]||(()=>{}),v7e=0;function Ql(e){const[t,n]=h.useState(w7e());return ma(()=>{n(s=>s??String(v7e++))},[e]),e||(t?`radix-${t}`:"")}var x7e=h.createContext(void 0);function dy(e){const t=h.useContext(x7e);return e||t||"ltr"}function Oc(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}var k7e="DismissableLayer",pN="dismissableLayer.update",_7e="dismissableLayer.pointerDownOutside",S7e="dismissableLayer.focusOutside",pH,RR=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),hy=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:c,...u}=e,d=h.useContext(RR),[f,m]=h.useState(null),p=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=h.useState({}),b=js(t,m),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),w=y?v.indexOf(y):-1,x=f?v.indexOf(f):-1,k=d.layersWithOutsidePointerEventsDisabled.size>0,C=x>=w,T=h.useRef(!1),_=A7e(O=>{i==null||i(O),a==null||a(O),O.defaultPrevented||c==null||c()},{ownerDocument:p,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:T,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:h.useCallback(O=>{if(!(O instanceof Node))return!1;const M=[...d.branches].some(D=>D.contains(O));return C&&!M},[d.branches,C])}),S=N7e(O=>{if(s&&T.current)return;const M=O.target;[...d.branches].some($=>$.contains(M))||(o==null||o(O),a==null||a(O),O.defaultPrevented||c==null||c())},p),R=f?x===v.length-1:!1,A=Oc(O=>{O.key==="Escape"&&(r==null||r(O),!O.defaultPrevented&&c&&(O.preventDefault(),c()))});return h.useEffect(()=>{if(R)return p.addEventListener("keydown",A,{capture:!0}),()=>p.removeEventListener("keydown",A,{capture:!0})},[p,R,A]),h.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(pH=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),gH(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=pH))}},[f,p,n,d]),h.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),gH())},[f,d]),h.useEffect(()=>{const O=()=>g({});return document.addEventListener(pN,O),()=>document.removeEventListener(pN,O)},[]),l.jsx(Wn.div,{...u,ref:b,style:{pointerEvents:k?C?"auto":"none":void 0,...e.style},onFocusCapture:ln(e.onFocusCapture,S.onFocusCapture),onBlurCapture:ln(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ln(e.onPointerDownCapture,_.onPointerDownCapture)})});hy.displayName=k7e;var C7e="DismissableLayerBranch",T7e=h.forwardRef((e,t)=>{const n=h.useContext(RR),s=h.useRef(null),r=js(t,s);return h.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),l.jsx(Wn.div,{...e,ref:r})});T7e.displayName=C7e;function E7e(){const e=h.useContext(RR),[t,n]=h.useState(null);return h.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var j7e=()=>!0;function A7e(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:s=!1,isDeferredPointerDownOutsideRef:r,dismissableSurfaces:i,shouldHandlePointerDownOutside:o=j7e}=t,a=Oc(e),c=h.useRef(!1),u=h.useRef(!1),d=h.useRef(new Map),f=h.useRef(()=>{});return h.useEffect(()=>{function m(){u.current=!1,r.current=!1,d.current.clear()}function p(){return Array.from(d.current.values()).some(Boolean)}function g(x){if(!u.current)return;const k=x.target;k instanceof Node&&[...i].some(T=>T.contains(k))||d.current.set(x.type,!0),x.type==="click"&&window.setTimeout(()=>{u.current&&f.current()},0)}function b(x){u.current&&d.current.set(x.type,!1)}const v=x=>{if(x.target&&!c.current){let k=function(){n.removeEventListener("click",f.current);const T=p();m(),T||lte(_7e,a,C,{discrete:!0})};if(!o(x.target)){n.removeEventListener("click",f.current),m(),c.current=!1;return}const C={originalEvent:x};u.current=!0,r.current=s&&x.button===0,d.current.clear(),!s||x.button!==0?k():(n.removeEventListener("click",f.current),f.current=k,n.addEventListener("click",f.current,{once:!0}))}else n.removeEventListener("click",f.current),m();c.current=!1},y=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const x of y)n.addEventListener(x,g,!0),n.addEventListener(x,b);const w=window.setTimeout(()=>{n.addEventListener("pointerdown",v)},0);return()=>{window.clearTimeout(w),n.removeEventListener("pointerdown",v),n.removeEventListener("click",f.current);for(const x of y)n.removeEventListener(x,g,!0),n.removeEventListener(x,b)}},[n,a,s,r,i,o]),{onPointerDownCapture:()=>c.current=!0}}function N7e(e,t=globalThis==null?void 0:globalThis.document){const n=Oc(e),s=h.useRef(!1);return h.useEffect(()=>{const r=i=>{i.target&&!s.current&&lte(S7e,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 gH(){const e=new CustomEvent(pN);document.dispatchEvent(e)}function lte(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?ite(r,i):r.dispatchEvent(i)}var k7="focusScope.autoFocusOnMount",_7="focusScope.autoFocusOnUnmount",bH={bubbles:!1,cancelable:!0},M7e="FocusScope",gk=h.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:r,onUnmountAutoFocus:i,...o}=e,[a,c]=h.useState(null),u=Oc(r),d=Oc(i),f=h.useRef(null),m=js(t,c),p=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(s){let b=function(x){if(p.paused||!a)return;const k=x.target;a.contains(k)?f.current=k:Wf(f.current,{select:!0})},v=function(x){if(p.paused||!a)return;const k=x.relatedTarget;k!==null&&(a.contains(k)||Wf(f.current,{select:!0}))},y=function(x){if(document.activeElement===document.body)for(const C of x)C.removedNodes.length>0&&Wf(a)};document.addEventListener("focusin",b),document.addEventListener("focusout",v);const w=new MutationObserver(y);return a&&w.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",v),w.disconnect()}}},[s,a,p.paused]),h.useEffect(()=>{if(a){wH.add(p);const b=document.activeElement;if(!a.contains(b)){const y=new CustomEvent(k7,bH);a.addEventListener(k7,u),a.dispatchEvent(y),y.defaultPrevented||(I7e(O7e(cte(a)),{select:!0}),document.activeElement===b&&Wf(a))}return()=>{a.removeEventListener(k7,u),setTimeout(()=>{const y=new CustomEvent(_7,bH);a.addEventListener(_7,d),a.dispatchEvent(y),y.defaultPrevented||Wf(b??document.body,{select:!0}),a.removeEventListener(_7,d),wH.remove(p)},0)}}},[a,u,d,p]);const g=h.useCallback(b=>{if(!n&&!s||p.paused)return;const v=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,y=document.activeElement;if(v&&y){const w=b.currentTarget,[x,k]=R7e(w);x&&k?!b.shiftKey&&y===k?(b.preventDefault(),n&&Wf(x,{select:!0})):b.shiftKey&&y===x&&(b.preventDefault(),n&&Wf(k,{select:!0})):y===w&&b.preventDefault()}},[n,s,p.paused]);return l.jsx(Wn.div,{tabIndex:-1,...o,ref:m,onKeyDown:g})});gk.displayName=M7e;function I7e(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(Wf(s,{select:t}),document.activeElement!==n)return}function R7e(e){const t=cte(e),n=yH(t,e),s=yH(t.reverse(),e);return[n,s]}function cte(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 yH(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const s of e)if(!(n?!s.checkVisibility({checkVisibilityCSS:!0}):D7e(s,{upTo:t})))return s}function D7e(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 P7e(e){return e instanceof HTMLInputElement&&"select"in e}function Wf(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&P7e(e)&&t&&e.select()}}var wH=L7e();function L7e(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=vH(e,t),e.unshift(t)},remove(t){var n;e=vH(e,t),(n=e[0])==null||n.resume()}}}function vH(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function O7e(e){return e.filter(t=>t.tagName!=="A")}var $7e="Portal",fy=h.forwardRef((e,t)=>{var a;const{container:n,...s}=e,[r,i]=h.useState(!1);ma(()=>i(!0),[]);const o=n||r&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?Wu.createPortal(l.jsx(Wn.div,{...s,ref:t}),o):null});fy.displayName=$7e;var kS=0,ud=null;function ET(){h.useEffect(()=>{ud||(ud={start:xH(),end:xH()});const{start:e,end:t}=ud;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),kS++,()=>{kS===1&&(ud==null||ud.start.remove(),ud==null||ud.end.remove(),ud=null),kS=Math.max(0,kS-1)}},[])}function xH(){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 Cd=function(){return Cd=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},Cd.apply(this,arguments)};function ute(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 B7e(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 Z2="right-scroll-bar-position",e4="width-before-scroll-bar",z7e="with-scroll-bars-hidden",F7e="--removed-body-scroll-bar-size";function S7(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function H7e(e,t){var n=h.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 q7e=typeof window<"u"?h.useLayoutEffect:h.useEffect,kH=new WeakMap;function U7e(e,t){var n=H7e(null,function(s){return e.forEach(function(r){return S7(r,s)})});return q7e(function(){var s=kH.get(n);if(s){var r=new Set(s),i=new Set(e),o=n.current;r.forEach(function(a){i.has(a)||S7(a,null)}),i.forEach(function(a){r.has(a)||S7(a,o)})}kH.set(n,e)},[e]),n}function W7e(e){return e}function V7e(e,t){t===void 0&&(t=W7e);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 G7e(e){e===void 0&&(e={});var t=V7e(null);return t.options=Cd({async:!0,ssr:!1},e),t}var dte=function(e){var t=e.sideCar,n=ute(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 h.createElement(s,Cd({},n))};dte.isSideCarExport=!0;function K7e(e,t){return e.useMedium(t),dte}var hte=G7e(),C7=function(){},jT=h.forwardRef(function(e,t){var n=h.useRef(null),s=h.useState({onScrollCapture:C7,onWheelCapture:C7,onTouchMoveCapture:C7}),r=s[0],i=s[1],o=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,m=e.sideCar,p=e.noRelative,g=e.noIsolation,b=e.inert,v=e.allowPinchZoom,y=e.as,w=y===void 0?"div":y,x=e.gapMode,k=ute(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=m,T=U7e([n,t]),_=Cd(Cd({},k),r);return h.createElement(h.Fragment,null,d&&h.createElement(C,{sideCar:hte,removeScrollBar:u,shards:f,noRelative:p,noIsolation:g,inert:b,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:x}),o?h.cloneElement(h.Children.only(a),Cd(Cd({},_),{ref:T})):h.createElement(w,Cd({},_,{className:c,ref:T}),a))});jT.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};jT.classNames={fullWidth:e4,zeroRight:Z2};var Y7e=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function X7e(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Y7e();return t&&e.setAttribute("nonce",t),e}function Q7e(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function J7e(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Z7e=function(){var e=0,t=null;return{add:function(n){e==0&&(t=X7e())&&(Q7e(t,n),J7e(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},eEe=function(){var e=Z7e();return function(t,n){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},fte=function(){var e=eEe(),t=function(n){var s=n.styles,r=n.dynamic;return e(s,r),null};return t},tEe={left:0,top:0,right:0,gap:0},T7=function(e){return parseInt(e||"",10)||0},nEe=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[T7(n),T7(s),T7(r)]},sEe=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return tEe;var t=nEe(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])}},rEe=fte(),sb="data-scroll-locked",iEe=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(z7e,` {
   overflow: hidden `).concat(s,`;
   padding-right: `).concat(a,"px ").concat(s,`;
  }
  body[`).concat(sb,`] {
    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(Z2,` {
    right: `).concat(a,"px ").concat(s,`;
  }
  
  .`).concat(e4,` {
    margin-right: `).concat(a,"px ").concat(s,`;
  }
  
  .`).concat(Z2," .").concat(Z2,` {
    right: 0 `).concat(s,`;
  }
  
  .`).concat(e4," .").concat(e4,` {
    margin-right: 0 `).concat(s,`;
  }
  
  body[`).concat(sb,`] {
    `).concat(F7e,": ").concat(a,`px;
  }
`)},_H=function(){var e=parseInt(document.body.getAttribute(sb)||"0",10);return isFinite(e)?e:0},oEe=function(){h.useEffect(function(){return document.body.setAttribute(sb,(_H()+1).toString()),function(){var e=_H()-1;e<=0?document.body.removeAttribute(sb):document.body.setAttribute(sb,e.toString())}},[])},aEe=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,r=s===void 0?"margin":s;oEe();var i=h.useMemo(function(){return sEe(r)},[r]);return h.createElement(rEe,{styles:iEe(i,!t,r,n?"":"!important")})},gN=!1;if(typeof window<"u")try{var _S=Object.defineProperty({},"passive",{get:function(){return gN=!0,!0}});window.addEventListener("test",_S,_S),window.removeEventListener("test",_S,_S)}catch{gN=!1}var Jg=gN?{passive:!1}:!1,lEe=function(e){return e.tagName==="TEXTAREA"},mte=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!lEe(e)&&n[t]==="visible")},cEe=function(e){return mte(e,"overflowY")},uEe=function(e){return mte(e,"overflowX")},SH=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var r=pte(e,s);if(r){var i=gte(e,s),o=i[1],a=i[2];if(o>a)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},dEe=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},hEe=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},pte=function(e,t){return e==="v"?cEe(t):uEe(t)},gte=function(e,t){return e==="v"?dEe(t):hEe(t)},fEe=function(e,t){return e==="h"&&t==="rtl"?-1:1},mEe=function(e,t,n,s,r){var i=fEe(e,window.getComputedStyle(t).direction),o=i*s,a=n.target,c=t.contains(a),u=!1,d=o>0,f=0,m=0;do{if(!a)break;var p=gte(e,a),g=p[0],b=p[1],v=p[2],y=b-v-i*g;(g||y)&&pte(e,a)&&(f+=y,m+=g);var w=a.parentNode;a=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&Math.abs(f)<1||!d&&Math.abs(m)<1)&&(u=!0),u},SS=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},CH=function(e){return[e.deltaX,e.deltaY]},TH=function(e){return e&&"current"in e?e.current:e},pEe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},gEe=function(e){return`
  .block-interactivity-`.concat(e,` {pointer-events: none;}
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},bEe=0,Zg=[];function yEe(e){var t=h.useRef([]),n=h.useRef([0,0]),s=h.useRef(),r=h.useState(bEe++)[0],i=h.useState(fte)[0],o=h.useRef(e);h.useEffect(function(){o.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var b=B7e([e.lockRef.current],(e.shards||[]).map(TH),!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=h.useCallback(function(b,v){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!o.current.allowPinchZoom;var y=SS(b),w=n.current,x="deltaX"in b?b.deltaX:w[0]-y[0],k="deltaY"in b?b.deltaY:w[1]-y[1],C,T=b.target,_=Math.abs(x)>Math.abs(k)?"h":"v";if("touches"in b&&_==="h"&&T.type==="range")return!1;var S=window.getSelection(),R=S&&S.anchorNode,A=R?R===T||R.contains(T):!1;if(A)return!1;var O=SH(_,T);if(!O)return!0;if(O?C=_:(C=_==="v"?"h":"v",O=SH(_,T)),!O)return!1;if(!s.current&&"changedTouches"in b&&(x||k)&&(s.current=C),!C)return!0;var M=s.current||C;return mEe(M,v,b,M==="h"?x:k)},[]),c=h.useCallback(function(b){var v=b;if(!(!Zg.length||Zg[Zg.length-1]!==i)){var y="deltaY"in v?CH(v):SS(v),w=t.current.filter(function(C){return C.name===v.type&&(C.target===v.target||v.target===C.shadowParent)&&pEe(C.delta,y)})[0];if(w&&w.should){v.cancelable&&v.preventDefault();return}if(!w){var x=(o.current.shards||[]).map(TH).filter(Boolean).filter(function(C){return C.contains(v.target)}),k=x.length>0?a(v,x[0]):!o.current.noIsolation;k&&v.cancelable&&v.preventDefault()}}},[]),u=h.useCallback(function(b,v,y,w){var x={name:b,delta:v,target:y,should:w,shadowParent:wEe(y)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(k){return k!==x})},1)},[]),d=h.useCallback(function(b){n.current=SS(b),s.current=void 0},[]),f=h.useCallback(function(b){u(b.type,CH(b),b.target,a(b,e.lockRef.current))},[]),m=h.useCallback(function(b){u(b.type,SS(b),b.target,a(b,e.lockRef.current))},[]);h.useEffect(function(){return Zg.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Jg),document.addEventListener("touchmove",c,Jg),document.addEventListener("touchstart",d,Jg),function(){Zg=Zg.filter(function(b){return b!==i}),document.removeEventListener("wheel",c,Jg),document.removeEventListener("touchmove",c,Jg),document.removeEventListener("touchstart",d,Jg)}},[]);var p=e.removeScrollBar,g=e.inert;return h.createElement(h.Fragment,null,g?h.createElement(i,{styles:gEe(r)}):null,p?h.createElement(aEe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function wEe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const vEe=K7e(hte,yEe);var bk=h.forwardRef(function(e,t){return h.createElement(jT,Cd({},e,{ref:t,sideCar:vEe}))});bk.classNames=jT.classNames;var xEe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},e1=new WeakMap,CS=new WeakMap,TS={},E7=0,bte=function(e){return e&&(e.host||bte(e.parentNode))},kEe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=bte(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})},_Ee=function(e,t,n,s){var r=kEe(t,Array.isArray(e)?e:[e]);TS[n]||(TS[n]=new WeakMap);var i=TS[n],o=[],a=new Set,c=new Set(r),u=function(f){!f||a.has(f)||(a.add(f),u(f.parentNode))};r.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(m){if(a.has(m))d(m);else try{var p=m.getAttribute(s),g=p!==null&&p!=="false",b=(e1.get(m)||0)+1,v=(i.get(m)||0)+1;e1.set(m,b),i.set(m,v),o.push(m),b===1&&g&&CS.set(m,!0),v===1&&m.setAttribute(n,"true"),g||m.setAttribute(s,"true")}catch(y){console.error("aria-hidden: cannot operate on ",m,y)}})};return d(t),a.clear(),E7++,function(){o.forEach(function(f){var m=e1.get(f)-1,p=i.get(f)-1;e1.set(f,m),i.set(f,p),m||(CS.has(f)||f.removeAttribute(s),CS.delete(f)),p||f.removeAttribute(n)}),E7--,E7||(e1=new WeakMap,e1=new WeakMap,CS=new WeakMap,TS={})}},AT=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=xEe(e);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),_Ee(s,r,n,"aria-hidden")):function(){return null}},NT="Dialog",[yte,wte]=Xa(NT),[SEe,Ku]=yte(NT),MT=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:r,onOpenChange:i,modal:o=!0}=e,a=h.useRef(null),c=h.useRef(null),[u,d]=Tl({prop:s,defaultProp:r??!1,onChange:i,caller:NT});return l.jsx(SEe,{scope:t,triggerRef:a,contentRef:c,contentId:Ql(),titleId:Ql(),descriptionId:Ql(),open:u,onOpenChange:d,onOpenToggle:h.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};MT.displayName=NT;var vte="DialogTrigger",xte=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Ku(vte,n),i=js(t,r.triggerRef);return l.jsx(Wn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":LR(r.open),...s,ref:i,onClick:ln(e.onClick,r.onOpenToggle)})});xte.displayName=vte;var DR="DialogPortal",[CEe,kte]=yte(DR,{forceMount:void 0}),IT=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:r}=e,i=Ku(DR,t);return l.jsx(CEe,{scope:t,forceMount:n,children:h.Children.map(s,o=>l.jsx(Qa,{present:n||i.open,children:l.jsx(fy,{asChild:!0,container:r,children:o})}))})};IT.displayName=DR;var DC="DialogOverlay",RT=h.forwardRef((e,t)=>{const n=kte(DC,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,i=Ku(DC,e.__scopeDialog);return i.modal?l.jsx(Qa,{present:s||i.open,children:l.jsx(EEe,{...r,ref:t})}):null});RT.displayName=DC;var TEe=Gm("DialogOverlay.RemoveScroll"),EEe=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Ku(DC,n),i=E7e(),o=js(t,i);return l.jsx(bk,{as:TEe,allowPinchZoom:!0,shards:[r.contentRef],children:l.jsx(Wn.div,{"data-state":LR(r.open),...s,ref:o,style:{pointerEvents:"auto",...s.style}})})}),Mb="DialogContent",DT=h.forwardRef((e,t)=>{const n=kte(Mb,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,i=Ku(Mb,e.__scopeDialog);return l.jsx(Qa,{present:s||i.open,children:i.modal?l.jsx(jEe,{...r,ref:t}):l.jsx(AEe,{...r,ref:t})})});DT.displayName=Mb;var jEe=h.forwardRef((e,t)=>{const n=Ku(Mb,e.__scopeDialog),s=h.useRef(null),r=js(t,n.contentRef,s);return h.useEffect(()=>{const i=s.current;if(i)return AT(i)},[]),l.jsx(_te,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:ln(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ln(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:ln(e.onFocusOutside,i=>i.preventDefault())})}),AEe=h.forwardRef((e,t)=>{const n=Ku(Mb,e.__scopeDialog),s=h.useRef(!1),r=h.useRef(!1);return l.jsx(_te,{...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()}})}),_te=h.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:i,...o}=e,a=Ku(Mb,n);return ET(),l.jsx(l.Fragment,{children:l.jsx(gk,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:i,children:l.jsx(hy,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":LR(a.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),Ste="DialogTitle",PT=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Ku(Ste,n);return l.jsx(Wn.h2,{id:r.titleId,...s,ref:t})});PT.displayName=Ste;var Cte="DialogDescription",PR=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Ku(Cte,n);return l.jsx(Wn.p,{id:r.descriptionId,...s,ref:t})});PR.displayName=Cte;var Tte="DialogClose",my=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Ku(Tte,n);return l.jsx(Wn.button,{type:"button",...s,ref:t,onClick:ln(e.onClick,()=>r.onOpenChange(!1))})});my.displayName=Tte;function LR(e){return e?"open":"closed"}var Ete="AlertDialog",[NEe,s7t]=Xa(Ete,[wte]),Sf=wte(),jte=e=>{const{__scopeAlertDialog:t,...n}=e,s=Sf(t);return l.jsx(MT,{...s,...n,modal:!0})};jte.displayName=Ete;var MEe="AlertDialogTrigger",IEe=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=Sf(n);return l.jsx(xte,{...r,...s,ref:t})});IEe.displayName=MEe;var REe="AlertDialogPortal",Ate=e=>{const{__scopeAlertDialog:t,...n}=e,s=Sf(t);return l.jsx(IT,{...s,...n})};Ate.displayName=REe;var DEe="AlertDialogOverlay",Nte=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=Sf(n);return l.jsx(RT,{...r,...s,ref:t})});Nte.displayName=DEe;var Mte="AlertDialogContent",[PEe,LEe]=NEe(Mte),Ite=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...r}=e,i=Sf(n),o=h.useRef(null),a=js(t,o),c=h.useRef(null);return l.jsx(PEe,{scope:n,cancelRef:c,children:l.jsx(DT,{role:"alertdialog",...i,...r,ref:a,onOpenAutoFocus:ln(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})})});Ite.displayName=Mte;var OEe="AlertDialogTitle",Rte=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=Sf(n);return l.jsx(PT,{...r,...s,ref:t})});Rte.displayName=OEe;var $Ee="AlertDialogDescription",Dte=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=Sf(n);return l.jsx(PR,{...r,...s,ref:t})});Dte.displayName=$Ee;var BEe="AlertDialogAction",Pte=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=Sf(n);return l.jsx(my,{...r,...s,ref:t})});Pte.displayName=BEe;var Lte="AlertDialogCancel",Ote=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:r}=LEe(Lte,n),i=Sf(n),o=js(t,r);return l.jsx(my,{...i,...s,ref:o})});Ote.displayName=Lte;var zEe=jte,FEe=Ate,HEe=Nte,qEe=Ite,UEe=Pte,WEe=Ote,VEe=Rte,GEe=Dte;function LT(e){const t=h.useRef({value:e,previous:e});return h.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function OT(e){const[t,n]=h.useState(void 0);return ma(()=>{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 $T="Checkbox",[KEe,r7t]=Xa($T),[YEe,OR]=KEe($T);function XEe(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:f}=e,[m,p]=Tl({prop:n,defaultProp:r??!1,onChange:c,caller:$T}),[g,b]=h.useState(null),[v,y]=h.useState(null),w=h.useRef(!1),x=g?!!o||!!g.closest("form"):!0,k={checked:m,disabled:i,setChecked:p,control:g,setControl:b,name:a,form:o,value:d,hasConsumerStoppedPropagationRef:w,required:u,defaultChecked:Im(r)?!1:r,isFormControl:x,bubbleInput:v,setBubbleInput:y};return l.jsx(YEe,{scope:t,...k,children:QEe(f)?f(k):s})}var $te="CheckboxTrigger",Bte=h.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...s},r)=>{const{control:i,value:o,disabled:a,checked:c,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:m,isFormControl:p,bubbleInput:g}=OR($te,e),b=js(r,d),v=h.useRef(c);return h.useEffect(()=>{const y=i==null?void 0:i.form;if(y){const w=()=>f(v.current);return y.addEventListener("reset",w),()=>y.removeEventListener("reset",w)}},[i,f]),l.jsx(Wn.button,{type:"button",role:"checkbox","aria-checked":Im(c)?"mixed":c,"aria-required":u,"data-state":Wte(c),"data-disabled":a?"":void 0,disabled:a,value:o,...s,ref:b,onKeyDown:ln(t,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:ln(n,y=>{f(w=>Im(w)?!0:!w),g&&p&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})})});Bte.displayName=$te;var zte=h.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:s,checked:r,defaultChecked:i,required:o,disabled:a,value:c,onCheckedChange:u,form:d,...f}=e;return l.jsx(XEe,{__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(Bte,{...f,ref:t,__scopeCheckbox:n}),m&&l.jsx(Ute,{__scopeCheckbox:n})]})})});zte.displayName=$T;var Fte="CheckboxIndicator",Hte=h.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...r}=e,i=OR(Fte,n);return l.jsx(Qa,{present:s||Im(i.checked)||i.checked===!0,children:l.jsx(Wn.span,{"data-state":Wte(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t,style:{pointerEvents:"none",...e.style}})})});Hte.displayName=Fte;var qte="CheckboxBubbleInput",Ute=h.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:r,checked:i,defaultChecked:o,required:a,disabled:c,name:u,value:d,form:f,bubbleInput:m,setBubbleInput:p}=OR(qte,e),g=js(n,p),b=LT(i),v=OT(s);h.useEffect(()=>{const w=m;if(!w)return;const x=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(x,"checked").set,T=!r.current;if(b!==i&&C){const _=new Event("click",{bubbles:T});w.indeterminate=Im(i),C.call(w,Im(i)?!1:i),w.dispatchEvent(_)}},[m,b,i,r]);const y=h.useRef(Im(i)?!1:i);return l.jsx(Wn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??y.current,required:a,disabled:c,name:u,value:d,form:f,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Ute.displayName=qte;function QEe(e){return typeof e=="function"}function Im(e){return e==="indeterminate"}function Wte(e){return Im(e)?"indeterminate":e?"checked":"unchecked"}const JEe=["top","right","bottom","left"],Km=Math.min,Jh=Math.max,PC=Math.round,ES=Math.floor,Zh=e=>({x:e,y:e}),ZEe={left:"right",right:"left",bottom:"top",top:"bottom"};function Vte(e,t,n){return Jh(e,Km(t,n))}function mf(e,t){return typeof e=="function"?e(t):e}function Ym(e){return e.split("-")[0]}function py(e){return e.split("-")[1]}function $R(e){return e==="x"?"y":"x"}function BR(e){return e==="y"?"height":"width"}function Rd(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function zR(e){return $R(Rd(e))}function eje(e,t,n){n===void 0&&(n=!1);const s=py(e),r=zR(e),i=BR(r);let o=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=LC(o)),[o,LC(o)]}function tje(e){const t=LC(e);return[bN(e),t,bN(t)]}function bN(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const EH=["left","right"],jH=["right","left"],nje=["top","bottom"],sje=["bottom","top"];function rje(e,t,n){switch(e){case"top":case"bottom":return n?t?jH:EH:t?EH:jH;case"left":case"right":return t?nje:sje;default:return[]}}function ije(e,t,n,s){const r=py(e);let i=rje(Ym(e),n==="start",s);return r&&(i=i.map(o=>o+"-"+r),t&&(i=i.concat(i.map(bN)))),i}function LC(e){const t=Ym(e);return ZEe[t]+e.slice(t.length)}function oje(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 Gte(e){return typeof e!="number"?oje(e):{top:e,right:e,bottom:e,left:e}}function OC(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 AH(e,t,n){let{reference:s,floating:r}=e;const i=Rd(t),o=zR(t),a=BR(o),c=Ym(t),u=i==="y",d=s.x+s.width/2-r.width/2,f=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:f};break;case"left":p={x:s.x-r.width,y:f};break;default:p={x:s.x,y:s.y}}const g=py(t);return g&&(p[o]+=m*(g==="end"?1:-1)*(n&&u?-1:1)),p}async function aje(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:i,rects:o,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:m=!1,padding:p=0}=mf(t,e),g=Gte(p),v=a[m?f==="floating"?"reference":"floating":f],y=OC(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})),w=f==="floating"?{x:s,y:r,width:o.floating.width,height:o.floating.height}:o.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),k=await(i.isElement==null?void 0:i.isElement(x))&&await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1},C=OC(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:x,strategy:c}):w);return{top:(y.top-C.top+g.top)/k.y,bottom:(C.bottom-y.bottom+g.bottom)/k.y,left:(y.left-C.left+g.left)/k.x,right:(C.right-y.right+g.right)/k.x}}const lje=50,cje=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:aje},c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:f}=AH(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:y,fn:w}=v,{x,y:k,data:C,reset:T}=await w({x:d,y:f,initialPlacement:s,placement:m,strategy:r,middlewareData:g,rects:u,platform:a,elements:{reference:e,floating:t}});d=x??d,f=k??f,g[y]={...g[y],...C},T&&p<lje&&(p++,typeof T=="object"&&(T.placement&&(m=T.placement),T.rects&&(u=T.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:r}):T.rects),{x:d,y:f}=AH(u,m,c)),b=-1)}return{x:d,y:f,placement:m,strategy:r,middlewareData:g}},uje=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}=mf(e,t)||{};if(u==null)return{};const f=Gte(d),m={x:n,y:s},p=zR(r),g=BR(p),b=await o.getDimensions(u),v=p==="y",y=v?"top":"left",w=v?"bottom":"right",x=v?"clientHeight":"clientWidth",k=i.reference[g]+i.reference[p]-m[p]-i.floating[g],C=m[p]-i.reference[p],T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let _=T?T[x]:0;(!_||!await(o.isElement==null?void 0:o.isElement(T)))&&(_=a.floating[x]||i.floating[g]);const S=k/2-C/2,R=_/2-b[g]/2-1,A=Km(f[y],R),O=Km(f[w],R),M=_-b[g]-O,D=_/2-b[g]/2+S,$=Vte(A,D,M),z=!c.arrow&&py(r)!=null&&D!==$&&i.reference[g]/2-(D<A?A:O)-b[g]/2<0,B=z?D<A?D-A:D-M:0;return{[p]:m[p]+B,data:{[p]:$,centerOffset:D-$-B,...z&&{alignmentOffset:B}},reset:z}}}),dje=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:f=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...v}=mf(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=Ym(r),w=Rd(a),x=Ym(a)===a,k=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=m||(x||!b?[LC(a)]:tje(a)),T=g!=="none";!m&&T&&C.push(...ije(a,b,g,k));const _=[a,...C],S=await c.detectOverflow(t,v),R=[];let A=((s=i.flip)==null?void 0:s.overflows)||[];if(d&&R.push(S[y]),f){const $=eje(r,o,k);R.push(S[$[0]],S[$[1]])}if(A=[...A,{placement:r,overflows:R}],!R.every($=>$<=0)){var O,M;const $=(((O=i.flip)==null?void 0:O.index)||0)+1,z=_[$];if(z&&(!(f==="alignment"?w!==Rd(z):!1)||A.every(H=>Rd(H.placement)===w?H.overflows[0]>0:!0)))return{data:{index:$,overflows:A},reset:{placement:z}};let B=(M=A.filter(j=>j.overflows[0]<=0).sort((j,H)=>j.overflows[1]-H.overflows[1])[0])==null?void 0:M.placement;if(!B)switch(p){case"bestFit":{var D;const j=(D=A.filter(H=>{if(T){const Q=Rd(H.placement);return Q===w||Q==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(Q=>Q>0).reduce((Q,I)=>Q+I,0)]).sort((H,Q)=>H[1]-Q[1])[0])==null?void 0:D[0];j&&(B=j);break}case"initialPlacement":B=a;break}if(r!==B)return{reset:{placement:B}}}return{}}}};function NH(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function MH(e){return JEe.some(t=>e[t]>=0)}const hje=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:r="referenceHidden",...i}=mf(e,t);switch(r){case"referenceHidden":{const o=await s.detectOverflow(t,{...i,elementContext:"reference"}),a=NH(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:MH(a)}}}case"escaped":{const o=await s.detectOverflow(t,{...i,altBoundary:!0}),a=NH(o,n.floating);return{data:{escapedOffsets:a,escaped:MH(a)}}}default:return{}}}}},Kte=new Set(["left","top"]);async function fje(e,t){const{placement:n,platform:s,elements:r}=e,i=await(s.isRTL==null?void 0:s.isRTL(r.floating)),o=Ym(n),a=py(n),c=Rd(n)==="y",u=Kte.has(o)?-1:1,d=i&&c?-1:1,f=mf(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.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 mje=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 fje(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}}}}},pje=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:w=>{let{x,y:k}=w;return{x,y:k}}},...u}=mf(e,t),d={x:n,y:s},f=await i.detectOverflow(t,u),m=Rd(r),p=$R(m);let g=d[p],b=d[m];const v=(w,x)=>Vte(x+f[w==="y"?"top":"left"],x,x-f[w==="y"?"bottom":"right"]);o&&(g=v(p,g)),a&&(b=v(m,b));const y=c.fn({...t,[p]:g,[m]:b});return{...y,data:{x:y.x-n,y:y.y-s,enabled:{[p]:o,[m]:a}}}}}},gje=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:f=!0}=mf(e,t),m={x:r,y:i},p=Rd(o),g=$R(p);let b=m[g],v=m[p];const y=mf(u,t),w=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(s=y.crossAxis)!=null?s:0};if(d){const C=g==="y"?"height":"width",T=a.reference[g]-a.floating[C]+w.mainAxis,_=a.reference[g]+a.reference[C]-w.mainAxis;b<T?b=T:b>_&&(b=_)}if(f){var x,k;const C=g==="y"?"width":"height",T=Kte.has(Ym(o)),_=a.reference[p]-a.floating[C]+(T&&((x=c.offset)==null?void 0:x[p])||0)+(T?0:w.crossAxis),S=a.reference[p]+a.reference[C]+(T?0:((k=c.offset)==null?void 0:k[p])||0)-(T?w.crossAxis:0);v<_?v=_:v>S&&(v=S)}return{[g]:b,[p]:v}}}},bje=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}=mf(e,t),c=await r.detectOverflow(t,a),u=Ym(n),d=py(n),f=Rd(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,y=m-c.left-c.right,w=Km(p-c[g],v),x=Km(m-c[b],y),k=t.middlewareData.shift,C=!k;let T=w,_=x;k!=null&&k.enabled.x&&(_=y),k!=null&&k.enabled.y&&(T=v),C&&!d&&(f?_=m-2*Jh(c.left,c.right):T=p-2*Jh(c.top,c.bottom)),await o({...t,availableWidth:_,availableHeight:T});const S=await r.getDimensions(i.floating);return m!==S.width||p!==S.height?{reset:{rects:!0}}:{}}}};function BT(){return typeof window<"u"}function gy(e){return Yte(e)?(e.nodeName||"").toLowerCase():"#document"}function Jl(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Cf(e){var t;return(t=(Yte(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Yte(e){return BT()?e instanceof Node||e instanceof Jl(e).Node:!1}function qd(e){return BT()?e instanceof Element||e instanceof Jl(e).Element:!1}function vp(e){return BT()?e instanceof HTMLElement||e instanceof Jl(e).HTMLElement:!1}function IH(e){return!BT()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Jl(e).ShadowRoot}function zT(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=Ud(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&r!=="inline"&&r!=="contents"}function yje(e){return/^(table|td|th)$/.test(gy(e))}function FT(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const wje=/transform|translate|scale|rotate|perspective|filter/,vje=/paint|layout|strict|content/,Xp=e=>!!e&&e!=="none";let j7;function FR(e){const t=qd(e)?Ud(e):e;return Xp(t.transform)||Xp(t.translate)||Xp(t.scale)||Xp(t.rotate)||Xp(t.perspective)||!HR()&&(Xp(t.backdropFilter)||Xp(t.filter))||wje.test(t.willChange||"")||vje.test(t.contain||"")}function xje(e){let t=H0(e);for(;vp(t)&&!ix(t);){if(FR(t))return t;if(FT(t))return null;t=H0(t)}return null}function HR(){return j7==null&&(j7=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),j7}function ix(e){return/^(html|body|#document)$/.test(gy(e))}function Ud(e){return Jl(e).getComputedStyle(e)}function HT(e){return qd(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function H0(e){if(gy(e)==="html")return e;const t=e.assignedSlot||e.parentNode||IH(e)&&e.host||Cf(e);return IH(t)?t.host:t}function Xte(e){const t=H0(e);return ix(t)?(e.ownerDocument||e).body:vp(t)&&zT(t)?t:Xte(t)}function ox(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Xte(e),i=r===((s=e.ownerDocument)==null?void 0:s.body),o=Jl(r);if(i){const a=yN(o);return t.concat(o,o.visualViewport||[],zT(r)?r:[],a&&n?ox(a):[])}else return t.concat(r,ox(r,[],n))}function yN(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Qte(e){const t=Ud(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=vp(e),i=r?e.offsetWidth:n,o=r?e.offsetHeight:s,a=PC(n)!==i||PC(s)!==o;return a&&(n=i,s=o),{width:n,height:s,$:a}}function qR(e){return qd(e)?e:e.contextElement}function rb(e){const t=qR(e);if(!vp(t))return Zh(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:i}=Qte(t);let o=(i?PC(n.width):n.width)/s,a=(i?PC(n.height):n.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const kje=Zh(0);function Jte(e){const t=Jl(e);return!HR()||!t.visualViewport?kje:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _je(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Jl(e)}function q0(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=qR(e);let o=Zh(1);t&&(s?qd(s)&&(o=rb(s)):o=rb(e));const a=_je(i,n,s)?Jte(i):Zh(0);let c=(r.left+a.x)/o.x,u=(r.top+a.y)/o.y,d=r.width/o.x,f=r.height/o.y;if(i&&s){const m=Jl(i),p=qd(s)?Jl(s):s;let g=m,b=yN(g);for(;b&&p!==g;){const v=rb(b),y=b.getBoundingClientRect(),w=Ud(b),x=y.left+(b.clientLeft+parseFloat(w.paddingLeft))*v.x,k=y.top+(b.clientTop+parseFloat(w.paddingTop))*v.y;c*=v.x,u*=v.y,d*=v.x,f*=v.y,c+=x,u+=k,g=Jl(b),b=yN(g)}}return OC({width:d,height:f,x:c,y:u})}function qT(e,t){const n=HT(e).scrollLeft;return t?t.left+n:q0(Cf(e)).left+n}function Zte(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-qT(e,n),r=n.top+t.scrollTop;return{x:s,y:r}}function Sje(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const i=r==="fixed",o=Cf(s),a=t?FT(t.floating):!1;if(s===o||a&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Zh(1);const d=Zh(0),f=vp(s);if((f||!i)&&((gy(s)!=="body"||zT(o))&&(c=HT(s)),f)){const p=q0(s);u=rb(s),d.x=p.x+s.clientLeft,d.y=p.y+s.clientTop}const m=o&&!f&&!i?Zte(o,c):Zh(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 Cje(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Tje(e){const t=HT(e),n=e.ownerDocument.body,s=Jh(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=Jh(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+qT(e);const o=-t.scrollTop;return Ud(n).direction==="rtl"&&(i+=Jh(e.clientWidth,n.clientWidth)-s),{width:s,height:r,x:i,y:o}}const Eje=25;function jje(e,t,n){n===void 0&&(n="viewport");const s=n==="layoutViewport",r=Jl(e),i=Cf(e),o=r.visualViewport;let a=i.clientWidth,c=i.clientHeight,u=0,d=0;if(o){const m=!HR()||t==="fixed";s?m||(u=-o.offsetLeft,d=-o.offsetTop):(a=o.width,c=o.height,m&&(u=o.offsetLeft,d=o.offsetTop))}if(qT(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),y=getComputedStyle(i).scrollbarGutter==="stable both-edges"?v/2:v;y<=Eje&&(a-=y)}return{width:a,height:c,x:u,y:d}}function Aje(e,t){const n=q0(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,i=rb(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 RH(e,t,n){let s;if(t==="viewport"||t==="layoutViewport")s=jje(e,n,t);else if(t==="document")s=Tje(Cf(e));else if(qd(t))s=Aje(t,n);else{const r=Jte(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return OC(s)}function Nje(e,t){const n=t.get(e);if(n)return n;let s=ox(e,[],!1).filter(a=>qd(a)&&gy(a)!=="body"),r=null;const i=Ud(e).position==="fixed";let o=i?H0(e):e;for(;qd(o)&&!ix(o);){const a=Ud(o),c=FR(o),u=r?r.position:i?"fixed":"";!c&&(u==="fixed"||u==="absolute"&&a.position==="static")?s=s.filter(f=>f!==o):r=a,o=H0(o)}return t.set(e,s),s}function Mje(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const o=[...n==="clippingAncestors"?FT(t)?[]:Nje(t,this._c):[].concat(n),s],a=RH(t,o[0],r);let c=a.top,u=a.right,d=a.bottom,f=a.left;for(let m=1;m<o.length;m++){const p=RH(t,o[m],r);c=Jh(p.top,c),u=Km(p.right,u),d=Km(p.bottom,d),f=Jh(p.left,f)}return{width:u-f,height:d-c,x:f,y:c}}function Ije(e){const{width:t,height:n}=Qte(e);return{width:t,height:n}}function Rje(e,t,n){const s=vp(t),r=Cf(t),i=n==="fixed",o=q0(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Zh(0);if((s||!i)&&((gy(t)!=="body"||zT(r))&&(a=HT(t)),s)){const m=q0(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}!s&&r&&(c.x=qT(r));const u=r&&!s&&!i?Zte(r,a):Zh(0),d=o.left+a.scrollLeft-c.x-u.x,f=o.top+a.scrollTop-c.y-u.y;return{x:d,y:f,width:o.width,height:o.height}}function A7(e){return Ud(e).position==="static"}function DH(e,t){if(!vp(e)||Ud(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Cf(e)===n&&(n=n.ownerDocument.body),n}function ene(e,t){const n=Jl(e);if(FT(e))return n;if(!vp(e)){let r=H0(e);for(;r&&!ix(r);){if(qd(r)&&!A7(r))return r;r=H0(r)}return n}let s=DH(e,t);for(;s&&yje(s)&&A7(s);)s=DH(s,t);return s&&ix(s)&&A7(s)&&!FR(s)?n:s||xje(e)||n}const Dje=async function(e){const t=this.getOffsetParent||ene,n=this.getDimensions,s=await n(e.floating);return{reference:Rje(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Pje(e){return Ud(e).direction==="rtl"}const Lje={convertOffsetParentRelativeRectToViewportRelativeRect:Sje,getDocumentElement:Cf,getClippingRect:Mje,getOffsetParent:ene,getElementRects:Dje,getClientRects:Cje,getDimensions:Ije,getScale:rb,isElement:qd,isRTL:Pje};function tne(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Oje(e,t,n){let s=null,r;const i=Cf(e);function o(){var d;clearTimeout(r),(d=s)==null||d.disconnect(),s=null}function a(d,f){d===void 0&&(d=!1),f===void 0&&(f=1),o();const m=e.getBoundingClientRect(),{left:p,top:g,width:b,height:v}=m;if(d||t(),!b||!v)return;const y=ES(g),w=ES(i.clientWidth-(p+b)),x=ES(i.clientHeight-(g+v)),k=ES(p),T={rootMargin:-y+"px "+-w+"px "+-x+"px "+-k+"px",threshold:Jh(0,Km(1,f))||1};let _=!0;function S(R){const A=R[0].intersectionRatio;if(!tne(m,e.getBoundingClientRect()))return a();if(A!==f){if(!_)return a();A?a(!1,A):r=setTimeout(()=>{a(!1,1e-7)},1e3)}_=!1}try{s=new IntersectionObserver(S,{...T,root:i.ownerDocument})}catch{s=new IntersectionObserver(S,T)}s.observe(e)}const c=Jl(e),u=()=>a(n);return c.addEventListener("resize",u),a(!0),()=>{c.removeEventListener("resize",u),o()}}function $je(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=qR(e),d=r||i?[...u?ox(u):[],...t?ox(t):[]]:[];d.forEach(y=>{r&&y.addEventListener("scroll",n),i&&y.addEventListener("resize",n)});const f=u&&a?Oje(u,n,i):null;let m=-1,p=null;o&&(p=new ResizeObserver(y=>{let[w]=y;w&&w.target===u&&p&&t&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(t)})),n()}),u&&!c&&p.observe(u),t&&p.observe(t));let g,b=c?q0(e):null;c&&v();function v(){const y=q0(e);b&&!tne(b,y)&&n(),b=y,g=requestAnimationFrame(v)}return n(),()=>{var y;d.forEach(w=>{r&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),f==null||f(),(y=p)==null||y.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const Bje=mje,zje=pje,Fje=dje,Hje=bje,qje=hje,PH=uje,Uje=gje,Wje=(e,t,n)=>{const s=new Map,r=n??{},i={...Lje,...r.platform,_c:s};return cje(e,t,{...r,platform:i})};var Vje=typeof document<"u",Gje=function(){},t4=Vje?h.useLayoutEffect:Gje;function $C(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(!$C(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)&&!$C(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function nne(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function LH(e,t){const n=nne(e);return Math.round(t*n)/n}function N7(e){const t=h.useRef(e);return t4(()=>{t.current=e}),t}function Kje(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,f]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=h.useState(s);$C(m,s)||p(s);const[g,b]=h.useState(null),[v,y]=h.useState(null),w=h.useCallback(H=>{H!==T.current&&(T.current=H,b(H))},[]),x=h.useCallback(H=>{H!==_.current&&(_.current=H,y(H))},[]),k=i||g,C=o||v,T=h.useRef(null),_=h.useRef(null),S=h.useRef(d),R=c!=null,A=N7(c),O=N7(r),M=N7(u),D=h.useCallback(()=>{if(!T.current||!_.current)return;const H={placement:t,strategy:n,middleware:m};O.current&&(H.platform=O.current),Wje(T.current,_.current,H).then(Q=>{const I={...Q,isPositioned:M.current!==!1};$.current&&!$C(S.current,I)&&(S.current=I,Wu.flushSync(()=>{f(I)}))})},[m,t,n,O,M]);t4(()=>{u===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,f(H=>({...H,isPositioned:!1})))},[u]);const $=h.useRef(!1);t4(()=>($.current=!0,()=>{$.current=!1}),[]),t4(()=>{if(k&&(T.current=k),C&&(_.current=C),k&&C){if(A.current)return A.current(k,C,D);D()}},[k,C,D,A,R]);const z=h.useMemo(()=>({reference:T,floating:_,setReference:w,setFloating:x}),[w,x]),B=h.useMemo(()=>({reference:k,floating:C}),[k,C]),j=h.useMemo(()=>{const H={position:n,left:0,top:0};if(!B.floating)return H;const Q=LH(B.floating,d.x),I=LH(B.floating,d.y);return a?{...H,transform:"translate("+Q+"px, "+I+"px)",...nne(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Q,top:I}},[n,a,B.floating,d.x,d.y]);return h.useMemo(()=>({...d,update:D,refs:z,elements:B,floatingStyles:j}),[d,D,z,B,j])}const Yje=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?PH({element:s.current,padding:r}).fn(n):{}:s?PH({element:s,padding:r}).fn(n):{}}}},Xje=(e,t)=>{const n=Bje(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qje=(e,t)=>{const n=zje(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jje=(e,t)=>({fn:Uje(e).fn,options:[e,t]}),Zje=(e,t)=>{const n=Fje(e);return{name:n.name,fn:n.fn,options:[e,t]}},eAe=(e,t)=>{const n=Hje(e);return{name:n.name,fn:n.fn,options:[e,t]}},tAe=(e,t)=>{const n=qje(e);return{name:n.name,fn:n.fn,options:[e,t]}},nAe=(e,t)=>{const n=Yje(e);return{name:n.name,fn:n.fn,options:[e,t]}};var sAe="Arrow",sne=h.forwardRef((e,t)=>{const{children:n,width:s=10,height:r=5,...i}=e;return l.jsx(Wn.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"})})});sne.displayName=sAe;var rAe=sne,UR="Popper",[rne,xp]=Xa(UR),[iAe,ine]=rne(UR),one=e=>{const{__scopePopper:t,children:n}=e,[s,r]=h.useState(null),[i,o]=h.useState(void 0);return l.jsx(iAe,{scope:t,anchor:s,onAnchorChange:r,placementState:i,setPlacementState:o,children:n})};one.displayName=UR;var ane="PopperAnchor",lne=h.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...r}=e,i=ine(ane,n),o=h.useRef(null),a=i.onAnchorChange,c=h.useCallback(g=>{o.current=g,g&&a(g)},[a]),u=js(t,c),d=h.useRef(null);h.useEffect(()=>{if(!s)return;const g=d.current;d.current=s.current,g!==d.current&&a(d.current)});const f=i.placementState&&VR(i.placementState),m=f==null?void 0:f[0],p=f==null?void 0:f[1];return s?null:l.jsx(Wn.div,{"data-radix-popper-side":m,"data-radix-popper-align":p,...r,ref:u})});lne.displayName=ane;var WR="PopperContent",[oAe,aAe]=rne(WR),cne=h.forwardRef((e,t)=>{var de,re,ne,U,Z,ge;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:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:g,...b}=e,v=ine(WR,n),[y,w]=h.useState(null),x=js(t,w),[k,C]=h.useState(null),T=OT(k),_=(T==null?void 0:T.width)??0,S=(T==null?void 0:T.height)??0,R=s+(i!=="center"?"-"+i:""),A=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},O=Array.isArray(u)?u:[u],M=O.length>0,D={padding:A,boundary:O.filter(cAe),altBoundary:M},{refs:$,floatingStyles:z,placement:B,isPositioned:j,middlewareData:H}=Kje({strategy:"fixed",placement:R,whileElementsMounted:(...ce)=>$je(...ce,{animationFrame:p==="always"}),elements:{reference:v.anchor},middleware:[Xje({mainAxis:r+S,alignmentAxis:o}),c&&Qje({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?Jje():void 0,...D}),c&&Zje({...D}),eAe({...D,apply:({elements:ce,rects:ue,availableWidth:be,availableHeight:rt})=>{const{width:le,height:Me}=ue.reference,We=ce.floating.style;We.setProperty("--radix-popper-available-width",`${be}px`),We.setProperty("--radix-popper-available-height",`${rt}px`),We.setProperty("--radix-popper-anchor-width",`${le}px`),We.setProperty("--radix-popper-anchor-height",`${Me}px`)}}),k&&nAe({element:k,padding:a}),uAe({arrowWidth:_,arrowHeight:S}),m&&tAe({strategy:"referenceHidden",...D,boundary:M?D.boundary:void 0})]}),Q=v.setPlacementState;ma(()=>(Q(B),()=>{Q(void 0)}),[B,Q]);const[I,J]=VR(B),W=Oc(g);ma(()=>{j&&(W==null||W())},[j,W]);const P=(de=H.arrow)==null?void 0:de.x,V=(re=H.arrow)==null?void 0:re.y,ee=((ne=H.arrow)==null?void 0:ne.centerOffset)!==0,[q,K]=h.useState();return ma(()=>{y&&K(window.getComputedStyle(y).zIndex)},[y]),l.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:j?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:q,"--radix-popper-transform-origin":[(U=H.transformOrigin)==null?void 0:U.x,(Z=H.transformOrigin)==null?void 0:Z.y].join(" "),...((ge=H.hide)==null?void 0:ge.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(oAe,{scope:n,placedSide:I,placedAlign:J,onArrowChange:C,arrowX:P,arrowY:V,shouldHideArrow:ee,children:l.jsx(Wn.div,{"data-side":I,"data-align":J,...b,ref:x,style:{...b.style,animation:j?void 0:"none"}})})})});cne.displayName=WR;var une="PopperArrow",lAe={top:"bottom",right:"left",bottom:"top",left:"right"},dne=h.forwardRef(function(t,n){const{__scopePopper:s,...r}=t,i=aAe(une,s),o=lAe[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(rAe,{...r,ref:n,style:{...r.style,display:"block"}})})});dne.displayName=une;function cAe(e){return e!==null}var uAe=e=>({name:"transformOrigin",options:e,fn(t){var v,y,w;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]=VR(n),f={start:"0%",center:"50%",end:"100%"}[d],m=(((y=r.arrow)==null?void 0:y.x)??0)+a/2,p=(((w=r.arrow)==null?void 0:w.y)??0)+c/2;let g="",b="";return u==="bottom"?(g=o?f:`${m}px`,b=`${-c}px`):u==="top"?(g=o?f:`${m}px`,b=`${s.floating.height+c}px`):u==="right"?(g=`${-c}px`,b=o?f:`${p}px`):u==="left"&&(g=`${s.floating.width+c}px`,b=o?f:`${p}px`),{data:{x:g,y:b}}}});function VR(e){const[t,n="center"]=e.split("-");return[t,n]}var yk=one,wk=lne,UT=cne,WT=dne,M7=!1;function dAe(){const[e,t]=h.useState(M7);return h.useEffect(()=>{M7||(M7=!0,t(!0))},[]),e}var hne=R3[" useSyncExternalStore ".trim().toString()];function hAe(){return()=>{}}function fAe(){return hne(hAe,()=>!0,()=>!1)}var mAe=typeof hne=="function"?fAe:dAe,I7="rovingFocusGroup.onEntryFocus",pAe={bubbles:!1,cancelable:!0},vk="RovingFocusGroup",[wN,fne,gAe]=IR(vk),[bAe,kp]=Xa(vk,[gAe]),[yAe,wAe]=bAe(vk),mne=h.forwardRef((e,t)=>l.jsx(wN.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(wN.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(vAe,{...e,ref:t})})}));mne.displayName=vk;var vAe=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:r=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,m=h.useRef(null),p=js(t,m),g=dy(i),[b,v]=Tl({prop:o,defaultProp:a??null,onChange:c,caller:vk}),[y,w]=h.useState(!1),x=Oc(u),k=fne(n),C=h.useRef(!1),[T,_]=h.useState(0);return h.useEffect(()=>{const S=m.current;if(S)return S.addEventListener(I7,x),()=>S.removeEventListener(I7,x)},[x]),l.jsx(yAe,{scope:n,orientation:s,dir:g,loop:r,currentTabStopId:b,onItemFocus:h.useCallback(S=>v(S),[v]),onItemShiftTab:h.useCallback(()=>w(!0),[]),onFocusableItemAdd:h.useCallback(()=>_(S=>S+1),[]),onFocusableItemRemove:h.useCallback(()=>_(S=>S-1),[]),children:l.jsx(Wn.div,{tabIndex:y||T===0?-1:0,"data-orientation":s,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:ln(e.onMouseDown,()=>{C.current=!0}),onFocus:ln(e.onFocus,S=>{const R=!C.current;if(S.target===S.currentTarget&&R&&!y){const A=new CustomEvent(I7,pAe);if(S.currentTarget.dispatchEvent(A),!A.defaultPrevented){const O=k().filter(B=>B.focusable),M=O.find(B=>B.active),D=O.find(B=>B.id===b),z=[M,D,...O].filter(Boolean).map(B=>B.ref.current);bne(z,d)}}C.current=!1}),onBlur:ln(e.onBlur,()=>w(!1))})})}),pne="RovingFocusGroupItem",gne=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:r=!1,tabStopId:i,children:o,...a}=e,c=Ql(),u=i||c,d=wAe(pne,n),f=d.currentTabStopId===u,m=fne(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:b}=d,v=mAe();return ma(()=>{if(!(!v||!s))return p(),()=>g()},[v,s,p,g]),h.useEffect(()=>{if(!(v||!s))return p(),()=>g()},[v,s,p,g]),l.jsx(wN.ItemSlot,{scope:n,id:u,focusable:s,active:r,children:l.jsx(Wn.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:ln(e.onMouseDown,y=>{s?d.onItemFocus(u):y.preventDefault()}),onFocus:ln(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:ln(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){d.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const w=_Ae(y,d.orientation,d.dir);if(w!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let k=m().filter(C=>C.focusable).map(C=>C.ref.current);if(w==="last")k.reverse();else if(w==="prev"||w==="next"){w==="prev"&&k.reverse();const C=k.indexOf(y.currentTarget);k=d.loop?SAe(k,C+1):k.slice(C+1)}setTimeout(()=>bne(k))}}),children:typeof o=="function"?o({isCurrentTabStop:f,hasTabStop:b!=null}):o})})});gne.displayName=pne;var xAe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function kAe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function _Ae(e,t,n){const s=kAe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return xAe[s]}function bne(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function SAe(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var VT=mne,GT=gne,vN=["Enter"," "],CAe=["ArrowDown","PageUp","Home"],yne=["ArrowUp","PageDown","End"],TAe=[...CAe,...yne],EAe={ltr:[...vN,"ArrowRight"],rtl:[...vN,"ArrowLeft"]},jAe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},xk="Menu",[ax,AAe,NAe]=IR(xk),[bg,wne]=Xa(xk,[NAe,xp,kp]),kk=xp(),vne=kp(),[xne,_p]=bg(xk),[MAe,_k]=bg(xk),kne=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:r,onOpenChange:i,modal:o=!0}=e,a=kk(t),[c,u]=h.useState(null),d=h.useRef(!1),f=Oc(i),m=dy(r);return h.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})}},[]),h.useEffect(()=>{if(!n)return;const p=()=>f(!1);return window.addEventListener("blur",p),()=>window.removeEventListener("blur",p)},[n,f]),l.jsx(yk,{...a,children:l.jsx(xne,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:u,children:l.jsx(MAe,{scope:t,onClose:h.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:m,modal:o,children:s})})})};kne.displayName=xk;var IAe="MenuAnchor",GR=h.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,r=kk(n);return l.jsx(wk,{...r,...s,ref:t})});GR.displayName=IAe;var KR="MenuPortal",[RAe,_ne]=bg(KR,{forceMount:void 0}),Sne=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:r}=e,i=_p(KR,t);return l.jsx(RAe,{scope:t,forceMount:n,children:l.jsx(Qa,{present:n||i.open,children:l.jsx(fy,{asChild:!0,container:r,children:s})})})};Sne.displayName=KR;var yu="MenuContent",[DAe,YR]=bg(yu),Cne=h.forwardRef((e,t)=>{const n=_ne(yu,e.__scopeMenu),{forceMount:s=n.forceMount,...r}=e,i=_p(yu,e.__scopeMenu),o=_k(yu,e.__scopeMenu);return l.jsx(ax.Provider,{scope:e.__scopeMenu,children:l.jsx(Qa,{present:s||i.open,children:l.jsx(ax.Slot,{scope:e.__scopeMenu,children:o.modal?l.jsx(PAe,{...r,ref:t}):l.jsx(LAe,{...r,ref:t})})})})}),PAe=h.forwardRef((e,t)=>{const n=_p(yu,e.__scopeMenu),s=h.useRef(null),r=js(t,s);return h.useEffect(()=>{const i=s.current;if(i)return AT(i)},[]),l.jsx(XR,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ln(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),LAe=h.forwardRef((e,t)=>{const n=_p(yu,e.__scopeMenu);return l.jsx(XR,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),OAe=Gm("MenuContent.ScrollLock"),XR=h.forwardRef((e,t)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:p,disableOutsideScroll:g,...b}=e,v=_p(yu,n),y=_k(yu,n),w=kk(n),x=vne(n),k=AAe(n),[C,T]=h.useState(null),_=h.useRef(null),S=js(t,_,v.onContentChange),R=h.useRef(0),A=h.useRef(""),O=h.useRef(0),M=h.useRef(null),D=h.useRef("right"),$=h.useRef(0),z=g?bk:h.Fragment,B=g?{as:OAe,allowPinchZoom:!0}:void 0,j=Q=>{var K,de;const I=A.current+Q,J=k().filter(re=>!re.disabled),W=document.activeElement,P=(K=J.find(re=>re.ref.current===W))==null?void 0:K.textValue,V=J.map(re=>re.textValue),ee=YAe(V,I,P),q=(de=J.find(re=>re.textValue===ee))==null?void 0:de.ref.current;(function re(ne){A.current=ne,window.clearTimeout(R.current),ne!==""&&(R.current=window.setTimeout(()=>re(""),1e3))})(I),q&&setTimeout(()=>q.focus())};h.useEffect(()=>()=>window.clearTimeout(R.current),[]),ET();const H=h.useCallback(Q=>{var J,W;return D.current===((J=M.current)==null?void 0:J.side)&&QAe(Q,(W=M.current)==null?void 0:W.area)},[]);return l.jsx(DAe,{scope:n,searchRef:A,onItemEnter:h.useCallback(Q=>{H(Q)&&Q.preventDefault()},[H]),onItemLeave:h.useCallback(Q=>{var I;H(Q)||((I=_.current)==null||I.focus(),T(null))},[H]),onTriggerLeave:h.useCallback(Q=>{H(Q)&&Q.preventDefault()},[H]),pointerGraceTimerRef:O,onPointerGraceIntentChange:h.useCallback(Q=>{M.current=Q},[]),children:l.jsx(z,{...B,children:l.jsx(gk,{asChild:!0,trapped:r,onMountAutoFocus:ln(i,Q=>{var I;Q.preventDefault(),(I=_.current)==null||I.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:l.jsx(hy,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:p,children:l.jsx(VT,{asChild:!0,...x,dir:y.dir,orientation:"vertical",loop:s,currentTabStopId:C,onCurrentTabStopIdChange:T,onEntryFocus:ln(c,Q=>{y.isUsingKeyboardRef.current||Q.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(UT,{role:"menu","aria-orientation":"vertical","data-state":Hne(v.open),"data-radix-menu-content":"",dir:y.dir,...w,...b,ref:S,style:{outline:"none",...b.style},onKeyDown:ln(b.onKeyDown,Q=>{const J=Q.target.closest("[data-radix-menu-content]")===Q.currentTarget,W=Q.ctrlKey||Q.altKey||Q.metaKey,P=Q.key.length===1;J&&(Q.key==="Tab"&&Q.preventDefault(),!W&&P&&j(Q.key));const V=_.current;if(Q.target!==V||!TAe.includes(Q.key))return;Q.preventDefault();const q=k().filter(K=>!K.disabled).map(K=>K.ref.current);yne.includes(Q.key)&&q.reverse(),GAe(q)}),onBlur:ln(e.onBlur,Q=>{Q.currentTarget.contains(Q.target)||(window.clearTimeout(R.current),A.current="")}),onPointerMove:ln(e.onPointerMove,lx(Q=>{const I=Q.target,J=$.current!==Q.clientX;if(Q.currentTarget.contains(I)&&J){const W=Q.clientX>$.current?"right":"left";D.current=W,$.current=Q.clientX}}))})})})})})})});Cne.displayName=yu;var $Ae="MenuGroup",QR=h.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return l.jsx(Wn.div,{role:"group",...s,ref:t})});QR.displayName=$Ae;var BAe="MenuLabel",Tne=h.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return l.jsx(Wn.div,{...s,ref:t})});Tne.displayName=BAe;var BC="MenuItem",OH="menu.itemSelect",KT=h.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...r}=e,i=h.useRef(null),o=_k(BC,e.__scopeMenu),a=YR(BC,e.__scopeMenu),c=js(t,i),u=h.useRef(!1),d=()=>{const f=i.current;if(!n&&f){const m=new CustomEvent(OH,{bubbles:!0,cancelable:!0});f.addEventListener(OH,p=>s==null?void 0:s(p),{once:!0}),ite(f,m),m.defaultPrevented?u.current=!1:o.onClose()}};return l.jsx(Ene,{...r,ref:c,disabled:n,onClick:ln(e.onClick,d),onPointerDown:f=>{var m;(m=e.onPointerDown)==null||m.call(e,f),u.current=!0},onPointerUp:ln(e.onPointerUp,f=>{var m;u.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:ln(e.onKeyDown,f=>{n||f.target!==f.currentTarget||a.searchRef.current!==""&&f.key===" "||vN.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});KT.displayName=BC;var Ene=h.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:r,...i}=e,o=YR(BC,n),a=vne(n),c=h.useRef(null),u=js(t,c),[d,f]=h.useState(!1),[m,p]=h.useState("");return h.useEffect(()=>{const g=c.current;g&&p((g.textContent??"").trim())},[i.children]),l.jsx(ax.ItemSlot,{scope:n,disabled:s,textValue:r??m,children:l.jsx(GT,{asChild:!0,...a,focusable:!s,children:l.jsx(Wn.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...i,ref:u,onPointerMove:ln(e.onPointerMove,lx(g=>{s?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ln(e.onPointerLeave,lx(g=>o.onItemLeave(g))),onFocus:ln(e.onFocus,()=>f(!0)),onBlur:ln(e.onBlur,()=>f(!1))})})})}),zAe="MenuCheckboxItem",jne=h.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...r}=e;return l.jsx(Rne,{scope:e.__scopeMenu,checked:n,children:l.jsx(KT,{role:"menuitemcheckbox","aria-checked":zC(n)?"mixed":n,...r,ref:t,"data-state":eD(n),onSelect:ln(r.onSelect,()=>s==null?void 0:s(zC(n)?!0:!n),{checkForDefaultPrevented:!1})})})});jne.displayName=zAe;var Ane="MenuRadioGroup",[FAe,HAe]=bg(Ane,{value:void 0,onValueChange:()=>{}}),Nne=h.forwardRef((e,t)=>{const{value:n,onValueChange:s,...r}=e,i=Oc(s);return l.jsx(FAe,{scope:e.__scopeMenu,value:n,onValueChange:i,children:l.jsx(QR,{...r,ref:t})})});Nne.displayName=Ane;var Mne="MenuRadioItem",Ine=h.forwardRef((e,t)=>{const{value:n,...s}=e,r=HAe(Mne,e.__scopeMenu),i=n===r.value;return l.jsx(Rne,{scope:e.__scopeMenu,checked:i,children:l.jsx(KT,{role:"menuitemradio","aria-checked":i,...s,ref:t,"data-state":eD(i),onSelect:ln(s.onSelect,()=>{var o;return(o=r.onValueChange)==null?void 0:o.call(r,n)},{checkForDefaultPrevented:!1})})})});Ine.displayName=Mne;var JR="MenuItemIndicator",[Rne,qAe]=bg(JR,{checked:!1}),Dne=h.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...r}=e,i=qAe(JR,n);return l.jsx(Qa,{present:s||zC(i.checked)||i.checked===!0,children:l.jsx(Wn.span,{...r,ref:t,"data-state":eD(i.checked)})})});Dne.displayName=JR;var UAe="MenuSeparator",Pne=h.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return l.jsx(Wn.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});Pne.displayName=UAe;var WAe="MenuArrow",Lne=h.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,r=kk(n);return l.jsx(WT,{...r,...s,ref:t})});Lne.displayName=WAe;var ZR="MenuSub",[VAe,One]=bg(ZR),$ne=e=>{const{__scopeMenu:t,children:n,open:s=!1,onOpenChange:r}=e,i=_p(ZR,t),o=kk(t),[a,c]=h.useState(null),[u,d]=h.useState(null),f=Oc(r);return h.useEffect(()=>(i.open===!1&&f(!1),()=>f(!1)),[i.open,f]),l.jsx(yk,{...o,children:l.jsx(xne,{scope:t,open:s,onOpenChange:f,content:u,onContentChange:d,children:l.jsx(VAe,{scope:t,contentId:Ql(),triggerId:Ql(),trigger:a,onTriggerChange:c,children:n})})})};$ne.displayName=ZR;var zw="MenuSubTrigger",Bne=h.forwardRef((e,t)=>{const n=_p(zw,e.__scopeMenu),s=_k(zw,e.__scopeMenu),r=One(zw,e.__scopeMenu),i=YR(zw,e.__scopeMenu),o=h.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=i,u={__scopeMenu:e.__scopeMenu},d=h.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);h.useEffect(()=>d,[d]),h.useEffect(()=>{const m=a.current;return()=>{window.clearTimeout(m),c(null)}},[a,c]);const f=js(t,r.onTriggerChange);return l.jsx(GR,{asChild:!0,...u,children:l.jsx(Ene,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":n.open?r.contentId:void 0,"data-state":Hne(n.open),...e,ref:f,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:ln(e.onPointerMove,lx(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:ln(e.onPointerLeave,lx(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,y=v==="right",w=y?-5:5,x=p[y?"left":"right"],k=p[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:m.clientX+w,y:m.clientY},{x,y:p.top},{x:k,y:p.top},{x:k,y:p.bottom},{x,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:ln(e.onKeyDown,m=>{var g;e.disabled||m.target!==m.currentTarget||i.searchRef.current!==""&&m.key===" "||EAe[s.dir].includes(m.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),m.preventDefault())})})})});Bne.displayName=zw;var zne="MenuSubContent",Fne=h.forwardRef((e,t)=>{const n=_ne(yu,e.__scopeMenu),{forceMount:s=n.forceMount,align:r="start",...i}=e,o=_p(yu,e.__scopeMenu),a=_k(yu,e.__scopeMenu),c=One(zne,e.__scopeMenu),u=h.useRef(null),d=js(t,u);return l.jsx(ax.Provider,{scope:e.__scopeMenu,children:l.jsx(Qa,{present:s||o.open,children:l.jsx(ax.Slot,{scope:e.__scopeMenu,children:l.jsx(XR,{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:f=>{var m;a.isUsingKeyboardRef.current&&((m=u.current)==null||m.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:ln(e.onFocusOutside,f=>{f.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:ln(e.onEscapeKeyDown,f=>{a.onClose(),f.preventDefault()}),onKeyDown:ln(e.onKeyDown,f=>{var g;const m=f.currentTarget.contains(f.target),p=jAe[a.dir].includes(f.key);m&&p&&(o.onOpenChange(!1),(g=c.trigger)==null||g.focus(),f.preventDefault())})})})})})});Fne.displayName=zne;function Hne(e){return e?"open":"closed"}function zC(e){return e==="indeterminate"}function eD(e){return zC(e)?"indeterminate":e?"checked":"unchecked"}function GAe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function KAe(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function YAe(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=KAe(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 XAe(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,f=c.x,m=c.y;d>s!=m>s&&n<(f-u)*(s-d)/(m-d)+u&&(r=!r)}return r}function QAe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return XAe(n,t)}function lx(e){return t=>t.pointerType==="mouse"?e(t):void 0}var JAe=kne,ZAe=GR,eNe=Sne,tNe=Cne,nNe=QR,sNe=Tne,rNe=KT,iNe=jne,oNe=Nne,aNe=Ine,lNe=Dne,cNe=Pne,uNe=Lne,dNe=$ne,hNe=Bne,fNe=Fne,YT="DropdownMenu",[mNe,i7t]=Xa(YT,[wne]),Ja=wne(),[pNe,qne]=mNe(YT),Une=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:r,defaultOpen:i,onOpenChange:o,modal:a=!0}=e,c=Ja(t),u=h.useRef(null),[d,f]=Tl({prop:r,defaultProp:i??!1,onChange:o,caller:YT});return l.jsx(pNe,{scope:t,triggerId:Ql(),triggerRef:u,contentId:Ql(),open:d,onOpenChange:f,onOpenToggle:h.useCallback(()=>f(m=>!m),[f]),modal:a,children:l.jsx(JAe,{...c,open:d,onOpenChange:f,dir:s,modal:a,children:n})})};Une.displayName=YT;var Wne="DropdownMenuTrigger",Vne=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...r}=e,i=qne(Wne,n),o=Ja(n),a=js(t,i.triggerRef);return l.jsx(ZAe,{asChild:!0,...o,children:l.jsx(Wn.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:ln(e.onPointerDown,c=>{!s&&c.button===0&&c.ctrlKey===!1&&(i.onOpenToggle(),i.open||c.preventDefault())}),onKeyDown:ln(e.onKeyDown,c=>{s||(["Enter"," "].includes(c.key)&&i.onOpenToggle(),c.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});Vne.displayName=Wne;var gNe="DropdownMenuPortal",Gne=e=>{const{__scopeDropdownMenu:t,...n}=e,s=Ja(t);return l.jsx(eNe,{...s,...n})};Gne.displayName=gNe;var Kne="DropdownMenuContent",Yne=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=qne(Kne,n),i=Ja(n),o=h.useRef(!1);return l.jsx(tNe,{id:r.contentId,"aria-labelledby":r.triggerId,...i,...s,ref:t,onCloseAutoFocus:ln(e.onCloseAutoFocus,a=>{var c;o.current||(c=r.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:ln(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)"}})});Yne.displayName=Kne;var bNe="DropdownMenuGroup",Xne=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Ja(n);return l.jsx(nNe,{...r,...s,ref:t})});Xne.displayName=bNe;var yNe="DropdownMenuLabel",wNe=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Ja(n);return l.jsx(sNe,{...r,...s,ref:t})});wNe.displayName=yNe;var vNe="DropdownMenuItem",Qne=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Ja(n);return l.jsx(rNe,{...r,...s,ref:t})});Qne.displayName=vNe;var xNe="DropdownMenuCheckboxItem",kNe=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Ja(n);return l.jsx(iNe,{...r,...s,ref:t})});kNe.displayName=xNe;var _Ne="DropdownMenuRadioGroup",Jne=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Ja(n);return l.jsx(oNe,{...r,...s,ref:t})});Jne.displayName=_Ne;var SNe="DropdownMenuRadioItem",Zne=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Ja(n);return l.jsx(aNe,{...r,...s,ref:t})});Zne.displayName=SNe;var CNe="DropdownMenuItemIndicator",ese=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Ja(n);return l.jsx(lNe,{...r,...s,ref:t})});ese.displayName=CNe;var TNe="DropdownMenuSeparator",tse=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Ja(n);return l.jsx(cNe,{...r,...s,ref:t})});tse.displayName=TNe;var ENe="DropdownMenuArrow",jNe=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Ja(n);return l.jsx(uNe,{...r,...s,ref:t})});jNe.displayName=ENe;var ANe=e=>{const{__scopeDropdownMenu:t,children:n,open:s,onOpenChange:r,defaultOpen:i}=e,o=Ja(t),[a,c]=Tl({prop:s,defaultProp:i??!1,onChange:r,caller:"DropdownMenuSub"});return l.jsx(dNe,{...o,open:a,onOpenChange:c,children:n})},NNe="DropdownMenuSubTrigger",nse=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Ja(n);return l.jsx(hNe,{...r,...s,ref:t})});nse.displayName=NNe;var MNe="DropdownMenuSubContent",sse=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Ja(n);return l.jsx(fNe,{...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)"}})});sse.displayName=MNe;var INe=Une,RNe=Vne,DNe=Gne,PNe=Yne,LNe=Xne,ONe=Qne,$Ne=Jne,BNe=Zne,zNe=ese,FNe=tse,HNe=ANe,qNe=nse,UNe=sse,WNe="Label",rse=h.forwardRef((e,t)=>l.jsx(Wn.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())}}));rse.displayName=WNe;var VNe=rse;function $H(e,[t,n]){return Math.min(n,Math.max(t,e))}var XT="Popover",[ise,o7t]=Xa(XT,[xp]),Sk=xp(),[GNe,Sp]=ise(XT),ose=e=>{const{__scopePopover:t,children:n,open:s,defaultOpen:r,onOpenChange:i,modal:o=!1}=e,a=Sk(t),c=h.useRef(null),[u,d]=h.useState(!1),[f,m]=Tl({prop:s,defaultProp:r??!1,onChange:i,caller:XT});return l.jsx(yk,{...a,children:l.jsx(GNe,{scope:t,contentId:Ql(),triggerRef:c,open:f,onOpenChange:m,onOpenToggle:h.useCallback(()=>m(p=>!p),[m]),hasCustomAnchor:u,onCustomAnchorAdd:h.useCallback(()=>d(!0),[]),onCustomAnchorRemove:h.useCallback(()=>d(!1),[]),modal:o,children:n})})};ose.displayName=XT;var ase="PopoverAnchor",lse=h.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=Sp(ase,n),i=Sk(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=r;return h.useEffect(()=>(o(),()=>a()),[o,a]),l.jsx(wk,{...i,...s,ref:t})});lse.displayName=ase;var cse="PopoverTrigger",use=h.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=Sp(cse,n),i=Sk(n),o=js(t,r.triggerRef),a=l.jsx(Wn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":pse(r.open),...s,ref:o,onClick:ln(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?a:l.jsx(wk,{asChild:!0,...i,children:a})});use.displayName=cse;var tD="PopoverPortal",[KNe,YNe]=ise(tD,{forceMount:void 0}),dse=e=>{const{__scopePopover:t,forceMount:n,children:s,container:r}=e,i=Sp(tD,t);return l.jsx(KNe,{scope:t,forceMount:n,children:l.jsx(Qa,{present:n||i.open,children:l.jsx(fy,{asChild:!0,container:r,children:s})})})};dse.displayName=tD;var Ib="PopoverContent",hse=h.forwardRef((e,t)=>{const n=YNe(Ib,e.__scopePopover),{forceMount:s=n.forceMount,...r}=e,i=Sp(Ib,e.__scopePopover);return l.jsx(Qa,{present:s||i.open,children:i.modal?l.jsx(QNe,{...r,ref:t}):l.jsx(JNe,{...r,ref:t})})});hse.displayName=Ib;var XNe=Gm("PopoverContent.RemoveScroll"),QNe=h.forwardRef((e,t)=>{const n=Sp(Ib,e.__scopePopover),s=h.useRef(null),r=js(t,s),i=h.useRef(!1);return h.useEffect(()=>{const o=s.current;if(o)return AT(o)},[]),l.jsx(bk,{as:XNe,allowPinchZoom:!0,children:l.jsx(fse,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ln(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),i.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ln(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:ln(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),JNe=h.forwardRef((e,t)=>{const n=Sp(Ib,e.__scopePopover),s=h.useRef(!1),r=h.useRef(!1);return l.jsx(fse,{...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()}})}),fse=h.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...f}=e,m=Sp(Ib,n),p=Sk(n);return ET(),l.jsx(gk,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:i,children:l.jsx(hy,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>m.onOpenChange(!1),deferPointerDownOutside:!0,children:l.jsx(UT,{"data-state":pse(m.open),role:"dialog",id:m.contentId,...p,...f,ref:t,style:{...f.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)"}})})})}),mse="PopoverClose",ZNe=h.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=Sp(mse,n);return l.jsx(Wn.button,{type:"button",...s,ref:t,onClick:ln(e.onClick,()=>r.onOpenChange(!1))})});ZNe.displayName=mse;var eMe="PopoverArrow",tMe=h.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=Sk(n);return l.jsx(WT,{...r,...s,ref:t})});tMe.displayName=eMe;function pse(e){return e?"open":"closed"}var nMe=ose,sMe=lse,rMe=use,iMe=dse,oMe=hse,nD="Radio",[aMe,gse]=Xa(nD),[lMe,QT]=aMe(nD);function bse(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,[f,m]=h.useState(null),[p,g]=h.useState(null),b=h.useRef(!1),v=f?!!i||!!f.closest("form"):!0,y={checked:n,disabled:r,required:c,name:o,form:i,value:u,control:f,setControl:m,hasConsumerStoppedPropagationRef:b,isFormControl:v,bubbleInput:p,setBubbleInput:g,onCheck:()=>a==null?void 0:a()};return l.jsx(lMe,{scope:t,...y,children:uMe(d)?d(y):s})}var yse="RadioTrigger",sD=h.forwardRef(({__scopeRadio:e,onClick:t,...n},s)=>{const{checked:r,disabled:i,value:o,setControl:a,onCheck:c,hasConsumerStoppedPropagationRef:u,isFormControl:d,bubbleInput:f}=QT(yse,e),m=js(s,a);return l.jsx(Wn.button,{type:"button",role:"radio","aria-checked":r,"data-state":kse(r),"data-disabled":i?"":void 0,disabled:i,value:o,...n,ref:m,onClick:ln(t,p=>{r||c(),f&&d&&(u.current=p.isPropagationStopped(),u.current||p.stopPropagation())})})});sD.displayName=yse;var cMe=h.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(bse,{__scopeRadio:n,checked:r,disabled:o,required:i,onCheck:c,name:s,form:u,value:a,internal_do_not_use_render:({isFormControl:f})=>l.jsxs(l.Fragment,{children:[l.jsx(sD,{...d,ref:t,__scopeRadio:n}),f&&l.jsx(rD,{__scopeRadio:n})]})})});cMe.displayName=nD;var wse="RadioIndicator",vse=h.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:s,...r}=e,i=QT(wse,n);return l.jsx(Qa,{present:s||i.checked,children:l.jsx(Wn.span,{"data-state":kse(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})})});vse.displayName=wse;var xse="RadioBubbleInput",rD=h.forwardRef(({__scopeRadio:e,...t},n)=>{const{control:s,checked:r,required:i,disabled:o,name:a,value:c,form:u,bubbleInput:d,setBubbleInput:f,hasConsumerStoppedPropagationRef:m}=QT(xse,e),p=js(n,f),g=LT(r),b=OT(s);h.useEffect(()=>{const y=d;if(!y)return;const w=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(w,"checked").set,C=!m.current;if(g!==r&&k){const T=new Event("click",{bubbles:C});k.call(y,r),y.dispatchEvent(T)}},[d,g,r,m]);const v=h.useRef(r);return l.jsx(Wn.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%)"}})});rD.displayName=xse;function uMe(e){return typeof e=="function"}function kse(e){return e?"checked":"unchecked"}var dMe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],JT="RadioGroup",[hMe,a7t]=Xa(JT,[kp,gse]),_se=kp(),ZT=gse(),[fMe,mMe]=hMe(JT),Sse=h.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:f=!0,onValueChange:m,...p}=e,g=_se(n),b=dy(d),[v,y]=Tl({prop:o,defaultProp:i??null,onChange:m,caller:JT}),[w,x]=h.useState(null),k=js(t,x),C=h.useRef(v);return h.useEffect(()=>{const T=r?w==null?void 0:w.ownerDocument.getElementById(r):w==null?void 0:w.closest("form");if(T instanceof HTMLFormElement){const _=()=>y(C.current);return T.addEventListener("reset",_),()=>T.removeEventListener("reset",_)}},[w,r,y]),l.jsx(fMe,{scope:n,name:s,form:r,required:a,disabled:c,value:v,onValueChange:y,children:l.jsx(VT,{asChild:!0,...g,orientation:u,dir:b,loop:f,children:l.jsx(Wn.div,{role:"radiogroup","aria-required":a,"aria-orientation":u,"data-disabled":c?"":void 0,dir:b,...p,ref:k})})})});Sse.displayName=JT;var pMe="RadioGroupItem",gMe="RadioGroupItemProvider",Cse="RadioGroupItemTrigger",bMe="RadioGroupItemBubbleInput";function yMe(e){const{__scopeRadioGroup:t,value:n,disabled:s,children:r,internal_do_not_use_render:i}=e,o=mMe(gMe,t),a=ZT(t),c=o.disabled||s;return l.jsx(bse,{...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 Tse=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,r=_se(n),i=ZT(n),{checked:o,disabled:a}=QT(Cse,i.__scopeRadio),c=h.useRef(null),u=js(t,c),d=h.useRef(!1);return h.useEffect(()=>{const f=p=>{dMe.includes(p.key)&&(d.current=!0)},m=()=>d.current=!1;return document.addEventListener("keydown",f),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",f),document.removeEventListener("keyup",m)}},[]),l.jsx(GT,{asChild:!0,...r,focusable:!a,active:o,children:l.jsx(sD,{...i,...s,ref:u,onKeyDown:ln(s.onKeyDown,f=>{f.key==="Enter"&&f.preventDefault()}),onFocus:ln(s.onFocus,()=>{var f;d.current&&((f=c.current)==null||f.click())})})})});Tse.displayName=Cse;var Ese=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,value:s,disabled:r,...i}=e;return l.jsx(yMe,{__scopeRadioGroup:n,value:s,disabled:r,internal_do_not_use_render:({isFormControl:o})=>l.jsxs(l.Fragment,{children:[l.jsx(Tse,{...i,ref:t,__scopeRadioGroup:n}),o&&l.jsx(jse,{__scopeRadioGroup:n})]})})});Ese.displayName=pMe;var jse=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,r=ZT(n);return l.jsx(rD,{...r,...s,ref:t})});jse.displayName=bMe;var wMe="RadioGroupIndicator",Ase=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,r=ZT(n);return l.jsx(vse,{...r,...s,ref:t})});Ase.displayName=wMe;var vMe=[" ","Enter","ArrowUp","ArrowDown"],xMe=[" ","Enter"],U0="Select",[e5,t5,kMe]=IR(U0),[yg,l7t]=Xa(U0,[kMe,xp]),n5=xp(),[_Me,Cp]=yg(U0),[SMe,CMe]=yg(U0),TMe="SelectProvider";function Nse(e){const{__scopeSelect:t,children:n,open:s,defaultOpen:r,onOpenChange:i,value:o,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:m,required:p,form:g,internal_do_not_use_render:b}=e,v=n5(t),[y,w]=h.useState(null),[x,k]=h.useState(null),[C,T]=h.useState(!1),_=dy(u),[S,R]=Tl({prop:s,defaultProp:r??!1,onChange:i,caller:U0}),[A,O]=Tl({prop:o,defaultProp:a,onChange:c,caller:U0}),M=h.useRef(null),D=h.useRef(A);h.useEffect(()=>{const W=g?y==null?void 0:y.ownerDocument.getElementById(g):y==null?void 0:y.form;if(W instanceof HTMLFormElement){const P=()=>O(D.current);return W.addEventListener("reset",P),()=>W.removeEventListener("reset",P)}},[g,y,O]);const $=y?!!g||!!y.closest("form"):!0,[z,B]=h.useState(new Set),j=Ql(),H=Array.from(z).map(W=>W.props.value).join(";"),Q=h.useCallback(W=>{B(P=>new Set(P).add(W))},[]),I=h.useCallback(W=>{B(P=>{const V=new Set(P);return V.delete(W),V})},[]),J={required:p,trigger:y,onTriggerChange:w,valueNode:x,onValueNodeChange:k,valueNodeHasChildren:C,onValueNodeHasChildrenChange:T,contentId:j,value:A,onValueChange:O,open:S,onOpenChange:R,dir:_,triggerPointerDownPosRef:M,disabled:m,name:d,autoComplete:f,form:g,nativeOptions:z,nativeSelectKey:H,isFormControl:$};return l.jsx(yk,{...v,children:l.jsx(_Me,{scope:t,...J,children:l.jsx(e5.Provider,{scope:t,children:l.jsx(SMe,{scope:t,onNativeOptionAdd:Q,onNativeOptionRemove:I,children:HMe(b)?b(J):n})})})})}Nse.displayName=TMe;var Mse=e=>{const{__scopeSelect:t,children:n,...s}=e;return l.jsx(Nse,{__scopeSelect:t,...s,internal_do_not_use_render:({isFormControl:r})=>l.jsxs(l.Fragment,{children:[n,r?l.jsx(rre,{__scopeSelect:t}):null]})})};Mse.displayName=U0;var Ise="SelectTrigger",Rse=h.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...r}=e,i=n5(n),o=Cp(Ise,n),a=o.disabled||s,c=js(t,o.onTriggerChange),u=t5(n),d=h.useRef("touch"),[f,m,p]=ire(b=>{const v=u().filter(x=>!x.disabled),y=v.find(x=>x.value===o.value),w=ore(v,b,y);w!==void 0&&o.onValueChange(w.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(wk,{asChild:!0,...i,children:l.jsx(Wn.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":s5(o.value)?"":void 0,...r,ref:c,onClick:ln(r.onClick,b=>{b.currentTarget.focus(),d.current!=="mouse"&&g(b)}),onPointerDown:ln(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:ln(r.onKeyDown,b=>{const v=f.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&m(b.key),!(v&&b.key===" ")&&vMe.includes(b.key)&&(g(),b.preventDefault())})})})});Rse.displayName=Ise;var Dse="SelectValue",Pse=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:r,children:i,placeholder:o="",...a}=e,c=Cp(Dse,n),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,f=js(t,c.onValueNodeChange);ma(()=>{u(d)},[u,d]);const m=s5(c.value);return l.jsx(Wn.span,{...a,asChild:m?!1:a.asChild,ref:f,style:{pointerEvents:"none"},children:l.jsx(h.Fragment,{children:m?o:i},m?"placeholder":"value")})});Pse.displayName=Dse;var EMe="SelectIcon",Lse=h.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...r}=e;return l.jsx(Wn.span,{"aria-hidden":!0,...r,ref:t,children:s||"▼"})});Lse.displayName=EMe;var Ose="SelectPortal",[jMe,AMe]=yg(Ose,{forceMount:void 0}),$se=e=>{const{__scopeSelect:t,forceMount:n,...s}=e;return l.jsx(jMe,{scope:e.__scopeSelect,forceMount:n,children:l.jsx(fy,{asChild:!0,...s})})};$se.displayName=Ose;var Xm="SelectContent",Bse=h.forwardRef((e,t)=>{const n=AMe(Xm,e.__scopeSelect),{forceMount:s=n.forceMount,...r}=e,i=Cp(Xm,e.__scopeSelect),[o,a]=h.useState();return ma(()=>{a(new DocumentFragment)},[]),l.jsx(Qa,{present:s||i.open,children:({present:c})=>c?l.jsx(Hse,{...r,ref:t}):l.jsx(zse,{...r,fragment:o})})});Bse.displayName=Xm;var zse=h.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,fragment:r}=e;return r?Wu.createPortal(l.jsx(Fse,{scope:n,children:l.jsx(e5.Slot,{scope:n,children:l.jsx("div",{ref:t,children:s})})}),r):null});zse.displayName="SelectContentFragment";var Mu=10,[Fse,Tp]=yg(Xm),NMe="SelectContentImpl",MMe=Gm("SelectContent.RemoveScroll"),Hse=h.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:f,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:b,avoidCollisions:v,...y}=e,w=Cp(Xm,n),[x,k]=h.useState(null),[C,T]=h.useState(null),_=js(t,k),[S,R]=h.useState(null),[A,O]=h.useState(null),M=t5(n),[D,$]=h.useState(!1),z=h.useRef(!1);h.useEffect(()=>{if(x)return AT(x)},[x]),ET();const B=h.useCallback(K=>{const[de,...re]=M().map(Z=>Z.ref.current),[ne]=re.slice(-1),U=document.activeElement;for(const Z of K)if(Z===U||(Z==null||Z.scrollIntoView({block:"nearest"}),Z===de&&C&&(C.scrollTop=0),Z===ne&&C&&(C.scrollTop=C.scrollHeight),Z==null||Z.focus(),document.activeElement!==U))return},[M,C]),j=h.useCallback(()=>B([S,x]),[B,S,x]);h.useEffect(()=>{D&&j()},[D,j]);const{onOpenChange:H,triggerPointerDownPosRef:Q}=w;h.useEffect(()=>{if(x){let K={x:0,y:0};const de=ne=>{var U,Z;K={x:Math.abs(Math.round(ne.pageX)-(((U=Q.current)==null?void 0:U.x)??0)),y:Math.abs(Math.round(ne.pageY)-(((Z=Q.current)==null?void 0:Z.y)??0))}},re=ne=>{K.x<=10&&K.y<=10?ne.preventDefault():ne.composedPath().includes(x)||H(!1),document.removeEventListener("pointermove",de),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",de),document.addEventListener("pointerup",re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",de),document.removeEventListener("pointerup",re,{capture:!0})}}},[x,H,Q]),h.useEffect(()=>{const K=()=>H(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[H]);const[I,J]=ire(K=>{const de=M().filter(U=>!U.disabled),re=de.find(U=>U.ref.current===document.activeElement),ne=ore(de,K,re);ne&&setTimeout(()=>{var U;return(U=ne.ref.current)==null?void 0:U.focus()})}),W=h.useCallback((K,de,re)=>{const ne=!z.current&&!re;(w.value!==void 0&&w.value===de||ne)&&(R(K),ne&&(z.current=!0))},[w.value]),P=h.useCallback(()=>x==null?void 0:x.focus(),[x]),V=h.useCallback((K,de,re)=>{const ne=!z.current&&!re;(w.value!==void 0&&w.value===de||ne)&&O(K)},[w.value]),ee=s==="popper"?xN:qse,q=ee===xN?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:b,avoidCollisions:v}:{};return l.jsx(Fse,{scope:n,content:x,viewport:C,onViewportChange:T,itemRefCallback:W,selectedItem:S,onItemLeave:P,itemTextRefCallback:V,focusSelectedItem:j,selectedItemText:A,position:s,isPositioned:D,searchRef:I,children:l.jsx(bk,{as:MMe,allowPinchZoom:!0,children:l.jsx(gk,{asChild:!0,trapped:w.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:ln(r,K=>{var de;(de=w.trigger)==null||de.focus({preventScroll:!0}),K.preventDefault()}),children:l.jsx(hy,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:l.jsx(ee,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:K=>K.preventDefault(),...y,...q,onPlaced:()=>$(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:ln(y.onKeyDown,K=>{const de=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!de&&K.key.length===1&&J(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let ne=M().filter(U=>!U.disabled).map(U=>U.ref.current);if(["ArrowUp","End"].includes(K.key)&&(ne=ne.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const U=K.target,Z=ne.indexOf(U);ne=ne.slice(Z+1)}setTimeout(()=>B(ne)),K.preventDefault()}})})})})})})});Hse.displayName=NMe;var IMe="SelectItemAlignedPosition",qse=h.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...r}=e,i=Cp(Xm,n),o=Tp(Xm,n),[a,c]=h.useState(null),[u,d]=h.useState(null),f=js(t,d),m=t5(n),p=h.useRef(!1),g=h.useRef(!0),{viewport:b,selectedItem:v,selectedItemText:y,focusSelectedItem:w}=o,x=h.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&u&&b&&v&&y){const _=i.trigger.getBoundingClientRect(),S=u.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),A=y.getBoundingClientRect();if(i.dir!=="rtl"){const U=A.left-S.left,Z=R.left-U,ge=_.left-Z,ce=_.width+ge,ue=Math.max(ce,S.width),be=window.innerWidth-Mu,rt=$H(Z,[Mu,Math.max(Mu,be-ue)]);a.style.minWidth=ce+"px",a.style.left=rt+"px"}else{const U=S.right-A.right,Z=window.innerWidth-R.right-U,ge=window.innerWidth-_.right-Z,ce=_.width+ge,ue=Math.max(ce,S.width),be=window.innerWidth-Mu,rt=$H(Z,[Mu,Math.max(Mu,be-ue)]);a.style.minWidth=ce+"px",a.style.right=rt+"px"}const O=m(),M=window.innerHeight-Mu*2,D=b.scrollHeight,$=window.getComputedStyle(u),z=parseInt($.borderTopWidth,10),B=parseInt($.paddingTop,10),j=parseInt($.borderBottomWidth,10),H=parseInt($.paddingBottom,10),Q=z+B+D+H+j,I=Math.min(v.offsetHeight*5,Q),J=window.getComputedStyle(b),W=parseInt(J.paddingTop,10),P=parseInt(J.paddingBottom,10),V=_.top+_.height/2-Mu,ee=M-V,q=v.offsetHeight/2,K=v.offsetTop+q,de=z+B+K,re=Q-de;if(de<=V){const U=O.length>0&&v===O[O.length-1].ref.current;a.style.bottom="0px";const Z=u.clientHeight-b.offsetTop-b.offsetHeight,ge=Math.max(ee,q+(U?P:0)+Z+j),ce=de+ge;a.style.height=ce+"px"}else{const U=O.length>0&&v===O[0].ref.current;a.style.top="0px";const ge=Math.max(V,z+b.offsetTop+(U?W:0)+q)+re;a.style.height=ge+"px",b.scrollTop=de-V+b.offsetTop}a.style.margin=`${Mu}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,y,i.dir,s]);ma(()=>x(),[x]);const[k,C]=h.useState();ma(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const T=h.useCallback(_=>{_&&g.current===!0&&(x(),w==null||w(),g.current=!1)},[x,w]);return l.jsx(DMe,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:T,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:l.jsx(Wn.div,{...r,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});qse.displayName=IMe;var RMe="SelectPopperPosition",xN=h.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:r=Mu,...i}=e,o=n5(n);return l.jsx(UT,{...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)"}})});xN.displayName=RMe;var[DMe,iD]=yg(Xm,{}),kN="SelectViewport",Use=h.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...r}=e,i=Tp(kN,n),o=iD(kN,n),a=js(t,i.onViewportChange),c=h.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(e5.Slot,{scope:n,children:l.jsx(Wn.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:ln(r.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&f){const p=Math.abs(c.current-d.scrollTop);if(p>0){const g=window.innerHeight-Mu*2,b=parseFloat(f.style.minHeight),v=parseFloat(f.style.height),y=Math.max(b,v);if(y<g){const w=y+p,x=Math.min(g,w),k=w-x;f.style.height=x+"px",f.style.bottom==="0px"&&(d.scrollTop=k>0?k:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Use.displayName=kN;var Wse="SelectGroup",[PMe,LMe]=yg(Wse),Vse=h.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=Ql();return l.jsx(PMe,{scope:n,id:r,children:l.jsx(Wn.div,{role:"group","aria-labelledby":r,...s,ref:t})})});Vse.displayName=Wse;var Gse="SelectLabel",OMe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=LMe(Gse,n);return l.jsx(Wn.div,{id:r.id,...s,ref:t})});OMe.displayName=Gse;var FC="SelectItem",[$Me,Kse]=yg(FC),Yse=h.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:r=!1,textValue:i,...o}=e,a=Cp(FC,n),c=Tp(FC,n),u=a.value===s,[d,f]=h.useState(i??""),[m,p]=h.useState(!1),g=Oc(x=>{var k;return(k=c.itemRefCallback)==null?void 0:k.call(c,x,s,r)}),b=js(t,g),v=Ql(),y=h.useRef("touch"),w=()=>{r||(a.onValueChange(s),a.onOpenChange(!1))};return l.jsx($Me,{scope:n,value:s,disabled:r,textId:v,isSelected:u,onItemTextChange:h.useCallback(x=>{f(k=>k||((x==null?void 0:x.textContent)??"").trim())},[]),children:l.jsx(e5.ItemSlot,{scope:n,value:s,disabled:r,textValue:d,children:l.jsx(Wn.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:ln(o.onFocus,()=>p(!0)),onBlur:ln(o.onBlur,()=>p(!1)),onClick:ln(o.onClick,()=>{y.current!=="mouse"&&w()}),onPointerUp:ln(o.onPointerUp,()=>{y.current==="mouse"&&w()}),onPointerDown:ln(o.onPointerDown,x=>{y.current=x.pointerType}),onPointerMove:ln(o.onPointerMove,x=>{var k;y.current=x.pointerType,r?(k=c.onItemLeave)==null||k.call(c):y.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ln(o.onPointerLeave,x=>{var k;x.currentTarget===document.activeElement&&((k=c.onItemLeave)==null||k.call(c))}),onKeyDown:ln(o.onKeyDown,x=>{var C;r||x.target!==x.currentTarget||((C=c.searchRef)==null?void 0:C.current)!==""&&x.key===" "||(xMe.includes(x.key)&&w(),x.key===" "&&x.preventDefault())})})})})});Yse.displayName=FC;var Fw="SelectItemText",Xse=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:r,...i}=e,o=Cp(Fw,n),a=Tp(Fw,n),c=Kse(Fw,n),u=CMe(Fw,n),[d,f]=h.useState(null),m=Oc(w=>{var x;return(x=a.itemTextRefCallback)==null?void 0:x.call(a,w,c.value,c.disabled)}),p=js(t,f,c.onItemTextChange,m),g=d==null?void 0:d.textContent,b=h.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=u;return ma(()=>(v(b),()=>y(b)),[v,y,b]),l.jsxs(l.Fragment,{children:[l.jsx(Wn.span,{id:c.textId,...i,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!s5(o.value)?Wu.createPortal(i.children,o.valueNode):null]})});Xse.displayName=Fw;var Qse="SelectItemIndicator",Jse=h.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return Kse(Qse,n).isSelected?l.jsx(Wn.span,{"aria-hidden":!0,...s,ref:t}):null});Jse.displayName=Qse;var _N="SelectScrollUpButton",Zse=h.forwardRef((e,t)=>{const n=Tp(_N,e.__scopeSelect),s=iD(_N,e.__scopeSelect),[r,i]=h.useState(!1),o=js(t,s.onScrollButtonChange);return ma(()=>{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(tre,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});Zse.displayName=_N;var SN="SelectScrollDownButton",ere=h.forwardRef((e,t)=>{const n=Tp(SN,e.__scopeSelect),s=iD(SN,e.__scopeSelect),[r,i]=h.useState(!1),o=js(t,s.onScrollButtonChange);return ma(()=>{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(tre,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});ere.displayName=SN;var tre=h.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...r}=e,i=Tp("SelectScrollButton",n),o=h.useRef(null),a=t5(n),c=h.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return h.useEffect(()=>()=>c(),[c]),ma(()=>{var d;const u=a().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),l.jsx(Wn.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:ln(r.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(s,50))}),onPointerMove:ln(r.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),o.current===null&&(o.current=window.setInterval(s,50))}),onPointerLeave:ln(r.onPointerLeave,()=>{c()})})}),BMe="SelectSeparator",zMe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return l.jsx(Wn.div,{"aria-hidden":!0,...s,ref:t})});zMe.displayName=BMe;var nre="SelectArrow",FMe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=n5(n);return Tp(nre,n).position==="popper"?l.jsx(WT,{...r,...s,ref:t}):null});FMe.displayName=nre;var sre="SelectBubbleInput",rre=h.forwardRef(({__scopeSelect:e,...t},n)=>{const s=Cp(sre,e),{value:r,onValueChange:i,required:o,disabled:a,name:c,autoComplete:u,form:d}=s,{nativeOptions:f,nativeSelectKey:m}=s,p=h.useRef(null),g=js(n,p),b=r??"",v=LT(b),y=Array.from(f).some(w=>(w.props.value??"")==="");return h.useEffect(()=>{const w=p.current;if(!w)return;const x=window.HTMLSelectElement.prototype,C=Object.getOwnPropertyDescriptor(x,"value").set;if(v!==b&&C){const T=new Event("change",{bubbles:!0});C.call(w,b),w.dispatchEvent(T)}},[v,b]),l.jsxs(Wn.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:u,disabled:a,form:d,onChange:w=>i(w.target.value),...t,style:{...ote,...t.style},ref:g,defaultValue:b,children:[s5(r)&&!y?l.jsx("option",{value:""}):null,Array.from(f)]},m)});rre.displayName=sre;function HMe(e){return typeof e=="function"}function s5(e){return e===""||e===void 0}function ire(e){const t=Oc(e),n=h.useRef(""),s=h.useRef(0),r=h.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=h.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,r,i]}function ore(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=qMe(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 qMe(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var UMe="Separator",BH="horizontal",WMe=["horizontal","vertical"],are=h.forwardRef((e,t)=>{const{decorative:n,orientation:s=BH,...r}=e,i=VMe(s)?s:BH,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return l.jsx(Wn.div,{"data-orientation":i,...a,...r,ref:t})});are.displayName=UMe;function VMe(e){return WMe.includes(e)}var GMe=are,r5="Switch",[KMe,c7t]=Xa(r5),[YMe,oD]=KMe(r5);function XMe(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:f}=e,[m,p]=Tl({prop:n,defaultProp:r??!1,onChange:c,caller:r5}),[g,b]=h.useState(null),[v,y]=h.useState(null),w=h.useRef(!1),x=g?!!o||!!g.closest("form"):!0,k={checked:m,setChecked:p,disabled:i,control:g,setControl:b,name:a,form:o,value:d,hasConsumerStoppedPropagationRef:w,required:u,defaultChecked:r,isFormControl:x,bubbleInput:v,setBubbleInput:y};return l.jsx(YMe,{scope:t,...k,children:QMe(f)?f(k):s})}var lre="SwitchTrigger",cre=h.forwardRef(({__scopeSwitch:e,onClick:t,...n},s)=>{const{control:r,form:i,value:o,disabled:a,checked:c,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:m,isFormControl:p,bubbleInput:g}=oD(lre,e),b=js(s,d),v=h.useRef(c);return h.useEffect(()=>{const y=i?r==null?void 0:r.ownerDocument.getElementById(i):r==null?void 0:r.form;if(y instanceof HTMLFormElement){const w=()=>f(v.current);return y.addEventListener("reset",w),()=>y.removeEventListener("reset",w)}},[r,i,f]),l.jsx(Wn.button,{type:"button",role:"switch","aria-checked":c,"aria-required":u,"data-state":pre(c),"data-disabled":a?"":void 0,disabled:a,value:o,...n,ref:b,onClick:ln(t,y=>{f(w=>!w),g&&p&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})})});cre.displayName=lre;var ure=h.forwardRef((e,t)=>{const{__scopeSwitch:n,name:s,checked:r,defaultChecked:i,required:o,disabled:a,value:c,onCheckedChange:u,form:d,...f}=e;return l.jsx(XMe,{__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(cre,{...f,ref:t,__scopeSwitch:n}),m&&l.jsx(mre,{__scopeSwitch:n})]})})});ure.displayName=r5;var dre="SwitchThumb",hre=h.forwardRef((e,t)=>{const{__scopeSwitch:n,...s}=e,r=oD(dre,n);return l.jsx(Wn.span,{"data-state":pre(r.checked),"data-disabled":r.disabled?"":void 0,...s,ref:t})});hre.displayName=dre;var fre="SwitchBubbleInput",mre=h.forwardRef(({__scopeSwitch:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:r,checked:i,defaultChecked:o,required:a,disabled:c,name:u,value:d,form:f,bubbleInput:m,setBubbleInput:p}=oD(fre,e),g=js(n,p),b=LT(i),v=OT(s);h.useEffect(()=>{const w=m;if(!w)return;const x=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(x,"checked").set,T=!r.current;if(b!==i&&C){const _=new Event("click",{bubbles:T});C.call(w,i),w.dispatchEvent(_)}},[m,b,i,r]);const y=h.useRef(i);return l.jsx(Wn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??y.current,required:a,disabled:c,name:u,value:d,form:f,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});mre.displayName=fre;function QMe(e){return typeof e=="function"}function pre(e){return e?"checked":"unchecked"}var i5="Tabs",[JMe,u7t]=Xa(i5,[kp]),gre=kp(),[ZMe,aD]=JMe(i5),bre=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:r,defaultValue:i,orientation:o="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=dy(a),[f,m]=Tl({prop:s,onChange:r,defaultProp:i??"",caller:i5});return l.jsx(ZMe,{scope:n,baseId:Ql(),value:f,onValueChange:m,orientation:o,dir:d,activationMode:c,children:l.jsx(Wn.div,{dir:d,"data-orientation":o,...u,ref:t})})});bre.displayName=i5;var yre="TabsList",wre=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...r}=e,i=aD(yre,n),o=gre(n);return l.jsx(VT,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:s,children:l.jsx(Wn.div,{role:"tablist","aria-orientation":i.orientation,...r,ref:t})})});wre.displayName=yre;var vre="TabsTrigger",xre=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:r=!1,...i}=e,o=aD(vre,n),a=gre(n),c=Sre(o.baseId,s),u=Cre(o.baseId,s),d=s===o.value;return l.jsx(GT,{asChild:!0,...a,focusable:!r,active:d,children:l.jsx(Wn.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:ln(e.onMouseDown,f=>{!r&&f.button===0&&f.ctrlKey===!1?o.onValueChange(s):f.preventDefault()}),onKeyDown:ln(e.onKeyDown,f=>{r||f.target!==f.currentTarget||[" ","Enter"].includes(f.key)&&o.onValueChange(s)}),onFocus:ln(e.onFocus,()=>{const f=o.activationMode!=="manual";!d&&!r&&f&&o.onValueChange(s)})})})});xre.displayName=vre;var kre="TabsContent",_re=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:r,children:i,...o}=e,a=aD(kre,n),c=Sre(a.baseId,s),u=Cre(a.baseId,s),d=s===a.value,f=h.useRef(d);return h.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(Qa,{present:r||d,children:({present:m})=>l.jsx(Wn.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:f.current?"0s":void 0},children:m&&i})})});_re.displayName=kre;function Sre(e,t){return`${e}-trigger-${t}`}function Cre(e,t){return`${e}-content-${t}`}var e9e=bre,t9e=wre,n9e=xre,s9e=_re,Tre="Toggle",Ere=h.forwardRef((e,t)=>{const{pressed:n,defaultPressed:s,onPressedChange:r,...i}=e,[o,a]=Tl({prop:n,onChange:r,defaultProp:s??!1,caller:Tre});return l.jsx(Wn.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":e.disabled?"":void 0,...i,ref:t,onClick:ln(e.onClick,()=>{e.disabled||a(!o)})})});Ere.displayName=Tre;var Ep="ToggleGroup",[jre,d7t]=Xa(Ep,[kp]),Are=kp(),lD=h.forwardRef((e,t)=>{const{type:n,...s}=e;if(n==="single"){const r=s;return l.jsx(r9e,{role:"radiogroup",...r,ref:t})}if(n==="multiple"){const r=s;return l.jsx(i9e,{role:"toolbar",...r,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${Ep}\``)});lD.displayName=Ep;var[Nre,Mre]=jre(Ep),r9e=h.forwardRef((e,t)=>{const{value:n,defaultValue:s,onValueChange:r=()=>{},...i}=e,[o,a]=Tl({prop:n,defaultProp:s??"",onChange:r,caller:Ep});return l.jsx(Nre,{scope:e.__scopeToggleGroup,type:"single",value:h.useMemo(()=>o?[o]:[],[o]),onItemActivate:a,onItemDeactivate:h.useCallback(()=>a(""),[a]),children:l.jsx(Ire,{...i,ref:t})})}),i9e=h.forwardRef((e,t)=>{const{value:n,defaultValue:s,onValueChange:r=()=>{},...i}=e,[o,a]=Tl({prop:n,defaultProp:s??[],onChange:r,caller:Ep}),c=h.useCallback(d=>a((f=[])=>[...f,d]),[a]),u=h.useCallback(d=>a((f=[])=>f.filter(m=>m!==d)),[a]);return l.jsx(Nre,{scope:e.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:c,onItemDeactivate:u,children:l.jsx(Ire,{...i,ref:t})})});lD.displayName=Ep;var[o9e,a9e]=jre(Ep),Ire=h.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:s=!1,rovingFocus:r=!0,orientation:i,dir:o,loop:a=!0,...c}=e,u=Are(n),d=dy(o),f={dir:d,...c};return l.jsx(o9e,{scope:n,rovingFocus:r,disabled:s,children:r?l.jsx(VT,{asChild:!0,...u,orientation:i,dir:d,loop:a,children:l.jsx(Wn.div,{...f,ref:t})}):l.jsx(Wn.div,{...f,ref:t})})}),HC="ToggleGroupItem",Rre=h.forwardRef((e,t)=>{const n=Mre(HC,e.__scopeToggleGroup),s=a9e(HC,e.__scopeToggleGroup),r=Are(e.__scopeToggleGroup),i=n.value.includes(e.value),o=s.disabled||e.disabled,a={...e,pressed:i,disabled:o},c=h.useRef(null);return s.rovingFocus?l.jsx(GT,{asChild:!0,...r,focusable:!o,active:i,ref:c,children:l.jsx(zH,{...a,ref:t})}):l.jsx(zH,{...a,ref:t})});Rre.displayName=HC;var zH=h.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:s,...r}=e,i=Mre(HC,n),o={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},a=i.type==="single"?o:void 0;return l.jsx(Ere,{...a,...r,ref:t,onPressedChange:c=>{c?i.onItemActivate(s):i.onItemDeactivate(s)}})}),[o5,h7t]=Xa("Tooltip",[xp]),a5=xp(),Dre="TooltipProvider",l9e=700,CN="tooltip.open",[c9e,cD]=o5(Dre),Pre=e=>{const{__scopeTooltip:t,delayDuration:n=l9e,skipDelayDuration:s=300,disableHoverableContent:r=!1,children:i}=e,o=h.useRef(!0),a=h.useRef(!1),c=h.useRef(0);return h.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),l.jsx(c9e,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:h.useCallback(()=>{s<=0||(window.clearTimeout(c.current),o.current=!1)},[s]),onClose:h.useCallback(()=>{s<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,s))},[s]),isPointerInTransitRef:a,onPointerInTransitChange:h.useCallback(u=>{a.current=u},[]),disableHoverableContent:r,children:i})};Pre.displayName=Dre;var cx="Tooltip",[u9e,Ck]=o5(cx),Lre=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:r,onOpenChange:i,disableHoverableContent:o,delayDuration:a}=e,c=cD(cx,e.__scopeTooltip),u=a5(t),[d,f]=h.useState(null),m=Ql(),p=h.useRef(0),g=o??c.disableHoverableContent,b=a??c.delayDuration,v=h.useRef(!1),[y,w]=Tl({prop:s,defaultProp:r??!1,onChange:_=>{_?(c.onOpen(),document.dispatchEvent(new CustomEvent(CN))):c.onClose(),i==null||i(_)},caller:cx}),x=h.useMemo(()=>y?v.current?"delayed-open":"instant-open":"closed",[y]),k=h.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v.current=!1,w(!0)},[w]),C=h.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w(!1)},[w]),T=h.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{v.current=!0,w(!0),p.current=0},b)},[b,w]);return h.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),l.jsx(yk,{...u,children:l.jsx(u9e,{scope:t,contentId:m,open:y,stateAttribute:x,trigger:d,onTriggerChange:f,onTriggerEnter:h.useCallback(()=>{c.isOpenDelayedRef.current?T():k()},[c.isOpenDelayedRef,T,k]),onTriggerLeave:h.useCallback(()=>{g?C():(window.clearTimeout(p.current),p.current=0)},[C,g]),onOpen:k,onClose:C,disableHoverableContent:g,children:n})})};Lre.displayName=cx;var TN="TooltipTrigger",Ore=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=Ck(TN,n),i=cD(TN,n),o=a5(n),a=h.useRef(null),c=js(t,a,r.onTriggerChange),u=h.useRef(!1),d=h.useRef(!1),f=h.useCallback(()=>u.current=!1,[]);return h.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),l.jsx(wk,{asChild:!0,...o,children:l.jsx(Wn.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...s,ref:c,onPointerMove:ln(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(r.onTriggerEnter(),d.current=!0)}),onPointerLeave:ln(e.onPointerLeave,()=>{r.onTriggerLeave(),d.current=!1}),onPointerDown:ln(e.onPointerDown,()=>{r.open&&r.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ln(e.onFocus,()=>{u.current||r.onOpen()}),onBlur:ln(e.onBlur,r.onClose),onClick:ln(e.onClick,r.onClose)})})});Ore.displayName=TN;var uD="TooltipPortal",[d9e,h9e]=o5(uD,{forceMount:void 0}),$re=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:r}=e,i=Ck(uD,t);return l.jsx(d9e,{scope:t,forceMount:n,children:l.jsx(Qa,{present:n||i.open,children:l.jsx(fy,{asChild:!0,container:r,children:s})})})};$re.displayName=uD;var Rb="TooltipContent",Bre=h.forwardRef((e,t)=>{const n=h9e(Rb,e.__scopeTooltip),{forceMount:s=n.forceMount,side:r="top",...i}=e,o=Ck(Rb,e.__scopeTooltip);return l.jsx(Qa,{present:s||o.open,children:o.disableHoverableContent?l.jsx(zre,{side:r,...i,ref:t}):l.jsx(f9e,{side:r,...i,ref:t})})}),f9e=h.forwardRef((e,t)=>{const n=Ck(Rb,e.__scopeTooltip),s=cD(Rb,e.__scopeTooltip),r=h.useRef(null),i=js(t,r),[o,a]=h.useState(null),{trigger:c,onClose:u}=n,d=r.current,{onPointerInTransitChange:f}=s,m=h.useCallback(()=>{a(null),f(!1)},[f]),p=h.useCallback((g,b)=>{const v=g.currentTarget,y={x:g.clientX,y:g.clientY},w=y9e(y,v.getBoundingClientRect()),x=w9e(y,w),k=v9e(b.getBoundingClientRect()),C=k9e([...x,...k]);a(C),f(!0)},[f]);return h.useEffect(()=>()=>m(),[m]),h.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]),h.useEffect(()=>{if(o){const g=b=>{const v=b.target,y={x:b.clientX,y:b.clientY},w=(c==null?void 0:c.contains(v))||(d==null?void 0:d.contains(v)),x=!x9e(y,o);w?m():x&&(m(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,o,u,m]),l.jsx(zre,{...e,ref:i})}),[m9e,p9e]=o5(cx,{isInside:!1}),g9e=Z8e("TooltipContent"),zre=h.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":r,onEscapeKeyDown:i,onPointerDownOutside:o,...a}=e,c=Ck(Rb,n),u=a5(n),{onClose:d}=c;return h.useEffect(()=>(document.addEventListener(CN,d),()=>document.removeEventListener(CN,d)),[d]),h.useEffect(()=>{if(c.trigger){const f=m=>{m.target instanceof Node&&m.target.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),l.jsx(hy,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:l.jsxs(UT,{"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(g9e,{children:s}),l.jsx(m9e,{scope:n,isInside:!0,children:l.jsx(u7e,{id:c.contentId,role:"tooltip",children:r||s})})]})})});Bre.displayName=Rb;var Fre="TooltipArrow",b9e=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=a5(n);return p9e(Fre,n).isInside?null:l.jsx(WT,{...r,...s,ref:t})});b9e.displayName=Fre;function y9e(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 w9e(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 v9e(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 x9e(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,f=c.x,m=c.y;d>s!=m>s&&n<(f-u)*(s-d)/(m-d)+u&&(r=!r)}return r}function k9e(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),_9e(t)}function _9e(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 Hre=Pre,qre=Lre,Ure=Ore,Wre=$re,Vre=Bre;const S9e=(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},C9e=(e,t)=>({classGroupId:e,validator:t}),Gre=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),qC="-",FH=[],T9e="arbitrary..",E9e=e=>{const t=A9e(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return j9e(o);const a=o.split(qC),c=a[0]===""&&a.length>1?1:0;return Kre(a,c,t)},getConflictingClassGroupIds:(o,a)=>{if(a){const c=s[o],u=n[o];return c?u?S9e(u,c):c:u||FH}return n[o]||FH}}},Kre=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],i=n.nextPart.get(r);if(i){const u=Kre(e,t+1,i);if(u)return u}const o=n.validators;if(o===null)return;const a=t===0?e.join(qC):e.slice(t).join(qC),c=o.length;for(let u=0;u<c;u++){const d=o[u];if(d.validator(a))return d.classGroupId}},j9e=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?T9e+s:void 0})(),A9e=e=>{const{theme:t,classGroups:n}=e;return N9e(n,t)},N9e=(e,t)=>{const n=Gre();for(const s in e){const r=e[s];dD(r,n,s,t)}return n},dD=(e,t,n,s)=>{const r=e.length;for(let i=0;i<r;i++){const o=e[i];M9e(o,t,n,s)}},M9e=(e,t,n,s)=>{if(typeof e=="string"){I9e(e,t,n);return}if(typeof e=="function"){R9e(e,t,n,s);return}D9e(e,t,n,s)},I9e=(e,t,n)=>{const s=e===""?t:Yre(t,e);s.classGroupId=n},R9e=(e,t,n,s)=>{if(P9e(e)){dD(e(s),t,n,s);return}t.validators===null&&(t.validators=[]),t.validators.push(C9e(n,e))},D9e=(e,t,n,s)=>{const r=Object.entries(e),i=r.length;for(let o=0;o<i;o++){const[a,c]=r[o];dD(c,Yre(t,a),n,s)}},Yre=(e,t)=>{let n=e;const s=t.split(qC),r=s.length;for(let i=0;i<r;i++){const o=s[i];let a=n.nextPart.get(o);a||(a=Gre(),n.nextPart.set(o,a)),n=a}return n},P9e=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,L9e=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)}}},EN="!",HH=":",O9e=[],qH=(e,t,n,s,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:s,isExternal:r}),$9e=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===HH){i.push(r.slice(c,b)),c=b+1;continue}if(v==="/"){u=b;continue}}v==="["?o++:v==="]"?o--:v==="("?a++:v===")"&&a--}const f=i.length===0?r:r.slice(c);let m=f,p=!1;f.endsWith(EN)?(m=f.slice(0,-1),p=!0):f.startsWith(EN)&&(m=f.slice(1),p=!0);const g=u&&u>c?u-c:void 0;return qH(i,p,m,g)};if(t){const r=t+HH,i=s;s=o=>o.startsWith(r)?i(o.slice(r.length)):qH(O9e,!1,o,void 0,!0)}if(n){const r=s;s=i=>n({className:i,parseClassName:r})}return s},B9e=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}},z9e=e=>({cache:L9e(e.cacheSize),parseClassName:$9e(e),sortModifiers:B9e(e),postfixLookupClassGroupIds:F9e(e),...E9e(e)}),F9e=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},H9e=/\s+/,q9e=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:i,postfixLookupClassGroupIds:o}=t,a=[],c=e.trim().split(H9e);let u="";for(let d=c.length-1;d>=0;d-=1){const f=c[d],{isExternal:m,modifiers:p,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:v}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let y=!!v,w;if(y){const _=b.substring(0,v);w=s(_);const S=w&&o[w]?s(b):void 0;S&&S!==w&&(w=S,y=!1)}else w=s(b);if(!w){if(!y){u=f+(u.length>0?" "+u:u);continue}if(w=s(b),!w){u=f+(u.length>0?" "+u:u);continue}y=!1}const x=p.length===0?"":p.length===1?p[0]:i(p).join(":"),k=g?x+EN:x,C=k+w;if(a.indexOf(C)>-1)continue;a.push(C);const T=r(w,y);for(let _=0;_<T.length;++_){const S=T[_];a.push(k+S)}u=f+(u.length>0?" "+u:u)}return u},U9e=(...e)=>{let t=0,n,s,r="";for(;t<e.length;)(n=e[t++])&&(s=Xre(n))&&(r&&(r+=" "),r+=s);return r},Xre=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Xre(e[s]))&&(n&&(n+=" "),n+=t);return n},W9e=(e,...t)=>{let n,s,r,i;const o=c=>{const u=t.reduce((d,f)=>f(d),e());return n=z9e(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=q9e(c,n);return r(c,d),d};return i=o,(...c)=>i(U9e(...c))},V9e=[],Fo=e=>{const t=n=>n[e]||V9e;return t.isThemeGetter=!0,t},Qre=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Jre=/^\((?:(\w[\w-]*):)?(.+)\)$/i,G9e=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,K9e=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Y9e=/\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$/,X9e=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Q9e=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,J9e=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ff=e=>G9e.test(e),Fs=e=>!!e&&!Number.isNaN(Number(e)),dd=e=>!!e&&Number.isInteger(Number(e)),R7=e=>e.endsWith("%")&&Fs(e.slice(0,-1)),Th=e=>K9e.test(e),Zre=()=>!0,Z9e=e=>Y9e.test(e)&&!X9e.test(e),hD=()=>!1,eIe=e=>Q9e.test(e),tIe=e=>J9e.test(e),nIe=e=>!Cn(e)&&!An(e),sIe=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)),rIe=e=>jp(e,nie,hD),Cn=e=>Qre.test(e),Qp=e=>jp(e,sie,Z9e),UH=e=>jp(e,hIe,Fs),iIe=e=>jp(e,iie,Zre),oIe=e=>jp(e,rie,hD),WH=e=>jp(e,eie,hD),aIe=e=>jp(e,tie,tIe),jS=e=>jp(e,oie,eIe),An=e=>Jre.test(e),fw=e=>wg(e,sie),lIe=e=>wg(e,rie),VH=e=>wg(e,eie),cIe=e=>wg(e,nie),uIe=e=>wg(e,tie),AS=e=>wg(e,oie,!0),dIe=e=>wg(e,iie,!0),jp=(e,t,n)=>{const s=Qre.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},wg=(e,t,n=!1)=>{const s=Jre.exec(e);return s?s[1]?t(s[1]):n:!1},eie=e=>e==="position"||e==="percentage",tie=e=>e==="image"||e==="url",nie=e=>e==="length"||e==="size"||e==="bg-size",sie=e=>e==="length",hIe=e=>e==="number",rie=e=>e==="family-name",iie=e=>e==="number"||e==="weight",oie=e=>e==="shadow",fIe=()=>{const e=Fo("color"),t=Fo("font"),n=Fo("text"),s=Fo("font-weight"),r=Fo("tracking"),i=Fo("leading"),o=Fo("breakpoint"),a=Fo("container"),c=Fo("spacing"),u=Fo("radius"),d=Fo("shadow"),f=Fo("inset-shadow"),m=Fo("text-shadow"),p=Fo("drop-shadow"),g=Fo("blur"),b=Fo("perspective"),v=Fo("aspect"),y=Fo("ease"),w=Fo("animate"),x=()=>["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"],C=()=>[...k(),An,Cn],T=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],S=()=>[An,Cn,c],R=()=>[Ff,"full","auto",...S()],A=()=>[dd,"none","subgrid",An,Cn],O=()=>["auto",{span:["full",dd,An,Cn]},dd,An,Cn],M=()=>[dd,"auto",An,Cn],D=()=>["auto","min","max","fr",An,Cn],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],B=()=>["auto",...S()],j=()=>[Ff,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],H=()=>[Ff,"screen","full","dvw","lvw","svw","min","max","fit",...S()],Q=()=>[Ff,"screen","full","lh","dvh","lvh","svh","min","max","fit",...S()],I=()=>[e,An,Cn],J=()=>[...k(),VH,WH,{position:[An,Cn]}],W=()=>["no-repeat",{repeat:["","x","y","space","round"]}],P=()=>["auto","cover","contain",cIe,rIe,{size:[An,Cn]}],V=()=>[R7,fw,Qp],ee=()=>["","none","full",u,An,Cn],q=()=>["",Fs,fw,Qp],K=()=>["solid","dashed","dotted","double"],de=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>[Fs,R7,VH,WH],ne=()=>["","none",g,An,Cn],U=()=>["none",Fs,An,Cn],Z=()=>["none",Fs,An,Cn],ge=()=>[Fs,An,Cn],ce=()=>[Ff,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Th],breakpoint:[Th],color:[Zre],container:[Th],"drop-shadow":[Th],ease:["in","out","in-out"],font:[nIe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Th],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Th],shadow:[Th],spacing:["px",Fs],text:[Th],"text-shadow":[Th],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ff,Cn,An,v]}],container:["container"],"container-type":[{"@container":["","normal","size",An,Cn]}],"container-named":[sIe],columns:[{columns:[Fs,Cn,An,a]}],"break-after":[{"break-after":x()}],"break-before":[{"break-before":x()}],"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:C()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{"inset-s":R(),start:R()}],end:[{"inset-e":R(),end:R()}],"inset-bs":[{"inset-bs":R()}],"inset-be":[{"inset-be":R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[dd,"auto",An,Cn]}],basis:[{basis:[Ff,"full","auto",a,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Fs,Ff,"auto","initial","none",Cn]}],grow:[{grow:["",Fs,An,Cn]}],shrink:[{shrink:["",Fs,An,Cn]}],order:[{order:[dd,"first","last","none",An,Cn]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:O()}],"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":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],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:B()}],mx:[{mx:B()}],my:[{my:B()}],ms:[{ms:B()}],me:[{me:B()}],mbs:[{mbs:B()}],mbe:[{mbe:B()}],mt:[{mt:B()}],mr:[{mr:B()}],mb:[{mb:B()}],ml:[{ml:B()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:j()}],"inline-size":[{inline:["auto",...H()]}],"min-inline-size":[{"min-inline":["auto",...H()]}],"max-inline-size":[{"max-inline":["none",...H()]}],"block-size":[{block:["auto",...Q()]}],"min-block-size":[{"min-block":["auto",...Q()]}],"max-block-size":[{"max-block":["none",...Q()]}],w:[{w:[a,"screen",...j()]}],"min-w":[{"min-w":[a,"screen","none",...j()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...j()]}],h:[{h:["screen","lh",...j()]}],"min-h":[{"min-h":["screen","lh","none",...j()]}],"max-h":[{"max-h":["screen","lh",...j()]}],"font-size":[{text:["base",n,fw,Qp]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,dIe,iIe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",R7,Cn]}],"font-family":[{font:[lIe,oIe,t]}],"font-features":[{"font-features":[Cn]}],"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,An,Cn]}],"line-clamp":[{"line-clamp":[Fs,"none",An,UH]}],leading:[{leading:[i,...S()]}],"list-image":[{"list-image":["none",An,Cn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",An,Cn]}],"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:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:[Fs,"from-font","auto",An,Qp]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Fs,"auto",An,Cn]}],"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:[dd,An,Cn]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",An,Cn]}],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",An,Cn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:J()}],"bg-repeat":[{bg:W()}],"bg-size":[{bg:P()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},dd,An,Cn],radial:["",An,Cn],conic:[dd,An,Cn]},uIe,aIe]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:ee()}],"rounded-s":[{"rounded-s":ee()}],"rounded-e":[{"rounded-e":ee()}],"rounded-t":[{"rounded-t":ee()}],"rounded-r":[{"rounded-r":ee()}],"rounded-b":[{"rounded-b":ee()}],"rounded-l":[{"rounded-l":ee()}],"rounded-ss":[{"rounded-ss":ee()}],"rounded-se":[{"rounded-se":ee()}],"rounded-ee":[{"rounded-ee":ee()}],"rounded-es":[{"rounded-es":ee()}],"rounded-tl":[{"rounded-tl":ee()}],"rounded-tr":[{"rounded-tr":ee()}],"rounded-br":[{"rounded-br":ee()}],"rounded-bl":[{"rounded-bl":ee()}],"border-w":[{border:q()}],"border-w-x":[{"border-x":q()}],"border-w-y":[{"border-y":q()}],"border-w-s":[{"border-s":q()}],"border-w-e":[{"border-e":q()}],"border-w-bs":[{"border-bs":q()}],"border-w-be":[{"border-be":q()}],"border-w-t":[{"border-t":q()}],"border-w-r":[{"border-r":q()}],"border-w-b":[{"border-b":q()}],"border-w-l":[{"border-l":q()}],"divide-x":[{"divide-x":q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...K(),"hidden","none"]}],"divide-style":[{divide:[...K(),"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:[...K(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Fs,An,Cn]}],"outline-w":[{outline:["",Fs,fw,Qp]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",d,AS,jS]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",f,AS,jS]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Fs,Qp]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":q()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",m,AS,jS]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Fs,An,Cn]}],"mix-blend":[{"mix-blend":[...de(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":de()}],"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":[Fs]}],"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":[An,Cn]}],"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":[Fs]}],"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:J()}],"mask-repeat":[{mask:W()}],"mask-size":[{mask:P()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",An,Cn]}],filter:[{filter:["","none",An,Cn]}],blur:[{blur:ne()}],brightness:[{brightness:[Fs,An,Cn]}],contrast:[{contrast:[Fs,An,Cn]}],"drop-shadow":[{"drop-shadow":["","none",p,AS,jS]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",Fs,An,Cn]}],"hue-rotate":[{"hue-rotate":[Fs,An,Cn]}],invert:[{invert:["",Fs,An,Cn]}],saturate:[{saturate:[Fs,An,Cn]}],sepia:[{sepia:["",Fs,An,Cn]}],"backdrop-filter":[{"backdrop-filter":["","none",An,Cn]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[Fs,An,Cn]}],"backdrop-contrast":[{"backdrop-contrast":[Fs,An,Cn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Fs,An,Cn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Fs,An,Cn]}],"backdrop-invert":[{"backdrop-invert":["",Fs,An,Cn]}],"backdrop-opacity":[{"backdrop-opacity":[Fs,An,Cn]}],"backdrop-saturate":[{"backdrop-saturate":[Fs,An,Cn]}],"backdrop-sepia":[{"backdrop-sepia":["",Fs,An,Cn]}],"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",An,Cn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Fs,"initial",An,Cn]}],ease:[{ease:["linear","initial",y,An,Cn]}],delay:[{delay:[Fs,An,Cn]}],animate:[{animate:["none",w,An,Cn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,An,Cn]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:U()}],"rotate-x":[{"rotate-x":U()}],"rotate-y":[{"rotate-y":U()}],"rotate-z":[{"rotate-z":U()}],scale:[{scale:Z()}],"scale-x":[{"scale-x":Z()}],"scale-y":[{"scale-y":Z()}],"scale-z":[{"scale-z":Z()}],"scale-3d":["scale-3d"],skew:[{skew:ge()}],"skew-x":[{"skew-x":ge()}],"skew-y":[{"skew-y":ge()}],transform:[{transform:[An,Cn,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ce()}],"translate-x":[{"translate-x":ce()}],"translate-y":[{"translate-y":ce()}],"translate-z":[{"translate-z":ce()}],"translate-none":["translate-none"],zoom:[{zoom:[dd,An,Cn]}],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",An,Cn]}],"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",An,Cn]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[Fs,fw,Qp,UH]}],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"]}},mIe=W9e(fIe);function en(...e){return mIe(ste(e))}const pIe=gg("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"}}),Jt=h.forwardRef(function({className:t,variant:n="default",size:s="default",asChild:r=!1,...i},o){const a=r?MR:"button";return l.jsx(a,{ref:o,"data-slot":"button","data-variant":n,"data-size":s,className:en(pIe({variant:n,size:s,className:t})),...i})}),UC=h.forwardRef(function({className:t,...n},s){return l.jsx(zte,{ref:s,"data-slot":"checkbox",className:en("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(Hte,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:l.jsx(dg,{})})})});function Qm({...e}){return l.jsx(MT,{"data-slot":"dialog",...e})}function gIe({container:e,...t}){const n=_u();return l.jsx(IT,{"data-slot":"dialog-portal",container:e??n??void 0,...t})}function jN({...e}){return l.jsx(my,{"data-slot":"dialog-close",...e})}const bIe=h.forwardRef(function({className:t,...n},s){return l.jsx(RT,{ref:s,"data-slot":"dialog-overlay",className:en("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})}),Jm=h.forwardRef(function({className:t,children:n,showCloseButton:s=!0,overlayProps:r,...i},o){return l.jsxs(gIe,{children:[l.jsx(bIe,{...r}),l.jsxs(DT,{ref:o,"data-slot":"dialog-content",className:en("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(my,{"data-slot":"dialog-close",asChild:!0,children:l.jsxs(Jt,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm",children:[l.jsx(ey,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})})]})]})});function Zm({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-header",className:en("flex flex-col gap-2",e),...t})}function ep({className:e,showCloseButton:t=!1,children:n,...s}){return l.jsxs("div",{"data-slot":"dialog-footer",className:en("-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(my,{asChild:!0,children:l.jsx(Jt,{variant:"outline",children:"Close"})})]})}function tp({className:e,...t}){return l.jsx(PT,{"data-slot":"dialog-title",className:en("text-base leading-none font-medium",e),...t})}function W0({className:e,...t}){return l.jsx(PR,{"data-slot":"dialog-description",className:en("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const Pr=h.forwardRef(function({className:t,type:n,...s},r){return l.jsx("input",{ref:r,type:n,"data-slot":"input",className:en("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 ux({className:e,...t}){return l.jsx(VNe,{"data-slot":"label",className:en("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 np({...e}){return l.jsx(nMe,{"data-slot":"popover",...e})}const V0=h.forwardRef(function(t,n){return l.jsx(rMe,{ref:n,"data-slot":"popover-trigger",...t})}),sp=h.forwardRef(function({className:t,align:n="center",sideOffset:s=4,...r},i){const o=_u();return l.jsx(iMe,{container:o??void 0,children:l.jsx(oMe,{ref:i,"data-slot":"popover-content",align:n,sideOffset:s,className:en("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})})}),GH=h.forwardRef(function(t,n){return l.jsx(sMe,{ref:n,"data-slot":"popover-anchor",...t})});function yIe({className:e,...t}){return l.jsx("div",{"data-slot":"popover-header",className:en("flex flex-col gap-0.5 text-sm",e),...t})}function wIe({className:e,...t}){return l.jsx("div",{"data-slot":"popover-title",className:en("font-medium",e),...t})}function xl({...e}){return l.jsx(Mse,{"data-slot":"select",...e})}function aie({className:e,...t}){return l.jsx(Vse,{"data-slot":"select-group",className:en("scroll-my-1 p-1",e),...t})}function kl({...e}){return l.jsx(Pse,{"data-slot":"select-value",...e})}const _l=h.forwardRef(function({className:t,size:n="default",children:s,...r},i){return l.jsxs(Rse,{ref:i,"data-slot":"select-trigger","data-size":n,className:en("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(Lse,{asChild:!0,children:l.jsx(gc,{className:"pointer-events-none size-4 text-muted-foreground"})})]})});function Sl({className:e,children:t,position:n="item-aligned",align:s="center",...r}){const i=_u();return l.jsx($se,{container:i??void 0,children:l.jsxs(Bse,{"data-slot":"select-content","data-align-trigger":n==="item-aligned",className:en("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(vIe,{}),l.jsx(Use,{"data-position":n,className:en("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(xIe,{})]})})}function Ti({className:e,children:t,...n}){return l.jsxs(Yse,{"data-slot":"select-item",className:en("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(Jse,{children:l.jsx(dg,{className:"pointer-events-none"})})}),l.jsx(Xse,{children:t})]})}function vIe({className:e,...t}){return l.jsx(Zse,{"data-slot":"select-scroll-up-button",className:en("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:l.jsx(Ybe,{})})}function xIe({className:e,...t}){return l.jsx(ere,{"data-slot":"select-scroll-down-button",className:en("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:l.jsx(gc,{})})}const kIe="_tableShell_ysf4j_1",_Ie="_densityCompact_ysf4j_11",SIe="_densityStandard_ysf4j_21",CIe="_densityComfortable_ysf4j_29",TIe="_toolbar_ysf4j_37",EIe="_summary_ysf4j_48",jIe="_hint_ysf4j_53",AIe="_selection_ysf4j_57",NIe="_selectionStats_ysf4j_62",MIe="_selectionMetric_ysf4j_70",IIe="_selectionMetricValue_ysf4j_74",RIe="_copyButton_ysf4j_80",DIe="_copyCheck_ysf4j_90",PIe="_scroller_ysf4j_98",LIe="_table_ysf4j_1",OIe="_headerCell_ysf4j_120",$Ie="_cell_ysf4j_121",BIe="_frozenHeaderCell_ysf4j_144",zIe="_headerControls_ysf4j_149",FIe="_headerButton_ysf4j_155",HIe="_filterTrigger_ysf4j_172",qIe="_headerText_ysf4j_176",UIe="_sortIcon_ysf4j_183",WIe="_activeHeaderCell_ysf4j_199",VIe="_reorderHandle_ysf4j_203",GIe="_reorderHandleVisible_ysf4j_226",KIe="_resizeHandle_ysf4j_246",YIe="_filterTriggerActive_ysf4j_265",XIe="_columnContextMenu_ysf4j_270",QIe="_columnContextMenuAction_ysf4j_283",JIe="_cellContent_ysf4j_315",ZIe="_detailValueContent_ysf4j_316",eRe="_cellText_ysf4j_322",tRe="_detailValueText_ysf4j_323",nRe="_cellContentCollapsed_ysf4j_329",sRe="_detailValueCollapsed_ysf4j_330",rRe="_dragging_ysf4j_337",iRe="_evenRow_ysf4j_341",oRe="_selectedCell_ysf4j_349",aRe="_actionHeaderCell_ysf4j_356",lRe="_actionCell_ysf4j_357",cRe="_stickyActionHeaderCell_ysf4j_365",uRe="_stickyActionCell_ysf4j_366",dRe="_frozenCell_ysf4j_382",hRe="_hasFrozenColumn_ysf4j_388",fRe="_rowDetailButton_ysf4j_435",mRe="_detailRow_ysf4j_450",pRe="_detailCell_ysf4j_454",gRe="_detailPanel_ysf4j_461",bRe="_detailTitle_ysf4j_467",yRe="_detailItem_ysf4j_472",wRe="_detailLabel_ysf4j_479",vRe="_detailValue_ysf4j_316",xRe="_emptyValue_ysf4j_494",kRe="_emptyState_ysf4j_499",dn={tableShell:kIe,densityCompact:_Ie,densityStandard:SIe,densityComfortable:CIe,toolbar:TIe,summary:EIe,hint:jIe,selection:AIe,selectionStats:NIe,selectionMetric:MIe,selectionMetricValue:IIe,copyButton:RIe,copyCheck:DIe,scroller:PIe,table:LIe,headerCell:OIe,cell:$Ie,frozenHeaderCell:BIe,headerControls:zIe,headerButton:FIe,filterTrigger:HIe,headerText:qIe,sortIcon:UIe,activeHeaderCell:WIe,reorderHandle:VIe,reorderHandleVisible:GIe,resizeHandle:KIe,filterTriggerActive:YIe,columnContextMenu:XIe,columnContextMenuAction:QIe,cellContent:JIe,detailValueContent:ZIe,cellText:eRe,detailValueText:tRe,cellContentCollapsed:nRe,detailValueCollapsed:sRe,dragging:rRe,evenRow:iRe,selectedCell:oRe,actionHeaderCell:aRe,actionCell:lRe,stickyActionHeaderCell:cRe,stickyActionCell:uRe,frozenCell:dRe,hasFrozenColumn:hRe,rowDetailButton:fRe,detailRow:mRe,detailCell:pRe,detailPanel:gRe,detailTitle:bRe,detailItem:yRe,detailLabel:wRe,detailValue:vRe,emptyValue:xRe,emptyState:kRe},_Re={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"},SRe={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"},CRe=500,TRe=50,Rm=160,lie=80,cie=640,KH=16,uie="application/x-qwen-web-shell-table-column",ERe=60,jRe=3,D7=["standard","compact","comfortable"],ARe={width:Rm,minWidth:Rm,maxWidth:Rm},NRe={width:"auto"};function YH(e){return Math.min(cie,Math.max(lie,e))}function P7(e){return e instanceof Element&&!!e.closest('a, button, input, textarea, select, [contenteditable="true"]')}function MRe(){const e=document.getSelection();return!!(e&&!e.isCollapsed)}function x0(e,t){return h.isValidElement(e)&&e.type===t}function IRe(e){return e.replace(/\s+/g," ").trim()}function L7(e){return e.length>ERe||e.split(/\r\n|\r|\n/).length>jRe}function RRe(e){const t=D7.indexOf(e);return D7[(t+1)%D7.length]??"standard"}function DRe(e){switch(e){case"compact":return dn.densityCompact;case"comfortable":return dn.densityComfortable;case"standard":default:return dn.densityStandard}}function AN(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(AN).join(""):h.isValidElement(e)?e.type==="img"?e.props.alt??"":AN(e.props.children):""}function PRe(e,t){return{key:`${e}-empty-${t}`,content:"",text:"",rawText:"",isHeader:!1}}function die(e,t){const n=h.Children.toArray(e.props.children).filter(s=>x0(s,"td")||x0(s,"th"));return{key:t,cells:n.map((s,r)=>{var o;const i=AN(s.props.children);return{key:`${t}-${r}`,content:s.props.children,text:IRe(i),rawText:i,isHeader:s.type==="th",textAlign:(o=s.props.style)==null?void 0:o.textAlign}})}}function O7(e,t){return h.Children.toArray(e.props.children).filter(n=>x0(n,"tr")).map((n,s)=>die(n,`${t}-${s}`))}function LRe(e,t){return{...e,cells:Array.from({length:t},(n,s)=>e.cells[s]??PRe(e.key,s))}}function ORe(e,t){const n=h.Children.toArray(e),s=[],r=[],i=[];if(n.forEach((d,f)=>{x0(d,"thead")?s.push(...O7(d,`head-${f}`)):x0(d,"tbody")?r.push(...O7(d,`body-${f}`)):x0(d,"tfoot")?r.push(...O7(d,`foot-${f}`)):x0(d,"tr")&&i.push(die(d,`row-${f}`))}),i.length>0){const[d,...f]=i;d!=null&&d.cells.some(m=>m.isHeader)?(s.push(d),r.push(...f)):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,f)=>{const m=c==null?void 0:c.cells[f];if(m)return m;const p=t(f);return{key:`header-${f}`,content:p,text:p,rawText:p,isHeader:!0}}),rows:r.map(d=>LRe(d,a)),columnCount:a}}function ef(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 hie(e,t){const n=ef(e),s=ef(t);return n!==null&&s!==null&&n!==s?n-s:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function WC(e){return{minRow:Math.min(e.anchorRow,e.focusRow),maxRow:Math.max(e.anchorRow,e.focusRow)}}function fD(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 VC(e){const t=e.replace(/[\u200B-\u200D\u2060\u00AD\uFEFF]/g,"").trimStart();return/^[=+\-@]/.test(t)?`'${e}`:e}function NN(e){return((e==null?void 0:e.rawText)??(e==null?void 0:e.text)??"").replace(/[\r\n\t]+/g," ")}function $7(e){return e.rawText||e.text}function XH(e,t,n){if((e[t]??Rm)===n)return e;if(n===Rm){const r={...e};return delete r[t],r}return{...e,[t]:n}}function QH(e,t,n){if(!e)return"";const{minRow:s,maxRow:r}=WC(e),i=fD(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=>VC(NN(c.cells[u]))).join("	"))}return o.join(`
`)}function $Re(e,t,n){return n.length===0?"":[n.map(r=>VC(NN(e[r]))).join("	"),...t.map(r=>n.map(i=>VC(NN(r.cells[i]))).join("	"))].join(`
`)}function BRe(e,t,n){if(!e)return null;const{minRow:s,maxRow:r}=WC(e),i=fD(e,n);if(i.length===0)return null;let o=0,a=0,c=0,u=0,d=1/0,f=-1/0,m=!0,p=!0,g;for(let v=s;v<=r;v++){const y=t[v];y&&i.forEach(w=>{const x=y.cells[w];if(!x)return;o+=1;const k=x.text.trim();if(!k)return;a+=1;const C=ef(k);if(C===null)return;c+=1,u+=C,d=Math.min(d,C),f=Math.max(f,C),m=m&&k.endsWith("%");const T=k.match(/[$€£¥₹]/g),_=(T==null?void 0:T.length)===1?T[0]:void 0;_?g===void 0?g=_:g!==_&&(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?f:0,format:b,currencySymbol:g}}function NS(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 JH(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 zRe(e,t,n,s){if(s.size===0)return JH(e,t,n);const r=e.filter(a=>!s.has(a)),i=JH(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 ZH(e){return Array.from({length:e},(t,n)=>n)}function eq(e){return Array.from(e.types).includes(uie)}function kv(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 FRe(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 HRe(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=ef(e),s=ef(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=ef(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 qRe(e,t){return t.selectedValues!==void 0&&!t.selectedValues.includes(e)?!1:FRe(e,t.textFilter)&&HRe(e,t.numberFilter)}function tq(e,t,n){const s=Object.entries(t).map(([r,i])=>[Number(r),i]).filter(([r,i])=>r!==n&&kv(i));return s.length===0?e:e.filter(r=>s.every(([i,o])=>{var a;return qRe(((a=r.cells[i])==null?void 0:a.text)??"",o)}))}function URe(e,t){return t?e.map((n,s)=>({row:n,index:s})).sort((n,s)=>{var o,a;const r=hie(((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 WRe(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)=>hie(r.value,i.value))}function VRe(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,ef(i)!==null&&(s+=1))}),n>0&&s/n>=.7}function GRe(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function KRe(e,t){var s,r,i;const n={};if(e.selectedValues!==void 0&&!GRe(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();ef(o)!==null&&(e.numberFilter.operator!=="between"||ef(a??"")!==null)&&(n.numberFilter={operator:e.numberFilter.operator,value:o,valueTo:a})}return kv(n)?n:void 0}function YRe({columnIndex:e,sortedThisColumn:t,onSort:n}){const{t:s}=lt();return l.jsxs("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:[l.jsx(Jt,{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(Jt,{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(Jt,{variant:"ghost",size:"sm",className:"w-full justify-start text-xs",type:"button",onClick:()=>n(e,null),children:s("markdownTable.sort.clear")})]})}function XRe({onHideColumn:e}){const{t}=lt();return l.jsx("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:l.jsx(Jt,{variant:"ghost",size:"sm",className:"w-full justify-start text-xs",type:"button",onClick:e,children:t("markdownTable.hideColumn")})})}function QRe({columnIndex:e,columnName:t,search:n,searchInputRef:s,filteredOptions:r,visibleOptions:i,selectedValues:o,allFilteredSelected:a,onSearchChange:c,onFilteredSelectionChange:u,onToggleValue:d}){const{t:f}=lt();return l.jsxs("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:[l.jsx(Pr,{ref:s,className:"h-7 text-xs",value:n,onChange:m=>c(m.currentTarget.value),placeholder:f("markdownTable.filter.searchPlaceholder"),name:`markdown-table-option-search-${e}`,"aria-label":f("markdownTable.filter.searchAria",{column:t})}),l.jsxs(ux,{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(UC,{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:f("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(ux,{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(UC,{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:f("markdownTable.filter.optionLimit",{count:i.length})}),r.length===0&&l.jsx("div",{className:"p-2 text-center text-muted-foreground",children:f("markdownTable.filter.noOptions")})]})]})}function JRe({overlayId:e,columnIndex:t,columnName:n,isNumeric:s,textOperator:r,textValue:i,numberOperator:o,numberValue:a,numberValueTo:c,onTextOperatorChange:u,onTextValueChange:d,onNumberOperatorChange:f,onNumberValueChange:m,onNumberValueToChange:p}){const{t:g}=lt();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(xl,{value:o,name:`markdown-table-number-operator-${t}`,onValueChange:b=>f(b),children:[l.jsx(_l,{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(kl,{})}),l.jsx(Sl,{"data-markdown-table-filter-owner":e,className:"z-[calc(var(--web-shell-popover-z-index,1000)+1)]",children:Object.entries(SRe).map(([b,v])=>l.jsx(Ti,{value:b,"data-value":b,className:"text-xs",children:g(v)},b))})]}),l.jsxs("div",{className:"flex gap-1.5",children:[l.jsx(Pr,{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(Pr,{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(xl,{value:r,name:`markdown-table-text-operator-${t}`,onValueChange:b=>u(b),children:[l.jsx(_l,{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(kl,{})}),l.jsx(Sl,{"data-markdown-table-filter-owner":e,className:"z-[calc(var(--web-shell-popover-z-index,1000)+1)]",children:Object.entries(_Re).map(([b,v])=>l.jsx(Ti,{value:b,"data-value":b,className:"text-xs",children:g(v)},b))})]}),l.jsx(Pr,{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 ZRe({onClear:e,onClose:t,onApply:n}){const{t:s}=lt();return l.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-2",children:[l.jsx(Jt,{variant:"outline",size:"sm",type:"button",onClick:e,children:s("markdownTable.filter.reset")}),l.jsx("span",{className:"flex-1"}),l.jsx(Jt,{variant:"outline",size:"sm",type:"button",onClick:t,children:s("markdownTable.filter.cancel")}),l.jsx(Jt,{size:"sm",type:"button",onClick:n,children:s("markdownTable.filter.confirm")})]})}function eDe({id:e,columnName:t,columnIndex:n,filter:s,isNumeric:r,options:i,sort:o,canHideColumn:a,onApply:c,onClose:u,onHideColumn:d,onSort:f}){var I,J,W,P,V;const m=h.useMemo(()=>i.map(ee=>ee.value),[i]),[p,g]=h.useState(""),[b,v]=h.useState(()=>new Set((s==null?void 0:s.selectedValues)??m)),[y,w]=h.useState(((I=s==null?void 0:s.textFilter)==null?void 0:I.operator)??"contains"),[x,k]=h.useState(((J=s==null?void 0:s.textFilter)==null?void 0:J.value)??""),[C,T]=h.useState(((W=s==null?void 0:s.numberFilter)==null?void 0:W.operator)??"gt"),[_,S]=h.useState(((P=s==null?void 0:s.numberFilter)==null?void 0:P.value)??""),[R,A]=h.useState(((V=s==null?void 0:s.numberFilter)==null?void 0:V.valueTo)??""),O=h.useRef(null);h.useEffect(()=>{var ee;(ee=O.current)==null||ee.focus()},[]);const M=h.useMemo(()=>{const ee=p.trim().toLowerCase();return ee?i.filter(q=>q.label.toLowerCase().includes(ee)):i},[i,p]),D=M.slice(0,500),$=M.length>0&&M.every(ee=>b.has(ee.value)),z=ee=>{v(q=>{const K=new Set(q);return M.forEach(de=>{ee?K.add(de.value):K.delete(de.value)}),K})},B=ee=>{v(q=>{const K=new Set(q);return K.has(ee)?K.delete(ee):K.add(ee),K})},j=()=>{c(n,KRe({selectedValues:Array.from(b),textFilter:{operator:y,value:x},numberFilter:{operator:C,value:_,valueTo:R}},m))},H=()=>{c(n,void 0)},Q=(o==null?void 0:o.columnIndex)===n?o:null;return l.jsxs(sp,{id:e,"data-markdown-table-filter-owner":e,align:"end",sideOffset:2,collisionPadding:6,onCloseAutoFocus:ee=>{document.activeElement&&document.activeElement!==document.body&&ee.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(yIe,{className:"border-b px-2.5 py-2",children:l.jsx(wIe,{id:`${e}-title`,className:"truncate text-xs font-bold",children:t})}),l.jsx(YRe,{columnIndex:n,sortedThisColumn:Q,onSort:f}),a&&l.jsx(XRe,{onHideColumn:()=>d(n)}),l.jsx(QRe,{columnIndex:n,columnName:t,search:p,searchInputRef:O,filteredOptions:M,visibleOptions:D,selectedValues:b,allFilteredSelected:$,onSearchChange:g,onFilteredSelectionChange:z,onToggleValue:B}),l.jsx(JRe,{overlayId:e,columnIndex:n,columnName:t,isNumeric:r,textOperator:y,textValue:x,numberOperator:C,numberValue:_,numberValueTo:R,onTextOperatorChange:w,onTextValueChange:k,onNumberOperatorChange:T,onNumberValueChange:S,onNumberValueToChange:A}),l.jsx(ZRe,{onClear:H,onClose:u,onApply:j})]})}function tDe({children:e,fallback:t,toolbarExtra:n}){const{t:s}=lt(),r=h.useMemo(()=>ORe(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>CRe||r.columnCount>TRe?l.jsx(l.Fragment,{children:t??l.jsx("table",{children:e})}):l.jsx(nDe,{table:r,toolbarExtra:n})}function nDe({table:e,toolbarExtra:t}){const{language:n,t:s}=lt(),r=Q8e(),i=h.useId(),[o,a]=h.useState(null),[c,u]=h.useState({}),[d,f]=h.useState(null),[m,p]=h.useState(null),[g,b]=h.useState(null),[v,y]=h.useState(()=>new Set),[w,x]=h.useState({}),[k,C]=h.useState(()=>ZH(e.columnCount)),[T,_]=h.useState(null),[S,R]=h.useState(!1),[A,O]=h.useState(null),[M,D]=h.useState(null),[$,z]=h.useState(null),[B,j]=h.useState(!1),[H,Q]=h.useState("standard"),[I,J]=h.useState(!1),[W,P]=h.useState(!1),[V,ee]=h.useState(!1),[q,K]=h.useState(!1),de=h.useRef(!1),re=h.useRef(null),ne=h.useRef(null),U=h.useRef(null),Z=h.useRef(0),ge=h.useRef(0),ce=h.useRef(0),ue=h.useRef(!0),be=h.useRef(null),rt=h.useRef(null),le=h.useRef(null),Me=h.useRef(null),We=h.useRef(null),at=h.useRef(null),ze=h.useRef(0),rn=h.useRef(0),Wt=h.useRef(null),zt=h.useRef(null),ae=h.useMemo(()=>`${e.columnCount}\0${e.headers.map(xe=>xe.text).join("\0")}`,[e.columnCount,e.headers]),je=h.useRef(ae),it=h.useCallback(()=>{p(null)},[]),gt=h.useCallback(()=>{Z.current+=1,re.current&&(clearTimeout(re.current),re.current=null),P(!1)},[]),wt=h.useCallback(()=>{ge.current+=1,ne.current&&(clearTimeout(ne.current),ne.current=null),ee(!1)},[]),Ke=h.useCallback(()=>{ce.current+=1,U.current&&(clearTimeout(U.current),U.current=null),K(!1)},[]),un=h.useCallback(()=>{ze.current&&(cancelAnimationFrame(ze.current),ze.current=0);const xe=at.current;at.current=null,xe&&f(Ye=>Ye&&{...Ye,focusRow:xe.rowIndex,focusCol:xe.columnIndex})},[]),me=h.useCallback(()=>{un(),de.current=!1,J(!1)},[un]);h.useEffect(()=>{const xe=()=>{document.hidden&&me()};return window.addEventListener("mouseup",me),window.addEventListener("blur",me),document.addEventListener("visibilitychange",xe),()=>{window.removeEventListener("mouseup",me),window.removeEventListener("blur",me),document.removeEventListener("visibilitychange",xe),ze.current&&cancelAnimationFrame(ze.current)}},[me]),h.useEffect(()=>{je.current!==ae&&(je.current=ae,a(null),u({}),f(null),p(null),b(null),y(new Set),x({}),C(ZH(e.columnCount)),_(null),R(!1),O(null),D(null),z(null),j(!1),Q("standard"),gt(),wt(),Ke(),de.current=!1,zt.current=null,J(!1))},[wt,Ke,gt,e.columnCount,ae]),h.useEffect(()=>{wt()},[wt,d]),h.useEffect(()=>(ue.current=!0,()=>{ue.current=!1,re.current&&(clearTimeout(re.current),re.current=null),ne.current&&(clearTimeout(ne.current),ne.current=null),U.current&&(clearTimeout(U.current),U.current=null)}),[]),h.useEffect(()=>{if(!m)return;const xe=`${i}-filter-${m.columnIndex}`,Ye=Et=>{if(Et.target instanceof Element){const Mt=Et.target.closest("[data-markdown-table-filter-owner]");if((Mt==null?void 0:Mt.getAttribute("data-markdown-table-filter-owner"))===xe)return}p(null)},st=()=>p(null);return document.addEventListener("scroll",Ye,!0),window.addEventListener("resize",st),()=>{document.removeEventListener("scroll",Ye,!0),window.removeEventListener("resize",st)}},[m,i]),h.useEffect(()=>{if(!g)return;const xe=Et=>{var cs;const Mt=Et.target;(cs=le.current)!=null&&cs.contains(Mt)||b(null)},Ye=Et=>{Et.key==="Escape"&&(Et.preventDefault(),b(null))},st=()=>b(null);return document.addEventListener("mousedown",xe),document.addEventListener("keydown",Ye),document.addEventListener("scroll",st,!0),window.addEventListener("resize",st),()=>{document.removeEventListener("mousedown",xe),document.removeEventListener("keydown",Ye),document.removeEventListener("scroll",st,!0),window.removeEventListener("resize",st)}},[g]),h.useEffect(()=>{const xe=st=>{var Mt,cs;const Et=st.target;Et instanceof Node&&!((Mt=be.current)!=null&&Mt.contains(Et))&&!((cs=le.current)!=null&&cs.contains(Et))&&_(null)},Ye=st=>{st.defaultPrevented||m||$||g||st.key==="Escape"&&_(null)};return document.addEventListener("mousedown",xe),document.addEventListener("keydown",Ye),()=>{document.removeEventListener("mousedown",xe),document.removeEventListener("keydown",Ye)}},[$,g,m]);const ht=h.useMemo(()=>tq(e.rows,c),[c,e.rows]),Oe=h.useMemo(()=>URe(ht,o),[ht,o]);h.useEffect(()=>{f(xe=>xe&&(WC(xe).maxRow<Oe.length?xe:null))},[Oe.length]);const Ne=h.useMemo(()=>{if(!m)return[];const xe=m.columnIndex;return WRe(tq(e.rows,c,xe),xe,s("markdownTable.blank"))},[c,m,s,e.rows]),St=h.useMemo(()=>e.headers.map((xe,Ye)=>VRe(e.rows,Ye)),[e.headers,e.rows]),Ue=h.useMemo(()=>k.filter(xe=>xe>=0&&xe<e.columnCount).filter(xe=>!v.has(xe)),[k,v,e.columnCount]),ve=S?Ue[0]:void 0,Fe=h.useMemo(()=>{if(!$)return null;const xe=Oe.find(Ye=>Ye.key===$.rowKey);return(xe==null?void 0:xe.cells[$.columnIndex])??null},[$,Oe]),ie=Fe==null?void 0:Fe.text;h.useEffect(()=>{gt()},[gt,Ue,Oe]),h.useEffect(()=>{if(!A)return;const xe=()=>{const Mt=Wt.current;Wt.current=null,rn.current&&(cancelAnimationFrame(rn.current),rn.current=0),Mt!==null&&x(cs=>XH(cs,A.columnIndex,Mt))},Ye=Mt=>{Wt.current=YH(A.startWidth+Mt.clientX-A.startX),!rn.current&&(rn.current=requestAnimationFrame(xe))},st=()=>{xe(),O(null)},Et=()=>{document.hidden&&st()};return window.addEventListener("mousemove",Ye),window.addEventListener("mouseup",st),window.addEventListener("blur",st),document.addEventListener("visibilitychange",Et),()=>{window.removeEventListener("mousemove",Ye),window.removeEventListener("mouseup",st),window.removeEventListener("blur",st),document.removeEventListener("visibilitychange",Et),rn.current&&(cancelAnimationFrame(rn.current),rn.current=0),Wt.current=null}},[A]),h.useEffect(()=>{M&&!Oe.some(xe=>xe.key===M)&&D(null),$&&!Oe.some(xe=>xe.key===$.rowKey&&xe.cells[$.columnIndex])&&z(null)},[$,M,Oe]),h.useEffect(()=>{if($)return r()},[$,r]),h.useEffect(()=>{$&&Ke()},[$,ie,Ke]),h.useEffect(()=>{if($)return()=>{const xe=We.current;We.current=null,xe!=null&&xe.isConnected&&xe.focus()}},[$]);const Pe=(xe,Ye)=>{f(null),u(st=>{const Et={...st};return Ye&&kv(Ye)?Et[xe]=Ye:delete Et[xe],Et}),it()},et=(xe,Ye)=>{f(null),_(xe),a(Ye?{columnIndex:xe,direction:Ye}:null)},He=xe=>{f(null),_(xe),a(Ye=>(Ye==null?void 0:Ye.columnIndex)!==xe?{columnIndex:xe,direction:"asc"}:Ye.direction==="asc"?{columnIndex:xe,direction:"desc"}:null)},Ae=(xe,Ye)=>{if(!Ye){p(st=>(st==null?void 0:st.columnIndex)===xe?null:st);return}f(null),_(xe),b(null),p({columnIndex:xe})},vt=xe=>{Ue.length<=1||(f(null),_(Ye=>Ye===xe?null:Ye),it(),u(Ye=>{const st={...Ye};return delete st[xe],st}),a(Ye=>(Ye==null?void 0:Ye.columnIndex)===xe?null:Ye),y(Ye=>{const st=new Set(Ye);return st.add(xe),st}))},vn=()=>{f(null),y(new Set)},Ce=()=>{R(xe=>!xe),b(null)},yt=(xe,Ye)=>{if(Ye!==Ue[0])return;xe.preventDefault(),f(null),_(Ye),p(null),b({left:Math.max(6,Math.min(xe.clientX,window.innerWidth-220-6)),top:Math.max(6,Math.min(xe.clientY,window.innerHeight-72-6))})},Ft=()=>{Q(xe=>RRe(xe))},De=xe=>{f(null),z(null),Ke(),D(Ye=>Ye===xe?null:xe)},Xe=(xe,Ye)=>{We.current=document.activeElement instanceof HTMLElement?document.activeElement:null,f(null),p(null),D(null),Ke(),z({rowKey:xe,columnIndex:Ye})},$e=()=>{z(null),Ke()},Ht=()=>{if(ie==null||!navigator.clipboard)return;const xe=ce.current;navigator.clipboard.writeText(VC(ie)).then(()=>{ue.current&&ce.current===xe&&(U.current&&clearTimeout(U.current),K(!0),U.current=setTimeout(()=>K(!1),2e3))}).catch(Ye=>console.warn("[web-shell] clipboard write failed:",Ye))},ke=h.useMemo(()=>d?WC(d):null,[d]),Fn=h.useMemo(()=>new Set(fD(d,Ue)),[d,Ue]),Ve=(xe,Ye)=>{if(!ke)return!1;const{minRow:st,maxRow:Et}=ke;return xe>=st&&xe<=Et&&Fn.has(Ye)},ft=(xe,Ye)=>{const st=w[xe];if(st===void 0){const Et=H==="compact"?NRe:ARe;return Ye?{...Et,...Ye}:Et}return{width:st,minWidth:st,maxWidth:st,...Ye}},Lt=(xe,Ye)=>{xe.preventDefault(),xe.stopPropagation();const st=xe.currentTarget.closest("th"),Et=st==null?void 0:st.getBoundingClientRect().width;O({columnIndex:Ye,startX:xe.clientX,startWidth:w[Ye]??(Et?Math.round(Et):Rm)})},gn=(xe,Ye)=>{if(xe.ctrlKey||xe.metaKey||xe.altKey||xe.shiftKey)return;let st=0;if(xe.key==="ArrowRight"?st=KH:xe.key==="ArrowLeft"&&(st=-KH),st===0)return;xe.preventDefault(),xe.stopPropagation();const Et=xe.currentTarget.closest("th"),Mt=Et==null?void 0:Et.getBoundingClientRect().width;x(cs=>{const bs=cs[Ye]??(Mt?Math.round(Mt):Rm),sr=YH(bs+st);return XH(cs,Ye,sr)})},Tn=(xe,Ye)=>{xe.stopPropagation(),_(Ye),zt.current=Ye,xe.dataTransfer.effectAllowed="move",xe.dataTransfer.setData(uie,String(Ye))},Xn=()=>{zt.current=null},_r=xe=>{zt.current===null||!eq(xe.dataTransfer)||(xe.preventDefault(),xe.dataTransfer.dropEffect="move")},zr=(xe,Ye)=>{const st=zt.current;Xn(),!(st===null||!eq(xe.dataTransfer))&&(xe.preventDefault(),xe.stopPropagation(),f(null),_(st),C(Et=>zRe(Et,st,Ye,v)))},Ar=(xe,Ye)=>{m!==null&&p(null),_(null),de.current=!0,f({anchorRow:xe,anchorCol:Ye,focusRow:xe,focusCol:Ye})},jt=(xe,Ye,st)=>{var Et;xe.button!==0||P7(xe.target)||(xe.preventDefault(),(Et=rt.current)==null||Et.focus({preventScroll:!0}),Ar(Ye,st))},Sn=(xe,Ye)=>{de.current&&(J(!0),at.current={rowIndex:xe,columnIndex:Ye},!ze.current&&(ze.current=requestAnimationFrame(()=>{ze.current=0;const st=at.current;at.current=null,st&&f(Et=>Et&&{...Et,focusRow:st.rowIndex,focusCol:st.columnIndex})})))},Hn=xe=>{var cs;const Ye=document.elementFromPoint(xe.clientX,xe.clientY),st=Ye==null?void 0:Ye.closest("[data-row-index][data-column-index]");if(!st||!((cs=be.current)!=null&&cs.contains(st)))return null;const Et=Number(st.dataset.rowIndex),Mt=Number(st.dataset.columnIndex);return!Number.isInteger(Et)||!Number.isInteger(Mt)?null:{rowIndex:Et,columnIndex:Mt}},Ln=(xe,Ye,st)=>{xe.touches.length!==1||P7(xe.target)||Ar(Ye,st)},gs=xe=>{if(!de.current||xe.touches.length!==1)return;const Ye=xe.touches[0];if(!Ye)return;const st=Hn(Ye);st&&(xe.preventDefault(),Sn(st.rowIndex,st.columnIndex))},qn=()=>{const xe=QH(d,Oe,Ue);if(!xe||!navigator.clipboard)return;const Ye=ge.current;navigator.clipboard.writeText(xe).then(()=>{ue.current&&ge.current===Ye&&(ne.current&&clearTimeout(ne.current),ee(!0),ne.current=setTimeout(()=>ee(!1),2e3))}).catch(st=>console.warn("[web-shell] clipboard write failed:",st))},Dn=()=>{const xe=$Re(e.headers,Oe,Ue);if(!xe||!navigator.clipboard)return;const Ye=Z.current;navigator.clipboard.writeText(xe).then(()=>{ue.current&&Z.current===Ye&&(re.current&&clearTimeout(re.current),P(!0),re.current=setTimeout(()=>P(!1),2e3))}).catch(st=>console.warn("[web-shell] clipboard write failed:",st))},Rs=xe=>{if(MRe())return;const Ye=QH(d,Oe,Ue);Ye&&(xe.preventDefault(),xe.clipboardData.setData("text/plain",Ye))},ts=h.useMemo(()=>BRe(d,Oe,Ue),[Ue,d,Oe]),Bs=(ts==null?void 0:ts.selectedCount)??0,Sr=Object.values(c).filter(kv).length,Nr=s(`markdownTable.density.${H}`),pi=h.useMemo(()=>Oe.some(xe=>Ue.some(Ye=>{const st=xe.cells[Ye];return st?L7($7(st)):!1})),[Ue,Oe]),lr=Oe.length===e.rows.length?s("markdownTable.rows",{count:e.rows.length}):s("markdownTable.rowsFiltered",{visible:Oe.length,total:e.rows.length}),Ds=(xe,Ye)=>{const st=$7(xe),Et=L7(st);return l.jsx("div",{className:`${dn.cellContent} ${Et&&!Ye?dn.cellContentCollapsed:""}`,title:Et&&!Ye?st:void 0,children:l.jsx("div",{className:dn.cellText,children:xe.content})})},gi=(xe,Ye)=>{const st=xe.text.length===0,Et=$7(xe),Mt=L7(Et);return l.jsx("div",{className:`${dn.detailValueContent} ${Mt&&!Ye?dn.detailValueCollapsed:""} ${st?dn.emptyValue:""}`,title:Mt&&!Ye?Et:void 0,children:l.jsx("div",{className:dn.detailValueText,children:st?s("markdownTable.emptyValue"):xe.content})})};return l.jsxs("div",{ref:be,className:`${dn.tableShell} ${DRe(H)} ${S?dn.hasFrozenColumn:""} ${I?dn.dragging:""}`,children:[l.jsxs("div",{className:dn.toolbar,children:[l.jsx("span",{className:dn.summary,children:lr}),l.jsx("span",{className:dn.hint,children:s("markdownTable.hint")}),l.jsx("button",{className:dn.copyButton,type:"button",onClick:Dn,children:W?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:dn.copyCheck,children:"✓"}),s("code.copied")]}):s("markdownTable.copyVisible")}),v.size>0&&l.jsx("button",{className:dn.copyButton,type:"button",onClick:vn,children:s("markdownTable.showHiddenColumns",{count:v.size})}),l.jsx("button",{className:dn.copyButton,type:"button",onClick:Ft,children:s("markdownTable.density",{density:Nr})}),pi&&l.jsx("button",{className:dn.copyButton,type:"button",onClick:()=>j(xe=>!xe),children:s(B?"markdownTable.collapseLongText":"markdownTable.expandLongText")}),Sr>0&&l.jsx("span",{className:dn.selection,children:s("markdownTable.filtersActive",{count:Sr})}),Bs>0&&l.jsxs(l.Fragment,{children:[ts&&l.jsxs("div",{className:dn.selectionStats,children:[l.jsxs("span",{className:dn.selectionMetric,children:[s("markdownTable.selection.selected")," ",l.jsx("strong",{className:dn.selectionMetricValue,children:ts.selectedCount})]}),l.jsxs("span",{className:dn.selectionMetric,children:[s("markdownTable.selection.nonEmpty")," ",l.jsx("strong",{className:dn.selectionMetricValue,children:ts.nonEmptyCount})]}),l.jsxs("span",{className:dn.selectionMetric,children:[s("markdownTable.selection.numeric")," ",l.jsx("strong",{className:dn.selectionMetricValue,children:ts.numericCount})]}),ts.numericCount>0&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:dn.selectionMetric,children:[s("markdownTable.selection.sum")," ",l.jsx("strong",{className:dn.selectionMetricValue,children:NS(ts.sum,ts,n)})]}),l.jsxs("span",{className:dn.selectionMetric,children:[s("markdownTable.selection.average")," ",l.jsx("strong",{className:dn.selectionMetricValue,children:NS(ts.average,ts,n)})]}),l.jsxs("span",{className:dn.selectionMetric,children:[s("markdownTable.selection.min")," ",l.jsx("strong",{className:dn.selectionMetricValue,children:NS(ts.min,ts,n)})]}),l.jsxs("span",{className:dn.selectionMetric,children:[s("markdownTable.selection.max")," ",l.jsx("strong",{className:dn.selectionMetricValue,children:NS(ts.max,ts,n)})]})]})]}),l.jsx("button",{className:dn.copyButton,type:"button",onClick:qn,children:V?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:dn.copyCheck,children:"✓"}),s("code.copied")]}):s("markdownTable.copyTsv")})]}),t]}),l.jsxs("div",{ref:rt,className:dn.scroller,tabIndex:0,onCopy:Rs,children:[l.jsxs("table",{className:dn.table,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{className:`${dn.headerCell} ${dn.actionHeaderCell} ${S?dn.stickyActionHeaderCell:""}`,children:s("markdownTable.actions")}),Ue.map(xe=>{const Ye=e.headers[xe];if(!Ye)return null;const st=(o==null?void 0:o.columnIndex)===xe,Et=kv(c[xe]),Mt=(m==null?void 0:m.columnIndex)===xe,cs=st?o.direction==="asc"?"↑":"↓":"↕",bs=Ye.text||s("markdownTable.column",{index:xe+1}),sr=st?s(o.direction==="asc"?"markdownTable.sortByColumnAsc":"markdownTable.sortByColumnDesc",{column:bs}):s("markdownTable.sortByColumn",{column:bs}),Qn=st?o.direction==="asc"?"ascending":"descending":"none",br=`${i}-filter-${xe}`,Ns=Ye.textAlign?{textAlign:Ye.textAlign}:void 0,Fr=ve===xe,yr=T===xe;return l.jsxs("th",{className:`${dn.headerCell} ${Fr?dn.frozenHeaderCell:""} ${yr?dn.activeHeaderCell:""}`,"aria-sort":Qn,onContextMenu:Mr=>yt(Mr,xe),onDragOver:_r,onDrop:Mr=>zr(Mr,xe),style:ft(xe,Ns),title:bs,children:[l.jsxs("div",{className:dn.headerControls,children:[l.jsxs("button",{className:dn.headerButton,type:"button",onClick:()=>He(xe),"aria-label":sr,style:Ns,children:[l.jsx("span",{className:dn.headerText,style:Ns,children:Ye.content}),l.jsx("span",{className:dn.sortIcon,"aria-hidden":"true",children:cs})]}),l.jsx("button",{className:`${dn.reorderHandle} ${yr?dn.reorderHandleVisible:""}`,type:"button",draggable:!0,tabIndex:yr?0:-1,onDragStart:Mr=>Tn(Mr,xe),onDragEnd:Xn,"aria-label":s("markdownTable.moveColumn",{column:bs}),children:"⋮⋮"}),l.jsxs(np,{open:Mt,onOpenChange:Mr=>Ae(xe,Mr),children:[l.jsx(V0,{asChild:!0,children:l.jsx("button",{className:`${dn.filterTrigger} ${Et?dn.filterTriggerActive:""}`,type:"button","aria-label":s("markdownTable.filterColumn",{column:bs}),"aria-controls":Mt?br:void 0,children:"▾"})}),Mt&&l.jsx(eDe,{id:br,columnName:bs,columnIndex:xe,filter:c[xe],isNumeric:St[xe]??!1,options:Ne,sort:o,canHideColumn:Ue.length>1,onApply:Pe,onClose:it,onHideColumn:vt,onSort:et},xe)]})]}),l.jsx("button",{className:dn.resizeHandle,type:"button",onMouseDown:Mr=>Lt(Mr,xe),onKeyDown:Mr=>gn(Mr,xe),role:"separator","aria-label":s("markdownTable.resizeColumn",{column:bs}),"aria-orientation":"vertical","aria-valuemin":lie,"aria-valuemax":cie,"aria-valuenow":w[xe]??Rm})]},Ye.key)})]})}),l.jsx("tbody",{children:Oe.map((xe,Ye)=>{const st=M===xe.key,Et=`${i}-detail-${xe.key}`;return l.jsxs(h.Fragment,{children:[l.jsxs("tr",{className:Ye%2===1?dn.evenRow:void 0,children:[l.jsx("td",{className:`${dn.cell} ${dn.actionCell} ${S?dn.stickyActionCell:""}`,children:l.jsx("button",{className:dn.rowDetailButton,type:"button",onClick:()=>De(xe.key),"aria-expanded":st,"aria-controls":Et,"aria-label":s(st?"markdownTable.closeRowDetailsAria":"markdownTable.rowDetailsAria",{index:Ye+1}),children:s("markdownTable.rowDetails")})}),Ue.map(Mt=>{const cs=xe.cells[Mt];if(!cs)return null;const bs=cs.textAlign?{textAlign:cs.textAlign}:void 0,sr=ve===Mt;return l.jsx("td",{className:`${dn.cell} ${Ve(Ye,Mt)?dn.selectedCell:""} ${sr?dn.frozenCell:""}`,style:ft(Mt,bs),"data-row-index":Ye,"data-column-index":Mt,onMouseDown:Qn=>jt(Qn,Ye,Mt),onMouseEnter:()=>Sn(Ye,Mt),onTouchStart:Qn=>Ln(Qn,Ye,Mt),onTouchMove:gs,onTouchEnd:me,onTouchCancel:me,onDoubleClick:Qn=>{P7(Qn.target)||Xe(xe.key,Mt)},children:Ds(cs,B)},cs.key)})]}),st&&l.jsx("tr",{id:Et,className:dn.detailRow,children:l.jsx("td",{className:dn.detailCell,colSpan:Ue.length+1,children:l.jsxs("div",{className:dn.detailPanel,children:[l.jsx("div",{className:dn.detailTitle,children:s("markdownTable.detailsHeader")}),Ue.map(Mt=>{const cs=e.headers[Mt],bs=xe.cells[Mt];return!cs||!bs?null:l.jsxs("div",{className:dn.detailItem,children:[l.jsx("div",{className:dn.detailLabel,title:cs.text,children:cs.content}),l.jsx("div",{className:dn.detailValue,children:gi(bs,B)})]},`${xe.key}-detail-${Mt}`)})]})})})]},xe.key)})})]}),Oe.length===0&&l.jsx("div",{className:dn.emptyState,children:e.rows.length===0?s("markdownTable.empty"):s("markdownTable.emptyFiltered")})]}),g&&Ue.length>0&&l.jsx("div",{ref:le,className:dn.columnContextMenu,style:{left:g.left,top:g.top},role:"menu",children:l.jsx("button",{className:dn.columnContextMenuAction,type:"button",role:"menuitem",onClick:Ce,children:s(S?"markdownTable.unfreezeFirstColumn":"markdownTable.freezeFirstColumn")})}),l.jsx(Qm,{open:$!==null&&Fe!==null,onOpenChange:xe=>{xe||$e()},children:Fe&&l.jsxs(Jm,{ref:Me,className:"sm:max-w-lg",showCloseButton:!1,overlayProps:{onMouseDown:$e},onOpenAutoFocus:xe=>{var Ye;xe.preventDefault(),(Ye=Me.current)==null||Ye.focus()},tabIndex:-1,children:[l.jsx(jN,{asChild:!0,children:l.jsxs(Jt,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm","aria-label":s("markdownTable.close"),children:[l.jsx(ey,{}),l.jsx("span",{className:"sr-only",children:s("markdownTable.close")})]})}),l.jsx(Zm,{children:l.jsx(tp,{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:Fe.content}),l.jsxs(ep,{children:[l.jsx(Jt,{variant:"outline",onClick:Ht,children:s(q?"code.copied":"markdownTable.copyCell")}),l.jsx(jN,{asChild:!0,children:l.jsx(Jt,{children:s("markdownTable.close")})})]})]})})]})}const sDe="_content_1n6wo_1",rDe="_inlineCode_1n6wo_127",iDe="_link_1n6wo_139",oDe="_tableWrapper_1n6wo_149",aDe="_table_1n6wo_149",lDe="_image_1n6wo_179",cDe="_codeBlock_1n6wo_187",uDe="_codeBlockHeader_1n6wo_196",dDe="_codeBlockLang_1n6wo_205",hDe="_codeBlockCopy_1n6wo_213",fDe="_codeBlockContent_1n6wo_236",mDe="_codeBlockPlain_1n6wo_256",pDe="_mermaidBlock_1n6wo_274",gDe="_mermaidInline_1n6wo_286",bDe="_mermaidLoading_1n6wo_305",yDe="_mermaidActions_1n6wo_312",wDe="_mermaidZoomWrapper_1n6wo_317",vDe="_mermaidDragging_1n6wo_325",Ws={content:sDe,inlineCode:rDe,link:iDe,tableWrapper:oDe,table:aDe,image:lDe,codeBlock:cDe,codeBlockHeader:uDe,codeBlockLang:dDe,codeBlockCopy:hDe,codeBlockContent:fDe,codeBlockPlain:mDe,mermaidBlock:pDe,mermaidInline:gDe,mermaidLoading:bDe,mermaidActions:yDe,mermaidZoomWrapper:wDe,mermaidDragging:vDe},xDe=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"]),nq={"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 mD(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(nq,t)?nq[t]:t,s=xDe.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const fie=/^(https?:|mailto:)/i,kDe=/^data:image\/(png|jpeg|gif|webp);base64,/i;function mie(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:fie.test(t):!1}function by(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")||kDe.test(t)?!0:fie.test(t):!1}let sq,_De=0;function SDe({code:e}){const{t}=lt(),n=ny(),[s,r]=h.useState(null),[i,o]=h.useState(null),[a,c]=h.useState("diagram"),[u,d]=h.useState(!1),[f,m]=h.useState(1),[p,g]=h.useState({x:0,y:0}),[b,v]=h.useState(!1),y=h.useRef(null),w=n==="light"?"default":"dark",x=.5,k=3,C=.25,T=()=>{m(O=>Math.min(k,Math.round((O+C)*100)/100))},_=()=>{m(O=>Math.max(x,Math.round((O-C)*100)/100))},S=h.useCallback(()=>{y.current=null,v(!1),m(1),g({x:0,y:0})},[]),R=h.useCallback(O=>{O.preventDefault(),v(!0),y.current={startX:O.clientX,startY:O.clientY,origX:p.x,origY:p.y}},[p]);h.useEffect(()=>{if(!b)return;const O=D=>{if(!y.current)return;const $=D.clientX-y.current.startX,z=D.clientY-y.current.startY,B=1500;g({x:y.current.origX+$,y:Math.max(-B,Math.min(B,y.current.origY+z))})},M=()=>{y.current=null,v(!1)};return window.addEventListener("mousemove",O),window.addEventListener("mouseup",M),window.addEventListener("blur",M),()=>{window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",M),window.removeEventListener("blur",M)}},[b]),h.useEffect(()=>{m(1),g({x:0,y:0})},[e]),h.useEffect(()=>{let O=!1;r(null),o(null);const M=setTimeout(()=>{he(()=>import("./mermaid.core-Ct97pqgW.js").then(D=>D.bm),[]).then(async D=>{if(O)return;const $=D.default;sq!==w&&($.initialize({startOnLoad:!1,theme:w,securityLevel:"strict",suppressErrorRendering:!0,flowchart:{wrappingWidth:300,useMaxWidth:!1}}),sq=w);try{const z=`mermaid-${++_De}`,{svg:B}=await $.render(z,e.trim());O||r(B)}catch(z){O||o(z instanceof Error?z.message:"Mermaid render failed")}})},150);return()=>{O=!0,clearTimeout(M)}},[e,w]);const A=()=>{navigator.clipboard.writeText(e).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)},()=>{})};return i?l.jsxs("div",{className:Ws.codeBlock,children:[l.jsx("div",{className:Ws.codeBlockHeader,children:l.jsx("span",{className:Ws.codeBlockLang,children:t("mermaid.errorLabel")})}),l.jsx("pre",{className:`${Ws.codeBlockContent} ${Ws.codeBlockPlain}`,children:l.jsx("code",{children:e})})]}):l.jsxs("div",{className:Ws.codeBlock,children:[l.jsxs("div",{className:Ws.codeBlockHeader,children:[l.jsx("span",{className:Ws.codeBlockLang,children:t("mermaid.label")}),l.jsxs("span",{className:Ws.mermaidActions,children:[a==="diagram"&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:Ws.codeBlockCopy,onClick:_,title:t("mermaid.zoomOut"),disabled:f<=x,children:t("mermaid.zoomOut")}),l.jsx("button",{className:Ws.codeBlockCopy,onClick:S,title:t("mermaid.zoomReset"),disabled:f===1&&p.x===0&&p.y===0,children:t("mermaid.zoomReset")}),l.jsx("button",{className:Ws.codeBlockCopy,onClick:T,title:t("mermaid.zoomIn"),disabled:f>=k,children:t("mermaid.zoomIn")})]}),l.jsx("button",{className:Ws.codeBlockCopy,onClick:()=>c(a==="diagram"?"code":"diagram"),children:t(a==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),l.jsx("button",{className:Ws.codeBlockCopy,onClick:A,children:t(u?"code.copied":"code.copy")})]})]}),a==="code"?l.jsx("pre",{className:`${Ws.codeBlockContent} ${Ws.codeBlockPlain}`,children:l.jsx("code",{children:e})}):s?l.jsx("div",{className:`${Ws.mermaidZoomWrapper} ${b?Ws.mermaidDragging:""}`,onMouseDown:R,onDoubleClick:S,children:l.jsx("div",{className:`${Ws.mermaidBlock} ${Ws.mermaidInline}`,style:{transform:`translate(${p.x}px, ${p.y}px) scale(${f})`,transformOrigin:"top center"},dangerouslySetInnerHTML:{__html:s}})}):l.jsx("div",{className:`${Ws.mermaidBlock} ${Ws.mermaidLoading} ${Ws.mermaidInline}`,children:l.jsx("span",{children:t("mermaid.rendering")})})]})}function CDe({className:e,children:t,isStreaming:n}){const{t:s}=lt(),r=ny(),[i,o]=h.useState(null),[a,c]=h.useState(!1),{label:u,lang:d,resolvedLang:f}=mD(pie(e)),m=String(t).replace(/\n$/,""),p=r==="light"?"github-light-default":"github-dark-default";h.useEffect(()=>{if(n||d==="mermaid"||f==="text"||mN(m)){o(null);return}const b=W8e(m,f,p);if(b!==null){o(b);return}const v=cH(m,f,p,!0);if(v!==null){o(v);return}o(null);let y=!1;return ete(f).then(()=>{if(y)return;const w=cH(m,f,p,!0);w!==null&&o(w)}).catch(w=>{y||(console.warn("[web-shell] highlight failed for lang=%s",f,w),o(null))}),()=>{y=!0}},[m,d,f,p,n]);const g=()=>{navigator.clipboard.writeText(m).then(()=>{c(!0),setTimeout(()=>c(!1),2e3)},()=>{})};return d==="mermaid"&&!n?l.jsx(SDe,{code:m}):l.jsxs("div",{className:Ws.codeBlock,children:[l.jsxs("div",{className:Ws.codeBlockHeader,children:[l.jsx("span",{className:Ws.codeBlockLang,children:u}),l.jsx("button",{className:Ws.codeBlockCopy,onClick:g,children:s(a?"code.copied":"code.copy")})]}),!n&&i!==null?l.jsx("div",{className:Ws.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):l.jsx("pre",{className:`${Ws.codeBlockContent} ${Ws.codeBlockPlain}`,children:l.jsx("code",{children:m})})]})}function pie(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 TDe({children:e}){return l.jsx("code",{className:Ws.inlineCode,children:e})}function rq({children:e}){return l.jsx("div",{className:Ws.tableWrapper,children:l.jsx("table",{className:Ws.table,children:e})})}const gie=h.createContext(!1),bie=h.createContext(void 0);function EDe({className:e,children:t}){const n=h.useContext(gie);return(e==null?void 0:e.startsWith("language-"))||typeof t=="string"&&t.includes(`
`)?l.jsx(jDe,{className:e,isStreaming:n,children:t}):l.jsx(TDe,{children:t})}function jDe({className:e,children:t,isStreaming:n}){var m;const s=h.useContext(bie),r=ny(),{markdown:i}=ku(),o=String(t),a=o.replace(/\n$/,""),c=l.jsx(CDe,{className:e,isStreaming:n,children:o}),u=pie(e),{resolvedLang:d}=mD(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(df,{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 ADe({children:e}){return l.jsx(l.Fragment,{children:e})}const MN=/^qwen-session:\/\//i;function NDe(e){return MN.test(e.trim())?e:zJ(e)}function MDe({href:e,children:t}){const n=BI();if(e&&MN.test(e.trim())){if(n==="readonly")return l.jsx("span",{className:Ws.link,children:t});const r=e.trim().replace(MN,"");return l.jsx("a",{href:"#",role:"button",className:Ws.link,onClick:i=>{i.preventDefault(),i.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:r}))},children:t})}const s=mie(e)?e:void 0;return l.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:Ws.link,children:t})}function IDe({src:e,alt:t}){const n=by(e)?e:void 0;return l.jsx("img",{src:n,alt:t||"",className:Ws.image})}function yie(e="basic",t=""){return{code:EDe,pre:ADe,a:MDe,img:IDe,table({children:n}){if(e==="advanced"){const s=l.jsx(rq,{children:n});return l.jsx(df,{fallback:s,label:"enhanced markdown table",resetKeys:[t],children:l.jsx(tDe,{fallback:s,children:n})})}return l.jsx(rq,{children:n})}}}const RDe=yie(),pf=h.memo(function({content:t,source:n,isStreaming:s,tableMode:r}){const{markdown:i,markdownTableMode:o}=ku(),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=h.useMemo(()=>u==="advanced"?yie("advanced",c):RDe,[u,c]),f=a==null?void 0:a.components,m=h.useMemo(()=>f?{...d,...f,...u==="advanced"?{table:d.table}:{}}:d,[d,u,f]);if(!t)return null;const p=a!=null&&a.remarkPlugins?[Yz,PF,...a.remarkPlugins]:[Yz,PF],g=a!=null&&a.rehypePlugins?[UF,...a.rehypePlugins]:[UF];return l.jsx("div",{className:n!=="thinking"?Ws.content:void 0,"data-markdown-source":n,children:l.jsx(gie.Provider,{value:!!s,children:l.jsx(bie.Provider,{value:n,children:l.jsx(i2e,{remarkPlugins:p,rehypePlugins:g,components:m,urlTransform:NDe,children:c})})})})});let IN=[],wie=[];(()=>{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?wie:IN).push(n=n+e[t])})();function DDe(e){if(e<768)return!1;for(let t=0,n=IN.length;;){let s=t+n>>1;if(e<IN[s])n=s;else if(e>=wie[s])t=s+1;else return!0;if(t==n)return!1}}function iq(e){return e>=127462&&e<=127487}const oq=8205;function PDe(e,t,n=!0,s=!0){return(n?vie:LDe)(e,t,s)}function vie(e,t,n){if(t==e.length)return t;t&&xie(e.charCodeAt(t))&&kie(e.charCodeAt(t-1))&&t--;let s=B7(e,t);for(t+=aq(s);t<e.length;){let r=B7(e,t);if(s==oq||r==oq||n&&DDe(r))t+=aq(r),s=r;else if(iq(r)){let i=0,o=t-2;for(;o>=0&&iq(B7(e,o));)i++,o-=2;if(i%2==0)break;t+=2}else break}return t}function LDe(e,t,n){for(;t>0;){let s=vie(e,t-2,n);if(s<t)return s;t--}return 0}function B7(e,t){let n=e.charCodeAt(t);if(!kie(n)||t+1==e.length)return n;let s=e.charCodeAt(t+1);return xie(s)?(n-55296<<10)+(s-56320)+65536:n}function xie(e){return e>=56320&&e<57344}function kie(e){return e>=55296&&e<56320}function aq(e){return e<65536?1:2}class kr{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]=Db(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),Td.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]=Db(this,t,n);let s=[];return this.decompose(t,n,s,0),Td.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 _v(this),i=new _v(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 _v(this,t)}iterRange(t,n=this.length){return new _ie(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 Sie(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]?kr.empty:t.length<=32?new fo(t):Td.from(fo.split(t,[]))}}class fo extends kr{constructor(t,n=ODe(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 $De(r,a,s,o);r=a+1,s++}}decompose(t,n,s,r){let i=t<=0&&n>=this.length?this:new fo(lq(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(r&1){let o=s.pop(),a=n4(i.text,o.text.slice(),0,i.length);if(a.length<=32)s.push(new fo(a,o.length+i.length));else{let c=a.length>>1;s.push(new fo(a.slice(0,c)),new fo(a.slice(c)))}}else s.push(i)}replace(t,n,s){if(!(s instanceof fo))return super.replace(t,n,s);[t,n]=Db(this,t,n);let r=n4(this.text,n4(s.text,lq(this.text,0,t)),n),i=this.length+s.length-(n-t);return r.length<=32?new fo(r,i):Td.from(fo.split(r,[]),i)}sliceString(t,n=this.length,s=`
`){[t,n]=Db(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 fo(s,r)),s=[],r=-1);return r>-1&&n.push(new fo(s,r)),n}}class Td extends kr{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]=Db(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 Td(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]=Db(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 Td))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 fo(p,n)}let r=Math.max(32,s>>5),i=r<<1,o=r>>1,a=[],c=0,u=-1,d=[];function f(p){let g;if(p.lines>i&&p instanceof Td)for(let b of p.children)f(b);else p.lines>o&&(c>o||!c)?(m(),a.push(p)):p instanceof fo&&c&&(g=d[d.length-1])instanceof fo&&p.lines+g.lines<=32?(c+=p.lines,u+=p.length+1,d[d.length-1]=new fo(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]:Td.from(d,u)),u=-1,c=d.length=0)}for(let p of t)f(p);return m(),a.length==1?a[0]:new Td(a,n)}}kr.empty=new fo([""],0);function ODe(e){let t=-1;for(let n of e)t+=n.length+1;return t}function n4(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 lq(e,t,n){return n4(e,[""],t,n)}class _v{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 fo?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 fo?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 fo){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 fo?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 _ie{constructor(t,n,s){this.value="",this.done=!1,this.cursor=new _v(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 Sie{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"&&(kr.prototype[Symbol.iterator]=function(){return this.iter()},_v.prototype[Symbol.iterator]=_ie.prototype[Symbol.iterator]=Sie.prototype[Symbol.iterator]=function(){return this});class $De{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 Db(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function ha(e,t,n=!0,s=!0){return PDe(e,t,n,s)}function BDe(e){return e>=56320&&e<57344}function zDe(e){return e>=55296&&e<56320}function Ul(e,t){let n=e.charCodeAt(t);if(!zDe(n)||t+1==e.length)return n;let s=e.charCodeAt(t+1);return BDe(s)?(n-55296<<10)+(s-56320)+65536:n}function pD(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function Ed(e){return e<65536?1:2}const RN=/\r\n?|\n/;var gl=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(gl||(gl={}));class Fd{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){DN(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 Fd(t)}composeDesc(t){return this.empty?t:t.empty?this:Cie(this,t)}mapDesc(t,n=!1){return t.empty?this:PN(this,t,n)}mapPos(t,n=-1,s=gl.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!=gl.Simple&&u>=t&&(s==gl.TrackDel&&r<t&&u>t||s==gl.TrackBefore&&r<t||s==gl.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 Fd(t)}static create(t){return new Fd(t)}}class Go extends Fd{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 DN(this,(n,s,r,i,o)=>t=t.replace(r,r+(s-n),o),!1),t}mapDesc(t,n=!1){return PN(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(kr.empty);s.push(o?t.slice(i,i+o):kr.empty)}i+=o}return new Go(n,s)}compose(t){return this.empty?t:t.empty?this:Cie(this,t,!0)}map(t,n=!1){return t.empty?this:PN(this,t,n,!0)}iterChanges(t,n=!1){DN(this,t,n)}get desc(){return Fd.create(this.sections)}filter(t){let n=[],s=[],r=[],i=new dx(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);Wa(r,d,-1);let f=i.ins==-1?-1:i.off==0?i.ins:0;Wa(n,d,f),f>0&&gm(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);Wa(n,d,-1),Wa(r,d,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(d),a+=d}}return{changes:new Go(n,s),filtered:Fd.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&&Wa(r,n-o,-1);let f=new Go(r,i);a=a?a.compose(f.map(a)):f,r=[],i=[],o=0}function u(d){if(Array.isArray(d))for(let f of d)u(f);else if(d instanceof Go){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:f,to:m=f,insert:p}=d;if(f>m||f<0||m>n)throw new RangeError(`Invalid change range ${f} to ${m} (in doc of length ${n})`);let g=p?typeof p=="string"?kr.of(p.split(s||RN)):p:kr.empty,b=g.length;if(f==m&&b==0)return;f<o&&c(),f>o&&Wa(r,f-o,-1),Wa(r,m-f,b),gm(i,r,g),o=m}}return u(t),c(!a),a}static empty(t){return new Go(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(kr.empty);s[r]=kr.of(i.slice(1)),n.push(i[0],s[r].length)}}}return new Go(n,s)}static createSet(t,n){return new Go(t,n)}}function Wa(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 gm(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(kr.empty);e.push(n)}}function DN(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,f=kr.empty;for(;u+=a,d+=c,c&&s&&(f=f.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,f),r=u,i=d}}}function PN(e,t,n,s=!1){let r=[],i=s?[]:null,o=new dx(e),a=new dx(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);Wa(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(Wa(r,a.ins,-1);u;){let d=Math.min(o.len,u);o.ins>=0&&c<o.i&&o.len<=d&&(Wa(r,0,o.ins),i&&gm(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 f=Math.min(d,a.len);u+=f,d-=f,a.forward(f)}else if(a.ins==0&&a.len<d)d-=a.len,a.next();else break;Wa(r,u,c<o.i?o.ins:0),i&&c<o.i&&gm(i,r,o.text),c=o.i,o.forward(o.len-d)}else{if(o.done&&a.done)return i?Go.createSet(r,i):Fd.create(r);throw new Error("Mismatched change set lengths")}}}function Cie(e,t,n=!1){let s=[],r=n?[]:null,i=new dx(e),o=new dx(t);for(let a=!1;;){if(i.done&&o.done)return r?Go.createSet(s,r):Fd.create(s);if(i.ins==0)Wa(s,i.len,0,a),i.next();else if(o.len==0&&!o.done)Wa(s,0,o.ins,a),r&&gm(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;Wa(s,c,d,a),r&&d&&gm(r,s,o.text)}else o.ins==-1?(Wa(s,i.off?0:i.len,c,a),r&&gm(r,s,i.textBit(c))):(Wa(s,i.off?0:i.len,o.off?0:o.ins,a),r&&!o.off&&gm(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 dx{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?kr.empty:t[n]}textBit(t){let{inserted:n}=this.set,s=this.i-2>>1;return s>=n.length&&!t?kr.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 k0{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 k0(s,r,this.flags)}extend(t,n=t,s=0){if(t<=this.anchor&&n>=this.anchor)return ut.range(t,n,void 0,void 0,s);let r=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return ut.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 ut.range(t.anchor,t.head)}static create(t,n,s){return new k0(t,n,s)}}class ut{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:ut.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 ut([this.main],0)}addRange(t,n=!0){return ut.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let s=this.ranges.slice();return s[n]=t,ut.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 ut(t.ranges.map(n=>k0.fromJSON(n)),t.main)}static single(t,n=t){return new ut([ut.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 ut.normalized(t.slice(),n);s=i.to}return new ut(t,n)}static cursor(t,n=0,s,r){return k0.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?k0.create(n,t,48|o):k0.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?ut.range(c,a):ut.range(a,c))}}return new ut(t,n)}}function Tie(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let gD=0;class yn{constructor(t,n,s,r,i){this.combine=t,this.compareInput=n,this.compare=s,this.isStatic=r,this.id=gD++,this.default=t([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(t={}){return new yn(t.combine||(n=>n),t.compareInput||((n,s)=>n===s),t.compare||(t.combine?(n,s)=>n===s:bD),!!t.static,t.enables)}of(t){return new s4([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new s4(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new s4(t,this,2,n)}from(t,n){return n||(n=s=>s),this.compute([t],s=>n(s.field(t)))}}function bD(e,t){return e==t||e.length==t.length&&e.every((n,s)=>n===t[s])}class s4{constructor(t,n,s,r){this.dependencies=t,this.facet=n,this.type=s,this.value=r,this.id=gD++}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 f of this.dependencies)f=="doc"?c=!0:f=="selection"?u=!0:((n=t[f.id])!==null&&n!==void 0?n:1)&1||d.push(t[f.id]);return{create(f){return f.values[o]=s(f),1},update(f,m){if(c&&m.docChanged||u&&(m.docChanged||m.selection)||LN(f,d)){let p=s(f);if(a?!cq(p,f.values[o],r):!r(p,f.values[o]))return f.values[o]=p,1}return 0},reconfigure:(f,m)=>{let p,g=m.config.address[i];if(g!=null){let b=KC(m,g);if(this.dependencies.every(v=>v instanceof yn?m.facet(v)===f.facet(v):v instanceof Da?m.field(v,!1)==f.field(v,!1):!0)||(a?cq(p=s(f),b,r):r(p=s(f),b)))return f.values[o]=b,0}else p=s(f);return f.values[o]=p,1}}}}function cq(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 LN(e,t){let n=!1;for(let s of t)Sv(e,s)&1&&(n=!0);return n}function FDe(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 f=KC(c,s[d]);if(r[d]==2)for(let m of f)u.push(m);else u.push(f)}return t.combine(u)}return{create(c){for(let u of s)Sv(c,u);return c.values[o]=a(c),1},update(c,u){if(!LN(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=LN(c,s),f=u.config.facets[t.id],m=u.facet(t);if(f&&!d&&bD(n,f))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 MS=yn.define({static:!0});class Da{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 Da(gD++,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(MS).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(MS),o=r.facet(MS),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,MS.of({field:this,create:t})]}get extension(){return this}}const m0={lowest:4,low:3,default:2,high:1,highest:0};function mw(e){return t=>new Eie(t,e)}const Ap={highest:mw(m0.highest),high:mw(m0.high),default:mw(m0.default),low:mw(m0.low),lowest:mw(m0.lowest)};class Eie{constructor(t,n){this.inner=t,this.prec=n}}class vg{of(t){return new ON(this,t)}reconfigure(t){return vg.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class ON{constructor(t,n){this.compartment=t,this.inner=n}}class GC{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 HDe(t,n,o))m instanceof Da?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,bD(b,p))c.push(s.facet(g));else{let v=g.combine(p.map(y=>y.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(y=>v.dynamicSlot(y)));a[g.id]=u.length<<1,u.push(v=>FDe(v,g,p))}}let f=u.map(m=>m(a));return new GC(t,o,f,a,c,i)}}function HDe(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 ON&&n.delete(o.compartment)}if(r.set(o,a),Array.isArray(o))for(let u of o)i(u,a);else if(o instanceof ON){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 Eie)i(o.inner,o.prec);else if(o instanceof Da)s[a].push(o),o.provides&&i(o.provides,a);else if(o instanceof s4)s[a].push(o),o.facet.extensions&&i(o.facet.extensions,m0.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,m0.default),s.reduce((o,a)=>o.concat(a))}function Sv(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 KC(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const jie=yn.define(),$N=yn.define({combine:e=>e.some(t=>t),static:!0}),Aie=yn.define({combine:e=>e.length?e[0]:void 0,static:!0}),Nie=yn.define(),Mie=yn.define(),Iie=yn.define(),Rie=yn.define({combine:e=>e.length?e[0]:!1});class Tf{constructor(t,n){this.type=t,this.value=n}static define(){return new qDe}}class qDe{of(t){return new Tf(this,t)}}class UDe{constructor(t){this.map=t}of(t){return new Ss(this,t)}}class Ss{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 Ss(this.type,n)}is(t){return this.type==t}static define(t={}){return new UDe(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}}Ss.reconfigure=Ss.define();Ss.appendConfig=Ss.define();class Yo{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&&Tie(s,n.newLength),i.some(a=>a.type==Yo.time)||(this.annotations=i.concat(Yo.time.of(Date.now())))}static create(t,n,s,r,i,o){return new Yo(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(Yo.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}Yo.time=Tf.define();Yo.userEvent=Tf.define();Yo.addToHistory=Tf.define();Yo.remote=Tf.define();function WDe(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 Die(e,t,n){var s;let r,i,o;return n?(r=t.changes,i=Go.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:Ss.mapEffects(e.effects,r).concat(Ss.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function BN(e,t,n){let s=t.selection,r=ib(t.annotations);return t.userEvent&&(r=r.concat(Yo.userEvent.of(t.userEvent))),{changes:t.changes instanceof Go?t.changes:Go.of(t.changes||[],n,e.facet(Aie)),selection:s&&(s instanceof ut?s:ut.single(s.anchor,s.head)),effects:ib(t.effects),annotations:r,scrollIntoView:!!t.scrollIntoView}}function Pie(e,t,n){let s=BN(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=Die(s,BN(e,t[i],o?s.changes.newLength:e.doc.length),o)}let r=Yo.create(e,s.changes,s.selection,s.effects,s.annotations,s.scrollIntoView);return GDe(n?VDe(r):r)}function VDe(e){let t=e.startState,n=!0;for(let r of t.facet(Nie)){let i=r(e);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:WDe(n,i))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=Go.empty(t.doc.length);else{let o=e.changes.filter(n);r=o.changes,i=o.filtered.mapDesc(o.changes).invertedDesc}e=Yo.create(t,r,e.selection&&e.selection.map(i),Ss.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let s=t.facet(Mie);for(let r=s.length-1;r>=0;r--){let i=s[r](e);i instanceof Yo?e=i:Array.isArray(i)&&i.length==1&&i[0]instanceof Yo?e=i[0]:e=Pie(t,ib(i),!1)}return e}function GDe(e){let t=e.startState,n=t.facet(Iie),s=e;for(let r=n.length-1;r>=0;r--){let i=n[r](e);i&&Object.keys(i).length&&(s=Die(s,BN(t,i,e.changes.newLength),!0))}return s==e?e:Yo.create(t,e.changes,e.selection,s.effects,s.annotations,s.scrollIntoView)}const KDe=[];function ib(e){return e==null?KDe:Array.isArray(e)?e:[e]}var Di=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Di||(Di={}));const YDe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let zN;try{zN=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function XDe(e){if(zN)return zN.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||YDe.test(n)))return!0}return!1}function QDe(e){return t=>{if(!/\S/.test(t))return Di.Space;if(XDe(t))return Di.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return Di.Word;return Di.Other}}class dr{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++)Sv(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 Sv(this,s),KC(this,s)}update(...t){return Pie(this,t,!0)}applyTransaction(t){let n=this.config,{base:s,compartments:r}=n;for(let a of t.effects)a.is(vg.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(Ss.reconfigure)?(n=null,s=a.value):a.is(Ss.appendConfig)&&(n=null,s=ib(s).concat(a.value));let i;n?i=t.startState.values.slice():(n=GC.resolve(s,r,this),i=new dr(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,u)=>u.reconfigure(c,this),null).values);let o=t.startState.facet($N)?t.newSelection:t.newSelection.asSingle();new dr(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:ut.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=ib(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 f=r.mapDesc(u,!0);i.push(c.range.map(f)),r=r.compose(d),o=Ss.mapEffects(o,d).concat(Ss.mapEffects(ib(c.effects),f))}return{changes:r,selection:ut.create(i,n.mainIndex),effects:o}}changes(t=[]){return t instanceof Go?t:Go.of(t,this.doc.length,this.facet(dr.lineSeparator))}toText(t){return kr.of(t.split(this.facet(dr.lineSeparator)||RN))}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:(Sv(this,n),KC(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 Da&&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 dr.create({doc:t.doc,selection:ut.fromJSON(t.selection),extensions:n.extensions?r.concat([n.extensions]):r})}static create(t={}){let n=GC.resolve(t.extensions||[],new Map),s=t.doc instanceof kr?t.doc:kr.of((t.doc||"").split(n.staticFacet(dr.lineSeparator)||RN)),r=t.selection?t.selection instanceof ut?t.selection:ut.single(t.selection.anchor,t.selection.head):ut.single(0);return Tie(r,s.length),n.staticFacet($N)||(r=r.asSingle()),new dr(n,s,r,n.dynamicSlots.map(()=>null),(i,o)=>o.create(i),null)}get tabSize(){return this.facet(dr.tabSize)}get lineBreak(){return this.facet(dr.lineSeparator)||`
`}get readOnly(){return this.facet(Rie)}phrase(t,...n){for(let s of this.facet(dr.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(jie))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 QDe(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=ha(n,o,!1);if(i(n.slice(c,o))!=Di.Word)break;o=c}for(;a<r;){let c=ha(n,a);if(i(n.slice(a,c))!=Di.Word)break;a=c}return o==a?null:ut.range(o+s,a+s)}}dr.allowMultipleSelections=$N;dr.tabSize=yn.define({combine:e=>e.length?e[0]:4});dr.lineSeparator=Aie;dr.readOnly=Rie;dr.phrases=yn.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])}});dr.languageData=jie;dr.changeFilter=Nie;dr.transactionFilter=Mie;dr.transactionExtender=Iie;vg.reconfigure=Ss.define();function th(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 rp{eq(t){return this==t}range(t,n=t){return FN.create(t,n,this)}}rp.prototype.startSide=rp.prototype.endSide=0;rp.prototype.point=!1;rp.prototype.mapMode=gl.TrackDel;function yD(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}let FN=class Lie{constructor(t,n,s){this.from=t,this.to=n,this.value=s}static create(t,n,s){return new Lie(t,n,s)}};function HN(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class wD{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,f=this.to[c]+t,m,p;if(d==f){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(f,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 wD(r,i,s,a):null,pos:o}}}class tr{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 tr(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(HN)),this.isEmpty)return n.length?tr.of(n):this;let a=new Oie(this,null,-1).goto(0),c=0,u=[],d=new Wd;for(;a.value||c<n.length;)if(c<n.length&&(a.from-n[c].from||a.startSide-n[c].value.startSide)>=0){let f=n[c++];d.addInner(f.from,f.to,f.value)||u.push(f)}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(FN.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!u.length?tr.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:f}=c.map(a,t);d&&(r=Math.max(r,d.maxPoint),n.push(d),s.push(f))}}let i=this.nextLayer.map(t);return n.length==0?i:new tr(s,n,i||tr.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 hx.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return hx.from(t).goto(n)}static compare(t,n,s,r,i=-1){let o=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=i),a=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=i),c=uq(o,a,s),u=new pw(o,c,i),d=new pw(a,c,i);s.iterGaps((f,m,p)=>dq(u,f,d,m,p,r)),s.empty&&s.length==0&&dq(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=uq(i,o),c=new pw(i,a,0).goto(s),u=new pw(o,a,0).goto(s);for(;;){if(c.to!=u.to||!qN(c.active,u.active)||c.point&&(!u.point||!yD(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 pw(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),f=o.pointFrom<n?d.length+1:o.point.startSide<0?d.length:Math.min(d.length,c);r.point(a,u,o.point,d,f,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 Wd;for(let r of t instanceof FN?[t]:n?JDe(t):t)s.add(r.from,r.to,r.value);return s.finish()}static join(t){if(!t.length)return tr.empty;let n=t[t.length-1];for(let s=t.length-2;s>=0;s--)for(let r=t[s];r!=tr.empty;r=r.nextLayer)n=new tr(r.chunkPos,r.chunk,n,Math.max(r.maxPoint,n.maxPoint));return n}}tr.empty=new tr([],[],null,-1);function JDe(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let s=e[n];if(HN(t,s)>0)return e.slice().sort(HN);t=s}return e}tr.empty.nextLayer=tr.empty;class Wd{finishChunk(t){this.chunks.push(new wD(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,n,s){this.addInner(t,n,s)||(this.nextLayer||(this.nextLayer=new Wd)).add(t,n,s)}addInner(t,n,s){let r=t-this.lastTo||s.startSide-this.last.endSide;if(r<=0&&(t-this.lastFrom||s.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(n-this.chunkStart),this.last=s,this.lastFrom=t,this.lastTo=n,this.value.push(s),s.point&&(this.maxPoint=Math.max(this.maxPoint,n-t)),!0)}addChunk(t,n){if((t-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(t);let s=n.value.length-1;return this.last=n.value[s],this.lastFrom=n.from[s]+t,this.lastTo=n.to[s]+t,!0}finish(){return this.finishInner(tr.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=tr.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function uq(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 Oie{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 hx{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 Oie(o,n,s,i));return r.length==1?r[0]:new hx(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--)z7(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--)z7(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(),z7(this.heap,0)}}}function z7(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 pw{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=hx.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){IS(this.active,t),IS(this.activeTo,t),IS(this.activeRank,t),this.minActive=hq(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++;RS(this.active,n,s),RS(this.activeTo,n,r),RS(this.activeRank,n,i),t&&RS(t,n,this.cursor.from),this.minActive=hq(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&&IS(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 dq(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 f=e.to+c-n.to,m=f||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&&yD(e.point,n.point)&&qN(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(a,g,e.point,n.point),d=!1):(d&&i.boundChange(a),g>a&&!qN(e.active,n.active)&&i.compareRange(a,g,e.active,n.active),u&&g<o&&(f||e.openEnd(p)!=n.openEnd(p))&&(d=!0)),p>o)break;a=p,m<=0&&e.next(),m>=0&&n.next()}}function qN(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!yD(e[n],t[n]))return!1;return!0}function IS(e,t){for(let n=t,s=e.length-1;n<s;n++)e[n]=e[n+1];e.pop()}function RS(e,t,n){for(let s=e.length-1;s>=t;s--)e[s+1]=e[s];e[t]=n}function hq(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 yy(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=ha(e,r));return s}function UN(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=ha(e,r)}return s===!0?-1:e.length}const WN="ͼ",fq=typeof Symbol>"u"?"__"+WN:Symbol.for(WN),VN=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),mq=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ip{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=[],f=/^@(\w+)\b/.exec(o[0]),m=f&&f[1]=="keyframes";if(f&&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(!f)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&&!f&&!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=mq[fq]||1;return mq[fq]=t+1,WN+t.toString(36)}static mount(t,n,s){let r=t[VN],i=s&&s.nonce;r?i&&r.setNonce(i):r=new ZDe(t,i),r.mount(Array.isArray(n)?n:[n],t)}}let pq=new Map;class ZDe{constructor(t,n){let s=t.ownerDocument||t,r=s.defaultView;if(!t.head&&t.adoptedStyleSheets&&r.CSSStyleSheet){let i=pq.get(s);if(i)return t[VN]=i;this.sheet=new r.CSSStyleSheet,pq.set(s,this)}else this.styleTag=s.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[VN]=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 op={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:"'"},fx={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ePe=typeof navigator<"u"&&/Mac/.test(navigator.platform),tPe=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ca=0;Ca<10;Ca++)op[48+Ca]=op[96+Ca]=String(Ca);for(var Ca=1;Ca<=24;Ca++)op[Ca+111]="F"+Ca;for(var Ca=65;Ca<=90;Ca++)op[Ca]=String.fromCharCode(Ca+32),fx[Ca]=String.fromCharCode(Ca);for(var F7 in op)fx.hasOwnProperty(F7)||(fx[F7]=op[F7]);function nPe(e){var t=ePe&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||tPe&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?fx:op)[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 Jr(){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++)$ie(e,arguments[t]);return e}function $ie(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++)$ie(e,t[n]);else throw new RangeError("Unsupported child node: "+t)}let dl=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},GN=typeof document<"u"?document:{documentElement:{style:{}}};const KN=/Edge\/(\d+)/.exec(dl.userAgent),Bie=/MSIE \d/.test(dl.userAgent),YN=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(dl.userAgent),l5=!!(Bie||YN||KN),gq=!l5&&/gecko\/(\d+)/i.test(dl.userAgent),H7=!l5&&/Chrome\/(\d+)/.exec(dl.userAgent),bq="webkitFontSmoothing"in GN.documentElement.style,XN=!l5&&/Apple Computer/.test(dl.vendor),yq=XN&&(/Mobile\/\w+/.test(dl.userAgent)||dl.maxTouchPoints>2);var bn={mac:yq||/Mac/.test(dl.platform),windows:/Win/.test(dl.platform),linux:/Linux|X11/.test(dl.platform),ie:l5,ie_version:Bie?GN.documentMode||6:YN?+YN[1]:KN?+KN[1]:0,gecko:gq,gecko_version:gq?+(/Firefox\/(\d+)/.exec(dl.userAgent)||[0,0])[1]:0,chrome:!!H7,chrome_version:H7?+H7[1]:0,ios:yq,android:/Android\b/.test(dl.userAgent),webkit:bq,webkit_version:bq?+(/\bAppleWebKit\/(\d+)/.exec(dl.userAgent)||[0,0])[1]:0,safari:XN,safari_version:XN?+(/\bVersion\/(\d+(\.\d+)?)/.exec(dl.userAgent)||[0,0])[1]:0,tabSize:GN.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function vD(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 YC=Object.create(null);function xD(e,t,n){if(e==t)return!0;e||(e=YC),t||(t=YC);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 sPe(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 wq(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 rPe(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 zc{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 Ia=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(Ia||(Ia={}));class Rn extends rp{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 Tk(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 G0(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}=zie(t,n);s=(i?n?-3e8:-1:5e8)-1,r=(o?n?2e8:1:-6e8)+1}return new G0(t,s,r,n,t.widget||null,!0)}static line(t){return new Ek(t)}static set(t,n=!1){return tr.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Rn.none=tr.empty;class Tk extends Rn{constructor(t){let{start:n,end:s}=zie(t);super(n?-1:5e8,s?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?vD(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||YC}eq(t){return this==t||t instanceof Tk&&this.tagName==t.tagName&&xD(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)}}Tk.prototype.point=!1;class Ek extends Rn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof Ek&&this.spec.class==t.spec.class&&xD(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)}}Ek.prototype.mapMode=gl.TrackBefore;Ek.prototype.point=!0;class G0 extends Rn{constructor(t,n,s,r,i,o){super(n,s,i,t),this.block=r,this.isReplace=o,this.mapMode=r?n<=0?gl.TrackBefore:gl.TrackAfter:gl.TrackDel}get type(){return this.startSide!=this.endSide?Ia.WidgetRange:this.startSide<=0?Ia.WidgetBefore:Ia.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof G0&&iPe(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)}}G0.prototype.point=!0;function zie(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 iPe(e,t){return e==t||!!(e&&t&&e.compare(t))}function ob(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 mx extends rp{constructor(t,n,s){super(),this.tagName=t,this.attributes=n,this.rank=s}eq(t){return t==this||t instanceof mx&&this.tagName==t.tagName&&xD(this.attributes,t.attributes)}static create(t){return new mx(t.tagName,t.attributes||YC,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return tr.of(t,n)}}mx.prototype.startSide=mx.prototype.endSide=-1;function px(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function QN(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function Cv(e,t){if(!t.anchorNode)return!1;try{return QN(e,t.anchorNode)}catch{return!1}}function Tv(e){return e.nodeType==3?bx(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function Ev(e,t,n,s){return n?vq(e,t,n,s,-1)||vq(e,t,n,s,1):!1}function ap(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function XC(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function vq(e,t,n,s,r){for(;;){if(e==n&&t==s)return!0;if(t==(r<0?0:gf(e))){if(e.nodeName=="DIV")return!1;let i=e.parentNode;if(!i||i.nodeType!=1)return!1;t=ap(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?gf(e):0}else return!1}}function gf(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function gx(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function oPe(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 Fie(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 aPe(e,t,n,s,r,i,o,a){let c=e.ownerDocument,u=c.defaultView||window;for(let d=e,f=!1;d&&!f;)if(d.nodeType==1){let m,p=d==c.body,g=1,b=1;if(p)m=oPe(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(d).position)&&(f=!0),d.scrollHeight<=d.clientHeight&&d.scrollWidth<=d.clientWidth){d=d.assignedSlot||d.parentNode;continue}let w=d.getBoundingClientRect();({scaleX:g,scaleY:b}=Fie(d,w)),m={left:w.left,right:w.left+d.clientWidth*g,top:w.top,bottom:w.top+d.clientHeight*b}}let v=0,y=0;if(r=="nearest")t.top<m.top+o?(y=t.top-(m.top+o),n>0&&t.bottom>m.bottom+y&&(y=t.bottom-m.bottom+o)):t.bottom>m.bottom-o&&(y=t.bottom-m.bottom+o,n<0&&t.top-y<m.top&&(y=t.top-(m.top+o)));else{let w=t.bottom-t.top,x=m.bottom-m.top;y=(r=="center"&&w<=x?t.top+w/2-x/2:r=="start"||r=="center"&&n<0?t.top-o:t.bottom-x+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||y)if(p)u.scrollBy(v,y);else{let w=0,x=0;if(y){let k=d.scrollTop;d.scrollTop+=y/b,x=(d.scrollTop-k)*b}if(v){let k=d.scrollLeft;d.scrollLeft+=v/g,w=(d.scrollLeft-k)*g}t={left:t.left-w,top:t.top-x,right:t.right-w,bottom:t.bottom-x},w&&Math.abs(w-v)<1&&(s="nearest"),x&&Math.abs(x-y)<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 Hie(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 lPe{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?gf(n):0),s,Math.min(t.focusOffset,s?gf(s):0))}set(t,n,s,r){this.anchorNode=t,this.anchorOffset=n,this.focusNode=s,this.focusOffset=r}}let l0=null;bn.safari&&bn.safari_version>=26&&(l0=!1);function qie(e){if(e.setActive)return e.setActive();if(l0)return e.focus(l0);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(l0==null?{get preventScroll(){return l0={preventScroll:!0},!0}}:void 0),!l0){l0=!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 xq;function bx(e,t,n=t){let s=xq||(xq=document.createRange());return s.setEnd(e,n),s.setStart(e,t),s}function ab(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 cPe(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function uPe(e,t){let n=t.focusNode,s=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=s)return!1;for(s=Math.min(s,gf(n));;)if(s){if(n.nodeType!=1)return!1;let r=n.childNodes[s-1];r.contentEditable=="false"?s--:(n=r,s=gf(n))}else{if(n==e)return!0;s=ap(n),n=n.parentNode}}function Uie(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 Wie(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=gf(n)}else if(n.parentNode&&!XC(n))s=ap(n),n=n.parentNode;else return null}}function Vie(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&&!XC(n))s=ap(n)+1,n=n.parentNode;else return null}}class Lu{constructor(t,n,s=!0){this.node=t,this.offset=n,this.precise=s}static before(t,n){return new Lu(t.parentNode,ap(t),n)}static after(t,n){return new Lu(t.parentNode,ap(t)+1,n)}}var di=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(di||(di={}));const K0=di.LTR,kD=di.RTL;function Gie(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const dPe=Gie("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),hPe=Gie("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),JN=Object.create(null),hd=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);JN[t]=n,JN[n]=-t}function Kie(e){return e<=247?dPe[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?hPe[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const fPe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Dd{get dir(){return this.level%2?kD:K0}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 Yie(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||!Yie(s.inner,r.inner))return!1}return!0}const ci=[];function mPe(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,f=c;u<a;u++){let m=Kie(e.charCodeAt(u));m==512?m=d:m==8&&f==4&&(m=16),ci[u]=m==4?2:m,m&7&&(f=m),d=m}for(let u=o,d=c,f=c;u<a;u++){let m=ci[u];if(m==128)u<a-1&&d==ci[u+1]&&d&24?m=ci[u]=d:ci[u]=256;else if(m==64){let p=u+1;for(;p<a&&ci[p]==64;)p++;let g=u&&d==8||p<n&&ci[p]==8?f==1?1:8:256;for(let b=u;b<p;b++)ci[b]=g;u=p-1}else m==8&&f==1&&(ci[u]=1);d=m,m&7&&(f=m)}}}function pPe(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 f=u,m,p,g;f<d;f++)if(p=JN[m=e.charCodeAt(f)])if(p<0){for(let b=a-3;b>=0;b-=3)if(hd[b+1]==-p){let v=hd[b+2],y=v&2?r:v&4?v&1?i:r:0;y&&(ci[f]=ci[hd[b]]=y),a=b;break}}else{if(hd.length==189)break;hd[a++]=f,hd[a++]=m,hd[a++]=c}else if((g=ci[f])==2||g==1){let b=g==r;c=b?0:1;for(let v=a-3;v>=0;v-=3){let y=hd[v+2];if(y&2)break;if(b)hd[v+2]|=2;else{if(y&4)break;hd[v+2]|=4}}}}}function gPe(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=ci[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(ci[d]==256)d++;else break;let f=i==1,m=(d<t?ci[d]:s)==1,p=f==m?f?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),ci[--g]=p;c=d}else i=u,c++}}}function ZN(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,f=!1;if(u==i.length||c<i[u].from){let b=ci[c];b!=a&&(d=!1,f=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(f)break e;let b=i[u];if(!d)for(let v=b.to,y=u+1;;){if(v==n)break e;if(y<i.length&&i[y].from==v)v=i[y++].to;else{if(ci[v]==a)break e;break}}if(u++,m)m.push(b);else{b.from>c&&o.push(new Dd(c,b.from,p));let v=b.direction==K0!=!(p%2);eM(e,v?s+1:s,r,b.inner,b.from,b.to,o),c=b.to}g=b.to}else{if(g==n||(d?ci[g]!=a:ci[g]==a))break;g++}m?ZN(e,c,g,s+1,r,m,o):c<g&&o.push(new Dd(c,g,p)),c=g}else for(let c=n,u=i.length;c>t;){let d=!0,f=!1;if(!u||c>i[u-1].to){let b=ci[c-1];b!=a&&(d=!1,f=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(f)break e;let b=i[--u];if(!d)for(let v=b.from,y=u;;){if(v==t)break e;if(y&&i[y-1].to==v)v=i[--y].from;else{if(ci[v-1]==a)break e;break}}if(m)m.push(b);else{b.to<c&&o.push(new Dd(b.to,c,p));let v=b.direction==K0!=!(p%2);eM(e,v?s+1:s,r,b.inner,b.from,b.to,o),c=b.from}g=b.from}else{if(g==t||(d?ci[g-1]!=a:ci[g-1]==a))break;g--}m?ZN(e,g,c,s+1,r,m,o):g<c&&o.push(new Dd(g,c,p)),c=g}}function eM(e,t,n,s,r,i,o){let a=t%2?2:1;mPe(e,r,i,s,a),pPe(e,r,i,s,a),gPe(r,i,s,a),ZN(e,r,i,t,n,s,o)}function bPe(e,t,n){if(!e)return[new Dd(0,0,t==kD?1:0)];if(t==K0&&!n.length&&!fPe.test(e))return Xie(e.length);if(n.length)for(;e.length>ci.length;)ci[ci.length]=256;let s=[],r=t==K0?0:1;return eM(e,r,r,n,0,e.length,s),s}function Xie(e){return[new Dd(0,e,0)]}let Qie="";function yPe(e,t,n,s,r){var i;let o=s.head-e.from,a=Dd.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=ha(e.text,o,c.forward(r,n));(d<c.from||d>c.to)&&(d=u),Qie=e.text.slice(Math.min(o,d),Math.max(o,d));let f=a==(r?t.length-1:0)?null:t[a+(r?1:-1)];return f&&d==u&&f.level+(r?0:1)<c.level?ut.cursor(f.side(!r,n)+e.from,f.forward(r,n)?1:-1,f.level):ut.cursor(d+e.from,c.forward(r,n)?-1:1,c.level)}function wPe(e,t,n){for(let s=t;s<n;s++){let r=Kie(e.charCodeAt(s));if(r==1)return K0;if(r==2||r==4)return kD}return K0}const Jie=yn.define(),Zie=yn.define(),eoe=yn.define(),toe=yn.define(),tM=yn.define(),noe=yn.define(),soe=yn.define(),_D=yn.define(),SD=yn.define(),roe=yn.define({combine:e=>e.some(t=>t)}),ioe=yn.define({combine:e=>e.some(t=>t)}),ooe=yn.define();class lb{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 lb(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 lb(ut.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const DS=Ss.define({map:(e,t)=>e.map(t)}),aoe=Ss.define();function Gl(e,t,n){let s=e.facet(toe);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 Ph=yn.define({combine:e=>e.length?e[0]:!0});let vPe=0;const O1=yn.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 Oi{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(O1.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(O1.of({plugin:this,arg:t}))}static define(t,n){const{eventHandlers:s,eventObservers:r,provide:i,decorations:o}=n||{};return new Oi(vPe++,t,s,r,a=>{let c=[];return o&&c.push(c5.of(u=>{let d=u.plugin(a);return d?o(d):Rn.none})),i&&c.push(i(a)),c})}static fromClass(t,n){return Oi.define((s,r)=>new t(s,r),n)}}class q7{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(Gl(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){Gl(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){Gl(t.state,s,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const loe=yn.define(),CD=yn.define(),c5=yn.define(),coe=yn.define(),TD=yn.define(),jk=yn.define(),uoe=yn.define();function kq(e,t){let n=e.state.facet(uoe);if(!n.length)return n;let s=n.map(i=>i instanceof Function?i(e):i),r=[];return tr.spans(s,t.from,t.to,{point(){},span(i,o,a,c){let u=i-t.from,d=o-t.from,f=r;for(let m=a.length-1;m>=0;m--,c--){let p=a[m].spec.bidiIsolate,g;if(p==null&&(p=wPe(t.text,u,d)),c>0&&f.length&&(g=f[f.length-1]).to==u&&g.direction==p)g.to=d,f=g.inner;else{let b={from:u,to:d,direction:p,inner:[]};f.push(b),f=b.inner}}}}),r}const doe=yn.define();function ED(e){let t=0,n=0,s=0,r=0;for(let i of e.state.facet(doe)){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 Hw=yn.define();class du{constructor(t,n,s,r){this.fromA=t,this.toA=n,this.fromB=s,this.toB=r}join(t){return new du(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,f=u,m=d;for(;;)if(i<n.length&&n[i]<=f){let p=n[i+1];i+=2,f=Math.max(f,p);for(let g=r;g<t.length&&t[g].fromB<=f;g++)o=t[g].toA-t[g].toB;m=Math.max(m,p+o)}else if(r<t.length&&t[r].fromB<=f){let p=t[r++];f=Math.max(f,p.toB),m=Math.max(m,p.toA),o=p.toA-p.toB}else break;s.push(new du(d,m,u,f))}return s}}class QC{constructor(t,n,s){this.view=t,this.state=n,this.transactions=s,this.flags=0,this.startState=t.state,this.changes=Go.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 du(i,o,a,c))),this.changedRanges=r}static create(t,n,s){return new QC(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 xPe=[];class ro{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 xPe}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&&sPe(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=ap(this.dom),r=this.length?t>0:n>0;return new Lu(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 d5)return t;return null}static get(t){return t.cmTile}}class u5 extends ro{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=_q(r);else n.insertBefore(a.dom,r);s=a.dom}for(r=s?s.nextSibling:n.firstChild,i&&r&&(i.written=!0);r;)r=_q(r);this.length=o}}function _q(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class d5 extends u5{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=ro.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 tf)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 tf extends u5{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 tf(n||document.createElement(t.tagName),t);return n||(s.flags|=4),s}}class Pb extends u5{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,s){let r=new Pb(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,f){for(let m=0,p=0;m<d.children.length&&p<=f;m++){let g=d.children[m],b=p+g.length;b>=f&&(g.isComposite()?c(g,f-p):(!o||o.isHidden&&(n>0||s&&_Pe(o,g)))&&(b>f||g.flags&32)?(o=g,a=f-p):(p<f||g.flags&16&&!g.isHidden)&&(r=g,i=f-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):kPe(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 Lu(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 Lu(c.dom,0);c==s.tile&&(a=!0)}}return new Lu(this.dom,0)}}function kPe(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Tv(t);return n[n.length-1]||null}function _Pe(e,t){let n=e.coordsIn(0,1),s=t.coordsIn(0,1);return n&&s&&s.top<n.bottom}class Wl extends u5{constructor(t,n){super(t),this.mark=n}get domAttrs(){return this.mark.attrs}static of(t,n){let s=new Wl(n||document.createElement(t.tagName),t);return n||(s.flags|=4),s}}class _0 extends ro{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?bn.chrome||bn.gecko||(t?(r--,o=1):i<s&&(i++,o=-1)):n<0?r--:i<s&&i++;let a=bx(this.dom,r,i).getClientRects();if(!a.length)return null;let c=a[(o?o<0:n>=0)?0:a.length-1];return bn.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(a,u=>u.width)||c),o?gx(c,o<0):c||null}static of(t,n){let s=new _0(n||document.createTextNode(t),t);return n||(s.flags|=2),s}}class Y0 extends ro{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 gx(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 gx(o,!a)}}get overrideDOMText(){if(!this.length)return kr.empty;let{root:t}=this;if(!t)return kr.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 Y0(i,s,t,r)}}class JC extends ro{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 kr.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class SPe{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 CPe{constructor(t,n,s,r){this.from=t,this.to=n,this.wrapper=s,this.rank=r}}class TPe{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 _0(a.dom,a.text+t);c.parent=o}else o.append(r||_0.of(t,(i=this.cache.find(_0))===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)?U7(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 Wl&&u.mark.eq(c.mark))u.dom!=c.dom&&u.setDOM(U7(c.dom)),r=u;else{if(this.cache.reused.get(c)){let f=ro.get(c.dom);f&&f.setDOM(U7(c.dom))}let d=Wl.of(c.mark,c.dom);r.append(d),r=d}this.cache.reused.set(c,2)}let i=ro.get(t.text);i&&this.cache.reused.set(i,2);let o=new _0(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=hoe);let r=Pb.start(t,n||((s=this.cache.find(Pb))===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 Wl&&a.mark.eq(o))r=a,n--;else{let c=Wl.of(o,(s=this.cache.find(Wl,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||!Sq(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(bn.ios&&Sq(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(W7,0,32)||new Y0(W7.toDOM(),0,W7,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 CPe(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 tf&&r.wrapper.eq(s.wrapper))n=r;else{let i=tf.of(s.wrapper,(t=this.cache.find(tf,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(JC,void 0,1);return s&&(s.flags=n),s||new JC(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class EPe{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 ZC=[Y0,Pb,_0,Wl,JC,tf,d5];for(let e=0;e<ZC.length;e++)ZC[e].bucket=e;class jPe{constructor(t){this.view=t,this.buckets=ZC.map(()=>[]),this.index=ZC.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 Y0(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 APe{constructor(t,n,s,r,i){this.view=t,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new jPe(t),this.text=new EPe(t.state.doc),this.builder=new TPe(this.cache,new d5(t,t.contentDOM),tr.iter(s)),this.cache.reused.set(n,2),this.old=new SPe(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=IPe(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?Y0.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 JC)this.cache.add(o);else if(o instanceof Wl)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 Wl&&r.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?r.length&&(r.length=i=0):o instanceof Wl&&(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=tr.spans(this.decorations,t,n,{point:(a,c,u,d,f,m)=>{if(u instanceof G0){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,f>d.length)r.continueWidget(c-a);else{let p=u.widget||(u.block?Lb.block:Lb.inline),g=NPe(u),b=this.cache.findWidget(p,c-a,g)||Y0.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,f))}s=null}else s=MPe(s,u);c>a&&this.text.skip(c-a)},span:(a,c,u,d)=>{for(let f=a;f<c;){let m=this.text.next(Math.min(512,c-f));m==null?(r.addLineStartIfNotCovered(s),r.addBreak(),f++):(r.ensureLine(s),r.addText(m,u,f==a?d:u.length),f+=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=ro.get(r);if(r==this.view.contentDOM)break;i instanceof Wl?n.push(i):i!=null&&i.isLine()?s=i:i instanceof tf||(r.nodeName=="DIV"&&!s&&r!=this.view.contentDOM?s=new Pb(r,hoe):s||n.push(Wl.of(new Tk({tagName:r.nodeName.toLowerCase(),attributes:rPe(r)}),r)))}return{line:s,marks:n}}}function Sq(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 NPe(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 hoe={class:"cm-line"};function MPe(e,t){let n=t.spec.attributes,s=t.spec.class;return!n&&!s||(e||(e={class:"cm-line"}),n&&vD(n,e),s&&(e.class+=" "+s)),e}function IPe(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 Wl&&t.push(s.mark)}return t}function U7(e){let t=ro.get(e);return t&&t.setDOM(e.cloneNode()),e}class Lb extends zc{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}}Lb.inline=new Lb("span");Lb.block=new Lb("div");const W7=new class extends zc{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Cq{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Rn.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 d5(t,t.contentDOM),this.updateInner([new du(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:f})=>f<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:!FPe(t.changes,this.hasComposition)&&!t.selectionSet&&(r=t.state.selection.main.head));let i=r>-1?DPe(this.view,t.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:f}=this.hasComposition;s=new du(d,f,t.changes.mapPos(d,-1),t.changes.mapPos(f,1)).addToSet(s.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(bn.ie||bn.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=OPe(o,this.decorations,t.changes);c.length&&(s=du.extendWithRanges(s,c));let u=BPe(a,this.blockWrappers,t.changes);return u.length&&(s=du.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 APe(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&ro.get(n.text)&&a.cache.reused.set(ro.get(n.text),2),this.tile=a.run(t,n),nM(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=bn.chrome||bn.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 V7&&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(aoe)&&(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(Ph)||s.tabIndex>-1)&&Cv(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)),bn.gecko&&c.empty&&!this.hasComposition&&RPe(u)){let m=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(m,u.node.childNodes[u.offset]||null)),u=d=new Lu(m,0),a=!0}let f=this.view.observer.selectionRange;(a||!f.focusNode||(!Ev(u.node,u.offset,f.anchorNode,f.anchorOffset)||!Ev(d.node,d.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,c))&&(this.view.observer.ignore(()=>{bn.android&&bn.chrome&&s.contains(f.focusNode)&&zPe(f.focusNode,s)&&(s.blur(),s.focus({preventScroll:!0}));let m=px(this.view.root);if(m)if(c.empty){if(bn.gecko){let p=PPe(u.node,u.offset);if(p&&p!=3){let g=(p==1?Wie:Vie)(u.node,u.offset);g&&(u=new Lu(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 Lu(f.anchorNode,f.anchorOffset),this.impreciseHead=d.precise?null:new Lu(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&Ev(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=px(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 f=t.observer.selectionRange;t.docView.posFromDOM(f.anchorNode,f.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=gf(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&&!ro.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 f=d+u.length;if(d<=t&&(s=u,r=t-d,i=f<t),f>=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 V7?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=ha(i.text,o);if(a==o)return null;let c=bx(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==di.LTR,u=0,d=(f,m,p)=>{for(let g=0;g<f.children.length&&!(m>r);g++){let b=f.children[g],v=m+b.length,y=b.dom.getBoundingClientRect(),{height:w}=y;if(p&&!g&&(u+=y.top-p.top),b instanceof tf)v>s&&d(b,m,y);else if(m>=s&&(u>0&&n.push(-u),n.push(w+u),u=0,o)){let x=b.dom.lastChild,k=x?Tv(x):[];if(k.length){let C=k[k.length-1],T=c?C.right-y.left:y.right-C.left;T>a&&(a=T,this.minWidth=i,this.minWidthFrom=m,this.minWidthTo=v)}}p&&g==f.children.length-1&&(u+=p.bottom-y.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"?di.RTL:di.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=Tv(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=Tv(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(Rn.replace({widget:new V7(a),block:!0,inclusive:!0,isBlockGap:!0}).range(s,o))}if(!i)break;s=i.to+1}return Rn.set(t)}updateDeco(){let t=1,n=this.view.state.facet(c5).map(i=>(this.dynamicDecorationMap[t++]=typeof i=="function")?i(this.view):i),s=!1,r=this.view.state.facet(TD).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(tr.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(coe).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(ooe))try{if(d(this.view,t.range,t))return!0}catch(f){Gl(this.view.state,f,"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=ED(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(aPe(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==di.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(){nM(this.tile)}}function nM(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let s of e.children)nM(s,t)}}function RPe(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 foe(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let s=Wie(n.focusNode,n.focusOffset),r=Vie(n.focusNode,n.focusOffset),i=s||r;if(r&&s&&r.node!=s.node){let a=ro.get(r.node);if(!a||a.isText()&&a.text!=r.node.nodeValue)i=r;else if(e.docView.lastCompositionAfterCursor){let c=ro.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 DPe(e,t,n){let s=foe(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 du(c.mapPos(i),c.mapPos(o),i,o),text:r}}function PPe(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 LPe=class{constructor(){this.changes=[]}compareRange(t,n){ob(t,n,this.changes)}comparePoint(t,n){ob(t,n,this.changes)}boundChange(t){ob(t,t,this.changes)}};function OPe(e,t,n){let s=new LPe;return tr.compare(e,t,n,s),s.changes}class $Pe{constructor(){this.changes=[]}compareRange(t,n){ob(t,n,this.changes)}comparePoint(){}boundChange(t){ob(t,t,this.changes)}}function BPe(e,t,n){let s=new $Pe;return tr.compare(e,t,n,s),s.changes}function zPe(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 FPe(e,t){let n=!1;return t&&e.iterChangedRanges((s,r)=>{s<t.to&&r>t.from&&(n=!0)}),n}class V7 extends zc{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 HPe(e,t,n=1){let s=e.charCategorizer(t),r=e.doc.lineAt(t),i=t-r.from;if(r.length==0)return ut.cursor(t);i==0?n=1:i==r.length&&(n=-1);let o=i,a=i;n<0?o=ha(r.text,i,!1):a=ha(r.text,i);let c=s(r.text.slice(o,a));for(;o>0;){let u=ha(r.text,o,!1);if(s(r.text.slice(u,o))!=c)break;o=u}for(;a<r.length;){let u=ha(r.text,a);if(s(r.text.slice(a,u))!=c)break;a=u}return ut.range(o+r.from,a+r.from)}function qPe(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+UN(o,i,e.state.tabSize)}function sM(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==Ia.Text&&(r.type!=i.type||(n<0?i.from<t:i.to>t)))&&(r=i)}}return r||s}return s}function UPe(e,t,n,s){let r=sM(e,t.head,t.assoc||-1),i=!s||r.type!=Ia.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==di.LTR)?o.right-1:o.left+1,y:(i.top+i.bottom)/2});if(c!=null)return ut.cursor(c,n?-1:1)}return ut.cursor(n?r.to:r.from,n?-1:1)}function Tq(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=yPe(r,i,o,a,n),d=Qie;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 WPe(e,t,n){let s=e.state.charCategorizer(t),r=s(n);return i=>{let o=s(i);return r==Di.Space&&(r=o),r==o}}function VPe(e,t,n,s){let r=t.head,i=n?1:-1;if(r==(n?e.state.doc.length:0))return ut.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 f=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=rM(e,{x:f,y:b},!1,i);if(n?b>c.bottom:b<c.top)return ut.cursor(v.pos,v.assoc);let y=e.coordsAtPos(v.pos,v.assoc),w=y?(y.top+y.bottom)/2:0;if(!y||(n?w>a:w<a))return ut.cursor(v.pos,v.assoc,void 0,o)}}function jv(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 moe(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=jv(e,r.from,0);o!=r.from&&(i=ut.cursor(o,-1))}else{let o=jv(e,r.from,-1),a=jv(e,r.to,1);(o!=r.from||a!=r.to)&&(i=ut.range(r.from==r.anchor?o:a,r.from==r.head?o:a))}i&&(n||(n=t.ranges.slice()),n[s]=i)}return n?ut.create(n,t.mainIndex):t}function G7(e,t,n){let s=jv(e.state.facet(jk).map(r=>r(e)),n.from,t.head>n.from?-1:1);return s==n.from?n:ut.cursor(s,s<n.from?1:-1)}class jd{constructor(t,n){this.pos=t,this.assoc=n}}function rM(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 jd(0,1);if(c>e.viewState.docHeight)return new jd(e.state.doc.length,-1);if(u=e.elementAtHeight(c),s==null)break;if(u.type==Ia.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 f=e.viewState.heightOracle.textHeight/2;c=s>0?u.bottom+f:u.top-f}if(e.viewport.from>=u.to||e.viewport.to<=u.from){if(n)return null;if(u.type==Ia.Text){let f=qPe(e,r,u,o,a);return new jd(f,f==u.from?1:-1)}}if(u.type!=Ia.Text)return c<(u.top+u.bottom)/2?new jd(u.from,1):new jd(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 GPe(e,o,a,e.textDirectionAt(u.from)).scanTile(d,u.from)}class GPe{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[Dd.find(r,t-s.from,-1,n)].level==this.baseDir}dirAt(t,n){let{line:s,spans:r}=this.bidiSpansAt(t);return r[Dd.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,f=1e9,m;e:for(;r<i;){let g=i-r,b=r+i>>1;t:if(o.has(b)){let y=r+Math.floor(Math.random()*g);for(let w=0;w<g;w++){if(!o.has(y)){b=y;break t}y++,y==i&&(y=r)}break e}o.add(b);let v=n(b);if(v)for(let y=0;y<v.length;y++){let w=v[y],x=0;if(!(w.width==0&&v.length>1)){if(w.bottom<this.y)(!c||c.bottom<w.bottom)&&(c=w),x=1;else if(w.top>this.y)(!u||u.top>w.top)&&(u=w),x=-1;else{let k=w.left>this.x?this.x-w.left:w.right<this.x?this.x-w.right:0,C=Math.abs(k);C<f&&(d=b,f=C,m=w),k&&(x=k<0==(this.baseDir==di.LTR)?-1:1)}x==-1&&(!a||this.baseDirAt(t[b],1))?i=b:x==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(f&&!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)==di.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=ha(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 bx(t.dom,o,a).getClientRects()});return r.after?new jd(s[r.i+1],-1):new jd(s[r.i],1)}scanTile(t,n){if(!t.length)return new jd(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:bx(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 jd(s[r.i+1],-1):new jd(o,1)}}const w1="";class KPe{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(dr.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=w1}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=ro.get(r),a=r.nextSibling;if(a==n){o!=null&&o.breakAfter&&!a&&s!=this.view.contentDOM&&this.lineBreak();break}let c=ro.get(a);(o&&c?o.breakAfter:(o?o.breakAfter:XC(r))||XC(a)&&(r.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>i)&&!XPe(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=ro.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+(YPe(t,s.node,s.offset)?n:0))}}function YPe(e,t,n){for(;;){if(!t||n<gf(t))return!1;if(t==e)return!0;n=ap(t)+1,t=t.parentNode}}function XPe(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let s=ro.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 Eq{constructor(t,n){this.node=t,this.offset=n,this.pos=-1}}class QPe{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=poe(t.docView.tile,n,s,0))){let c=i||o?[]:ZPe(t),u=new KPe(c,t);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=eLe(c,this.bounds.from)}else{let c=t.observer.selectionRange,u=i&&i.node==c.focusNode&&i.offset==c.focusOffset||!QN(t.contentDOM,c.focusNode)?a.main.head:t.docView.posFromDOM(c.focusNode,c.focusOffset),d=o&&o.node==c.anchorNode&&o.offset==c.anchorOffset||!QN(t.contentDOM,c.anchorNode)?a.main.anchor:t.docView.posFromDOM(c.anchorNode,c.anchorOffset),f=t.viewport;if((bn.ios||bn.chrome)&&a.main.empty&&u!=d&&(f.from>0||f.to<t.state.doc.length)){let m=Math.min(u,d),p=Math.max(u,d),g=f.from-m,b=f.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(ut.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=ut.create([ut.cursor(u,p)])}else this.newSel=ut.single(d,u)}}}function poe(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 f=e.children[c],m=u+f.length;if(u<t&&m>n)return poe(f,t,n,u);if(m>=t&&r==-1&&(r=c,i=u),u>n&&f.dom.parentNode==e.dom){o=c,a=d;break}d=m,u=m+f.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 goe(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||bn.android&&t.text.length<c-a)&&(u=i.to,d="end");let f=r.doc.sliceString(a,c,w1),m,p;!i.empty&&i.from>=a&&i.to<=c&&(t.typeOver||f!=t.text)&&f.slice(0,i.from-a)==t.text.slice(0,i.from-a)&&f.slice(i.to-a)==t.text.slice(m=t.text.length-(f.length-(i.to-a)))?n={from:i.from,to:i.to,insert:kr.of(t.text.slice(i.from-a,m).split(w1))}:(p=boe(f,t.text,u-a,d))&&(bn.chrome&&o==13&&p.toB==p.from+2&&t.text.slice(p.from,p.toB)==w1+w1&&p.toB--,n={from:a+p.from,to:a+p.toA,insert:kr.of(t.text.slice(p.from,p.toB).split(w1))})}else s&&(!e.hasFocus&&r.facet(Ph)||e3(s,i))&&(s=null);if(!n&&!s)return!1;if((bn.mac||bn.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=ut.single(s.main.anchor-1,s.main.head-1)),n={from:n.from,to:n.to,insert:kr.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)}:bn.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
 `&&e.lineWrapping&&(s&&(s=ut.single(s.main.anchor-1,s.main.head-1)),n={from:i.from,to:i.to,insert:kr.of([" "])}),n)return jD(e,n,s,o);if(s&&!e3(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=moe(r.facet(jk).map(u=>u(e)),s))),e.dispatch({selection:s,scrollIntoView:a,userEvent:c}),!0}else return!1}function jD(e,t,n,s=-1){if(bn.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(bn.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&&ab(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)&&ab(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&t.insert.length==0&&ab(e.contentDOM,"Delete",46)))return!0;let i=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,a=()=>o||(o=JPe(e,t,n));return e.state.facet(noe).some(c=>c(e,t.from,t.to,i,a))||e.dispatch(a()),!0}function JPe(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=jv(r.facet(jk).map(f=>f(e)),u,c);t.from==d&&(o=d)}if(o>-1)s={changes:t,selection:ut.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),f,m=n&&foe(e,n.main.head);if(m){let g=t.insert.length-(t.to-t.from);f={from:m.from,to:m.to-g}}else f=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>=f.from&&v<=f.to)return{range:g};let y=r.changes({from:v,to:b,insert:t.insert}),w=g.to-i.to;return{changes:y,range:u?ut.range(Math.max(0,u.anchor+w),Math.max(0,u.head+w)):g.map(y)}})}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 boe(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 ZPe(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 Eq(n,s)),(r!=n||i!=s)&&t.push(new Eq(r,i))),t}function eLe(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?ut.single(n+t,s+t):null}function e3(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class tLe{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,bn.safari&&t.contentDOM.addEventListener("input",()=>null),bn.gecko&&gLe(t.contentDOM.ownerDocument)}handleEvent(t){!cLe(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=nLe(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&&woe.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),bn.android&&bn.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let n;return bn.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&!t.shiftKey&&((n=yoe.find(s=>s.keyCode==t.keyCode))&&!t.ctrlKey||sLe.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,ab(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:bn.safari&&!bn.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 jq(e,t){return(n,s)=>{try{return t.call(e,s,n)}catch(r){Gl(n.state,r)}}}function nLe(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(jq(s.value,c))}if(o)for(let a in o){let c=o[a];c&&n(a).observers.push(jq(s.value,c))}}for(let s in Hu)n(s).handlers.push(Hu[s]);for(let s in ec)n(s).observers.push(ec[s]);return t}const yoe=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],sLe="dthko",woe=[16,17,18,20,91,92,224,225],PS=6;function LS(e){return Math.max(0,e)*.7+8}function rLe(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class iLe{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=Hie(t.contentDOM),this.atoms=t.state.facet(jk).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(dr.allowMultipleSelections)&&oLe(t,n),this.dragging=lLe(t,n)&&koe(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&&rLe(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=ED(this.view);t.clientX-c.left<=r+PS?n=-LS(r-t.clientX):t.clientX+c.right>=o-PS&&(n=LS(t.clientX-o)),t.clientY-c.top<=i+PS?s=-LS(i-t.clientY):t.clientY+c.bottom>=a-PS&&(s=LS(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=moe(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 oLe(e,t){let n=e.state.facet(Jie);return n.length?n[0](t):bn.mac?t.metaKey:t.ctrlKey}function aLe(e,t){let n=e.state.facet(Zie);return n.length?n[0](t):bn.mac?!t.altKey:!t.ctrlKey}function lLe(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let s=px(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 cLe(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=ro.get(n))&&s.isWidget()&&!s.isHidden&&s.widget.ignoreEvent(t))return!1;return!0}const Hu=Object.create(null),ec=Object.create(null),voe=bn.ie&&bn.ie_version<15||bn.ios&&bn.webkit_version<604;function uLe(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(),xoe(e,n.value)},50)}function h5(e,t,n){for(let s of e.facet(t))n=s(n,e);return n}function xoe(e,t){t=h5(e.state,_D,t);let{state:n}=e,s,r=1,i=n.toText(t),o=i.lines==n.selection.ranges.length;if(iM!=null&&n.selection.ranges.every(c=>c.empty)&&iM==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 f=n.toText((o?i.line(r++).text:t)+n.lineBreak);return{changes:{from:d.from,insert:f},range:ut.cursor(u.from+f.length)}})}else o?s=n.changeByRange(c=>{let u=i.line(r++);return{changes:{from:c.from,to:c.to,insert:u.text},range:ut.cursor(c.from+u.length)}}):s=n.replaceSelection(i);e.dispatch(s,{userEvent:"input.paste",scrollIntoView:!0})}ec.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft};ec.wheel=ec.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};Hu.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);ec.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")};ec.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};Hu.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(eoe))if(n=s(e,t),n)break;if(!n&&t.button==0&&(n=hLe(e,t)),n){let s=!e.hasFocus;e.inputState.startMouseSelection(new iLe(e,t,n,s)),s&&e.observer.ignore(()=>{qie(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 Aq(e,t,n,s){if(s==1)return ut.cursor(t,n);if(s==2)return HPe(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++,ut.range(o,a)}}const dLe=bn.ie&&bn.ie_version<=11;let Nq=null,Mq=0,Iq=0;function koe(e){if(!dLe)return e.detail;let t=Nq,n=Iq;return Nq=e,Iq=Date.now(),Mq=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(Mq+1)%3:1}function hLe(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),s=koe(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=Aq(e,c.pos,c.assoc,s);if(n.pos!=c.pos&&!o){let f=Aq(e,n.pos,n.assoc,s),m=Math.min(f.from,d.from),p=Math.max(f.to,d.to);d=m<d.from?ut.range(m,p,d.assoc):ut.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=fLe(r,c.pos))?u:a?r.addRange(d):ut.create([d])}}}function fLe(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 ut.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}Hu.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=ut.range(i,o))}}let{inputState:s}=e;return s.mouseSelection&&(s.mouseSelection.dragging=!0),s.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",h5(e.state,SD,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};Hu.dragend=e=>(e.inputState.draggedContent=null,!1);function Rq(e,t,n,s){if(n=h5(e.state,_D,n),!n)return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:i}=e.inputState,o=s&&i&&aLe(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}Hu.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&&Rq(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 Rq(e,t,s,!0),!0}return!1};Hu.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=voe?null:t.clipboardData;return n?(xoe(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(uLe(e),!1)};function mLe(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 pLe(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:h5(e,SD,t.join(e.lineBreak)),ranges:n,linewise:s}}let iM=null;Hu.copy=Hu.cut=(e,t)=>{if(!Cv(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:s,linewise:r}=pLe(e.state);if(!n&&!r)return!1;iM=r?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"});let i=voe?null:t.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(mLe(e,n),!1)};const _oe=Tf.define();function Soe(e,t){let n=[];for(let s of e.facet(soe)){let r=s(e,t);r&&n.push(r)}return n.length?e.update({effects:n,annotations:_oe.of(!0)}):null}function Coe(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Soe(e.state,t);n?e.dispatch(n):e.update([])}},10)}ec.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),Coe(e)};ec.blur=e=>{e.observer.clearSelectionRange(),Coe(e)};ec.compositionstart=ec.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};ec.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,bn.chrome&&bn.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};ec.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};Hu.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 jD(e,{from:c,to:u,insert:e.state.toText(i)},null),!0}}let r;if(bn.chrome&&bn.android&&(r=yoe.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 bn.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),bn.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>ec.compositionend(e,t),20),!1};const Dq=new Set;function gLe(e){Dq.has(e)||(Dq.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const Pq=["pre-wrap","normal","pre-line","break-spaces"];let Ob=!1;function Lq(){Ob=!1}class bLe{constructor(t){this.lineWrapping=t,this.doc=kr.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 Pq.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=Pq.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 yLe{constructor(t,n){this.from=t,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class Pu{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"?Ia.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 G0?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 Pu(this.from,this.length+t.length,this.top,this.height+t.height,n)}}var wi=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(wi||(wi={}));const r4=.001;class Cl{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)>r4&&(Ob=!0),this.height=t)}replace(t,n,s){return Cl.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:f}=r[a],m=i.lineAt(c,wi.ByPosNoHeight,s.setDoc(n),0,0),p=m.to>=u?m:i.lineAt(u,wi.ByPosNoHeight,s,0,0);for(f+=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,wi.ByPosNoHeight,s,0,0));d+=m.from-c,c=m.from;let g=AD.build(s.setDoc(o),t,d,f);i=t3(i,i.replace(c,u,g))}return i.updateHeight(s,0)}static empty(){return new bc(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 vLe(Cl.of(t.slice(0,n)),o,Cl.of(t.slice(s)))}}function t3(e,t){return e==t?e:(e.constructor!=t.constructor&&(Ob=!0),t)}Cl.prototype.size=1;const wLe=Rn.replace({});class Toe extends Cl{constructor(t,n,s){super(t,n),this.deco=s,this.spaceAbove=0}mainBlock(t,n){return new Pu(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 Pu(r,0,s,this.spaceAbove,wLe):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,wi.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 bc extends Toe{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 Pu(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 bc||r instanceof ka&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof ka?r=new bc(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):Cl.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 ka extends Cl{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),f=a+d.length*c,m=Math.max(s,t-f/2);return new Pu(d.from,d.length,m,f,0)}else{let u=Math.max(0,Math.min(o-i,Math.floor((t-s)/a))),{from:d,length:f}=n.doc.line(i+u);return new Pu(d,f,s+a*u,a,0)}}lineAt(t,n,s,r,i){if(n==wi.ByHeight)return this.blockAt(t,s,r,i);if(n==wi.ByPosNoHeight){let{from:p,to:g}=s.doc.lineAt(t);return new Pu(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,f=u.number-o,m=r+a*f+c*(u.from-i-f);return new Pu(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,f=r;d<=n;){let m=s.doc.lineAt(d);if(d==t){let g=m.number-a;f+=c*g+u*(t-i-g)}let p=c+u*m.length;o(new Pu(m.from,m.length,f,p,0)),f+=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 ka?s[s.length-1]=new ka(i.length+r):s.push(null,new ka(r-1))}if(t>0){let i=s[0];i instanceof ka?s[0]=new ka(t+i.length):s.unshift(new ka(t-1),null)}return Cl.of(s)}decomposeLeft(t,n){n.push(new ka(t-1),null)}decomposeRight(t,n){n.push(null,new ka(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 ka(r.from-n-1).updateHeight(t,n));a<=i&&r.more;){let d=t.doc.lineAt(a).length;o.length&&o.push(null);let f=r.heights[r.index++],m=0;f<0&&(m=-f,f=r.heights[r.index++]),c==-1?c=f:Math.abs(f-c)>=r4&&(c=-2);let p=new bc(d,f,m);p.outdated=!1,o.push(p),a+=d+1}a<=i&&o.push(null,new ka(i-a).updateHeight(t,a));let u=Cl.of(o);return(c<0||Math.abs(u.height-this.height)>=r4||Math.abs(c-this.heightMetrics(t,n).perLine)>=r4)&&(Ob=!0),t3(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 vLe extends Cl{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==wi.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==wi.ByPosNoHeight?wi.ByPosNoHeight:wi.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,wi.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&&Oq(i,o-1),n<this.length){let a=i.length;this.decomposeRight(n,i),Oq(i,a)}return Cl.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?Cl.of(this.break?[t,null,n]:[t,n]):(this.left=t3(this.left,t),this.right=t3(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 Oq(e,t){let n,s;e[t]==null&&(n=e[t-1])instanceof ka&&(s=e[t+1])instanceof ka&&e.splice(t-1,3,new ka(n.length+1+s.length))}const xLe=5;class AD{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 bc?r.length+=s-this.pos:(s>this.pos||!this.isCovered)&&this.nodes.push(new bc(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 Toe(o,r,s)):(o||i||r>=xLe)&&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 bc(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let s=new ka(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 bc)return t;let n=new bc(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 bc)&&!this.isCovered?this.nodes.push(new bc(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 bc&&r.updateHeight(this.oracle,s),s+=r?r.length:1;return this.nodes}static build(t,n,s,r){let i=new AD(s,t);return tr.spans(n,s,r,i,0),i.finish(s)}}function kLe(e,t,n){let s=new _Le;return tr.compare(e,t,n,s,0),s.changes}class _Le{constructor(){this.changes=[]}compareRange(){}comparePoint(t,n,s,r){(t<n||s&&s.heightRelevant||r&&r.heightRelevant)&&ob(t,n,this.changes,5)}}function SLe(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,f=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&f.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=f.position=="absolute"||f.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 CLe(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 TLe(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class K7{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 Rn.replace({widget:new ELe(this.displaySize*(n?t.scaleY:t.scaleX),n)}).range(this.from,this.to)}}class ELe extends zc{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 $q{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=Bq,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=di.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let s=n.facet(CD).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new bLe(s),this.stateDeco=zq(n),this.heightMap=Cl.empty().applyChanges(this.stateDeco,kr.empty,this.heightOracle.setDoc(n.doc),[new du(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=Rn.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 OS(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?Bq:new ND(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(qw(t,this.scaler))})}update(t,n=null){this.state=t.state;let s=this.stateDeco;this.stateDeco=zq(this.state);let r=t.changedRanges,i=du.extendWithRanges(r,kLe(s,this.stateDeco,t?t.changes:Go.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);Lq(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||Ob)&&(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(ioe)&&(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"?di.RTL:di.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:C,scaleY:T}=Fie(n,a);(C>.005&&Math.abs(this.scaleX-C)>.005||T>.005&&Math.abs(this.scaleY-T)>.005)&&(this.scaleX=C,this.scaleY=T,u|=16,o=c=!0)}let f=(parseInt(s.paddingTop)||0)*this.scaleY,m=(parseInt(s.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=m)&&(this.paddingTop=f,this.paddingBottom=m,u|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(r.lineWrapping&&(c=!0),this.editorWidth=t.scrollDOM.clientWidth,u|=16);let p=Hie(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=Uie(this.scrollParent||t.win);let b=(this.printing?TLe:SLe)(n,this.paddingTop),v=b.top-this.pixelViewport.top,y=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(c=!0)),!this.inView&&!this.scrollTarget&&!CLe(t.dom))return 0;let x=a.width;if((this.contentDOMWidth!=x||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=t.scrollDOM.clientHeight,u|=16),c){let C=t.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(C)&&(o=!0),o||r.lineWrapping&&Math.abs(x-this.contentDOMWidth)>r.charWidth){let{lineHeight:T,charWidth:_,textHeight:S}=t.docView.measureTextSize();o=T>0&&r.refresh(i,T,_,S,Math.max(5,x/_),C),o&&(t.docView.minWidth=0,u|=16)}v>0&&y>0?d=Math.max(v,y):v<0&&y<0&&(d=Math.min(v,y)),Lq();for(let T of this.viewports){let _=T.from==this.viewport.from?C:t.docView.measureVisibleLineHeights(T);this.heightMap=(o?Cl.empty().applyChanges(this.stateDeco,kr.empty,this.heightOracle,[new du(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new yLe(T.from,_))}Ob&&(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 OS(r.lineAt(o-s*1e3,wi.ByHeight,i,0,0).from,r.lineAt(a+(1-s)*1e3,wi.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),f=r.lineAt(u,wi.ByPos,i,0,0),m;n.y=="center"?m=(f.top+f.bottom)/2-d/2:n.y=="start"||n.y=="nearest"&&u<c.from?m=f.top:m=f.bottom-d,c=new OS(r.lineAt(m-1e3/2,wi.ByHeight,i,0,0).from,r.lineAt(m+d+1e3/2,wi.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 OS(this.heightMap.lineAt(s,wi.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,wi.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,wi.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,wi.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 K7(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!=di.LTR&&!s)return[];let a=[],c=(d,f,m,p)=>{if(f-d<i)return;let g=this.state.selection.main,b=[g.from];g.empty||b.push(g.to);for(let y of b)if(y>d&&y<f){c(d,y-10,m,p),c(y+10,f,m,p);return}let v=ALe(t,y=>y.from>=m.from&&y.to<=m.to&&Math.abs(y.from-d)<i&&Math.abs(y.to-f)<i&&!b.some(w=>y.from<w&&y.to>w));if(!v){if(f<m.to&&n&&s&&n.visibleRanges.some(x=>x.from<=f&&x.to>=f)){let x=n.moveToLineBoundary(ut.cursor(f),!1,!0).head;x>d&&(f=x)}let y=this.gapSize(m,d,f,p),w=s||y<2e6?y:2e6;v=new K7(d,f,y,w)}a.push(v)},u=d=>{if(d.length<o||d.type!=Ia.Text)return;let f=jLe(d.from,d.to,this.stateDeco);if(f.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,y;if(m!=null){let w=BS(f,m),x=((this.visibleBottom-this.visibleTop)/2+b)/d.height;v=w-x,y=w+x}else v=(this.visibleTop-d.top-b)/d.height,y=(this.visibleBottom-d.top+b)/d.height;p=$S(f,v),g=$S(f,y)}else{let b=f.total*this.heightOracle.charWidth,v=r*this.heightOracle.charWidth,y=0;if(b>2e6)for(let T of t)T.from>=d.from&&T.from<d.to&&T.size!=T.displaySize&&T.from*this.heightOracle.charWidth+y<this.pixelViewport.left&&(y=T.size-T.displaySize);let w=this.pixelViewport.left+y,x=this.pixelViewport.right+y,k,C;if(m!=null){let T=BS(f,m),_=((x-w)/2+v)/b;k=T-_,C=T+_}else k=(w-v)/b,C=(x+v)/b;p=$S(f,k),g=$S(f,C)}p>d.from&&c(d.from,p,d,f),g<d.to&&c(g,d.to,d,f)};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=BS(r,s)-BS(r,n);return this.heightOracle.lineWrapping?t.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(t){K7.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=Rn.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=[];tr.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)||qw(this.heightMap.lineAt(t,wi.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)||qw(this.heightMap.lineAt(this.scaler.fromDOM(t),wi.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 qw(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 OS{constructor(t,n){this.from=t,this.to=n}}function jLe(e,t,n){let s=[],r=e,i=0;return tr.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 $S({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 BS(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 ALe(e,t){for(let n of e)if(t(n))return n}const Bq={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function zq(e){let t=e.facet(c5).filter(s=>typeof s!="function"),n=e.facet(TD).filter(s=>typeof s!="function");return n.length&&t.push(tr.join(n)),t}class ND{constructor(t,n,s){let r=0,i=0,o=0;this.viewports=s.map(({from:a,to:c})=>{let u=n.lineAt(a,wi.ByPos,t,0,0).top,d=n.lineAt(c,wi.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 ND?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 qw(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),s=t.toDOM(e.bottom);return new Pu(e.from,e.length,n,s-n,Array.isArray(e._content)?e._content.map(r=>qw(r,t)):e._content)}const zS=yn.define({combine:e=>e.join(" ")}),oM=yn.define({combine:e=>e.indexOf(!0)>-1}),aM=ip.newName(),Eoe=ip.newName(),joe=ip.newName(),Aoe={"&light":"."+Eoe,"&dark":"."+joe};function lM(e,t,n){return new ip(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 NLe=lM("."+aM,{"&":{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"}},Aoe),MLe={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Y7=bn.ie&&bn.ie_version<=11;class ILe{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new lPe,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);(bn.ie&&bn.ie_version<=11||bn.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&&bn.android&&t.constructor.EDIT_CONTEXT!==!1&&!(bn.chrome&&bn.chrome_version<126)&&(this.editContext=new DLe(t),t.state.facet(Ph)&&(t.contentDOM.editContext=this.editContext.editContext)),Y7&&(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(Ph)?s.root.activeElement!=this.dom:!Cv(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}(bn.ie&&bn.ie_version<=11||bn.android&&bn.chrome)&&!s.state.selection.main.empty&&r.focusNode&&Ev(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=px(t.root);if(!n)return!1;let s=bn.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&RLe(this.view,n)||n;if(!s||this.selectionRange.eq(s))return!1;let r=Cv(this.dom,s);return r&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&uPe(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,MLe),Y7&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Y7&&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&&ab(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&&Cv(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 QPe(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=goe(this.view,n);return this.view.state==s&&(n.domChanged||n.newSel&&!e3(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=Fq(n,t.previousSibling||t.target.previousSibling,-1),r=Fq(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(Ph)!=t.state.facet(Ph)&&(t.view.contentDOM.editContext=t.state.facet(Ph)?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 Fq(e,t,n){for(;t;){let s=ro.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 Hq(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 Ev(o.node,o.offset,r,i)&&([n,s,r,i]=[r,i,n,s]),{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:i}}function RLe(e,t){if(t.getComposedRanges){let r=t.getComposedRanges(e.root)[0];if(r)return Hq(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?Hq(e,n):null}class DLe{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=boe(t.state.sliceDoc(a,c),s.text,(u?r.from:r.to)-a,u?"end":null);if(!d){let m=ut.single(this.toEditorPos(s.selectionStart),this.toEditorPos(s.selectionEnd));e3(m,r)||t.dispatch({selection:m,userEvent:"select"});return}let f={from:d.from+a,to:d.toA+a,insert:kr.of(s.text.slice(d.from,d.toB).split(`
`))};if((bn.mac||bn.android)&&f.from==o-1&&/^\. ?$/.test(s.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:a,to:c,insert:kr.of([s.text.replace("."," ")])}),this.pendingContextChange=f,!t.state.readOnly){let m=this.to-this.from+(f.to-f.from+f.insert.length);jD(t,f,ut.single(this.toEditorPos(s.selectionStart,m),this.toEditorPos(s.selectionEnd,m)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),f.from<f.to&&!f.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(Rn.mark({attributes:{style:d}}).range(c,u))}}}t.dispatch({effects:aoe.of(Rn.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=px(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 Vt{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||cPe(t.parent)||document,this.viewState=new $q(this,t.state||dr.create(t)),t.scrollTo&&t.scrollTo.is(DS)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(O1).map(r=>new q7(r));for(let r of this.plugins)r.update(this);this.observer=new ILe(this),this.inputState=new tLe(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Cq(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 Yo?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(_oe))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=Soe(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(dr.phrases)!=this.state.facet(dr.phrases))return this.setState(i);r=QC.create(this,i,t),r.flags|=a;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let m of t){if(f&&(f=f.map(m.changes)),m.scrollIntoView){let{main:p}=m.state.selection,{x:g,y:b}=this.state.facet(Vt.cursorScrollMargin);f=new lb(p.empty?p:ut.cursor(p.head,p.head>p.anchor?-1:1),"nearest","nearest",b,g)}for(let p of m.effects)p.is(DS)&&(f=p.value.clip(this.state))}this.viewState.update(r,f),this.bidiCache=n3.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),n=this.docView.update(r),this.state.facet(Hw)!=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(zS)!=r.state.facet(zS)&&(this.viewState.mustMeasureContent=!0),(n||s||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!r.empty)for(let m of this.state.facet(tM))try{m(r)}catch(p){Gl(this.state,p,"update listener")}(c||d)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),d&&!goe(this,d)&&u.force&&ab(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 $q(this,t),this.plugins=t.facet(O1).map(s=>new q7(s)),this.pluginMap.clear();for(let s of this.plugins)s.update(this);this.docView.destroy(),this.docView=new Cq(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(O1),s=t.state.facet(O1);if(n!=s){let r=[];for(let i of s){let o=n.indexOf(i);if(o<0)r.push(new q7(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){Gl(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(Uie(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 Gl(this.state,g),qq}}),f=QC.create(this,this.state,[]),m=!1;f.flags|=c,n?n.flags|=c:n=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),m=this.docView.update(f),m&&this.docViewUpdate());for(let p=0;p<u.length;p++)if(d[p]!=qq)try{let g=u[p];g.write&&g.write(d[p],this)}catch(g){Gl(this.state,g)}if(m&&this.docView.updateSelection(!0),!f.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(tM))a(n)}get themeClasses(){return aM+" "+(this.state.facet(oM)?joe:Eoe)+" "+this.state.facet(zS)}updateAttrs(){let t=Uq(this,loe,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Ph)?"true":"false",class:"cm-content",style:`${bn.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),Uq(this,CD,n);let s=this.observer.ignore(()=>{let r=wq(this.contentDOM,this.contentAttrs,n),i=wq(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(Vt.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(Hw);let t=this.state.facet(Vt.cspNonce);ip.mount(this.root,this.styleModules.concat(NLe).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 G7(this,t,Tq(this,t,n,s))}moveByGroup(t,n){return G7(this,t,Tq(this,t,n,s=>WPe(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 ut.cursor(i.side(n,r)+t.from,i.forward(!n,r)?1:-1)}moveToLineBoundary(t,n,s=!0){return UPe(this,t,n,s)}moveVertically(t,n,s){return G7(this,t,VPe(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=rM(this,t,n);return s&&s.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),rM(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[Dd.find(i,t-r.from,-1,n)];return gx(s,o.dir==di.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(roe)||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>PLe)return Xie(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||Yie(i.isolates,s=kq(this,t))))return i.order;s||(s=kq(this,t));let r=bPe(t.text,n,s);return this.bidiCache.push(new n3(t.from,t.to,n,s,!0,r)),r}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||bn.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{qie(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 DS.of(new lb(typeof t=="number"?ut.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 DS.of(new lb(ut.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 Oi.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return Oi.define(()=>({}),{eventObservers:t})}static theme(t,n){let s=ip.newName(),r=[zS.of(s),Hw.of(lM(`.${s}`,t))];return n&&n.dark&&r.push(oM.of(!0)),r}static baseTheme(t){return Ap.lowest(Hw.of(lM("."+aM,t,Aoe)))}static findFromDOM(t){var n;let s=t.querySelector(".cm-content"),r=s&&ro.get(s)||ro.get(t);return((n=r==null?void 0:r.root)===null||n===void 0?void 0:n.view)||null}}Vt.styleModule=Hw;Vt.inputHandler=noe;Vt.clipboardInputFilter=_D;Vt.clipboardOutputFilter=SD;Vt.scrollHandler=ooe;Vt.focusChangeEffect=soe;Vt.perLineTextDirection=roe;Vt.exceptionSink=toe;Vt.updateListener=tM;Vt.editable=Ph;Vt.mouseSelectionStyle=eoe;Vt.dragMovesSelection=Zie;Vt.clickAddsSelectionRange=Jie;Vt.decorations=c5;Vt.blockWrappers=coe;Vt.outerDecorations=TD;Vt.atomicRanges=jk;Vt.bidiIsolatedRanges=uoe;Vt.cursorScrollMargin=yn.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}}});Vt.scrollMargins=doe;Vt.darkTheme=oM;Vt.cspNonce=yn.define({combine:e=>e.length?e[0]:""});Vt.contentAttributes=CD;Vt.editorAttributes=loe;Vt.lineWrapping=Vt.contentAttributes.of({class:"cm-lineWrapping"});Vt.announce=Ss.define();const PLe=4096,qq={};class n3{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:di.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 n3(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return s}}function Uq(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&&vD(o,n)}return n}const LLe=bn.mac?"mac":bn.windows?"win":bn.linux?"linux":"key";function OLe(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 FS(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 $Le=Ap.default(Vt.domEventHandlers({keydown(e,t){return Moe(Noe(t.state),e,t,"editor")}})),$b=yn.define({enables:$Le}),Wq=new WeakMap;function Noe(e){let t=e.facet($b),n=Wq.get(t);return n||Wq.set(t,n=FLe(t.reduce((s,r)=>s.concat(r),[]))),n}function BLe(e,t,n){return Moe(Noe(e.state),t,e,n)}let im=null;const zLe=4e3;function FLe(e,t=LLe){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 f,m;let p=n[o]||(n[o]=Object.create(null)),g=a.split(/ (?!$)/).map(y=>OLe(y,t));for(let y=1;y<g.length;y++){let w=g.slice(0,y).join(" ");r(w,!0),p[w]||(p[w]={preventDefault:!0,stopPropagation:!1,run:[x=>{let k=im={view:x,prefix:w,scope:o};return setTimeout(()=>{im==k&&(im=null)},zLe),!0}]})}let b=g.join(" ");r(b,!1);let v=p[b]||(p[b]={preventDefault:!1,stopPropagation:!1,run:((m=(f=p._any)===null||f===void 0?void 0:f.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:f}=o;for(let m in d)d[m].run.push(p=>f(p,cM))}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 cM=null;function Moe(e,t,n,s){cM=t;let r=nPe(t),i=Ul(r,0),o=Ed(i)==r.length&&r!=" ",a="",c=!1,u=!1,d=!1;im&&im.view==n&&im.scope==s&&(a=im.prefix+" ",woe.indexOf(t.keyCode)<0&&(u=!0,im=null));let f=new Set,m=v=>{if(v){for(let y of v.run)if(!f.has(y)&&(f.add(y),y(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+FS(r,t,!o)])?c=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(bn.windows&&t.ctrlKey&&t.altKey)&&!(bn.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(g=op[t.keyCode])&&g!=r?(m(p[a+FS(g,t,!0)])||t.shiftKey&&(b=fx[t.keyCode])!=r&&b!=g&&m(p[a+FS(b,t,!1)]))&&(c=!0):o&&t.shiftKey&&m(p[a+FS(r,t,!0)])&&(c=!0),!c&&m(p._any)&&(c=!0)),u&&(c=!0),c&&d&&t.stopPropagation(),cM=null,c}class I0{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=Ioe(t);return[new I0(n,r.left-i.left,r.top-i.top,null,r.bottom-r.top)]}else return HLe(t,n,s)}}function Ioe(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==di.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function Vq(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 HLe(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==di.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),c=Ioe(e),u=o.querySelector(".cm-line"),d=u&&window.getComputedStyle(u),f=a.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),m=a.right-(d?parseInt(d.paddingRight):0),p=sM(e,s,1),g=sM(e,r,-1),b=p.type==Ia.Text?p:null,v=g.type==Ia.Text?g:null;if(b&&(e.lineWrapping||p.widgetLineBreaks)&&(b=Vq(e,s,1,b)),v&&(e.lineWrapping||g.widgetLineBreaks)&&(v=Vq(e,r,-1,v)),b&&v&&b.from==v.from&&b.to==v.to)return w(x(n.from,n.to,b));{let C=b?x(n.from,null,b):k(p,!1),T=v?x(null,n.to,v):k(g,!0),_=[];return(b||p).to<(v||g).from-(b&&v?1:0)||p.widgetLineBreaks>1&&C.bottom+e.defaultLineHeight/2<T.top?_.push(y(f,C.bottom,m,T.top)):C.bottom<T.top&&e.elementAtHeight((C.bottom+T.top)/2).type==Ia.Text&&(C.bottom=T.top=(C.bottom+T.top)/2),w(C).concat(_).concat(w(T))}function y(C,T,_,S){return new I0(t,C-c.left,T-c.top,Math.max(0,_-C),S-T)}function w({top:C,bottom:T,horizontal:_}){let S=[];for(let R=0;R<_.length;R+=2)S.push(y(_[R],C,_[R+1],T));return S}function x(C,T,_){let S=1e9,R=-1e9,A=[];function O($,z,B,j,H){let Q=e.coordsAtPos($,$==_.to?-2:2),I=e.coordsAtPos(B,B==_.from?2:-2);!Q||!I||(S=Math.min(Q.top,I.top,S),R=Math.max(Q.bottom,I.bottom,R),H==di.LTR?A.push(i&&z?f:Q.left,i&&j?m:I.right):A.push(!i&&j?f:I.left,!i&&z?m:Q.right))}let M=C??_.from,D=T??_.to;for(let $ of e.visibleRanges)if($.to>M&&$.from<D)for(let z=Math.max($.from,M),B=Math.min($.to,D);;){let j=e.state.doc.lineAt(z);for(let H of e.bidiSpans(j)){let Q=H.from+j.from,I=H.to+j.from;if(Q>=B)break;I>z&&O(Math.max(Q,z),C==null&&Q<=M,Math.min(I,B),T==null&&I>=D,H.dir)}if(z=j.to+1,z>=B)break}return A.length==0&&O(M,C==null,D,T==null,e.textDirection),{top:S,bottom:R,horizontal:A}}function k(C,T){let _=a.top+(T?C.top:C.bottom);return{top:_,bottom:_,horizontal:[]}}}function qLe(e,t){return e.constructor==t.constructor&&e.eq(t)}class ULe{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(i4)!=t.state.facet(i4)&&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(i4);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)=>!qLe(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,bn.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const i4=yn.define();function Roe(e){return[Oi.define(t=>new ULe(t,e)),i4.of(e)]}const Bb=yn.define({combine(e){return th(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function Doe(e={}){return[Bb.of(e),WLe,VLe,GLe,ioe.of(!0)]}function Poe(e){return e.startState.facet(Bb)!=e.state.facet(Bb)}const WLe=Roe({above:!0,markers(e){let{state:t}=e,n=t.facet(Bb),s=[];for(let r of t.selection.ranges){let i=r==t.selection.main;if(r.empty||n.drawRangeCursor&&!(i&&bn.ios&&n.iosSelectionHandles)){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=r.empty?r:ut.cursor(r.head,r.assoc);for(let c of I0.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=Poe(e);return n&&Gq(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){Gq(t.state,e)},class:"cm-cursorLayer"});function Gq(e,t){t.style.animationDuration=e.facet(Bb).cursorBlinkRate+"ms"}const VLe=Roe({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 I0.forRange(e,"cm-selectionBackground",r))t.push(i);if(bn.ios&&!n.empty&&e.state.facet(Bb).iosSelectionHandles){for(let r of I0.forRange(e,"cm-selectionHandle cm-selectionHandle-start",ut.cursor(n.from,1)))t.push(r);for(let r of I0.forRange(e,"cm-selectionHandle cm-selectionHandle-end",ut.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||Poe(e)},class:"cm-selectionLayer"}),GLe=Ap.highest(Vt.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"}}}})),Loe=Ss.define({map(e,t){return e==null?null:t.mapPos(e)}}),Uw=Da.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((n,s)=>s.is(Loe)?s.value:n,e)}}),KLe=Oi.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(Uw);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(Uw)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(Uw),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(Uw)!=e&&this.view.dispatch({effects:Loe.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 YLe(){return[Uw,KLe]}function Kq(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 XLe(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 QLe{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 f=s(a,c,u);f&&d(u,u+a[0].length,f)};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 Wd,s=n.add.bind(n);for(let{from:r,to:i}of XLe(t,this.maxLength))Kq(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),f=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])){f=a;break}}let m=[],p,g=(b,v,y)=>m.push(y.range(b,v));if(c==u)for(this.regexp.lastIndex=d-c.from;(p=this.regexp.exec(c.text))&&p.index<f-c.from;)this.addMatch(p,t,p.index+c.from,g);else Kq(t.state.doc,this.regexp,d,f,(b,v)=>this.addMatch(v,t,b,g));n=n.update({filterFrom:d,filterTo:f,filter:(b,v)=>b<d||v>f,add:m})}}return n}}const uM=/x/.unicode!=null?"gu":"g",JLe=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,uM),ZLe={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 X7=null;function eOe(){var e;if(X7==null&&typeof document<"u"&&document.body){let t=document.body.style;X7=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return X7||!1}const o4=yn.define({combine(e){let t=th(e,{render:null,specialChars:JLe,addSpecialChars:null});return(t.replaceTabs=!eOe())&&(t.specialChars=new RegExp("	|"+t.specialChars.source,uM)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,uM)),t}});function Ooe(e={}){return[o4.of(e),tOe()]}let Yq=null;function tOe(){return Yq||(Yq=Oi.fromClass(class{constructor(e){this.view=e,this.decorations=Rn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(o4)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new QLe({regexp:e.specialChars,decoration:(t,n,s)=>{let{doc:r}=n.state,i=Ul(t[0],0);if(i==9){let o=r.lineAt(s),a=n.state.tabSize,c=yy(o.text,a,s-o.from);return Rn.replace({widget:new iOe((a-c%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=Rn.replace({widget:new rOe(e,i)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(o4);e.startState.facet(o4)!=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 nOe="•";function sOe(e){return e>=32?nOe:e==10?"␤":String.fromCharCode(9216+e)}class rOe extends zc{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=sOe(this.code),s=t.state.phrase("Control character")+" "+(ZLe[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 iOe extends zc{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 oOe(){return lOe}const aOe=Rn.line({class:"cm-activeLine"}),lOe=Oi.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(aOe.range(r.from)),t=r.from)}return Rn.set(n)}},{decorations:e=>e.decorations});class cOe extends zc{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?Tv(t.firstChild):[];if(!n.length)return null;let s=window.getComputedStyle(t.parentNode),r=gx(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 Xq(e){let t=Oi.fromClass(class{constructor(n){this.view=n,this.placeholder=e?Rn.set([Rn.widget({widget:new cOe(e),side:1}).range(0)]):Rn.none}get decorations(){return this.view.state.doc.length?Rn.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,Vt.contentAttributes.of({"aria-placeholder":e})]:t}const dM=2e3;function uOe(e,t,n){let s=Math.min(t.line,n.line),r=Math.max(t.line,n.line),i=[];if(t.off>dM||n.off>dM||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(ut.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=UN(u.text,o,e.tabSize,!0);if(d<0)i.push(ut.cursor(u.to));else{let f=UN(u.text,a,e.tabSize);i.push(ut.range(u.from+d,u.from+f))}}}return i}function dOe(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function Qq(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>dM?-1:r==s.length?dOe(e,t.clientX):yy(s.text,e.state.tabSize,n-s.from);return{line:s.number,col:i,off:r}}function hOe(e,t){let n=Qq(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=Qq(e,r);if(!a)return s;let c=uOe(e.state,n,a);return c.length?o?ut.create(c.concat(s.ranges)):ut.create(c):s}}:null}function fOe(e){let t=n=>n.altKey&&n.button==0;return Vt.mouseSelectionStyle.of((n,s)=>t(s)?hOe(n,s):null)}const mOe={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},pOe={style:"cursor: crosshair"};function gOe(e={}){let[t,n]=mOe[e.key||"Alt"],s=Oi.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,Vt.contentAttributes.of(r=>{var i;return!((i=r.plugin(s))===null||i===void 0)&&i.isDown?pOe:null})]}const HS="-10000px";class $oe{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 f=0;f<this.tooltips.length;f++){let m=this.tooltips[f];m&&m.create==u.create&&(d=f)}if(d<0)o[c]=this.createTooltipView(u,c?o[c-1]:null),a&&(a[c]=!!u.above);else{let f=o[c]=this.tooltipViews[d];a&&(a[c]=n[d]),f.update&&f.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 bOe(e={}){return a4.of(e)}function yOe(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const a4=yn.define({combine:e=>{var t,n,s;return{position:bn.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)||yOe}}}),Jq=new WeakMap,MD=Oi.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(a4);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 $oe(e,ID,(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(a4);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=HS,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(bn.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=ED(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(a4).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,f=e.pos[a],m=e.size[a];if(!f||c.clip!==!1&&(f.bottom<=Math.max(n.top,s.top)||f.top>=Math.min(n.bottom,s.bottom)||f.right<Math.max(n.left,s.left)-.1||f.left>Math.min(n.right,s.right)+.1)){d.style.top=HS;continue}let p=c.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,g=p?7:0,b=m.right-m.left,v=(t=Jq.get(u))!==null&&t!==void 0?t:m.bottom-m.top,y=u.offset||vOe,w=this.view.textDirection==di.LTR,x=m.width>s.right-s.left?w?s.left:s.right-m.width:w?Math.max(s.left,Math.min(f.left-(p?14:0)+y.x,s.right-b)):Math.min(Math.max(s.left,f.left-b+(p?14:0)-y.x),s.right-b),k=this.above[a];!c.strictSide&&(k?f.top-v-g-y.y<s.top:f.bottom+v+g+y.y>s.bottom)&&k==s.bottom-f.bottom>f.top-s.top&&(k=this.above[a]=!k);let C=(k?f.top-s.top:s.bottom-f.bottom)-g;if(C<v&&u.resize!==!1){if(C<this.view.defaultLineHeight){d.style.top=HS;continue}Jq.set(u,v),d.style.height=(v=C)/i+"px"}else d.style.height&&(d.style.height="");let T=k?f.top-v-g-y.y:f.bottom+g+y.y,_=x+b;if(u.overlap!==!0)for(let S of o)S.left<_&&S.right>x&&S.top<T+v&&S.bottom>T&&(T=k?S.top-v-2-g:S.bottom+g+2);if(this.position=="absolute"?(d.style.top=(T-e.parent.top)/i+"px",Zq(d,(x-e.parent.left)/r)):(d.style.top=T/i+"px",Zq(d,x/r)),p){let S=f.left+(w?y.x:-y.x)-(x+14-7);p.style.left=S/r+"px"}u.overlap!==!0&&o.push({left:x,top:T,right:_,bottom:T+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=HS}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Zq(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const wOe=Vt.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"}}}),vOe={x:0,y:0},ID=yn.define({enables:[MD,wOe]}),s3=yn.define({combine:e=>e.reduce((t,n)=>t.concat(n),[])});class f5{static create(t){return new f5(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new $oe(t,s3,(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 xOe=ID.compute([s3],e=>{let t=e.facet(s3);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:f5.create,above:t[0].above,arrow:t.some(n=>n.arrow)}}),Boe=yn.define();class kOe{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==di.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=>Gl(t.state,c,"hover tooltip"))}else o(i)}get tooltip(){let t=this.view.plugin(MD),n=t?t.manager.tooltips.findIndex(s=>s.create==f5.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&&!_Oe(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:!SOe(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 qS=4;function _Oe(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-qS&&t.clientX<=s+qS&&t.clientY>=r-qS&&t.clientY<=i+qS}function SOe(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 COe(e,t={}){let n=Ss.define(),s=new WeakMap,r=Da.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 f=a.changes.mapPos(d.pos,-1,gl.TrackDel);if(f!=null){let m=Object.assign(Object.create(null),d);m.pos=f,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(EOe)&&!u.value||u.value==r)&&(o=[]);return o.length&&c&&s.set(o,c),o},provide:o=>s3.from(o)});const i=Oi.define(o=>new kOe(o,e,r,s,n,t.hoverTime||300));return{active:r,extension:[r,i,Boe.of(i),xOe]}}function TOe(e,t,n,s={}){var r;let i=e.state.facet(Boe).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 zoe(e,t){let n=e.plugin(MD);if(!n)return null;let s=n.manager.tooltips.indexOf(t);return s<0?null:n.manager.tooltipViews[s]}const EOe=Ss.define(),eU=yn.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 RD(e,t){let n=e.plugin(Foe),s=n?n.specs.indexOf(t):-1;return s>-1?n.panels[s]:null}const Foe=Oi.fromClass(class{constructor(e){this.input=e.state.facet(yx),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(e));let t=e.state.facet(eU);this.top=new US(e,!0,t.topContainer),this.bottom=new US(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(eU);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new US(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new US(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(yx);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=>Vt.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class US{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=tU(t);t=t.nextSibling}else this.dom.insertBefore(n.dom,t);for(;t;)t=tU(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 tU(e){let t=e.nextSibling;return e.remove(),t}const yx=yn.define({enables:Foe});function jOe(e,t){let n,s=new Promise(o=>n=o),r=o=>AOe(o,t,n);e.state.field(Q7,!1)?e.dispatch({effects:Hoe.of(r)}):e.dispatch({effects:Ss.appendConfig.of(Q7.init(()=>[r]))});let i=qoe.of(r);return{close:i,result:s.then(o=>((e.win.queueMicrotask||(c=>e.win.setTimeout(c,10)))(()=>{e.state.field(Q7).indexOf(r)>-1&&e.dispatch({effects:i})}),o))}}const Q7=Da.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(Hoe)?e=[n.value].concat(e):n.is(qoe)&&(e=e.filter(s=>s!=n.value));return e},provide:e=>yx.computeN([e],t=>t.field(e))}),Hoe=Ss.define(),qoe=Ss.define();function AOe(e,t,n){let s=t.content?t.content(e,()=>o(null)):null;if(!s){if(s=Jr("form"),t.input){let a=Jr("input",t.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),s.appendChild(Jr("label",(t.label||"")+": ",a))}else s.appendChild(document.createTextNode(t.label||""));s.appendChild(document.createTextNode(" ")),s.appendChild(Jr("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=Jr("div",s,Jr("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 bf extends rp{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}bf.prototype.elementClass="";bf.prototype.toDOM=void 0;bf.prototype.mapMode=gl.TrackBefore;bf.prototype.startSide=bf.prototype.endSide=-1;bf.prototype.point=!0;const l4=yn.define(),NOe=yn.define(),MOe={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>tr.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Av=yn.define();function IOe(e){return[Uoe(),Av.of({...MOe,...e})]}const nU=yn.define({combine:e=>e.some(t=>t)});function Uoe(e){return[ROe]}const ROe=Oi.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(Av).map(t=>new rU(e,t)),this.fixed=!e.state.facet(nU);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(nU)!=!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=tr.iter(this.view.state.facet(l4),this.view.viewport.from),s=[],r=this.gutters.map(i=>new DOe(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==Ia.Text&&o){hM(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==Ia.Text){hM(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(Av),n=e.state.facet(Av),s=e.docChanged||e.heightChanged||e.viewportChanged||!tr.eq(e.startState.facet(l4),e.state.facet(l4),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 rU(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=>Vt.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==di.LTR?{left:s,right:r}:{right:s,left:r}})});function sU(e){return Array.isArray(e)?e:[e]}function hM(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class DOe{constructor(t,n,s){this.gutter=t,this.height=s,this.i=0,this.cursor=tr.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 Woe(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=[];hM(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(NOe)){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 rU{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=sU(n.markers(t)),n.initialSpacer&&(this.spacer=new Woe(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=sU(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!tr.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 Woe{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":""),POe(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 f=o;f<this.markers.length;f++)if(this.markers[f].compare(c)){a=f,u=!0;break}}else a=this.markers.length;for(;o<a;){let d=this.markers[o++];if(d.toDOM){d.destroy(r);let f=r.nextSibling;r.remove(),r=f}}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 POe(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 LOe=yn.define(),OOe=yn.define(),$1=yn.define({combine(e){return th(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 J7 extends bf{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function Z7(e,t){return e.state.facet($1).formatNumber(t,e.state)}const $Oe=Av.compute([$1],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(LOe)},lineMarker(t,n,s){return s.some(r=>r.toDOM)?null:new J7(Z7(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,s)=>{for(let r of t.state.facet(OOe)){let i=r(t,n,s);if(i)return i}return null},lineMarkerChange:t=>t.startState.facet($1)!=t.state.facet($1),initialSpacer(t){return new J7(Z7(t,iU(t.state.doc.lines)))},updateSpacer(t,n){let s=Z7(n.view,iU(n.view.state.doc.lines));return s==t.number?t:new J7(s)},domEventHandlers:e.facet($1).domEventHandlers,side:"before"}));function BOe(e={}){return[$1.of(e),Uoe(),$Oe]}function iU(e){let t=9;for(;t<e;)t=t*10+9;return t}const zOe=new class extends bf{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},FOe=l4.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(zOe.range(r)))}return tr.of(t)});function HOe(){return FOe}const qOe=1024;let UOe=0;class eE{constructor(t,n){this.from=t,this.to=n}}class mr{constructor(t={}){this.id=UOe++,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=xu.match(t)),n=>{let s=t(n);return s===void 0?null:[this,s]}}}mr.closedBy=new mr({deserialize:e=>e.split(" ")});mr.openedBy=new mr({deserialize:e=>e.split(" ")});mr.group=new mr({deserialize:e=>e.split(" ")});mr.isolate=new mr({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});mr.contextHash=new mr({perNode:!0});mr.lookAhead=new mr({perNode:!0});mr.mounted=new mr({perNode:!0});class Nv{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[mr.mounted.id]}}const WOe=Object.create(null);class xu{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):WOe,s=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),r=new xu(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(mr.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(mr.group),i=-1;i<(r?r.length:0);i++){let o=n[i<0?s.name:r[i]];if(o)return o}}}}xu.none=new xu("",Object.create(null),0,8);const WS=new WeakMap,oU=new WeakMap;var mo;(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"})(mo||(mo={}));class Na{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=Nv.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 mM(this.topNode,t)}cursorAt(t,n=0,s=0){let r=WS.get(this)||this.topNode,i=new mM(r);return i.moveTo(t,n),WS.set(this,i._tree),i}get topNode(){return new cp(this,0,0,null)}resolve(t,n=0){let s=wx(WS.get(this)||this.topNode,t,n,!1);return WS.set(this,s),s}resolveInner(t,n=0){let s=wx(oU.get(this)||this.topNode,t,n,!0);return oU.set(this,s),s}resolveStack(t,n=0){return KOe(this,t,n)}iterate(t){let{enter:n,leave:s,from:r=0,to:i=this.length}=t,o=t.mode||0,a=(o&mo.IncludeAnonymous)>0;for(let c=this.cursor(o|mo.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:LD(xu.none,this.children,this.positions,0,this.children.length,0,this.length,(n,s,r)=>new Na(this.type,n,s,r,this.propValues),t.makeTree||((n,s,r)=>new Na(xu.none,n,s,r)))}static build(t){return YOe(t)}}Na.empty=new Na(xu.none,[],[],0);class DD{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 DD(this.buffer,this.index)}}class lp{constructor(t,n,s){this.buffer=t,this.length=n,this.set=s}get type(){return xu.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&&!(Voe(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 lp(i,o,this.set)}}function Voe(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 wx(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 cp&&e.index<0?null:e.parent;if(!o)return e;e=o}let i=s?0:mo.IgnoreOverlays;if(s)for(let o=e,a=o.parent;a;o=a,a=o.parent)o instanceof cp&&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 Goe{cursor(t=0){return new mM(this,t)}getChild(t,n=null,s=null){let r=aU(this,t,n,s);return r.length?r[0]:null}getChildren(t,n=null,s=null){return aU(this,t,n,s)}resolve(t,n=0){return wx(this,t,n,!1)}resolveInner(t,n=0){return wx(this,t,n,!0)}matchContext(t){return fM(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 cp=class c4 extends Goe{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],f=c[t]+o.from,m;if(!(!(i&mo.EnterBracketed&&d instanceof Na&&(m=Nv.get(d))&&!m.overlay&&m.bracketed&&s>=f&&s<=f+d.length)&&!Voe(r,s,f,f+d.length))){if(d instanceof lp){if(i&mo.ExcludeBuffers)continue;let p=d.findChild(0,d.buffer.length,n,s-f,r);if(p>-1)return new bm(new VOe(o,d,t,f),null,p)}else if(i&mo.IncludeAnonymous||!d.type.isAnonymous||PD(d)){let p;if(!(i&mo.IgnoreMounts)&&(p=Nv.get(d))&&!p.overlay)return new c4(p.tree,f,t,o);let g=new c4(d,f,t,o);return i&mo.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?d.children.length-1:0,n,s,r,i)}}}if(i&mo.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&mo.IgnoreOverlays)&&(r=Nv.get(this._tree))&&r.overlay){let i=t-this.from,o=s&mo.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 c4(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 aU(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 fM(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 VOe{constructor(t,n,s,r){this.parent=t,this.buffer=n,this.index=s,this.start=r}}class bm extends Goe{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 bm(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&mo.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 bm(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 bm(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 bm(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 Na(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Koe(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 cp&&n.index<0?null:n.parent,r=e.slice();return s?r[t]=s:r.splice(t,1),new GOe(r,n)}class GOe{constructor(t,n){this.heads=t,this.node=n}get next(){return Koe(this.heads)}}function KOe(e,t,n){let s=e.resolveInner(t,n),r=null;for(let i=s instanceof cp?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=Nv.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new cp(o.tree,o.overlay[0].from+i.from,-1,i);(r||(r=[s])).push(wx(a,t,n,!1))}}return r?Koe(r):s}class mM{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&~mo.EnterBracketed,t instanceof cp)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 cp?(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&mo.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,s))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.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&mo.IncludeAnonymous||a instanceof lp||!a.type.isAnonymous||PD(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 bm(this.buffer,n,this.stack[r]);return this.bufferNode=new bm(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 fM(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 fM(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 PD(e){return e.children.some(t=>t instanceof lp||!t.type.isAnonymous||PD(t))}function YOe(e){var t;let{buffer:n,nodeSet:s,maxBufferLength:r=qOe,reused:i=[],minRepeatType:o=s.types.length}=e,a=Array.isArray(n)?new DD(n,n.length):n,c=s.types,u=0,d=0;function f(C,T,_,S,R,A){let{id:O,start:M,end:D,size:$}=a,z=d,B=u;if($<0)if(a.next(),$==-1){let J=i[O];_.push(J),S.push(M-C);return}else if($==-3){u=O;return}else if($==-4){d=O;return}else throw new RangeError(`Unrecognized record size: ${$}`);let j=c[O],H,Q,I=M-C;if(D-M<=r&&(Q=v(a.pos-T,R))){let J=new Uint16Array(Q.size-Q.skip),W=a.pos-Q.size,P=J.length;for(;a.pos>W;)P=y(Q.start,J,P);H=new lp(J,D-Q.start,s),I=Q.start-C}else{let J=a.pos-$;a.next();let W=[],P=[],V=O>=o?O:-1,ee=0,q=D;for(;a.pos>J;)V>=0&&a.id==V&&a.size>=0?(a.end<=q-r&&(g(W,P,M,ee,a.end,q,V,z,B),ee=W.length,q=a.end),a.next()):A>2500?m(M,J,W,P):f(M,J,W,P,V,A+1);if(V>=0&&ee>0&&ee<W.length&&g(W,P,M,ee,M,q,V,z,B),W.reverse(),P.reverse(),V>-1&&ee>0){let K=p(j,B);H=LD(j,W,P,0,W.length,0,D-M,K,K)}else H=b(j,W,P,D-M,z-D,B)}_.push(H),S.push(I)}function m(C,T,_,S){let R=[],A=0,O=-1;for(;a.pos>T;){let{id:M,start:D,end:$,size:z}=a;if(z>4)a.next();else{if(O>-1&&D<O)break;O<0&&(O=$-r),R.push(M,D,$),A++,a.next()}}if(A){let M=new Uint16Array(A*4),D=R[R.length-2];for(let $=R.length-3,z=0;$>=0;$-=3)M[z++]=R[$],M[z++]=R[$+1]-D,M[z++]=R[$+2]-D,M[z++]=z;_.push(new lp(M,R[2]-D,s)),S.push(D-C)}}function p(C,T){return(_,S,R)=>{let A=0,O=_.length-1,M,D;if(O>=0&&(M=_[O])instanceof Na){if(!O&&M.type==C&&M.length==R)return M;(D=M.prop(mr.lookAhead))&&(A=S[O]+M.length+D)}return b(C,_,S,R,A,T)}}function g(C,T,_,S,R,A,O,M,D){let $=[],z=[];for(;C.length>S;)$.push(C.pop()),z.push(T.pop()+_-R);C.push(b(s.types[O],$,z,A-R,M-A,D)),T.push(R-_)}function b(C,T,_,S,R,A,O){if(A){let M=[mr.contextHash,A];O=O?[M].concat(O):[M]}if(R>25){let M=[mr.lookAhead,R];O=O?[M].concat(O):[M]}return new Na(C,T,_,S,O)}function v(C,T){let _=a.fork(),S=0,R=0,A=0,O=_.end-r,M={size:0,start:0,skip:0};e:for(let D=_.pos-C;_.pos>D;){let $=_.size;if(_.id==T&&$>=0){M.size=S,M.start=R,M.skip=A,A+=4,S+=4,_.next();continue}let z=_.pos-$;if($<0||z<D||_.start<O)break;let B=_.id>=o?4:0,j=_.start;for(_.next();_.pos>z;){if(_.size<0)if(_.size==-3||_.size==-4)B+=4;else break e;else _.id>=o&&(B+=4);_.next()}R=j,S+=$,A+=B}return(T<0||S==C)&&(M.size=S,M.start=R,M.skip=A),M.size>4?M:void 0}function y(C,T,_){let{id:S,start:R,end:A,size:O}=a;if(a.next(),O>=0&&S<o){let M=_;if(O>4){let D=a.pos-(O-4);for(;a.pos>D;)_=y(C,T,_)}T[--_]=M,T[--_]=A-C,T[--_]=R-C,T[--_]=S}else O==-3?u=S:O==-4&&(d=S);return _}let w=[],x=[];for(;a.pos>0;)f(e.start||0,e.bufferStart||0,w,x,-1,0);let k=(t=e.length)!==null&&t!==void 0?t:w.length?x[0]+w[0].length:0;return new Na(c[e.topID],w.reverse(),x.reverse(),k)}const lU=new WeakMap;function u4(e,t){if(!e.isAnonymous||t instanceof lp||t.type!=e)return 1;let n=lU.get(t);if(n==null){n=1;for(let s of t.children){if(s.type!=e||!(s instanceof Na)){n=1;break}n+=u4(e,s)}lU.set(t,n)}return n}function LD(e,t,n,s,r,i,o,a,c){let u=0;for(let g=s;g<r;g++)u+=u4(e,t[g]);let d=Math.ceil(u*1.5/8),f=[],m=[];function p(g,b,v,y,w){for(let x=v;x<y;){let k=x,C=b[x],T=u4(e,g[x]);for(x++;x<y;x++){let _=u4(e,g[x]);if(T+_>=d)break;T+=_}if(x==k+1){if(T>d){let _=g[k];p(_.children,_.positions,0,_.children.length,b[k]+w);continue}f.push(g[k])}else{let _=b[x-1]+g[x-1].length-C;f.push(LD(e,g,b,k,x,C,_,null,c))}m.push(C+w-i)}}return p(t,n,s,r,0),(a||c)(f,m,o)}class R0{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 R0(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,f=d?d.fromA:1e9;if(f-c>=s)for(;o&&o.from<f;){let m=o;if(c>=m.from||f<=m.to||u){let p=Math.max(m.from,c)-u,g=Math.min(m.to,f)-u;m=p>=g?null:new R0(p,g,m.tree,m.offset+u,a>0,!!d)}if(m&&r.push(m),o.to>f)break;o=i<t.length?t[i++]:null}if(!d)break;c=d.toA,u=d.toA-d.toB}return r}}class XOe{startParse(t,n,s){return typeof t=="string"&&(t=new QOe(t)),s=s?s.length?s.map(r=>new eE(r.from,r.to)):[new eE(0,0)]:[new eE(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 QOe{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 mr({perNode:!0});let JOe=0;class iu{constructor(t,n,s,r){this.name=t,this.set=n,this.base=s,this.modified=r,this.id=JOe++}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 iu&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let r=new iu(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 r3(t);return s=>s.modified.indexOf(n)>-1?s:r3.get(s.base||s,s.modified.concat(n).sort((r,i)=>r.id-i.id))}}let ZOe=0;class r3{constructor(t){this.name=t,this.instances=[],this.id=ZOe++}static get(t,n){if(!n.length)return t;let s=n[0].instances.find(a=>a.base==t&&e$e(n,a.modified));if(s)return s;let r=[],i=new iu(t.name,r,t,n);for(let a of n)a.instances.push(i);let o=t$e(n);for(let a of t.set)if(!a.modified.length)for(let c of o)r.push(r3.get(a,c));return i}}function e$e(e,t){return e.length==t.length&&e.every((n,s)=>n==t[s])}function t$e(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 n$e(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 f=0;;){if(a=="..."&&f>0&&f+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]),f+=m[0].length,f==r.length)break;let p=r[f++];if(f==r.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+r);a=r.slice(f)}let c=i.length-1,u=i[c];if(!u)throw new RangeError("Invalid path: "+r);let d=new vx(s,o,c>0?i.slice(0,c):null);t[u]=d.sort(t[u])}}return Yoe.add(t)}const Yoe=new mr({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 vx(r.tags,r.mode,r.context);n?n.next=i:s=i,n=i}return s}});class vx{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}}vx.empty=new vx([],2,null);function Xoe(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 s$e(e,t){let n=null;for(let s of e){let r=s.style(t);r&&(n=n?n+" "+r:r)}return n}function r$e(e,t,n,s=0,r=e.length){let i=new i$e(s,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),s,r,"",i.highlighters),i.flush(r)}class i$e{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=o$e(t)||vx.empty,f=s$e(i,d.tags);if(f&&(u&&(u+=" "),u+=f,d.mode==1&&(r+=(r?" ":"")+f)),this.startSpan(Math.max(n,a),u),d.opaque)return;let m=t.tree&&t.tree.prop(mr.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,y=a;;v++){let w=v<m.overlay.length?m.overlay[v]:null,x=w?w.from+a:c,k=Math.max(n,y),C=Math.min(s,x);if(k<C&&b)for(;t.from<C&&(this.highlightRange(t,k,C,r,i),this.startSpan(Math.min(C,t.to),u),!(t.to>=x||!t.nextSibling())););if(!w||x>s)break;y=w.to+a,y>n&&(this.highlightRange(p.cursor(),Math.max(n,w.from+a),Math.min(s,y),"",g),this.startSpan(Math.min(s,y),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 o$e(e){let t=e.type.prop(Yoe);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const an=iu.define,VS=an(),Jf=an(),cU=an(Jf),uU=an(Jf),Zf=an(),GS=an(Zf),tE=an(Zf),wd=an(),Jp=an(wd),fd=an(),md=an(),pM=an(),gw=an(pM),KS=an(),hn={comment:VS,lineComment:an(VS),blockComment:an(VS),docComment:an(VS),name:Jf,variableName:an(Jf),typeName:cU,tagName:an(cU),propertyName:uU,attributeName:an(uU),className:an(Jf),labelName:an(Jf),namespace:an(Jf),macroName:an(Jf),literal:Zf,string:GS,docString:an(GS),character:an(GS),attributeValue:an(GS),number:tE,integer:an(tE),float:an(tE),bool:an(Zf),regexp:an(Zf),escape:an(Zf),color:an(Zf),url:an(Zf),keyword:fd,self:an(fd),null:an(fd),atom:an(fd),unit:an(fd),modifier:an(fd),operatorKeyword:an(fd),controlKeyword:an(fd),definitionKeyword:an(fd),moduleKeyword:an(fd),operator:md,derefOperator:an(md),arithmeticOperator:an(md),logicOperator:an(md),bitwiseOperator:an(md),compareOperator:an(md),updateOperator:an(md),definitionOperator:an(md),typeOperator:an(md),controlOperator:an(md),punctuation:pM,separator:an(pM),bracket:gw,angleBracket:an(gw),squareBracket:an(gw),paren:an(gw),brace:an(gw),content:wd,heading:Jp,heading1:an(Jp),heading2:an(Jp),heading3:an(Jp),heading4:an(Jp),heading5:an(Jp),heading6:an(Jp),contentSeparator:an(wd),list:an(wd),quote:an(wd),emphasis:an(wd),strong:an(wd),link:an(wd),monospace:an(wd),strikethrough:an(wd),inserted:an(),deleted:an(),changed:an(),invalid:an(),meta:KS,documentMeta:an(KS),annotation:an(KS),processingInstruction:an(KS),definition:iu.defineModifier("definition"),constant:iu.defineModifier("constant"),function:iu.defineModifier("function"),standard:iu.defineModifier("standard"),local:iu.defineModifier("local"),special:iu.defineModifier("special")};for(let e in hn){let t=hn[e];t instanceof iu&&(t.name=e)}Xoe([{tag:hn.link,class:"tok-link"},{tag:hn.heading,class:"tok-heading"},{tag:hn.emphasis,class:"tok-emphasis"},{tag:hn.strong,class:"tok-strong"},{tag:hn.keyword,class:"tok-keyword"},{tag:hn.atom,class:"tok-atom"},{tag:hn.bool,class:"tok-bool"},{tag:hn.url,class:"tok-url"},{tag:hn.labelName,class:"tok-labelName"},{tag:hn.inserted,class:"tok-inserted"},{tag:hn.deleted,class:"tok-deleted"},{tag:hn.literal,class:"tok-literal"},{tag:hn.string,class:"tok-string"},{tag:hn.number,class:"tok-number"},{tag:[hn.regexp,hn.escape,hn.special(hn.string)],class:"tok-string2"},{tag:hn.variableName,class:"tok-variableName"},{tag:hn.local(hn.variableName),class:"tok-variableName tok-local"},{tag:hn.definition(hn.variableName),class:"tok-variableName tok-definition"},{tag:hn.special(hn.variableName),class:"tok-variableName2"},{tag:hn.definition(hn.propertyName),class:"tok-propertyName tok-definition"},{tag:hn.typeName,class:"tok-typeName"},{tag:hn.namespace,class:"tok-namespace"},{tag:hn.className,class:"tok-className"},{tag:hn.macroName,class:"tok-macroName"},{tag:hn.propertyName,class:"tok-propertyName"},{tag:hn.operator,class:"tok-operator"},{tag:hn.comment,class:"tok-comment"},{tag:hn.meta,class:"tok-meta"},{tag:hn.invalid,class:"tok-invalid"},{tag:hn.punctuation,class:"tok-punctuation"}]);var nE;const Ww=new mr,a$e=new mr;class Pd{constructor(t,n,s=[],r=""){this.data=t,this.name=r,dr.prototype.hasOwnProperty("tree")||Object.defineProperty(dr.prototype,"tree",{get(){return Ka(this)}}),this.parser=n,this.extension=[up.of(this),dr.languageData.of((i,o,a)=>{let c=dU(i,o,a),u=c.type.prop(Ww);if(!u)return[];let d=i.facet(u),f=c.type.prop(a$e);if(f){let m=c.resolve(o-c.from,a);for(let p of f)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 dU(t,n,s).type.prop(Ww)==this.data}findRegions(t){let n=t.facet(up);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(Ww)==this.data){s.push({from:o,to:o+i.length});return}let a=i.prop(mr.mounted);if(a){if(a.tree.prop(Ww)==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 Na&&r(u,i.positions[c]+o)}};return r(Ka(t),0),s}get allowsNesting(){return!0}}Pd.setState=Ss.define();function dU(e,t,n){let s=e.facet(up),r=Ka(e).topNode;if(!s||s.allowsNesting)for(let i=r;i;i=i.enter(t,n,mo.ExcludeBuffers|mo.EnterBracketed))i.type.isTop&&(r=i);return r}function Ka(e){let t=e.field(Pd.state,!1);return t?t.tree:Na.empty}class l$e{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 bw=null;class i3{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 i3(t,n,[],Na.empty,0,s,[],null)}startParse(){return this.parser.startParse(new l$e(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Na.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(R0.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(R0.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=bw;bw=this;try{return t()}finally{bw=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=hU(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,f,m)=>c.push({fromA:u,toA:d,fromB:f,toB:m})),s=R0.applyChanges(s,c),r=Na.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),f=t.mapPos(u.to,-1);d<f&&a.push({from:d,to:f})}}}return new i3(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=hU(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 XOe{createParse(n,s,r){let i=r[0].from,o=r[r.length-1].to;return{parsedPos:i,advance(){let c=bw;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 Na(xu.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 bw}}function hU(e,t,n){return R0.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class zb{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 zb(n)}static init(t){let n=Math.min(3e3,t.doc.length),s=i3.create(t.facet(up).parser,t,{from:0,to:n});return s.work(20,n)||s.takeTree(),new zb(s)}}Pd.state=Da.define({create:zb.init,update(e,t){for(let n of t.effects)if(n.is(Pd.setState))return n.value;return t.startState.facet(up)!=t.state.facet(up)?zb.init(t.state):e.apply(t)}});let Qoe=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(Qoe=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const sE=typeof navigator<"u"&&(!((nE=navigator.scheduling)===null||nE===void 0)&&nE.isInputPending)?()=>navigator.scheduling.isInputPending():null,c$e=Oi.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(Pd.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(Pd.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=Qoe(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(Pd.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!sE?Math.max(25,t.timeRemaining()-5):1e9),a=i.context.treeLen<r&&s.doc.length>r+1e3,c=i.context.work(()=>sE&&sE()||Date.now()>o,r+(a?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Pd.setState.of(new zb(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=>Gl(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()}}}),up=yn.define({combine(e){return e.length?e[0]:null},enables:e=>[Pd.state,c$e,Vt.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),u$e=yn.define(),OD=yn.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 o3(e){let t=e.facet(OD);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function xx(e,t){let n="",s=e.tabSize,r=e.facet(OD)[0];if(r=="	"){for(;t>=s;)n+="	",t-=s;r=" "}for(let i=0;i<t;i++)n+=r;return n}function $D(e,t){e instanceof dr&&(e=new m5(e));for(let s of e.state.facet(u$e)){let r=s(e,t);if(r!==void 0)return r}let n=Ka(e.state);return n.length>=t?h$e(e,n,t):null}class m5{constructor(t,n={}){this.state=t,this.options=n,this.unit=o3(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 yy(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 d$e=new mr;function h$e(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 Joe(s,e,n)}function Joe(e,t,n){for(let s=e;s;s=s.next){let r=m$e(s.node);if(r)return r(BD.create(t,n,s))}return 0}function f$e(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function m$e(e){let t=e.type.prop(d$e);if(t)return t;let n=e.firstChild,s;if(n&&(s=n.type.prop(mr.closedBy))){let r=e.lastChild,i=r&&s.indexOf(r.name)>-1;return o=>y$e(o,!0,1,void 0,i&&!f$e(o)?r.from:void 0)}return e.parent==null?p$e:null}function p$e(){return 0}class BD extends m5{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 BD(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(g$e(s,t))break;n=this.state.doc.lineAt(s.from)}return this.lineIndent(n.from)}continue(){return Joe(this.context.next,this.base,this.pos)}}function g$e(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function b$e(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 y$e(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=b$e(e);return c?a?e.column(c.from):e.column(c.to):e.baseIndent+(a?0:e.unit*n)}const w$e=200;function v$e(){return dr.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+w$e)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 f=$D(o,d.from);if(f==null)continue;let m=/^\s*/.exec(d.text)[0],p=xx(o,f);m!=p&&c.push({from:d.from,to:d.from+m.length,insert:p})}return c.length?[e,{changes:c,sequential:!0}]:e})}const x$e=yn.define(),k$e=new mr;function _$e(e,t,n){let s=Ka(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(k$e);if(c&&(a.to<s.length-50||s.length==e.doc.length||!S$e(a))){let u=c(a,e);u&&u.from<=n&&u.from>=t&&u.to>n&&(i=u)}}return i}function S$e(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function a3(e,t,n){for(let s of e.facet(x$e)){let r=s(e,t,n);if(r)return r}return _$e(e,t,n)}function Zoe(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 p5=Ss.define({map:Zoe}),Ak=Ss.define({map:Zoe});function eae(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 X0=Da.define({create(){return Rn.none},update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((n,s)=>e=fU(e,n,s)),e=e.map(t.changes);for(let n of t.effects)if(n.is(p5)&&!C$e(e,n.value.from,n.value.to)){let{preparePlaceholder:s}=t.state.facet(sae),r=s?Rn.replace({widget:new I$e(s(t.state,n.value))}):mU;e=e.update({add:[r.range(n.value.from,n.value.to)]})}else n.is(Ak)&&(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=fU(e,t.selection.main.head)),e},provide:e=>Vt.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(mU.range(s,r))}return Rn.set(t,!0)}});function fU(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 l3(e,t,n){var s;let r=null;return(s=e.field(X0,!1))===null||s===void 0||s.between(t,n,(i,o)=>{(!r||r.from>i)&&(r={from:i,to:o})}),r}function C$e(e,t,n){let s=!1;return e.between(t,t,(r,i)=>{r==t&&i==n&&(s=!0)}),s}function tae(e,t){return e.field(X0,!1)?t:t.concat(Ss.appendConfig.of(rae()))}const T$e=e=>{for(let t of eae(e)){let n=a3(e.state,t.from,t.to);if(n)return e.dispatch({effects:tae(e.state,[p5.of(n),nae(e,n)])}),!0}return!1},E$e=e=>{if(!e.state.field(X0,!1))return!1;let t=[];for(let n of eae(e)){let s=l3(e.state,n.from,n.to);s&&t.push(Ak.of(s),nae(e,s,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function nae(e,t,n=!0){let s=e.state.doc.lineAt(t.from).number,r=e.state.doc.lineAt(t.to).number;return Vt.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${s} ${e.state.phrase("to")} ${r}.`)}const j$e=e=>{let{state:t}=e,n=[];for(let s=0;s<t.doc.length;){let r=e.lineBlockAt(s),i=a3(t,r.from,r.to);i&&n.push(p5.of(i)),s=(i?e.lineBlockAt(i.to):r).to+1}return n.length&&e.dispatch({effects:tae(e.state,n)}),!!n.length},A$e=e=>{let t=e.state.field(X0,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(s,r)=>{n.push(Ak.of({from:s,to:r}))}),e.dispatch({effects:n}),!0},N$e=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:T$e},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:E$e},{key:"Ctrl-Alt-[",run:j$e},{key:"Ctrl-Alt-]",run:A$e}],M$e={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},sae=yn.define({combine(e){return th(e,M$e)}});function rae(e){return[X0,P$e]}function iae(e,t){let{state:n}=e,s=n.facet(sae),r=o=>{let a=e.lineBlockAt(e.posAtDOM(o.target)),c=l3(e.state,a.from,a.to);c&&e.dispatch({effects:Ak.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 mU=Rn.replace({widget:new class extends zc{toDOM(e){return iae(e,null)}}});class I$e extends zc{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return iae(t,this.value)}}const R$e={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class rE extends bf{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 D$e(e={}){let t={...R$e,...e},n=new rE(t,!0),s=new rE(t,!1),r=Oi.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(up)!=o.state.facet(up)||o.startState.field(X0,!1)!=o.state.field(X0,!1)||Ka(o.startState)!=Ka(o.state)||t.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Wd;for(let c of o.viewportLineBlocks){let u=l3(o.state,c.from,c.to)?s:a3(o.state,c.from,c.to)?n:null;u&&a.add(c.from,c.from,u)}return a.finish()}}),{domEventHandlers:i}=t;return[r,IOe({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(r))===null||a===void 0?void 0:a.markers)||tr.empty},initialSpacer(){return new rE(t,!1)},domEventHandlers:{...i,click:(o,a,c)=>{if(i.click&&i.click(o,a,c))return!0;let u=l3(o.state,a.from,a.to);if(u)return o.dispatch({effects:Ak.of(u)}),!0;let d=a3(o.state,a.from,a.to);return d?(o.dispatch({effects:p5.of(d)}),!0):!1}}}),rae()]}const P$e=Vt.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 g5{constructor(t,n){this.specs=t;let s;function r(a){let c=ip.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 Pd?a=>a.prop(Ww)==o.data:o?a=>a==o:void 0,this.style=Xoe(t.map(a=>({tag:a.tag,class:a.class||r(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=s?new ip(s):null,this.themeType=n.themeType}static define(t,n){return new g5(t,n||{})}}const gM=yn.define(),oae=yn.define({combine(e){return e.length?[e[0]]:null}});function d4(e){let t=e.facet(gM);return t.length?t:e.facet(oae)}function aae(e,t){let n=[O$e],s;return e instanceof g5&&(e.module&&n.push(Vt.styleModule.of(e.module)),s=e.themeType),t!=null&&t.fallback?n.push(oae.of(e)):s?n.push(gM.computeN([Vt.darkTheme],r=>r.facet(Vt.darkTheme)==(s=="dark")?[e]:[])):n.push(gM.of(e)),n}function p7t(e,t,n){let s=d4(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 L$e{constructor(t){this.markCache=Object.create(null),this.tree=Ka(t.state),this.decorations=this.buildDeco(t,d4(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=Ka(t.state),s=d4(t.state),r=s!=d4(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 Rn.none;let s=new Wd;for(let{from:r,to:i}of t.visibleRanges)r$e(this.tree,n,(o,a,c)=>{s.add(o,a,this.markCache[c]||(this.markCache[c]=Rn.mark({class:c})))},r,i);return s.finish()}}const O$e=Ap.high(Oi.fromClass(L$e,{decorations:e=>e.decorations})),lae=g5.define([{tag:hn.meta,color:"#404740"},{tag:hn.link,textDecoration:"underline"},{tag:hn.heading,textDecoration:"underline",fontWeight:"bold"},{tag:hn.emphasis,fontStyle:"italic"},{tag:hn.strong,fontWeight:"bold"},{tag:hn.strikethrough,textDecoration:"line-through"},{tag:hn.keyword,color:"#708"},{tag:[hn.atom,hn.bool,hn.url,hn.contentSeparator,hn.labelName],color:"#219"},{tag:[hn.literal,hn.inserted],color:"#164"},{tag:[hn.string,hn.deleted],color:"#a11"},{tag:[hn.regexp,hn.escape,hn.special(hn.string)],color:"#e40"},{tag:hn.definition(hn.variableName),color:"#00f"},{tag:hn.local(hn.variableName),color:"#30a"},{tag:[hn.typeName,hn.namespace],color:"#085"},{tag:hn.className,color:"#167"},{tag:[hn.special(hn.variableName),hn.macroName],color:"#256"},{tag:hn.definition(hn.propertyName),color:"#00c"},{tag:hn.comment,color:"#940"},{tag:hn.invalid,color:"#f00"}]),$$e=Vt.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),cae=1e4,uae="()[]{}",dae=yn.define({combine(e){return th(e,{afterCursor:!0,brackets:uae,maxScanDistance:cae,renderMatch:F$e})}}),B$e=Rn.mark({class:"cm-matchingBracket"}),z$e=Rn.mark({class:"cm-nonmatchingBracket"});function F$e(e){let t=[],n=e.matched?B$e:z$e;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 pU(e){let t=[],n=e.facet(dae);for(let s of e.selection.ranges){if(!s.empty)continue;let r=Ld(e,s.head,-1,n)||s.head>0&&Ld(e,s.head-1,1,n)||n.afterCursor&&(Ld(e,s.head,1,n)||s.head<e.doc.length&&Ld(e,s.head+1,-1,n));r&&(t=t.concat(n.renderMatch(r,e)))}return Rn.set(t,!0)}const H$e=Oi.fromClass(class{constructor(e){this.paused=!1,this.decorations=pU(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=pU(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),q$e=[H$e,$$e];function U$e(e={}){return[dae.of(e),q$e]}const W$e=new mr;function bM(e,t,n){let s=e.prop(t<0?mr.openedBy:mr.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 yM(e){let t=e.type.prop(W$e);return t?t(e.node):e}function Ld(e,t,n,s={}){let r=s.maxScanDistance||cae,i=s.brackets||uae,o=Ka(e),a=o.resolveInner(t,n);for(let c=a;c;c=c.parent){let u=bM(c.type,n,i);if(u&&c.from<c.to){let d=yM(c);if(d&&(n>0?t>=d.from&&t<d.to:t>d.from&&t<=d.to))return V$e(e,t,n,c,d,u,i)}}return G$e(e,t,n,o,a.type,r,i)}function V$e(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 f=yM(d);return{start:c,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(bM(d.type,n,o))u++;else if(bM(d.type,-n,o)){if(u==0){let f=yM(d);return{start:c,end:f&&f.from<f.to?{from:f.from,to:f.to}:void 0,matched:!1}}u--}}while(n<0?d.prevSibling():d.nextSibling());return{start:c,matched:!1}}function G$e(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),f=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 y=o.indexOf(p[b]);if(!(y<0||s.resolveInner(g+b,1).type!=r))if(y%2==0==n>0)f++;else{if(f==1)return{start:u,end:{from:g+b,to:g+b+1},matched:y>>1==c>>1};f--}}n>0&&(m+=p.length)}return d.done?{start:u,matched:!1}:null}const K$e=Object.create(null),gU=[xu.none],bU=[],yU=Object.create(null),Y$e=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"]])Y$e[e]=X$e(K$e,t);function iE(e,t){bU.indexOf(e)>-1||(bU.push(e),console.warn(t))}function X$e(e,t){let n=[];for(let a of t.split(" ")){let c=[];for(let u of a.split(".")){let d=e[u]||hn[u];d?typeof d=="function"?c.length?c=c.map(d):iE(u,`Modifier ${u} used at start of tag`):c.length?iE(u,`Tag ${u} used as modifier`):c=Array.isArray(d)?d:[d]:iE(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=yU[r];if(i)return i.id;let o=yU[r]=xu.define({id:gU.length,name:s,props:[n$e({[s]:n})]});return gU.push(o),o.id}di.RTL,di.LTR;const Q$e=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),s=FD(e.state,n.from);return s.line?J$e(e):s.block?eBe(e):!1};function zD(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 J$e=zD(sBe,0),Z$e=zD(hae,0),eBe=zD((e,t)=>hae(e,t,nBe(t)),0);function FD(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const yw=50;function tBe(e,{open:t,close:n},s,r){let i=e.sliceDoc(s-yw,s),o=e.sliceDoc(r,r+yw),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,f;r-s<=2*yw?d=f=e.sliceDoc(s,r):(d=e.sliceDoc(s,s+yw),f=e.sliceDoc(r-yw,r));let m=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(f)[0].length,g=f.length-p-n.length;return d.slice(m,m+t.length)==t&&f.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(f.charAt(g-1))?1:0}}:null}function nBe(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 hae(e,t,n=t.selection.ranges){let s=n.map(i=>FD(t,i.from).block);if(!s.every(i=>i))return null;let r=n.map((i,o)=>tBe(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 sBe(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 f=t.doc.lineAt(d);if(u==null&&(u=FD(t,f.from).line,!u))continue e;if(f.from>r&&(i==o||o>f.from)){r=f.from;let m=/^\s*/.exec(f.text)[0].length,p=m==f.length,g=f.text.slice(m,m+u.length)==u?m:-1;m<f.text.length&&m<c&&(c=m),s.push({line:f,comment:g,token:u,indent:m,empty:p,single:!1})}d=f.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:f}of s)(f||!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 wM=Tf.define(),rBe=Tf.define(),iBe=yn.define(),fae=yn.define({combine(e){return th(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)})}}),mae=Da.define({create(){return Od.empty},update(e,t){let n=t.state.facet(fae),s=t.annotation(wM);if(s){let c=Kl.fromTransaction(t,s.selection),u=s.side,d=u==0?e.undone:e.done;return c?d=c3(d,d.length,n.minDepth,c):d=bae(d,t.startState.selection),new Od(u==0?s.rest:d,u==0?d:s.rest)}let r=t.annotation(rBe);if((r=="full"||r=="before")&&(e=e.isolate()),t.annotation(Yo.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let i=Kl.fromTransaction(t),o=t.annotation(Yo.time),a=t.annotation(Yo.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 Od(e.done.map(Kl.fromJSON),e.undone.map(Kl.fromJSON))}});function HD(e={}){return[mae,fae.of(e),Vt.domEventHandlers({beforeinput(t,n){let s=t.inputType=="historyUndo"?pae:t.inputType=="historyRedo"?vM:null;return s?(t.preventDefault(),s(n)):!1}})]}function b5(e,t){return function({state:n,dispatch:s}){if(!t&&n.readOnly)return!1;let r=n.field(mae,!1);if(!r)return!1;let i=r.pop(e,n,t);return i?(s(i),!0):!1}}const pae=b5(0,!1),vM=b5(1,!1),oBe=b5(0,!0),aBe=b5(1,!0);class Kl{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 Kl(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 Kl(t.changes&&Go.fromJSON(t.changes),[],t.mapped&&Fd.fromJSON(t.mapped),t.startSelection&&ut.fromJSON(t.startSelection),t.selectionsAfter.map(ut.fromJSON))}static fromTransaction(t,n){let s=hu;for(let r of t.startState.facet(iBe)){let i=r(t);i.length&&(s=s.concat(i))}return!s.length&&t.changes.empty?null:new Kl(t.changes.invert(t.startState.doc),s,void 0,n||t.startState.selection,hu)}static selection(t){return new Kl(void 0,hu,void 0,void 0,t)}}function c3(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 lBe(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 cBe(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,s)=>n.empty!=t.ranges[s].empty).length===0}function gae(e,t){return e.length?t.length?e.concat(t):e:t}const hu=[],uBe=200;function bae(e,t){if(e.length){let n=e[e.length-1],s=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-uBe));return s.length&&s[s.length-1].eq(t)?e:(s.push(t),c3(e,e.length-1,1e9,n.setSelAfter(s)))}else return[Kl.selection([t])]}function dBe(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 oE(e,t){if(!e.length)return e;let n=e.length,s=hu;for(;n;){let r=hBe(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?[Kl.selection(s)]:hu}function hBe(e,t,n){let s=gae(e.selectionsAfter.length?e.selectionsAfter.map(a=>a.map(t)):hu,n);if(!e.changes)return Kl.selection(s);let r=e.changes.map(t),i=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(i):i;return new Kl(r,Ss.mapEffects(e.effects,t),o,e.startSelection.map(i),s)}const fBe=/^(input\.type|delete)($|\.)/;class Od{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 Od(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||fBe.test(s))&&(!a.selectionsAfter.length&&n-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,lBe(a.changes,t.changes))||s=="input.type.compose")?o=c3(o,o.length-1,r.minDepth,new Kl(t.changes.compose(a.changes),gae(Ss.mapEffects(t.effects,a.changes),a.effects),a.mapped,a.startSelection,hu)):o=c3(o,o.length,r.minDepth,t),new Od(o,hu,n,s)}addSelection(t,n,s,r){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:hu;return i.length>0&&n-this.prevTime<r&&s==this.prevUserEvent&&s&&/^select($|\.)/.test(s)&&cBe(i[i.length-1],t)?this:new Od(bae(this.done,t),this.undone,n,s)}addMapping(t){return new Od(oE(this.done,t),oE(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:wM.of({side:t,rest:dBe(r),selection:o}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=r.length==1?hu:r.slice(0,r.length-1);return i.mapped&&(a=oE(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:wM.of({side:t,rest:a,selection:o}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}Od.empty=new Od(hu,hu);const qD=[{key:"Mod-z",run:pae,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:vM,preventDefault:!0},{linux:"Ctrl-Shift-z",run:vM,preventDefault:!0},{key:"Mod-u",run:oBe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:aBe,preventDefault:!0}];function wy(e,t){return ut.create(e.ranges.map(t),e.mainIndex)}function Yu(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Xu({state:e,dispatch:t},n){let s=wy(e.selection,n);return s.eq(e.selection,!0)?!1:(t(Yu(e,s)),!0)}function y5(e,t){return ut.cursor(t?e.to:e.from)}function yae(e,t){return Xu(e,n=>n.empty?e.moveByChar(n,t):y5(n,t))}function Za(e){return e.textDirectionAt(e.state.selection.main.head)==di.LTR}const wae=e=>yae(e,!Za(e)),vae=e=>yae(e,Za(e));function xae(e,t){return Xu(e,n=>n.empty?e.moveByGroup(n,t):y5(n,t))}const mBe=e=>xae(e,!Za(e)),pBe=e=>xae(e,Za(e));function gBe(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 w5(e,t,n){let s=Ka(e).resolveInner(t.head),r=n?mr.closedBy:mr.openedBy;for(let c=t.head;;){let u=n?s.childAfter(c):s.childBefore(c);if(!u)break;gBe(e,u,r)?s=u:c=n?u.to:u.from}let i=s.type.prop(r),o,a;return i&&(o=n?Ld(e,s.from,1):Ld(e,s.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?s.to:s.from,ut.cursor(a,n?-1:1)}const bBe=e=>Xu(e,t=>w5(e.state,t,!Za(e))),yBe=e=>Xu(e,t=>w5(e.state,t,Za(e)));function kae(e,t){return Xu(e,n=>{if(!n.empty)return y5(n,t);let s=e.moveVertically(n,t);return s.head!=n.head?s:e.moveToLineBoundary(n,t)})}const _ae=e=>kae(e,!1),Sae=e=>kae(e,!0);function Cae(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,s=0,r;if(t){for(let i of e.state.facet(Vt.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 Tae(e,t){let n=Cae(e),{state:s}=e,r=wy(s.selection,o=>o.empty?e.moveVertically(o,t,n.height):y5(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=Vt.scrollIntoView(r.main.head,{y:"start",yMargin:o.top-c}))}return e.dispatch(Yu(s,r),{effects:i}),!0}const wU=e=>Tae(e,!1),xM=e=>Tae(e,!0);function Np(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=ut.cursor(s.from+i))}return r}const wBe=e=>Xu(e,t=>Np(e,t,!0)),vBe=e=>Xu(e,t=>Np(e,t,!1)),xBe=e=>Xu(e,t=>Np(e,t,!Za(e))),kBe=e=>Xu(e,t=>Np(e,t,Za(e))),_Be=e=>Xu(e,t=>ut.cursor(e.lineBlockAt(t.head).from,1)),SBe=e=>Xu(e,t=>ut.cursor(e.lineBlockAt(t.head).to,-1));function CBe(e,t,n){let s=!1,r=wy(e.selection,i=>{let o=Ld(e,i.head,-1)||Ld(e,i.head,1)||i.head>0&&Ld(e,i.head-1,1)||i.head<e.doc.length&&Ld(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 ut.cursor(a)});return s?(t(Yu(e,r)),!0):!1}const TBe=({state:e,dispatch:t})=>CBe(e,t);function Su(e,t){let n=wy(e.state.selection,s=>{let r=t(s);return ut.range(s.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(Yu(e.state,n)),!0)}function Eae(e,t){return Su(e,n=>e.moveByChar(n,t))}const jae=e=>Eae(e,!Za(e)),Aae=e=>Eae(e,Za(e));function Nae(e,t){return Su(e,n=>e.moveByGroup(n,t))}const EBe=e=>Nae(e,!Za(e)),jBe=e=>Nae(e,Za(e)),ABe=e=>Su(e,t=>w5(e.state,t,!Za(e))),NBe=e=>Su(e,t=>w5(e.state,t,Za(e)));function Mae(e,t){return Su(e,n=>e.moveVertically(n,t))}const Iae=e=>Mae(e,!1),Rae=e=>Mae(e,!0);function Dae(e,t){return Su(e,n=>e.moveVertically(n,t,Cae(e).height))}const vU=e=>Dae(e,!1),xU=e=>Dae(e,!0),MBe=e=>Su(e,t=>Np(e,t,!0)),IBe=e=>Su(e,t=>Np(e,t,!1)),RBe=e=>Su(e,t=>Np(e,t,!Za(e))),DBe=e=>Su(e,t=>Np(e,t,Za(e))),PBe=e=>Su(e,t=>ut.cursor(e.lineBlockAt(t.head).from)),LBe=e=>Su(e,t=>ut.cursor(e.lineBlockAt(t.head).to)),kU=({state:e,dispatch:t})=>(t(Yu(e,{anchor:0})),!0),_U=({state:e,dispatch:t})=>(t(Yu(e,{anchor:e.doc.length})),!0),SU=({state:e,dispatch:t})=>(t(Yu(e,{anchor:e.selection.main.anchor,head:0})),!0),CU=({state:e,dispatch:t})=>(t(Yu(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),OBe=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),$Be=({state:e,dispatch:t})=>{let n=v5(e).map(({from:s,to:r})=>ut.range(s,Math.min(r+1,e.doc.length)));return t(e.update({selection:ut.create(n),userEvent:"select"})),!0},BBe=({state:e,dispatch:t})=>{let n=wy(e.selection,s=>{let r=Ka(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 ut.range(a.to,a.from)}return s});return n.eq(e.selection)?!1:(t(Yu(e,n)),!0)};function Pae(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(Yu(n,ut.create(r,r.length-1))),!0)}const zBe=e=>Pae(e,!1),FBe=e=>Pae(e,!0),HBe=({state:e,dispatch:t})=>{let n=e.selection,s=null;return n.ranges.length>1?s=ut.create([n.main]):n.main.empty||(s=ut.create([ut.cursor(n.main.head)])),s?(t(Yu(e,s)),!0):!1};function Nk(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=YS(e,c,!1)):c>o&&(n="delete.forward",c=YS(e,c,!0)),o=Math.min(o,c),a=Math.max(a,c)}else o=YS(e,o,!1),a=YS(e,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:ut.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"?Vt.announce.of(s.phrase("Selection deleted")):void 0})),!0)}function YS(e,t,n){if(e instanceof Vt)for(let s of e.state.facet(Vt.atomicRanges).map(r=>r(e)))s.between(t,t,(r,i)=>{r<t&&i>t&&(t=n?i:r)});return t}const Lae=(e,t,n)=>Nk(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=yy(a,i.tabSize),d=u%o3(i)||o3(i);for(let f=0;f<d&&a[a.length-1-f]==" ";f++)r--;c=r}else c=ha(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=ha(o.text,c-o.from,!1,!1)+o.from);return c}),kM=e=>Lae(e,!1,!0),Oae=e=>Lae(e,!0,!1),$ae=(e,t)=>Nk(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=ha(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}),Bae=e=>$ae(e,!1),qBe=e=>$ae(e,!0),UBe=e=>Nk(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),WBe=e=>Nk(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),VBe=e=>Nk(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),GBe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(s=>({changes:{from:s.from,to:s.to,insert:kr.of(["",""])},range:ut.cursor(s.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},KBe=({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:ha(i.text,r-i.from,!1)+i.from,a=r==i.to?r+1:ha(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:ut.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function v5(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 zae(e,t,n){if(e.readOnly)return!1;let s=[],r=[];for(let i of v5(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(ut.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(ut.range(c.anchor-a,c.head-a))}}return s.length?(t(e.update({changes:s,scrollIntoView:!0,selection:ut.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const YBe=({state:e,dispatch:t})=>zae(e,t,!1),XBe=({state:e,dispatch:t})=>zae(e,t,!0);function Fae(e,t,n){if(e.readOnly)return!1;let s=[];for(let i of v5(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 QBe=({state:e,dispatch:t})=>Fae(e,t,!1),JBe=({state:e,dispatch:t})=>Fae(e,t,!0),ZBe=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(v5(t).map(({from:r,to:i})=>(r>0?r--:i<t.doc.length&&i++,{from:r,to:i}))),s=wy(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 eze(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=Ka(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(mr.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 TU=Hae(!1),tze=Hae(!0);function Hae(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&&eze(t,i);e&&(i=o=(o<=a.to?a:t.doc.lineAt(o)).to);let u=new m5(t,{simulateBreak:i,simulateDoubleBreak:!!c}),d=$D(u,i);for(d==null&&(d=yy(/^\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 f=["",xx(t,d)];return c&&f.push(xx(t,u.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:kr.of(f)},range:ut.cursor(i+1+f[1].length)}});return n(t.update(s,{scrollIntoView:!0,userEvent:"input"})),!0}}function UD(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:ut.range(i.mapPos(s.anchor,1),i.mapPos(s.head,1))}})}const nze=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),s=new m5(e,{overrideIndentation:i=>{let o=n[i];return o??-1}}),r=UD(e,(i,o,a)=>{let c=$D(s,i.from);if(c==null)return;/\S/.test(i.text)||(c=0);let u=/^\s*/.exec(i.text)[0],d=xx(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},sze=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(UD(e,(n,s)=>{s.push({from:n.from,insert:e.facet(OD)})}),{userEvent:"input.indent"})),!0),rze=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(UD(e,(n,s)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let i=yy(r,e.tabSize),o=0,a=xx(e,Math.max(0,i-o3(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),ize=e=>(e.setTabFocusMode(),!0),oze=[{key:"Ctrl-b",run:wae,shift:jae,preventDefault:!0},{key:"Ctrl-f",run:vae,shift:Aae},{key:"Ctrl-p",run:_ae,shift:Iae},{key:"Ctrl-n",run:Sae,shift:Rae},{key:"Ctrl-a",run:_Be,shift:PBe},{key:"Ctrl-e",run:SBe,shift:LBe},{key:"Ctrl-d",run:Oae},{key:"Ctrl-h",run:kM},{key:"Ctrl-k",run:UBe},{key:"Ctrl-Alt-h",run:Bae},{key:"Ctrl-o",run:GBe},{key:"Ctrl-t",run:KBe},{key:"Ctrl-v",run:xM}],aze=[{key:"ArrowLeft",run:wae,shift:jae,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:mBe,shift:EBe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:xBe,shift:RBe,preventDefault:!0},{key:"ArrowRight",run:vae,shift:Aae,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:pBe,shift:jBe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:kBe,shift:DBe,preventDefault:!0},{key:"ArrowUp",run:_ae,shift:Iae,preventDefault:!0},{mac:"Cmd-ArrowUp",run:kU,shift:SU},{mac:"Ctrl-ArrowUp",run:wU,shift:vU},{key:"ArrowDown",run:Sae,shift:Rae,preventDefault:!0},{mac:"Cmd-ArrowDown",run:_U,shift:CU},{mac:"Ctrl-ArrowDown",run:xM,shift:xU},{key:"PageUp",run:wU,shift:vU},{key:"PageDown",run:xM,shift:xU},{key:"Home",run:vBe,shift:IBe,preventDefault:!0},{key:"Mod-Home",run:kU,shift:SU},{key:"End",run:wBe,shift:MBe,preventDefault:!0},{key:"Mod-End",run:_U,shift:CU},{key:"Enter",run:TU,shift:TU},{key:"Mod-a",run:OBe},{key:"Backspace",run:kM,shift:kM,preventDefault:!0},{key:"Delete",run:Oae,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Bae,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:qBe,preventDefault:!0},{mac:"Mod-Backspace",run:WBe,preventDefault:!0},{mac:"Mod-Delete",run:VBe,preventDefault:!0}].concat(oze.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),WD=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:bBe,shift:ABe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:yBe,shift:NBe},{key:"Alt-ArrowUp",run:YBe},{key:"Shift-Alt-ArrowUp",run:QBe},{key:"Alt-ArrowDown",run:XBe},{key:"Shift-Alt-ArrowDown",run:JBe},{key:"Mod-Alt-ArrowUp",run:zBe},{key:"Mod-Alt-ArrowDown",run:FBe},{key:"Escape",run:HBe},{key:"Mod-Enter",run:tze},{key:"Alt-l",mac:"Ctrl-l",run:$Be},{key:"Mod-i",run:BBe,preventDefault:!0},{key:"Mod-[",run:rze},{key:"Mod-]",run:sze},{key:"Mod-Alt-\\",run:nze},{key:"Shift-Mod-k",run:ZBe},{key:"Shift-Mod-\\",run:TBe},{key:"Mod-/",run:Q$e},{key:"Alt-A",run:Z$e},{key:"Ctrl-m",mac:"Shift-Alt-m",run:ize}].concat(aze);class qae{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=Ka(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(Uae(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 EU(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 lze(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=EU(t)+EU(n)+"*$";return[new RegExp("^"+s),new RegExp(s)]}function cze(e){let t=e.map(r=>typeof r=="string"?{label:r}:r),[n,s]=t.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:lze(t);return r=>{let i=r.matchBefore(s);return i||r.explicit?{from:i?i.from:r.pos,options:t,validFor:n}:null}}class jU{constructor(t,n,s,r){this.completion=t,this.source=n,this.match=s,this.score=r}}function D0(e){return e.selection.main.from}function Uae(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 Wae=Tf.define();function uze(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:ut.cursor(a.from+i+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const AU=new WeakMap;function dze(e){if(!Array.isArray(e))return e;let t=AU.get(e);return t||AU.set(e,t=cze(e)),t}const u3=Ss.define(),kx=Ss.define();class hze{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=Ul(t,n),r=Ed(s);this.chars.push(s);let i=t.slice(n,n+r),o=i.toUpperCase();this.folded.push(Ul(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 w=Ul(t,0),x=Ed(w),k=x==t.length?0:-100;if(w!=n[0])if(w==s[0])k+=-200;else return null;return this.ret(k,[0,x])}let a=t.indexOf(this.pattern);if(a==0)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let c=n.length,u=0;if(a<0){for(let w=0,x=Math.min(t.length,200);w<x&&u<c;){let k=Ul(t,w);(k==n[u]||k==s[u])&&(r[u++]=w),w+=Ed(k)}if(u<c)return null}let d=0,f=0,m=!1,p=0,g=-1,b=-1,v=/[a-z]/.test(t),y=!0;for(let w=0,x=Math.min(t.length,200),k=0;w<x&&f<c;){let C=Ul(t,w);a<0&&(d<c&&C==n[d]&&(i[d++]=w),p<c&&(C==n[p]||C==s[p]?(p==0&&(g=w),b=w+1,p++):p=0));let T,_=C<255?C>=48&&C<=57||C>=97&&C<=122?2:C>=65&&C<=90?1:0:(T=pD(C))!=T.toLowerCase()?1:T!=T.toUpperCase()?2:0;(!w||_==1&&v||k==0&&_!=0)&&(n[f]==C||s[f]==C&&(m=!0)?o[f++]=w:o.length&&(y=!1)),k=_,w+=Ed(C)}return f==c&&o[0]==0&&y?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]):f==c?this.result(-100+(m?-200:0)+-700+(y?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?Ed(Ul(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 fze{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 da=yn.define({combine(e){return th(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:mze,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=>NU(t(s),n(s)),optionClass:(t,n)=>s=>NU(t(s),n(s)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function NU(e,t){return e?t?e+" "+t:e:t}function mze(e,t,n,s,r,i){let o=e.textDirection==di.RTL,a=o,c=!1,u="top",d,f,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,f=Math.min(400,a?m:p);else{c=!0,f=Math.min(400,(o?t.right:r.right-t.left)-30);let w=r.bottom-t.bottom;w>=b||w>t.top?d=n.bottom-t.top:(u="bottom",d=t.bottom-n.top)}let v=(t.bottom-t.top)/i.offsetHeight,y=(t.right-t.left)/i.offsetWidth;return{style:`${u}: ${d/v}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(c?o?"left-narrow":"right-narrow":a?"left":"right")}}const VD=Ss.define();function pze(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++],f=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,f))),m.className="cm-completionMatchedText",c=f}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 aE(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 gze{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(da);this.optionContent=pze(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=aE(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,f;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(f=/-(\d+)$/.exec(d.id))&&+f[1]<u.length){this.applyCompletion(t,u[+f[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:VD.of(d)}),c.preventDefault())}}),this.dom.addEventListener("focusout",c=>{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet(da).closeOnBlur&&c.relatedTarget!=t.contentDOM&&t.dispatch({effects:kx.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=aE(i.length,o,t.state.facet(da).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=aE(n.options.length,n.selected,this.view.state.facet(da).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=>Gl(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&&yze(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(da).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 f=this.optionClass(a);f&&(d.className=f);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 bze(e,t){return n=>new gze(n,e,t)}function yze(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 MU(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function wze(e,t){let n=[],s=null,r=null,i=d=>{n.push(d);let{section:f}=d.completion;if(f){s||(s=[]);let m=typeof f=="string"?f:f.name;s.some(p=>p.name==m)||s.push(typeof f=="string"?{name:m}:f)}},o=t.facet(da);for(let d of e)if(d.hasResult()){let f=d.result.getMatch;if(d.result.filter===!1)for(let m of d.result.options)i(new jU(m,d.source,f?f(m):[],1e9-n.length));else{let m=t.sliceDoc(d.from,d.to),p,g=o.filterStrict?new fze(m):new hze(m);for(let b of d.result.options)if(p=g.match(b.label)){let v=b.displayLabel?f?f(b,p.matched):[]:p.matched,y=p.score+(b.boost||0);if(i(new jU(b,d.source,v,y)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:w}=b.section;r||(r=Object.create(null)),r[w]=Math.max(y,r[w]||-1e9)}}}}if(s){let d=Object.create(null),f=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))f-=1e5,d[p.name]=f;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((f,m)=>m.score-f.score||u(f.completion,m.completion))){let f=d.completion;!c||c.label!=f.label||c.detail!=f.detail||c.type!=null&&f.type!=null&&c.type!=f.type||c.apply!=f.apply||c.boost!=f.boost?a.push(d):MU(d.completion)>MU(c)&&(a[a.length-1]=d),c=d.completion}return a}class B1{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 B1(this.options,IU(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=wze(t,n);if(!a.length)return r&&t.some(u=>u.isPending)?r.setDisabled():null;let c=n.facet(da).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 B1(a,IU(s,c),{pos:t.reduce((u,d)=>d.hasResult()?Math.min(u,d.from):u,1e8),create:Cze,above:i.aboveCursor},r?r.timestamp:Date.now(),c,!1)}map(t){return new B1(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new B1(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class d3{constructor(t,n,s){this.active=t,this.id=n,this.open=s}static start(){return new d3(_ze,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,s=n.facet(da),i=(s.override||n.languageDataAt("autocomplete",D0(n)).map(dze)).map(c=>(this.active.find(d=>d.source==c)||new fu(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(GD));o&&t.docChanged&&(o=o.map(t.changes)),t.selection||i.some(c=>c.hasResult()&&t.changes.touchesRange(c.from,c.to))||!vze(i,this.active)||a?o=B1.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 fu(c.source,0):c));for(let c of t.effects)c.is(VD)&&(o=o&&o.setSelected(c.value,this.id));return i==this.active&&o==this.open?this:new d3(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?xze:kze}}function vze(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 xze={"aria-autocomplete":"list"},kze={};function IU(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const _ze=[];function Vae(e,t){if(e.isUserEvent("input.complete")){let s=e.annotation(Wae);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 fu{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=Vae(t,n),r=this;(s&8||s&16&&this.touches(t))&&(r=new fu(r.source,0)),s&4&&r.state==0&&(r=new fu(this.source,1)),r=r.updateFor(t,s);for(let i of t.effects)if(i.is(u3))r=new fu(r.source,1,i.value);else if(i.is(kx))r=new fu(r.source,0);else if(i.is(GD))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(D0(t.state))}}class cb extends fu{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=D0(t.state);if(a>o||!r||n&2&&(D0(t.startState)==this.from||a<this.limit))return new fu(this.source,n&4?1:0);let c=t.changes.mapPos(this.limit);return Sze(r.validFor,t.state,i,o)?new cb(this.source,this.explicit,c,r,i,o):r.update&&(r=r.update(r,i,o,new qae(t.state,a,!1)))?new cb(this.source,this.explicit,c,r,r.from,(s=r.to)!==null&&s!==void 0?s:D0(t.state)):new fu(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 cb(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new fu(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function Sze(e,t,n,s){if(!e)return!1;let r=t.sliceDoc(n,s);return typeof e=="function"?e(r,n,s,t):Uae(e,!0).test(r)}const GD=Ss.define({map(e,t){return e.map(n=>n.map(t))}}),fl=Da.define({create(){return d3.start()},update(e,t){return e.update(t)},provide:e=>[ID.from(e,t=>t.tooltip),Vt.contentAttributes.from(e,t=>t.attrs)]});function KD(e,t){const n=t.completion.apply||t.completion.label;let s=e.state.field(fl).active.find(r=>r.source==t.source);return s instanceof cb?(typeof n=="string"?e.dispatch({...uze(e.state,n,s.from,s.to),annotations:Wae.of(t.completion)}):n(e,t.completion,s.from,s.to),!0):!1}const Cze=bze(fl,KD);function ym(e,t="option"){return n=>{let s=n.state.field(fl,!1);if(!s||!s.open||s.open.disabled||Date.now()-s.open.timestamp<n.state.facet(da).interactionDelay)return!1;let r=1,i;t=="page"&&(i=zoe(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:VD.of(a)}),!0}}const Gae=e=>{let t=e.state.field(fl,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(da).interactionDelay?!1:KD(e,t.open.options[t.open.selected])},h4=e=>e.state.field(fl,!1)?(e.dispatch({effects:u3.of(!0)}),!0):!1,f4=e=>{let t=e.state.field(fl,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:kx.of(null)}),!0)};class Tze{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const Eze=50,jze=1e3,Aze=Oi.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(fl).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(fl),n=e.state.facet(da);if(!e.selectionSet&&!e.docChanged&&e.startState.field(fl)==t)return;let s=e.transactions.some(i=>{let o=Vae(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>Eze&&Date.now()-o.time>jze){for(let a of o.context.abortListeners)try{a()}catch(c){Gl(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(u3)))&&(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(fl);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(da).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=D0(t),s=new qae(t,n,e.explicit,this.view),r=new Tze(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:kx.of(null)}),Gl(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(da).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(da),s=this.view.state.field(fl);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=D0(i.updates.length?i.updates[0].startState:this.view.state),c=Math.min(a,i.done.from+(i.active.explicit?0:1)),u=new cb(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 fu(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:GD.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(fl,!1);if(t&&t.tooltip&&this.view.state.facet(da).closeOnBlur){let n=t.open&&zoe(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:kx.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:u3.of(!1)}),20),this.composing=0}}}),Nze=typeof navigator=="object"&&/Win/.test(navigator.platform),Mze=Ap.highest(Vt.domEventHandlers({keydown(e,t){let n=t.state.field(fl,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(Nze&&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&&KD(t,s),!1}})),Ize=Vt.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"}}}),_x={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},S0=Ss.define({map(e,t){let n=t.mapPos(e,-1,gl.TrackAfter);return n??void 0}}),YD=new class extends rp{};YD.startSide=1;YD.endSide=-1;const Kae=Da.define({create(){return tr.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(S0)&&(e=e.update({add:[YD.range(n.value,n.value+1)]}));return e}});function Rze(){return[Pze,Kae]}const lE="()[]{}<>«»»«［］｛｝";function Yae(e){for(let t=0;t<lE.length;t+=2)if(lE.charCodeAt(t)==e)return lE.charAt(t+1);return pD(e<128?e:e+1)}function Xae(e,t){return e.languageDataAt("closeBrackets",t)[0]||_x}const Dze=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Pze=Vt.inputHandler.of((e,t,n,s)=>{if((Dze?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let r=e.state.selection.main;if(s.length>2||s.length==2&&Ed(Ul(s,0))==1||t!=r.from||n!=r.to)return!1;let i=$ze(e.state,s);return i?(e.dispatch(i),!0):!1}),Lze=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let s=Xae(e,e.selection.main.head).brackets||_x.brackets,r=null,i=e.changeByRange(o=>{if(o.empty){let a=Bze(e.doc,o.head);for(let c of s)if(c==a&&x5(e.doc,o.head)==Yae(Ul(c,0)))return{changes:{from:o.head-c.length,to:o.head+c.length},range:ut.cursor(o.head-c.length)}}return{range:r=o}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},Oze=[{key:"Backspace",run:Lze}];function $ze(e,t){let n=Xae(e,e.selection.main.head),s=n.brackets||_x.brackets;for(let r of s){let i=Yae(Ul(r,0));if(t==r)return i==r?Hze(e,r,s.indexOf(r+r+r)>-1,n):zze(e,r,i,n.before||_x.before);if(t==i&&Qae(e,e.selection.main.from))return Fze(e,r,i)}return null}function Qae(e,t){let n=!1;return e.field(Kae).between(0,e.doc.length,s=>{s==t&&(n=!0)}),n}function x5(e,t){let n=e.sliceString(t,t+2);return n.slice(0,Ed(Ul(n,0)))}function Bze(e,t){let n=e.sliceString(t-2,t);return Ed(Ul(n,0))==n.length?n:n.slice(1)}function zze(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:S0.of(o.to+t.length),range:ut.range(o.anchor+t.length,o.head+t.length)};let a=x5(e.doc,o.head);return!a||/\s/.test(a)||s.indexOf(a)>-1?{changes:{insert:t+n,from:o.head},effects:S0.of(o.head+t.length),range:ut.cursor(o.head+t.length)}:{range:r=o}});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function Fze(e,t,n){let s=null,r=e.changeByRange(i=>i.empty&&x5(e.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:ut.cursor(i.head+n.length)}:s={range:i});return s?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Hze(e,t,n,s){let r=s.stringPrefixes||_x.stringPrefixes,i=null,o=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:t,from:a.to}],effects:S0.of(a.to+t.length),range:ut.range(a.anchor+t.length,a.head+t.length)};let c=a.head,u=x5(e.doc,c),d;if(u==t){if(RU(e,c))return{changes:{insert:t+t,from:c},effects:S0.of(c+t.length),range:ut.cursor(c+t.length)};if(Qae(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:ut.cursor(c+m.length)}}}else{if(n&&e.sliceDoc(c-2*t.length,c)==t+t&&(d=DU(e,c-2*t.length,r))>-1&&RU(e,d))return{changes:{insert:t+t+t+t,from:c},effects:S0.of(c+t.length),range:ut.cursor(c+t.length)};if(e.charCategorizer(c)(u)!=Di.Word&&DU(e,c,r)>-1&&!qze(e,c,t,r))return{changes:{insert:t+t,from:c},effects:S0.of(c+t.length),range:ut.cursor(c+t.length)}}return{range:i=a}});return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function RU(e,t){let n=Ka(e).resolveInner(t+1);return n.parent&&n.from==t}function qze(e,t,n,s){let r=Ka(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 DU(e,t,n){let s=e.charCategorizer(t);if(s(e.sliceDoc(t-1,t))!=Di.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))!=Di.Word)return i}return-1}function Jae(e={}){return[Mze,fl,da.of(e),Aze,Uze,Ize]}const Zae=[{key:"Ctrl-Space",run:h4},{mac:"Alt-`",run:h4},{mac:"Alt-i",run:h4},{key:"Escape",run:f4},{key:"ArrowDown",run:ym(!0)},{key:"ArrowUp",run:ym(!1)},{key:"PageDown",run:ym(!0,"page")},{key:"PageUp",run:ym(!1,"page")},{key:"Enter",run:Gae}],Uze=Ap.highest($b.computeN([da],e=>e.facet(da).defaultKeymap?[Zae]:[]));function lc(e){let t=e.field(fl,!1);return t&&t.active.some(n=>n.isPending)?"pending":t&&t.active.some(n=>n.state!=0)?"active":null}const PU=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class Fb{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(PU(a)):PU,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 Ul(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=pD(t),s=this.bufferStart+this.bufferPos;this.bufferPos+=Ed(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"&&(Fb.prototype[Symbol.iterator]=function(){return this});const ele={from:-1,to:-1,match:/.*/.exec(""),precise:!0},XD="gm"+(/x/.unicode==null?"":"u");class tle{constructor(t,n,s,r=0,i=t.length){if(this.text=t,this.to=i,this.curLine="",this.done=!1,this.value=ele,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new nle(t,n,s,r,i);this.re=new RegExp(n,XD+(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=h3(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=h3(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 cE=new WeakMap;class ub{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,s){let r=cE.get(t);if(!r||r.from>=s||r.to<=n){let a=new ub(n,t.sliceString(n,s));return cE.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)),cE.set(t,new ub(o,i)),new ub(n,i.slice(n-o,s-o))}}class nle{constructor(t,n,s,r,i){this.text=t,this.to=i,this.done=!1,this.value=ele,this.matchPos=h3(t,r),this.re=new RegExp(n,XD+(s!=null&&s.ignoreCase?"i":"")),this.test=s==null?void 0:s.test,this.flat=ub.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=h3(this.text,r+(s==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=ub.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(tle.prototype[Symbol.iterator]=nle.prototype[Symbol.iterator]=function(){return this});function Wze(e){try{return new RegExp(e,XD),!0}catch{return!1}}function h3(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 Vze=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:s,result:r}=jOe(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,f]=o,m=d?+d.slice(1):0,p=u?+u:a.number;if(u&&f){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=ut.cursor(g.from+Math.max(0,Math.min(m,g.length)));e.dispatch({effects:[s,Vt.scrollIntoView(b.from,{y:"center"})],selection:b})}),!0},Gze={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kze=yn.define({combine(e){return th(e,Gze,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Yze(e){return[eFe,Zze]}const Xze=Rn.mark({class:"cm-selectionMatch"}),Qze=Rn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function LU(e,t,n,s){return(n==0||e(t.sliceDoc(n-1,n))!=Di.Word)&&(s==t.doc.length||e(t.sliceDoc(s,s+1))!=Di.Word)}function Jze(e,t,n,s){return e(t.sliceDoc(n,n+1))==Di.Word&&e(t.sliceDoc(s-1,s))==Di.Word}const Zze=Oi.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(Kze),{state:n}=e,s=n.selection;if(s.ranges.length>1)return Rn.none;let r=s.main,i,o=null;if(r.empty){if(!t.highlightWordAroundCursor)return Rn.none;let c=n.wordAt(r.head);if(!c)return Rn.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 Rn.none;if(t.wholeWords){if(i=n.sliceDoc(r.from,r.to),o=n.charCategorizer(r.head),!(LU(o,n,r.from,r.to)&&Jze(o,n,r.from,r.to)))return Rn.none}else if(i=n.sliceDoc(r.from,r.to),!i)return Rn.none}let a=[];for(let c of e.visibleRanges){let u=new Fb(n.doc,i,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!o||LU(o,n,d,f))&&(r.empty&&d<=r.from&&f>=r.to?a.push(Qze.range(d,f)):(d>=r.to||f<=r.from)&&a.push(Xze.range(d,f)),a.length>t.maxMatches))return Rn.none}}return Rn.set(a)}},{decorations:e=>e.decorations}),eFe=Vt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),tFe=({state:e,dispatch:t})=>{let{selection:n}=e,s=ut.create(n.ranges.map(r=>e.wordAt(r.head)||ut.cursor(r.head)),n.mainIndex);return s.eq(n)?!1:(t(e.update({selection:s})),!0)};function nFe(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 Fb(e.doc,t,s[s.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new Fb(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 sFe=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(i=>i.from===i.to))return tFe({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=nFe(e,s);return r?(t(e.update({selection:e.selection.addRange(ut.range(r.from,r.to),!1),effects:Vt.scrollIntoView(r.to)})),!0):!1},vy=yn.define({combine(e){return th(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new bFe(t),scrollToMatch:t=>Vt.scrollIntoView(t)})}});class sle{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||Wze(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 cFe(this):new oFe(this)}getCursor(t,n=0,s){let r=t.doc?t:dr.create({doc:t});return s==null&&(s=r.doc.length),this.regexp?x1(this,r,n,s):v1(this,r,n,s)}}class rle{constructor(t){this.spec=t}}function rFe(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 v1(e,t,n,s){let r;return e.wholeWord&&(r=iFe(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(r=rFe(e.test,t,r)),new Fb(t.doc,e.unquoted,n,s,e.caseSensitive?void 0:i=>i.toLowerCase(),r)}function iFe(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(f3(r,n-i))!=Di.Word||t(m3(r,n-i))!=Di.Word)&&(t(m3(r,s-i))!=Di.Word||t(f3(r,s-i))!=Di.Word))}class oFe extends rle{constructor(t){super(t)}nextMatch(t,n,s){let r=v1(this.spec,t,s,t.doc.length).nextOverlapping();if(r.done){let i=Math.min(t.doc.length,n+this.spec.unquoted.length);r=v1(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=v1(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=v1(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=v1(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 aFe(e,t,n){return(s,r,i)=>(!n||n(s,r,i))&&e(i[0],t,s,r)}function x1(e,t,n,s){let r;return e.wholeWord&&(r=lFe(t.charCategorizer(t.selection.main.head))),e.test&&(r=aFe(e.test,t,r)),new tle(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:r},n,s)}function f3(e,t){return e.slice(ha(e,t,!1),t)}function m3(e,t){return e.slice(t,ha(e,t))}function lFe(e){return(t,n,s)=>!s[0].length||(e(f3(s.input,s.index))!=Di.Word||e(m3(s.input,s.index))!=Di.Word)&&(e(m3(s.input,s.index+s[0].length))!=Di.Word||e(f3(s.input,s.index+s[0].length))!=Di.Word)}class cFe extends rle{nextMatch(t,n,s){let r=x1(this.spec,t,s,t.doc.length).next();return r.done&&(r=x1(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=x1(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=x1(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=x1(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 Sx=Ss.define(),QD=Ss.define(),Dm=Da.define({create(e){return new uE(_M(e).create(),null)},update(e,t){for(let n of t.effects)n.is(Sx)?e=new uE(n.value.create(),e.panel):n.is(QD)&&(e=new uE(e.query,n.value?JD:null));return e},provide:e=>yx.from(e,t=>t.panel)});class uE{constructor(t,n){this.query=t,this.panel=n}}const uFe=Rn.mark({class:"cm-searchMatch"}),dFe=Rn.mark({class:"cm-searchMatch cm-searchMatch-selected"}),hFe=Oi.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Dm))}update(e){let t=e.state.field(Dm);(t!=e.startState.field(Dm)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return Rn.none;let{view:n}=this,s=new Wd;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 f=n.state.selection.ranges.some(m=>m.from==u&&m.to==d);s.add(u,d,f?dFe:uFe)})}return s.finish()}},{decorations:e=>e.decorations});function Mk(e){return t=>{let n=t.state.field(Dm,!1);return n&&n.query.spec.valid?e(t,n):ale(t)}}const p3=Mk((e,{query:t})=>{let{to:n}=e.state.selection.main,s=t.nextMatch(e.state,n,n);if(!s)return!1;let r=ut.single(s.from,s.to),i=e.state.facet(vy);return e.dispatch({selection:r,effects:[ZD(e,s),i.scrollToMatch(r.main,e)],userEvent:"select.search"}),ole(e),!0}),g3=Mk((e,{query:t})=>{let{state:n}=e,{from:s}=n.selection.main,r=t.prevMatch(n,s,s);if(!r)return!1;let i=ut.single(r.from,r.to),o=e.state.facet(vy);return e.dispatch({selection:i,effects:[ZD(e,r),o.scrollToMatch(i.main,e)],userEvent:"select.search"}),ole(e),!0}),fFe=Mk((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:ut.create(n.map(s=>ut.range(s.from,s.to))),userEvent:"select.search.matches"}),!0)}),mFe=({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 Fb(e.doc,e.sliceDoc(s,r));!a.next().done;){if(i.length>1e3)return!1;a.value.from==s&&(o=i.length),i.push(ut.range(a.value.from,a.value.to))}return t(e.update({selection:ut.create(i,o),userEvent:"select.search.matches"})),!0},OU=Mk((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(Vt.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(s).number)+"."))):o=t.nextMatch(n,o.from,o.to);let f=e.state.changes(a);return o&&(c=ut.single(o.from,o.to).map(f),d.push(ZD(e,o)),d.push(n.facet(vy).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:"input.replace"}),!0}),pFe=Mk((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:Vt.announce.of(s),userEvent:"input.replace.all"}),!0});function JD(e){return e.state.facet(vy).createPanel(e)}function _M(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(vy);return new sle({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 ile(e){let t=RD(e,JD);return t&&t.dom.querySelector("[main-field]")}function ole(e){let t=ile(e);t&&t==e.root.activeElement&&t.select()}const ale=e=>{let t=e.state.field(Dm,!1);if(t&&t.panel){let n=ile(e);if(n&&n!=e.root.activeElement){let s=_M(e.state,t.query.spec);s.valid&&e.dispatch({effects:Sx.of(s)}),n.focus(),n.select()}}else e.dispatch({effects:[QD.of(!0),t?Sx.of(_M(e.state,t.query.spec)):Ss.appendConfig.of(wFe)]});return!0},lle=e=>{let t=e.state.field(Dm,!1);if(!t||!t.panel)return!1;let n=RD(e,JD);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:QD.of(!1)}),!0},gFe=[{key:"Mod-f",run:ale,scope:"editor search-panel"},{key:"F3",run:p3,shift:g3,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:p3,shift:g3,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:lle,scope:"editor search-panel"},{key:"Mod-Shift-l",run:mFe},{key:"Mod-Alt-g",run:Vze},{key:"Mod-d",run:sFe,preventDefault:!0}];class bFe{constructor(t){this.view=t;let n=this.query=t.state.field(Dm).query.spec;this.commit=this.commit.bind(this),this.searchField=Jr("input",{value:n.search,placeholder:cc(t,"Find"),"aria-label":cc(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Jr("input",{value:n.replace,placeholder:cc(t,"Replace"),"aria-label":cc(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Jr("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Jr("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Jr("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function s(r,i,o){return Jr("button",{class:"cm-button",name:r,onclick:i,type:"button"},o)}this.dom=Jr("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,s("next",()=>p3(t),[cc(t,"next")]),s("prev",()=>g3(t),[cc(t,"previous")]),s("select",()=>fFe(t),[cc(t,"all")]),Jr("label",null,[this.caseField,cc(t,"match case")]),Jr("label",null,[this.reField,cc(t,"regexp")]),Jr("label",null,[this.wordField,cc(t,"by word")]),...t.state.readOnly?[]:[Jr("br"),this.replaceField,s("replace",()=>OU(t),[cc(t,"replace")]),s("replaceAll",()=>pFe(t),[cc(t,"replace all")])],Jr("button",{name:"close",onclick:()=>lle(t),"aria-label":cc(t,"close"),type:"button"},["×"])])}commit(){let t=new sle({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:Sx.of(t)}))}keydown(t){BLe(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?g3:p3)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),OU(this.view))}update(t){for(let n of t.transactions)for(let s of n.effects)s.is(Sx)&&!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(vy).top}}function cc(e,t){return e.state.phrase(t)}const XS=30,QS=/[\s\.,:;?!]/;function ZD(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-XS),o=Math.min(r,n+XS),a=e.state.sliceDoc(i,o);if(i!=s.from){for(let c=0;c<XS;c++)if(!QS.test(a[c+1])&&QS.test(a[c])){a=a.slice(c);break}}if(o!=r){for(let c=a.length-1;c>a.length-XS;c--)if(!QS.test(a[c-1])&&QS.test(a[c])){a=a.slice(0,c);break}}return Vt.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${s.number}.`)}const yFe=Vt.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"}}),wFe=[Dm,Ap.low(hFe),yFe];class $U{constructor(t,n,s){this.from=t,this.to=n,this.diagnostic=s}}class p0{constructor(t,n,s){this.diagnostics=t,this.panel=n,this.selected=s}static init(t,n,s){let r=s.facet(Cx).markerFilter;r&&(t=r(t,s));let i=t.slice().sort((p,g)=>p.from-g.from||p.to-g.to),o=new Wd,a=[],c=0,u=s.doc.iter(),d=0,f=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((x,k)=>Math.min(x,k.to),g&&g.from>b?g.from:1e8);else{if(b=g.from,b>f)break;v=g.to,a.push(g),p++}for(;p<i.length;){let x=i[p];if(x.from==b&&(x.to>x.from||x.to==b))a.push(x),p++,v=Math.min(x.to,v);else{v=Math.min(x.from,v);break}}v=Math.min(v,f);let y=!1;if(a.some(x=>x.from==b&&(x.to==v||v==f))&&(y=b==v,!y&&v-b<10)){let x=b-(d+u.value.length);x>0&&(u.next(x),d=b);for(let k=b;;){if(k>=v){y=!0;break}if(!u.lineBreak&&d+u.value.length>k)break;k=d+u.value.length,d+=u.value.length,u.next()}}let w=IFe(a);if(y)o.add(b,b,Rn.widget({widget:new jFe(w),diagnostics:a.slice()}));else{let x=a.reduce((k,C)=>C.markClass?k+" "+C.markClass:k,"");o.add(b,v,Rn.mark({class:"cm-lintRange cm-lintRange-"+w+x,diagnostics:a.slice(),inclusiveEnd:a.some(k=>k.to>v)}))}if(c=v,c==f)break;for(let x=0;x<a.length;x++)a[x].to<=c&&a.splice(x--,1)}let m=o.finish();return new p0(m,n,dp(m))}}function dp(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 $U(r,i,t||o.diagnostics[0]);else{if(o.diagnostics.indexOf(s.diagnostic)<0)return!1;s=new $U(s.from,i,s.diagnostic)}}),s}function vFe(e,t){let n=t.pos,s=t.end||n,r=e.state.facet(Cx).hideOn(e,n,s);if(r!=null)return r;let i=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(o=>o.is(cle))||e.changes.touchesRange(i.from,Math.max(i.to,s)))}function xFe(e,t){return e.field(_c,!1)?t:t.concat(Ss.appendConfig.of(RFe))}const cle=Ss.define(),eP=Ss.define(),ule=Ss.define(),_c=Da.define({create(){return new p0(Rn.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=dp(n,e.selected.diagnostic,i)||dp(n,null,i)}!n.size&&r&&t.state.facet(Cx).autoPanel&&(r=null),e=new p0(n,r,s)}for(let n of t.effects)if(n.is(cle)){let s=t.state.facet(Cx).autoPanel?n.value.length?Tx.open:null:e.panel;e=p0.init(n.value,s,t.state)}else n.is(eP)?e=new p0(e.diagnostics,n.value?Tx.open:null,e.selected):n.is(ule)&&(e=new p0(e.diagnostics,e.panel,n.value));return e},provide:e=>[yx.from(e,t=>t.panel),Vt.decorations.from(e,t=>t.diagnostics)]}),kFe=Rn.mark({class:"cm-lintRange cm-lintRange-active"});function _Fe(e,t,n){let{diagnostics:s}=e.state.field(_c),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(Cx).tooltipFilter;return r&&a&&(r=a(r,e.state)),r?{pos:i,end:o,above:!0,create(){return{dom:SFe(e,r)}}}:null}function SFe(e,t){return Jr("ul",{class:"cm-tooltip-lint"},t.map(n=>hle(e,n,!1)))}const CFe=e=>{let t=e.state.field(_c,!1);(!t||!t.panel)&&e.dispatch({effects:xFe(e.state,[eP.of(!0)])});let n=RD(e,Tx.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},BU=e=>{let t=e.state.field(_c,!1);return!t||!t.panel?!1:(e.dispatch({effects:eP.of(!1)}),!0)},TFe=e=>{let t=e.state.field(_c,!1);if(!t)return!1;let n=e.state.selection.main,s=dp(t.diagnostics,null,n.to+1);return!s&&(s=dp(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}),TOe(e,s.from,1,{tooltip:fle,until:r=>r.docChanged||r.newSelection.main.head<s.from||r.newSelection.main.head>s.to}),!0)},EFe=[{key:"Mod-Shift-m",run:CFe,preventDefault:!0},{key:"F8",run:TFe}],Cx=yn.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...th(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:zU,tooltipFilter:zU,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 zU(e,t){return e?t?(n,s)=>t(e(n,s),s):e:t}function dle(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 hle(e,t,n){var s;let r=n?dle(t.actions):[];return Jr("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},Jr("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=dp(e.state.field(_c).diagnostics,t);g&&i.apply(e,g.from,g.to)},{name:u}=i,d=r[o]?u.indexOf(r[o]):-1,f=d<0?u:[u.slice(0,d),Jr("u",u.slice(d,d+1)),u.slice(d+1)],m=i.markClass?" "+i.markClass:"";return Jr("button",{type:"button",class:"cm-diagnosticAction"+m,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${r[o]})"`}.`},f)}),t.source&&Jr("div",{class:"cm-diagnosticSource"},t.source))}class jFe extends zc{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return Jr("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class FU{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=hle(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Tx{constructor(t){this.view=t,this.items=[];let n=r=>{if(!(r.ctrlKey||r.altKey||r.metaKey)){if(r.keyCode==27)BU(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=dle(i.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==r.keyCode){let c=dp(this.view.state.field(_c).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=Jr("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:s}),this.dom=Jr("div",{class:"cm-panel-lint"},this.list,Jr("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>BU(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(_c).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(_c),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 f=-1,m;for(let p=s;p<this.items.length;p++)if(this.items[p].diagnostic==d){f=p;break}f<0?(m=new FU(this.view,d),this.items.splice(s,0,m),r=!0):(m=this.items[f],f>s&&(this.items.splice(s,f-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 FU(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(_c),s=dp(n.diagnostics,this.items[t].diagnostic);s&&this.view.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0,effects:ule.of(s)})}static open(t){return new Tx(t)}}function AFe(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 JS(e){return AFe(`<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 NFe=Vt.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:JS("#f11")},".cm-lintRange-warning":{backgroundImage:JS("orange")},".cm-lintRange-info":{backgroundImage:JS("#999")},".cm-lintRange-hint":{backgroundImage:JS("#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 MFe(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function IFe(e){let t="hint",n=1;for(let s of e){let r=MFe(s.severity);r>n&&(n=r,t=s.severity)}return t}const fle=COe(_Fe,{hideOn:vFe}),RFe=[_c,Vt.decorations.compute([_c],e=>{let{selected:t,panel:n}=e.field(_c);return!t||!n||t.from==t.to?Rn.none:Rn.set([kFe.range(t.from,t.to)])}),fle,NFe],mle=[BOe(),HOe(),Ooe(),HD(),D$e(),Doe(),YLe(),dr.allowMultipleSelections.of(!0),v$e(),aae(lae,{fallback:!0}),U$e(),Rze(),Jae(),fOe(),gOe(),oOe(),Yze(),$b.of([...Oze,...WD,...gFe,...qD,...N$e,...Zae,...EFe])],DFe=[Ooe(),HD(),Doe(),aae(lae,{fallback:!0}),$b.of([...WD,...qD])];/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const PFe="(hover: none) and (pointer: coarse)";function Vw(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(PFe).matches}function LFe(){if(typeof window<"u"){const e=new URLSearchParams(window.location.search).get("composer");if(e==="textarea")return!0;if(e==="codemirror")return!1}return Vw()}function OFe(){const[e]=h.useState(LFe);return e}/** @license
 * fzf v0.5.2
 * Copyright (c) 2021 Ajit
 * Licensed under BSD 3-Clause
 */const tP={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&&(tP[r]=n)}}const dE={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(const e of Object.keys(dE)){const t=e.toUpperCase();for(let n=dE[e][0];n<=dE[e][1];++n)tP[n]=n%2===0?t:e}function Ik(e){if(e<192||e>8580)return e;const t=tP[e];return t!==void 0?t.codePointAt(0):e}function em(e,t){return e>t?e:t}const ple=e=>e.split("").map(t=>t.codePointAt(0)),$Fe=new Set(` \f
\r	\v  \u2028\u2029  　\uFEFF`.split("").map(e=>e.codePointAt(0)));for(let e=" ".codePointAt(0);e<=" ".codePointAt(0);e++)$Fe.add(e);const Hb="".codePointAt(0),Ex="A".codePointAt(0),jx="Z".codePointAt(0),gle="a".codePointAt(0),ble="z".codePointAt(0),BFe="0".codePointAt(0),zFe="9".codePointAt(0);function z1(e,t,n){return n?e:t-e-1}const Ax=16,SM=-3,b3=-1,Q0=Ax/2,FFe=Ax/2,HFe=Q0+b3,yle=4,wle=2;function CM(e){return e?new Set:null}function ww(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 HU(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 vle(e){return e>=gle&&e<=ble?1:e>=Ex&&e<=jx?2:e>=BFe&&e<=zFe?4:0}function xle(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 y3(e){return e<=Hb?vle(e):xle(e)}function nP(e,t){return e===0&&t!==0?Q0:e===1&&t===2||e!==4&&t===4?HFe:t===0?FFe:0}function qFe(e,t){return t===0?Q0:nP(y3(e[t-1]),y3(e[t]))}function UFe(e,t,n,s){let r=e.slice(s),i=r.indexOf(n);if(i===0)return s;if(!t&&n>=gle&&n<=ble){i>0&&(r=r.slice(0,i));const o=r.indexOf(n-32);o>=0&&(i=o)}return i<0?-1:s+i}function qU(e){for(const t of e)if(t>=128)return!1;return!0}function sP(e,t,n){if(!qU(e))return 0;if(!qU(t))return-1;let s=0,r=0;for(let i=0;i<t.length;i++){if(r=UFe(e,n,t[i],r),r<0)return-1;i===0&&r>0&&(s=r-1),r++}return s}const WFe=(e,t,n,s,r,i,o)=>{const a=r.length;if(a===0)return[{start:0,end:0,score:0},CM(i)];const c=s.length;if(o!==null&&c*a>o.i16.length)return _le(e,t,n,s,r,i);const u=sP(s,r,e);if(u<0)return[{start:-1,end:-1,score:0},null];let d=0,f=0,m=null,p=null,g=null,b=null;[d,m]=ww(d,o,c),[d,p]=ww(d,o,c),[d,g]=ww(d,o,c),[f,b]=HU(f,o,a);const[,v]=HU(f,o,c);for(let W=0;W<v.length;W++)v[W]=s[W];let y=0,w=0,x=0,k=0;const C=r[0];let T=r[0],_=0,S=0,R=!1,A=v.subarray(u),O=m.subarray(u).subarray(0,A.length),M=p.subarray(u).subarray(0,A.length),D=g.subarray(u).subarray(0,A.length);for(let[W,P]of A.entries()){let V=null;P<=Hb?(V=vle(P),!e&&V===2&&(P+=32)):(V=xle(P),!e&&V===2&&(P=String.fromCodePoint(P).toLowerCase().codePointAt(0)),t&&(P=Ik(P))),A[W]=P;const ee=nP(S,V);if(D[W]=ee,S=V,P===T&&(x<a&&(b[x]=u+W,x++,T=r[Math.min(x,a-1)]),k=u+W),P===C){const q=Ax+ee*wle;if(O[W]=q,M[W]=1,a===1&&(n&&q>y||!n&&q>=y)&&(y=q,w=u+W,n&&ee===Q0))break;R=!1}else R?O[W]=em(_+b3,0):O[W]=em(_+SM,0),M[W]=0,R=!0;_=O[W]}if(x!==a)return[{start:-1,end:-1,score:0},null];if(a===1){const W={start:w,end:w+1,score:y};if(!i)return[W,null];const P=new Set;return P.add(w),[W,P]}const $=b[0],z=k-$+1;let B=null;[d,B]=ww(d,o,z*a);{const W=m.subarray($,k+1);for(const[P,V]of W.entries())B[P]=V}let[,j]=ww(d,o,z*a);{const W=p.subarray($,k+1);for(const[P,V]of W.entries())j[P]=V}const H=b.subarray(1),Q=r.slice(1).slice(0,H.length);for(const[W,P]of H.entries()){let V=!1;const ee=Q[W],q=W+1,K=q*z,de=v.subarray(P,k+1),re=g.subarray(P).subarray(0,de.length),ne=j.subarray(K+P-$).subarray(0,de.length),U=j.subarray(K+P-$-1-z).subarray(0,de.length),Z=B.subarray(K+P-$).subarray(0,de.length),ge=B.subarray(K+P-$-1-z).subarray(0,de.length),ce=B.subarray(K+P-$-1).subarray(0,de.length);ce[0]=0;for(const[ue,be]of de.entries()){const rt=ue+P;let le=0,Me=0,We=0;if(V?Me=ce[ue]+b3:Me=ce[ue]+SM,ee===be){le=ge[ue]+Ax;let ze=re[ue];We=U[ue]+1,ze===Q0?We=1:We>1&&(ze=em(ze,em(yle,g[rt-We+1]))),le+ze<Me?(le+=re[ue],We=0):le+=ze}ne[ue]=We,V=le<Me;const at=em(em(le,Me),0);q===a-1&&(n&&at>y||!n&&at>=y)&&(y=at,w=rt),Z[ue]=at}}const I=CM(i);let J=$;if(i&&I!==null){let W=a-1;J=w;let P=!0;for(;;){const V=W*z,ee=J-$,q=B[V+ee];let K=0,de=0;if(W>0&&J>=b[W]&&(K=B[V-z+ee-1]),J>b[W]&&(de=B[V+ee-1]),q>K&&(q>de||q===de&&P)){if(I.add(J),W===0)break;W--}P=j[V+ee]>1||V+z+ee+1<j.length&&j[V+z+ee+1]>0,J--}}return[{start:J,end:w+1,score:y},I]};function kle(e,t,n,s,r,i,o){let a=0,c=0,u=!1,d=0,f=0;const m=CM(o);let p=0;r>0&&(p=y3(n[r-1]));for(let g=r;g<i;g++){let b=n[g];const v=y3(b);if(e||(b>=Ex&&b<=jx?b+=32:b>Hb&&(b=String.fromCodePoint(b).toLowerCase().codePointAt(0))),t&&(b=Ik(b)),b===s[a]){o&&m!==null&&m.add(g),c+=Ax;let y=nP(p,v);d===0?f=y:(y===Q0&&(f=y),y=em(em(y,f),yle)),a===0?c+=y*wle:c+=y,u=!1,d++,a++}else u?c+=b3:c+=SM,u=!0,d=0,f=0;p=v}return[c,m]}const _le=(e,t,n,s,r,i,o)=>{if(r.length===0)return[{start:0,end:0,score:0},null];if(sP(s,r,e)<0)return[{start:-1,end:-1,score:0},null];let a=0,c=-1,u=-1;const d=s.length,f=r.length;for(let m=0;m<d;m++){let p=s[z1(m,d,n)];e||(p>=Ex&&p<=jx?p+=32:p>Hb&&(p=String.fromCodePoint(p).toLowerCase().codePointAt(0))),t&&(p=Ik(p));const g=r[z1(a,f,n)];if(p===g&&(c<0&&(c=m),a++,a===f)){u=m+1;break}}if(c>=0&&u>=0){a--;for(let g=u-1;g>=c;g--){const b=z1(g,d,n);let v=s[b];e||(v>=Ex&&v<=jx?v+=32:v>Hb&&(v=String.fromCodePoint(v).toLowerCase().codePointAt(0)));const y=z1(a,f,n),w=r[y];if(v===w&&(a--,a<0)){c=g;break}}if(!n){const g=c;c=d-u,u=d-g}const[m,p]=kle(e,t,s,r,c,u,i);return[{start:c,end:u,score:m},p]}return[{start:-1,end:-1,score:0},null]},VFe=(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(sP(s,r,e)<0)return[{start:-1,end:-1,score:0},null];let u=0,d=-1,f=0,m=-1;for(let p=0;p<a;p++){const g=z1(p,a,n);let b=s[g];e||(b>=Ex&&b<=jx?b+=32:b>Hb&&(b=String.fromCodePoint(b).toLowerCase().codePointAt(0))),t&&(b=Ik(b));const v=z1(u,c,n);if(r[v]===b){if(v===0&&(f=qFe(s,g)),u++,u===c){if(f>m&&(d=p,m=f),f===Q0)break;p-=u-1,u=0,f=0}}else p-=u,u=0,f=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]=kle(e,t,s,r,p,g,!1);return[{start:p,end:g,score:b},null]}return[{start:-1,end:-1,score:0},null]},GFe=100*1024,KFe=2048;function YFe(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}const XFe=YFe(GFe,KFe),QFe=(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=ple(e);return n&&(r=r.map(Ik)),{queryRunes:r,caseSensitive:s}};function JFe(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 ZFe(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,XFe);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 eHe(e){const{queryRunes:t,caseSensitive:n}=QFe(e,this.opts.casing,this.opts.normalize),s={},r=ZFe.bind(this)(s,t,n);for(let i=0,o=this.runesList.length;i<o;++i)r(i);return JFe(s,this.opts.limit)}const Sle={limit:1/0,selector:e=>e,casing:"smart-case",normalize:!0,fuzzy:"v2",tiebreakers:[],sort:!0,forward:!0};class tHe{constructor(t,...n){switch(this.opts={...Sle,...n[0]},this.items=t,this.runesList=t.map(s=>ple(this.opts.selector(s).normalize())),this.algoFn=VFe,this.opts.fuzzy){case"v2":this.algoFn=WFe;break;case"v1":this.algoFn=_le;break}}}const nHe={...Sle,match:eHe};class sHe extends tHe{constructor(t,...n){super(t,...n),this.opts={...nHe,...n[0]}}find(t){if(t.length===0||this.items.length===0)return this.items.slice(0,this.opts.limit).map(rHe);t=t.normalize();let n=this.opts.match.bind(this)(t);return iHe(n,this.opts)}}const rHe=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function iHe(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 oHe{constructor(t,...n){this.finder=new sHe(t,...n),this.find=this.finder.find.bind(this.finder)}}const Nx=["custom","skill","system"];function TM(e){return e.displayCategory?e.displayCategory:e.source==="builtin-command"?"system":e.source==="bundled-skill"||e.source==="skill"?"skill":"custom"}function aHe(e,t,n=Nx){return UU(TM(e),n)-UU(TM(t),n)}function UU(e,t=Nx){const n=t.indexOf(e);return n>=0?n:t.length+Nx.indexOf(e)}const rP=String.raw`([^\s/]+)`,k5={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:"安装扩展"}]},_5={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"}]},S5={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 文件列表"}]},C5={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 lHe(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"?k5:_5)[e];if(o||(o=(s==="zh-CN"?S5:C5)[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 cHe(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 uHe(e,t,n,s){const r=aHe(e,t,s);return r!==0?r:0}const dHe={custom:"slash.category.custom",skill:"slash.category.skill",system:"slash.category.system"};function hHe(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 fHe(e,t,n){var u;const s=e.match(new RegExp(`^/${rP}\\s+$`));if(!s)return null;const r=s[1],i=t.find(d=>d.name===r),o=n==="zh-CN"?k5:_5;if((u=i==null?void 0:i.subcommands)!=null&&u.length||o[r]||r==="skills")return null;const c=(n==="zh-CN"?S5:C5)[r];return!c||c.length===0?null:`/${r} ${c[0].name} `}function mHe(e,t,n){var d,f;const s=e.match(new RegExp(`^/${rP}(\\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"?k5:_5;if((f=i.subcommands)!=null&&f.length||a[r]||r==="skills")return null;const u=(n==="zh-CN"?S5:C5)[r];return!u||u.length===0?null:`[${u.map(m=>m.name).join("|")}]`}function pHe(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 WU=new WeakMap;function gHe(e){let t=WU.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 oHe(n,{fuzzy:"v2",casing:"case-insensitive"}),byName:s},WU.set(e,t)}return t}function bHe(e,t){try{const{fzf:n,byName:s}=gHe(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 yHe(e,t,n,s=[],r="en",i=a=>a,o=Nx){var w,x;const{lineStart:a,lineEnd:c,lineText:u,textBefore:d,cursor:f}=pHe(e,t),m=d.match(new RegExp(`^/${rP}\\s+(.*)$`));if(m){const[,k,C]=m,T=n.find(I=>I.name===k),_=r==="zh-CN"?k5:_5,S=r==="zh-CN"?S5:C5,R=!!_[k]||k==="skills",A=!!S[k];if(!((w=T==null?void 0:T.subcommands)!=null&&w.length)&&!R&&!A)return null;const O=C.split(/\s+/),M=O.pop()||"",D=O;if(!((x=T==null?void 0:T.subcommands)!=null&&x.length)&&!R&&A&&!M)return null;const $=lHe(k,D,s,r,T==null?void 0:T.subcommands);if(!$)return null;const z=M.toLowerCase(),B=`/${k} ${D.length>0?D.join(" ")+" ":""}`,j=$.filter(I=>!M||I.name.toLowerCase().includes(z)).sort((I,J)=>M?cHe(I.name,J.name,z):0),H=k==="skills"&&D.length===0,Q=j.map(I=>{const J=`${B}${I.name}`;return{id:J,label:I.name,detail:I.description||void 0,apply:`${J} `,...H?{type:"skill"}:{}}});return Q.length===0?null:{kind:"subcommand",from:a,to:f,query:M,items:Q}}const p=u.match(/^\/([^\s/]*)$/);if(!p)return null;const g=p[1],b=g.length===0,y=(b?[...n].sort((k,C)=>uHe(k,C,"",o)):bHe(n,g)).map(k=>{const C=`/${k.name} `,T=TM(k),_=T==="custom"||T==="skill";return{id:k.name,label:`/${k.name}`,detail:k.description||void 0,apply:C,category:T,...b?{section:i(dHe[T])}:{},..._&&k.description?{type:"command-info"}:{}}});return y.length===0?null:{kind:"command",from:a,to:c,query:g,items:y}}const EM="qwen-web-shell-history",iP=100;function VU(e){return e?`${EM}:${encodeURIComponent(e)}`:EM}function w3(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 jM(e,t){const n=w3(e);return n.length===0&&t?w3(t):n}function v3(e,t){try{localStorage.setItem(e,JSON.stringify(t.slice(-iP)))}catch{}}function wHe(e,t,n){const s=jM(e,n);if(s[s.length-1]===t){n&&w3(e).length===0&&v3(e,s);return}s.push(t),s.length>iP&&s.shift(),v3(e,s)}function GU(e=EM,t){const n=h.useRef(e),s=h.useRef(t),r=h.useRef(e),i=h.useRef(t);n.current=e,s.current=t;const o=h.useRef([]),a=h.useRef(!1);a.current||(o.current=jM(e,t),a.current=!0);const c=h.useRef(-1),u=h.useRef(""),d=h.useRef(-1),[f,m]=h.useState(()=>({canUp:o.current.length>0,canDown:!1})),p=h.useCallback(()=>{const _=o.current,S=c.current;m({canUp:_.length>0&&(S===-1||S>0),canDown:S!==-1})},[]);h.useEffect(()=>{r.current===e&&i.current===t||(r.current=e,i.current=t,o.current=jM(e,t),c.current=-1,u.current="",d.current=-1,p())},[t,e,p]);const g=h.useCallback(_=>{const S=o.current;if(S[S.length-1]===_){s.current&&w3(n.current).length===0&&v3(n.current,S);return}S.push(_),S.length>iP&&S.shift(),v3(n.current,S),c.current=-1,p()},[p]),b=h.useCallback(_=>{const S=o.current;if(S.length===0)return null;if(c.current===-1)u.current=_,c.current=S.length-1;else if(c.current>0)c.current--;else return null;return p(),S[c.current]},[p]),v=h.useCallback(()=>{const _=o.current;return c.current===-1?null:c.current<_.length-1?(c.current++,p(),_[c.current]):(c.current=-1,p(),u.current)},[p]),y=h.useCallback(()=>c.current!==-1,[]),w=h.useCallback(()=>{c.current=-1,d.current=-1,p()},[p]),x=h.useCallback(_=>{const S=o.current;if(S.length===0||!_)return null;const R=d.current===-1?S.length-1:d.current-1;if(R<0)return d.current=-1,null;const A=_.toLowerCase();for(let O=R;O>=0;O--)if(S[O].toLowerCase().includes(A))return d.current=O,S[O];return d.current=-1,null},[]),k=h.useCallback(_=>{const S=_.trim().toLowerCase();return o.current.slice().reverse().filter(R=>!S||R.toLowerCase().includes(S))},[]),C=h.useCallback(_=>{const S=o.current;if(!_)return S.length>0?S[S.length-1]:null;for(let R=S.length-1;R>=0;R--)if(_(S[R]))return S[R];return null},[]),T=h.useCallback(()=>{d.current=-1},[]);return{push:g,navigateUp:b,navigateDown:v,isNavigating:y,reset:w,searchReverse:x,getReverseMatches:k,getLastEntry:C,resetSearch:T,nav:f}}function ZS(){return{directories:new Map,globResults:new Map,mcpResources:new Map}}function AM(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 vHe=/@((?:[\p{L}\p{N}_./:-]|\\.)*)$/u,xHe=[],KU=150,J0=50,Cle=J0+1,va="files",xy="extensions",_a="mcp-resources",Tle=[va,xy,_a],kHe="\x1B",Ele=new RegExp(`${kHe}(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])`,"g"),jle=/[\u200B\u200E\u200F\u061C\u2066-\u2069\u202A-\u202E]/g,Mx="[invalid]",_He=/[^\p{L}\p{N}_./-]/gu;function m4(e){return Tle.includes(e)}function SHe(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 CHe(e){const t=new Set(Tle),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 YU(e){return(e.textValue===void 0?void 0:ni(e.textValue))??(typeof e.label=="string"?ni(e.label)??void 0:void 0)??yf(e.id)??Mx}function Ale(e,t){return e==="."||e===""?t:`${e.replace(/\/+$/,"")}/${t}`}function nf(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 THe(e){return Array.from(e,t=>/[a-z]/i.test(t)?`[${t.toLowerCase()}${t.toUpperCase()}]`:/[\\*?[{\]}()!@+|]/.test(t)?`\\${t}`:t).join("")}function NM(e){const t=T5(e).replace(/^\.\//,"");return t?`**/*${THe(t)}*`:"**/*"}function x3(e,...t){const n=e.toLowerCase();return t.some(s=>s==null?void 0:s.toLowerCase().includes(n))}function XU(e){const t=nf(e),n=Vd(t);return t==="."?"@./ ":`@${Z0(n)}/ `}function EHe(e,t){return`${e}:${t}`}function Z0(e){return e.replace(_He,"\\$&")}function T5(e){return e.replace(/\\(.)/g,"$1")}function Nle(e){const t=e.charCodeAt(0);return t>31&&t!==127&&(t<128||t>159)}function jHe(e,t){return`@${Z0(EHe(Vd(e),Vd(t)))} `}function AHe(e,t,n){const s=T5(e);return t===_a&&n&&s.startsWith(`${n}:`)?{providerId:_a,serverName:n,itemQuery:s.slice(n.length+1),validateServer:!0}:e.startsWith("ext:")?{providerId:xy,itemQuery:e.slice(4)}:e.startsWith("mcp:")?{providerId:_a,itemQuery:e.slice(4)}:null}function NHe(e,t,n){if(e===xy&&t.startsWith("ext:")||e===_a&&t.startsWith("mcp:"))return t.slice(4);const s=T5(t);return e===_a&&n&&s.startsWith(`${n}:`)?s.slice(n.length+1):!m4(e)&&t.startsWith(`${e}:`)?t.slice(e.length+1):t}async function MHe(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 IHe(e){const t=nf(e);if(t===".")return".";const n=t.lastIndexOf("/");return n<0?".":t.slice(0,n)}function Mle(e,t){const n=T5(e).replace(/^\.\/+/,"").replace(/\/+/g,"/"),s=n.lastIndexOf("/");if(s<0)return{dirPath:nf(t),entryQuery:n};const r=n.slice(0,s),i=nf(t),o=i==="."?r:Ale(i,r);return{dirPath:nf(o),entryQuery:n.slice(s+1)}}function RHe(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(vHe);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 ni(e){const t=e.replace(Ele,"").replace(jle,"").split("").filter(Nle).join("").replace(/\s+/g," ").trim();return t.length>0?t:void 0}function Vd(e){const t=e.replace(Ele,"").replace(jle,"").split("").filter(Nle).join("");return t.length>0?t:Mx}function yf(e){return e===void 0?Mx:ni(e)??Mx}function DHe(e){if(e!==void 0)return Vd(e).trim()}function PHe(e){if(!e)return;const t=e.kind===void 0?void 0:ni(e.kind);return{id:ni(e.id)??Mx,label:e.label===void 0?void 0:ni(e.label),value:e.value===void 0?void 0:ni(e.value),removable:e.removable,kind:t,icon:e.icon,metadata:e.metadata,serialized:DHe(e.serialized)}}function LHe(e,t){const n={...e,label:ni(e.label)??yf(e.id),description:e.description===void 0?void 0:ni(e.description),subtitle:e.subtitle===void 0?void 0:ni(e.subtitle),detail:e.detail===void 0?void 0:ni(e.detail),icon:e.icon,iconTooltip:e.iconTooltip===void 0?void 0:ni(e.iconTooltip),insertText:e.insertText===void 0?void 0:Vd(e.insertText),composerTag:PHe(e.composerTag)};if(!(t!=null&&t.customProvider))return n;const s={...n};return delete s.targetPath,delete s.serverName,{...s,kind:"insert"}}function OHe(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===xy?{id:`extension:${s}`,kind:"extension",value:t.label,serialized:s}:e===_a?{id:`mcp:${s}`,kind:"mcp",value:t.label,serialized:s}:e===va?{id:`file:${s}`,kind:"file",value:t.description??t.label,serialized:s}:null:null}function $He(e,t,n,s,r){return{id:va,label:s,description:r,order:1,async search({query:i,signal:o}){const a=e(),c=nf(t()),u=a==null?void 0:a.listDirectory;if(u&&(!i||!(a!=null&&a.globWorkspace)))try{const{dirPath:f,entryQuery:m}=Mle(i,c),p=m.toLowerCase(),g=await AM(n().directories,f,()=>u(f,{signal:o}));if(o.aborted)return[];const b=g.entries.filter(y=>!y.ignored).filter(y=>y.name.toLowerCase().includes(p)).sort((y,w)=>y.kind==="directory"&&w.kind!=="directory"?-1:y.kind!=="directory"&&w.kind==="directory"?1:y.name.localeCompare(w.name)),v={id:`current:${f}`,label:XU(f).trim(),description:ni(f),insertText:XU(f),kind:"insert"};return[...m?[]:[v],...b.map(y=>{const w=Ale(f,y.name),x=yf(y.name),k=ni(w),C=Vd(w);return y.kind==="directory"?{id:`dir:${w}`,label:`${x}/`,description:k,kind:"directory",targetPath:w}:{id:`file:${w}`,label:x,description:k,insertText:`@${Z0(C)} `,kind:"insert"}})].slice(0,m?J0:Cle)}catch(f){return o.aborted||console.warn("Failed to load @ file suggestions",f),[]}const d=a==null?void 0:a.globWorkspace;if(!d)return console.warn("[@mention] file provider unavailable: workspace actions are not configured"),[];try{const f=NM(i),m=await AM(n().globResults,f,()=>d(f,{maxResults:J0,signal:o}));return o.aborted?[]:m.matches.filter(p=>p!==".").map(p=>({id:p,label:yf(p),insertText:`@${Z0(Vd(p))} `,kind:"insert"}))}catch(f){return o.aborted||console.warn("Failed to load @ file suggestions",f),[]}}}}function BHe(e,t,n,s){return{id:xy,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(f=>{throw c.extensionsStatus=void 0,f}));const u=await c.extensionsStatus;if(i.aborted)return[];const d=r.toLowerCase();return u.extensions.filter(f=>f.isActive).map(f=>{const m=yf(f.name),g=`@ext:${Z0(Vd(f.name))}`,b=ni(f.displayName??""),v=ni(f.description??"");return{id:f.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(f=>x3(d,f.label,f.description)).sort((f,m)=>{const p=f.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,J0)}catch(c){return i.aborted||console.warn("Failed to load @ extension suggestions",c),[]}}}}function zHe(e,t,n,s,r){return{id:_a,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 f=i.toLowerCase();return d.servers.filter(m=>!m.disabled).map(m=>{const p=Vd(m.name),g=m.resourceCount===void 0?void 0:r(m.resourceCount);return m.resourceCount===0?{id:`mcp-server-ref:${m.name}`,label:yf(m.name),description:ni(m.description??""),detail:ni(m.description??""),insertText:`@mcp:${Z0(p)} `,kind:"insert"}:{id:`mcp-server:${m.name}`,label:yf(m.name),description:g===void 0?ni(m.description??""):g,detail:ni(m.description??""),kind:"mcp-server",serverName:m.name}}).filter(m=>x3(f,m.label,m.description)).sort((m,p)=>m.label.localeCompare(p.label)).slice(0,J0)}catch(u){return o.aborted||console.warn("Failed to load @ MCP resource suggestions",u),[]}}}}function FHe(e,t,n){return t<=0?null:n==="up"?e<=0?null:e-1:e>=t-1?null:e+1}function HHe({viewRef:e,disabledRef:t,shellModeRef:n,workspaceActionsRef:s,workspaceKey:r,builtinProviders:i,providers:o=xHe,createInlineTagEffect:a}){const{t:c}=lt(),[u,d]=h.useState(null),f=h.useRef(null),m=h.useRef(0),p=h.useRef(null),g=h.useRef(null),b=h.useRef("."),v=h.useRef(ZS()),y=h.useRef(null),w=h.useRef(null),x=h.useRef(!1),k=h.useMemo(()=>[...[$He(()=>s.current,()=>b.current,()=>v.current,c("at.category.files"),c("at.category.files.description")),BHe(()=>s.current,()=>v.current,c("at.category.extensions"),c("at.category.extensions.description")),zHe(()=>s.current,()=>v.current,c("at.category.mcpResources"),c("at.category.mcpResources.description"),K=>c("mcp.resourceCount",{count:K}))].filter(K=>SHe(K.id,i)),...CHe(o)].sort((K,de)=>(K.order??0)-(de.order??0)),[i,o,c,s]),C=h.useRef(k);C.current=k;const T=h.useMemo(()=>k.map(q=>({id:q.id,provider:q,textValue:YU(q),label:typeof q.label=="string"?YU(q):q.label,description:q.description===void 0?void 0:ni(q.description),tabs:q.tabs,renderItem:q.renderItem})),[k]),_=h.useRef(T);_.current=T;const S=h.useCallback(q=>{const K=typeof q=="function"?q(f.current):q;f.current=K,d(K)},[]);h.useEffect(()=>{var q;(q=p.current)==null||q.abort(),p.current=null,g.current&&(clearTimeout(g.current),g.current=null),b.current=".",v.current=ZS(),f.current=null,d(null)},[r]);const R=h.useCallback(()=>{var q;(q=p.current)==null||q.abort(),p.current=null,g.current&&(clearTimeout(g.current),g.current=null)},[]),A=h.useCallback((q={})=>{R(),v.current=ZS();const K=q.preserveProviderSelection||x.current;x.current=!1,K||(y.current=null,w.current=null),S(null)},[R,S]),O=h.useCallback(()=>{const q=f.current;return q?q.level==="items"?(R(),S({...q,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"):(A(),"closed"):!1},[R,A,S]);h.useEffect(()=>()=>{var q;g.current&&clearTimeout(g.current),(q=p.current)==null||q.abort(),p.current=null,b.current=".",v.current=ZS()},[]);const M=h.useCallback((q,K,de)=>{const re=f.current;return(re==null?void 0:re.level)!=="items"||re.selectedProviderId!==q||re.selectedTabId!==de.selectedTabId||re.itemMode!==de.itemMode||re.mcpServerName!==de.mcpServerName||re.fileDirectory!==de.fileDirectory?[]:re.query!==K&&!m4(q)?[]:q===va&&K===""&&b.current==="."?[]:re.items},[]),D=h.useCallback((q,K)=>{const de=s.current,re=v.current;if(q===va){if(K&&(de!=null&&de.globWorkspace))return re.globResults.has(NM(K));if(de!=null&&de.listDirectory){const{dirPath:U}=Mle(K,nf(b.current));return re.directories.has(U)}const ne=NM(K);return!!(de!=null&&de.globWorkspace)&&re.globResults.has(ne)}return q===xy?re.extensionsStatus!==void 0:q===_a?re.mcpStatus!==void 0:!1},[s]),$=h.useCallback((q,K,de,re={})=>{var ce;const ne=C.current.find(ue=>ue.id===q);if(!ne){console.warn(`[@mention] provider="${q}" not found (may have been removed)`),S(null);return}(ce=p.current)==null||ce.abort();const U=new AbortController;p.current=U;const Z=m.current+1;m.current=Z;const ge=M(q,K,de);re.loadingAlreadySet||S({...de,items:ge,loading:!0}),Promise.resolve().then(()=>ne.search({query:K,signal:U.signal,tabId:de.selectedTabId})).then(ue=>{U.signal.aborted||m.current!==Z||S(be=>{if(!be||be.level!=="items")return be;const rt=q===va&&K.length===0?Cle:J0;return{...be,items:ue.slice(0,rt).map(le=>LHe(le,{customProvider:!m4(q)})),selectedIndex:0,loading:!1}})}).catch(ue=>{U.signal.aborted||m.current!==Z||(console.warn(`[@mention] provider="${q}" query=<redacted> failed`,ue),S(be=>!be||be.level!=="items"?be:{...be,items:[],selectedIndex:0,loading:!1}))})},[M,S]),z=h.useCallback((q,K,de)=>{var ne;g.current&&clearTimeout(g.current),(ne=p.current)==null||ne.abort(),p.current=null;const re=M(q,K,de);if(S({...de,items:re,loading:!0}),D(q,K)){$(q,K,de,{loadingAlreadySet:!0});return}g.current=setTimeout(()=>{g.current=null,$(q,K,de,{loadingAlreadySet:!0})},KU)},[M,D,$,S]),B=h.useCallback((q,K,de,re={})=>{var rt,le;const ne=s.current,U=ne==null?void 0:ne.loadMcpResources;if(!U){console.warn(`[@mention] loadMcpResources not available for server="${q}"`),S({...de,items:[],loading:!1});return}(rt=p.current)==null||rt.abort();const Z=new AbortController;p.current=Z;const ge=m.current+1;m.current=ge;const ce=((le=f.current)==null?void 0:le.level)==="items"&&f.current.itemMode==="mcpResources"&&f.current.mcpServerName===q?f.current.items:[];re.loadingAlreadySet||S({...de,items:ce,loading:!0});const ue=ne==null?void 0:ne.loadMcpStatus;(re.validateServer?MHe(ne,q,Z.signal,ue?()=>{const Me=v.current;return Me.mcpStatus??(Me.mcpStatus=ue().catch(We=>{throw Me.mcpStatus=void 0,We})),Me.mcpStatus}:void 0):Promise.resolve(!0)).then(Me=>Z.signal.aborted?{resources:[]}:Me?AM(v.current.mcpResources,q,()=>U(q,{signal:Z.signal})):(console.warn("[@mention] MCP server disabled or not found",{serverName:q}),{resources:[]})).then(Me=>{if(Z.signal.aborted||m.current!==ge)return;const We=Me.resources.map(at=>{const ze=ni(at.title??"")??ni(at.name??"")??yf(at.uri);return{id:`mcp-resource:${q}:${at.uri}`,label:ze,description:ni(at.description??"")??ni(at.mimeType??""),detail:yf(at.uri),insertText:jHe(q,at.uri),kind:"insert"}}).filter(at=>x3(K,at.label,at.description,at.detail)).sort((at,ze)=>at.label.localeCompare(ze.label)).slice(0,J0);S(at=>!at||at.level!=="items"?at:{...at,items:We,selectedIndex:0,loading:!1})}).catch(Me=>{Z.signal.aborted||m.current!==ge||(console.warn("Failed to load @ MCP resources",Me),S(We=>!We||We.level!=="items"?We:{...We,items:[],selectedIndex:0,loading:!1}))})},[S,s]),j=h.useCallback((q,K,de,re={})=>{var U,Z;g.current&&clearTimeout(g.current),(U=p.current)==null||U.abort(),p.current=null;const ne=((Z=f.current)==null?void 0:Z.level)==="items"&&f.current.itemMode==="mcpResources"&&f.current.mcpServerName===q&&de.itemMode==="mcpResources"?f.current.items:[];if(S({...de,items:ne,loading:!0}),v.current.mcpResources.has(q)){B(q,K,de,{...re,loadingAlreadySet:!0});return}g.current=setTimeout(()=>{g.current=null,B(q,K,de,{...re,loadingAlreadySet:!0})},KU)},[B,S]),H=h.useCallback(q=>{if(t.current||n.current)return A(),!1;const K=RHe(q);if(!K)return A(),!1;const de=f.current;if((de==null?void 0:de.level)==="items"&&de.from===K.from&&(de.to===K.to||de.inputMode==="search"&&K.to>=de.to||de.inputMode==="context"&&K.to>=de.to)&&de.selectedProviderId!==void 0&&_.current.some(U=>U.id===de.selectedProviderId)){if(!de.selectedProviderId)return!0;const U=de.selectedProviderId,Z=de.inputMode==="context"?NHe(U,K.query,de.mcpServerName):de.query;if(Z!==de.query){const ge={...de,from:K.from,to:K.to,query:Z,selectedIndex:0,providers:_.current};return U===_a&&de.itemMode==="mcpResources"&&de.mcpServerName?(j(de.mcpServerName,Z,ge,{validateServer:de.validateMcpServer}),!0):(z(U,Z,ge),!0)}return S({...de,from:K.from,to:K.to,query:Z,providers:_.current}),!0}const ne=_.current.filter(U=>x3(K.query,U.textValue,U.description));if(ne.length===0&&K.query){const U=AHe(K.query,y.current,w.current);if(U&&_.current.some(ge=>ge.id===U.providerId))return U.providerId===_a&&U.serverName?(w.current=U.serverName,j(U.serverName,U.itemQuery,{from:K.from,to:K.to,query:U.itemQuery,level:"items",selectedProviderId:_a,selectedIndex:0,providers:_.current,itemMode:"mcpResources",mcpServerName:U.serverName,fileDirectory:void 0,inputMode:"context",validateMcpServer:U.validateServer},{validateServer:U.validateServer}),!0):(z(U.providerId,U.itemQuery,{from:K.from,to:K.to,query:U.itemQuery,level:"items",selectedProviderId:U.providerId,selectedIndex:0,providers:_.current,itemMode:"default",mcpServerName:void 0,fileDirectory:U.providerId===va?b.current:void 0,inputMode:"context"}),!0);const Z=_.current.find(ge=>!m4(ge.id)&&K.query.startsWith(`${ge.id}:`));if(Z){const ge=K.query.slice(Z.id.length+1);return z(Z.id,ge,{from:K.from,to:K.to,query:ge,level:"items",selectedProviderId:Z.id,selectedIndex:0,providers:_.current,itemMode:"default",mcpServerName:void 0,fileDirectory:void 0,inputMode:"context"}),!0}if(_.current.some(ge=>ge.id===va))return b.current=".",z(va,K.query,{from:K.from,to:K.to,query:K.query,level:"items",selectedProviderId:va,selectedIndex:0,providers:_.current,itemMode:"default",mcpServerName:void 0,fileDirectory:b.current,inputMode:"context"}),!0}return S({from:K.from,to:K.to,query:K.query,level:"categories",selectedIndex:0,providers:ne,items:[],loading:!1,inputMode:void 0}),!0},[A,t,z,j,S,n]),Q=h.useCallback(q=>{const K=f.current;if(!K)return!1;const de=K.level==="categories"?K.providers.length:K.items.length;if(de<=0)return!0;const re=FHe(K.selectedIndex,de,q);return re===null||S({...K,selectedIndex:re}),!0},[S]),I=h.useCallback(q=>{const K=f.current;if(!K)return!1;const de=K.level==="categories"?K.providers.length:K.items.length;return q<0||q>=de?!1:(S({...K,selectedIndex:q}),!0)},[S]),J=h.useCallback(q=>{var ne,U;const K=f.current;if(!K||K.level!=="categories")return!1;const de=K.providers[q??K.selectedIndex];if(!de)return!1;y.current=de.id,de.id===va&&(b.current=".");const re=(U=(ne=de.tabs)==null?void 0:ne.find(Z=>!Z.disabled))==null?void 0:U.id;return z(de.id,K.query,{...K,level:"items",selectedProviderId:de.id,selectedIndex:0,tabs:de.tabs,selectedTabId:re,itemMode:de.id===_a?"mcpServers":"default",mcpServerName:void 0,fileDirectory:de.id===va?b.current:void 0,inputMode:"search"}),!0},[z]),W=h.useCallback(q=>{const K=f.current;if(!K||K.level!=="items"||!K.selectedProviderId)return!1;const de={...K,query:q,selectedIndex:0,inputMode:"search"};return K.selectedProviderId===_a&&K.itemMode==="mcpResources"&&K.mcpServerName?(j(K.mcpServerName,q,de,{validateServer:K.validateMcpServer}),!0):(z(K.selectedProviderId,q,de),!0)},[z,j]),P=h.useCallback(q=>{var re;const K=f.current;if(!K||K.level!=="items"||!K.selectedProviderId||!((re=K.tabs)!=null&&re.some(ne=>ne.id===q&&!ne.disabled)))return!1;if(K.selectedTabId===q)return!0;const de={...K,selectedTabId:q,selectedIndex:0,inputMode:"search"};return z(K.selectedProviderId,K.query,de),!0},[z]),V=h.useCallback(()=>{const q=f.current;if(!q||q.level!=="items")return!1;if(q.selectedProviderId===_a&&q.itemMode==="mcpResources")return z(_a,"",{...q,query:"",selectedIndex:0,itemMode:"mcpServers",mcpServerName:void 0,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),"items";if(q.selectedProviderId===va){const K=nf(q.fileDirectory??b.current);if(K!==".")return b.current=IHe(K),z(va,"",{...q,query:"",selectedIndex:0,fileDirectory:b.current,inputMode:"search"}),"items"}return S({...q,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}),R(),"categories"},[R,z,S]),ee=h.useCallback(q=>{const K=f.current;if(!K)return!1;if(K.level==="categories")return J(q);const de=e.current;if(!de)return!1;if(K.loading)return!0;const re=K.items[q??K.selectedIndex];if(!re)return!1;if(K.selectedProviderId&&(y.current=K.selectedProviderId),K.selectedProviderId===va&&re.kind==="directory"&&re.targetPath)return b.current=nf(re.targetPath),z(va,"",{...K,query:"",selectedIndex:0,fileDirectory:b.current,inputMode:"search"}),!0;if(K.selectedProviderId===_a&&re.kind==="mcp-server"&&re.serverName)return w.current=re.serverName,j(re.serverName,"",{...K,query:"",selectedIndex:0,itemMode:"mcpResources",mcpServerName:re.serverName,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),!0;const ne=re.insertText??`@${Z0(Vd(re.label))} `,U=re.composerTag&&!/\s$/.test(ne)?`${ne} `:ne,Z=de.state.doc.length;if(K.from<0||K.to<K.from||K.to>Z)return console.warn("[@mention] stale insertion range",{from:K.from,to:K.to,docLength:Z}),A(),!0;if(!de.state.doc.sliceString(K.from,K.to).startsWith("@"))return console.warn("[@mention] stale insertion text",{from:K.from,to:K.to}),A(),!0;x.current=!0;const ce=OHe(K.selectedProviderId,re,U),ue=U.trimEnd(),be=ce&&a?[a({from:K.from,to:K.from+ue.length,tag:ce})]:void 0;return de.dispatch({changes:{from:K.from,to:K.to,insert:U},...be?{effects:be}:{},selection:{anchor:K.from+U.length},scrollIntoView:!0}),de.focus(),A({preserveProviderSelection:!0}),!0},[A,J,a,z,j,e]);return{state:u,close:A,closeIfOpen:O,refreshForView:H,moveSelection:Q,select:I,accept:ee,enterCategory:J,selectTab:P,backToCategories:V,updateSearch:W}}const qHe=Rn.mark({class:"cm-input-slash"}),UHe=Rn.mark({class:"cm-input-at"}),WHe=Rn.mark({class:"cm-input-code"});class VHe extends zc{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 QU(e,t,n){const s=new Wd,r=e.state.doc,i=[];for(let o=1;o<=r.lines;o++){const a=r.line(o),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:qHe})}const d=mHe(c,t(),n());if(d){const g=c.endsWith(" ")?"":" ";i.push({from:u+c.length,to:u+c.length,deco:Rn.widget({widget:new VHe(`${g}${d}`),side:1})})}const f=/@[^\s]+/g;let m;for(;(m=f.exec(c))!==null;)i.push({from:u+m.index,to:u+m.index+m[0].length,deco:UHe});const p=/`[^`]+`/g;for(;(m=p.exec(c))!==null;)i.push({from:u+m.index,to:u+m.index+m[0].length,deco:WHe})}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 GHe(e=()=>[],t=()=>"en"){return Oi.fromClass(class{constructor(n){qe(this,"decorations");this.decorations=QU(n,e,t)}update(n){(n.docChanged||n.viewportChanged)&&(this.decorations=QU(n.view,e,t))}},{decorations:n=>n.decorations})}const KHe=Vt.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 eg(e){return e instanceof HTMLElement?e.isContentEditable?!0:!!e.closest('input, textarea, select, [contenteditable="true"], .cm-editor, [data-keyboard-scope]'):!1}function E5(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 wm(e,t){return{[e]:E5(t)}}const YHe=1e3,XHe=10,JU="web-shell-tooltip-styles",QHe=`
[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 ZU(e){if(e.getElementById(JU))return;const n=(e instanceof Document?e:e.ownerDocument).createElement("style");n.id=JU,n.textContent=QHe,e instanceof Document?e.head.appendChild(n):e.appendChild(n)}function eW(e){const t=e.getRootNode();return t instanceof ShadowRoot?t:e.ownerDocument}function JHe(e,t,n){return t<=0?null:((e+(n==="up"?-1:1))%t+t)%t}function ZHe(e){return typeof e.apply=="string"&&e.apply.trim().startsWith("/")}function oP(e){return ZHe(e)}function eqe(e){var t;return typeof e.apply=="string"?e.apply.trim():((t=e.displayLabel)==null?void 0:t.trim())||e.label}function tqe(e){e.querySelectorAll(".cm-completionInfo-hover").forEach(t=>{t.remove()})}function nqe(e,t,n){if(!t.detail||!oP(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=`${eqe(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,f=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,f-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 sqe(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 rqe(e){if(!e.detail||!oP(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=>{nqe(t,e,s)}),n.addEventListener("mouseleave",()=>{const s=t.closest("[data-web-shell-tooltip-portal]");s&&sqe(s)}))}),t}function iqe(e){return e.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function oqe(e){return[...e].length>YHe||e.split(`
`).length>XHe}function Ile(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function aqe(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 lqe(e,t){if(e.size===0)return null;const n=[...e.keys()].sort((i,o)=>o.length-i.length),s=new RegExp(n.map(Ile).join("|"),"g"),r=new Set;for(const i of t.matchAll(s))r.add(i[0]);for(const i of e.keys())r.has(i)||e.delete(i);return e.size===0?1:null}function e2(e,t){if(e.size===0)return t;const n=[...e.keys()].sort((r,i)=>i.length-r.length),s=new RegExp(n.map(Ile).join("|"),"g");return t.replace(s,r=>e.get(r)??r)}function Mv(e){return rT(e)}function cqe(e){return e.map(Mv).join(`
`)}function j5(e){var t;return((t=e.label)==null?void 0:t.trim())??""}function A5(e){var t;return((t=e.value)==null?void 0:t.trim())??""}function aP(e){return A5(e)||j5(e)||e.id}function uqe(e,t){const n=cqe(t);return n?e?`${n}

${e}`:n:e}function dqe(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(Mv(i.tag)),s=i.end);return r.push(e.slice(s)),r.join("")}function N5(e){const t={...e};return delete t.iconUrl,delete t.renderContent,delete t.tooltip,delete t.tooltipText,delete t.onClick,t}const k1=Ss.define({map:e=>e}),lP=Ss.define(),Jc=Ss.define();let hqe=0;class fqe extends zc{constructor(n){super();qe(this,"contentRoot",null);qe(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=N5(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,y;b.stopPropagation(),(y=(v=this.tag).onClick)==null||y.call(v,{tag:r,placement:"composer",readonly:!1,anchorRect:s.getBoundingClientRect()})}),s.addEventListener("keydown",b=>{var v,y;b.key!=="Enter"&&b.key!==" "||(b.preventDefault(),(y=(v=this.tag).onClick)==null||y.call(v,{tag:r,placement:"composer",readonly:!1,anchorRect:s.getBoundingClientRect()}))}));const i=j5(this.tag),o=A5(this.tag),a=this.tag.kind?"":i,c=this.tag.iconUrl??hg(this.tag.kind),u=c&&(OI(c)||by(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 f=!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=oA.createRoot(b),this.contentRoot.render(d),s.appendChild(b),f=!0}catch(v){(g=this.contentRoot)==null||g.unmount(),this.contentRoot=null,console.warn("[WebShell] inline tag renderContent failed",v)}}if(!f&&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",E5(u)),s.appendChild(b)}return f||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=oA.createRoot(r),this.tooltipRoot.render(s),n.appendChild(r),r.id=`composer-tag-tooltip-${++hqe}`,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 ${aP(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(om).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:lP.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 mqe(e){const t={widget:new fqe(e.tag),inclusive:!1,tag:e.tag};return Rn.replace(t).range(e.from,e.to)}const om=Da.define({create(){return Rn.none},update(e,t){let n=e.map(t.changes);for(const s of t.effects)s.is(k1)?n=n.update({add:[mqe(s.value)]}):s.is(lP)?n=n.update({filter:(r,i,o)=>{const a=o.spec.tag;return a&&s.value.predicate?!s.value.predicate(a):!0}}):s.is(Jc)&&(n=Rn.none);return n},provide:e=>[Vt.decorations.from(e),Vt.atomicRanges.of(t=>t.state.field(e))]});function t2(e){const t=[],n=e.state.field(om,!1);return n==null||n.between(0,e.state.doc.length,(s,r,i)=>{const o=i.spec.tag;o&&t.push(N5(o))}),t}function pqe(e){const t=[];return e.state.field(om).between(0,e.state.doc.length,(n,s,r)=>{const i=r.spec.tag;i&&t.push({start:n,end:s,tag:N5(i)})}),t}const tW=new vg,nW=new vg,sW=new vg;function c0(e,t){return t&&(e.length===0||t.startsWith(e))?t:null}function gqe(e,t){const n=c0(e,t);if(!n||e.length===0)return null;const s=n.slice(e.length);return s.length>0?s:null}class bqe extends zc{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 rW(e){return Oi.fromClass(class{constructor(t){qe(this,"decorations");this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){if(!e)return Rn.none;const n=t.state.selection.main,s=t.state.doc.toString(),r=gqe(s,e);return!r||!n.empty||n.head!==s.length?Rn.none:Rn.set([Rn.widget({widget:new bqe(r),side:1}).range(s.length)])}},{decorations:t=>t.decorations})}const yqe="qwen-web-shell-session-draft:",wqe="qwen-web-shell-pending-task-draft:",iW=2e3;function vqe(e,t){if(e)return`${yqe}${encodeURIComponent(e)}`;if(t)return`${wqe}${encodeURIComponent(t)}`}function p4(e){if(!e)return null;try{return localStorage.getItem(e)}catch{return null}}function Gw(e,t){if(e)try{t?localStorage.setItem(e,t):localStorage.removeItem(e)}catch{}}function xqe(e,t){e&&p4(e)===t&&Gw(e,"")}function oW(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 aW(e,t){let n=!1;for(const s of e)if(s.type.startsWith("image/")&&/^image\/(png|jpeg|gif|webp)$/i.test(s.type)){n=!0;const r=s.getAsFile();if(!r)continue;const i=s.type,o=new FileReader;o.onload=()=>{const a=o.result.split(",")[1];t({data:a,media_type:i})},o.readAsDataURL(r)}return n}function kqe(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:f,currentMode:m="default",onFocusFooter:p,dialogOpen:g=!1,followupState:b,onAcceptFollowup:v,onDismissFollowup:y,sessionId:w,sessionName:x,composerInput:k,composerInputVersion:C,builtinAtProviders:T,atProviders:_,atWorkspaceCwd:S,composerTagIcons:R,parseUserMessageContent:A,renderComposerTag:O,renderComposerTagTooltip:M,onComposerTagClick:D,editorTheme:$}=e,z=gQ(),{language:B,t:j}=lt(),H=_u(),Q=VU(S),I=VU(),J=Q===I?void 0:I,W=vqe(w,S),P=h.useRef(null),V=h.useRef(null),ee=OFe(),q=h.useRef(null),[K,de]=h.useState(()=>ee?p4(W)??"":""),re=h.useRef(K),ne=h.useRef(0),U=h.useRef({sessionId:w,workspaceCwd:S,storageKey:W}),Z=h.useRef(!1),ge=h.useRef(()=>{}),ce=h.useRef(()=>{}),ue=h.useRef({sessionId:w,promptHistoryStorageKey:Q,promptHistoryFallbackStorageKey:J,draftStorageKey:W});ue.current={sessionId:w,promptHistoryStorageKey:Q,promptHistoryFallbackStorageKey:J,draftStorageKey:W};const be=h.useRef(null),rt=h.useRef(t);rt.current=t;const le=h.useRef(n);le.current=n;const Me=h.useCallback(se=>{var ye;ne.current+=1,re.current=se,de(se),U.current.storageKey===void 0&&(Z.current=!0),!Et.current&&!Fn.current&&ce.current(),(ye=le.current)==null||ye.call(le,se)},[]);h.useEffect(()=>{var se;ee&&re.current&&((se=le.current)==null||se.call(le,re.current))},[]);const We=h.useRef(s);We.current=s;const at=h.useRef(r);at.current=r;const ze=h.useRef(i);ze.current=i;const rn=h.useRef(a);rn.current=a;const Wt=h.useRef(c);Wt.current=c;const zt=h.useRef(u);zt.current=u;const ae=h.useRef(j);ae.current=j;const je=h.useRef(d);je.current=d;const it=h.useRef(f);it.current=f;const gt=h.useRef(b);gt.current=b;const wt=h.useRef(v);wt.current=v;const Ke=h.useRef(y);Ke.current=y;const un=h.useRef(p);un.current=p;const me=h.useRef(B);me.current=B;const ht=h.useRef(void 0);if(z&&S){const se=z.client.workspaceByCwd(S);ht.current={...z.actions,async globWorkspace(ye,fe){var ct,Dt;(ct=fe==null?void 0:fe.signal)==null||ct.throwIfAborted();const Qe=await se.glob(ye,{maxResults:fe==null?void 0:fe.maxResults,signal:fe==null?void 0:fe.signal});return(Dt=fe==null?void 0:fe.signal)==null||Dt.throwIfAborted(),{matches:Array.isArray(Qe.matches)?Qe.matches.filter(Vn=>typeof Vn=="string"):[]}},async listDirectory(ye,fe){var tn,ct;if((tn=fe==null?void 0:fe.signal)!=null&&tn.aborted)return{kind:"list",path:ye,entries:[],truncated:!1};const Qe=await se.dirList(ye);return(ct=fe==null?void 0:fe.signal)!=null&&ct.aborted?{kind:"list",path:ye,entries:[],truncated:!1}:Qe}}}else ht.current=z==null?void 0:z.actions;const Oe=h.useRef(R);Oe.current=R;const Ne=h.useRef(A);Ne.current=A;const St=h.useRef(O);St.current=O;const Ue=h.useRef(M);Ue.current=M;const ve=h.useRef(D);ve.current=D;const Fe=h.useCallback(se=>{var ct;const ye=se.icon??hg(se.kind,Oe.current),fe={tag:se,placement:"composer",readonly:!1};let Qe;try{Qe=(ct=Ue.current)==null?void 0:ct.call(Ue,fe)}catch(Dt){console.warn("[WebShell] inline tag tooltip render failed",Dt)}const tn=typeof Qe=="string"||typeof Qe=="number"?String(Qe):void 0;return{...se,...ye?{iconUrl:ye}:{},...St.current?{renderContent:St.current}:{},...Qe!=null?{tooltip:Qe}:{},...tn?{tooltipText:tn}:{},...ve.current?{onClick:ve.current}:{}}},[]),[ie,Pe]=h.useState(!1),et=h.useRef(ie);et.current=ie;const He=HHe({viewRef:V,disabledRef:ze,shellModeRef:et,workspaceActionsRef:ht,workspaceKey:S,builtinProviders:T,providers:_,createInlineTagEffect:se=>k1.of({...se,tag:Fe(se.tag)})}),Ae=He.close,vt=He.refreshForView;h.useEffect(()=>{const se=V.current;if(!se)return;const ye=[Jc.of()];se.state.field(om).between(0,se.state.doc.length,(fe,Qe,tn)=>{const ct=tn.spec.tag;ct&&ye.push(k1.of({from:fe,to:Qe,tag:Fe(N5(ct))}))}),ye.length!==1&&se.dispatch({effects:ye})},[R,D,O,M,Fe]);const vn=h.useCallback(()=>{var se,ye,fe;(se=gt.current)!=null&&se.isVisible&&((ye=Ke.current)==null||ye.call(Ke)),Pe(Qe=>!Qe),(fe=V.current)==null||fe.focus()},[]),[Ce,yt]=h.useState(!1),[Ft,De]=h.useState(""),[Xe,$e]=h.useState([]),[Ht,ke]=h.useState(0),Fn=h.useRef(Ce);Fn.current=Ce;const Ve=h.useRef(null),ft=h.useRef(null),Lt=h.useRef(""),[gn,Tn]=h.useState([]),Xn=h.useRef([]),_r=h.useRef(new Map),zr=h.useRef(1),[Ar,jt]=h.useState([]),Sn=h.useRef([]);Sn.current=Ar;const[Hn,Ln]=h.useState(!1),gs=h.useRef(null),qn=h.useCallback(()=>{gs.current===null&&(gs.current=[...Sn.current])},[]),Dn=h.useCallback(()=>{const se=gs.current;if(se===null)return;gs.current=null;const ye=[...se];Sn.current=ye,jt(ye)},[]),Rs=h.useCallback(()=>{gs.current=null},[]),ts=h.useCallback(()=>{Sn.current=[],jt([])},[]),Bs=h.useCallback((se,ye)=>{ts(),se.dispatch({changes:{from:0,to:se.state.doc.length,insert:ye},effects:Jc.of(),selection:{anchor:ye.length}})},[ts]),Sr=h.useCallback((se,ye)=>{const fe=PI(ye,Ne.current,"[WebShell] failed to parse composer history content",{requireSourcePreservation:!0}),Qe=(fe==null?void 0:fe.some(Dt=>Dt.type==="tag"))??!1;if(!fe||!Qe){Bs(se,ye);return}const tn=[Jc.of()];let ct="";for(const Dt of fe){if(Dt.type==="text"){ct+=Dt.text;continue}const Vn=rT(Dt.tag),ps=ct.length;ct+=Vn,tn.push(k1.of({from:ps,to:ct.length,tag:Fe(Dt.tag)}))}ts(),se.dispatch({changes:{from:0,to:se.state.doc.length,insert:ct},effects:tn,selection:{anchor:ct.length}})},[ts,Fe,Bs]),Nr=h.useCallback((se,ye)=>{if(et.current){Bs(se,ye);return}Sr(se,ye)},[Sr,Bs]),pi=h.useCallback(se=>{const ye=V.current;if(!ye){ee&&Me(se);return}Nr(ye,se)},[ee,Nr,Me]),lr=h.useRef(k);lr.current=k;const Ds=h.useRef(()=>!0),gi=h.useRef(null),[xe,Ye]=h.useState(null),st=h.useRef(null),Et=h.useRef(!1);h.useEffect(()=>{let se,ye=0,fe=!1;const Qe=()=>{se!==void 0&&(window.clearTimeout(se),se=void 0)},tn=()=>{if(Et.current||Fn.current)return!1;const hs=V.current,$r=hs?e2(_r.current,hs.state.doc.toString()):re.current;return Gw(U.current.storageKey,$r),!0},ct=()=>{Qe(),ye=0,fe&&tn()&&(fe=!1)},Dt=()=>{const hs=ye-Date.now();if(hs>0){se=window.setTimeout(Dt,hs);return}se=void 0,ct()},Vn=()=>{fe=!0,ye=Date.now()+iW,se===void 0&&(se=window.setTimeout(Dt,iW))};ge.current=ct,ce.current=Vn;const ps=()=>{document.visibilityState==="hidden"&&ct()},Ts=()=>ct();return document.addEventListener("visibilitychange",ps),window.addEventListener("pagehide",Ts),()=>{window.removeEventListener("pagehide",Ts),document.removeEventListener("visibilitychange",ps),ct(),ge.current=()=>{},ce.current=()=>{}}},[]);const Mt=h.useCallback(se=>{st.current=se,Ye(se)},[]),cs=h.useCallback(()=>{const se=gi.current,ye=V.current;if(!se||!ye)return;const fe=ye.state.doc,Qe=se.from+se.text.length;fe.length===Qe&&fe.sliceString(se.from,Qe)===se.text&&ye.dispatch({changes:{from:se.from,to:Qe,insert:""}}),gi.current=null},[]),bs=h.useCallback(()=>{cs(),Ae()},[cs,Ae]),sr=He.closeIfOpen,Qn=h.useCallback(()=>{const se=sr();return se?(se==="closed"&&cs(),!0):!1},[cs,sr]),br=h.useCallback((se,ye)=>{var Dt;if(!se||ze.current||et.current){Mt(null);return}if(Et.current){Mt(null);return}const fe=se.state.selection.main;if(!fe.empty){Mt(null);return}const Qe=yHe(se.state.doc.toString(),fe.head,rn.current,Wt.current,me.current,Vn=>ae.current(Vn),zt.current??Nx);if(!Qe){Mt(null);return}bs();const tn=ye??((Dt=st.current)==null?void 0:Dt.selectedIndex)??0,ct=Math.max(0,Math.min(tn,Qe.items.length-1));Mt({...Qe,selectedIndex:ct})},[bs,Mt]),Ns=h.useCallback(()=>{Mt(null)},[Mt]),Fr=h.useCallback(se=>{const ye=st.current;return!ye||se<0||se>=ye.items.length?!1:(ye.selectedIndex===se||Mt({...ye,selectedIndex:se}),!0)},[Mt]),yr=h.useCallback(se=>{const ye=st.current;if(!ye)return!1;const fe=JHe(ye.selectedIndex,ye.items.length,se);return fe===null?!1:(Mt({...ye,selectedIndex:fe}),!0)},[Mt]),Mr=h.useCallback(se=>{const ye=V.current,fe=st.current;if(!ye||!fe)return!1;const Qe=fe.items[se??fe.selectedIndex];return Qe?(ye.dispatch({changes:{from:fe.from,to:fe.to,insert:Qe.apply},selection:{anchor:fe.from+Qe.apply.length},scrollIntoView:!0}),ye.focus(),!0):!1},[]),[Pn,Gs]=h.useState(!1);h.useEffect(()=>{const se=V.current,ye=se?se.state.doc.toString():K,fe=c0(ye,b!=null&&b.isVisible?b.suggestion:null);Gs(ye.trim().length>0||!!fe||Ar.length>0||gn.length>0)},[Ar,gn,K,b==null?void 0:b.isVisible,b==null?void 0:b.suggestion]);const vo=GU(Q,J),Ks=GU("qwen-web-shell-command-history"),{push:bi,navigateUp:Jn,navigateDown:xi,isNavigating:qs,reset:wr,getReverseMatches:Hr,getLastEntry:Ir,resetSearch:_t}=vo,Zn=h.useRef({push:bi,navigateUp:Jn,navigateDown:xi,isNavigating:qs,reset:wr,getReverseMatches:Hr,getLastEntry:Ir,resetSearch:_t});Zn.current={push:bi,navigateUp:Jn,navigateDown:xi,isNavigating:qs,reset:wr,getReverseMatches:Hr,getLastEntry:Ir,resetSearch:_t};const ds=h.useRef(Ks);ds.current=Ks,Xn.current=gn;const Kr=h.useCallback(se=>{const ye=et.current,Qe=(ye?ds.current:Zn.current).getReverseMatches(se);return ye?Qe:Qe.filter(tn=>!tn.trimStart().startsWith("/"))},[]),_e=h.useCallback(()=>{if(ze.current)return;const se=V.current;if(!se&&!ee)return;ge.current(),Ns(),bs();const ye=se?se.state.doc.toString():re.current;Lt.current=ye,yt(!0),De("");const fe=et.current?ds.current:Zn.current;$e(Kr("")),ke(0),fe.resetSearch(),setTimeout(()=>{var Qe;return(Qe=Ve.current)==null?void 0:Qe.focus()},0)},[bs,Ns,Kr,ee]),Je=h.useRef(_e);Je.current=_e;const qt=h.useCallback(()=>{if(ze.current)return;const se=V.current;if(!se)return;if(lc(se.state)==="active"){ym(!1)(se),se.focus();return}if(se.state.doc.lines>1){se.focus();return}const ye=et.current?ds.current:Zn.current,fe=se.state.doc.toString();ye.isNavigating()||ge.current();const Qe=ye.navigateUp(fe);Qe!==null&&(Et.current=!0,et.current||qn(),Nr(se,Qe)),se.focus()},[qn,Nr]),On=h.useCallback(()=>{if(ze.current)return;const se=V.current;if(!se)return;if(lc(se.state)==="active"){ym(!0)(se),se.focus();return}if(se.state.doc.lines>1){se.focus();return}const ye=et.current?ds.current:Zn.current,fe=ye.navigateDown();if(fe!==null){const Qe=!et.current&&!ye.isNavigating();Et.current=ye.isNavigating(),Nr(se,fe),Qe&&Dn()}se.focus()},[Nr,Dn]),on=h.useCallback(se=>{Me(se.target.value)},[Me]);h.useEffect(()=>{if(!ee)return;const se=q.current;if(se&&(se.style.height="auto",se.scrollHeight>0)){const ye=parseFloat(getComputedStyle(se).maxHeight),fe=Number.isFinite(ye)&&ye>0?Math.min(se.scrollHeight,ye):se.scrollHeight;se.style.height=`${fe}px`}},[ee,K]);const Le=h.useCallback(se=>{var Qe;const ye=(Qe=se.clipboardData)==null?void 0:Qe.items;if(!ye)return;aW(ye,tn=>Tn(ct=>[...ct,tn]))&&se.preventDefault()},[]),Qt=(se,ye,fe,Qe=!1)=>{const tn=fe===void 0&&se?pqe(se):[],ct=se?se.state.doc.toString():re.current,Dt=gt.current,Vn=ye===void 0&&!Qe&&tn.length===0&&(Dt!=null&&Dt.isVisible)?c0(ct,Dt.suggestion):null,ps=ye??Vn??ct,Ts=ps.length-ps.trimStart().length,hs=ps.trim(),$r=ye===void 0&&Vn===null?tn.map(ys=>({...ys,start:ys.start-Ts,end:ys.end-Ts})).filter(ys=>ys.end>0).map(ys=>({...ys,start:Math.max(0,ys.start)})):[],Cs=fe??Sn.current;if(!hs&&Cs.length===0&&tn.length===0)return!0;const es=fe===void 0?dqe(hs,$r):hs,xs=e2(_r.current,es),La=uqe(xs,Cs),vr=Xn.current,Ur=et.current,Os=Ur?`!${La}`:La,ko=Ave(Os,[...Cs,...$r.map(ys=>ys.tag)]),ba={...ue.current},Oo=e2(_r.current,ct),sc=se==null?void 0:se.state.doc,Al=ne.current,kt=Sn.current,cn=Xn.current,En=et.current;let jn=!1;const Yn=()=>{var tl,Zu,ed;if(jn)return;jn=!0;const ys=ue.current;if(V.current!==se||ys.sessionId!==ba.sessionId||ys.promptHistoryStorageKey!==ba.promptHistoryStorageKey){Ur?ds.current.push(xs):ys.promptHistoryStorageKey===ba.promptHistoryStorageKey?Zn.current.push(xs):wHe(ba.promptHistoryStorageKey,xs,ba.promptHistoryFallbackStorageKey),xqe(ba.draftStorageKey,Oo);return}(tl=Ke.current)==null||tl.call(Ke),Ur?(ds.current.push(xs),ds.current.reset()):(Zn.current.push(xs),Zn.current.reset());const Oa=(se?se.state.doc===sc:ne.current===Al)&&Sn.current===kt&&Xn.current===cn&&et.current===En;Et.current=!1,Oa&&(Gw(ba.draftStorageKey,""),Mt(null),Vn&&((Zu=wt.current)==null||Zu.call(wt,"enter",{skipOnAccept:!0})),(ed=Ke.current)==null||ed.call(Ke),_r.current.clear(),zr.current=1,Rs(),jt([]),Tn([]),se?se.dispatch({changes:{from:0,to:se.state.doc.length,insert:""},effects:Jc.of()}):Me(""))};return rt.current(Os,vr.length>0?[...vr]:void 0,Yn,ko.length>0?{inputAnnotations:ko}:void 0)===!1||Yn(),!0};Ds.current=Qt,h.useEffect(()=>{var Oo,sc,Al;if(!P.current)return;const se=H??document.body;ZU(eW(se));const ye=document.createElement("div");be.current=ye,ye.setAttribute("data-web-shell-tooltip-portal",""),ye.style.position="fixed",ye.style.inset="0",ye.style.zIndex="var(--web-shell-tooltip-z-index)",ye.style.pointerEvents="none";const fe=/\b\S*theme(?:Dark|Light)\S*/gi,Qe=()=>{var En,jn;let kt=P.current,cn=null;if(P.current){const Yn=getComputedStyle(P.current);for(let rs=0;rs<Yn.length;rs+=1){const ys=Yn[rs];ys.startsWith("--")&&ye.style.setProperty(ys,Yn.getPropertyValue(ys))}Yn.getPropertyValue("--web-shell-tooltip-z-index").trim()||ye.style.setProperty("--web-shell-tooltip-z-index","1000")}for(;kt;){const Yn=(jn=(En=kt.className)==null?void 0:En.match)==null?void 0:jn.call(En,fe);if(Yn){cn=Yn[0];break}kt=kt.parentElement}cn&&(ye.className=cn)};Qe(),se.appendChild(ye);const tn=new MutationObserver(Qe);let ct=P.current;for(;ct&&(tn.observe(ct,{attributes:!0,attributeFilter:["class","style"]}),!((sc=(Oo=ct.className)==null?void 0:Oo.match)!=null&&sc.call(Oo,fe)));)ct=ct.parentElement;const Dt=(kt,cn,En,jn=!1)=>Ds.current(kt,cn,En,jn),Vn=kt=>(kt.dispatch(kt.state.replaceSelection(`
`)),!0),ps=(kt,cn)=>{var rs;const En=gt.current,jn=En==null?void 0:En.suggestion,Yn=c0(kt.state.doc.toString(),jn);return!(En!=null&&En.isVisible)||!Yn?!1:(kt.dispatch({changes:{from:0,to:kt.state.doc.length,insert:Yn},selection:{anchor:Yn.length},scrollIntoView:!0}),kt.focus(),(rs=wt.current)==null||rs.call(wt,cn,{skipOnAccept:!0}),!0)},Ts=$b.of([{key:"Backspace",run:kt=>{var Yn;const cn=kt.state.selection.main;if(!cn.empty||cn.from!==0)return!1;let En=!1;if(kt.state.field(om).between(0,1,rs=>{rs===0&&(En=!0)}),En)return!1;let jn=-1;for(let rs=Sn.current.length-1;rs>=0;rs-=1)if(((Yn=Sn.current[rs])==null?void 0:Yn.removable)!==!1){jn=rs;break}return jn<0?!1:(jt(rs=>rs.filter((ys,Qs)=>Qs!==jn)),!0)}},{key:"Delete",run:kt=>{const cn=kt.state.selection.main;if(!cn.empty||cn.from!==0)return!1;let En=!1;if(kt.state.field(om).between(0,1,Yn=>{Yn===0&&(En=!0)}),En)return!1;const jn=Sn.current.findIndex(Yn=>Yn.removable!==!1);return jn<0?!1:(jt(Yn=>Yn.filter((rs,ys)=>ys!==jn)),!0)}},{key:"Enter",run:kt=>{var Yn;if(He.accept())return!0;if(st.current)return Mr();if(lc(kt.state)==="active")return!1;const cn=gt.current,jn=t2(kt).length>0?null:c0(kt.state.doc.toString(),cn==null?void 0:cn.suggestion);return cn!=null&&cn.isVisible&&jn?((Yn=wt.current)==null||Yn.call(wt,"enter",{skipOnAccept:!0}),Dt(kt,jn)):Dt(kt)}},{key:"Shift-Enter",run:Vn},{key:"Ctrl-j",run:Vn},{key:"Mod-Enter",run:Vn},{key:"Alt-Enter",run:Vn},{key:"Escape",run:()=>Qn()?!0:st.current?(Ns(),!0):et.current?(Pe(!1),!0):!1},{key:"Ctrl-o",run:()=>!0},{key:"Ctrl-l",run:()=>!0},{key:"Ctrl-y",run:()=>!0},{key:"ArrowUp",run:kt=>{var ys;const cn=et.current?ds.current:Zn.current,En=Et.current;if(En)f4(kt),Ns(),bs();else{if(He.moveSelection("up")||yr("up"))return!0;if(lc(kt.state)==="active")return ym(!1)(kt)}const jn=oW(kt,"up");if(jn==="handled")return!0;if(jn==="editor")return!1;if(et.current){const Qs=kt.state.doc.toString();En||ge.current();const Oa=cn.navigateUp(Qs);return Oa===null||(Et.current=!0,Nr(kt,Oa)),!0}if(je.current.length>0&&(ys=it.current)!=null&&ys.call(it))return!0;const Yn=kt.state.doc.toString();En||ge.current();const rs=cn.navigateUp(Yn);return rs===null?!1:(qn(),Et.current=!0,Nr(kt,rs),!0)}},{key:"ArrowDown",run:kt=>{var ys;const cn=et.current?ds.current:Zn.current;if(Et.current)f4(kt),Ns(),bs();else{if(He.moveSelection("down")||yr("down"))return!0;if(lc(kt.state)==="active")return ym(!0)(kt)}const jn=oW(kt,"down");if(jn==="handled")return!0;if(jn==="editor")return!1;if(et.current){const Qs=cn.navigateDown();return Qs===null||(Et.current=cn.isNavigating(),Nr(kt,Qs)),!0}const Yn=cn.navigateDown();if(Yn===null)return((ys=un.current)==null?void 0:ys.call(un))??!1;const rs=!cn.isNavigating();return Et.current=!rs,Nr(kt,Yn),rs&&Dn(),!0}},{key:"Ctrl-r",run:()=>(Je.current(),!0)},{key:"Tab",run:kt=>{if(He.accept()||ps(kt,"tab"))return!0;if(st.current)return Mr();if(lc(kt.state)==="active")return Gae(kt);const cn=kt.state.doc.toString(),En=fHe(cn,rn.current,me.current);if(En)return kt.dispatch({changes:{from:0,to:kt.state.doc.length,insert:En},selection:{anchor:En.length}}),!0;const jn=hHe(cn,rn.current);return jn&&kt.dispatch({changes:{from:0,to:kt.state.doc.length,insert:jn},selection:{anchor:jn.length}}),!0}},{key:"ArrowRight",run:kt=>!!(lc(kt.state)!=="active"&&ps(kt,"right"))},{key:"Shift-Tab",run:()=>{var kt;return(kt=We.current)==null||kt.call(We),!0}}]);let hs=null,$r="";const Cs=kt=>(hs!==kt.doc&&(hs=kt.doc,$r=kt.doc.toString()),$r),es=Vt.updateListener.of(kt=>{const cn=kt.transactions.some(jn=>jn.isUserEvent("input")||jn.isUserEvent("delete")),En=kt.transactions.some(jn=>jn.isUserEvent("input"));if(kt.docChanged&&En&&_r.current.size>0){const jn=lqe(_r.current,Cs(kt.state));jn!==null&&(zr.current=jn)}cn&&(Et.current=!1),(kt.docChanged||kt.selectionSet)&&(br(kt.view),Et.current?bs():vt(kt.view)&&Ns())});let xs=!1;const La=Vt.updateListener.of(kt=>{const cn=gi.current,En=lc(kt.state)==="active";if(cn){const jn=kt.state.doc;if(!(jn.length===cn.from+cn.text.length&&jn.sliceString(cn.from)===cn.text))gi.current=null;else if(xs&&!En){gi.current=null;const{view:rs}=kt,{from:ys}=cn;window.setTimeout(()=>{if(V.current!==rs)return;const Qs=rs.state.doc;Qs.length===ys+cn.text.length&&Qs.sliceString(ys)===cn.text&&rs.dispatch({changes:{from:ys,to:ys+cn.text.length,insert:""}})},0)}}xs=En,En||tqe(ye)}),vr=dr.create({doc:p4(U.current.storageKey)??"",extensions:[Ap.highest(Ts),DFe,HD(),$b.of([...WD,...qD]),Jae({override:[],activateOnTyping:!0,icons:!1,optionClass:kt=>{const cn=[];return kt.type==="file"&&cn.push("cm-file-completion"),oP(kt)&&cn.push("cm-command-info-completion"),cn.join(" ")},addToOptions:[{render:rqe,position:90}],maxRenderedOptions:300,aboveCursor:!0,positionInfo:(kt,cn,En,jn,Yn)=>{const rs=jn.bottom-jn.top,ys=Yn.bottom-cn.bottom,Qs=ys>=rs||ys>cn.top,Oa=Qs?"top":"bottom",tl=Qs?En.bottom-cn.top:cn.bottom-En.top;return{style:`${Oa}: ${tl}px`,class:"cm-completionInfo-right-narrow"}},activateOnCompletion:kt=>typeof kt.apply=="string"&&kt.apply.endsWith(" ")}),bOe({parent:ye}),nW.of(Xq("")),sW.of(rW(null)),Vt.lineWrapping,tW.of(Vt.editable.of(!0)),GHe(()=>rn.current,()=>me.current),KHe,om,es,La,Vt.updateListener.of(kt=>{var cn;if(Ln(t2(kt.view).length>0),kt.docChanged){const En=Cs(kt.state);U.current.storageKey===void 0&&(Z.current=!0),!Et.current&&!Fn.current&&ce.current(),(cn=le.current)==null||cn.call(le,En);const jn=gt.current,Yn=c0(En,jn!=null&&jn.isVisible?jn.suggestion:null);Gs(En.trim().length>0||!!Yn||Sn.current.length>0||Xn.current.length>0)}}),Vt.inputHandler.of((kt,cn,En,jn)=>{var Yn;return jn==="!"&&kt.state.doc.toString()===""&&lc(kt.state)!=="active"?(vn(),!0):jn==="?"&&kt.state.doc.toString()===""&&lc(kt.state)!=="active"?((Yn=at.current)==null||Yn.call(at),!0):!1}),Vt.domEventHandlers({blur(kt){return Ns(),kt.relatedTarget instanceof Element&&kt.relatedTarget.closest('[data-at-mention-panel="true"]')||window.setTimeout(()=>{const cn=V.current;cn!=null&&cn.hasFocus||document.activeElement instanceof Element&&document.activeElement.closest('[data-at-mention-panel="true"]')||bs()},0),!1},paste(kt){var Qs,Oa,tl,Zu;const cn=(Qs=kt.clipboardData)==null?void 0:Qs.items;if(!cn)return!1;if(aW(cn,ed=>Tn(Cg=>[...Cg,ed])))return kt.preventDefault(),!0;const jn=iqe(((Oa=kt.clipboardData)==null?void 0:Oa.getData("text/plain"))??"");if(!jn||!oqe(jn))return!1;kt.preventDefault(),Ur.state.doc.toString()===""&&((tl=gt.current)!=null&&tl.isVisible)&&((Zu=Ke.current)==null||Zu.call(Ke));const{placeholderText:Yn,nextPasteId:rs}=aqe(_r.current,zr.current,jn);zr.current=rs;const ys=Ur.state.selection.main;return Ur.dispatch({changes:{from:ys.from,to:ys.to,insert:Yn},selection:{anchor:ys.from+Yn.length},scrollIntoView:!0}),!0}}),Vt.theme($)]}),Ur=new Vt({state:vr,parent:P.current});V.current=Ur;const Os=()=>ge.current();Ur.dom.addEventListener("blur",Os,!0),Vw()||Ur.focus();const ko=Ur.state.doc.toString(),ba=ko.trim();return ko&&((Al=le.current)==null||Al.call(le,ko)),Gs(ba.length>0||Sn.current.length>0||Xn.current.length>0),()=>{Ur.dom.removeEventListener("blur",Os,!0),ge.current(),Ur.dispatch({effects:Jc.of()}),Ur.destroy(),V.current=null,tn.disconnect(),ye.remove(),be.current=null}},[]),h.useEffect(()=>{const se=U.current,ye=V.current,fe=se.sessionId!==w,Qe=se.workspaceCwd!==S,tn=se.storageKey!==W,ct=Et.current,Dt=Fn.current;if(!fe&&!Qe)return;Zn.current.reset(),ds.current.reset(),Et.current=!1,Rs(),Lt.current="",yt(!1),De(""),$e([]),ke(0);const Vn=ye?e2(_r.current,ye.state.doc.toString()):re.current;if(tn&&!ct&&!Dt&&Gw(se.storageKey,Vn),U.current={sessionId:w,workspaceCwd:S,storageKey:W},!tn||!ye&&!ee)return;const ps=p4(W),Ts=!ct&&!Dt&&se.sessionId===void 0&&w===void 0&&se.workspaceCwd===void 0&&se.storageKey===void 0&&S!==void 0&&(Z.current||ps===null);Z.current=!1;const hs=Ts?Vn:ps??"";Ts&&Gw(W,Vn),_r.current.clear(),zr.current=1,jt([]),Tn([]),ye?ye.dispatch({changes:{from:0,to:ye.state.doc.length,insert:hs},effects:Jc.of(),selection:{anchor:hs.length}}):Me(hs),W===void 0&&(Z.current=!1)},[S,Rs,W,ee,w,Me]),h.useEffect(()=>{const se=be.current;if(!se)return;const ye=H??document.body;ZU(eW(ye)),ye.appendChild(se)},[H]),h.useEffect(()=>{const se=V.current;se&&(se.dispatch({effects:tW.reconfigure(Vt.editable.of(!i))}),!i&&!Vw()&&se.focus())},[i]);const Un=!i&&(b!=null&&b.isVisible)&&b.suggestion?b.suggestion:null,Kn=Un??(ie?j("editor.shellPlaceholder"):o);h.useEffect(()=>{const se=V.current;se&&se.dispatch({effects:[nW.reconfigure(Xq(Kn)),sW.reconfigure(rW(Un))]})},[Kn,Un]),h.useEffect(()=>{const se=V.current;!se||lc(se.state)!=="active"||(f4(se),window.setTimeout(()=>{V.current===se&&h4(se)},0))},[B]);const zs=[a.map(se=>{var ye;return[se.name,se.description??"",se.source??"",se.displayCategory??"",se.argumentHint??"",((ye=se.subcommands)==null?void 0:ye.join(","))??""].join("\0")}).join(""),c.map(se=>[se.name,se.description].join("\0")).join(""),(u==null?void 0:u.join("|"))??""].join("");h.useEffect(()=>{st.current&&br(V.current)},[zs,B,br]),h.useEffect(()=>{const se=V.current;se&&(g?(Ns(),bs(),se.contentDOM.blur()):Vw()||se.focus())},[bs,g,Ns]),h.useEffect(()=>{const se=ye=>{var Ts,hs,$r;if(ze.current||Ce||g||ye.defaultPrevented)return;const fe=ye.target,Qe=(Ts=P.current)==null?void 0:Ts.contains(fe),tn=document.activeElement===document.body;if(!Qe&&!tn)return;const ct=V.current,Dt=gt.current,Vn=c0((ct==null?void 0:ct.state.doc.toString())??"",Dt==null?void 0:Dt.suggestion);if(ct&&!ct.hasFocus&&(Dt!=null&&Dt.isVisible)&&Vn&&!eg(ye.target)){if(ye.key==="Tab"&&!ye.shiftKey&&!ye.metaKey&&!ye.ctrlKey&&!ye.altKey&&lc(ct.state)!=="active"){ye.preventDefault(),ct.dispatch({changes:{from:0,to:ct.state.doc.length,insert:Vn},selection:{anchor:Vn.length},scrollIntoView:!0}),ct.focus(),(hs=wt.current)==null||hs.call(wt,"tab",{skipOnAccept:!0});return}if(ye.key==="ArrowRight"&&!ye.shiftKey&&!ye.metaKey&&!ye.ctrlKey&&!ye.altKey&&lc(ct.state)!=="active"){ye.preventDefault(),ct.dispatch({changes:{from:0,to:ct.state.doc.length,insert:Vn},selection:{anchor:Vn.length},scrollIntoView:!0}),ct.focus(),($r=wt.current)==null||$r.call(wt,"right",{skipOnAccept:!0});return}}if(ye.metaKey||ye.ctrlKey||ye.altKey||ye.key.length!==1||eg(ye.target)||!ct||ct.hasFocus)return;if(ye.preventDefault(),ye.key==="!"&&ct.state.doc.toString()===""){vn();return}const ps=ct.state.selection.main;ct.dispatch({changes:{from:ps.from,to:ps.to,insert:ye.key},selection:{anchor:ps.from+ye.key.length},scrollIntoView:!0}),ct.focus(),ye.key==="/"?window.setTimeout(()=>{br(V.current)},0):ye.key==="@"&&window.setTimeout(()=>{const Cs=V.current;Cs&&Cs.hasFocus&&(Ns(),vt(Cs))},0)};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[vt,Ns,Ce,g,br,vn]);const ns=h.useCallback(()=>{var se,ye;if(ee){(se=q.current)==null||se.focus();return}(ye=V.current)==null||ye.focus()},[ee]),si=h.useCallback((se,ye)=>{var Ts;if(ee){if(se)if((ye==null?void 0:ye.mode)==="replace")Me(se);else{const hs=q.current,$r=re.current,Cs=hs?hs.selectionStart:$r.length,es=hs?hs.selectionEnd:$r.length,xs=Cs+se.length;Me($r.slice(0,Cs)+se+$r.slice(es));const La=()=>{var vr;(vr=q.current)==null||vr.setSelectionRange(xs,xs)};typeof requestAnimationFrame=="function"?requestAnimationFrame(La):window.setTimeout(La,0)}(Ts=q.current)==null||Ts.focus();return}const fe=V.current;if(!fe||!se){fe==null||fe.focus();return}if((ye==null?void 0:ye.mode)==="replace"){fe.dispatch({changes:{from:0,to:fe.state.doc.length,insert:se},effects:Jc.of(),selection:{anchor:se.length},scrollIntoView:!0}),fe.focus();return}const Qe=fe.state.selection.main;let tn=se,ct=!1,Dt=null;const Vn=se==="@";let ps=se==="/";if(se==="/")fe.state.doc.lineAt(Qe.head).text.startsWith("/")?ct=!0:fe.state.doc.length>0&&(ct=!0,ps=!1);else if(se==="@"){const hs=Qe.from>0?fe.state.doc.sliceString(Qe.from-1,Qe.from):"";fe.state.doc.sliceString(Qe.from,Qe.from+1)==="@"?(ct=!0,Dt=Qe.from+1):hs==="@"?ct=!0:hs&&!/\s/.test(hs)&&(tn=" @")}ct?Dt!==null&&fe.dispatch({selection:{anchor:Dt},scrollIntoView:!0}):(fe.dispatch({changes:{from:Qe.from,to:Qe.to,insert:tn},selection:{anchor:Qe.from+tn.length},scrollIntoView:!0}),Vn&&(gi.current={text:tn,from:Qe.from})),fe.focus(),ps?window.setTimeout(()=>{br(V.current)},0):Vn&&window.setTimeout(()=>{const hs=V.current;hs&&hs.hasFocus&&(Ns(),vt(hs))},0)},[Ns,ee,vt,br,Me]),Ys=h.useCallback(()=>{var se;return ee?re.current:((se=V.current)==null?void 0:se.state.doc.toString())??""},[ee]),Ps=h.useCallback(se=>{if(ee){Me(se);return}const ye=V.current;ye&&(ye.dispatch({changes:{from:0,to:ye.state.doc.length,insert:se},effects:Jc.of(),selection:{anchor:se.length},scrollIntoView:!0}),ye.focus())},[ee,Me]),Xs=h.useCallback(se=>{const ye=V.current;if(!ye)return;const fe=[];ye.state.field(om).between(0,ye.state.doc.length,(Qe,tn,ct)=>{const Dt=ct.spec.tag;Dt&&(!se||se(Dt))&&fe.push({from:Qe,to:tn,insert:""})}),fe.length!==0&&ye.dispatch({changes:fe,effects:lP.of({predicate:se}),scrollIntoView:!0})},[]),Ai=h.useCallback(se=>{const ye=(se==null?void 0:se.text)??!0,fe=(se==null?void 0:se.tags)??!0,Qe=V.current;ye&&Qe&&Qe.state.doc.length>0&&Qe.dispatch({changes:{from:0,to:Qe.state.doc.length,insert:""},effects:Jc.of()}),ye&&ee&&Me(""),ye&&(Tn([]),_r.current.clear(),zr.current=1),fe&&(jt([]),ye||Xs())},[ee,Xs,Me]),oo=h.useCallback(()=>{Ai({text:!0,tags:!1})},[Ai]),xo=h.useCallback((se,ye)=>{if(se.length!==0){if((ye==null?void 0:ye.placement)==="inline"&&!ee){const fe=V.current;if(!fe)return;const Qe=fe.state.selection.main;let tn=Qe.from;const ct=[],Dt=se.map(ps=>{const Ts=Mv(ps);return ct.push({from:tn,to:tn+Ts.length,tag:ps}),tn+=Ts.length+1,Ts}).join(" "),Vn=Dt?`${Dt} `:"";fe.dispatch({changes:{from:Qe.from,to:Qe.to,insert:Vn},effects:ct.length>0?ct.map(ps=>k1.of({...ps,tag:Fe(ps.tag)})):void 0,selection:{anchor:Qe.from+Vn.length},scrollIntoView:!0}),fe.focus();return}jt(fe=>{const Qe=[...fe];for(const tn of se){const ct=Qe.findIndex(Dt=>Dt.id===tn.id);ct>=0?Qe[ct]=tn:Qe.push(tn)}return Qe})}},[ee,Fe]),ki=h.useCallback(se=>{jt(ye=>{const fe=ye.filter(Qe=>Qe.id!==se||Qe.removable===!1);return fe.length===ye.length?ye:fe}),Xs(ye=>ye.id===se&&ye.removable!==!1)},[Xs]),Pa=h.useCallback(()=>{var ye;return(ee?re.current:((ye=V.current)==null?void 0:ye.state.doc.toString())??"").trim().length>0||Sn.current.length>0||Xn.current.length>0},[ee]),Yr=h.useCallback(()=>(V.current?t2(V.current):[]).length>0||Sn.current.length>0||Xn.current.length>0,[]),pr=h.useCallback(se=>{const ye=V.current;if(!ye&&!ee)return;const fe=ye?t2(ye):[];if((se==null?void 0:se.tagPlacement)==="inline"){Ds.current(ye,se.text??"",se.tags??fe);return}if((se==null?void 0:se.text)!==void 0&&se.tags===void 0&&fe.length>0){Ds.current(ye,se.text,fe);return}Ds.current(ye,se==null?void 0:se.text,se?se.tags??[]:void 0)},[ee]),os=h.useCallback(()=>{const se=Zn.current.getLastEntry(fe=>!fe.startsWith("/")&&!fe.startsWith("!"));!se||rt.current(se)===!1||Tn([])},[]),_i=h.useCallback(se=>{if(ee){Me(se);return}const ye=V.current;ye&&ye.dispatch({changes:{from:0,to:ye.state.doc.length,insert:se},selection:{anchor:se.length},scrollIntoView:!0})},[ee,Me]);h.useEffect(()=>{const se=lr.current;if(!se)return;const ye=V.current;if(!ye&&!ee)return;const fe=se.tagPlacement??"top";if(se.tags!==void 0&&fe==="top"&&jt([...se.tags]),!ye){se.tags!==void 0&&fe==="inline"&&jt([...se.tags]),se.text!==void 0&&Me(se.text);let tn=null;return se.submit&&(tn=window.setTimeout(()=>{pr(se)},0)),()=>{tn!==null&&window.clearTimeout(tn)}}if(se.text!==void 0||fe==="inline"){const tn=fe==="inline"?[...se.tags??[]]:[],ct=tn.map(Mv).join(" "),Dt=fe==="inline"?ct&&se.text?`${ct} ${se.text}`:ct||(se.text??""):se.text??"",Vn=[Jc.of()];if(tn.length>0){let ps=0;for(const Ts of tn){const hs=Mv(Ts);Vn.push(k1.of({from:ps,to:ps+hs.length,tag:Fe(Ts)})),ps+=hs.length+1}}ye.dispatch({changes:{from:0,to:ye.state.doc.length,insert:Dt},effects:Vn,selection:{anchor:Dt.length},scrollIntoView:!0})}else ye.dispatch({effects:Jc.of()});(se.text!==void 0||se.submit)&&!Vw()&&ye.focus();let Qe=null;return se.submit&&(Qe=window.setTimeout(()=>{V.current&&pr(se)},0)),()=>{Qe!==null&&window.clearTimeout(Qe)}},[C,ee,Fe,Me,pr]);const ri=h.useCallback((se,ye=!0)=>{var Qe;se&&_i(Lt.current),yt(!1),De(""),$e([]),ke(0),(et.current?ds.current:Zn.current).resetSearch(),ye&&((Qe=V.current)==null||Qe.focus())},[_i]);h.useEffect(()=>{if(!Ce)return;const se=ye=>{if(ye instanceof MouseEvent&&ye.button!==0||ye.defaultPrevented)return;const fe=ft.current,Qe=ye.target;fe&&Qe instanceof Node&&!fe.contains(Qe)&&ri(!0,!1)};return window.addEventListener("mousedown",se),window.addEventListener("touchstart",se),()=>{window.removeEventListener("mousedown",se),window.removeEventListener("touchstart",se)}},[Ce,ri]);const Cu=h.useCallback(se=>{var ct;const ye=V.current;if(!ye&&!ee)return;if(ri(!1),!et.current){pi(se),Ds.current(ye,void 0,void 0,!0);return}const fe=se.trim();if(!fe)return;const Qe=Xn.current;if(rt.current(`!${fe}`,Qe.length>0?[...Qe]:void 0)===!1){pi(se);return}(ct=Ke.current)==null||ct.call(Ke),ds.current.push(fe),ds.current.reset(),Tn([]),_i("")},[ri,ee,_i,pi]),Ju=se=>{if(!se.nativeEvent.isComposing)if(se.key==="Escape")se.preventDefault(),ri(!0);else if(se.key==="Tab"){se.preventDefault();const ye=Xe[Ht];ye&&pi(ye),ri(!1)}else if(se.key==="Enter"){se.preventDefault();const ye=Xe[Ht];ye?Cu(ye):ri(!1)}else se.key==="r"&&se.ctrlKey&&(se.preventDefault(),Xe.length>0&&ke(ye=>(ye+1)%Xe.length))},Fc=se=>{const ye=et.current?ds.current:Zn.current;$e(Kr(se)),ke(0),ye.resetSearch()},ga=se=>{const ye=se.target.value;De(ye),!se.nativeEvent.isComposing&&Fc(ye)},rr=se=>{const ye=se.currentTarget.value;De(ye),Fc(ye)},ii=h.useCallback(se=>{Tn(ye=>ye.filter((fe,Qe)=>Qe!==se))},[]),Bi=!ie&&!Ce&&!(b!=null&&b.isVisible)&&!i&&!g,el=h.useCallback(se=>{Tn(ye=>[...ye,...se])},[]),qr=h.useMemo(()=>({clearText:oo,clear:Ai,focus:ns,getText:Ys,hasAttachments:Yr,hasInput:Pa,setText:Ps,addTags:xo,removeTag:ki,insertText:si,retryLast:os,restoreImages:el,submit:pr}),[xo,Ai,oo,ns,Ys,Yr,Pa,si,ki,el,os,Ps,pr]);return{containerRef:P,viewRef:V,mobileComposer:ee?{textareaRef:q,value:K,onChange:on,onBlur:()=>ge.current(),onPaste:Le,placeholder:Kn}:null,focus:ns,submitText:h.useCallback(()=>{const se=V.current;!se&&!ee||Ds.current(se)},[ee]),clearText:oo,getText:Ys,hasInput:Pa,hasAttachments:Hn||Ar.length>0||gn.length>0,hasContent:Pn,handle:qr,pastedImages:gn,removeImage:ii,composerTags:Ar,removeTopTag:ki,addTags:xo,removeInlineTags:Xs,insertText:si,setText:Ps,submit:pr,clear:Ai,retryLast:os,replaceEditorText:_i,shellMode:ie,setShellMode:Pe,toggleShellMode:vn,currentMode:m,sessionName:x,searchState:{searchMode:Ce,searchQuery:Ft,searchMatches:Xe,searchActiveIndex:Ht,searchInputRef:Ve,searchUiRef:ft,openHistorySearch:_e,closeSearch:ri,submitSearchMatch:Cu,restoreSearchMatch:pi,handleSearchKeyDown:Ju,handleSearchInput:ga,handleSearchCompositionEnd:rr},navigatePrevHistory:qt,navigateNextHistory:On,showShortcutHints:Bi,followupState:b,disabled:i,onAcceptFollowup:v,onDismissFollowup:y,slashMenu:xe,closeSlashMenu:Ns,selectSlashCompletion:Fr,acceptSlashCompletion:Mr,atMenu:He.state,closeAtMenu:bs,selectAtCompletion:He.select,acceptAtCompletion:He.accept,enterAtCategory:He.enterCategory,backAtCategories:He.backToCategories,updateAtSearch:He.updateSearch,selectAtTab:He.selectTab}}const _qe="_flash_96ig5_1",hp={flash:_qe},Sqe="_chatMessageRow_17pz3_41",Cqe="_chatBubble_17pz3_48",Tqe="_chatContent_17pz3_61",Eqe="_messageTag_17pz3_66",jqe="_messageTagTooltip_17pz3_83",Aqe="_messageTagClickable_17pz3_117",Nqe="_messageTagIcon_17pz3_127",Mqe="_messageTagLabel_17pz3_138",Iqe="_messageTagValue_17pz3_139",Rqe="_chatContentCollapsed_17pz3_162",Dqe="_toggleButton_17pz3_167",Pqe="_toggleIcon_17pz3_188",Lqe="_toggleIconExpanded_17pz3_195",Oqe="_chatImages_17pz3_199",$qe="_chatImageThumb_17pz3_206",Ua={chatMessageRow:Sqe,chatBubble:Cqe,chatContent:Tqe,messageTag:Eqe,messageTagTooltip:jqe,messageTagClickable:Aqe,messageTagIcon:Nqe,messageTagLabel:Mqe,messageTagValue:Iqe,chatContentCollapsed:Rqe,toggleButton:Dqe,toggleIcon:Pqe,toggleIconExpanded:Lqe,chatImages:Oqe,chatImageThumb:$qe};function Bqe({composerTagIcons:e,content:t,inputAnnotations:n,onComposerTagClick:s,renderComposerTag:r,renderComposerTagTooltip:i}){const o=h.useMemo(()=>QQ(t,n),[t,n]);return l.jsx(l.Fragment,{children:o.map((a,c)=>a.type==="text"?l.jsx(h.Fragment,{children:a.text},c):l.jsx(cP,{composerTagIcons:e,onComposerTagClick:s,renderComposerTag:r,renderComposerTagTooltip:i,tag:a.tag,title:a.tag.serialized,preserveCustomKindLabel:!0},`${a.tag.id}:${c}`))})}const zqe=h.memo(function({content:t,images:n,inputAnnotations:s,isLocateFlashing:r=!1}){const{t:i}=lt(),{parseUserMessageContent:o,renderUserMessageContent:a,composerTagIcons:c,renderComposerTag:u,renderComposerTagTooltip:d,onComposerTagClick:f}=ku(),m=h.useRef(null),[p,g]=h.useState(!1),[b,v]=h.useState(!1),y=h.useMemo(()=>{const x=a==null?void 0:a({content:t,images:n,inputAnnotations:s});if(x!=null)return x;if(s&&s.length>0)return l.jsx(Bqe,{composerTagIcons:c,content:t,inputAnnotations:s,onComposerTagClick:f,renderComposerTag:u,renderComposerTagTooltip:d});const k=PI(t,o,"[WebShell] failed to parse user message content");return k?k.map((C,T)=>C.type==="text"?C.text:l.jsx(cP,{tag:C.tag,composerTagIcons:c,renderComposerTag:u,renderComposerTagTooltip:d,onComposerTagClick:f},`${C.tag.id}-${T}`)):t},[t,n,s,f,o,c,u,d,a]),w=h.useCallback(()=>{const x=m.current;x&&v(x.scrollHeight>400)},[]);return h.useLayoutEffect(()=>{g(!1),w()},[t,n==null?void 0:n.length,w]),h.useEffect(()=>{const x=m.current;if(!x||typeof ResizeObserver>"u")return;const k=new ResizeObserver(w);return k.observe(x),()=>k.disconnect()},[w]),l.jsx("div",{className:Ua.chatMessageRow,children:l.jsxs("div",{className:`${Ua.chatBubble}${r?` ${hp.flash}`:""}`,children:[l.jsxs("div",{ref:m,className:`${Ua.chatContent} ${b&&!p?Ua.chatContentCollapsed:""}`,children:[n&&n.length>0&&l.jsx("div",{className:Ua.chatImages,children:n.map((x,k)=>{const C=x.data.startsWith("data:")?x.data:`data:${x.mimeType};base64,${x.data}`;return by(C)?l.jsx("img",{src:C,alt:i("user.uploadedImage",{index:k+1}),className:Ua.chatImageThumb,onLoad:w},k):null})}),y]}),b&&l.jsxs("button",{type:"button",className:Ua.toggleButton,onClick:()=>g(x=>!x),children:[l.jsx("span",{children:i(p?"userMessage.showLess":"userMessage.showMore")}),l.jsx("svg",{className:`${Ua.toggleIcon} ${p?Ua.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 Fqe(e){return aP(e)}function cP({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(w){console.warn("[WebShell] user message tag render failed",w)}try{u=s==null?void 0:s(a)}catch(w){console.warn("[WebShell] user message tag tooltip render failed",w)}const d=!!r,f=o?Nve(e,t):null,m=j5(e),p=(f==null?void 0:f.tagValue)??A5(e),g=(f==null?void 0:f.tagLabel)??(e.kind?"":m),b=(f==null?void 0:f.fallback)??e.id,v=e.icon??(f==null?void 0:f.iconUrl)??hg(e.kind,t),y=v&&(OI(v)||by(v))?v:void 0;return l.jsxs("span",{className:`${Ua.messageTag}${d?` ${Ua.messageTagClickable}`:""}`,role:d?"button":void 0,tabIndex:d?0:void 0,title:i??Fqe(e),onClick:w=>{d&&(w.stopPropagation(),r==null||r({...a,anchorRect:w.currentTarget.getBoundingClientRect()}))},onKeyDown:w=>{d&&(w.key!=="Enter"&&w.key!==" "||(w.preventDefault(),r==null||r({...a,anchorRect:w.currentTarget.getBoundingClientRect()})))},children:[c??l.jsxs(l.Fragment,{children:[y&&l.jsx("span",{className:Ua.messageTagIcon,style:wm("--user-message-tag-icon-url",y),"aria-hidden":"true"}),g&&l.jsx("span",{className:Ua.messageTagLabel,children:g}),p?l.jsx("span",{className:Ua.messageTagValue,children:p}):g?null:l.jsx("span",{className:Ua.messageTagLabel,children:b})]}),u!=null&&l.jsx("span",{className:Ua.messageTagTooltip,role:"tooltip",children:u})]})}const Hqe="_message_nn1j4_1",qqe="_customFooter_nn1j4_7",Uqe="_messageFooter_nn1j4_11",Wqe="_copyButton_nn1j4_27",Vqe="_footerTime_nn1j4_53",Gqe="_thinking_nn1j4_65",Kqe="_thinkingBody_nn1j4_77",Yqe="_thinkingHeader_nn1j4_108",Xqe="_thinkingSummary_nn1j4_120",Qqe="_translateButton_nn1j4_136",Jqe="_thinkingHeaderExpanded_nn1j4_147",Zqe="_translationPopover_nn1j4_154",eUe="_translationTitle_nn1j4_159",tUe="_translationContent_nn1j4_164",nUe="_translationPending_nn1j4_171",sUe="_translationError_nn1j4_175",rUe="_translationFooter_nn1j4_179",iUe="_translationUsage_nn1j4_189",oUe="_translationActions_nn1j4_196",aUe="_thinkingSummaryTextActive_nn1j4_211",lUe="_thinkingSummaryIcon_nn1j4_218",cUe="_thinkingSummaryText_nn1j4_211",uUe="_thinkingChevronRight_nn1j4_275",dUe="_thinkingChevronDown_nn1j4_276",hUe="_thinkingExpandedWrap_nn1j4_339",fUe="_thinkingExpandedClip_nn1j4_343",mUe="_thinkingExpandedInner_nn1j4_350",pUe="_content_nn1j4_398",gUe="_contentBody_nn1j4_403",xr={message:Hqe,customFooter:qqe,messageFooter:Uqe,copyButton:Wqe,footerTime:Vqe,thinking:Gqe,thinkingBody:Kqe,thinkingHeader:Yqe,thinkingSummary:Xqe,translateButton:Qqe,thinkingHeaderExpanded:Jqe,translationPopover:Zqe,translationTitle:eUe,translationContent:tUe,translationPending:nUe,translationError:sUe,translationFooter:rUe,translationUsage:iUe,translationActions:oUe,thinkingSummaryTextActive:aUe,thinkingSummaryIcon:lUe,thinkingSummaryText:cUe,thinkingChevronRight:uUe,thinkingChevronDown:dUe,thinkingExpandedWrap:hUe,thinkingExpandedClip:fUe,thinkingExpandedInner:mUe,content:pUe,contentBody:gUe},bUe=80;function yUe(e,t){const[n,s]=h.useState(e),r=h.useRef(e),i=h.useRef(void 0);return r.current=e,h.useEffect(()=>{if(!t){i.current!==void 0&&(clearTimeout(i.current),i.current=void 0),n!==e&&s(e);return}i.current!==void 0||n===e||(i.current=setTimeout(()=>{i.current=void 0,s(r.current)},bUe))},[e,t,n]),h.useEffect(()=>()=>{i.current!==void 0&&clearTimeout(i.current)},[]),t&&e.startsWith(n)?n:e}const wUe=h.memo(function({content:t,isStreaming:n,timestamp:s,onBranchSession:r,showFooterActions:i=!1,showBranchAction:o=!1,isLocateFlashing:a=!1,customFooterInfo:c}){const{t:u}=lt(),{renderAssistantTurnFooter:d}=ku(),f=yUe(t,n),[m,p]=h.useState(!1),g=!!t&&!n&&i,b=h.useMemo(()=>c?d==null?void 0:d(c):void 0,[c,d]),v=h.useCallback(()=>{var w;const y=(w=navigator.clipboard)==null?void 0:w.writeText(t);y&&y.then(()=>{p(!0),window.setTimeout(()=>p(!1),2e3)}).catch(()=>{})},[t]);return l.jsxs("div",{className:xr.message,children:[t&&l.jsx("div",{className:`${xr.content}${a?` ${hp.flash}`:""}`,children:l.jsx("div",{className:xr.contentBody,children:l.jsx(pf,{content:f,source:"assistant",isStreaming:n})})}),b&&l.jsx("div",{className:xr.customFooter,children:b}),g&&l.jsxs("div",{className:xr.messageFooter,children:[l.jsx("button",{type:"button",className:xr.copyButton,title:u("assistant.copy"),"aria-label":u("assistant.copy"),onClick:v,children:m?l.jsx(xUe,{}):l.jsx(vUe,{})}),o&&r&&l.jsx("button",{type:"button",className:xr.copyButton,title:u("assistant.branch"),"aria-label":u("assistant.branch"),onClick:r,children:l.jsx(kUe,{})}),s!==void 0&&l.jsx("span",{className:xr.footerTime,"aria-hidden":"true",children:Cb(s)})]})]})});function vUe(){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 xUe(){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 kUe(){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 g0=new Map,_Ue=200;function lW(e,t){if(g0.delete(e),g0.set(e,t),g0.size<=_Ue)return;const n=g0.keys().next().value;n!==void 0&&g0.delete(n)}const SUe=h.memo(function({messageId:t,content:n,isStreaming:s,timestamp:r,isLocateFlashing:i=!1,generateContent:o}){const{language:a,t:c}=lt(),u=h.useContext(sg),[d,f]=h.useState(!1),m=s===!0,p=h.useRef(r??Date.now()),g=h.useRef(m),[b,v]=h.useState(()=>Date.now()),[y,w]=h.useState(null),[x,k]=h.useState(!1),[C,T]=h.useState(),[_,S]=h.useState(!1),[R,A]=h.useState(!1),[O,M]=h.useState(!1),D=h.useRef(void 0);h.useEffect(()=>{if(!n||!m)return;v(Date.now());const J=setInterval(()=>v(Date.now()),1e3);return()=>clearInterval(J)},[n,m]),h.useEffect(()=>{if(n){if(m){g.current=!0,w(null);return}g.current&&y===null&&w(Date.now())}},[n,y,m]);const $=m||y!==null?(m?b:y)-p.current:void 0,z=CUe({isStreaming:s,durationMs:$}),B=$!==void 0?TUe($):"",j=h.useCallback(()=>{f(J=>!J)},[]);h.useEffect(()=>()=>{var J;(J=D.current)==null||J.abort()},[]);const H=h.useCallback(async(J=!1)=>{var K;if(s||!o||_&&!J)return;const W=`${a}:${t}:${n}`,P=g0.get(W);if(P&&!J){lW(W,P),T(P);return}J&&g0.delete(W),(K=D.current)==null||K.abort();const V=new AbortController;D.current=V,T({text:""}),A(!1),M(!1),S(!0);let ee="",q=!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 ne of o(re,{signal:V.signal})){if(D.current!==V)return;if(ne.type==="thinking")A(!0);else if(ne.type==="delta")A(!1),ee+=ne.text,T({text:ee});else if(ne.type==="done"){if(!ee.trim())throw new Error("Translation was empty");q=!0;const U={text:ee,inputTokens:ne.inputTokens,outputTokens:ne.outputTokens};lW(W,U),T(U)}else if(ne.type==="error")throw new Error(ne.message)}if(!q)throw new Error("Translation stream ended early")}catch{V.signal.aborted||M(!0)}finally{D.current===V&&(D.current=void 0,A(!1),S(!1))}},[n,o,s,a,t,_]),Q=h.useCallback(J=>{k(J),J&&H()},[H]),I=h.useCallback(()=>{const J=D.current;D.current=void 0,J==null||J.abort(),A(!1),S(!1),k(!1)},[]);return l.jsx("div",{className:`${xr.message}${i?` ${hp.flash}`:""}`,children:n&&!u&&l.jsx("div",{className:xr.thinking,children:l.jsxs("div",{className:xr.thinkingBody,children:[l.jsxs("div",{className:`${xr.thinkingHeader}${d?` ${xr.thinkingHeaderExpanded}`:""}`,onClick:J=>{J.currentTarget.contains(J.target)&&j()},children:[l.jsxs("button",{type:"button",className:xr.thinkingSummary,"aria-expanded":d,title:c(d?"thinking.collapse":"thinking.expand"),children:[l.jsx("span",{className:xr.thinkingSummaryIcon,"aria-hidden":"true",children:l.jsx(EUe,{})}),l.jsx("span",{className:m?`${xr.thinkingSummaryText} ${xr.thinkingSummaryTextActive}`:xr.thinkingSummaryText,children:c(z,B?{duration:B}:{})})]}),a==="zh-CN"&&!m&&o&&l.jsxs(np,{open:x,onOpenChange:Q,children:[l.jsx(V0,{asChild:!0,children:l.jsx(Jt,{type:"button",variant:"secondary",size:"xs",className:xr.translateButton,title:c("thinking.translate"),onClick:J=>J.stopPropagation(),children:c("thinking.translate")})}),l.jsxs(sp,{align:"start",className:xr.translationPopover,children:[l.jsx("div",{className:xr.translationTitle,children:c("thinking.translation")}),O?l.jsx("div",{className:xr.translationError,children:c("thinking.translationFailed")}):C!=null&&C.text?l.jsx("div",{className:`${xr.thinkingExpandedWrap} ${xr.translationContent}`,children:l.jsx(pf,{content:C.text,source:"thinking",isStreaming:_})}):l.jsx("div",{className:xr.translationPending,children:c(R?"thinking.translationThinking":"thinking.translating")}),l.jsxs("div",{className:xr.translationFooter,children:[l.jsx("div",{className:xr.translationUsage,children:!_&&(C==null?void 0:C.text)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{children:c("thinking.inputTokens",{count:C.inputTokens??"--"})}),l.jsx("span",{children:c("thinking.outputTokens",{count:C.outputTokens??"--"})})]})}),l.jsxs("div",{className:xr.translationActions,children:[l.jsx(Jt,{type:"button",variant:"outline",size:"xs",onClick:()=>void H(!0),children:c("thinking.retranslate")}),l.jsx(Jt,{type:"button",variant:"outline",size:"xs",disabled:!_&&!(C!=null&&C.text)&&!O,onClick:I,children:c(_?"thinking.cancelTranslation":"thinking.closeTranslation")})]})]})]})]}),l.jsx("span",{className:d?xr.thinkingChevronDown:xr.thinkingChevronRight,"aria-hidden":"true"})]}),d&&l.jsx("div",{className:xr.thinkingExpandedClip,children:l.jsx("div",{className:xr.thinkingExpandedInner,children:l.jsx("div",{className:xr.thinkingExpandedWrap,children:l.jsx(pf,{content:n,source:"thinking",isStreaming:s})})})})]})})})});function CUe({isStreaming:e,durationMs:t}){return e?"thinking.running":t!==void 0&&t<1e3?"thinking.doneBriefly":"thinking.done"}function TUe(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 EUe(){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 jUe="_panel_8ng9u_1",AUe="_title_8ng9u_16",NUe="_metaLine_8ng9u_22",MUe="_progress_8ng9u_32",IUe="_spacer_8ng9u_38",RUe="_row_8ng9u_42",DUe="_detailRow_8ng9u_43",PUe="_subDetailRow_8ng9u_44",LUe="_symbol_8ng9u_65",OUe="_label_8ng9u_69",$Ue="_value_8ng9u_73",BUe="_detailName_8ng9u_80",zUe="_sectionTitle_8ng9u_88",FUe="_detailSection_8ng9u_94",HUe="_skillBlock_8ng9u_100",qUe="_hint_8ng9u_105",UUe="_detailCommand_8ng9u_111",WUe="_bodyLoaded_8ng9u_132",VUe="_accent_8ng9u_137",GUe="_secondary_8ng9u_141",KUe="_warning_8ng9u_145",YUe="_error_8ng9u_149",XUe="_success_8ng9u_153",ls={panel:jUe,title:AUe,metaLine:NUe,progress:MUe,spacer:IUe,row:RUe,detailRow:DUe,subDetailRow:PUe,symbol:LUe,label:OUe,value:$Ue,detailName:BUe,sectionTitle:zUe,detailSection:FUe,skillBlock:HUe,hint:qUe,detailCommand:UUe,bodyLoaded:WUe,accent:VUe,secondary:GUe,warning:KUe,error:YUe,success:XUe},MM="web-shell:context-usage:v1:",Vf="█",Rle="▒",Dle="░",Ple=30;function QUe(e){return`${MM}${JSON.stringify(e)}`}function JUe(e){if(!e.startsWith(MM))return null;try{const t=JSON.parse(e.slice(MM.length));return!(t!=null&&t.usage)||typeof t.usage.totalTokens!="number"?null:t}catch{return null}}function Lle(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function qb(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function ZUe(e,t){if(t<=0)return"0.0";const n=e/t*100;return n>100?">100":n.toFixed(1)}function eWe(e){return[...e].sort((t,n)=>n.tokens-t.tokens)}function tWe({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?ls.error:e>60?ls.warning:ls.accent;return l.jsxs("div",{className:ls.progress,"aria-hidden":"true",children:[l.jsx("span",{className:o,children:Vf.repeat(Math.max(0,s))}),l.jsx("span",{className:ls.secondary,children:Dle.repeat(Math.max(0,i))}),l.jsx("span",{className:ls.warning,children:Rle.repeat(Math.max(0,r))})]})}function Eh({symbol:e,label:t,tokens:n,tokenLabel:s,contextWindowSize:r,symbolClassName:i=ls.secondary,isOverLimit:o}){return l.jsxs("div",{className:ls.row,children:[l.jsx("span",{className:`${ls.symbol} ${i}`,children:e}),l.jsx("span",{className:ls.label,children:t}),l.jsxs("span",{className:o?ls.error:ls.value,children:[qb(n)," ",s," (",ZUe(n,r),"%)"]})]})}const hE="/context detail";function nWe({hint:e,onShowDetail:t}){const n=t?e.indexOf(hE):-1;return n<0?l.jsx("div",{className:ls.hint,children:e}):l.jsxs("div",{className:ls.hint,children:[e.slice(0,n),l.jsx("button",{type:"button",className:ls.detailCommand,onClick:t,children:hE}),e.slice(n+hE.length)]})}function sWe({name:e,tokens:t,tokenLabel:n}){return l.jsxs("div",{className:ls.detailRow,children:[l.jsxs("span",{className:ls.secondary,children:["└"," "]}),l.jsx("span",{className:ls.detailName,title:e,children:Lle(e,Ple)}),l.jsxs("span",{className:ls.value,children:[qb(t)," ",n]})]})}function fE({title:e,items:t,getName:n,tokenLabel:s}){const r=eWe(t);return r.length===0?null:l.jsxs("section",{className:ls.detailSection,children:[l.jsx("div",{className:ls.sectionTitle,children:e}),r.map(i=>l.jsx(sWe,{name:n(i),tokens:i.tokens,tokenLabel:s},n(i)))]})}function rWe({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:ls.detailSection,children:[l.jsx("div",{className:ls.sectionTitle,children:t.skills}),n.map(s=>l.jsxs("div",{className:ls.skillBlock,children:[l.jsxs("div",{className:ls.detailRow,children:[l.jsxs("span",{className:ls.secondary,children:["└"," "]}),l.jsxs("span",{className:ls.detailName,title:s.name,children:[Lle(s.name,Ple),s.loaded&&l.jsxs("span",{className:ls.success,children:[" ",t.active]})]}),l.jsxs("span",{className:ls.value,children:[qb(s.tokens)," ",t.tokens]})]}),s.loaded&&s.bodyTokens!=null&&s.bodyTokens>0&&l.jsxs("div",{className:ls.subDetailRow,children:[l.jsxs("span",{className:ls.secondary,children:["  └"," "]}),l.jsx("span",{className:ls.bodyLoaded,children:t.bodyLoaded}),l.jsxs("span",{className:ls.success,children:["+",qb(s.bodyTokens)," ",t.tokens]})]})]},s.name))]})}function iWe({status:e,onShowDetail:t}){const{t:n}=lt(),{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:ls.panel,children:[l.jsx("div",{className:ls.title,children:n("contextUsage.title")}),s.isEstimated?l.jsx(l.Fragment,{children:l.jsxs("div",{className:ls.metaLine,children:[l.jsxs("span",{children:[n("contextUsage.model"),": ",s.modelName]}),l.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",qb(i)," ",n("contextUsage.tokens")]})]})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ls.metaLine,children:[l.jsxs("span",{children:[n("contextUsage.model"),": ",s.modelName]}),l.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",qb(i)," ",n("contextUsage.tokens")]})]}),a&&l.jsx("div",{className:ls.error,children:n("contextUsage.overLimit")})]}),l.jsx(tWe,{usedPercentage:Math.min(o,100),bufferPercentage:c}),l.jsx("div",{className:ls.spacer}),l.jsx(Eh,{symbol:Vf,label:n("contextUsage.used"),tokens:s.totalTokens,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:a?ls.error:ls.accent,isOverLimit:a}),l.jsx(Eh,{symbol:Dle,label:n("contextUsage.free"),tokens:r.freeSpace,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i}),l.jsx(Eh,{symbol:Rle,label:n("contextUsage.autocompactBuffer"),tokens:r.autocompactBuffer,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ls.warning}),l.jsx("div",{className:ls.spacer}),l.jsx("div",{className:ls.sectionTitle,children:n("contextUsage.usageByCategory")}),l.jsx(Eh,{symbol:Vf,label:n("contextUsage.systemPrompt"),tokens:r.systemPrompt,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ls.accent}),l.jsx(Eh,{symbol:Vf,label:n("contextUsage.builtinTools"),tokens:r.builtinTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ls.accent}),r.mcpTools>0&&l.jsx(Eh,{symbol:Vf,label:n("contextUsage.mcpTools"),tokens:r.mcpTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ls.accent}),l.jsx(Eh,{symbol:Vf,label:n("contextUsage.memoryFiles"),tokens:r.memoryFiles,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ls.accent}),l.jsx(Eh,{symbol:Vf,label:n("contextUsage.skills"),tokens:r.skills,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ls.accent}),!s.isEstimated&&l.jsx(Eh,{symbol:Vf,label:n("contextUsage.messages"),tokens:r.messages,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ls.accent}),s.showDetails?l.jsxs(l.Fragment,{children:[l.jsx(fE,{title:n("contextUsage.builtinTools"),items:s.builtinTools,getName:u=>"name"in u?u.name:u.path,tokenLabel:n("contextUsage.tokens")}),l.jsx(fE,{title:n("contextUsage.mcpTools"),items:s.mcpTools,getName:u=>"name"in u?u.name:u.path,tokenLabel:n("contextUsage.tokens")}),l.jsx(fE,{title:n("contextUsage.memoryFiles"),items:s.memoryFiles,getName:u=>"path"in u?u.path:u.name,tokenLabel:n("contextUsage.tokens")}),l.jsx(rWe,{skills:s.skills,labels:{active:n("contextUsage.active"),bodyLoaded:n("contextUsage.bodyLoaded"),skills:n("contextUsage.skills"),tokens:n("contextUsage.tokens")}})]}):l.jsx(nWe,{hint:n("contextUsage.detailHint"),onShowDetail:t})]})}const oWe={edit:"Edit",write_file:"WriteFile",read_file:"ReadFile",zoom_image:"ZoomImage",grep:"Grep",grep_search:"Grep",glob:"Glob",run_shell_command:"Shell",todo_write:"TodoList",get_goal:"Goal",update_goal:"UpdateGoal",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",list_agents:"ListAgents",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",image_gen:"ImageGen",bash:"Shell",shell:"Shell Command",read:"ReadFile",write:"WriteFile",search:"Grep"},aWe=/[\x00-\x08\x0b-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/g;function g4(e){return e.replace(aWe,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 Ole(e){if(!e.trim())return"Tool";const t=oWe[e];if(t)return t;const n=e.toLowerCase();return n==="web_fetch"||n==="webfetch"||n==="fetch"?"WebFetch":e}function qu(e,t){const n=Ole(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 Qu(e){const t=e.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function Do(e,t){return e.length<=t?e:e.slice(0,t)+"..."}const db=2e3;function uP(e,t){if(I5(e.toolName)){const r=M5(e.args,"skill");if(r)return Do(r,db)}const n=uWe(e,t);if(n)return Do(n,db);const s=Ble(e,t);return s?Do(s,db):""}function $le(e,t){if(!Sc(e.toolName))return uP(e,t);const n=M5(e.args,"description");if(n)return Do(n,db);const s=Ble(e,t,{includeTimeout:!1});return s?Do(s,db):""}function lWe(e){return Sc(e.toolName)?M5(e.args,"description"):""}function Hd(e){var t;if(!e.content)return RM(e.rawOutput);for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text;return RM(e.rawOutput)}function cWe(e){if(e.status!=="completed"&&e.status!=="failed")return"";const t=e.toolName.toLowerCase();if(t==="grep_search"||t==="grep"||t==="search"){const o=cW((RM(e.rawOutput)??"").trim());if(o)return o}const n=Hd(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(Sc(t)){if(r>3)return`${r} lines of output`;const o=s[0]||"";return Do(o,80)}if(t==="grep_search"||t==="grep"||t==="search"){const o=cW(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 Do(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(Qu(t))return"";const i=s[0]||"";return Do(i,80)}function uWe(e,t){if(!e.title)return null;const n=Ole(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 uW(o.replace(/^:\s*|\s+/,""),t)}return uW(s,t)}function cW(e){return e==="No matches found"||/^Found \d+ match(?:es)?(?: \(truncated\))?$/.test(e)?e:null}function Ble(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 ${F1(String(s.directory),t)}]`),s.is_background?o+=" [background]":i&&s.timeout&&(o+=` [timeout: ${String(s.timeout)}ms]`);const a=M5(s,"description");return a&&(o+=` (${a})`),Do(o,db)}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):F1(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} — "${Do(a,40)}"`:o;return Do(c,80)}if(s.path)return F1(String(s.path),t);if(s.query)return Do(String(s.query),60);if(r==="list_directory"||r==="listfiles"){const o=s.path||s.directory||"";return F1(String(o),t)}return s.description?String(s.description):""}function M5(e,t){const n=e==null?void 0:e[t];return typeof n=="string"?n.trim().replace(/\n/g," "):""}function Sc(e){const t=e.toLowerCase();return t==="run_shell_command"||t==="bash"||t==="shell"||t==="execute_command"}function I5(e){return e.toLowerCase()==="skill"}function Uu(e,t){var n;return e.callId===t?!0:((n=e.subTools)==null?void 0:n.some(s=>Uu(s,t)))??!1}function uW(e,t){const n=e.trim();return zle(IM(n))?F1(n,t):n.replace(/(?:[A-Za-z]:)?\/[^\s'")]+/g,s=>F1(s,t))}function F1(e,t){const n=IM(e),s=t?IM(t).replace(/\/+$/,""):"";return s&&(n===s||n.startsWith(`${s}/`))?n.slice(s.length+1)||".":zle(n)?dWe(n):n}function IM(e){return e.replace(/\\/g,"/")}function zle(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function dWe(e){return e.replace(/\/+$/,"").split("/").pop()||e}function Rk(e){if(!e||typeof e!="object")return;const t=e;return t.type==="task_execution"?t:void 0}function dP(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 Ix(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=dP(e);return n==="cancelled"||n==="canceled"||s.toLowerCase().includes("cancel")?"failed":e.status}function hP(e){return e>=1e6?`${(e/1e6).toFixed(1)}M tokens`:e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k tokens":`${e} tokens`}const hWe="general-purpose";function fP(e){var s;const t=Rk(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":hWe}function R5(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=Rk(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 fWe(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=qu(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 Do(r,50)}function RM(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 mWe="_panel_qchwm_1",pWe="_title_qchwm_17",gWe="_sectionTitle_qchwm_23",bWe="_spacer_qchwm_29",yWe="_pivotRow_qchwm_35",wWe="_metricCell_qchwm_41",vWe="_metricCellSection_qchwm_48",xWe="_metricCellSub_qchwm_56",kWe="_modelCell_qchwm_64",_We="_modelCellHeader_qchwm_71",SWe="_divider_qchwm_79",CWe="_kvRow_qchwm_87",TWe="_kvSubRow_qchwm_94",EWe="_kvLabel_qchwm_102",jWe="_kvValue_qchwm_106",AWe="_tableRow_qchwm_115",NWe="_modelUsageRow_qchwm_121",MWe="_tableNameCol_qchwm_129",IWe="_tableToolCol_qchwm_137",RWe="_tableNumCol_qchwm_145",DWe="_tableValueCol_qchwm_153",PWe="_success_qchwm_162",LWe="_error_qchwm_166",OWe="_secondary_qchwm_170",$We="_warning_qchwm_174",Ut={panel:mWe,title:pWe,sectionTitle:gWe,spacer:bWe,pivotRow:yWe,metricCell:wWe,metricCellSection:vWe,metricCellSub:xWe,modelCell:kWe,modelCellHeader:_We,divider:SWe,kvRow:CWe,kvSubRow:TWe,kvLabel:EWe,kvValue:jWe,tableRow:AWe,modelUsageRow:NWe,tableNameCol:MWe,tableToolCol:IWe,tableNumCol:RWe,tableValueCol:DWe,success:PWe,error:LWe,secondary:OWe,warning:$We},DM="web-shell:session-stats:v1:";function BWe(e,t="overview"){return`${DM}${JSON.stringify({_view:t,...e})}`}function zWe(e){if(!e.startsWith(DM))return null;try{const t=JSON.parse(e.slice(DM.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 Pm(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 b0({label:e,children:t}){return l.jsxs("div",{className:Ut.kvRow,children:[l.jsx("span",{className:Ut.kvLabel,children:e}),l.jsx("span",{className:Ut.kvValue,children:t})]})}function Iv({label:e,children:t}){return l.jsxs("div",{className:Ut.kvSubRow,children:[l.jsxs("span",{className:Ut.secondary,children:["»"," ",e]}),l.jsx("span",{className:Ut.kvValue,children:t})]})}function Fle(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 FWe(e){return e.api.totalRequests===0?0:e.api.totalErrors/e.api.totalRequests*100}function HWe(e){return e.api.totalRequests===0?0:e.api.totalLatencyMs/e.api.totalRequests}function qWe(e){return e.tokens.prompt===0?0:e.tokens.cached/e.tokens.prompt*100}function pd({metric:e,values:t,variant:n="normal"}){const s=n==="section"?Ut.metricCellSection:n==="sub"?Ut.metricCellSub:Ut.metricCell;return l.jsxs("div",{className:Ut.pivotRow,children:[l.jsx("span",{className:s,children:n==="sub"?`↳ ${e}`:e}),t.map((r,i)=>l.jsx("span",{className:Ut.modelCell,children:r},i))]})}function UWe({status:e}){const{t}=lt(),{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,f=Fle(n),m=f.reduce((b,v)=>b+v.metrics.tokens.cached,0),p=f.reduce((b,v)=>b+v.metrics.tokens.prompt,0),g=p>0?m/p*100:0;return l.jsxs("div",{className:Ut.panel,children:[l.jsx("div",{className:Ut.title,children:t("stats.title")}),l.jsx("div",{className:Ut.sectionTitle,children:t("stats.overview")}),l.jsx(b0,{label:t("stats.duration"),children:Pm(e.durationMs)}),l.jsx(b0,{label:t("stats.prompts"),children:e.promptCount}),l.jsx(b0,{label:t("stats.toolCalls"),children:l.jsxs("span",{children:[s.totalCalls," ",l.jsx("span",{className:Ut.secondary,children:"("}),l.jsxs("span",{className:Ut.success,children:["✓",s.totalSuccess]})," ",l.jsxs("span",{className:Ut.error,children:["✗",s.totalFail]}),l.jsx("span",{className:Ut.secondary,children:")"})]})}),l.jsx(b0,{label:t("stats.successRate"),children:l.jsxs("span",{className:d>=90?Ut.success:d>=70?Ut.warning:Ut.error,children:[d.toFixed(1),"%"]})}),(r.totalLinesAdded>0||r.totalLinesRemoved>0)&&l.jsx(b0,{label:t("stats.codeChanges"),children:l.jsxs("span",{children:[l.jsxs("span",{className:Ut.success,children:["+",r.totalLinesAdded]})," ",l.jsxs("span",{className:Ut.error,children:["-",r.totalLinesRemoved]})]})}),l.jsx("div",{className:Ut.spacer}),l.jsx("div",{className:Ut.sectionTitle,children:t("stats.performance")}),l.jsxs(Iv,{label:t("stats.apiTime"),children:[Pm(i)," ",l.jsxs("span",{className:Ut.secondary,children:["(",c.toFixed(1),"%)"]})]}),l.jsxs(Iv,{label:t("stats.toolTime"),children:[Pm(o)," ",l.jsxs("span",{className:Ut.secondary,children:["(",u.toFixed(1),"%)"]})]}),f.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Ut.spacer}),l.jsx("div",{className:Ut.sectionTitle,children:t("stats.modelUsage")}),l.jsx("div",{className:Ut.spacer}),l.jsxs("div",{className:`${Ut.tableRow} ${Ut.modelUsageRow}`,children:[l.jsx("span",{className:Ut.tableNameCol,children:t("stats.modelUsage")}),l.jsx("span",{className:Ut.tableValueCol,children:t("stats.reqs")}),l.jsx("span",{className:Ut.tableValueCol,children:t("stats.inputTokens")}),l.jsx("span",{className:Ut.tableValueCol,children:t("stats.outputTokens")})]}),l.jsx("div",{className:Ut.divider}),f.map(b=>l.jsxs("div",{className:`${Ut.tableRow} ${Ut.modelUsageRow}`,children:[l.jsx("span",{className:Ut.tableNameCol,children:b.label}),l.jsx("span",{className:Ut.tableValueCol,children:b.metrics.api.totalRequests}),l.jsx("span",{className:`${Ut.tableValueCol} ${Ut.warning}`,children:b.metrics.tokens.prompt.toLocaleString()}),l.jsx("span",{className:`${Ut.tableValueCol} ${Ut.warning}`,children:b.metrics.tokens.candidates.toLocaleString()})]},b.key)),g>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Ut.spacer}),l.jsxs("div",{children:[l.jsx("span",{className:Ut.success,children:t("stats.savingsHighlight")})," ",m.toLocaleString()," (",g.toFixed(1),"%)"," ",t("stats.cacheDesc")]}),l.jsxs("div",{className:Ut.secondary,children:["»"," ",t("stats.modelTip")]})]})]})]})}function WWe({status:e}){const{t}=lt(),n=Fle(e.models);if(n.length===0)return l.jsxs("div",{className:Ut.panel,children:[l.jsx("div",{className:Ut.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:Ut.panel,children:[l.jsx("div",{className:Ut.title,children:t("stats.modelStats")}),l.jsx("div",{className:Ut.spacer}),l.jsxs("div",{className:Ut.pivotRow,children:[l.jsx("span",{className:Ut.metricCellSection,children:t("stats.metric")}),n.map(o=>l.jsx("span",{className:Ut.modelCellHeader,children:o.label},o.key))]}),l.jsx("div",{className:Ut.divider}),l.jsx(pd,{metric:t("stats.api"),values:[],variant:"section"}),l.jsx(pd,{metric:t("stats.requests"),values:i(o=>o.api.totalRequests.toLocaleString())}),l.jsx(pd,{metric:t("stats.errors"),values:i(o=>{const a=FWe(o);return l.jsxs("span",{className:o.api.totalErrors>0?Ut.error:void 0,children:[o.api.totalErrors.toLocaleString()," (",a.toFixed(1),"%)"]})})}),l.jsx(pd,{metric:t("stats.avgLatency"),values:i(o=>Pm(HWe(o)))}),l.jsx("div",{className:Ut.spacer}),l.jsx(pd,{metric:t("stats.tokens"),values:[],variant:"section"}),l.jsx(pd,{metric:t("stats.total"),values:i(o=>l.jsx("span",{className:Ut.warning,children:o.tokens.total.toLocaleString()}))}),l.jsx(pd,{metric:t("stats.inputTokens"),values:i(o=>o.tokens.prompt.toLocaleString()),variant:"sub"}),s&&l.jsx(pd,{metric:t("stats.cached"),values:i(o=>l.jsxs("span",{className:Ut.success,children:[o.tokens.cached.toLocaleString()," (",qWe(o).toFixed(1),"%)"]})),variant:"sub"}),l.jsx(pd,{metric:t("stats.outputTokens"),values:i(o=>o.tokens.candidates.toLocaleString()),variant:"sub"}),r&&l.jsx(pd,{metric:t("stats.thoughts"),values:i(o=>o.tokens.thoughts.toLocaleString()),variant:"sub"})]})}function VWe(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 GWe({status:e}){const{t}=lt(),n=VWe(e.tools.byName);if(n.length===0)return l.jsxs("div",{className:Ut.panel,children:[l.jsx("div",{className:Ut.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:Ut.panel,children:[l.jsx("div",{className:Ut.title,children:t("stats.toolStats")}),l.jsx("div",{className:Ut.spacer}),l.jsxs("div",{className:Ut.tableRow,children:[l.jsx("span",{className:Ut.tableToolCol,children:t("stats.toolName")}),l.jsx("span",{className:Ut.tableNumCol,children:t("stats.calls")}),l.jsx("span",{className:Ut.tableNumCol,children:t("stats.successRate")}),l.jsx("span",{className:Ut.tableNumCol,children:t("stats.avgDuration")})]}),l.jsx("div",{className:Ut.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:Ut.tableRow,children:[l.jsx("span",{className:`${Ut.tableToolCol} ${Ut.metricCell}`,children:qu(o.name,t)}),l.jsx("span",{className:Ut.tableNumCol,children:o.stats.count}),l.jsxs("span",{className:`${Ut.tableNumCol} ${a>=90?Ut.success:a>=70?Ut.warning:Ut.error}`,children:[a.toFixed(1),"%"]}),l.jsx("span",{className:Ut.tableNumCol,children:Pm(c)})]},o.name)}),l.jsx("div",{className:Ut.spacer}),l.jsx("div",{className:Ut.sectionTitle,children:t("stats.decisionSummary")}),l.jsx(b0,{label:t("stats.totalReviewed"),children:r}),l.jsx(Iv,{label:t("stats.accepted"),children:l.jsx("span",{className:Ut.success,children:s.accept})}),l.jsx(Iv,{label:t("stats.rejected"),children:l.jsx("span",{className:Ut.error,children:s.reject})}),l.jsx(Iv,{label:t("stats.modified"),children:l.jsx("span",{className:Ut.warning,children:s.modify})}),l.jsx("div",{className:Ut.divider}),l.jsx(b0,{label:t("stats.agreementRate"),children:l.jsx("span",{className:r>0?i>=90?Ut.success:i>=70?Ut.warning:Ut.error:void 0,children:r>0?`${i.toFixed(1)}%`:"--"})})]})}function KWe({view:e,status:t}){switch(e){case"model":return l.jsx(WWe,{status:t});case"tools":return l.jsx(GWe,{status:t});default:return l.jsx(UWe,{status:t})}}function D5(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 YWe="_panel_13hcg_1",XWe="_title_13hcg_17",QWe="_row_13hcg_23",JWe="_rowGap_13hcg_31",ZWe="_label_13hcg_35",eVe="_value_13hcg_41",tVe="_accent_13hcg_46",C0={panel:YWe,title:XWe,row:QWe,rowGap:JWe,label:ZWe,value:eVe,accent:tVe},{serialize:nVe,parse:sVe}=D5("web-shell:status:v1:");function Au({label:e,children:t,gap:n}){return l.jsxs("div",{className:`${C0.row}${n?` ${C0.rowGap}`:""}`,children:[l.jsx("span",{className:C0.label,children:e}),l.jsx("span",{className:C0.value,children:t})]})}function rVe({info:e}){const{t}=lt();return l.jsxs("div",{className:C0.panel,children:[l.jsx("div",{className:C0.title,children:t("about.title")}),e.cliVersion&&l.jsx(Au,{label:t("about.qwenCode"),children:l.jsx("span",{className:C0.accent,children:e.cliVersion})}),e.runtime&&l.jsx(Au,{label:t("about.runtime"),children:e.runtime}),e.platform&&l.jsx(Au,{label:t("about.platform"),children:e.platform}),e.auth&&l.jsx(Au,{label:t("about.auth"),gap:!0,children:e.auth}),e.baseUrl&&l.jsx(Au,{label:t("about.baseUrl"),children:e.baseUrl}),e.model&&l.jsx(Au,{label:t("about.model"),children:e.model}),e.fastModel&&e.fastModel!==e.model&&l.jsx(Au,{label:t("about.fastModel"),children:e.fastModel}),e.sessionId&&l.jsx(Au,{label:t("about.sessionId"),children:e.sessionId}),l.jsx(Au,{label:t("about.sandbox"),children:e.sandbox||t("about.noSandbox")}),l.jsx(Au,{label:t("about.proxy"),children:e.proxy||t("about.noProxy")}),e.memoryUsage&&l.jsx(Au,{label:t("about.memoryUsage"),children:e.memoryUsage})]})}function iVe(e){return e instanceof HTMLElement?!!e.closest("[data-keyboard-scope]"):!1}function Hle(e,t,n=50){const s=h.useRef(e);h.useEffect(()=>{s.current=e},[e]),h.useEffect(()=>{const r=o=>{o.defaultPrevented||eg(o.target)&&!iVe(o.target)||s.current(o)},i=setTimeout(()=>{window.addEventListener("keydown",r)},n);return()=>{clearTimeout(i),window.removeEventListener("keydown",r)}},t)}function Wi(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 oVe="_panel_1jx2a_1",aVe="_title_1jx2a_13",lVe="_header_1jx2a_18",cVe="_startup_1jx2a_24",uVe="_note_1jx2a_28",dVe="_secondary_1jx2a_29",hVe="_row_1jx2a_39",fVe="_selected_1jx2a_48",mVe="_disabled_1jx2a_52",pVe="_pointer_1jx2a_56",gVe="_nameCell_1jx2a_62",bVe="_truncate_1jx2a_69",yVe="_separator_1jx2a_75",wVe="_sectionTitle_1jx2a_79",vVe="_groupTitle_1jx2a_80",xVe="_success_1jx2a_84",kVe="_warning_1jx2a_88",_Ve="_error_1jx2a_92",SVe="_group_1jx2a_80",CVe="_list_1jx2a_102",TVe="_description_1jx2a_108",EVe="_schema_1jx2a_113",jVe="_shortcuts_1jx2a_131",AVe="_detail_1jx2a_137",NVe="_serverFields_1jx2a_143",MVe="_serverField_1jx2a_143",IVe="_serverFieldLabel_1jx2a_156",RVe="_detailBlock_1jx2a_160",DVe="_parameters_1jx2a_161",PVe="_invalidBlock_1jx2a_162",LVe="_parameterRow_1jx2a_172",OVe="_actionMessage_1jx2a_177",$Ve="_oauthPage_1jx2a_183",BVe="_scrollHint_1jx2a_189",fn={panel:oVe,title:aVe,header:lVe,startup:cVe,note:uVe,secondary:dVe,row:hVe,selected:fVe,disabled:mVe,pointer:pVe,nameCell:gVe,truncate:bVe,separator:yVe,sectionTitle:wVe,groupTitle:vVe,success:xVe,warning:kVe,error:_Ve,group:SVe,list:CVe,description:TVe,schema:EVe,shortcuts:jVe,detail:AVe,serverFields:NVe,serverField:MVe,serverFieldLabel:IVe,detailBlock:RVe,parameters:DVe,invalidBlock:PVe,parameterRow:LVe,actionMessage:OVe,oauthPage:$Ve,scrollHint:BVe},PM="web-shell:mcp-panel-active",Zp=10,{parse:zVe}=D5("web-shell:mcp-status:v1:");function FVe(e){const t=zVe(e);return!t||!t.status?null:t}function n2(e,t){if(e.disabled)return{icon:"✗",text:t("mcp.status.disabled"),className:fn.error};if(e.approvalState==="pending")return{icon:"!",text:t("mcp.status.needsApproval"),className:fn.warning};if(e.approvalState==="rejected")return{icon:"✗",text:t("mcp.status.rejected"),className:fn.warning};switch(e.mcpStatus){case"connected":return{icon:"✓",text:t("mcp.status.connected"),className:fn.success};case"connecting":return{icon:"🔄",text:t("mcp.status.starting"),className:fn.warning};case"disconnected":default:return{icon:"🔴",text:t("mcp.status.disconnectedTitle"),className:fn.error}}}function qle(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 HVe(e){const t=qle(e);return t?JSON.stringify(t,null,2):""}function qVe(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function UVe(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 WVe(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 mE(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 dW(e,t){window.dispatchEvent(new CustomEvent(PM,{detail:{id:e,active:t}}))}function s2(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function VVe(e,t){return e?t("mcp.required"):""}function GVe(e,t){const n=qle(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=HVe(e);return o?l.jsx("pre",{className:fn.schema,children:o}):null}const i=Object.entries(s);return i.length===0?null:l.jsxs("div",{className:fn.parameters,children:[l.jsx("div",{className:fn.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:fn.parameterRow,children:`• ${o}${VVe(r.has(o),t)}: ${u}${d?` - ${d}`:""}`},o)})]})}function KVe({message:e}){var J;const{t}=lt(),n=EI({autoLoad:!1}),[s,r]=h.useState(e.status),[i,o]=h.useState(e.toolsByServer),[a,c]=h.useState(null),[u,d]=h.useState(!1),f=h.useRef(`mcp-${Math.random().toString(36).slice(2)}`),[m,p]=h.useState(!0),[g,b]=h.useState("servers"),[v,y]=h.useState(0),[w,x]=h.useState(0),[k,C]=h.useState(0),T=h.useMemo(()=>s.servers??[],[s.servers]),_=T[v]??null,S=h.useMemo(()=>{var W;return _?((W=i[_.name])==null?void 0:W.tools)??[]:[]},[_,i]),R=S[k]??null,A=h.useMemo(()=>S.length<=Zp||k<Zp-1?0:Math.min(k-Zp+1,S.length-Zp),[k,S.length]),O=h.useMemo(()=>S.slice(A,A+Zp),[S,A]),M=T.filter(W=>!W.disabled&&W.mcpStatus==="connecting").length,D=h.useMemo(()=>{const W=[];for(const P of T){const V=qVe(P,t),ee=W.find(q=>q.label===V);ee?ee.servers.push(P):W.push({label:V,servers:[P]})}return W},[T,t]),$=h.useMemo(()=>T.length===0?20:Math.min(Math.max(...T.map(W=>W.name.length))+2,35),[T]),z=h.useMemo(()=>S.length===0?30:Math.min(Math.max(...S.map(W=>W.name.length))+2,50),[S]),B=h.useMemo(()=>{if(!_)return[];const W=[],P=!!_.approvalState;return!_.disabled&&!P&&S.length>0&&W.push({id:"view-tools",label:t("mcp.action.tools")}),!_.disabled&&!P&&_.mcpStatus==="disconnected"&&W.push({id:"reconnect",label:t("mcp.action.reconnect")}),!_.disabled&&P&&W.push({id:"approve",label:t("mcp.action.approve")}),(!(_.configOrigin==="extension"||_.source==="extension"||!!_.extensionName)||_.disabled)&&W.push({id:_.disabled?"enable":"disable",label:_.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),!_.disabled&&!P&&(W.push({id:"authenticate",label:_.hasOAuthTokens?t("mcp.action.reauth"):t("mcp.action.auth")}),_.hasOAuthTokens&&W.push({id:"clear-auth",label:t("mcp.action.clearAuth")})),W},[_,S.length,t]),j=h.useCallback(async()=>{var P;const W=await n.reload();if(W){r(W);const V=((P=W.servers)==null?void 0:P.find(ee=>ee.name===(_==null?void 0:_.name)))??null;if(V){if(V.approvalState)return;const ee=await n.loadTools(V.name);o(q=>({...q,[V.name]:ee}))}}},[n,_==null?void 0:_.name]),H=h.useCallback(async W=>{if(!(!_||W.disabled||u)){if(W.id==="view-tools"){b("tools"),C(0),c(null);return}d(!0),W.id==="authenticate"&&b("oauth"),c(W.id==="authenticate"?s2(_.name,t):t("mcp.action.running",{action:W.label}));try{let P=null;if(W.id==="reconnect"){const V=await n.restartServer(_.name);if("restarted"in V&&!V.restarted)throw new Error(t("mcp.reconnect.skipped",{reason:V.reason}));if("entries"in V&&(V.entries.length===0||V.entries.every(ee=>!ee.restarted)))throw new Error(t("mcp.reconnect.skipped",{reason:V.entries.map(ee=>ee.reason).filter(Boolean).join(", ")||"not connected"}))}else{const V=await n.manageServer(_.name,W.id),ee=[...V.messages??[],...V.authUrl?[V.authUrl]:[]].join(`
`);ee&&(P=W.id==="authenticate"?s2(_.name,t,ee):ee)}await j(),c(P??t("mcp.action.done",{action:W.label}))}catch(P){c(W.id==="authenticate"?s2(_.name,t,Wi(P)):t("mcp.action.failed",{error:Wi(P)}))}finally{d(!1)}}},[u,n,j,_,t]);if(h.useEffect(()=>{const W=f.current;return dW(W,m),()=>dW(W,!1)},[m]),h.useEffect(()=>{const W=P=>{const V=P.detail;V!=null&&V.active&&V.id&&V.id!==f.current&&p(!1)};return window.addEventListener(PM,W),()=>window.removeEventListener(PM,W)},[]),Hle(W=>{if(m){if(W.key==="Escape"){W.preventDefault(),W.stopPropagation(),g==="servers"?p(!1):g==="server"?(b("servers"),x(0),c(null)):g==="oauth"?(b("server"),c(null)):g==="tools"?(b("server"),C(0)):b("tools");return}if(W.key==="ArrowUp"||W.key==="ArrowDown"){W.preventDefault(),W.stopPropagation();const P=W.key==="ArrowUp"?-1:1;g==="servers"?(y(V=>Math.min(Math.max(V+P,0),T.length-1)),x(0)):g==="server"?x(V=>Math.min(Math.max(V+P,0),B.length-1)):g==="tools"&&C(V=>Math.min(Math.max(V+P,0),S.length-1));return}if(W.key==="Enter")if(W.preventDefault(),W.stopPropagation(),g==="servers"&&T.length>0)b("server"),x(0);else if(g==="server"&&B.length>0){const P=B[w];P&&H(P)}else g==="tools"&&S.length>0&&b("tool")}},[m,w,S.length,B,H,T.length,g]),!m)return null;if(T.length===0)return l.jsxs("div",{className:fn.panel,"data-keyboard-scope":!0,children:[l.jsxs("div",{className:fn.header,children:[l.jsx("div",{className:fn.title,children:t("mcp.manageServers")}),l.jsx("div",{className:fn.secondary,children:t("mcp.servers",{count:0})})]}),l.jsx("div",{className:fn.secondary,children:t("mcp.empty")}),l.jsx("div",{className:fn.shortcuts,children:t("mcp.shortcut.close")})]});const Q=g==="servers"?t("mcp.manageServers"):g==="server"?(_==null?void 0:_.name)??t("mcp.manageServers"):g==="oauth"?t("mcp.oauth.title"):g==="tools"?t("mcp.toolsForServer",{name:(_==null?void 0:_.name)??t("common.server")}):(R==null?void 0:R.name)??t("mcp.toolDetail"),I=g==="servers"?t("mcp.servers",{count:T.length}):g==="server"||g==="oauth"?"":g==="tools"?t(S.length===1?"mcp.toolCount":"mcp.toolsCount",{count:S.length}):(R==null?void 0:R.serverToolName)??(_==null?void 0:_.name)??"";return l.jsxs("div",{className:fn.panel,"data-keyboard-scope":!0,children:[M>0&&l.jsxs("div",{children:[l.jsx("div",{className:fn.startup,children:t("mcp.starting",{count:M})}),l.jsx("div",{className:fn.note,children:t("mcp.startingNote")})]}),l.jsxs("div",{className:fn.header,children:[l.jsx("div",{className:fn.title,children:Q}),I&&l.jsx("div",{className:fn.secondary,children:I})]}),g==="servers"&&l.jsx("div",{className:fn.list,children:D.map(W=>{let P=0;for(const V of D){if(V===W)break;P+=V.servers.length}return l.jsxs("div",{className:fn.group,children:[l.jsx("div",{className:fn.groupTitle,children:W.label}),W.servers.map((V,ee)=>{const q=P+ee,K=q===v,de=n2(V,t);return l.jsxs("div",{className:K?`${fn.row} ${fn.selected}`:fn.row,onClick:()=>{y(q),b("server"),x(0)},onMouseEnter:()=>y(q),children:[l.jsx("span",{className:fn.pointer,children:K?"❯":""}),l.jsx("span",{className:fn.nameCell,style:{width:`${$}ch`},children:V.name}),l.jsx("span",{className:fn.separator,children:"·"}),l.jsxs("span",{className:de.className,children:[de.icon," ",de.text]})]},V.name)})]},W.label)})}),g==="server"&&_&&l.jsxs("div",{className:fn.detail,children:[l.jsxs("div",{className:fn.serverFields,children:[l.jsxs("div",{className:fn.serverField,children:[l.jsxs("span",{className:fn.serverFieldLabel,children:[t("mcp.status"),":"]}),l.jsxs("span",{className:n2(_,t).className,children:[n2(_,t).icon," ",n2(_,t).text]})]}),l.jsxs("div",{className:fn.serverField,children:[l.jsxs("span",{className:fn.serverFieldLabel,children:[t("mcp.source"),":"]}),l.jsx("span",{children:UVe(_,t)})]}),l.jsxs("div",{className:fn.serverField,children:[l.jsxs("span",{className:fn.serverFieldLabel,children:[t("mcp.command"),":"]}),l.jsx("span",{className:fn.truncate,children:WVe(_,t)})]}),((J=_.config)==null?void 0:J.cwd)&&l.jsxs("div",{className:fn.serverField,children:[l.jsxs("span",{className:fn.serverFieldLabel,children:[t("mcp.workingDirectory"),":"]}),l.jsx("span",{className:fn.truncate,children:_.config.cwd})]}),!_.disabled&&l.jsxs("div",{className:fn.serverField,children:[l.jsxs("span",{className:fn.serverFieldLabel,children:[t("mcp.tools"),":"]}),l.jsx("span",{children:t(S.length===1?"mcp.toolCount":"mcp.toolsCount",{count:S.length})})]})]}),l.jsx("div",{className:fn.list,children:B.map((W,P)=>{const V=P===w,ee=[fn.row,V?fn.selected:"",W.disabled?fn.disabled:""].filter(Boolean).join(" ");return l.jsxs("div",{className:ee,onClick:()=>{x(P),H(W)},children:[l.jsx("span",{className:fn.pointer,children:V?"❯":""}),l.jsx("span",{children:W.label})]},W.id)})}),a&&l.jsx("pre",{className:fn.actionMessage,children:a})]}),g==="oauth"&&l.jsx("div",{className:fn.oauthPage,children:l.jsx("pre",{className:fn.actionMessage,children:a??(_?s2(_.name,t):t("mcp.status.unknown"))})}),g==="tools"&&l.jsx("div",{className:fn.list,children:S.length===0?l.jsx("div",{className:fn.secondary,children:t("mcp.emptyTools")}):O.map((W,P)=>{const V=A+P,ee=V===k,q=mE(W,t);return l.jsxs("div",{className:ee?`${fn.row} ${fn.selected}`:fn.row,onClick:()=>{C(V),b("tool")},onMouseEnter:()=>C(V),children:[l.jsx("span",{className:fn.pointer,children:ee?"❯":""}),l.jsx("span",{className:fn.nameCell,style:{width:`${z}ch`},children:W.name}),W.isValid?q?l.jsx("span",{className:fn.secondary,children:q}):null:l.jsx("span",{className:fn.warning,children:t("mcp.invalidReason",{reason:W.invalidReason||t("mcp.status.unknown")})})]},W.name)})}),g==="tools"&&S.length>Zp&&l.jsxs("div",{className:fn.scrollHint,children:[A>0?"↑ ":"  ",t("mcp.scrollPosition",{current:k+1,total:S.length}),A+Zp<S.length?" ↓":""]}),g==="tool"&&R&&l.jsxs("div",{className:fn.detail,children:[!R.isValid&&l.jsxs("div",{className:fn.invalidBlock,children:[l.jsx("div",{className:fn.sectionTitle,children:t("mcp.invalidToolWarning")}),l.jsxs("div",{children:[t("mcp.invalidReasonLabel")," ",R.invalidReason||t("mcp.status.unknown")]}),l.jsx("div",{className:fn.secondary,children:t("mcp.invalidToolHelp")})]}),R.description&&l.jsxs("div",{className:fn.detailBlock,children:[l.jsx("div",{className:fn.sectionTitle,children:t("mcp.description")}),l.jsx("div",{className:fn.description,children:R.description.trim()})]}),mE(R,t)&&l.jsxs("div",{className:fn.detailBlock,children:[l.jsx("span",{className:fn.sectionTitle,children:t("mcp.annotations")})," ",l.jsx("span",{children:mE(R,t)})]}),GVe(R,t)]}),l.jsx("div",{className:fn.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 YVe=3;function k3(e){return e.kind==="agent"&&typeof e.id=="string"}function XVe(e){const t=e.filter(k3),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 f=s.get(d);f?f.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=>k3(u)?i[c++]:u)}function Ule(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 QVe(e){const t=new Map;for(const s of e)k3(s)&&t.set(s.id,s);const n=new Map;for(const s of t.values()){const{chain:r,terminatedBy:i}=Ule(s,o=>t.get(o));n.set(s.id,{visibleDepth:i==="cycle"?0:r.length,orphaned:r.length===0&&i==="missing"})}return n}function JVe(e){const t=new Map;for(const s of e)k3(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}=Ule(s,o=>t.get(o));i==="root"&&r.every(o=>o.isBackgrounded===!1)&&n.add(s.id)}return n}function Rx(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 ZVe=gg("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 Pi({className:e,variant:t="default",asChild:n=!1,...s}){const r=n?MR:"span";return l.jsx(r,{"data-slot":"badge","data-variant":t,className:en(ZVe({variant:t}),e),...s})}const eGe="_panel_q3h5p_1",tGe="_embeddedPanel_q3h5p_12",nGe="_title_q3h5p_19",sGe="_sectionTitle_q3h5p_24",rGe="_overflowHint_q3h5p_28",iGe="_header_q3h5p_33",oGe="_secondary_q3h5p_39",aGe="_row_q3h5p_43",lGe="_selected_q3h5p_51",cGe="_pointer_q3h5p_55",uGe="_nameCell_q3h5p_61",dGe="_treeMarker_q3h5p_70",hGe="_orphanNote_q3h5p_74",fGe="_status_q3h5p_78",mGe="_chevronCell_q3h5p_84",pGe="_chevron_q3h5p_84",gGe="_chevronExpanded_q3h5p_101",bGe="_separator_q3h5p_111",yGe="_list_q3h5p_115",wGe="_task_q3h5p_121",vGe="_taskExpanded_q3h5p_127",xGe="_success_q3h5p_132",kGe="_warning_q3h5p_136",_Ge="_error_q3h5p_140",SGe="_detail_q3h5p_144",CGe="_detailTop_q3h5p_153",TGe="_monitorDetail_q3h5p_160",EGe="_monitorOverview_q3h5p_166",jGe="_monitorHeadingRow_q3h5p_174",AGe="_monitorDescription_q3h5p_182",NGe="_monitorStatusActions_q3h5p_192",MGe="_monitorStatusTag_q3h5p_199",IGe="_monitorStopButton_q3h5p_231",RGe="_monitorActionError_q3h5p_253",DGe="_monitorMetrics_q3h5p_259",PGe="_monitorMetric_q3h5p_259",LGe="_monitorMetricValue_q3h5p_275",OGe="_monitorMetricLabel_q3h5p_284",$Ge="_monitorSectionLabel_q3h5p_285",BGe="_monitorCommandSection_q3h5p_290",zGe="_monitorError_q3h5p_291",FGe="_monitorCommand_q3h5p_290",HGe="_detailTopMain_q3h5p_317",qGe="_inlineDetail_q3h5p_357",UGe="_taskIcon_q3h5p_379",WGe="_detailField_q3h5p_408",VGe="_detailFieldLabel_q3h5p_415",GGe="_detailContent_q3h5p_421",KGe="_compactSummary_q3h5p_428",YGe="_actionBar_q3h5p_437",XGe="_actionHint_q3h5p_446",QGe="_actionButton_q3h5p_451",JGe="_dangerButton_q3h5p_471",ZGe="_shortcuts_q3h5p_475",eKe="_confirmHint_q3h5p_481",tKe="_statusBadge_q3h5p_485",nKe="_activityCurrent_q3h5p_491",sKe="_activityPast_q3h5p_498",rKe="_promptContent_q3h5p_505",At={panel:eGe,embeddedPanel:tGe,title:nGe,sectionTitle:sGe,overflowHint:rGe,header:iGe,secondary:oGe,row:aGe,selected:lGe,pointer:cGe,nameCell:uGe,treeMarker:dGe,orphanNote:hGe,status:fGe,chevronCell:mGe,chevron:pGe,chevronExpanded:gGe,separator:bGe,list:yGe,task:wGe,taskExpanded:vGe,success:xGe,warning:kGe,error:_Ge,detail:SGe,detailTop:CGe,monitorDetail:TGe,monitorOverview:EGe,monitorHeadingRow:jGe,monitorDescription:AGe,monitorStatusActions:NGe,monitorStatusTag:MGe,monitorStopButton:IGe,monitorActionError:RGe,monitorMetrics:DGe,monitorMetric:PGe,monitorMetricValue:LGe,monitorMetricLabel:OGe,monitorSectionLabel:$Ge,monitorCommandSection:BGe,monitorError:zGe,monitorCommand:FGe,detailTopMain:HGe,inlineDetail:qGe,taskIcon:UGe,detailField:WGe,detailFieldLabel:VGe,detailContent:GGe,compactSummary:KGe,actionBar:YGe,actionHint:XGe,actionButton:QGe,dangerButton:JGe,shortcuts:ZGe,confirmHint:eKe,statusBadge:tKe,activityCurrent:nKe,activityPast:sKe,promptContent:rKe},Dx="web-shell:tasks-panel-active",iKe=3e3,hW=8,{parse:oKe}=D5("web-shell:tasks-status:v1:");function aKe(e){const t=oKe(e);return!t||!t.snapshot?null:t}function fW(e,t){window.dispatchEvent(new CustomEvent(Dx,{detail:{id:e,active:t}}))}function mW(e){return e.status==="running"||e.status==="paused"}function lKe(e){return[...e].sort((t,n)=>{const s=mW(t),r=mW(n);return s!==r?s?-1:1:s?n.startTime-t.startTime:(n.endTime??n.startTime)-(t.endTime??t.startTime)})}function pE(e){return XVe(lKe(e))}function pW(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Wle(e){switch(e){case"running":return At.success;case"paused":return At.warning;case"completed":return At.success;case"failed":return At.error;case"cancelled":return At.warning;default:return""}}function Vle(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 cKe(e){switch(e){case"paused":return"⏸";case"completed":return"✓";case"failed":case"cancelled":return"✗";case"running":return null;default:return null}}function uKe({expanded:e}){return l.jsx("svg",{className:`${At.chevron} ${e?At.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 dKe(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 hKe(e,t){if(e.length<=hW)return{visible:e,windowStart:0,hiddenAbove:0,hiddenBelow:0};const n=Math.max(1,hW-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 fKe(e,t,n){const s=qu(e,n),r=t?t.replace(/\s*\n\s*/g," ").trim():"",i=r?`${s}(${r})`:s;return g4(i)}function Gle({message:e,embedded:t=!1,manageActiveEvent:n=!0,onClose:s,onOpenMonitor:r}){const{t:i}=lt(),o=ug(),[a,c]=h.useState(()=>pE(e.snapshot.tasks)),[u,d]=h.useState(!0),[f,m]=h.useState("list"),[p,g]=h.useState(0),[b,v]=h.useState(null),[y,w]=h.useState(!1),[x,k]=h.useState(!1),[C,T]=h.useState(null),_=h.useRef(`tasks-${Math.random().toString(36).slice(2)}`),S=h.useRef(!1),R=h.useRef(null),A=a.length===0?0:Math.min(p,a.length-1),O=a[A]??null,M=h.useMemo(()=>QVe(a),[a]),D=h.useMemo(()=>JVe(a),[a]);h.useEffect(()=>{if(!u)return;const ee=setInterval(()=>{S.current||(S.current=!0,o.getTasks().then(q=>{c(pE(q.tasks)),k(!1)}).catch(q=>{console.warn("[web-shell] failed to refresh tasks:",q),k(!0)}).finally(()=>{S.current=!1}))},iKe);return()=>clearInterval(ee)},[u,o]),h.useEffect(()=>{a.length===0&&p!==0&&g(0),p>=a.length&&a.length>0&&g(a.length-1)},[a.length,p]),h.useEffect(()=>{if(!u||f!=="detail"){R.current=null;return}if(!O){R.current=null,m("list");return}const V=R.current;if(!V||V.taskId!==O.id){R.current={taskId:O.id,status:O.status};return}V.status==="running"&&O.status!=="running"&&(v(null),m("list"))},[u,f,O]),h.useEffect(()=>{if(!n)return;const V=_.current;return fW(V,u),()=>fW(V,!1)},[u,n]),h.useEffect(()=>{if(!n)return;const V=ee=>{const q=ee.detail;q!=null&&q.active&&q.id&&q.id!==_.current&&d(!1)};return window.addEventListener(Dx,V),()=>window.removeEventListener(Dx,V)},[n]),h.useEffect(()=>{u||s==null||s()},[u,s]);const $=h.useCallback(async V=>{if(y)return;const ee=V.status==="running",q=V.kind==="agent"&&V.status==="paused";if(!ee&&!q)return;if(V.kind==="agent"&&D.has(V.id)&&b!==V.id){v(V.id);return}v(null),w(!0);try{if(!(await o.cancelTask(V.id,V.kind)).cancelled){T(i("tasks.alreadyStopped"));return}const re=await o.getTasks();c(pE(re.tasks)),T(null)}catch(de){console.warn("[web-shell] failed to cancel task:",de),T(i("tasks.cancelFailed"))}finally{w(!1)}},[o,y,D,b,i]);if(Hle(V=>{if(u){if(V.key==="Escape"){if(V.preventDefault(),V.stopPropagation(),b){v(null);return}f==="detail"?m("list"):d(!1);return}if(V.key==="ArrowLeft"){V.preventDefault(),V.stopPropagation(),f==="detail"?(v(null),m("list")):d(!1);return}if((V.key==="ArrowUp"||V.key==="ArrowDown")&&f==="list"){if(V.preventDefault(),V.stopPropagation(),a.length===0)return;const ee=V.key==="ArrowUp"?-1:1;g(q=>Math.min(Math.max(q+ee,0),a.length-1)),v(null);return}if(V.key==="Enter"){V.preventDefault(),V.stopPropagation(),f==="list"&&O?t&&O.kind==="monitor"&&r?r(O):m("detail"):f==="detail"&&d(!1);return}if(V.key===" "&&f==="detail"){V.preventDefault(),V.stopPropagation(),d(!1);return}if(V.key==="x"&&!V.ctrlKey&&!V.metaKey){V.preventDefault(),V.stopPropagation(),O&&$(O);return}}},[t,u,f,a.length,O,$,r,b]),!u)return null;const z=b!==null&&O!==null&&b===O.id,B=[];z?(B.push(i("tasks.confirmStop")),B.push(i("tasks.shortcut.cancelConfirm"))):(B.push(i("tasks.shortcut.select")),B.push(i("tasks.shortcut.view")),(O==null?void 0:O.status)==="running"?B.push(i("tasks.shortcut.stop")):(O==null?void 0:O.kind)==="agent"&&(O==null?void 0:O.status)==="paused"&&B.push(i("tasks.shortcut.abandon")),B.push(i("tasks.shortcut.listClose")));const j=[];if(z?(j.push(i("tasks.confirmStop")),j.push(i("tasks.shortcut.cancelConfirm"))):(j.push(i("tasks.shortcut.detailBack")),j.push(i("tasks.shortcut.detailClose")),(O==null?void 0:O.status)==="running"?j.push(i("tasks.shortcut.stop")):(O==null?void 0:O.kind)==="agent"&&(O==null?void 0:O.status)==="paused"&&j.push(i("tasks.shortcut.abandon"))),a.length===0)return l.jsxs("div",{className:t?`${At.panel} ${At.embeddedPanel}`:At.panel,"data-keyboard-scope":!0,children:[(x||C||!t)&&l.jsxs("div",{className:At.header,children:[!t&&l.jsx("div",{className:At.title,children:i("tasks.title")}),x&&l.jsx("div",{className:At.warning,children:i("tasks.refreshStale")}),C&&l.jsx("div",{className:At.error,children:C})]}),l.jsx("div",{children:l.jsx("div",{className:At.secondary,children:i("tasks.empty")})}),!t&&l.jsx("div",{className:At.shortcuts,children:i("tasks.shortcut.close")})]});const{visible:H,windowStart:Q,hiddenAbove:I,hiddenBelow:J}=hKe(a,A),W=t?a:H,P=t?0:Q;return l.jsxs("div",{className:t?`${At.panel} ${At.embeddedPanel}`:At.panel,"data-keyboard-scope":!0,children:[(t||f==="list")&&(x||C||!t)&&l.jsxs("div",{className:At.header,children:[!t&&l.jsx("div",{className:At.title,children:i("tasks.title")}),x&&l.jsx("div",{className:At.warning,children:i("tasks.refreshStale")}),C&&l.jsx("div",{className:At.error,children:C})]}),(t||f==="list")&&l.jsxs("div",{className:At.list,children:[!t&&l.jsxs("div",{className:At.sectionTitle,children:[i("tasks.title")," ",l.jsxs("span",{className:At.secondary,children:["(",a.length,")"]})]}),!t&&I>0&&l.jsx("div",{className:At.overflowHint,children:i("tasks.moreAbove",{count:I})}),W.map((V,ee)=>{const q=P+ee,K=q===A,de=Wle(V.status),re=Vle(V.status,i),ne=t&&K&&f==="detail",U=t?ne:K,Z=V.kind==="agent"?M.get(V.id):void 0,ge=Math.min((Z==null?void 0:Z.visibleDepth)??0,YVe),ce=V.kind==="agent"&&V.parentAgentId!=null,ue=Z!=null&&Z.orphaned?V.kind==="agent"&&V.parentName?i("tasks.row.from",{parent:V.parentName}):i("tasks.row.nested"):null;return l.jsxs("div",{className:`${At.task} ${ne?At.taskExpanded:""}`,children:[l.jsxs("div",{className:U?`${At.row} ${At.selected}`:At.row,onClick:()=>{g(q),t&&V.kind==="monitor"&&r?r(V):m(t&&ne?"list":"detail")},onMouseEnter:()=>{t||g(q)},children:[l.jsx("span",{className:At.pointer,children:U?"❯":""}),t&&l.jsx("span",{className:At.taskIcon,"aria-hidden":"true"}),l.jsxs("span",{className:At.nameCell,style:ge>0?{paddingLeft:`${ge*16}px`}:void 0,children:[ce&&l.jsx("span",{className:At.treeMarker,"aria-hidden":"true",children:"↳ "}),dKe(V,D.has(V.id)),ue&&l.jsxs("span",{className:At.orphanNote,children:[" · ",ue]})]}),l.jsx("span",{className:`${At.status} ${de}`,children:re}),l.jsx("span",{className:At.chevronCell,children:l.jsx(uKe,{expanded:ne})})]}),ne&&l.jsx("div",{className:At.inlineDetail,children:l.jsx(gW,{task:V,t:i,hideHeader:!0,busy:y,showCancelConfirm:b===V.id,onCancel:()=>void $(V),onCancelConfirmDismiss:()=>v(null)})})]},V.id)}),!t&&J>0&&l.jsx("div",{className:At.overflowHint,children:i("tasks.moreBelow",{count:J})})]}),!t&&f==="detail"&&O&&l.jsxs(l.Fragment,{children:[C&&l.jsx("div",{className:At.error,children:C}),l.jsx(gW,{task:O,t:i,busy:y,showCancelConfirm:b===O.id,onCancel:()=>void $(O),onCancelConfirmDismiss:()=>v(null)})]}),!t&&l.jsx("div",{className:z?`${At.shortcuts} ${At.confirmHint}`:At.shortcuts,children:(f==="list"?B:j).join(" · ")})]})}function mKe(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 pKe({task:e}){const{t}=lt(),n=ug(),[s,r]=h.useState(e),[i,o]=h.useState(!1),[a,c]=h.useState(null);h.useEffect(()=>{r(d=>d.id===e.id&&d.status!=="running"&&e.status==="running"?d:e)},[e]),h.useEffect(()=>{c(null)},[e.id,e.status]);const u=h.useCallback(async()=>{if(!(i||s.status!=="running")){c(null),o(!0);try{if(!(await n.cancelTask(s.id,"monitor")).cancelled){c(t("tasks.alreadyStopped"));return}r({...s,status:"cancelled",endTime:Date.now()}),c(null);try{const m=(await n.getTasks()).tasks.find(p=>p.kind==="monitor"&&p.id===s.id);m&&m.status!=="running"&&r(m)}catch(f){console.warn("[web-shell] failed to refresh stopped monitor:",f)}}catch(d){console.warn("[web-shell] failed to cancel monitor:",d),c(t("tasks.cancelFailed"))}finally{o(!1)}}},[n,i,s,t]);return l.jsxs("div",{className:At.monitorDetail,children:[l.jsxs("div",{className:At.monitorOverview,children:[l.jsxs("div",{className:At.monitorHeadingRow,children:[l.jsx("div",{className:At.monitorDescription,children:s.description}),l.jsxs("div",{className:At.monitorStatusActions,children:[l.jsx(Pi,{variant:"outline",className:At.monitorStatusTag,"data-status":s.status,children:Vle(s.status,t)}),s.status==="running"&&l.jsx("button",{type:"button",className:At.monitorStopButton,disabled:i,onClick:()=>void u(),children:t(i?"common.loading":"tasks.action.stop")})]})]}),a&&l.jsx("div",{className:At.monitorActionError,children:a}),l.jsxs("div",{className:At.monitorMetrics,children:[l.jsx(t1,{label:t("tasks.detail.runtime"),value:Rx(s.runtimeMs)}),l.jsx(t1,{label:t("tasks.detail.eventCount"),value:String(s.eventCount)}),s.pid!==void 0&&l.jsx(t1,{label:t("tasks.detail.pid"),value:String(s.pid)}),s.eventCount>0&&l.jsx(t1,{label:t("tasks.detail.lastEvent"),value:new Date(s.lastEventTime).toLocaleTimeString()}),s.droppedLines>0&&l.jsx(t1,{label:t("tasks.detail.droppedCount"),value:String(s.droppedLines)}),s.exitCode!==void 0&&l.jsx(t1,{label:t("tasks.detail.exitCode"),value:String(s.exitCode)})]})]}),l.jsxs("div",{className:At.monitorCommandSection,children:[l.jsx("div",{className:At.monitorSectionLabel,children:t("tasks.detail.command")}),l.jsx("pre",{className:At.monitorCommand,children:s.command})]}),s.error&&l.jsxs("div",{className:At.monitorError,children:[l.jsx("div",{className:At.monitorSectionLabel,children:t("tasks.detail.error")}),l.jsx("div",{children:s.error})]})]})}function t1({label:e,value:t}){return l.jsxs("div",{className:At.monitorMetric,children:[l.jsx("div",{className:At.monitorMetricValue,children:t}),l.jsx("div",{className:At.monitorMetricLabel,children:e})]})}function gW({task:e,t,hideHeader:n=!1,busy:s=!1,showCancelConfirm:r=!1,onCancel:i,onCancelConfirmDismiss:o}){var x,k,C;const a=cKe(e.status),c=Wle(e.status),u=e.kind==="agent"&&e.status==="paused",d=e.status==="running"||u,f=t(u?"tasks.action.abandon":"tasks.action.stop"),m=t(u?"tasks.action.confirmAbandon":"tasks.action.confirmStop"),p=[Rx(e.runtimeMs)],g=[{label:t("tasks.detail.runtime"),value:Rx(e.runtimeMs)}],b=e.kind==="agent"?((x=e.stats)==null?void 0:x.outputTokens)??((k=e.stats)==null?void 0:k.totalTokens):void 0;b&&(p.push(t("tasks.detail.tokens",{count:pW(b)})),g.push({label:t("tasks.detail.tokenCount"),value:pW(b)})),e.kind==="agent"&&((C=e.stats)==null?void 0:C.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(`
`):[],y=d&&i?l.jsx("div",{className:At.actionBar,children:r?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:At.actionHint,children:t("tasks.action.confirmHint")}),l.jsx("button",{type:"button",className:`${At.actionButton} ${At.dangerButton}`,disabled:s,onClick:i,children:m}),l.jsx("button",{type:"button",className:At.actionButton,onClick:o,children:t("common.cancel")})]}):l.jsx("button",{type:"button",className:`${At.actionButton} ${At.dangerButton}`,disabled:s,onClick:i,children:f})}):null,w=n?g.length>0?l.jsx("div",{className:At.compactSummary,children:g.map(T=>`${T.label} ${T.value}`).join(" · ")}):null:l.jsxs(l.Fragment,{children:[l.jsx("div",{className:At.title,children:mKe(e,t)}),l.jsxs("div",{className:At.statusBadge,children:[a&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:c,children:[a," ",t(`tasks.${e.status}`)]}),l.jsx("span",{className:At.separator,children:"·"})]}),l.jsx("span",{className:At.secondary,children:p.join(" · ")})]})]});return l.jsxs("div",{className:At.detail,children:[(w||y)&&l.jsxs("div",{className:At.detailTop,children:[w&&l.jsx("div",{className:At.detailTopMain,children:w}),y]}),e.kind==="shell"&&l.jsxs(l.Fragment,{children:[l.jsx(n1,{label:t("tasks.detail.workingDir"),value:e.cwd}),e.outputFile&&l.jsx(n1,{label:t("tasks.detail.outputFile"),value:e.outputFile})]}),e.kind==="monitor"&&l.jsx(n1,{label:t("tasks.detail.command"),value:e.command}),e.kind==="agent"&&e.subagentType&&l.jsx(n1,{label:t("tasks.detail.type"),value:e.subagentType}),e.kind==="agent"&&(e.depth??0)>0&&l.jsx(n1,{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:At.detailField,children:[l.jsx("div",{className:At.detailFieldLabel,children:t("tasks.detail.progress")}),l.jsx("div",{className:At.detailContent,children:e.recentActivities.slice(-5).map((T,_,S)=>{const R=_===S.length-1,A=fKe(T.name,T.description,t);return l.jsxs("div",{className:R?At.activityCurrent:At.activityPast,children:[R?"> ":"  ",A]},`${T.at}-${_}`)})})]}),e.kind==="agent"&&e.prompt&&l.jsxs("div",{className:At.detailField,children:[l.jsx("div",{className:At.detailFieldLabel,children:t("tasks.detail.prompt")}),l.jsx("div",{className:At.promptContent,children:v.slice(0,5).map((T,_,S)=>l.jsx("div",{children:_===S.length-1&&v.length>5?`${T}…`:T||" "},_))})]}),e.kind==="agent"&&e.outputFile&&l.jsx(n1,{label:t("tasks.detail.outputFile"),value:e.outputFile}),e.kind==="agent"&&e.status==="paused"&&e.resumeBlockedReason&&l.jsxs("div",{className:At.detailField,children:[l.jsx("div",{className:`${At.detailFieldLabel} ${At.error}`,children:t("tasks.detail.resumeBlocked")}),l.jsx("div",{className:At.error,children:e.resumeBlockedReason})]}),e.error&&l.jsxs("div",{className:At.detailField,children:[l.jsx("div",{className:`${At.detailFieldLabel} ${e.kind==="monitor"&&e.status!=="failed"?At.warning:At.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"?At.warning:At.error,children:e.error})]})]})}function n1({label:e,value:t}){return l.jsxs("div",{className:At.detailField,children:[l.jsx("div",{className:At.detailFieldLabel,children:e}),l.jsx("div",{className:At.detailContent,children:t})]})}const gKe="_message_fm8gc_1",bKe="_body_fm8gc_15",yKe="_title_fm8gc_20",wKe="_muted_fm8gc_24",vKe="_accent_fm8gc_28",xKe="_success_fm8gc_32",kKe="_error_fm8gc_36",_Ke="_warning_fm8gc_40",SKe="_row_fm8gc_44",CKe="_label_fm8gc_50",TKe="_value_fm8gc_55",Hl={message:gKe,body:bKe,title:yKe,muted:wKe,accent:vKe,success:xKe,error:kKe,warning:_Ke,row:SKe,label:CKe,value:TKe},LM="web-shell-goal-status-active",{serialize:bW,parse:EKe}=D5(e1e),jKe=new Set(["set","achieved","cleared","failed","aborted","checking"]);function _3(e){const t=typeof e=="string"?EKe(e):e;return AKe(t)}function AKe(e){if(!e||typeof e!="object")return null;const t=e,n=t.kind,s=t.condition;if(typeof n!="string"||!jKe.has(n)||typeof s!="string")return null;const r=gE(t.iterations),i=gE(t.durationMs),o=gE(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 gE(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function NKe(e,t){return t(e===1?"goal.turn":"goal.turns",{count:e})}function MKe(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:Hl.muted};case"set":return{title:t("goal.set"),colorClass:Hl.accent};case"achieved":return{title:t("goal.achieved"),colorClass:Hl.success};case"cleared":return{title:t("goal.cleared"),colorClass:Hl.muted};case"failed":return{title:t("goal.failed"),colorClass:Hl.error};case"aborted":return{title:t("goal.aborted"),colorClass:Hl.warning}}}function IKe({status:e,activateFooter:t=!1}){var u;const{t:n}=lt(),s=BI();h.useEffect(()=>{if(!t||s==="readonly")return;const d=e.kind==="set"||e.kind==="checking";window.dispatchEvent(new CustomEvent(LM,{detail:{active:d,condition:e.condition,setAt:e.setAt}}))},[t,s,e.condition,e.kind,e.setAt]);const r=MKe(e,n),i=[];e.kind!=="checking"&&(e.iterations&&e.iterations>0&&i.push(NKe(e.iterations,n)),typeof e.durationMs=="number"&&i.push(Rx(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:Hl.message,children:l.jsxs("div",{className:Hl.body,children:[l.jsxs("div",{className:`${Hl.title} ${r.colorClass}`,children:[r.title,o&&l.jsx("span",{className:Hl.muted,children:o})]}),l.jsxs("div",{className:Hl.row,children:[l.jsxs("span",{className:Hl.label,children:[n("goal.label"),":"]}),l.jsx("span",{className:Hl.value,children:e.condition})]}),a&&l.jsxs("div",{className:Hl.muted,children:[c,": ",a]})]})})}const RKe="_message_14xa5_1",DKe="_flushMessage_14xa5_12",PKe="_noMarker_14xa5_26",LKe="_content_14xa5_30",OKe="_notificationContent_14xa5_34",$Ke="_notificationIcon_14xa5_40",BKe="_notificationText_14xa5_61",zKe="_info_14xa5_80",FKe="_recap_14xa5_85",HKe="_modelSwitch_14xa5_98",qKe="_error_14xa5_102",UKe="_warning_14xa5_108",WKe="_retryHint_14xa5_114",VKe="_retryButton_14xa5_121",GKe="_cancelled_14xa5_139",ta={message:RKe,flushMessage:DKe,noMarker:PKe,content:LKe,notificationContent:OKe,notificationIcon:$Ke,notificationText:BKe,info:zKe,recap:FKe,modelSwitch:HKe,error:qKe,warning:UKe,retryHint:WKe,retryButton:VKe,cancelled:GKe},KKe=h.memo(function({content:t,variant:n,source:s,data:r,onShowContextDetail:i,isLatest:o=!1,showRetryHint:a=!1,onRetryClick:c}){const{t:u}=lt();if(s==="prompt_cancelled")return l.jsx("div",{className:ta.cancelled,role:"status",children:l.jsx("span",{children:u("turn.stopped")})});const d=n==="info"?JUe(t):null;if(d)return l.jsx("div",{className:ta.flushMessage,children:l.jsx(iWe,{status:d,onShowDetail:i})});const f=n==="info"?zWe(t):null;if(f)return l.jsx("div",{className:ta.flushMessage,children:l.jsx(KWe,{view:f.view,status:f.status})});const m=n==="info"?sVe(t):null;if(m)return l.jsx("div",{className:ta.flushMessage,children:l.jsx(rVe,{info:m})});const p=n==="info"?FVe(t):null;if(p)return l.jsx("div",{className:ta.flushMessage,children:l.jsx(KVe,{message:p})});const g=n==="info"?aKe(t):null;if(g)return l.jsx("div",{className:ta.flushMessage,children:l.jsx(Gle,{message:g})});const b=n==="info"?_3(s==="goal"?r:t):null;if(b)return l.jsx("div",{className:ta.flushMessage,children:l.jsx(IKe,{status:b,activateFooter:o})});const v=n==="info"&&s==="model_switch_summary",y=n==="info"&&s==="recap",w=n==="info"&&s==="background_notification",x=w&&typeof r=="object"&&r!==null&&"status"in r&&typeof r.status=="string"?r.status:void 0,k=u(x==="completed"?"system.taskCompleted":x==="failed"?"system.taskFailed":x==="cancelled"?"system.taskCancelled":"system.taskNotification"),C=x==="completed"?"success":x==="failed"?"error":"neutral",T=x==="completed"?AI:x==="failed"?nye:x==="cancelled"?eye:cC,_=v?l.jsx("pre",{children:t}):n==="info"?l.jsx(pf,{content:t}):l.jsx("pre",{children:t});return l.jsx("div",{className:`${ta.message} ${ta[n]} ${v?ta.modelSwitch:""} ${y?ta.recap:""} ${w?ta.noMarker:""}`,children:l.jsxs("div",{className:ta.content,children:[w?l.jsxs("div",{className:ta.notificationContent,children:[l.jsx("span",{className:ta.notificationIcon,"data-tone":C,role:"img","aria-label":k,title:k,children:l.jsx(T,{"aria-hidden":"true"})}),l.jsx("div",{className:ta.notificationText,children:_})]}):_,a&&c&&l.jsx("div",{className:ta.retryHint,children:l.jsx("button",{type:"button",className:ta.retryButton,onClick:c,children:u("retry.hint")})})]})})}),YKe="_group_117nk_1",XKe="_chatSummaryGroup_117nk_14",QKe="_line_117nk_22",JKe="_chatSummary_117nk_14",ZKe="_chatSummaryTextActive_117nk_49",eYe="_chatSummaryIcon_117nk_55",tYe="_chatSummaryToolIcon_117nk_69",nYe="_chatSummaryText_117nk_49",sYe="_chatSummaryInline_117nk_85",rYe="_chatChevronRight_117nk_122",iYe="_chatChevronDown_117nk_123",oYe="_chatSummaryContentClip_117nk_184",aYe="_chatSummaryContentCollapsed_117nk_192",lYe="_chatSummaryContentInner_117nk_196",cYe="_lineMain_117nk_201",uYe="_icon_117nk_211",dYe="_iconError_117nk_216",hYe="_lineName_117nk_221",fYe="_lineArg_117nk_225",mYe="_lineElapsed_117nk_233",pYe="_lineExpandable_117nk_239",gYe="_lineButton_117nk_246",bYe="_lineChevronRight_117nk_267",yYe="_lineChevronDown_117nk_268",wYe="_lineOutput_117nk_305",vYe="_expandedCard_117nk_314",xYe="_expandedCardHeader_117nk_324",kYe="_expandedCardTitle_117nk_333",_Ye="_expandedCardDetail_117nk_340",SYe="_expandedCardBody_117nk_350",CYe="_expandedAgentCard_117nk_355",TYe="_expandedLineOutput_117nk_365",EYe="_lineDetail_117nk_369",jYe="_markdownLineDetail_117nk_375",AYe="_expandedBash_117nk_383",NYe="_expandedRead_117nk_384",MYe="_expandedOutput_117nk_388",IYe="_expandedEdit_117nk_402",RYe="_todoProgress_117nk_416",DYe="_todoBody_117nk_423",PYe="_compactGroup_117nk_431",LYe="_compactHeader_117nk_438",OYe="_compactCount_117nk_448",$Ye="_compactHint_117nk_454",Zt={group:YKe,chatSummaryGroup:XKe,line:QKe,chatSummary:JKe,chatSummaryTextActive:ZKe,chatSummaryIcon:eYe,chatSummaryToolIcon:tYe,chatSummaryText:nYe,chatSummaryInline:sYe,chatChevronRight:rYe,chatChevronDown:iYe,chatSummaryContentClip:oYe,chatSummaryContentCollapsed:aYe,chatSummaryContentInner:lYe,lineMain:cYe,icon:uYe,iconError:dYe,lineName:hYe,lineArg:fYe,lineElapsed:mYe,lineExpandable:pYe,lineButton:gYe,lineChevronRight:bYe,lineChevronDown:yYe,lineOutput:wYe,expandedCard:vYe,expandedCardHeader:xYe,expandedCardTitle:kYe,expandedCardDetail:_Ye,expandedCardBody:SYe,expandedAgentCard:CYe,expandedLineOutput:TYe,lineDetail:EYe,markdownLineDetail:jYe,expandedBash:AYe,expandedRead:NYe,expandedOutput:MYe,expandedEdit:IYe,todoProgress:RYe,todoBody:DYe,compactGroup:PYe,compactHeader:LYe,compactCount:OYe,compactHint:$Ye};function sf({status:e}){const{t}=lt();switch(e){case"completed":case"success":return null;case"failed":case"error":case"cancelled":case"canceled":return l.jsx("span",{className:`${Zt.icon} ${Zt.iconError}`,children:t("tool.status.failed")});case"in_progress":case"running":return null;default:return null}}function Dk(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 Kle(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 Yle(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 BYe="_panel_rcjxd_1",zYe="_header_rcjxd_11",FYe="_desc_rcjxd_23",HYe="_toggle_rcjxd_32",qYe="_meta_rcjxd_38",UYe="_body_rcjxd_44",WYe="_content_rcjxd_55",VYe="_stream_rcjxd_70",GYe="_streamCollapsed_rcjxd_80",KYe="_scrollWindow_rcjxd_88",YYe="_expandToggle_rcjxd_93",XYe="_sectionCap_rcjxd_110",QYe="_tools_rcjxd_128",JYe="_step_rcjxd_142",ZYe="_toolTimeRow_rcjxd_188",eXe="_toolTimeTip_rcjxd_192",Ui={panel:BYe,header:zYe,desc:FYe,toggle:HYe,meta:qYe,body:UYe,content:WYe,stream:VYe,streamCollapsed:GYe,scrollWindow:KYe,expandToggle:YYe,sectionCap:XYe,tools:QYe,step:JYe,toolTimeRow:ZYe,toolTimeTip:eXe};function Xle(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function tXe({timestamp:e,children:t}){return e===void 0?l.jsx(l.Fragment,{children:t}):l.jsxs("div",{className:Ui.toolTimeRow,children:[t,l.jsx("span",{className:Ui.toolTimeTip,"aria-hidden":"true",children:Cb(e)})]})}const nXe=h.memo(function({tool:t}){const n=t.subTools||t.subContent?l.jsx(mP,{tool:t}):l.jsx(FM,{tool:t,forceExpandable:!0,hideCollapsedOutput:!0});return l.jsx(tXe,{timestamp:t.startTime,children:n})});function sXe({tc:e}){const{t}=lt();return l.jsx("div",{className:Zt.line,children:l.jsxs("div",{className:Zt.lineMain,children:[l.jsx(sf,{status:e.status}),l.jsx("span",{className:Zt.lineName,children:qu(e.name,t)})]})})}function rXe(e){var t;if(e.rawOutput&&Xle(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 iXe({text:e}){const{compactThinking:t}=ku(),{t:n}=lt(),[s,r]=h.useState(!1),[i,o]=h.useState(!1),a=h.useRef(null),c=t&&!s;return h.useEffect(()=>{const u=a.current;!u||!c||(o(u.scrollHeight>u.clientHeight),u.scrollTop=u.scrollHeight)},[c,e]),h.useEffect(()=>{const u=a.current;if(!u||!c)return;const d=()=>o(u.scrollHeight>u.clientHeight),f=new ResizeObserver(d);return f.observe(u),()=>f.disconnect()},[c]),l.jsxs("div",{children:[l.jsx("pre",{ref:a,className:c?`${Ui.stream} ${Ui.streamCollapsed}`:Ui.stream,children:e}),t&&(i||s)&&l.jsx("button",{className:Ui.expandToggle,onClick:()=>r(u=>!u),"aria-expanded":s,"aria-label":n("subagent.toggleStream"),children:s?"▲":"▼"})]})}function oXe({content:e}){const{compactThinking:t}=ku();return l.jsx("div",{className:t?Ui.scrollWindow:void 0,children:l.jsx(pf,{content:e,source:"assistant"})})}function yW({pinTail:e,itemCount:t,children:n}){const s=h.useRef(null);return h.useEffect(()=>{const r=s.current;r&&(r.scrollTop=e?r.scrollHeight:0)},[e,t]),l.jsx("div",{ref:s,className:`${Ui.tools} ${Ui.scrollWindow}`,children:n})}function mP({tool:e,defaultExpanded:t,hideHeader:n,inline:s}){var C,T,_,S;const{t:r}=lt(),i=e.status==="completed"||e.status==="failed",o=Ix(e),[a,c]=h.useState(t??!1),u=Xle(e.rawOutput)?e.rawOutput:null,d=((C=e.subTools)==null?void 0:C.length)||((T=u==null?void 0:u.toolCalls)==null?void 0:T.length)||0,f=R5(e),m=fP(e),p=Dk(e.startTime,e.endTime)||Kle((_=u==null?void 0:u.executionSummary)==null?void 0:_.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?hP(g):"",v=i?rXe(e):"",y=h.useMemo(()=>e.subTools&&e.subTools.length>0?null:(u==null?void 0:u.toolCalls)||null,[e.subTools,u]),w=!!(e.subContent||v),x=!!(e.subTools&&e.subTools.length>0||y&&y.length>0),k=i&&w&&x;return l.jsxs("div",{className:s?void 0:Ui.panel,children:[!n&&l.jsxs("div",{className:Ui.header,onClick:()=>c(!a),children:[l.jsx(sf,{status:o}),l.jsxs("span",{className:Zt.lineName,children:[m,":"]}),f&&l.jsx("span",{className:Ui.desc,children:Do(f,50)}),i&&d>0&&l.jsxs("span",{className:Ui.meta,children:["· ",r("subagent.toolsCount",{count:d})]}),p&&l.jsxs("span",{className:Ui.meta,children:["· ",p]}),b&&l.jsxs("span",{className:Ui.meta,children:["· ",b]}),!i&&l.jsx("span",{className:Ui.toggle,children:a?"▼":"▶"})]}),(a||n)&&l.jsxs("div",{className:Ui.body,children:[i&&w&&l.jsxs("div",{className:Ui.content,children:[k&&l.jsx("div",{className:Ui.sectionCap,children:r("subagent.result")}),l.jsx(oXe,{content:e.subContent||v})]}),k&&l.jsx("div",{className:Ui.sectionCap,children:r("subagent.tools",{count:d})}),e.subTools&&e.subTools.length>0&&l.jsx(yW,{pinTail:!i,itemCount:e.subTools.length,children:e.subTools.map(R=>l.jsx("div",{className:Ui.step,"data-status":R.status,children:l.jsx(nXe,{tool:R})},R.callId))}),y&&y.length>0&&l.jsx(yW,{pinTail:!i,itemCount:y.length,children:y.map(R=>l.jsx("div",{className:Ui.step,"data-status":R.status,children:l.jsx(sXe,{tc:R})},R.callId))}),!i&&e.subContent&&l.jsx("div",{className:Ui.content,children:l.jsx(iXe,{text:e.subContent})})]})]})}const aXe="_view_1ycry_1",lXe="_stats_1ycry_7",cXe="_statAdd_1ycry_16",uXe="_statDel_1ycry_20",dXe="_lines_1ycry_24",hXe="_line_1ycry_24",fXe="_lineAdd_1ycry_36",mXe="_lineDel_1ycry_40",pXe="_lineHeader_1ycry_44",gXe="_lineContext_1ycry_50",bXe="_lineNo_1ycry_54",yXe="_marker_1ycry_64",wXe="_content_1ycry_79",gd={view:aXe,stats:lXe,statAdd:cXe,statDel:uXe,lines:dXe,line:hXe,lineAdd:fXe,lineDel:mXe,lineHeader:pXe,lineContext:gXe,lineNo:bXe,marker:yXe,content:wXe};function vXe(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 xXe=h.memo(function({diff:t}){if(!t)return null;const{lines:n,additions:s,deletions:r}=vXe(t);return l.jsxs("div",{className:gd.view,children:[l.jsxs("div",{className:gd.stats,children:[s>0&&l.jsxs("span",{className:gd.statAdd,children:["+",s]}),r>0&&l.jsxs("span",{className:gd.statDel,children:["-",r]})]}),l.jsx("div",{className:gd.lines,children:n.map((i,o)=>l.jsxs("div",{className:`${gd.line} ${gd[`line${i.type[0].toUpperCase()}${i.type.slice(1)}`]}`,children:[l.jsx("span",{className:gd.lineNo,children:i.type==="header"?"":i.oldLine??i.newLine}),l.jsx("span",{className:gd.marker,children:i.type==="add"?"+":i.type==="del"?"-":i.type==="header"?"":" "}),l.jsx("span",{className:gd.content,children:i.content})]},o))})]})}),S3={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"},bE=[0,95,135,175,215,255];function OM(e,t,n){let s="#";for(const r of[e,t,n]){if(r===void 0||!Number.isInteger(r)||r<0||r>255)return;s+=r.toString(16).padStart(2,"0")}return s}function kXe(e){if(e===void 0||!Number.isInteger(e)||e<0||e>255)return;if(e<8)return S3[30+e];if(e<16)return S3[90+(e-8)];if(e<232){const n=e-16;return OM(bE[Math.floor(n/36)],bE[Math.floor(n/6)%6],bE[n%6])}const t=8+(e-232)*10;return OM(t,t,t)}function _Xe(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(let u=0;u<c.length;u++){const d=c[u];if(d===38||d===48||d===58){const f=c[u+1];let m;if(f===5)m=kXe(c[u+2]),u+=2;else if(f===2)m=OM(c[u+2],c[u+3],c[u+4]),u+=4;else break;d===38&&m!==void 0&&(n=m)}else d===0?(n=void 0,s=!1,r=!1):d===1?s=!0:d===2?r=!0:d===22?(s=!1,r=!1):d>=30&&d<=37||d>=90&&d<=97?n=S3[d]:d===39&&(n=void 0)}}return i<e.length&&t.push({text:e.slice(i),color:n,bold:s,dim:r}),t}function SXe(e){return new RegExp(String.raw`\x1b\[`).test(e)}function Ef(e){const t=e.toLowerCase();return t==="todo_write"||t==="todowrite"}function yE(e){const t=e.flatMap((n,s)=>{const r=T3(n),i=r2(r,"content");return i?[{id:r2(r,"id")??`plan-${s}`,content:i,status:LXe(r2(r,"status")),priority:OXe(r2(r,"priority"))}]:[]});return t.length>0?t:void 0}function pP(e){if(!Ef(e.toolName)&&e.kind!=="other")return;const t=vW(e.args);if(t)return yE(t);const n=T3(e.rawOutput),s=vW(n);if(s)return yE(s);const r=Array.isArray(n==null?void 0:n.entries)?n.entries:void 0;return r?yE(r):void 0}function CXe(e){return e.some(t=>t.status==="pending"||t.status==="in_progress")}function C3(e){switch(e){case"completed":return"●";case"in_progress":return"◐";case"pending":return"○"}}const wW={todos:[],allCompleted:!1,sourceMessageId:null,sourceCallId:null};function TXe(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=pP(a);c&&(t=c,n=o.id,s=a.callId,r=!1)}}if(t.length===0)return wW;const i=!CXe(t);return r?wW:{todos:t,allCompleted:i,sourceMessageId:n,sourceCallId:s}}function gP(e){return JSON.stringify([e.id,e.content])}function P5(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=pP(n);s&&t.push({key:n.callId,todos:s,stats:NXe(n)})}return t}return[]}function EXe(e){const t=new Map,n=new Map;for(const s of e)for(const{key:r,todos:i}of P5(s)){const o=[];for(const a of i){const c=gP(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 jXe(e){const t=[];for(const n of e)for(const{key:s,todos:r}of P5(n))t.push(JSON.stringify([s,r.map(i=>[i.id,i.status,i.content])]));return t.join(`
`)}function AXe(e){const t=[];for(const n of e){if(n.role==="tool_group")for(const s of n.tools)!Ef(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 P5(n))t.push(JSON.stringify([s,n.timestamp,r.map(o=>[o.id,o.status,o.content]),i]))}return t.join(`
`)}function NXe(e){var o;const t=T3((o=T3(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 MXe(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const s of n.tools){if(Ef(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 IXe(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 RXe(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 DXe(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 PXe(e){var a;const t=new Map,n=new Map,s=new Map,r=new Set,i=MXe(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:f}of P5(c))for(const m of d){const p=gP(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,f),u!==void 0&&(o(p).startTs=u));else if(m.status==="completed"&&g!=="completed"&&g!==void 0){const b=s.get(p),v=b&&f?RXe(b,f):void 0,y=(a=t.get(p))==null?void 0:a.startTs,w=y!==void 0&&u!==void 0?IXe(i,y,u):void 0,x=DXe(v,w);if(u!==void 0||x){const k=o(p);u!==void 0&&(k.endTs=u),x&&(k.resources=x)}}m.status==="completed"&&r.add(p),n.set(p,m.status)}}return t}function vW(e){const t=e==null?void 0:e.todos;return Array.isArray(t)?t:void 0}function LXe(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function OXe(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function T3(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function r2(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}const b4=new Set;let vw=null,Qle=Date.now();function $Xe(){Qle=Date.now();for(const e of b4)e()}function BXe(e){return b4.add(e),vw||(vw=setInterval($Xe,1e3)),()=>{b4.delete(e),b4.size===0&&vw&&(clearInterval(vw),vw=null)}}function bP(e){const[t,n]=h.useState(()=>Date.now());return h.useEffect(()=>{if(e)return n(Date.now()),BXe(()=>n(Qle))},[e]),t}const Jle=h.createContext(void 0);function Zle({onOpen:e,children:t}){return l.jsx(Jle.Provider,{value:{onOpen:e},children:t})}function yP(){return h.useContext(Jle)}const ece=h.createContext(void 0);function zXe({onOpen:e,children:t}){return l.jsx(ece.Provider,{value:{onOpen:e},children:t})}function tce(){return h.useContext(ece)}const FXe="_list_1bo8s_1",HXe="_summary_1bo8s_2",qXe="_row_1bo8s_8",UXe="_num_1bo8s_16",WXe="_icon_1bo8s_23",VXe="_text_1bo8s_29",GXe="_inProgress_1bo8s_43",KXe="_completed_1bo8s_48",YXe="_item_1bo8s_62",XXe="_rowButton_1bo8s_69",QXe="_detailChevron_1bo8s_82",JXe="_detail_1bo8s_82",ZXe="_detailSection_1bo8s_100",eQe="_detailSectionTitle_1bo8s_106",tQe="_detailRows_1bo8s_114",nQe="_detailLabel_1bo8s_122",sQe="_detailValue_1bo8s_126",rQe="_detailDuration_1bo8s_132",iQe="_detailHint_1bo8s_136",gr={list:FXe,summary:HXe,row:qXe,num:UXe,icon:WXe,text:VXe,inProgress:GXe,completed:KXe,item:YXe,rowButton:XXe,detailChevron:QXe,detail:JXe,detailSection:ZXe,detailSectionTitle:eQe,detailRows:tQe,detailLabel:nQe,detailValue:sQe,detailDuration:rQe,detailHint:iQe};function $M(e){switch(e){case"completed":return gr.completed;case"in_progress":return gr.inProgress;case"pending":return""}}function nce({todos:e,events:t}){const{t:n}=lt();if(t.length===0){if(e.length>0&&e.every(i=>i.status==="completed"))return l.jsx("div",{className:gr.summary,children:l.jsxs("div",{className:`${gr.row} ${gr.completed}`,children:[l.jsx("span",{className:gr.icon,"aria-hidden":"true",children:"✓"}),l.jsx("span",{className:gr.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:gr.summary,children:l.jsxs("div",{className:`${gr.row} ${$M(r.status)}`,children:[l.jsx("span",{className:gr.icon,"aria-hidden":"true",children:C3(r.status)}),l.jsx("span",{className:gr.text,children:r.content})]})}):null}return l.jsx("div",{className:gr.summary,children:t.map(s=>l.jsxs("div",{className:`${gr.row} ${s.kind==="completed"?gr.completed:gr.inProgress}`,children:[l.jsx("span",{className:gr.icon,"aria-hidden":"true",children:C3(s.kind==="completed"?"completed":"in_progress")}),l.jsx("span",{className:gr.text,children:s.content})]},`${s.kind}-${s.id}`))})}function e0({label:e,value:t,suffix:n}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{className:gr.detailLabel,children:e}),l.jsxs("span",{className:gr.detailValue,children:[t,n]})]})}function wE({title:e,children:t}){return l.jsxs("div",{className:gr.detailSection,children:[l.jsx("div",{className:gr.detailSectionTitle,children:e}),l.jsx("div",{className:gr.detailRows,children:t})]})}function oQe({detail:e}){const{t}=lt(),{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:gr.detail,children:[i&&l.jsxs(wE,{title:t("todo.detail.sectionTime"),children:[n!==void 0&&l.jsx(e0,{label:t("todo.detail.start"),value:Cb(n)}),s!==void 0&&l.jsx(e0,{label:t("todo.detail.end"),value:Cb(s),suffix:n!==void 0?l.jsxs("span",{className:gr.detailDuration,children:[" ","(",Pm(s-n),")"]}):void 0})]}),o&&l.jsxs(wE,{title:t("todo.detail.sectionTokens"),children:[l.jsx(e0,{label:t("todo.detail.input"),value:((r==null?void 0:r.inputTokens)??0).toLocaleString()}),l.jsx(e0,{label:t("todo.detail.output"),value:((r==null?void 0:r.outputTokens)??0).toLocaleString()}),l.jsx(e0,{label:t("todo.detail.cached"),value:((r==null?void 0:r.cachedTokens)??0).toLocaleString()})]}),a&&l.jsxs(wE,{title:t("todo.detail.sectionSpent"),children:[(r==null?void 0:r.apiTimeMs)!==void 0&&l.jsx(e0,{label:t("todo.detail.api"),value:Pm(r.apiTimeMs)}),(r==null?void 0:r.toolTimeMs)!==void 0&&l.jsx(e0,{label:t("todo.detail.tool"),value:Pm(r.toolTimeMs)})]}),!r&&l.jsx("div",{className:gr.detailHint,children:t("todo.detail.noResources")})]})}function aQe(e){return!!e&&(e.endTs!==void 0||e.resources!==void 0)}function sce({todos:e,numbered:t=!1}){const{t:n}=lt(),s=h.useContext(yde),[r,i]=h.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:gr.list,children:e.map((c,u)=>{const d=c.id||String(u),f=s.get(gP(c)),m=aQe(f),p=m&&r.has(d),g=l.jsxs(l.Fragment,{children:[t&&l.jsxs("span",{className:gr.num,style:{minWidth:o},children:[u+1,"."]}),l.jsx("span",{className:gr.icon,"aria-hidden":"true",children:C3(c.status)}),l.jsx("span",{className:gr.text,children:c.content}),m&&l.jsx("span",{className:gr.detailChevron,"aria-hidden":"true",children:p?"▾":"▸"})]});return l.jsxs("div",{className:gr.item,children:[m?l.jsx("button",{type:"button",className:`${gr.row} ${gr.rowButton} ${$M(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:`${gr.row} ${$M(c.status)}`,children:g}),p&&f&&l.jsx(oQe,{detail:f})]},d)})})}function rce(e,t,n){if(e.current)return;const s={};e.current=s,t().then(r=>{e.current===s&&!r&&n()},()=>{e.current===s&&n()}).finally(()=>{e.current===s&&(e.current=null)})}function lQe(e){const t=e.toolName.toLowerCase();if(Qu(e.toolName))return!!Hd(e);if(t==="write_file"||t==="writefile")return!!SQe(e)||xW(e);if(e.status!=="completed"&&e.status!=="failed")return!1;if(Sc(t)){const n=Hd(e);return!!n&&n.trim().length>0&&n.split(`
`).length>1}if(I5(t))return!!ace(e);if(t==="edit"||t==="write"||t==="editfile")return xW(e);if(t==="read"||t==="read_file"||t==="readfile"){const n=Hd(e);return!!n&&n.split(`
`).length>3}return!1}function cQe(e){const t=e.toolName.toLowerCase();return Sc(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||I5(t)||Qu(e.toolName)}function uQe(e){var t;return(t=e.content)!=null&&t.some(n=>n.type==="diff")?!0:!!ice(e)}function xW(e){return uQe(e)||!!Hd(e)}function dQe(e){const t=ice(e);if(t)return t;if(e.content){const n=e.content.find(s=>s.type==="diff");if(n&&n.type==="diff")return mQe(n.oldText||"",n.newText||"")}return""}function ice(e){if(e.rawOutput&&typeof e.rawOutput=="object"){const t=e.rawOutput;if(hQe(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function hQe(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}const fQe=25e4;function mQe(e,t){const n=e.split(`
`),s=t.split(`
`),r=n.length,i=s.length;if(r*i>fQe){const d=n.map(m=>m?`-${m}`:"-"),f=s.map(m=>m?`+${m}`:"+");return[...d,...f].join(`
`)}const o=Array.from({length:r+1},()=>Array(i+1).fill(0));for(let d=1;d<=r;d++)for(let f=1;f<=i;f++)o[d][f]=n[d-1]===s[f-1]?o[d-1][f-1]+1:Math.max(o[d-1][f],o[d][f-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 pQe=60,gQe=2e5,bQe=1e3,yQe={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 wQe({tool:e}){const t=h.useMemo(()=>Hd(e)||"",[e]),n=h.useMemo(()=>SXe(t)?_Xe(t):null,[t]);return l.jsx("div",{className:Zt.expandedBash,children:l.jsx("pre",{className:Zt.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 vQe({tool:e}){const t=h.useMemo(()=>Hd(e)||"",[e]),n=oce(xQe(e)),s=n==="text"||t.length>gQe||kQe(t,bQe);return l.jsx("div",{className:Zt.expandedRead,children:s?l.jsx("pre",{className:Zt.expandedOutput,children:t}):l.jsx(pf,{content:_Qe(n,t)})})}function xQe(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 kQe(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 oce(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=yQe[t]??t;return/^[\w+.#-]+$/.test(n)?n:"text"}function _Qe(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 kW({tool:e}){const t=h.useMemo(()=>dQe(e),[e]),n=h.useMemo(()=>Hd(e)||"",[e]);return!t&&!n?null:l.jsx("div",{className:Zt.expandedEdit,children:t?l.jsx(xXe,{diff:t}):l.jsx("pre",{className:Zt.expandedOutput,children:n})})}function BM({title:e,detail:t,children:n}){return l.jsxs("div",{className:Zt.expandedCard,children:[l.jsxs("div",{className:Zt.expandedCardHeader,children:[l.jsx("span",{className:Zt.expandedCardTitle,children:e}),t&&l.jsx("span",{className:Zt.expandedCardDetail,children:t})]}),n&&l.jsx("div",{className:Zt.expandedCardBody,children:n})]})}function SQe(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=Hd(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 CQe({tool:e,todos:t,expanded:n,title:s}){var o;const i=((o=h.useContext(HP).get(e.callId))==null?void 0:o.events)??[];return n?l.jsx(BM,{title:s,children:l.jsx("div",{className:Zt.todoBody,children:l.jsx(sce,{todos:t})})}):l.jsx("div",{className:Zt.todoBody,children:l.jsx(nce,{todos:t,events:i})})}function TQe(e,t){var p,g;const n=Rk(e.rawOutput),s=dP(e),r=Ix(e),i=fP(e),o=EQe(e),a=R5(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"?Kle(u.totalDurationMs):Dk(e.startTime,e.endTime??(e.status==="in_progress"&&t?t:void 0)),f=n&&typeof n.tokenCount=="number"&&n.tokenCount>0?n.tokenCount:u&&typeof u.outputTokens=="number"&&u.outputTokens>0?u.outputTokens:0,m=f>0?hP(f):"";return{agentType:i,explicitAgentType:o,description:a,subToolCount:c,elapsed:d,tokens:m,status:r,reason:s}}function EQe(e){var r;const t=Rk(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 _W(e){if(e.status==="completed")return!1;const t=e.toolName.toLowerCase();return!!(Qu(e.toolName)||t==="write_file"||t==="writefile"||t==="edit"||t==="editfile"||Sc(t))}function jQe({tool:e}){const t=Hd(e)||"";return l.jsx("pre",{className:Zt.expandedOutput,children:t})}function AQe({tool:e}){var n;const t=ace(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:Zt.expandedOutput,children:t})}function ace(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 L5(e){const t=e.toolName.toLowerCase();return ty(e)?"agent":Qu(e.toolName)?"ask":Sc(t)?"shell":vP(t)?"fetch":Ef(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 NQe({description:e,elapsed:t}){return l.jsxs(l.Fragment,{children:[e&&l.jsx("span",{className:Zt.lineArg,children:e}),t&&l.jsx("span",{className:Zt.lineElapsed,children:t})]})}function Rv({info:e}){const{renderToolHeaderExtra:t}=ku(),n=t==null?void 0:t(e);return n?l.jsx(l.Fragment,{children:n}):l.jsx(NQe,{description:e.description,elapsed:e.elapsed})}function MQe(e){return e.length>pQe||e.includes(`
`)}function xg(e){return e==="in_progress"||e==="pending"||e==="running"}function wP(e){return e.find(t=>xg(t.status))??e[e.length-1]}function IQe(e,t,n){if(uce(e)){const r=e.find(o=>xg(o.status)&&!hf(o)),i=r??wP(e);return Qu(i.toolName)?t("toolGroup.summary.provideInformation"):!r&&hf(i)?t("subagent.background"):t("toolGroup.running",{name:qu(i.toolName,t),count:e.length,duration:n??""})}const s=PQe(e,t);return s||t("toolGroup.summary",{count:e.length})}function RQe(e,t,n){if(Ef(e.toolName))return t("toolGroup.summary.updatedTodos",{count:1});if(Qu(e.toolName))return xg(e.status)?t("toolGroup.summary.provideInformation"):t("toolGroup.summary.askedQuestions",{count:cce(e)});const{displayName:s,description:r,hideDisplayName:i}=lce(e,t,n);return[i?"":s,r].filter(Boolean).join(" ")}function lce(e,t,n){const s=qu(e.toolName,t),r=Do($le(e,n),120);return{kind:L5(e),tool:e,displayName:s,description:r,elapsed:"",workspaceCwd:n,hideDisplayName:!!lWe(e)}}function DQe({tool:e,runningDuration:t,workspaceCwd:n}){const{t:s}=lt(),r=Qu(e.toolName),i=xg(e.status),o=!r&&i?hf(e)?s("subagent.background"):s("toolGroup.runningPrefix").trim():"";if(Ef(e.toolName)||r)return l.jsxs(l.Fragment,{children:[o&&l.jsxs("span",{children:[o," "]}),RQe(e,s,n),t&&l.jsxs("span",{children:[" ",t]})]});const a=lce(e,s,n);return l.jsxs(l.Fragment,{children:[o&&l.jsxs("span",{children:[o," "]}),l.jsxs("span",{className:Zt.chatSummaryInline,children:[!a.hideDisplayName&&l.jsx("span",{className:Zt.lineName,children:a.displayName}),l.jsx(Rv,{info:a})]}),t&&l.jsxs("span",{children:[" ",t]})]})}function PQe(e,t){let n=0,s=0,r=0,i=0,o=0,a=0,c=0;for(const d of e){const f=d.toolName.toLowerCase();Sc(f)?s++:f==="edit"||f==="editfile"||f==="write"||f==="write_file"||f==="writefile"?n++:f==="read"||f==="read_file"||f==="readfile"?r++:f==="grep"||f==="grep_search"||f==="search"||f==="glob"||f==="web_search"||f==="websearch"?i++:Ef(f)?o++:Qu(f)?a+=cce(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 cce(e){var n;const t=(n=e.args)==null?void 0:n.questions;return Array.isArray(t)&&t.length>0?t.length:1}function uce(e){return e.some(t=>xg(t.status))}function LQe(){return l.jsxs("svg",{className:Zt.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 dce(){return l.jsxs("svg",{className:Zt.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 OQe(){return l.jsxs("svg",{className:Zt.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 $Qe(){return l.jsxs("svg",{className:Zt.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 BQe(){return l.jsx("svg",{className:Zt.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 zQe(){return l.jsx("svg",{className:Zt.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 zM(){return l.jsx("svg",{className:Zt.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 FQe({tool:e}){const t=L5(e);return t==="agent"?l.jsx(zM,{}):t==="ask"?l.jsx(zQe,{}):t==="edit"||t==="write"?l.jsx(LQe,{}):t==="fetch"?l.jsx(OQe,{}):t==="read"?l.jsx($Qe,{}):t==="todo"?l.jsx(BQe,{}):l.jsx(dce,{})}function vP(e){const t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}const HQe=Ix;function qQe({tools:e,workspaceCwd:t,isLocateFlashing:n=!1}){const{t:s}=lt(),r=wP(e),i=qu(r.toolName,s),o=HQe(r),a=uP(r,t),c=xg(r.status)&&hf(r)||Sc(r.toolName)||vP(r.toolName)?"":Dk(r.startTime,r.endTime);return l.jsxs("div",{className:`${Zt.compactGroup}${n?` ${hp.flash}`:""}`,children:[l.jsxs("div",{className:Zt.compactHeader,children:[l.jsx(sf,{status:o}),l.jsx("span",{className:Zt.lineName,children:i}),e.length>1&&l.jsxs("span",{className:Zt.compactCount,children:["× ",e.length]}),l.jsx(Rv,{info:{kind:L5(r),tool:r,displayName:i,description:a,elapsed:c,workspaceCwd:t}})]}),l.jsx("div",{className:Zt.compactHint,children:s("compact.hint")})]})}function UQe(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&&WQe(n.subTools,s.subTools)}function WQe(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 SW=/\[([^\]]+)\]\(qwen-session:\/\/([^)]+)\)/g;function vE(e,t){if(!e||!e.includes("qwen-session://"))return e;const n=[];let s=0,r;for(SW.lastIndex=0;(r=SW.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 FM=h.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}=lt(),d=BI(),f=h.useContext(sg),m=yP(),p=tce(),g=p!==void 0,[b,v]=h.useState(!1),[y,w]=h.useState(()=>i||!f&&_W(t)),x=h.useRef(null),k=h.useRef(!1);h.useEffect(()=>{w(i||(f?!1:_W(t))),v(!1),x.current=null,k.current=!1},[f,i,g,t.callId,t.toolName]);const C=ty(t),T=n&&n.toolCallId===t.callId,_=!T&&(n==null?void 0:n.toolCallId)&&C&&Uu(t,n.toolCallId),S=C&&t.status==="in_progress",R=bP(S);if(h.useEffect(()=>{!i&&!C&&t.status==="completed"&&!k.current&&w(!1)},[i,C,t.status]),C){const be=TQe(t,R),rt=be.explicitAgentType?`${u("agent.label")} (${be.explicitAgentType})`:u("agent.label"),le=t.status==="completed"||t.status==="failed",Me=hf(t),at=[Me&&!le?u("subagent.background"):t.status==="pending"?u("subagent.pending"):u("subagent.running"),Me&&!le?"":be.elapsed].filter(Boolean).join(" · "),ze=[be.subToolCount>0?u("subagent.toolsCount",{count:be.subToolCount}):"",be.elapsed,be.tokens,be.reason?Do(be.reason,80):""].filter(Boolean).join(" · "),rn=i||y||!!T||!!_,Wt=l.jsx(mP,{tool:t,hideHeader:!0,defaultExpanded:!0,inline:!0});return m&&!a?l.jsx("div",{className:Zt.line,children:l.jsxs("button",{type:"button",className:`${Zt.lineMain} ${Zt.lineExpandable} ${Zt.lineButton}`,onClick:()=>m.onOpen(t),children:[l.jsx(zM,{}),l.jsx(sf,{status:le?be.status:t.status}),l.jsx("span",{className:Zt.lineName,children:rt}),l.jsx(Rv,{info:{kind:"agent",tool:t,displayName:rt,description:be.description?Do(be.description,60):"",elapsed:le?ze:at,workspaceCwd:s}}),l.jsx("span",{className:Zt.lineChevronRight,"aria-hidden":"true"})]})}):l.jsxs("div",{className:Zt.line,children:[!a&&l.jsxs("div",{className:`${Zt.lineMain} ${Zt.lineExpandable}`,onClick:()=>w(!y),children:[l.jsx(zM,{}),l.jsx(sf,{status:le?be.status:t.status}),l.jsx("span",{className:Zt.lineName,children:rt}),l.jsx(Rv,{info:{kind:"agent",tool:t,displayName:rt,description:be.description?Do(be.description,60):"",elapsed:le?ze:at,workspaceCwd:s}}),l.jsx("span",{className:y?Zt.lineChevronDown:Zt.lineChevronRight,"aria-hidden":"true"})]}),rn&&l.jsx("div",{className:Zt.lineDetail,children:a?l.jsx("div",{className:Zt.expandedAgentCard,children:Wt}):Wt})]})}const A=uP(t,s),O=cWe(t),D=r&&Sc(t.toolName)?$le(t,s):A,$=qu(t.toolName,u),z=Sc(t.toolName)||vP(t.toolName)?"":Dk(t.startTime,t.endTime),B=t.toolName.toLowerCase(),j=B==="monitor"&&g&&!b&&!a,H=Ef(B),Q=H?pP(t):void 0,I=!!Q&&Q.length>0,J=Q?Q.filter(be=>be.status==="completed").length:0,W=Sc(B),P=B==="grep"||B==="grep_search"||B==="search"||B==="glob",V=B==="read"||B==="read_file"||B==="readfile",ee=!H&&MQe(D),q=!i&&(o||(H?I:lQe(t)||ee)),K=j||q,de=()=>{v(!0),q&&(k.current=!0,w(be=>!be))},re=()=>{p&&rce(x,()=>p.onOpen(t),de)},ne=cQe(t),U=y&&ee,Z=V,ge=U&&!W&&!P&&!V,ce=A,ue=!H&&y&&!ne&&(U||O);return l.jsxs("div",{className:Zt.line,children:[!a&&l.jsxs("div",{className:`${Zt.lineMain} ${K?Zt.lineExpandable:""}`,title:j?void 0:q?u(y?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":j?void 0:q?y:void 0,role:K?"button":void 0,tabIndex:K?0:void 0,onClick:K?()=>{if(j){re();return}k.current=!0,w(be=>!be)}:void 0,onKeyDown:K?be=>{if(!(be.key!=="Enter"&&be.key!==" ")){if(be.preventDefault(),j){re();return}k.current=!0,w(rt=>!rt)}}:void 0,children:[l.jsx(sf,{status:t.status}),l.jsx("span",{className:Zt.lineName,children:$}),H&&I&&l.jsxs("span",{className:Zt.todoProgress,children:[J,"/",Q.length]}),l.jsx(Rv,{info:{kind:L5(t),tool:t,displayName:$,description:H||ge?"":D,elapsed:H?"":z,workspaceCwd:s}}),K&&l.jsx("span",{className:!j&&y?Zt.lineChevronDown:Zt.lineChevronRight,"aria-hidden":"true"})]}),(!r||y)&&H&&I&&l.jsx(CQe,{tool:t,todos:Q,expanded:y,title:$}),(!r||y)&&H&&!I&&O&&l.jsx("div",{className:Zt.lineOutput,children:vE(O,d)}),ue&&l.jsx(BM,{title:$,detail:ce,children:O&&l.jsx("div",{className:`${Zt.lineOutput} ${Zt.expandedLineOutput}`,children:vE(O,d)})}),!H&&!c&&O&&!ue&&(!y||!ne)&&(!r||y)&&l.jsx("div",{className:y?`${Zt.lineOutput} ${Zt.expandedLineOutput}`:Zt.lineOutput,children:vE(O,d)}),!H&&y&&ne&&l.jsx("div",{className:Z?`${Zt.lineDetail} ${Zt.markdownLineDetail}`:Zt.lineDetail,children:V?l.jsx(vQe,{tool:t}):l.jsxs(BM,{title:$,detail:ce,children:[Sc(B)&&l.jsx(wQe,{tool:t}),(B==="write_file"||B==="writefile")&&l.jsx(kW,{tool:t}),(B==="edit"||B==="write"||B==="editfile")&&l.jsx(kW,{tool:t}),Qu(t.toolName)&&l.jsx(jQe,{tool:t}),I5(B)&&l.jsx(AQe,{tool:t})]})})]})},UQe),VQe=h.memo(function({tools:t,pendingApproval:n,workspaceCwd:s,isLocateFlashing:r=!1}){const{t:i}=lt(),o=h.useContext(sg),a=yP(),c=tce(),u=c!==void 0,[d,f]=h.useState(!1),[m,p]=h.useState(!1),g=h.useRef(null),b=uce(t),v=t.some(j=>j.status==="failed"),y=t.length>0?wP(t):void 0,w=t.length===1?t[0]:void 0,x=w&&ty(w)?w:void 0,k=w&&w.toolName.toLowerCase()==="monitor"?w:void 0,C=t.some(j=>xg(j.status)&&!hf(j)),T=b&&C,_=!!(x&&a),S=!!(k&&u&&!d),R=_||S,A=t[0]??y,O=h.useRef(Date.now()),M=bP(T),D=(n==null?void 0:n.toolCallId)&&t.some(j=>Uu(j,n.toolCallId)),$=o&&!D,z=T?Yle(M-O.current):void 0;h.useEffect(()=>{T&&(O.current=Date.now())},[T,y==null?void 0:y.callId]),h.useEffect(()=>{f(!1),p(!1),g.current=null},[u,k==null?void 0:k.callId]);const B=()=>{!k||!c||rce(g,()=>c.onOpen(k),()=>{f(!0),p(j=>!j)})};return $?l.jsx(qQe,{tools:t,workspaceCwd:s,isLocateFlashing:r}):D?l.jsx("div",{className:`${Zt.group}${r?` ${hp.flash}`:""}`,children:t.map(j=>l.jsx(FM,{tool:j,approval:n,workspaceCwd:s},j.callId))}):l.jsxs("div",{className:r?hp.flash:void 0,children:[l.jsxs("button",{type:"button",className:Zt.chatSummary,onClick:()=>{if(x&&a){a.onOpen(x);return}if(S&&k&&c){B();return}p(j=>!j)},"aria-expanded":R?void 0:m,title:R?void 0:i(m?"tool.collapseHint":"tool.expand"),children:[l.jsx("span",{className:Zt.chatSummaryIcon,"aria-hidden":"true",children:A?l.jsx(FQe,{tool:A}):l.jsx(dce,{})}),v&&l.jsx(sf,{status:"failed"}),l.jsx("span",{className:T?`${Zt.chatSummaryText} ${Zt.chatSummaryTextActive}`:Zt.chatSummaryText,children:w?l.jsx(DQe,{tool:w,runningDuration:z,workspaceCwd:s}):IQe(t,i,z)}),l.jsx("span",{className:m?Zt.chatChevronDown:Zt.chatChevronRight,"aria-hidden":"true"})]}),l.jsx("div",{className:m?Zt.chatSummaryContentClip:`${Zt.chatSummaryContentClip} ${Zt.chatSummaryContentCollapsed}`,children:l.jsx("div",{className:Zt.chatSummaryContentInner,children:l.jsx("div",{className:`${Zt.group} ${Zt.chatSummaryGroup}`,children:t.map(j=>l.jsx(FM,{tool:j,approval:n,workspaceCwd:s,summaryOnly:!w,forceExpanded:!!w,hideHeader:!!w},j.callId))})})})]})}),GQe="_message_kwepu_1",KQe="_header_kwepu_6",YQe="_chevron_kwepu_20",XQe="_title_kwepu_26",QQe="_progress_kwepu_35",xw={message:GQe,header:KQe,chevron:YQe,title:XQe,progress:QQe};function JQe({id:e,todos:t}){var r;const s=((r=h.useContext(HP).get(e))==null?void 0:r.events)??[];return l.jsx(nce,{todos:t,events:s})}const ZQe=h.memo(function({id:t,todos:n,isLocateFlashing:s=!1}){const{t:r}=lt(),[i,o]=h.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:`${xw.message}${s?` ${hp.flash}`:""}`,children:[l.jsxs("button",{type:"button",className:xw.header,onClick:()=>o(u=>!u),"aria-expanded":i,title:r(i?"todo.collapse":"todo.expand"),children:[l.jsx("span",{className:xw.chevron,"aria-hidden":"true",children:i?"▾":"▸"}),l.jsx("span",{className:xw.title,children:r("plan.title")}),l.jsxs("span",{className:xw.progress,children:[c,"/",a]})]}),i?l.jsx(sce,{todos:n,numbered:!0}):l.jsx(JQe,{id:t,todos:n})]})}),eJe="_message_1abcu_1",tJe="_content_1abcu_11",nJe="_question_1abcu_17",sJe="_prefix_1abcu_24",rJe="_answer_1abcu_28",iJe="_pending_1abcu_32",oJe="_shortcuts_1abcu_36",t0={message:eJe,content:tJe,question:nJe,prefix:sJe,answer:rJe,pending:iJe,shortcuts:oJe},hce=h.memo(function({question:t,answer:n,isPending:s}){const{t:r}=lt();return l.jsxs("div",{className:t0.message,children:[l.jsxs("div",{className:t0.content,children:[l.jsxs("div",{className:t0.question,children:[l.jsx("span",{className:t0.prefix,children:"/btw "}),l.jsx("span",{children:t})]}),l.jsx("div",{className:t0.answer,children:s?l.jsx("span",{className:t0.pending,children:r("btw.answering")}):l.jsx(pf,{content:n})})]}),l.jsx("div",{className:t0.shortcuts,children:r(s?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),aJe="_message_1q4dw_1",lJe="_compact_1q4dw_16",cJe="_header_1q4dw_21",uJe="_status_1q4dw_30",dJe="_name_1q4dw_35",hJe="_command_1q4dw_42",fJe="_output_1q4dw_51",mJe="_compactHint_1q4dw_62",jh={message:aJe,compact:lJe,header:cJe,status:uJe,name:dJe,command:hJe,output:fJe,compactHint:mJe},pJe=h.memo(function({command:t,output:n}){const s=h.useContext(sg),{t:r}=lt();return l.jsxs("div",{className:s?`${jh.message} ${jh.compact}`:jh.message,children:[l.jsxs("div",{className:jh.header,children:[l.jsx("span",{className:jh.status,children:"✓"}),l.jsx("span",{className:jh.name,children:r("shell.command")}),t&&l.jsx("span",{className:jh.command,children:t})]}),s?l.jsx("div",{className:jh.compactHint,children:r("compact.hint")}):n&&l.jsx("pre",{className:jh.output,children:n})]})}),gJe="_progress_1j3ys_1",bJe="_spinner_1j3ys_12",yJe="_bar_1j3ys_19",wJe="_stage_1j3ys_25",vJe="_icon_1j3ys_29",xJe="_done_1j3ys_35",kJe="_error_1j3ys_43",_Je="_detail_1j3ys_51",SJe="_path_1j3ys_56",oa={progress:gJe,spinner:bJe,bar:yJe,stage:wJe,icon:vJe,done:xJe,error:kJe,detail:_Je,path:SJe},CW=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"];function CJe({progress:e}){const{stage:t,progress:n,detail:s,isComplete:r,error:i}=e,[o,a]=h.useState(0),c=30,u=Math.round(n/100*c),d=c-u,f="█".repeat(Math.max(0,u))+"░".repeat(Math.max(0,d));return h.useEffect(()=>{if(r||i)return;const m=setInterval(()=>{a(p=>(p+1)%CW.length)},120);return()=>clearInterval(m)},[r,i]),i?l.jsxs("div",{className:`${oa.progress} ${oa.error}`,children:[l.jsx("span",{className:oa.icon,children:"✕"}),l.jsx("span",{className:oa.stage,children:t}),l.jsx("div",{className:oa.detail,children:i})]}):r?l.jsxs("div",{className:`${oa.progress} ${oa.done}`,children:[l.jsx("span",{className:oa.icon,children:"✓"}),l.jsx("span",{className:oa.stage,children:t})]}):l.jsxs("div",{className:oa.progress,children:[l.jsx("span",{className:oa.spinner,children:CW[o]}),l.jsx("span",{className:oa.bar,children:f}),l.jsxs("span",{className:oa.stage,children:[t,s?` (${s})`:""]})]})}function TJe({path:e}){const{t}=lt();return l.jsxs("div",{className:`${oa.progress} ${oa.done}`,children:[l.jsx("span",{className:oa.icon,children:"✓"}),l.jsx("span",{className:oa.stage,children:t("insight.ready")}),l.jsx("span",{className:oa.path,children:e})]})}const EJe=h.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:f=!1,assistantTurnFooterInfo:m,generateContent:p}){const{t:g}=lt(),b=(()=>{switch(t.role){case"user":return l.jsx(zqe,{content:t.content,images:t.images,inputAnnotations:t.inputAnnotations,isLocateFlashing:f});case"assistant":return l.jsx(wUe,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,onBranchSession:c,showFooterActions:u,showBranchAction:d,isLocateFlashing:f,customFooterInfo:m});case"thinking":return l.jsx(SUe,{messageId:t.id,content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,isLocateFlashing:f,generateContent:p});case"tool_group":return l.jsx(VQe,{tools:t.tools,pendingApproval:n,workspaceCwd:r,isLocateFlashing:f});case"plan":return l.jsx(ZQe,{id:t.id,todos:t.todos,isLocateFlashing:f});case"system":return l.jsx(KKe,{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(pJe,{command:t.command,output:t.output});case"btw":return l.jsx(hce,{question:t.question,answer:t.answer,isPending:t.isPending});case"insight_progress":return l.jsx(CJe,{progress:{stage:t.stage,progress:t.progress,detail:t.detail}});case"insight_ready":return l.jsx(TJe,{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(df,{label:`message:${t.role}`,resetKeys:[t],fallback:l.jsx(jJe,{align:t.role==="user"?"end":"start"}),children:b}),y=l.jsx("div",{"data-user-selectable":"true",style:{display:"contents"},children:v});return t.role==="assistant"?u?y:l.jsx(CA,{timestamp:t.timestamp,children:y}):t.role==="system"&&t.source==="prompt_cancelled"?y:l.jsx(CA,{timestamp:t.timestamp,chatMode:t.role==="user",copyText:t.role==="user"?t.content:void 0,copyTitle:g("common.copy"),children:y})},AJe);function jJe({align:e}){const{t}=lt();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 AJe(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||!NJe(e.assistantTurnFooterInfo,t.assistantTurnFooterInfo)?!1:MJe(e.message,t.message)}function NJe(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 MJe(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&&DJe(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"&&IJe(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&e.tools.length===t.tools.length&&e.tools.every((n,s)=>fce(n,t.tools[s]));default:return!1}}function IJe(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 fce(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&&Hf(e.args)===Hf(t.args)&&Hf(e.rawOutput)===Hf(t.rawOutput)&&Hf(e.locations)===Hf(t.locations)&&Hf(e.content)===Hf(t.content)&&RJe(e.subTools,t.subTools):!1}function RJe(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((n,s)=>fce(n,t[s]))}const TW=new WeakMap;function DJe(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 Hf(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=TW.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return TW.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 PJe(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 E3(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=PJe(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 Px(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(","),f=Number(a)===7?0:Number(a),m=d[f]??a;return t("scheduledTasks.human.weekly",{day:m,time:`${u(r)}:${u(s)}`})}return e}const _d={frequency:"daily",time:"09:00",weekday:1,minuteInterval:30,customCron:"0 9 * * *"};function Gf(e){const t=e.trim(),n={..._d,frequency:"custom",customCron:t.length>0?t:_d.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"),f=o==="*"&&a==="*";if(/^\*\/\d+$/.test(r)&&i==="*"&&f&&c==="*"){const b=Number(r.slice(2));return Number.isInteger(b)&&b>=1&&b<=30&&60%b===0?{..._d,frequency:"minutes",minuteInterval:b}:n}if(!u(r))return n;const m=Number(r);if(m>59)return n;if(i==="*"&&f&&c==="*")return{..._d,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(f&&c==="*")return{..._d,frequency:"daily",time:g};if(f&&c==="1-5")return{..._d,frequency:"weekdays",time:g};if(f&&u(c)){const b=Number(c);if(b>=0&&b<=7)return{..._d,frequency:"weekly",time:g,weekday:b===7?0:b}}return n}function LJe(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 OJe(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 mce(e){switch(e){case"html":return"HTML";case"pdf":return"PDF";case"notebook":return"Notebook";default:return e||"artifact"}}function pce(e){return e===void 0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function $Je(e){return e.workspacePath??e.url??e.managedId??""}function tg(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 HM(e,t){const n=tg(e),s=tg(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 gce(e,t,n){const s=HM(e??"",n),r=HM(t??"",n);return!!s&&s===r}const EW="default-src 'none'; base-uri 'none'; style-src 'unsafe-inline'; img-src data: blob:;";function BJe(e){if(typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${EW}"></head><body>${zJe(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=EW,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function zJe(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 j3({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 bce(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 FJe="_root_aths8_1",HJe="_card_aths8_7",qJe="_summary_aths8_14",UJe="_icon_aths8_22",WJe="_iconSvg_aths8_33",VJe="_title_aths8_39",GJe="_linkButton_aths8_46",KJe="_reviewButton_aths8_47",YJe="_showMoreButton_aths8_48",XJe="_actions_aths8_79",QJe="_list_aths8_97",JJe="_fileRow_aths8_104",ZJe="_path_aths8_124",eZe="_lineStats_aths8_133",tZe="_additions_aths8_142",nZe="_deletions_aths8_146",sZe="_chevronIcon_aths8_160",rZe="_chevronIconOpen_aths8_168",iZe="_artifactInfo_aths8_172",oZe="_artifactMeta_aths8_178",Hs={root:FJe,card:HJe,summary:qJe,icon:UJe,iconSvg:WJe,title:VJe,linkButton:GJe,reviewButton:KJe,showMoreButton:YJe,actions:XJe,list:QJe,fileRow:JJe,path:ZJe,lineStats:eZe,additions:tZe,deletions:nZe,chevronIcon:sZe,chevronIconOpen:rZe,artifactInfo:iZe,artifactMeta:oZe},yce=["file","artifact","scheduled_task"];function aZe({turnId:e,changes:t,artifacts:n,scheduledTasks:s,workspaceCwd:r,onOpenRequest:i,onReviewChanges:o,onOpenArtifact:a,onOpenScheduledTask:c}){const{t:u}=lt(),[d,f]=h.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=bce(t),b=w=>{if(i){i({id:"review",kind:"review",title:u("turnOutputs.review"),turnId:e,changes:t,...r?{workspaceCwd:r}:{},...w?{selectedPath:w}:{}});return}o(t,w)},v=w=>{const x=mZe(w,t,r);if(i){i({id:`artifact:${w.id}`,kind:"artifact",title:w.title??"Artifact",turnId:e,artifactId:w.id,...w.managedId?{managedId:w.managedId}:{},artifact:w,...x!==void 0?{previewContent:x}:{}});return}a(w.id,x)},y=w=>{if(i){i({id:`scheduled-task:${w.toolCallId}`,kind:"scheduled_task",title:u("scheduledTasks.title"),turnId:e,task:w});return}c(w)};return l.jsxs("div",{className:Hs.root,children:[t.length>0&&l.jsxs("div",{className:Hs.card,children:[l.jsxs("div",{className:Hs.summary,children:[l.jsx("span",{className:Hs.icon,"aria-hidden":"true",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",focusable:"false",className:Hs.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:Hs.title,children:u("turnOutputs.filesEdited",{count:t.length})}),l.jsx(j3,{additions:g==null?void 0:g.additions,deletions:g==null?void 0:g.deletions,className:Hs.lineStats,additionsClassName:Hs.additions,deletionsClassName:Hs.deletions}),l.jsxs("button",{type:"button",className:Hs.linkButton,onClick:()=>b(),children:[u("turnOutputs.viewChanges")," ↗"]})]}),l.jsx("div",{className:Hs.actions,children:l.jsx("button",{type:"button",className:Hs.reviewButton,onClick:()=>b(),children:u("turnOutputs.review")})})]}),l.jsxs("div",{className:Hs.list,children:[m.map(w=>l.jsxs("button",{type:"button",className:Hs.fileRow,onClick:()=>b(w.path),title:w.path,children:[l.jsx("span",{className:Hs.path,children:O5(w.path,r)}),l.jsx(j3,{additions:w.additions,deletions:w.deletions,className:Hs.lineStats,additionsClassName:Hs.additions,deletionsClassName:Hs.deletions})]},`${w.toolCallId}:${w.path}`)),p>0&&l.jsxs("button",{type:"button",className:Hs.showMoreButton,onClick:()=>f(w=>!w),children:[l.jsx("span",{children:d?u("turnOutputs.collapseFiles"):u("turnOutputs.showMoreFiles",{count:p})}),l.jsx(hZe,{open:d})]})]})]}),n.map(w=>l.jsx(lZe,{artifact:w,onOpen:()=>v(w)},w.id)),s.map(w=>l.jsx(cZe,{task:w,scheduleLabel:Px(w.cron,u),onOpen:()=>y(w)},w.toolCallId))]})}function lZe({artifact:e,onOpen:t}){const{t:n}=lt(),s=pce(e.sizeBytes);return l.jsx("div",{className:Hs.card,children:l.jsxs("div",{className:Hs.summary,children:[l.jsx("span",{className:Hs.icon,"aria-hidden":"true",children:l.jsx(uZe,{})}),l.jsxs("div",{className:Hs.artifactInfo,children:[l.jsx("div",{className:Hs.title,children:e.title}),l.jsx("div",{className:Hs.artifactMeta,children:[mce(e.kind),s].filter(Boolean).join(" · ")})]}),l.jsx("div",{className:Hs.actions,children:l.jsx("button",{type:"button",className:Hs.reviewButton,onClick:t,title:e.title,children:n("common.open")})})]})})}function cZe({task:e,scheduleLabel:t,onOpen:n}){const{t:s}=lt();return l.jsx("div",{className:Hs.card,children:l.jsxs("div",{className:Hs.summary,children:[l.jsx("span",{className:Hs.icon,"aria-hidden":"true",children:l.jsx(dZe,{})}),l.jsxs("div",{className:Hs.artifactInfo,children:[l.jsx("div",{className:Hs.title,children:e.title}),l.jsx("div",{className:Hs.artifactMeta,children:[t,e.recurring?s("scheduledTasks.repeats"):s("scheduledTasks.runsOnce")].filter(Boolean).join(" · ")})]}),l.jsx("div",{className:Hs.actions,children:l.jsx("button",{type:"button",className:Hs.reviewButton,onClick:n,title:e.title,children:s("common.open")})})]})})}function uZe(){return l.jsxs("svg",{className:Hs.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 dZe(){return l.jsxs("svg",{className:Hs.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 hZe({open:e}){return l.jsx("svg",{className:[Hs.chevronIcon,e?Hs.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 fZe=h.memo(aZe);function mZe(e,t,n){if(!pZe(e)||!e.workspacePath)return;const s=t.find(r=>gce(r.path,e.workspacePath,n));if(s)return wce(s)}function wce(e){for(let t=e.diffs.length-1;t>=0;t--){const n=e.diffs[t];if(n!=null&&n.fullContent)return n.newText}}function pZe(e){var s,r;const t=((s=e.workspacePath)==null?void 0:s.toLowerCase())??"",n=((r=e.mimeType)==null?void 0:r.toLowerCase())??"";return e.kind==="html"||vce(t)||n==="text/html"||n==="text/markdown"}function vce(e){const t=e.toLowerCase();return t.endsWith(".html")||t.endsWith(".htm")||t.endsWith(".md")||t.endsWith(".markdown")}function O5(e,t){return HM(e,t)}const gZe="_wrap_16iog_1",bZe="_summary_16iog_5",yZe="_summaryTextActive_16iog_27",wZe="_summaryIcon_16iog_33",vZe="_summaryStatus_16iog_47",xZe="_summaryToolIcon_16iog_54",kZe="_summaryText_16iog_27",_Ze="_summaryDot_16iog_96",SZe="_chevronRight_16iog_100",CZe="_chevronDown_16iog_101",TZe="_group_16iog_161",EZe="_list_16iog_193",jZe="_row_16iog_199",AZe="_rowStats_16iog_221",NZe="_rowDesc_16iog_229",MZe="_rowTool_16iog_239",IZe="_detail_16iog_243",RZe="_track_16iog_249",DZe="_bar_16iog_257",PZe="_barRunning_16iog_265",LZe="_ruler_16iog_304",OZe="_tick_16iog_311",Ni={wrap:gZe,summary:bZe,summaryTextActive:yZe,summaryIcon:wZe,summaryStatus:vZe,summaryToolIcon:xZe,summaryText:kZe,summaryDot:_Ze,chevronRight:SZe,chevronDown:CZe,group:TZe,list:EZe,row:jZe,rowStats:AZe,rowDesc:NZe,rowTool:MZe,detail:IZe,track:RZe,bar:DZe,barRunning:PZe,ruler:LZe,tick:OZe};function xce(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 $Ze(e,t){if(e.length<2)return null;const n=[];for(const f of e){if(typeof f.startTime!="number")return null;n.push(f.startTime)}const s=e.map((f,m)=>f.status==="in_progress"?Math.max(t,n[m]):Math.max(f.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((f,m)=>{const p=Math.max((s[m]-n[m])/i,.02),g=Math.min((n[m]-r)/i,1-p);o.set(f.callId,{leftPct:g*100,widthPct:p*100,running:f.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(f=>f*c).find(f=>f<=a)??c,d=[];for(let f=0;d.length<4;f++){const m=f*u*1e3;if(m>i*.92)break;d.push({leftPct:m/i*100,label:xce(m)})}return{rows:o,ticks:d}}function BZe(e,t){const n=[],s=Rk(e.rawOutput),r=s==null?void 0:s.executionSummary,i=r&&typeof r.totalDurationMs=="number"?xce(r.totalDurationMs):Dk(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(hP(o));const a=dP(e);return a&&n.push(Do(a,80)),n.join(" · ")}function zZe(){return l.jsx("svg",{className:Ni.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 FZe({agents:e,pendingApproval:t}){const{t:n}=lt(),s=yP(),[r,i]=h.useState(!1),[o,a]=h.useState(null),[c,u]=h.useState(()=>Date.now()),d=h.useRef(Date.now()),f=e.some(x=>x.status==="in_progress");h.useEffect(()=>{f&&(d.current=Date.now(),u(Date.now()))},[f]),h.useEffect(()=>{if(!f)return;const x=setInterval(()=>u(Date.now()),1e3);return()=>clearInterval(x)},[f]);const m=f?Yle(c-d.current):"",p=e.filter(x=>x.status==="completed"||x.status==="failed").length,g=e.length,b=t!=null&&t.toolCallId?e.find(x=>Uu(x,t.toolCallId)):void 0,v=r||!!b,y=v?$Ze(e,c):null,w=e.some(x=>Ix(x)==="failed")?"failed":f?"in_progress":"completed";return l.jsxs("div",{className:Ni.wrap,children:[l.jsxs("button",{type:"button",className:Ni.summary,onClick:()=>i(x=>!x),"aria-expanded":v,title:n(v?"tool.collapseHint":"tool.expand"),children:[w==="failed"?l.jsx("span",{className:Ni.summaryStatus,children:l.jsx(sf,{status:w})}):l.jsx("span",{className:Ni.summaryIcon,"aria-hidden":"true",children:l.jsx(zZe,{})}),l.jsxs("span",{className:f?`${Ni.summaryText} ${Ni.summaryTextActive}`:Ni.summaryText,children:[n("parallelAgents.title"),m&&l.jsxs(l.Fragment,{children:[" ",m]}),l.jsx("span",{className:Ni.summaryDot,children:"·"}),n("parallelAgents.done",{done:p,total:g})]}),l.jsx("span",{className:v?Ni.chevronDown:Ni.chevronRight,"aria-hidden":"true"})]}),v&&l.jsxs("div",{className:Ni.group,children:[l.jsx("div",{className:Ni.list,children:e.map(x=>{const k=fP(x),C=R5(x),T=fWe(x,n),_=BZe(x,c),S=Ix(x),R=o===x.callId,A=y==null?void 0:y.rows.get(x.callId);return l.jsxs("div",{children:[l.jsxs("button",{type:"button",className:Ni.row,"aria-expanded":s?void 0:R,onClick:()=>{s?s.onOpen(x):a(R?null:x.callId)},children:[l.jsx(sf,{status:S}),l.jsxs("span",{className:Ni.rowDesc,children:[Do(C||k,50),T&&l.jsx("span",{className:Ni.rowTool,children:` (${T})`})]}),_&&l.jsx("span",{className:Ni.rowStats,children:_})]}),A&&l.jsx("div",{className:Ni.track,"aria-hidden":"true",children:l.jsx("span",{className:A.running?`${Ni.bar} ${Ni.barRunning}`:Ni.bar,style:{left:`${A.leftPct}%`,width:`${A.widthPct}%`}})}),!s&&R&&l.jsx("div",{className:Ni.detail,children:l.jsx(mP,{tool:x,hideHeader:!0})})]},x.callId)})}),y&&y.ticks.length>=2&&l.jsx("div",{className:Ni.ruler,"aria-hidden":"true",children:y.ticks.map(x=>l.jsx("span",{className:Ni.tick,style:{left:`${x.leftPct}%`},children:x.label},x.label))})]})]})}const HZe="_collapseRow_d7f01_1",qZe="_collapseRowClickable_d7f01_14",UZe="_collapseLabel_d7f01_19",WZe="_processedLabel_d7f01_36",VZe="_processedMeta_d7f01_43",GZe="_hiddenMetrics_d7f01_47",KZe="_summaryMetrics_d7f01_51",YZe="_collapseIcon_d7f01_59",XZe="_chevronRight_d7f01_72",QZe="_chevronDown_d7f01_73",Nu={collapseRow:HZe,collapseRowClickable:qZe,collapseLabel:UZe,processedLabel:WZe,processedMeta:VZe,hiddenMetrics:GZe,summaryMetrics:KZe,collapseIcon:YZe,chevronRight:XZe,chevronDown:QZe},JZe="_list_p1edz_1",ZZe="_listWithWelcomeHeader_p1edz_12",eet="_historyStatus_p1edz_32",tet="_virtualSizer_p1edz_48",net="_virtualRow_p1edz_57",set="_loadingSkeleton_p1edz_67",ret="_srOnly_p1edz_75",iet="_loadingSkeletonUserRow_p1edz_87",oet="_loadingSkeletonAssistantRow_p1edz_93",aet="_loadingSkeletonUserBubble_p1edz_99",cet="_loadingSkeletonUserBubbleCompact_p1edz_100",uet="_loadingSkeletonAssistantBlock_p1edz_114",det="_loadingSkeletonLineWide_p1edz_122",het="_loadingSkeletonLineMedium_p1edz_123",fet="_loadingSkeletonLineShort_p1edz_124",met="_loadingSkeletonLineNarrow_p1edz_125",pet="_turnStatusRow_p1edz_165",get="_turnAnswerRow_p1edz_166",bet="_turnContentRow_p1edz_177",yet="_sessionTimelineLayer_p1edz_181",wet="_sessionTimelinePanel_p1edz_194",vet="_sessionTimelineViewport_p1edz_205",xet="_sessionTimelineList_p1edz_246",ket="_sessionTimelineItem_p1edz_256",_et="_sessionTimelineButton_p1edz_261",Cet="_sessionTimelineTick_p1edz_280",Tet="_sessionTimelineButtonInRange_p1edz_367",Eet="_sessionTimelineButtonCurrent_p1edz_371",jet="_sessionTimelineDetails_p1edz_382",Aet="_sessionTimelineDetailsTitle_p1edz_416",Net="_sessionTimelineDetailsIcon_p1edz_423",Met="_sessionTimelineDetailsTitleText_p1edz_435",Iet="_sessionTimelineDetailsDetail_p1edz_445",Ms={list:JZe,listWithWelcomeHeader:ZZe,historyStatus:eet,virtualSizer:tet,virtualRow:net,loadingSkeleton:set,srOnly:ret,loadingSkeletonUserRow:iet,loadingSkeletonAssistantRow:oet,loadingSkeletonUserBubble:aet,loadingSkeletonUserBubbleCompact:cet,loadingSkeletonAssistantBlock:uet,loadingSkeletonLineWide:det,loadingSkeletonLineMedium:het,loadingSkeletonLineShort:fet,loadingSkeletonLineNarrow:met,turnStatusRow:pet,turnAnswerRow:get,turnContentRow:bet,sessionTimelineLayer:yet,sessionTimelinePanel:wet,sessionTimelineViewport:vet,sessionTimelineList:xet,sessionTimelineItem:ket,sessionTimelineButton:_et,sessionTimelineTick:Cet,sessionTimelineButtonInRange:Tet,sessionTimelineButtonCurrent:Eet,sessionTimelineDetails:jet,sessionTimelineDetailsTitle:Aet,sessionTimelineDetailsIcon:Net,sessionTimelineDetailsTitleText:Met,sessionTimelineDetailsDetail:Iet},xE=()=>{},Ret=12e4,kE=180;function Det(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 Pet(e){return e[e.length-1]}function Let(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&kg(n))return n.id}return null}function jW(e){return e.role==="tool_group"&&e.tools.length===1&&ty(e.tools[0])}function _E(e){return e.role==="tool_group"&&e.tools.length===1&&hf(e.tools[0])}function AW(e){return e.role==="thinking"}function NW(e,t){return e.role!=="tool_group"?!1:!!(t!=null&&t.toolCallId&&e.tools.some(n=>Uu(n,t.toolCallId)))}function MW(e){return e.role==="thinking"}function Oet(e,t){const n=[];let s=0;for(;s<e.length;){const r=e[s];if(r.role!=="tool_group"||NW(r,t)){MW(r)||n.push(r),s++;continue}const i=[r];let o=s,a=s+1;for(;a<e.length;){const u=e[a];if(MW(u)){a++;continue}if(u.role==="tool_group"&&!NW(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 kce(e){const t=[];let n=0;for(;n<e.length;){if(_E(e[n])){const s=[];let r=n;for(;r<e.length;){const i=e[r];if(_E(i)){s.push(i),r++;continue}if(AW(i)){let o=r+1;for(;o<e.length&&AW(e[o]);)o++;if(o<e.length&&_E(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(jW(e[n])){const s=n;for(;n<e.length&&jW(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 $et(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`msg:${e.key}`}function Bet(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))??[],f=(s==null?void 0:s.get(c))??[],m=(r==null?void 0:r.get(c))??[];d.length===0&&f.length===0&&m.length===0||i.push({type:"turn_outputs",key:c,turnId:c,changes:d,artifacts:f,scheduledTasks:m})};for(const c of e)c.type==="message"&&kg(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 zet(e,t){return e.type==="message"&&(e.message.role==="assistant"||t&&e.message.role==="system"&&e.message.source==="background_notification")&&!!e.message.content&&e.message.content.trim().length>0}function xP(e,t,n,s=!0){let r=t;for(let i=n;i>t;i--)if(ett(e[i])){r=i;break}for(let i=n;i>r;i--)if(zet(e[i],s))return i;return-1}function Fet(e,t){const n=[];for(let r=0;r<e.length;r++){const i=e[r];i.type==="message"&&kg(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=xP(e,i,o,!1);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 IW(e,t){if(e.type==="parallel_agents")return!0;if(e.type==="turn_outputs"||e.type==="turn_collapse")return!1;switch(e.message.role){case"tool_group":case"plan":return!0;case"assistant":return!t;case"thinking":return!0;case"system":return e.message.source==="background_notification"?!t:kP(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 kP(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 Het(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}:ng(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 kP(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 ng(e,t,n={}){const r=(n.stripMarkdown===!0?qet(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 qet(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=SE(s,"~~"),s=SE(s,"**"),s=SE(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 SE(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 Uet(e,t){const n=e.role==="user"?e.content:e.role==="user_shell"?e.command:"",s=ng(n,32);return s||(t?t("timeline.userTurn"):"User turn")}function Wet(e){return e.role==="user"&&(e.source==="cron"||e.source==="loop")}function kg(e){return e.role==="user"||e.role==="user_shell"}function Vet(e,t){switch(e.role){case"thinking":return t?t("timeline.kind.thought"):"thinking";case"assistant":return ng(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 kP(e)?ng(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 Get(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"?"":Vet(e.message,t)}function Ket(e,t){return t?t(`timeline.kind.${e}`):Stt[e]}function Yet(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=ng(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=Get(a,s);c&&r.push(c)}const i=ng(r.join(" · "),180);return i||(n.length>0?n.map(o=>Ket(o,s)).join(" · "):s?s("timeline.noActivity"):"No activity")}function Xet(e,t){const n=[];let s=null,r=[];const i=()=>{if(!s)return;const o=kce(r),a=xP(o,-1,o.length-1,!1),c=a>=0?o[a]:null,u=(c==null?void 0:c.type)==="message"&&c.message.role==="assistant"&&!c.message.isStreaming&&ng(c.message.content,1,{stripMarkdown:!0}).length>0?c.message.id:null,d=[];for(const f of o){if(f.type==="message"&&u!==null&&f.message.id===u)continue;const m=Het(f,t);m.kind!=="none"&&!d.includes(m.kind)&&d.push(m.kind)}n.push({id:s.id,label:Uet(s,t),detail:Yet(o,u,d,t),timestamp:s.timestamp,nodeKinds:d,...Wet(s)?{isScheduledTask:!0}:{}})};for(const o of e){if(kg(o)){i(),s=o,r=[];continue}s&&r.push(o)}return i(),n}function Qet(){return l.jsxs("svg",{className:Ms.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 Jet(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 Zet(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(Jet).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 ett(e){return e.type==="parallel_agents"?!0:e.type==="turn_outputs"||e.type==="turn_collapse"?!1:e.message.role==="tool_group"||e.message.role==="plan"}function RW(e){return e==="pending"||e==="running"||e==="in_progress"}function ttt(e){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=>RW(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=>RW(n.status));return t.length===0?null:`tools:${e.message.id}:${t.map(n=>n.callId).join(",")}`}function ntt(e){for(let t=e.length-1;t>=0;t--){const n=ttt(e[t]);if(n)return n}return null}function stt(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 rtt(e){return e.type==="message"&&e.message.role==="system"&&e.message.source==="turn_error"}function itt(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 ott(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function CE(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0}function DW(e){if(e.parentToolCallId||!ty(e))return;const t=e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0,n=t!=null&&t.executionSummary&&typeof t.executionSummary=="object"?t.executionSummary:void 0,s=CE(n==null?void 0:n.inputTokens),r=CE(n==null?void 0:n.outputTokens);if(s===void 0&&r===void 0)return;const i=CE(n==null?void 0:n.cachedTokens);return{callId:e.callId,usage:{inputTokens:s??0,outputTokens:r??0,...i!==void 0?{cachedTokens:i}:{}}}}function att(e){return e.type==="parallel_agents"?e.agents.flatMap(t=>DW(t)??[]):e.type!=="message"||e.message.role!=="tool_group"?[]:e.message.tools.flatMap(t=>DW(t)??[])}function ltt(e){return e.type==="parallel_agents"?e.agents.length:e.type==="turn_outputs"||e.type==="turn_collapse"?0:e.message.role==="tool_group"?e.message.tools.length:0}function _ce(e,t){for(let n=Math.min(t,e.length-1);n>=0;n--){const s=e[n];if(s.type==="message"&&kg(s.message))return s.message.id}return null}function Sce(e){const t=[];let n=null;for(const s of e)s.type==="message"&&kg(s.message)&&(n=s.message.id),t.push(n);return t}function PW(e,t,n,s){const r=s===void 0?_ce(e,t):s[t]??null;return r?n.get(r)??null:null}function ctt(e,t,n,s,r=Sce(e)){let i=Number.POSITIVE_INFINITY,o=-1;for(const c of t){if(c<0||c>=e.length)continue;const u=PW(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:PW(e,s,n,r);return{startIndex:i,endIndex:o,currentIndex:a!==null&&a>=i&&a<=o?a:o}}function utt(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=>Uu(o,s)))return!0}else if(i.type==="message"&&i.message.role==="tool_group"&&i.message.tools.some(o=>Uu(o,s)))return!0}return!1}function dtt(e,{overrides:t,isResponding:n,activeTurnStartedAt:s,pendingApprovalCallId:r,includeSubagentToolUsageInMetrics:i=!0,enabled:o}){if(!o||e.length===0)return e;const a=[];for(let u=0;u<e.length;u++){const d=e[u];d.type==="message"&&kg(d.message)&&a.push(u)}if(a.length===0)return e;const c=[];for(let u=0;u<a[0];u++)c.push(e[u]);for(let u=0;u<a.length;u++){const d=a[u],f=(u+1<a.length?a[u+1]:e.length)-1,m=e[d],p=m.message.id,g=m.message.timestamp,b=u===a.length-1&&n,v=utt(e,d,f,r),y=xP(e,d,f);let w=0,x,k,C=0,T=0,_=0,S=0,R=0,A=!1;const O=new Set;let M=!1;for(let J=d+1;J<=f;J++){const W=e[J];IW(W,J===y)&&w++,rtt(W)&&(M=!0),S+=ltt(W),W.type==="message"&&W.message.role==="thinking"&&R++;const V=stt(W);V!==void 0&&(x=x===void 0?V:Math.max(x,V));const ee=itt(W);ee!==void 0&&(k=k===void 0?ee:Math.max(k,ee));const q=ott(W);if(q&&(C+=q.inputTokens,T+=q.outputTokens,_+=q.cachedTokens??0,A=!0),i)for(const K of att(W))O.has(K.callId)||(O.add(K.callId),C+=K.usage.inputTokens,T+=K.usage.outputTokens,_+=K.usage.cachedTokens??0,A=!0)}const D=b?s??g??Date.now():void 0,$=x??k,z=g!==void 0&&$!==void 0&&$>=g?$-g:void 0;if(v||w===0&&!(A||z!==void 0||D!==void 0)){for(let J=d;J<=f;J++)c.push(e[J]);continue}const j=b||M||y<0,Q=!(w===0?!0:t.has(p)?t.get(p):j);c.push({type:"message",key:m.key,message:m.message});const I={turnId:p,collapsed:Q,hiddenCount:w,...z!==void 0?{elapsedMs:z}:{},...A?{inputTokens:C,outputTokens:T}:{},..._>0?{cachedTokens:_}:{},...S>0?{toolCallCount:S}:{},...R>0?{thinkingCount:R}:{},...D!==void 0?{liveStartedAt:D}:{}};if(c.push({type:"turn_collapse",key:`tc-${p}`,turnCollapse:I}),!Q){for(let J=d+1;J<=f;J++){const W=e[J];J===y&&W.type==="message"&&W.message.role==="assistant"?c.push({...W,turnCollapse:I}):c.push(W)}continue}for(let J=d+1;J<=f;J++){const W=e[J];if(!(J===y&&b)){if(J===y&&W.type==="message"&&W.message.role==="assistant"){c.push({...W,turnCollapse:I});continue}IW(W,J===y)||c.push(W)}}}return c}function TE(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=>Uu(i,n)))return s}else{if(r.type==="parallel_agents"&&n&&r.agents.some(i=>Uu(i,n)))return s;if(r.type==="turn_outputs")continue}}return-1}function LW(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=>Uu(s,n)):e.type==="parallel_agents"?!!n&&e.agents.some(s=>Uu(s,n)):(e.type==="turn_outputs",!1)}const EE=0,htt=120,ftt=80,mtt=32,ptt=240,i2=30,OW=48,Cce=200,gtt=4;function btt(e,t=Cce){return e>t}function ytt(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 jE(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function wtt(e){return e!==void 0&&e>0?ytt(e):""}function vtt(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";const n=e.cachedTokens??0,s=n>0&&e.inputTokens>0?` (${jE(n)} ${t("turn.cached")}, ${Math.round(n/e.inputTokens*100)}%)`:"";return`↑${jE(e.inputTokens)}${s} ↓${jE(e.outputTokens)}`}function $W(e,t){const n=[],s=vtt(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 xtt(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}const ktt=h.memo(function({turnCollapse:t,onToggleCollapse:n}){const{t:s}=lt(),r=t.hiddenCount>0,i=t.liveStartedAt,o=r||i!==void 0||xtt(t),a=bP(i!==void 0&&o),c=h.useRef(0),u=h.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 f=wtt(d),m=$W(t,s),p=$W(t,s),g=s(i!==void 0?"turn.processing":"turn.processed"),b=!!f&&o,v=!!m&&o,y=!!p&&o;if(!o)return null;const w=()=>{if(!r)return;const x=t.collapsed;n(t.turnId,x)};return l.jsxs("div",{className:r?`${Nu.collapseRow} ${Nu.collapseRowClickable}`:Nu.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?w:void 0,onKeyDown:r?x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),w())}:void 0,children:[l.jsxs("span",{className:Nu.collapseLabel,children:[l.jsxs("span",{className:Nu.processedLabel,children:[g,b&&l.jsxs("span",{className:Nu.processedMeta,children:[" ",f]})]}),y&&l.jsx("span",{className:Nu.summaryMetrics,children:p}),v&&l.jsx("span",{className:Nu.hiddenMetrics,children:m})]}),r&&l.jsx("span",{"data-testid":`toggle-${t.turnId}`,className:Nu.collapseIcon,onClick:x=>{x.stopPropagation(),w()},children:l.jsx("span",{className:t.collapsed?Nu.chevronRight:Nu.chevronDown,"aria-hidden":"true"})})]})});function _tt(e){if(e.type==="turn_collapse")return Ms.turnStatusRow;if(e.type==="turn_outputs")return Ms.turnContentRow;if(e.type==="message"&&e.turnCollapse)return Ms.turnAnswerRow}const Stt={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},Ctt=["--background","--foreground","--muted-foreground","--border","--font-sans"],BW="session-timeline-detail-tooltip",Ttt=h.memo(function({entries:t,currentTurnId:n,currentRange:s,hidden:r,onSelect:i}){const o=_u(),{t:a}=lt(),c=h.useRef(null),u=h.useRef(null),d=h.useRef(null),f=h.useRef(!1),m=h.useRef(!1),p=h.useRef(null),g=h.useRef(null),[b,v]=h.useState(null),y=s!==null?s.currentIndex:t.findIndex(A=>A.id===n),w=h.useCallback(()=>v(null),[]),x=h.useCallback(()=>{f.current||m.current||w()},[w]),k=h.useCallback((A,O)=>{const M=c.current;if(!M)return null;const D=getComputedStyle(M),$=O.getBoundingClientRect();return{entry:A,top:$.top+$.height/2,left:$.right+8,clamped:!1,themeVars:Object.fromEntries(Ctt.map(z=>[z,D.getPropertyValue(z)]))}},[]),C=h.useCallback(A=>{const O=u.current;if(!O)return null;const M=Array.from(O.querySelectorAll('[data-testid="session-timeline-entry"]')).find(D=>D.getAttribute("data-turn-id")===A.id);return(M==null?void 0:M.querySelector("button"))??null},[]),T=h.useCallback(A=>{const O=u.current;if(!O)return!1;const M=O.getBoundingClientRect(),D=A.getBoundingClientRect();return D.bottom>=M.top&&D.top<=M.bottom},[]),_=h.useCallback(()=>{v(A=>{if(!A)return null;const O=C(A.entry);return!O||!T(O)?null:k(A.entry,O)})},[k,C,T]),S=h.useCallback((A,O)=>{v(k(A,O))},[k]),R=h.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,_()}),g.current=window.setTimeout(()=>{g.current=null,m.current=!1},100))},[_]);return h.useLayoutEffect(()=>{if(r)return;const A=u.current;if(!A||y<0)return;const O=A.querySelector(`[data-timeline-index="${y}"]`);if(!O)return;const M=O.offsetTop+O.offsetHeight/2,D=A.scrollHeight-A.clientHeight,$=Math.max(0,Math.min(M-A.clientHeight/2,D));if(A.scrollTop===$)return;f.current=!0,A.scrollTop=$;const z=window.requestAnimationFrame(()=>{f.current=!1,_()}),B=window.setTimeout(()=>{f.current=!1},100);return()=>{window.cancelAnimationFrame(z),window.clearTimeout(B),f.current=!1}},[y,r,_]),h.useLayoutEffect(()=>{if(!(!b||typeof window>"u"))return window.addEventListener("resize",_),()=>{window.removeEventListener("resize",_)}},[_,b]),h.useLayoutEffect(()=>()=>{p.current!==null&&window.cancelAnimationFrame(p.current),g.current!==null&&window.clearTimeout(g.current),m.current=!1},[]),h.useLayoutEffect(()=>{if(!b||b.clamped)return;const A=c.current,O=d.current;if(!A||!O||typeof window>"u")return;const M=O.getBoundingClientRect(),D=12;let $=b.top;M.top<D?$+=D-M.top:M.bottom>window.innerHeight-D&&($-=M.bottom-(window.innerHeight-D)),$!==b.top&&v(z=>(z==null?void 0:z.entry.id)===b.entry.id?{...z,top:$,clamped:!0}:z)},[b]),r||t.length===0?null:l.jsx("div",{className:Ms.sessionTimelineLayer,"aria-hidden":"false",children:l.jsxs("nav",{ref:c,className:Ms.sessionTimelinePanel,"aria-label":a("timeline.sessionTimeline"),"data-testid":"session-timeline",onMouseLeave:w,children:[l.jsx("div",{ref:u,className:Ms.sessionTimelineViewport,"data-testid":"session-timeline-viewport",onScroll:x,children:l.jsx("ol",{className:Ms.sessionTimelineList,children:t.map((A,O)=>{const M=s!==null&&O>=s.startIndex&&O<=s.endIndex,D=s!==null?O===s.currentIndex:A.id===n,$=A.nodeKinds.join(","),z=[`${a("timeline.turnPrefix",{index:O+1})}: ${A.label}`,D?a("timeline.currentTurn"):null].filter(Boolean).join(". "),B=Q=>S(A,Q.currentTarget),j=Q=>{R(),S(A,Q.currentTarget)},H=(b==null?void 0:b.entry.id)===A.id;return l.jsx("li",{className:Ms.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":A.id,"data-timeline-index":O,"data-node-kinds":$,"data-in-current-range":M?"true":void 0,children:l.jsx("button",{type:"button",className:qM(Ms.sessionTimelineButton,M?Ms.sessionTimelineButtonInRange:void 0,D?Ms.sessionTimelineButtonCurrent:void 0),"aria-current":D?"step":void 0,"aria-describedby":H?BW:void 0,"aria-label":z,onClick:()=>i(A.id),onFocus:j,onBlur:w,onMouseEnter:B,onMouseLeave:w,children:l.jsx("span",{className:Ms.sessionTimelineTick})})},A.id)})})}),b&&typeof document<"u"&&Wu.createPortal(l.jsxs("div",{ref:d,className:Ms.sessionTimelineDetails,id:BW,"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:Ms.sessionTimelineDetailsTitle,children:[b.entry.isScheduledTask&&l.jsx(Qet,{}),l.jsx("span",{className:Ms.sessionTimelineDetailsTitleText,children:b.entry.label})]}),l.jsx("span",{className:Ms.sessionTimelineDetailsDetail,children:b.entry.detail})]}),o??document.body)]})})});function qM(...e){return e.filter(Boolean).join(" ")||void 0}const Ett=[];function jtt({label:e}){return l.jsxs(l.Fragment,{children:[l.jsx("div",{role:"status","aria-live":"polite",className:Ms.srOnly,children:e}),l.jsxs("div",{className:Ms.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[l.jsx("div",{className:Ms.loadingSkeletonUserRow,children:l.jsxs("div",{className:Ms.loadingSkeletonUserBubble,children:[l.jsx("span",{className:Ms.loadingSkeletonLineWide}),l.jsx("span",{className:Ms.loadingSkeletonLineShort})]})}),l.jsx("div",{className:Ms.loadingSkeletonAssistantRow,children:l.jsxs("div",{className:Ms.loadingSkeletonAssistantBlock,children:[l.jsx("span",{className:Ms.loadingSkeletonLineMedium}),l.jsx("span",{className:Ms.loadingSkeletonLineWide}),l.jsx("span",{className:Ms.loadingSkeletonLineNarrow})]})}),l.jsx("div",{className:Ms.loadingSkeletonUserRow,children:l.jsx("div",{className:Ms.loadingSkeletonUserBubbleCompact,children:l.jsx("span",{className:Ms.loadingSkeletonLineMedium})})}),l.jsx("div",{className:Ms.loadingSkeletonAssistantRow,children:l.jsxs("div",{className:Ms.loadingSkeletonAssistantBlock,children:[l.jsx("span",{className:Ms.loadingSkeletonLineWide}),l.jsx("span",{className:Ms.loadingSkeletonLineMedium})]})})]})]})}const _P=h.memo(h.forwardRef(function({messages:t,pendingApproval:n,onShowContextDetail:s,loadingTranscript:r,catchingUp:i,hasOlderHistory:o=!1,loadingOlderHistory:a=!1,historyCapacityReached:c=!1,historyPaginationError:u=!1,onLoadOlderHistory:d,transcriptBlockCount:f=0,transcriptActivity:m,onReloadTranscript:p,isResponding:g=!1,activeTurnStartedAt:b,welcomeHeader:v,centerWelcomeHeader:y=!1,workspaceCwd:w,tailContent:x,tailKey:k="tail",virtualScrollThreshold:C=Cce,autoScrollTailIntoView:T=!1,bottomOverlayInset:_=0,hideSessionTimeline:S=!1,hideFirstUserMessage:R=!1,firstTurnMetrics:A,includeSubagentToolUsageInMetrics:O=!0,showRetryHint:M=!1,onRetryClick:D,onBranchSession:$,onCanScrollToBottomChange:z,turnFileChanges:B,turnArtifacts:j,turnScheduledTasks:H,onReviewChanges:Q,onOpenArtifact:I,onOpenScheduledTask:J,onTurnOutputOpen:W,generateContent:P},V){var Kr;const{t:ee}=lt(),q=h.useContext(sg),K=h.useMemo(()=>q?Oet(t,n):t,[q,t,n]),de=h.useMemo(()=>Bet(kce(K),g,B,j,H),[K,g,B,j,H]),[re,ne]=h.useState(!1),U=h.useRef(null),Z=h.useMemo(()=>{var Je,qt;if(!re)return Ett;const _e=Zet(K);return(((Je=U.current)==null?void 0:Je.signature)!==_e||((qt=U.current)==null?void 0:qt.t)!==ee)&&(U.current={signature:_e,t:ee,entries:Xet(K,ee)}),U.current.entries},[re,K,ee]),ge=h.useMemo(()=>new Map(Z.map((_e,Je)=>[_e.id,Je])),[Z]),ce=h.useMemo(()=>Let(K),[K]),[ue,be]=h.useState(null),rt=ue!==null?((Kr=Z[ue.currentIndex])==null?void 0:Kr.id)??ce:ce,le=h.useMemo(()=>{var _e;if(g)return null;for(let Je=K.length-1;Je>=0;Je-=1){const qt=K[Je];if(qt&&(qt.role==="tool_group"||qt.role==="plan"))return null;if((qt==null?void 0:qt.role)==="assistant"&&!qt.isStreaming&&((_e=qt.content)!=null&&_e.trim()))return qt.id}return null},[g,K]),Me=h.useMemo(()=>Fet(de,g),[de,g]),{collapseCompletedTurns:We}=ku(),at=We??!0,[ze,rn]=h.useState(()=>new Map),[Wt,zt]=h.useTransition(),ae=h.useRef(!1),je=h.useRef(new Map),it=h.useRef(void 0),gt=h.useRef([]),wt=h.useRef(!0),Ke=h.useRef(!1),un=h.useRef(0),me=h.useRef(0),ht=h.useRef(!1),Oe=h.useRef(!1),Ne=h.useRef(0),St=h.useRef(null),Ue=h.useRef(null),ve=h.useRef(!1),Fe=h.useRef(null),ie=h.useRef(!1),Pe=h.useRef(r),et=h.useRef(!!r),He=h.useRef(void 0),Ae=h.useRef(void 0),vt=h.useRef(_),vn=h.useRef(null),Ce=h.useRef(i),yt=h.useRef(i),Ft=h.useRef(!1),De=h.useRef(!1),Xe=h.useRef(void 0),$e=h.useRef(void 0);yt.current=i;const Ht=h.useRef(null),ke=h.useRef(!1),Fn=h.useRef(void 0),Ve=h.useRef(void 0),ft=h.useRef(void 0),Lt=h.useRef(f),gn=h.useRef(g);Lt.current=f,gn.current=g;const Tn=h.useRef(null),[Xn,_r]=h.useState(null),[zr,Ar]=h.useState(!1);h.useLayoutEffect(()=>{if(!Xn)return;const _e=Ht.current;_e&&(_e.scrollTop=Xn.scrollTop+Math.max(0,_e.scrollHeight-Xn.scrollHeight)),ht.current=!1,_r(null)},[Xn]),h.useEffect(()=>{o||(ke.current=!1,Tn.current=null)},[o]);const jt=h.useCallback(()=>{const _e=Ht.current,Je=_e?_e.scrollHeight-_e.scrollTop-_e.clientHeight:0,qt=!wt.current&&Je>1;Ue.current!==qt&&(Ue.current=qt,z==null||z(qt))},[z]),Sn=h.useCallback(()=>{$e.current!==void 0&&window.cancelAnimationFrame($e.current),$e.current=window.requestAnimationFrame(jt)},[jt]),Hn=h.useCallback(_e=>{wt.current!==_e&&(wt.current=_e,Sn())},[Sn]),Ln=h.useMemo(()=>{var on;const _e=dtt(de,{overrides:ze,isResponding:g,activeTurnStartedAt:b,pendingApprovalCallId:(n==null?void 0:n.toolCallId)??null,includeSubagentToolUsageInMetrics:O,enabled:at});let Je=!1;const qt=A?_e.map(Le=>Je||Le.type!=="turn_collapse"?Le:(Je=!0,{...Le,turnCollapse:{...Le.turnCollapse,...A.durationMs!==void 0&&A.durationMs>0?{elapsedMs:A.durationMs}:{},...A.inputTokens!==void 0?{inputTokens:A.inputTokens}:{},...A.outputTokens!==void 0?{outputTokens:A.outputTokens}:{},...A.cachedTokens!==void 0?{cachedTokens:A.cachedTokens}:{}}})):_e;if(!R)return qt;const On=(on=K.find(Le=>Le.role==="user"))==null?void 0:on.id;return On?qt.filter(Le=>Le.type!=="message"||Le.message.id!==On):qt},[de,ze,g,b,n==null?void 0:n.toolCallId,at,R,A,O,K]),gs=h.useMemo(()=>Sce(Ln),[Ln]),qn=Z.length>=gtt;h.useLayoutEffect(()=>{if(S){ne(On=>On&&!1);return}const _e=Ht.current;if(!_e)return;const Je=()=>{const on=_e.getBoundingClientRect().width>=1160;ne(Le=>Le===on?Le:on)};if(Je(),typeof ResizeObserver>"u")return;const qt=new ResizeObserver(Je);return qt.observe(_e),()=>qt.disconnect()},[S]);const Dn=x!=null,Rs=!!r,ts=!!v,Bs=ts?1:0,Sr=Bs+Ln.length,Nr=Sr+(Dn?1:0),pi=Bs+de.length+(Dn?1:0),lr=btt(pi,C),Ds=h.useCallback(()=>Ht.current,[]),gi=h.useCallback(()=>{const _e=Ht.current;if(!_e)return;const qt=_e.scrollHeight-_e.scrollTop-_e.clientHeight<i2;Ke.current=!qt,Hn(qt),Sn()},[Sn,Hn]),xe=h.useCallback(()=>{un.current=Date.now()+1e3},[]),Ye=h.useCallback(()=>{Fn.current!==void 0&&(window.clearTimeout(Fn.current),Fn.current=void 0)},[]),st=h.useCallback(()=>{var _e;Ye(),(_e=Ve.current)==null||_e.abort(),Ve.current=void 0},[Ye]),Et=h.useCallback(()=>{Ye();const _e=ft.current;if(_e){if((m==null?void 0:m.getSnapshot().lastEventId)===_e.lastEventId&&Lt.current<=_e.blockCount)return;ft.current=void 0}!p||Ve.current!==void 0||Ke.current||gn.current||Lt.current<=Hwe||(Fn.current=window.setTimeout(()=>{Fn.current=void 0;const Je=Ht.current;if(!Je||Je.scrollHeight-Je.scrollTop-Je.clientHeight>=i2)return;const On=new AbortController;Ve.current=On,p(On.signal).then(()=>{var Le;if(On.signal.aborted)return;const on=m==null?void 0:m.getSnapshot();ft.current={...(on==null?void 0:on.lastEventId)!==void 0?{lastEventId:on.lastEventId}:{},blockCount:((Le=on==null?void 0:on.blocks)==null?void 0:Le.length)??Lt.current}}).catch(on=>{on instanceof Error&&on.name==="AbortError"||console.warn("[MessageList] transcript reload failed:",on)}).finally(()=>{Ve.current===On&&(Ve.current=void 0)})},Ret))},[Ye,p,m]);h.useEffect(()=>{ft.current=void 0},[m]),h.useEffect(()=>{if(!m)return st;let _e=m.getSnapshot().lastEventId;const Je=m.subscribe(()=>{const qt=m.getSnapshot().lastEventId;qt!==_e&&(_e=qt,Et())});return()=>{Je(),st()}},[m,Et,st]),h.useEffect(()=>{Et()},[g,Et,f]);const Mt=h.useCallback(()=>{De.current=!0,Xe.current!==void 0&&window.cancelAnimationFrame(Xe.current),Xe.current=window.requestAnimationFrame(()=>{De.current=!1,Xe.current=void 0,gi()})},[gi]);h.useEffect(()=>()=>{Xe.current!==void 0&&window.cancelAnimationFrame(Xe.current),$e.current!==void 0&&window.cancelAnimationFrame($e.current),st(),He.current!==void 0&&window.cancelAnimationFrame(He.current),Ae.current!==void 0&&window.cancelAnimationFrame(Ae.current)},[st]);const cs=h.useCallback((_e,Je)=>{var On;const qt=Ht.current;(!qt||qt.scrollHeight>qt.clientHeight+1)&&(Ke.current=!0,Hn(!1)),Mt(),it.current!==void 0&&window.clearTimeout(it.current),je.current.clear(),(On=Ht.current)==null||On.querySelectorAll("[data-message-row-key]").forEach(on=>{const Le=on.dataset.messageRowKey;Le&&je.current.set(Le,on.getBoundingClientRect().top)}),ae.current=!0,zt(()=>{rn(on=>{const Le=new Map(on);return Le.set(_e,Je),Le})})},[Mt,Hn]);h.useLayoutEffect(()=>{var Je;if(Wt||!ae.current)return;ae.current=!1;for(const qt of gt.current)qt.cancel();gt.current=[];const _e=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;_e||(Je=Ht.current)==null||Je.querySelectorAll("[data-message-row-key]").forEach(qt=>{if(typeof qt.animate!="function")return;const On=qt.dataset.messageRowKey,on=On?je.current.get(On):void 0;if(on===void 0){gt.current.push(qt.animate([{opacity:0},{opacity:1}],{duration:kE,easing:"ease-out"}));return}const Le=on-qt.getBoundingClientRect().top;Math.abs(Le)<1||gt.current.push(qt.animate([{translate:`0 ${Le}px`},{translate:"0 0"}],{duration:kE,easing:"ease-out"}))}),je.current.clear(),it.current=window.setTimeout(()=>{it.current=void 0,Mt()},_e?0:kE)},[Mt,Wt]),h.useEffect(()=>()=>{it.current!==void 0&&window.clearTimeout(it.current);for(const _e of gt.current)_e.cancel();gt.current=[]},[]);const bs=h.useCallback(_e=>{const Je=_e.target;Je instanceof HTMLElement&&Je.closest("[aria-expanded]")&&(Ke.current=!0,Hn(!1),Mt())},[Mt,Hn]),sr=h.useCallback(_e=>{if(ts&&_e===EE)return"slot:header";if(Dn&&_e===Sr)return`slot:tail:${k}`;const Je=Ln[_e-Bs];return Je?$et(Je):`slot:row:${_e}`},[ts,Dn,Sr,k,Ln,Bs]),Qn=h.useCallback((_e="auto")=>{const Je=Ds();if(!Je||Je.scrollHeight<=Je.clientHeight)return;Ne.current+=1;const qt=Ne.current;Oe.current=!0,_e==="smooth"?Je.scrollTo({top:Je.scrollHeight,behavior:_e}):Je.scrollTop=Je.scrollHeight,Sn(),me.current=Math.max(0,Je.scrollHeight-Je.clientHeight),jt();const On=()=>{Ne.current===qt&&(Oe.current=!1)};_e==="smooth"?setTimeout(On,350):requestAnimationFrame(On)},[Ds,jt,Sn]),br=h.useCallback((_e="smooth")=>{Ke.current=!1,Hn(!0),Qn(_e)},[Qn,Hn]),Ns=ave({count:Nr,enabled:lr,getScrollElement:Ds,getItemKey:sr,estimateSize:_e=>{if(ts&&_e===EE)return htt;if(Dn&&_e===Sr)return ptt;const Je=Ln[_e-Bs];return(Je==null?void 0:Je.type)==="turn_collapse"?mtt:ftt},overscan:20,useFlushSync:!1,useAnimationFrameWithResizeObserver:!0}),Fr=Ns.getVirtualItems(),yr=Ns.getTotalSize(),Mr=h.useRef({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});Mr.current={entryIndexById:ge,headerOffset:Bs,isVisible:re,turnIdByDisplayIndex:gs,visibleItems:Ln};const Pn=h.useCallback(()=>{const _e=Ds(),Je=Mr.current;if(!_e||!Je.isVisible||Je.entryIndexById.size===0){be(ns=>ns===null?ns:null);return}const qt=_e.getBoundingClientRect(),On=qt.top,on=qt.bottom,Le=On+(on-On)/2,Qt=[];let Un=null,Kn=Number.POSITIVE_INFINITY;_e.querySelectorAll("[data-index]").forEach(ns=>{const si=ns.dataset.index;if(si===void 0)return;const Ys=Number(si);if(!Number.isFinite(Ys))return;const Ps=Ys-Je.headerOffset;if(Ps<0||Ps>=Je.visibleItems.length)return;const Xs=ns.getBoundingClientRect();if(Xs.bottom<On||Xs.top>on)return;Qt.push(Ps);const Ai=Xs.top+(Xs.bottom-Xs.top)/2,oo=Math.abs(Ai-Le);oo<Kn&&(Kn=oo,Un=Ps)});const zs=ctt(Je.visibleItems,Qt,Je.entryIndexById,Un,Je.turnIdByDisplayIndex);be(ns=>(ns==null?void 0:ns.startIndex)===(zs==null?void 0:zs.startIndex)&&(ns==null?void 0:ns.endIndex)===(zs==null?void 0:zs.endIndex)&&(ns==null?void 0:ns.currentIndex)===(zs==null?void 0:zs.currentIndex)?ns:zs)},[Ds]),Gs=h.useCallback(()=>{St.current!==null&&cancelAnimationFrame(St.current),St.current=requestAnimationFrame(()=>{St.current=null,Pn()})},[Pn]);h.useEffect(()=>()=>{St.current!==null&&(cancelAnimationFrame(St.current),St.current=null)},[]),h.useEffect(()=>{Gs()},[Gs,Nr,yr,lr,Fr.length,re]);const[vo,Ks]=h.useState(null);h.useEffect(()=>{if(!vo)return;const _e=setTimeout(()=>Ks(null),1600);return()=>clearTimeout(_e)},[vo]);const bi=h.useCallback((_e,Je)=>{var On,on;Ke.current=!0,Hn(!1),Ne.current+=1;const qt=Ne.current;Oe.current=!0,lr?Ns.scrollToIndex(_e,{align:"center"}):(on=(On=Ht.current)==null?void 0:On.querySelector(`[data-index="${_e}"]`))==null||on.scrollIntoView({block:"center"}),setTimeout(()=>{Ne.current===qt&&(Oe.current=!1,Gs(),Sn())},150),Ks(null),requestAnimationFrame(()=>Ks(Je))},[lr,Ns,Hn,Gs,Sn]),Jn=h.useRef({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});Jn.current={visibleItems:Ln,displayItems:de,headerOffset:Bs,performScrollToRow:bi};const xi=h.useRef(null),qs=h.useCallback((_e,Je)=>{const{visibleItems:qt,displayItems:On,headerOffset:on,performScrollToRow:Le}=Jn.current,Qt=TE(qt,_e,Je);if(Qt>=0)return xi.current=null,Le(Qt+on,{messageId:_e,callId:Je}),!0;const Un=TE(On,_e,Je);if(Un<0)return!1;const Kn=_ce(On,Un);return Kn?(xi.current={messageId:_e,callId:Je},rn(zs=>{if(zs.get(Kn)===!0)return zs;const ns=new Map(zs);return ns.set(Kn,!0),ns}),!0):!1},[]);h.useImperativeHandle(V,()=>({scrollToMessage:qs,scrollToBottom:br}),[qs,br]),h.useEffect(()=>{const _e=xi.current;if(!_e)return;const Je=TE(Ln,_e.messageId,_e.callId);Je<0||(xi.current=null,bi(Je+Bs,_e))},[Ln,Bs,bi]);const wr=h.useCallback(async(_e=!1)=>{const Je=Ht.current;if(!Je||!d||a||ht.current||u||ke.current&&!_e)return;ke.current=!1,ht.current=!0,Ar(!_e);const qt=Je.scrollHeight,On=Je.scrollTop;Ke.current=!0;try{await d(),_r({scrollHeight:qt,scrollTop:On})}catch{ke.current=!0,ht.current=!1}finally{Ar(!1)}},[a,d,u]),Hr=h.useCallback(()=>{const _e=Ds();if(!_e)return;const Je=_e.scrollTop;if(o&&Je<=OW&&wr(!0),Oe.current){me.current=Je;return}Gs();const qt=me.current;me.current=Je;const On=_e.scrollHeight-Je-_e.clientHeight;if(Sn(),Je<qt-1){const on=On<i2,Le=Date.now()<=un.current;on?(Ke.current=!1,Hn(!0)):Le?(st(),Ke.current=!0,Hn(!1)):Ke.current||(st(),Hn(!1));return}On<i2?(Ke.current=!1,Hn(!0),Et()):st()},[Ds,o,wr,Sn,Gs,Et,st,Hn]);h.useEffect(()=>{const _e=Ds();if(_e)return _e.addEventListener("scroll",Hr,{passive:!0}),()=>_e.removeEventListener("scroll",Hr)},[Ds,Hr]);const Ir=h.useCallback(()=>{if(!o||a||i||Rs)return;const _e=Ds();if(!_e||_e.scrollHeight>_e.clientHeight+1)return;const Je=Tn.current;if(Je!==null&&Je.loader===d&&Je.totalVirtualSize===yr){ke.current=!0;return}Tn.current={loader:d,totalVirtualSize:yr},wr()},[i,Ds,o,wr,a,d,Rs,yr]);h.useEffect(()=>{Ir()},[Ir,yr]),h.useEffect(()=>{const _e=Ds();if(!_e)return;const Je=()=>{ke.current&&_e.scrollTop<=OW&&wr(!0)},qt=Qt=>{xe(),Qt.deltaY<0&&Je()},On=()=>{xe(),Je()},on=Qt=>{const Un=_e.getBoundingClientRect(),Kn=20;(Qt.clientX>=Un.right-Kn||Qt.clientY>=Un.bottom-Kn)&&xe()},Le=Qt=>{(Qt.key==="ArrowUp"||Qt.key==="ArrowDown"||Qt.key==="PageUp"||Qt.key==="PageDown"||Qt.key==="Home"||Qt.key==="End"||Qt.key===" ")&&(xe(),(Qt.key==="ArrowUp"||Qt.key==="PageUp"||Qt.key==="Home")&&Je())};return _e.addEventListener("wheel",qt,{passive:!0}),_e.addEventListener("touchstart",On,{passive:!0}),_e.addEventListener("pointerdown",on,{passive:!0}),_e.addEventListener("keydown",Le,{passive:!0}),()=>{_e.removeEventListener("wheel",qt),_e.removeEventListener("touchstart",On),_e.removeEventListener("pointerdown",on),_e.removeEventListener("keydown",Le)}},[Ds,wr,xe]),h.useEffect(()=>{const _e=Ds();if(!_e||typeof ResizeObserver>"u")return;const Je=new ResizeObserver(()=>{Sn(),Ir()});Je.observe(_e);for(const On of Array.from(_e.children))Je.observe(On);const qt=new MutationObserver(On=>{for(const on of On){for(const Le of Array.from(on.addedNodes))Le instanceof HTMLElement&&Je.observe(Le);for(const Le of Array.from(on.removedNodes))Le instanceof HTMLElement&&Je.unobserve(Le)}Sn()});return qt.observe(_e,{childList:!0}),Sn(),()=>{Je.disconnect(),qt.disconnect()}},[Ds,Ir,Sn]),h.useEffect(()=>{t.length===0&&(Ke.current=!1,Hn(!0),xi.current=null,rn(_e=>_e.size?new Map:_e))},[t.length,Hn]),h.useEffect(()=>{const _e=Ht.current;if(!_e)return;const Je=new ResizeObserver(()=>{Gs(),!yt.current&&(Ke.current||(Hn(!0),requestAnimationFrame(()=>{!yt.current&&!Ke.current&&Qn()})))});return Je.observe(_e),()=>Je.disconnect()},[Qn,Gs,Hn]),h.useLayoutEffect(()=>{const _e=Det(t);if(i||r||Pe.current){Fe.current=_e,ve.current=!0,ie.current=!1,Pe.current=r;return}if(Pe.current=r,!ve.current){Fe.current=_e,ve.current=!0,ie.current=!1;return}const Je=Pet(t);_e&&(Je==null?void 0:Je.role)==="user"&&_e!==Fe.current?(Ke.current=!1,Hn(!0),xi.current=null,ie.current=!0):ie.current=!1,Fe.current=_e},[t,i,r,Hn]),h.useLayoutEffect(()=>{Ce.current&&!i&&(Ke.current=!1,Hn(!0),Qn("auto")),Ce.current=i},[i,Qn,Hn]),h.useLayoutEffect(()=>{if(r){et.current=!0;return}if(!et.current||i||t.length===0)return;et.current=!1,Ke.current=!1,Hn(!0),xi.current=null,He.current!==void 0&&window.cancelAnimationFrame(He.current),Ae.current!==void 0&&window.cancelAnimationFrame(Ae.current);const _e=()=>{yt.current||Ke.current||(Hn(!0),Qn("auto"))};He.current=window.requestAnimationFrame(()=>{He.current=void 0,_e(),Ae.current=window.requestAnimationFrame(()=>{Ae.current=void 0,_e()})})},[i,r,t.length,Qn,Hn]),h.useLayoutEffect(()=>{const _e=vt.current!==_;vt.current=_,_e&&(i||Ke.current||(Hn(!0),requestAnimationFrame(()=>{!yt.current&&!Ke.current&&Qn("auto")})))},[_,i,Qn,Hn]);const _t=h.useMemo(()=>ntt(Ln),[Ln]);h.useLayoutEffect(()=>{if(!i){if(!_t){vn.current=null;return}_t!==vn.current&&(vn.current=_t,(wt.current||!Ke.current)&&requestAnimationFrame(()=>{Ke.current||(Hn(!0),Qn())}))}},[i,_t,Qn,Hn]),h.useEffect(()=>{T&&Dn&&!Ft.current&&(Ke.current=!1,Hn(!0),requestAnimationFrame(()=>{Ke.current||Qn()})),Ft.current=Dn},[T,Dn,Qn,Hn]);const Zn=h.useCallback(_e=>{const Je=(on,Le)=>{if(on.type==="parallel_agents")return l.jsx(CA,{timestamp:on.timestamp,children:l.jsx("div",{className:LW(on,vo)?hp.flash:void 0,children:l.jsx(FZe,{agents:on.agents,pendingApproval:n})})});if(on.type==="turn_outputs")return l.jsx(fZe,{changes:on.changes,turnId:on.turnId,artifacts:on.artifacts,scheduledTasks:on.scheduledTasks,workspaceCwd:w,onOpenRequest:W,onReviewChanges:Q??xE,onOpenArtifact:I??xE,onOpenScheduledTask:J??xE});if(on.type==="turn_collapse")return l.jsx(ktt,{turnCollapse:on.turnCollapse,onToggleCollapse:cs});const Qt=on.message.role==="assistant"?Me.get(on.message.id):void 0;let Un;return on.message.role==="assistant"&&Qt&&(Un={turnId:Qt,message:{id:on.message.id,content:on.message.content,isStreaming:on.message.isStreaming,timestamp:on.message.timestamp}}),l.jsx(EJe,{message:on.message,pendingApproval:n,onShowContextDetail:s,workspaceCwd:w,isLatest:Le,showRetryHint:M,onRetryClick:D,onBranchSession:$,showAssistantActions:on.message.role==="assistant"&&Me.has(on.message.id),showAssistantBranch:on.message.role==="assistant"&&on.message.id===le,isLocateFlashing:LW(on,vo),assistantTurnFooterInfo:Un,generateContent:P})};if(ts&&_e===EE)return v;if(Dn&&_e===Sr)return x;const qt=_e-Bs,On=Ln[qt];return On?Je(On,qt===Ln.length-1):null},[ts,v,Dn,x,Sr,n,s,P,Bs,Ln,vo,Me,le,w,M,D,$,cs,I,J,Q,W]),ds=h.useCallback(_e=>_e?_tt(_e):void 0,[]);return h.useLayoutEffect(()=>{if(i)return;const _e=ie.current;Oe.current&&!_e||De.current&&!_e||(wt.current||_e||!Ke.current)&&(Ke.current||Hn(!0),Qn(_e?"smooth":"auto"),ie.current=!1)},[yr,t,Nr,i,Qn,Hn]),h.useLayoutEffect(()=>{Sn()},[t,Sn,Nr,yr]),l.jsxs("div",{ref:Ht,className:qM(Ms.list,ts&&y?Ms.listWithWelcomeHeader:void 0),"data-web-shell-message-list":!0,onClickCapture:bs,children:[Rs&&l.jsx(jtt,{label:ee("editor.sessionLoading")}),a&&!Rs&&!zr&&l.jsx("div",{className:Ms.historyStatus,role:"status",children:ee("history.loadingEarlier")}),c&&!Rs&&l.jsx("div",{className:Ms.historyStatus,role:"status",children:ee("history.capacityReached")}),u&&!Rs&&!c&&l.jsx("div",{className:Ms.historyStatus,role:"status",children:ee("history.paginationError")}),l.jsx(Ttt,{entries:Z,currentTurnId:rt,currentRange:ue,hidden:!re||!qn,onSelect:qs}),lr?l.jsx("div",{className:Ms.virtualSizer,style:{height:yr},children:Fr.map(_e=>l.jsx("div",{"data-index":_e.index,ref:Ns.measureElement,className:qM(Ms.virtualRow,ds(Ln[_e.index-Bs])),"data-message-row-key":String(sr(_e.index)),"data-web-shell-message-row":!0,style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${_e.start}px)`},children:Zn(_e.index)},_e.key))}):Array.from({length:Nr},(_e,Je)=>{const qt=sr(Je),On=Ln[Je-Bs];return l.jsx("div",{"data-index":Je,className:ds(On),"data-message-row-key":String(qt),"data-web-shell-message-row":!0,children:Zn(Je)},qt)})]})}));function Att(e){var n;return(n=[typeof e.rawOutput=="string"?e.rawOutput:"",e.subContent??"",...(e.content??[]).map(s=>{var r;return((r=s.content)==null?void 0:r.text)??""})].join(`
`).match(/\bmon_[a-f0-9]{16}\b/i))==null?void 0:n[0]}function Ntt(e,t){const n=e.filter(i=>i.kind==="monitor"),s=n.find(i=>i.toolUseId===t.callId);if(s)return s;const r=Att(t);return r?n.find(i=>i.id===r&&i.toolUseId===void 0):void 0}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */function Mtt(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 Itt(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||!Mtt(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}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const Rtt="voice_transcribe",Tce="workspace_qualified_voice",Dtt="workspace_qualified_rest_core",Ptt="workspace_settings",Ltt=new Set(["dynamic_workspace_registration","persistent_workspace_registration","scratch_workspace_registration","workspace_display_name","workspace_runtime_removal"]);function SP(e){return JSON.stringify(e)}function Ott(e){return e.some(t=>Ltt.has(t)||t.startsWith("multi_workspace_")||t.startsWith("workspace_qualified_"))}function Ece(e,t){return{...e,...t?{sessionId:t}:{},ownerKey:SP([e.workspaceKey,t?["session",t]:["draft"]])}}function AE(e,t){return Ece({route:"legacy-primary",...e?{cwd:e}:{},workspaceKey:SP(["legacy-primary",e??null]),streamPath:"voice/stream"},t)}function jce({capabilities:e,intendedCwd:t,sessionId:n,workspaces:s}){var a;if(!e)return;const r=s??e.workspaces,i=((a=r==null?void 0:r.find(c=>c.primary))==null?void 0:a.cwd)??e.workspaceCwd,o=t??(n?void 0:i);if(r){if(!o)return;const c=r.filter(g=>g.cwd===o);if(c.length!==1)return;const u=c[0];if(u.primary)return AE(u.cwd,n);if(!u.trusted)return;const d=u.id.trim()?u.id:void 0,m=d!==void 0&&r.filter(g=>g.id===d).length===1?{kind:"id",value:d}:{kind:"cwd",value:u.cwd},p=SP(["workspace-qualified",m.kind,m.value,u.cwd]);return Ece({route:"workspace-qualified",cwd:u.cwd,workspaceKey:p,selector:m,streamPath:`workspaces/${encodeURIComponent(m.value)}/voice/stream`},n)}if(e.workspaceCwd)return o!==e.workspaceCwd?void 0:AE(e.workspaceCwd,n);if(!t&&!Ott(e.features))return AE(void 0,n)}function $tt(e,t){return e?t.includes(e.route==="legacy-primary"?Rtt:Tce):!1}function o2(e,t){return e?e.route==="legacy-primary"?!0:[Tce,Dtt,Ptt].every(n=>t.includes(n)):!1}function $5(e,t){if(t.route==="workspace-qualified")return t.selector.kind==="id"?e.workspaceById(t.selector.value):e.workspaceByCwd(t.selector.value)}async function Btt(e,t){const n=t.route==="legacy-primary"?await e.workspaceVoice():await $5(e,t).workspaceVoice();if(t.cwd&&n.workspaceCwd!==t.cwd)throw new Error("Voice status workspace does not match the selected target.");return n}async function ztt(e,t){const n=t.route==="legacy-primary"?await e.workspaceProviders():await $5(e,t).workspaceProviders();if(t.cwd&&n.workspaceCwd!==t.cwd)throw new Error("Voice provider workspace does not match the selected target.");return n}async function Ftt(e,t){return t.route==="legacy-primary"?await e.workspaceSettings():await $5(e,t).workspaceSettings()}async function Htt(e,t,n,s){return t.route==="workspace-qualified"&&n==="workspace"?await $5(e,t).setWorkspaceSetting("workspace","voiceModel",s):await e.setWorkspaceSetting(n,"voiceModel",s)}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */function qtt(e,t,n,s){var p;const r=h.useRef(0),i=n&&(t==null?void 0:t.route)==="workspace-qualified"?t.ownerKey:void 0,o=i?JSON.stringify([i,s]):void 0,a=h.useRef(o);a.current=o;const[c,u]=h.useState({ownerKey:i,status:void 0}),d=h.useCallback(async()=>{const g=o;if(a.current!==g)return;const b=++r.current;if(!g||!i||!t||t.route!=="workspace-qualified"){u({ownerKey:i,status:void 0});return}u(v=>v.ownerKey===i?v:{ownerKey:i,status:void 0});try{const v=await Ftt(e,t);return b===r.current&&a.current===g&&u({ownerKey:i,status:v}),v}catch{return}},[e,i,o,t]),f=h.useCallback(()=>{r.current++},[]);h.useEffect(()=>(d(),f),[f,d]);const m=c.ownerKey===i?c:void 0;return{descriptor:(p=m==null?void 0:m.status)==null?void 0:p.settings.find(g=>g.key==="voiceModel"),reload:d}}const Utt="_editorShell_fs4hc_1",Wtt="_editorShellDropdownOpen_fs4hc_7",Vtt="_container_fs4hc_11",Gtt="_content_fs4hc_30",Ktt="_dacAura_fs4hc_46",Ytt="_dacHalo_fs4hc_47",Xtt="_atPortalLayer_fs4hc_188",Qtt="_slashPanel_fs4hc_216",Jtt="_slashPanelBody_fs4hc_225",Ztt="_slashList_fs4hc_230",ent="_slashEntry_fs4hc_257",tnt="_slashSection_fs4hc_263",nnt="_slashSectionHeader_fs4hc_269",snt="_slashSectionCount_fs4hc_282",rnt="_slashItem_fs4hc_290",int="_slashItemActive_fs4hc_316",ont="_slashCommand_fs4hc_320",ant="_slashDetail_fs4hc_325",lnt="_slashDetailCommand_fs4hc_335",cnt="_slashDetailText_fs4hc_345",unt="_slashDescription_fs4hc_365",dnt="_atPanel_fs4hc_377",hnt="_atPanelHeaderWrap_fs4hc_401",fnt="_atPanelHeader_fs4hc_401",mnt="_atBackButton_fs4hc_416",pnt="_atPanelTitle_fs4hc_438",gnt="_atTabsWrap_fs4hc_447",bnt="_atTabs_fs4hc_447",ynt="_atTab_fs4hc_447",wnt="_atTabScrollButton_fs4hc_471",vnt="_atTabActive_fs4hc_503",xnt="_atSearchInput_fs4hc_514",knt="_atList_fs4hc_533",_nt="_atItem_fs4hc_561",Snt="_atItemActive_fs4hc_583",Cnt="_atItemSingleLine_fs4hc_587",Tnt="_atItemMain_fs4hc_593",Ent="_atItemLeading_fs4hc_604",jnt="_atItemIcon_fs4hc_614",Ant="_atItemImageIcon_fs4hc_625",Nnt="_atItemIconSpin_fs4hc_633",Mnt="_atItemLabel_fs4hc_637",Int="_atItemSubtitle_fs4hc_638",Rnt="_atItemDescription_fs4hc_665",Dnt="_atItemTrailing_fs4hc_676",Pnt="_atEmpty_fs4hc_683",Lnt="_attachments_fs4hc_689",Ont="_tags_fs4hc_699",$nt="_tag_fs4hc_699",Bnt="_tagContent_fs4hc_722",znt="_tagTooltip_fs4hc_730",Fnt="_tagLabel_fs4hc_754",Hnt="_tagValue_fs4hc_755",qnt="_tagIcon_fs4hc_759",Unt="_tagRemove_fs4hc_794",Wnt="_editorArea_fs4hc_814",Vnt="_shellPrefix_fs4hc_842",Gnt="_mobileTextarea_fs4hc_865",Knt="_toolbar_fs4hc_911",Ynt="_toolbarLeading_fs4hc_921",Xnt="_toolbarStart_fs4hc_922",Qnt="_toolbarEnd_fs4hc_923",Jnt="_toolbarLeft_fs4hc_924",Znt="_toolbarRight_fs4hc_925",est="_gitBranchChip_fs4hc_958",tst="_gitBranchChipButton_fs4hc_975",nst="_gitBranchIcon_fs4hc_993",sst="_gitBranchText_fs4hc_1005",rst="_gitBranchIconWrap_fs4hc_1020",ist="_gitBranchBadgeDot_fs4hc_1028",ost="_gitBranchIndicators_fs4hc_1047",ast="_gitBranchDirtyDot_fs4hc_1054",lst="_gitBranchAheadBehind_fs4hc_1062",cst="_gitBranchStash_fs4hc_1067",ust="_gitBranchConflicted_fs4hc_1080",dst="_gitBranchOperation_fs4hc_1094",hst="_gitBranchTooltip_fs4hc_1102",fst="_gitBranchTooltipTitle_fs4hc_1108",mst="_gitBranchTooltipRow_fs4hc_1112",pst="_workspaceChip_fs4hc_1118",gst="_workspaceChipAccented_fs4hc_1137",bst="_workspaceChipIcon_fs4hc_1141",yst="_workspaceChipText_fs4hc_1157",wst="_toolbarRightCustom_fs4hc_1169",vst="_toolbarMeasurements_fs4hc_1175",xst="_dropdownWrapper_fs4hc_1186",kst="_dropdownWrapperCompact_fs4hc_1190",_st="_dropdownList_fs4hc_1195",Sst="_dropdownListConstrained_fs4hc_1205",Cst="_dropdownEmpty_fs4hc_1209",Tst="_dropdownItem_fs4hc_1216",Est="_dropdownRich_fs4hc_1233",jst="_dropdownCheck_fs4hc_1242",Ast="_dropdownItemActive_fs4hc_1254",Nst="_dropdownItemIcon_fs4hc_1259",Mst="_dropdownItemCheck_fs4hc_1260",Ist="_dropdownItemContent_fs4hc_1277",Rst="_dropdownItemLabel_fs4hc_1284",Dst="_dropdownItemDesc_fs4hc_1294",Pst="_toolBtn_fs4hc_1308",Lst="_modeToolBtn_fs4hc_1326",Ost="_modelToolBtn_fs4hc_1327",$st="_workspaceSelectTrigger_fs4hc_1336",Bst="_gitBranchChipCompact_fs4hc_1371",zst="_workspaceChipCompact_fs4hc_1372",Fst="_workspaceSelectTriggerCompact_fs4hc_1373",Hst="_toolBtnCompact_fs4hc_1374",qst="_toolBtnText_fs4hc_1394",Ust="_toolBtnArrow_fs4hc_1395",Wst="_toolBtnIcon_fs4hc_1422",Vst="_widthModeBtn_fs4hc_1438",Gst="_quickActionsBtn_fs4hc_1447",Kst="_toolBtnModeIcon_fs4hc_1456",Yst="_toolBtnModelIcon_fs4hc_1457",Xst="_quickActionsPanel_fs4hc_1503",Qst="_quickActionsHeader_fs4hc_1516",Jst="_quickActionsLayout_fs4hc_1523",Zst="_quickActionsGrid_fs4hc_1530",ert="_quickAction_fs4hc_1447",trt="_quickActionLabel_fs4hc_1561",nrt="_quickKeysGrid_fs4hc_1576",srt="_quickKey_fs4hc_1576",rrt="_quickKeyLabel_fs4hc_1605",irt="_sendBtn_fs4hc_1618",ort="_sendBtnRunning_fs4hc_1656",art="_sendIcon_fs4hc_1669",lrt="_stopIcon_fs4hc_1675",crt="_loadingIcon_fs4hc_1682",urt="_sendBtnArmed_fs4hc_1694",drt="_escLabel_fs4hc_1762",hrt="_srOnly_fs4hc_1770",frt="_images_fs4hc_1792",mrt="_imageThumb_fs4hc_1800",prt="_imageRemove_fs4hc_1815",grt="_searchPanel_fs4hc_1836",brt="_searchBar_fs4hc_1853",yrt="_searchLabel_fs4hc_1861",wrt="_searchInput_fs4hc_1866",vrt="_searchResults_fs4hc_1880",xrt="_searchResult_fs4hc_1880",krt="_searchResultActive_fs4hc_1913",_rt="_searchResultMarker_fs4hc_1918",Srt="_searchResultText_fs4hc_1923",Crt="_searchEmpty_fs4hc_1930",Se={editorShell:Utt,editorShellDropdownOpen:Wtt,container:Vtt,content:Gtt,dacAura:Ktt,dacHalo:Ytt,atPortalLayer:Xtt,slashPanel:Qtt,slashPanelBody:Jtt,slashList:Ztt,slashEntry:ent,slashSection:tnt,slashSectionHeader:nnt,slashSectionCount:snt,slashItem:rnt,slashItemActive:int,slashCommand:ont,slashDetail:ant,slashDetailCommand:lnt,slashDetailText:cnt,slashDescription:unt,atPanel:dnt,atPanelHeaderWrap:hnt,atPanelHeader:fnt,atBackButton:mnt,atPanelTitle:pnt,atTabsWrap:gnt,atTabs:bnt,atTab:ynt,atTabScrollButton:wnt,atTabActive:vnt,atSearchInput:xnt,atList:knt,atItem:_nt,atItemActive:Snt,atItemSingleLine:Cnt,atItemMain:Tnt,atItemLeading:Ent,atItemIcon:jnt,atItemImageIcon:Ant,atItemIconSpin:Nnt,atItemLabel:Mnt,atItemSubtitle:Int,atItemDescription:Rnt,atItemTrailing:Dnt,atEmpty:Pnt,attachments:Lnt,tags:Ont,tag:$nt,tagContent:Bnt,tagTooltip:znt,tagLabel:Fnt,tagValue:Hnt,tagIcon:qnt,tagRemove:Unt,editorArea:Wnt,shellPrefix:Vnt,mobileTextarea:Gnt,toolbar:Knt,toolbarLeading:Ynt,toolbarStart:Xnt,toolbarEnd:Qnt,toolbarLeft:Jnt,toolbarRight:Znt,gitBranchChip:est,gitBranchChipButton:tst,gitBranchIcon:nst,gitBranchText:sst,gitBranchIconWrap:rst,gitBranchBadgeDot:ist,gitBranchIndicators:ost,gitBranchDirtyDot:ast,gitBranchAheadBehind:lst,gitBranchStash:cst,gitBranchConflicted:ust,gitBranchOperation:dst,gitBranchTooltip:hst,gitBranchTooltipTitle:fst,gitBranchTooltipRow:mst,workspaceChip:pst,workspaceChipAccented:gst,workspaceChipIcon:bst,workspaceChipText:yst,toolbarRightCustom:wst,toolbarMeasurements:vst,dropdownWrapper:xst,dropdownWrapperCompact:kst,dropdownList:_st,dropdownListConstrained:Sst,dropdownEmpty:Cst,dropdownItem:Tst,dropdownRich:Est,dropdownCheck:jst,dropdownItemActive:Ast,dropdownItemIcon:Nst,dropdownItemCheck:Mst,dropdownItemContent:Ist,dropdownItemLabel:Rst,dropdownItemDesc:Dst,toolBtn:Pst,modeToolBtn:Lst,modelToolBtn:Ost,workspaceSelectTrigger:$st,gitBranchChipCompact:Bst,workspaceChipCompact:zst,workspaceSelectTriggerCompact:Fst,toolBtnCompact:Hst,toolBtnText:qst,toolBtnArrow:Ust,toolBtnIcon:Wst,widthModeBtn:Vst,quickActionsBtn:Gst,toolBtnModeIcon:Kst,toolBtnModelIcon:Yst,quickActionsPanel:Xst,quickActionsHeader:Qst,quickActionsLayout:Jst,quickActionsGrid:Zst,quickAction:ert,quickActionLabel:trt,quickKeysGrid:nrt,quickKey:srt,quickKeyLabel:rrt,sendBtn:irt,sendBtnRunning:ort,sendIcon:art,stopIcon:lrt,loadingIcon:crt,sendBtnArmed:urt,escLabel:drt,srOnly:hrt,images:frt,imageThumb:mrt,imageRemove:prt,searchPanel:grt,searchBar:brt,searchLabel:yrt,searchInput:wrt,searchResults:vrt,searchResult:xrt,searchResultActive:krt,searchResultMarker:_rt,searchResultText:Srt,searchEmpty:Crt},Trt=["--chat-editor-accent-color","--chat-editor-text-primary","--accent","--background","--foreground","--muted-foreground","--chat-editor-border-color","--font-sans"];function Ert({menu:e,anchorRef:t,panelRef:n,onSelect:s,onAccept:r,onBack:i,onSearch:o,onSelectTab:a}){const c=_u(),{t:u}=lt(),d=h.useRef([]),f=h.useRef(null),m=h.useRef(null),[p,g]=h.useState(null),[b,v]=h.useState({});h.useEffect(()=>{var S;(S=d.current[e.selectedIndex])==null||S.scrollIntoView({block:"nearest"})},[e.level,e.selectedIndex]),h.useEffect(()=>{if(e.level!=="items"||e.inputMode!=="search"||document.activeElement===f.current)return;const S=()=>{var O;return(O=f.current)==null?void 0:O.focus()},R=window.requestAnimationFrame(S),A=window.setTimeout(S,0);return()=>{window.cancelAnimationFrame(R),window.clearTimeout(A)}},[e.inputMode,e.level,e.selectedProviderId]),h.useLayoutEffect(()=>{const S=t.current;if(!S)return;const R=getComputedStyle(S);v(Object.fromEntries(Trt.map(A=>[A,R.getPropertyValue(A)])))},[t]),h.useLayoutEffect(()=>{const S=t.current;if(!S)return;let R=null;const A=()=>{var Q;const D=S.getBoundingClientRect(),$=((Q=n.current)==null?void 0:Q.offsetWidth)??360,z=getComputedStyle(S),B=Number.parseFloat(z.getPropertyValue("--web-shell-popover-safe-top"))||48,j=Math.max(96,Math.min(300,D.top-B-8)),H={left:Math.max(12,Math.min(D.left+16,window.innerWidth-$-12)),bottom:window.innerHeight-D.top+8,width:D.width,maxHeight:j};g(I=>I&&I.left===H.left&&I.bottom===H.bottom&&I.width===H.width&&I.maxHeight===H.maxHeight?I:H)},O=()=>{R===null&&(R=window.requestAnimationFrame(()=>{R=null,A()}))};A();const M=new ResizeObserver(O);return M.observe(S),window.addEventListener("resize",O),window.addEventListener("scroll",O,!0),()=>{R!==null&&window.cancelAnimationFrame(R),M.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("scroll",O,!0)}},[t,n]);const y=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===va?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(h.useEffect(()=>{d.current.length=y.length},[y.length]),!p)return null;const w=e.providers.find(S=>S.id===e.selectedProviderId),x=e.itemMode==="mcpResources"&&e.mcpServerName?ni(e.mcpServerName)??"[invalid]":(w==null?void 0:w.label)??"",k=e.itemMode==="mcpResources"&&e.mcpServerName?ni(e.mcpServerName)??"[invalid]":(w==null?void 0:w.textValue)??"",C=e.level==="items"?(w==null?void 0:w.textValue)??u("at.menu"):u("at.menu"),T="at-mention-listbox",_=e.selectedIndex>=0&&e.selectedIndex<y.length?`at-mention-option-${e.selectedIndex}`:void 0;return Wu.createPortal(l.jsx("div",{className:Se.atPortalLayer,style:b,children:l.jsxs("div",{ref:n,className:Se.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":C,onMouseDown:S=>{S.target instanceof HTMLInputElement||S.preventDefault()},children:[e.level==="items"&&l.jsxs("div",{className:Se.atPanelHeaderWrap,children:[l.jsxs("div",{className:Se.atPanelHeader,children:[l.jsx("button",{type:"button",className:Se.atBackButton,"aria-label":u("common.back"),onMouseDown:S=>{S.preventDefault(),S.stopPropagation()},onClick:S=>{S.preventDefault(),S.stopPropagation(),i()},children:"‹"}),l.jsx("span",{className:Se.atPanelTitle,title:k,children:x})]}),l.jsx("input",{ref:f,className:Se.atSearchInput,value:e.query,placeholder:u("common.search"),"aria-label":u("common.search"),"aria-controls":T,"aria-activedescendant":_,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(),y.length===0)return;s(Math.max(0,e.selectedIndex-1))}else if(S.key==="ArrowDown"){if(S.preventDefault(),S.stopPropagation(),y.length===0)return;s(Math.min(y.length-1,e.selectedIndex+1))}}}}),e.tabs&&e.tabs.length>0&&l.jsxs("div",{className:Se.atTabsWrap,children:[l.jsx("button",{type:"button",className:Se.atTabScrollButton,"aria-label":"Previous tab",onClick:S=>{S.preventDefault(),S.stopPropagation(),zW(m.current,"previous")},children:"‹"}),l.jsx("div",{ref:m,className:Se.atTabs,role:"tablist",children:e.tabs.map(S=>{const R=S.id===e.selectedTabId,A=S.textValue??(typeof S.label=="string"?S.label:S.id);return l.jsx("button",{type:"button",role:"tab","aria-selected":R,disabled:S.disabled,className:`${Se.atTab} ${R?Se.atTabActive:""}`,title:A,onClick:O=>{O.preventDefault(),O.stopPropagation(),a(S.id)},children:S.label},S.id)})}),l.jsx("button",{type:"button",className:Se.atTabScrollButton,"aria-label":"Next tab",onClick:S=>{S.preventDefault(),S.stopPropagation(),zW(m.current,"next")},children:"›"})]})]}),l.jsx("div",{id:T,className:Se.atList,role:y.length>0?"listbox":void 0,"aria-label":y.length>0?C:void 0,children:e.loading&&y.length===0?l.jsx("div",{className:Se.atEmpty,role:"status","aria-live":"polite",children:u("common.loading")}):y.length===0?l.jsx("div",{className:Se.atEmpty,role:"status","aria-live":"polite",children:u("common.noResults")}):y.map((S,R)=>{const A=R===e.selectedIndex,O="item"in S?w==null?void 0:w.provider:S.provider.provider;let M;if("item"in S&&(O!=null&&O.renderItem))try{M=O.renderItem({item:S.item,provider:O,selected:A})}catch($){console.warn("[WebShell] at mention item render failed",$)}const D="icon"in S&&S.icon&&by(S.icon)?S.icon:void 0;return l.jsxs("button",{ref:$=>{d.current[R]=$},type:"button",id:`at-mention-option-${R}`,role:"option","aria-selected":A,className:`${Se.atItem} ${A?Se.atItemActive:""} ${S.description?"":Se.atItemSingleLine}`,style:{"--at-item-main-template":jrt(Art(S.label,S.labelTitle),"subtitle"in S?S.subtitle:void 0)},onMouseEnter:()=>s(R),onMouseDown:$=>{$.preventDefault(),$.stopPropagation()},onClick:$=>{$.preventDefault(),$.stopPropagation(),r(R)},children:[M??l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:Se.atItemMain,children:[l.jsxs("span",{className:Se.atItemLeading,children:["icon"in S&&D&&(S.iconMode==="image"?l.jsx("img",{className:Se.atItemImageIcon,src:D,title:S.iconTooltip,alt:"","aria-hidden":"true"}):l.jsx("span",{className:`${Se.atItemIcon} ${S.iconSpin?Se.atItemIconSpin:""}`,style:{...wm("--at-item-icon-url",D),color:S.iconColor},title:S.iconTooltip,"aria-hidden":"true"})),l.jsx("span",{className:Se.atItemLabel,title:S.labelTitle,children:S.label})]}),"subtitle"in S&&S.subtitle&&l.jsx("span",{className:Se.atItemSubtitle,title:S.subtitle,children:S.subtitle})]}),S.description&&l.jsx("span",{className:Se.atItemDescription,title:S.description,children:S.description})]}),S.trailing&&l.jsx("span",{className:Se.atItemTrailing,"aria-hidden":"true",children:S.trailing})]},S.id)})})]})}),c??document.body)}function zW(e,t){if(!e)return;const n=Math.max(96,e.clientWidth*.75);e.scrollBy({left:t==="previous"?-n:n,behavior:"smooth"})}function jrt(e,t){if(!t)return"minmax(0, 1fr)";const n=FW(e);return FW(t)<=12?"minmax(0, 1fr) max-content":n<=18?"max-content minmax(0, 1fr)":"minmax(0, 3fr) minmax(0, 2fr)"}function Art(e,t){return typeof e=="string"?e:typeof e=="number"?String(e):t||""}function FW(e){return Array.from(e).reduce((t,n)=>t+(n.charCodeAt(0)>255?2:1),0)}const Nrt="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",Mrt="/assets/default-aEtf0G7-.svg",Ace="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",Irt="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",Rrt="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",Drt="_icon_i7y0u_1",Prt={icon:Drt},Lrt={auto:Nrt,"auto-edit":Ace,default:Mrt,plan:Irt,yolo:Rrt};function Kw({mode:e}){const t=Lrt[e];return t?l.jsx("span",{className:Prt.icon,style:wm("--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 Ort(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 vm(e){return e.replace(/\([^()]+\)$/,"")}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const y4=16e3,$rt=4096,Nce=6e4,HW=6e4,Brt=y4*Int16Array.BYTES_PER_ELEMENT*(Nce/1e3);function zrt(e,t){const n=new URL(e),s=n.pathname.replace(/\/?$/,"/"),r=new URL(t.replace(/^\/+/,""),`${n.origin}${s}`);return r.protocol=r.protocol==="https:"?"wss:":"ws:",r.toString()}const Frt="qwen-bearer.",Hrt="qwen-ws";function qrt(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`${Frt}${s}`}function Urt(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 Wrt(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 Vrt({baseUrl:e,token:t,target:n,onFinal:s,onError:r,onUnexpectedClose:i}){const[o,a]=h.useState("idle"),[c,u]=h.useState(""),[d,f]=h.useState(0),[m,p]=h.useState(),g=h.useRef({}),b=h.useRef(!0),v=h.useRef(0),y=h.useRef(!1),w=h.useRef("idle"),x=h.useRef(void 0),k=h.useCallback(j=>{w.current=j,a(j)},[]),C=h.useCallback(()=>{const j=g.current;j.transcribeTimeout&&(clearTimeout(j.transcribeTimeout),j.transcribeTimeout=void 0)},[]),T=h.useCallback(()=>{var H;const j=g.current;j.processor&&(j.processor.onaudioprocess=null);for(const Q of[j.processor,j.source,j.sink])try{Q==null||Q.disconnect()}catch{}(H=j.stream)==null||H.getTracks().forEach(Q=>Q.stop()),j.context&&j.context.state!=="closed"&&j.context.close().catch(()=>{}),j.processor=void 0,j.source=void 0,j.sink=void 0,j.stream=void 0,j.context=void 0},[]),_=h.useCallback(()=>{v.current++,x.current=void 0,y.current=!1,T(),C();const j=g.current;if(j.ws){try{j.ws.onopen=null,j.ws.onmessage=null,j.ws.onerror=null,j.ws.onclose=null,j.ws.close()}catch{}j.ws=void 0}},[C,T]),S=h.useCallback(j=>b.current&&v.current===j.generation&&x.current===j,[]),R=h.useCallback((j,H)=>{var Q;S(H)&&(_(),b.current&&(k("error"),u(""),f(0),p(j),(Q=H.onError)==null||Q.call(H,j)))},[k,_,S]),A=h.useCallback((j,H)=>{S(H)&&(_(),b.current&&(k("idle"),u(""),f(0),H.onFinal(j)))},[k,_,S]),O=h.useCallback(()=>{var H;const j=g.current;if(((H=j.ws)==null?void 0:H.readyState)===WebSocket.OPEN)try{j.ws.send(JSON.stringify({type:"abort"}))}catch{}_(),b.current&&(k("idle"),u(""),f(0),p(void 0))},[k,_]),M=h.useCallback((j,H)=>{T(),f(0),k("transcribing");try{j.send(JSON.stringify({type:"stop"})),C(),g.current.transcribeTimeout=setTimeout(()=>{S(H)&&w.current==="transcribing"&&R("Transcription timed out.",H)},HW)}catch{R("Failed to finalize voice transcription.",H)}},[k,C,R,S,T]),D=n?JSON.stringify([n.ownerKey,n.streamPath]):void 0,$=h.useRef(D);h.useLayoutEffect(()=>{$.current!==D&&($.current=D,x.current?O():(k("idle"),u(""),f(0),p(void 0)))},[O,k,D]);const z=h.useCallback(()=>{var I;if(!n||w.current!=="idle"&&w.current!=="error")return;p(void 0),u(""),k("connecting");const j={generation:++v.current,ownerKey:n.ownerKey,streamPath:n.streamPath,onFinal:s,...r?{onError:r}:{},...i?{onUnexpectedClose:i}:{}};if(x.current=j,!((I=navigator.mediaDevices)!=null&&I.getUserMedia)){R(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.",j);return}let H,Q;try{if(H=new AudioContext({sampleRate:y4}),g.current.context=H,H.sampleRate!==y4)throw new Error(`Browser audio rate ${H.sampleRate} Hz is not the required ${y4} Hz.`);Q=H.state==="suspended"?H.resume():Promise.resolve()}catch(J){R(J instanceof Error?J.message:String(J),j);return}C(),g.current.transcribeTimeout=setTimeout(()=>{S(j)&&w.current==="connecting"&&R("Voice capture timed out while starting.",j)},Nce),(async()=>{try{const J=navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}}).then(ne=>(S(j)?g.current.stream=ne:ne.getTracks().forEach(U=>U.stop()),ne),ne=>{throw new Error(Urt(ne))}),[W]=await Promise.all([J,Q]);if(!S(j))return;const P=H.createMediaStreamSource(W),V=H.createScriptProcessor($rt,1,1),ee=H.createGain();ee.gain.value=0,g.current.source=P,g.current.processor=V,g.current.sink=ee;const q=new WebSocket(zrt(e,j.streamPath),t?[Hrt,qrt(t)]:void 0);q.binaryType="arraybuffer",g.current.ws=q;const K=[];let de=0,re=!1;V.onaudioprocess=ne=>{if(!S(j))return;const{pcm:U,level:Z}=Wrt(ne.inputBuffer.getChannelData(0));if(f(Z),re)q.readyState===WebSocket.OPEN&&q.send(U);else{if(de+U.byteLength>Brt){R("Voice capture buffer limit reached while starting.",j);return}K.push(U),de+=U.byteLength}},y.current||(P.connect(V),V.connect(ee),ee.connect(H.destination)),q.onopen=()=>{if(!S(j)){try{q.close()}catch{}return}q.send(JSON.stringify({type:"start"})),re=!0;for(const ne of K)q.send(ne);if(K.length=0,de=0,C(),y.current){y.current=!1,M(q,j);return}g.current.transcribeTimeout=setTimeout(()=>{S(j)&&w.current==="recording"&&R("No response from server. Check that the voice model is running.",j)},HW),k("recording")},q.onmessage=ne=>{if(!S(j))return;(w.current==="connecting"||w.current==="recording")&&C();let U;try{U=JSON.parse(String(ne.data))}catch{return}U.type==="interim"?u(U.text??""):U.type==="final"?A(U.text??"",j):U.type==="error"&&R(U.message??U.text??"Voice transcription failed.",j)},q.onerror=()=>{},q.onclose=ne=>{var ge;if(!S(j)||!(w.current==="recording"||w.current==="connecting"||w.current==="transcribing"))return;const U=ne.code||1006,Z=ne.reason||"none";try{(ge=j.onUnexpectedClose)==null||ge.call(j,{code:U,reason:Z})}catch{}R(U===1013?Z==="none"?"Voice capacity is temporarily unavailable. Retry shortly.":Z:`Voice connection closed (code=${U}, reason=${Z}).`,j)}}catch(J){R(J instanceof Error?J.message:String(J),j)}})()},[k,e,C,R,M,A,r,s,i,S,n,t]),B=h.useCallback(()=>{const j=x.current,H=g.current.ws;if(!j||!H||H.readyState!==WebSocket.OPEN){if(j&&w.current==="connecting"){g.current.processor&&T(),y.current=!0,C();return}O();return}w.current!=="transcribing"&&M(H,j)},[O,C,M,T]);return h.useEffect(()=>(b.current=!0,()=>{b.current=!1,_()}),[_]),{status:o,interimText:c,audioLevel:d,errorMessage:m,start:z,stop:B,abort:O}}const Grt="_root_9hwm9_7",Krt="_iconBtn_9hwm9_14",Yrt="_error_9hwm9_47",Xrt="_connecting_9hwm9_51",Qrt="_pill_9hwm9_56",Jrt="_transcribing_9hwm9_75",Zrt="_recDot_9hwm9_79",eit="_wave_9hwm9_88",tit="_bar_9hwm9_95",nit="_time_9hwm9_103",sit="_stop_9hwm9_111",rit="_spinner_9hwm9_118",iit="_interim_9hwm9_128",Fa={root:Grt,iconBtn:Krt,error:Yrt,connecting:Xrt,pill:Qrt,transcribing:Jrt,recDot:Zrt,wave:eit,bar:tit,time:nit,stop:sit,spinner:rit,interim:iit},qW=16,oit=2e3,ait=()=>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"})]}),lit=()=>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 cit(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),s=String(t%60).padStart(2,"0");return`${n}:${s}`}function uit({onInsert:e,onActiveChange:t,disabled:n,target:s,statusRevision:r={user:0,workspace:0}}){var rt;const i=io(),o=Ra(),a=Xd(),{t:c}=lt(),u=((rt=i.capabilities)==null?void 0:rt.features)??[],d=$tt(s,u),f=s!=null&&s.sessionId&&s.sessionId===o.sessionId&&(!s.cwd||s.cwd===o.workspaceCwd)?a==null?void 0:a.settingsVersion:void 0,[m,p]=h.useState(0),[g,b]=h.useState(!1),v=h.useMemo(()=>s?JSON.stringify([s.workspaceKey,s.ownerKey,f??null,r.user,r.workspace,m]):void 0,[m,f,r.user,r.workspace,s]),[y,w]=h.useState(()=>({queryKey:v,enabled:!1,mode:"hold"})),x=h.useRef(null),k=h.useRef(s);k.current=s;const C=h.useRef(0),T=h.useRef(0),_=h.useRef(!1);h.useEffect(()=>(_.current=!0,()=>{_.current=!1,T.current+=1}),[]),h.useEffect(()=>{const le=++C.current,Me=k.current;let We=!0;if(w({queryKey:v,enabled:!1,mode:"hold"}),!(!Me||!v||!d||g))return Btt(i.client,Me).then(at=>{We&&C.current===le&&w({queryKey:v,enabled:at.enabled===!0,mode:at.mode})}).catch(at=>{console.warn("[web-shell] Voice status probe failed:",at)}),()=>{We=!1}},[g,d,v,i.client]);const S=d&&!g&&y.queryKey===v&&y.enabled,[R,A]=h.useState(void 0);h.useEffect(()=>{if(!R)return;const le=window.setTimeout(()=>A(void 0),oit);return()=>window.clearTimeout(le)},[R]);const{status:O,interimText:M,audioLevel:D,errorMessage:$,start:z,stop:B,abort:j}=Vrt({baseUrl:i.baseUrl,token:i.token,target:s?{ownerKey:s.ownerKey,streamPath:s.streamPath}:void 0,onFinal:le=>{const Me=le.trim();Me?(A(void 0),e(Me)):A(c("voice.noSpeech"))},onUnexpectedClose:({code:le})=>{var ze,rn;if(le===1013||(p(Wt=>Wt+1),le!==1012))return;const Me=(ze=k.current)==null?void 0:ze.ownerKey,We=++T.current;b(!0);const at=()=>{var Wt;!_.current||T.current!==We||((Wt=k.current)==null?void 0:Wt.ownerKey)!==Me||(b(!1),p(zt=>zt+1))};try{const Wt=(rn=i.refreshCapabilities)==null?void 0:rn.call(i);Wt?Wt.then(at,at):at()}catch{at()}}}),H=O==="connecting"||O==="recording"||O==="transcribing",Q=O==="recording";h.useEffect(()=>{t==null||t(H)},[H,t]),h.useEffect(()=>()=>{t==null||t(!1)},[t]);const[I,J]=h.useState(()=>new Array(qW).fill(0));h.useEffect(()=>{if(!Q){J(new Array(qW).fill(0));return}J(le=>[...le.slice(1),Math.min(1,D*8)])},[D,Q]);const[W,P]=h.useState(0);h.useEffect(()=>{if(!Q){P(0);return}const le=performance.now(),Me=setInterval(()=>P(performance.now()-le),200);return()=>clearInterval(Me)},[Q]),h.useLayoutEffect(()=>{!S&&(O==="recording"||O==="connecting"||O==="transcribing")&&j()},[j,O,S]);const V=h.useRef(s==null?void 0:s.ownerKey);if(h.useLayoutEffect(()=>{V.current!==(s==null?void 0:s.ownerKey)&&(V.current=s==null?void 0:s.ownerKey,T.current+=1,A(void 0),b(!1))},[s==null?void 0:s.ownerKey]),!S)return null;const ee=O==="connecting",q=O==="transcribing",K=O==="error",de=!!R&&!K,re=Q||ee,ne=le=>{y.mode==="hold"&&le.detail!==0||(Q?B():ee?j():n||(A(void 0),z()))},U=le=>{if(!(y.mode!=="hold"||le.button!==0||n||ee||Q)){le.preventDefault(),x.current=le.pointerId;try{le.currentTarget.setPointerCapture(le.pointerId)}catch{}A(void 0),z()}},Z=le=>{y.mode!=="hold"||x.current!==le.pointerId||(x.current=null,(ee||Q)&&B())},ge=le=>{y.mode!=="hold"||x.current!==le.pointerId||(x.current=null,(ee||Q)&&j())},ce=Q?c("voice.stopDictation"):q?c("voice.transcribing"):ee?c("voice.starting"):K?c("voice.errorRetry",{message:$??""}):c(de?"voice.noSpeechRetry":"voice.startDictation");let ue;if(Q)ue=l.jsxs("button",{type:"button",className:Fa.pill,onClick:ne,onPointerDown:U,onPointerUp:Z,onPointerCancel:ge,"aria-label":ce,title:ce,children:[l.jsx("span",{className:Fa.recDot,"aria-hidden":"true"}),l.jsx("span",{className:Fa.wave,"aria-hidden":"true",children:I.map((le,Me)=>l.jsx("span",{className:Fa.bar,style:{height:`${2+Math.round(le*14)}px`}},Me))}),l.jsx("span",{className:Fa.time,children:cit(W)}),l.jsx("span",{className:Fa.stop,"aria-hidden":"true",children:l.jsx(lit,{})})]});else if(q)ue=l.jsxs("span",{className:`${Fa.pill} ${Fa.transcribing}`,role:"status","aria-label":ce,children:[l.jsx("span",{className:Fa.spinner,"aria-hidden":"true"}),l.jsx("span",{className:Fa.time,children:"…"})]});else{const le=[Fa.iconBtn,K?Fa.error:"",ee?Fa.connecting:""].filter(Boolean).join(" ");ue=l.jsx("button",{type:"button",className:le,onClick:ne,onPointerDown:U,onPointerUp:Z,onPointerCancel:ge,disabled:!!n&&!re,"aria-label":ce,title:$??R??ce,children:l.jsx(ait,{})})}const be=Q&&M||K||de;return l.jsxs("span",{className:Fa.root,children:[ue,be&&l.jsx("span",{role:"status","aria-live":"polite",className:`${Fa.interim}${K?` ${Fa.error}`:""}`,children:K?$||c("voice.error"):de?R:M})]})}function nh({delayDuration:e=0,...t}){return l.jsx(Hre,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function sh({...e}){return l.jsx(qre,{"data-slot":"tooltip",...e})}function rh({...e}){return l.jsx(Ure,{"data-slot":"tooltip-trigger",...e})}function ih({className:e,sideOffset:t=8,children:n,...s}){const r=_u();return l.jsx(Wre,{container:r??void 0,children:l.jsx(Vre,{"data-slot":"tooltip-content",sideOffset:t,className:en("relative 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 before:pointer-events-none before:absolute before:size-2.5 before:rotate-45 before:rounded-[2px] before:bg-popover before:border-border before:content-[''] has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:before:-top-[5px] data-[side=bottom]:before:left-1/2 data-[side=bottom]:before:-translate-x-1/2 data-[side=bottom]:before:border-t data-[side=bottom]:before:border-l data-[side=left]:before:top-1/2 data-[side=left]:before:-right-[5px] data-[side=left]:before:-translate-y-1/2 data-[side=left]:before:border-t data-[side=left]:before:border-r data-[side=right]:before:top-1/2 data-[side=right]:before:-left-[5px] data-[side=right]:before:-translate-y-1/2 data-[side=right]:before:border-b data-[side=right]:before:border-l data-[side=top]:before:-bottom-[6px] data-[side=top]:before:left-1/2 data-[side=top]:before:-translate-x-1/2 data-[side=top]:before:border-r data-[side=top]:before:border-b 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-[state=instant-open]:animate-in data-[state=instant-open]:fade-in-0 data-[state=instant-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...s,children:n})})}function dit(){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 CP(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 hit(e){return e.conflicted>0?"error":e.operation||e.detached?"warning":e.dirty?"accent":null}function Mce(e,t){const n=[];return e.operation&&n.push(t(`git.operation.${e.operation}`)),e.detached&&n.push(t("git.detached")),e.conflicted>0&&n.push(t("git.conflicted",{count:e.conflicted})),e.staged>0&&n.push(t("git.staged",{count:e.staged})),e.unstaged>0&&n.push(t("git.unstaged",{count:e.unstaged})),e.untracked>0&&n.push(t("git.untracked",{count:e.untracked})),e.ahead>0&&n.push(t("git.ahead",{count:e.ahead})),e.behind>0&&n.push(t("git.behind",{count:e.behind})),e.stashCount>0&&n.push(t("git.stash",{count:e.stashCount})),n}function Ice(e,t,n){const s=Mce(CP(t),n);return s.length>0?`${n("git.currentBranch",{branch:e})} — ${s.join(", ")}`:(t==null?void 0:t.computedAt)!==void 0?`${n("git.currentBranch",{branch:e})} — ${n("git.clean")}`:n("git.currentBranch",{branch:e})}function UM({branch:e,status:t,compact:n,worktree:s=!1}){const{t:r}=lt(),i=CP(t),o=hit(i);return l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:Se.gitBranchIconWrap,children:[l.jsx("span",{className:Se.gitBranchIcon,children:s?l.jsx(lC,{size:14,strokeWidth:1.5}):i.detached?l.jsx(OQ,{}):l.jsx(dit,{})}),n&&o&&l.jsx("span",{className:Se.gitBranchBadgeDot,"data-tone":o,"aria-hidden":"true"})]}),l.jsx("span",{className:Se.gitBranchText,children:e}),!n&&l.jsxs("span",{className:Se.gitBranchIndicators,"aria-hidden":"true",children:[i.operation&&l.jsx("span",{className:Se.gitBranchOperation,children:r(`git.operation.${i.operation}`)}),i.conflicted>0&&l.jsxs("span",{className:Se.gitBranchConflicted,children:[l.jsx(Rwe,{}),i.conflicted]}),i.dirty&&l.jsx("span",{className:Se.gitBranchDirtyDot}),i.ahead>0&&l.jsxs("span",{className:Se.gitBranchAheadBehind,children:["↑",i.ahead]}),i.behind>0&&l.jsxs("span",{className:Se.gitBranchAheadBehind,children:["↓",i.behind]}),i.stashCount>0&&l.jsxs("span",{className:Se.gitBranchStash,children:[l.jsx(Fye,{}),i.stashCount]})]})]})}function Rce({branch:e,status:t,compact:n=!1,onOpenDiff:s,worktree:r=!1}){const{t:i}=lt(),o=CP(t),a=Mce(o,i),c=Ice(e,t,i),u=`${Se.gitBranchChip} ${n?Se.gitBranchChipCompact:""} ${s?Se.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},f=l.jsx(UM,{branch:e,status:t,compact:n,worktree:r});return l.jsx(nh,{delayDuration:300,children:l.jsxs(sh,{children:[l.jsx(rh,{asChild:!0,children:s?l.jsx("button",{type:"button",className:u,"aria-label":c,onClick:s,...d,children:f}):l.jsx("output",{className:u,"aria-label":c,...d,children:f})}),l.jsx(ih,{side:"top",children:l.jsxs("div",{className:Se.gitBranchTooltip,children:[l.jsx("div",{className:Se.gitBranchTooltipTitle,children:o.detached?`${i("git.detached")} (${e})`:e}),a.length>0?a.map(m=>l.jsx("div",{className:Se.gitBranchTooltipRow,children:m},m)):(t==null?void 0:t.computedAt)!==void 0?l.jsx("div",{className:Se.gitBranchTooltipRow,children:i("git.clean")}):null]})})]})})}const fit="_wrap_11orh_1",mit="_chip_11orh_8",pit="_chipBranch_11orh_34",git="_chipWorktree_11orh_44",bit="_chipCompact_11orh_54",yit="_chipIcon_11orh_57",wit="_chipText_11orh_66",vit="_chevron_11orh_71",xit="_chevronOpen_11orh_78",kit="_clearBtn_11orh_82",_it="_popover_11orh_104",Sit="_header_11orh_110",Cit="_option_11orh_120",Tit="_optionSelected_11orh_140",Eit="_optionIcon_11orh_144",jit="_iconCurrent_11orh_159",Ait="_iconBranch_11orh_164",Nit="_iconWorktree_11orh_169",Mit="_optionText_11orh_175",Iit="_optionName_11orh_183",Rit="_optionDesc_11orh_187",Dit="_checkCurrent_11orh_193",Pit="_checkBranch_11orh_194",Lit="_checkWorktree_11orh_195",Oit="_branchBox_11orh_213",$it="_branchRow_11orh_220",Bit="_branchLabel_11orh_225",zit="_branchInputWrap_11orh_231",Fit="_branchInput_11orh_231",Hit="_branchInputInvalid_11orh_257",qit="_branchInputValid_11orh_261",Uit="_branchStatus_11orh_266",Wit="_branchHint_11orh_274",Vit="_branchHintError_11orh_280",Git="_footer_11orh_285",Kit="_cmd_11orh_294",Yit="_confirmBranch_11orh_304",Xit="_confirmWorktree_11orh_305",is={wrap:fit,chip:mit,chipBranch:pit,chipWorktree:git,chipCompact:bit,chipIcon:yit,chipText:wit,chevron:vit,chevronOpen:xit,clearBtn:kit,popover:_it,header:Sit,option:Cit,optionSelected:Tit,optionIcon:Eit,iconCurrent:jit,iconBranch:Ait,iconWorktree:Nit,optionText:Mit,optionName:Iit,optionDesc:Rit,checkCurrent:Dit,checkBranch:Pit,checkWorktree:Lit,branchBox:Oit,branchRow:$it,branchLabel:Bit,branchInputWrap:zit,branchInput:Fit,branchInputInvalid:Hit,branchInputValid:qit,branchStatus:Uit,branchHint:Wit,branchHintError:Vit,footer:Git,cmd:Kit,confirmBranch:Yit,confirmWorktree:Xit},Qit=1e3,Jit=200,UW=new TextEncoder;function WM(e){return e?!(/[^\p{L}\p{N}._/-]/u.test(e)||e.includes("..")||e.includes("//")||e.startsWith(".")||e.startsWith("-")||e.startsWith("/")||e.endsWith("/")||e.endsWith(".")||e.endsWith(".git")||e.includes("@{")||e.split("/").some(t=>t.startsWith(".")||t.endsWith(".lock"))||e.toUpperCase()==="HEAD"||UW.encode(e).length>Qit||e.split("/").some(t=>UW.encode(t).length>Jit)):!1}function Zit({branch:e,compact:t=!1,intent:n,onIntentChange:s}){const{t:r}=lt(),[i,o]=h.useState(!1),[a,c]=h.useState(n.mode),[u,d]=h.useState(n.mode==="branch"?n.name:""),f=h.useRef(null),m=h.useMemo(()=>WM(u),[u]),p=h.useCallback(C=>{o(C),C&&(c(n.mode),d(n.mode==="branch"?n.name:""))},[n]),g=h.useCallback(()=>{s({mode:"current"}),o(!1)},[s]),b=h.useCallback(()=>{!u||!m||(s({mode:"branch",name:u}),o(!1))},[u,m,s]),v=h.useCallback(()=>{s({mode:"worktree"}),o(!1)},[s]),y=h.useCallback(C=>{C.stopPropagation(),s({mode:"current"}),o(!1)},[s]),w=n.mode==="branch",x=n.mode==="worktree",k=w?`→ ${n.name}`:x?r("gitMode.worktree"):e;return l.jsxs("span",{className:is.wrap,children:[l.jsxs(np,{open:i,onOpenChange:p,children:[l.jsx(V0,{asChild:!0,children:l.jsxs("button",{type:"button",className:`${is.chip} ${w?is.chipBranch:""} ${x?is.chipWorktree:""} ${t?is.chipCompact:""}`,"data-web-shell-git-branch":!0,"data-testid":"git-mode-chip","aria-label":`${r("gitMode.title")}: ${k}`,children:[l.jsx("span",{className:is.chipIcon,children:x?l.jsx(lC,{size:14,strokeWidth:1.5}):l.jsx(aC,{size:15,strokeWidth:1.5})}),!t&&l.jsx("span",{className:is.chipText,children:k}),l.jsx("svg",{className:`${is.chevron} ${i?is.chevronOpen:""}`,viewBox:"0 0 16 16",fill:"currentColor",width:9,height:9,"aria-hidden":"true",children:l.jsx("path",{d:"M4.427 7.427l3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"})})]})}),l.jsxs(sp,{ref:f,side:"top",align:"end",sideOffset:8,className:is.popover,onClick:C=>C.stopPropagation(),onOpenAutoFocus:C=>C.preventDefault(),onInteractOutside:C=>{var T;(T=f.current)!=null&&T.contains(C.target)&&C.preventDefault()},children:[l.jsx("div",{className:is.header,children:r("gitMode.title")}),l.jsxs("button",{type:"button",role:"radio","aria-checked":a==="current",className:`${is.option} ${a==="current"?is.optionSelected:""}`,onClick:g,children:[l.jsx("span",{className:`${is.optionIcon} ${is.iconCurrent}`,children:l.jsx(OQ,{size:15,strokeWidth:1.5})}),l.jsxs("span",{className:is.optionText,children:[l.jsx("span",{className:is.optionName,children:r("gitMode.current")}),l.jsx("span",{className:is.optionDesc,children:r("gitMode.currentDesc",{branch:e})})]}),a==="current"&&l.jsx("span",{className:is.checkCurrent,"aria-hidden":"true",children:"✓"})]}),l.jsxs("button",{type:"button",role:"radio","aria-checked":a==="branch",className:`${is.option} ${a==="branch"?is.optionSelected:""}`,onClick:()=>c("branch"),children:[l.jsx("span",{className:`${is.optionIcon} ${is.iconBranch}`,children:l.jsx(aC,{size:15,strokeWidth:1.5})}),l.jsxs("span",{className:is.optionText,children:[l.jsx("span",{className:is.optionName,children:r("gitMode.branch")}),l.jsx("span",{className:is.optionDesc,children:r("gitMode.branchDesc",{branch:e})})]}),a==="branch"&&l.jsx("span",{className:is.checkBranch,"aria-hidden":"true",children:"✓"})]}),a==="branch"&&l.jsxs("div",{className:is.branchBox,children:[l.jsxs("div",{className:is.branchRow,children:[l.jsx("label",{className:is.branchLabel,htmlFor:"git-mode-branch-input",children:r("gitMode.branchLabel")}),l.jsxs("span",{className:is.branchInputWrap,children:[l.jsx("input",{className:`${is.branchInput} ${u&&!m?is.branchInputInvalid:""} ${u&&m?is.branchInputValid:""}`,value:u,onChange:C=>d(C.target.value),onKeyDown:C=>{C.key==="Enter"&&u&&m&&b()},placeholder:r("gitMode.branchPlaceholder"),autoFocus:!0,spellCheck:!1,autoComplete:"off",id:"git-mode-branch-input","data-testid":"git-mode-branch-input"}),u&&l.jsx("span",{className:is.branchStatus,"aria-hidden":"true",style:{color:m?"var(--git-mode-valid)":"var(--git-mode-invalid)"},children:m?"✓":"✗"})]})]}),l.jsx("div",{className:`${is.branchHint} ${u&&!m?is.branchHintError:""}`,children:r(u&&!m?"gitMode.branchInvalidName":"gitMode.branchHint")}),u&&m&&l.jsx("div",{className:is.branchHint,children:r("gitMode.branchConflictWarning")})]}),l.jsxs("button",{type:"button",role:"radio","aria-checked":a==="worktree",className:`${is.option} ${a==="worktree"?is.optionSelected:""}`,onClick:()=>c("worktree"),children:[l.jsx("span",{className:`${is.optionIcon} ${is.iconWorktree}`,children:l.jsx(lC,{size:15,strokeWidth:1.5})}),l.jsxs("span",{className:is.optionText,children:[l.jsx("span",{className:is.optionName,children:r("gitMode.worktree")}),l.jsx("span",{className:is.optionDesc,children:r("gitMode.worktreeDesc")})]}),a==="worktree"&&l.jsx("span",{className:is.checkWorktree,"aria-hidden":"true",children:"✓"})]}),l.jsxs("div",{className:is.footer,children:[l.jsx("span",{className:is.cmd,children:a==="branch"?`$ git checkout -b ${u||"…"} ← ${e}`:a==="worktree"?"$ git worktree add .qwen/worktrees/<slug>":`$ git checkout ${e}`}),a==="branch"&&l.jsx("button",{type:"button",className:is.confirmBranch,disabled:!u||!m,onClick:b,"data-testid":"git-mode-confirm-branch",children:r("gitMode.confirmBranch")}),a==="worktree"&&l.jsx("button",{type:"button",className:is.confirmWorktree,onClick:v,"data-testid":"git-mode-confirm-worktree",children:r("gitMode.confirmWorktree")})]})]})]}),(w||x)&&l.jsx("button",{type:"button",className:is.clearBtn,onClick:y,"aria-label":r("gitMode.resetToCurrent"),title:r("gitMode.resetToCurrent"),"data-testid":"git-mode-clear",children:"✕"})]})}const eot="_picker_11vtj_1",tot="_searchWrap_11vtj_10",not="_searchIcon_11vtj_18",sot="_searchInput_11vtj_23",rot="_list_11vtj_41",iot="_section_11vtj_47",oot="_sectionHeader_11vtj_51",aot="_sectionChevron_11vtj_69",lot="_sectionChevronCollapsed_11vtj_74",cot="_item_11vtj_78",uot="_itemActive_11vtj_101",dot="_itemIcon_11vtj_105",hot="_itemStar_11vtj_112",fot="_itemName_11vtj_116",mot="_itemMeta_11vtj_122",pot="_itemAheadBehind_11vtj_131",got="_itemUpstream_11vtj_137",bot="_separator_11vtj_145",yot="_actionItem_11vtj_151",wot="_actionIcon_11vtj_176",vot="_actionLabel_11vtj_183",xot="_inlineInput_11vtj_187",kot="_inlineInputField_11vtj_194",_ot="_inlineInputFieldInvalid_11vtj_209",Sot="_statusBar_11vtj_213",Cot="_statusBarError_11vtj_224",Tot="_statusBarSuccess_11vtj_229",Eot="_spin_11vtj_238",jot="_empty_11vtj_247",Aot="_remoteGroupLabel_11vtj_254",Not="_loading_11vtj_262",Bn={picker:eot,searchWrap:tot,searchIcon:not,searchInput:sot,list:rot,section:iot,sectionHeader:oot,sectionChevron:aot,sectionChevronCollapsed:lot,item:cot,itemActive:uot,itemIcon:dot,itemStar:hot,itemName:fot,itemMeta:mot,itemAheadBehind:pot,itemUpstream:got,separator:bot,actionItem:yot,actionIcon:wot,actionLabel:vot,inlineInput:xot,inlineInputField:kot,inlineInputFieldInvalid:_ot,statusBar:Sot,statusBarError:Cot,statusBarSuccess:Tot,spin:Eot,empty:jot,remoteGroupLabel:Aot,loading:Not};function Dce({open:e,onOpenChange:t,workspaceCwd:n,gitCwd:s,onBranchChanged:r,onOpenDiff:i,onOpenCommit:o,children:a}){const{t:c}=lt(),{client:u}=io(),d=h.useMemo(()=>u.workspaceByCwd(n),[u,n]),[f,m]=h.useState(null),[p,g]=h.useState(!1),[b,v]=h.useState(null),[y,w]=h.useState(null),[x,k]=h.useState("info"),[C,T]=h.useState(""),[_,S]=h.useState(!1),[R,A]=h.useState(""),[O,M]=h.useState(!1),[D,$]=h.useState(""),[z,B]=h.useState(null),[j,H]=h.useState({recent:!1,local:!1,remote:!0,tags:!0}),Q=h.useRef(null),I=h.useRef(null),J=h.useRef(0),W=h.useCallback(async()=>{const le=++J.current;g(!0),v(null);try{const Me=await d.workspaceGitBranches(s);if(le!==J.current)return;m(Me)}catch(Me){if(le!==J.current)return;v(Me instanceof Error?Me.message:String(Me))}finally{le===J.current&&g(!1)}},[d,s]);h.useEffect(()=>{e&&(W(),T(""),S(!1),M(!1),A(""),$(""),w(null),setTimeout(()=>{var le;return(le=Q.current)==null?void 0:le.focus()},50))},[e,W]);const P=h.useCallback((le,Me="info")=>{w(le),k(Me)},[]),V=h.useCallback(async le=>{if(!z){B("checkout");try{await d.workspaceGitCheckout(le,s),P(c("branchPicker.checkedOut",{branch:le}),"success"),r==null||r(),t(!1)}catch(Me){P(Me instanceof Error?Me.message:String(Me),"error")}finally{B(null)}}},[d,z,s,r,t,P,c]),ee=h.useCallback(async()=>{if(!z){if(!WM(R)){R&&P(c("branchPicker.invalidBranchName"),"error");return}B("newBranch");try{await d.workspaceGitCreateBranch(R,void 0,s),P(c("branchPicker.createdBranch",{branch:R}),"success"),r==null||r(),t(!1)}catch(le){P(le instanceof Error?le.message:String(le),"error")}finally{B(null)}}},[d,z,s,R,r,t,P,c]),q=h.useCallback(async()=>{D.trim()&&await V(D.trim())},[D,V]),K=h.useCallback(async()=>{if(!z){B("push");try{const le=await d.workspaceGitPush({setUpstream:!0},s);P(le.output||c("branchPicker.pushSuccess"),"success"),await W(),r==null||r()}catch(le){P(le instanceof Error?le.message:String(le),"error")}finally{B(null)}}},[d,z,s,W,r,P,c]),de=h.useCallback(async()=>{if(!z){B("pull");try{const le=await d.workspaceGitPull(void 0,s);P(le.output||c("branchPicker.pullSuccess"),"success"),await W(),r==null||r()}catch(le){P(le instanceof Error?le.message:String(le),"error")}finally{B(null)}}},[d,z,s,W,r,P,c]),re=C.toLowerCase().trim(),ne=h.useCallback(le=>re?le.filter(Me=>Me.name.toLowerCase().includes(re)):le,[re]),U=h.useMemo(()=>f?ne(f.local):[],[f,ne]),Z=h.useMemo(()=>f?ne(f.remote):[],[f,ne]),ge=h.useMemo(()=>f?re?f.tags.filter(le=>le.name.toLowerCase().includes(re)):f.tags:[],[f,re]),ce=h.useMemo(()=>f?re?f.recent.filter(le=>le.toLowerCase().includes(re)):f.recent:[],[f,re]),ue=h.useMemo(()=>{const le=new Map;for(const Me of Z){const We=Me.name.indexOf("/"),at=We>0?Me.name.slice(0,We):"other";let ze=le.get(at);ze||(ze=[],le.set(at,ze)),ze.push(Me)}return le},[Z]),be=!re||c("branchPicker.action.pull").toLowerCase().includes(re)||c("branchPicker.action.push").toLowerCase().includes(re)||c("branchPicker.action.commit").toLowerCase().includes(re)||c("branchPicker.action.newBranch").toLowerCase().includes(re)||c("branchPicker.action.checkoutRef").toLowerCase().includes(re)||c("branchPicker.action.viewChanges").toLowerCase().includes(re);h.useEffect(()=>{be||(S(!1),M(!1))},[be]);const rt=h.useCallback(le=>H(Me=>({...Me,[le]:!Me[le]})),[]);return l.jsxs(np,{open:e,onOpenChange:t,children:[l.jsx(V0,{asChild:!0,children:a}),l.jsxs(sp,{ref:I,className:Bn.picker,side:"bottom",align:"start",sideOffset:4,onClick:le=>le.stopPropagation(),onPointerDownOutside:le=>{var Me;(Me=I.current)!=null&&Me.contains(le.target)&&le.preventDefault()},children:[l.jsxs("div",{className:Bn.searchWrap,children:[l.jsx(Pc,{size:14,className:Bn.searchIcon}),l.jsx("input",{ref:Q,className:Bn.searchInput,placeholder:c("branchPicker.search"),value:C,onChange:le=>T(le.target.value)})]}),l.jsxs("div",{className:Bn.list,children:[p&&l.jsx("div",{className:Bn.loading,children:c("branchPicker.loading")}),b&&l.jsx("div",{className:Bn.empty,children:b}),!p&&!b&&f&&l.jsxs(l.Fragment,{children:[be&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:Bn.actionItem,disabled:!!z,onClick:()=>void de(),children:[z==="pull"?l.jsx(J1,{size:14,className:`${Bn.actionIcon} ${Bn.spin}`}):l.jsx(Dbe,{size:14,className:Bn.actionIcon}),l.jsx("span",{className:Bn.actionLabel,children:c("branchPicker.action.pull")})]}),o&&l.jsxs("button",{type:"button",className:Bn.actionItem,disabled:!!z,onClick:()=>{o(),t(!1)},children:[l.jsx(Iye,{size:14,className:Bn.actionIcon}),l.jsx("span",{className:Bn.actionLabel,children:c("branchPicker.action.commit")})]}),l.jsxs("button",{type:"button",className:Bn.actionItem,disabled:!!z,onClick:()=>void K(),children:[z==="push"?l.jsx(J1,{size:14,className:`${Bn.actionIcon} ${Bn.spin}`}):l.jsx(Obe,{size:14,className:Bn.actionIcon}),l.jsx("span",{className:Bn.actionLabel,children:c("branchPicker.action.push")})]}),i&&l.jsxs("button",{type:"button",className:Bn.actionItem,onClick:()=>{i(),t(!1)},children:[l.jsx(bye,{size:14,className:Bn.actionIcon}),l.jsx("span",{className:Bn.actionLabel,children:c("branchPicker.action.viewChanges")})]}),l.jsx("div",{className:Bn.separator}),l.jsxs("button",{type:"button",className:Bn.actionItem,onClick:()=>{S(!_),M(!1)},children:[l.jsx(z0,{size:14,className:Bn.actionIcon}),l.jsx("span",{className:Bn.actionLabel,children:c("branchPicker.action.newBranch")})]}),_&&l.jsx("div",{className:Bn.inlineInput,children:l.jsx("input",{className:`${Bn.inlineInputField} ${R&&!WM(R)?Bn.inlineInputFieldInvalid:""}`,placeholder:c("branchPicker.newBranchPlaceholder"),value:R,onChange:le=>A(le.target.value),onKeyDown:le=>{le.key==="Enter"&&ee(),le.key==="Escape"&&S(!1)},autoFocus:!0})}),l.jsxs("button",{type:"button",className:Bn.actionItem,onClick:()=>{M(!O),S(!1)},children:[l.jsx(VB,{size:14,className:Bn.actionIcon}),l.jsx("span",{className:Bn.actionLabel,children:c("branchPicker.action.checkoutRef")})]}),O&&l.jsx("div",{className:Bn.inlineInput,children:l.jsx("input",{className:Bn.inlineInputField,placeholder:c("branchPicker.checkoutRefPlaceholder"),value:D,onChange:le=>$(le.target.value),onKeyDown:le=>{le.key==="Enter"&&q(),le.key==="Escape"&&M(!1)},autoFocus:!0})}),l.jsx("div",{className:Bn.separator})]}),ce.length>0&&l.jsx(a2,{label:c("branchPicker.section.recent"),sectionKey:"recent",collapsed:j.recent,onToggle:rt,children:ce.map(le=>l.jsx(NE,{name:le,isHead:le===f.head&&!f.detached,onClick:()=>void V(le)},le))}),l.jsx(a2,{label:c("branchPicker.section.local"),sectionKey:"local",collapsed:j.local,onToggle:rt,children:U.length===0?l.jsx("div",{className:Bn.empty,children:c("branchPicker.noBranches")}):U.map(le=>l.jsx(NE,{name:le.name,isHead:le.isHead,ahead:le.ahead,behind:le.behind,upstream:le.upstream,onClick:()=>void V(le.name)},le.name))}),l.jsx(a2,{label:c("branchPicker.section.remote"),sectionKey:"remote",collapsed:j.remote,onToggle:rt,children:Z.length===0?l.jsx("div",{className:Bn.empty,children:c("branchPicker.noBranches")}):Array.from(ue.entries()).map(([le,Me])=>l.jsxs("div",{children:[l.jsx("div",{className:Bn.remoteGroupLabel,children:le}),Me.map(We=>{const at=We.name.indexOf("/"),ze=at>0?We.name.slice(at+1):We.name;return l.jsx(NE,{name:ze,isHead:!1,onClick:()=>void V(We.name)},We.name)})]},le))}),l.jsx(a2,{label:c("branchPicker.section.tags"),sectionKey:"tags",collapsed:j.tags,onToggle:rt,children:ge.length===0?l.jsx("div",{className:Bn.empty,children:c("branchPicker.noTags")}):ge.map(le=>l.jsxs("button",{type:"button",className:Bn.item,onClick:()=>void V(`refs/tags/${le.name}`),children:[l.jsx(VB,{size:13,className:Bn.itemIcon}),l.jsx("span",{className:Bn.itemName,children:le.name})]},le.name))})]})]}),y&&l.jsx("div",{className:`${Bn.statusBar} ${x==="error"?Bn.statusBarError:x==="success"?Bn.statusBarSuccess:""}`,children:y})]})]})}function a2({label:e,sectionKey:t,collapsed:n,onToggle:s,children:r}){return l.jsxs("div",{className:Bn.section,children:[l.jsxs("button",{type:"button",className:Bn.sectionHeader,"aria-expanded":!n,onClick:()=>s(t),children:[l.jsx(ok,{size:12,className:`${Bn.sectionChevron} ${n?Bn.sectionChevronCollapsed:""}`}),e]}),!n&&r]})}function NE({name:e,isHead:t,ahead:n,behind:s,upstream:r,onClick:i}){return l.jsxs("button",{type:"button",className:`${Bn.item} ${t?Bn.itemActive:""}`,onClick:i,children:[t?l.jsx(Cwe,{size:13,className:`${Bn.itemIcon} ${Bn.itemStar}`}):l.jsx(aC,{size:13,className:Bn.itemIcon}),l.jsx("span",{className:Bn.itemName,children:e}),l.jsxs("span",{className:Bn.itemMeta,children:[(n??0)>0||(s??0)>0?l.jsxs("span",{className:Bn.itemAheadBehind,children:[(n??0)>0&&l.jsxs("span",{children:["↑",n]}),(s??0)>0&&l.jsxs("span",{children:["↓",s]})]}):null,r&&l.jsx("span",{className:Bn.itemUpstream,children:r}),t&&l.jsx(dg,{size:12})]})]})}const Mot="_red_179c6_21",Iot="_orange_179c6_24",Rot="_yellow_179c6_27",Dot="_green_179c6_30",Pot="_blue_179c6_33",Lot="_purple_179c6_36",TP={red:Mot,orange:Iot,yellow:Rot,green:Dot,blue:Pot,purple:Lot};function Oot(){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 $ot({name:e,title:t,ariaLabel:n,color:s,compact:r=!1}){const i=[Se.workspaceChip,r?Se.workspaceChipCompact:"",s?TP[s]:"",s?Se.workspaceChipAccented:""].filter(Boolean).join(" ");return l.jsx(nh,{delayDuration:300,children:l.jsxs(sh,{children:[l.jsx(rh,{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:Se.workspaceChipIcon,children:l.jsx(Oot,{})}),l.jsx("span",{className:Se.workspaceChipText,children:e})]})}),l.jsx(ih,{side:"top",children:t})]})})}function Hh({...e}){return l.jsx(INe,{"data-slot":"dropdown-menu",...e})}function Bot({container:e,...t}){const n=_u();return l.jsx(DNe,{"data-slot":"dropdown-menu-portal",container:e??n??void 0,...t})}const qh=h.forwardRef(function(t,n){return l.jsx(RNe,{ref:n,"data-slot":"dropdown-menu-trigger",...t})});function Uh({className:e,align:t="start",sideOffset:n=4,...s}){return l.jsx(Bot,{children:l.jsx(PNe,{"data-slot":"dropdown-menu-content",sideOffset:n,align:t,className:en("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 Lm({...e}){return l.jsx(LNe,{"data-slot":"dropdown-menu-group",...e})}function ho({className:e,inset:t,variant:n="default",...s}){return l.jsx(ONe,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:en("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 zot({...e}){return l.jsx($Ne,{"data-slot":"dropdown-menu-radio-group",...e})}function Fot({className:e,children:t,inset:n,...s}){return l.jsxs(BNe,{"data-slot":"dropdown-menu-radio-item","data-inset":n,className:en("relative flex 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 focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...s,children:[l.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:l.jsx(zNe,{children:l.jsx(dg,{})})}),t]})}function Pce({className:e,...t}){return l.jsx(FNe,{"data-slot":"dropdown-menu-separator",className:en("-mx-1 my-1 h-px bg-border",e),...t})}function VM({...e}){return l.jsx(HNe,{"data-slot":"dropdown-menu-sub",...e})}const GM=h.forwardRef(function({className:t,inset:n,children:s,...r},i){return l.jsxs(qNe,{ref:i,"data-slot":"dropdown-menu-sub-trigger","data-inset":n,className:en("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",t),...r,children:[s,l.jsx(ok,{className:"ml-auto"})]})});function KM({className:e,...t}){return l.jsx(UNe,{"data-slot":"dropdown-menu-sub-content",className:en("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 Hot({workspaces:e,selectedWorkspaceCwd:t,disabled:n,busy:s,scratchSupported:r,existingFolderSupported:i,className:o,onSelectWorkspace:a,onCreateScratch:c,onOpenExistingFolder:u}){const{t:d}=lt(),[f,m]=h.useState(!1),[p,g]=h.useState(!1),b=h.useRef(!1),v=h.useRef(!1),y=e.find(x=>t?x.cwd===t:x.primary),w=r||i;return e.length<=1&&!w?null:l.jsx(nh,{delayDuration:300,children:l.jsxs(Hh,{open:f,onOpenChange:x=>{b.current=x,m(x),x&&(v.current=!0,g(!1))},children:[l.jsxs(sh,{open:p,onOpenChange:x=>{x&&(f||v.current)||g(x)},children:[l.jsx(rh,{asChild:!0,children:l.jsx(qh,{asChild:!0,disabled:n||s,children:l.jsxs("button",{type:"button",className:o,"aria-label":d("sidebar.workspaceSelectLabel"),onPointerEnter:()=>{b.current||(v.current=!1)},onPointerLeave:()=>{v.current=!1,g(!1)},onBlur:()=>{b.current||(v.current=!1,g(!1))},children:[l.jsx(oC,{size:16,strokeWidth:1.2}),l.jsx("span",{"data-slot":"select-value",children:(y==null?void 0:y.label)??""})]})})}),l.jsx(ih,{side:"top",children:y==null?void 0:y.label})]}),l.jsxs(Uh,{align:"start",className:"min-w-56",children:[l.jsx(zot,{value:y==null?void 0:y.id,onValueChange:x=>{const k=e.find(C=>C.id===x);k!=null&&k.trusted&&a(k.primary?void 0:k.cwd)},children:e.map(x=>l.jsxs(Fot,{value:x.id,disabled:!x.trusted,title:x.cwd,children:[l.jsx("span",{className:"min-w-0 flex-1 truncate",children:x.label}),!x.trusted&&l.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[l.jsx(Vye,{}),d("sidebar.workspaceUntrusted")]})]},x.id))}),w&&l.jsxs(l.Fragment,{children:[l.jsx(Pce,{}),l.jsxs(VM,{children:[l.jsxs(GM,{disabled:s,children:[l.jsx(Eye,{}),d("sidebar.newWorkspace")]}),l.jsxs(KM,{children:[r&&l.jsx(ho,{onSelect:c,children:d("sidebar.startFromScratch")}),i&&l.jsx(ho,{onSelect:u,children:d("sidebar.useExistingFolder")})]})]})]})]})]})})}function qot(e,t){const n=t.trim().toLocaleLowerCase();return n?e.filter(s=>`${s.label}
${s.searchText??""}`.toLocaleLowerCase().includes(n)):[...e]}function WW({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 Uot({availableWidth:e,items:t,currentVisibility:n,expansionMargin:s}){const r=WW({availableWidth:e,items:t}),i=WW({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 Wot({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 Vot({currentModelLabel:e,lastConfirmedModelLabel:t}){const n=e||t;return{modelLabel:n,modelLabelReady:!!n,nextConfirmedModelLabel:n}}const Got=["approvalMode","gitBranch","model","widthMode","voice","workspace"],Kot=new Set(Got),Yot={"&":{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 VW(){return typeof window>"u"?!1:typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches}function Xot({tag:e,content:t,tooltip:n,onActivate:s,onRemove:r}){const i=h.useRef(null),o=_u(),a=n!=null,c=l.jsx("span",{className:Se.tagContent,"data-web-shell-composer-tag-trigger":!0,role:s?"button":void 0,tabIndex:s||a?0:void 0,onClick:d=>{var f;s&&(d.stopPropagation(),s(((f=i.current)==null?void 0:f.getBoundingClientRect())??d.currentTarget.getBoundingClientRect()))},onKeyDown:d=>{var f;s&&(d.key!=="Enter"&&d.key!==" "||(d.preventDefault(),s(((f=i.current)==null?void 0:f.getBoundingClientRect())??d.currentTarget.getBoundingClientRect())))},children:t}),u=l.jsxs("span",{ref:i,className:Se.tag,"data-web-shell-composer-tag":!0,children:[a?l.jsx(Ure,{asChild:!0,children:c}):c,r&&l.jsx("button",{type:"button",className:Se.tagRemove,"aria-label":`Remove ${aP(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(qre,{disableHoverableContent:!1,children:[u,l.jsx(Wre,{container:o??void 0,children:l.jsx(Vre,{className:Se.tagTooltip,"data-web-shell-composer-tag-tooltip":!0,sideOffset:6,collisionPadding:8,avoidCollisions:!0,children:n})})]}):u}function Qot(){return l.jsx("svg",{className:Se.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 Jot(){return l.jsx("span",{className:Se.stopIcon,"aria-hidden":"true"})}function Zot(){return l.jsx("span",{className:Se.loadingIcon,"aria-hidden":"true"})}function eat(){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 tat(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,y=b-v;if(Math.abs(y)<.001){o=b,c(b,a);return}const w=performance.now(),x=k=>{const C=Math.min((k-w)/220,1);o=v+y*(1-(1-C)**2),c(o,a),n=C<1?window.requestAnimationFrame(x):void 0};n=window.requestAnimationFrame(x)},d=()=>{s!==void 0&&window.cancelAnimationFrame(s);const b=a,v=performance.now(),y=w=>{const x=Math.min((w-v)/300,1);a=b*(1-x),c(o,a),s=x<1?window.requestAnimationFrame(y):void 0};s=window.requestAnimationFrame(y)},f=b=>{b?e.setAttribute("data-dac-typing",""):e.removeAttribute("data-dac-typing")},m=()=>u(1),p=()=>{u(0),f(!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),f(!0),i!==void 0&&window.clearTimeout(i),i=window.setTimeout(()=>f(!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),f(!1)}}function nat({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 ME(){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 sat(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 rat=[{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 iat(){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 Lce(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 oat(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]??Lce(e,t)}function GW({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[f,m]=h.useState(""),[p,g]=h.useState(null),b=h.useRef(!1),v=h.useRef(!1),y=h.useRef(null),w=t.some(C=>C.description||C.icon),x=c?qot(t,f):t;h.useEffect(()=>{e||m("")},[e]);const k=w||a;return l.jsxs(np,{open:e,onOpenChange:C=>{var T;C&&(b.current=!1,v.current=!1,g(((T=y.current)==null?void 0:T.closest("[data-web-shell-root]"))??null)),s(C)},children:[o?l.jsx(nh,{delayDuration:300,children:l.jsxs(sh,{children:[l.jsx(rh,{asChild:!0,children:l.jsx(V0,{ref:y,asChild:!0,children:i})}),l.jsx(ih,{side:"top",children:o})]})}):l.jsx(V0,{ref:y,asChild:!0,children:i}),l.jsxs(sp,{side:"top",align:"start",collisionPadding:8,collisionBoundary:p??void 0,"data-web-shell-toolbar-popover":!0,onClick:C=>C.stopPropagation(),onPointerDownOutside:C=>{const T=C.target;T instanceof Element&&T.closest("[data-web-shell-toolbar-popover-trigger]")&&(v.current=!0)},onCloseAutoFocus:C=>{if(v.current){C.preventDefault(),v.current=!1;return}if(document.activeElement instanceof HTMLElement&&document.activeElement.closest("[data-web-shell-toolbar-popover]")){C.preventDefault();return}b.current&&(C.preventDefault(),b.current=!1)},children:[c&&l.jsx(Pr,{type:"search",value:f,"aria-label":u,placeholder:u,autoComplete:"off",onChange:C=>m(C.target.value)}),l.jsxs("div",{className:`${Se.dropdownList} ${w?Se.dropdownRich:a?Se.dropdownCheck:""} ${c?Se.dropdownListConstrained:""}`,children:[x.map(C=>l.jsx("button",{type:"button",className:`${Se.dropdownItem} ${C.id===n?Se.dropdownItemActive:""}`,onClick:()=>{b.current=!0,r(C.id)},children:k?l.jsxs(l.Fragment,{children:[w&&l.jsx("span",{className:Se.dropdownItemIcon,children:C.icon}),l.jsxs("span",{className:Se.dropdownItemContent,children:[l.jsx("span",{className:Se.dropdownItemLabel,children:C.label}),C.description&&l.jsx("span",{className:Se.dropdownItemDesc,children:C.description})]}),l.jsx("span",{className:Se.dropdownItemCheck,children:C.id===n?l.jsx(iat,{}):null})]}):C.label},C.id)),x.length===0&&d&&l.jsx("div",{className:Se.dropdownEmpty,role:"status",children:d(f)})]})]})]})}function aat({menu:e,anchorRef:t,panelRef:n,detailRef:s,onClose:r,onSelect:i,onAccept:o}){const a=h.useRef([]),c=h.useRef(null),[u,d]=h.useState(null),[f,m]=h.useState(null);h.useEffect(()=>{var g;(g=a.current[e.selectedIndex])==null||g.scrollIntoView({block:"nearest"})},[e.items,e.selectedIndex]),h.useEffect(()=>{m(null)},[e.items]),h.useLayoutEffect(()=>{var g;d(((g=t.current)==null?void 0:g.closest("[data-web-shell-root]"))??null)},[t]),h.useEffect(()=>{const g=b=>{b.key!=="Escape"||!b.isComposing&&b.keyCode!==229||(Object.defineProperty(b,"key",{configurable:!0,value:"Process"}),window.addEventListener("keydown",v=>{v===b&&Reflect.deleteProperty(b,"key")},{once:!0}))};return window.addEventListener("keydown",g,{capture:!0}),()=>{window.removeEventListener("keydown",g,{capture:!0})}},[]);const p=Ort(e.items,e.kind);return l.jsxs(l.Fragment,{children:[l.jsxs(np,{open:!0,onOpenChange:g=>{g||r()},children:[l.jsx(GH,{virtualRef:t}),l.jsx(sp,{ref:n,side:"top",align:"start",alignOffset:16,sideOffset:8,avoidCollisions:!1,collisionPadding:12,collisionBoundary:u??void 0,className:"duration-0 data-open:animate-none data-closed:animate-none",role:"listbox","data-web-shell-slash-menu":!0,onOpenAutoFocus:g=>g.preventDefault(),onCloseAutoFocus:g=>g.preventDefault(),onInteractOutside:g=>{var v,y;const b=g.target;b instanceof Node&&((v=t.current)!=null&&v.contains(b)||(y=s.current)!=null&&y.contains(b))&&g.preventDefault()},onMouseDown:g=>g.preventDefault(),onMouseLeave:g=>{var v;const b=g.relatedTarget;b instanceof Node&&((v=s.current)!=null&&v.contains(b))||m(null)},children:l.jsx("div",{className:Se.slashPanel,children:l.jsx("div",{className:Se.slashPanelBody,children:l.jsx("div",{className:Se.slashList,onScroll:()=>m(null),children:e.items.map((g,b)=>{const v=p[b];return l.jsxs("div",{className:Se.slashEntry,children:[v.showHeader&&l.jsxs(l.Fragment,{children:[v.showDivider&&l.jsx("div",{className:Se.slashSection}),l.jsxs("div",{className:Se.slashSectionHeader,children:[l.jsx("span",{children:g.section}),v.count>0?l.jsx("span",{className:Se.slashSectionCount,children:v.count}):null]})]}),l.jsxs("button",{ref:y=>{a.current[b]=y},type:"button",role:"option","aria-selected":b===e.selectedIndex,"data-has-description":g.detail?"":void 0,className:`${Se.slashItem} ${b===e.selectedIndex?Se.slashItemActive:""}`,onMouseEnter:y=>{if(i(b),!g.detail){m(null);return}c.current=y.currentTarget;const w=y.currentTarget.getBoundingClientRect(),x=u==null?void 0:u.getBoundingClientRect(),k=(x==null?void 0:x.left)??0,C=(x==null?void 0:x.right)??window.innerWidth,T=(x==null?void 0:x.top)??0,_=(x==null?void 0:x.bottom)??window.innerHeight,S=Math.min(320,C-k-24),R=C-w.right>=S+8?"right":w.left-k>=S+8?"left":w.top-T>=_-w.bottom?"top":"bottom";m({label:g.label,detail:g.detail,side:R})},onMouseDown:y=>{y.preventDefault(),y.stopPropagation(),o(b)},children:[l.jsx("span",{className:Se.slashCommand,children:g.label}),g.detail&&l.jsx("span",{className:Se.slashDescription,children:g.detail})]})]},`${g.id}:${b}`)})})})})})]}),l.jsxs(np,{open:!!f,onOpenChange:g=>{g||m(null)},children:[l.jsx(GH,{virtualRef:c}),f&&l.jsx(sp,{ref:s,side:f.side,align:"start",sideOffset:8,collisionPadding:12,collisionBoundary:u??void 0,className:"duration-0 data-open:animate-none data-closed:animate-none","data-web-shell-slash-detail":!0,onOpenAutoFocus:g=>g.preventDefault(),onCloseAutoFocus:g=>g.preventDefault(),onMouseLeave:g=>{var v;const b=g.relatedTarget;b instanceof Node&&((v=n.current)!=null&&v.contains(b))||m(null)},children:l.jsxs("div",{className:Se.slashDetail,children:[l.jsx("div",{className:Se.slashDetailCommand,children:f.label}),l.jsx("div",{className:Se.slashDetailText,children:f.detail})]})})]})]})}function lat({actions:e,onRun:t,onPressKey:n,showKeyHints:s=!0}){const{t:r}=lt();return l.jsxs("div",{className:Se.quickActionsPanel,onMouseDown:i=>i.stopPropagation(),onClick:i=>i.stopPropagation(),children:[l.jsx("div",{className:Se.quickActionsHeader,children:r("quickActions.title")}),l.jsxs("div",{className:Se.quickActionsLayout,children:[l.jsx("div",{className:Se.quickActionsGrid,children:e.map(i=>l.jsx("button",{type:"button",className:Se.quickAction,onClick:()=>t(i),children:l.jsx("span",{className:Se.quickActionLabel,children:i.label})},i.id))}),s&&l.jsx("div",{className:Se.quickKeysGrid,children:rat.map(i=>l.jsx("button",{type:"button",className:Se.quickKey,title:r(i.descriptionKey),onMouseDown:o=>o.preventDefault(),onClick:()=>n(i),children:l.jsx("span",{className:Se.quickKeyLabel,children:i.label})},i.id))})]})]})}const Oce=h.memo(h.forwardRef(function(t,n){var on;const{onSubmit:s,onInputTextChange:r,onAttachmentsChange:i,onCycleMode:o,onToggleShortcuts:a,onCancel:c,isRunning:u=!1,isPreparing:d=!1,cancelArmed:f=!1,disabled:m=!1,placeholderText:p="Type a message...",commands:g,skills:b=[],slashCommandCategoryOrder:v,queuedMessages:y=[],onPopQueuedMessages:w,currentMode:x="default",currentModel:k="",gitBranch:C,gitWorktree:T,gitCwd:_,gitModeIntent:S,onGitModeIntentChange:R,gitStatus:A,onOpenGitDiff:O,onOpenCommit:M,workspaceName:D,workspaceTitle:$,workspaceColor:z,chatWidthMode:B="1000",showChatWidthToggle:j=!0,chatWidthToggleMin:H,visibleToolbarActions:Q,availableModels:I=[],onSelectMode:J,onSelectModel:W,workspaces:P,selectedWorkspaceCwd:V,workspaceSelectionDisabled:ee=!1,onSelectWorkspace:q,scratchWorkspaceSupported:K=!1,existingFolderWorkspaceSupported:de=!1,workspaceMutationBusy:re=!1,onCreateScratchWorkspace:ne,onOpenExistingWorkspace:U,atWorkspaceCwd:Z,onChatWidthModeChange:ge,onFocusFooter:ce,dialogOpen:ue=!1,followupState:be,onAcceptFollowup:rt,onDismissFollowup:le,sessionId:Me,sessionName:We,composerInput:at,composerInputVersion:ze,builtinAtProviders:rn,atProviders:Wt,composerTagIcons:zt,voiceTarget:ae,voiceStatusRevision:je}=t,{renderComposerToolbarStart:it,renderComposerToolbarEnd:gt,renderComposerToolbarRight:wt,renderComposerTag:Ke,renderComposerTagTooltip:un,onComposerTagClick:me,parseUserMessageContent:ht}=ku(),Oe=kqe({onSubmit:s,onInputTextChange:r,onCycleMode:o,onToggleShortcuts:a,disabled:m,placeholderText:p,commands:g,skills:b,slashCommandCategoryOrder:v,queuedMessages:y,onPopQueuedMessages:w,currentMode:x,onFocusFooter:ce,dialogOpen:ue,followupState:be,onAcceptFollowup:rt,onDismissFollowup:le,sessionId:Me,sessionName:We,composerInput:at,composerInputVersion:ze,builtinAtProviders:rn,atProviders:Wt,atWorkspaceCwd:Z,composerTagIcons:zt,parseUserMessageContent:ht,renderComposerTag:Ke,renderComposerTagTooltip:un,onComposerTagClick:me,editorTheme:Yot}),{t:Ne}=lt();h.useImperativeHandle(n,()=>Oe.handle,[Oe.handle]),h.useEffect(()=>{i==null||i(Oe.hasAttachments)},[Oe.hasAttachments,i]);const[St,Ue]=h.useState(!1),[ve,Fe]=h.useState(!1),[ie,Pe]=h.useState(!1),[et,He]=h.useState(!1),[Ae,vt]=h.useState(VW),vn=h.useRef(null),Ce=h.useRef(null),yt=h.useRef(null),Ft=h.useRef(null),De=h.useRef(null),Xe=h.useRef(null),$e=h.useRef(null),Ht=h.useRef(null),ke=h.useRef(null),Fn=h.useRef(null),Ve=h.useRef(null),[ft,Lt]=h.useState(!1),[gn,Tn]=h.useState(!1),[Xn,_r]=h.useState({workspaceSelect:!1,workspace:!1,gitBranch:!1,mode:!1,model:!1}),[zr,Ar]=h.useState(""),jt=Oe.slashMenu,Sn=Oe.closeSlashMenu,Hn=Oe.atMenu,Ln=Oe.closeAtMenu,gs=!!jt,qn=!!Hn,Dn=Oe.viewRef;h.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const Le=window.matchMedia("(hover: none), (pointer: coarse)"),Qt=()=>vt(VW());return Qt(),Le.addEventListener("change",Qt),()=>Le.removeEventListener("change",Qt)},[]),h.useEffect(()=>{Ae||Pe(!1)},[Ae]),h.useEffect(()=>{if(!gs&&!qn)return;const Le=Qt=>{var zs,ns,si;const Un=Qt.target,Kn=vn.current;Un instanceof Node&&Kn&&!Kn.contains(Un)&&!((zs=Ce.current)!=null&&zs.contains(Un))&&!((ns=yt.current)!=null&&ns.contains(Un))&&!((si=Ft.current)!=null&&si.contains(Un))&&(Sn(),Ln())};return window.addEventListener("mousedown",Le),window.addEventListener("touchstart",Le),()=>{window.removeEventListener("mousedown",Le),window.removeEventListener("touchstart",Le)}},[qn,gs,Ln,Sn]),h.useEffect(()=>{var Un;const Le=vn.current,Qt=(Un=Dn.current)==null?void 0:Un.contentDOM;if(!(!Le||!Qt))return tat(Le,Qt)},[Dn]),h.useEffect(()=>{const Le=vn.current,Qt=H;if(!Le||Qt===void 0){Lt(!1);return}const Un=()=>{Lt(Le.getBoundingClientRect().width>=Qt-50)};Un();const Kn=new ResizeObserver(Un);return Kn.observe(Le),()=>Kn.disconnect()},[H]);const Rs=h.useMemo(()=>Jb.map(Le=>({id:Le,label:oat(Le,Ne),description:Ne(`mode.desc.${Le}`),icon:l.jsx(Kw,{mode:Le})})),[Ne]),ts=h.useMemo(()=>{if(!Q)return null;const Le=Q.filter(Qt=>Kot.has(Qt));return new Set(Le)},[Q]),Bs=Le=>ts?ts.has(Le):!0,Sr=Bs("approvalMode"),Nr=Bs("model"),pi=h.useMemo(()=>new Set(g.map(Le=>Le.name.replace(/^\/+/,""))),[g]),lr=h.useCallback(Le=>pi.has(Le),[pi]),Ds=h.useMemo(()=>[{id:"new",label:Ne("quickActions.new"),action:{type:"run",command:"/new"}},{id:"resume",label:Ne("quickActions.resume"),action:{type:"run",command:"/resume"}},{id:"delete",label:Ne("quickActions.delete"),action:{type:"run",command:"/delete"}},{id:"branch",label:Ne("quickActions.branch"),action:{type:"run",command:"/branch"}},{id:"rewind",label:Ne("quickActions.rewind"),action:{type:"run",command:"/rewind"}},{id:"history-search",label:Ne("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:Ne("quickActions.recap"),action:{type:"run",command:"/recap"}},{id:"stats",label:Ne("quickActions.stats"),action:{type:"run",command:"/stats"}},{id:"context",label:Ne("quickActions.context"),action:{type:"run",command:"/context"}},{id:"status",label:Ne("quickActions.status"),action:{type:"run",command:"/status"}},{id:"skills",label:Ne("quickActions.skills"),action:{type:"run",command:"/skills detail"}},{id:"tools",label:Ne("quickActions.tools"),action:{type:"run",command:"/tools desc"}},{id:"agents",label:Ne("quickActions.agents"),action:{type:"run",command:"/agents"}},{id:"mcp",label:Ne("quickActions.mcp"),action:{type:"run",command:"/mcp"}},{id:"memory",label:Ne("quickActions.memory"),action:{type:"run",command:"/memory"}},{id:"theme",label:Ne("quickActions.theme"),action:{type:"run",command:"/theme"}},{id:"shell",label:Oe.shellMode?Ne("quickActions.exitShellMode"):Ne("quickActions.shellMode"),action:{type:"shell"}},{id:"goal",label:Ne("quickActions.setGoal"),action:{type:"insert",text:"/goal "}}].filter(Le=>{const Qt=sat(Le);return!Qt||lr(Qt)}),[Oe.shellMode,lr,Ne]),gi=h.useMemo(()=>I.map(Le=>({id:Le.id,label:vm(Le.label||Le.id),searchText:`${Le.label??""}
${Le.id}`})),[I]),xe=h.useCallback(Le=>{J==null||J(Le),Ue(!1),Oe.focus()},[J,Oe]),Ye=h.useCallback(Le=>{W==null||W(Le),Fe(!1),Oe.focus()},[W,Oe]),st=h.useCallback(Le=>{if(Oe.mobileComposer){Le.ctrlKey&&Le.key==="r"&&Oe.searchState.openHistorySearch();return}const Qt=Oe.viewRef.current;Qt&&(Qt.focus(),Qt.contentDOM.dispatchEvent(new KeyboardEvent("keydown",{...Le,bubbles:!0,cancelable:!0})))},[Oe]),Et=h.useCallback(Le=>{if(Pe(!1),Ue(!1),Fe(!1),Oe.closeSlashMenu(),Oe.closeAtMenu(),Le.action.type==="insert"){Oe.insertText(Le.action.text,{mode:"replace"});return}if(Le.action.type==="shell"){Oe.toggleShellMode();return}if(Le.action.type==="key"){st(Le.action.item.event);return}s(Le.action.command)},[Oe,st,s]),Mt=h.useCallback(Le=>{st(Le.event),Le.id==="ctrl-r"&&Pe(!1)},[st]),{searchMode:cs,searchQuery:bs,searchMatches:sr,searchActiveIndex:Qn,searchInputRef:br,searchUiRef:Ns,closeSearch:Fr,restoreSearchMatch:yr,handleSearchKeyDown:Mr,handleSearchInput:Pn,handleSearchCompositionEnd:Gs}=Oe.searchState,vo=Le=>{const Qt=Ke==null?void 0:Ke({tag:Le,placement:"composer",readonly:!1});if(Qt!=null)return Qt;const Un=j5(Le),Kn=A5(Le),zs=Le.kind?"":Un,ns=Le.icon??hg(Le.kind,zt),si=ns&&(OI(ns)||by(ns))?ns:void 0;return!zs&&!Kn?l.jsx("span",{className:Se.tagLabel,children:Le.id}):l.jsxs(l.Fragment,{children:[si&&l.jsx("span",{className:Se.tagIcon,style:wm("--composer-tag-icon-url",si),"aria-hidden":"true"}),zs&&l.jsx("span",{className:Se.tagLabel,children:zs}),Kn&&l.jsx("span",{className:Se.tagValue,children:Kn})]})},Ks=Lce(x,Ne),bi=k?((on=I.find(Le=>Le.id===k))==null?void 0:on.label)??(k.startsWith("qwen-route:")?"":vm(k)):"",{modelLabel:Jn,modelLabelReady:xi}=Vot({currentModelLabel:bi,lastConfirmedModelLabel:zr}),qs=P==null?void 0:P.find(Le=>V?Le.cwd===V:Le.primary),wr=(qs==null?void 0:qs.label)??"",Hr=!!(P&&q&&(P.length>1||K||de)),Ir=!!(D&&Bs("workspace")),_t=!!(C&&Bs("gitBranch"));h.useLayoutEffect(()=>{bi&&bi!==zr&&Ar(bi)},[bi,zr]);const Zn=Xn.workspaceSelect,ds=Xn.workspace,Kr=Xn.gitBranch,_e=Xn.mode,Je=Xn.model,qt=u&&!Oe.hasContent,On=Ae&&gn;return h.useEffect(()=>{On&&Pe(!1)},[On]),h.useLayoutEffect(()=>{const Le=De.current,Qt=Xe.current,Un=$e.current,Kn=Ve.current;if(!Le||!Qt||!Un||!Kn)return;const zs=()=>{const Xs=os=>{const _i=Kn.querySelector(`[data-toolbar-measure="${os}:collapsed"]`),ri=Kn.querySelector(`[data-toolbar-measure="${os}:expanded"]`);return Math.max(0,Math.ceil((ri==null?void 0:ri.getBoundingClientRect().width)??0)-Math.ceil((_i==null?void 0:_i.getBoundingClientRect().width)??0))},Ai=[...Hr?[{id:"workspaceSelect",expansionWidth:Xs("workspaceSelect")}]:[],...Ir?[{id:"workspace",expansionWidth:Xs("workspace")}]:[],..._t?[{id:"gitBranch",expansionWidth:Xs("gitBranch")}]:[],...Sr?[{id:"mode",expansionWidth:Xs("mode")}]:[],...Nr?[{id:"model",expansionWidth:Xs("model"),ready:xi}]:[]],oo=Ai.reduce((os,_i)=>os+(Xn[_i.id]?_i.expansionWidth:0),0),xo=Qt.scrollWidth,ki=Math.ceil(Number.parseFloat(getComputedStyle(Le).columnGap)||0),Pa=Wot({toolbarWidth:Math.floor(Le.getBoundingClientRect().width),leadingWidth:xo,rightWidth:Math.ceil(Un.getBoundingClientRect().width),currentExpansionWidth:oo,gap:ki}),Yr=Uot({availableWidth:Pa,items:Ai,currentVisibility:Xn,expansionMargin:Ai.length}),pr={workspaceSelect:Yr.workspaceSelect??!1,workspace:Yr.workspace??!1,gitBranch:Yr.gitBranch??!1,mode:Yr.mode??!1,model:Yr.model??!1};_r(os=>Object.keys(pr).every(ri=>os[ri]===pr[ri])?os:pr)};zs();const ns=new ResizeObserver(zs);ns.observe(Le),ns.observe(Qt),ns.observe(Un);for(const Xs of Kn.children)ns.observe(Xs);const si=[Ht.current,ke.current,Fn.current].filter(Xs=>Xs!==null),Ys=()=>{for(const Xs of si){ns.observe(Xs);for(const Ai of Xs.children)ns.observe(Ai)}};Ys();const Ps=new MutationObserver(()=>{Ys(),zs()});for(const Xs of si)Ps.observe(Xs,{attributes:!0,characterData:!0,childList:!0,subtree:!0});return()=>{Ps.disconnect(),ns.disconnect()}},[gt,wt,it,m,C,_t,u,Jn,xi,Ks,We,Nr,Sr,Xn,Ir,D,Hr,wr]),l.jsxs("div",{className:`${Se.editorShell} ${St||ve?Se.editorShellDropdownOpen:""}`,"data-composer":!0,"data-web-shell-composer":!0,children:[l.jsxs("div",{ref:vn,className:Se.container,"data-web-shell-composer-surface":!0,"data-dac-glow":!0,onClick:()=>{Ue(!1),Fe(!1),Pe(!1),Oe.focus()},children:[l.jsx("div",{className:Se.dacAura,"aria-hidden":"true"}),l.jsx("div",{className:Se.dacHalo,"aria-hidden":"true"}),cs&&l.jsxs("div",{ref:Ns,className:Se.searchPanel,onMouseDown:Le=>Le.stopPropagation(),onClick:Le=>Le.stopPropagation(),children:[l.jsxs("div",{className:Se.searchBar,children:[l.jsx("span",{className:Se.searchLabel,children:Ne("editor.searchLabel")}),l.jsx("input",{ref:br,className:Se.searchInput,value:bs,onChange:Pn,onCompositionEnd:Gs,onKeyDown:Mr,placeholder:Ne("editor.searchPlaceholder")})]}),sr.length>0&&l.jsx("div",{className:Se.searchResults,children:sr.map((Le,Qt)=>l.jsxs("button",{type:"button",className:`${Se.searchResult} ${Qt===Qn?Se.searchResultActive:""}`,onMouseDown:Un=>{Un.preventDefault(),yr?yr(Le):Oe.replaceEditorText(Le),Fr(!1)},children:[l.jsx("span",{className:Se.searchResultMarker,children:Qt===Qn?"›":""}),l.jsx("span",{className:Se.searchResultText,children:Le})]},`${Le}-${Qt}`))}),sr.length===0&&l.jsx("div",{className:Se.searchEmpty,children:Ne("editor.noHistory")})]}),l.jsxs("div",{className:Se.content,children:[(Oe.composerTags.length>0||Oe.pastedImages.length>0)&&l.jsxs("div",{className:Se.attachments,"data-web-shell-composer-attachments":!0,children:[Oe.composerTags.length>0&&l.jsx(Hre,{delayDuration:0,disableHoverableContent:!1,children:l.jsx("div",{className:Se.tags,children:Oe.composerTags.map(Le=>{const Qt={tag:Le,placement:"composer",readonly:!1};let Un;try{Un=un==null?void 0:un(Qt)}catch(Kn){console.warn("[WebShell] composer tag tooltip render failed",Kn)}return l.jsx(Xot,{tag:Le,content:vo(Le),tooltip:Un,onActivate:me?Kn=>me({...Qt,anchorRect:Kn}):void 0,onRemove:Le.removable!==!1?()=>{var Kn;Oe.removeTopTag(Le.id),(Kn=Oe.viewRef.current)==null||Kn.focus()}:void 0},Le.id)})})}),Oe.pastedImages.length>0&&l.jsx("div",{className:Se.images,children:Oe.pastedImages.map((Le,Qt)=>l.jsxs("div",{className:Se.imageThumb,children:[l.jsx("img",{src:`data:${Le.media_type};base64,${Le.data}`,alt:""}),l.jsx("button",{className:Se.imageRemove,onClick:Un=>{Un.stopPropagation(),Oe.removeImage(Qt)},children:"×"})]},Qt))})]}),Oe.slashMenu&&l.jsx(aat,{menu:Oe.slashMenu,anchorRef:vn,panelRef:Ce,detailRef:yt,onClose:Oe.closeSlashMenu,onSelect:Oe.selectSlashCompletion,onAccept:Oe.acceptSlashCompletion}),Oe.atMenu&&l.jsx(Ert,{menu:Oe.atMenu,anchorRef:vn,panelRef:Ft,onSelect:Oe.selectAtCompletion,onAccept:Oe.acceptAtCompletion,onBack:()=>{const Le=Oe.backAtCategories();return Le==="categories"&&window.setTimeout(()=>Oe.focus(),0),!!Le},onSearch:Oe.updateAtSearch,onSelectTab:Oe.selectAtTab}),l.jsxs("div",{className:Se.editorArea,children:[Oe.shellMode&&l.jsx("span",{className:Se.shellPrefix,"aria-hidden":"true",children:"!"}),Oe.mobileComposer?l.jsx("textarea",{ref:Oe.mobileComposer.textareaRef,className:Se.mobileTextarea,value:Oe.mobileComposer.value,onChange:Oe.mobileComposer.onChange,onBlur:Oe.mobileComposer.onBlur,onPaste:Oe.mobileComposer.onPaste,placeholder:Oe.mobileComposer.placeholder,disabled:Oe.disabled,rows:1,enterKeyHint:"enter",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,"data-web-shell-composer-editor":!0}):l.jsx("div",{ref:Oe.containerRef,"data-web-shell-composer-editor":!0})]}),l.jsxs("div",{ref:De,className:Se.toolbar,"data-mobile-voice-active":On||void 0,children:[l.jsxs("div",{ref:Xe,className:Se.toolbarLeading,"data-web-shell-toolbar-leading":!0,children:[it&&l.jsx("div",{ref:Ht,className:Se.toolbarStart,children:l.jsx(it,{disabled:m,isRunning:u,currentMode:x,currentModel:k,sessionName:We})}),l.jsxs("div",{className:Se.toolbarLeft,children:[Hr&&P&&q&&l.jsx(Hot,{workspaces:P,selectedWorkspaceCwd:V,disabled:ee,busy:re,scratchSupported:K,existingFolderSupported:de,className:`${Se.toolBtn} ${Se.workspaceSelectTrigger} ${Zn?"":Se.workspaceSelectTriggerCompact}`,onSelectWorkspace:q,onCreateScratch:ne??(()=>{}),onOpenExistingFolder:U??(()=>{})}),Ir&&D&&l.jsx($ot,{name:D,title:$??D,color:z,compact:!ds,ariaLabel:Ne("workspace.paneLabel",{name:D})}),_t&&C&&(S&&R?l.jsx(Zit,{branch:C,compact:!Kr,intent:S,onIntentChange:R}):l.jsx(Dce,{open:et,onOpenChange:He,workspaceCwd:(qs==null?void 0:qs.cwd)??"",gitCwd:_,onOpenDiff:O,onOpenCommit:M,children:l.jsx("button",{type:"button",className:Se.gitBranchChipButton,"aria-label":Ice(C,A,Ne),children:l.jsx(Rce,{branch:C,status:A,compact:!Kr,worktree:T})})})),Sr&&l.jsx("div",{className:`${Se.dropdownWrapper} ${_e?"":Se.dropdownWrapperCompact}`,children:l.jsx(GW,{open:St,items:Rs,activeId:x,onOpenChange:Le=>{Ue(Le),Le&&Fe(!1)},onSelect:xe,tooltip:Ks,trigger:l.jsxs("button",{className:`${Se.toolBtn} ${Se.modeToolBtn} ${_e?"":Se.toolBtnCompact}`,"data-web-shell-mode-button":!0,"data-web-shell-toolbar-popover-trigger":!0,onClick:Le=>{Le.stopPropagation(),Oe.closeSlashMenu(),Oe.closeAtMenu(),Pe(!1)},"aria-label":Ne("status.mode"),children:[l.jsx("span",{className:Se.toolBtnModeIcon,children:l.jsx(Kw,{mode:x})}),_e&&l.jsx("span",{className:Se.toolBtnText,children:Ks}),l.jsx("span",{className:Se.toolBtnArrow,children:l.jsx(gc,{})})]})})}),Nr&&l.jsx("div",{className:`${Se.dropdownWrapper} ${Je?"":Se.dropdownWrapperCompact}`,children:l.jsx(GW,{open:ve,items:gi,activeId:k,onOpenChange:Le=>{Fe(Le),Le&&Ue(!1)},onSelect:Ye,tooltip:Jn,showCheck:!0,searchable:!0,searchLabel:Ne("common.search"),noResultsLabel:Le=>Ne("model.noMatch",{query:Le}),trigger:l.jsxs("button",{className:`${Se.toolBtn} ${Se.modelToolBtn} ${Je?"":Se.toolBtnCompact}`,"data-web-shell-model-button":!0,"data-web-shell-toolbar-popover-trigger":!0,onClick:Le=>{Le.stopPropagation(),Oe.closeSlashMenu(),Oe.closeAtMenu(),Pe(!1)},"aria-label":Ne("model.select"),children:[l.jsx("span",{className:Se.toolBtnModelIcon,children:l.jsx(ME,{})}),Je&&l.jsx("span",{className:Se.toolBtnText,children:Jn}),l.jsx("span",{className:Se.toolBtnArrow,children:l.jsx(gc,{})})]})})}),gt&&l.jsx("div",{ref:ke,className:Se.toolbarEnd,children:l.jsx(gt,{disabled:m,isRunning:u,currentMode:x,currentModel:k,sessionName:We})})]})]}),l.jsxs("div",{ref:$e,className:Se.toolbarRight,children:[Ae&&Ds.length>0&&l.jsx("button",{className:`${Se.toolBtn} ${Se.quickActionsBtn}`,"data-hide-during-mobile-voice":!0,onClick:Le=>{Le.stopPropagation(),Oe.closeSlashMenu(),Oe.closeAtMenu(),Ue(!1),Fe(!1),Pe(Qt=>!Qt)},"aria-expanded":ie,"aria-label":Ne("quickActions.open"),title:Ne("quickActions.open"),"data-tooltip":Ne("quickActions.open"),children:l.jsx("span",{className:Se.toolBtnIcon,children:l.jsx(eat,{})})}),wt&&l.jsx("div",{ref:Fn,className:Se.toolbarRightCustom,"data-hide-during-mobile-voice":!0,children:l.jsx(wt,{disabled:m,isRunning:u,currentMode:x,currentModel:k,sessionName:We})}),j&&ft&&Bs("widthMode")&&l.jsx("button",{className:`${Se.toolBtn} ${Se.widthModeBtn}`,"data-hide-during-mobile-voice":!0,onClick:Le=>{Le.stopPropagation(),ge==null||ge(B==="wide"?"1000":"wide")},disabled:!ge,"aria-label":Ne(B==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),title:Ne(B==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),"data-tooltip":Ne(B==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),children:l.jsx("span",{className:Se.toolBtnIcon,children:l.jsx(nat,{mode:B})})}),Bs("voice")&&l.jsx(uit,{disabled:m,onActiveChange:Tn,target:ae,statusRevision:je,onInsert:Le=>{const Qt=Oe.getText(),Un=Qt&&!/\s$/.test(Qt)?" ":"";Oe.insertText(`${Un}${Le} `),Oe.focus()}}),l.jsx("button",{className:d||qt?`${Se.sendBtn} ${Se.sendBtnRunning}${f?` ${Se.sendBtnArmed}`:""}`:Se.sendBtn,disabled:d?!0:qt?!c:Oe.disabled||!Oe.hasContent,"data-web-shell-composer-submit":!0,onClick:Le=>{if(Le.stopPropagation(),!d){if(qt){c==null||c();return}Oe.submitText()}},"aria-label":Ne(d?"common.loading":qt?f?"stream.cancelArmed":"stream.cancel":"editor.send"),title:u&&f?Ne("stream.cancelArmed"):void 0,children:d?l.jsx(Zot,{}):qt?f?l.jsx("span",{className:Se.escLabel,"aria-hidden":"true",children:"Esc"}):l.jsx(Jot,{}):l.jsx(Qot,{})}),l.jsx("span",{role:"status","aria-live":"polite",className:Se.srOnly,children:u&&f?Ne("stream.cancelArmed"):""})]})]}),l.jsxs("div",{ref:Ve,className:Se.toolbarMeasurements,"aria-hidden":"true",children:[Hr&&qs&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{"data-toolbar-measure":"workspaceSelect:collapsed",className:`${Se.toolBtn} ${Se.workspaceSelectTrigger} ${Se.workspaceSelectTriggerCompact}`,children:[l.jsx(oC,{size:16,strokeWidth:1.2}),l.jsx("span",{className:Se.toolBtnText,children:wr}),l.jsx("span",{className:Se.toolBtnArrow,children:l.jsx(gc,{})})]}),l.jsxs("span",{"data-toolbar-measure":"workspaceSelect:expanded",className:`${Se.toolBtn} ${Se.workspaceSelectTrigger}`,children:[l.jsx(oC,{size:16,strokeWidth:1.2}),l.jsx("span",{className:Se.toolBtnText,children:wr}),l.jsx("span",{className:Se.toolBtnArrow,children:l.jsx(gc,{})})]})]}),Ir&&D&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{"data-toolbar-measure":"workspace:collapsed",className:`${Se.workspaceChip} ${Se.workspaceChipCompact}`,children:[l.jsx("span",{className:Se.workspaceChipIcon}),l.jsx("span",{className:Se.workspaceChipText,children:D})]}),l.jsxs("span",{"data-toolbar-measure":"workspace:expanded",className:Se.workspaceChip,children:[l.jsx("span",{className:Se.workspaceChipIcon}),l.jsx("span",{className:Se.workspaceChipText,children:D})]})]}),_t&&C&&l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-toolbar-measure":"gitBranch:collapsed",className:`${Se.gitBranchChip} ${Se.gitBranchChipCompact}`,children:l.jsx(UM,{branch:C,status:A,compact:!0,worktree:T})}),l.jsx("span",{"data-toolbar-measure":"gitBranch:expanded",className:Se.gitBranchChip,children:l.jsx(UM,{branch:C,status:A,compact:!1,worktree:T})})]}),l.jsxs("span",{"data-toolbar-measure":"mode:collapsed",className:`${Se.toolBtn} ${Se.modeToolBtn} ${Se.toolBtnCompact}`,children:[l.jsx("span",{className:Se.toolBtnModeIcon,children:l.jsx(Kw,{mode:x})}),l.jsx("span",{className:Se.toolBtnText,children:Ks}),l.jsx("span",{className:Se.toolBtnArrow,children:l.jsx(gc,{})})]}),l.jsxs("span",{"data-toolbar-measure":"mode:expanded",className:`${Se.toolBtn} ${Se.modeToolBtn}`,children:[l.jsx("span",{className:Se.toolBtnModeIcon,children:l.jsx(Kw,{mode:x})}),l.jsx("span",{className:Se.toolBtnText,children:Ks}),l.jsx("span",{className:Se.toolBtnArrow,children:l.jsx(gc,{})})]}),l.jsxs("span",{"data-toolbar-measure":"model:collapsed",className:`${Se.toolBtn} ${Se.modelToolBtn} ${Se.toolBtnCompact}`,children:[l.jsx("span",{className:Se.toolBtnModelIcon,children:l.jsx(ME,{})}),l.jsx("span",{className:Se.toolBtnText,children:Jn}),l.jsx("span",{className:Se.toolBtnArrow,children:l.jsx(gc,{})})]}),l.jsxs("span",{"data-toolbar-measure":"model:expanded",className:`${Se.toolBtn} ${Se.modelToolBtn}`,children:[l.jsx("span",{className:Se.toolBtnModelIcon,children:l.jsx(ME,{})}),l.jsx("span",{className:Se.toolBtnText,children:Jn}),l.jsx("span",{className:Se.toolBtnArrow,children:l.jsx(gc,{})})]})]})]})]}),Ae&&ie&&Ds.length>0&&l.jsx(lat,{actions:Ds,onRun:Et,onPressKey:Mt,showKeyHints:!Oe.mobileComposer})]})}));function $ce(e){return e.kind!=="agent"}const cat="_bar_17p6f_1",uat="_left_17p6f_12",dat="_right_17p6f_13",hat="_settingsButton_17p6f_23",fat="_modeButton_17p6f_49",mat="_modeHint_17p6f_62",pat="_modeLabel_17p6f_67",gat="_modeDefault_17p6f_71",bat="_modePlan_17p6f_75",yat="_modeAutoEdit_17p6f_79",wat="_modeAuto_17p6f_79",vat="_modeYolo_17p6f_87",xat="_shortcutsButton_17p6f_96",kat="_modelButton_17p6f_114",_at="_model_17p6f_114",Sat="_contextButton_17p6f_138",Cat="_context_17p6f_138",Tat="_goal_17p6f_161",Eat="_goalButton_17p6f_167",jat="_separator_17p6f_184",Aat="_taskPill_17p6f_188",eo={bar:cat,left:uat,right:dat,settingsButton:hat,modeButton:fat,modeHint:mat,modeLabel:pat,modeDefault:gat,modePlan:bat,modeAutoEdit:yat,modeAuto:wat,modeYolo:vat,shortcutsButton:xat,modelButton:kat,model:_at,contextButton:Sat,context:Cat,goal:Tat,goalButton:Eat,separator:jat,taskPill:Aat},Nat=1e3;function Mat(e,t){switch(e){case"default":return{label:t("mode.default"),className:eo.modeDefault};case"plan":return{label:t("mode.plan"),className:eo.modePlan};case"auto-edit":return{label:t("mode.auto-edit"),className:eo.modeAutoEdit};case"auto":return{label:t("mode.auto"),className:eo.modeAuto};case"yolo":return{label:t("mode.yolo"),className:eo.modeYolo};default:return null}}function Iat(){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 KW(e,t,n,s){return s(e===1?t:n,{count:e})}function Rat(e,t){const n=e.filter($ce);if(n.length===0)return"";const s=n.filter(r=>r.status==="running");if(s.length>0){const r={shell:0,monitor:0};for(const o of s)o.kind==="shell"&&(r.shell+=1),o.kind==="monitor"&&(r.monitor+=1);const i=[];return r.shell>0&&i.push(KW(r.shell,"tasks.pill.shell","tasks.pill.shells",t)),r.monitor>0&&i.push(KW(r.monitor,"tasks.pill.monitor","tasks.pill.monitors",t)),i.join(", ")}return t(n.length===1?"tasks.pill.done":"tasks.pill.doneMany",{count:n.length})}function Dat(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 Pat=h.forwardRef(function({onSelectMode:t,onSelectModel:n,onShowContext:s,onOpenSettings:r,onOpenTasks:i,onReturnToInput:o,tasks:a,activeGoal:c,onOpenGoals:u,hideSettings:d,onToggleShortcuts:f,compact:m=!1},p){const g=Ra(),b=g.status==="connected",v=g.currentModel??"",y=g.currentMode??"",w=g.tokenCount??0,x=g.contextWindow??0,{t:k}=lt(),T=(x>0?w/x*100:0).toFixed(1),_=Mat(y,k),[,S]=h.useState(0),R=h.useRef(null);h.useEffect(()=>{if(!c)return;const j=setInterval(()=>S(H=>(H+1)%1e6),Nat);return()=>clearInterval(j)},[c]);const A=h.useMemo(()=>Rat(a,k),[a,k]),O=!m&&(b||!!_),M=c?Dat(Date.now()-c.setAt):"",D=c?`◎ ${k("goal.statusActive")}${M?` (${M})`:""}`:"",$=!!A||!m,z=!m&&!!v||!m&&x>0&&w>0||!!D;if(h.useImperativeHandle(p,()=>({focusTaskPill(){var j;return A?((j=R.current)==null||j.focus({preventScroll:!0}),!0):!1}}),[A]),!$&&!z)return null;const B=j=>{if(j.key==="Enter"||j.key==="ArrowDown"||j.key==="n"&&j.ctrlKey){j.preventDefault(),j.stopPropagation(),i==null||i();return}if(j.key==="ArrowUp"||j.key==="Escape"||j.key==="p"&&j.ctrlKey){j.preventDefault(),j.stopPropagation(),o==null||o();return}j.key.length===1&&!j.metaKey&&!j.ctrlKey&&!j.altKey&&(j.preventDefault(),j.stopPropagation(),o==null||o(j.key))};return l.jsxs("div",{className:eo.bar,children:[l.jsxs("div",{className:eo.left,children:[b&&!d&&!m&&l.jsx("button",{type:"button",className:eo.settingsButton,onClick:r,onMouseDown:j=>j.stopPropagation(),onTouchStart:j=>j.stopPropagation(),title:k("settings.title"),"aria-label":k("settings.title"),"aria-haspopup":"dialog",children:l.jsx(Iat,{})}),_&&!m&&l.jsxs("button",{type:"button",className:eo.modeButton,onClick:t,onMouseDown:j=>j.stopPropagation(),onTouchStart:j=>j.stopPropagation(),title:k("mode.select"),"aria-haspopup":"listbox",children:[l.jsx("span",{className:`${eo.modeLabel} ${_.className}`,children:_.label}),!m&&l.jsx("span",{className:eo.modeHint,children:k("status.modeHint")})]}),!m&&l.jsx(l.Fragment,{children:f?l.jsx("button",{type:"button",className:eo.shortcutsButton,onClick:f,onMouseDown:j=>j.stopPropagation(),onTouchStart:j=>j.stopPropagation(),"aria-haspopup":"dialog","aria-label":k("status.shortcuts"),children:k("status.shortcuts")}):l.jsx("span",{children:k("status.shortcuts")})}),A&&l.jsxs(l.Fragment,{children:[O&&l.jsx("span",{className:eo.separator,children:"·"}),l.jsx("button",{ref:R,type:"button",className:eo.taskPill,onClick:i,onKeyDown:B,disabled:!i,children:A})]})]}),l.jsxs("div",{className:eo.right,children:[!m&&v&&l.jsx("button",{type:"button",className:eo.modelButton,onClick:n,onMouseDown:j=>j.stopPropagation(),onTouchStart:j=>j.stopPropagation(),title:k("model.select"),"aria-haspopup":"listbox",children:l.jsx("span",{className:eo.model,children:v})}),!m&&x>0&&w>0&&l.jsx("button",{type:"button",className:eo.contextButton,onClick:s,title:k("contextUsage.title"),children:l.jsx("span",{className:eo.context,children:k("status.contextUsed",{pct:T})})}),D&&(u?l.jsx("button",{type:"button",className:eo.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:eo.goal,children:D})}):l.jsx("span",{className:eo.goal,title:c==null?void 0:c.condition,children:D}))]})]})}),Lat=15e3,Oat=["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."],$at=["正在努力搬砖，请稍候...","老板在身后，快加载啊！","头发掉光前，一定能加载完...","服务器正在深呼吸，准备放大招...","正在向服务器投喂咖啡...","正在赋能全链路，寻找关键抓手...","正在降本增效，优化加载路径...","正在打破部门壁垒，沉淀方法论...","正在拥抱变化，迭代核心价值...","正在对齐颗粒度，打磨底层逻辑...","大力出奇迹，正在强行加载...","只要我不写代码，代码就没有 Bug...","正在把 Bug 转化为 Feature...","只要我不尴尬，Bug 就追不上我...","正在试图理解去年的自己写了什么...","正在猿力觉醒中，请耐心等待...","正在询问产品经理：这需求是真的吗？","正在给产品经理画饼，请稍等...","每一行代码，都在努力让世界变得更好一点点...","每一个伟大的想法，都值得这份耐心的等待...","别急，美好的事物总是需要一点时间去酝酿...","愿你的代码永无 Bug，愿你的梦想终将成真...","哪怕只有 0.1% 的进度，也是在向目标靠近...","加载的是字节，承载的是对技术的热爱..."];function YW(e){return(e??(typeof navigator<"u"?navigator.language.toLowerCase():"")).toLowerCase().startsWith("zh")?$at:Oat}function Bat(){const e=sT(),t=rk(),n=e!=="idle",s=h.useRef(0),r=h.useRef(0),[i,o]=h.useState({estimatedOutputTokens:0,isReceivingContent:!1}),a=h.useMemo(()=>{let u=0,d=0,f=!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&&(f=!0)),b.kind==="tool"&&!b.parentToolCallId){if(b.rawInput!==void 0)try{u+=JSON.stringify(b.rawInput).length}catch{}const v=zat(b.rawOutput);v!==void 0&&!m.has(b.toolCallId)&&(d+=v,m.add(b.toolCallId))}}return{chars:u,agentTokens:d,isReceiving:f}},[t]),c=h.useRef(a);return c.current=a,a.chars<r.current&&(s.current=a.chars),r.current=a.chars,h.useEffect(()=>{if(!n){s.current=0,o({estimatedOutputTokens:0,isReceivingContent:!1});return}const u=setInterval(()=>{const{chars:d,agentTokens:f,isReceiving:m}=c.current;if(d<s.current){s.current=d,o({estimatedOutputTokens:f+Math.round(d/4),isReceivingContent:m});return}const p=d-s.current;if(p<=0){o(v=>{const y={estimatedOutputTokens:f+Math.round(s.current/4),isReceivingContent:m};return v.estimatedOutputTokens===y.estimatedOutputTokens&&v.isReceivingContent===y.isReceivingContent?v:y});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:f+Math.round(b/4),isReceivingContent:m})},100);return()=>clearInterval(u)},[n]),i}function zat(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 Fat(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.floor(e/1e3)}k`}function H1(e){const t=Math.round(e);return Math.abs(t)<1e6?t.toLocaleString():`${(t/1e6).toFixed(1)}M`}const Hat="_status_zld2v_1",qat="_spinner_zld2v_11",Uat="_label_zld2v_15",Wat="_meta_zld2v_19",l2={status:Hat,spinner:qat,label:Uat,meta:Wat},IE=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function Bce({startedAt:e,showPhrase:t=!0}){const n=sT(),{estimatedOutputTokens:s,isReceivingContent:r}=Bat(),{language:i,t:o}=lt(),{loadingPhrases:a}=ku(),c=h.useRef(a);c.current=a;const u=h.useCallback(T=>{var _;try{return((_=c.current)==null?void 0:_.call(c,T))??YW(T)}catch(S){return console.warn("[web-shell] loadingPhrases resolver threw; using defaults",S),YW(T)}},[]),[d,f]=h.useState(0),m=h.useRef(Date.now()),[p,g]=h.useState(0),[b,v]=h.useState(()=>u(i)[0]??""),y=n!=="idle";if(h.useEffect(()=>{if(!y){f(0);return}m.current=e??Date.now(),f(XW(m.current));const T=setInterval(()=>{f(XW(m.current))},1e3);return()=>clearInterval(T)},[y,e]),h.useEffect(()=>{if(!t)return;if(n==="idle"){v(u(i)[0]??"");return}const T=()=>{const S=u(i),R=Math.floor(Math.random()*S.length);v(S[R]??"")};T();const _=setInterval(T,Lat);return()=>clearInterval(_)},[i,n,u,t]),h.useEffect(()=>{if(n==="idle")return;const T=setInterval(()=>{g(_=>(_+1)%IE.length)},250);return()=>clearInterval(T)},[n]),n==="idle")return null;const w=IE[p%IE.length],x=r?"↓":"↑",k=d<60?`${d}s`:Vat(d*1e3),C=s>0?` · ${x} ${o("stream.tokens",{count:Fat(s)})}`:"";return l.jsxs("div",{className:l2.status,children:[l.jsx("span",{className:l2.spinner,children:w}),t&&b&&l.jsx("span",{className:l2.label,children:b}),l.jsxs("span",{className:l2.meta,children:["(",k,C," · ",o("stream.cancel"),")"]})]})}function Vat(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 XW(e){return Math.max(0,Math.ceil((Date.now()-e)/1e3))}const Gat="_host_1scjy_1",Kat="_toast_1scjy_13",Yat="_message_1scjy_31",Xat="_close_1scjy_39",Qat="_info_1scjy_58",Jat="_success_1scjy_62",Zat="_warning_1scjy_66",elt="_error_1scjy_70",Yw={host:Gat,toast:Kat,message:Yat,close:Xat,info:Qat,success:Jat,warning:Zat,error:elt};function tlt({toasts:e,onDismiss:t,autoDismissMs:n=5e3}){return e.length===0?null:l.jsx("div",{className:Yw.host,role:"status","aria-live":"polite","data-web-shell-toast-host":!0,children:e.map(s=>l.jsx(nlt,{toast:s,onDismiss:t,autoDismissMs:n},s.id))})}function nlt({toast:e,onDismiss:t,autoDismissMs:n}){const{t:s}=lt();return h.useEffect(()=>{const r=window.setTimeout(()=>t(e.id),n);return()=>window.clearTimeout(r)},[n,t,e.id]),l.jsxs("div",{className:`${Yw.toast} ${Yw[e.tone]}`,"data-web-shell-toast":!0,"data-tone":e.tone,children:[l.jsx("div",{className:Yw.message,children:e.message}),l.jsx("button",{type:"button",className:Yw.close,onClick:()=>t(e.id),"aria-label":s("toast.dismiss"),title:s("toast.dismissShort"),children:"x"})]})}const slt="_panel_n876c_1",rlt="_summary_n876c_10",ilt="_progressRing_n876c_27",olt="_stepText_n876c_41",alt="_statusSegmentWrap_n876c_48",llt="_separator_n876c_55",clt="_statusSegment_n876c_48",ult="_statusSegmentButton_n876c_61",dlt="_fullText_n876c_83",hlt="_compactText_n876c_87",flt="_detail_n876c_106",mlt="_item_n876c_138",plt="_icon_n876c_148",glt="_loadingIcon_n876c_156",blt="_content_n876c_165",ylt="_completed_n876c_173",wlt="_inProgress_n876c_187",vlt="_pending_n876c_192",ia={panel:slt,summary:rlt,progressRing:ilt,stepText:olt,statusSegmentWrap:alt,separator:llt,statusSegment:clt,statusSegmentButton:ult,fullText:dlt,compactText:hlt,detail:flt,item:mlt,icon:plt,loadingIcon:glt,content:blt,completed:ylt,inProgress:wlt,pending:vlt};function xlt(e){switch(e){case"completed":return ia.completed;case"in_progress":return ia.inProgress;case"pending":return ia.pending}}const klt=h.memo(function({todos:t,title:n,statusItems:s=[]}){const{t:r}=lt();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,f=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}):f;return l.jsxs("section",{className:ia.panel,"aria-label":n??(o?r("todo.title"):f),tabIndex:0,children:[l.jsxs("div",{className:ia.summary,"aria-label":m,children:[o&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:ia.progressRing,style:{"--todo-progress":String(d)},"aria-hidden":"true"}),l.jsxs("span",{className:ia.stepText,children:[l.jsx("span",{className:ia.fullText,children:r("todo.stepProgress",{current:u,total:i})}),l.jsx("span",{className:ia.compactText,children:r("todo.stepFraction",{current:u,total:i})})]})]}),s.map((p,g)=>l.jsxs("span",{className:ia.statusSegmentWrap,children:[(i>0||g>0)&&l.jsx("span",{className:ia.separator,"aria-hidden":"true",children:"·"}),p.onClick?l.jsx("button",{type:"button",className:ia.statusSegmentButton,title:p.title,"aria-label":p.ariaLabel,onClick:p.onClick,children:p.label}):l.jsx("span",{className:ia.statusSegment,title:p.title,children:p.label})]},p.id))]}),i>0&&l.jsx("div",{className:ia.detail,role:"tooltip",children:t.map((p,g)=>l.jsxs("div",{className:`${ia.item} ${xlt(p.status)}`,children:[l.jsx("span",{className:ia.icon,"aria-hidden":"true",children:p.status==="in_progress"?l.jsx("span",{className:ia.loadingIcon}):C3(p.status)}),l.jsx("span",{className:ia.content,title:p.content,children:p.content})]},`${p.id||g}:${p.content}`))})]})}),_lt="_header_leiy3_1",Slt="_titleRow_leiy3_11",Clt="_title_leiy3_11",Tlt="_subtitle_leiy3_31",c2={header:_lt,titleRow:Slt,title:Clt,subtitle:Tlt};function Elt(e){const{t}=lt();return l.jsxs("div",{className:c2.header,children:[l.jsxs("div",{className:c2.titleRow,children:[l.jsx("span",{children:t("welcome.titlePrefix")}),l.jsx("span",{className:c2.title,children:"Qwen Code"})]}),l.jsx("div",{className:c2.subtitle,children:t("welcome.prompt")})]})}const jlt="_themeDark_1tp31_1",Alt="_themeLight_1tp31_25",QW={themeDark:jlt,themeLight:Alt},Nlt={sm:"sm:max-w-[420px]",md:"sm:max-w-[560px]",lg:"sm:max-w-[720px]",xl:"sm:max-w-[900px]"},Mlt=["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 JW(e){return e?Array.from(e.querySelectorAll(Mlt)):[]}const q1=[],zce=h.createContext(null);function YM(e){return e===null?!0:q1[q1.length-1]===e}function Ii({title:e,subtitle:t,size:n="md",allowFullscreen:s=!1,dismissible:r=!0,onClose:i,children:o}){const{t:a}=lt(),c=ny(),[u,d]=h.useState(!1),f=h.useRef(null),m=h.useRef(i);m.current=i;const[p]=h.useState(()=>typeof document<"u"?document.activeElement:null),g=h.useRef(!1),b=h.useRef(!1),v=h.useRef(null);v.current===null&&(v.current={}),h.useEffect(()=>{const C=v.current;q1.push(C);const T=_=>{_.key!=="Escape"||!_.isComposing&&_.keyCode!==229||!YM(C)||(Object.defineProperty(_,"key",{configurable:!0,value:"Process"}),document.addEventListener("keydown",S=>{S===_&&Reflect.deleteProperty(_,"key")},{capture:!0,once:!0}))};return window.addEventListener("keydown",T,{capture:!0}),()=>{var O,M;window.removeEventListener("keydown",T,{capture:!0});const _=q1.indexOf(C);if(_>=0&&q1.splice(_,1),q1.length===0){(O=p==null?void 0:p.focus)==null||O.call(p);return}const S=Array.from(document.querySelectorAll("[data-keyboard-scope]")),R=S[S.length-1];(M=JW(R).find(D=>!D.hasAttribute("data-dialog-close"))??R)==null||M.focus()}},[p]);const y=C=>{g.current=C.target===C.currentTarget,b.current=!1},w=C=>{b.current=C.target===C.currentTarget},x=C=>{const T=g.current&&b.current&&C.target===C.currentTarget;g.current=!1,b.current=!1,T&&r&&i()},k=c===ei.Light?QW.themeLight:QW.themeDark;return l.jsx(Qm,{open:!0,onOpenChange:C=>{!C&&r&&i()},children:l.jsx(zce.Provider,{value:v.current,children:l.jsxs(Jm,{ref:f,showCloseButton:!1,overlayProps:{onMouseDown:y,onMouseUp:w,onClick:x},className:`${k} ${c===ei.Dark?"dark":""} flex max-h-[min(80vh,calc(100vh-48px))] flex-col gap-0 overflow-hidden p-0 font-mono text-sm ${u?"h-[calc(100vh-32px)] max-h-[calc(100vh-32px)] max-w-[calc(100vw-32px)] sm:max-w-[calc(100vw-32px)]":Nlt[n]}`,"aria-label":e,"data-keyboard-scope":!0,"data-web-shell-dialog":!0,"data-web-shell-dialog-title":e,onPointerDownOutside:C=>C.preventDefault(),onEscapeKeyDown:C=>{C.defaultPrevented||C.isComposing||C.keyCode===229||YM(v.current)&&(C.preventDefault(),r&&m.current())},onOpenAutoFocus:C=>{var _;C.preventDefault(),(_=JW(f.current).find(S=>!S.hasAttribute("data-dialog-close"))??f.current)==null||_.focus()},onCloseAutoFocus:C=>C.preventDefault(),children:[l.jsxs(Zm,{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(tp,{children:e}),t&&l.jsx(W0,{className:"mt-0.5 text-xs",children:t})]}),s&&l.jsx(Jt,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>d(C=>!C),"aria-label":a(u?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":u,title:a(u?"common.exitFullscreen":"common.fullscreen"),children:u?l.jsx(zQ,{}):l.jsx(BQ,{})}),r&&l.jsx(jN,{asChild:!0,children:l.jsx(Jt,{type:"button",variant:"ghost",size:"icon-sm","aria-label":a("common.close"),title:a("common.close"),"data-dialog-close":!0,children:l.jsx(ey,{})})})]}),l.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-4","data-dialog-fullscreen":u?"":void 0,children:o})]})})})}function u2(e,t){return t<=0||e<0?0:e>t-1?t-1:e}const Ilt=new Set(["button","submit","reset"]),Rlt=new Set(["checkbox","radio","button","submit","reset","range","color","file"]);function ZW(){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 Ilt.has(e.type);const n=e.getAttribute("role");return n==="button"||n==="link"||n==="menuitem"}function RE(){const e=typeof document<"u"?document.activeElement:null;if(!e)return!1;const t=e.tagName;return t==="TEXTAREA"?!0:t==="INPUT"?!Rlt.has(e.type):e.isContentEditable===!0}function Mp({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s,enabled:r=!0}){const i=h.useContext(zce),o=h.useRef({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s});o.current={itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s};const[a,c]=h.useState(!1);return h.useEffect(()=>{if(!r)return;const u=()=>c(!0),d=()=>c(!1),f=m=>{if(!YM(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(u2(g+1,p));break;case"ArrowUp":m.preventDefault(),u(),o.current.onActiveIndexChange(u2(g-1,p));break;case"Home":if(RE())return;m.preventDefault(),u(),o.current.onActiveIndexChange(0);break;case"End":if(RE())return;m.preventDefault(),u(),o.current.onActiveIndexChange(p-1);break;case"Enter":{if(ZW()||g<0)return;m.preventDefault(),o.current.onConfirm(u2(g,p));break}case" ":{if(ZW()||RE()||g<0)return;m.preventDefault(),o.current.onConfirm(u2(g,p));break}}};return window.addEventListener("keydown",f),window.addEventListener("mousemove",d),()=>{window.removeEventListener("keydown",f),window.removeEventListener("mousemove",d)}},[i,r]),{keyboardMode:a}}const Dlt="_picker_5cmbf_4",Plt="_selected_5cmbf_98",Llt="_disabled_5cmbf_114",Olt={picker:Dlt,"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:Plt,"picker-keyboard-only":"_picker-keyboard-only_5cmbf_106",disabled:Llt,"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 mn(...e){return e.filter(t=>!!t).map(t=>Olt[t]).filter(Boolean).join(" ")}const $lt="_list_jbgdx_1",Blt="_row_jbgdx_16",zlt="_selected_jbgdx_32",Flt="_keyboardOnly_jbgdx_39",Hlt="_modeName_jbgdx_47",qlt="_modeIcon_jbgdx_51",Ult="_modeText_jbgdx_67",Wlt="_modeDesc_jbgdx_83",qf={list:$lt,row:Blt,selected:zlt,keyboardOnly:Flt,modeName:Hlt,modeIcon:qlt,modeText:Ult,modeDesc:Wlt};function Vlt({currentMode:e,onSelect:t}){const{t:n}=lt(),s=h.useRef(null),r=Jb.map(m=>({id:m,name:n(`mode.listLabel.${m}`),description:n(`mode.desc.${m}`)})),i=r.findIndex(m=>m.id===e),[o,a]=h.useState(i>=0?i:0),c=h.useRef(!1);h.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:f}=Mp({itemCount:r.length,activeIndex:o,onActiveIndexChange:u,onConfirm:d});return h.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:`${qf.list} ${f?qf.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:`${qf.row} ${g?qf.selected:""} ${b?mn("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:qf.modeIcon,children:l.jsx(Kw,{mode:m.id})}),l.jsxs("span",{className:qf.modeText,children:[l.jsx("span",{className:qf.modeName,children:m.name}),l.jsx("span",{className:qf.modeDesc,children:m.description})]})]},m.id)})})}function B5(e){const[t,n]=h.useState(""),[s,r]=h.useState(""),i=h.useRef(!1),o=h.useRef(""),a=h.useRef(e);a.current=e;const c=h.useCallback(m=>{var p;m!==o.current&&(o.current=m,r(m),(p=a.current)==null||p.call(a,m))},[]),u=h.useCallback(m=>{const p=m.target.value;n(p),i.current||c(p)},[c]),d=h.useCallback(()=>{i.current=!0},[]),f=h.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:f}}}function Lx(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 EP({session:e,active:t,current:n,confirmed:s,disabled:r,currentLabel:i,optionId:o,ariaSelected:a,leading:c,trailing:u,resumeSelector:d,onClick:f,onActivate:m}){const{t:p}=lt(),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:mn("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:f,onMouseMove:m,children:[l.jsxs("div",{className:mn("picker-item-row"),children:[c,l.jsx("span",{className:mn("picker-item-title"),children:e.displayName||e.sessionId.slice(0,8)}),u]}),l.jsxs("div",{className:mn("picker-item-meta"),children:[l.jsx("span",{children:g&&Lx(g,p)}),l.jsx("span",{className:mn("picker-item-detail"),children:p("common.clients",{count:e.clientCount??0})}),e.hasActivePrompt&&l.jsx("span",{className:mn("picker-item-detail"),children:p("resume.activePrompt")})]})]})}function Pk(e,t={}){const{autoLoad:n=!1,enabled:s=!0,pageSize:r,archiveState:i,view:o,group:a}=t,c=V2({autoLoad:n,enabled:s&&!e,pageSize:r,archiveState:i,view:o,group:a,sourceType:uC}),{reload:u,deleteSession:d,deleteSessions:f}=c,m=io(),p=h.useRef(0),[g,b]=h.useState({sessions:[],loading:!1}),v=h.useCallback(async()=>{if(!e||!s)return[];const C=++p.current;b(T=>({cwd:e,sessions:T.cwd===e?T.sessions:[],loading:!0}));try{const _=(await m.client.workspaceByCwd(e).listWorkspaceSessions({pageSize:r,archiveState:i,view:o,group:a,sourceType:uC})).map(S=>({...S,workspaceCwd:e}));return p.current===C&&b({cwd:e,sessions:_,loading:!1}),_}catch(T){const _=T instanceof Error?T:new Error(String(T));throw p.current===C&&b({cwd:e,sessions:[],loading:!1,error:_}),_}},[i,s,a,r,o,m.client,e]);h.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 y=h.useCallback(()=>e?v():u(),[u,v,e]),w=h.useCallback(async C=>{if(!e)return f(C);const T=await m.client.workspaceByCwd(e).deleteSessionsData(C);return await v(),T},[f,v,m.client,e]),x=h.useCallback(async C=>{if(!e)return d(C);const T=await w([C]);if(T.errors.length>0)throw new Error(T.errors[0].error);return T.removed.length>0||T.notFound.length>0},[d,w,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:y,deleteSession:x,deleteSessions:w,releaseSession:c.releaseSession}}const XM="resume-session-list",eV=e=>`${XM}-opt-${e}`;function Glt({onSelect:e,onClose:t,workspaceCwd:n}){const{t:s}=lt(),r=Ra(),{sessions:i,loading:o,error:a}=Pk(n,{autoLoad:!0}),c=r.sessionId,[u,d]=h.useState(-1),{filterValue:f,inputProps:m}=B5(()=>d(-1)),p=h.useRef(null),g=h.useRef(null),b=f?i.filter(w=>{const x=f.toLowerCase();return(w.displayName||"").toLowerCase().includes(x)||w.sessionId.toLowerCase().includes(x)}):i;h.useEffect(()=>{u>=b.length&&b.length>0&&d(b.length-1)},[b.length,u]),h.useEffect(()=>{var x;const w=(x=p.current)==null?void 0:x.children[u];w==null||w.scrollIntoView({block:"nearest"})},[u]);const v=w=>{const x=b[w];x&&(e(x.sessionId),t())},{keyboardMode:y}=Mp({itemCount:b.length,activeIndex:u,onActiveIndexChange:d,onConfirm:v});return h.useEffect(()=>{var w;(w=g.current)==null||w.focus()},[]),l.jsxs("div",{className:mn("picker","picker-in-shell"),"data-web-shell-resume-dialog":!0,children:[l.jsxs("div",{className:mn("picker-search"),children:[l.jsxs("span",{className:mn("picker-search-label"),children:[s("resume.search"),":"," "]}),l.jsx("input",{ref:g,className:mn("picker-search-input"),"aria-label":s("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":XM,"aria-activedescendant":u>=0&&u<b.length?eV(u):void 0,...m,placeholder:""})]}),l.jsx("div",{className:mn("picker-sep")}),l.jsxs("div",{id:XM,role:"listbox",className:mn("picker-list",y?"picker-keyboard-only":void 0),ref:p,children:[o&&l.jsx("div",{className:mn("picker-empty"),children:s("common.loading")}),!o&&a&&l.jsx("div",{className:mn("picker-empty"),children:a.message||s("resume.failedToLoad")}),!o&&!a&&b.length===0&&l.jsx("div",{className:mn("picker-empty"),children:f?s("resume.noMatch",{query:f}):s("resume.none")}),!o&&b.map((w,x)=>l.jsx(EP,{session:w,optionId:eV(x),active:x===u,current:w.sessionId===c,currentLabel:s("resume.current"),resumeSelector:!0,onClick:()=>v(x),onActivate:()=>d(x)},w.sessionId))]})]})}const Klt="_layout_1sigx_1",Ylt="_list_1sigx_9",Xlt="_row_1sigx_23",Qlt="_selected_1sigx_39",Jlt="_keyboardOnly_1sigx_46",Zlt="_label_1sigx_54",ect="_divider_1sigx_58",tct="_number_1sigx_65",nct="_provider_1sigx_71",sct="_badge_1sigx_86",rct="_detail_1sigx_92",ict="_detailRow_1sigx_104",oct="_detailLabel_1sigx_111",act="_detailValue_1sigx_117",lct="_empty_1sigx_122",ll={layout:Klt,list:Ylt,row:Xlt,selected:Qlt,keyboardOnly:Jlt,label:Zlt,divider:ect,number:tct,provider:nct,badge:sct,detail:rct,detailRow:ict,detailLabel:oct,detailValue:act,empty:lct};function cct(e,t){return e?`${e.toLocaleString()} ${t("contextUsage.tokens")}`:t("model.contextWindow.unknown")}function uct(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 tV(e){if(e.authType)return e.authType;const t=e.id.match(/\(([^()]+)\)$/);return t==null?void 0:t[1]}function dct(e){return e.label?e.label:e.baseModelId?e.baseModelId:e.id.replace(/\([^()]+\)$/,"")}function hct(e){return[e.authType??"",e.id,e.baseUrl??"",e.envKey??""].join("\0")}function fct(e,t){return t?e.baseModelId??e.id.replace(/\([^()]+\)$/,""):e.id}function d2({label:e,value:t}){return l.jsxs("div",{className:ll.detailRow,children:[l.jsx("span",{className:ll.detailLabel,children:e}),l.jsx("span",{className:ll.detailValue,children:t})]})}function mct({mode:e="main",onSelect:t,models:n,currentModelId:s}){const r=Ra(),i=s??r.currentModel??"",o=h.useMemo(()=>n??r.models??[],[n,r.models]),{t:a}=lt(),c=h.useRef(null),u=e==="fast",d=e==="voice",f=e==="vision",m=o.findIndex(k=>k.id===i),[p,g]=h.useState(m>=0?m:0),b=h.useRef(!1);h.useEffect(()=>{b.current||o.length===0||g(m>=0?m:0)},[o.length,m]);const v=k=>{b.current=!0,g(k)};h.useEffect(()=>{p>=o.length&&o.length>0&&g(o.length-1)},[o.length,p]);const y=o[p]??o[0],w=k=>{const C=o[k];C&&t(fct(C,u))},{keyboardMode:x}=Mp({itemCount:o.length,activeIndex:p,onActiveIndexChange:v,onConfirm:w});return h.useEffect(()=>{var C;const k=(C=c.current)==null?void 0:C.children[p];k==null||k.scrollIntoView({block:"nearest"})},[p]),l.jsxs("div",{className:ll.layout,children:[l.jsxs("div",{className:`${ll.list} ${x?ll.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":f?"model.setVision":"model.select"),"data-web-shell-model-dialog":!0,children:[o.length===0?l.jsx("div",{className:ll.empty,children:a("model.none")}):null,o.map((k,C)=>{const T=C===p,_=C===m,S=tV(k);return l.jsxs("div",{id:`model-opt-${C}`,role:"option","aria-selected":_,className:`${ll.row} ${T?ll.selected:""} ${_?mn("dialog-current"):""}`,"data-web-shell-model-option":!0,"data-model-id":k.id,onClick:()=>w(C),onMouseMove:()=>v(C),children:[l.jsxs("span",{className:ll.number,children:[C+1,"."]}),S?l.jsxs("span",{className:ll.provider,children:["[",S,"]"]}):null,l.jsx("span",{className:ll.label,children:dct(k)}),k.isRuntime?l.jsx("span",{className:ll.badge,children:a("common.runtime")}):null]},hct(k))})]}),y?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:ll.divider}),l.jsxs("div",{className:ll.detail,children:[l.jsx(d2,{label:a("model.modality"),value:uct(y.modalities,a)}),l.jsx(d2,{label:a("model.contextWindow"),value:cct(y.contextWindow,a)}),tV(y)!=="qwen-oauth"?l.jsxs(l.Fragment,{children:[l.jsx(d2,{label:a("model.baseUrl"),value:y.baseUrl??a("model.default")}),l.jsx(d2,{label:a("model.apiKey"),value:y.envKey??a("model.notSet")})]}):null]})]}):null]})}const pct="_body_2kfet_1",gct="_hint_2kfet_8",bct="_list_2kfet_13",yct="_empty_2kfet_21",wct="_row_2kfet_27",vct="_rowSelected_2kfet_51",xct="_badge_2kfet_56",kct="_label_2kfet_74",_ct="_footer_2kfet_78",Sct="_count_2kfet_86",Cct="_actions_2kfet_91",Tct="_cancel_2kfet_96",Ect="_confirm_2kfet_97",uc={body:pct,hint:gct,list:bct,empty:yct,row:wct,rowSelected:vct,badge:xct,label:kct,footer:_ct,count:Sct,actions:Cct,cancel:Tct,confirm:Ect};function jct({models:e,current:t,max:n,onConfirm:s,onClose:r}){const{t:i}=lt(),[o,a]=h.useState(()=>{const d=new Set,f=[];for(const m of t){const p=m.trim();if(!(!p||d.has(p))&&(d.add(p),f.push(p),f.length>=n))break}return f}),c=h.useMemo(()=>{const d=new Set(e.map(m=>m.baseId)),f=o.filter(m=>!d.has(m)).map(m=>({baseId:m,label:m}));return[...e,...f]},[e,o]),u=d=>{a(f=>f.includes(d)?f.filter(m=>m!==d):f.length>=n?f:[...f,d])};return l.jsxs("div",{className:uc.body,children:[l.jsx("div",{className:uc.hint,children:i("settings.models.fallbacks.hint",{max:n})}),l.jsxs("div",{className:uc.list,role:"group","aria-label":i("settings.models.fallbacks.title"),children:[c.length===0&&l.jsx("div",{className:uc.empty,children:i("settings.models.fallbacks.empty")}),c.map(d=>{const f=o.indexOf(d.baseId),m=f>=0,p=o.length>=n&&!m;return l.jsxs("button",{type:"button","aria-pressed":m,className:`${uc.row} ${m?uc.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:uc.badge,children:m?f+1:""}),l.jsx("span",{className:uc.label,children:d.label})]},d.baseId)})]}),l.jsxs("div",{className:uc.footer,children:[l.jsxs("span",{className:uc.count,children:[o.length,"/",n]}),l.jsxs("div",{className:uc.actions,children:[l.jsx("button",{type:"button",className:uc.cancel,onClick:r,children:i("settings.models.cancel")}),l.jsx("button",{type:"button",className:uc.confirm,onClick:()=>s(o),children:i("settings.models.fallbacks.confirm")})]})]})]})}function Act(e,t,n="all"){const s=t.trim().toLowerCase();return e.filter(r=>n!=="all"&&r.level!==n?!1:s?r.name.toLowerCase().includes(s):!0)}function nV(e,t){return e?t.find(n=>n.name===e.name&&n.level===e.level)??null:null}function sV(e,t){return e.level!=="user"?!1:t.some(n=>n.level==="project"&&n.name===e.name)}function Nct(e){return(e.level==="project"||e.level==="user")&&!e.isBuiltin}function rV(e){if(e==="project")return"workspace";if(e==="user")return"global"}function jP({className:e,orientation:t="horizontal",decorative:n=!0,...s}){return l.jsx(GMe,{"data-slot":"separator",decorative:n,orientation:t,className:en("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",e),...s})}function hb({className:e,...t}){return l.jsx("div",{"data-slot":"field-group",className:en("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 Mct=gg("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 to({className:e,orientation:t="vertical",...n}){return l.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:en(Mct({orientation:t}),e),...n})}function Fce({className:e,...t}){return l.jsx("div",{"data-slot":"field-content",className:en("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...t})}function qo({className:e,...t}){return l.jsx(ux,{"data-slot":"field-label",className:en("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 Ict({className:e,...t}){return l.jsx("div",{"data-slot":"field-label",className:en("flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50",e),...t})}function Du({className:e,...t}){return l.jsx("p",{"data-slot":"field-description",className:en("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 Rct({className:e,children:t,errors:n,...s}){const r=h.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:en("text-sm font-normal text-destructive",e),...s,children:r}):null}const Dct=gg("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",success:"border-[var(--success-color)]/30 bg-[var(--success-bg)] text-[var(--success-color)] *:data-[slot=alert-description]:text-[var(--success-color)]"}},defaultVariants:{variant:"default"}});function bo({className:e,variant:t,...n}){return l.jsx("div",{"data-slot":"alert",role:"alert",className:en(Dct({variant:t}),e),...n})}function xc({className:e,...t}){return l.jsx("div",{"data-slot":"alert-title",className:en("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",e),...t})}function yo({className:e,...t}){return l.jsx("div",{"data-slot":"alert-description",className:en("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),...t})}function Pct({className:e,...t}){return l.jsx("div",{"data-slot":"alert-action",className:en("absolute top-2 right-2",e),...t})}function fr({className:e,...t}){return l.jsx(J1,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:en("size-4 animate-spin",e),...t})}function Yl({children:e,closeLabel:t,noticeKey:n,onDismiss:s,tone:r,className:i}){const o=h.useRef(s);return o.current=s,h.useEffect(()=>{if(r==="error"||r==="progress")return;const a=window.setTimeout(()=>o.current(),3e3);return()=>window.clearTimeout(a)},[n,r]),l.jsxs(bo,{variant:r==="error"?"destructive":r==="success"?"success":"default",children:[r==="error"?l.jsx(ja,{}):r==="success"?l.jsx(AI,{}):r==="progress"?l.jsx(fr,{}):l.jsx(cC,{}),l.jsx(yo,{className:i,children:e}),r!=="progress"?l.jsx(Pct,{children:l.jsx(Jt,{type:"button",variant:"ghost",size:"icon-xs","aria-label":t,title:t,onClick:s,children:l.jsx(ey,{})})}):null]})}function _g({className:e,orientation:t="horizontal",...n}){return l.jsx(e9e,{orientation:t,"data-slot":"tabs","data-orientation":t,className:en("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}const Lct=gg("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 Sg({className:e,variant:t="default",...n}){return l.jsx(t9e,{"data-slot":"tabs-list","data-variant":t,className:en(Lct({variant:t}),e),...n})}function ti({className:e,...t}){return l.jsx(n9e,{"data-slot":"tabs-trigger",className:en("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 Ri({className:e,...t}){return l.jsx(s9e,{"data-slot":"tabs-content",className:en("flex-1 text-sm outline-none",e),...t})}function u0({className:e,...t}){return l.jsx("textarea",{"data-slot":"textarea",className:en("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})}function Oct(e,t){const n=new Set(Object.values(t).flatMap(s=>s.map(r=>r.name)));return e.filter(s=>s.enabled&&!s.name.startsWith("mcp__")&&!n.has(s.name))}function $ct(e){return e.filter(t=>!t.disabled&&(t.mcpStatus==="connected"||t.mcpStatus===void 0&&t.status==="ok")).map(t=>t.name)}function Bct(e,t){if(!e.trim())return;const n=JSON.parse(e);if(!Kf(n))throw new Error(`${t} must be a JSON object`);return n}function Kf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function zct(e){return(e instanceof Error?e.message:String(e)).replace(/^[A-Z]+ \/\S+:\s*/,"")}function QM(e,t,n){const s=new Set(e);return n?s.add(t):s.delete(t),s}const iV=["inherit",...Jb],Fct=1500,Hct=40;function oV({initialScope:e="global",agent:t,onCancel:n,onCreated:s}){var yt,Ft;const{t:r}=lt(),{createAgent:i,updateAgent:o,generateContent:a}=RQ({autoLoad:!1}),c=DQ({autoLoad:!1}),u=EI({autoLoad:!1}),d=jI({autoLoad:!0}),f=u.loadTools,m=u.initialize,p=u.reloadConfig,g=u.reload,b=c.preheat,v=c.reload,y=(t==null?void 0:t.level)==="user"?"global":"workspace",[w,x]=h.useState(t?y:e),[k,C]=h.useState((t==null?void 0:t.name)??""),[T,_]=h.useState((t==null?void 0:t.description)??""),[S,R]=h.useState((t==null?void 0:t.systemPrompt)??""),[A,O]=h.useState(()=>{var De;return new Set((De=t==null?void 0:t.tools)!=null&&De.includes("*")?[]:(t==null?void 0:t.tools)??[])}),[M,D]=h.useState(()=>new Set((t==null?void 0:t.disallowedTools)??[])),[$,z]=h.useState((t==null?void 0:t.model)??""),[B,j]=h.useState((t==null?void 0:t.approvalMode)??"inherit"),H=B==="bubble"?[...iV,"bubble"]:iV,[Q,I]=h.useState(((yt=t==null?void 0:t.maxTurns)==null?void 0:yt.toString())??""),[J,W]=h.useState((t==null?void 0:t.color)??"inherit"),[P,V]=h.useState(()=>new Set(Object.keys((t==null?void 0:t.mcpServers)??{}))),[ee,q]=h.useState(t!=null&&t.hooks?JSON.stringify(t.hooks,null,2):""),[K,de]=h.useState(!1),[re,ne]=h.useState(""),[U,Z]=h.useState(""),[ge,ce]=h.useState(""),[ue,be]=h.useState({}),[rt,le]=h.useState(!1),[Me,We]=h.useState(null),[at,ze]=h.useState(!0),[rn,Wt]=h.useState(null),[zt,ae]=h.useState(!1),[je,it]=h.useState(()=>new Set),[gt,wt]=h.useState(null),[Ke,un]=h.useState(null),me=h.useRef({description:0,systemPrompt:0}),ht=h.useRef({}),Oe=h.useMemo(()=>Oct(c.tools,ue),[ue,c.tools]),Ne=h.useMemo(()=>{var De;return((De=u.status)==null?void 0:De.servers)??[]},[(Ft=u.status)==null?void 0:Ft.servers]),St=h.useMemo(()=>{var $e;const De=($e=d.settings.find(Ht=>Ht.key==="mcpServers"))==null?void 0:$e.values,Xe=w==="global"?De==null?void 0:De.user:De==null?void 0:De.effective;return Kf(Xe)?Xe:{}},[w,d.settings]),Ue=h.useMemo(()=>Ne.filter(De=>{var Xe;return Kf(St[De.name])||Kf((Xe=t==null?void 0:t.mcpServers)==null?void 0:Xe[De.name])?!0:w==="workspace"&&Kf(De.config)}),[t==null?void 0:t.mcpServers,St,Ne,w]),ve=h.useMemo(()=>$ct(Ue),[Ue]),Fe=ve.join("\0"),ie=!!(k.trim()&&T.trim()&&S.trim());h.useEffect(()=>()=>{for(const De of Object.values(ht.current))De==null||De.abort()},[]),h.useEffect(()=>{let De=!0;return(async()=>{var $e,Ht;ze(!0),Wt(null);try{if(!(await b(5e3)).ready)throw new Error(r("agent.create.tools.preheatFailed"));if(!De)return;const Fn=await v();if(!Fn)throw new Error(r("agent.create.tools.loadFailed"));if(($e=Fn.errors)!=null&&$e.length)throw new Error(Fn.errors.map(Lt=>Lt.error||Lt.hint||Lt.kind).join(`
`));(await m()).accepted||await p();let ft=!1;for(let Lt=0;Lt<Hct;Lt+=1){if(await new Promise(Tn=>window.setTimeout(Tn,Fct)),!De)return;const gn=await g();if(gn){if((Ht=gn.errors)!=null&&Ht.length)throw new Error(gn.errors.map(Tn=>Tn.error||Tn.hint||Tn.kind).join(`
`));if(gn.discoveryState==="completed"||gn.initialized&&gn.discoveryState==="not_started"&&gn.servers.length===0){ft=!0;break}}}if(!ft)throw new Error(r("mcp.discovery.timeout"))}catch(ke){De&&Wt(ke instanceof Error?ke.message:String(ke))}finally{De&&ze(!1)}})(),()=>{De=!1}},[m,b,g,p,v,r]),h.useEffect(()=>{if(at)return;if(!Fe){be({});return}let De=!0;return le(!0),We(null),Promise.all(ve.map(async Xe=>{var Ht;const $e=await f(Xe);return{serverName:Xe,tools:$e.tools.filter(ke=>ke.isValid),error:(Ht=$e.errors)!=null&&Ht.length?`${Xe}: ${$e.errors.map(ke=>ke.error||ke.hint||ke.kind).join(", ")}`:void 0}})).then(Xe=>{if(!De)return;be(Object.fromEntries(Xe.map(({serverName:Ht,tools:ke})=>[Ht,ke])));const $e=Xe.flatMap(({error:Ht})=>Ht?[Ht]:[]);We($e.length>0?$e.join(`
`):null)}).catch(Xe=>{De&&We(Xe instanceof Error?Xe.message:String(Xe))}).finally(()=>{De&&le(!1)}),()=>{De=!1}},[Fe,ve,at,f]);function Pe(De){var Xe;if(!De){for(const $e of["description","systemPrompt"])me.current[$e]+=1,(Xe=ht.current[$e])==null||Xe.abort(),delete ht.current[$e];it(new Set)}de(De)}function et(){Z(T),ce(S),un(null),de(!0)}function He(De){var Xe;me.current[De]+=1,(Xe=ht.current[De])==null||Xe.abort(),delete ht.current[De],it($e=>{const Ht=new Set($e);return Ht.delete(De),Ht})}async function Ae(De){const Xe=re.trim();if(!Xe||ht.current[De])return;const $e=me.current[De]+1;me.current[De]=$e;const Ht=new AbortController;ht.current[De]=Ht,it(Fn=>new Set(Fn).add(De)),un(null);const ke=De==="description"?Z:ce;ke("");try{const Fn=De==="description"?"Return only a concise one-sentence subagent description explaining when this subagent should be used. Do not return JSON, Markdown, a label, or commentary.":"Return only the complete subagent system prompt. Do not return JSON, a Markdown code block, a name, a description, or commentary.";let Ve="";for await(const ft of a(`${Xe}

${Fn}`,{signal:Ht.signal})){if(me.current[De]!==$e)return;if(ft.type==="delta")Ve+=ft.text,ke(Ve);else if(ft.type==="error")throw new Error(ft.message)}if(me.current[De]!==$e)return;ke(Ve.trim())}catch(Fn){if(me.current[De]!==$e||Ht.signal.aborted)return;un(r("agent.create.generateFailed",{error:Fn instanceof Error?Fn.message:String(Fn)}))}finally{me.current[De]===$e&&(it(Fn=>{const Ve=new Set(Fn);return Ve.delete(De),Ve}),ht.current[De]===Ht&&delete ht.current[De])}}function vt(){_(U.trim()),R(ge.trim()),Pe(!1)}function vn(De){var ke,Fn;const Xe=(ke=t==null?void 0:t.mcpServers)==null?void 0:ke[De];if(Kf(Xe))return Xe;const $e=St[De];if(Kf($e))return $e;const Ht=w==="workspace"?(Fn=Ne.find(Ve=>Ve.name===De))==null?void 0:Fn.config:void 0;return Kf(Ht)?Ht:void 0}async function Ce(){if(!ie){wt(r("agent.create.required"));return}ae(!0),wt(null);try{const De=Q.trim()?Number(Q.trim()):void 0;if(De!==void 0&&(!Number.isSafeInteger(De)||De<=0))throw new Error(r("agent.create.maxTurnsInvalid"));const Xe=[...A],$e=[...M],Ht=Bct(ee,"hooks"),ke=Object.fromEntries([...P].flatMap(ft=>{const Lt=vn(ft);return Lt?[[ft,Lt]]:[]})),Fn={description:T.trim(),systemPrompt:S.trim(),tools:t||Xe.length>0?Xe:void 0,disallowedTools:t||$e.length>0?$e:void 0,mcpServers:t||Object.keys(ke).length>0?ke:void 0,hooks:t?Ht??{}:Ht},Ve=t?await o(t.name,{...Fn,model:$.trim()||null,approvalMode:B==="inherit"?null:B,maxTurns:De??null,color:J==="inherit"?null:J},w):await i({name:k.trim(),scope:w,...Fn,model:$.trim()||void 0,approvalMode:B==="inherit"?void 0:B,maxTurns:De,color:J==="inherit"?void 0:J});s(Ve.agent.name)}catch(De){wt(zct(De))}finally{ae(!1)}}return l.jsxs("div",{className:"flex w-full max-w-5xl flex-col gap-6",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsx("h1",{className:"text-xl font-semibold text-balance",children:r(t?"agent.edit":"agent.create")}),l.jsxs(Jt,{type:"button",variant:"outline",onClick:et,children:[l.jsx(eb,{"data-icon":"inline-start"}),r("agent.create.modelGenerate")]})]}),gt?l.jsx(Yl,{tone:"error",noticeKey:gt,closeLabel:r("common.close"),onDismiss:()=>wt(null),children:gt}):null,l.jsxs(_g,{defaultValue:"overview",children:[l.jsxs(Sg,{className:"max-w-full overflow-x-auto",children:[l.jsx(ti,{value:"overview",children:r("agent.detail.overview")}),l.jsx(ti,{value:"prompt",children:r("agent.detail.systemPrompt")}),l.jsx(ti,{value:"tools",children:r("agent.detail.tools")}),l.jsx(ti,{value:"mcp",children:r("agent.detail.mcp")}),l.jsx(ti,{value:"hooks",children:r("agent.detail.hooks")})]}),l.jsx(Ri,{value:"overview",className:"pt-4",children:l.jsxs(hb,{className:"grid grid-cols-1 gap-5 lg:grid-cols-2",children:[l.jsxs(to,{children:[l.jsx(qo,{htmlFor:"agent-scope",children:r("agent.create.scope")}),l.jsxs(xl,{value:w,disabled:!!t,onValueChange:De=>x(De),children:[l.jsx(_l,{id:"agent-scope",className:"w-full",children:l.jsx(kl,{})}),l.jsxs(Sl,{children:[l.jsx(Ti,{value:"workspace",children:r("agent.create.project.cli")}),l.jsx(Ti,{value:"global",children:r("agent.create.user.cli")})]})]})]}),l.jsxs(to,{children:[l.jsx(qo,{htmlFor:"agent-name",children:r("agent.create.name")}),l.jsx(Pr,{id:"agent-name",value:k,onChange:De=>C(De.target.value),placeholder:r("agent.create.namePlaceholder"),disabled:!!t}),l.jsx(Du,{children:r("agent.create.nameHelp")})]}),l.jsxs(to,{className:"lg:col-span-2",children:[l.jsx(qo,{htmlFor:"agent-description",children:r("agent.create.description")}),l.jsx(u0,{id:"agent-description",value:T,onChange:De=>_(De.target.value),placeholder:r("agent.create.manualDescPlaceholder"),rows:3})]}),l.jsxs(to,{children:[l.jsx(qo,{htmlFor:"agent-model",children:r("agent.create.model")}),l.jsx(Pr,{id:"agent-model",value:$,onChange:De=>z(De.target.value),placeholder:"inherit / fast / provider:model"})]}),l.jsxs(to,{children:[l.jsx(qo,{htmlFor:"agent-approval",children:r("agent.create.approvalMode")}),l.jsxs(xl,{value:B,onValueChange:j,children:[l.jsx(_l,{id:"agent-approval",className:"w-full",children:l.jsx(kl,{children:cV(B,r)})}),l.jsx(Sl,{children:H.map(De=>l.jsx(Ti,{value:De,disabled:De==="bubble",children:cV(De,r)},De))})]}),l.jsx(Du,{children:Uct(B,r)})]}),l.jsxs(to,{children:[l.jsx(qo,{htmlFor:"agent-max-turns",children:r("agent.create.maxTurns")}),l.jsx(Pr,{id:"agent-max-turns",type:"number",min:"1",step:"1",value:Q,onChange:De=>I(De.target.value)}),l.jsx(Du,{children:r("agent.create.maxTurnsHelp")})]}),l.jsxs(to,{children:[l.jsx(qo,{htmlFor:"agent-color",children:r("agent.create.color")}),l.jsxs(xl,{value:J,onValueChange:W,children:[l.jsx(_l,{id:"agent-color",className:"w-full",children:l.jsx(kl,{})}),l.jsx(Sl,{children:["inherit","auto","red","blue","green","yellow","purple","orange","pink","cyan"].map(De=>l.jsx(Ti,{value:De,children:De},De))})]})]})]})}),l.jsx(Ri,{value:"prompt",className:"pt-4",children:l.jsxs(to,{children:[l.jsx(u0,{id:"agent-prompt","aria-label":r("agent.create.prompt"),value:S,onChange:De=>R(De.target.value),placeholder:r("agent.create.promptPlaceholder.cli"),rows:16,className:"min-h-80 max-h-[60vh] overflow-y-auto"}),l.jsx(Du,{children:r("agent.create.promptHelp")})]})}),l.jsx(Ri,{value:"tools",className:"pt-4",children:l.jsxs(hb,{children:[l.jsxs(to,{children:[l.jsx(qo,{children:r("agent.create.tools")}),l.jsx(Du,{children:r("agent.create.toolsSelectHelp")}),l.jsx(lV,{idPrefix:"agent-allowed-tool",selection:A,onSelectionChange:O,builtInTools:Oe,mcpServers:Ue,mcpTools:ue,t:r}),at||rt?l.jsx(uV,{label:r("agent.create.tools.initializing")}):null,rn||Me?l.jsx("div",{className:"whitespace-pre-wrap text-sm text-destructive",children:rn||Me}):null]}),l.jsxs(to,{children:[l.jsx(qo,{children:r("agent.create.disallowedTools")}),l.jsx(lV,{idPrefix:"agent-disallowed-tool",selection:M,onSelectionChange:D,builtInTools:Oe,mcpServers:Ue,mcpTools:ue,t:r})]})]})}),l.jsx(Ri,{value:"mcp",className:"pt-4",children:l.jsxs(to,{children:[l.jsx(qo,{children:r("agent.create.mcpServers")}),l.jsx(qct,{selection:P,onSelectionChange:V,servers:Ue,t:r}),d.loading?l.jsx(uV,{label:r("common.loading")}):d.error?l.jsx(Wct,{error:d.error}):null]})}),l.jsx(Ri,{value:"hooks",className:"pt-4",children:l.jsxs(to,{children:[l.jsx(qo,{htmlFor:"agent-hooks",children:"Hooks"}),l.jsx(u0,{id:"agent-hooks",value:ee,onChange:De=>q(De.target.value),placeholder:'{"PreToolUse":[...] }',rows:10,className:"min-h-64 max-h-[60vh] overflow-y-auto font-mono text-xs"}),l.jsx(Du,{children:r("agent.create.jsonObjectHelp")})]})})]}),l.jsxs("div",{className:"flex justify-end gap-2 border-t pt-4",children:[l.jsx(Jt,{variant:"outline",onClick:n,disabled:zt,children:r("common.cancel")}),l.jsxs(Jt,{onClick:()=>void Ce(),disabled:!ie||zt,children:[zt?l.jsx(fr,{"data-icon":"inline-start"}):null,r(t?"agent.edit.save":"agent.create.save")]})]}),l.jsx(Qm,{open:K,onOpenChange:Pe,children:l.jsxs(Jm,{className:"max-h-[calc(100vh-2rem)] overflow-y-auto sm:max-w-2xl",children:[l.jsxs(Zm,{children:[l.jsx(tp,{children:r("agent.create.modelGenerate")}),l.jsx(W0,{children:r("agent.create.modelGenerate.description")})]}),Ke?l.jsx(Yl,{tone:"error",noticeKey:Ke,closeLabel:r("common.close"),onDismiss:()=>un(null),children:Ke}):null,l.jsxs(hb,{children:[l.jsxs(to,{children:[l.jsx(qo,{htmlFor:"agent-generation-requirements",children:r("agent.create.describeAgent")}),l.jsx(u0,{id:"agent-generation-requirements",value:re,onChange:De=>ne(De.target.value),placeholder:r("agent.create.qwenPlaceholder"),rows:4}),l.jsx(Du,{children:r("agent.create.qwenHint")})]}),l.jsxs(to,{children:[l.jsx(aV,{htmlFor:"agent-generated-description",label:r("agent.create.generatedDescription"),active:je.has("description"),disabled:!re.trim(),onGenerate:()=>void Ae("description"),onCancel:()=>He("description"),t:r}),l.jsx(u0,{id:"agent-generated-description",value:U,onChange:De=>Z(De.target.value),rows:3,readOnly:je.has("description")})]}),l.jsxs(to,{children:[l.jsx(aV,{htmlFor:"agent-generated-prompt",label:r("agent.create.generatedSystemPrompt"),active:je.has("systemPrompt"),disabled:!re.trim(),onGenerate:()=>void Ae("systemPrompt"),onCancel:()=>He("systemPrompt"),t:r}),l.jsx(u0,{id:"agent-generated-prompt",value:ge,onChange:De=>ce(De.target.value),rows:10,readOnly:je.has("systemPrompt"),className:"min-h-64 max-h-64 overflow-y-auto"})]})]}),l.jsxs(ep,{children:[l.jsx(Jt,{type:"button",variant:"outline",onClick:()=>Pe(!1),children:r("common.cancel")}),l.jsx(Jt,{type:"button",onClick:vt,disabled:je.size>0||!U.trim()||!ge.trim(),children:r("agent.create.useGenerated")})]})]})})]})}function aV({htmlFor:e,label:t,active:n,disabled:s,onGenerate:r,onCancel:i,t:o}){return l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(qo,{htmlFor:e,children:t}),n?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[l.jsx(fr,{className:"size-3"}),o("agent.create.generatingPrompt")]}),l.jsx(Jt,{type:"button",variant:"outline",size:"sm",className:"ml-auto",onClick:i,children:o("common.cancel")})]}):l.jsxs(Jt,{type:"button",variant:"outline",size:"sm",className:"ml-auto",disabled:s,onClick:r,children:[l.jsx(eb,{"data-icon":"inline-start"}),o("agent.create.generate")]})]})}function lV({idPrefix:e,selection:t,onSelectionChange:n,builtInTools:s,mcpServers:r,mcpTools:i,t:o}){const[a,c]=h.useState("builtin"),[u,d]=h.useState(""),f=r.filter(g=>!g.disabled),m=a==="builtin"?s:i[u]??[],p=new Map;for(const g of s)p.set(g.name,g.displayName||g.name);for(const[g,b]of Object.entries(i))for(const v of b)p.set(v.name,`${g} / ${v.serverToolName||v.name}`);return l.jsxs("div",{className:"grid gap-3 rounded-lg border p-4",children:[l.jsxs("div",{className:`grid gap-3 ${a==="mcp"?"sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]":"sm:grid-cols-[minmax(0,1fr)]"}`,children:[l.jsxs(xl,{value:a,onValueChange:g=>{c(g),d("")},children:[l.jsx(_l,{id:`${e}-kind`,className:"w-full","aria-label":o("agent.create.tools.type"),children:l.jsx(kl,{})}),l.jsxs(Sl,{children:[l.jsx(Ti,{value:"builtin",children:o("agent.create.tools.builtin")}),l.jsx(Ti,{value:"mcp",children:o("agent.create.tools.mcp")})]})]}),a==="mcp"?l.jsxs(xl,{value:u||void 0,onValueChange:d,children:[l.jsx(_l,{id:`${e}-server`,className:"w-full","aria-label":o("agent.create.tools.selectServer"),children:l.jsx(kl,{placeholder:o("agent.create.tools.selectServer")})}),l.jsx(Sl,{children:f.map(g=>{var b;return l.jsxs(Ti,{value:g.name,disabled:g.mcpStatus!=="connected"&&(((b=i[g.name])==null?void 0:b.length)??0)===0,children:[g.name,g.mcpStatus?` · ${o(`mcp.status.${g.mcpStatus}`)}`:""]},g.name)})})]}):null]}),l.jsx("div",{className:"max-h-64 overflow-y-auto rounded-md border",children:m.length>0?l.jsx(nh,{delayDuration:300,children:l.jsx("div",{className:"divide-y",children:m.map(g=>{const b=a==="builtin"?g.displayName||g.name:g.serverToolName||g.name;return l.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-3 py-2.5 hover:bg-accent/30",children:[l.jsx(UC,{id:`${e}-${g.name}`,checked:t.has(g.name),onCheckedChange:v=>n(QM(t,g.name,v===!0))}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block truncate text-sm font-medium",children:b}),g.description?l.jsxs(sh,{children:[l.jsx(rh,{asChild:!0,children:l.jsx("span",{className:"mt-0.5 block truncate text-xs text-muted-foreground",children:g.description})}),l.jsx(ih,{className:"max-w-sm whitespace-normal",children:g.description})]}):null]})]},g.name)})})}):l.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:o("agent.create.tools.empty")})}),t.size>0?l.jsx("div",{className:"flex flex-wrap gap-2",children:[...t].map(g=>l.jsxs("span",{className:"inline-flex max-w-full items-center gap-1 rounded-md bg-muted px-2 py-1 text-sm",title:g,children:[l.jsx("span",{className:"truncate",children:p.get(g)||g}),l.jsx("button",{type:"button",className:"rounded-sm text-muted-foreground hover:text-foreground","aria-label":o("agent.create.removeSelection",{name:g}),onClick:()=>n(QM(t,g,!1)),children:l.jsx(ey,{className:"size-3.5"})})]},g))}):l.jsx("div",{className:"text-sm text-muted-foreground",children:o("agent.create.tools.noneSelected")})]})}function qct({selection:e,onSelectionChange:t,servers:n,t:s}){return l.jsx("div",{className:"max-h-64 overflow-y-auto rounded-lg border",children:n.length>0?l.jsx("div",{className:"divide-y",children:n.map(r=>l.jsxs("label",{className:"flex cursor-pointer items-center gap-3 px-3 py-2.5 hover:bg-accent/30",children:[l.jsx(UC,{id:`agent-mcp-server-${r.name}`,checked:e.has(r.name),onCheckedChange:i=>t(QM(e,r.name,i===!0))}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:r.name}),r.mcpStatus?l.jsx(Pi,{variant:"secondary",className:r.mcpStatus==="connected"?"bg-[var(--success-bg)] text-[var(--success-color)]":void 0,children:s(`mcp.status.${r.mcpStatus}`)}):null]},r.name))}):l.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:s("agent.create.mcpServers.empty")})})}function cV(e,t){return t(e==="inherit"||e==="bubble"?`agent.approval.${e}`:`mode.listLabel.${e}`)}function Uct(e,t){return t(e==="inherit"||e==="bubble"?`agent.approval.desc.${e}`:`mode.desc.${e}`)}function uV({label:e}){return l.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[l.jsx(fr,{}),e]})}function Wct({error:e}){return l.jsx("div",{className:"text-sm text-destructive",children:e==null?void 0:e.message})}function Ox({...e}){return l.jsx(zEe,{"data-slot":"alert-dialog",...e})}function Vct({container:e,...t}){const n=_u();return l.jsx(FEe,{"data-slot":"alert-dialog-portal",container:e??n??void 0,...t})}const Gct=h.forwardRef(function({className:t,...n},s){return l.jsx(HEe,{ref:s,"data-slot":"alert-dialog-overlay",className:en("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})}),$x=h.forwardRef(function({className:t,size:n="default",...s},r){return l.jsxs(Vct,{children:[l.jsx(Gct,{}),l.jsx(qEe,{ref:r,"data-slot":"alert-dialog-content","data-size":n,className:en("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 Bx({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-header",className:en("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 zx({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-footer",className:en("-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 Fx({className:e,...t}){return l.jsx(VEe,{"data-slot":"alert-dialog-title",className:en("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 Hx({className:e,...t}){return l.jsx(GEe,{"data-slot":"alert-dialog-description",className:en("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function AP({className:e,variant:t="default",size:n="default",...s}){return l.jsx(Jt,{variant:t,size:n,asChild:!0,children:l.jsx(UEe,{"data-slot":"alert-dialog-action",className:en(e),...s})})}function qx({className:e,variant:t="outline",size:n="default",...s}){return l.jsx(Jt,{variant:t,size:n,asChild:!0,children:l.jsx(WEe,{"data-slot":"alert-dialog-cancel",className:en(e),...s})})}function fp({className:e,...t}){return l.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:en(e),...t})}function mp({className:e,...t}){return l.jsx("ol",{"data-slot":"breadcrumb-list",className:en("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground",e),...t})}function Yi({className:e,...t}){return l.jsx("li",{"data-slot":"breadcrumb-item",className:en("inline-flex items-center gap-1",e),...t})}function $d({asChild:e,className:t,...n}){const s=e?MR:"a";return l.jsx(s,{"data-slot":"breadcrumb-link",className:en("transition-colors hover:text-foreground",t),...n})}function ml({className:e,...t}){return l.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:en("font-normal text-foreground",e),...t})}function Bd({children:e,className:t,...n}){return l.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:en("[&>svg]:size-3.5",t),...n,children:e??l.jsx(ok,{})})}function No({className:e,size:t="default",...n}){return l.jsx("div",{"data-slot":"card","data-size":t,className:en("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 bl({className:e,...t}){return l.jsx("div",{"data-slot":"card-header",className:en("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 yl({className:e,...t}){return l.jsx("div",{"data-slot":"card-title",className:en("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",e),...t})}function mu({className:e,...t}){return l.jsx("div",{"data-slot":"card-description",className:en("text-sm text-muted-foreground",e),...t})}function Hce({className:e,...t}){return l.jsx("div",{"data-slot":"card-action",className:en("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),...t})}function Vl({className:e,...t}){return l.jsx("div",{"data-slot":"card-content",className:en("px-(--card-spacing)",e),...t})}function Kct({className:e,...t}){return l.jsx("div",{"data-slot":"card-footer",className:en("flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)",e),...t})}function $u({className:e,...t}){return l.jsx("div",{"data-slot":"empty",className:en("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 Bu({className:e,...t}){return l.jsx("div",{"data-slot":"empty-header",className:en("flex max-w-sm flex-col items-center gap-2",e),...t})}const Yct=gg("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 zu({className:e,variant:t="default",...n}){return l.jsx("div",{"data-slot":"empty-icon","data-variant":t,className:en(Yct({variant:t,className:e})),...n})}function Fu({className:e,...t}){return l.jsx("div",{"data-slot":"empty-title",className:en("text-sm font-medium tracking-tight",e),...t})}function ky({className:e,...t}){return l.jsx("div",{"data-slot":"empty-description",className:en("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function Xct({className:e,...t}){return l.jsx("div",{"data-slot":"empty-content",className:en("flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance",e),...t})}const Qct=gg("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"}}),qce=h.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function NP({className:e,variant:t,size:n,spacing:s=2,orientation:r="horizontal",children:i,...o}){return l.jsx(lD,{orientation:r,"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":s,"data-orientation":r,style:{"--gap":s},className:en("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(qce.Provider,{value:{variant:t,size:n,spacing:s,orientation:r},children:i})})}function MP({className:e,children:t,variant:n="default",size:s="default",...r}){const i=h.useContext(qce);return l.jsx(Rre,{"data-slot":"toggle-group-item","data-variant":i.variant||n,"data-size":i.size||s,"data-spacing":i.spacing,className:en("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",Qct({variant:i.variant||n,size:i.size||s}),e),...r,children:t})}const Jct="_agentGrid_bui90_1",Zct={agentGrid:Jct};function DE(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}function eut(e,t){return e?e==="inherit"||e==="bubble"?t(`agent.approval.${e}`):Jb.some(n=>n===e)?t(`mode.listLabel.${e}`):e:"—"}function n0({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 dV(e){return e?JSON.stringify(e,null,2):"—"}function tut(e){return e.replace(/\r\n?/g,`
`).replace(new RegExp("(?<!\\n)\\n(?!\\n|[ \\t]*(?:#{1,6}\\s|[-*+]\\s|\\d+\\.\\s|```|>\\s|\\*\\*[^*\\n]+\\*\\*:))","g")," ")}function Uce({onClose:e,embedded:t,initialCreateScope:n}){var re,ne;const{t:s}=lt(),{agents:r,loading:i,error:o,reload:a,getAgent:c,deleteAgent:u}=RQ({autoLoad:!0}),[d,f]=h.useState(""),[m,p]=h.useState("all"),[g,b]=h.useState(null),[v,y]=h.useState(null),[w,x]=h.useState(!1),[k,C]=h.useState(!1),[T,_]=h.useState(!1),[S,R]=h.useState(()=>!!n),[A,O]=h.useState(!1),[M,D]=h.useState(null),[$,z]=h.useState(null),[B,j]=h.useState(null),[H,Q]=h.useState(!1),I=h.useMemo(()=>Act(r,d,m),[r,d,m]),J=h.useMemo(()=>nV(g,r),[r,g]),W=(g==null?void 0:g.name)??null;h.useEffect(()=>{b(U=>nV(U,r))},[r]),h.useEffect(()=>{t==null||t.onDetailChange(!!(W||S||A))},[S,A,t,W]),h.useEffect(()=>{if(!g){y(null),j(null);return}let U=!0;return y(null),j(null),x(!0),c(g.name,rV(g.level)).then(Z=>{U&&y(Z)}).catch(Z=>{U&&j(Z instanceof Error?Z.message:String(Z))}).finally(()=>{U&&x(!1)}),()=>{U=!1}},[g,c]),h.useEffect(()=>{Q(!1)},[o]),h.useEffect(()=>{n&&R(!0)},[n]);function P(){R(!1),O(!1),b(null),y(null),z(null),a()}async function V(){if(!v||!J)return;const U=rV(J.level);if(U){C(!0);try{await u(J.name,U),_(!1),b(null),y(null),D(s("agent.deleted",{name:v.name})),await a()}catch(Z){_(!1),z(Z instanceof Error?Z.message:String(Z))}finally{C(!1)}}}const ee=[{value:"all",label:s("skills.filter.all")},{value:"project",label:s("agent.level.project")},{value:"user",label:s("agent.level.user")},{value:"builtin",label:s("agent.level.builtin")},{value:"extension",label:s("agent.level.extension")}],q=A?s("agent.edit"):W??(S?s("agent.create.button"):null),K=l.jsx(fp,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(mp,{className:"text-base",children:[l.jsx(Yi,{children:l.jsx(Jt,{variant:"ghost",size:"icon",onClick:e,"aria-label":s("common.back"),children:l.jsx(ik,{})})}),l.jsx(Yi,{children:q?l.jsx($d,{asChild:!0,children:l.jsx("button",{type:"button",onClick:P,children:s("agents.title")})}):l.jsx(ml,{children:s("agents.title")})}),q?l.jsx(Bd,{}):null,q?l.jsx(Yi,{children:l.jsx(ml,{children:q})}):null]})}),de=t?q?l.jsx(fp,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(mp,{className:"h-8 text-sm",children:[l.jsx(Yi,{children:l.jsx($d,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>{P(),t.onDetailChange(!1)},children:s("agents.title")})})}),l.jsx(Bd,{}),l.jsx(Yi,{children:l.jsx(ml,{children:q})})]})}):null:K;if(S)return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[de,l.jsx(oV,{initialScope:n??"global",onCancel:P,onCreated:U=>{R(!1),D(s("agent.created",{name:U})),a()}})]});if(A&&v)return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[de,l.jsx(oV,{agent:v,onCancel:()=>O(!1),onCreated:U=>{O(!1),b(null),y(null),D(s("agent.updated",{name:U})),a()}})]});if(W&&v){const U=Nct(v),Z=!v.tools||v.tools.length===0||v.tools.includes("*")?s("agent.create.tools.all"):v.tools.join(", "),ge=((re=v.disallowedTools)==null?void 0:re.join(", "))||"—";return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[de,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(gv,{})}),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-xl font-semibold text-balance",children:v.name}),l.jsx(Pi,{variant:"outline",children:DE(v.level,s)}),sV(v,r)?l.jsx(Pi,{variant:"secondary",children:s("agent.overriddenBadge")}):null]})}),U?l.jsxs(Hh,{children:[l.jsx(qh,{asChild:!0,children:l.jsx(Jt,{variant:"ghost",size:"icon",disabled:k,"aria-label":s("agent.chooseAction",{name:v.name}),children:k?l.jsx(fr,{}):l.jsx(fm,{})})}),l.jsx(Uh,{align:"end",onCloseAutoFocus:ce=>ce.preventDefault(),children:l.jsxs(Lm,{children:[l.jsxs(ho,{onSelect:()=>O(!0),children:[l.jsx(Sb,{"data-icon":"inline-start"}),s("agent.edit")]}),l.jsxs(ho,{variant:"destructive",disabled:k,onSelect:()=>_(!0),children:[l.jsx(mm,{"data-icon":"inline-start"}),s("agent.delete")]})]})})]}):null]}),$?l.jsx(Yl,{tone:"error",noticeKey:$,closeLabel:s("common.close"),onDismiss:()=>z(null),children:$}):null,l.jsxs(_g,{defaultValue:"overview",children:[l.jsxs(Sg,{className:"max-w-full overflow-x-auto",children:[l.jsx(ti,{value:"overview",children:s("agent.detail.overview")}),l.jsx(ti,{value:"prompt",children:s("agent.detail.systemPrompt")}),l.jsx(ti,{value:"tools",children:s("agent.detail.tools")}),l.jsx(ti,{value:"mcp",children:s("agent.detail.mcp")}),l.jsx(ti,{value:"hooks",children:s("agent.detail.hooks")})]}),l.jsx(Ri,{value:"overview",className:"pt-4",children:l.jsxs(No,{children:[l.jsxs(bl,{children:[l.jsx(yl,{className:"text-sm",children:s("agent.descriptionLabel")}),l.jsx(mu,{children:v.description||"—"})]}),l.jsxs(Vl,{className:"grid gap-6 sm:grid-cols-2",children:[l.jsx(n0,{label:s("agent.filePathLabel"),value:v.filePath||"—"}),l.jsx(n0,{label:s("agent.modelLabel"),value:v.model||"—"}),l.jsx(n0,{label:s("agent.level.label"),value:DE(v.level,s)}),l.jsx(n0,{label:s("agent.create.approvalMode"),value:eut(v.approvalMode||v.permissionMode,s)}),l.jsx(n0,{label:s("agent.create.maxTurns"),value:((ne=v.maxTurns)==null?void 0:ne.toString())||"—"}),l.jsx(n0,{label:s("agent.create.color"),value:v.color||"—"})]})]})}),l.jsx(Ri,{value:"prompt",className:"pt-4",children:l.jsx(No,{children:l.jsx(Vl,{children:l.jsx("div",{className:"max-h-[60vh] w-full overflow-auto break-words whitespace-pre-line text-sm leading-6 text-muted-foreground",children:v.systemPrompt?tut(v.systemPrompt):"—"})})})}),l.jsx(Ri,{value:"tools",className:"pt-4",children:l.jsxs(No,{children:[l.jsxs(bl,{children:[l.jsx(yl,{className:"text-sm",children:s("agent.toolsLabel")}),l.jsx(mu,{children:Z})]}),l.jsx(Vl,{className:"flex flex-col gap-6",children:l.jsx(n0,{label:s("agent.create.disallowedTools"),value:ge})})]})}),l.jsx(Ri,{value:"mcp",className:"pt-4",children:l.jsxs(No,{children:[l.jsx(bl,{children:l.jsx(yl,{className:"text-sm",children:s("agent.create.mcpServers")})}),l.jsx(Vl,{children:l.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs text-muted-foreground",children:dV(v.mcpServers)})})]})}),l.jsx(Ri,{value:"hooks",className:"pt-4",children:l.jsxs(No,{children:[l.jsx(bl,{children:l.jsx(yl,{className:"text-sm",children:s("agent.detail.hooks")})}),l.jsx(Vl,{children:l.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs text-muted-foreground",children:dV(v.hooks)})})]})})]}),l.jsx(Ox,{open:T,onOpenChange:ce=>{!ce&&k||_(ce)},children:l.jsxs($x,{children:[l.jsxs(Bx,{children:[l.jsx(Fx,{children:s("agent.delete.title",{name:v.name})}),l.jsx(Hx,{children:s("agent.delete.confirm",{name:v.name})})]}),l.jsxs(zx,{children:[l.jsx(qx,{disabled:k,children:s("common.cancel")}),l.jsxs(AP,{variant:"destructive",disabled:k,onClick:ce=>{ce.preventDefault(),V()},children:[k?l.jsx(fr,{"data-icon":"inline-start"}):null,s("agent.delete.yes")]})]})]})})]})]})}return W&&w?l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[de,l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx(fr,{className:"size-6"})})]}):W&&B?l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[de,l.jsx(Yl,{tone:"error",noticeKey:B,closeLabel:s("common.close"),onDismiss:P,children:B})]}):l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[de,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-xl font-semibold text-balance",children:s("agents.title")}),l.jsx("p",{className:"mt-1 text-sm text-muted-foreground tabular-nums",children:s("agent.count",{count:r.length})})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(Jt,{variant:"outline",disabled:i,onClick:()=>void a(),children:[i?l.jsx(fr,{"data-icon":"inline-start"}):l.jsx(ak,{"data-icon":"inline-start"}),s("common.refresh")]}),l.jsxs(Jt,{onClick:()=>R(!0),children:[l.jsx(z0,{"data-icon":"inline-start"}),s("agent.create.button")]})]})]}),o&&!H?l.jsx(Yl,{tone:"error",noticeKey:o.message,closeLabel:s("common.close"),onDismiss:()=>Q(!0),children:o.message}):null,M?l.jsx(Yl,{tone:"success",noticeKey:M,closeLabel:s("common.close"),onDismiss:()=>D(null),children:M}):null,l.jsxs("div",{className:"relative",children:[l.jsx(Pc,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(Pr,{name:"agent-search","aria-label":s("common.search"),autoComplete:"off",value:d,onChange:U=>f(U.target.value),placeholder:s("common.search"),className:"pl-9"})]}),l.jsx(NP,{type:"single",value:m,onValueChange:U=>{U&&p(U)},variant:"outline",size:"sm","aria-label":s("agent.level.filter"),children:ee.map(U=>l.jsx(MP,{value:U.value,children:U.label},U.value))}),I.length?l.jsx("div",{className:Zct.agentGrid,"data-column-count":Math.min(I.length,4),children:I.map(U=>l.jsx(No,{size:"sm",role:"button",tabIndex:0,"aria-label":U.name,className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>{D(null),z(null),b({name:U.name,level:U.level})},onKeyDown:Z=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),D(null),z(null),b({name:U.name,level:U.level}))},children:l.jsx(bl,{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(gv,{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(yl,{className:"min-w-0 flex-1 truncate",children:U.name}),l.jsxs("div",{className:"flex shrink-0 gap-1",children:[l.jsx(Pi,{variant:"outline",className:"text-[10px]",children:DE(U.level,s)}),sV(U,r)?l.jsx(Pi,{variant:"secondary",className:"text-[10px]",children:s("agent.overriddenBadge")}):null]})]}),l.jsx(mu,{className:"mt-1 min-w-0 text-xs",children:l.jsx(nh,{delayDuration:300,children:l.jsxs(sh,{children:[l.jsx(rh,{asChild:!0,children:l.jsx("span",{className:"block truncate",children:U.description||"—"})}),l.jsx(ih,{children:U.description||"—"})]})})})]})]})})},`${U.level}:${U.name}`))}):l.jsx($u,{className:"border",children:l.jsxs(Bu,{children:[l.jsx(zu,{variant:"icon",children:d||m!=="all"?l.jsx(Pc,{}):l.jsx(gv,{})}),l.jsx(Fu,{children:s(d||m!=="all"?"agent.noMatches":"agent.empty")})]})})]})]})}const nut="_page_1np31_1",sut="_tabs_1np31_11",rut="_memoryCard_1np31_19",iut="_memoryCardActive_1np31_35",out="_memoryTitle_1np31_44",aut="_detailPath_1np31_48",lut="_status_1np31_49",cut="_actionButton_1np31_54",uut="_primaryButton_1np31_55",dut="_secondaryButton_1np31_56",hut="_detail_1np31_48",fut="_detailHeader_1np31_79",mut="_detailTitleWrap_1np31_87",put="_actions_1np31_91",gut="_content_1np31_105",but="_editor_1np31_106",yut="_editorFooter_1np31_127",wa={page:nut,tabs:sut,memoryCard:rut,memoryCardActive:iut,memoryTitle:out,detailPath:aut,status:lut,actionButton:cut,primaryButton:uut,secondaryButton:dut,detail:hut,detailHeader:fut,detailTitleWrap:mut,actions:put,content:gut,editor:but,editorFooter:yut};function hV(e,t){return e.find(n=>n.scope===t)}function fV(e,t){return t(e==="global"?"memory.global":"memory.project")}function wut({refreshSignal:e=0,addSignal:t=0,addScope:n="workspace",onMessage:s}){var I,J;const{t:r}=lt(),{files:i,loading:o,error:a,readFile:c,reload:u,writeMemory:d}=lbe({autoLoad:!0}),f=h.useRef(null),m=h.useRef(0),[p,g]=h.useState("workspace"),[b,v]=h.useState("view"),[y,w]=h.useState(""),[x,k]=h.useState(""),[C,T]=h.useState(!1),[_,S]=h.useState(!1),[R,A]=h.useState(null),O=h.useRef(0),M=h.useMemo(()=>{const W=hV(i,"global"),P=hV(i,"workspace");return[{scope:"workspace",title:r("memory.project"),description:r("memory.project.desc"),fallbackPath:"QWEN.md",file:P},{scope:"global",title:r("memory.global"),description:r("memory.global.desc"),fallbackPath:"~/.qwen/QWEN.md",file:W}]},[i,r]),D=M.find(W=>W.scope===p)??M[0],$=h.useCallback((W,P)=>{const V=++m.current;if(v(P),A(null),w(""),k(""),!(W!=null&&W.file)){P==="edit"&&requestAnimationFrame(()=>{var ee;return(ee=f.current)==null?void 0:ee.focus()});return}T(!0),c(W.file.path).then(ee=>{V===m.current&&(w(ee.content),k(ee.content),ee.truncated&&A(r("memory.fileTruncated")),requestAnimationFrame(()=>{var q;return(q=f.current)==null?void 0:q.focus()}))}).catch(ee=>{if(V!==m.current)return;const q=ee instanceof Error?ee.message:String(ee);A(q),W.scope!=="global"&&(s==null||s(q,"error"))}).finally(()=>{V===m.current&&T(!1)})},[s,c,r]);h.useEffect(()=>{D&&$(D,b)},[(I=D==null?void 0:D.file)==null?void 0:I.path,D==null?void 0:D.scope]),h.useEffect(()=>{a&&A(a.message)},[a]),h.useEffect(()=>{e<=0||u().then(()=>A(r("memory.refreshed"))).catch(W=>{const P=W instanceof Error?W.message:String(W);A(P),s==null||s(P,"error")})},[s,e,u,r]),h.useEffect(()=>{if(t<=0||O.current===t)return;O.current=t;const W=n==="global"?"global":"workspace";g(W);const P=M.find(V=>V.scope===W);$(P,"edit")},[n,t,M,$]);const z=W=>{g(W.scope),$(W,"view")},B=()=>{D&&$(D,"edit")},j=()=>{if(D){if(!x.trim()){A(r("memory.contentEmpty"));return}S(!0),A(null),d({scope:D.scope,mode:"replace",content:x}).then(W=>{const P=r("memory.saved",{scope:fV(D.scope,r),bytes:W.bytesWritten,path:W.filePath});w(x),v("view"),A(P),s==null||s(P,"status"),u().catch(()=>{})}).catch(W=>{const P=W instanceof Error?W.message:String(W);A(P),s==null||s(P,"error")}).finally(()=>S(!1))}},H=((J=D==null?void 0:D.file)==null?void 0:J.path)??(D==null?void 0:D.fallbackPath)??"",Q=R??(o?r("memory.loading"):null);return l.jsxs("div",{className:wa.page,children:[l.jsx("nav",{className:wa.tabs,"aria-label":r("memory.menu"),children:M.map(W=>{const P=W.scope===p;return l.jsx("button",{type:"button",className:`${wa.memoryCard} ${P?wa.memoryCardActive:""}`,onClick:()=>z(W),children:l.jsx("span",{className:wa.memoryTitle,children:W.title})},W.scope)})}),l.jsxs("section",{className:wa.detail,children:[l.jsxs("header",{className:wa.detailHeader,children:[l.jsx("div",{className:wa.detailTitleWrap,children:l.jsx("div",{className:wa.detailPath,children:H})}),l.jsx("div",{className:wa.actions,children:l.jsx("button",{type:"button",className:wa.actionButton,onClick:B,children:r("settings.action.edit")})})]}),Q&&l.jsx("div",{className:wa.status,children:Q}),b==="edit"?l.jsxs(l.Fragment,{children:[l.jsx("textarea",{ref:f,className:wa.editor,value:x,disabled:_||C,onChange:W=>k(W.target.value),placeholder:r("memory.placeholder",{scope:D?fV(D.scope,r):""})}),l.jsxs("div",{className:wa.editorFooter,children:[l.jsx("button",{type:"button",className:wa.secondaryButton,disabled:_,onClick:()=>{k(y),v("view")},children:r("common.cancel")}),l.jsx("button",{type:"button",className:wa.primaryButton,disabled:_||C,onClick:j,children:r(_?"memory.saving":"memory.save")})]})]}):l.jsx("pre",{className:wa.content,children:C?r("memory.loadingFile"):y||r("memory.noFiles")})]})]})}const vut="_panel_cxp6w_1",xut="_steps_cxp6w_10",kut="_stepPill_cxp6w_18",_ut="_stepPillActive_cxp6w_29",Sut="_stepPillDone_cxp6w_34",Cut="_stepNumber_cxp6w_38",Tut="_stepLabel_cxp6w_49",Eut="_body_cxp6w_55",jut="_text_cxp6w_59",Aut="_muted_cxp6w_64",Nut="_options_cxp6w_68",Mut="_option_cxp6w_68",Iut="_optionActive_cxp6w_90",Rut="_label_cxp6w_94",Dut="_optionText_cxp6w_98",Put="_description_cxp6w_112",Lut="_input_cxp6w_119",Out="_preview_cxp6w_135",$ut="_error_cxp6w_146",But="_link_cxp6w_150",zut="_terms_cxp6w_161",Fut="_actions_cxp6w_169",Hut="_actionButton_cxp6w_177",Tr={panel:vut,steps:xut,stepPill:kut,stepPillActive:_ut,stepPillDone:Sut,stepNumber:Cut,stepLabel:Tut,body:Eut,text:jut,muted:Aut,options:Nut,option:Mut,optionActive:Iut,label:Rut,optionText:Dut,description:Put,input:Lut,preview:Out,error:$ut,link:But,terms:zut,actions:Fut,actionButton:Hut};function qut(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 kw(e){return e==="anthropic"?"https://api.anthropic.com/v1":e==="gemini"?"https://generativelanguage.googleapis.com":"https://api.openai.com/v1"}function mV(e){var t;return((t=e==null?void 0:e.models)==null?void 0:t.map(n=>n.id).join(", "))??""}function Uut(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 Wut(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 PE(e){return[...new Set(e.split(",").map(t=>t.trim()).filter(t=>t.length>0))]}function Vut({onMessage:e,onClose:t}){const{t:n}=lt(),s=pa(),[r,i]=h.useState("groups"),[o,a]=h.useState(0),[c,u]=h.useState(0),[d,f]=h.useState("providers"),[m,p]=h.useState(0),[g,b]=h.useState(),[v,y]=h.useState("alibaba"),[w,x]=h.useState(null),[k,C]=h.useState("openai"),[T,_]=h.useState(""),[S,R]=h.useState(""),[A,O]=h.useState(""),[M,D]=h.useState(!1),[$,z]=h.useState(!1),[B,j]=h.useState(!0),[H,Q]=h.useState(!0),[I,J]=h.useState(!1),[W,P]=h.useState(!1),[V,ee]=h.useState(""),[q,K]=h.useState(!0),[de,re]=h.useState(!1),[ne,U]=h.useState(null);h.useEffect(()=>{s.getAuthProviders().then(Ne=>{b(Ne),K(!1)}).catch(Ne=>{U(Ne instanceof Error?Ne.message:String(Ne)),K(!1)})},[s]);const Z=h.useMemo(()=>(g==null?void 0:g.groups)??[],[g]),ge=h.useMemo(()=>{var St;return(((St=Z.find(Ue=>Ue.id===v))==null?void 0:St.providerIds)??[]).map(Ue=>g==null?void 0:g.providers.find(ve=>ve.id===Ue)).filter(Ue=>!!Ue)},[g,v,Z]),ce=h.useMemo(()=>(w==null?void 0:w.steps)??[],[w==null?void 0:w.steps]),ue=ce[m],be=(w==null?void 0:w.showAdvancedConfig)===!0,rt=h.useMemo(()=>$?["thinking","modality","image","video","audio","pdf","context"]:["thinking","modality","context"],[$]),le=rt.indexOf("context"),Me=ue==="apiKey"||ue==="models"||ue==="baseUrl"&&!Array.isArray(w==null?void 0:w.baseUrl),[We,at]=h.useState(0),ze=h.useCallback((Ne,St="providers")=>{var ve,Fe;x(Ne),f(St);const Ue=((ve=Ne.protocolOptions)==null?void 0:ve[0])??Ne.protocol;C(Ue),typeof Ne.baseUrl=="string"?_(Ne.baseUrl):Array.isArray(Ne.baseUrl)?_(((Fe=Ne.baseUrl[0])==null?void 0:Fe.url)??""):_(kw(Ue)),R(""),O(mV(Ne)),D(!1),z(!1),j(!0),Q(!0),J(!1),P(!1),ee(""),p(0),at(0),U(null),i(Ne.steps.length>0?"step":"review")},[]),rn=h.useCallback(()=>{if(U(null),r==="groups"){t();return}if(r==="providers"){i("groups");return}if(r==="review"){if(ce.length===0){i(d);return}i("step"),p(Math.max(0,ce.length-1));return}if(m>0){p(Ne=>Ne-1),at(0);return}i(d)},[t,d,m,ce.length,r]),Wt=h.useCallback(()=>{if(!w||de)return;re(!0),U(null);const Ne=Number(V);s.installAuthProvider({providerId:w.id,protocol:k,baseUrl:T,apiKey:S,modelIds:PE(A),advancedConfig:M||$||Number.isFinite(Ne)&&Ne>0?{...M?{enableThinking:!0}:{},...$?{multimodal:{...B?{image:!0}:{},...H?{video:!0}:{},...I?{audio:!0}:{},...W?{pdf:!0}:{}}}:{},...Number.isFinite(Ne)&&Ne>0?{contextWindowSize:Ne}:{}}:void 0}).then(St=>{e(St.message),t()}).catch(St=>{const Ue=St instanceof Error?St.message:String(St);U(Ue),e(Ue,"error")}).finally(()=>re(!1))},[S,T,V,$,I,B,W,H,A,t,e,k,w,de,M,s]),zt=h.useCallback(()=>{if(w){if(ue==="baseUrl"){const Ne=T.trim()||kw(k);if(!Ne){U(n("auth.baseUrlRequired"));return}if(!/^https?:\/\//i.test(Ne)){U(n("auth.baseUrlInvalid"));return}T.trim()||_(Ne)}if(ue==="apiKey"&&S.trim().length===0){U(n("auth.apiKeyRequired"));return}if(ue==="models"&&PE(A).length===0){U(n("auth.modelsRequired"));return}U(null),m>=ce.length-1?be?i("review"):Wt():(p(Ne=>Ne+1),at(0))}},[S,T,ue,A,k,w,Wt,be,m,ce.length,n]),ae=h.useCallback(Ne=>{switch(Ne){case"thinking":D(St=>!St);return;case"modality":z(St=>!St);return;case"image":j(St=>!St);return;case"video":Q(St=>!St);return;case"audio":J(St=>!St);return;case"pdf":P(St=>!St);return;case"context":zt();return;default:return}},[zt]),je=h.useCallback(()=>{if(r==="groups"){const Ne=Z[o];if(!Ne)return;if(Ne.id==="custom"){const St=Ne.providerIds.map(Ue=>g==null?void 0:g.providers.find(ve=>ve.id===Ue)).find(Ue=>!!Ue);St&&ze(St,"groups");return}y(Ne.id),u(0),i("providers");return}if(r==="providers"){const Ne=ge[c];Ne&&ze(Ne,"providers");return}if(r==="review"){Wt();return}if(!(!w||!ue)){if(ue==="protocol"){const Ne=(w.protocolOptions??[w.protocol])[We];Ne&&(C(Ne),w.baseUrl||_(kw(Ne))),zt();return}if(ue==="baseUrl"&&Array.isArray(w.baseUrl)){const Ne=w.baseUrl[We];Ne&&_(Ne.url),zt();return}if(ue==="advancedConfig"){ae(rt[We]);return}zt()}},[ue,g,zt,o,Z,We,w,c,ge,Wt,ze,r,ae,rt]),it=h.useCallback(Ne=>{if(r==="groups"){const St=Z[Ne];if(!St)return;if(St.id==="custom"){const Ue=St.providerIds.map(ve=>g==null?void 0:g.providers.find(Fe=>Fe.id===ve)).find(ve=>!!ve);Ue&&ze(Ue,"groups");return}y(St.id),u(0),i("providers");return}if(r==="providers"){const St=ge[Ne];St&&ze(St,"providers");return}if(!w||!ue){r==="review"&&Wt();return}if(ue==="protocol"){const St=(w.protocolOptions??[w.protocol])[Ne];St&&(C(St),w.baseUrl||_(kw(St))),zt();return}if(ue==="baseUrl"&&Array.isArray(w.baseUrl)){const St=w.baseUrl[Ne];St&&_(St.url),zt();return}ue==="advancedConfig"&&ae(rt[Ne])},[ue,g,zt,Z,ae,rt,w,ge,Wt,ze,r]),gt=(Ne,St,Ue)=>l.jsx("div",{className:Tr.options,children:Ne.map((ve,Fe)=>l.jsx("button",{type:"button",className:`${Tr.option} ${St===Fe?Tr.optionActive:""}`,onClick:()=>{Ue(Fe),it(Fe)},children:l.jsxs("div",{className:Tr.optionText,children:[l.jsx("div",{className:Tr.label,children:ve.label}),ve.description&&l.jsx("div",{className:Tr.description,children:ve.description})]})},ve.value))}),wt=()=>{if(!w||!ue)return null;if(ue==="protocol"){const Ue=w.protocolOptions??[w.protocol];return gt(qut(n).filter(ve=>Ue.includes(ve.value)),We,at)}if(ue==="baseUrl")return Array.isArray(w.baseUrl)?gt(w.baseUrl.map(Ue=>({value:Ue.url,label:Ue.label,description:Ue.url})),We,at):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Tr.text,children:n("auth.baseUrlPrompt")}),l.jsx("input",{className:Tr.input,value:T,placeholder:kw(k),onChange:Ue=>{_(Ue.target.value),U(null)},onKeyDown:Ue=>{Ue.key==="Enter"&&(Ue.preventDefault(),Ue.stopPropagation(),zt())},autoFocus:!0}),w.documentationUrl&&l.jsx("a",{className:Tr.link,href:w.documentationUrl,target:"_blank",rel:"noreferrer",children:n("auth.documentation")})]});if(ue==="apiKey")return l.jsxs(l.Fragment,{children:[w.documentationUrl&&l.jsxs("a",{className:Tr.link,href:w.documentationUrl,target:"_blank",rel:"noreferrer",children:[n("auth.documentation"),": ",w.documentationUrl]}),l.jsx("input",{className:Tr.input,type:"password",value:S,placeholder:w.apiKeyPlaceholder??n("auth.apiKeyPlaceholder"),onChange:Ue=>{R(Ue.target.value),U(null)},onKeyDown:Ue=>{Ue.key==="Enter"&&(Ue.preventDefault(),Ue.stopPropagation(),zt())},autoFocus:!0})]});if(ue==="models"){const Ue=mV(w);return l.jsxs(l.Fragment,{children:[Ue&&l.jsx("div",{className:Tr.muted,children:n("auth.modelsPrompt",{modelIds:Ue})}),l.jsx("input",{className:Tr.input,value:A,placeholder:Ue||n("auth.modelsPlaceholder"),onChange:ve=>{O(ve.target.value),U(null)},onKeyDown:ve=>{ve.key==="Enter"&&(ve.preventDefault(),ve.stopPropagation(),zt())},autoFocus:!0})]})}const Ne=Ue=>Ue?"◉":"○",St=[{value:"thinking",label:`${Ne(M)} ${n("auth.advanced.thinking")}`,description:n("auth.advanced.thinkingDesc")},{value:"modality",label:`${Ne($)} ${n("auth.advanced.modality")}`,description:n("auth.advanced.modalityDesc")}];return $&&St.push({value:"image",label:`${Ne(B)} ${n("auth.advanced.modalityImage")}`},{value:"video",label:`${Ne(H)} ${n("auth.advanced.modalityVideo")}`},{value:"audio",label:`${Ne(I)} ${n("auth.advanced.modalityAudio")}`},{value:"pdf",label:`${Ne(W)} ${n("auth.advanced.modalityPdf")}`}),St.push({value:"context",label:`${n("auth.advanced.contextWindow")}: ${V||"auto"}`,description:n("auth.advanced.contextDesc")}),l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Tr.text,children:n("auth.advanced.prompt")}),gt(St,We,at),l.jsx("input",{className:Tr.input,value:V,placeholder:n("common.auto"),onChange:Ue=>ee(Ue.target.value.replace(/[^0-9]/g,"")),onFocus:()=>at(le),onKeyDown:Ue=>{Ue.key==="Enter"&&(Ue.preventDefault(),Ue.stopPropagation(),zt())}})]})},Ke=h.useMemo(()=>{if(!w)return"";const Ne=w.envKey??`${k.toUpperCase()}_API_KEY`,St=PE(A),Ue={};if(M&&(Ue.extra_body={enable_thinking:!0}),$){const ie={};B&&(ie.image=!0),H&&(ie.video=!0),I&&(ie.audio=!0),W&&(ie.pdf=!0),Object.keys(ie).length>0&&(Ue.modalities=ie)}const ve=Number(V);Number.isFinite(ve)&&ve>0&&(Ue.contextWindowSize=ve);const Fe=Object.keys(Ue).length>0;return JSON.stringify({env:{[Ne]:Wut(S,n)},modelProviders:{[k]:St.map(ie=>({id:ie,name:ie,baseUrl:T.trim(),envKey:Ne,...Fe?{generationConfig:Ue}:{}}))},security:{auth:{selectedType:k}},model:{name:St[0]}},null,2)},[S,T,V,$,I,B,W,H,A,k,w,n,M]),un=h.useMemo(()=>{const Ne=[n("auth.step.group"),n("auth.step.provider")];return w&&(Ne.push(...ce.map(St=>Uut(St,w,n))),be&&Ne.push(n("auth.review"))),Ne},[w,be,ce,n]),me=h.useMemo(()=>r==="groups"?1:r==="providers"?2:r==="step"?Math.min(3+m,un.length):un.length,[m,un.length,r]),ht=q?l.jsx("div",{className:Tr.muted,children:n("common.loading")}):r==="groups"?l.jsxs(l.Fragment,{children:[gt(Z.map(Ne=>({value:Ne.id,label:n(Ne.label),description:n(Ne.description)})),o,a),l.jsxs("div",{className:Tr.terms,children:[l.jsxs("div",{children:[n("auth.termsTitle"),":"]}),l.jsx("a",{className:Tr.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"?gt(ge.map(Ne=>({value:Ne.id,label:n(Ne.label),description:n(Ne.description)})),c,u):r==="step"?wt():l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Tr.text,children:n("auth.reviewText")}),l.jsx("div",{className:Tr.preview,children:Ke})]}),Oe=()=>{if(r==="review"){Wt();return}if(Me||ue==="advancedConfig"){zt();return}je()};return l.jsxs("div",{className:Tr.panel,children:[l.jsx("div",{className:Tr.steps,children:un.map((Ne,St)=>{const Ue=St+1;return l.jsxs("div",{className:`${Tr.stepPill} ${Ue===me?Tr.stepPillActive:""} ${Ue<me?Tr.stepPillDone:""}`,children:[l.jsx("span",{className:Tr.stepNumber,children:Ue}),l.jsx("span",{className:Tr.stepLabel,children:Ne})]},`${Ue}:${Ne}`)})}),l.jsx("div",{className:Tr.body,children:ht}),ne&&l.jsx("div",{className:Tr.error,children:ne}),l.jsxs("div",{className:Tr.actions,children:[l.jsx("button",{type:"button",className:Tr.actionButton,onClick:rn,disabled:r==="groups"||q||de,children:n("common.previous")}),l.jsx("button",{type:"button",className:Tr.actionButton,onClick:Oe,disabled:q||de,children:n(r==="review"?de?"auth.saving":"auth.save":"common.next")})]})]})}function Gut(e){return e.displayName||e.name}const Wce="tools-list",pV=e=>`${Wce}-opt-${e}`;function Kut(){const{t:e}=lt(),{status:t,tools:n,loading:s,error:r}=DQ({autoLoad:!0}),[i,o]=h.useState(0),[a,c]=h.useState(null),[u,d]=h.useState(()=>new Set),f=h.useRef(null);h.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=h.useCallback(b=>{d(v=>v.has(b.name)?new Set:new Set([b.name]))},[]);h.useEffect(()=>{i>=n.length&&n.length>0&&o(n.length-1)},[i,n.length]),h.useEffect(()=>{var v;const b=(v=f.current)==null?void 0:v.children[i];b==null||b.scrollIntoView({block:"nearest"})},[i]);const{keyboardMode:p}=Mp({itemCount:n.length,activeIndex:i,onActiveIndexChange:o,onConfirm:b=>{const v=n[b];v!=null&&v.description&&m(v)}}),g=h.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:mn("picker","picker-in-shell"),children:[g&&l.jsx("div",{className:mn("picker-search"),children:l.jsx("span",{className:mn("picker-search-hint"),children:g})}),(a||s)&&l.jsx("div",{className:mn("picker-search"),children:l.jsx("span",{className:mn("picker-search-hint"),children:a||e("tools.loading")})}),l.jsx("div",{className:mn("picker-sep")}),l.jsxs("div",{id:Wce,role:"listbox","aria-label":e("tools.title"),tabIndex:0,"aria-activedescendant":n.length>0?pV(i):void 0,className:mn("picker-list",p?"picker-keyboard-only":void 0),ref:f,children:[!s&&n.length===0&&l.jsx("div",{className:mn("picker-empty"),children:e("tools.empty")}),n.map((b,v)=>{const y=u.has(b.name),w=b.description??"";return l.jsxs("div",{id:pV(v),role:"option","aria-selected":!1,"aria-expanded":w?y:void 0,className:mn("picker-item","picker-session-item","tools-picker-item",v===i?"selected":void 0,y?"tools-picker-item-expanded":void 0),onClick:()=>{o(v),b.description&&m(b)},onMouseMove:()=>o(v),children:[l.jsxs("div",{className:mn("picker-item-row"),children:[l.jsx("span",{className:mn("tools-item-icon"),"aria-hidden":"true"}),l.jsx("span",{className:mn("picker-item-title"),children:Gut(b)}),l.jsx("span",{className:mn("tools-status-badge",b.enabled?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:b.enabled?e("tools.status.enabled"):e("tools.status.disabled")}),w?l.jsx("svg",{className:mn("tools-item-chevron",y?"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]}),y&&w&&l.jsx("div",{className:mn("tools-desc-expanded"),children:l.jsx("div",{className:mn("tools-desc-body"),children:w})})]},b.name)})]})]})}const Yut="_content_xihrz_1",Xut="_placeholder_xihrz_7",Qut="_fileList_xihrz_13",Jut="_file_xihrz_13",Zut="_fileHeader_xihrz_25",edt="_fileStats_xihrz_43",tdt="_statAdd_xihrz_51",ndt="_statDel_xihrz_55",sdt="_fileBinary_xihrz_59",rdt="_filePath_xihrz_63",idt="_fileOldPath_xihrz_71",odt="_fileTag_xihrz_75",adt="_fileBody_xihrz_85",ldt="_filePlaceholder_xihrz_89",cdt="_hiddenNote_xihrz_95",udt="_diffLines_xihrz_101",ddt="_diffLine_xihrz_101",hdt="_diffLineAdd_xihrz_113",fdt="_diffLineDel_xihrz_117",mdt="_diffLineContext_xihrz_121",pdt="_diffLineMeta_xihrz_125",gdt="_diffOldNo_xihrz_131",bdt="_diffNewNo_xihrz_132",ydt="_diffMarker_xihrz_143",wdt="_diffContent_xihrz_159",ur={content:Yut,placeholder:Xut,fileList:Qut,file:Jut,fileHeader:Zut,fileStats:edt,statAdd:tdt,statDel:ndt,fileBinary:sdt,filePath:rdt,fileOldPath:idt,fileTag:odt,fileBody:adt,filePlaceholder:ldt,hiddenNote:cdt,diffLines:udt,diffLine:ddt,diffLineAdd:hdt,diffLineDel:fdt,diffLineContext:mdt,diffLineMeta:pdt,diffOldNo:gdt,diffNewNo:bdt,diffMarker:ydt,diffContent:wdt},vdt={add:ur.diffLineAdd,del:ur.diffLineDel,context:ur.diffLineContext,meta:ur.diffLineMeta};function xdt(e){return e===ei.Light?"github-light-default":"github-dark-default"}async function kdt(e,t,n){const{resolvedLang:s}=mD(oce(t));let r=null;if(s!=="text")try{r=await ete(s)}catch{r=null}const i=[];for(const o of e){const a=[],c=[];for(const y of o.lines){const w=y[0],x=y.slice(1);w==="+"?a.push(x):w==="-"?c.push(x):w===" "&&(a.push(x),c.push(x))}const u=a.join(`
`),d=c.join(`
`);let f=null,m=null;if(r){const y=s;if(!mN(u))try{f=r.codeToTokens(u,{lang:y,theme:n}).tokens}catch{f=null}if(!mN(d))try{m=r.codeToTokens(d,{lang:y,theme:n}).tokens}catch{m=null}}let p=0,g=0,b=o.oldStart,v=o.newStart;for(const y of o.lines){const w=y[0],x=y.slice(1);w==="+"?(i.push({type:"add",oldNo:null,newNo:v,text:x,tokens:(f==null?void 0:f[p])??null}),p++,v++):w==="-"?(i.push({type:"del",oldNo:b,newNo:null,text:x,tokens:(m==null?void 0:m[g])??null}),g++,b++):w===" "?(i.push({type:"context",oldNo:b,newNo:v,text:x,tokens:(f==null?void 0:f[p])??null}),p++,g++,b++,v++):i.push({type:"meta",oldNo:null,newNo:null,text:y,tokens:null})}}return i}function _dt(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 Sdt({hunks:e,path:t}){const{t:n}=lt(),s=ny(),r=xdt(s),[i,o]=h.useState(null),[a,c]=h.useState(!1);return h.useEffect(()=>{let u=!1;return o(null),c(!1),kdt(e,t,r).then(d=>{u||o(d)}).catch(()=>{u||c(!0)}),()=>{u=!0}},[e,t,r]),a?l.jsx("div",{className:ur.filePlaceholder,children:n("gitDiff.fileError")}):i===null?l.jsx("div",{className:ur.filePlaceholder,children:n("gitDiff.loading")}):l.jsx("div",{className:ur.diffLines,children:(i??[]).map((u,d)=>l.jsxs("div",{className:`${ur.diffLine} ${vdt[u.type]}`,children:[l.jsx("span",{className:ur.diffOldNo,children:u.oldNo??""}),l.jsx("span",{className:ur.diffNewNo,children:u.newNo??""}),l.jsx("span",{className:ur.diffMarker,children:u.type==="add"?"+":u.type==="del"?"-":u.type==="meta"?"":" "}),l.jsx("code",{className:ur.diffContent,children:_dt(u)})]},d))})}function Cdt({workspaceCwd:e,gitCwd:t,file:n}){const{t:s}=lt(),{client:r}=io(),[i,o]=h.useState(!1),[a,c]=h.useState(null),[u,d]=h.useState(!1),[f,m]=h.useState(!1),[p,g]=h.useState(!1),b=h.useRef(!1);h.useEffect(()=>(b.current=!1,()=>{b.current=!0}),[]);const v=()=>{const w=!i;o(w),w&&a===null&&!f&&!n.isBinary&&(m(!0),g(!1),r.workspaceByCwd(e).workspaceGitDiffFile(n.path,n.oldPath,t).then(x=>{b.current||(c(x.hunks),d(x.truncated===!0))}).catch(()=>{b.current||g(!0)}).finally(()=>{b.current||m(!1)}))},y=g4(n.path);return l.jsxs("div",{className:ur.file,children:[l.jsxs("button",{type:"button",className:ur.fileHeader,onClick:v,"aria-expanded":i,"aria-label":s(i?"gitDiff.collapse":"gitDiff.expand",{path:n.oldPath?`${g4(n.oldPath)} → ${y}`:y}),children:[l.jsx("span",{className:ur.fileStats,children:n.isBinary?l.jsx("span",{className:ur.fileBinary,children:s("gitDiff.binary")}):l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:ur.statAdd,children:["+",n.added??0]}),l.jsxs("span",{className:ur.statDel,children:["-",n.removed??0]})]})}),l.jsxs("span",{className:ur.filePath,title:y,children:[n.oldPath?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:ur.fileOldPath,children:g4(n.oldPath)})," → "]}):null,y]}),n.isUntracked&&l.jsx("span",{className:ur.fileTag,children:s("gitDiff.untracked")}),n.isDeleted&&l.jsx("span",{className:ur.fileTag,children:s("gitDiff.deleted")})]}),i&&l.jsx("div",{className:ur.fileBody,children:n.isBinary?l.jsx("div",{className:ur.filePlaceholder,children:s("gitDiff.binary")}):f?l.jsx("div",{className:ur.filePlaceholder,children:s("gitDiff.loading")}):p?l.jsx("div",{className:ur.filePlaceholder,children:s("gitDiff.fileError")}):a&&a.length>0?l.jsxs(l.Fragment,{children:[l.jsx(Sdt,{hunks:a,path:n.path}),u&&l.jsx("div",{className:ur.filePlaceholder,role:"note",children:s("gitDiff.truncated")})]}):l.jsx("div",{className:ur.filePlaceholder,children:s("gitDiff.noDiff")})})]})}function Tdt({workspaceCwd:e,gitCwd:t,onSubtitleChange:n}){const{t:s}=lt(),{client:r}=io(),[i,o]=h.useState(null),[a,c]=h.useState(!0),[u,d]=h.useState(!1);h.useEffect(()=>{let p=!1;return c(!0),d(!1),r.workspaceByCwd(e).workspaceGitDiff(t).then(g=>{p||o(g)}).catch(()=>{p||d(!0)}).finally(()=>{p||c(!1)}),()=>{p=!0}},[r,e,t]);const f=i&&i.available?s("gitDiff.summary",{count:i.filesCount,added:i.linesAdded,removed:i.linesRemoved}):void 0;h.useEffect(()=>{n==null||n(f)},[n,f]);let m;return a?m=l.jsx("div",{className:ur.placeholder,children:s("gitDiff.loading")}):u?m=l.jsx("div",{className:ur.placeholder,children:s("gitDiff.error")}):!i||!i.available?m=l.jsx("div",{className:ur.placeholder,children:s("gitDiff.unavailable")}):i.files.length===0?m=l.jsx("div",{className:ur.placeholder,children:s("gitDiff.empty")}):m=l.jsxs("div",{className:ur.fileList,children:[i.files.map(p=>l.jsx(Cdt,{workspaceCwd:e,gitCwd:t,file:p},`${e}:${t??""}:${p.path}`)),i.hiddenCount>0&&l.jsx("div",{className:ur.hiddenNote,children:s("gitDiff.hidden",{count:i.hiddenCount})})]}),l.jsx("div",{className:ur.content,children:m})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Vce(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")}const Edt="_content_18nyy_1",jdt="_placeholder_18nyy_7",Adt="_commitList_18nyy_13",Ndt="_commitRow_18nyy_18",Mdt="_commitHeader_18nyy_22",Idt="_commitToggle_18nyy_32",Rdt="_commitSha_18nyy_47",Ddt="_copyBtn_18nyy_54",Pdt="_commitSubject_18nyy_78",Ldt="_commitMeta_18nyy_86",Odt="_commitRefs_18nyy_93",$dt="_refTag_18nyy_99",Bdt="_refHead_18nyy_109",zdt="_mergeIcon_18nyy_114",Fdt="_commitDetail_18nyy_120",Hdt="_commitBody_18nyy_126",qdt="_fileStats_18nyy_134",Udt="_fileStatHeader_18nyy_140",Wdt="_fileStatRow_18nyy_146",Vdt="_statNums_18nyy_154",Gdt="_statAdd_18nyy_162",Kdt="_statDel_18nyy_166",Ydt="_fileStatPath_18nyy_170",Xdt="_fileBinary_18nyy_178",Qdt="_hiddenNote_18nyy_182",Jdt="_detailError_18nyy_188",Zdt="_loadMore_18nyy_194",ir={content:Edt,placeholder:jdt,commitList:Adt,commitRow:Ndt,commitHeader:Mdt,commitToggle:Idt,commitSha:Rdt,copyBtn:Ddt,commitSubject:Pdt,commitMeta:Ldt,commitRefs:Odt,refTag:$dt,refHead:Bdt,mergeIcon:zdt,commitDetail:Fdt,commitBody:Hdt,fileStats:qdt,fileStatHeader:Udt,fileStatRow:Wdt,statNums:Vdt,statAdd:Gdt,statDel:Kdt,fileStatPath:Ydt,fileBinary:Xdt,hiddenNote:Qdt,detailError:Jdt,loadMore:Zdt},gV=50;function eht(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 tht({entry:e,workspaceCwd:t,gitCwd:n,now:s}){const{client:r}=io(),{language:i,t:o}=lt(),[a,c]=h.useState(!1),[u,d]=h.useState(null),[f,m]=h.useState(!1),[p,g]=h.useState(!1),[b,v]=h.useState(!1),y=h.useRef(!1),w=()=>{navigator.clipboard.writeText(e.sha).then(()=>{v(!0),setTimeout(()=>v(!1),1500)}).catch(()=>{})};h.useEffect(()=>(y.current=!1,()=>{y.current=!0}),[]);const x=()=>{const _=!a;c(_),_&&u===null&&!f&&(m(!0),g(!1),r.workspaceByCwd(t).workspaceGitCommitDetail(e.sha,n).then(S=>{y.current||d(S)}).catch(()=>{y.current||g(!0)}).finally(()=>{y.current||m(!1)}))},k=eht(e.refs??""),C=e.parents.length>1;let T;return a&&(f?T=l.jsx("div",{className:ir.commitDetail,children:l.jsx("span",{className:ir.fileBinary,children:o("gitLog.loading")})}):p?T=l.jsx("div",{className:ir.commitDetail,children:l.jsx("span",{className:ir.detailError,children:o("gitLog.detailError")})}):u&&u.available?T=l.jsxs("div",{className:ir.commitDetail,children:[u.body&&l.jsx("pre",{className:ir.commitBody,children:u.body}),u.files&&l.jsxs("div",{className:ir.fileStats,children:[l.jsx("div",{className:ir.fileStatHeader,children:o("gitLog.files",{count:u.filesCount??0,added:u.linesAdded??0,removed:u.linesRemoved??0})}),u.files.map(_=>l.jsxs("div",{className:ir.fileStatRow,children:[_.isBinary?l.jsx("span",{className:ir.fileBinary,children:"~"}):l.jsxs("span",{className:ir.statNums,children:[l.jsxs("span",{className:ir.statAdd,children:["+",_.added]}),l.jsxs("span",{className:ir.statDel,children:["−",_.removed]})]}),l.jsx("span",{className:ir.fileStatPath,children:_.path})]},_.path)),(u.hiddenCount??0)>0&&l.jsx("div",{className:ir.hiddenNote,children:o("gitLog.hidden",{count:u.hiddenCount??0})})]})]}):u&&!u.available&&(T=l.jsx("div",{className:ir.commitDetail,children:l.jsx("span",{className:ir.detailError,children:o("gitLog.detailError")})}))),l.jsxs("div",{className:ir.commitRow,children:[l.jsxs("div",{className:ir.commitHeader,children:[l.jsxs("button",{type:"button",className:ir.commitToggle,onClick:x,"aria-expanded":a,children:[C&&l.jsx("span",{className:ir.mergeIcon,children:"⎇"}),l.jsx("span",{className:ir.commitSha,title:e.sha,children:e.shortSha}),l.jsx("span",{className:ir.commitSubject,children:e.subject}),k.length>0&&l.jsx("span",{className:ir.commitRefs,children:k.map(_=>l.jsx("span",{className:`${ir.refTag}${_.isHead?` ${ir.refHead}`:""}`,children:_.label},_.label))}),l.jsxs("span",{className:ir.commitMeta,children:[e.authorName," · ",Vce(e.authorDate,s,i)]})]}),l.jsx("button",{type:"button",className:ir.copyBtn,onClick:w,"aria-label":o("gitLog.copySha",{sha:e.shortSha}),children:b?l.jsx(dg,{size:12}):l.jsx(uye,{size:12})})]}),T]})}function nht({workspaceCwd:e,gitCwd:t,onSubtitleChange:n}){const{client:s}=io(),{t:r}=lt(),[i,o]=h.useState(null),[a,c]=h.useState(!0),[u,d]=h.useState(!1),[f,m]=h.useState(!1),[p,g]=h.useState(!1),[b,v]=h.useState(Date.now()/1e3),y=h.useRef(0);h.useEffect(()=>{const C=setInterval(()=>v(Date.now()/1e3),6e4);return()=>clearInterval(C)},[]),h.useEffect(()=>{let C=!1;return c(!0),d(!1),g(!1),y.current=0,s.workspaceByCwd(e).workspaceGitLog(gV,0,t).then(T=>{C||(y.current=T.entries.length,o(T))}).catch(()=>{C||d(!0)}).finally(()=>{C||c(!1)}),()=>{C=!0}},[s,e,t]);const w=h.useCallback(()=>{!i||f||(m(!0),s.workspaceByCwd(e).workspaceGitLog(gV,y.current,t).then(C=>{y.current+=C.entries.length,o(T=>{if(!T)return C;const _=new Set(T.entries.map(S=>S.sha));return{...T,entries:[...T.entries,...C.entries.filter(S=>!_.has(S.sha))],hasMore:C.hasMore}})}).catch(()=>{g(!0)}).finally(()=>{m(!1)}))},[s,e,t,i,f]),x=i!=null&&i.available?r("gitLog.subtitle",{count:i.entries.length}):void 0;h.useEffect(()=>{n==null||n(x)},[n,x]);let k;return a?k=l.jsx("div",{className:ir.placeholder,children:r("gitLog.loading")}):u?k=l.jsx("div",{className:ir.placeholder,children:r("gitLog.error")}):!i||!i.available?k=l.jsx("div",{className:ir.placeholder,children:r("gitLog.unavailable")}):i.entries.length===0?k=l.jsx("div",{className:ir.placeholder,children:r("gitLog.empty")}):k=l.jsxs(l.Fragment,{children:[l.jsx("div",{className:ir.commitList,children:i.entries.map(C=>l.jsx(tht,{entry:C,workspaceCwd:e,gitCwd:t,now:b},C.sha))}),p&&l.jsx("div",{className:ir.placeholder,children:r("gitLog.error")}),i.hasMore&&l.jsx("button",{type:"button",className:ir.loadMore,onClick:()=>{g(!1),w()},disabled:f,children:r(f?"gitLog.loadingMore":"gitLog.loadMore")})]}),l.jsx("div",{className:ir.content,children:k})}const sht="_content_fozmc_1",rht="_placeholder_fozmc_7",iht="_prList_fozmc_14",oht="_prRow_fozmc_19",aht="_prLine_fozmc_43",lht="_stateOpen_fozmc_50",cht="_stateDraft_fozmc_55",uht="_prTitle_fozmc_60",dht="_badge_fozmc_68",hht="_badgeApproved_fozmc_77",fht="_badgeChanges_fozmc_82",mht="_badgeReviewRequired_fozmc_87",pht="_checksPassing_fozmc_92",ght="_checksFailing_fozmc_98",bht="_checksPending_fozmc_104",yht="_prMeta_fozmc_110",no={content:sht,placeholder:rht,prList:iht,prRow:oht,prLine:aht,stateOpen:lht,stateDraft:cht,prTitle:uht,badge:dht,badgeApproved:hht,badgeChanges:fht,badgeReviewRequired:mht,checksPassing:pht,checksFailing:ght,checksPending:bht,prMeta:yht};function wht(e){const t=e&&typeof e=="object"?e.body:void 0,n=t&&typeof t=="object"?t.code:void 0;return typeof n=="string"?n:null}function vht({checks:e}){const{t}=lt();switch(e){case"passing":return l.jsx("span",{className:no.checksPassing,title:t("githubPrs.checksPassing"),children:l.jsx(dg,{size:12})});case"failing":return l.jsx("span",{className:no.checksFailing,title:t("githubPrs.checksFailing"),children:l.jsx(ey,{size:12})});case"pending":return l.jsx("span",{className:no.checksPending,title:t("githubPrs.checksPending"),children:l.jsx(rye,{size:12})});default:return null}}function xht({pr:e,now:t}){const{t:n,language:s}=lt(),r=e.state==="draft"?Pye:Oye,i=e.reviewDecision==="approved"?l.jsx("span",{className:`${no.badge} ${no.badgeApproved}`,children:n("githubPrs.reviewApproved")}):e.reviewDecision==="changes_requested"?l.jsx("span",{className:`${no.badge} ${no.badgeChanges}`,children:n("githubPrs.reviewChanges")}):e.reviewDecision==="review_required"?l.jsx("span",{className:`${no.badge} ${no.badgeReviewRequired}`,children:n("githubPrs.reviewRequired")}):null;return l.jsxs("button",{type:"button",className:no.prRow,"aria-label":n("githubPrs.open",{number:e.number}),onClick:()=>{e.url&&window.open(e.url,"_blank","noopener,noreferrer")},children:[l.jsxs("span",{className:no.prLine,children:[l.jsx(r,{size:12,className:e.state==="draft"?no.stateDraft:no.stateOpen}),l.jsx("span",{className:no.prTitle,children:e.title}),i,l.jsx(vht,{checks:e.checks})]}),l.jsxs("span",{className:no.prMeta,children:["#",e.number," · ",e.headRefName,e.author?` · ${e.author}`:""," ·"," ",Vce(e.updatedAt,t,s)]})]})}function kht({workspaceCwd:e,onSubtitleChange:t}){const{client:n}=io(),{t:s}=lt(),[r,i]=h.useState(null),[o,a]=h.useState(!0),[c,u]=h.useState(null),[d,f]=h.useState(Date.now()/1e3);h.useEffect(()=>{const g=setInterval(()=>f(Date.now()/1e3),6e4);return()=>clearInterval(g)},[]),h.useEffect(()=>{let g=!1;return a(!0),u(null),n.workspaceByCwd(e).workspaceGitHubPullRequests().then(b=>{g||i(b)}).catch(b=>{g||u(wht(b)??"unknown")}).finally(()=>{g||a(!1)}),()=>{g=!0}},[n,e]);const m=r!=null&&r.available?s("githubPrs.subtitle",{count:r.pullRequests.length}):void 0;h.useEffect(()=>{t==null||t(m)},[t,m]);let p;return o?p=l.jsx("div",{className:no.placeholder,children:s("githubPrs.loading")}):c==="github_cli_unavailable"?p=l.jsx("div",{className:no.placeholder,children:s("githubPrs.cliUnavailable")}):c!==null?p=l.jsx("div",{className:no.placeholder,children:s("githubPrs.error")}):!r||!r.available?p=l.jsx("div",{className:no.placeholder,children:s("githubPrs.unavailable")}):r.pullRequests.length===0?p=l.jsx("div",{className:no.placeholder,children:s("githubPrs.empty")}):p=l.jsx("div",{className:no.prList,children:r.pullRequests.map(g=>l.jsx(xht,{pr:g,now:d},g.number))}),l.jsx("div",{className:no.content,children:p})}const _ht="_content_a537a_1",Sht="_tabBar_a537a_7",Cht="_tab_a537a_7",Tht="_tabActive_a537a_27",Eht="_tabPanel_a537a_36",jht="_commitPanel_a537a_44",Aht="_commitMessage_a537a_53",Nht="_commitStatus_a537a_79",Mht="_commitStatusError_a537a_84",Iht="_commitStatusSuccess_a537a_88",Rht="_commitActions_a537a_92",Dht="_commitBtn_a537a_98",Pht="_commitBtnPrimary_a537a_116",Lht="_commitBtnSecondary_a537a_125",Oht="_spin_a537a_135",$ht="_prForm_a537a_149",Bht="_prInput_a537a_158",zht="_prBody_a537a_177",Fht="_prBodyWrap_a537a_202",Hht="_prBodyToolbar_a537a_207",qht="_prBodyTab_a537a_216",Uht="_prBodyTabActive_a537a_232",Wht="_prBodyPreview_a537a_242",Vht="_prBodyEmpty_a537a_254",Ght="_prFormRow_a537a_259",Kht="_branchSelectTrigger_a537a_271",Yht="_branchSelectValue_a537a_290",Xht="_branchSelectPopover_a537a_298",Qht="_branchSelectSearch_a537a_307",Jht="_branchSelectInput_a537a_316",Zht="_branchSelectList_a537a_329",eft="_branchSelectGroup_a537a_335",tft="_branchSelectItem_a537a_344",nft="_branchSelectItemActive_a537a_363",sft="_branchSelectEmpty_a537a_368",rft="_branchSelectRetry_a537a_375",Gn={content:_ht,tabBar:Sht,tab:Cht,tabActive:Tht,tabPanel:Eht,commitPanel:jht,commitMessage:Aht,commitStatus:Nht,commitStatusError:Mht,commitStatusSuccess:Iht,commitActions:Rht,commitBtn:Dht,commitBtnPrimary:Pht,commitBtnSecondary:Lht,spin:Oht,prForm:$ht,prInput:Bht,prBody:zht,prBodyWrap:Fht,prBodyToolbar:Hht,prBodyTab:qht,prBodyTabActive:Uht,prBodyPreview:Wht,prBodyEmpty:Vht,prFormRow:Ght,branchSelectTrigger:Kht,branchSelectValue:Yht,branchSelectPopover:Xht,branchSelectSearch:Qht,branchSelectInput:Jht,branchSelectList:Zht,branchSelectGroup:eft,branchSelectItem:tft,branchSelectItemActive:nft,branchSelectEmpty:sft,branchSelectRetry:rft},ift="workspace_github_prs",bV={diff:"gitDiff.title",log:"gitLog.title",prs:"githubPrs.title",commit:"gitCommit.title"},yV=["diff","log","prs"],h2=3500;function oft({workspaceCwd:e,gitCwd:t,initialView:n,sessionId:s,resolveSessionForWorkspace:r,onClose:i}){var zt;const{t:o}=lt(),{client:a,capabilities:c}=io(),u=((zt=c==null?void 0:c.features)==null?void 0:zt.includes(ift))===!0,d=u?yV:yV.filter(ae=>ae!=="prs"),[f,m]=h.useState(n),[p,g]=h.useState(),[b,v]=h.useState(""),[y,w]=h.useState(null),[x,k]=h.useState(!1),[C,T]=h.useState(!1),[_,S]=h.useState(!1),[R,A]=h.useState(""),[O,M]=h.useState(""),[D,$]=h.useState(""),[z,B]=h.useState(!1),[j,H]=h.useState(!1),[Q,I]=h.useState(!1),[J,W]=h.useState(null),[P,V]=h.useState(!1),ee=h.useRef(null),[q,K]=h.useState(null),[de,re]=h.useState(null),ne=h.useRef(null),U=h.useRef(r);U.current=r;const Z=h.useRef(s);Z.current=s;const ge=h.useCallback(async(ae,je,it)=>{try{return await a.btwSession(ae,je,{signal:it})}catch(gt){const wt=gt instanceof Error?gt.message:String(gt);if(/no session/i.test(wt)&&U.current){const Ke=await U.current(t??e,!0);if(Ke&&Ke!==ae&&!it.aborted)return Z.current=Ke,a.btwSession(Ke,je,{signal:it})}throw gt}},[a,e,t]),ce=h.useRef(ge);ce.current=ge;const ue=h.useRef(n==="commit").current,be=f==="commit",rt=be?"diff":f;h.useEffect(()=>{if(!be)return;const ae=new AbortController;return k(!0),T(!1),v(""),(U.current?U.current(t??e):Z.current?Promise.resolve(Z.current):Promise.resolve(void 0)).then(it=>{if(ae.signal.aborted)return;if(!it){T(!0),k(!1);return}return a.workspaceByCwd(e).workspaceGitDiff(t).then(wt=>{if(ae.signal.aborted)return;if(wt.files.length===0){k(!1);return}const Ke=wt.files.map(ht=>{const Oe=ht.isUntracked?"new":ht.isDeleted?"deleted":"modified",Ne=ht.isBinary?" (binary)":` (+${ht.added??0} -${ht.removed??0})`,St=ht.oldPath?` (renamed from ${ht.oldPath})`:"";return`${Oe}: ${ht.path}${Ne}${St}`});let un=Ke.join(`
`);if(un.length>h2){let ht="",Oe=0;for(const Ne of Ke){if(ht.length+Ne.length+1>h2)break;ht+=(ht?`
`:"")+Ne,Oe++}un=ht+`
(…and ${Ke.length-Oe} more files)`}const me=`Generate a concise git commit message for these changes. Reply with ONLY the commit message text, no quotes, no explanation.

${un}`;return ce.current(it,me,ae.signal).then(ht=>{ae.signal.aborted||ht.answer&&v(ht.answer.trim())})})}).catch(()=>{ae.signal.aborted||T(!0)}).finally(()=>{ae.signal.aborted||k(!1)}),()=>{ae.abort()}},[be,a,e,t]);const le=d.includes(rt)?rt:"diff",Me=h.useCallback(ae=>{g(void 0),m(ae)},[]),We=ae=>{var je;Me(ae),(je=document.getElementById(`git-dialog-tab-${ae}`))==null||je.focus()},at=ae=>{if(be){ae.key==="ArrowLeft"?(ae.preventDefault(),We(d[d.length-1])):ae.key==="ArrowRight"||ae.key==="Home"?(ae.preventDefault(),We(d[0])):ae.key==="End"&&ae.preventDefault();return}const je=d.indexOf(le);if(ae.key==="ArrowLeft"||ae.key==="ArrowRight"){ae.preventDefault();const it=ae.key==="ArrowRight"?1:-1;We(d[(je+it+d.length)%d.length]);return}if(ae.key==="Home"){ae.preventDefault(),We(d[0]);return}ae.key==="End"&&(ae.preventDefault(),We(d[d.length-1]))},ze=h.useCallback(async ae=>{if(!(y||z||!b.trim())){w(ae?"push":"commit"),re(null);try{const je=a.workspaceByCwd(e),it=await je.workspaceGitCommit(b.trim(),{all:!0},t);if(ae)try{await je.workspaceGitPush({setUpstream:!0},t),v(""),re({msg:o("gitCommit.commitPushSuccess",{sha:it.sha}),type:"success"})}catch(gt){re({msg:o("gitCommit.commitSuccessPushFailed",{sha:it.sha,error:gt instanceof Error?gt.message:String(gt)}),type:"error"})}else v(""),re({msg:o("gitCommit.commitSuccess",{sha:it.sha}),type:"success"})}catch(je){re({msg:je instanceof Error?je.message:String(je),type:"error"})}finally{w(null)}}},[a,e,t,b,y,z,o]),rn=h.useCallback(()=>{const ae=a.workspaceByCwd(e);V(!1),ae.workspaceGitBranches(t).then(je=>{const it=je.local.map(Ke=>Ke.name),gt=new Map;for(const Ke of je.remote){const un=Ke.name.indexOf("/"),me=un>0?Ke.name.slice(0,un):"other";let ht=gt.get(me);ht||(ht=[],gt.set(me,ht)),ht.push(Ke.name)}W({local:it,remotes:Array.from(gt.entries())});const wt=je.local.find(Ke=>Ke.isHead);ee.current=wt?{hasUpstream:!!wt.upstream}:null}).catch(()=>{W(null),V(!0),ee.current=null})},[a,e,t]);h.useEffect(()=>{if(!_||!be)return;const ae=a.workspaceByCwd(e);rn(),K(null),H(!0);const je=new AbortController,it=ae.workspaceGitHubDefaultBranch().then(wt=>wt.branch).catch(()=>"origin/main"),gt=U.current?U.current(t??e):Z.current?Promise.resolve(Z.current):Promise.resolve(void 0);return Promise.all([it,gt]).then(([wt,Ke])=>{if(!je.signal.aborted){if($(wt),!Ke){ae.workspaceGit().then(un=>{!je.signal.aborted&&un.branch&&!un.detached&&A(un.branch)}).catch(()=>{}).finally(()=>{je.signal.aborted||H(!1)});return}return Promise.all([ae.workspaceGitLog(50,0,t,`${wt}..HEAD`),ae.workspaceGitDiff(t)]).then(([un,me])=>{if(je.signal.aborted)return;if(!un.available){K({msg:o("gitCommit.prLogUnavailable"),type:"error"});return}const ht=un.entries.length>0?un.entries.map(Ue=>`- ${Ue.shortSha} ${Ue.subject}`).join(`
`):"(no commits ahead of base)",Oe=me.files.map(Ue=>`${Ue.isUntracked?"new":Ue.isDeleted?"deleted":"modified"}: ${Ue.path}`);let Ne=Oe.join(`
`);if(Ne.length>h2){let Ue="",ve=0;for(const Fe of Oe){if(Ue.length+Fe.length+1>h2)break;Ue+=(Ue?`
`:"")+Fe,ve++}Ne=Ue+`
(…and ${Oe.length-ve} more files)`}const St=`Generate a GitHub pull request title and body for the changes on this branch compared to ${wt}. Use the commit history and conversation context to understand what was done and why.

Commits on this branch (not in ${wt}):
${ht}

${Ne?`Uncommitted changes:
${Ne}

`:""}Follow these rules strictly:
1. Title: conventional commit format, e.g. "feat(web-shell): add branch picker". Under 70 chars.
2. Body must follow this exact template structure (fill in each section):

## What this PR does
<Describe the change in prose. Do NOT reference file names or function names.>

## Why it is needed
<Motivation, problem being solved, or user-facing benefit.>

## Reviewer Test Plan
### How to verify
<Steps a reviewer should follow to confirm the change works.>
### Evidence (Before & After)
N/A
### Tested on
|     OS     | Status |
| :--------: | :----: |
|  macOS  | ⚠️ |
| Windows | ⚠️ |
|  Linux  | ⚠️ |

## Risk & Scope
- Main risk or tradeoff: <fill in>
- Not validated / out of scope: <fill in>
- Breaking changes / migration notes: none

<details>
<summary>中文说明</summary>

<Full Chinese translation of the English body above, section by section.>

</details>

3. Do NOT hard-wrap paragraphs — write each paragraph as one long line.
4. Reply with the title on the first line, then a blank line, then the body. No extra explanation.`;return ce.current(Ke,St,je.signal).then(Ue=>{if(!je.signal.aborted)if(Ue.answer){const ve=Ue.answer.trim().split(`
`);A(ve[0]??""),M(ve.slice(1).join(`
`).trim())}else console.warn("[GitDialog] btwSession returned null answer")})})}}).catch(wt=>{je.signal.aborted||(console.error("[GitDialog] PR generation failed:",wt),K({msg:wt instanceof Error?wt.message:String(wt),type:"error"}),ae.workspaceGit().then(Ke=>{!je.signal.aborted&&Ke.branch&&!Ke.detached&&A(Ke.branch)}).catch(()=>{}))}).finally(()=>{je.signal.aborted||H(!1)}),()=>je.abort()},[_,be,a,e,t,o,rn]);const Wt=h.useCallback(async()=>{if(!(!R.trim()||j||z)){if(B(!0),K(null),ee.current&&!ee.current.hasUpstream){K({msg:o("gitCommit.prPushFirst"),type:"error"}),B(!1);return}try{const ae=a.workspaceByCwd(e),je=D.trim(),it=((J==null?void 0:J.remotes)??[]).map(([Ke])=>Ke).sort((Ke,un)=>un.length-Ke.length).find(Ke=>je.startsWith(`${Ke}/`)),gt=it?je.slice(it.length+1):je,wt=await ae.workspaceGitHubCreatePullRequest({title:R.trim(),body:O.trim()||void 0,base:gt||void 0},t);K({msg:o("gitCommit.prCreated",{number:wt.number??""}),type:"success",url:wt.url}),S(!1)}catch(ae){K({msg:ae instanceof Error?ae.message:String(ae),type:"error"})}finally{B(!1)}}},[a,e,t,R,O,D,J,j,z,o]);return l.jsx(Ii,{title:o(bV[be?"commit":le]),subtitle:p,size:"xl",allowFullscreen:!0,onClose:i,children:l.jsxs("div",{className:Gn.content,children:[l.jsxs("div",{className:Gn.tabBar,role:"tablist",children:[d.map(ae=>l.jsx("button",{id:`git-dialog-tab-${ae}`,type:"button",role:"tab","aria-selected":le===ae&&!be,"aria-controls":"git-dialog-panel",tabIndex:le===ae&&!be?0:-1,className:`${Gn.tab}${le===ae&&!be?` ${Gn.tabActive}`:""}`,onClick:()=>Me(ae),onKeyDown:at,children:o(bV[ae])},ae)),ue&&l.jsx("button",{id:"git-dialog-tab-commit",type:"button",role:"tab","aria-selected":be,"aria-controls":"git-dialog-panel",tabIndex:be?0:-1,className:`${Gn.tab}${be?` ${Gn.tabActive}`:""}`,onKeyDown:at,onClick:()=>Me("commit"),children:o("gitCommit.title")})]}),l.jsx("div",{id:"git-dialog-panel",className:Gn.tabPanel,role:"tabpanel","aria-labelledby":`git-dialog-tab-${be?"commit":le}`,children:le==="diff"||be?l.jsx(Tdt,{workspaceCwd:e,gitCwd:t,onSubtitleChange:g}):le==="log"?l.jsx(nht,{workspaceCwd:e,gitCwd:t,onSubtitleChange:g}):l.jsx(kht,{workspaceCwd:e,onSubtitleChange:g})}),be&&l.jsxs("div",{className:Gn.commitPanel,children:[l.jsx("textarea",{ref:ne,className:Gn.commitMessage,placeholder:o(x?"gitCommit.generating":C?"gitCommit.genFailed":"gitCommit.messagePlaceholder"),value:b,disabled:x,onChange:ae=>v(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&(ae.metaKey||ae.ctrlKey)&&(ae.preventDefault(),ze(!1))}}),de&&l.jsx("div",{className:`${Gn.commitStatus} ${de.type==="error"?Gn.commitStatusError:Gn.commitStatusSuccess}`,children:de.msg}),l.jsxs("div",{className:Gn.commitActions,children:[l.jsxs("button",{type:"button",className:`${Gn.commitBtn} ${Gn.commitBtnPrimary}`,disabled:!b.trim()||!!y||z,onClick:()=>void ze(!1),children:[y==="commit"&&l.jsx(J1,{size:14,className:Gn.spin}),o("gitCommit.commit")]}),l.jsxs("button",{type:"button",className:`${Gn.commitBtn} ${Gn.commitBtnSecondary}`,disabled:!b.trim()||!!y||z,onClick:()=>void ze(!0),children:[y==="push"&&l.jsx(J1,{size:14,className:Gn.spin}),o("gitCommit.commitAndPush")]}),u&&l.jsx("button",{type:"button",className:`${Gn.commitBtn} ${Gn.commitBtnSecondary}`,disabled:!!y||z,onClick:()=>S(!_),children:o("gitCommit.createPr")})]}),_&&l.jsxs("div",{className:Gn.prForm,children:[l.jsx("input",{className:Gn.prInput,placeholder:o(j?"gitCommit.generating":"gitCommit.prTitlePlaceholder"),value:R,disabled:j,onChange:ae=>A(ae.target.value)}),l.jsxs("div",{className:Gn.prBodyWrap,children:[l.jsxs("div",{className:Gn.prBodyToolbar,children:[l.jsxs("button",{type:"button",className:`${Gn.prBodyTab} ${Q?"":Gn.prBodyTabActive}`,onClick:()=>I(!1),children:[l.jsx(Sb,{size:12}),o("gitCommit.prEdit")]}),l.jsxs("button",{type:"button",className:`${Gn.prBodyTab} ${Q?Gn.prBodyTabActive:""}`,onClick:()=>I(!0),children:[l.jsx(pye,{size:12}),o("gitCommit.prPreview")]})]}),Q?l.jsx("div",{className:Gn.prBodyPreview,children:O?l.jsx(pf,{content:O}):l.jsx("span",{className:Gn.prBodyEmpty,children:o("gitCommit.prBodyPlaceholder")})}):l.jsx("textarea",{className:Gn.prBody,placeholder:o(j?"gitCommit.generating":"gitCommit.prBodyPlaceholder"),value:O,disabled:j,onChange:ae=>M(ae.target.value)})]}),l.jsxs("div",{className:Gn.prFormRow,children:[l.jsx(aft,{value:D,onChange:$,branches:J,error:P,onRetry:rn}),l.jsxs("button",{type:"button",className:`${Gn.commitBtn} ${Gn.commitBtnPrimary}`,disabled:!R.trim()||z||j||!!y,onClick:()=>void Wt(),children:[z&&l.jsx(J1,{size:14,className:Gn.spin}),o("gitCommit.prSubmit")]})]})]}),q&&l.jsx("div",{className:`${Gn.commitStatus} ${q.type==="error"?Gn.commitStatusError:Gn.commitStatusSuccess}`,children:q.url?l.jsx("a",{href:q.url,target:"_blank",rel:"noopener noreferrer",children:q.msg}):q.msg})]})]})})}function aft({value:e,onChange:t,branches:n,error:s=!1,onRetry:r}){const{t:i}=lt(),[o,a]=h.useState(!1),[c,u]=h.useState(""),d=h.useRef(null),f=c.toLowerCase().trim(),m=n?n.remotes.map(([g,b])=>[g,b.filter(v=>!f||v.toLowerCase().includes(f))]).filter(([g,b])=>b.length>0||g.toLowerCase().includes(f)):[],p=n?n.local.filter(g=>!f||g.toLowerCase().includes(f)):[];return l.jsxs(np,{open:o,onOpenChange:g=>{a(g),g?setTimeout(()=>{var b;return(b=d.current)==null?void 0:b.focus()},50):u("")},children:[l.jsx(V0,{asChild:!0,children:l.jsxs("button",{type:"button",className:Gn.branchSelectTrigger,"aria-label":i("branchSelect.baseBranch"),children:[l.jsx("span",{className:Gn.branchSelectValue,children:e?e.includes("/")?e.slice(e.indexOf("/")+1):e:"main"}),l.jsx(gc,{size:12})]})}),l.jsxs(sp,{className:Gn.branchSelectPopover,side:"bottom",align:"start",sideOffset:4,children:[l.jsxs("div",{className:Gn.branchSelectSearch,children:[l.jsx(Pc,{size:13}),l.jsx("input",{ref:d,className:Gn.branchSelectInput,placeholder:i("branchSelect.search"),"aria-label":i("branchSelect.search"),value:c,onChange:g=>u(g.target.value)})]}),l.jsxs("div",{className:Gn.branchSelectList,children:[m.map(([g,b])=>l.jsxs("div",{children:[l.jsx("div",{className:Gn.branchSelectGroup,children:g}),b.map(v=>l.jsx("button",{type:"button",className:`${Gn.branchSelectItem} ${v===e?Gn.branchSelectItemActive:""}`,onClick:()=>{t(v),a(!1)},children:v.includes("/")?v.slice(v.indexOf("/")+1):v},v))]},g)),p.length>0&&l.jsxs("div",{children:[l.jsx("div",{className:Gn.branchSelectGroup,children:i("branchSelect.local")}),p.map(g=>l.jsx("button",{type:"button",className:`${Gn.branchSelectItem} ${g===e?Gn.branchSelectItemActive:""}`,onClick:()=>{t(g),a(!1)},children:g},g))]}),!n&&(s?l.jsxs("div",{className:Gn.branchSelectEmpty,children:[i("branchSelect.error"),r&&l.jsx("button",{type:"button",className:Gn.branchSelectRetry,onClick:r,children:i("branchSelect.retry")})]}):l.jsx("div",{className:Gn.branchSelectEmpty,children:i("branchSelect.loading")})),n&&m.length===0&&p.length===0&&l.jsx("div",{className:Gn.branchSelectEmpty,children:i("branchSelect.noMatches")})]})]})]})}function lft(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 cft(e,t){return e&&t.some(n=>n.name===e)?e:null}const uft=6*1024*1024;function dft(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"):Wi(e)||t("skills.install.failed")}async function hft(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 fft({open:e,onOpenChange:t,onInstall:n}){const{t:s}=lt(),[r,i]=h.useState(""),[o,a]=h.useState("workspace"),[c,u]=h.useState("github"),[d,f]=h.useState(""),[m,p]=h.useState(""),[g,b]=h.useState(null),[v,y]=h.useState(!1),[w,x]=h.useState(null);function k(){i(""),a("workspace"),u("github"),f(""),p(""),b(null),x(null)}async function C(){y(!0),x(null);try{if(!r.trim())throw new Error(s("skills.install.error.nameRequired"));let T;if(c==="github"){if(!d.trim())throw new Error(s("skills.install.error.githubRequired"));T={type:"github",url:d.trim()}}else if(c==="folder"){if(!m.trim())throw new Error(s("skills.install.error.folderRequired"));T={type:"folder",path:m.trim()}}else{if(!g)throw new Error(s("skills.install.selectZip"));if(g.size>uft)throw new Error(s("skills.install.error.zipTooLarge"));T={type:"zip",contentBase64:await hft(g)}}await n({name:r.trim(),scope:o,source:T}),t(!1),k()}catch(T){x(dft(T,s))}finally{y(!1)}}return l.jsx(Qm,{open:e,onOpenChange:T=>{v||(t(T),T||k())},children:l.jsxs(Jm,{className:"sm:max-w-lg",showCloseButton:!1,onPointerDownOutside:T=>T.preventDefault(),children:[l.jsxs(Zm,{children:[l.jsx(tp,{children:s("skills.install.title")}),l.jsx(W0,{children:s("skills.install.description")})]}),l.jsxs("div",{className:"grid gap-4",children:[w?l.jsxs(bo,{variant:"destructive",children:[l.jsx(ja,{}),l.jsx(yo,{children:w})]}):null,l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.name"),l.jsx(Pr,{value:r,onChange:T=>i(T.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(xl,{value:o,onValueChange:T=>a(T),disabled:v,children:[l.jsx(_l,{className:"w-full",children:l.jsx(kl,{})}),l.jsxs(Sl,{children:[l.jsx(Ti,{value:"workspace",children:s("skills.install.scope.workspace")}),l.jsx(Ti,{value:"global",children:s("skills.install.scope.global")})]})]})]}),l.jsxs(_g,{value:c,onValueChange:T=>u(T),children:[l.jsxs(Sg,{className:"grid w-full grid-cols-3",children:[l.jsx(ti,{value:"github",disabled:v,children:"GitHub"}),l.jsx(ti,{value:"folder",disabled:v,children:s("skills.install.folder")}),l.jsx(ti,{value:"zip",disabled:v,children:"ZIP"})]}),l.jsx(Ri,{value:"github",className:"pt-3",children:l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.githubUrl"),l.jsx(Pr,{type:"url",value:d,onChange:T=>f(T.target.value),placeholder:"https://github.com/owner/repo/blob/main/skill/SKILL.md",disabled:v})]})}),l.jsx(Ri,{value:"folder",className:"pt-3",children:l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.folderPath"),l.jsx(Pr,{value:m,onChange:T=>p(T.target.value),placeholder:"/absolute/path/to/my-skill",disabled:v})]})}),l.jsx(Ri,{value:"zip",className:"pt-3",children:l.jsxs("div",{className:"grid gap-2",children:[l.jsx(Pr,{type:"file",accept:".zip,application/zip",onChange:T=>{var S;const _=((S=T.target.files)==null?void 0:S[0])??null;b(_),_&&i(R=>R||_.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(ep,{children:[l.jsx(Jt,{variant:"outline",onClick:()=>{t(!1),k()},disabled:v,children:s("common.cancel")}),l.jsxs(Jt,{onClick:()=>void C(),disabled:v,children:[v?l.jsx(fr,{"data-icon":"inline-start"}):l.jsx(Pwe,{"data-icon":"inline-start"}),s("skills.install.action")]})]})]})})}const mft="_skillGrid_1hucr_1",pft={skillGrid:mft};function wV(e,t){return t(`skills.level.${e.level}`)}function vV(e,t){return t(e.status==="disabled"?"skills.status.disabled":"skills.status.enabled")}function xV(e){return e.status==="disabled"?"":"bg-[var(--success-bg)] text-[var(--success-color)]"}function gft(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 s1({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 kV({compact:e=!1}){const{t}=lt();return l.jsx(nh,{delayDuration:300,children:l.jsxs(sh,{children:[l.jsx(rh,{asChild:!0,children:l.jsx(Pi,{variant:"secondary",className:e?"text-[10px]":void 0,children:t("skills.manualReference")})}),l.jsx(ih,{children:t("skills.manualReferenceHint")})]})})}function Gce({onClose:e,onUseSkill:t,embedded:n}){var U,Z,ge,ce;const{t:s}=lt(),r=io(),{status:i,skills:o,loading:a,error:c,reload:u,setEnabled:d,install:f,remove:m}=cbe({autoLoad:!0}),p=((U=r.capabilities)==null?void 0:U.features.includes("workspace_skill_toggle"))===!0,g=((Z=r.capabilities)==null?void 0:Z.features.includes("workspace_skill_manage"))===!0,[b,v]=h.useState(""),[y,w]=h.useState("all"),[x,k]=h.useState("enabled"),[C,T]=h.useState({}),[_,S]=h.useState(null),[R,A]=h.useState(null),[O,M]=h.useState(!1),[D,$]=h.useState(!1),[z,B]=h.useState(null),[j,H]=h.useState(null),Q=h.useMemo(()=>o.map(ue=>({...ue,status:C[ue.name]??ue.status})),[o,C]),I=h.useMemo(()=>Q.find(ue=>ue.name===_),[Q,_]),J=h.useMemo(()=>lft(Q,b,y,x),[Q,y,b,x]),W=Q.filter(ue=>ue.status==="disabled").length,P=(c==null?void 0:c.message)??((ce=(ge=i==null?void 0:i.errors)==null?void 0:ge[0])==null?void 0:ce.error),V=[{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")}];h.useEffect(()=>{S(ue=>cft(ue,Q))},[Q]),h.useEffect(()=>{T(ue=>{const be={...ue};let rt=!1;for(const le of o)be[le.name]===le.status&&(delete be[le.name],rt=!0);return rt?be:ue})},[o]),h.useEffect(()=>{n==null||n.onDetailChange(!!I)},[n,I]);async function ee(ue){const be=ue.status==="disabled";A(ue.name),H(null);try{await d(ue.name,be),T(rt=>({...rt,[ue.name]:be?"ok":"disabled"})),await u(),H({skillName:ue.name,text:s(be?"skills.enabled":"skills.disabled"),error:!1})}catch(rt){H({skillName:ue.name,text:gft(rt,s),error:!0})}finally{A(null)}}async function q(ue){B(null),await f(ue),B(s("skills.install.succeeded",{name:ue.name.trim()})),await u().catch(()=>{})}async function K(){if(!I)return;const ue=I.level==="project"?"workspace":"global";A(I.name);try{await m(I.name,ue),$(!1),S(null),B(s("skills.delete.succeeded",{name:I.name})),await u().catch(()=>{})}catch(be){$(!1),H({skillName:I.name,text:be instanceof Error?be.message:s("skills.delete.failed"),error:!0})}finally{A(null)}}function de(){S(null),u()}const re=l.jsx(fp,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(mp,{className:"text-base",children:[l.jsx(Yi,{children:l.jsx(Jt,{variant:"ghost",size:"icon",onClick:e,"aria-label":s("common.back"),children:l.jsx(ik,{})})}),l.jsx(Yi,{children:I?l.jsx($d,{asChild:!0,children:l.jsx("button",{type:"button",onClick:de,children:s("skills.title")})}):l.jsx(ml,{children:s("skills.title")})}),I?l.jsx(Bd,{}):null,I?l.jsx(Yi,{children:l.jsx(ml,{children:I.name})}):null]})}),ne=n?I?l.jsx(fp,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(mp,{className:"h-8 text-sm",children:[l.jsx(Yi,{children:l.jsx($d,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>{de(),n.onDetailChange(!1)},children:s("skills.title")})})}),l.jsx(Bd,{}),l.jsx(Yi,{children:l.jsx(ml,{children:I.name})})]})}):null:re;if(I){const ue=`/${I.name}${I.argumentHint?` ${I.argumentHint}`:""}`;return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ne,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(eb,{})}),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-xl font-semibold text-balance",children:I.name}),l.jsx(Pi,{variant:"outline",children:wV(I,s)}),l.jsx(Pi,{variant:"secondary",className:xV(I),children:vV(I,s)}),I.modelInvocable?null:l.jsx(kV,{})]})}),l.jsxs(Jt,{disabled:I.status==="disabled",onClick:()=>t(I.name),children:[l.jsx(awe,{"data-icon":"inline-start"}),s("skills.run")]}),l.jsxs(Hh,{children:[l.jsx(qh,{asChild:!0,children:l.jsx(Jt,{variant:"ghost",size:"icon",disabled:R!==null,"aria-label":s("skills.actions"),"data-testid":"skill-actions",children:R===I.name?l.jsx(fr,{}):l.jsx(fm,{})})}),l.jsx(Uh,{align:"end",onCloseAutoFocus:be=>be.preventDefault(),children:l.jsxs(Lm,{children:[l.jsx(ho,{disabled:R!==null||!p||I.userInvocable===!1,title:p?I.userInvocable===!1?s("skills.notToggleable"):void 0:s("skills.toggleUnsupported"),onSelect:()=>void ee(I),children:s(I.status==="disabled"?"skills.enable":"skills.disable")}),g&&(I.level==="project"||I.level==="user")?l.jsx(ho,{variant:"destructive",disabled:R!==null,onSelect:()=>$(!0),children:s("skills.delete.action")}):null]})})]})]}),(j==null?void 0:j.skillName)===I.name?l.jsx(Yl,{tone:j.error?"error":"success",noticeKey:j.text,closeLabel:s("common.close"),onDismiss:()=>H(null),children:j.text}):null,P||I.error?l.jsxs(bo,{variant:"destructive",children:[l.jsx(ja,{}),l.jsx(yo,{children:I.error||P})]}):null,l.jsxs(No,{children:[l.jsxs(bl,{children:[l.jsx(yl,{className:"text-sm",children:s("skills.details")}),l.jsx(mu,{children:I.description||s("skills.noDescription")})]}),l.jsxs(Vl,{className:"grid gap-6 sm:grid-cols-2",children:[l.jsx(s1,{label:s("skills.invocation"),value:ue}),l.jsx(s1,{label:s("skills.level"),value:wV(I,s)}),l.jsx(s1,{label:s("skills.modelAccess"),value:I.modelInvocable?s("skills.modelAccess.enabled"):s("skills.modelAccess.disabled")}),l.jsx(s1,{label:s("skills.model"),value:I.model||"-"}),l.jsx(s1,{label:s("skills.extension"),value:I.extensionName||"-"}),I.hint?l.jsx("div",{className:"sm:col-span-2",children:l.jsx(s1,{label:s("skills.hint"),value:I.hint})}):null]})]}),l.jsx(Ox,{open:D,onOpenChange:be=>{!be&&R!==null||$(be)},children:l.jsxs($x,{children:[l.jsxs(Bx,{children:[l.jsx(Fx,{children:s("skills.delete.title")}),l.jsx(Hx,{children:s("skills.delete.description",{name:I.name})})]}),l.jsxs(zx,{children:[l.jsx(qx,{disabled:R!==null,children:s("common.cancel")}),l.jsxs(AP,{variant:"destructive",disabled:R!==null,onClick:be=>{be.preventDefault(),K()},children:[R?l.jsx(fr,{"data-icon":"inline-start"}):null,s("skills.delete.action")]})]})]})})]})]})}return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ne,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-xl 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-W,disabled:W})})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(Jt,{variant:"outline",disabled:a,onClick:()=>void u(),children:[a?l.jsx(fr,{"data-icon":"inline-start"}):l.jsx(ak,{"data-icon":"inline-start"}),s("common.refresh")]}),g?l.jsxs(Jt,{onClick:()=>M(!0),children:[l.jsx(z0,{"data-icon":"inline-start"}),s("skills.install.action")]}):null]})]}),P?l.jsxs(bo,{variant:"destructive",children:[l.jsx(ja,{}),l.jsx(yo,{children:P})]}):null,z?l.jsx(Yl,{tone:"success",noticeKey:z,closeLabel:s("common.close"),onDismiss:()=>B(null),children:z}):null,l.jsxs("div",{className:"relative",children:[l.jsx(Pc,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(Pr,{name:"skill-search","aria-label":s("skills.search"),autoComplete:"off",value:b,onChange:ue=>v(ue.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(NP,{type:"single",value:y,onValueChange:ue=>{ue&&w(ue)},variant:"outline",size:"sm","aria-label":s("skills.filter.label"),children:V.map(ue=>l.jsx(MP,{value:ue.value,children:ue.label},ue.value))}),l.jsxs(xl,{value:x,onValueChange:ue=>k(ue),children:[l.jsx(_l,{className:"w-32","aria-label":s("skills.filter.status.label"),children:l.jsx(kl,{})}),l.jsxs(Sl,{children:[l.jsx(Ti,{value:"all",children:s("skills.filter.status.all")}),l.jsx(Ti,{value:"enabled",children:s("skills.filter.status.enabled")}),l.jsx(Ti,{value:"disabled",children:s("skills.filter.status.disabled")})]})]})]}),J.length?l.jsx("div",{className:pft.skillGrid,"data-column-count":Math.min(J.length,4),children:J.map(ue=>l.jsx(No,{size:"sm",role:"button",tabIndex:0,"aria-label":ue.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(ue.name),onKeyDown:be=>{(be.key==="Enter"||be.key===" ")&&(be.preventDefault(),S(ue.name))},children:l.jsx(bl,{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(eb,{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(yl,{className:"min-w-0 flex-1 truncate",children:ue.name}),l.jsxs("div",{className:"flex shrink-0 gap-1",children:[l.jsx(Pi,{variant:"secondary",className:`${xV(ue)} text-[10px]`,children:vV(ue,s)}),ue.modelInvocable?null:l.jsx(kV,{compact:!0})]})]}),l.jsx(mu,{className:"mt-1 min-w-0 text-xs",children:l.jsx(nh,{delayDuration:300,children:l.jsxs(sh,{children:[l.jsx(rh,{asChild:!0,children:l.jsx("span",{className:"block truncate",children:ue.description||s("skills.noDescription")})}),l.jsx(ih,{children:ue.description||s("skills.noDescription")})]})})})]})]})})},ue.name))}):l.jsx($u,{className:"border",children:l.jsxs(Bu,{children:[l.jsx(zu,{variant:"icon",children:b||y!=="all"||x!=="all"?l.jsx(Pc,{}):l.jsx(eb,{})}),l.jsx(Fu,{children:s(b||y!=="all"||x!=="all"?"skills.noMatches":"skills.empty")})]})})]}),l.jsx(fft,{open:O,onOpenChange:M,onInstall:q})]})}const bft="_chart_1xbk4_1",yft="_plot_1xbk4_8",wft="_svg_1xbk4_13",vft="_cursor_1xbk4_30",xft="_tooltip_1xbk4_40",kft="_tooltipBelow_1xbk4_62",_ft="_tooltipTime_1xbk4_67",Sft="_tooltipRow_1xbk4_73",Cft="_tooltipLabel_1xbk4_79",Tft="_tooltipValue_1xbk4_83",Eft="_axis_1xbk4_91",jft="_legend_1xbk4_96",Aft="_legendItem_1xbk4_105",Nft="_swatch_1xbk4_112",Mft="_legendLabel_1xbk4_118",Ift="_legendValue_1xbk4_123",Rft="_peak_1xbk4_131",na={chart:bft,plot:yft,svg:wft,cursor:vft,tooltip:xft,tooltipBelow:kft,tooltipTime:_ft,tooltipRow:Sft,tooltipLabel:Cft,tooltipValue:Tft,axis:Eft,legend:jft,legendItem:Aft,swatch:Nft,legendLabel:Mft,legendValue:Ift,peak:Rft},JM=320,Xw=64,Bl=3,f2=JM-Bl*2,m2=Xw-Bl*2;function _V(e,t){return Number.isFinite(e)?e:t}const Dft=84;function Pft(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 Lft(e){return new Date(e).toLocaleTimeString()}function Kce({series:e,timestamps:t,format:n=a=>String(Math.round(a)),formatTime:s=Lft,zeroBased:r=!0,ariaLabel:i,peakLabel:o="peak"}){const a=h.useRef(null),[c,u]=h.useState(null),[d,f]=h.useState(!1),m=h.useRef(void 0),{paths:p,maxV:g,maxLen:b,min:v,span:y}=h.useMemo(()=>{const A=e.reduce((j,H)=>Math.max(j,H.values.length),0);let O=0,M=r?0:Number.POSITIVE_INFINITY;for(const j of e)for(const H of j.values)Number.isFinite(H)&&(H>O&&(O=H),H<M&&(M=H));Number.isFinite(M)||(M=0);const D=O-M||1,$=j=>A<=1?Bl+f2/2:Bl+j/(A-1)*f2,z=j=>Bl+m2-(_V(j,M)-M)/D*m2;return{paths:e.map(j=>{const H=j.values.map((J,W)=>`${W===0?"M":"L"}${$(W).toFixed(1)},${z(J).toFixed(1)}`).join(" "),Q=j.values.length-1,I=Q>=0?{cx:$(Q),cy:z(j.values[Q]),color:j.color}:void 0;return{key:j.label,d:H,color:j.color,dot:I}}),maxV:O,maxLen:A,min:M,span:D}},[e,r]),w=b>0,x=A=>b<=1?Bl+f2/2:Bl+A/(b-1)*f2,k=A=>Bl+m2-(_V(A,v)-v)/y*m2,C=A=>{const O=a.current;if(!O||b===0)return;const M=O.getBoundingClientRect();if(M.width===0)return;const D=(A.clientX-M.left)/M.width,$=Math.max(0,Math.min(b-1,Math.round(D*(b-1))));u($),m.current===void 0&&(m.current=Pft(O));const z=m.current,B=z?z.getBoundingClientRect().top:0;f(M.top-B<Dft)},T=()=>u(null),_=c!=null&&c>=0&&c<b?c:null,S=_!=null?x(_):0,R=_!=null&&b>1?_/(b-1)*100:50;return l.jsxs("div",{className:na.chart,children:[l.jsxs("div",{className:na.plot,children:[l.jsxs("svg",{ref:a,viewBox:`0 0 ${JM} ${Xw}`,preserveAspectRatio:"none",role:"img","aria-label":i,className:na.svg,onPointerMove:C,onPointerLeave:T,children:[l.jsx("line",{x1:Bl,y1:Xw-Bl,x2:JM-Bl,y2:Xw-Bl,className:na.axis,vectorEffect:"non-scaling-stroke"}),p.map(A=>l.jsx("path",{d:A.d,fill:"none",stroke:A.color,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"},A.key)),_!=null&&l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:S,y1:Bl,x2:S,y2:Xw-Bl,className:na.cursor,vectorEffect:"non-scaling-stroke"}),e.map(A=>_<A.values.length?l.jsx("circle",{cx:S,cy:k(A.values[_]),r:2.5,fill:A.color,vectorEffect:"non-scaling-stroke"},`${A.label}-hover`):null)]}),_==null&&p.map(A=>A.dot?l.jsx("circle",{cx:A.dot.cx,cy:A.dot.cy,r:2,fill:A.dot.color,vectorEffect:"non-scaling-stroke"},`${A.key}-dot`):null)]}),_!=null&&l.jsxs("div",{className:`${na.tooltip} ${d?na.tooltipBelow:""}`,style:{left:`${R}%`},role:"tooltip",children:[t&&t[_]!=null&&l.jsx("div",{className:na.tooltipTime,children:s(t[_])}),e.map(A=>_<A.values.length?l.jsxs("div",{className:na.tooltipRow,children:[l.jsx("svg",{className:na.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:l.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:A.color})}),l.jsx("span",{className:na.tooltipLabel,children:A.label}),l.jsx("span",{className:na.tooltipValue,children:n(A.values[_])})]},A.label):null)]})]}),l.jsxs("div",{className:na.legend,children:[e.map(A=>{const O=A.values.length?A.values[A.values.length-1]:void 0;return l.jsxs("span",{className:na.legendItem,children:[l.jsx("svg",{className:na.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:l.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:A.color})}),l.jsx("span",{className:na.legendLabel,children:A.label}),O!==void 0&&l.jsx("span",{className:na.legendValue,children:n(O)})]},A.label)}),w&&l.jsx("span",{className:na.peak,children:`${o} ${n(g)}`})]})]})}const Oft="_wrap_1icv6_1",$ft="_tooltip_1icv6_11",Bft="_legend_1icv6_27",zft="_legendLabel_1icv6_35",Fft="_scroll_1icv6_39",Hft="_grid_1icv6_44",qft="_month_1icv6_51",Uft="_weekday_1icv6_59",Wft="_cell_1icv6_69",Vft="_legendCell_1icv6_75",Gft="_lvl0_1icv6_82",Kft="_lvl1_1icv6_85",Yft="_lvl2_1icv6_88",Xft="_lvl3_1icv6_91",Qft="_lvl4_1icv6_94",Jft="_today_1icv6_98",al={wrap:Oft,tooltip:$ft,legend:Bft,legendLabel:zft,scroll:Fft,grid:Hft,month:qft,weekday:Uft,cell:Wft,legendCell:Vft,lvl0:Gft,lvl1:Kft,lvl2:Yft,lvl3:Xft,lvl4:Qft,today:Jft},LE=864e5,Zft=4;function OE(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function SV(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 emt(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 tmt(e,[t,n,s]){return e<=0?0:e<=t?1:e<=n?2:e<=s?3:Zft}function nmt(e,t,n){const s=Math.max(1,Math.floor(t)),r=OE(Date.now()),i=OE(r.getTime()-(s-1)*LE),o=(i.getDay()+6)%7,a=OE(i.getTime()-o*LE),c=Math.round((r.getTime()-a.getTime())/LE)+1,u=[],d=[],f=SV(r),m=new Date(a.getTime());for(let x=0;x<c;x++){const k=SV(m),C=e[k],T=(C==null?void 0:C.tokens)??0;d.push(T),u.push({dateKey:k,tokens:T,cacheReadRate:(C==null?void 0:C.cacheReadRate)??0,isToday:k===f,weekday:x%7,week:Math.floor(x/7)}),m.setDate(m.getDate()+1)}const p=emt(d),g=u.map(x=>({...x,level:tmt(x.tokens,p)})),b=Math.ceil(c/7),v=[];let y=-1;const w=new Date(a.getTime());for(let x=0;x<b;x++){const k=w.getMonth();k!==y&&(v.push({week:x,text:w.toLocaleDateString(n,{month:"short"})}),y=k),w.setDate(w.getDate()+7)}return{cells:g,months:v,weeks:b}}function smt({heatmap:e,days:t}){const{t:n,language:s}=lt(),r=h.useMemo(()=>nmt(e,t,s),[e,t,s]),i=h.useRef(null),[o,a]=h.useState(null),c={0:n("daemon.usage.dowMon"),2:n("daemon.usage.dowWed"),4:n("daemon.usage.dowFri")},u=d=>{const f=d.target.closest("[data-date]"),m=i.current;if(!f||!m)return;const p=f.dataset.date??"",g=Number(f.dataset.tokens??"0"),b=Number(f.dataset.cache??"0"),v=f.getBoundingClientRect(),y=m.getBoundingClientRect();a({left:v.left-y.left+v.width/2,top:v.top-y.top,text:n("daemon.usage.cellTokens",{date:p,tokens:H1(g),cache:Math.round(b*100)})})};return l.jsxs("div",{className:al.wrap,ref:i,children:[l.jsxs("div",{className:al.legend,children:[l.jsx("span",{className:al.legendLabel,children:n("daemon.usage.low")}),[0,1,2,3,4].map(d=>l.jsx("span",{className:`${al.cell} ${al.legendCell} ${al[`lvl${d}`]}`},d)),l.jsx("span",{className:al.legendLabel,children:n("daemon.usage.high")})]}),l.jsx("div",{className:al.scroll,onMouseOver:u,onMouseLeave:()=>a(null),children:l.jsxs("div",{className:al.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:al.month,style:{gridColumn:d.week+2,gridRow:1},children:d.text},`m-${d.week}`)),[0,2,4].map(d=>l.jsx("div",{className:al.weekday,style:{gridColumn:1,gridRow:d+2},children:c[d]},`wd-${d}`)),r.cells.map(d=>l.jsx("div",{className:`${al.cell} ${al[`lvl${d.level}`]} ${d.isToday?al.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:al.tooltip,style:{left:o.left,top:o.top},role:"status",children:o.text})]})}const rmt="_usage_1kfmt_1",imt="_toolbar_1kfmt_9",omt="_segmented_1kfmt_14",amt="_segment_1kfmt_14",lmt="_segmentActive_1kfmt_41",cmt="_hero_1kfmt_48",umt="_heroMain_1kfmt_59",dmt="_heroLabel_1kfmt_63",hmt="_heroNumber_1kfmt_71",fmt="_heroSub_1kfmt_82",mmt="_refresh_1kfmt_87",pmt="_stats_1kfmt_109",gmt="_stat_1kfmt_109",bmt="_statValue_1kfmt_121",ymt="_statLabel_1kfmt_130",wmt="_section_1kfmt_139",vmt="_sectionTitle_1kfmt_145",xmt="_sectionSub_1kfmt_154",kmt="_breakdown_1kfmt_161",_mt="_metric_1kfmt_167",Smt="_metricHead_1kfmt_173",Cmt="_tick_1kfmt_179",Tmt="_tick_input_1kfmt_186",Emt="_tick_output_1kfmt_190",jmt="_tick_cache_1kfmt_198",Amt="_metricLabel_1kfmt_202",Nmt="_metricValue_1kfmt_209",Mmt="_metricHint_1kfmt_219",Imt="_state_1kfmt_225",Rmt="_modelList_1kfmt_233",Dmt="_modelRow_1kfmt_239",Pmt="_modelHead_1kfmt_245",Lmt="_modelRank_1kfmt_251",Omt="_modelMeta_1kfmt_262",$mt="_modelName_1kfmt_267",Bmt="_modelSub_1kfmt_277",zmt="_modelShare_1kfmt_282",Fmt="_modelTrack_1kfmt_289",Hmt="_modelFill_1kfmt_296",qmt="_modelFillCache_1kfmt_303",Umt="_skillTable_1kfmt_310",Wmt="_right_1kfmt_334",Vmt="_bars_1kfmt_339",Gmt="_barsBody_1kfmt_345",Kmt="_barCol_1kfmt_352",Ymt="_bar_1kfmt_339",Xmt="_barsCaption_1kfmt_371",Mn={usage:rmt,toolbar:imt,segmented:omt,segment:amt,segmentActive:lmt,hero:cmt,heroMain:umt,heroLabel:dmt,heroNumber:hmt,heroSub:fmt,refresh:mmt,stats:pmt,stat:gmt,statValue:bmt,statLabel:ymt,section:wmt,sectionTitle:vmt,sectionSub:xmt,breakdown:kmt,metric:_mt,metricHead:Smt,tick:Cmt,tick_input:Tmt,tick_output:Emt,tick_cache:jmt,metricLabel:Amt,metricValue:Nmt,metricHint:Mmt,state:Imt,modelList:Rmt,modelRow:Dmt,modelHead:Pmt,modelRank:Lmt,modelMeta:Omt,modelName:$mt,modelSub:Bmt,modelShare:zmt,modelTrack:Fmt,modelFill:Hmt,modelFillCache:qmt,skillTable:Umt,right:Wmt,bars:Vmt,barsBody:Gmt,barCol:Kmt,bar:Ymt,barsCaption:Xmt},Yce=12,Qmt=Math.round(Yce*30.44),Jmt=["today","week","month"],Zmt={today:"daemon.usage.today",week:"daemon.usage.period7d",month:"daemon.usage.period30d"},ept={today:"daemon.usage.today",week:"daemon.usage.rangeWeek",month:"daemon.usage.rangeMonth"},tpt={today:"daemon.usage.rangeWordToday",week:"daemon.usage.rangeWordWeek",month:"daemon.usage.rangeWordMonth"},CV=["#3b82f6","#14b8a6","#f59e0b","#ef4444","#8b5cf6","#22c55e","#06b6d4","#ec4899"];function npt(e){return new Date(`${e}T00:00:00`).getTime()}function $E(e,t){return new Date(`${e}T00:00:00`).toLocaleDateString(t,{month:"short",day:"numeric"})}function spt(e,t){return new Date(e).toLocaleDateString(t,{month:"short",day:"numeric"})}function p2({label:e,value:t}){return l.jsxs("div",{className:Mn.stat,children:[l.jsx("div",{className:Mn.statValue,children:t.toLocaleString()}),l.jsx("div",{className:Mn.statLabel,children:e})]})}function BE({accent:e,value:t,label:n,hint:s}){return l.jsxs("div",{className:Mn.metric,children:[l.jsxs("div",{className:Mn.metricHead,children:[l.jsx("span",{className:`${Mn.tick} ${Mn[`tick_${e}`]}`}),l.jsx("span",{className:Mn.metricLabel,children:n})]}),l.jsx("div",{className:Mn.metricValue,children:t}),l.jsx("div",{className:Mn.metricHint,children:s})]})}function rpt({rank:e,model:t,color:n}){const{t:s}=lt(),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:Mn.modelRow,children:[l.jsxs("div",{className:Mn.modelHead,children:[l.jsx("span",{className:Mn.modelRank,style:{color:n},children:String(e).padStart(2,"0")}),l.jsxs("div",{className:Mn.modelMeta,children:[l.jsx("div",{className:Mn.modelName,children:t.model}),l.jsx("div",{className:Mn.modelSub,children:s("daemon.usage.modelMeta",{tokens:H1(t.totalTokens),cache:Math.round(i)})})]}),l.jsxs("span",{className:Mn.modelShare,style:{color:n},children:[Math.round(r),"%"]})]}),l.jsx("div",{className:Mn.modelTrack,children:l.jsx("div",{className:Mn.modelFill,style:{width:`${r}%`,background:n},children:l.jsx("div",{className:Mn.modelFillCache,style:{width:`${i}%`}})})})]})}function ipt({points:e,format:t,locale:n}){const s=Math.max(1,...e.map(r=>r.value));return l.jsxs("div",{className:Mn.bars,children:[l.jsx("div",{className:Mn.barsBody,children:e.map((r,i)=>l.jsx("div",{className:Mn.barCol,title:`${$E(r.label,n)} · ${t(r.value)}`,children:l.jsx("div",{className:Mn.bar,style:{height:`${r.value/s*100}%`}})},`${r.label}-${i}`))}),e.length>1&&l.jsxs("div",{className:Mn.barsCaption,children:[l.jsx("span",{children:$E(e[0].label,n)}),l.jsx("span",{children:$E(e[e.length-1].label,n)})]})]})}function opt(){const{t:e,language:t}=lt(),[n,s]=h.useState("today"),{dashboard:r,loading:i,error:o,reload:a}=ube({range:n,heatmapDays:Qmt,autoLoad:!0}),c=l.jsx("div",{className:Mn.segmented,role:"group","aria-label":e("daemon.usage.rangeGroup"),children:Jmt.map(w=>l.jsx("button",{type:"button",className:`${Mn.segment} ${w===n?Mn.segmentActive:""}`,"aria-pressed":w===n,onClick:()=>s(w),children:e(Zmt[w])},w))});if(!r)return l.jsxs("div",{className:Mn.usage,children:[l.jsx("div",{className:Mn.toolbar,children:c}),i?l.jsx("div",{className:Mn.state,children:e("daemon.usage.loading")}):o?l.jsxs("div",{className:Mn.state,children:[e("daemon.usage.failed"),": ",o.message]}):l.jsx("div",{className:Mn.state,children:e("daemon.usage.empty")})]});const{summary:u,models:d,skills:f,daily:m,heatmap:p,heatmapDays:g}=r,b=u.linesAdded+u.linesRemoved,v=u.totalTokens>0||Object.keys(p).length>0,y=e(tpt[r.range]);return l.jsxs("div",{className:Mn.usage,"aria-busy":i,children:[l.jsx("div",{className:Mn.toolbar,children:c}),l.jsxs("header",{className:Mn.hero,children:[l.jsxs("div",{className:Mn.heroMain,children:[l.jsx("div",{className:Mn.heroLabel,children:e(ept[r.range])}),l.jsx("div",{className:Mn.heroNumber,children:H1(u.totalTokens)}),l.jsx("div",{className:Mn.heroSub,children:e("daemon.usage.tokensConsumed")})]}),l.jsx("button",{type:"button",className:Mn.refresh,onClick:()=>void a(),disabled:i,children:e("daemon.refresh")})]}),l.jsxs("div",{className:Mn.stats,children:[l.jsx(p2,{label:e("daemon.usage.sessions"),value:u.sessions}),l.jsx(p2,{label:e("daemon.usage.requests"),value:u.requests}),l.jsx(p2,{label:e("daemon.usage.tools"),value:u.toolCalls}),l.jsx(p2,{label:e("daemon.usage.changes"),value:b})]}),l.jsxs("section",{className:Mn.section,children:[l.jsx("h4",{className:Mn.sectionTitle,children:e("daemon.usage.breakdownTitle")}),l.jsxs("div",{className:Mn.breakdown,children:[l.jsx(BE,{accent:"input",value:H1(u.inputTokens),label:e("daemon.usage.inputTokens"),hint:e("daemon.usage.inputHint")}),l.jsx(BE,{accent:"output",value:H1(u.outputTokens+u.thoughtsTokens),label:e("daemon.usage.outputTokens"),hint:e("daemon.usage.outputHint")}),l.jsx(BE,{accent:"cache",value:`${Math.round(u.cacheReadRate*100)}%`,label:e("daemon.usage.cacheRead"),hint:e("daemon.usage.cacheHint")})]})]}),l.jsxs("section",{className:Mn.section,children:[l.jsx("h4",{className:Mn.sectionTitle,children:e("daemon.usage.heatmapTitle")}),l.jsx("div",{className:Mn.sectionSub,children:e("daemon.usage.heatmapSub",{months:Yce})}),v?l.jsx(smt,{heatmap:p,days:g}):l.jsx("div",{className:Mn.state,children:e("daemon.usage.empty")})]}),d.length>0&&l.jsxs("section",{className:Mn.section,children:[l.jsxs("h4",{className:Mn.sectionTitle,children:[y," ",e("daemon.usage.modelShareTitle")]}),l.jsx("div",{className:Mn.sectionSub,children:e("daemon.usage.modelShareSub")}),l.jsx("div",{className:Mn.modelList,children:d.map((w,x)=>l.jsx(rpt,{rank:x+1,model:w,color:CV[x%CV.length]},w.model))})]}),f.length>0&&l.jsxs("section",{className:Mn.section,children:[l.jsxs("h4",{className:Mn.sectionTitle,children:[y," ",e("daemon.usage.skillTitle")]}),l.jsx("div",{className:Mn.sectionSub,children:e("daemon.usage.skillSub")}),l.jsxs("table",{className:Mn.skillTable,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:e("daemon.usage.skillName")}),l.jsx("th",{className:Mn.right,children:e("daemon.usage.skillCount")})]})}),l.jsx("tbody",{children:f.map(w=>l.jsxs("tr",{children:[l.jsx("td",{children:w.name}),l.jsx("td",{className:Mn.right,children:w.count.toLocaleString()})]},w.name))})]})]}),m.length>1&&l.jsxs("section",{className:Mn.section,children:[l.jsxs("h4",{className:Mn.sectionTitle,children:[y," ",e("daemon.usage.dailyTokensTitle")]}),l.jsx("div",{className:Mn.sectionSub,children:e("daemon.usage.dailyTokensSub")}),l.jsx(Kce,{series:[{label:e("daemon.usage.tokensConsumed"),values:m.map(w=>w.tokens),color:"var(--agent-blue-400)"}],timestamps:m.map(w=>npt(w.date)),format:H1,formatTime:w=>spt(w,t),ariaLabel:e("daemon.usage.dailyTokensTitle"),peakLabel:e("daemon.charts.peak")})]}),m.length>1&&l.jsxs("section",{className:Mn.section,children:[l.jsxs("h4",{className:Mn.sectionTitle,children:[y," ",e("daemon.usage.dailySessionsTitle")]}),l.jsx("div",{className:Mn.sectionSub,children:e("daemon.usage.dailySessionsSub")}),l.jsx(ipt,{points:m.map(w=>({label:w.date,value:w.sessions})),format:w=>w.toLocaleString(),locale:t})]})]})}const apt="_dialog_lw868_4",lpt="_toolbar_lw868_12",cpt="_toolbarActions_lw868_19",upt="_updatedAt_lw868_26",dpt="_refreshError_lw868_31",hpt="_refreshButton_lw868_36",fpt="_badge_lw868_51",mpt="_levelOk_lw868_61",ppt="_levelWarning_lw868_66",gpt="_levelError_lw868_71",bpt="_levelUnavailable_lw868_76",ypt="_tabs_lw868_81",wpt="_tab_lw868_81",vpt="_tabActive_lw868_106",xpt="_grid_lw868_114",kpt="_chartsGrid_lw868_113",_pt="_card_lw868_128",Spt="_cardTitle_lw868_135",Cpt="_cardHeader_lw868_147",Tpt="_infoHint_lw868_162",Ept="_infoHintButton_lw868_168",jpt="_infoHintTip_lw868_197",Apt="_row_lw868_231",Npt="_rowLabel_lw868_240",Mpt="_rowValue_lw868_244",Ipt="_pathRow_lw868_253",Rpt="_pathValue_lw868_247",Dpt="_empty_lw868_274",Ppt="_issueRow_lw868_279",Lpt="_issueMessage_lw868_286",Opt="_featureChips_lw868_290",$pt="_featureChip_lw868_290",Bpt="_summaryChip_lw868_311",zpt="_sessionRow_lw868_320",Fpt="_sessionName_lw868_329",Hpt="_sessionMeta_lw868_335",qpt="_activePrompt_lw868_344",Upt="_workspaceRow_lw868_348",Wpt="_workspaceRowHead_lw868_357",Vpt="_workspaceName_lw868_363",Gpt="_workspaceDuration_lw868_367",Kpt="_workspaceError_lw868_374",Ypt="_workspaceSummary_lw868_381",Xpt="_workspaceCell_lw868_388",Qpt="_workspaceCellLabel_lw868_397",Jpt="_workspaceCellMessage_lw868_402",wn={dialog:apt,toolbar:lpt,toolbarActions:cpt,updatedAt:upt,refreshError:dpt,refreshButton:hpt,badge:fpt,levelOk:mpt,levelWarning:ppt,levelError:gpt,levelUnavailable:bpt,tabs:ypt,tab:wpt,tabActive:vpt,grid:xpt,chartsGrid:kpt,card:_pt,cardTitle:Spt,cardHeader:Cpt,infoHint:Tpt,infoHintButton:Ept,infoHintTip:jpt,row:Apt,rowLabel:Npt,rowValue:Mpt,pathRow:Ipt,pathValue:Rpt,empty:Dpt,issueRow:Ppt,issueMessage:Lpt,featureChips:Opt,featureChip:$pt,summaryChip:Bpt,sessionRow:zpt,sessionName:Fpt,sessionMeta:Hpt,activePrompt:qpt,workspaceRow:Upt,workspaceRowHead:Wpt,workspaceName:Vpt,workspaceDuration:Gpt,workspaceError:Kpt,workspaceSummary:Ypt,workspaceCell:Xpt,workspaceCellLabel:Qpt,workspaceCellMessage:Jpt},Zpt=5e3,r1=[{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 Xce(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 xm(e){return e=Math.max(0,e),e>=6e4?Xce(e):e>=1e3?`${(e/1e3).toFixed(e%1e3===0?0:1)}s`:`${e}ms`}function A3(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 _w(e){const t=Math.round(e);return t>=1e4?`${(t/1e3).toFixed(t%1e3===0?0:1)}k`:t.toLocaleString()}function e0t(e){return`${e.toFixed(e>=100||e===0?0:1)}%`}function t0t(e){return e.exitCode!=null?`${e.state} (exit ${e.exitCode})`:e.signal?`${e.state} (${e.signal})`:e.state}function TV(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const n0t=["cells","servers","errors","skills","tools","providers","hooks","extensions","budgets"];function s0t(e){if(!TV(e))return[];const t=[];for(const n of n0t){const s=e[n];if(Array.isArray(s))for(const r of s){if(!TV(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 ZM(e){switch(e){case"ok":return wn.levelOk;case"warning":return wn.levelWarning;case"error":return wn.levelError;default:return wn.levelUnavailable}}function Er({label:e,value:t}){return l.jsxs("div",{className:wn.row,children:[l.jsx("span",{className:wn.rowLabel,children:e}),l.jsx("span",{className:wn.rowValue,children:t})]})}function r0t({text:e}){return l.jsxs("span",{className:wn.infoHint,children:[l.jsx("button",{type:"button",className:wn.infoHintButton,"aria-label":e,children:l.jsx("span",{"aria-hidden":"true",children:"ⓘ"})}),l.jsx("span",{"aria-hidden":"true",className:wn.infoHintTip,children:e})]})}function eu({title:e,help:t,children:n}){return l.jsxs("section",{className:wn.card,children:[t?l.jsxs("div",{className:wn.cardHeader,children:[l.jsx("h3",{className:wn.cardTitle,children:e}),l.jsx(r0t,{text:t})]}):l.jsx("h3",{className:wn.cardTitle,children:e}),n]})}function i0t({name:e,section:t}){const{t:n}=lt(),s=Object.entries(t.summary??{}),r=s0t(t.data);return l.jsxs("div",{className:wn.workspaceRow,children:[l.jsxs("div",{className:wn.workspaceRowHead,children:[l.jsx("span",{className:`${wn.badge} ${ZM(t.status)}`,children:n(`daemon.level.${t.status}`)}),l.jsx("span",{className:wn.workspaceName,children:e}),l.jsx("span",{className:wn.workspaceDuration,children:xm(t.durationMs)})]}),t.error&&l.jsx("div",{className:wn.workspaceError,children:t.error.message}),r.map((i,o)=>l.jsxs("div",{className:wn.workspaceCell,children:[l.jsx("span",{className:`${wn.badge} ${ZM(i.status)}`,children:n(`daemon.level.${i.status}`)}),l.jsx("span",{className:wn.workspaceCellLabel,children:i.label}),i.message&&l.jsx("span",{className:wn.workspaceCellMessage,children:i.message})]},`${i.label}-${o}`)),s.length>0&&l.jsx("div",{className:wn.workspaceSummary,children:s.map(([i,o])=>l.jsxs("span",{className:wn.summaryChip,children:[i,": ",o===null?n("common.na"):String(o)]},i))})]})}function o0t({report:e}){const{t}=lt(),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(eu,{title:t("daemon.full.sessions.title"),children:n.sessions.length===0?l.jsx("div",{className:wn.empty,children:t("daemon.full.sessions.empty")}):n.sessions.map(r=>l.jsxs("div",{className:wn.sessionRow,children:[l.jsx("div",{className:wn.sessionName,children:r.displayName||r.sessionId}),l.jsxs("div",{className:wn.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:wn.activePrompt,children:t("daemon.full.session.prompting")})]})]},r.sessionId))}),l.jsx(eu,{title:t("daemon.full.workspace.title"),children:s.length===0?l.jsx("div",{className:wn.empty,children:t("daemon.full.workspace.empty")}):s.map(([r,i])=>l.jsx(i0t,{name:r,section:i},r))}),l.jsxs(eu,{title:t("daemon.full.auth.title"),children:[l.jsx(Er,{label:t("daemon.full.auth.providers"),value:n.auth.supportedDeviceFlowProviders.join(", ")||t("daemon.none")}),l.jsx(Er,{label:t("daemon.full.auth.pending"),value:n.auth.pendingDeviceFlowCount}),l.jsx(Er,{label:t("daemon.full.acp.title"),value:n.acpConnections.length})]})]})}function a0t({series:e}){const{t}=lt();if(e.length===0)return l.jsx(eu,{title:t("daemon.charts.title"),children:l.jsx("div",{className:wn.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(eu,{title:t(i),help:t(c),children:l.jsx(Kce,{series:a,timestamps:s,format:o,ariaLabel:t(i),peakLabel:t("daemon.charts.peak")})});return l.jsxs("div",{className:`${wn.grid} ${wn.chartsGrid}`,children:[r("daemon.charts.concurrency",_w,[{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",_w,[{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",xm,[{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",xm,[{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",_w,[{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",xm,[{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",xm,[{label:t("daemon.charts.eventLoopLag"),values:n(i=>i.eventLoopLagP99Ms),color:"var(--error-color)"}],"daemon.charts.eventLoop.help"),r("daemon.charts.cpu",e0t,[{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",A3,[{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",A3,[{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",_w,[{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",_w,[{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 l0t(){var S;const{t:e}=lt(),[t,n]=h.useState("overview"),s=h.useRef([]),r=(R,A)=>{var M;let O;if(R.key==="ArrowRight"||R.key==="ArrowDown")O=(A+1)%r1.length;else if(R.key==="ArrowLeft"||R.key==="ArrowUp")O=(A-1+r1.length)%r1.length;else if(R.key==="Home")O=0;else if(R.key==="End")O=r1.length-1;else return;R.preventDefault(),n(r1[O].id),(M=s.current[O])==null||M.focus()},i=xA({autoLoad:!0,detail:"summary"}),o=xA({autoLoad:!0,detail:"full"}),a=i.reload,c=o.reload,u=h.useRef(!1);h.useEffect(()=>{const R=window.setInterval(()=>{document.hidden||u.current||(u.current=!0,a().finally(()=>{u.current=!1}))},Zpt);return()=>window.clearInterval(R)},[a]);const d=h.useCallback(()=>{a(),c()},[a,c]),f=i.report??o.report,m=o.report,p=i.loading||o.loading,g=i.error??o.error;if(!f)return l.jsx("div",{className:wn.dialog,children:l.jsx("div",{className:wn.empty,children:g?`${e("daemon.loadFailed")}: ${g.message}`:e("daemon.loading")})});const b=m??f,{daemon:v,runtime:y,security:w,limits:x,capabilities:k}=f,C=y.transport.acp,T=Object.values(y.rateLimit.rejectedSinceStart).reduce((R,A)=>R+A,0),_=R=>R===null?e("daemon.limits.unlimited"):R;return l.jsxs("div",{className:wn.dialog,children:[l.jsxs("div",{className:wn.toolbar,children:[l.jsx("span",{role:"status","aria-label":`${e("daemon.title")}: ${e(`daemon.level.${b.status}`)}`,className:`${wn.badge} ${ZM(b.status)}`,children:e(`daemon.level.${b.status}`)}),l.jsx("span",{className:wn.updatedAt,children:e("daemon.updatedAt",{time:new Date(f.generatedAt).toLocaleTimeString()})}),i.error&&i.report&&l.jsx("span",{className:wn.refreshError,children:e("daemon.loadFailed")}),l.jsx("div",{className:wn.toolbarActions,children:l.jsx("button",{type:"button",className:wn.refreshButton,onClick:d,disabled:p,children:e("daemon.refresh")})})]}),b.issues.length>0&&l.jsx(eu,{title:e("daemon.issues.title"),children:b.issues.map((R,A)=>l.jsxs("div",{className:wn.issueRow,children:[l.jsx("span",{className:`${wn.badge} ${R.severity==="error"?wn.levelError:wn.levelWarning}`,children:R.severity==="error"?e("daemon.level.error"):e("daemon.level.warning")}),l.jsx("span",{className:wn.issueMessage,children:R.message})]},`${R.code}-${A}`))}),l.jsx("div",{className:wn.tabs,role:"tablist","aria-label":e("daemon.title"),children:r1.map((R,A)=>l.jsx("button",{ref:O=>{s.current[A]=O},type:"button",role:"tab",id:`daemon-tab-${R.id}`,"aria-selected":R.id===t,"aria-controls":`daemon-tabpanel-${R.id}`,tabIndex:R.id===t?0:-1,className:`${wn.tab} ${R.id===t?wn.tabActive:""}`,onClick:()=>n(R.id),onKeyDown:O=>r(O,A),children:e(R.labelKey)},R.id))}),t==="overview"&&l.jsxs("div",{role:"tabpanel",id:"daemon-tabpanel-overview","aria-labelledby":"daemon-tab-overview",tabIndex:0,className:wn.grid,children:[l.jsxs(eu,{title:e("daemon.overview.title"),children:[v.qwenCodeVersion&&l.jsx(Er,{label:e("daemon.overview.version"),value:v.qwenCodeVersion}),l.jsx(Er,{label:e("daemon.overview.pid"),value:v.pid}),l.jsx(Er,{label:e("daemon.overview.mode"),value:v.mode}),l.jsx(Er,{label:e("daemon.overview.uptime"),value:Xce(v.uptimeMs)}),l.jsxs("div",{className:wn.pathRow,children:[l.jsx("span",{className:wn.rowLabel,children:e("daemon.overview.workspace")}),l.jsx("span",{className:wn.pathValue,title:v.workspaceCwd,children:l.jsx("bdi",{children:v.workspaceCwd})})]})]}),l.jsxs(eu,{title:e("daemon.runtime.title"),children:[y.error?l.jsxs("div",{className:wn.workspaceError,children:[e("daemon.runtime.startFailed"),": ",y.error]}):y.loading?l.jsx("div",{className:wn.empty,children:e("daemon.runtime.startingUp")}):null,l.jsx(Er,{label:e("daemon.runtime.activeSessions"),value:y.sessions.active}),y.activity&&l.jsxs(l.Fragment,{children:[l.jsx(Er,{label:e("daemon.runtime.activePrompts"),value:y.activity.activePrompts}),l.jsx(Er,{label:e("daemon.runtime.idle"),value:y.activity.idleSinceMs===null?e("daemon.runtime.noActivity"):xm(y.activity.idleSinceMs)})]}),l.jsx(Er,{label:e("daemon.runtime.pendingPermissions"),value:y.permissions.pending}),l.jsx(Er,{label:e("daemon.runtime.permissionPolicy"),value:y.permissions.policy}),l.jsx(Er,{label:e("daemon.runtime.channel"),value:y.channel.live?e("daemon.runtime.channelLive"):e("daemon.runtime.channelDown")}),y.channelWorker.enabled&&l.jsxs(l.Fragment,{children:[l.jsx(Er,{label:e("daemon.runtime.channelWorker"),value:t0t(y.channelWorker)}),y.channelWorker.error&&l.jsx("div",{className:wn.workspaceError,children:y.channelWorker.error}),(y.channelWorker.restartCount??0)>0&&l.jsx(Er,{label:e("daemon.runtime.channelWorkerRestarts"),value:y.channelWorker.restartCount})]}),l.jsx(Er,{label:e("daemon.runtime.memory"),value:`${A3(y.process.rss)} / ${A3(y.process.heapUsed)}`})]}),l.jsxs(eu,{title:e("daemon.transport.title"),children:[l.jsx(Er,{label:e("daemon.transport.restSse"),value:y.transport.restSseActive}),C.enabled?l.jsxs(l.Fragment,{children:[l.jsx(Er,{label:e("daemon.transport.acpConnections"),value:C.connections}),l.jsx(Er,{label:e("daemon.transport.acpStreams"),value:`${C.sessionStreams} / ${C.sseStreams} / ${C.wsStreams}`}),l.jsx(Er,{label:e("daemon.transport.pendingRequests"),value:C.pendingClientRequests})]}):l.jsx("div",{className:wn.empty,children:e("daemon.transport.acpDisabled")}),l.jsx(Er,{label:e("daemon.transport.rateLimitRejected"),value:y.rateLimit.enabled?T:e("common.disabled")})]}),l.jsxs(eu,{title:e("daemon.security.title"),children:[l.jsx(Er,{label:e("daemon.security.token"),value:w.tokenConfigured?e("daemon.security.configured"):e("daemon.security.notConfigured")}),l.jsx(Er,{label:e("daemon.security.requireAuth"),value:w.requireAuth?e("common.enabled"):e("common.disabled")}),l.jsx(Er,{label:e("daemon.security.loopback"),value:w.loopbackBind?e("common.enabled"):e("common.disabled")}),l.jsx(Er,{label:e("daemon.security.allowOrigin"),value:w.allowOriginMode}),l.jsx(Er,{label:e("daemon.security.shell"),value:w.sessionShellCommandEnabled?e("common.enabled"):e("common.disabled")})]}),l.jsxs(eu,{title:e("daemon.limits.title"),children:[l.jsx(Er,{label:e("daemon.limits.maxSessions"),value:_(x.maxSessions)}),l.jsx(Er,{label:e("daemon.limits.maxPendingPrompts"),value:_(x.maxPendingPromptsPerSession)}),l.jsx(Er,{label:e("daemon.limits.maxConnections"),value:_(x.listenerMaxConnections)}),l.jsx(Er,{label:e("daemon.limits.eventRing"),value:x.eventRingSize}),l.jsx(Er,{label:e("daemon.limits.promptDeadline"),value:x.promptDeadlineMs===null?e("daemon.limits.unlimited"):xm(x.promptDeadlineMs)}),l.jsx(Er,{label:e("daemon.limits.sessionIdle"),value:xm(x.sessionIdleTimeoutMs)})]}),l.jsx(eu,{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:wn.empty,children:e("daemon.none")}):l.jsx("div",{className:wn.featureChips,children:[...k.features].sort().map(R=>l.jsx("span",{className:wn.featureChip,children:R},R))})})]}),t==="usage"&&l.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-usage","aria-labelledby":"daemon-tab-usage",tabIndex:0,children:l.jsx(df,{label:"daemon-usage",fallback:l.jsx("div",{className:wn.empty,children:e("daemon.usage.failed")}),children:l.jsx(opt,{})})}),t==="metrics"&&l.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-metrics","aria-labelledby":"daemon-tab-metrics",tabIndex:0,children:l.jsx(a0t,{series:((S=f.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(df,{label:"daemon-status-detail",fallback:l.jsx("div",{className:wn.empty,children:e("daemon.details.failed")}),children:m!=null&&m.full?l.jsx(o0t,{report:m}):o.loading?l.jsx("div",{className:wn.empty,children:e("daemon.details.loading")}):o.error?l.jsxs("div",{className:wn.empty,children:[e("daemon.details.failed"),": ",o.error.message]}):l.jsx("div",{className:wn.empty,children:e("daemon.details.failed")})})})]})}function c0t(){const{t:e}=lt();return l.jsx(df,{label:"daemon-status",fallback:t=>l.jsx("div",{className:wn.dialog,children:l.jsxs("div",{className:wn.empty,children:[e("daemon.loadFailed"),": ",t.message]})}),children:l.jsx(l0t,{})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Qce="split",Om=6;function u0t(e,t,n){const s=new URL(t);return s.pathname="/",s.searchParams.set(Qce,e.join(",")),n&&(s.hash=new URLSearchParams({token:n}).toString()),s.toString()}function d0t(e){const t=new URLSearchParams(e).get(Qce);return t?t.split(",").map(n=>n.trim()).filter(Boolean):[]}const IP="qwen-webshell-split-sessions";function h0t(e){const t=Array.from(new Set(e.filter(Boolean))).slice(0,Om);try{sessionStorage.setItem(IP,JSON.stringify(t))}catch{}}function f0t(){try{const e=sessionStorage.getItem(IP);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,Om):[]}catch{return[]}}function m0t(){try{sessionStorage.removeItem(IP)}catch{}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Jce(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function z5(e){var t;return((t=e.displayName)==null?void 0:t.trim())||Jce(e.cwd)}function F5(e,t){const n=t==null?void 0:t.find(s=>s.cwd===e);return n?z5(n):Jce(e)}function RP(e){var t;return(((t=e==null?void 0:e.workspaces)==null?void 0:t.length)??0)>1}function p0t(e,t){return!!e&&!!t&&e!==t}function Zce(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 g2=[];function eue(e=!0){var c;const t=io(),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]=h.useState(g2),o=h.useCallback(async()=>{const u=s?s.split(`
`):[];if(u.length===0)return g2;const d=await Promise.allSettled(u.map(m=>n.listWorkspaceSessions(m,{pageSize:Dh,archiveState:"active",sourceType:uC}))),f=[];return d.forEach((m,p)=>{m.status==="fulfilled"?f.push(...m.value):console.warn(`[useOtherWorkspaceSessions] failed to list sessions for ${u[p]}:`,m.reason)}),f.length===0?g2:f},[n,s]),a=h.useCallback(async()=>{s&&i(await o())},[s,o]);return h.useEffect(()=>{if(!s){i(d=>d.length===0?d:g2);return}let u=!1;return o().then(d=>{u||i(d)}),()=>{u=!0}},[s,o]),{sessions:r,reload:a}}function g0t(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search).get("daemon")||"";return e?_0t(e):""}let d0;const b0t="qwen-daemon-auth",y0t=2500,tue="qwen-daemon-token";function w0t(){try{return window.sessionStorage.getItem(tue)||void 0}catch{return}}function v0t(e){try{window.sessionStorage.setItem(tue,e)}catch{}}function nue(){if(d0)return d0;if(typeof window>"u")return;const t=new URLSearchParams(window.location.hash.replace(/^#/,"")).get("token")||new URLSearchParams(window.location.search).get("token")||"";return t?(v0t(t),d0=t,d0):(d0=w0t(),d0)}function x0t(e=y0t){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),d0=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)!==b0t)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 k0t(){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 _0t(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 S0t="_panel_1s6rs_1",C0t="_toolbar_1s6rs_9",T0t="_count_1s6rs_16",E0t="_selectAll_1s6rs_21",j0t="_actionButton_1s6rs_30",A0t="_refreshButton_1s6rs_50",N0t="_notice_1s6rs_61",M0t="_grid_1s6rs_71",I0t="_card_1s6rs_80",R0t="_cardCurrent_1s6rs_91",D0t="_cardTop_1s6rs_96",P0t="_cardCheckbox_1s6rs_103",L0t="_colorDot_1s6rs_108",O0t="_cardLabel_1s6rs_115",$0t="_currentBadge_1s6rs_135",B0t="_cardMeta_1s6rs_145",z0t="_metaItem_1s6rs_153",F0t="_statusBadge_1s6rs_162",H0t="_statusApproval_1s6rs_172",q0t="_statusRunning_1s6rs_181",U0t="_statusIdle_1s6rs_190",W0t="_workspaceBadge_1s6rs_202",V0t="_workspaceBadgeOther_1s6rs_218",G0t="_empty_1s6rs_223",K0t="_colorRed_1s6rs_231",Y0t="_colorOrange_1s6rs_234",X0t="_colorYellow_1s6rs_237",Q0t="_colorGreen_1s6rs_240",J0t="_colorBlue_1s6rs_243",Z0t="_colorPurple_1s6rs_246",Us={panel:S0t,toolbar:C0t,count:T0t,selectAll:E0t,actionButton:j0t,refreshButton:A0t,notice:N0t,grid:M0t,card:I0t,cardCurrent:R0t,cardTop:D0t,cardCheckbox:P0t,colorDot:L0t,cardLabel:O0t,currentBadge:$0t,cardMeta:B0t,metaItem:z0t,statusBadge:F0t,statusApproval:H0t,statusRunning:q0t,statusIdle:U0t,workspaceBadge:W0t,workspaceBadgeOther:V0t,empty:G0t,colorRed:K0t,colorOrange:Y0t,colorYellow:X0t,colorGreen:Q0t,colorBlue:J0t,colorPurple:Z0t},egt=3e3,tgt=1e4,EV={needsApproval:0,running:1,idle:2};function ngt(e,t,n,s){const r=new Map(t.map(o=>[o.sessionId,o])),i=e.map(o=>{var d,f;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:(f=a==null?void 0:a.currentModelId)!=null&&f.startsWith("qwen-route:")?void 0:a!=null&&a.currentModelId?vm(a.currentModelId):void 0,updatedAt:o.updatedAt||o.createdAt,color:o.color,isCurrent:o.sessionId===n,workspaceCwd:o.workspaceCwd,isNonPrimary:p0t(o.workspaceCwd,s)}});return i.sort((o,a)=>{const c=EV[o.status]-EV[a.status];return c!==0?c:(a.updatedAt??"").localeCompare(o.updatedAt??"")}),i}function b2(...e){return e.filter(Boolean).join(" ")}function sgt(e){switch(e){case"red":return Us.colorRed;case"orange":return Us.colorOrange;case"yellow":return Us.colorYellow;case"green":return Us.colorGreen;case"blue":return Us.colorBlue;case"purple":return Us.colorPurple;default:return}}function jV(e){switch(e){case"needsApproval":return Us.statusApproval;case"running":return Us.statusRunning;default:return Us.statusIdle}}function rgt({onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n,workspaceCwd:s}){var I,J,W;const{t:r}=lt(),i=Ra(),o=i.sessionId,a=((J=(I=i.capabilities)==null?void 0:I.features)==null?void 0:J.includes(NI))??!1,{sessions:c,loading:u,error:d,reload:f}=Pk(s,{autoLoad:!0,pageSize:Dh,archiveState:"active",...a?{view:"organized",group:"all"}:{}}),{sessions:m,reload:p}=eue(n&&!s),g=h.useMemo(()=>Zce(c,m),[c,m]),b=!s&&n&&RP(i.capabilities),v=xA({autoLoad:!0,detail:"full"}),y=v.reload,w=v.report,[x,k]=h.useState(()=>new Set),[C,T]=h.useState(!1),_=h.useRef(!1);h.useEffect(()=>{const P=window.setInterval(()=>{document.hidden||_.current||(_.current=!0,Promise.all([f(),p()]).finally(()=>{_.current=!1}))},egt);return()=>window.clearInterval(P)},[f,p]);const S=h.useRef(!1);h.useEffect(()=>{const P=window.setInterval(()=>{document.hidden||S.current||(S.current=!0,y().finally(()=>{S.current=!1}))},tgt);return()=>window.clearInterval(P)},[y]);const R=(W=i.capabilities)==null?void 0:W.workspaceCwd,A=h.useMemo(()=>{var P;return ngt(g,((P=w==null?void 0:w.full)==null?void 0:P.sessions)??[],o,R)},[g,w,o,R]),O=h.useCallback(P=>{k(V=>{const ee=new Set(V);return ee.has(P)?ee.delete(P):ee.add(P),ee})},[]),M=A.map(P=>P.sessionId).filter(P=>x.has(P)),D=M.length,$=A.length>0&&D===A.length,z=M.slice(0,Om),B=D>Om,j=h.useCallback(()=>{k(P=>{const V=A.map(q=>q.sessionId);return V.length>0&&V.every(q=>P.has(q))?new Set:new Set(V)})},[A]);h.useEffect(()=>{k(P=>{if(P.size===0)return P;const V=new Set(A.map(K=>K.sessionId));let ee=!1;const q=new Set;for(const K of P)V.has(K)?q.add(K):ee=!0;return ee?q:P})},[A]);const H=h.useCallback(()=>{if(z.length===0)return;const P=u0t(z,window.location.href,nue()),V=window.open(P,"_blank");V&&(V.opener=null,V.focus()),T(!V)},[z]),Q=h.useCallback(()=>{f(),p(),y()},[f,p,y]);return A.length===0?l.jsx("div",{className:Us.panel,children:l.jsx("div",{className:Us.empty,children:u?r("sessionsOverview.loading"):d?`${r("sessionsOverview.loadFailed")}: ${d.message}`:r("sessionsOverview.empty")})}):l.jsxs("div",{className:Us.panel,children:[l.jsxs("div",{className:Us.toolbar,children:[l.jsx("span",{className:Us.count,children:r("sessionsOverview.count",{count:A.length})}),l.jsxs("label",{className:Us.selectAll,children:[l.jsx("input",{type:"checkbox",checked:$,onChange:j}),r("sessionsOverview.selectAll")]}),l.jsx("button",{type:"button",className:Us.actionButton,disabled:D===0,onClick:H,title:r("sessionsOverview.openInTabHint"),children:r("sessionsOverview.openInTab")}),t&&l.jsx("button",{type:"button",className:Us.actionButton,disabled:D===0,onClick:()=>t(z),title:r("sessionsOverview.openInSplitHint"),children:r("sessionsOverview.openInSplit")}),l.jsx("button",{type:"button",className:Us.refreshButton,onClick:Q,children:r("sessionsOverview.refresh")})]}),B&&l.jsx("div",{className:Us.notice,role:"status",children:r("sessionsOverview.splitCap",{max:Om})}),C&&l.jsx("div",{className:Us.notice,role:"alert",children:r("sessionsOverview.popupBlocked")}),d&&l.jsxs("div",{className:Us.notice,role:"alert",children:[r("sessionsOverview.loadFailed"),": ",d.message]}),l.jsx("ul",{className:Us.grid,children:A.map(P=>{var V;return l.jsxs("li",{className:b2(Us.card,jV(P.status),P.isCurrent&&Us.cardCurrent),children:[l.jsxs("div",{className:Us.cardTop,children:[l.jsx("input",{type:"checkbox",className:Us.cardCheckbox,checked:x.has(P.sessionId),onChange:()=>O(P.sessionId),"aria-label":r("sessionsOverview.selectSession",{name:P.label})}),P.color&&l.jsx("span",{className:b2(Us.colorDot,sgt(P.color)),"aria-hidden":"true"}),l.jsx("button",{type:"button",className:Us.cardLabel,onClick:()=>e(P.sessionId),title:P.label,children:P.label}),P.isCurrent&&l.jsx("span",{className:Us.currentBadge,children:r("sessionsOverview.current")})]}),l.jsxs("div",{className:Us.cardMeta,children:[l.jsx("span",{className:b2(Us.statusBadge,jV(P.status)),children:r(`sessionsOverview.status.${P.status}`)}),b&&l.jsx("span",{className:b2(Us.workspaceBadge,P.isNonPrimary&&Us.workspaceBadgeOther),title:P.workspaceCwd,children:F5(P.workspaceCwd,(V=i.capabilities)==null?void 0:V.workspaces)}),P.model&&l.jsx("span",{className:Us.metaItem,title:P.model,children:P.model}),P.clientCount>0&&l.jsx("span",{className:Us.metaItem,title:r("sessionsOverview.openElsewhere"),children:r("common.clients",{count:P.clientCount})}),P.updatedAt&&l.jsx("span",{className:Us.metaItem,children:Lx(P.updatedAt,r)})]})]},P.sessionId)})})]})}function igt({onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n=!0,workspaceCwd:s}){const{t:r}=lt();return l.jsx(df,{label:"session-overview",fallback:i=>l.jsx("div",{className:Us.panel,children:l.jsxs("div",{className:Us.empty,children:[r("sessionsOverview.loadFailed"),": ",i.message]})}),children:l.jsx(rgt,{onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n,workspaceCwd:s})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function ogt(e){const t=new Map;for(const n of e){if(n.kind!=="assistant")continue;const s=Po(n.meta);if((s==null?void 0:s.source)!=="background_notification"||s.qwenDiscreteMessage!==!0)continue;const r=Po(s.backgroundTask),i=Sa(r,"toolUseId"),o=Sa(r,"status");(r==null?void 0:r.kind)!=="agent"||!i||!o||t.set(i,{status:o,endTime:n.serverTimestamp??n.clientReceivedAt})}return t}function agt(e,t){if(t)switch(t.status){case"completed":e.status="completed",e.endTime=t.endTime;break;case"failed":e.status="failed",e.endTime=t.endTime;break;case"cancelled":case"canceled":e.status="completed",e.endTime=t.endTime,e.rawOutput={...Po(e.rawOutput)??{},status:"cancelled"};break}}function lgt(e){return e.startsWith("language_changed (unrecognized daemon event):")||e.startsWith("session_cwd_changed (unrecognized daemon event):")||e.startsWith("Model switched: ")}function cgt(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 ugt(e,t){return e===void 0?{}:t?{data:{...Po(e)??{value:e},errorKind:t}}:{data:e}}function dgt(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 hgt(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 AV(e){var n;return((n=e.meta)==null?void 0:n.source)==="background_notification"}function NV(e){var n;return Po((n=e.meta)==null?void 0:n.backgroundTask)??void 0}function MV(e){return e.text.length===0}function fgt(e){const t=e.flatMap((n,s)=>{const r=Po(n),i=Sa(r,"content");return i?[{id:Sa(r,"id")??`plan-${s}`,content:i,status:wgt(Sa(r,"status")),...(()=>{const a=vgt(Sa(r,"priority"));return a?{priority:a}:{}})()}]:[]});return t.length>0?t:void 0}function IV(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 mgt(e,t={}){var d,f,m;const n=[],s=((d=t.labels)==null?void 0:d.promptCancelled)??"Request cancelled.",r=new Map,i=new Map,o=ogt(e);let a=null,c=null,u=!1;for(let p=0;p<e.length;p++){const g=e[p],b=g.serverTimestamp??g.clientReceivedAt;switch(g.kind){case"user":{const v=g;if(AV(v)){a=null,c=null,u=!0,n.push({id:g.id,role:"system",content:v.text,variant:"info",source:"background_notification",data:NV(v),timestamp:b});break}a=null,c=null,u=!1;const y=Po(v.meta),w=Sa(y,"source"),x=Array.isArray(y==null?void 0:y.inputAnnotations)?y.inputAnnotations:void 0,k={id:g.id,role:"user",content:v.text,timestamp:b,...w?{source:w}:{},...x?{inputAnnotations:x}:{}};v.images&&v.images.length>0&&(k.images=v.images.map(C=>({data:C.data,mimeType:C.mimeType||"image/*"}))),n.push(k);break}case"assistant":{const v=g;if(AV(v)){a=null,c=null,u=!0,n.push({id:g.id,role:"system",content:v.text,variant:"info",source:"background_notification",data:NV(v),timestamp:b});break}if(!v.text&&!v.usage)break;const y=v.parentToolCallId?r.get(v.parentToolCallId):void 0;if(y){RV(y,v.text);break}const w=Rgt(v.text);if(w){let k=null,C=!1,T=0,_=0;for(const S of w)S.kind==="insight"?S.data.type==="insight_progress"?k=S.data:S.data.type==="insight_ready"?(C=!0,n.push({id:`${g.id}-ir-${T++}`,role:"insight_ready",path:S.data.path,timestamp:b})):S.data.type==="insight_error"&&(C=!0,n.push({id:`${g.id}-ie-${_++}`,role:"insight_error",error:S.data.error,timestamp:b})):(n.push({id:`${g.id}-t-${n.length}`,role:"assistant",content:S.text,timestamp:b}),a=n.length-1,c=null);k&&!C&&n.push({id:`${g.id}-ip`,role:"insight_progress",stage:k.stage,progress:k.progress,detail:k.detail,timestamp:b}),u=!0;break}const x=a!==null?n[a]:void 0;if(x&&x.role==="assistant"&&!u&&!MV(v)){const k=IV(x.usage,v.usage);n[a]={...x,content:x.content+v.text,isStreaming:v.streaming,...k?{usage:k}:{}},u=!1,c=null}else if(!MV(v))n.push({id:g.id,role:"assistant",content:v.text,isStreaming:v.streaming,timestamp:b,...v.usage?{usage:v.usage}:{}}),a=n.length-1,c=null,u=!1;else if(v.usage&&x&&x.role==="assistant"){const k=IV(x.usage,v.usage);n[a]={...x,...k?{usage:k}:{}}}break}case"thought":{const v=g,y=v.parentToolCallId?r.get(v.parentToolCallId):void 0;if(y){RV(y,v.text);break}const w=c!==null?n[c]:void 0;w&&w.role==="thinking"&&!u?(n[c]={...w,content:w.content+v.text,isStreaming:v.streaming},u=!1):(n.push({id:g.id,role:"thinking",content:v.text,isStreaming:v.streaming,timestamp:b}),c=n.length-1,u=!1),a=null;break}case"tool":{const y=xgt(g);agt(y,o.get(y.callId));const w=i.get(y.callId);w!=null&&w.title&&(y.title=w.title),!y.args&&(w!=null&&w.args)&&(y.args=w.args);const x=y.parentToolCallId?r.get(y.parentToolCallId):void 0,k=r.get(y.callId);if(k){DV(k,y);break}if(x){pgt(x,y),r.set(y.callId,y);break}zE(n,g.id,y,b),r.set(y.callId,y),a=null,c=null,u=!0;break}case"shell":{const v=g,y=n[n.length-1];if(y&&y.role==="tool_group"){const w=ggt(y.tools),x=y.tools[w];if(x){const k=typeof x.rawOutput=="string"?x.rawOutput:"",C={...x,rawOutput:k+v.text};n[n.length-1]={...y,tools:[...y.tools.slice(0,w),C,...y.tools.slice(w+1)]},r.get(x.callId)===x&&r.set(x.callId,C)}}else n.push({id:g.id,role:"tool_group",tools:[{callId:g.id,toolName:"shell",status:"completed",kind:"execute",rawOutput:v.text}],timestamp:b}),u=!0;break}case"user_shell":{const v=g;n.push({id:g.id,role:"user_shell",command:v.command,output:v.text,...v.cwd?{cwd:v.cwd}:{},timestamp:b}),u=!0;break}case"permission":{const v=g;_gt(v,i);const y=kgt(v);if(!y)break;const w=sue(y);if(!v.resolved)break;const x=r.get(y.callId);if(x){const k=x.status;y.toolName=x.toolName,v.resolved&&(FE(v.resolved)?y.status=w?y.status:"in_progress":(y.status="failed",y.endTime=v.updatedAt)),DV(x,y),v.resolved&&w&&FE(v.resolved)&&(x.status=k);break}if(v.resolved){FE(v.resolved)?(w||(y.status="in_progress"),zE(n,g.id,y,b),r.set(y.callId,y),u=!0):(y.status="failed",y.endTime=v.updatedAt,zE(n,g.id,y,b),r.set(y.callId,y),u=!0);break}break}case"status":case"debug":{const v=g,y=v.source==="session_branched"?dgt(v.data):null,w=v.source==="mid_turn_message_injected"?hgt(v.data):null,x=y&&((f=t.labels)!=null&&f.branchSuccess)?t.labels.branchSuccess(y):w&&((m=t.labels)!=null&&m.midTurnInserted)?t.labels.midTurnInserted(w):v.text;if(lgt(x))break;const k=ygt(x);if(k){n.push({id:g.id,role:"plan",todos:k,timestamp:b}),u=!0;break}n.push({id:g.id,role:"system",content:x,variant:"info",timestamp:b,...v.source?{source:v.source}:{},...v.data!==void 0?{data:v.data}:{}}),u=!0;break}case"error":{const v=g,y=v.errorKind;n.push({id:g.id,role:"system",content:cgt(v,t.labels),variant:"error",retryable:v.source==="turn_error",timestamp:b,...v.source?{source:v.source}:{},...ugt(v.data,y)}),u=!0;break}case"prompt_cancelled":n.push({id:g.id,role:"system",content:s,variant:"info",source:"prompt_cancelled",timestamp:b}),u=!0;break}}return n}function pgt(e,t){e.subTools||(e.subTools=[]),e.subTools.push(t)}function RV(e,t){e.subContent=(e.subContent||"")+t}function zE(e,t,n,s){const r=o=>sue(o)||Ef(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 ggt(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 DV(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 sue(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||bgt(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function bgt(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function ygt(e){const t=e.startsWith("plan: ")?e.slice(6):void 0;if(t)try{const n=JSON.parse(t),s=Po(n);return(s==null?void 0:s.sessionUpdate)!=="plan"||!Array.isArray(s.entries)?void 0:fgt(s.entries)}catch{return}}function Po(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Sa(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function wgt(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function vgt(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function xgt(e){const t=Cgt(e),n=Sgt(e,t),s=Tgt(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:iue(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 kgt(e){const t=Po(e.toolCall);if(!t)return;const n=rue(t);if(Array.isArray(n==null?void 0:n.questions))return;const s=Po(t._meta),r=Sa(t,"kind"),i=Sa(s,"toolName")??Sa(t,"toolName")??Sa(t,"name")??(n!=null&&n.subagent_type?"agent":void 0)??(r==="fetch"?"web_fetch":r),o=Sa(t,"toolCallId")??Sa(t,"id");return!o||!i?void 0:{callId:o,toolName:i,title:Sa(t,"title")??e.title,status:"pending",kind:iue(i,r),args:n,startTime:e.createdAt}}function _gt(e,t){const n=Po(e.toolCall),s=Sa(n,"toolCallId")??Sa(n,"id");if(!s)return;const r=Sa(n,"title")??e.title,i=n?rue(n):void 0;Array.isArray(i==null?void 0:i.questions)&&t.set(s,{...r?{title:r}:{},...i?{args:i}:{}})}function FE(e){const[t="",n=""]=e.toLowerCase().split(":",2);return PV(t)?!0:t!=="selected"?!1:PV(n.trim())}function PV(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 rue(e){return Po(e.rawInput)??Po(e.input)??Po(e.args)}function Sgt(e,t){var r;const n=(r=e.toolName)==null?void 0:r.toLowerCase();if(n!=="agent"&&n!=="task")return!1;const s=Po(t);return(s==null?void 0:s.status)==="background"}function Cgt(e){return Egt(e)&&e.status==="failed"?jgt(e)??e.details??e.rawOutput:!Agt(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 Tgt(e){if(!Array.isArray(e))return;const t=e.flatMap(n=>{const s=Po(n);if(!s)return[];const r=s.type;if(r==="content"){const i=Po(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 Egt(e){if(!e.toolName)return!1;const t=e.toolName.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function jgt(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 Agt(e){return e==="cancelled"||e==="canceled"}const Ngt=['"insight_progress":','"insight_ready":','"insight_error":'];function Mgt(e){try{const t=JSON.parse(e),n=Po(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=Po(t.insight_ready);if(s&&typeof s.path=="string")return{type:"insight_ready",path:s.path};const r=Po(t.insight_error);if(r&&typeof r.error=="string")return{type:"insight_error",error:r.error}}catch{}return null}function Igt(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 Rgt(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(!Ngt.some(m=>a.startsWith(m))){s=o+1;continue}const u=Igt(e,o);if(!u){s=o+1;continue}const d=Mgt(u);if(!d){s=o+1;continue}r=!0;const f=e.slice(n,o).trim();f&&t.push({kind:"text",text:f}),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 iue(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 Dgt(e,t){return mgt(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 oue(e){return e==="pending"||e==="in_progress"||e==="running"}function DP(e){return e==="completed"||e==="failed"||e==="cancelled"||e==="canceled"}function LV(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}function Pgt(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t];if(n.kind!=="assistant")continue;const s=LV(n.meta),r=LV(s==null?void 0:s.backgroundTask),i=r==null?void 0:r.status;if((s==null?void 0:s.source)==="background_notification"&&(r==null?void 0:r.kind)==="agent"&&typeof i=="string"&&DP(i))return`${n.id}:${i}`}return""}function Lgt(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const s of n.tools)oue(s.status)&&hf(s)&&t.push(s.callId);return t.join("|")}function Ogt(e,t){if(t.size===0)return e;let n=!1;const s=e.map(r=>{if(r.role!=="tool_group")return r;let i=!1;const o=r.tools.map(a=>{const c=t.get(a.callId);if(!c||!DP(c.status)||!oue(a.status)||!hf(a))return a;i=!0;const u=c.status==="cancelled"||c.status==="canceled",d=c.status==="failed"?"failed":"completed";return{...a,status:d,...a.startTime!==void 0?{endTime:a.startTime+(c.durationMs??0)}:{},...u?{rawOutput:{...typeof a.rawOutput=="object"&&a.rawOutput!==null&&!Array.isArray(a.rawOutput)?a.rawOutput:{},status:"cancelled"}}:{}}});return i?(n=!0,{...r,tools:o}):r});return n?s:e}function H5(e){const t=rk(),n=io(),s=Ra(),r=h.useMemo(()=>Dgt(t,e),[t,e]),i=h.useMemo(()=>Lgt(r),[r]),o=h.useMemo(()=>Pgt(t),[t]),[a,c]=h.useState(),u=h.useRef(void 0);return h.useEffect(()=>{const d=s.sessionId;if(!d||s.status!=="connected"||s.loadingTranscript||s.catchingUp||!i){(!d||s.status!=="connected"||s.loadingTranscript||s.catchingUp)&&(u.current=void 0);return}const f=`${d}:${i}:${o}`,m=u.current,p=i.split("|"),g=(m==null?void 0:m.key)===f?m.request:Promise.allSettled(p.map(async v=>{const y=await n.client.resolveSubagentSession(d,v);return[v,y]})).then(v=>{const y=new Map;return v.forEach(w=>{w.status==="fulfilled"&&DP(w.value[1].status)&&y.set(...w.value)}),y});u.current={key:f,request:g};let b=!0;return g.then(v=>{b&&c(y=>({sessionId:d,resolutions:new Map([...(y==null?void 0:y.sessionId)===d?y.resolutions:[],...v])}))}).catch(()=>{var v;((v=u.current)==null?void 0:v.request)===g&&(u.current=void 0)}),()=>{b=!1}},[o,s.catchingUp,s.loadingTranscript,s.sessionId,s.status,i,n.client]),h.useMemo(()=>!a||a.sessionId!==s.sessionId?r:Ogt(r,a.resolutions),[s.sessionId,r,a])}const $gt="session_artifacts";function aue(){var C,T;const e=ug(),t=Ra(),n=IQ(),s=Xd(),r=s==null?void 0:s.artifactsVersion,i=t.status==="connected",o=((T=(C=t.capabilities)==null?void 0:C.features)==null?void 0:T.includes($gt))??!1,a=t.sessionId,[c,u]=h.useState([]),[d,f]=h.useState(!1),[m,p]=h.useState(null),g=h.useRef(0),b=h.useRef(void 0),v=h.useRef(n),y=h.useRef(r),w=h.useCallback(async()=>{const _=g.current+1;if(g.current=_,!a){b.current=void 0,u([]),p(null),f(!1);return}if(!i){b.current=void 0,u([]),p(null),f(!1);return}if(!o){b.current=void 0,u([]),p(null),f(!1);return}b.current!==void 0&&b.current!==a&&u([]),f(!0);try{const S=await e.loadArtifacts();if(g.current!==_)return;b.current=a,u(S.artifacts),p(null)}catch{if(g.current!==_)return;p(null)}finally{g.current===_&&f(!1)}},[e,i,a,o]),x=h.useRef(w);x.current=w,h.useEffect(()=>{w()},[w]),h.useEffect(()=>{const _=v.current;v.current=n,_!=="idle"&&n==="idle"&&x.current()},[n]),h.useEffect(()=>{const _=y.current;y.current=r,_!==void 0&&r!==void 0&&r!==_&&x.current()},[r]);const k=h.useMemo(()=>new Map(c.map(_=>[_.id,_])),[c]);return{artifacts:c,artifactById:k,loading:d,error:m,refresh:w}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Bgt(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 zgt(e,t,n,s){return e?!0:(s.append(t),!1)}function lue(e){const t=e.trimStart();return t.startsWith("/")||t.startsWith("!")}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Fgt=100;function Hgt(e,t){return e.trim()?e===t||e.startsWith(`${t}
`)?e:`${t}
${e}`:t}function OV(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 $V(e){if(!(!e||e.length===0))return e.map(t=>({data:t.data,mimeType:t.media_type||"image/*"}))}function cue({connected:e,sessionId:t,clientId:n,streamingState:s,sessionActions:r,store:i,editorRef:o,reportError:a,notifySuccess:c,t:u}){const[d,f]=h.useState([]),m=h.useRef([]),p=h.useRef(1),g=h.useRef(t),b=h.useRef(null),v=h.useRef(new Set),y=h.useRef(new Set),w=h.useRef(new Set),x=h.useRef(new Map),k=h.useRef(new Set),C=h.useRef([]),T=h.useRef(s),_=h.useRef(0);g.current=t,T.current=s;const S=h.useMemo(()=>d.map(re=>re.text),[d]);h.useEffect(()=>{m.current=d},[d]),h.useEffect(()=>{var re;m.current=[],f([]),x.current.clear(),k.current.clear(),C.current=[];for(const ne of v.current)ne.abort();v.current.clear(),y.current.clear(),w.current.clear(),z.current=void 0,(re=b.current)==null||re.abort(),b.current=null},[t]);const R=h.useCallback((re,ne)=>{const U=m.current.filter(Z=>Z.serverPromptId?re.some(ge=>ge.promptId===Z.serverPromptId):!0);for(const Z of re){if(y.current.has(Z.promptId))continue;const ge=U.findIndex(be=>be.serverPromptId===Z.promptId),ce=w.current.has(Z.promptId);if(ge!==-1){if(ce){U.splice(ge,1);continue}U[ge]={...U[ge],text:Z.text,serverState:Z.state};continue}const ue=U.filter(be=>!be.serverPromptId&&be.serverState==="submitting"&&be.text===Z.text);if(ue.length===1){const be=U.indexOf(ue[0]);if(ce){U.splice(be,1);continue}U[be]={...ue[0],serverPromptId:Z.promptId,serverState:Z.state};continue}Z.state==="running"||ce||U.push({id:p.current++,sessionId:ne,text:Z.text,serverPromptId:Z.promptId,serverState:Z.state})}OV(m.current,U)||(m.current=U,f(U))},[]),A=h.useCallback(async(re=t)=>{if(!e||!re||g.current!==re)return"skipped";const ne=++_.current;try{const U=await r.getPendingPrompts({sessionId:re});return ne!==_.current?"superseded":g.current!==re?"skipped":(R(U.pendingPrompts.filter(Z=>Z.state==="queued"||Z.state==="running"),re),"refreshed")}catch(U){return console.warn("Failed to refresh pending prompts",U),"failed"}},[e,r,t,R]),O=h.useCallback(re=>{const ne=g.current,U=re.filter(ue=>ue.sessionId===void 0||ue.sessionId===ne);if(U.length===0)return;const Z=new Set(m.current.map(ue=>ue.id)),ge=U.filter(ue=>!Z.has(ue.id));if(ge.length===0)return;const ce=[...m.current,...ge].sort((ue,be)=>ue.id-be.id);m.current=ce,f(ce)},[]),M=h.useCallback((re,ne,U)=>{var ce,ue,be,rt;if(U!==void 0&&g.current!==U)return;const Z=((ce=o.current)==null?void 0:ce.getText())??"",ge=Hgt(Z,re);ge!==Z&&((ue=o.current)==null||ue.setText(ge),ne&&ne.length>0&&((be=o.current)==null||be.restoreImages(ne))),(rt=o.current)==null||rt.focus()},[o]),D=h.useSyncExternalStore(D1e,R1e),$=h.useRef(D),z=h.useRef(void 0);h.useEffect(()=>{if(!e||!t)return;const re=$.current!==D;if($.current=D,!re){if(m.current.length>0||s==="idle"||z.current===t)return;z.current=t}A()},[D,e,t,s,A]);const B=h.useSyncExternalStore(P1e,RB,RB);h.useEffect(()=>{var ne;if(!t||B.length===0)return;const re=[];for(const U of B){if(U.data.sessionId!==t)continue;re.push(U);const Z=U.data.promptId;if(Z){if(U.type==="pending_prompt_started"){if(y.current.has(Z))continue;if((U.originatorClientId===void 0||U.originatorClientId===n)&&!w.current.has(Z)){const ce=typeof U.data.text=="string"?U.data.text:"",ue=m.current.find(rt=>rt.serverPromptId===Z)??m.current.find(rt=>!rt.serverPromptId&&rt.serverState==="submitting"&&rt.text===ce),be=(ue==null?void 0:ue.text)??"";be&&(w.current.add(Z),i.appendLocalUserMessage(be,$V(ue==null?void 0:ue.images),(ne=ue==null?void 0:ue.inputAnnotations)!=null&&ne.length?{inputAnnotations:ue.inputAnnotations}:void 0))}A()}else if(U.type==="turn_complete"){w.current.delete(Z);const ge=x.current.get(Z);if(x.current.delete(Z),ge)ge();else if(!k.current.has(Z))for(k.current.add(Z),C.current.push(Z);C.current.length>Fgt;){const ce=C.current.shift();ce&&k.current.delete(ce)}}else if(U.type==="turn_error"||U.type==="pending_prompt_completed"&&U.data.state==="removed"){w.current.delete(Z);const ge=x.current.get(Z);x.current.delete(Z),ge==null||ge(),k.current.delete(Z),C.current=C.current.filter(ce=>ce!==Z)}}}O1e(re)},[B,t,n,i,A]);const j=h.useCallback((re,ne)=>{if(k.current.delete(re)){C.current=C.current.filter(U=>U!==re),ne();return}x.current.set(re,ne)},[]),H=h.useCallback((re,ne,U,Z)=>{const ge=re.trim();if(!ge)return!0;const ce=p.current++,ue=g.current,be=new AbortController;v.current.add(be);const rt=ne?[...ne]:void 0,le=Z?[...Z]:void 0,Me={id:ce,sessionId:ue,text:ge,images:rt,inputAnnotations:le,onComplete:U,serverState:"submitting"};return m.current=[...m.current,Me],f(m.current),r.submitPrompt(ge,{images:ne,inputAnnotations:le,optimisticUserMessage:!1,sessionId:ue,signal:be.signal}).then(We=>{if(v.current.delete(be),g.current!==ue){r.removePendingPrompt(We.promptId,{sessionId:ue}).catch(Wt=>{console.warn("[useQueuedPrompts] cleanup removePendingPrompt failed after session change",{targetSessionId:ue,promptId:We.promptId,error:Wt})});return}if(T.current==="idle"){w.current.has(We.promptId)||(w.current.add(We.promptId),i.appendLocalUserMessage(ge,$V(rt),le!=null&&le.length?{inputAnnotations:le}:void 0));const Wt=m.current.filter(zt=>zt.id!==ce);m.current=Wt,f(Wt),U&&j(We.promptId,U);return}const at=m.current,ze=at.findIndex(Wt=>Wt.id===ce);if(ze===-1){r.removePendingPrompt(We.promptId,{sessionId:ue}).then(Wt=>{Wt.removed||A(ue)},()=>{A(ue)});return}const rn=[...at];rn[ze]={...rn[ze],serverPromptId:We.promptId,serverState:"queued"},m.current=rn,f(rn),U&&j(We.promptId,U)}).catch(We=>{if(v.current.delete(be),g.current!==ue||!m.current.some(ze=>ze.id===ce))return;const at=m.current.filter(ze=>ze.id!==ce);m.current=at,f(at),M(ge,rt,ue),a(We,u("queue.queueFailed"))}),!0},[A,a,M,r,j,i,u]);h.useEffect(()=>{if(s!=="idle")return;const re=b.current;re&&(re.abort(),b.current=null)},[s]);const Q=h.useCallback(re=>{const ne=m.current;if(ne.length===0)return null;const U=re===void 0?ne.length-1:ne.findIndex(ce=>ce.id===re);if(U<0)return null;const Z=ne[U],ge=ne.filter((ce,ue)=>ue!==U);return m.current=ge,f(ge),(Z==null?void 0:Z.text)??null},[]),I=h.useCallback((re,ne)=>{const U=m.current.map(Z=>Z.id===re?{...Z,...ne}:Z);OV(U,m.current)||(m.current=U,f(U))},[]),J=h.useCallback(async(re,ne,U)=>{if(!re.serverPromptId)return!0;if(re.serverState!=="queued"||y.current.has(re.serverPromptId))return!1;const Z=re.sessionId;y.current.add(re.serverPromptId),I(re.id,ne);try{const ge=await r.removePendingPrompt(re.serverPromptId,{sessionId:Z});return y.current.delete(re.serverPromptId),ge.removed?(x.current.delete(re.serverPromptId),await A(Z)==="failed"&&(I(re.id,{isEditing:!1,isRemoving:!1}),a(new Error("Queue changed but pending prompts could not refresh"),U)),!0):(I(re.id,{isEditing:!1,isRemoving:!1}),await A(Z),a(new Error("Prompt could not be removed from queue"),U),!1)}catch(ge){return y.current.delete(re.serverPromptId),I(re.id,{isEditing:!1,isRemoving:!1}),await A(Z)!=="refreshed"&&O([re]),a(ge,U),!1}},[A,a,O,r,I]),W=h.useCallback(re=>{const ne=m.current.find(U=>U.id===re);if((ne==null?void 0:ne.serverState)!=="submitting"&&ne){if(!ne.serverPromptId){const U=m.current.filter(Z=>Z.id!==re);m.current=U,f(U);return}J(ne,{isRemoving:!0},u("queue.deleteFailed"))}},[J,u]),P=h.useCallback(async re=>{var ue;const ne=m.current.find(be=>be.id===re);if(!ne||(((ue=ne.images)==null?void 0:ue.length)??0)>0||ne.serverState==="submitting"||ne.isEditing||ne.isRemoving||lue(ne.text))return;const U=ne.serverPromptId?ne.onComplete??x.current.get(ne.serverPromptId):void 0,Z=()=>{ne.serverPromptId&&x.current.delete(ne.serverPromptId),U==null||U()};if(ne.serverPromptId&&!await J(ne,{isRemoving:!0},u("queue.insertFailed")))return;let ge=b.current;ge||(ge=new AbortController,b.current=ge);let ce;try{ce=await r.enqueueMidTurnMessage(ne.text,{signal:ge.signal})}catch(be){ne.serverPromptId&&(M(ne.text,ne.images,ne.sessionId),Z()),a(be,u("queue.insertFailed"));return}if(!ce.accepted){ne.serverPromptId&&(M(ne.text,ne.images,ne.sessionId),Z()),a(new Error("Queued message was not accepted for insertion"),u("queue.insertFailed"));return}if(Z(),!ne.serverPromptId){const be=m.current.filter(rt=>rt.id!==re);m.current=be,f(be)}c(u("queue.inserted"))},[J,c,a,M,r,u]),V=h.useCallback(async re=>{const ne=m.current.find(Z=>Z.id===re);if(!ne||ne.serverState==="submitting"||ne.isEditing||ne.isRemoving)return;if(ne.serverPromptId){if(!await J(ne,{isEditing:!0},u("queue.editFailed")))return;M(ne.text,ne.images,ne.sessionId);return}const U=Q(re);U&&M(U,ne.images,ne.sessionId)},[Q,J,M,u]),ee=h.useCallback(()=>{const re=m.current;if(re.length===0)return!1;const ne=re[re.length-1];if(!ne)return!1;if(ne.serverState==="submitting"||ne.isEditing||ne.isRemoving)return!0;if(!ne.serverPromptId){const U=Q(ne.id);return U?(M(U,ne.images,ne.sessionId),!0):!1}return ne.serverState!=="queued"?!1:((async()=>{await J(ne,{isEditing:!0},u("queue.editFailed"))&&M(ne.text,ne.images,ne.sessionId)})().catch(U=>{a(U,u("queue.editFailed"))}),!0)},[Q,J,a,M,u]),q=h.useCallback(()=>{if(m.current.length===0)return!1;const re=g.current,ne=m.current.filter(be=>be.serverState==="submitting"),U=m.current.filter(be=>be.serverState!=="submitting");for(const be of[...ne].reverse())M(be.text,be.images,be.sessionId);for(const be of v.current)be.abort();const Z=U.filter(be=>be.serverPromptId);if(Z.length===0)return m.current=[],f([]),i.dispatch([{type:"status",text:u("queue.cleared")}]),!0;const ge=new Set(m.current.map(be=>be.id)),ce=new Set(Z.map(be=>be.serverPromptId).filter(be=>!!be));for(const be of ce)y.current.add(be);const ue=m.current.filter(be=>!ge.has(be.id)).concat(Z.map(be=>({...be,isRemoving:!0})));return m.current=ue,f(ue),(async()=>{var Me;const be=[];if(await Promise.all(Z.map(async We=>{const at=We.serverPromptId;try{if((await r.removePendingPrompt(at,{sessionId:We.sessionId})).removed){x.current.delete(at);return}be.push(We)}catch{be.push(We)}finally{y.current.delete(at)}})),g.current!==re)return;const rt=be.map(We=>({...We,isRemoving:!1})),le=m.current.filter(We=>We.serverPromptId?!ce.has(We.serverPromptId):!ge.has(We.id)).concat(rt);if(m.current=le,f(le),be.length>0){a(new Error("Some prompts could not be removed from queue"),u("queue.deleteFailed")),A((Me=be[0])==null?void 0:Me.sessionId);return}i.dispatch([{type:"status",text:u("queue.cleared")}])})(),!0},[A,a,M,i,u,r]),{batches:K,consume:de}=pbe();return h.useEffect(()=>{if(!t||K.length===0)return;const re=Bgt(m.current,K,t,n);re&&(m.current=re,f(re)),de(K.filter(ne=>ne.sessionId===t))},[K,t,n,de]),{queuedPrompts:d,queuedTexts:S,enqueuePrompt:H,removeQueuedPrompt:W,insertQueuedPrompt:P,editQueuedPrompt:V,editLastQueuedPrompt:ee,clearQueuedPrompts:q}}/**
 * @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?Qu(e.toolName):!0}const qgt=3e4;function N3(e){return Jb.includes(e)}async function Ugt({sessionActions:e,modelId:t,modeId:n,workspaceCwd:s,worktree:r,branch:i,onSessionCreated:o,onSessionAllocated:a,getCurrentSessionId:c,warn:u=console.warn}){const d=n&&N3(n)?n:void 0,{sessionId:f,worktree:m,branch:p}=await e.createSession({workspaceCwd:s,sourceType:uC,...d?{approvalMode:d}:{},...r?{worktree:r}:{},...i?{branch:i}:{}});a==null||a(f);let g="prepare new session";try{if(o){g="run onSessionCreated";let y;try{await Promise.race([o(f),new Promise((w,x)=>{y=setTimeout(()=>x(new Error("onSessionCreated timed out")),qgt)})])}finally{clearTimeout(y)}}g="verify session identity";const b=c();if(b!==void 0&&b!==f)throw new Error(`Session changed before attach: expected ${f}, found ${b}`);g="attach new session",await e.attachSession(),g="verify attached session";const v=c();if(v!==void 0&&v!==f)throw new Error(`Session changed while attaching: expected ${f}, found ${v}`)}catch(b){u(`[WebShell] failed to ${g}:`,b),await e.releaseSession(f).catch(y=>{u("[WebShell] failed to release unattached session:",y)});const v=c();throw v===void 0||v===f?await e.clearSession().catch(y=>{u("[WebShell] failed to clear unattached session:",y)}):u(`[WebShell] skipping clearSession: expected ${f}, found ${v}`),b}return t&&await e.setModel(t).catch(b=>{u("[WebShell] failed to set model for new session:",b)}),{...m?{worktree:m}:{},...p?{branch:p}:{}}}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const Wgt=new Set(["coder-model(qwen-oauth)"]);function Qw(e){return!Wgt.has(e.id)}function Vgt({catchingUp:e,pendingApproval:t,isPreparingPrompt:n}){return!!(e||t||n)}function uue({catchingUp:e,isPreparingPrompt:t,isStreaming:n}){return e?"loading":t||n?"processing":"idle"}function Ggt(e){switch(uue(e)){case"loading":return"common.loading";case"processing":return"editor.processing";case"idle":return"editor.placeholder"}}function due({connectionStatus:e,hasSession:t,restartSseOnPrompt:n}){return e==="error"?!0:e==="disconnected"&&(!n||!t)}const hue=/^\/([\w-]+)(?=\s|$)/;function fue(e,t,n){if(!t)return!1;const s=e.match(hue);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 t9=["blue","green","purple","orange","yellow","red"];for(const e of t9){if(TP[e])continue;const t=`WorkspaceAccent.module.css is missing a class for the "${e}" accent`;console.error(t)}function Kgt(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)}function Ygt(e,t){if(!e)return;const s=((t==null?void 0:t.workspaces)??[]).findIndex(i=>i.cwd===e),r=s>=0?s:Kgt(e);return t9[r%t9.length]}function mue(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:"prs",description:e("local.prs")},{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 Xgt={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"},Qgt={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 pue(e){return Qgt[e]}function gue(e,t){return e.map(n=>{const s=Xgt[n.name];return!s||n.source&&n.source!=="builtin-command"?n:{...n,description:t(s)}})}function bue(...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 Jgt="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",Zgt="/assets/insert-DmRbh9Rv.svg",e1t="/assets/queue-DWpnpFgW.svg",t1t="_app_7uwuo_1",n1t="_appChat_7uwuo_43",s1t="_appChatEmpty_7uwuo_49",r1t="_appShell_7uwuo_54",i1t="_chatPane_7uwuo_62",o1t="_artifactResizeHandle_7uwuo_71",a1t="_artifactPanelDock_7uwuo_88",l1t="_artifactPanelClip_7uwuo_96",c1t="_chatPaneShowingPage_7uwuo_124",u1t="_fullPage_7uwuo_130",d1t="_fullPageHeader_7uwuo_139",h1t="_splitApprovalNotice_7uwuo_149",f1t="_fullPageBack_7uwuo_175",m1t="_fullPageTitle_7uwuo_192",p1t="_fullPageBody_7uwuo_197",g1t="_mobileDrawer_7uwuo_204",b1t="_mobileBackdrop_7uwuo_208",y1t="_mobileDrawerForced_7uwuo_215",w1t="_hamburgerButton_7uwuo_243",v1t="_mobileDrawerOpen_7uwuo_288",x1t="_hamburgerButtonFloating_7uwuo_323",k1t="_appWithSidebar_7uwuo_331",_1t="_themeDark_7uwuo_341",S1t="_themeLight_7uwuo_414",C1t="_content_7uwuo_487",T1t="_contentHasMessages_7uwuo_495",E1t="_missingSessionState_7uwuo_504",j1t="_missingSessionMessage_7uwuo_517",A1t="_missingSessionButton_7uwuo_524",N1t="_panelHost_7uwuo_559",M1t="_panelHeader_7uwuo_567",I1t="_panelBack_7uwuo_577",R1t="_panelTitle_7uwuo_603",D1t="_panelBody_7uwuo_612",P1t="_chatViewWrap_7uwuo_624",L1t="_chatViewHidden_7uwuo_632",O1t="_chatSubtree_7uwuo_636",$1t="_chatSubtreeHidden_7uwuo_640",B1t="_footer_7uwuo_653",z1t="_bottomPanels_7uwuo_663",F1t="_approvalOverlay_7uwuo_678",H1t="_scrollToBottomLayer_7uwuo_692",q1t="_scrollToBottomLayerWithTodos_7uwuo_703",U1t="_scrollToBottomButton_7uwuo_710",W1t="_scrollToBottomIcon_7uwuo_739",V1t="_btwPanel_7uwuo_745",G1t="_composer_7uwuo_752",K1t="_composerHeader_7uwuo_757",Y1t="_chatHeader_7uwuo_761",X1t="_customFooter_7uwuo_765",Q1t="_escClearStatus_7uwuo_771",J1t="_composerActionTip_7uwuo_778",Z1t="_composerActionTipIcon_7uwuo_788",ebt="_composerActionTipText_7uwuo_795",tbt="_composerActionTipActions_7uwuo_802",nbt="_composerActionTipButton_7uwuo_808",sbt="_composerActionTipButtonPrimary_7uwuo_825",rbt="_emptyWelcomeFooter_7uwuo_844",ibt="_mobileWelcomeFooterMiddle_7uwuo_848",obt="_mobileWelcomeGroup_7uwuo_852",abt="_chatPaneWithMobileComposerBottom_7uwuo_857",lbt="_chatViewWithMobileComposerBottom_7uwuo_862",cbt="_chatViewWithWelcomeMiddle_7uwuo_875",ubt="_footerWithCustomFooter_7uwuo_875",dbt="_desktopWelcomeFooter_7uwuo_909",hbt="_queuedPrompts_7uwuo_918",fbt="_queuedPrompt_7uwuo_918",mbt="_queuedPromptIcon_7uwuo_948",pbt="_queuedPromptMaskIcon_7uwuo_958",gbt="_queuedPromptActionIcon_7uwuo_959",bbt="_queuedPromptText_7uwuo_972",ybt="_queuedPromptState_7uwuo_980",wbt="_queuedPromptSpinner_7uwuo_988",vbt="_queuedPromptActions_7uwuo_1003",xbt="_queuedPromptAction_7uwuo_959",kbt="_queuedHint_7uwuo_1048",Ot={app:t1t,appChat:n1t,appChatEmpty:s1t,appShell:r1t,chatPane:i1t,artifactResizeHandle:o1t,artifactPanelDock:a1t,artifactPanelClip:l1t,chatPaneShowingPage:c1t,fullPage:u1t,fullPageHeader:d1t,splitApprovalNotice:h1t,fullPageBack:f1t,fullPageTitle:m1t,fullPageBody:p1t,mobileDrawer:g1t,mobileBackdrop:b1t,mobileDrawerForced:y1t,hamburgerButton:w1t,mobileDrawerOpen:v1t,hamburgerButtonFloating:x1t,appWithSidebar:k1t,themeDark:_1t,themeLight:S1t,content:C1t,contentHasMessages:T1t,missingSessionState:E1t,missingSessionMessage:j1t,missingSessionButton:A1t,panelHost:N1t,panelHeader:M1t,panelBack:I1t,panelTitle:R1t,panelBody:D1t,chatViewWrap:P1t,chatViewHidden:L1t,chatSubtree:O1t,chatSubtreeHidden:$1t,footer:B1t,bottomPanels:z1t,approvalOverlay:F1t,scrollToBottomLayer:H1t,scrollToBottomLayerWithTodos:q1t,scrollToBottomButton:U1t,scrollToBottomIcon:W1t,btwPanel:V1t,composer:G1t,composerHeader:K1t,chatHeader:Y1t,customFooter:X1t,escClearStatus:Q1t,composerActionTip:J1t,composerActionTipIcon:Z1t,composerActionTipText:ebt,composerActionTipActions:tbt,composerActionTipButton:nbt,composerActionTipButtonPrimary:sbt,emptyWelcomeFooter:rbt,mobileWelcomeFooterMiddle:ibt,mobileWelcomeGroup:obt,chatPaneWithMobileComposerBottom:abt,chatViewWithMobileComposerBottom:lbt,chatViewWithWelcomeMiddle:cbt,footerWithCustomFooter:ubt,desktopWelcomeFooter:dbt,queuedPrompts:hbt,queuedPrompt:fbt,queuedPromptIcon:mbt,queuedPromptMaskIcon:pbt,queuedPromptActionIcon:gbt,queuedPromptText:bbt,queuedPromptState:ybt,queuedPromptSpinner:wbt,queuedPromptActions:vbt,queuedPromptAction:xbt,queuedHint:kbt},_bt=240;function Sbt(e){var t,n;return((t=e.value)==null?void 0:t.trim())||((n=e.label)==null?void 0:n.trim())||e.id}function Cbt(e,t){if(e.inputAnnotations&&e.inputAnnotations.length>0)return QQ(e.text,e.inputAnnotations).map(s=>s.type==="text"?s:{type:"tag",tag:s.tag,preserveCustomKindLabel:!0});const n=PI(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 Tbt(e){const t=[];let n=_bt,s=!1;for(const i of e){if(i.type==="tag"){if(n<=0){s=!0;break}const a=Sbt(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 yue({prompts:e,t,onDelete:n,onInsert:s,onEdit:r}){const{parseUserMessageContent:i,composerTagIcons:o,renderComposerTag:a,renderComposerTagTooltip:c,onComposerTagClick:u}=ku();return e.length===0?null:l.jsxs("div",{className:Ot.queuedPrompts,children:[e.map(d=>{var C;const f=Tbt(Cbt(d,i)),m=((C=d.images)==null?void 0:C.length)??0,p=lue(d.text),g=d.serverState==="submitting",b=d.serverState==="running",v=d.isRemoving===!0,y=g||b||d.isEditing===!0||v;let w=t("queue.insertTip");y?w=t("queue.submittingDisabled"):p&&(w=t("queue.insertCommandDisabled"));let x=t("queue.editTip");y&&(x=t("queue.submittingDisabled"));const k=t(y?"queue.submittingDisabled":"queue.deleteTip");return l.jsxs("div",{className:Ot.queuedPrompt,children:[l.jsx("span",{className:Ot.queuedPromptIcon,"aria-hidden":"true",children:l.jsx("span",{className:Ot.queuedPromptMaskIcon,style:wm("--queued-icon-url",e1t)})}),l.jsxs("span",{className:Ot.queuedPromptText,children:[f.parts.map((T,_)=>T.type==="text"?l.jsx(h.Fragment,{children:T.text},_):l.jsx(cP,{tag:T.tag,composerTagIcons:o,renderComposerTag:a,renderComposerTagTooltip:c,onComposerTagClick:u,preserveCustomKindLabel:T.preserveCustomKindLabel},`${T.tag.id}:${_}`)),f.truncated?"...":null,m>0?` ${t("queue.imageCount",{count:m})}`:"",g||d.isEditing||v?l.jsxs("span",{className:Ot.queuedPromptState,children:[l.jsx("span",{className:Ot.queuedPromptSpinner}),v?t("queue.removing"):d.isEditing?t("queue.editing"):t("queue.submitting")]}):null]}),l.jsxs("span",{className:Ot.queuedPromptActions,children:[m===0&&l.jsxs("button",{type:"button",className:Ot.queuedPromptAction,onClick:()=>s(d.id),disabled:p||y,title:w,children:[l.jsx("span",{className:Ot.queuedPromptActionIcon,style:wm("--queued-icon-url",Zgt),"aria-hidden":"true"}),t("queue.insert")]}),l.jsx("button",{type:"button",className:Ot.queuedPromptAction,onClick:()=>n(d.id),disabled:y,"aria-label":t("queue.delete"),title:k,children:l.jsx("span",{className:Ot.queuedPromptActionIcon,style:wm("--queued-icon-url",Jgt),"aria-hidden":"true"})}),l.jsx("button",{type:"button",className:Ot.queuedPromptAction,onClick:()=>r(d.id),disabled:y,"aria-label":t("queue.edit"),title:x,children:l.jsx("span",{className:Ot.queuedPromptActionIcon,style:wm("--queued-icon-url",Ace),"aria-hidden":"true"})})]})]},d.id)}),l.jsx("div",{className:Ot.queuedHint,children:t("queue.footer")})]})}const Ebt="_approval_5nswb_1",jbt="_floating_5nswb_18",Abt="_header_5nswb_31",Nbt="_icon_5nswb_41",Mbt="_name_5nswb_56",Ibt="_desc_5nswb_67",Rbt="_content_5nswb_87",Dbt="_code_5nswb_105",Pbt="_codeBlock_5nswb_113",Lbt="_question_5nswb_136",Obt="_options_5nswb_148",$bt="_option_5nswb_148",Bbt="_optionPlain_5nswb_183",zbt="_optionSecondary_5nswb_193",Fbt="_optionPrimary_5nswb_200",Hbt="_optionActive_5nswb_211",qbt="_pointer_5nswb_215",Ubt="_num_5nswb_219",Wbt="_label_5nswb_223",co={approval:Ebt,floating:jbt,header:Abt,icon:Nbt,name:Mbt,desc:Ibt,content:Rbt,code:Dbt,codeBlock:Pbt,question:Lbt,options:Obt,option:$bt,optionPlain:Bbt,optionSecondary:zbt,optionPrimary:Fbt,optionActive:Hbt,pointer:qbt,num:Ubt,label:Wbt};function Vbt(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 Gbt(e){const t=[];for(const n of e.content)n.type==="text"&&n.text&&t.push(n.text);return t.join(`
`)}function Kbt(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 Ybt(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 Xbt(e){var n;const t=(n=e.rawInput)==null?void 0:n.description;return typeof t=="string"&&t.trim()?t.trim():e.title}function HE(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 BV(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 y2(e){return e.map((t,n)=>({option:t,index:n})).sort((t,n)=>{const s=BV(t.option)-BV(n.option);return s===0?t.index-n.index:s}).map(({option:t})=>t)}function Qbt(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 Jbt(e){return e.kind==="allow_once"?co.optionPrimary:e.kind==="allow_always"?co.optionSecondary:e.kind==="reject_once"||e.kind==="reject_always"?co.optionPlain:co.optionSecondary}function wue({request:e,onConfirm:t,variant:n="inline",keyboardActive:s=!0}){const{t:r}=lt(),i=h.useMemo(()=>y2(e.options),[e.options]),[o,a]=h.useState(()=>HE(y2(e.options))),c=h.useRef(e);c.current=e;const u=h.useRef(o);u.current=o;const d=h.useRef(!1),f=h.useRef([]),m=h.useId(),p=h.useId(),g=h.useId(),b=h.useId();h.useEffect(()=>{const B=HE(y2(c.current.options));d.current=!1,u.current=B,a(B)},[e.id]);const v=Vbt(e.title),y=e.toolName||v.toolName||e.kind||"Tool",w=qu(y,r),x=Xbt(e),k=Gbt(e),C=h.useCallback(B=>{d.current||(d.current=!0,t(c.current.id,B))},[t]),T=h.useCallback(B=>{const j=f.current[B];j&&(document.activeElement===j&&j.blur(),j.focus())},[]),_=h.useRef(!1),S=h.useRef(e.id);h.useEffect(()=>{const B=_.current,j=S.current;if(_.current=s,S.current=e.id,!s)return;const H=e.id!==j;B&&!H||T(H?HE(y2(c.current.options)):u.current)},[s,e.id,T]);const R=h.useCallback(B=>{const j=i.length,H=(u.current+B+j)%j;u.current=H,a(H),T(H)},[i.length,T]),A=h.useCallback(B=>{const j=i.length;if(B.key==="ArrowDown"||B.key==="j")B.preventDefault(),R(1);else if(B.key==="ArrowUp"||B.key==="k")B.preventDefault(),R(-1);else if(B.key==="Home")B.preventDefault(),u.current=0,a(0),T(0);else if(B.key==="End"){B.preventDefault();const H=j-1;u.current=H,a(H),T(H)}else if(B.key==="Escape"){B.preventDefault();const H=c.current.options.find(Q=>Q.kind==="reject_once"||Q.kind==="reject_always");H&&C(H.id)}else if(B.key>="1"&&B.key<="9"){const H=parseInt(B.key,10)-1;H<j&&(B.preventDefault(),C(i[H].id))}},[i,R,C,T]),O=Kbt(e),M=Kpe(e.toolName),D=Ybt(e),$=!!(O&&D||k&&k!==e.title),z=M?r("approval.launchAgentQuestion"):O?r("approval.execQuestion",{tool:w}):r("approval.changeQuestion");return l.jsxs("div",{className:n==="floating"?`${co.approval} ${co.floating}`:co.approval,"data-web-shell-permission-panel":!0,role:"alertdialog","aria-labelledby":m,"aria-describedby":[p,x?g:null,$?b:null].filter(Boolean).join(" "),onKeyDown:A,children:[l.jsxs("div",{className:co.header,children:[l.jsx("span",{className:co.icon,"aria-hidden":"true",children:"?"}),l.jsx("span",{className:co.name,id:m,children:w})]}),x&&l.jsx("div",{className:co.desc,id:g,title:x,children:x}),O&&D?l.jsx("div",{className:co.code,children:l.jsx("pre",{className:co.codeBlock,id:b,title:D,children:D})}):k&&k!==e.title?l.jsx("pre",{className:co.content,id:b,title:k,children:k}):null,l.jsx("div",{className:co.question,id:p,children:z}),l.jsx("div",{className:co.options,role:"radiogroup",children:i.map((B,j)=>{const H=j===o,Q=Qbt(B),I=Q?r(Q):B.label;return l.jsxs("button",{type:"button",ref:J=>{f.current[j]=J},className:`${co.option} ${Jbt(B)} ${H?co.optionActive:""}`,"data-web-shell-permission-option":!0,"data-option-id":B.id,tabIndex:H?0:-1,role:"radio","aria-checked":H,"aria-keyshortcuts":j<9?String(j+1):void 0,onClick:()=>C(B.id),onFocus:()=>{u.current=j,a(j)},children:[l.jsx("span",{className:co.pointer,"aria-hidden":"true",children:H?"›":" "}),l.jsxs("span",{className:co.num,"aria-hidden":"true",children:[j+1,"."]}),l.jsx("span",{className:co.label,children:I})]},B.id)})})]})}const Zbt="_question_1paag_1",eyt="_floating_1paag_18",tyt="_titleLine_1paag_30",nyt="_icon_1paag_38",syt="_toolName_1paag_42",ryt="_toolDesc_1paag_46",iyt="_tabs_1paag_53",oyt="_topRight_1paag_63",ayt="_collapseButton_1paag_70",lyt="_collapseIcon_1paag_89",cyt="_collapseIconCollapsed_1paag_95",uyt="_collapsed_1paag_99",dyt="_tab_1paag_53",hyt="_tabActive_1paag_118",fyt="_text_1paag_135",myt="_description_1paag_143",pyt="_multiHint_1paag_151",gyt="_options_1paag_157",byt="_option_1paag_157",yyt="_optionActive_1paag_194",wyt="_optionSelected_1paag_195",vyt="_optionLabel_1paag_200",xyt="_pointer_1paag_205",kyt="_optionNum_1paag_209",_yt="_editIcon_1paag_226",Syt="_optionContent_1paag_258",Cyt="_optionPlaceholder_1paag_274",Tyt="_optionDesc_1paag_279",Eyt="_customInput_1paag_286",jyt="_customTrigger_1paag_301",Ayt="_actions_1paag_327",Nyt="_button_1paag_335",Myt="_submitButton_1paag_361",Iyt="_ignoreButton_1paag_367",$s={question:Zbt,floating:eyt,titleLine:tyt,icon:nyt,toolName:syt,toolDesc:ryt,tabs:iyt,topRight:oyt,collapseButton:ayt,collapseIcon:lyt,collapseIconCollapsed:cyt,collapsed:uyt,tab:dyt,tabActive:hyt,text:fyt,description:myt,multiHint:pyt,options:gyt,option:byt,optionActive:yyt,optionSelected:wyt,optionLabel:vyt,pointer:xyt,optionNum:kyt,editIcon:_yt,optionContent:Syt,optionPlaceholder:Cyt,optionDesc:Tyt,customInput:Eyt,customTrigger:jyt,actions:Ayt,button:Nyt,submitButton:Myt,ignoreButton:Iyt};function vue({request:e,onConfirm:t,variant:n="inline",keyboardActive:s=!0}){const{t:r}=lt(),i=h.useMemo(()=>{var U;return Array.isArray((U=e.rawInput)==null?void 0:U.questions)?e.rawInput.questions:[]},[e.rawInput]),[o,a]=h.useState(0),[c,u]=h.useState(null),[d,f]=h.useState({}),[m,p]=h.useState({}),[g,b]=h.useState({}),[v,y]=h.useState(!1),[w,x]=h.useState(!1),k=h.useRef(!1),C=h.useRef([]),T=h.useRef(null),_=h.useRef(c);_.current=c;const S=h.useId(),R=h.useId();h.useEffect(()=>{const U=i[0];k.current=!1,x(!1),a(0),_.current=U!=null&&U.options.length?0:null,u(U!=null&&U.options.length?0:null),f(U&&!U.multiSelect&&U.options[0]?{0:U.options[0].label}:{}),p({}),b(U!=null&&U.multiSelect&&U.options[0]?{0:[U.options[0].label]}:{}),y(!1)},[i,e.id]);const A=i[o],O=(A==null?void 0:A.multiSelect)??!1,M=h.useCallback(()=>{const U={};for(let Z=0;Z<i.length;Z++){const ge=i[Z];if(ge)if(ge.multiSelect){const ce=g[Z]||[],ue=m[Z],be=ue?[...ce,ue]:ce;U[String(Z)]=be.join(", ")}else U[String(Z)]=d[Z]||m[Z]||""}return U},[i,g,m,d]),D=h.useCallback(()=>{if(k.current)return;const U=e.options.find(Z=>Z.kind==="allow_once");U&&(k.current=!0,t(e.id,U.id,M()))},[M,e,t]),$=h.useCallback(()=>{if(k.current)return;const U=e.options.find(Z=>Z.kind==="reject_once"||Z.kind==="reject_always");U&&(k.current=!0,t(e.id,U.id,void 0))},[e,t]),z=h.useCallback(U=>{U!==void 0&&p(Z=>({...Z,[o]:U})),O||f(Z=>{if(!(o in Z))return Z;const ge={...Z};return delete ge[o],ge}),y(!0)},[o,O]),B=h.useCallback(U=>{if(!A)return;if(U===A.options.length){z();return}const ge=A.options[U].label;if(O){const ce=g[o]||[],ue=ce.includes(ge)?ce.filter(be=>be!==ge):[...ce,ge];b({...g,[o]:ue})}else{const ce={...d,[o]:ge};f(ce),p(ue=>{if(!(o in ue))return ue;const be={...ue};return delete be[o],be})}},[A,o,O,g,d,z]),j=h.useCallback(U=>{if(!A||!O)return;if(U===A.options.length){z();return}const Z=A.options[U].label,ge=g[o]||[],ce=ge.includes(Z)?ge.filter(ue=>ue!==Z):[...ge,Z];b({...g,[o]:ce})},[A,O,g,o,z]),H=h.useCallback(U=>{if(A){if(_.current=U,u(U),U===A.options.length){z();return}O?j(U):B(U)}},[A,O,z,j,B]),Q=h.useCallback(U=>{var Z,ge;A&&(_.current=U,u(U),U===A.options.length?((Z=T.current)==null||Z.focus(),O||f(ce=>{if(!(o in ce))return ce;const ue={...ce};return delete ue[o],ue})):((ge=C.current[U])==null||ge.focus(),O||B(U)))},[A,o,O,B]),I=h.useCallback(U=>{if(!A)return;const Z=A.options.length+1,ge=_.current??0;Q((ge+U+Z)%Z)},[A,Q]),J=h.useCallback(U=>{if(eg(U.target)||!U.target.closest("[data-web-shell-ask-option]")||!A)return;const Z=A.options.length+1;if(U.key==="ArrowDown"||U.key==="j")U.preventDefault(),I(1);else if(U.key==="ArrowUp"||U.key==="k")U.preventDefault(),I(-1);else if(U.key==="Home")U.preventDefault(),Q(0);else if(U.key==="End")U.preventDefault(),Q(Z-1);else if(U.key==="Escape")U.preventDefault(),$();else if(U.key>="1"&&U.key<="9"){const ge=parseInt(U.key,10)-1;ge<Z&&(U.preventDefault(),H(ge))}},[A,I,Q,$,H]),W=h.useRef(!1),P=h.useRef(e.id),V=h.useRef((A==null?void 0:A.options.length)??0);if(V.current=(A==null?void 0:A.options.length)??0,h.useEffect(()=>{var ce,ue;const U=W.current,Z=P.current;if(W.current=s,P.current=e.id,!s||U&&e.id===Z)return;const ge=_.current??0;ge===V.current?(ce=T.current)==null||ce.focus():(ue=C.current[ge])==null||ue.focus()},[s,e.id]),i.length===0)return null;const ee=U=>{const Z=i[U];return Z?Z.multiSelect?(g[U]||[]).length>0||!!m[U]:!!d[U]||!!m[U]:!1},q=i.every((U,Z)=>ee(Z)),K=Math.min(o,i.length-1),de=U=>{const Z=i[U];if(a(U),y(!1),!(Z!=null&&Z.options.length)){u(null);return}if(u(0),Z.multiSelect){b(ge=>(ge[U]||[]).length>0||m[U]?ge:{...ge,[U]:[Z.options[0].label]});return}f(ge=>ge[U]||m[U]?ge:{...ge,[U]:Z.options[0].label})},re=()=>{o<=0||de(o-1)},ne=()=>{o>=i.length-1||de(o+1)};return l.jsxs("div",{className:`${$s.question} ${n==="floating"?$s.floating:""} ${w?$s.collapsed:""}`,"data-web-shell-ask-panel":!0,role:"alertdialog","aria-label":qu("ask_user_question",r),"aria-labelledby":w?void 0:`${R} ${S}`,onKeyDown:J,children:[l.jsxs("div",{className:$s.titleLine,children:[l.jsx("span",{className:$s.icon,"aria-hidden":"true",children:"?"}),l.jsx("span",{className:$s.toolName,id:R,children:qu("ask_user_question",r)}),l.jsx("span",{className:$s.toolDesc,children:r("askUser.progress",{current:K+1,total:i.length})}),l.jsxs("div",{className:$s.topRight,children:[l.jsx("div",{className:$s.tabs,children:i.map((U,Z)=>l.jsx("span",{className:`${$s.tab} ${Z===o?$s.tabActive:""}`,"aria-hidden":"true"},Z))}),l.jsx("button",{type:"button",className:$s.collapseButton,onClick:()=>x(U=>!U),"aria-expanded":!w,"aria-label":r(w?"common.expand":"common.collapse"),title:r(w?"common.expand":"common.collapse"),children:l.jsx("svg",{viewBox:"0 0 16 16",className:`${$s.collapseIcon} ${w?$s.collapseIconCollapsed:""}`,children:l.jsx("path",{d:"M4 6l4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})})]})]}),!w&&l.jsxs(l.Fragment,{children:[A?l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:$s.text,id:S,children:[A.question,O&&l.jsxs("span",{className:$s.multiHint,children:[" ","(",r("askUser.multiHint"),")"]})]}),l.jsx("p",{className:$s.description,children:r("askUser.selectAnswer")}),l.jsxs("div",{className:$s.options,role:O?"group":"radiogroup","aria-labelledby":S,children:[A.options.map((U,Z)=>{const ge=Z===c,ce=O?(g[o]||[]).includes(U.label):d[o]===U.label;return l.jsxs("button",{type:"button",ref:ue=>{C.current[Z]=ue},className:`${$s.option} ${ge?$s.optionActive:""} ${ce?$s.optionSelected:""}`,"data-web-shell-ask-option":!0,tabIndex:ge?0:-1,role:O?void 0:"radio","aria-checked":O?void 0:ce,"aria-pressed":O?ce:void 0,"aria-keyshortcuts":Z<9?String(Z+1):void 0,onClick:()=>H(Z),onFocus:()=>u(Z),children:[l.jsx("span",{className:$s.pointer,"aria-hidden":"true",children:ge?"›":" "}),l.jsx("span",{className:$s.optionNum,"aria-hidden":"true",children:Z+1}),l.jsxs("span",{className:$s.optionContent,children:[l.jsx("span",{className:$s.optionLabel,children:U.label}),U.description&&l.jsx("span",{className:$s.optionDesc,children:U.description})]})]},U.label)}),(()=>{const U=c===A.options.length,Z=!!m[o];return l.jsxs("div",{className:`${$s.option} ${U?$s.optionActive:""} ${Z?$s.optionSelected:""}`,onClick:()=>H(A.options.length),children:[l.jsx("span",{className:$s.pointer,"aria-hidden":"true",children:U?"›":" "}),l.jsx("span",{className:$s.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:$s.customInput,placeholder:r("askUser.typePlaceholder"),value:m[o]||"","aria-label":r("askUser.typePlaceholder"),onChange:ge=>p({...m,[o]:ge.target.value}),onClick:ge=>ge.stopPropagation(),onFocus:()=>u(A.options.length),onBlur:()=>y(!1),autoFocus:!0}):l.jsx("button",{type:"button",ref:T,className:`${$s.customTrigger} ${m[o]?"":$s.optionPlaceholder}`,"data-web-shell-ask-option":!0,tabIndex:U?0:-1,role:O?void 0:"radio","aria-checked":O?void 0:Z,"aria-pressed":O?Z:void 0,"aria-keyshortcuts":A.options.length<9?String(A.options.length+1):void 0,onFocus:()=>u(A.options.length),children:m[o]||r("askUser.typePlaceholder")})]})})()]})]}):null,l.jsxs("div",{className:$s.actions,children:[l.jsx("button",{type:"button",className:$s.ignoreButton,onClick:$,children:r("askUser.ignore")}),i.length>1&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:$s.button,disabled:o<=0,onClick:re,children:r("common.previous")}),l.jsx("button",{type:"button",className:$s.button,disabled:o>=i.length-1,onClick:ne,children:r("common.next")})]}),l.jsx("button",{type:"button",className:`${$s.button} ${$s.submitButton}`,disabled:!q,onClick:D,children:r("askUser.submit")})]})]})]})}const Ryt=1e6;function xue(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 xue(n))t.add(s);return Array.from(t)}function kue(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 xue(c))s.set(u,i);_ue(c,i,r)}}const o=new Map;for(const a of t){const c=Dyt(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(f=>f.id===a.id)||d.push(a):o.set(u,[a])}}return o}function _ue(e,t,n){e.toolName.toLowerCase()==="record_artifact"&&n.push({turnId:t,workspacePath:Wh(e.args,"workspacePath"),managedId:Wh(e.args,"managedId"),url:Wh(e.args,"url")});for(const s of e.subTools??[])_ue(s,t,n)}function Dyt(e,t,n){const s=new Set;for(const r of e){if(r.workspacePath&&t.workspacePath&&Mue(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 Sue(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=>tg(a.workspacePath)).filter(a=>!!a));for(const a of i.tools)Eue(a,r,o,s,n)}return s}function Cue(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)Tue(r,n,t)}return t}function Tue(e,t,n){const s=Pyt(e);if(s){const r=n.get(t);r?r.push(s):n.set(t,[s])}for(const r of e.subTools??[])Tue(r,t,n)}function Pyt(e){if(e.status!=="completed"||e.toolName.toLowerCase()!=="cron_create")return null;const t=PP(e);if(t!=null&&t.error)return null;const n=Wh(e.args,"cron"),s=Wh(e.args,"prompt");if(!n||!s)return null;const r=Wh(t,"returnDisplay")??Wh(t,"llmContent")??(typeof e.rawOutput=="string"?e.rawOutput:void 0),i=r?jue(r):void 0;return{id:r?Fyt(r)??e.callId:e.callId,toolCallId:e.callId,title:Hyt(s),cron:n,prompt:s,recurring:zV(e.args,"recurring")??!0,durable:zV(e.args,"durable")??!1,...i?{display:i}:{}}}function Eue(e,t,n,s,r){const i=Lyt(e,n,r);if(i){const o=s.get(t);o?qyt(o,i):s.set(t,[i])}for(const o of e.subTools??[])Eue(o,t,n,s,r)}function Lyt(e,t,n){if(e.status!=="completed")return null;const s=e.toolName.toLowerCase();if(s!=="write_file"&&s!=="edit")return null;const r=Oyt(e);if(!r)return null;const i=tg(r),o=$yt(e),a=zyt(e),c=Byt(a);return{path:r,status:o,toolCallId:e.callId,isArtifact:Array.from(t).some(u=>Mue(i,u,n)),...c?{additions:c.additions,deletions:c.deletions}:{},diffs:a}}function Oyt(e){var n,s;const t=w4(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 Wh(e,...t){if(e)for(const n of t){const s=e[n];if(typeof s=="string"&&s.trim())return s}}function w4(e,...t){if(e)for(const n of t){const s=e[n];if(typeof s=="string")return s}}function $yt(e){if(e.toolName.toLowerCase()==="write_file")return"created";const t=PP(e),n=(Wh(t,"returnDisplay")??"").toLowerCase();return n.includes("created new file")||n.includes("successfully created")||n.includes("created and wrote")?"created":"modified"}function Byt(e){const t=Aue(e);return t?Nue(t.oldText,t.newText):void 0}function zyt(e){const t=PP(e),n=w4(t,"originalContent"),s=w4(t,"newContent");if(n!==void 0||s!==void 0)return[{oldText:n??"",newText:s??"",fileDiff:Wh(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=w4(e.args,"content");return i!==void 0?[{oldText:"",newText:i,fullContent:!0}]:[]}return[]}function PP(e){return e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0}function zV(e,t){const n=e==null?void 0:e[t];return typeof n=="boolean"?n:void 0}function jue(e){return e.split(/\r\n|\r|\n/).map(t=>t.trim()).find(Boolean)}function Fyt(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 Hyt(e){const t=jue(e)??e.trim();return t.length>36?`${t.slice(0,36)}...`:t}function qyt(e,t){const n=tg(t.path),s=e.findIndex(f=>tg(f.path)===n);if(s<0){e.push(t);return}const r=e[s],{additions:i,deletions:o,...a}=r,c=Uyt(r.diffs,t.diffs),u=Aue(c),d=u?Nue(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 Uyt(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 Aue(e){const t=e.at(-1);return t!=null&&t.fullContent?t:void 0}function Nue(e,t){const n=FV(e),s=FV(t);if(n.length*s.length>Ryt)return;const r=Wyt(n,s);return{additions:s.length-r,deletions:n.length-r}}function FV(e){return e?e.replace(/\r?\n$/,"").split(/\r\n|\r|\n/):[]}function Wyt(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 Mue(e,t,n){return gce(e,t,n)}const Vyt="_pane_4s0kf_1",Gyt="_header_4s0kf_13",Kyt="_workspaceTag_4s0kf_36",Yyt="_workspaceTagDot_4s0kf_52",Xyt="_workspaceTagText_4s0kf_60",Qyt="_connectionError_4s0kf_69",Jyt="_connectionErrorText_4s0kf_77",Zyt="_title_4s0kf_84",ewt="_closeButton_4s0kf_95",twt="_maximizeButton_4s0kf_96",nwt="_body_4s0kf_124",swt="_footer_4s0kf_132",rwt="_approval_4s0kf_138",Ol={pane:Vyt,header:Gyt,workspaceTag:Kyt,workspaceTagDot:Yyt,workspaceTagText:Xyt,connectionError:Qyt,connectionErrorText:Jyt,title:Zyt,closeButton:ewt,maximizeButton:twt,body:nwt,footer:swt,approval:rwt},HV=["approvalMode","model","voice"],iwt={};function owt({title:e,workspaceCwd:t,onClose:n,onToggleMaximize:s,isMaximized:r=!1,onError:i,onSlashCommand:o,onRightPanelOpen:a,onPaneArtifactsChange:c,messageTurnOutputs:u,restartSseOnPrompt:d=!1,hidden:f=!1,voiceUserRevision:m=0,voiceWorkspaceRevisions:p=iwt,voiceWorkspaces:g}){var ie,Pe,et,He;const{t:b}=lt(),{renderComposerFooter:v}=ku(),y=Ra(),w=ug(),x=pa(),k=io(),C=H5(b),T=rk(),_=MQ(),S=nT(),R=sT(),{artifacts:A}=aue(),O=h.useCallback(Ae=>{var Ce;if(!y.sessionId||!a)return;const vt=Ae.rawOutput&&typeof Ae.rawOutput=="object"?Ae.rawOutput:void 0,vn=(typeof((Ce=Ae.args)==null?void 0:Ce.subagent_type)=="string"?Ae.args.subagent_type:void 0)??(typeof(vt==null?void 0:vt.subagentName)=="string"?vt.subagentName:void 0);a({id:`subagent:${y.sessionId}:${Ae.callId}`,kind:"subagent",title:Ae.title||vn||b("agent.label"),turnId:Ae.callId,tool:Ae,sessionId:y.sessionId,workspaceCwd:y.workspaceCwd??t})},[y.sessionId,y.workspaceCwd,a,b,t]);h.useEffect(()=>{const Ae=y.sessionId;if(Ae)return c==null||c(Ae,A,x),()=>{c==null||c(Ae,[],x)}},[A,y.sessionId,c,x]);const M=h.useRef(R);M.current=R;const D=h.useCallback(async Ae=>{y.sessionId&&await w.reloadSession(Ae)},[w,y.sessionId]),$=((ie=y.capabilities)==null?void 0:ie.features.includes(qQ))===!0,z=h.useRef(null),{followupState:B,onAcceptFollowup:j,onDismissFollowup:H,clear:Q}=PQ({onAccept:Ae=>{var vt;(vt=z.current)==null||vt.insertText(Ae)}}),I=h.useCallback((Ae,vt)=>{i?i(Ae,vt):console.error(vt,Ae)},[i]),J=h.useRef(o);J.current=o;const W=h.useCallback(Ae=>S.dispatch([{type:"status",text:Ae}]),[S]),P=h.useMemo(()=>SA(T),[T]),V=e9(P),ee=P&&!V?P:null,q=P&&V?P:null,K=h.useRef(ee);K.current=ee;const de=ee!==null||q!==null,re=y.sessionId&&y.workspaceCwd&&(!t||t===y.workspaceCwd)?y.workspaceCwd:void 0,ne=h.useMemo(()=>jce({capabilities:k.capabilities,intendedCwd:re,sessionId:y.sessionId,workspaces:g}),[y.sessionId,re,g,k.capabilities]),U=h.useMemo(()=>({user:m,workspace:ne?p[ne.workspaceKey]??0:0}),[ne,m,p]),Z=R!=="idle",ge=h.useMemo(()=>kue(C,A,y.workspaceCwd||""),[C,A,y.workspaceCwd]),ce=h.useMemo(()=>Sue(C,ge,y.workspaceCwd||""),[C,ge,y.workspaceCwd]),ue=h.useMemo(()=>Cue(C),[C]),be=h.useMemo(()=>new Set(u??yce),[u]),{queuedPrompts:rt,queuedTexts:le,enqueuePrompt:Me,removeQueuedPrompt:We,insertQueuedPrompt:at,editQueuedPrompt:ze,editLastQueuedPrompt:rn,clearQueuedPrompts:Wt}=cue({connected:y.status==="connected",sessionId:y.sessionId,clientId:y.clientId,streamingState:R,sessionActions:w,store:S,editorRef:z,reportError:I,notifySuccess:W,t:b}),zt=h.useMemo(()=>{if(Z)for(let Ae=C.length-1;Ae>=0;Ae--){const vt=C[Ae];if((vt==null?void 0:vt.role)==="user")return vt.timestamp}},[C,Z]),ae=h.useCallback((Ae,vt,vn,Ce)=>{const yt=Ae.trim();if(!yt)return!1;if(fue(Ae,J.current,I))return!0;if(due({connectionStatus:y.status,hasSession:!!y.sessionId,restartSseOnPrompt:d}))return!1;const Ft=Ce==null?void 0:Ce.inputAnnotations;return M.current==="idle"?(w.sendPrompt(yt,{...vt&&vt.length?{images:vt}:{},...Ft?{inputAnnotations:Ft}:{},onAdmitted:()=>{Q(),vn==null||vn()}}).catch(De=>I(De,"Failed to send prompt")),!1):Ft?Me(yt,vt,void 0,Ft):Me(yt,vt)},[w,Q,y.sessionId,y.status,Me,I,d]),je=h.useCallback((Ae,vt,vn)=>{w.submitPermission(Ae,vt,vn).catch(Ce=>I(Ce,"Failed to submit permission choice"))},[w,I]),it=h.useCallback(()=>{w.cancel().catch(Ae=>I(Ae,"Failed to cancel request"))},[w,I]),gt=h.useCallback(Ae=>{if(a){if(Ae.kind==="subagent"){a(Ae);return}a({...Ae,workspaceActions:x})}},[a,x]),wt=h.useMemo(()=>gue(bue(y.commands??[],mue(b)),b).map(Ae=>{const vt=pue(Ae.name);return vt?{...Ae,displayCategory:"skill",description:b(vt)}:Ae}),[y.commands,b]),Ke=h.useMemo(()=>(y.models??[]).filter(Qw).map(Ae=>({id:Ae.id,label:vm(Ae.label||Ae.id)})),[y.models]),un=h.useCallback(Ae=>{if(!N3(Ae)){I(new Error(`Unsupported approval mode: ${Ae}`),"Failed to set approval mode");return}w.setApprovalMode(Ae).then(()=>{const vt=K.current;if(!vt||!(Ae==="yolo"||Ae==="auto-edit"&&vt.toolKind==="edit"))return;const Ce=vt.options.find(yt=>yt.kind==="allow_once");Ce&&w.submitPermission(vt.id,Ce.id).catch(yt=>I(yt,"Failed to auto-approve tool call"))}).catch(vt=>I(vt,"Failed to set approval mode"))},[w,I]),me=h.useCallback(Ae=>{w.setModel(Ae).catch(vt=>I(vt,"Failed to switch model"))},[w,I]),ht=e||y.displayName||((Pe=y.sessionId)==null?void 0:Pe.slice(0,8))||"",Oe=t??y.workspaceCwd,Ne=RP(k.capabilities)&&!!Oe,St=h.useMemo(()=>Ne?[...HV,"workspace"]:HV,[Ne]),Ue=Ne&&Oe?F5(Oe,(et=k.capabilities)==null?void 0:et.workspaces):void 0,ve=Ne?Ygt(Oe,k.capabilities):void 0,Fe=ve?TP[ve]:void 0;return l.jsxs("section",{className:Ol.pane,"data-testid":"chat-pane","aria-label":ht,children:[l.jsxs("header",{className:`${Ol.header} ${Fe??""}`.trim(),children:[Ue&&l.jsxs("span",{role:"img",className:Ol.workspaceTag,title:Oe,"aria-label":b("workspace.paneLabel",{name:Ue}),"data-web-shell-pane-workspace":!0,children:[l.jsx("span",{className:Ol.workspaceTagDot,"aria-hidden":"true"}),l.jsx("span",{className:Ol.workspaceTagText,children:Ue})]}),l.jsx("span",{className:Ol.title,title:ht,children:ht}),s&&l.jsx("button",{type:"button",className:Ol.maximizeButton,onClick:s,"aria-pressed":r,"aria-label":b(r?"splitView.restorePane":"splitView.maximizePane"),title:b(r?"splitView.restorePane":"splitView.maximizePane"),children:r?l.jsx(zQ,{size:16,"aria-hidden":!0}):l.jsx(BQ,{size:16,"aria-hidden":!0})}),n&&l.jsx("button",{type:"button",className:Ol.closeButton,onClick:n,"aria-label":b("splitView.closePane"),title:b("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"})})})]}),y.error&&l.jsx("div",{className:Ol.connectionError,role:"alert",children:l.jsxs("span",{className:Ol.connectionErrorText,children:[b("splitView.paneConnectionError"),": ",y.error]})}),l.jsx("div",{className:Ol.body,children:l.jsx(Zle,{onOpen:O,children:l.jsx(_P,{messages:C,pendingApproval:ee,loadingTranscript:y.loadingTranscript,catchingUp:y.catchingUp,hasOlderHistory:_.hasMore,loadingOlderHistory:_.loading,historyCapacityReached:_.capacityReached,historyPaginationError:_.paginationError,onLoadOlderHistory:_.loadMore,transcriptBlockCount:T.length,transcriptActivity:S,onReloadTranscript:$?D:void 0,isResponding:Z,workspaceCwd:y.workspaceCwd||"",hideSessionTimeline:!0,turnFileChanges:be.has("file")?ce:void 0,turnArtifacts:be.has("artifact")?ge:void 0,turnScheduledTasks:be.has("scheduled_task")?ue:void 0,onTurnOutputOpen:gt,generateContent:(He=y.capabilities)!=null&&He.features.includes("session_generation")?w.generateSessionContent:void 0})})}),l.jsxs("div",{className:Ol.footer,children:[ee&&l.jsx("div",{className:Ol.approval,"data-testid":"pane-approval",children:l.jsx(wue,{request:ee,onConfirm:je,variant:"floating",keyboardActive:!1})}),q&&l.jsx("div",{className:Ol.approval,"data-testid":"pane-approval",children:l.jsx(vue,{request:q,onConfirm:je,variant:"floating",keyboardActive:!1})}),l.jsx(Bce,{startedAt:zt,showPhrase:!1}),l.jsx(yue,{prompts:rt,t:b,onDelete:We,onInsert:at,onEdit:ze}),l.jsx(Oce,{ref:z,onSubmit:ae,onCancel:it,isRunning:Z,commands:wt,queuedMessages:le,onPopQueuedMessages:rn,onClearQueuedMessages:Wt,visibleToolbarActions:St,workspaceName:Ne?Ue:void 0,workspaceTitle:Oe,workspaceColor:ve,currentMode:y.currentMode??"default",currentModel:y.currentModel??"",availableModels:Ke,onSelectMode:un,onSelectModel:me,dialogOpen:de,disabled:de,voiceTarget:f?void 0:ne,voiceStatusRevision:U,followupState:B,onAcceptFollowup:j,onDismissFollowup:H,sessionId:y.sessionId,atWorkspaceCwd:Oe,placeholderText:b("splitView.composerPlaceholder")}),v&&l.jsx(v,{disabled:de,isRunning:Z,currentMode:y.currentMode??"default",currentModel:y.currentModel??"",sessionName:y.displayName})]})]})}const awt="_split_99j2q_1",lwt="_toolbar_99j2q_9",cwt="_backButton_99j2q_18",uwt="_title_99j2q_35",dwt="_count_99j2q_40",hwt="_addWrap_99j2q_45",fwt="_addButton_99j2q_50",mwt="_picker_99j2q_70",pwt="_pickerItem_99j2q_87",gwt="_pickerItemLabel_99j2q_102",bwt="_pickerItemWorkspace_99j2q_112",ywt="_panes_99j2q_131",wwt="_paneSlot_99j2q_140",vwt="_empty_99j2q_153",xwt="_paneError_99j2q_162",kwt="_paneErrorTitle_99j2q_175",_wt="_paneErrorMessage_99j2q_180",Swt="_paneErrorClose_99j2q_185",sa={split:awt,toolbar:lwt,backButton:cwt,title:uwt,count:dwt,addWrap:hwt,addButton:fwt,picker:mwt,pickerItem:pwt,pickerItemLabel:gwt,pickerItemWorkspace:bwt,panes:ywt,paneSlot:wwt,empty:vwt,paneError:xwt,paneErrorTitle:kwt,paneErrorMessage:_wt,paneErrorClose:Swt},qE=Om;function Cwt({sessionIds:e,onPanesChange:t,onExit:n,onError:s,onSlashCommand:r,onRightPanelOpen:i,onPaneArtifactsChange:o,messageTurnOutputs:a,sessionListReloadToken:c,includeOtherWorkspaces:u=!0,workspaceCwd:d,restartSseOnPrompt:f,historyPageSize:m=UQ,voiceUserRevision:p=0,voiceWorkspaceRevisions:g={},voiceWorkspaces:b}){var Z,ge;const{t:v}=lt(),y=Ra(),w=y.sessionId,x=((ge=(Z=y.capabilities)==null?void 0:Z.features)==null?void 0:ge.includes(NI))??!1,{sessions:k,reload:C}=Pk(d,{autoLoad:!0,pageSize:Dh,archiveState:"active",...x?{view:"organized",group:"all"}:{}}),{sessions:T,reload:_}=eue(u&&!d),S=h.useMemo(()=>Zce(k,T),[k,T]),R=!d&&u&&RP(y.capabilities),A=!!d||R,O=e!==void 0,M=h.useMemo(()=>Array.from(new Set((e??[]).filter(Boolean))).slice(0,qE),[e]),[D,$]=h.useState(()=>M.length>0?M:w?[w]:[]),[z,B]=h.useState(!1),[j,H]=h.useState(null),Q=h.useRef(null),[I]=h.useState(()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2));h.useEffect(()=>{O&&$(ce=>ce.length===M.length&&ce.every((ue,be)=>ue===M[be])?ce:M)},[M,O]);const J=h.useRef(D);J.current=D,h.useEffect(()=>{if(!z)return;const ce=be=>{var rt;(rt=Q.current)!=null&&rt.contains(be.target)||B(!1)},ue=be=>{be.key==="Escape"&&B(!1)};return document.addEventListener("mousedown",ce),document.addEventListener("keydown",ue),()=>{document.removeEventListener("mousedown",ce),document.removeEventListener("keydown",ue)}},[z]),h.useEffect(()=>{z&&(C(),_())},[z,C,_]);const W=h.useRef(c);h.useEffect(()=>{c!==void 0&&c!==W.current&&(W.current=c,C(),_())},[c,C,_]);const P=h.useMemo(()=>{var ue;const ce=new Map;for(const be of S)ce.set(be.sessionId,((ue=be.displayName)==null?void 0:ue.trim())||be.sessionId.slice(0,8));return ce},[S]),V=h.useMemo(()=>{const ce=new Map;for(const ue of S)ce.set(ue.sessionId,ue.workspaceCwd);return w&&y.workspaceCwd&&!ce.has(w)&&ce.set(w,y.workspaceCwd),ce},[S,w,y.workspaceCwd]),ee=h.useCallback(ce=>{const ue=J.current;if(ue.includes(ce)||ue.length>=qE){B(!1);return}const be=[...ue,ce];H(null),O?t==null||t(be):$(be),B(!1)},[t,O]),q=h.useRef(!1);h.useEffect(()=>{D.length>0?q.current=!0:q.current&&n()},[D,n]),h.useEffect(()=>{O||t==null||t(D)},[D,t,O]);const K=h.useCallback(ce=>{const ue=J.current;if(!ue.includes(ce))return;const be=ue.filter(rt=>rt!==ce);O?t==null||t(be):$(be)},[t,O]),de=h.useCallback(ce=>{H(ue=>ue===ce?null:ce)},[]);h.useEffect(()=>{j&&(D.length<2||!D.includes(j))&&H(null)},[D,j]),h.useEffect(()=>{if(!j)return;const ce=ue=>{ue.key!=="Escape"||ue.defaultPrevented||z||eg(ue.target)||H(null)};return document.addEventListener("keydown",ce),()=>document.removeEventListener("keydown",ce)},[j,z]);const re=h.useMemo(()=>S.filter(ce=>!D.includes(ce.sessionId)),[S,D]),ne=D.length<qE&&re.length>0,U=D.length>1;return l.jsxs("div",{className:sa.split,"data-testid":"split-view",children:[l.jsxs("header",{className:sa.toolbar,children:[l.jsx("button",{type:"button",className:sa.backButton,onClick:n,"aria-label":v("common.back"),title:v("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:sa.title,children:v("splitView.title")}),l.jsx("span",{className:sa.count,children:v("splitView.count",{count:D.length})}),l.jsxs("div",{className:sa.addWrap,ref:Q,children:[l.jsxs("button",{type:"button",className:sa.addButton,disabled:!ne,"aria-haspopup":"listbox","aria-expanded":z,onClick:()=>B(ce=>!ce),children:["+ ",v("splitView.addPane")]}),z&&re.length>0&&l.jsx("ul",{className:sa.picker,role:"listbox",children:re.map(ce=>{var ue;return l.jsx("li",{role:"option","aria-selected":"false",children:l.jsxs("button",{type:"button",className:sa.pickerItem,onClick:()=>ee(ce.sessionId),children:[l.jsx("span",{className:sa.pickerItemLabel,children:P.get(ce.sessionId)??ce.sessionId.slice(0,8)}),R&&l.jsx("span",{className:sa.pickerItemWorkspace,title:ce.workspaceCwd,children:F5(ce.workspaceCwd,(ue=y.capabilities)==null?void 0:ue.workspaces)})]})},ce.sessionId)})})]})]}),l.jsx("div",{className:sa.panes,children:D.length===0?l.jsx("div",{className:sa.empty,children:v("splitView.empty")}):D.map(ce=>{const ue=V.get(ce),be=j===ce,rt=j!==null&&!be;return l.jsx("div",{className:sa.paneSlot,"data-pane-hidden":rt?"":void 0,children:l.jsx(df,{label:`split-pane:${ce}`,resetKeys:[ce],fallback:le=>l.jsxs("div",{className:sa.paneError,role:"alert",children:[l.jsx("div",{className:sa.paneErrorTitle,children:P.get(ce)??ce.slice(0,8)}),l.jsxs("div",{className:sa.paneErrorMessage,children:[v("splitView.paneError"),": ",le.message]}),l.jsx("button",{type:"button",className:sa.paneErrorClose,onClick:()=>K(ce),children:v("splitView.closePane")})]}),children:l.jsx(TI,{sessionId:ce,workspaceCwd:A?ue??d:void 0,clientId:`split-pane:${I}:${ce}`,historyPageSize:m,subagentTranscriptMode:"summary",maxBlocks:WQ,suppressOwnUserEcho:!0,restartEventStreamOnPrompt:f,children:l.jsx(owt,{title:P.get(ce),workspaceCwd:ue,hidden:rt,voiceUserRevision:p,voiceWorkspaceRevisions:g,voiceWorkspaces:b,onClose:()=>K(ce),onToggleMaximize:U?()=>de(ce):void 0,isMaximized:be,onError:s,onSlashCommand:r,onRightPanelOpen:i,onPaneArtifactsChange:o,messageTurnOutputs:a,restartSseOnPrompt:f})})})},A?`${ce}:${ue??""}`:ce)})})]})}const Twt="_root_1l1wz_1",Ewt="_intro_1l1wz_8",jwt="_toolbar_1l1wz_14",Awt="_count_1l1wz_22",Nwt="_toolbarActions_1l1wz_28",Mwt="_primaryButton_1l1wz_34",Iwt="_secondaryButton_1l1wz_35",Rwt="_formFields_1l1wz_73",Dwt="_field_1l1wz_79",Pwt="_fieldGrow_1l1wz_86",Lwt="_fieldLabel_1l1wz_90",Owt="_required_1l1wz_96",$wt="_input_1l1wz_107",Bwt="_textarea_1l1wz_108",zwt="_select_1l1wz_109",Fwt="_promptEditorWrap_1l1wz_127",Hwt="_promptEditor_1l1wz_127",qwt="_promptPlaceholder_1l1wz_160",Uwt="_promptTag_1l1wz_174",Wwt="_promptTagIcon_1l1wz_190",Vwt="_promptTagValue_1l1wz_201",Gwt="_promptTagRemove_1l1wz_211",Kwt="_referencePopover_1l1wz_239",Ywt="_referenceBar_1l1wz_243",Xwt="_referenceButton_1l1wz_250",Qwt="_referenceButtonActive_1l1wz_267",Jwt="_referenceButtonIcon_1l1wz_272",Zwt="_referencePicker_1l1wz_282",evt="_referenceItem_1l1wz_295",tvt="_referenceItemLabel_1l1wz_318",nvt="_referenceItemDescription_1l1wz_319",svt="_referenceEmpty_1l1wz_336",rvt="_referenceError_1l1wz_337",ivt="_scheduleRow_1l1wz_347",ovt="_preview_1l1wz_359",avt="_previewLabel_1l1wz_367",lvt="_previewCron_1l1wz_372",cvt="_previewInvalid_1l1wz_382",uvt="_formError_1l1wz_387",dvt="_loadError_1l1wz_388",hvt="_formActions_1l1wz_394",fvt="_empty_1l1wz_402",mvt="_list_1l1wz_409",pvt="_card_1l1wz_417",gvt="_cardDisabled_1l1wz_428",bvt="_cardHeader_1l1wz_432",yvt="_cardTitle_1l1wz_438",wvt="_cardMenu_1l1wz_449",vvt="_iconAction_1l1wz_456",xvt="_toggle_1l1wz_482",kvt="_toggleOn_1l1wz_501",_vt="_toggleKnob_1l1wz_505",Svt="_cardPrompt_1l1wz_520",Cvt="_cardFooter_1l1wz_533",Tvt="_schedulePill_1l1wz_542",Evt="_clockIcon_1l1wz_554",jvt="_recurringTag_1l1wz_559",Avt="_workspacePill_1l1wz_567",Nvt="_workspaceIcon_1l1wz_584",Mvt="_countdown_1l1wz_589",Ivt="_hourglassIcon_1l1wz_600",Rvt="_lastFired_1l1wz_605",Dvt="_runsToggle_1l1wz_613",Pvt="_runsList_1l1wz_630",Lvt="_runsItem_1l1wz_644",nt={root:Twt,intro:Ewt,toolbar:jwt,count:Awt,toolbarActions:Nwt,primaryButton:Mwt,secondaryButton:Iwt,formFields:Rwt,field:Dwt,fieldGrow:Pwt,fieldLabel:Lwt,required:Owt,input:$wt,textarea:Bwt,select:zwt,promptEditorWrap:Fwt,promptEditor:Hwt,promptPlaceholder:qwt,promptTag:Uwt,promptTagIcon:Wwt,promptTagValue:Vwt,promptTagRemove:Gwt,referencePopover:Kwt,referenceBar:Ywt,referenceButton:Xwt,referenceButtonActive:Qwt,referenceButtonIcon:Jwt,referencePicker:Zwt,referenceItem:evt,referenceItemLabel:tvt,referenceItemDescription:nvt,referenceEmpty:svt,referenceError:rvt,scheduleRow:ivt,preview:ovt,previewLabel:avt,previewCron:lvt,previewInvalid:cvt,formError:uvt,loadError:dvt,formActions:hvt,empty:fvt,list:mvt,card:pvt,cardDisabled:gvt,cardHeader:bvt,cardTitle:yvt,cardMenu:wvt,iconAction:vvt,toggle:xvt,toggleOn:kvt,toggleKnob:_vt,cardPrompt:Svt,cardFooter:Cvt,schedulePill:Tvt,clockIcon:Evt,recurringTag:jvt,workspacePill:Avt,workspaceIcon:Nvt,countdown:Mvt,hourglassIcon:Ivt,lastFired:Rvt,runsToggle:Dvt,runsList:Pvt,runsItem:Lvt},Ovt="_panel_tz8v7_1",$vt="_panelDrawer_tz8v7_11",Bvt="_header_tz8v7_18",zvt="_tabs_tz8v7_35",Fvt="_tabItem_tz8v7_44",Hvt="_tab_tz8v7_35",qvt="_tabTitle_tz8v7_72",Uvt="_tabIcon_tz8v7_79",Wvt="_tabIconSvg_tz8v7_89",Vvt="_tabActive_tz8v7_96",Gvt="_tabCloseButton_tz8v7_111",Kvt="_tabCloseIcon_tz8v7_141",Yvt="_iconButton_tz8v7_147",Xvt="_iconButtonActive_tz8v7_165",Qvt="_toolbarIcon_tz8v7_169",Jvt="_body_tz8v7_175",Zvt="_empty_tz8v7_182",ext="_meta_tz8v7_220",txt="_detail_tz8v7_225",nxt="_section_tz8v7_230",sxt="_sectionTitle_tz8v7_235",rxt="_description_tz8v7_242",ixt="_actionsRow_tz8v7_246",oxt="_fieldGrid_tz8v7_253",axt="_fieldLabel_tz8v7_260",lxt="_fieldValue_tz8v7_269",cxt="_link_tz8v7_274",uxt="_review_tz8v7_283",dxt="_reviewToolbar_tz8v7_290",hxt="_reviewToolbarTitle_tz8v7_299",fxt="_reviewToolbarActions_tz8v7_306",mxt="_reviewTotalsButton_tz8v7_312",pxt="_reviewContent_tz8v7_330",gxt="_reviewContentListOnly_tz8v7_340",bxt="_reviewContentStacked_tz8v7_344",yxt="_reviewList_tz8v7_349",wxt="_reviewListWithExpanded_tz8v7_357",vxt="_reviewSplitHandle_tz8v7_370",xxt="_reviewItem_tz8v7_385",kxt="_reviewItemExpanded_tz8v7_390",_xt="_reviewRow_tz8v7_397",Sxt="_reviewRowToggle_tz8v7_419",Cxt="_reviewFileName_tz8v7_440",Txt="_reviewOpenButton_tz8v7_447",Ext="_fileIcon_tz8v7_465",jxt="_reviewPath_tz8v7_479",Axt="_treeName_tz8v7_480",Nxt="_pathPrefix_tz8v7_496",Mxt="_pathFileName_tz8v7_502",Ixt="_lineStats_tz8v7_510",Rxt="_additions_tz8v7_519",Dxt="_deletions_tz8v7_523",Pxt="_chevron_tz8v7_527",Lxt="_chevronOpen_tz8v7_533",Oxt="_chevronIcon_tz8v7_537",$xt="_diffPreview_tz8v7_543",Bxt="_codeMirrorDiff_tz8v7_553",zxt="_codeMirrorDiffWrap_tz8v7_561",Fxt="_diffError_tz8v7_569",Hxt="_codeMirrorFile_tz8v7_594",qxt="_diffEmpty_tz8v7_660",Uxt="_tree_tz8v7_480",Wxt="_treeNode_tz8v7_673",Vxt="_treeChildren_tz8v7_677",Gxt="_treeRow_tz8v7_691",Kxt="_treeFolder_tz8v7_724",Yxt="_treeFile_tz8v7_728",Xxt="_treeTwisty_tz8v7_737",Qxt="_treeChevronIcon_tz8v7_746",Jxt="_treeChevron_tz8v7_746",Zxt="_treeChevronClosed_tz8v7_757",ekt="_treeContent_tz8v7_761",tkt="_reviewBadge_tz8v7_784",nkt="_htmlPreviewWrap_tz8v7_797",skt="_markdownPreviewWrap_tz8v7_803",rkt="_htmlPreview_tz8v7_797",ikt="_previewError_tz8v7_819",okt="_filePreviewWrap_tz8v7_825",ot={panel:Ovt,panelDrawer:$vt,header:Bvt,tabs:zvt,tabItem:Fvt,tab:Hvt,tabTitle:qvt,tabIcon:Uvt,tabIconSvg:Wvt,tabActive:Vvt,tabCloseButton:Gvt,tabCloseIcon:Kvt,iconButton:Yvt,iconButtonActive:Xvt,toolbarIcon:Qvt,body:Jvt,empty:Zvt,meta:ext,detail:txt,section:nxt,sectionTitle:sxt,description:rxt,actionsRow:ixt,fieldGrid:oxt,fieldLabel:axt,fieldValue:lxt,link:cxt,review:uxt,reviewToolbar:dxt,reviewToolbarTitle:hxt,reviewToolbarActions:fxt,reviewTotalsButton:mxt,reviewContent:pxt,reviewContentListOnly:gxt,reviewContentStacked:bxt,reviewList:yxt,reviewListWithExpanded:wxt,reviewSplitHandle:vxt,reviewItem:xxt,reviewItemExpanded:kxt,reviewRow:_xt,reviewRowToggle:Sxt,reviewFileName:Cxt,reviewOpenButton:Txt,fileIcon:Ext,reviewPath:jxt,treeName:Axt,pathPrefix:Nxt,pathFileName:Mxt,lineStats:Ixt,additions:Rxt,deletions:Dxt,chevron:Pxt,chevronOpen:Lxt,chevronIcon:Oxt,diffPreview:$xt,codeMirrorDiff:Bxt,codeMirrorDiffWrap:zxt,diffError:Fxt,codeMirrorFile:Hxt,diffEmpty:qxt,tree:Uxt,treeNode:Wxt,treeChildren:Vxt,treeRow:Gxt,treeFolder:Kxt,treeFile:Yxt,treeTwisty:Xxt,treeChevronIcon:Qxt,treeChevron:Jxt,treeChevronClosed:Zxt,treeContent:ekt,reviewBadge:tkt,htmlPreviewWrap:nkt,markdownPreviewWrap:skt,htmlPreview:rkt,previewError:ikt,filePreviewWrap:okt},akt="_detail_56y5v_1",lkt="_state_56y5v_7",ckt="_overview_56y5v_15",ukt="_descriptionRow_56y5v_23",dkt="_statusTag_56y5v_31",hkt="_statusActions_56y5v_36",fkt="_stopButton_56y5v_43",mkt="_stopError_56y5v_65",pkt="_description_56y5v_23",gkt="_prompt_56y5v_112",bkt="_transcript_56y5v_124",ykt="_retry_56y5v_133",mc={detail:akt,state:lkt,overview:ckt,descriptionRow:ukt,statusTag:dkt,statusActions:hkt,stopButton:fkt,stopError:mkt,description:pkt,prompt:gkt,transcript:bkt,retry:ykt};function wkt(e,t){const n=typeof e.rawOutput=="object"&&e.rawOutput!==null?e.rawOutput:void 0,s=typeof(n==null?void 0:n.executionSummary)=="object"&&n.executionSummary!==null?n.executionSummary:void 0,r=s==null?void 0:s.totalDurationMs,i=s==null?void 0:s.inputTokens,o=s==null?void 0:s.outputTokens,a=s==null?void 0:s.cachedTokens;return{status:t.status,durationMs:typeof r=="number"?r:e.endTime&&e.startTime?Math.max(0,e.endTime-e.startTime):t.durationMs,inputTokens:typeof i=="number"?i:t.inputTokens,outputTokens:typeof o=="number"?o:t.outputTokens,cachedTokens:typeof a=="number"?a:t.cachedTokens}}function qV(){return`subagent-detail:${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2)}`}function vkt(e,t){for(const n of e){if(n.role!=="tool_group")continue;const s=n.tools.find(r=>r.callId===t);if(s)return s}}function xkt(e,t){var s;const n=e.find(r=>r.role==="user");return((n==null?void 0:n.role)==="user"?n.content:"")||(typeof((s=t.args)==null?void 0:s.prompt)=="string"?t.args.prompt:"")}function kkt(e,t){switch(e){case"completed":case"success":return t("subagent.completed");case"failed":case"error":return t("subagent.failed");case"cancelled":case"canceled":return t("subagent.cancelled");case"paused":return t("subagent.paused");default:return t("subagent.running")}}function _kt({rootTool:e,resolution:t,onStop:n}){const{t:s}=lt(),r=Ra(),i=H5(s),o=R5(e),a=xkt(i,e),c=h.useMemo(()=>wkt(e,t),[t,e]),u=c.status==="running"||c.status==="in_progress",[d,f]=h.useState(!1),[m,p]=h.useState("");h.useEffect(()=>{u||(f(!1),p(""))},[u]);const g=async()=>{if(!d){f(!0),p("");try{(await n()).cancelled||f(!1)}catch{f(!1),p(s("tasks.cancelFailed"))}}};return l.jsxs("div",{className:mc.detail,children:[l.jsxs("div",{className:mc.overview,children:[l.jsxs("div",{className:mc.descriptionRow,children:[o&&l.jsx("div",{className:mc.description,children:o}),l.jsxs("div",{className:mc.statusActions,children:[l.jsx(Pi,{variant:"outline",className:mc.statusTag,"data-status":c.status,children:kkt(c.status,s)}),u&&l.jsx("button",{type:"button",className:mc.stopButton,disabled:d,onClick:()=>void g(),children:s(d?"common.loading":"tasks.action.stop")})]})]}),m&&l.jsx("div",{className:mc.stopError,children:m}),a&&l.jsx("pre",{className:mc.prompt,children:a})]}),l.jsx("div",{className:mc.transcript,children:l.jsx(_P,{messages:i,pendingApproval:null,loadingTranscript:r.loadingTranscript,isResponding:u,workspaceCwd:r.workspaceCwd||"",hideSessionTimeline:!0,hideFirstUserMessage:!0,firstTurnMetrics:c,includeSubagentToolUsageInMetrics:!1})})]})}function Skt({sessionId:e,rootToolCallId:t,initialRootTool:n,workspaceCwd:s}){const{t:r}=lt(),i=io(),o=Ra(),a=H5(r),c=(o.sessionId===e?vkt(a,t):void 0)??n,[u,d]=h.useState(()=>({key:0,clientId:qV()})),[f,m]=h.useState(),[p,g]=h.useState(!1);return h.useEffect(()=>{let b=!1,v=!1,y=0,w;m(void 0),g(!1);const x=async()=>{try{const k=await i.client.resolveSubagentSession(e,t);if(b)return;v=!0,m(k),k.status==="running"&&(w=setTimeout(()=>void x(),3e3))}catch{if(b)return;!v&&y<3?(y+=1,w=setTimeout(()=>void x(),3e3)):v?w=setTimeout(()=>void x(),3e3):g(!0)}};return x(),()=>{b=!0,w&&clearTimeout(w)}},[u.key,t,e,i.client]),p?l.jsxs("div",{className:mc.state,children:[l.jsx("div",{children:r("subagent.detailsLoadFailed")}),l.jsx("button",{type:"button",className:mc.retry,onClick:()=>d(b=>({key:b.key+1,clientId:qV()})),children:r("common.retry")})]}):f?l.jsx(TI,{sessionId:f.sessionId,workspaceCwd:s,clientId:u.clientId,maxQueued:256,subagentTranscriptMode:"full",suppressOwnUserEcho:!0,children:l.jsx(_kt,{rootTool:c,resolution:f,onStop:()=>i.client.cancelSubagentSession(e,t)})},`${u.key}:${f.sessionId}`):l.jsx("div",{className:mc.state,children:r("subagent.detailsLoading")})}const Ckt=700,Tkt=["daily","weekdays","weekly","hourly","minutes","custom"],Ekt=[1,2,3,4,5,6,10,12,15,20,30];function UV({artifacts:e,tabs:t,activeTabId:n,reviewChanges:s,selectedReviewPath:r,panelWidth:i,workspaceCwd:o,loading:a,error:c,onSelectTab:u,onCloseTab:d,onOpenFilePreview:f,onClose:m,variant:p="docked"}){const g=t.find(y=>y.id===n)??t[0],b=pa(),v=g&&"workspaceActions"in g?g.workspaceActions??b:b;return l.jsxs("aside",{className:`${ot.panel} ${p==="drawer"?ot.panelDrawer:""}`,style:p==="docked"&&i?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[l.jsxs("div",{className:ot.header,children:[l.jsx("div",{className:ot.tabs,role:"tablist","aria-label":"Right panel",children:t.map(y=>l.jsxs("div",{className:[ot.tabItem,y.id===(g==null?void 0:g.id)?ot.tabActive:""].filter(Boolean).join(" "),children:[l.jsxs("button",{type:"button",role:"tab","aria-selected":y.id===(g==null?void 0:g.id),className:ot.tab,onClick:()=>u(y.id),title:y.title,children:[l.jsx("span",{className:ot.tabIcon,"aria-hidden":"true",children:y.kind==="review"?l.jsx(Mkt,{}):y.kind==="artifact"||y.kind==="file"?l.jsx(Ikt,{}):y.kind==="subagent"?l.jsx(Akt,{}):y.kind==="monitor"?l.jsx(jkt,{}):l.jsx(Rkt,{})}),l.jsx("span",{className:ot.tabTitle,children:y.title})]}),l.jsx("button",{type:"button",className:ot.tabCloseButton,onClick:()=>d(y.id),"aria-label":`Close ${y.title}`,title:"Close",children:l.jsx(Nkt,{})})]},y.id))}),l.jsx("button",{type:"button",className:ot.iconButton,onClick:m,"aria-label":"Close artifacts panel",title:"Close",children:"×"})]}),l.jsx("div",{className:ot.body,children:g?g.kind==="review"?l.jsx(Lkt,{changes:s,selectedPath:r,workspaceCwd:g.workspaceCwd??o,onOpenFilePreview:y=>f(y,v,g.workspaceCwd??o)}):g.kind==="file"?l.jsx(Lue,{workspacePath:g.workspacePath,workspaceActions:v,previewContent:g.previewContent},g.id):g.kind==="artifact"?l.jsx(Dkt,{artifacts:e,artifactId:g.artifactId,workspaceActions:v,previewContent:g.previewContent,loading:a,error:c},g.id):g.kind==="subagent"?l.jsx(Skt,{sessionId:g.sessionId,rootToolCallId:g.rootToolCallId,initialRootTool:g.rootTool,workspaceCwd:g.workspaceCwd??o}):g.kind==="monitor"?l.jsx(pKe,{task:g.task},g.id):l.jsx(Pkt,{task:g.task,actions:v},g.id):l.jsx("div",{className:ot.empty,children:"No panel selected."})})]})}function jkt(){return l.jsx("svg",{className:ot.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:l.jsx("path",{d:"M4 12h3l2-5 4 10 2-5h5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function Akt(){return l.jsxs("svg",{className:ot.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.6"}),l.jsx("path",{d:"M6.5 19c.7-3.1 2.5-4.7 5.5-4.7s4.8 1.6 5.5 4.7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function Nkt(){return l.jsx("svg",{className:ot.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 Mkt(){return l.jsxs("svg",{className:ot.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 Ikt(){return l.jsxs("svg",{className:ot.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 Rkt(){return l.jsxs("svg",{className:ot.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 Dkt({artifacts:e,artifactId:t,workspaceActions:n,previewContent:s,loading:r,error:i}){const o=e.find(a=>a.id===t);return o?l.jsx(Kkt,{artifact:o,workspaceActions:n,previewContent:s}):r?l.jsx("div",{className:ot.empty,children:"Loading artifact..."}):i?l.jsx("div",{className:ot.empty,children:i}):l.jsx("div",{className:ot.empty,children:"Artifact not found."})}function Pkt({task:e,actions:t}){const{t:n}=lt(),[s,r]=h.useState(null),[i,o]=h.useState(!0),[a,c]=h.useState(null),[u,d]=h.useState(""),[f,m]=h.useState(e.prompt),[p,g]=h.useState(()=>Gf(e.cron)),[b,v]=h.useState(!1),[y,w]=h.useState(!1),[x,k]=h.useState(!1),[C,T]=h.useState(!1),[_,S]=h.useState(null),R=h.useCallback(async()=>{if(!e.durable){r(null),d(""),m(e.prompt),g(Gf(e.cron)),c(null),o(!1);return}o(!0),c(null);try{const q=(await t.listScheduledTasks()).find(K=>K.id===e.id)??null;r(q),q?(d(q.name??""),m(q.prompt),g(Gf(q.cron))):(d(""),m(e.prompt),g(Gf(e.cron)))}catch(ee){c(ee instanceof Error?ee.message:String(ee))}finally{o(!1)}},[t,e.cron,e.durable,e.id,e.prompt]);h.useEffect(()=>{R()},[R]);const A=!e.durable,O=e.durable&&!i&&!a&&!s,M=!!s,D=(s==null?void 0:s.name)||(s==null?void 0:s.prompt)||e.title,$=(s==null?void 0:s.prompt)??e.prompt,z=(s==null?void 0:s.cron)??e.cron,B=(s==null?void 0:s.recurring)??e.recurring,j=s==null?void 0:s.enabled,H=h.useCallback(()=>{s&&(d(s.name??""),m(s.prompt),g(Gf(s.cron)),S(null),v(!0))},[s]),Q=h.useCallback(()=>{v(!1),S(null),s&&(d(s.name??""),m(s.prompt),g(Gf(s.cron)))},[s]),I=h.useCallback(async()=>{if(!s)return;const ee=E3(p);if(!ee){S(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){S(n("scheduledTasks.error.emptyPrompt"));return}T(!0),S(null);try{const q=await t.updateScheduledTask(s.id,{cron:ee,prompt:f.trim(),name:u.trim()||null});r(q),d(q.name??""),m(q.prompt),g(Gf(q.cron)),v(!1)}catch(q){S(q instanceof Error?q.message:String(q))}finally{T(!1)}},[t,p,s,u,f,n]),J=h.useCallback(async()=>{if(s){k(!0),S(null);try{const ee=await t.updateScheduledTask(s.id,{enabled:!s.enabled});r(ee)}catch(ee){S(ee instanceof Error?ee.message:String(ee))}finally{k(!1)}}},[t,s]),W=h.useCallback(async()=>{if(s){k(!0),S(null);try{await t.deleteScheduledTask(s.id),r(null),w(!1)}catch(ee){S(ee instanceof Error?ee.message:String(ee))}finally{k(!1)}}},[t,s]),P=E3(p),V=P?Px(P,n):null;return l.jsxs("div",{className:ot.detail,children:[i&&l.jsx("div",{className:ot.empty,children:n("scheduledTasks.loading")}),a&&l.jsx("div",{className:nt.loadError,children:a}),O&&l.jsx("div",{className:ot.empty,children:n("scheduledTasks.deletedSnapshot")}),A&&l.jsx("div",{className:ot.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!O&&l.jsx("div",{className:ot.section,children:l.jsxs("div",{className:ot.fieldGrid,children:[l.jsx("span",{className:ot.fieldLabel,children:n("scheduledTasks.name")}),l.jsx("span",{className:ot.fieldValue,children:D}),l.jsx("span",{className:ot.fieldLabel,children:n("scheduledTasks.taskId")}),l.jsx("span",{className:ot.fieldValue,children:e.id}),l.jsx("span",{className:ot.fieldLabel,children:n("scheduledTasks.schedule")}),l.jsx("span",{className:ot.fieldValue,children:Px(z,n)}),l.jsx("span",{className:ot.fieldLabel,children:"Cron"}),l.jsx("span",{className:ot.fieldValue,children:z}),l.jsx("span",{className:ot.fieldLabel,children:n("scheduledTasks.type")}),l.jsx("span",{className:ot.fieldValue,children:n(B?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),j!==void 0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:ot.fieldLabel,children:n("scheduledTasks.status")}),l.jsx("span",{className:ot.fieldValue,children:n(j?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!O&&l.jsxs("div",{className:ot.section,children:[l.jsx("div",{className:ot.sectionTitle,children:"Prompt"}),l.jsx("div",{className:ot.description,children:$})]}),_&&l.jsx("div",{className:nt.formError,children:_}),l.jsxs("div",{className:ot.actionsRow,children:[l.jsx("button",{type:"button",className:nt.primaryButton,disabled:!M||x,onClick:H,children:n("scheduledTasks.edit")}),l.jsx("button",{type:"button",className:nt.secondaryButton,disabled:!M||x,onClick:()=>void J(),children:s!=null&&s.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),l.jsx("button",{type:"button",className:nt.secondaryButton,disabled:!M||x,onClick:()=>w(!0),children:n("scheduledTasks.delete")})]}),y&&s&&l.jsx(Ii,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>w(!1),children:l.jsxs("div",{className:nt.formFields,children:[l.jsx("div",{className:ot.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),_&&l.jsx("div",{className:nt.formError,children:_}),l.jsxs("div",{className:nt.formActions,children:[l.jsx("button",{type:"button",className:nt.secondaryButton,onClick:()=>w(!1),disabled:x,children:n("scheduledTasks.cancel")}),l.jsx("button",{type:"button",className:nt.primaryButton,onClick:()=>void W(),disabled:x,children:n("scheduledTasks.delete")})]})]})}),b&&l.jsx(Ii,{title:n("scheduledTasks.editTitle"),size:"md",onClose:Q,children:l.jsxs("div",{className:nt.formFields,children:[l.jsxs("label",{className:nt.field,children:[l.jsx("span",{className:nt.fieldLabel,children:n("scheduledTasks.name")}),l.jsx("input",{className:nt.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:ee=>d(ee.target.value)})]}),l.jsxs("label",{className:nt.field,children:[l.jsxs("span",{className:nt.fieldLabel,children:[n("scheduledTasks.prompt"),l.jsx("span",{className:nt.required,children:"*"})]}),l.jsx("textarea",{className:nt.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:ee=>m(ee.target.value)})]}),l.jsxs("div",{className:nt.scheduleRow,children:[l.jsxs("label",{className:nt.field,children:[l.jsx("span",{className:nt.fieldLabel,children:n("scheduledTasks.frequency")}),l.jsx("select",{className:nt.select,value:p.frequency,onChange:ee=>{const q=ee.target.value;g(K=>({...K,frequency:q,...q==="hourly"?{time:"00:00"}:{}}))},children:Tkt.map(ee=>l.jsx("option",{value:ee,children:n(`scheduledTasks.freq.${ee}`)},ee))})]}),(p.frequency==="daily"||p.frequency==="weekdays"||p.frequency==="weekly")&&l.jsxs("label",{className:nt.field,children:[l.jsx("span",{className:nt.fieldLabel,children:n("scheduledTasks.time")}),l.jsx("input",{className:nt.input,type:"time",value:p.time,onChange:ee=>g(q=>({...q,time:ee.target.value}))})]}),p.frequency==="weekly"&&l.jsxs("label",{className:nt.field,children:[l.jsx("span",{className:nt.fieldLabel,children:n("scheduledTasks.weekday")}),l.jsx("select",{className:nt.select,value:p.weekday,onChange:ee=>g(q=>({...q,weekday:Number(ee.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((ee,q)=>l.jsx("option",{value:q,children:ee},q))})]}),p.frequency==="minutes"&&l.jsxs("label",{className:nt.field,children:[l.jsx("span",{className:nt.fieldLabel,children:n("scheduledTasks.interval")}),l.jsx("select",{className:nt.select,value:p.minuteInterval,onChange:ee=>g(q=>({...q,minuteInterval:Number(ee.target.value)})),children:Ekt.map(ee=>l.jsx("option",{value:ee,children:ee},ee))})]}),p.frequency==="custom"&&l.jsxs("label",{className:`${nt.field} ${nt.fieldGrow}`,children:[l.jsx("span",{className:nt.fieldLabel,children:n("scheduledTasks.cron")}),l.jsx("input",{className:nt.input,type:"text",value:p.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:ee=>g(q=>({...q,customCron:ee.target.value}))})]})]}),l.jsx("div",{className:nt.preview,children:V?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:nt.previewLabel,children:V}),l.jsx("code",{className:nt.previewCron,children:P})]}):l.jsx("span",{className:nt.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),_&&l.jsx("div",{className:nt.formError,children:_}),l.jsxs("div",{className:nt.formActions,children:[l.jsx("button",{type:"button",className:nt.secondaryButton,onClick:Q,disabled:C,children:n("scheduledTasks.cancel")}),l.jsx("button",{type:"button",className:nt.primaryButton,onClick:()=>void I(),disabled:C,children:n(C?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function Lkt({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s}){const{t:r}=lt(),[i,o]=h.useState(!1),[a,c]=h.useState(!0),[u,d]=h.useState(!1),[f,m]=h.useState(520),p=h.useRef(f),g=h.useRef(null),b=h.useRef(null),[v,y]=h.useState(null),w=i,x=h.useMemo(()=>Vkt(e,n),[e,n]);h.useEffect(()=>{y(t)},[t]),h.useEffect(()=>{p.current=f},[f]),h.useEffect(()=>{const _=g.current;if(!_)return;const S=()=>{d(_.clientWidth<Ckt)};S();const R=new ResizeObserver(S);return R.observe(_),()=>R.disconnect()},[a]),h.useEffect(()=>()=>{var _;return(_=b.current)==null?void 0:_.call(b)},[]);const k=h.useCallback(_=>{const S=g.current;if(!S)return;_.preventDefault();const R=_.currentTarget;R.setPointerCapture(_.pointerId);const A=_.clientX,O=p.current,M=S.getBoundingClientRect().width,D=Math.max(180,M-180),$=document.body.style.cursor,z=document.body.style.userSelect;let B=O,j=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const H=()=>{j=null,m(B)},Q=W=>{B=Math.min(D,Math.max(180,O+(W.clientX-A))),j===null&&(j=window.requestAnimationFrame(H))};let I=()=>{};const J=W=>{b.current=null,j!==null&&(window.cancelAnimationFrame(j),j=null),W&&m(B),R.hasPointerCapture(_.pointerId)&&R.releasePointerCapture(_.pointerId),document.body.style.cursor=$,document.body.style.userSelect=z,window.removeEventListener("pointermove",Q),window.removeEventListener("pointerup",I),window.removeEventListener("pointercancel",I)};I=()=>J(!0),b.current=()=>J(!1),window.addEventListener("pointermove",Q),window.addEventListener("pointerup",I),window.addEventListener("pointercancel",I)},[]);if(e.length===0)return l.jsx("div",{className:ot.empty,children:"No file changes to review."});const C=bce(e),T=_=>{y(S=>S===_?null:_)};return l.jsxs("div",{className:ot.review,children:[l.jsxs("div",{className:ot.reviewToolbar,children:[l.jsxs("div",{className:ot.reviewToolbarTitle,children:[l.jsx("span",{children:r("turnOutputs.previousTurn")}),l.jsx(j3,{additions:C==null?void 0:C.additions,deletions:C==null?void 0:C.deletions,className:ot.lineStats,additionsClassName:ot.additions,deletionsClassName:ot.deletions})]}),l.jsxs("div",{className:ot.reviewToolbarActions,children:[l.jsxs("button",{type:"button",className:ot.reviewTotalsButton,onClick:()=>c(_=>!_),"aria-expanded":a,children:[l.jsx("span",{children:r("turnOutputs.fileCount",{count:e.length})}),l.jsx("span",{className:[ot.chevron,a?ot.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:l.jsx(VV,{})})]}),l.jsx("button",{type:"button",className:[ot.iconButton,i?ot.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>o(_=>!_),"aria-label":r(i?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:r(i?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:i?l.jsx(Ukt,{}):l.jsx(qkt,{})})]})]}),a&&l.jsxs("div",{ref:g,className:[ot.reviewContent,w?"":ot.reviewContentListOnly,w&&u?ot.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${f}px`},children:[l.jsx("div",{className:[ot.reviewList,v?ot.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(_=>{const S=v===_.path,R=vce(_.path);return l.jsxs("div",{className:[ot.reviewItem,S?ot.reviewItemExpanded:""].filter(Boolean).join(" "),children:[l.jsxs("div",{className:ot.reviewRow,"data-selected":_.path===t||void 0,children:[l.jsx("button",{type:"button",className:ot.reviewRowToggle,onClick:()=>T(_.path),"aria-label":_.path,"aria-expanded":S}),l.jsx("span",{className:ot.fileIcon,children:Pue(_.path)}),l.jsxs("span",{className:ot.reviewFileName,children:[l.jsx(zkt,{path:O5(_.path,n),title:_.path}),R&&l.jsx("button",{type:"button",className:ot.reviewOpenButton,onClick:()=>s(_),title:`${r("turnOutputs.preview")} ${_.path}`,children:r("turnOutputs.preview")})]}),l.jsx(j3,{additions:_.additions,deletions:_.deletions,className:ot.lineStats,additionsClassName:ot.additions,deletionsClassName:ot.deletions}),l.jsx("span",{className:[ot.chevron,S?ot.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:l.jsx(VV,{})})]}),S&&l.jsx(Okt,{change:_})]},`${_.toolCallId}:${_.path}`)})}),w&&!u&&l.jsx("div",{className:ot.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:k}),w&&l.jsx("div",{className:ot.tree,children:x.children.map(_=>l.jsx(Iue,{node:_,depth:0,selectedPath:t},_.path))})]})]})}function Okt({change:e}){if(e.diffs.length===0)return l.jsx("div",{className:ot.diffEmpty,children:"No diff available."});const t=$kt(e.diffs);return l.jsx("div",{className:ot.diffPreview,children:t.map((n,s)=>l.jsx(Bkt,{oldText:n.oldText,newText:n.newText},s))})}function $kt(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 Bkt({oldText:e,newText:t}){const n=h.useRef(null),[s,r]=h.useState(null),[i,o]=h.useState(null);return h.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()},[]),h.useEffect(()=>{const a=n.current;if(!a||s===null)return;a.replaceChildren(),o(null);let c=!1,u=null;const d=[mle,Vt.editable.of(!1),dr.readOnly.of(!0),Vt.lineWrapping],f={scanLimit:1e3,timeout:500},m={margin:3,minSize:8};return he(async()=>{const{MergeView:p,unifiedMergeView:g}=await import("./index-CKIadvET.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:f});return}u=new Vt({doc:t,extensions:[...d,g({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:m,diffConfig:f})],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:ot.codeMirrorDiffWrap,children:[l.jsx("div",{ref:n,className:ot.codeMirrorDiff}),i&&l.jsxs("div",{className:ot.diffError,children:["Diff unavailable: ",i]})]})}function Iue({node:e,depth:t,selectedPath:n}){var d,f;const s=!!e.file,[r,i]=h.useState(!0),o=[ot.treeRow,s?ot.treeFile:ot.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:ot.treeTwisty,children:!s&&l.jsx("span",{className:[ot.treeChevron,r?"":ot.treeChevronClosed].filter(Boolean).join(" "),children:l.jsx(Wkt,{})})}),l.jsxs("span",{className:ot.treeContent,children:[s&&l.jsx("span",{className:ot.fileIcon,children:Pue(e.path)}),l.jsx("span",{className:ot.treeName,children:e.name})]}),((d=e.file)==null?void 0:d.isArtifact)&&l.jsx("span",{className:ot.reviewBadge,children:"artifact"})]});return l.jsxs("div",{className:ot.treeNode,children:[s?l.jsx("div",{className:o,"data-selected":((f=e.file)==null?void 0:f.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:ot.treeChildren,style:c,children:e.children.map(m=>l.jsx(Iue,{node:m,depth:t+1,selectedPath:n},m.path))})]})}function zkt({path:e,title:t}){const n=h.useRef(null),[s,r]=h.useState(()=>Rue(e));return h.useLayoutEffect(()=>{const i=n.current;if(!i)return;const o=()=>r(Fkt(e,i));o();const a=new ResizeObserver(o);return a.observe(i),()=>a.disconnect()},[e]),l.jsxs("span",{ref:n,className:ot.reviewPath,title:t??e,children:[s.prefix&&l.jsx("span",{className:ot.pathPrefix,children:s.prefix}),l.jsx("span",{className:ot.pathFileName,children:s.leaf})]})}function Rue(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let WV=null;function Fkt(e,t){const n=Rue(e),s=t.clientWidth;if(s<=0)return n;const r=Hkt(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 f=`.../${i.slice(i.length-1-u,-1).join("/")}/`;if(r(f)+a>s)break;c=f}return{prefix:c,leaf:o}}function Hkt(e){WV??(WV=document.createElement("canvas"));const t=WV.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 qkt(){return l.jsxs("svg",{className:ot.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 Ukt(){return l.jsxs("svg",{className:ot.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 VV(){return l.jsx("svg",{className:ot.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 Wkt(){return l.jsx("svg",{className:ot.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 Vkt(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=O5(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 Due(n),n}function Due(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)Due(t)}function Gkt(e){return tg(e).split("/").filter(Boolean).at(-1)??e}function Pue(e){var r;const t=Gkt(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 Kkt({artifact:e,workspaceActions:t,previewContent:n}){var a;const s=$Je(e),r=mie(e.url)?e.url:void 0,i=((a=e.metadata)==null?void 0:a.artifactType)==="automation_snapshot";return e.storage==="workspace"&&!!e.workspacePath&&e.workspacePath?l.jsx(Lue,{workspacePath:e.workspacePath,artifactVersion:e.updatedAt,workspaceActions:t,previewContent:n,previewKind:Ykt(e)?"html":Xkt(e)?"markdown":"source"}):l.jsxs("div",{className:ot.detail,children:[l.jsxs("div",{className:ot.section,children:[l.jsx("div",{className:ot.sectionTitle,children:i?"Automation Snapshot":"Artifact"}),l.jsxs("div",{className:ot.fieldGrid,children:[l.jsx(vd,{label:"Type",value:mce(e.kind)}),l.jsx(vd,{label:"Storage",value:e.storage}),l.jsx(vd,{label:"Status",value:e.status}),l.jsx(vd,{label:"Source",value:e.source}),l.jsx(vd,{label:"Size",value:pce(e.sizeBytes)}),l.jsx(vd,{label:"Created",value:e.createdAt}),l.jsx(vd,{label:"Updated",value:e.updatedAt}),e.toolName&&l.jsx(vd,{label:"Tool",value:e.toolName}),e.toolCallId&&l.jsx(vd,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&l.jsxs("div",{className:ot.section,children:[l.jsx("div",{className:ot.sectionTitle,children:"Description"}),l.jsx("div",{className:ot.description,children:e.description})]}),i&&e.metadata&&l.jsxs("div",{className:ot.section,children:[l.jsx("div",{className:ot.sectionTitle,children:"Details"}),l.jsxs("div",{className:ot.fieldGrid,children:[i1(e.metadata,"automationId","Automation ID"),i1(e.metadata,"schedule","Schedule"),i1(e.metadata,"timezone","Timezone"),i1(e.metadata,"status","Status"),i1(e.metadata,"nextRunAt","Next run"),i1(e.metadata,"prompt","Prompt")]})]}),(s||r)&&l.jsxs("div",{className:ot.section,children:[l.jsx("div",{className:ot.sectionTitle,children:"Location"}),r?l.jsx("a",{className:ot.link,href:r,target:"_blank",rel:"noreferrer",children:r}):l.jsx("div",{className:ot.meta,children:s})]})]})}function Ykt(e){var s,r;const t=((s=e.workspacePath)==null?void 0:s.toLowerCase())??"",n=((r=e.mimeType)==null?void 0:r.toLowerCase())??"";return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function Xkt(e){var n,s;const t=((n=e.workspacePath)==null?void 0:n.toLowerCase())??"";return t.endsWith(".md")||t.endsWith(".markdown")||((s=e.mimeType)==null?void 0:s.toLowerCase())==="text/markdown"}function Lue({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewKind:r=e.toLowerCase().endsWith(".html")||e.toLowerCase().endsWith(".htm")?"html":e.toLowerCase().endsWith(".md")||e.toLowerCase().endsWith(".markdown")?"markdown":"source"}){return r==="html"?l.jsx(Qkt,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s}):r==="markdown"?l.jsx(Zkt,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s}):l.jsx(Jkt,{workspacePath:e,artifactVersion:t,workspaceActions:n})}function LP({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,truncatedMessage:r}){const[i,o]=h.useState(s??null),[a,c]=h.useState(null);return h.useEffect(()=>{let u=!1;return o(s??null),c(null),n.readWorkspaceFile(e).then(d=>{u||(o(d.content),d.truncated&&c(r))}).catch(d=>{u||c(d instanceof Error?d.message:String(d))}),()=>{u=!0}},[t,s,r,n,e]),{content:i,error:a}}function Qkt({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s}){const{content:r,error:i}=LP({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,truncatedMessage:"Preview is truncated because the file is too large."});return l.jsxs("div",{className:ot.htmlPreviewWrap,children:[r===null?l.jsx("div",{className:ot.empty,children:"Loading preview..."}):l.jsx("iframe",{className:ot.htmlPreview,referrerPolicy:"no-referrer",sandbox:"",srcDoc:BJe(r),title:`Preview ${e}`}),i&&l.jsx("div",{className:ot.previewError,children:i})]})}function Jkt({workspacePath:e,artifactVersion:t,workspaceActions:n}){const s=h.useRef(null),[r,i]=h.useState(null),{content:o,error:a}=LP({workspacePath:e,artifactVersion:t,workspaceActions:n,truncatedMessage:"File is truncated because it is too large."});return h.useEffect(()=>{const c=s.current;if(!c||o===null)return;c.replaceChildren(),i(null);let u;try{u=new Vt({doc:o,extensions:[mle,Vt.editable.of(!1),dr.readOnly.of(!0),Vt.lineWrapping],parent:c})}catch(d){i(d instanceof Error?d.message:String(d));return}return()=>u.destroy()},[o]),l.jsxs("div",{className:ot.filePreviewWrap,children:[o===null?l.jsx("div",{className:ot.empty,children:"Loading file..."}):l.jsx("div",{ref:s,className:ot.codeMirrorFile}),(a||r)&&l.jsx("div",{className:ot.previewError,children:a||r})]})}function Zkt({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s}){const{content:r,error:i}=LP({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,truncatedMessage:"Preview is truncated because the file is too large."});return l.jsxs("div",{className:ot.markdownPreviewWrap,children:[r===null?l.jsx("div",{className:ot.empty,children:"Loading preview..."}):l.jsx(pf,{content:r}),i&&l.jsx("div",{className:ot.previewError,children:i})]})}function vd({label:e,value:t}){return t?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:ot.fieldLabel,children:e}),l.jsx("span",{className:ot.fieldValue,children:t})]}):null}function i1(e,t,n){const s=e[t];return s==null||s===""?null:l.jsx(vd,{label:n,value:String(s)},t)}function e_t(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const Oue=kn.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),Lk=()=>{const e=kn.useContext(Oue);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};e_t(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
[data-state=closed]
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function t_t(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function n_t(){return OP(/^Mac/)}function s_t(){return OP(/^iPhone/)}function GV(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function r_t(){return OP(/^iPad/)||n_t()&&navigator.maxTouchPoints>1}function $ue(){return s_t()||r_t()}function OP(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const i_t=24,o_t=typeof window<"u"?h.useLayoutEffect:h.useEffect;function KV(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}const UE=typeof document<"u"&&window.visualViewport;function YV(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Bue(e){for(YV(e)&&(e=e.parentElement);e&&!YV(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const a_t=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let w2=0,WE;function l_t(e={}){let{isDisabled:t}=e;o_t(()=>{if(!t)return w2++,w2===1&&$ue()&&(WE=c_t()),()=>{w2--,w2===0&&(WE==null||WE())}},[t])}function c_t(){let e,t=0,n=f=>{e=Bue(f.target),!(e===document.documentElement&&e===document.body)&&(t=f.changedTouches[0].pageY)},s=f=>{if(!e||e===document.documentElement||e===document.body){f.preventDefault();return}let m=f.changedTouches[0].pageY,p=e.scrollTop,g=e.scrollHeight-e.clientHeight;g!==0&&((p<=0&&m>t||p>=g&&m<t)&&f.preventDefault(),t=m)},r=f=>{let m=f.target;n9(m)&&m!==document.activeElement&&(f.preventDefault(),m.style.transform="translateY(-2000px)",m.focus(),requestAnimationFrame(()=>{m.style.transform=""}))},i=f=>{let m=f.target;n9(m)&&(m.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{m.style.transform="",UE&&(UE.height<window.innerHeight?requestAnimationFrame(()=>{XV(m)}):UE.addEventListener("resize",()=>XV(m),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},a=window.pageXOffset,c=window.pageYOffset,u=KV(u_t(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let d=KV(Sw(document,"touchstart",n,{passive:!1,capture:!0}),Sw(document,"touchmove",s,{passive:!1,capture:!0}),Sw(document,"touchend",r,{passive:!1,capture:!0}),Sw(document,"focus",i,!0),Sw(window,"scroll",o));return()=>{u(),d(),window.scrollTo(a,c)}}function u_t(e,t,n){let s=e.style[t];return e.style[t]=n,()=>{e.style[t]=s}}function Sw(e,t,n,s){return e.addEventListener(t,n,s),()=>{e.removeEventListener(t,n,s)}}function XV(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=Bue(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let s=n.getBoundingClientRect().top,r=e.getBoundingClientRect().top,i=e.getBoundingClientRect().bottom;const o=n.getBoundingClientRect().bottom+i_t;i>o&&(n.scrollTop+=r-s)}e=n.parentElement}}function n9(e){return e instanceof HTMLInputElement&&!a_t.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function d_t(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function h_t(...e){return t=>e.forEach(n=>d_t(n,t))}function zue(...e){return h.useCallback(h_t(...e),e)}const Fue=new WeakMap;function Ho(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let s={};Object.entries(t).forEach(([r,i])=>{if(r.startsWith("--")){e.style.setProperty(r,i);return}s[r]=e.style[r],e.style[r]=i}),!n&&Fue.set(e,s)}function f_t(e,t){if(!e||!(e instanceof HTMLElement))return;let n=Fue.get(e);n&&(e.style[t]=n[t])}const Co=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function v2(e,t){if(!e)return null;const n=window.getComputedStyle(e),s=n.transform||n.webkitTransform||n.mozTransform;let r=s.match(/^matrix3d\((.+)\)$/);return r?parseFloat(r[1].split(", ")[Co(t)?13:12]):(r=s.match(/^matrix\((.+)\)$/),r?parseFloat(r[1].split(", ")[Co(t)?5:4]):null)}function m_t(e){return 8*(Math.log(e+1)-2)}function VE(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}function p_t(...e){return(...t)=>{for(const n of e)typeof n=="function"&&n(...t)}}const Vi={DURATION:.5,EASE:[.32,.72,0,1]},Hue=.4,g_t=.25,b_t=100,que=8,s0=16,s9=26,GE="vaul-dragging";function Uue(e){const t=kn.useRef(e);return kn.useEffect(()=>{t.current=e}),kn.useMemo(()=>(...n)=>t.current==null?void 0:t.current.call(t,...n),[])}function y_t({defaultProp:e,onChange:t}){const n=kn.useState(e),[s]=n,r=kn.useRef(s),i=Uue(t);return kn.useEffect(()=>{r.current!==s&&(i(s),r.current=s)},[s,r,i]),n}function Wue({prop:e,defaultProp:t,onChange:n=()=>{}}){const[s,r]=y_t({defaultProp:t,onChange:n}),i=e!==void 0,o=i?e:s,a=Uue(n),c=kn.useCallback(u=>{if(i){const f=typeof u=="function"?u(e):u;f!==e&&a(f)}else r(u)},[i,e,r,a]);return[o,c]}function w_t({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:s,overlayRef:r,fadeFromIndex:i,onSnapPointChange:o,direction:a="bottom",container:c,snapToSequentialPoint:u}){const[d,f]=Wue({prop:e,defaultProp:n==null?void 0:n[0],onChange:t}),[m,p]=kn.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);kn.useEffect(()=>{function _(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[]);const g=kn.useMemo(()=>d===(n==null?void 0:n[n.length-1])||null,[n,d]),b=kn.useMemo(()=>{var _;return(_=n==null?void 0:n.findIndex(S=>S===d))!=null?_:null},[n,d]),v=n&&n.length>0&&(i||i===0)&&!Number.isNaN(i)&&n[i]===d||!n,y=kn.useMemo(()=>{const _=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var S;return(S=n==null?void 0:n.map(R=>{const A=typeof R=="string";let O=0;if(A&&(O=parseInt(R,10)),Co(a)){const D=A?O:m?R*_.height:0;return m?a==="bottom"?_.height-D:-_.height+D:D}const M=A?O:m?R*_.width:0;return m?a==="right"?_.width-M:-_.width+M:M}))!=null?S:[]},[n,m,c]),w=kn.useMemo(()=>b!==null?y==null?void 0:y[b]:null,[y,b]),x=kn.useCallback(_=>{var S;const R=(S=y==null?void 0:y.findIndex(A=>A===_))!=null?S:null;o(R),Ho(s.current,{transition:`transform ${Vi.DURATION}s cubic-bezier(${Vi.EASE.join(",")})`,transform:Co(a)?`translate3d(0, ${_}px, 0)`:`translate3d(${_}px, 0, 0)`}),y&&R!==y.length-1&&i!==void 0&&R!==i&&R<i?Ho(r.current,{transition:`opacity ${Vi.DURATION}s cubic-bezier(${Vi.EASE.join(",")})`,opacity:"0"}):Ho(r.current,{transition:`opacity ${Vi.DURATION}s cubic-bezier(${Vi.EASE.join(",")})`,opacity:"1"}),f(n==null?void 0:n[Math.max(R,0)])},[s.current,n,y,i,r,f]);kn.useEffect(()=>{if(d||e){var _;const S=(_=n==null?void 0:n.findIndex(R=>R===e||R===d))!=null?_:-1;y&&S!==-1&&typeof y[S]=="number"&&x(y[S])}},[d,e,n,y,x]);function k({draggedDistance:_,closeDrawer:S,velocity:R,dismissible:A}){if(i===void 0)return;const O=a==="bottom"||a==="right"?(w??0)-_:(w??0)+_,M=b===i-1,D=b===0,$=_>0;if(M&&Ho(r.current,{transition:`opacity ${Vi.DURATION}s cubic-bezier(${Vi.EASE.join(",")})`}),!u&&R>2&&!$){A?S():x(y[0]);return}if(!u&&R>2&&$&&y&&n){x(y[n.length-1]);return}const z=y==null?void 0:y.reduce((j,H)=>typeof j!="number"||typeof H!="number"?j:Math.abs(H-O)<Math.abs(j-O)?H:j),B=Co(a)?window.innerHeight:window.innerWidth;if(R>Hue&&Math.abs(_)<B*.4){const j=$?1:-1;if(j>0&&g&&n){x(y[n.length-1]);return}if(D&&j<0&&A&&S(),b===null)return;x(y[b+j]);return}x(z)}function C({draggedDistance:_}){if(w===null)return;const S=a==="bottom"||a==="right"?w-_:w+_;(a==="bottom"||a==="right")&&S<y[y.length-1]||(a==="top"||a==="left")&&S>y[y.length-1]||Ho(s.current,{transform:Co(a)?`translate3d(0, ${S}px, 0)`:`translate3d(${S}px, 0, 0)`})}function T(_,S){if(!n||typeof b!="number"||!y||i===void 0)return null;const R=b===i-1;if(b>=i&&S)return 0;if(R&&!S)return 1;if(!v&&!R)return null;const O=R?b+1:b-1,M=R?y[O]-y[O-1]:y[O+1]-y[O],D=_/Math.abs(M);return R?1-D:D}return{isLastSnapPoint:g,activeSnapPoint:d,shouldFade:v,getPercentageDragged:T,setActiveSnapPoint:f,activeSnapPointIndex:b,onRelease:k,onDrag:C,snapPointsOffset:y}}const v_t=()=>()=>{};function x_t(){const{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:s,noBodyStyles:r}=Lk(),i=kn.useRef(null),o=h.useMemo(()=>document.body.style.backgroundColor,[]);function a(){return(window.innerWidth-s9)/window.innerWidth}kn.useEffect(()=>{if(t&&n){i.current&&clearTimeout(i.current);const c=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!c)return;p_t(s&&!r?VE(document.body,{background:"black"}):v_t,VE(c,{transformOrigin:Co(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${Vi.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Vi.EASE.join(",")})`}));const u=VE(c,{borderRadius:`${que}px`,overflow:"hidden",...Co(e)?{transform:`scale(${a()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${a()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{u(),i.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty("background")},Vi.DURATION*1e3)}}},[t,n,o])}let Cw=null;function k_t({isOpen:e,modal:t,nested:n,hasBeenOpened:s,preventScrollRestoration:r,noBodyStyles:i}){const[o,a]=kn.useState(()=>typeof window<"u"?window.location.href:""),c=kn.useRef(0),u=kn.useCallback(()=>{if(GV()&&Cw===null&&e&&!i){Cw={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:f,innerHeight:m}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-f}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const p=m-window.innerHeight;p&&c.current>=m&&(document.body.style.top=`${-(c.current+p)}px`)}),300)}},[e]),d=kn.useCallback(()=>{if(GV()&&Cw!==null&&!i){const f=-parseInt(document.body.style.top,10),m=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Cw),window.requestAnimationFrame(()=>{if(r&&o!==window.location.href){a(window.location.href);return}window.scrollTo(m,f)}),Cw=null}},[o]);return kn.useEffect(()=>{function f(){c.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),kn.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||d()}},[t,d]),kn.useEffect(()=>{n||!s||(e?(!window.matchMedia("(display-mode: standalone)").matches&&u(),t||window.setTimeout(()=>{d()},500)):d())},[e,s,o,t,n,u,d]),{restorePositionSetting:d}}function __t({open:e,onOpenChange:t,children:n,onDrag:s,onRelease:r,snapPoints:i,shouldScaleBackground:o=!1,setBackgroundColorOnScale:a=!0,closeThreshold:c=g_t,scrollLockTimeout:u=b_t,dismissible:d=!0,handleOnly:f=!1,fadeFromIndex:m=i&&i.length-1,activeSnapPoint:p,setActiveSnapPoint:g,fixed:b,modal:v=!0,onClose:y,nested:w,noBodyStyles:x=!1,direction:k="bottom",defaultOpen:C=!1,disablePreventScroll:T=!0,snapToSequentialPoint:_=!1,preventScrollRestoration:S=!1,repositionInputs:R=!0,onAnimationEnd:A,container:O,autoFocus:M=!1}){var D,$;const[z=!1,B]=Wue({defaultProp:C,prop:e,onChange:ve=>{t==null||t(ve),!ve&&!w&&je(),setTimeout(()=>{A==null||A(ve)},Vi.DURATION*1e3),ve&&!v&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),ve||(document.body.style.pointerEvents="auto")}}),[j,H]=kn.useState(!1),[Q,I]=kn.useState(!1),[J,W]=kn.useState(!1),P=kn.useRef(null),V=kn.useRef(null),ee=kn.useRef(null),q=kn.useRef(null),K=kn.useRef(null),de=kn.useRef(!1),re=kn.useRef(null),ne=kn.useRef(0),U=kn.useRef(!1),Z=kn.useRef(!C),ge=kn.useRef(0),ce=kn.useRef(null),ue=kn.useRef(((D=ce.current)==null?void 0:D.getBoundingClientRect().height)||0),be=kn.useRef((($=ce.current)==null?void 0:$.getBoundingClientRect().width)||0),rt=kn.useRef(0),le=kn.useCallback(ve=>{i&&ve===rn.length-1&&(V.current=new Date)},[]),{activeSnapPoint:Me,activeSnapPointIndex:We,setActiveSnapPoint:at,onRelease:ze,snapPointsOffset:rn,onDrag:Wt,shouldFade:zt,getPercentageDragged:ae}=w_t({snapPoints:i,activeSnapPointProp:p,setActiveSnapPointProp:g,drawerRef:ce,fadeFromIndex:m,overlayRef:P,onSnapPointChange:le,direction:k,container:O,snapToSequentialPoint:_});l_t({isDisabled:!z||Q||!v||J||!j||!R||!T});const{restorePositionSetting:je}=k_t({isOpen:z,modal:v,nested:w??!1,hasBeenOpened:j,preventScrollRestoration:S,noBodyStyles:x});function it(){return(window.innerWidth-s9)/window.innerWidth}function gt(ve){var Fe,ie;!d&&!i||ce.current&&!ce.current.contains(ve.target)||(ue.current=((Fe=ce.current)==null?void 0:Fe.getBoundingClientRect().height)||0,be.current=((ie=ce.current)==null?void 0:ie.getBoundingClientRect().width)||0,I(!0),ee.current=new Date,$ue()&&window.addEventListener("touchend",()=>de.current=!1,{once:!0}),ve.target.setPointerCapture(ve.pointerId),ne.current=Co(k)?ve.pageY:ve.pageX)}function wt(ve,Fe){var ie;let Pe=ve;const et=(ie=window.getSelection())==null?void 0:ie.toString(),He=ce.current?v2(ce.current,k):null,Ae=new Date;if(Pe.tagName==="SELECT"||Pe.hasAttribute("data-vaul-no-drag")||Pe.closest("[data-vaul-no-drag]"))return!1;if(k==="right"||k==="left")return!0;if(V.current&&Ae.getTime()-V.current.getTime()<500)return!1;if(He!==null&&(k==="bottom"?He>0:He<0))return!0;if(et&&et.length>0)return!1;if(K.current&&Ae.getTime()-K.current.getTime()<u&&He===0||Fe)return K.current=Ae,!1;for(;Pe;){if(Pe.scrollHeight>Pe.clientHeight){if(Pe.scrollTop!==0)return K.current=new Date,!1;if(Pe.getAttribute("role")==="dialog")return!0}Pe=Pe.parentNode}return!0}function Ke(ve){if(ce.current&&Q){const Fe=k==="bottom"||k==="right"?1:-1,ie=(ne.current-(Co(k)?ve.pageY:ve.pageX))*Fe,Pe=ie>0,et=i&&!d&&!Pe;if(et&&We===0)return;const He=Math.abs(ie),Ae=document.querySelector("[data-vaul-drawer-wrapper]"),vt=k==="bottom"||k==="top"?ue.current:be.current;let vn=He/vt;const Ce=ae(He,Pe);if(Ce!==null&&(vn=Ce),et&&vn>=1||!de.current&&!wt(ve.target,Pe))return;if(ce.current.classList.add(GE),de.current=!0,Ho(ce.current,{transition:"none"}),Ho(P.current,{transition:"none"}),i&&Wt({draggedDistance:ie}),Pe&&!i){const Ft=m_t(ie),De=Math.min(Ft*-1,0)*Fe;Ho(ce.current,{transform:Co(k)?`translate3d(0, ${De}px, 0)`:`translate3d(${De}px, 0, 0)`});return}const yt=1-vn;if((zt||m&&We===m-1)&&(s==null||s(ve,vn),Ho(P.current,{opacity:`${yt}`,transition:"none"},!0)),Ae&&P.current&&o){const Ft=Math.min(it()+vn*(1-it()),1),De=8-vn*8,Xe=Math.max(0,14-vn*14);Ho(Ae,{borderRadius:`${De}px`,transform:Co(k)?`scale(${Ft}) translate3d(0, ${Xe}px, 0)`:`scale(${Ft}) translate3d(${Xe}px, 0, 0)`,transition:"none"},!0)}if(!i){const Ft=He*Fe;Ho(ce.current,{transform:Co(k)?`translate3d(0, ${Ft}px, 0)`:`translate3d(${Ft}px, 0, 0)`})}}}kn.useEffect(()=>{window.requestAnimationFrame(()=>{Z.current=!0})},[]),kn.useEffect(()=>{var ve;function Fe(){if(!ce.current||!R)return;const ie=document.activeElement;if(n9(ie)||U.current){var Pe;const et=((Pe=window.visualViewport)==null?void 0:Pe.height)||0,He=window.innerHeight;let Ae=He-et;const vt=ce.current.getBoundingClientRect().height||0,vn=vt>He*.8;rt.current||(rt.current=vt);const Ce=ce.current.getBoundingClientRect().top;if(Math.abs(ge.current-Ae)>60&&(U.current=!U.current),i&&i.length>0&&rn&&We){const yt=rn[We]||0;Ae+=yt}if(ge.current=Ae,vt>et||U.current){const yt=ce.current.getBoundingClientRect().height;let Ft=yt;yt>et&&(Ft=et-(vn?Ce:s9)),b?ce.current.style.height=`${yt-Math.max(Ae,0)}px`:ce.current.style.height=`${Math.max(Ft,et-Ce)}px`}else t_t()||(ce.current.style.height=`${rt.current}px`);i&&i.length>0&&!U.current?ce.current.style.bottom="0px":ce.current.style.bottom=`${Math.max(Ae,0)}px`}}return(ve=window.visualViewport)==null||ve.addEventListener("resize",Fe),()=>{var ie;return(ie=window.visualViewport)==null?void 0:ie.removeEventListener("resize",Fe)}},[We,i,rn]);function un(ve){ht(),y==null||y(),ve||B(!1),setTimeout(()=>{i&&at(i[0])},Vi.DURATION*1e3)}function me(){if(!ce.current)return;const ve=document.querySelector("[data-vaul-drawer-wrapper]"),Fe=v2(ce.current,k);Ho(ce.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${Vi.DURATION}s cubic-bezier(${Vi.EASE.join(",")})`}),Ho(P.current,{transition:`opacity ${Vi.DURATION}s cubic-bezier(${Vi.EASE.join(",")})`,opacity:"1"}),o&&Fe&&Fe>0&&z&&Ho(ve,{borderRadius:`${que}px`,overflow:"hidden",...Co(k)?{transform:`scale(${it()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${it()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Vi.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Vi.EASE.join(",")})`},!0)}function ht(){!Q||!ce.current||(ce.current.classList.remove(GE),de.current=!1,I(!1),q.current=new Date)}function Oe(ve){if(!Q||!ce.current)return;ce.current.classList.remove(GE),de.current=!1,I(!1),q.current=new Date;const Fe=v2(ce.current,k);if(!ve||!wt(ve.target,!1)||!Fe||Number.isNaN(Fe)||ee.current===null)return;const ie=q.current.getTime()-ee.current.getTime(),Pe=ne.current-(Co(k)?ve.pageY:ve.pageX),et=Math.abs(Pe)/ie;if(et>.05&&(W(!0),setTimeout(()=>{W(!1)},200)),i){ze({draggedDistance:Pe*(k==="bottom"||k==="right"?1:-1),closeDrawer:un,velocity:et,dismissible:d}),r==null||r(ve,!0);return}if(k==="bottom"||k==="right"?Pe>0:Pe<0){me(),r==null||r(ve,!0);return}if(et>Hue){un(),r==null||r(ve,!1);return}var He;const Ae=Math.min((He=ce.current.getBoundingClientRect().height)!=null?He:0,window.innerHeight);var vt;const vn=Math.min((vt=ce.current.getBoundingClientRect().width)!=null?vt:0,window.innerWidth),Ce=k==="left"||k==="right";if(Math.abs(Fe)>=(Ce?vn:Ae)*c){un(),r==null||r(ve,!1);return}r==null||r(ve,!0),me()}kn.useEffect(()=>(z&&(Ho(document.documentElement,{scrollBehavior:"auto"}),V.current=new Date),()=>{f_t(document.documentElement,"scrollBehavior")}),[z]);function Ne(ve){const Fe=ve?(window.innerWidth-s0)/window.innerWidth:1,ie=ve?-s0:0;re.current&&window.clearTimeout(re.current),Ho(ce.current,{transition:`transform ${Vi.DURATION}s cubic-bezier(${Vi.EASE.join(",")})`,transform:Co(k)?`scale(${Fe}) translate3d(0, ${ie}px, 0)`:`scale(${Fe}) translate3d(${ie}px, 0, 0)`}),!ve&&ce.current&&(re.current=setTimeout(()=>{const Pe=v2(ce.current,k);Ho(ce.current,{transition:"none",transform:Co(k)?`translate3d(0, ${Pe}px, 0)`:`translate3d(${Pe}px, 0, 0)`})},500))}function St(ve,Fe){if(Fe<0)return;const ie=(window.innerWidth-s0)/window.innerWidth,Pe=ie+Fe*(1-ie),et=-s0+Fe*s0;Ho(ce.current,{transform:Co(k)?`scale(${Pe}) translate3d(0, ${et}px, 0)`:`scale(${Pe}) translate3d(${et}px, 0, 0)`,transition:"none"})}function Ue(ve,Fe){const ie=Co(k)?window.innerHeight:window.innerWidth,Pe=Fe?(ie-s0)/ie:1,et=Fe?-s0:0;Fe&&Ho(ce.current,{transition:`transform ${Vi.DURATION}s cubic-bezier(${Vi.EASE.join(",")})`,transform:Co(k)?`scale(${Pe}) translate3d(0, ${et}px, 0)`:`scale(${Pe}) translate3d(${et}px, 0, 0)`})}return kn.useEffect(()=>{v||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[v]),kn.createElement(MT,{defaultOpen:C,onOpenChange:ve=>{!d&&!ve||(ve?H(!0):un(!0),B(ve))},open:z},kn.createElement(Oue.Provider,{value:{activeSnapPoint:Me,snapPoints:i,setActiveSnapPoint:at,drawerRef:ce,overlayRef:P,onOpenChange:t,onPress:gt,onRelease:Oe,onDrag:Ke,dismissible:d,shouldAnimate:Z,handleOnly:f,isOpen:z,isDragging:Q,shouldFade:zt,closeDrawer:un,onNestedDrag:St,onNestedOpenChange:Ne,onNestedRelease:Ue,keyboardIsOpen:U,modal:v,snapPointsOffset:rn,activeSnapPointIndex:We,direction:k,shouldScaleBackground:o,setBackgroundColorOnScale:a,noBodyStyles:x,container:O,autoFocus:M}},n))}const Vue=kn.forwardRef(function({...e},t){const{overlayRef:n,snapPoints:s,onRelease:r,shouldFade:i,isOpen:o,modal:a,shouldAnimate:c}=Lk(),u=zue(t,n),d=s&&s.length>0;if(!a)return null;const f=kn.useCallback(m=>r(m),[r]);return kn.createElement(RT,{onMouseUp:f,ref:u,"data-vaul-overlay":"","data-vaul-snap-points":o&&d?"true":"false","data-vaul-snap-points-overlay":o&&i?"true":"false","data-vaul-animate":c!=null&&c.current?"true":"false",...e})});Vue.displayName="Drawer.Overlay";const Gue=kn.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...s},r){const{drawerRef:i,onPress:o,onRelease:a,onDrag:c,keyboardIsOpen:u,snapPointsOffset:d,activeSnapPointIndex:f,modal:m,isOpen:p,direction:g,snapPoints:b,container:v,handleOnly:y,shouldAnimate:w,autoFocus:x}=Lk(),[k,C]=kn.useState(!1),T=zue(r,i),_=kn.useRef(null),S=kn.useRef(null),R=kn.useRef(!1),A=b&&b.length>0;x_t();const O=(D,$,z=0)=>{if(R.current)return!0;const B=Math.abs(D.y),j=Math.abs(D.x),H=j>B,Q=["bottom","right"].includes($)?1:-1;if($==="left"||$==="right"){if(!(D.x*Q<0)&&j>=0&&j<=z)return H}else if(!(D.y*Q<0)&&B>=0&&B<=z)return!H;return R.current=!0,!0};kn.useEffect(()=>{A&&window.requestAnimationFrame(()=>{C(!0)})},[]);function M(D){_.current=null,R.current=!1,a(D)}return kn.createElement(DT,{"data-vaul-drawer-direction":g,"data-vaul-drawer":"","data-vaul-delayed-snap-points":k?"true":"false","data-vaul-snap-points":p&&A?"true":"false","data-vaul-custom-container":v?"true":"false","data-vaul-animate":w!=null&&w.current?"true":"false",...s,ref:T,style:d&&d.length>0?{"--snap-point-height":`${d[f??0]}px`,...t}:t,onPointerDown:D=>{y||(s.onPointerDown==null||s.onPointerDown.call(s,D),_.current={x:D.pageX,y:D.pageY},o(D))},onOpenAutoFocus:D=>{n==null||n(D),x||D.preventDefault()},onPointerDownOutside:D=>{if(e==null||e(D),!m||D.defaultPrevented){D.preventDefault();return}u.current&&(u.current=!1)},onFocusOutside:D=>{if(!m){D.preventDefault();return}},onPointerMove:D=>{if(S.current=D,y||(s.onPointerMove==null||s.onPointerMove.call(s,D),!_.current))return;const $=D.pageY-_.current.y,z=D.pageX-_.current.x,B=D.pointerType==="touch"?10:2;O({x:z,y:$},g,B)?c(D):(Math.abs(z)>B||Math.abs($)>B)&&(_.current=null)},onPointerUp:D=>{s.onPointerUp==null||s.onPointerUp.call(s,D),_.current=null,R.current=!1,a(D)},onPointerOut:D=>{s.onPointerOut==null||s.onPointerOut.call(s,D),M(S.current)},onContextMenu:D=>{s.onContextMenu==null||s.onContextMenu.call(s,D),S.current&&M(S.current)}})});Gue.displayName="Drawer.Content";const S_t=250,C_t=120,T_t=kn.forwardRef(function({preventCycle:e=!1,children:t,...n},s){const{closeDrawer:r,isDragging:i,snapPoints:o,activeSnapPoint:a,setActiveSnapPoint:c,dismissible:u,handleOnly:d,isOpen:f,onPress:m,onDrag:p}=Lk(),g=kn.useRef(null),b=kn.useRef(!1);function v(){if(b.current){x();return}window.setTimeout(()=>{y()},C_t)}function y(){if(i||e||b.current){x();return}if(x(),!o||o.length===0){u||r();return}if(a===o[o.length-1]&&u){r();return}const C=o.findIndex(_=>_===a);if(C===-1)return;const T=o[C+1];c(T)}function w(){g.current=window.setTimeout(()=>{b.current=!0},S_t)}function x(){g.current&&window.clearTimeout(g.current),b.current=!1}return kn.createElement("div",{onClick:v,onPointerCancel:x,onPointerDown:k=>{d&&m(k),w()},onPointerMove:k=>{d&&p(k)},ref:s,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},kn.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});T_t.displayName="Drawer.Handle";function E_t(e){const t=Lk(),{container:n=t.container,...s}=e;return kn.createElement(IT,{container:n,...s})}const Ok={Root:__t,Content:Gue,Overlay:Vue,Portal:E_t,Title:PT};function j_t({...e}){return l.jsx(Ok.Root,{"data-slot":"drawer",...e})}function A_t({container:e,...t}){const n=_u();return l.jsx(Ok.Portal,{"data-slot":"drawer-portal",container:e??n??void 0,...t})}const N_t=h.forwardRef(function({className:t,...n},s){return l.jsx(Ok.Overlay,{ref:s,"data-slot":"drawer-overlay",className:en("fixed inset-0 isolate z-[var(--web-shell-dialog-backdrop-z-index,50)] bg-black/10 duration-150 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",t),...n})}),M_t=h.forwardRef(function({className:t,children:n,overlayProps:s,...r},i){return l.jsxs(A_t,{children:[l.jsx(N_t,{...s}),l.jsx(Ok.Content,{ref:i,"data-slot":"drawer-content",className:en("group/drawer-content fixed z-[var(--web-shell-dialog-backdrop-z-index,50)] flex h-auto flex-col bg-popover text-sm text-popover-foreground outline-none data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-xl data-[vaul-drawer-direction=bottom]:border-t data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:rounded-r-xl data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:rounded-l-xl data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-xl data-[vaul-drawer-direction=top]:border-b data-[vaul-drawer-direction=left]:sm:max-w-sm data-[vaul-drawer-direction=right]:sm:max-w-sm",t),...r,children:n})]})});function I_t({className:e,...t}){return l.jsx(Ok.Title,{"data-slot":"drawer-title",className:en("text-base font-medium text-foreground",e),...t})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const R_t="(min-width: 1024px)";function KE(e=R_t){const[t,n]=h.useState(()=>D_t(e));return h.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 D_t(e){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches}function Kue(e){try{return new Date(e).toLocaleString()}catch{return String(e)}}function P_t(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`${Kue(e.at)}${n}${s}`}function Uf(e){return`${e.workspaceId??""}:${e.id}`}const L_t=["daily","weekdays","weekly","hourly","minutes","custom"],O_t=[1,2,3,4,5,6,10,12,15,20,30],$_t=2147483647,B_t=3,z_t=3e4,Ux=1e5,F_t=/[^\p{L}\p{N}_.-]/gu,QV=/(^|[\s])(@(?:ext|mcp):(?:\\.[^\s\\]*|[^\s\\])+|\/(?:\\.[^\s\\/]*|[^\s\\/])+)(?=$|\s)/gu,H_t=["--background","--foreground","--muted","--muted-foreground","--border","--error-color","--font-mono"];function YE(e){return e.replace(F_t,"\\$&")}function XE(e){return e.replace(/\\(.)/g,"$1")}function q_t(e){if(e.startsWith("@ext:")){const t=XE(e.slice(5));return{id:`extension:${t}`,kind:"extension",label:t,insertText:e}}if(e.startsWith("@mcp:")){const t=XE(e.slice(5));return{id:`mcp:${t}`,kind:"mcp",label:t,insertText:e}}if(e.startsWith("/")){const t=XE(e.slice(1));return t?{id:`skill:${t}`,kind:"skill",label:t,insertText:e}:null}return null}function U_t(e){return e.displayName&&e.displayName!==e.name?e.displayName:e.description}function W_t(e){return e.description||e.argumentHint||e.level}function V_t(e){return e.description||e.mcpStatus}function Yue(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+=Yue(s)}),e.tagName==="DIV"||e.tagName==="P"?`${n}
`:n}function Xue(e){let t="";return e.childNodes.forEach(n=>{t+=Yue(n)}),t}function Que(e){return e.replace(/\u00a0/g," ").replace(/\n$/,"")}function q5(e){return Que(Xue(e))}function G_t(e){return Que(Xue(e))}function $P(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function QE(e,t){t&&e.appendChild(document.createTextNode(t))}function Jue(e,t,n){if($P(e),!t)return;t.split(`
`).forEach((r,i)=>{i>0&&e.appendChild(document.createElement("br")),K_t(e,r,n)})}function JE(e,t){let n=q5(e);return n.length>Ux?(n=n.slice(0,Ux),Jue(e,n,t)):n.trim().length===0&&($P(e),n=""),n}function JV(e,t){const n=Ux-q5(e).length;n<=0||document.execCommand("insertText",!1,t.slice(0,n))}function ZV(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:G_t(n.cloneContents())}:null}function Zue(e,t){const n=document.createElement("span");n.className=nt.promptTag,n.contentEditable="false",n.dataset.promptTagSerialized=e.insertText.trim();const s=hg(e.kind);if(s){const o=document.createElement("span");o.className=nt.promptTagIcon,o.style.setProperty("--composer-tag-icon-url",E5(s)),o.setAttribute("aria-hidden","true"),n.appendChild(o)}const r=document.createElement("span");r.className=nt.promptTagValue,r.textContent=e.tagLabel??e.label,n.appendChild(r);const i=document.createElement("span");return i.className=nt.promptTagRemove,i.setAttribute("role","button"),i.tabIndex=-1,i.dataset.promptTagRemove="",i.setAttribute("aria-label",`${t} ${e.label}`),n.appendChild(i),n}function K_t(e,t,n){let s=0;QV.lastIndex=0;for(const r of t.matchAll(QV)){const[i,o,a]=r,c=r.index??0,u=q_t(a);u&&(QE(e,t.slice(s,c)),QE(e,o),e.appendChild(Zue(u,n)),s=c+i.length)}QE(e,t.slice(s))}function Y_t(e,t,n){var c;const s=window.getSelection(),r=Zue(t,n),i=document.createTextNode(" ");q5(e).trim().length===0&&$P(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 X_t(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 Q_t({value:e,label:t,placeholder:n,onChange:s,insertItem:r,onInserted:i}){const{t:o}=lt(),a=o("scheduledTasks.reference.remove"),c=h.useRef(null),u=h.useRef(""),d=h.useRef("");return h.useEffect(()=>{const f=c.current;f&&(e===u.current&&a===d.current||(Jue(f,e,a),u.current=e,d.current=a))},[a,e]),h.useEffect(()=>{const f=c.current;if(!f||!r)return;Y_t(f,r,a);const m=q5(f);u.current=m,s(m),f.focus(),i()},[r,s,i,a]),l.jsxs("div",{className:nt.promptEditorWrap,children:[l.jsx("div",{ref:c,className:nt.promptEditor,contentEditable:!0,role:"textbox","aria-label":t,"aria-multiline":"true","aria-placeholder":n,onMouseDown:f=>{f.target instanceof Element&&f.target.closest("[data-prompt-tag-remove]")&&f.preventDefault()},onClick:f=>{if(!(f.target instanceof Element))return;const m=f.target.closest("[data-prompt-tag-remove]"),p=m==null?void 0:m.closest("[data-prompt-tag-serialized]");if(!p||!f.currentTarget.contains(p))return;X_t(p);const g=JE(f.currentTarget,a);u.current=g,s(g),f.currentTarget.focus()},onInput:f=>{const m=JE(f.currentTarget,a);u.current=m,s(m)},onPaste:f=>{f.preventDefault(),JV(f.currentTarget,f.clipboardData.getData("text/plain"))},onDrop:f=>{f.preventDefault(),JV(f.currentTarget,f.dataTransfer.getData("text/plain"))},onCopy:f=>{const m=ZV(f.currentTarget);m&&(f.preventDefault(),f.clipboardData.setData("text/plain",m.text))},onCut:f=>{const m=ZV(f.currentTarget);if(!m)return;f.preventDefault(),f.clipboardData.setData("text/plain",m.text),m.selection.deleteFromDocument();const p=JE(f.currentTarget,a);u.current=p,s(p)}}),e.trim().length===0&&l.jsx("div",{className:nt.promptPlaceholder,children:n})]})}function J_t({onRunPrompt:e,onCreateViaChat:t,onOpenSession:n,workspaces:s,lockedWorkspace:r,onError:i}){const{t:o}=lt(),a=pa(),c=_u(),u=h.useMemo(()=>s??[],[s]),d=!r&&u.length>1,f=h.useMemo(()=>u.filter(ie=>ie.primary||ie.trusted),[u]),m=h.useCallback(ie=>ie.primary?void 0:ie.id,[]),p=r?m(r):void 0,[g,b]=h.useState(null),[v,y]=h.useState(null),[w,x]=h.useState(null),[k,C]=h.useState(null),[T,_]=h.useState(!1),[S,R]=h.useState(null),[A,O]=h.useState(p),[M,D]=h.useState(""),[$,z]=h.useState(""),[B,j]=h.useState(_d),[H,Q]=h.useState(!1),[I,J]=h.useState(null),[W,P]=h.useState(null),[V,ee]=h.useState([]),[q,K]=h.useState(!1),[de,re]=h.useState(null),[ne,U]=h.useState(null),Z=h.useRef(null),ge=h.useRef(null),[ce,ue]=h.useState(null),[be,rt]=h.useState({}),[le,Me]=h.useState(null),[We,at]=h.useState(()=>Date.now()),ze=h.useRef(!0),rn=h.useRef(0),Wt=h.useRef(0);h.useEffect(()=>(ze.current=!0,()=>{ze.current=!1}),[]);const zt=h.useCallback(async()=>{const ie=++rn.current;try{let Pe,et=null;if(r?Pe=(await a.listScheduledTasks(p)).map(Ae=>({...Ae,workspaceId:p,workspaceCwd:r.cwd})):d?Pe=(await Promise.all(f.map(async vt=>{try{return(await a.listScheduledTasks(m(vt))).map(Ce=>({...Ce,workspaceId:m(vt),workspaceCwd:vt.cwd}))}catch(vn){return et||(et=vn instanceof Error?vn.message:String(vn)),[]}}))).flat():Pe=await a.listScheduledTasks(),!ze.current||ie!==rn.current)return;const He=[...Pe].sort((Ae,vt)=>vt.createdAt-Ae.createdAt);b(He),y(et)}catch(Pe){if(!ze.current||ie!==rn.current)return;y(Pe instanceof Error?Pe.message:String(Pe)),b(et=>et??[])}},[a,d,r,p,f,m]);h.useEffect(()=>{zt()},[zt]);const ae=!!(g!=null&&g.some(ie=>ie.nextRunAt!=null));h.useEffect(()=>{if(!ae)return;const ie=window.setInterval(()=>at(Date.now()),1e3);return()=>window.clearInterval(ie)},[ae]);const je=h.useRef(0);h.useEffect(()=>{if(!g)return;let ie=1/0;for(const Ae of g)Ae.nextRunAt!=null&&Ae.nextRunAt<ie&&(ie=Ae.nextRunAt);if(!Number.isFinite(ie))return;const Pe=ie-Date.now();let et;Pe>0?(je.current=0,et=Math.min(Pe+2e3,$_t)):et=je.current++<B_t?1e3:z_t;const He=window.setTimeout(()=>void zt(),et);return()=>window.clearTimeout(He)},[g,zt]);const it=E3(B),gt=it?Px(it,o):null,wt=h.useCallback(()=>{const ie=Z.current;if(!ie){ue(null);return}const Pe=getComputedStyle(ie);rt(Object.fromEntries(H_t.map(Ce=>[Ce,Pe.getPropertyValue(Ce)])));const et=ie.getBoundingClientRect(),He=Math.min(420,window.innerWidth-24),Ae=Math.max(12,Math.min(et.left,window.innerWidth-He-12)),vt=et.bottom+6,vn=Math.max(140,Math.min(320,window.innerHeight-vt-12));ue(Ce=>{const yt={left:Ae,top:vt,width:He,maxHeight:vn};return Ce&&Ce.left===yt.left&&Ce.top===yt.top&&Ce.width===yt.width&&Ce.maxHeight===yt.maxHeight?Ce:yt})},[]),Ke=h.useCallback(()=>{Wt.current+=1,P(null),ee([]),K(!1),re(null),U(null),ue(null),rt({})},[]),un=h.useCallback(async ie=>{const Pe=++Wt.current;if(W===ie){Ke();return}wt(),P(ie),K(!0),re(null),ee([]);try{let et;if(ie==="extension"?et=((await a.loadExtensionsStatus()).extensions??[]).filter(Ae=>Ae.isActive).map(Ae=>({id:Ae.id||Ae.name,kind:ie,label:Ae.name,tagLabel:ni(Ae.displayName??"")||Ae.name,description:U_t(Ae),insertText:`@ext:${YE(Ae.name)} `})):ie==="skill"?et=((await a.loadSkillsStatus()).skills??[]).filter(Ae=>Ae.modelInvocable).map(Ae=>({id:Ae.name,kind:ie,label:Ae.name,description:W_t(Ae),insertText:`/${YE(Ae.name)} `})):et=((await a.loadMcpStatus()).servers??[]).filter(Ae=>!Ae.disabled).map(Ae=>({id:Ae.name,kind:ie,label:Ae.name,description:V_t(Ae),insertText:`@mcp:${YE(Ae.name)} `})),!ze.current||Pe!==Wt.current)return;ee(et)}catch(et){if(!ze.current||Pe!==Wt.current)return;re(et instanceof Error?et.message:String(et))}finally{ze.current&&Pe===Wt.current&&K(!1)}},[a,W,Ke,wt]);h.useEffect(()=>{if(!W)return;wt();const ie=He=>{const Ae=Z.current,vt=ge.current;Ae!=null&&Ae.contains(He.target)||vt!=null&&vt.contains(He.target)||Ke()},Pe=He=>{He.key==="Escape"&&(He.preventDefault(),He.stopPropagation(),Ke())},et=()=>wt();return document.addEventListener("pointerdown",ie),document.addEventListener("keydown",Pe,!0),window.addEventListener("resize",et),window.addEventListener("scroll",et,!0),()=>{document.removeEventListener("pointerdown",ie),document.removeEventListener("keydown",Pe,!0),window.removeEventListener("resize",et),window.removeEventListener("scroll",et,!0)}},[W,Ke,wt]);const me=h.useCallback(()=>{D(""),z(""),j(_d),J(null),_(!1),R(null),O(p),Ke()},[p,Ke]),ht=h.useCallback(()=>{R(null),O(p),D(""),z(""),j(_d),J(null),Ke(),_(!0)},[p,Ke]),Oe=h.useCallback(ie=>{R(ie.id),O(ie.workspaceId),D(ie.name??""),z(ie.prompt),j(Gf(ie.cron)),J(null),Ke(),_(!0)},[Ke]),Ne=h.useCallback(async()=>{const ie=E3(B);if(!ie){J(o("scheduledTasks.error.invalidSchedule"));return}if($.trim().length===0){J(o("scheduledTasks.error.emptyPrompt"));return}if($.length>Ux){J(o("scheduledTasks.error.promptTooLong",{max:Ux}));return}Q(!0),J(null);try{if(S?await a.updateScheduledTask(S,{cron:ie,prompt:$.trim(),name:M.trim()||null},A):await a.createScheduledTask({cron:ie,prompt:$.trim(),name:M.trim()||null,recurring:!0,enabled:!0},A),!ze.current)return;me(),await zt()}catch(Pe){if(!ze.current)return;J(Pe instanceof Error?Pe.message:String(Pe))}finally{ze.current&&Q(!1)}},[a,B,S,A,M,$,zt,me,o]),St=h.useCallback(async ie=>{x(Uf(ie));try{await a.updateScheduledTask(ie.id,{enabled:!ie.enabled},ie.workspaceId),await zt()}catch(Pe){i(Pe,o("scheduledTasks.error.toggleFailed"))}finally{ze.current&&x(null)}},[a,i,zt,o]),Ue=h.useCallback(async ie=>{if(!(!ie.enabled||k!==null)){C(ie.id);try{const Pe=(await a.listScheduledTasks(ie.workspaceId)).find(et=>et.id===ie.id);if(!Pe||!Pe.enabled){await zt().catch(()=>{}),i(new Error("This task is no longer runnable."),o("scheduledTasks.error.runFailed"));return}if(Pe.recurring){await e(Pe.prompt,Pe.sessionId);try{await a.runScheduledTask(Pe.id,ie.workspaceId),await zt()}catch(et){i(et,o("scheduledTasks.error.runFailed"))}}else{await a.runScheduledTask(Pe.id,ie.workspaceId),await zt();try{await e(Pe.prompt,Pe.sessionId)}catch(et){i(et,o("scheduledTasks.error.oneShotConsumedButFailed"));return}}}catch(Pe){i(Pe,o("scheduledTasks.error.runFailed"))}finally{C(null)}}},[a,i,e,zt,k,o]),ve=h.useCallback(async ie=>{const Pe=ie.name||ie.prompt,et=Pe.length>60?`${Pe.slice(0,57)}…`:Pe;if(window.confirm(o("scheduledTasks.deleteConfirm",{name:et}))){x(Uf(ie));try{await a.deleteScheduledTask(ie.id,ie.workspaceId),await zt()}catch(He){i(He,o("scheduledTasks.error.deleteFailed"))}finally{ze.current&&x(null)}}},[a,i,zt,o]),Fe=W&&ce?Wu.createPortal(l.jsx("div",{ref:ge,className:nt.referencePicker,role:"listbox","aria-label":o("scheduledTasks.referencePicker"),style:{...be,left:ce.left,top:ce.top,width:ce.width,maxHeight:ce.maxHeight},onWheel:ie=>{ie.stopPropagation()},onTouchMove:ie=>ie.stopPropagation(),children:q?l.jsx("div",{className:nt.referenceEmpty,children:o("scheduledTasks.reference.loading")}):de?l.jsx("div",{className:nt.referenceError,children:de}):V.length===0?l.jsx("div",{className:nt.referenceEmpty,children:o("scheduledTasks.reference.empty")}):V.map(ie=>l.jsxs("button",{type:"button",className:nt.referenceItem,role:"option","aria-selected":"false",onMouseDown:Pe=>Pe.preventDefault(),onClick:()=>{U(ie),P(null)},children:[l.jsx("span",{className:nt.referenceItemLabel,children:ie.label}),ie.description&&l.jsx("span",{className:nt.referenceItemDescription,children:ie.description})]},`${ie.kind}:${ie.id}`))}),c??document.body):null;return l.jsxs("div",{className:nt.root,children:[l.jsx("div",{className:nt.intro,children:o("scheduledTasks.subtitle")}),l.jsxs("div",{className:nt.toolbar,children:[l.jsx("div",{className:nt.count,children:g===null?o("scheduledTasks.loading"):o("scheduledTasks.count",{count:g.length})}),l.jsxs("div",{className:nt.toolbarActions,children:[l.jsx("button",{type:"button",className:nt.secondaryButton,onClick:()=>void zt(),children:o("scheduledTasks.refresh")}),l.jsx("button",{type:"button",className:nt.secondaryButton,onClick:t,children:o("scheduledTasks.createViaChat")}),l.jsx("button",{type:"button",className:nt.primaryButton,onClick:ht,children:o("scheduledTasks.new")})]})]}),T&&l.jsx(Ii,{title:o(S?"scheduledTasks.editTitle":"scheduledTasks.new"),size:"md",onClose:me,children:l.jsxs("div",{className:nt.formFields,children:[d&&l.jsxs("label",{className:nt.field,children:[l.jsx("span",{className:nt.fieldLabel,children:o("scheduledTasks.workspace")}),l.jsx("select",{className:nt.select,value:A??"",disabled:!!S||f.length<=1,onChange:ie=>O(ie.target.value||void 0),children:f.map(ie=>l.jsx("option",{value:m(ie)??"",children:z5(ie)},ie.id))})]}),l.jsxs("label",{className:nt.field,children:[l.jsx("span",{className:nt.fieldLabel,children:o("scheduledTasks.name")}),l.jsx("input",{className:nt.input,type:"text",value:M,maxLength:200,placeholder:o("scheduledTasks.namePlaceholder"),onChange:ie=>D(ie.target.value)})]}),l.jsxs("label",{className:nt.field,children:[l.jsxs("span",{className:nt.fieldLabel,children:[o("scheduledTasks.prompt"),l.jsx("span",{className:nt.required,children:"*"})]}),l.jsx(Q_t,{value:$,label:o("scheduledTasks.prompt"),placeholder:o("scheduledTasks.promptPlaceholder"),onChange:z,insertItem:ne,onInserted:()=>U(null)})]}),l.jsx("div",{ref:Z,className:nt.referencePopover,children:l.jsx("div",{className:nt.referenceBar,children:["extension","skill","mcp"].map(ie=>{const Pe=hg(ie);return l.jsxs("button",{type:"button",className:`${nt.referenceButton} ${W===ie?nt.referenceButtonActive:""}`,"aria-expanded":W===ie,onClick:()=>void un(ie),children:[Pe&&l.jsx("span",{className:nt.referenceButtonIcon,style:{"--composer-tag-icon-url":E5(Pe)},"aria-hidden":!0}),o(`scheduledTasks.reference.${ie}`)]},ie)})})}),l.jsxs("div",{className:nt.scheduleRow,children:[l.jsxs("label",{className:nt.field,children:[l.jsx("span",{className:nt.fieldLabel,children:o("scheduledTasks.frequency")}),l.jsx("select",{className:nt.select,value:B.frequency,onChange:ie=>{const Pe=ie.target.value;j(et=>({...et,frequency:Pe,...Pe==="hourly"?{time:"00:00"}:{}}))},children:L_t.map(ie=>l.jsx("option",{value:ie,children:o(`scheduledTasks.freq.${ie}`)},ie))})]}),(B.frequency==="daily"||B.frequency==="weekdays"||B.frequency==="weekly")&&l.jsxs("label",{className:nt.field,children:[l.jsx("span",{className:nt.fieldLabel,children:o("scheduledTasks.time")}),l.jsx("input",{className:nt.input,type:"time",value:B.time,onChange:ie=>j(Pe=>({...Pe,time:ie.target.value}))})]}),B.frequency==="weekly"&&l.jsxs("label",{className:nt.field,children:[l.jsx("span",{className:nt.fieldLabel,children:o("scheduledTasks.weekday")}),l.jsx("select",{className:nt.select,value:B.weekday,onChange:ie=>j(Pe=>({...Pe,weekday:Number(ie.target.value)})),children:o("scheduledTasks.weekdayNames").split(",").map((ie,Pe)=>l.jsx("option",{value:Pe,children:ie},Pe))})]}),B.frequency==="minutes"&&l.jsxs("label",{className:nt.field,children:[l.jsx("span",{className:nt.fieldLabel,children:o("scheduledTasks.interval")}),l.jsx("select",{className:nt.select,value:B.minuteInterval,onChange:ie=>j(Pe=>({...Pe,minuteInterval:Number(ie.target.value)})),children:O_t.map(ie=>l.jsx("option",{value:ie,children:ie},ie))})]}),B.frequency==="custom"&&l.jsxs("label",{className:`${nt.field} ${nt.fieldGrow}`,children:[l.jsx("span",{className:nt.fieldLabel,children:o("scheduledTasks.cron")}),l.jsx("input",{className:nt.input,type:"text",value:B.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:ie=>j(Pe=>({...Pe,customCron:ie.target.value}))})]})]}),l.jsx("div",{className:nt.preview,children:gt?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:nt.previewLabel,children:gt}),l.jsx("code",{className:nt.previewCron,children:it})]}):l.jsx("span",{className:nt.previewInvalid,children:o("scheduledTasks.error.invalidSchedule")})}),I&&l.jsx("div",{className:nt.formError,children:I}),l.jsxs("div",{className:nt.formActions,children:[l.jsx("button",{type:"button",className:nt.secondaryButton,onClick:me,disabled:H,children:o("scheduledTasks.cancel")}),l.jsx("button",{type:"button",className:nt.primaryButton,onClick:()=>void Ne(),disabled:H,children:o(H?S?"scheduledTasks.saving":"scheduledTasks.creating":S?"scheduledTasks.save":"scheduledTasks.create")})]})]})}),Fe,v&&l.jsx("div",{className:nt.loadError,children:v}),g!==null&&g.length===0&&!v&&l.jsx("div",{className:nt.empty,children:o("scheduledTasks.empty")}),l.jsx("div",{className:nt.list,children:(g??[]).map(ie=>{const Pe=ie.name||ie.prompt,et=w===Uf(ie);return l.jsxs("div",{className:`${nt.card} ${ie.enabled?"":nt.cardDisabled}`,children:[l.jsxs("div",{className:nt.cardHeader,children:[l.jsx("button",{type:"button",role:"switch","aria-checked":ie.enabled,"aria-label":ie.enabled?o("scheduledTasks.disable"):o("scheduledTasks.enable"),className:`${nt.toggle} ${ie.enabled?nt.toggleOn:""}`,onClick:()=>void St(ie),disabled:et,children:l.jsx("span",{className:nt.toggleKnob})}),l.jsx("div",{className:nt.cardTitle,title:Pe,children:Pe}),l.jsxs("div",{className:nt.cardMenu,children:[l.jsx("button",{type:"button",className:nt.iconAction,onClick:()=>void Ue(ie),disabled:!ie.enabled||k!==null,title:o("scheduledTasks.runNow"),"aria-label":o("scheduledTasks.runNow"),children:"▶"}),l.jsx("button",{type:"button",className:nt.iconAction,onClick:()=>Oe(ie),disabled:et,title:o("scheduledTasks.edit"),"aria-label":o("scheduledTasks.edit"),children:"✎"}),l.jsx("button",{type:"button",className:nt.iconAction,onClick:()=>void ve(ie),disabled:et,title:o("scheduledTasks.delete"),"aria-label":o("scheduledTasks.delete"),children:"✕"})]})]}),ie.name&&l.jsx("div",{className:nt.cardPrompt,title:ie.prompt,children:ie.prompt}),l.jsxs("div",{className:nt.cardFooter,children:[d&&ie.workspaceCwd&&l.jsxs("span",{className:nt.workspacePill,title:ie.workspaceCwd,children:[l.jsx("span",{className:nt.workspaceIcon,"aria-hidden":"true",children:"⌂"}),F5(ie.workspaceCwd,u)]}),l.jsxs("span",{className:nt.schedulePill,children:[l.jsx("span",{className:nt.clockIcon,"aria-hidden":"true",children:"◷"}),Px(ie.cron,o)]}),l.jsx("span",{className:nt.recurringTag,children:o(ie.recurring?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),ie.nextRunAt!=null&&l.jsxs("span",{className:nt.countdown,"data-testid":"scheduled-task-next-run",title:o("scheduledTasks.nextRunTooltip",{when:Kue(ie.nextRunAt)}),children:[l.jsx("span",{className:nt.hourglassIcon,"aria-hidden":"true",children:"⏳"}),LJe(ie.nextRunAt-We,o)]}),l.jsx("span",{className:nt.lastFired,children:OJe(ie,o)}),ie.sessionId&&n?l.jsx("button",{type:"button",className:nt.runsToggle,onClick:()=>n(ie.sessionId),title:o("scheduledTasks.viewHistoryHint"),children:ie.runs.length>0?o("scheduledTasks.viewHistory",{count:ie.runs.length}):o("scheduledTasks.viewHistoryEmpty")}):ie.runs.length>0&&l.jsx("button",{type:"button",className:nt.runsToggle,"aria-expanded":le===Uf(ie),onClick:()=>Me(He=>He===Uf(ie)?null:Uf(ie)),children:o("scheduledTasks.runHistory",{count:ie.runs.length})})]}),le===Uf(ie)&&ie.runs.length>0&&l.jsx("ul",{className:nt.runsList,children:[...ie.runs].reverse().map((He,Ae)=>l.jsx("li",{className:nt.runsItem,children:P_t(He,o)},`${He.at}-${Ae}`))})]},Uf(ie))})})]})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Z_t=new Set(["clear","stop","off","reset","none","cancel"]);function r9(e){return e.replace(/^\/goal\b/i,"").trim()}function eSt(e){return/^\/goal\b/i.test(e.trim())?BP(r9(e.trim())):!1}function BP(e){return Z_t.has(e.trim().toLowerCase())}const tSt="_root_v50oc_1",nSt="_intro_v50oc_8",sSt="_toolbar_v50oc_14",rSt="_count_v50oc_22",iSt="_toolbarActions_v50oc_28",oSt="_primaryButton_v50oc_34",aSt="_secondaryButton_v50oc_35",lSt="_formFields_v50oc_80",cSt="_field_v50oc_86",uSt="_fieldLabel_v50oc_93",dSt="_required_v50oc_102",hSt="_textarea_v50oc_59",fSt="_formHint_v50oc_126",mSt="_formError_v50oc_132",pSt="_loadError_v50oc_133",gSt="_degraded_v50oc_140",bSt="_formActions_v50oc_148",ySt="_empty_v50oc_156",wSt="_list_v50oc_163",vSt="_card_v50oc_169",xSt="_cardHeader_v50oc_180",kSt="_statusDot_v50oc_188",_St="_statusDotRunning_v50oc_196",SSt="_cardTitle_v50oc_200",CSt="_cardMenu_v50oc_211",TSt="_iconAction_v50oc_218",ESt="_cardReason_v50oc_250",jSt="_reasonLabel_v50oc_262",ASt="_cardFooter_v50oc_266",NSt="_statusPill_v50oc_274",MSt="_meta_v50oc_285",ISt="_sessionLink_v50oc_290",cr={root:tSt,intro:nSt,toolbar:sSt,count:rSt,toolbarActions:iSt,primaryButton:oSt,secondaryButton:aSt,formFields:lSt,field:cSt,fieldLabel:uSt,required:dSt,textarea:hSt,formHint:fSt,formError:mSt,loadError:pSt,degraded:gSt,formActions:bSt,empty:ySt,list:wSt,card:vSt,cardHeader:xSt,statusDot:kSt,statusDotRunning:_St,cardTitle:SSt,cardMenu:CSt,iconAction:TSt,cardReason:ESt,reasonLabel:jSt,cardFooter:ASt,statusPill:NSt,meta:MSt,sessionLink:ISt},RSt=1e4,DSt=1e3;function PSt({onCreateGoal:e,onOpenSession:t,onError:n}){const{t:s}=lt(),r=pa(),[i,o]=h.useState(null),[a,c]=h.useState(0),[u,d]=h.useState(null),[f,m]=h.useState(null),[p,g]=h.useState(!1),[b,v]=h.useState(""),[y,w]=h.useState(!1),[x,k]=h.useState(null),[C,T]=h.useState(()=>Date.now()),_=h.useRef(!0),S=h.useRef(0);h.useEffect(()=>(_.current=!0,()=>{_.current=!1}),[]);const R=h.useCallback(async()=>{const $=++S.current;try{const z=await r.listGoals();if(!_.current||$!==S.current)return;o(z.goals),c(z.droppedCount),d(null)}catch(z){if(!_.current||$!==S.current)return;d(z instanceof Error?z.message:String(z)),o(B=>B??[]),c(0)}},[r]);h.useEffect(()=>{let $=!1,z=0;const B=async()=>{await R(),!$&&(z=window.setTimeout(()=>void B(),RSt))};return B(),()=>{$=!0,window.clearTimeout(z)}},[R]);const A=!!(i!=null&&i.length);h.useEffect(()=>{if(!A)return;const $=window.setInterval(()=>T(Date.now()),DSt);return()=>window.clearInterval($)},[A]);const O=h.useCallback(()=>{v(""),k(null),g(!1)},[]),M=h.useCallback(async()=>{const $=b.trim();if($.length===0){k(s("goals.error.emptyCondition"));return}if(BP($)){k(s("goals.error.clearKeyword",{word:$}));return}w(!0),k(null);try{const z=await e($);if(!_.current||z===!1)return;O()}catch(z){if(!_.current){n(z,s("goals.error.createFailed"));return}k(z instanceof Error?z.message:String(z))}finally{_.current&&w(!1)}},[b,e,n,O,s]),D=h.useCallback(async $=>{const z=$.condition.length>60?`${$.condition.slice(0,57)}…`:$.condition;if(window.confirm(s("goals.clearConfirm",{condition:z}))){m($.sessionId);try{await r.clearGoal($.sessionId),await R()}catch(B){n(B,s("goals.error.clearFailed"))}finally{_.current&&m(null)}}},[r,n,R,s]);return l.jsxs("div",{className:cr.root,children:[l.jsx("div",{className:cr.intro,children:s("goals.subtitle")}),l.jsxs("div",{className:cr.toolbar,children:[l.jsx("div",{className:cr.count,children:i===null?s("goals.loading"):s("goals.count",{count:i.length})}),l.jsxs("div",{className:cr.toolbarActions,children:[l.jsx("button",{type:"button",className:cr.secondaryButton,onClick:()=>void R(),children:s("goals.refresh")}),l.jsx("button",{type:"button",className:cr.primaryButton,onClick:()=>{v(""),k(null),g(!0)},children:s("goals.new")})]})]}),p&&l.jsx(Ii,{title:s("goals.new"),size:"md",onClose:O,children:l.jsxs("div",{className:cr.formFields,children:[l.jsxs("label",{className:cr.field,children:[l.jsxs("span",{className:cr.fieldLabel,children:[s("goals.condition"),l.jsx("span",{className:cr.required,children:"*"})]}),l.jsx("textarea",{className:cr.textarea,value:b,rows:4,placeholder:s("goals.conditionPlaceholder"),onChange:$=>v($.target.value)})]}),l.jsx("div",{className:cr.formHint,children:s("goals.newHint")}),x&&l.jsx("div",{className:cr.formError,role:"alert",children:x}),l.jsxs("div",{className:cr.formActions,children:[l.jsx("button",{type:"button",className:cr.secondaryButton,onClick:O,disabled:y,children:s("goals.cancel")}),l.jsx("button",{type:"button",className:cr.primaryButton,onClick:()=>void M(),disabled:y,children:s(y?"goals.creating":"goals.create")})]})]})}),u&&l.jsx("div",{className:cr.loadError,role:"alert",children:u}),a>0&&l.jsx("div",{className:cr.degraded,"data-testid":"goals-dropped",children:s("goals.dropped",{count:a})}),i!==null&&i.length===0&&!u&&l.jsx("div",{className:cr.empty,children:s("goals.empty")}),l.jsx("div",{className:cr.list,role:"list",children:(i??[]).map($=>{const z=f===$.sessionId;return l.jsxs("div",{className:cr.card,role:"listitem",children:[l.jsxs("div",{className:cr.cardHeader,children:[l.jsx("span",{className:`${cr.statusDot} ${$.hasActivePrompt?cr.statusDotRunning:""}`,"aria-hidden":"true"}),l.jsx("div",{className:cr.cardTitle,title:$.condition,children:$.condition}),l.jsx("div",{className:cr.cardMenu,children:l.jsx("button",{type:"button",className:cr.iconAction,onClick:()=>void D($),disabled:z,title:s("goals.clear"),"aria-label":s("goals.clear"),children:"✕"})})]}),$.lastReason&&l.jsxs("div",{className:cr.cardReason,children:[l.jsxs("span",{className:cr.reasonLabel,children:[s("goal.lastCheck"),":"]})," ",$.lastReason]}),l.jsxs("div",{className:cr.cardFooter,children:[l.jsx("span",{className:cr.statusPill,children:s($.hasActivePrompt?"goals.running":"goals.idle")}),l.jsx("span",{className:cr.meta,children:$.iterations>0?s($.iterations===1?"goal.turn":"goal.turns",{count:$.iterations}):s("goals.notYetEvaluated")}),l.jsx("span",{className:cr.meta,"data-testid":"goal-elapsed",children:Rx(Math.max(0,C-$.setAt))}),l.jsx("button",{type:"button",className:cr.sessionLink,onClick:()=>t($.sessionId),title:s("goals.openSessionHint"),"aria-label":`${s("goals.openSessionHint")}: ${$.displayName||$.sessionId}`,children:$.displayName||$.sessionId})]})]},$.sessionId)})})]})}function _1(e){return e.replace(/[：:\s]+$/u,"")}const LSt="_extensionGrid_1aki4_1",OSt={extensionGrid:LSt};function $St(e,t){return e&&t.some(n=>n.name===e)?e:null}function BSt(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 ede({className:e,...t}){return l.jsx(Sse,{"data-slot":"radio-group",className:en("grid w-full gap-2",e),...t})}function tde({className:e,...t}){return l.jsx(Ese,{"data-slot":"radio-group-item",className:en("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(Ase,{"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"})})})}const eG="update available";function Tw(e){return e.displayName||e.name}function i9(e){return e.workspaceActivation&&e.workspaceActivation!=="inherit"?e.workspaceActivation==="enabled":e.defaultActivation?e.defaultActivation==="enabled":e.isActive}function ZE(e,t){return i9(e)?t("extensions.manage.status.enabled"):t("extensions.manage.status.disabled")}function ej(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 x2(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 tG(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 Ah({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:_1(e)}),l.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function Ew({items:e,empty:t,icon:n}){return e.length?l.jsx(No,{children:l.jsx(Vl,{className:"flex flex-col",children:e.map((s,r)=>l.jsxs("div",{children:[r>0?l.jsx(jP,{}):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($u,{className:"border",children:l.jsxs(Bu,{children:[l.jsx(zu,{variant:"icon",children:l.jsx(n,{})}),l.jsx(Fu,{children:t})]})})}function nG({pendingInteraction:e,submitting:t,selectedPlugin:n,interactionValue:s,setSelectedPlugin:r,setInteractionValue:i,submit:o,t:a}){return l.jsx(Qm,{open:!!e,onOpenChange:c=>{!c&&e&&!t&&o({cancelled:!0})},children:l.jsxs(Jm,{showCloseButton:!1,className:"max-h-[calc(100vh-2rem)] overflow-y-auto sm:max-w-3xl",children:[l.jsxs(Zm,{className:"items-start px-3 text-left",children:[l.jsx(tp,{children:(e==null?void 0:e.interaction.kind)==="setting"?e.interaction.setting.name:a("extensions.manage.selectExtension")}),l.jsx(W0,{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(ede,{"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(tde,{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(ep,{children:[l.jsx(Jt,{variant:"outline",disabled:t,onClick:()=>o({cancelled:!0}),children:a("common.cancel")}),l.jsxs(Jt,{disabled:t||!n,onClick:()=>o({pluginName:n}),children:[t?l.jsx(fr,{}):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(Pr,{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(ep,{children:[l.jsx(Jt,{variant:"outline",disabled:t,onClick:()=>o({cancelled:!0}),children:a("common.cancel")}),l.jsxs(Jt,{disabled:t,onClick:()=>o({value:s}),children:[t?l.jsx(fr,{}):null,e.owner==="mutation"?a("extensions.manage.update"):a("extensions.manage.install")]})]})]}):null]})})}function nde({onClose:e,initialFocusRef:t,embedded:n}){const{t:s}=lt(),r=Ra(),i=io(),o=pa(),a=Xd(),[c,u]=h.useState([]),[d,f]=h.useState(null),[m,p]=h.useState(""),[g,b]=h.useState({}),[v,y]=h.useState(!1),[w,x]=h.useState(null),[k,C]=h.useState(null),[T,_]=h.useState(null),[S,R]=h.useState("info"),[A,O]=h.useState(null),[M,D]=h.useState(null),[$,z]=h.useState(!1),[B,j]=h.useState(null),[H,Q]=h.useState(!1),[I,J]=h.useState(""),[W,P]=h.useState(!1),[V,ee]=h.useState(null),[q,K]=h.useState(null),de=h.useRef(null),[re,ne]=h.useState(""),[U,Z]=h.useState(""),[ge,ce]=h.useState(!1),[ue,be]=h.useState(!1),rt=h.useRef(!1),le=h.useRef(null),Me=h.useRef(null),We=h.useRef(new Map),at=h.useRef(null),[ze,rn]=h.useState(null),Wt=h.useCallback(ve=>{ve&&Me.current!==ve||(Me.current=null,de.current=null,K(null),ne(""),Z(""))},[]),zt=h.useCallback((ve,Fe,ie)=>{de.current!==Fe.id&&(ne(""),Z(""),de.current=Fe.id),Me.current=ve,K({operationId:ve,interaction:Fe,owner:ie})},[]),ae=h.useCallback((ve=!1)=>{y(!0);const Fe=i.workspaceCwd?i.client.workspaceByCwd(i.workspaceCwd).workspaceExtensions().catch(()=>null):Promise.resolve(null);return Promise.all([o.loadExtensionsStatus(),Fe]).then(([ie,Pe])=>{var Ae,vt,vn;const et=new Map(((Pe==null?void 0:Pe.extensions)??[]).map(Ce=>[Ce.extensionId,Ce])),He=(ie.extensions??[]).map(Ce=>{const yt=et.get(Ce.id);return yt?{...Ce,defaultActivation:yt.defaultActivation,workspaceActivation:yt.workspaceActivation??"inherit"}:Ce});u(Ce=>{const yt=le.current;if(!yt||He.some(De=>De.name===yt))return He;const Ft=Ce.find(De=>De.name===yt);return Ft?[...He,Ft]:He}),ve||(O(null),R((Ae=ie.errors)!=null&&Ae[0]?"error":"info"),_(((vn=(vt=ie.errors)==null?void 0:vt[0])==null?void 0:vn.error)??null)),f(Ce=>Ce&&le.current===Ce?Ce:$St(Ce,He))}).catch(ie=>{ve||(O(null),R("error"),_(ie instanceof Error?ie.message:String(ie)))}).finally(()=>y(!1))},[o,i.client,i.workspaceCwd]);h.useEffect(()=>{ae()},[ae]),h.useEffect(()=>{let ve=!1,Fe,ie=2e3;const Pe=async()=>{try{const{operations:et}=await o.activeExtensionOperations();if(ve)return;const He=et.filter(vt=>vt.operation==="install").sort((vt,vn)=>vn.createdAt-vt.createdAt)[0];He&&ee(vt=>vt??{operationId:He.operationId,source:He.source??He.name??"extension"});const Ae=et.find(vt=>vt.operation!=="install");Ae&&(rt.current=!0,Ae.operation==="uninstall"&&(le.current=Ae.name??"extension"),rn(vt=>vt??{operationId:Ae.operationId,name:Ae.name??"extension",operation:Ae.operation}),C(vt=>vt??Ae.name??null)),D(null),be(!0)}catch(et){ve||(D(et instanceof Error?et.message:String(et)),Fe=setTimeout(()=>void Pe(),ie),ie=Math.min(ie*2,3e4))}};return Pe(),()=>{ve=!0,Fe&&clearTimeout(Fe)}},[o]);const je=h.useRef((a==null?void 0:a.extensionsVersion)??0);h.useEffect(()=>{const ve=(a==null?void 0:a.extensionsVersion)??0;ve!==je.current&&(je.current=ve,b({}),ae(!0))},[ae,a==null?void 0:a.extensionsVersion]),h.useEffect(()=>{if(!V)return;let ve=!1,Fe,ie=1e3;const Pe=async()=>{var et,He;try{const Ae=await o.extensionOperationStatus(V.operationId);if(ve)return;if(ie=1e3,Ae.status==="waiting_for_input"){Ae.interaction?(zt(Ae.operationId,Ae.interaction,"install"),Fe=setTimeout(()=>void Pe(),5e3)):(R("error"),_(s("extensions.manage.operationFailed")),Wt(V.operationId),ee(null));return}if(Ae.status==="failed"){R("error"),_(s("extensions.install.failed",{source:V.source,error:Ae.error??""})),Wt(V.operationId),ee(null);return}if(Ae.status==="succeeded"||Ae.status==="succeeded_with_refresh_error"){R(Ae.status==="succeeded_with_refresh_error"?"error":"success"),_(Ae.status==="succeeded_with_refresh_error"?s("extensions.manage.refreshFailed",{error:((et=Ae.result)==null?void 0:et.error)??""}):s("extensions.install.installed",{name:((He=Ae.result)==null?void 0:He.name)??V.source})),Wt(V.operationId),ee(null),ae(!0);return}R("progress"),_(s("extensions.install.started",{source:V.source})),Fe=setTimeout(()=>void Pe(),1e3)}catch(Ae){if(ve)return;if(R("error"),_(Ae instanceof Error?Ae.message:String(Ae)),Ae instanceof Rc&&Ae.status===404){Wt(V.operationId),ee(null);return}Fe=setTimeout(()=>void Pe(),ie),ie=Math.min(ie*2,3e4)}};return Pe(),()=>{ve=!0,Fe&&clearTimeout(Fe)}},[o,Wt,ae,V,zt,s]);const it=h.useCallback(ve=>{if(!q)return;const Fe=q.owner,ie=()=>{Fe==="install"?ee(Pe=>Pe&&{...Pe}):rn(Pe=>Pe&&{...Pe})};ce(!0),o.respondToExtensionInteraction(q.operationId,q.interaction.id,ve,r.clientId).then(()=>{Wt(q.operationId),ie()}).catch(Pe=>{R("error"),_(Pe instanceof Error?Pe.message:String(Pe)),Wt(q.operationId),ie()}).finally(()=>ce(!1))},[o,Wt,r.clientId,q]);h.useEffect(()=>{if(!ze)return;let ve=!1,Fe,ie=1e3;const Pe=async()=>{var et;try{const He=await o.extensionOperationStatus(ze.operationId);if(ve)return;if(ie=1e3,He.status==="waiting_for_input"){He.interaction?(zt(He.operationId,He.interaction,"mutation"),Fe=setTimeout(()=>void Pe(),5e3)):(R("error"),_(s("extensions.manage.operationFailed")),Wt(ze.operationId),rn(null),C(null),rt.current=!1,ze.operation==="uninstall"&&(le.current=null,ae(!0)));return}if(He.status==="failed"){R("error"),_(He.error??s("extensions.manage.operationFailed")),Wt(ze.operationId),rn(null),C(null),rt.current=!1,He.operation==="uninstall"&&(le.current=null,ae(!0));return}if(He.status==="succeeded"||He.status==="succeeded_with_refresh_error"){He.status==="succeeded_with_refresh_error"?(R("error"),_(s("extensions.manage.refreshFailed",{error:((et=He.result)==null?void 0:et.error)??""}))):He.operation==="uninstall"?_(null):(R("success"),_(tG(He.operation,ze.name,s))),Wt(ze.operationId),rn(null),C(null),rt.current=!1,He.operation==="uninstall"&&(le.current=null,O(null),f(null)),He.operation==="update"&&b(Ae=>{const vt={...Ae};return delete vt[ze.name],vt}),ae(!0);return}R("progress"),_(x2(He.operation,ze.name,s)),Fe=setTimeout(()=>void Pe(),1e3)}catch(He){if(ve)return;if(R("error"),_(He instanceof Error?He.message:String(He)),He instanceof Rc&&He.status===404){Wt(ze.operationId),rn(null),C(null),rt.current=!1,ze.operation==="uninstall"&&(le.current=null,ae(!0));return}Fe=setTimeout(()=>void Pe(),ie),ie=Math.min(ie*2,3e4)}};return Pe(),()=>{ve=!0,Fe&&clearTimeout(Fe)}},[o,Wt,ae,ze,zt,s]);const gt=h.useCallback(()=>{O(null),R("info"),_(null),ae()},[ae]),wt=h.useCallback(ve=>{x(ve),O(d===ve?ve:null),R("info"),_(null),b(Fe=>({...Fe,[ve]:"checking for updates"})),o.checkExtensionUpdates(r.clientId).then(Fe=>{b(Fe.states),_(ej(Fe.states[ve],s))}).catch(Fe=>{b(ie=>({...ie,[ve]:"error"})),R("error"),_(Fe instanceof Error?Fe.message:String(Fe))}).finally(()=>x(null))},[o,r.clientId,d,s]),Ke=h.useCallback(()=>{const ve=I.trim(),Fe=r.clientId;!ve||!ue||V||ze||rt.current||(P(!0),O(null),R("progress"),_(null),o.installExtension({source:ve,consent:!0},Fe).then(ie=>{ee({operationId:ie.operationId,source:ve}),J(""),Q(!1)}).catch(ie=>{R("error"),_(ie instanceof Error?ie.message:String(ie))}).finally(()=>P(!1)))},[o,r.clientId,I,ue,V,ze]),un=h.useCallback((ve,Fe,ie={})=>{const Pe=r.clientId;if(!ue||V||ze||w||rt.current)return!1;rt.current=!0,ie.operation==="uninstall"&&(le.current=ve),C(ve),O(d===ve?ve:null),R("progress"),_(ie.startMessage??null);let et=!1;return Fe(Pe).then(He=>{const Ae=He&&typeof He=="object"&&"operationId"in He&&typeof He.operationId=="string"?He.operationId:void 0;if(Ae){et=!0,rn({operationId:Ae,name:ve,operation:ie.operation});return}_(s("extensions.manage.queued",{name:ve}))}).catch(He=>{R("error"),_(He instanceof Error?He.message:String(He))}).finally(()=>{et||(rt.current=!1,C(null),ie.operation==="uninstall"&&(le.current=null),ae(!0))}),!0},[r.clientId,w,ae,ue,V,ze,d,s]),me=h.useCallback(async(ve,Fe,ie)=>{if(k||V||ze||w||!i.workspaceCwd)return;const Pe=ie==="enabled"?"enable":ie==="disabled"?"disable":"inherit";C(ve.name),O(ve.name),R("progress"),_(Pe==="inherit"?s("extensions.manage.inheriting",{name:ve.name}):x2(Pe,ve.name,s));try{const et=Fe==="user"?await i.client.setExtensionDefaultActivation(ve.id,ie):ie==="inherit"?await i.client.workspaceByCwd(i.workspaceCwd).clearExtensionActivation(ve.id):await i.client.workspaceByCwd(i.workspaceCwd).setExtensionActivation(ve.id,ie),He=await i.client.waitForExtensionOperation(et);if(He.status==="failed")throw new Error(He.error??s("extensions.manage.operationFailed"));await ae(!0),R("success"),_(Pe==="inherit"?s("extensions.manage.inherited",{name:ve.name}):tG(Pe,ve.name,s))}catch(et){R("error"),_(et instanceof Error?et.message:String(et))}finally{C(null)}},[k,w,ae,V,ze,s,i.client,i.workspaceCwd]),ht=h.useMemo(()=>c.find(ve=>ve.name===d),[c,d]);h.useEffect(()=>{n==null||n.onDetailChange(!!ht)},[n,ht]);const Oe=h.useMemo(()=>BSt(c,m),[c,m]),Ne=h.useCallback(()=>{at.current=d,f(null)},[d]);h.useEffect(()=>{var ve;d||!at.current||((ve=We.current.get(at.current))==null||ve.focus(),at.current=null)},[d]);const St=l.jsx(fp,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(mp,{className:"text-base",children:[l.jsx(Yi,{children:l.jsx(Jt,{variant:"ghost",size:"icon",onClick:e,"aria-label":s("common.back"),children:l.jsx(ik,{})})}),l.jsx(Yi,{children:ht?l.jsx($d,{asChild:!0,children:l.jsx("button",{type:"button",onClick:Ne,children:s("extensions.manage.title")})}):l.jsx(ml,{children:s("extensions.manage.title")})}),ht?l.jsx(Bd,{}):null,ht?l.jsx(Yi,{children:l.jsx(ml,{children:Tw(ht)})}):null]})}),Ue=n?ht?l.jsx(fp,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(mp,{className:"h-8 text-sm",children:[l.jsx(Yi,{children:l.jsx($d,{asChild:!0,children:l.jsx("button",{type:"button",onClick:n.onRoot,children:s("extensions.manage.title")})})}),l.jsx(Bd,{}),l.jsx(Yi,{children:l.jsx(ml,{children:Tw(ht)})})]})}):null:St;if(ht){const ve=ht.details,Fe=g[ht.name]??ht.updateState,ie=!ue||V!==null||k!==null||ze!==null,Pe=w===ht.name,et=ht.defaultActivation,He=ht.workspaceActivation,Ae=et===void 0||He===void 0,vt=(ve==null?void 0:ve.commands)??[],vn=(ve==null?void 0:ve.skills)??[],Ce=(ve==null?void 0:ve.agents)??[],yt=(ve==null?void 0:ve.mcpServers)??[],Ft=(ve==null?void 0:ve.contextFiles)??[];return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[Ue,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(qB,{})}),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-xl font-semibold",children:Tw(ht)}),l.jsxs(Pi,{variant:"outline",children:["v",ht.version]}),l.jsx(Pi,{variant:"secondary",className:i9(ht)?"bg-[var(--success-bg)] text-[var(--success-color)]":void 0,children:ZE(ht,s)})]})}),l.jsxs(Hh,{open:$,onOpenChange:z,children:[l.jsx(qh,{asChild:!0,children:l.jsx(Jt,{variant:"ghost",size:"icon",disabled:ie||Pe,"aria-label":s("extensions.manage.actions"),children:ie||Pe?l.jsx(fr,{}):l.jsx(fm,{})})}),l.jsxs(Uh,{align:"end",children:[l.jsxs(Lm,{children:[l.jsx(ho,{disabled:ie||w!==null,onSelect:()=>wt(ht.name),children:s("extensions.manage.checkUpdates")}),l.jsx(ho,{disabled:ie||Pe||Fe!==eG,onSelect:()=>un(ht.name,De=>o.updateExtension(ht.name,De),{operation:"update",startMessage:x2("update",ht.name,s)}),children:s("extensions.manage.update")})]}),l.jsx(Pce,{}),l.jsx(Lm,{children:l.jsx(ho,{variant:"destructive",disabled:ie||Pe,onSelect:De=>{De.preventDefault(),z(!1),j(ht.name)},children:s("extensions.manage.uninstallAction")})})]})]})]}),A===ht.name&&T?l.jsx(Yl,{tone:S,noticeKey:T,closeLabel:s("common.close"),onDismiss:()=>_(null),className:"break-words",children:T}):null,Ae?l.jsxs(bo,{variant:"destructive",children:[l.jsx(ja,{}),l.jsx(yo,{children:s("extensions.manage.setting.unavailableDescription")})]}):null,l.jsx(No,{className:"gap-0 py-1",children:l.jsxs(Vl,{className:"flex flex-col p-0",children:[l.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"font-medium",children:s("extensions.manage.userSetting")}),l.jsx("p",{className:"text-sm text-muted-foreground",children:s("extensions.manage.userSettingDescription")})]}),l.jsxs(xl,{value:et,disabled:ie||Pe||Ae,onValueChange:De=>void me(ht,"user",De),children:[l.jsx(_l,{className:"w-28 shrink-0",children:l.jsx(kl,{placeholder:s("extensions.manage.setting.unknown")})}),l.jsxs(Sl,{children:[l.jsx(Ti,{value:"enabled",children:s("extensions.manage.setting.enabled")}),l.jsx(Ti,{value:"disabled",children:s("extensions.manage.setting.disabled")})]})]})]}),l.jsx(jP,{}),l.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"font-medium",children:s("extensions.manage.workspaceSetting")}),l.jsx("p",{className:"text-sm text-muted-foreground",children:s("extensions.manage.workspaceSettingDescription")})]}),l.jsxs(xl,{value:He,disabled:ie||Pe||Ae,onValueChange:De=>void me(ht,"workspace",De),children:[l.jsx(_l,{className:"w-28 shrink-0",children:l.jsx(kl,{placeholder:s("extensions.manage.setting.unknown")})}),l.jsxs(Sl,{children:[l.jsx(Ti,{value:"inherit",children:s("extensions.manage.setting.default")}),l.jsx(Ti,{value:"enabled",children:s("extensions.manage.setting.enabled")}),l.jsx(Ti,{value:"disabled",children:s("extensions.manage.setting.disabled")})]})]})]})]})}),l.jsxs(_g,{defaultValue:"overview",children:[l.jsxs(Sg,{className:"max-w-full overflow-x-auto",children:[l.jsx(ti,{value:"overview",children:s("extensions.manage.overview")}),l.jsxs(ti,{value:"commands",children:[_1(s("extensions.manage.commands"))," ",vt.length]}),l.jsxs(ti,{value:"skills",children:[_1(s("extensions.manage.skills"))," ",vn.length]}),l.jsxs(ti,{value:"agents",children:[_1(s("extensions.manage.agents"))," ",Ce.length]}),l.jsxs(ti,{value:"mcp",children:[_1(s("extensions.manage.mcpServers"))," ",yt.length]}),l.jsxs(ti,{value:"context",children:[_1(s("extensions.manage.contextFiles"))," ",Ft.length]})]}),l.jsx(Ri,{value:"overview",className:"pt-4",children:l.jsxs(No,{children:[l.jsxs(bl,{children:[l.jsx(yl,{children:s("extensions.manage.overview")}),ht.description?l.jsx(mu,{children:ht.description}):null]}),l.jsxs(Vl,{className:"grid gap-6 sm:grid-cols-2",children:[l.jsx(Ah,{label:s("extensions.manage.name"),value:ht.name}),l.jsx(Ah,{label:s("extensions.manage.version"),value:ht.version}),l.jsx(Ah,{label:s("extensions.manage.status"),value:ZE(ht,s)}),l.jsx(Ah,{label:s("extensions.manage.source"),value:ht.source??"-"}),l.jsx(Ah,{label:s("extensions.manage.path"),value:ht.path}),l.jsx(Ah,{label:s("extensions.manage.updateStatus"),value:ej(Fe,s)}),l.jsx(Ah,{label:s("extensions.manage.installType"),value:ht.installType??"-"}),l.jsx(Ah,{label:s("extensions.manage.origin"),value:ht.originSource??"-"}),l.jsx(Ah,{label:s("extensions.manage.settings"),value:((ve==null?void 0:ve.settings)??[]).join(", ")||"-"})]})]})}),l.jsx(Ri,{value:"commands",className:"pt-4",children:l.jsx(Ew,{items:vt,empty:s("extensions.manage.emptyCommands"),icon:lye})}),l.jsx(Ri,{value:"skills",className:"pt-4",children:l.jsx(Ew,{items:vn,empty:s("extensions.manage.emptySkills"),icon:eb})}),l.jsx(Ri,{value:"agents",className:"pt-4",children:l.jsx(Ew,{items:Ce,empty:s("extensions.manage.emptyAgents"),icon:gv})}),l.jsx(Ri,{value:"mcp",className:"pt-4",children:l.jsx(Ew,{items:yt,empty:s("extensions.manage.emptyMcpServers"),icon:Z1})}),l.jsx(Ri,{value:"context",className:"pt-4",children:l.jsx(Ew,{items:Ft,empty:s("extensions.manage.emptyContextFiles"),icon:wye})})]})]}),l.jsx(Ox,{open:B===ht.name,onOpenChange:De=>{De||j(null)},children:l.jsxs($x,{children:[l.jsxs(Bx,{className:"place-items-start text-left",children:[l.jsx(Fx,{children:s("extensions.manage.uninstallAction")}),l.jsx(Hx,{children:s("extensions.manage.uninstallConfirm",{name:ht.name})})]}),l.jsxs(zx,{children:[l.jsx(qx,{children:s("common.cancel")}),l.jsx(AP,{variant:"destructive",onClick:()=>{B&&un(B,De=>o.uninstallExtension(B,De),{operation:"uninstall",startMessage:x2("uninstall",B,s)})&&j(null)},children:s("extensions.manage.uninstallAction")})]})]})}),l.jsx(nG,{pendingInteraction:q,submitting:ge,selectedPlugin:U,interactionValue:re,setSelectedPlugin:Z,setInteractionValue:ne,submit:it,t:s})]})}return l.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[Ue,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-xl 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:c.length})})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[l.jsxs(Jt,{variant:"outline",disabled:v,onClick:gt,children:[v?l.jsx(fr,{}):l.jsx(ak,{"data-icon":"inline-start"}),s("common.refresh")]}),l.jsxs(Jt,{disabled:!ue||!!(V||ze||k),onClick:()=>Q(!0),children:[l.jsx(z0,{"data-icon":"inline-start"}),s("extensions.manage.add")]})]})]}),A===null&&T||M?l.jsx(Yl,{tone:M?"error":S,noticeKey:(A===null?T:null)??M??"",closeLabel:s("common.close"),onDismiss:()=>{_(null),D(null)},className:"break-words",children:(A===null?T:null)??M}):null,l.jsxs("div",{className:"relative",children:[l.jsx(Pc,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(Pr,{name:"extension-search","aria-label":s("extensions.manage.search"),autoComplete:"off",value:m,onChange:ve=>p(ve.target.value),placeholder:s("extensions.manage.search"),className:"pl-9"})]}),Oe.length?l.jsx("div",{className:OSt.extensionGrid,"data-column-count":Math.min(Oe.length,4),children:Oe.map(ve=>{const Fe=g[ve.name]??ve.updateState;return l.jsx(No,{ref:ie=>{ie?We.current.set(ve.name,ie):We.current.delete(ve.name)},size:"sm",role:"button",tabIndex:0,"aria-label":Tw(ve),className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>f(ve.name),onKeyDown:ie=>{(ie.key==="Enter"||ie.key===" ")&&(ie.preventDefault(),f(ve.name))},children:l.jsx(bl,{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(qB,{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(yl,{className:"min-w-0 truncate",children:Tw(ve)}),l.jsx("div",{className:"flex shrink-0 justify-end",children:l.jsx(Pi,{variant:"secondary",className:i9(ve)?"bg-[var(--success-bg)] text-[10px] text-[var(--success-color)]":"text-[10px]",children:ZE(ve,s)})})]}),Fe===eG?l.jsx("div",{className:"mt-1",children:l.jsx(Pi,{className:"text-[10px]",children:ej(Fe,s)})}):null,l.jsx(mu,{className:"mt-1 min-w-0 text-xs",children:l.jsx(nh,{delayDuration:300,children:l.jsxs(sh,{children:[l.jsx(rh,{asChild:!0,children:l.jsx("span",{className:"block truncate",children:ve.description||s("extensions.manage.noDescription")})}),l.jsx(ih,{children:ve.description||s("extensions.manage.noDescription")})]})})})]})]})})},ve.id||ve.name)})}):l.jsx($u,{className:"border",children:l.jsxs(Bu,{children:[l.jsx(zu,{variant:"icon",children:m?l.jsx(Pc,{}):l.jsx(Hbe,{})}),l.jsx(Fu,{children:s(m?"extensions.manage.noMatches":"extensions.manage.empty")}),m?null:l.jsx(ky,{children:s("extensions.manage.emptyDescription")})]})})]}),l.jsx(Ox,{open:H,onOpenChange:ve=>{(ve||!W)&&Q(ve)},children:l.jsxs($x,{size:"middle",children:[l.jsxs(Bx,{className:"place-items-start text-left",children:[l.jsx(Fx,{children:s("extensions.manage.add")}),l.jsx(Hx,{children:s("extensions.manage.installDescription")})]}),l.jsx(Pr,{id:"extension-source",name:"extension-source","aria-label":s("extensions.manage.installDescription"),autoComplete:"off",value:I,onChange:ve=>J(ve.target.value),placeholder:s("extensions.manage.sourcePlaceholder")}),l.jsxs(zx,{children:[l.jsx(qx,{disabled:W,children:s("common.cancel")}),l.jsxs(Jt,{disabled:W||!ue||!!(V||ze||k)||!I.trim(),onClick:Ke,children:[W?l.jsx(fr,{}):null,s("extensions.manage.install")]})]})]})}),l.jsx(nG,{pendingInteraction:q,submitting:ge,selectedPlugin:U,interactionValue:re,setSelectedPlugin:Z,setInteractionValue:ne,submit:it,t:s})]})}const zSt="_connectedBadge_1erz5_1",FSt="_serverGrid_1erz5_6",sde={connectedBadge:zSt,serverGrid:FSt},k2=`{
  "command": "",
  "args": []
}`;function U5(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 v4(e){const t=U5(e);return t==="workspace_settings"?"workspace":t==="extension"?"extension":"user"}function HSt(e){const t=U5(e);return t==="extension"||t==="workspace_settings"||t==="user_settings"}function sG(e,t){const n=v4(e);return t(n==="workspace"?"mcp.source.workspace":n==="extension"?"mcp.source.extension":"mcp.source.user")}function rG(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 iG(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 oG(e){return!e.disabled&&!e.approvalState&&e.mcpStatus==="connected"?sde.connectedBadge:""}function qSt(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 USt(e,t){const n=[],s=!!e.approvalState,r=U5(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 tj(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,t("mcp.oauth.starting",{name:e}),n].filter(Boolean).join(`
`)}function WSt(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function VSt(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 wc({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 GSt({tool:e,t}){var i;const n=VSt(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(bo,{variant:"destructive",children:[l.jsx(ja,{}),l.jsx(xc,{children:t("mcp.invalidToolWarning")}),l.jsxs(yo,{children:[e.invalidReason||t("mcp.status.unknown"),l.jsx("span",{className:"mt-1 block",children:t("mcp.invalidToolHelp")})]})]}),l.jsx(wc,{label:t("mcp.description"),value:((i=e.description)==null?void 0:i.trim())||t("mcp.noDescription")}),n?l.jsx(wc,{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 KSt({resource:e,t}){const n=e.title||e.name||"";return l.jsxs("div",{className:"flex flex-col gap-5",children:[l.jsx(wc,{label:t("mcp.resource.uriLabel"),value:e.uri}),n&&n!==e.uri?l.jsx(wc,{label:t("mcp.resource.nameLabel"),value:n}):null,e.mimeType?l.jsx(wc,{label:t("mcp.resource.mimeTypeLabel"),value:e.mimeType}):null,typeof e.size=="number"?l.jsx(wc,{label:t("mcp.resource.sizeLabel"),value:t("mcp.resource.bytes",{count:e.size})}):null,e.description?l.jsx(wc,{label:t("mcp.description"),value:e.description.trim()}):null]})}function rde({message:e,onClose:t,embedded:n}){var He,Ae,vt,vn;const{t:s}=lt(),r=EI({autoLoad:!1}),i=jI({autoLoad:!1}),[o,a]=h.useState(e.status),[c,u]=h.useState(e.toolsByServer),[d,f]=h.useState(e.resourcesByServer??{}),[m,p]=h.useState(null),[g,b]=h.useState(null),[v,y]=h.useState(null),[w,x]=h.useState("overview"),[k,C]=h.useState(""),[T,_]=h.useState("all"),[S,R]=h.useState(null),[A,O]=h.useState(!1),[M,D]=h.useState(!1),[$,z]=h.useState(!1),[B,j]=h.useState(null),[H,Q]=h.useState(""),[I,J]=h.useState(""),[W,P]=h.useState("workspace"),[V,ee]=h.useState(k2),[q,K]=h.useState(!1),[de,re]=h.useState(null),[ne,U]=h.useState(null),[Z,ge]=h.useState(null),ce=Z!=null&&Z.error?"error":Z!=null&&Z.success?"success":Z!=null&&Z.progress?"progress":"info",[ue,be]=h.useState({}),rt=h.useRef(e.status.discoveryState==="completed"),le=h.useRef(!0);h.useEffect(()=>(le.current=!0,()=>{le.current=!1}),[]);const Me=h.useCallback(async()=>(await new Promise(Ce=>window.setTimeout(Ce,1500)),le.current),[]),We=h.useCallback(async(Ce,yt=!0,Ft=!1)=>{var De;if(await(Ce==="initialize"?r.initialize():r.reloadConfig()),!le.current)return!1;for(let Xe=0;Xe<40;Xe+=1){if(!await Me())return!1;const $e=await r.reload();if(!le.current)return!1;if($e){if((!Ft||$e.discoveryState==="completed")&&a(Ht=>yt&&$e.servers.length===0&&Ht.servers.length>0?{...$e,servers:Ht.servers}:$e),(De=$e.errors)!=null&&De.length)return yt&&ge({text:$e.errors.map(Ht=>Ht.error||Ht.hint||Ht.kind).join(`
`),error:!0}),!1;if($e.discoveryState==="completed")return yt&&ge(null),!0;if($e.initialized&&$e.discoveryState==="not_started"&&$e.servers.length===0)return Ft&&a($e),yt&&ge({text:s("mcp.discovery.empty")}),!0}}return yt&&ge({text:s("mcp.discovery.timeout"),error:!0}),!1},[r,s,Me]);h.useEffect(()=>{rt.current||(rt.current=!0,O(!0),We("initialize").catch(Ce=>{le.current&&ge({text:Wi(Ce),error:!0})}).finally(()=>{le.current&&O(!1)}))},[We]);const at=h.useMemo(()=>(o.servers??[]).filter(HSt),[o.servers]),ze=at.find(Ce=>Ce.name===m)??null,rn=ze?((He=c[ze.name])==null?void 0:He.tools)??[]:[],Wt=ze?((Ae=d[ze.name])==null?void 0:Ae.resources)??[]:[],zt=rn.find(Ce=>Ce.name===g)??null,ae=Wt.find(Ce=>Ce.uri===v)??null;h.useEffect(()=>{n==null||n.onDetailChange(!!ze)},[n,ze]);const je=h.useMemo(()=>{const Ce=k.trim().toLowerCase();return at.filter(yt=>{var Xe,$e;const Ft=T==="all"||v4(yt)===T,De=!Ce||yt.name.toLowerCase().includes(Ce)||((Xe=yt.description)==null?void 0:Xe.toLowerCase().includes(Ce))||(($e=yt.extensionName)==null?void 0:$e.toLowerCase().includes(Ce));return Ft&&!!De})},[k,at,T]),it=h.useCallback(async Ce=>{const yt=[],[Ft,De]=await Promise.allSettled([r.loadTools(Ce.name),Ce.resourceCount?r.loadResources(Ce.name):Promise.resolve(null)]);if(Ft.status==="fulfilled")u(Xe=>({...Xe,[Ce.name]:Ft.value})),be(Xe=>({...Xe,[Ce.name]:{...Xe[Ce.name],tools:void 0}}));else{yt.push(Ft.reason);const Xe=Wi(Ft.reason);be($e=>({...$e,[Ce.name]:{...$e[Ce.name],tools:Xe}}))}if(De.status==="fulfilled"&&De.value!==null){const Xe=De.value;f($e=>({...$e,[Ce.name]:Xe})),be($e=>({...$e,[Ce.name]:{...$e[Ce.name],resources:void 0}}))}else if(De.status==="rejected"){yt.push(De.reason);const Xe=Wi(De.reason);be($e=>({...$e,[Ce.name]:{...$e[Ce.name],resources:Xe}}))}else f(Xe=>{if(!(Ce.name in Xe))return Xe;const $e={...Xe};return delete $e[Ce.name],$e}),be(Xe=>({...Xe,[Ce.name]:{...Xe[Ce.name],resources:void 0}}));if(yt.length>0)throw new AggregateError(yt,`${Ce.name}: ${yt.map(Wi).join("; ")}`)},[r]),gt=h.useCallback(async()=>{if(!M){D(!0),ge(null);try{const Ce=await r.reload();if(!Ce)return;a(Ce)}catch(Ce){ge({text:Wi(Ce),error:!0})}finally{D(!1)}}},[r,M]),wt=h.useCallback(async()=>{const Ce=H.trim(),yt=B!==null;if(!Ce){re(s("mcp.add.nameRequired"));return}let Ft;try{const Xe=JSON.parse(V);if(!Xe||typeof Xe!="object"||Array.isArray(Xe))throw new Error(s("mcp.add.configInvalid"));const $e=I.trim();Ft={...Xe,...$e?{description:$e}:{}}}catch(Xe){re(Wi(Xe));return}re(null),K(!0);let De=!1;try{await i.setValue(W,"mcpServers",Ft,{mcpServerMutation:{operation:"set",name:Ce}}),De=!0,ge(null);const Xe=await We("reload",!1).catch(()=>!1);ge({...yt?{serverName:Ce}:{},text:Xe?s(yt?"mcp.edit.done":"mcp.add.done",{name:Ce}):s("mcp.runtime.notUpdated"),error:!Xe,success:Xe}),z(!1),j(null),Q(""),J(""),ee(k2)}catch(Xe){De?(ge({...yt?{serverName:Ce}:{},text:s("mcp.runtime.notUpdated"),error:!0}),z(!1),j(null),Q(""),J(""),ee(k2)):re(Wi(Xe))}finally{K(!1)}},[r,B,V,I,H,W,i,We,s]),Ke=h.useCallback(async()=>{if(!ne)return;R(ne.name);let Ce=!1;try{const yt=await i.reload();if(!yt){ge({serverName:ne.name,text:s("mcp.add.settingsUnavailable"),error:!0});return}const Ft=v4(ne)==="workspace"?"workspace":"user",De=rG(yt,Ft);if(!(ne.name in De)){ge({serverName:ne.name,text:s("mcp.remove.notWorkspace"),error:!0});return}await i.setValue(Ft,"mcpServers",{},{mcpServerMutation:{operation:"remove",name:ne.name}}),Ce=!0,U(null),ge({serverName:ne.name,text:s("mcp.action.running",{action:s("mcp.action.remove")}),progress:!0}),await We("reload",!1,!0).catch(()=>!1)?(p(null),b(null),y(null),ge(null)):ge({serverName:ne.name,text:s("mcp.runtime.removeNotUpdated"),error:!0})}catch(yt){ge({serverName:ne.name,text:Ce?s("mcp.runtime.removeNotUpdated"):s("mcp.action.failed",{error:Wi(yt)}),error:!0})}finally{R(null)}},[ne,i,We,s]),un=h.useCallback(async Ce=>{if(S)return;const yt=U5(Ce);if(yt!=="user_settings"&&yt!=="workspace_settings")return;const Ft=yt==="workspace_settings"?"workspace":"user";R(Ce.name),ge(null);try{const De=await i.reload();if(!De)throw new Error(s("mcp.add.settingsUnavailable"));const Xe=rG(De,Ft)[Ce.name];if(!Xe||typeof Xe!="object"||Array.isArray(Xe))throw new Error(s("mcp.edit.notFound"));const $e={...Xe},Ht=$e.description;delete $e.description,j(Ce),Q(Ce.name),P(Ft),J(typeof Ht=="string"?Ht:""),ee(JSON.stringify($e,null,2)),re(null),z(!0)}catch(De){ge({serverName:Ce.name,text:s("mcp.action.failed",{error:Wi(De)}),error:!0})}finally{R(null)}},[S,i,s]),me=h.useCallback(async(Ce,yt)=>{var Ft,De,Xe,$e;if(!S){if(yt.id==="remove"){U(Ce);return}if(yt.id==="edit"){await un(Ce);return}R(Ce.name),ge({serverName:Ce.name,text:yt.id==="authenticate"?tj(Ce.name,s):s("mcp.action.running",{action:yt.label}),progress:!0});try{let Ht="",ke,Fn=!1;if(yt.id==="reconnect"){const ft=await r.restartServer(Ce.name);if(!le.current)return;if("restarted"in ft&&!ft.restarted)throw ft.reason==="authentication_required"?new Error(s("mcp.reconnect.authenticationRequired")):new Error(s("mcp.reconnect.skipped",{reason:ft.reason}));if("entries"in ft&&(ft.entries.length===0||ft.entries.every(Lt=>!Lt.restarted)))throw new Error(s("mcp.reconnect.skipped",{reason:ft.entries.map(Lt=>Lt.reason).filter(Boolean).join(", ")||"not connected"}))}else{const ft=await r.manageServer(Ce.name,yt.id);if(!le.current)return;ke=ft.authUrl,Ht=[...ft.messages??[]].join(`
`),Fn=yt.id==="authenticate"&&ft.pending===!0,Fn&&ge({serverName:Ce.name,text:tj(Ce.name,s,Ht),progress:!0,...ke?{authUrl:ke}:{}})}let Ve;if(Fn){for(let ft=0;ft<400;ft+=1){if(!await Me())return;const Lt=await r.reload();if(!le.current)return;if(!Lt)continue;a(Lt);const gn=(Ft=Lt.errors)==null?void 0:Ft[0];if(gn)throw new Error(gn.error||gn.hint||s("mcp.oauth.statusFailed"));const Tn=(De=Lt.servers)==null?void 0:De.find(Xn=>Xn.name===Ce.name);if(!Tn)throw new Error(s("mcp.oauth.serverRemoved"));if(Tn.authenticationState==="failed")throw new Error(Tn.authenticationError||s("mcp.oauth.authenticationFailed"));if(Tn.authenticationState==="succeeded"||Tn.authenticationState===void 0&&Tn.mcpStatus==="connected"){Ve=Lt;break}}if(!Ve)throw new Error(s("mcp.oauth.timeout"))}else{if(Ve=await r.reload(),!le.current)return;for(let ft=0;(Ve==null?void 0:Ve.discoveryState)!==void 0&&Ve.discoveryState!=="completed"&&!((Xe=Ve.errors)!=null&&Xe.length)&&ft<40;ft+=1){if(!await Me())return;const Lt=await r.reload();if(!le.current)return;Lt&&(Ve=Lt,a(Lt))}}if(Ve){a(Ve);const ft=($e=Ve.servers)==null?void 0:$e.find(Lt=>Lt.name===Ce.name);if(ft&&(Ve.discoveryState===void 0||Ve.discoveryState==="completed")){try{await it(ft)}catch{}if(!le.current)return}}ge({serverName:Ce.name,text:Fn?s("mcp.action.done",{action:yt.label}):yt.id==="authenticate"&&Ht?tj(Ce.name,s,Ht):Ht||s("mcp.action.done",{action:yt.label}),success:!0,...!Fn&&ke?{authUrl:ke}:{}})}catch(Ht){le.current&&ge({serverName:Ce.name,text:s("mcp.action.failed",{error:Wi(Ht)}),error:!0})}finally{le.current&&R(null)}}},[S,it,r,un,s,Me]),ht=Ce=>{p(Ce.name),x("overview"),b(null),y(null),ge(null),!Ce.approvalState&&it(Ce).catch(yt=>{ge({serverName:Ce.name,text:s("mcp.action.failed",{error:Wi(yt)}),error:!0})})},Oe=()=>{S===null&&(p(null),b(null),y(null),D(!0),r.reload().then(Ce=>{Ce&&a(Ce)}).catch(Ce=>{ge({text:Wi(Ce),error:!0})}).finally(()=>D(!1)))},Ne=()=>{b(null),y(null)},St=l.jsx(fp,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(mp,{className:"text-base",children:[l.jsx(Yi,{children:l.jsx(Jt,{variant:"ghost",size:"icon",disabled:S!==null,onClick:t,"aria-label":s("common.back"),children:l.jsx(ik,{})})}),l.jsx(Yi,{children:ze?l.jsx($d,{asChild:!0,children:l.jsx("button",{type:"button",disabled:S!==null,onClick:Oe,children:s("mcp.title")})}):l.jsx(ml,{children:s("mcp.title")})}),ze?l.jsx(Bd,{}):null,ze?l.jsx(Yi,{children:zt||ae?l.jsx($d,{asChild:!0,children:l.jsx("button",{type:"button",onClick:Ne,children:ze.name})}):l.jsx(ml,{children:ze.name})}):null,zt||ae?l.jsx(Bd,{}):null,zt?l.jsx(Yi,{children:l.jsx(ml,{children:zt.name})}):null,ae?l.jsx(Yi,{children:l.jsx(ml,{children:ae.title||ae.name||ae.uri})}):null]})}),Ue=zt?zt.name:ae?ae.title||ae.name||ae.uri:ze==null?void 0:ze.name,ve=n?ze?l.jsx(fp,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:l.jsxs(mp,{className:"h-8 text-sm",children:[l.jsx(Yi,{children:l.jsx($d,{asChild:!0,children:l.jsx("button",{type:"button",disabled:S!==null,onClick:Oe,children:s("mcp.title")})})}),l.jsx(Bd,{}),l.jsx(Yi,{children:zt||ae?l.jsx($d,{asChild:!0,children:l.jsx("button",{type:"button",onClick:Ne,children:ze.name})}):l.jsx(ml,{children:ze.name})}),zt||ae?l.jsx(Bd,{}):null,zt||ae?l.jsx(Yi,{children:l.jsx(ml,{children:Ue})}):null]})}):null:St,Fe=l.jsx(Qm,{open:ne!==null,onOpenChange:Ce=>!Ce&&U(null),children:l.jsxs(Jm,{showCloseButton:!1,children:[l.jsxs(Zm,{children:[l.jsx(tp,{children:s("mcp.remove.title")}),l.jsx(W0,{children:s(ne&&v4(ne)==="workspace"?"mcp.remove.description":"mcp.remove.description.global",{name:(ne==null?void 0:ne.name)??""})})]}),l.jsxs(ep,{children:[l.jsx(Jt,{variant:"outline",onClick:()=>U(null),disabled:S!==null,children:s("common.cancel")}),l.jsxs(Jt,{variant:"destructive",onClick:()=>void Ke(),disabled:S!==null,children:[S?l.jsx(fr,{"data-icon":"inline-start"}):l.jsx(mm,{"data-icon":"inline-start"}),s("mcp.action.remove")]})]})]})}),ie=l.jsx(Qm,{open:$,onOpenChange:Ce=>{q||(z(Ce),Ce||j(null))},children:l.jsxs(Jm,{className:"sm:max-w-lg",showCloseButton:!1,children:[l.jsxs(Zm,{children:[l.jsx(tp,{children:s(B?"mcp.edit.title":"mcp.add.title")}),l.jsx(W0,{children:s(B?"mcp.edit.description":"mcp.add.description")})]}),l.jsxs("div",{className:"grid gap-4",children:[de?l.jsxs(bo,{variant:"destructive",children:[l.jsx(ja,{}),l.jsx(yo,{children:de})]}):null,l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.name"),l.jsx(Pr,{value:H,onChange:Ce=>Q(Ce.target.value),placeholder:"my-mcp-server",disabled:q||B!==null})]}),l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.serverDescription"),l.jsx(Pr,{value:I,onChange:Ce=>J(Ce.target.value),placeholder:s("mcp.add.serverDescriptionPlaceholder"),disabled:q})]}),l.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.scope"),l.jsxs(xl,{value:W,onValueChange:Ce=>P(Ce),disabled:q||B!==null,children:[l.jsx(_l,{className:"w-full",children:l.jsx(kl,{})}),l.jsxs(Sl,{children:[l.jsx(Ti,{value:"workspace",children:s("settings.scope.workspace")}),l.jsx(Ti,{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(u0,{className:"min-h-44 font-mono text-xs",value:V,onChange:Ce=>ee(Ce.target.value),disabled:q})]})]}),l.jsxs(ep,{children:[l.jsx(Jt,{variant:"outline",onClick:()=>{z(!1),j(null)},disabled:q,children:s("common.cancel")}),l.jsxs(Jt,{onClick:()=>void wt(),disabled:q,children:[q?l.jsx(fr,{"data-icon":"inline-start"}):null,s(q?B?"mcp.edit.saving":"mcp.add.adding":B?"mcp.edit.save":"mcp.add.button")]})]})]})});if(zt&&ze)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(_A,{})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h1",{className:"break-words text-xl font-semibold",children:zt.name}),l.jsx("p",{className:"text-sm text-muted-foreground",children:zt.serverToolName||ze.name})]})]}),l.jsx(No,{children:l.jsx(Vl,{children:l.jsx(GSt,{tool:zt,t:s})})})]})]}),ie]});if(ae&&ze)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(kA,{})}),l.jsx("h1",{className:"min-w-0 break-words text-xl font-semibold",children:ae.title||ae.name||ae.uri})]}),l.jsx(No,{children:l.jsx(Vl,{children:l.jsx(KSt,{resource:ae,t:s})})})]})]}),ie]});if(ze){const Ce=rn,yt=Wt,Ft=ue[ze.name],De=USt(ze,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(Z1,{})}),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-xl font-semibold",children:ze.name}),l.jsx(Pi,{variant:"secondary",className:oG(ze),children:iG(ze,s)}),l.jsx(Pi,{variant:"outline",children:sG(ze,s)})]})}),l.jsxs(Hh,{children:[l.jsx(qh,{asChild:!0,children:l.jsx(Jt,{variant:"ghost",size:"icon",disabled:S!==null,"aria-label":s("mcp.actions"),"data-testid":"mcp-server-actions",children:S===ze.name?l.jsx(fr,{}):l.jsx(fm,{})})}),l.jsx(Uh,{align:"end",onCloseAutoFocus:Xe=>Xe.preventDefault(),children:l.jsx(Lm,{children:De.map(Xe=>l.jsx(ho,{"data-testid":`mcp-server-action-${Xe.id}`,variant:Xe.id==="remove"?"destructive":"default",disabled:S!==null,onSelect:()=>void me(ze,Xe),children:Xe.label},Xe.id))})})]})]}),(Z==null?void 0:Z.serverName)===ze.name?l.jsxs(Yl,{tone:ce,noticeKey:Z.text,closeLabel:s("common.close"),onDismiss:()=>ge(null),className:"whitespace-pre-wrap break-words",children:[l.jsx("p",{children:Z.text}),Z.authUrl&&WSt(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(_g,{value:w,onValueChange:x,children:[l.jsxs(Sg,{children:[l.jsx(ti,{value:"overview",children:s("mcp.basicInfo")}),l.jsxs(ti,{value:"tools",children:[s("mcp.tools")," ",Ce.length]}),l.jsxs(ti,{value:"resources",children:[s("mcp.resources")," ",ze.resourceCount??yt.length]})]}),l.jsx(Ri,{value:"overview",className:"pt-4",children:l.jsxs(No,{children:[l.jsxs(bl,{children:[l.jsx(yl,{className:"text-sm",children:s("mcp.descriptionTitle")}),l.jsx(mu,{children:((vt=ze.description)==null?void 0:vt.trim())||"-"})]}),l.jsxs(Vl,{className:"grid gap-6 sm:grid-cols-2",children:[l.jsx(wc,{label:s("mcp.source"),value:sG(ze,s)}),l.jsx(wc,{label:s("mcp.transport"),value:ze.transport}),l.jsx(wc,{label:s("mcp.command"),value:qSt(ze,s)}),l.jsx(wc,{label:s("mcp.workingDirectory"),value:((vn=ze.config)==null?void 0:vn.cwd)||o.workspaceCwd}),ze.error?l.jsx(wc,{label:s("mcp.invalidReasonLabel"),value:ze.error}):null,ze.hint?l.jsx(wc,{label:s("mcp.description"),value:ze.hint}):null]})]})}),l.jsx(Ri,{value:"tools",className:"pt-4",children:Ft!=null&&Ft.tools?l.jsxs(bo,{variant:"destructive",children:[l.jsx(ja,{}),l.jsx(xc,{children:s("mcp.loadingTools")}),l.jsx(yo,{children:Ft.tools})]}):Ce.length?l.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:Ce.map(Xe=>l.jsx(No,{size:"sm",role:"button",tabIndex:0,className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>b(Xe.name),onKeyDown:$e=>{($e.key==="Enter"||$e.key===" ")&&($e.preventDefault(),b(Xe.name))},children:l.jsxs(bl,{children:[l.jsx(yl,{className:"break-words",children:Xe.name}),l.jsx(mu,{className:"line-clamp-2 text-xs",children:Xe.description||s("mcp.noDescription")}),Xe.isValid?null:l.jsx(Hce,{children:l.jsx(Pi,{variant:"destructive",children:s("mcp.status.blocked")})})]})},Xe.name))}):l.jsx($u,{className:"rounded-xl border border-dashed",children:l.jsxs(Bu,{children:[l.jsx(zu,{variant:"icon",children:l.jsx(_A,{})}),l.jsx(Fu,{children:s("mcp.emptyTools")})]})})}),l.jsx(Ri,{value:"resources",className:"pt-4",children:Ft!=null&&Ft.resources?l.jsxs(bo,{variant:"destructive",children:[l.jsx(ja,{}),l.jsx(xc,{children:s("mcp.resourcesUnavailable")}),l.jsx(yo,{children:Ft.resources})]}):yt.length?l.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:yt.map(Xe=>l.jsx(No,{size:"sm",role:"button",tabIndex:0,className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>y(Xe.uri),onKeyDown:$e=>{($e.key==="Enter"||$e.key===" ")&&($e.preventDefault(),y(Xe.uri))},children:l.jsxs(bl,{children:[l.jsx(yl,{className:"break-words",children:Xe.title||Xe.name||Xe.uri}),l.jsx(mu,{className:"break-all",children:Xe.uri})]})},Xe.uri))}):l.jsx($u,{className:"rounded-xl border border-dashed",children:l.jsxs(Bu,{children:[l.jsx(zu,{variant:"icon",children:l.jsx(kA,{})}),l.jsx(Fu,{children:s("mcp.noResources")})]})})})]})]})]}),Fe,ie]})}const Pe=at.filter(Ce=>!Ce.disabled&&Ce.mcpStatus==="connecting").length,et=[{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-xl 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:at.length})})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(Jt,{variant:"outline",onClick:()=>void gt(),disabled:M,children:[M?l.jsx(fr,{"data-icon":"inline-start"}):l.jsx(ak,{"data-icon":"inline-start"}),s("common.refresh")]}),l.jsxs(Jt,{onClick:()=>{j(null),Q(""),J(""),P("workspace"),ee(k2),re(null),z(!0)},disabled:q,children:[l.jsx(z0,{"data-icon":"inline-start"}),s("mcp.add.button")]})]})]}),A&&Pe===0?l.jsx(Yl,{tone:"progress",noticeKey:"mcp-initializing",closeLabel:s("common.close"),onDismiss:()=>{},children:l.jsxs("span",{className:"grid gap-1",children:[l.jsx("span",{className:"font-medium",children:s("mcp.discovery.initializing")}),l.jsx("span",{children:s("mcp.startingNote")})]})}):Pe>0?l.jsx(Yl,{tone:"progress",noticeKey:`mcp-connecting-${Pe}`,closeLabel:s("common.close"),onDismiss:()=>{},children:l.jsxs("span",{className:"grid gap-1",children:[l.jsx("span",{className:"font-medium",children:s("mcp.starting",{count:Pe})}),l.jsx("span",{children:s("mcp.startingNote")})]})}):null,Z&&!Z.serverName?l.jsx(Yl,{tone:ce,noticeKey:Z.text,closeLabel:s("common.close"),onDismiss:()=>ge(null),children:Z.text}):null,(o.errors??[]).map((Ce,yt)=>l.jsxs(bo,{variant:"destructive",children:[l.jsx(ja,{}),l.jsx(xc,{children:Ce.kind}),l.jsx(yo,{children:Ce.error||Ce.hint||s("mcp.status.unknown")})]},`${Ce.kind}-${yt}`)),o.budgetMode&&o.budgetMode!=="off"?l.jsxs(bo,{children:[l.jsx(ja,{}),l.jsx(yo,{children:s("mcp.clientBudget",{count:o.clientCount??0,budget:o.clientBudget??"∞"})})]}):null,l.jsxs("div",{className:"relative",children:[l.jsx(Pc,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(Pr,{className:"pl-9",value:k,onChange:Ce=>C(Ce.target.value),placeholder:`${s("common.search")} MCP…`})]}),l.jsx(NP,{type:"single",value:T,onValueChange:Ce=>{Ce&&_(Ce)},variant:"outline",size:"sm","aria-label":s("mcp.source"),children:et.map(Ce=>l.jsx(MP,{value:Ce.value,children:Ce.label},Ce.value))}),je.length?l.jsx("div",{className:sde.serverGrid,"data-column-count":Math.min(je.length,4),children:je.map(Ce=>{var yt,Ft;return l.jsx(No,{size:"sm",role:"button",tabIndex:0,"aria-label":Ce.name,className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>ht(Ce),onKeyDown:De=>{(De.key==="Enter"||De.key===" ")&&(De.preventDefault(),ht(Ce))},children:l.jsx(bl,{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(Z1,{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(yl,{className:"min-w-0 flex-1 truncate",children:Ce.name}),l.jsx(Pi,{variant:"secondary",className:`${oG(Ce)} shrink-0 text-[10px]`,children:iG(Ce,s)})]}),l.jsx(mu,{className:"mt-1 min-w-0 text-xs",children:l.jsx(nh,{delayDuration:300,children:l.jsxs(sh,{children:[l.jsx(rh,{asChild:!0,children:l.jsx("span",{className:"block truncate",children:((yt=Ce.description)==null?void 0:yt.trim())||"-"})}),l.jsx(ih,{children:((Ft=Ce.description)==null?void 0:Ft.trim())||"-"})]})})})]})]})})},Ce.name)})}):l.jsx($u,{className:"border",children:l.jsxs(Bu,{children:[l.jsx(zu,{variant:"icon",children:k||T!=="all"?l.jsx(Pc,{}):l.jsx(Z1,{})}),l.jsx(Fu,{children:s(k||T!=="all"?"mcp.noMatches":"mcp.empty")}),!k&&T==="all"?l.jsx(ky,{children:s("mcp.emptyDescription")}):null]})})]}),ie]})}function YSt({mcpMessage:e,loadMcpMessage:t,onClose:n,onUseSkill:s,initialFocusRef:r}){const{t:i}=lt(),[o,a]=h.useState("extensions"),[c,u]=h.useState(!1),[d,f]=h.useState(0),[m,p]=h.useState(!1),[g,b]=h.useState(null),v=h.useCallback(()=>{p(!1),b(null),t().then(()=>p(!0)).catch(k=>{b(k instanceof Error?k.message:String(k))})},[t]),y=h.useCallback(()=>{u(!1),f(k=>k+1)},[]),w=h.useMemo(()=>({onRoot:y,onDetailChange:u}),[y]),x=k=>{const C=k;a(C),u(!1),f(T=>T+1),C==="mcp"&&v()};return l.jsxs(_g,{value:o,onValueChange:x,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(Sg,{className:"h-8","aria-label":i("plugins.sections"),children:[l.jsx(ti,{ref:r,value:"extensions",children:i("plugins.extensions")}),l.jsx(ti,{value:"mcp",children:i("plugins.mcp")}),l.jsx(ti,{value:"skills",children:i("plugins.skills")}),l.jsx(ti,{value:"agents",children:i("plugins.agents")})]})}),l.jsx(Ri,{value:o,className:"mt-0",children:o==="extensions"?l.jsx(nde,{onClose:n,embedded:w},`extensions-${d}`):o==="skills"?l.jsx(Gce,{onClose:n,onUseSkill:s,embedded:w},`skills-${d}`):o==="agents"?l.jsx(Uce,{onClose:n,embedded:w},`agents-${d}`):g?l.jsxs(bo,{variant:"destructive",className:"mt-4",children:[l.jsx(xc,{children:i("plugins.mcpLoadFailed")}),l.jsxs(yo,{className:"space-y-3",children:[l.jsx("p",{children:g}),l.jsx(Jt,{variant:"outline",size:"sm",onClick:v,children:i("common.retry")})]})]}):e&&m?l.jsx(rde,{message:e,onClose:n,embedded:w},`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(Pc,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(Pr,{"aria-label":i("common.search"),readOnly:!0,className:"pl-9",placeholder:`${i("common.search")} MCP…`})]}),l.jsx($u,{className:"border",children:l.jsxs(Bu,{children:[l.jsx(zu,{variant:"icon",children:l.jsx(Z1,{})}),l.jsx(Fu,{children:i("mcp.empty")}),l.jsx(ky,{children:i("mcp.emptyDescription")})]})})]})})]})}function W5({className:e,size:t="default",...n}){return l.jsx(ure,{"data-slot":"switch","data-size":t,className:en("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(hre,{"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 XSt="_platformHeader_1yzta_1",QSt="_platformMark_1yzta_7",JSt="_form_1yzta_21",ZSt="_body_1yzta_28",e2t="_section_1yzta_38",t2t="_sectionHeading_1yzta_44",n2t="_field_1yzta_62",s2t="_fieldHeader_1yzta_68",r2t="_required_1yzta_76",i2t="_hint_1yzta_80",o2t="_secretState_1yzta_85",a2t="_secretStatus_1yzta_97",l2t="_secretActions_1yzta_105",c2t="_policyGrid_1yzta_111",u2t="_policyCard_1yzta_117",d2t="_policyCopy_1yzta_137",h2t="_policyTitle_1yzta_143",f2t="_policyDescription_1yzta_148",Hi={platformHeader:XSt,platformMark:QSt,form:JSt,body:ZSt,section:e2t,sectionHeading:t2t,field:n2t,fieldHeader:s2t,required:r2t,hint:i2t,secretState:o2t,secretStatus:a2t,secretActions:l2t,policyGrid:c2t,policyCard:u2t,policyCopy:d2t,policyTitle:h2t,policyDescription:f2t},m2t="_panel_o7wfm_1",p2t="_header_o7wfm_11",g2t="_title_o7wfm_18",b2t="_description_o7wfm_23",y2t="_emptyDescription_o7wfm_24",w2t="_headerActions_o7wfm_31",v2t="_success_o7wfm_38",x2t="_empty_o7wfm_24",k2t="_emptyTitle_o7wfm_72",_2t="_list_o7wfm_77",S2t="_request_o7wfm_83",C2t="_requestIdentity_o7wfm_94",T2t="_senderName_o7wfm_100",E2t="_senderId_o7wfm_108",j2t="_requestTime_o7wfm_109",A2t="_code_o7wfm_117",Ha={panel:m2t,header:p2t,title:g2t,description:b2t,emptyDescription:y2t,headerActions:w2t,success:v2t,empty:x2t,emptyTitle:k2t,list:_2t,request:S2t,requestIdentity:C2t,senderName:T2t,senderId:E2t,requestTime:j2t,code:A2t};function aG(e){return e.senderName.trim()||e.senderId}function N2t({channelName:e,listRequests:t,approveRequest:n}){const{t:s}=lt(),r=h.useId(),i=h.useRef(!1),o=h.useRef(e);o.current=e;const[a,c]=h.useState([]),[u,d]=h.useState(!0),[f,m]=h.useState(0),[p,g]=h.useState(),[b,v]=h.useState(),[y,w]=h.useState();h.useEffect(()=>(i.current=!0,()=>{i.current=!1}),[]),h.useEffect(()=>{let k=!0;return d(!0),c([]),v(void 0),w(void 0),g(void 0),t(e).then(C=>{k&&(c(C.requests),d(!1))},C=>{k&&(v(Wi(C)),d(!1))}),()=>{k=!1}},[e,t,f]);const x=async k=>{if(p)return;const C=e;g(k.code),v(void 0),w(void 0);try{const T=await n(e,k.code);if(!i.current||o.current!==C)return;c(T.requests),w(s("channels.editor.pairing.approved",{sender:aG(T.approved)}))}catch(T){if(!i.current||o.current!==C)return;v(Wi(T))}finally{i.current&&o.current===C&&g(void 0)}};return l.jsxs("section",{className:Ha.panel,"aria-labelledby":r,children:[l.jsxs("div",{className:Ha.header,children:[l.jsxs("div",{children:[l.jsx("h4",{id:r,className:Ha.title,children:s("channels.editor.pairing.title")}),l.jsx("p",{className:Ha.description,children:s("channels.editor.pairing.description")})]}),l.jsxs("div",{className:Ha.headerActions,children:[l.jsx(Pi,{variant:"outline",children:a.length}),l.jsx(Jt,{type:"button",size:"icon-sm",variant:"ghost",disabled:u||!!p,"aria-label":s("channels.editor.pairing.refresh"),onClick:()=>{w(void 0),m(k=>k+1)},children:u?l.jsx(fr,{}):l.jsx(ak,{})})]})]}),b?l.jsxs(bo,{variant:"destructive",children:[l.jsx(ja,{}),l.jsx(xc,{children:s("channels.editor.pairing.error")}),l.jsx(yo,{children:b}),l.jsx(Jt,{className:"mt-2 w-fit",type:"button",size:"sm",variant:"outline",disabled:u,onClick:()=>m(k=>k+1),children:s("channels.editor.pairing.retry")})]}):null,y?l.jsxs("div",{role:"status",className:Ha.success,children:[l.jsx(dg,{}),y]}):null,!u&&!b&&a.length===0?l.jsxs("div",{className:Ha.empty,children:[l.jsx(Owe,{"aria-hidden":"true"}),l.jsxs("div",{children:[l.jsx("p",{className:Ha.emptyTitle,children:s("channels.editor.pairing.empty.title")}),l.jsx("p",{className:Ha.emptyDescription,children:s("channels.editor.pairing.empty.description")})]})]}):null,a.length>0?l.jsx("ul",{className:Ha.list,children:a.map(k=>{const C=aG(k);return l.jsxs("li",{className:Ha.request,children:[l.jsxs("div",{className:Ha.requestIdentity,children:[l.jsx("span",{className:Ha.senderName,children:C}),C!==k.senderId?l.jsx("span",{className:Ha.senderId,children:k.senderId}):null,l.jsx("span",{className:Ha.requestTime,children:Lx(new Date(k.createdAt).toISOString(),s)})]}),l.jsx("code",{className:Ha.code,children:k.code}),l.jsxs(Jt,{type:"button",size:"sm",disabled:!!p,onClick:()=>void x(k),children:[p===k.code?l.jsx(fr,{}):null,s("channels.editor.pairing.approve")]})]},k.code)})}):null]})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function M2t(e,t){const n=t==null?void 0:t.config[e.key];return e.kind==="boolean"?typeof n=="boolean"?n:!1:e.kind==="number"?typeof n=="number"?String(n):"":typeof n=="string"?n:""}function lG(e,t){var i;const n={},s={};for(const o of e.fields){if(o.kind==="secret"){s[o.key]=(i=t==null?void 0:t.secrets[o.key])!=null&&i.present?{operation:"preserve"}:{operation:"replace",value:""};continue}n[o.key]=M2t(o,t)}const r=t==null?void 0:t.config.senderPolicy;return{name:(t==null?void 0:t.name)??"",values:n,secrets:s,senderPolicy:r==="pairing"||r==="open"?r:t?"":"pairing"}}function I2t(e,t){var s;if(e.kind==="secret"){const r=t.secrets[e.key];return(r==null?void 0:r.operation)==="preserve"?!1:(r==null?void 0:r.operation)==="clear"?!0:!((s=r==null?void 0:r.value)!=null&&s.trim())}const n=t.values[e.key];return typeof n=="string"?n.trim().length===0:!1}function R2t(e,t,n){const s={},r=t.name.trim();r?r==="all"||["__proto__","constructor","prototype"].includes(r)?s.name="invalid":n.includes(r)&&(s.name="duplicate"):s.name="required";for(const i of e.fields)i.required&&I2t(i,t)?s[i.key]="required":i.kind==="number"&&typeof t.values[i.key]=="string"&&t.values[i.key]!==""&&!Number.isFinite(Number(t.values[i.key]))&&(s[i.key]="number");return t.senderPolicy||(s.senderPolicy="policy"),s}function D2t(e,t,n){if(t.kind==="boolean"){e[t.key]=n===!0;return}const s=typeof n=="string"?n.trim():"";if(!s){delete e[t.key];return}e[t.key]=t.kind==="number"?Number(s):s}function P2t(e,t,n,s){const r={...(s==null?void 0:s.config)??{},type:e.type},i={};for(const o of e.fields){if(o.kind==="secret"){const a=t.secrets[o.key]??{operation:"preserve"};i[o.key]=a.operation==="replace"?{operation:"replace",value:a.value??""}:{operation:a.operation};continue}D2t(r,o,t.values[o.key])}return r.senderPolicy=t.senderPolicy,{expectedRevision:n,config:r,secrets:i}}const L2t={dingtalk:"D",wecom:"W",feishu:"F"},O2t={dingtalk:{clientId:"channels.editor.field.dingtalk.clientId",clientSecret:"channels.editor.field.dingtalk.clientSecret"},wecom:{botId:"channels.editor.field.wecom.botId",secret:"channels.editor.field.wecom.secret",wsUrl:"channels.editor.field.wecom.wsUrl"},feishu:{clientId:"channels.editor.field.feishu.clientId",clientSecret:"channels.editor.field.feishu.clientSecret"}};function jw({id:e,label:t,required:n,hint:s,error:r,children:i}){return l.jsxs("div",{className:Hi.field,children:[l.jsxs("div",{className:Hi.fieldHeader,children:[l.jsxs(ux,{htmlFor:e,children:[t,n?l.jsx("span",{className:Hi.required,"aria-hidden":"true",children:"*"}):null]}),s?l.jsx("span",{className:Hi.hint,children:s}):null]}),i,r?l.jsx("p",{role:"alert",className:"text-xs text-destructive",children:r}):null]})}function $2t({open:e,descriptor:t,instance:n,expectedRevision:s,existingNames:r,onOpenChange:i,onSave:o,onReload:a,listPairingRequests:c,approvePairingRequest:u}){const{t:d}=lt(),f=h.useId(),[m,p]=h.useState(()=>lG(t,n)),[g,b]=h.useState({}),[v,y]=h.useState(),[w,x]=h.useState(!1),[k,C]=h.useState(!1);h.useEffect(()=>{e&&(p(lG(t,n)),b({}),y(void 0))},[t,n,e]);const T=M=>{var $;const D=($=O2t[t.type])==null?void 0:$[M.key];return D?d(D):M.label},_=(M,D)=>D==="duplicate"?d("channels.editor.validation.duplicate"):D==="invalid"?d("channels.editor.validation.invalidName"):D==="number"?d("channels.editor.validation.number"):D==="policy"?d("channels.editor.validation.policy"):d("channels.editor.validation.required",{label:M?T(M):d("channels.editor.instanceName")}),S=async M=>{M.preventDefault();const D=R2t(t,m,r);if(Object.keys(D).length>0){b(Object.fromEntries(Object.entries(D).map(([$,z])=>[$,_(t.fields.find(B=>B.key===$),z)])));return}x(!0),y(void 0);try{await o(m.name.trim(),P2t(t,m,s,n)),i(!1)}catch($){y(Wi($))}finally{x(!1)}},R=async()=>{C(!0);try{await a(),i(!1)}catch(M){y(Wi(M))}finally{C(!1)}},A=M=>{const D=`${f}-${M.key}`,$=n==null?void 0:n.secrets[M.key],z=m.secrets[M.key]??{operation:"replace",value:""},B=g[M.key],j=z.operation==="replace",H=M.required?["preserve","replace"]:["preserve","replace","clear"];return l.jsxs(jw,{id:D,label:T(M),required:M.required,hint:M.envResolvable?d("channels.editor.environmentReference"):void 0,error:B,children:[$!=null&&$.present?l.jsxs("div",{className:Hi.secretState,children:[l.jsxs("span",{className:Hi.secretStatus,children:[l.jsx(AI,{size:15}),$.source==="environment"?d("channels.editor.secret.environment"):d("channels.editor.secret.stored")]}),l.jsx("div",{className:Hi.secretActions,children:H.map(Q=>l.jsx(Jt,{type:"button",size:"xs",variant:z.operation===Q?"secondary":"ghost","aria-pressed":z.operation===Q,onClick:()=>p(I=>({...I,secrets:{...I.secrets,[M.key]:Q==="replace"?{operation:Q,value:""}:{operation:Q}}})),children:d(`channels.editor.secret.${Q}`)},Q))})]}):null,j?l.jsx(Pr,{id:D,type:"password",autoComplete:"new-password",value:z.value??"","aria-invalid":!!B,"aria-required":M.required,placeholder:d("channels.editor.secret.placeholder",{label:T(M)}),onChange:Q=>p(I=>({...I,secrets:{...I.secrets,[M.key]:{operation:"replace",value:Q.target.value}}}))}):null,z.operation==="clear"?l.jsx("p",{className:Hi.hint,children:d("channels.editor.secret.clearHint")}):null]},M.key)},O=M=>{var j;if(M.kind==="secret")return A(M);const D=`${f}-${M.key}`,$=m.values[M.key],z=g[M.key],B=H=>p(Q=>({...Q,values:{...Q.values,[M.key]:H}}));return M.kind==="boolean"?l.jsx(jw,{id:D,label:T(M),required:M.required,error:z,children:l.jsx(W5,{id:D,checked:$===!0,"aria-required":M.required,onCheckedChange:H=>B(H)})},M.key):M.kind==="enum"?l.jsx(jw,{id:D,label:T(M),required:M.required,error:z,children:l.jsxs(xl,{value:String($??""),onValueChange:B,children:[l.jsx(_l,{id:D,className:"w-full","aria-required":M.required,children:l.jsx(kl,{})}),l.jsx(Sl,{children:(j=M.options)==null?void 0:j.map(H=>l.jsx(Ti,{value:H.value,children:H.label},H.value))})]})},M.key):l.jsx(jw,{id:D,label:T(M),required:M.required,hint:M.envResolvable?d("channels.editor.environmentReference"):void 0,error:z,children:l.jsx(Pr,{id:D,type:M.kind==="number"?"number":"text",value:String($??""),"aria-invalid":!!z,"aria-required":M.required,onChange:H=>B(H.target.value)})},M.key)};return l.jsx(Qm,{open:e,onOpenChange:i,children:l.jsxs(Jm,{className:"max-w-[calc(100%-2rem)] p-5 sm:max-w-xl",children:[l.jsx(Zm,{children:l.jsxs("div",{className:Hi.platformHeader,children:[l.jsx("span",{className:Hi.platformMark,"aria-hidden":"true",children:L2t[t.type]??t.displayName[0]}),l.jsxs("div",{children:[l.jsx(tp,{children:d(n?"channels.editor.editTitle":"channels.editor.addTitle",{platform:t.displayName})}),l.jsx(W0,{className:"mt-1",children:d(n?"channels.editor.editDescription":"channels.editor.addDescription")})]})]})}),l.jsxs("form",{className:Hi.form,onSubmit:S,children:[l.jsxs("div",{className:Hi.body,children:[v?l.jsxs(bo,{variant:"destructive",children:[l.jsx(HB,{}),l.jsx(xc,{children:d("channels.editor.saveError")}),l.jsx(yo,{children:v}),l.jsxs(Jt,{className:"mt-2 w-fit",type:"button",size:"sm",variant:"outline",disabled:k,onClick:()=>void R(),children:[k?l.jsx(fr,{}):null,d("channels.editor.reloadLatest")]})]}):null,l.jsxs("section",{className:Hi.section,children:[l.jsx("h3",{className:Hi.sectionHeading,children:d("channels.editor.section.identity")}),l.jsx(jw,{id:`${f}-name`,label:d("channels.editor.instanceName"),required:!0,error:g.name,children:l.jsx(Pr,{id:`${f}-name`,value:m.name,disabled:!!n,"aria-invalid":!!g.name,"aria-required":!0,placeholder:d("channels.editor.instanceNamePlaceholder"),onChange:M=>p(D=>({...D,name:M.target.value}))})})]}),l.jsxs("section",{className:Hi.section,children:[l.jsx("h3",{className:Hi.sectionHeading,children:d("channels.editor.section.credentials")}),t.fields.map(O)]}),l.jsxs("section",{className:Hi.section,children:[l.jsx("h3",{className:Hi.sectionHeading,children:d("channels.editor.section.access")}),l.jsx(ede,{className:Hi.policyGrid,value:m.senderPolicy,"aria-invalid":!!g.senderPolicy,onValueChange:M=>p(D=>({...D,senderPolicy:M==="pairing"||M==="open"?M:""})),children:["pairing","open"].map(M=>l.jsxs(ux,{className:Hi.policyCard,"data-selected":m.senderPolicy===M,children:[l.jsx(tde,{value:M}),l.jsxs("span",{className:Hi.policyCopy,children:[l.jsx("span",{className:Hi.policyTitle,children:d(`channels.editor.policy.${M}.title`)}),l.jsx("span",{className:Hi.policyDescription,children:d(`channels.editor.policy.${M}.description`)})]})]},M))}),g.senderPolicy?l.jsx("p",{role:"alert",className:"text-xs text-destructive",children:g.senderPolicy}):null,m.senderPolicy==="pairing"?(n==null?void 0:n.config.senderPolicy)==="pairing"?l.jsx(N2t,{channelName:n.name,listRequests:c,approveRequest:u}):l.jsxs(bo,{children:[l.jsx(HB,{}),l.jsx(xc,{children:d("channels.editor.pairing.saveFirst.title")}),l.jsx(yo,{children:d("channels.editor.pairing.saveFirst.description")})]}):null]})]}),l.jsxs(ep,{className:"mt-4",children:[l.jsx(Jt,{type:"button",variant:"outline",onClick:()=>i(!1),children:d("channels.editor.cancel")}),l.jsxs(Jt,{type:"submit",disabled:w||k,children:[w?l.jsx(fr,{}):null,d("channels.editor.save")]})]})]})]})})}const B2t="_page_1flo8_1",z2t="_pageHeader_1flo8_9",F2t="_titleGroup_1flo8_18",H2t="_titleCopy_1flo8_25",q2t="_title_1flo8_18",U2t="_summary_1flo8_37",W2t="_section_1flo8_46",V2t="_sectionHeader_1flo8_53",G2t="_sectionTitle_1flo8_60",K2t="_channelGrid_1flo8_65",Y2t="_channelCard_1flo8_71",X2t="_channelActions_1flo8_98",Q2t="_lifecycleActions_1flo8_106",J2t="_startupControl_1flo8_112",Z2t="_errorAlert_1flo8_120",e4t="_platformGrid_1flo8_128",t4t="_platformCard_1flo8_134",n4t="_platformMark_1flo8_167",s4t="_platformCopy_1flo8_182",r4t="_platformName_1flo8_186",i4t="_platformHint_1flo8_194",Fi={page:B2t,pageHeader:z2t,titleGroup:F2t,titleCopy:H2t,title:q2t,summary:U2t,section:W2t,sectionHeader:V2t,sectionTitle:G2t,channelGrid:K2t,channelCard:Y2t,channelActions:X2t,lifecycleActions:Q2t,startupControl:J2t,errorAlert:Z2t,platformGrid:e4t,platformCard:t4t,platformMark:n4t,platformCopy:s4t,platformName:r4t,platformHint:i4t};/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const o4t=new Set(["dingtalk","wecom","feishu"]);function ide(e){return typeof e=="string"&&o4t.has(e)}function a4t(e){return e.manageable&&ide(e.type)}const l4t={stopped:"channels.status.stopped",starting:"channels.status.starting",connected:"channels.status.connected",partial:"channels.status.partial",error:"channels.status.error"},c4t={dingtalk:"D",wecom:"W",feishu:"F"};function u4t(e){return e==="error"?"destructive":e==="connected"?"secondary":"outline"}function d4t({onClose:e,initialFocusRef:t}){var V,ee;const{t:n}=lt(),s=io(),r=((V=s.capabilities)==null?void 0:V.features.includes("channel_management"))===!0,{catalog:i,snapshot:o,channels:a,loading:c,error:u,reload:d,createOrUpdate:f,remove:m,setStartup:p,start:g,stop:b,restart:v,pairing:y}=abe({autoLoad:r,enabled:r}),w=r&&!!s.token,[x,k]=h.useState(null),[C,T]=h.useState({}),[_,S]=h.useState(),[R,A]=h.useState(),[O,M]=h.useState(),[D,$]=h.useState(!1);h.useEffect(()=>{k(null),T({}),S(void 0),A(void 0),M(void 0),$(!1)},[s.workspaceCwd]);const z=h.useMemo(()=>i.filter(a4t),[i]),B=h.useMemo(()=>Object.values(a).filter(q=>ide(q.config.type)).sort((q,K)=>q.name.localeCompare(K.name)),[a]),j=((ee=s.workspaceCwd)==null?void 0:ee.split(/[\\/]+/).filter(Boolean).at(-1))??n("channels.workspace.current"),H=h.useCallback(q=>{var de;const K=String(q.config.type);return((de=i.find(re=>re.type===K))==null?void 0:de.displayName)??K},[i]),Q=h.useCallback(q=>z.find(K=>K.type===q.config.type),[z]),I=h.useCallback((q,K)=>f(q,K),[f]),J=h.useCallback(async()=>{if(!(!R||R.workspaceCwd!==s.workspaceCwd||!o||D)){$(!0),M(void 0);try{await m(R.instance.name,{expectedRevision:o.revision}),A(void 0)}catch(q){M(Wi(q))}finally{$(!1)}}},[R,D,m,o,s.workspaceCwd]),W=h.useCallback(async(q,K,de)=>{if(!(!w||x)){k({name:q.name,action:K}),T(re=>{const ne={...re};return delete ne[q.name],ne});try{await de()}catch(re){T(ne=>({...ne,[q.name]:Wi(re)}))}finally{k(null)}}},[x,w]),P=q=>{const K=!w||x!==null;return q.runtime.state==="stopped"?l.jsxs(Jt,{size:"sm",disabled:K,onClick:()=>void W(q,"start",()=>g(q.name)),children:[(x==null?void 0:x.name)===q.name&&x.action==="start"?l.jsx(fr,{}):null,n("channels.action.start")]}):q.runtime.state==="error"?l.jsxs(Jt,{size:"sm",disabled:K,onClick:()=>void W(q,"restart",()=>v(q.name)),children:[(x==null?void 0:x.name)===q.name&&x.action==="restart"?l.jsx(fr,{}):null,n("channels.action.retry")]}):l.jsxs(Jt,{size:"sm",variant:"outline",disabled:K,onClick:()=>void W(q,"stop",()=>b(q.name)),children:[(x==null?void 0:x.name)===q.name&&x.action==="stop"?l.jsx(fr,{}):null,n("channels.action.stop")]})};return l.jsxs("div",{className:Fi.page,children:[l.jsx("header",{className:Fi.pageHeader,children:l.jsxs("div",{className:Fi.titleGroup,children:[l.jsx(Jt,{variant:"ghost",size:"icon",onClick:e,"aria-label":n("channels.action.back"),children:l.jsx(ik,{})}),l.jsxs("div",{className:Fi.titleCopy,children:[l.jsx("h1",{ref:t,tabIndex:-1,className:Fi.title,children:n("channels.title")}),l.jsx("p",{className:Fi.summary,children:n("channels.summary",{workspace:j,count:B.length})})]})]})}),r?null:l.jsxs(bo,{children:[l.jsx(ja,{}),l.jsx(xc,{children:n("channels.unsupported.title")}),l.jsx(yo,{children:n("channels.unsupported.description")})]}),r&&!s.token?l.jsxs(bo,{children:[l.jsx(ja,{}),l.jsx(xc,{children:n("channels.readOnly.title")}),l.jsx(yo,{children:n("channels.readOnly.description")})]}):null,c&&B.length===0?l.jsxs("div",{className:"flex min-h-32 items-center justify-center gap-2 text-sm text-muted-foreground",children:[l.jsx(fr,{}),n("channels.loading")]}):null,u?l.jsxs(bo,{variant:"destructive",children:[l.jsx(ja,{}),l.jsx(xc,{children:n("channels.loadError.title")}),l.jsx(yo,{children:Wi(u)}),l.jsx(Jt,{className:"mt-2 w-fit",size:"sm",variant:"outline",onClick:()=>void d(),children:n("channels.action.retry")})]}):null,l.jsxs("section",{className:Fi.section,"aria-labelledby":"configured-channels",children:[l.jsxs("div",{className:Fi.sectionHeader,children:[l.jsx("h2",{id:"configured-channels",className:Fi.sectionTitle,children:n("channels.configured")}),l.jsx(Pi,{variant:"outline",children:B.length})]}),!c&&!u&&B.length===0?l.jsx($u,{className:"border",children:l.jsxs(Bu,{children:[l.jsx(zu,{variant:"icon",children:l.jsx(FQ,{})}),l.jsx(Fu,{children:n("channels.empty.title")}),l.jsx(ky,{children:n("channels.empty.description")})]})}):null,B.length>0?l.jsx("div",{className:Fi.channelGrid,children:B.map(q=>{const K=Q(q),de=C[q.name]??q.runtime.lastError;return l.jsxs(No,{size:"sm",className:Fi.channelCard,"data-runtime-state":q.runtime.state,children:[l.jsxs(bl,{children:[l.jsxs("div",{className:"min-w-0",children:[l.jsxs(yl,{className:"flex min-w-0 flex-wrap items-center gap-2",children:[l.jsx("span",{className:"truncate",children:q.name}),l.jsx(Pi,{variant:u4t(q.runtime.state),children:n(l4t[q.runtime.state])})]}),l.jsx(mu,{children:H(q)})]}),l.jsx(Hce,{children:P(q)})]}),de?l.jsx(Vl,{children:l.jsxs(bo,{variant:"destructive",className:Fi.errorAlert,children:[l.jsx(ja,{}),l.jsx(xc,{children:n("channels.runtimeError")}),l.jsx(yo,{children:de})]})}):null,l.jsxs(Kct,{className:Fi.channelActions,children:[l.jsxs("label",{className:Fi.startupControl,children:[l.jsx(W5,{size:"sm",checked:q.startsWithServe,disabled:!w||x!==null||!o,"aria-label":n("channels.action.startWithServeNamed",{name:q.name}),onCheckedChange:re=>void W(q,"startup",()=>p(q.name,{expectedRevision:(o==null?void 0:o.revision)??"",enabled:re}))}),n("channels.startsWithServe")]}),l.jsxs("div",{className:Fi.lifecycleActions,children:[q.runtime.state!=="stopped"&&q.runtime.state!=="error"?l.jsxs(Jt,{size:"sm",variant:"ghost",disabled:!w||x!==null,onClick:()=>void W(q,"restart",()=>v(q.name)),children:[(x==null?void 0:x.name)===q.name&&x.action==="restart"?l.jsx(fr,{}):l.jsx(hwe,{}),n("channels.action.restart")]}):null,K?l.jsxs(Jt,{size:"sm",variant:"ghost",disabled:!w||x!==null||!o,"aria-label":n("channels.action.editNamed",{name:q.name}),onClick:()=>S({workspaceCwd:s.workspaceCwd,descriptor:K,instance:q}),children:[l.jsx(Sb,{}),n("channels.action.edit")]}):null,l.jsxs(Jt,{size:"sm",variant:"ghost",className:"text-destructive hover:text-destructive",disabled:!w||x!==null||!o,"aria-label":n("channels.action.deleteNamed",{name:q.name}),onClick:()=>{M(void 0),A({workspaceCwd:s.workspaceCwd,instance:q})},children:[l.jsx(mm,{}),n("channels.action.delete")]})]})]})]},q.name)})}):null]}),z.length>0?l.jsxs("section",{className:Fi.section,"aria-labelledby":"channel-platforms",children:[l.jsxs("div",{children:[l.jsx("h2",{id:"channel-platforms",className:Fi.sectionTitle,children:n("channels.availablePlatforms")}),l.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:n("channels.availablePlatforms.description")})]}),l.jsx("div",{className:Fi.platformGrid,children:z.map(q=>l.jsxs("button",{type:"button",className:Fi.platformCard,"data-testid":`channel-platform-${q.type}`,disabled:!w||!o,"aria-label":n("channels.platform.configureNamed",{platform:q.displayName}),onClick:()=>S({workspaceCwd:s.workspaceCwd,descriptor:q}),children:[l.jsx("span",{className:Fi.platformMark,"aria-hidden":"true",children:c4t[q.type]}),l.jsxs("div",{className:Fi.platformCopy,children:[l.jsx("p",{className:Fi.platformName,children:q.displayName}),l.jsx("p",{className:Fi.platformHint,children:n("channels.platform.configure")})]})]},q.type))})]}):null,_&&_.workspaceCwd===s.workspaceCwd&&o?l.jsx($2t,{open:!0,descriptor:_.descriptor,instance:_.instance,expectedRevision:o.revision,existingNames:B.filter(q=>{var K;return q.name!==((K=_.instance)==null?void 0:K.name)}).map(q=>q.name),onOpenChange:q=>{q||S(void 0)},onSave:I,onReload:d,listPairingRequests:y.list,approvePairingRequest:y.approve}):null,l.jsx(Ox,{open:!!(R&&R.workspaceCwd===s.workspaceCwd),onOpenChange:q=>{!q&&!D&&(A(void 0),M(void 0))},children:l.jsxs($x,{children:[l.jsxs(Bx,{children:[l.jsx(Fx,{children:n("channels.delete.title",{name:(R==null?void 0:R.instance.name)??""})}),l.jsx(Hx,{children:n("channels.delete.description")})]}),O?l.jsxs(bo,{variant:"destructive",children:[l.jsx(ja,{}),l.jsx(xc,{children:n("channels.delete.error")}),l.jsx(yo,{children:O}),l.jsx(Jt,{className:"mt-2 w-fit",size:"sm",variant:"outline",onClick:()=>{d().then(()=>{A(void 0),M(void 0)},q=>{M(Wi(q))})},children:n("channels.editor.reloadLatest")})]}):null,l.jsxs(zx,{children:[l.jsx(qx,{disabled:D,children:n("channels.editor.cancel")}),l.jsxs(Jt,{variant:"destructive",disabled:D,onClick:()=>void J(),children:[D?l.jsx(fr,{}):null,n("channels.action.delete")]})]})]})})]})}const h4t=new Set(["plugins","extensions","mcp","skills","agents","channels"]);function f4t(e){return e!==null&&h4t.has(e)}function m4t(e){return typeof e=="boolean"?{plugins:e,portals:e}:{plugins:(e==null?void 0:e.plugins)??!1,portals:(e==null?void 0:e.portals)??!1,styles:e==null?void 0:e.styles}}const cG=new WeakMap;function p4t(e){const t=e.querySelector('style[data-qwen-web-shell="component"]');return t!=null&&t.textContent?t.textContent:Array.from(e.querySelectorAll("style[data-vite-dev-id]")).filter(n=>{const s=n.dataset.viteDevId??"";return s.includes("/packages/web-shell/")||s.includes("/web-shell/client/")}).map(n=>n.textContent??"").filter(Boolean).join(`
`)}function ode(e,t){var r;const n=(r=e.defaultView)==null?void 0:r.CSSStyleSheet;if(!n||typeof n.prototype.replaceSync!="function")return null;const s=new n;return s.replaceSync(t),s}function g4t(e,t){const n=cG.get(e);if((n==null?void 0:n.css)===t)return n.sheet;const s=ode(e,t);return s&&cG.set(e,{css:t,sheet:s}),s}function ade(e,t){const n=p4t(e.ownerDocument),s=[n,t].filter(i=>!!i);try{const i=n?g4t(e.ownerDocument,n):null,o=t?ode(e.ownerDocument,t):null,a=[i,o].filter(c=>!!c);if(a.length===s.length&&a.length>0)return e.adoptedStyleSheets=[...e.adoptedStyleSheets,...a],()=>{e.adoptedStyleSheets=e.adoptedStyleSheets.filter(c=>!a.includes(c))}}catch{}const r=s.map(i=>{const o=e.ownerDocument.createElement("style");return o.dataset.qwenWebShellShadow="",o.textContent=i,e.appendChild(o),o});return()=>{for(const i of r)i.remove()}}function b4t({children:e,enabled:t,language:n,themeClassName:s,styles:r,initialFocusRef:i}){const o=h.useRef(null),[a,c]=h.useState(null);return h.useLayoutEffect(()=>{if(!t||!o.current)return;o.current.style.setProperty("all","initial","important"),o.current.style.setProperty("display","block","important"),o.current.style.setProperty("min-width","0","important"),o.current.style.setProperty("width","100%","important");const u=o.current.shadowRoot??o.current.attachShadow({mode:"open"}),d=u.ownerDocument.createElement("div");d.dataset.webShellRoot="",d.dataset.webShellShadcn="",d.dataset.webShellShadowRoot="plugins";const f=ade(u,r);return u.appendChild(d),c(d),()=>{d.remove(),f(),c(null)}},[t,r]),h.useLayoutEffect(()=>{a&&(a.className=s,a.lang=n)},[n,a,s]),h.useLayoutEffect(()=>{var u;a&&((u=i==null?void 0:i.current)==null||u.focus())},[i,a]),t?l.jsx("div",{ref:o,"data-web-shell-shadow-host":"plugins",children:a?Wu.createPortal(e,a):null}):e}const y4t="_section_1ghly_1",w4t="_header_1ghly_12",v4t="_title_1ghly_19",x4t="_addButton_1ghly_24",k4t="_hint_1ghly_38",_4t="_empty_1ghly_39",S4t="_provider_1ghly_45",C4t="_providerName_1ghly_51",T4t="_modelRow_1ghly_59",E4t="_modelInfo_1ghly_70",j4t="_modelName_1ghly_78",A4t="_modelBaseUrl_1ghly_84",N4t="_currentBadge_1ghly_91",M4t="_runtimeBadge_1ghly_99",I4t="_modelActions_1ghly_107",R4t="_actionButton_1ghly_114",D4t="_deleteButton_1ghly_115",P4t="_confirmButton_1ghly_116",_o={section:y4t,header:w4t,title:v4t,addButton:x4t,hint:k4t,empty:_4t,provider:S4t,providerName:C4t,modelRow:T4t,modelInfo:E4t,modelName:j4t,modelBaseUrl:A4t,currentBadge:N4t,runtimeBadge:M4t,modelActions:I4t,actionButton:R4t,deleteButton:D4t,confirmButton:P4t};function x4(e,t){return`${e.authType}:${t.modelId}:${t.baseUrl??""}`}function L4t(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 x4(r.provider,r.model);const i=n.filter(({model:o})=>o.baseModelId===t);if(i.length===1)return x4(i[0].provider,i[0].model)}const s=n.find(({model:r})=>r.isCurrent);return s?x4(s.provider,s.model):void 0}function O4t({providers:e,currentModelId:t,loading:n,error:s,busy:r,onSelectModel:i,onDeleteModel:o,onAddModel:a}){const{t:c}=lt(),[u,d]=h.useState(null);h.useEffect(()=>{if(u===null)return;const p=g=>{g.key==="Escape"&&d(null)};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[u]);const f=e.some(p=>p.models.length>0),m=L4t(e,t);return l.jsxs("div",{className:_o.section,"data-testid":"model-management",children:[l.jsxs("div",{className:_o.header,children:[l.jsx("span",{className:_o.title,children:c("settings.models.title")}),l.jsx("button",{type:"button",className:_o.addButton,disabled:r,onClick:a,children:c("settings.models.add")})]}),s&&l.jsx("div",{className:_o.hint,children:s.message}),n&&!f&&l.jsx("div",{className:_o.hint,children:c("settings.models.loading")}),!n&&!f&&!s&&l.jsx("div",{className:_o.empty,children:c("settings.models.empty")}),e.map((p,g)=>p.models.length===0?null:l.jsxs("div",{className:_o.provider,children:[l.jsx("div",{className:_o.providerName,children:p.authType}),p.models.map(b=>{const v=x4(p,b),y=v===m,w=u===v,x=b.name||b.baseModelId;return l.jsxs("div",{className:_o.modelRow,children:[l.jsxs("div",{className:_o.modelInfo,children:[l.jsx("span",{className:_o.modelName,children:b.name||b.baseModelId}),y&&l.jsx("span",{className:_o.currentBadge,children:c("settings.models.current")}),b.isRuntime&&l.jsx("span",{className:_o.runtimeBadge,children:c("settings.models.runtime")}),b.baseUrl&&l.jsx("span",{className:_o.modelBaseUrl,children:b.baseUrl})]}),l.jsxs("div",{className:_o.modelActions,children:[!y&&l.jsx("button",{type:"button",className:_o.actionButton,disabled:r,"aria-label":`${c("settings.models.setCurrent")} ${x}`,onClick:()=>i(b.modelId),children:c("settings.models.setCurrent")}),!b.isRuntime&&(w?l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:_o.confirmButton,disabled:r,"aria-label":`${c("settings.models.confirmDelete")} ${x}`,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:_o.actionButton,disabled:r,"aria-label":`${c("settings.models.cancel")} ${x}`,onClick:()=>d(null),children:c("settings.models.cancel")})]}):l.jsx("button",{type:"button",className:_o.deleteButton,disabled:r,"aria-label":`${c("settings.models.delete")} ${x}`,onClick:()=>d(v),children:c("settings.models.delete")}))]})]},v)})]},`${p.authType}:${g}`))]})}const $4t=new Set(["fastModel","visionModel","voiceModel","modelFallbacks"]),B4t=new Set(["ui.hideTips","ui.enableUserFeedback","ui.compactMode","ui.compactInline","mcpServers"]);function V5(e,t,n){const s=e(t);return s===t?n:s}function uG(e,t){return V5(t,`settings.category.${e}`,e)}function o1(e,t){return V5(t,`settings.label.${e.key}`,e.label)}function z4t(e,t){if(e.description)return V5(t,`settings.description.${e.key}`,e.description)}function lde(e,t,n,s){return V5(s,`settings.option.${e.key}.${String(t)}`,n)}function F4t(e,t,n){const s=ude(e,t);if(s==null)return"";if(e.key===y0){const i=$I(s,ei.Dark);return n(`theme.${i}`)}if(e.key===hC){const i=II(s);return i?RI(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?lde(e,i.value,i.label,n):String(s)}const r=String(s);return r.length>24?`${r.slice(0,21)}…`:r}function cde(e,t){return(t==="user"?e.values.user:e.values.workspace)!==void 0}function H4t(e,t){if(t==="workspace"?e.values.user!==void 0:e.values.workspace!==void 0)return cde(e,t)?"settings.alsoModifiedIn":"settings.modifiedIn"}function ude(e,t){const n=t==="user"?e.values.user:e.values.workspace;return n!==void 0?n:e.values.effective}function q4t(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 dG({category:e}){const t=e.toLowerCase(),n=t.includes("ui")?Zye:t.includes("tool")?_A:t.includes("context")?kA:t.includes("privacy")?wwe:t.includes("model")?gv:t.includes("daemon")?Z1:t.includes("advanced")?xwe:t.includes("experimental")?xye:HQ;return l.jsx(n,{"data-icon":"inline-start","aria-hidden":"true"})}function hG({title:e,description:t,metadata:n,control:s}){return l.jsxs(to,{orientation:"responsive",className:"min-h-20 gap-6 px-5 py-4 max-md:px-4",children:[l.jsxs(Fce,{className:"min-w-0",children:[l.jsxs(Ict,{children:[e,n]}),t&&l.jsx(Du,{className:"max-w-3xl",children:t})]}),l.jsx("div",{className:"flex min-w-0 justify-end max-md:justify-start",children:s})]})}function U4t({name:e,label:t,type:n,value:s,disabled:r,onCommit:i,onInvalid:o}){const a=String(s??""),[c,u]=h.useState(a);h.useEffect(()=>u(a),[a]);const d=()=>{if(n==="number"){const f=c.trim(),m=Number(f);if(!f||!Number.isFinite(m)){u(a),o();return}m!==s&&i(m);return}c!==a&&i(c)};return l.jsx(Pr,{type:n,name:e,autoComplete:"off","aria-label":t,value:c,disabled:r,className:"w-[min(80px,50vw)] max-md:w-full",onChange:f=>u(f.target.value),onBlur:d,onKeyDown:f=>{f.key==="Enter"&&f.currentTarget.blur(),f.key==="Escape"&&(u(a),f.currentTarget.blur())}})}function W4t({settingsState:e,onLanguageChange:t,onSubDialog:n,onThemeChange:s,chatWidthMode:r,onChatWidthModeChange:i,modelManagement:o,embedded:a=!1}){const{language:c,t:u}=lt(),d=ny(),{status:f,settings:m,loading:p,error:g,reload:b,setValue:v}=e,[y,w]=h.useState("workspace"),[x,k]=h.useState(""),[C,T]=h.useState(null),[_,S]=h.useState(null),[R,A]=h.useState(!1),O=p&&!f,M=h.useMemo(()=>{const H=m.filter(W=>!B4t.has(W.key)),Q=q4t(H).map(W=>({id:W.category,label:uG(W.category,u),items:W.items.map(P=>({type:"setting",setting:P}))})),I={type:"local",localKey:"chatWidth"},J=Q.find(W=>W.items.some(P=>P.type==="setting"&&P.setting.key===y0));if(J){const W=J.items.findIndex(P=>P.type==="setting"&&P.setting.key===y0);J.items.splice(W+1,0,I)}else Q.push({id:"UI",label:uG("UI",u),items:[I]});return Q},[m,u]);h.useEffect(()=>{M.length!==0&&(M.some(H=>H.id===x)||k(M[0].id))},[x,M]),h.useEffect(()=>{var H;g?S(g.message):(H=f==null?void 0:f.warnings)!=null&&H.length?S(f.warnings.map(Q=>u("settings.corrupted",{recovered:Q.recovered?"true":"false"})).join("; ")):m.length>0&&S(null)},[g,m,f,u]);const D=h.useCallback((H,Q)=>{R||S(null),T(H),v(y,H,Q).then(async I=>{try{await b()}catch{}I!=null&&I.requiresRestart&&H!==hC&&A(!0)}).catch(I=>{S(I instanceof Error?I.message:String(I))}).finally(()=>T(null))},[b,R,y,v]),$=M.find(H=>H.id===x)??M[0],z=$==null?void 0:$.items.some(H=>H.type==="setting"&&H.setting.category==="Model"),B=(H,Q,I,J,W=!1)=>l.jsxs(xl,{value:H,disabled:W,onValueChange:Q,children:[l.jsx(_l,{size:"sm","aria-label":J,className:"w-[min(160px,50vw)] bg-background max-md:w-full",children:l.jsx(kl,{})}),l.jsx(Sl,{position:"popper",align:"end",children:l.jsx(aie,{children:I.map(P=>l.jsx(Ti,{value:P.value,children:P.label},P.value))})})]}),j=H=>{var W;const Q=ude(H,y),J=C===H.key;if(H.key===y0)return B($I(Q)??d,P=>{const V=P;s(V),D(y0,eJ(V))},JQ.map(P=>({value:P,label:u(`theme.${P}`)})),o1(H,u),J);if(H.key===hC)return B(II(Q)??c,P=>t(P,y),cve.map(P=>({value:P,label:RI(P)})),o1(H,u),J);if($4t.has(H.key))return l.jsx(Jt,{type:"button",variant:"outline",size:"sm",disabled:J,className:"max-w-[260px] truncate",onClick:()=>n(H.key,y),children:F4t(H,y,u)||u("settings.action.select")});if(H.type==="boolean"){const P=Q===!0;return l.jsx(W5,{checked:P,disabled:J,onCheckedChange:V=>D(H.key,V),"aria-label":o1(H,u)})}if(H.type==="enum"&&((W=H.options)!=null&&W.length)){const P=H.options.findIndex(V=>V.value===Q);return B(P>=0?String(P):"",V=>{var q;const ee=(q=H.options)==null?void 0:q[Number(V)];ee&&D(H.key,ee.value)},H.options.map((V,ee)=>({value:String(ee),label:lde(H,V.value,V.label,u)})),o1(H,u),J)}return l.jsx(U4t,{name:H.key,label:o1(H,u),type:H.type==="number"?"number":"text",value:Q,disabled:J,onCommit:P=>D(H.key,P),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")})]})}),(_||O)&&l.jsxs(bo,{className:"mx-4 mt-3 w-auto",children:[O&&l.jsx(fr,{}),l.jsx(yo,{children:_||u("settings.loading")})]}),l.jsxs(_g,{value:y,className:"flex min-h-0 flex-1 flex-col gap-0",onValueChange:H=>{w(H)},children:[l.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-border px-3 py-2",children:[l.jsxs(Sg,{className:"p-0",children:[l.jsx(ti,{value:"workspace",children:u("settings.scope.workspace")}),l.jsx(ti,{value:"user",children:u("settings.scope.user")})]}),R&&l.jsx(Pi,{variant:"secondary",children:u("settings.requiresRestart")})]}),l.jsxs(Ri,{value:y,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(H=>l.jsxs(Jt,{type:"button",variant:H.id===x?"secondary":"ghost",size:"sm","aria-current":H.id===x?"page":void 0,className:"w-full justify-start gap-2 px-2.5 max-md:w-auto max-md:shrink-0",onClick:()=>k(H.id),children:[l.jsx(dG,{category:H.id}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:H.label}),l.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:H.items.length})]},H.id))}),l.jsxs("section",{className:"min-h-0 min-w-0 overflow-y-auto bg-background p-5 max-md:p-3",children:[!p&&!$&&l.jsx($u,{className:"min-h-60",children:l.jsxs(Bu,{children:[l.jsx(zu,{variant:"icon",children:l.jsx(HQ,{})}),l.jsx(Fu,{children:u("settings.empty")}),l.jsx(ky,{children:u("settings.empty")})]})}),$&&l.jsxs("div",{className:"mx-auto w-full max-w-5xl",children:[l.jsxs(No,{children:[l.jsx(bl,{children:l.jsxs(yl,{className:"flex items-center gap-2",children:[l.jsx(dG,{category:$.id}),$.label]})}),l.jsx(Vl,{className:"-mb-(--card-spacing) p-0",children:l.jsx(hb,{className:"gap-0",children:$.items.map((H,Q)=>{const I=Q>0&&l.jsx(jP,{className:"mx-5 w-auto max-md:mx-4"});if(H.type==="local")return l.jsxs("div",{children:[I,l.jsx(hG,{title:u("settings.label.ui.chatWidth"),description:u("settings.description.ui.chatWidth"),control:B(r,q=>i(q),[{value:"1000",label:u("settings.option.ui.chatWidth.1000")},{value:"wide",label:u("settings.option.ui.chatWidth.wide")}],u("settings.label.ui.chatWidth"),!1)})]},H.localKey);const J=H.setting,W=z4t(J,u),P=H4t(J,y),V=cde(J,y),ee=P?u(P,{scope:u(y==="workspace"?"settings.scope.user":"settings.scope.workspace")}):void 0;return l.jsxs("div",{children:[I,l.jsx(hG,{title:o1(J,u),description:[W,ee].filter(Boolean).join(" · ")||void 0,metadata:V?l.jsx(Pi,{variant:"secondary",children:u(y==="workspace"?"settings.scope.workspace":"settings.scope.user")}):void 0,control:C===J.key?l.jsx(fr,{}):j(J)})]},J.key)})})})]}),z&&o&&l.jsx("div",{className:"mt-4",children:l.jsx(O4t,{...o})})]})]})]})]}),!a&&l.jsx("div",{className:"border-t border-border px-5 py-3 text-xs text-muted-foreground",children:u("settings.footer")})]})}const V4t="_dialog_1ymqd_1",G4t="_toolbar_1ymqd_12",K4t="_tabs_1ymqd_21",Y4t="_tab_1ymqd_21",X4t="_tabActive_1ymqd_39",Q4t="_search_1ymqd_48",J4t="_general_1ymqd_60",Z4t="_shortcuts_1ymqd_67",eCt="_shortcut_1ymqd_67",tCt="_shortcutKey_1ymqd_87",nCt="_shortcutDesc_1ymqd_95",sCt="_commandList_1ymqd_101",rCt="_commandCard_1ymqd_108",iCt="_commandCardExpanded_1ymqd_115",oCt="_commandRow_1ymqd_119",aCt="_commandName_1ymqd_135",lCt="_commandTag_1ymqd_142",cCt="_chevron_1ymqd_152",uCt="_chevronExpanded_1ymqd_160",dCt="_commandDetail_1ymqd_164",hCt="_commandDescription_1ymqd_174",fCt="_commandSubcommands_1ymqd_175",mCt="_empty_1ymqd_182",Gi={dialog:V4t,toolbar:G4t,tabs:K4t,tab:Y4t,tabActive:X4t,search:Q4t,general:J4t,shortcuts:Z4t,shortcut:eCt,shortcutKey:tCt,shortcutDesc:nCt,commandList:sCt,commandCard:rCt,commandCardExpanded:iCt,commandRow:oCt,commandName:aCt,commandTag:lCt,chevron:cCt,chevronExpanded:uCt,commandDetail:dCt,commandDescription:hCt,commandSubcommands:fCt,empty:mCt},pCt=[{id:"general",labelKey:"help.tab.general"},{id:"commands",labelKey:"help.tab.commands"},{id:"custom-commands",labelKey:"help.tab.custom"}],gCt=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"]),bCt=[["@","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 yCt(e){return[`/${e.name}`,e.argumentHint].filter(Boolean).join(" ")}function o9(e){return!gCt.has(e.name)}function wCt(e,t){return o9(e)?t("help.commandMeta.custom"):t("help.commandMeta.builtIn")}function vCt(e,t,n){const s=n.trim().toLowerCase();return e.filter(r=>r.name&&r.description!==void 0).filter(r=>t==="commands"?!o9(r):t==="custom-commands"?o9(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 xCt(){const{t:e}=lt();return l.jsx("div",{className:Gi.general,children:l.jsx("div",{className:Gi.shortcuts,children:bCt.map(([t,n])=>l.jsxs("div",{className:Gi.shortcut,children:[l.jsx("span",{className:Gi.shortcutDesc,children:e(n)}),l.jsx("span",{className:Gi.shortcutKey,children:t})]},t))})})}function kCt({commands:e,tab:t,query:n}){const{t:s}=lt(),[r,i]=h.useState(null),o=h.useMemo(()=>vCt(e,t,n),[e,n,t]);return o.length===0?l.jsx("div",{className:Gi.empty,children:s(t==="custom-commands"?"help.emptyCustom":"help.empty")}):l.jsx("div",{className:Gi.commandList,children:o.map(a=>{var u;const c=r===a.name;return l.jsxs("article",{className:`${Gi.commandCard} ${c?Gi.commandCardExpanded:""}`,children:[l.jsxs("button",{type:"button",className:Gi.commandRow,onClick:()=>i(c?null:a.name),"aria-expanded":c,children:[l.jsx("span",{className:Gi.commandName,children:yCt(a)}),l.jsx("span",{className:Gi.commandTag,children:wCt(a,s)}),l.jsx("svg",{className:`${Gi.chevron} ${c?Gi.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:Gi.commandDetail,children:[a.description&&l.jsx("div",{className:Gi.commandDescription,children:a.description}),!!((u=a.subcommands)!=null&&u.length)&&l.jsxs("div",{className:Gi.commandSubcommands,children:[s("help.subcommands"),": ",a.subcommands.join(", ")]})]})]},a.name)})})}function _Ct({commands:e}){const{t}=lt(),[n,s]=h.useState("general"),{filterValue:r,inputProps:i}=B5(),o=n!=="general";return l.jsxs("div",{className:Gi.dialog,children:[l.jsxs("div",{className:Gi.toolbar,children:[l.jsx("div",{className:Gi.tabs,children:pCt.map(a=>l.jsx("button",{type:"button",className:`${Gi.tab} ${a.id===n?Gi.tabActive:""}`,onClick:()=>s(a.id),children:t(a.labelKey)},a.id))}),o&&l.jsx("input",{className:Gi.search,...i,placeholder:t("help.search")})]}),n==="general"?l.jsx(xCt,{}):l.jsx(kCt,{commands:e,tab:n,query:r})]})}function SCt({currentTheme:e,onSelect:t,onClose:n}){const{t:s}=lt(),r=JQ.map(d=>({id:d,label:s(`theme.${d}`),description:s(`theme.${d}.desc`)})),[i,o]=h.useState(()=>{const d=r.findIndex(f=>f.id===e);return d>=0?d:0}),a=h.useRef(null),c=d=>{const f=r[d];f&&(t(f.id),n())},{keyboardMode:u}=Mp({itemCount:r.length,activeIndex:i,onActiveIndexChange:o,onConfirm:c});return h.useEffect(()=>{var f;const d=(f=a.current)==null?void 0:f.children[i];d==null||d.scrollIntoView({block:"nearest"})},[i]),l.jsx("div",{className:mn("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,f)=>{const m=d.id===e;return l.jsxs("div",{id:`theme-opt-${f}`,role:"option","aria-selected":m,className:mn("picker-item","picker-session-item",f===i?"selected":void 0,m?"dialog-current":void 0),"data-web-shell-theme-option":!0,"data-theme-id":d.id,onClick:()=>c(f),onMouseMove:()=>o(f),children:[l.jsx("div",{className:mn("picker-item-row"),children:l.jsx("span",{className:mn("picker-item-title"),children:d.label})}),l.jsx("div",{className:mn("picker-item-meta"),children:d.description})]},d.id)})})}const a9="delete-session-list",fG=e=>`${a9}-opt-${e}`;function CCt({onDeleted:e,onError:t,onClose:n,workspaceCwd:s}){const{t:r}=lt(),i=Ra(),{sessions:o,loading:a,error:c,deleteSession:u,deleteSessions:d}=Pk(s,{autoLoad:!0}),f=i.sessionId,[m,p]=h.useState(!1),[g,b]=h.useState(-1),[v,y]=h.useState(new Set),{filterValue:w,inputProps:x}=B5(()=>{b(-1),y(new Set)}),[k,C]=h.useState(null),T=h.useRef(null),_=h.useRef(null);h.useEffect(()=>{c&&C(c.message)},[c]);const S=h.useMemo(()=>w?o.filter($=>{const z=w.toLowerCase();return($.displayName||"").toLowerCase().includes(z)||$.sessionId.toLowerCase().includes(z)}):o,[o,w]),R=h.useCallback($=>{$!==f&&y(z=>{const B=new Set(z);return B.has($)?B.delete($):B.add($),B})},[f]);h.useEffect(()=>{if(v.size===0)return;const $=new Set(S.map(z=>z.sessionId));y(z=>{const B=new Set([...z].filter(j=>$.has(j)));return B.size===z.size?z:B})},[S,v.size]),h.useEffect(()=>{g>=S.length&&S.length>0&&b(S.length-1)},[S.length,g]),h.useEffect(()=>{var z;const $=(z=T.current)==null?void 0:z.children[g];$==null||$.scrollIntoView({block:"nearest"})},[g]),h.useEffect(()=>{var $;($=_.current)==null||$.focus()},[]);const{keyboardMode:A}=Mp({itemCount:S.length,activeIndex:g,onActiveIndexChange:b,onConfirm:$=>{const z=S[$];z&&R(z.sessionId)}}),O=h.useCallback(()=>{if(m)return;if(v.size>0){const z=new Set(S.map(j=>j.sessionId)),B=Array.from(v).filter(j=>z.has(j));if(B.length===0)return;p(!0),d(B).then(j=>{const H=j.removed.length+j.notFound.length,Q=j.errors.length;if(Q>0&&H>0){t(new Error(r("delete.partialFail",{removed:H,failed:Q,detail:j.errors[0].error}))),n();return}if(Q>0){C(r("delete.allFailed",{count:Q,reason:j.errors[0].error})),p(!1),y(new Set);return}if(H===0){C(r("delete.nonRemoved")),p(!1),y(new Set);return}e([...j.removed,...j.notFound]),n()}).catch(j=>{t(j),p(!1)});return}const $=S[g];if($){if($.sessionId===f){C(r("delete.cannotCurrent"));return}p(!0),u($.sessionId).then(z=>{if(!z){C(r("delete.notFound")),p(!1);return}e([$.sessionId]),n()}).catch(z=>{t(z),p(!1)})}},[f,u,d,m,S,n,e,t,g,v,r]),M=v.size>0,D=!m&&!a&&M;return l.jsxs("div",{className:mn("picker","picker-in-shell"),children:[l.jsxs("div",{className:mn("picker-search"),children:[l.jsxs("span",{className:mn("picker-search-label"),children:[r("resume.search"),":"," "]}),l.jsx("input",{ref:_,className:mn("picker-search-input"),"aria-label":r("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":a9,"aria-activedescendant":g>=0&&g<S.length?fG(g):void 0,...x,placeholder:""}),l.jsx("span",{className:mn("picker-search-hint"),children:k||(m?r("delete.deleting"):a?r("common.loading"):M?r("delete.selected",{count:v.size}):w?r("delete.matches",{count:S.length}):"")})]}),l.jsx("div",{className:mn("picker-sep")}),l.jsxs("div",{id:a9,role:"listbox","aria-multiselectable":"true",className:mn("picker-list",A?"picker-keyboard-only":void 0),ref:T,children:[a&&l.jsx("div",{className:mn("picker-empty"),children:r("common.loading")}),!a&&c&&l.jsx("div",{className:mn("picker-empty"),children:c.message}),!a&&!c&&S.length===0&&l.jsx("div",{className:mn("picker-empty"),children:w?r("delete.noMatch",{query:w}):r("delete.none")}),!a&&S.map(($,z)=>{const B=$.sessionId===f,j=v.has($.sessionId);return l.jsx(EP,{session:$,optionId:fG(z),active:z===g,ariaSelected:j,current:!1,disabled:B,leading:l.jsx("span",{className:mn("picker-item-checkbox",j?"picker-item-checkbox-checked":void 0),children:j?"[x] ":"[ ] "}),trailing:B?l.jsx("span",{className:mn("picker-item-badge"),children:r("resume.current")}):void 0,onClick:()=>{b(z),B||R($.sessionId)},onActivate:()=>b(z)},$.sessionId)})]}),l.jsx("div",{className:mn("picker-sep")}),l.jsxs("div",{className:mn("dialog-footer-actions"),children:[l.jsx("button",{type:"button",className:mn("dialog-inline-button"),onClick:n,disabled:m,children:r("common.cancel")}),l.jsx("button",{type:"button",className:mn("dialog-danger-button"),onClick:O,disabled:!D,children:r(m?"delete.deleting":"delete.action")})]})]})}const l9="release-session-list",mG=e=>`${l9}-opt-${e}`;function TCt({onReleased:e,onError:t,onClose:n,workspaceCwd:s}){const{t:r}=lt(),i=Ra(),{sessions:o,loading:a,error:c,releaseSession:u}=Pk(s,{autoLoad:!0}),d=i.sessionId,[f,m]=h.useState(!1),[p,g]=h.useState(-1),[b,v]=h.useState(null),{filterValue:y,inputProps:w}=B5(()=>{g(-1),v(null)}),[x,k]=h.useState(null),C=h.useRef(null),T=h.useRef(null);h.useEffect(()=>{c&&k(c.message)},[c]);const _=y?o.filter($=>{const z=y.toLowerCase();return($.displayName||"").toLowerCase().includes(z)||$.sessionId.toLowerCase().includes(z)}):o,S=$=>{const z=_[$];if(!z)return;const B=z.sessionId===d,j=(z.clientCount??0)>0||z.hasActivePrompt===!0;B||!j||(g($),v(z.sessionId))};h.useEffect(()=>{p>=_.length&&_.length>0&&g(_.length-1)},[_.length,p]),h.useEffect(()=>{var z;const $=(z=C.current)==null?void 0:z.children[p];$==null||$.scrollIntoView({block:"nearest"})},[p]),h.useEffect(()=>{var $;($=T.current)==null||$.focus()},[]);const{keyboardMode:R}=Mp({itemCount:_.length,activeIndex:p,onActiveIndexChange:g,onConfirm:S}),A=h.useCallback($=>{const z=$??_.find(j=>j.sessionId===b)??void 0;if(!z||f)return;if(!((z.clientCount??0)>0||z.hasActivePrompt===!0)){k(r("release.inactive"));return}if(z.sessionId===d){k(r("release.cannotCurrent"));return}u&&(m(!0),u(z.sessionId).then(()=>{e(z.sessionId),n()}).catch(j=>{t(j),m(!1)}))},[d,f,_,n,t,e,u,b,r]),O=_.find($=>$.sessionId===b)??void 0,M=O&&((O.clientCount??0)>0||O.hasActivePrompt===!0),D=!f&&!a&&!!O&&O.sessionId!==d&&!!M;return l.jsxs("div",{className:mn("picker","picker-in-shell"),children:[l.jsxs("div",{className:mn("picker-search"),children:[l.jsxs("span",{className:mn("picker-search-label"),children:[r("resume.search"),":"," "]}),l.jsx("input",{ref:T,className:mn("picker-search-input"),"aria-label":r("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":l9,"aria-activedescendant":p>=0&&p<_.length?mG(p):void 0,...w,placeholder:""}),l.jsx("span",{className:mn("picker-search-hint"),children:x||(f?r("release.releasing"):a?r("common.loading"):y?r("release.matches",{count:_.length}):"")})]}),l.jsx("div",{className:mn("picker-sep")}),l.jsxs("div",{id:l9,role:"listbox",className:mn("picker-list",R?"picker-keyboard-only":void 0),ref:C,children:[a&&l.jsx("div",{className:mn("picker-empty"),children:r("common.loading")}),!a&&_.length===0&&l.jsx("div",{className:mn("picker-empty"),children:y?r("release.noMatch",{query:y}):r("release.none")}),!a&&_.map(($,z)=>{const B=$.sessionId===d,j=($.clientCount??0)>0||$.hasActivePrompt===!0,H=B||!j;return l.jsx(EP,{session:$,optionId:mG(z),active:z===p,confirmed:$.sessionId===b,ariaSelected:$.sessionId===b,current:!1,disabled:H,trailing:B?l.jsx("span",{className:mn("picker-item-badge"),children:r("resume.current")}):j?void 0:l.jsx("span",{className:mn("picker-item-badge"),children:r("release.inactiveBadge")}),onClick:()=>S(z),onActivate:()=>g(z)},$.sessionId)})]}),l.jsx("div",{className:mn("picker-sep")}),l.jsxs("div",{className:mn("dialog-footer-actions"),children:[l.jsx("button",{type:"button",className:mn("dialog-inline-button"),onClick:n,disabled:f,children:r("common.cancel")}),l.jsx("button",{type:"button",className:mn("dialog-danger-button"),onClick:()=>A(),disabled:!D,children:r(f?"release.releasing":"release.action")})]})]})}const ECt="_root_ieg2d_1",jCt="_list_ieg2d_8",ACt="_item_ieg2d_21",NCt="_itemCursor_ieg2d_42",MCt="_itemSelected_ieg2d_49",ICt="_prompt_ieg2d_61",RCt="_keyboardOnly_ieg2d_68",DCt="_itemDisabled_ieg2d_77",PCt="_turn_ieg2d_91",LCt="_time_ieg2d_96",OCt="_footer_ieg2d_102",$Ct="_footerMessage_ieg2d_112",BCt="_dangerButton_ieg2d_118",dc={root:ECt,list:jCt,item:ACt,itemCursor:NCt,itemSelected:MCt,prompt:ICt,keyboardOnly:RCt,itemDisabled:DCt,turn:PCt,time:LCt,footer:OCt,footerMessage:$Ct,dangerButton:BCt},zCt="rewind-snapshot-list",pG=e=>`${zCt}-opt-${e}`;function FCt(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 HCt(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function qCt({blocks:e,loadSnapshots:t,rewind:n,onError:s,onClose:r}){const{t:i}=lt(),[o,a]=h.useState([]),[c,u]=h.useState(!0),[d,f]=h.useState(null),[m,p]=h.useState(0),[g,b]=h.useState(null),[v,y]=h.useState(null);h.useEffect(()=>{let S=!0;return u(!0),t().then(R=>{S&&a(R.snapshots)}).catch(R=>{S&&s(R)}).finally(()=>{S&&u(!1)}),()=>{S=!1}},[t,s]);const w=h.useMemo(()=>o.map(S=>({snapshot:S,promptText:FCt(e,S.turnIndex)})).sort((S,R)=>S.snapshot.turnIndex-R.snapshot.turnIndex),[e,o]);h.useEffect(()=>{m>=w.length&&w.length>0&&p(w.length-1)},[w.length,m]);const x=h.useRef(null),k=d!==null,C=S=>{!S||d||(f(S),y(null),n(S).then(()=>{r()}).catch(R=>{s(R),y(i("rewind.failed",{reason:R instanceof Error?R.message:String(R)})),f(null)}))},T=S=>{const R=w[S];R&&(p(S),b(R.snapshot.promptId))},{keyboardMode:_}=Mp({itemCount:w.length,activeIndex:m,onActiveIndexChange:p,onConfirm:T,enabled:!k});return h.useEffect(()=>{var R;const S=(R=x.current)==null?void 0:R.children[m];S==null||S.scrollIntoView({block:"nearest"})},[m]),h.useEffect(()=>{var R;if(c||w.length===0)return;const S=document.activeElement;(S==null?void 0:S.getAttribute("role"))==="dialog"&&((R=x.current)==null||R.focus())},[c,w.length]),c?l.jsx("div",{className:mn("picker-empty"),children:i("rewind.loading")}):w.length===0?l.jsx("div",{className:mn("picker-empty"),children:i("rewind.empty")}):l.jsxs("div",{className:dc.root,children:[l.jsx("div",{className:`${dc.list} ${_?dc.keyboardOnly:""}`,ref:x,role:"listbox","aria-label":i("rewind.title"),tabIndex:0,"aria-activedescendant":w.length>0?pG(m):void 0,children:w.map(({snapshot:S,promptText:R},A)=>{const O=A===m,M=g===S.promptId,D=R||i("rewind.promptFallback",{id:S.promptId.slice(-8)});return l.jsxs("div",{id:pG(A),role:"option","aria-selected":M,"aria-disabled":k||void 0,className:`${dc.item} ${O?dc.itemCursor:""} ${M?dc.itemSelected:""} ${k?dc.itemDisabled:""}`,onClick:()=>{k||T(A)},onMouseMove:()=>p(A),children:[l.jsxs("div",{className:dc.prompt,title:D,children:[l.jsxs("span",{className:dc.turn,children:["#",S.turnIndex+1]})," ",D]}),l.jsx("div",{className:dc.time,children:HCt(S.timestamp)})]},S.promptId)})}),l.jsxs("div",{className:dc.footer,children:[v&&l.jsx("span",{className:dc.footerMessage,role:"alert",children:v}),l.jsx("button",{type:"button",className:mn("dialog-inline-button"),onClick:r,disabled:d!==null,children:i("common.cancel")}),l.jsx("button",{type:"button",className:`${mn("dialog-danger-button")} ${dc.dangerButton}`,onClick:()=>C(g),disabled:!g||d!==null,children:i(d?"rewind.rewinding":"rewind.confirm")})]})]})}const nj="add-workspace-hint",gG="add-workspace-display-name-hint",bG="add-workspace-error",_2="add-workspace-suggestions",UCt=150;function yG(e){return e.startsWith("/")||/^[A-Za-z]:[\\/]/.test(e)}function WCt({onClose:e,onAdd:t,displayNameEnabled:n=!1,onSuggest:s,onPick:r,persistenceSupported:i=!0}){const{t:o}=lt(),[a,c]=h.useState(""),[u,d]=h.useState(""),[f,m]=h.useState(null),[p,g]=h.useState(!1),[b,v]=h.useState(!0),[y,w]=h.useState([]),[x,k]=h.useState(!1),[C,T]=h.useState(-1),[_,S]=h.useState("/"),[R,A]=h.useState(!1),O=h.useRef(null),M=h.useRef(!1);M.current=x&&y.length>0;const D=h.useRef(0),$=h.useRef(!1);h.useEffect(()=>{var J;(J=O.current)==null||J.focus()},[]);const z=h.useCallback(()=>{k(!1),T(-1)},[]);h.useEffect(()=>{if(!s)return;if(!yG(a)){w([]),z();return}const J=++D.current,W=!$.current;$.current=!1;const P=setTimeout(()=>{s(a).then(V=>{J===D.current&&(w(V.suggestions),S(V.sep||"/"),T(-1),(W||M.current)&&k(V.suggestions.length>0))},()=>{J===D.current&&(w([]),z())})},UCt);return()=>clearTimeout(P)},[a,s,z]),h.useEffect(()=>{const J=W=>{W.key!=="Escape"||!M.current||W.isComposing||W.keyCode===229||(W.preventDefault(),z())};return window.addEventListener("keydown",J,{capture:!0}),()=>window.removeEventListener("keydown",J,{capture:!0})},[z]);const B=h.useCallback(J=>{var W;$.current=!1,c(J.path+_),m(null),z(),(W=O.current)==null||W.focus()},[_,z]),j=h.useCallback(async()=>{if(r){A(!0),m(null);try{const J=await r();J&&(++D.current,c(J),w([]),z())}catch{m(o("sidebar.addWorkspaceBrowseError"))}finally{A(!1)}}},[r,z,o]),H=h.useCallback(J=>{const W=x&&y.length>0;if(J.key==="ArrowDown"){if(J.preventDefault(),!W){y.length>0&&k(!0);return}T(P=>(P+1)%y.length);return}if(J.key==="ArrowUp"){if(!W)return;J.preventDefault(),T(P=>(P<=0?y.length:P)-1);return}if(J.key==="Tab"&&W&&!J.shiftKey){const P=C>=0?y[C]:y.length===1?y[0]:void 0;P&&(J.preventDefault(),B(P));return}J.key==="Enter"&&W&&C>=0&&(J.preventDefault(),B(y[C]))},[x,y,C,B]),Q=h.useCallback(async J=>{J.preventDefault();const W=a.trim();if(W){if(!yG(W)){m(o("sidebar.addWorkspaceAbsError"));return}m(null),g(!0),z();try{const P=i?b:!1,V=n?u.trim():"";V?await t(W,P,V):await t(W,P),e()}catch(P){m(P instanceof Error?P.message:o("sidebar.addWorkspaceError"))}finally{g(!1)}}},[a,u,n,b,i,t,e,z,o]),I=x&&y.length>0;return l.jsx(Ii,{title:o("sidebar.addWorkspaceTitle"),size:"md",onClose:e,children:l.jsxs("form",{className:"flex flex-col gap-6",onSubmit:Q,children:[l.jsxs(hb,{children:[l.jsxs(to,{"data-invalid":f?!0:void 0,children:[l.jsx(qo,{htmlFor:"add-workspace-path",children:o("sidebar.addWorkspacePath")}),l.jsxs("div",{className:"relative",children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pr,{ref:O,id:"add-workspace-path",type:"text",placeholder:"/absolute/path/to/project",value:a,onChange:J=>{c(J.target.value),f&&m(null)},onKeyDown:H,onBlur:()=>{setTimeout(()=>{$.current=!0,z()},100)},disabled:p||R,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1,role:"combobox","aria-expanded":I,"aria-controls":I?_2:void 0,"aria-activedescendant":I&&C>=0?`${_2}-${C}`:void 0,"aria-describedby":f?`${bG} ${nj}`:nj,"aria-invalid":f?!0:void 0}),r&&l.jsxs(Jt,{type:"button",variant:"outline",onMouseDown:J=>J.preventDefault(),onClick:()=>void j(),disabled:p||R,children:[l.jsx($Q,{"aria-hidden":"true"}),o("sidebar.addWorkspaceBrowse")]})]}),I&&l.jsx("ul",{id:_2,role:"listbox","aria-label":o("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:y.map((J,W)=>l.jsxs("li",{id:`${_2}-${W}`,role:"option","aria-selected":W===C,className:`cursor-pointer truncate px-3 py-1.5 ${W===C?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onMouseDown:P=>{P.preventDefault(),B(J)},onMouseEnter:()=>T(W),children:[J.name,l.jsx("span",{className:"text-muted-foreground",children:_})]},J.path))})]}),l.jsx(Du,{id:nj,children:o("sidebar.addWorkspaceHint")}),f&&l.jsx(Rct,{id:bG,children:f})]}),n&&l.jsxs(to,{children:[l.jsx(qo,{htmlFor:"add-workspace-display-name",children:o("sidebar.addWorkspaceDisplayName")}),l.jsx(Pr,{id:"add-workspace-display-name",type:"text",value:u,onChange:J=>d(J.target.value),disabled:p,maxLength:256,autoComplete:"off","aria-describedby":gG}),l.jsx(Du,{id:gG,children:o("sidebar.addWorkspaceDisplayNameHint")})]}),i&&l.jsxs(to,{orientation:"horizontal",children:[l.jsxs(Fce,{children:[l.jsx(qo,{htmlFor:"add-workspace-persist",children:o("sidebar.addWorkspacePersist")}),l.jsx(Du,{children:o("sidebar.addWorkspacePersistHint")})]}),l.jsx(W5,{id:"add-workspace-persist",checked:b,onCheckedChange:v,disabled:p})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Jt,{type:"button",variant:"outline",onClick:e,disabled:p,children:o("sidebar.addWorkspaceCancel")}),l.jsx(Jt,{type:"submit",disabled:p||!a.trim(),children:o(p?"sidebar.addWorkspaceAdding":"sidebar.addWorkspaceRegister")})]})]})})}const dde="qwen-code-web-shell-collapsed-session-groups",$k="ws:";function wG(e){return!e.startsWith($k)}function VCt(e,t){return`${$k}${e}|group:${t}`}function hde(e){return`${$k}${e}|ungrouped`}function GCt(e,t){return t.startsWith(`${$k}${e}|`)}function zP(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(dde);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 KCt(e){try{window.localStorage.setItem(dde,JSON.stringify(Array.from(e).sort()))}catch{}}function fde(e,t){const n=zP(),s=new Set(Array.from(n).filter(r=>!t(r)));for(const r of e)s.add(r);KCt(s)}function YCt(e){const t=zP(),n=new Set,s=`${$k}${e}|group:`,r=hde(e);for(const i of t)i===r?n.add("ungrouped"):i.startsWith(s)&&n.add(i.slice(s.length));return n}function XCt(e,t){const n=new Set;for(const s of t)n.add(s==="ungrouped"?hde(e):VCt(e,s));fde(n,s=>GCt(e,s))}const QCt="_sidebar_dp3e8_1",JCt="_resizing_dp3e8_20",ZCt="_collapsed_dp3e8_24",e3t="_newChatButton_dp3e8_30",t3t="_pluginButton_dp3e8_31",n3t="_footerButton_dp3e8_32",s3t="_collapseButton_dp3e8_33",r3t="_projectRow_dp3e8_34",i3t="_sessionRow_dp3e8_35",o3t="_sessionGroupHeader_dp3e8_36",a3t="_sessionGroupActionButton_dp3e8_37",l3t="_retry_dp3e8_38",c3t="_iconButton_dp3e8_39",u3t="_projectIconButton_dp3e8_40",d3t="_sessionActionButton_dp3e8_41",h3t="_groupMenuItem_dp3e8_42",f3t="_secondaryButton_dp3e8_43",m3t="_dangerButton_dp3e8_44",p3t="_primaryNav_dp3e8_80",g3t="_navIcon_dp3e8_129",b3t="_topRow_dp3e8_155",y3t="_brandLogo_dp3e8_170",w3t="_brandName_dp3e8_186",v3t="_workspacePicker_dp3e8_206",x3t="_workspacePickerLabel_dp3e8_213",k3t="_workspacePickerHeader_dp3e8_220",_3t="_workspaceAddIconButton_dp3e8_227",S3t="_workspaceList_dp3e8_247",C3t="_workspaceSessionBody_dp3e8_253",T3t="_projectsHeader_dp3e8_257",E3t="_pinnedSessionList_dp3e8_267",j3t="_projectsHeaderToggle_dp3e8_275",A3t="_projectsHeaderAction_dp3e8_276",N3t="_projectsHeaderActions_dp3e8_284",M3t="_projectSearch_dp3e8_335",I3t="_addWorkspaceButton_dp3e8_357",R3t="_body_dp3e8_377",D3t="_sectionTitle_dp3e8_387",P3t="_projectRowExpanded_dp3e8_402",L3t="_workspaceHeaderActions_dp3e8_428",O3t="_workspaceHeaderAction_dp3e8_428",$3t="_projectName_dp3e8_471",B3t="_sessionText_dp3e8_472",z3t="_sessionBadgeIcon_dp3e8_479",F3t="_projectHoverAction_dp3e8_495",H3t="_sessionList_dp3e8_504",q3t="_sessionGroupSection_dp3e8_519",U3t="_sessionGroupHeaderRow_dp3e8_525",W3t="_sessionGroupDot_dp3e8_561",V3t="_sessionGroupDotMuted_dp3e8_568",G3t="_sessionGroupTitle_dp3e8_572",K3t="_sessionGroupCount_dp3e8_579",Y3t="_sessionGroupChevron_dp3e8_584",X3t="_sessionGroupHeaderActions_dp3e8_605",Q3t="_sessionGroupList_dp3e8_635",J3t="_currentSession_dp3e8_653",Z3t="_busySession_dp3e8_658",eTt="_floatingTooltip_dp3e8_663",tTt="_tooltipContent_dp3e8_693",nTt="_tooltipTitle_dp3e8_699",sTt="_tooltipTags_dp3e8_706",rTt="_tooltipTag_dp3e8_706",iTt="_tooltipTagRunning_dp3e8_726",oTt="_tooltipTagNew_dp3e8_731",aTt="_tooltipMeta_dp3e8_736",lTt="_sessionStatusSlot_dp3e8_751",cTt="_sessionStatusDot_dp3e8_763",uTt="_sidebarPulse_dp3e8_1",dTt="_sessionTitlePin_dp3e8_773",hTt="_sessionMetaSlot_dp3e8_805",fTt="_sessionAttention_dp3e8_815",mTt="_sessionAttentionUserInput_dp3e8_829",pTt="_sessionLoading_dp3e8_834",gTt="_sessionTime_dp3e8_844",bTt="_sidebarSpin_dp3e8_1",yTt="_runningSession_dp3e8_863",wTt="_sessionActions_dp3e8_879",vTt="_activeSessionActionButton_dp3e8_945",xTt="_searchInput_dp3e8_964",kTt="_renameInput_dp3e8_978",_Tt="_dialogSelect_dp3e8_984",STt="_dialogInput_dp3e8_994",CTt="_groupMenu_dp3e8_42",TTt="_groupMenuItemActive_dp3e8_1036",ETt="_groupMenuName_dp3e8_1042",jTt="_groupMenuDot_dp3e8_1050",ATt="_groupMenuEmptyDot_dp3e8_1051",NTt="_groupMenuIcon_dp3e8_1052",MTt="_groupMenuCheck_dp3e8_1080",ITt="_groupMenuSeparator_dp3e8_1087",RTt="_groupColorRed_dp3e8_1093",DTt="_groupColorOrange_dp3e8_1097",PTt="_groupColorYellow_dp3e8_1101",LTt="_groupColorGreen_dp3e8_1105",OTt="_groupColorBlue_dp3e8_1109",$Tt="_groupColorPurple_dp3e8_1113",BTt="_groupColorCustom_dp3e8_1117",zTt="_renameForm_dp3e8_1127",FTt="_notice_dp3e8_1143",HTt="_confirmContent_dp3e8_1158",qTt="_confirmDescription_dp3e8_1164",UTt="_workspaceRemovalActivityList_dp3e8_1171",WTt="_confirmActions_dp3e8_1179",VTt="_groupForm_dp3e8_1185",GTt="_fieldStack_dp3e8_1192",KTt="_groupCustomColorRow_dp3e8_1220",YTt="_groupColorPicker_dp3e8_1227",XTt="_groupHexField_dp3e8_1237",QTt="_groupColorError_dp3e8_1247",JTt="_footer_dp3e8_32",ZTt="_footerPrimary_dp3e8_1308",e5t="_footerActions_dp3e8_1309",t5t="_footerButtonLabel_dp3e8_1325",n5t="_footerCompact_dp3e8_1332",s5t="_footerTight_dp3e8_1333",r5t="_version_dp3e8_1368",i5t="_resizeHandle_dp3e8_1411",o5t="_sessionActionButtonActive_dp3e8_1439",a5t="_menuActive_dp3e8_1445",l5t="_actionMenu_dp3e8_1449",c5t="_actionMenuItem_dp3e8_1466",u5t="_actionMenuItemDanger_dp3e8_1497",d5t="_actionMenuIcon_dp3e8_1507",h5t="_actionMenuLabel_dp3e8_1526",f5t="_archivedSection_dp3e8_1534",m5t="_archivedHeader_dp3e8_1541",p5t="_archivedChevron_dp3e8_1567",g5t="_archivedTitle_dp3e8_1586",b5t="_archivedCount_dp3e8_1595",y5t="_archivedList_dp3e8_1610",w5t="_archivedRow_dp3e8_1617",v5t="_mobileOpen_dp3e8_1626",Be={sidebar:QCt,resizing:JCt,collapsed:ZCt,newChatButton:e3t,pluginButton:t3t,footerButton:n3t,collapseButton:s3t,projectRow:r3t,sessionRow:i3t,sessionGroupHeader:o3t,sessionGroupActionButton:a3t,retry:l3t,iconButton:c3t,projectIconButton:u3t,sessionActionButton:d3t,groupMenuItem:h3t,secondaryButton:f3t,dangerButton:m3t,primaryNav:p3t,navIcon:g3t,topRow:b3t,brandLogo:y3t,brandName:w3t,workspacePicker:v3t,workspacePickerLabel:x3t,workspacePickerHeader:k3t,workspaceAddIconButton:_3t,workspaceList:S3t,workspaceSessionBody:C3t,projectsHeader:T3t,pinnedSessionList:E3t,projectsHeaderToggle:j3t,projectsHeaderAction:A3t,projectsHeaderActions:N3t,projectSearch:M3t,addWorkspaceButton:I3t,body:R3t,sectionTitle:D3t,projectRowExpanded:P3t,workspaceHeaderActions:L3t,workspaceHeaderAction:O3t,projectName:$3t,sessionText:B3t,sessionBadgeIcon:z3t,projectHoverAction:F3t,sessionList:H3t,sessionGroupSection:q3t,sessionGroupHeaderRow:U3t,sessionGroupDot:W3t,sessionGroupDotMuted:V3t,sessionGroupTitle:G3t,sessionGroupCount:K3t,sessionGroupChevron:Y3t,sessionGroupHeaderActions:X3t,sessionGroupList:Q3t,currentSession:J3t,busySession:Z3t,floatingTooltip:eTt,tooltipContent:tTt,tooltipTitle:nTt,tooltipTags:sTt,tooltipTag:rTt,tooltipTagRunning:iTt,tooltipTagNew:oTt,tooltipMeta:aTt,sessionStatusSlot:lTt,sessionStatusDot:cTt,sidebarPulse:uTt,sessionTitlePin:dTt,sessionMetaSlot:hTt,sessionAttention:fTt,sessionAttentionUserInput:mTt,sessionLoading:pTt,sessionTime:gTt,sidebarSpin:bTt,runningSession:yTt,sessionActions:wTt,activeSessionActionButton:vTt,searchInput:xTt,renameInput:kTt,dialogSelect:_Tt,dialogInput:STt,groupMenu:CTt,groupMenuItemActive:TTt,groupMenuName:ETt,groupMenuDot:jTt,groupMenuEmptyDot:ATt,groupMenuIcon:NTt,groupMenuCheck:MTt,groupMenuSeparator:ITt,groupColorRed:RTt,groupColorOrange:DTt,groupColorYellow:PTt,groupColorGreen:LTt,groupColorBlue:OTt,groupColorPurple:$Tt,groupColorCustom:BTt,renameForm:zTt,notice:FTt,confirmContent:HTt,confirmDescription:qTt,workspaceRemovalActivityList:UTt,confirmActions:WTt,groupForm:VTt,fieldStack:GTt,groupCustomColorRow:KTt,groupColorPicker:YTt,groupHexField:XTt,groupColorError:QTt,footer:JTt,footerPrimary:ZTt,footerActions:e5t,footerButtonLabel:t5t,footerCompact:n5t,footerTight:s5t,version:r5t,resizeHandle:i5t,sessionActionButtonActive:o5t,menuActive:a5t,actionMenu:l5t,actionMenuItem:c5t,actionMenuItemDanger:u5t,actionMenuIcon:d5t,actionMenuLabel:h5t,archivedSection:f5t,archivedHeader:m5t,archivedChevron:p5t,archivedTitle:g5t,archivedCount:b5t,archivedList:y5t,archivedRow:w5t,mobileOpen:v5t};function c9({label:e,count:t,expanded:n,color:s,children:r,onToggle:i,onRename:o,onDelete:a,renameLabel:c,deleteLabel:u,actionsDisabled:d}){const f=s!=null&&s.startsWith("#")?Be.groupColorCustom:s?Be[`groupColor${s[0].toUpperCase()}${s.slice(1)}`]:Be.sessionGroupDotMuted,m=s!=null&&s.startsWith("#")?{"--session-group-custom-color":s}:void 0;return l.jsxs("section",{className:Be.sessionGroupSection,"aria-label":e,children:[l.jsxs("div",{className:Be.sessionGroupHeaderRow,children:[l.jsxs("button",{type:"button",className:Be.sessionGroupHeader,"aria-expanded":n,onClick:i,children:[l.jsx("span",{className:`${Be.sessionGroupDot} ${f}`,style:m,"aria-hidden":"true"}),l.jsx("span",{className:Be.sessionGroupTitle,children:e}),l.jsxs("span",{className:Be.sessionGroupCount,children:["· ",t]}),l.jsx("span",{className:Be.sessionGroupChevron,"aria-hidden":"true",children:n?l.jsx(gc,{}):l.jsx(ok,{})})]}),(o||a)&&l.jsxs("div",{className:Be.sessionGroupHeaderActions,children:[o&&l.jsx("button",{className:Be.sessionGroupActionButton,type:"button",title:c,"aria-label":c,disabled:d,onClick:o,children:l.jsx(Sb,{})}),a&&l.jsx("button",{className:Be.sessionGroupActionButton,type:"button",title:u,"aria-label":u,disabled:d,onClick:a,children:l.jsx(mm,{})})]})]}),n&&l.jsx("div",{className:Be.sessionGroupList,children:r})]})}const x5t="_section_kbnw6_1",k5t="_headerRow_kbnw6_6",_5t="_header_kbnw6_6",S5t="_headerDisabled_kbnw6_34",C5t="_headerContent_kbnw6_42",T5t="_chevron_kbnw6_50",E5t="_folderIcon_kbnw6_55",j5t="_chevronOpen_kbnw6_59",A5t="_name_kbnw6_63",N5t="_badge_kbnw6_71",M5t="_gitPill_kbnw6_85",I5t="_sessions_kbnw6_107",R5t="_empty_kbnw6_114",D5t="_error_kbnw6_120",P5t="_sessionItemReadOnly_kbnw6_126",L5t="_sessionName_kbnw6_137",O5t="_sessionTime_kbnw6_144",ra={section:x5t,headerRow:k5t,header:_5t,headerDisabled:S5t,headerContent:C5t,chevron:T5t,folderIcon:E5t,chevronOpen:j5t,name:A5t,badge:N5t,gitPill:M5t,sessions:I5t,empty:R5t,error:D5t,sessionItemReadOnly:P5t,sessionName:L5t,sessionTime:O5t};function vG(...e){return e.filter(Boolean).join(" ")}function $5t(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-zA-Z]:[\\/]/.test(e)}function B5t(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function z5t({open:e}){const t=e?$Q:oC;return l.jsx(t,{className:ra.folderIcon,size:16,strokeWidth:1.2,"aria-hidden":"true"})}function F5t({workspace:e,renderHeader:t,client:n,reloadToken:s,untrustedLabel:r,readOnlyLabel:i,trustToOpenLabel:o,noSessionsLabel:a,loadErrorLabel:c,organizationEnabled:u,ungroupedLabel:d,formatTime:f,searchQuery:m="",expanded:p,autoExpandKey:g,onExpandedChange:b,renderSessions:v=!0,renderSession:y,headerActions:w,onRenameGroup:x,onDeleteGroup:k,renameGroupLabel:C,deleteGroupLabel:T,groupActionsDisabled:_,excludePinned:S=!1,onOpenGitDiff:R,onOpenCommit:A}){const[O,M]=h.useState([]),[D,$]=h.useState([]),[z,B]=h.useState(!1),[j,H]=h.useState(!1),[Q,I]=h.useState(()=>YCt(e.id)),[J,W]=h.useState(!1),[P,V]=h.useState(),[ee,q]=h.useState(!1),{t:K}=lt(),de=p??j,re=!e.primary&&!e.trusted,ne=e.primary&&!e.trusted;h.useEffect(()=>{p===void 0&&H(!1)},[p,e.id]),h.useEffect(()=>{XCt(e.id,Q)},[Q,e.id]),h.useEffect(()=>{p===void 0&&g&&H(!0)},[g,p]);const U=h.useCallback(async()=>{if(!ne)try{const le=await n.workspaceByCwd(e.cwd).listWorkspaceSessions({pageSize:Dh,archiveState:"active",...u?{view:"organized",group:"all"}:{}});M(le),B(!1)}catch(le){console.warn("[WorkspaceSection] session poll failed:",le),B(!0)}},[n,ne,u,e.cwd]);h.useEffect(()=>{if(!v||ne||!u){$([]);return}let le=!1;return n.workspaceByCwd(e.cwd).listSessionGroups().then(Me=>{le||$(Me.groups)}).catch(Me=>{console.warn("[WorkspaceSection] group catalog load failed:",Me)}),()=>{le=!0}},[n,ne,u,s,v,e.cwd]),h.useEffect(()=>{if(!v||!de&&!m.trim()||(U(),re))return;const le=setInterval(()=>void U(),1e4);return()=>clearInterval(le)},[de,U,re,s,v,m]);const Z=$5t(e.cwd)?e.cwd:void 0,ge=!!R,ce=h.useRef(!1),ue=h.useCallback(async()=>{if(!(!ge||!e.trusted||!Z))try{const le=await n.workspaceByCwd(Z).workspaceGit({wait:!0});ce.current=!1,V(le)}catch(le){ce.current||(console.warn("[WorkspaceSection] git status poll failed:",le),ce.current=!0)}},[n,Z,ge,e.trusted]);h.useEffect(()=>{if(!ge||!e.trusted||!Z){V(void 0);return}ue();const le=()=>void ue();window.addEventListener("focus",le);const Me=window.setInterval(()=>{document.visibilityState==="visible"&&ue()},6e4);return()=>{window.removeEventListener("focus",le),window.clearInterval(Me)}},[Z,ge,ue,s,e.trusted]);const be=h.useMemo(()=>{const le=m.trim().toLowerCase();return O.filter(Me=>S&&Me.isPinned?!1:le?(Me.displayName||"").toLowerCase().includes(le)||Me.sessionId.toLowerCase().includes(le):!0)},[S,m,O]),rt=h.useMemo(()=>{if(!u||D.length===0)return null;const le=new Set;return{sections:D.map(We=>{const at=be.filter(ze=>ze.groupId===We.id);return at.forEach(ze=>le.add(ze.sessionId)),{group:We,sessions:at}}),ungrouped:be.filter(We=>!le.has(We.sessionId))}},[D,u,be]);return l.jsxs("div",{className:ra.section,children:[l.jsxs("div",{className:vG(ra.headerRow,ne&&ra.headerDisabled),onMouseEnter:()=>W(!0),onMouseLeave:()=>W(!1),onFocus:()=>W(!0),onBlur:le=>{le.currentTarget.contains(le.relatedTarget)||W(!1)},children:[l.jsx("button",{className:ra.header,type:"button",disabled:ne,"aria-expanded":de,onClick:()=>{const le=!de;H(le),b==null||b(le)},children:t?t(de):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:vG(ra.chevron,de&&ra.chevronOpen),children:l.jsx(z5t,{open:de})}),l.jsx("span",{className:ra.headerContent,children:l.jsx("span",{className:ra.name,children:z5(e)})}),!e.trusted&&l.jsx("span",{className:ra.badge,children:r}),re&&l.jsx("span",{className:ra.badge,children:i})]})}),R&&e.trusted&&(P==null?void 0:P.branch)&&l.jsx(Dce,{open:ee,onOpenChange:q,workspaceCwd:e.cwd,onOpenDiff:()=>R(e.cwd),onOpenCommit:A?()=>A(e.cwd):void 0,children:l.jsx("button",{type:"button",className:ra.gitPill,"aria-label":`${K("branchPicker.label")} — ${P.branch}`,children:l.jsx(Rce,{branch:P.branch,status:P,compact:!0})})}),w==null?void 0:w(J)]}),v&&(de||!!m.trim())&&!ne&&l.jsx("div",{className:ra.sessions,children:z?l.jsx("div",{className:ra.error,role:"status",children:c}):be.length===0?l.jsx("div",{className:ra.empty,children:a}):rt?l.jsxs(l.Fragment,{children:[rt.sections.map(({group:le,sessions:Me})=>l.jsx(c9,{id:`group:${le.id}`,label:le.name,count:Me.length,color:le.color,expanded:!Q.has(le.id),onToggle:()=>{I(We=>{const at=new Set(We);return at.has(le.id)?at.delete(le.id):at.add(le.id),at})},onRename:x?()=>x(le,e.cwd):void 0,onDelete:k?()=>k(le,e.cwd):void 0,renameLabel:C,deleteLabel:T,actionsDisabled:_,children:Me.map(We=>y(We))},le.id)),rt.ungrouped.length>0&&l.jsx(c9,{id:"ungrouped",label:d,count:rt.ungrouped.length,expanded:!Q.has("ungrouped"),onToggle:()=>{I(le=>{const Me=new Set(le);return Me.has("ungrouped")?Me.delete("ungrouped"):Me.add("ungrouped"),Me})},children:rt.ungrouped.map(le=>y(le))})]}):be.map(le=>{if(!re)return y(le);const Me=B5t(le),We=le.createdAt?f(le.createdAt):"";return l.jsxs("div",{className:ra.sessionItemReadOnly,role:"note","aria-label":`${Me}${We?`, ${We}`:""}. ${o}`,children:[l.jsx("span",{className:ra.sessionName,title:Me,children:Me}),We&&l.jsx("span",{className:ra.sessionTime,children:We})]},le.sessionId)})})]})}const mde="qwen-code-web-shell-sidebar-width",S2=260,H5t=220,xG=420,q5t=.5,U5t=344,W5t=250,pde=200,V5t=56,kG=pde-V5t,G5t=2e3,K5t=3e4,_G=96,Y5t="recent",sj=240,a1=8,rj="__custom__",l1="#416ef5";function c1(e,t){return`${t??""}\0${e}`}const X5t=["settings","version","theme","sessionsOverview","splitView","daemonStatus","collapse"],Q5t=["newTask","plugins","channels","scheduledTasks","goals"],J5t=["details","rename","group","export","delete","pin","archive"],Z5t=["pin","archive"],u1=["red","orange","yellow","green","blue","purple"];function hc(...e){return e.filter(Boolean).join(" ")}function SG(e){return e instanceof DOMException&&e.name==="AbortError"}function e6t(e){return e?e.split(/[\\/]+/).filter(Boolean).at(-1)??e:""}function k4(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function t6t(e){const t=k4(e).replace(/\s+/g," ").trim();return t.length<=_G?t:`${t.slice(0,_G-3).trimEnd()}...`}function n6t(e){if(!e.createdAt)return 0;const t=Date.parse(e.createdAt);return Number.isFinite(t)?t:0}function C2(e){return e[0]??"blue"}function u9(e){const t=e.trim();if(/^#[0-9a-f]{6}$/i.test(t))return t.toLowerCase()}function CG(e,t){const n=e.trim();return t.includes(n)?n:u9(n)}function TG(e){if(e.startsWith("#"))return Be.groupColorCustom;switch(e){case"red":return Be.groupColorRed;case"orange":return Be.groupColorOrange;case"yellow":return Be.groupColorYellow;case"green":return Be.groupColorGreen;case"blue":return Be.groupColorBlue;case"purple":return Be.groupColorPurple}}function s6t(e){return e.startsWith("#")?{backgroundColor:e}:void 0}function gde(){return typeof window>"u"?xG:Math.max(xG,Math.floor(window.innerWidth*q5t))}function Dv(e){return Math.min(gde(),Math.max(H5t,e))}function r6t(e){return Math.min(gde(),Math.max(pde,e))}function i6t(){if(typeof window>"u")return S2;try{const e=window.localStorage.getItem(mde),t=e?Number(e):S2;return Number.isFinite(t)?Dv(t):S2}catch{return S2}}function EG(e){try{window.localStorage.setItem(mde,String(Dv(e)))}catch{}}function o6t(){return l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{d:"M12 5v14M5 12h14"})})}function a6t(){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 jG({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 l6t({collapsed:e,onCollapsedChange:t,onOpenSettings:n,onOpenPlugins:s,onOpenChannels:r,onOpenDaemonStatus:i,onOpenScheduledTasks:o,onOpenGoals:a,onOpenSessions:c,canOpenSessionsOverview:u,onOpenSplitView:d,canOpenSplitView:f,onNewSession:m,onLoadSession:p,onSelectCurrentSession:g,onError:b,theme:v,onThemeChange:y,mobileOpen:w,sessionListReloadToken:x,selectedWorkspaceCwd:k,onSelectWorkspace:C,onOpenGitDiff:T,onOpenCommit:_,onOpenAddWorkspace:S,workspaces:R,lockedWorkspaceCwd:A,lockedWorkspace:O,branding:M,primaryNav:D,hideProjectHeader:$,sessionActions:z,footer:B}){var Vk,Gk,Ey,jy,Uc,Kk,Pp,ch,Yk,Ay,Ig,Ny,Xk,Qk,Jk,My,Rg,uh,Zk,e_,t_,n_;const{t:j}=lt(),H=Ra(),Q=ug(),I=pa(),J=io(),W=h.useMemo(()=>new Set(B===!1?[]:(B==null?void 0:B.items)??X5t),[B]),P=h.useMemo(()=>new Set((D==null?void 0:D.items)??Q5t),[D==null?void 0:D.items]),V=h.useMemo(()=>new Set((z==null?void 0:z.items)??J5t),[z==null?void 0:z.items]),ee=h.useMemo(()=>new Set((z==null?void 0:z.inlineItems)??Z5t),[z==null?void 0:z.inlineItems]),q=M!==!1&&!(w&&((M==null?void 0:M.hideWhenCompact)??!0)),K=!!((Gk=(Vk=H.capabilities)==null?void 0:Vk.features)!=null&&Gk.includes(NI)),de=!!((jy=(Ey=H.capabilities)==null?void 0:Ey.features)!=null&&jy.includes("session_archive")),re=!!((Kk=(Uc=H.capabilities)==null?void 0:Uc.features)!=null&&Kk.includes("workspace_qualified_rest_core")),ne=h.useMemo(()=>{var G;return R??((G=J.capabilities)==null?void 0:G.workspaces)??[]},[R,(Pp=J.capabilities)==null?void 0:Pp.workspaces]),U=ne.length>0||((ch=J.capabilities)==null?void 0:ch.workspaces)!==void 0||((Yk=H.capabilities)==null?void 0:Yk.workspaces)!==void 0,Z=((Ay=ne.find(G=>G.primary))==null?void 0:Ay.cwd)??((Ig=J.capabilities)==null?void 0:Ig.workspaceCwd)??H.workspaceCwd,ge=A?ne.find(G=>G.cwd===A):void 0,ce=!A||(ge==null?void 0:ge.primary)===!0,{sessions:ue,loading:be,error:rt,data:le,reload:Me,deleteSession:We,exportSession:at,archiveSession:ze}=V2({autoLoad:!0,enabled:ce,pageSize:Dh,archiveState:"active",...K?{view:"organized",group:"all"}:{}}),rn=!K||!ce||le!==void 0,{sessions:Wt,reload:zt}=V2({autoLoad:K,enabled:K&&ce,pageSize:Dh,archiveState:"active",view:"organized",group:"pinned"}),[ae,je]=h.useState(!1),[it,gt]=h.useState(!0),[wt,Ke]=h.useState([]),{sessions:un,loading:me,error:ht,reload:Oe,deleteSession:Ne,unarchiveSession:St}=V2({autoLoad:!0,enabled:de&&ae&&ce,pageSize:Dh,archiveState:"archived",...K?{view:"organized",group:"all"}:{}}),[Ue,ve]=h.useState([]),[Fe,ie]=h.useState(!1),[Pe,et]=h.useState(!1),[He,Ae]=h.useState(0),[vt,vn]=h.useState([]),[Ce,yt]=h.useState([]),[Ft,De]=h.useState([]),[Xe,$e]=h.useState(!1),[Ht,ke]=h.useState(null),[Fn,Ve]=h.useState(""),[ft,Lt]=h.useState(()=>new Set),gn=h.useRef(new Set),[Tn,Xn]=h.useState(()=>new Set),_r=h.useRef(new Set),[zr,Ar]=h.useState(!1),jt=h.useRef(!1),[Sn,Hn]=h.useState(null),[Ln,gs]=h.useState(null),[qn,Dn]=h.useState(null),[Rs,ts]=h.useState(""),[Bs,Sr]=h.useState("blue"),[Nr,pi]=h.useState(l1),[lr,Ds]=h.useState(null),[gi,xe]=h.useState(()=>new Set(Array.from(zP()).filter(wG))),Ye=h.useRef(new Set),st=h.useRef(!0),[Et,Mt]=h.useState(!K),[cs,bs]=h.useState(K);cs!==K&&(bs(K),Mt(!K));const[sr,Qn]=h.useState(i6t),[br,Ns]=h.useState(!1),[Fr,yr]=h.useState(!0),[Mr,Pn]=h.useState(!1),[Gs,vo]=h.useState(null),[Ks,bi]=h.useState(null),[Jn,xi]=h.useState(!1),qs=h.useRef(!1),wr=h.useRef(!1),[Hr,Ir]=h.useState(!1),[_t,Zn]=h.useState(0),[ds,Kr]=h.useState(null),_e=h.useCallback(()=>{Zn(G=>G+1)},[]);h.useEffect(()=>(qs.current=!0,()=>{qs.current=!1,wr.current=!0}),[]);const[Je,qt]=h.useState(""),[On,on]=h.useState(!1),[Le,Qt]=h.useState(()=>new Set),Un=h.useRef(null),Kn=h.useRef(!1),zs=h.useRef(null),ns=h.useRef(null),si=h.useRef(!1),Ys=h.useRef(null),Ps=H.sessionId,Xs=!!((Xk=(Ny=H.capabilities)==null?void 0:Ny.features)!=null&&Xk.includes("workspace_runtime_removal")),Ai=((Jk=(Qk=H.capabilities)==null?void 0:Qk.features)==null?void 0:Jk.includes("session_export"))??!1,oo=((Rg=(My=H.capabilities)==null?void 0:My.features)==null?void 0:Rg.includes("workspace_session_export"))??!1,xo=((Zk=(uh=H.capabilities)==null?void 0:uh.features)==null?void 0:Zk.includes("workspace_archived_session_export"))??!1,ki=Ps?c1(Ps,H.workspaceCwd||Z):null,Pa=e6t(H.workspaceCwd)||j("sidebar.projectFallback"),Yr=h.useMemo(()=>{const G=ne.length>0?ne:[{id:"primary",cwd:H.workspaceCwd||Pa,primary:!0,trusted:!0}];return A?G.filter(Ie=>Ie.cwd===A):G},[H.workspaceCwd,A,Pa,ne]),pr=h.useMemo(()=>{const G=new Map;for(const Ie of[...ce?Wt:[],...wt])G.set(c1(Ie.sessionId,Ie.workspaceCwd||Z),Ie);return[...G.values()]},[ce,Z,Wt,wt]),os=h.useCallback(G=>{const Ie=G.workspaceCwd,Re=Ie||Z||"",Ge=ne.find(mt=>mt.cwd===Re);return Ie&&!Ge?!U&&Re===Z?{kind:"primary",cwd:Re}:{kind:"unknown",cwd:Re}:Ge&&!Ge.trusted?{kind:"untrusted",cwd:Re,workspace:Ge}:Ge!=null&&Ge.primary||!Ie&&Re===Z?{kind:"primary",cwd:Re}:Ge?A===Re?{kind:"locked",cwd:Re,workspace:Ge}:{kind:"restricted",cwd:Re,workspace:Ge}:{kind:"unknown",cwd:Re}},[A,Z,U,ne]),_i=h.useCallback(G=>os(G).cwd,[os]),ri=h.useCallback(G=>G.kind==="primary"||G.kind==="locked",[]),Cu=h.useCallback(G=>G.kind==="primary"||G.kind==="locked"&&re,[re]),Ju=h.useCallback(G=>G.kind==="unknown"||G.kind==="untrusted"?!1:G.kind==="primary"||re,[re]),Fc=h.useCallback(G=>!ri(os(G)),[ri,os]),ga=h.useCallback(G=>{const Ie=os(G);if(Ie.kind==="primary")return I;if(Ie.kind==="locked"||Ie.kind==="restricted")return J.client.workspaceByCwd(Ie.cwd)},[os,J.client,I]),rr=h.useCallback(G=>c1(G.sessionId,_i(G)),[_i]),ii=h.useCallback(G=>ki===rr(G),[ki,rr]),Bi=h.useCallback(G=>V.has("rename")&&ii(G)&&ri(os(G)),[ii,ri,os,V]),el=h.useCallback(G=>V.has("delete")&&Cu(os(G)),[Cu,os,V]),qr=h.useCallback(G=>!ii(G)&&el(G),[el,ii]),se=h.useCallback((G,Ie)=>K&&V.has(Ie)&&Ju(os(G)),[Ju,K,os,V]),ye=h.useCallback(G=>os({sessionId:"",workspaceCwd:G}),[os]),fe=h.useCallback(G=>K&&V.has("group")&&Ju(ye(G)),[Ju,K,ye,V]),Qe=h.useRef(null);Qe.current={canOrganizeSession:se,getSessionWorkspaceActions:ga,resolveWorkspaceScope:ye};const tn=h.useCallback(G=>{const Ie=os(G);return Ie.kind==="unknown"||Ie.kind==="untrusted"?!1:de&&(Ie.kind==="primary"||re)},[os,de,re]),ct=h.useCallback(G=>{const Ie=os(G);if(Ie.kind==="primary"&&Ai||Ie.kind==="locked"&&oo)return Ie},[Ai,oo,os]),Dt=h.useCallback(G=>{const Ie=os(G);return xo&&Ie.kind!=="unknown"&&Ie.kind!=="untrusted"?Ie.cwd:void 0},[xo,os]),Vn=h.useCallback(G=>V.has("archive")&&!ii(G)&&tn(G),[tn,ii,V]),ps=h.useCallback(G=>V.has("archive")&&tn(G),[tn,V]);h.useEffect(()=>{if(!K){Ke([]);return}const G=Yr.filter(Re=>!Re.primary&&Re.trusted);let Ie=!1;return Promise.allSettled(G.map(async Re=>(await J.client.workspaceByCwd(Re.cwd).listWorkspaceSessions({pageSize:Dh,archiveState:"active",view:"organized",group:"pinned"})).map(mt=>({...mt,workspaceCwd:Re.cwd})))).then(Re=>{Ie||Ke(Re.flatMap(Ge=>Ge.status==="fulfilled"?Ge.value:[]))}),()=>{Ie=!0}},[Yr,K,J.client,_t]);const Ts=h.useMemo(()=>{const G=new Map;for(const Ie of[...ce?un:[],...Ue])G.set(rr(Ie),Ie);return[...G.values()]},[un,rr,ce,Ue]),hs=ce&&me||Fe,$r=ce&&!!ht||Pe;h.useEffect(()=>{if(!ae)return;if(!de||!re){ve([]),ie(!1),et(!1);return}const G=Yr.filter(Re=>!Re.primary&&Re.trusted);if(G.length===0){ve([]),ie(!1),et(!1);return}let Ie=!1;return ie(!0),Promise.allSettled(G.map(async Re=>(await J.client.workspaceByCwd(Re.cwd).listWorkspaceSessions({pageSize:Dh,archiveState:"archived",...K?{view:"organized",group:"all"}:{}})).map(mt=>({...mt,workspaceCwd:Re.cwd})))).then(Re=>{if(Ie)return;const Ge=Re.filter(mt=>mt.status==="rejected");ve(Re.flatMap(mt=>mt.status==="fulfilled"?mt.value:[])),et(Ge.length>0);for(const mt of Ge)console.warn("[WebShellSidebar] archived session load failed:",mt.reason)}).finally(()=>{Ie||ie(!1)}),()=>{Ie=!0}},[ae,Yr,K,He,de,J.client,re,_t]);const Cs=((e_=H.capabilities)==null?void 0:e_.qwenCodeVersion)||"",es=Cs?/^\d/.test(Cs)?`v${Cs}`:Cs:"",xs=!e&&sr<U5t,La=!e&&sr<W5t,vr={"--web-shell-sidebar-width":`${sr}px`},Ur=zr;h.useEffect(()=>{var Re;if(!Ps)return;const G=Yr.find(Ge=>Ge.cwd===H.workspaceCwd)??(Yr.length===1&&((Re=Yr[0])!=null&&Re.primary)?Yr[0]:void 0);if(!G)return;const Ie=`session:${Ps}:${G.id}`;ns.current!==Ie&&(ns.current=Ie,yr(!0),G.primary?Ns(!0):Kr({id:G.id,key:Ie}))},[H.workspaceCwd,Ps,Yr]),h.useEffect(()=>{if(Ps||k!==void 0||!J.capabilities)return;const G=ne.find(Re=>Re.cwd===H.workspaceCwd),Ie=`new:${(G==null?void 0:G.id)??"primary"}`;if(ns.current!==Ie){if(ns.current=Ie,yr(!0),G&&!G.primary){Ns(!1),Kr({id:G.id,key:Ie}),C==null||C(G.cwd);return}Ns(!0)}},[H.workspaceCwd,Ps,C,k,J.capabilities,ne]);const Os=h.useCallback((G,Ie,Re)=>{const Ge=c1(G,Re||Z),mt=new Set(gn.current);Ie?mt.add(Ge):mt.delete(Ge),gn.current=mt,Lt(mt)},[Z]),ko=h.useCallback(async()=>{if(!K){vn([]),De([]),Mt(!0);return}try{const G=await I.listSessionGroups();vn(G.groups),yt(G.groups),De(G.colorOptions),Mt(!0)}catch(G){b(G,j("sidebar.groupsLoadFailed"))}},[b,K,j,I]);h.useEffect(()=>{if(!K){vn([]),De([]),Mt(!0);return}Mt(!1),ko()},[K,ko]),h.useEffect(()=>{if(!Ln)return;const G=Re=>{var Ge;(Ge=Un.current)!=null&&Ge.contains(Re.target)||gs(null)},Ie=Re=>{Re.key==="Escape"&&gs(null)};return document.addEventListener("mousedown",G),document.addEventListener("keydown",Ie),()=>{document.removeEventListener("mousedown",G),document.removeEventListener("keydown",Ie)}},[Ln]),h.useEffect(()=>{if(!Ln)return;const G=window.requestAnimationFrame(()=>{var Ge;const Ie=Array.from(((Ge=Un.current)==null?void 0:Ge.querySelectorAll("button:not(:disabled)"))??[]),Re=Ie.find(mt=>mt.getAttribute("aria-checked")==="true")??Ie[0];Re==null||Re.focus()});return()=>window.cancelAnimationFrame(G)},[Ln]);const ba=h.useCallback(G=>{var xn,Nn;const Ie=Array.from(((xn=Un.current)==null?void 0:xn.querySelectorAll("button:not(:disabled)"))??[]);if(Ie.length===0)return;const Re=Ie.indexOf(document.activeElement),Ge=Re>=0?Re:-1;let mt;if(G.key==="ArrowDown")mt=(Ge+1)%Ie.length;else if(G.key==="ArrowUp")mt=(Ge-1+Ie.length)%Ie.length;else if(G.key==="Home")mt=0;else if(G.key==="End")mt=Ie.length-1;else if(G.key==="Escape"){G.preventDefault(),gs(null);return}mt!==void 0&&(G.preventDefault(),(Nn=Ie[mt])==null||Nn.focus())},[]);h.useEffect(()=>()=>{var G;(G=Ys.current)==null||G.call(Ys,!1)},[]),h.useEffect(()=>{function G(){Qn(Ie=>Dv(Ie))}return window.addEventListener("resize",G),()=>window.removeEventListener("resize",G)},[]),h.useEffect(()=>{e&&(Ns(!1),Pn(!1),qt(""))},[e]);const Oo=h.useMemo(()=>ue.some(G=>G.hasActivePrompt),[ue]);h.useEffect(()=>{if(!br&&!Oo)return;const G=Oo&&!rt?G5t:K5t,Ie=window.setInterval(()=>{document.hidden||si.current||(si.current=!0,Me().finally(()=>{si.current=!1}))},G);return()=>window.clearInterval(Ie)},[rt,Oo,br,Me]);const sc=h.useRef(x);h.useEffect(()=>{x!==void 0&&x!==sc.current&&!document.hidden&&!si.current&&(sc.current=x,si.current=!0,Me().finally(()=>{si.current=!1}))},[x,Me]),h.useEffect(()=>{const G=new Map(ue.map(Re=>[rr(Re),!!Re.hasActivePrompt])),Ie=zs.current;zs.current=G,Ie!==null&&Qt(Re=>{const Ge=new Set(Re);let mt=!1;for(const[xn,Nn]of Ie){const ws=G.get(xn);Nn&&ws===!1&&xn!==ki&&!Ge.has(xn)&&(Ge.add(xn),mt=!0)}for(const xn of Ge)(xn===ki||!G.has(xn)||G.get(xn))&&(Ge.delete(xn),mt=!0);return mt?Ge:Re})},[ki,rr,ue]);const Al=h.useCallback(async G=>{var Ie;if(qs.current){k===G.cwd&&(C==null||C(void 0)),Zn(Re=>Re+1);try{await((Ie=J.refreshCapabilities)==null?void 0:Ie.call(J))}catch{}qs.current&&(vo(null),bi(null),Ir(!1),Me().catch(()=>{}),Oe().catch(()=>{}))}},[C,Me,Oe,k,J]),kt=h.useCallback(G=>{Jn||(wr.current=!1,bi(null),Ir(!1),vo(G))},[Jn]),cn=h.useCallback(async()=>{const G=Gs;if(!G||Jn)return;const Ie=Ks!==null;if(!(Ie&&H.sessionId&&H.workspaceCwd===G.cwd)){xi(!0);try{await I.removeWorkspace(G.id,{force:Ie}),await Al(G)}catch(Re){if(!qs.current)return;if(Re instanceof Rc){const Ge=Re.body;if(Re.status===409&&(Ge==null?void 0:Ge.code)==="workspace_busy"&&Ge.activity){bi(Ge.activity);return}if(Re.status===400&&(Ge==null?void 0:Ge.code)==="workspace_mismatch"){await Al(G);return}if(Re.status===409&&((Ge==null?void 0:Ge.code)==="workspace_removal_in_progress"||(Ge==null?void 0:Ge.code)==="workspace_registration_in_progress")){Ir(!0);let mt=Re,xn=!0;for(let Nn=0;Nn<20;Nn++){if(!qs.current||wr.current||(await new Promise(ws=>window.setTimeout(ws,250)),!qs.current||wr.current))return;try{await I.removeWorkspace(G.id,{force:Ie}),await Al(G);return}catch(ws){if(!qs.current)return;if(mt=ws,ws instanceof Rc){const us=ws.body;if(ws.status===400&&(us==null?void 0:us.code)==="workspace_mismatch"){await Al(G);return}if(ws.status===409&&(us==null?void 0:us.code)==="workspace_busy"&&us.activity){Ir(!1),bi(us.activity);return}if(ws.status===409&&((us==null?void 0:us.code)==="workspace_removal_in_progress"||(us==null?void 0:us.code)==="workspace_registration_in_progress"))continue}xn=!1;break}}if(!qs.current||wr.current)return;Ir(!1),b(xn?new Error("Workspace removal remained in progress after retries."):mt,j("sidebar.removeWorkspaceError"));return}}b(Re,j("sidebar.removeWorkspaceError"))}finally{qs.current&&xi(!1)}}},[H.sessionId,H.workspaceCwd,b,Al,j,I,Ks,Gs,Jn]),En=h.useCallback(G=>{jt.current||(jt.current=!0,Ar(!0),(async()=>{try{await m(G)&&(Me().catch(()=>{}),_e())}catch(Ie){SG(Ie)||b(Ie,j("sidebar.newSessionFailed"))}finally{jt.current=!1,Ar(!1)}})())},[_e,b,m,Me,j]),jn=h.useCallback((G,Ie)=>{const Re=c1(G,Ie||Z);if(Re===ki){g==null||g();return}gn.current.has(Re)||(Qt(Ge=>{if(!Ge.has(Re))return Ge;const mt=new Set(Ge);return mt.delete(Re),mt}),Os(G,!0,Ie),(async()=>{try{await p(G,Ie)}catch(Ge){SG(Ge)||b(Ge,j("sidebar.switchFailed"))}finally{Os(G,!1,Ie)}})())},[ki,b,p,g,Z,Os,j]),Yn=h.useCallback(G=>{Bi(G)&&(ke(rr(G)),Ve(k4(G)))},[Bi,rr]),rs=h.useCallback(()=>{ke(null),Ve("")},[]);h.useEffect(()=>{const G=Ps?{sessionId:Ps,workspaceCwd:H.workspaceCwd}:void 0;Ht!==null&&(!G||Ht!==ki||!Bi(G))&&rs()},[Bi,rs,H.workspaceCwd,Ps,ki,Ht]);const ys=h.useCallback(()=>{const G=Fn.trim();if(!G||!Ps||Ht!==ki||!Bi({sessionId:Ps,workspaceCwd:H.workspaceCwd})){rs();return}const Ie=Ps,Re=ki;!Re||gn.current.has(Re)||(Os(Ie,!0,H.workspaceCwd),Q.renameSession(G).then(()=>{rs(),Me(),_e()}).catch(Ge=>{b(Ge,j("sidebar.renameFailed")),rs()}).finally(()=>{Os(Ie,!1,H.workspaceCwd)}))},[Q,_e,Bi,rs,H.workspaceCwd,ki,Ps,Fn,Ht,b,Me,Os,j]),Qs=h.useCallback(G=>{qr(G)&&Hn(G)},[qr]),Oa=h.useCallback((G,Ie,Re)=>{const Ge=c1(G,Re||Z),mt=new Set(_r.current);Ie?mt.add(Ge):mt.delete(Ge),_r.current=mt,Xn(mt)},[Z]),tl=h.useCallback(G=>{const Ie=G.sessionId,Re=rr(G),Ge=G.isArchived===!0,mt=ct(G);!V.has("export")||(Ge?!Dt(G):!mt)||_r.current.has(Re)||(Oa(Ie,!0,G.workspaceCwd),(async()=>{try{let xn;if(Ge){const us=Dt(G);if(!us)return;xn=await J.client.workspaceByCwd(us).exportArchivedSession(Ie,{format:"html"})}else if((mt==null?void 0:mt.kind)==="primary")xn=await at(Ie,"html");else if((mt==null?void 0:mt.kind)==="locked")xn=await J.client.workspaceByCwd(mt.cwd).exportSession(Ie,{format:"html"});else return;const Nn=new Blob([xn.content],{type:xn.mimeType||"text/html"}),ws=URL.createObjectURL(Nn);try{const us=document.createElement("a");us.href=ws,us.download=xn.filename,document.body.appendChild(us),us.click(),us.remove()}finally{URL.revokeObjectURL(ws)}}catch(xn){b(xn,j("sidebar.exportFailed"))}finally{Oa(Ie,!1,G.workspaceCwd)}})())},[at,ct,Dt,rr,b,Oa,V,j,J.client]),Zu=h.useCallback(()=>{if(!Sn)return;const G=Sn.sessionId,Ie=rr(Sn);if(!qr(Sn)){Hn(null);return}const Re=os(Sn),Ge=!!Sn.isArchived,mt=Re.kind==="locked"?async xn=>{const ws=(await J.client.workspaceByCwd(Re.cwd).deleteSessionsData([xn])).errors.find(us=>us.sessionId===xn);if(ws)throw new Error(ws.error)}:Re.kind==="primary"?Ge?Ne:We:void 0;Hn(null),mt&&(gn.current.has(Ie)||(Os(G,!0,Sn.workspaceCwd),mt(G).then(()=>{Me(),Oe(),_e()}).catch(xn=>b(xn,j("sidebar.deleteFailed"))).finally(()=>{Os(G,!1,Sn.workspaceCwd)})))},[_e,qr,Ne,Sn,We,rr,b,Me,Oe,os,Os,j,J.client]),ed=h.useCallback(G=>{ii(G)&&Yn(G)},[ii,Yn]),Cg=h.useCallback(()=>{fe()&&(gs(null),ts(""),Sr(C2(Ft)),pi(l1),Dn({mode:"create"}))},[fe,Ft]),G5=h.useCallback(G=>{fe(G)&&(async()=>{try{const Ie=await J.client.workspaceByCwd(G).listSessionGroups();gs(null),ts(""),Sr(C2(Ie.colorOptions)),pi(l1),Dn({mode:"create",workspaceCwd:G})}catch(Ie){b(Ie,j("sidebar.groupsLoadFailed"))}})()},[fe,b,j,J.client]),Bk=h.useCallback(G=>{se(G,"group")&&(gs(null),ts(""),Sr(C2(Ft)),pi(l1),Dn({mode:"create",targetSession:G,workspaceCwd:G.workspaceCwd}))},[se,Ft]),_y=h.useCallback((G,Ie)=>{fe(Ie)&&(ts(G.name),Sr(G.color),pi(u9(G.color)??l1),Dn({mode:"edit",group:G,workspaceCwd:Ie}))},[fe]),Tg=h.useCallback(()=>{Xe||(Dn(null),ts(""),Sr(C2(Ft)),pi(l1))},[Ft,Xe]),K5=h.useCallback(()=>{if(!qn)return;if(!fe(qn.workspaceCwd)||qn.targetSession&&!se(qn.targetSession,"group")){Tg();return}const G=Rs.trim(),Ie=CG(Bs,Ft.length>0?Ft:u1);!G||!Ie||(async()=>{$e(!0);const Re=Ge=>{Dn(null),ts(""),qn.workspaceCwd?_e():ko().catch(()=>{}),b(Ge,j("sidebar.groupAssignFailedAfterCreate"))};try{const Ge=ye(qn.workspaceCwd),mt=Ge.kind==="primary"?I:Ge.kind==="locked"||Ge.kind==="restricted"?J.client.workspaceByCwd(Ge.cwd):void 0;if(!mt)return;const xn=qn.mode==="create"?await mt.createSessionGroup({name:G,color:Ie}):await mt.updateSessionGroup(qn.group.id,{name:G,color:Ie});if(qn.mode==="create"&&qn.targetSession)try{const Nn=Qe.current,ws=Nn==null?void 0:Nn.resolveWorkspaceScope(qn.targetSession.workspaceCwd);if(!Nn||!ws||!Nn.canOrganizeSession(qn.targetSession,"group")||ws.kind!==Ge.kind||ws.cwd!==Ge.cwd){Re(new Error(j("sidebar.groupAssignFailedAfterCreate")));return}const us=Nn.getSessionWorkspaceActions(qn.targetSession);if(!us){Re(new Error(j("sidebar.groupAssignFailedAfterCreate")));return}await us.updateSessionOrganization(qn.targetSession.sessionId,{groupId:xn.id,color:null}),qn.workspaceCwd||Me().catch(()=>{}),_e()}catch(Nn){Re(Nn);return}Dn(null),ts(""),qn.workspaceCwd?_e():ko().catch(()=>{})}catch(Ge){b(Ge,qn.mode==="create"?j("sidebar.groupCreateFailed"):j("sidebar.groupUpdateFailed"))}finally{$e(!1)}})()},[_e,Ft,Bs,qn,Rs,se,fe,Tg,b,Me,ko,ye,j,I,J.client]),Ip=h.useCallback((G,Ie)=>{fe(Ie)&&Ds({group:G,workspaceCwd:Ie})},[fe]),Eg=h.useCallback(()=>{if(!lr)return;if(!fe(lr.workspaceCwd)){Ds(null);return}$e(!0);const G=ye(lr.workspaceCwd),Ie=G.kind==="primary"?I:G.kind==="locked"||G.kind==="restricted"?J.client.workspaceByCwd(G.cwd):void 0;if(!Ie){$e(!1);return}Ie.deleteSessionGroup(lr.group.id).then(()=>{Ds(null),lr.workspaceCwd?_e():Me().catch(()=>{})}).catch(Re=>b(Re,j("sidebar.groupDeleteFailed"))).then(()=>lr.workspaceCwd?void 0:ko().catch(()=>{})).finally(()=>$e(!1))},[lr,fe,b,Me,ko,j,_e,ye,J.client,I]);h.useEffect(()=>{Sn&&!qr(Sn)&&Hn(null)},[qr,Sn]),h.useEffect(()=>{Ln&&!se(Ln.session,"group")&&gs(null)},[se,Ln]),h.useEffect(()=>{qn&&(!fe(qn.workspaceCwd)||qn.targetSession&&!se(qn.targetSession,"group"))&&(Dn(null),ts(""))},[se,fe,qn]),h.useEffect(()=>{lr&&!fe(lr.workspaceCwd)&&Ds(null)},[fe,lr]);const jg=h.useCallback(G=>{const Ie=G.sessionId,Re=rr(G);if(!se(G,"pin")||gn.current.has(Re))return;Os(Ie,!0,G.workspaceCwd);const Ge=ga(G);if(!Ge){Os(Ie,!1,G.workspaceCwd);return}Ge.updateSessionOrganization(Ie,{isPinned:!G.isPinned}).then(()=>{Me().catch(()=>{}),zt().catch(()=>{}),_e()}).catch(mt=>b(mt,j("sidebar.organizationFailed"))).finally(()=>{Os(Ie,!1,G.workspaceCwd)})},[_e,rr,ga,b,se,Me,zt,Os,j]),td=h.useCallback(G=>{const Ie=G.sessionId,Re=rr(G);Vn(G)&&(gn.current.has(Re)||(Os(Ie,!0,G.workspaceCwd),(async()=>{try{const Ge=os(G);if(Ge.kind==="locked"||Ge.kind==="restricted"){const xn=(await J.client.workspaceByCwd(Ge.cwd).archiveSessionsData([Ie])).errors.find(Nn=>Nn.sessionId===Ie);xn&&b(new Error(xn.error),j("sidebar.archiveFailed"))}else if(Ge.kind==="primary")await ze(Ie);else return}catch(Ge){b(Ge,j("sidebar.archiveFailed"))}finally{Me().catch(()=>{}),Oe().catch(()=>{}),_e(),Os(Ie,!1,G.workspaceCwd)}})()))},[ze,_e,Vn,rr,b,Me,Oe,Os,j,os,J.client]),jf=h.useCallback(G=>{const Ie=G.sessionId,Re=rr(G);ps(G)&&(gn.current.has(Re)||(Os(Ie,!0,G.workspaceCwd),(async()=>{try{const Ge=os(G);if(Ge.kind==="locked"||Ge.kind==="restricted"){const xn=(await J.client.workspaceByCwd(Ge.cwd).unarchiveSessionsData([Ie])).errors.find(Nn=>Nn.sessionId===Ie);xn&&b(new Error(xn.error),j("sidebar.unarchiveFailed"))}else if(Ge.kind==="primary")await St(Ie);else return}catch(Ge){b(Ge,j("sidebar.unarchiveFailed"))}finally{Me().catch(()=>{}),Oe().catch(()=>{}),_e(),Os(Ie,!1,G.workspaceCwd)}})()))},[_e,ps,rr,b,Me,Oe,Os,j,St,os,J.client]),Sy=h.useCallback(async(G,Ie)=>{if(!se(Ie,"group"))return;let Re=0;try{const Nl=ga(Ie);if(!Nl)return;const Wc=await Nl.listSessionGroups();if(!se(Ie,"group"))return;yt(Wc.groups),De(Wc.colorOptions),Re=Wc.groups.length}catch(Nl){b(Nl,j("sidebar.groupsLoadFailed"));return}if(!G.isConnected)return;const Ge=G.getBoundingClientRect(),mt=typeof window>"u"?Ge.right+sj:window.innerWidth,xn=typeof window>"u"?Ge.top+320:window.innerHeight,Nn=Math.min(320,34*(Re+u1.length+2)+25),ws=Ge.right+a1+sj<=mt?Ge.right+a1:Math.max(a1,Ge.left-sj-a1),us=Math.max(a1,Math.min(Ge.top,xn-Nn-a1));gs({session:Ie,top:us,left:ws})},[se,ga,b,j]),Hc=h.useCallback((G,Ie)=>{const Re=G.sessionId,Ge=rr(G);if(!se(G,"group")||gn.current.has(Ge))return;gs(null),Os(Re,!0,G.workspaceCwd);const mt=ga(G);if(!mt){Os(Re,!1,G.workspaceCwd);return}mt.updateSessionOrganization(Re,{groupId:Ie,color:null}).then(()=>{Me().catch(()=>{}),_e()}).catch(xn=>b(xn,j("sidebar.organizationFailed"))).finally(()=>{Os(Re,!1,G.workspaceCwd)})},[_e,rr,ga,b,se,Me,Os,j]),Ag=h.useCallback((G,Ie)=>{const Re=G.sessionId,Ge=rr(G);if(!se(G,"group")||gn.current.has(Ge))return;gs(null),Os(Re,!0,G.workspaceCwd);const mt=ga(G);if(!mt){Os(Re,!1,G.workspaceCwd);return}mt.updateSessionOrganization(Re,{color:Ie,groupId:null}).then(()=>{Me().catch(()=>{}),_e()}).catch(xn=>b(xn,j("sidebar.organizationFailed"))).finally(()=>{Os(Re,!1,G.workspaceCwd)})},[_e,rr,ga,b,se,Me,Os,j]),oh=h.useMemo(()=>{const G=Je.trim().toLowerCase(),Ie=ue.filter(mt=>!mt.isPinned),Re=G?Ie.filter(mt=>k4(mt).toLowerCase().includes(G)||mt.sessionId.toLowerCase().includes(G)):Ie.slice();if(K)return Re;const Ge=new Map(Re.map(mt=>[mt.sessionId,n6t(mt)]));return Re.sort((mt,xn)=>(Ge.get(xn.sessionId)??0)-(Ge.get(mt.sessionId)??0))},[K,Je,ue]),ah=h.useMemo(()=>{if(!K)return[];const G=Je.trim().length>0,Ie=new Set(vt.map(Nn=>Nn.id)),Re=new Map,Ge=new Map;for(const Nn of vt)Ge.set(Nn.id,[]);const mt=[];for(const Nn of oh){if(Nn.color&&u1.includes(Nn.color)){const us=Re.get(Nn.color)??[];us.push(Nn),Re.set(Nn.color,us);continue}const ws=Nn.groupId&&Ie.has(Nn.groupId)?Ge.get(Nn.groupId):void 0;ws?ws.push(Nn):mt.push(Nn)}const xn=[];for(const Nn of u1){const ws=Re.get(Nn);!ws||ws.length===0||xn.push({id:`color:${Nn}`,kind:"color",label:j(`sidebar.groupColor.${Nn}`),countLabel:String(ws.length),color:Nn,sessions:ws})}for(const Nn of vt){const ws=Ge.get(Nn.id)??[];G&&ws.length===0||xn.push({id:`group:${Nn.id}`,kind:"group",label:Nn.name,countLabel:String(ws.length),color:Nn.color,group:Nn,sessions:ws})}return mt.length>0&&xn.length>0&&xn.push({id:Y5t,kind:"recent",label:j("sidebar.groupUngrouped"),countLabel:String(mt.length),sessions:mt}),xn},[oh,vt,K,Je,j]);h.useEffect(()=>{if(!K||!Et||!rn)return;const G=ah.map(Re=>Re.id).filter(Re=>!Ye.current.has(Re));if(st.current){st.current=!1;for(const Re of G)Ye.current.add(Re);return}if(G.length!==0){for(const Re of G)Ye.current.add(Re);xe(Re=>{const Ge=new Set(Re);for(const mt of G)Ge.add(mt);return Ge})}},[Et,K,ah,rn]),h.useEffect(()=>{fde(gi,wG)},[gi]);const Ng=h.useCallback(G=>{xe(Ie=>{const Re=new Set(Ie);return Re.has(G)?Re.delete(G):Re.add(G),Re})},[]),Cy=h.useCallback(G=>{var nd;if(e)return;G.preventDefault(),(nd=Ys.current)==null||nd.call(Ys,!0),on(!0);const Ie=G.clientX,Re=sr,Ge=document.body.style.cursor,mt=document.body.style.userSelect;let xn=!1,Nn=()=>{};document.body.style.cursor="col-resize",document.body.style.userSelect="none";try{G.currentTarget.setPointerCapture(G.pointerId)}catch{}function ws(Zo){return Re+Zo-Ie}function us(){const Zo=Dv(Re);Qn(Zo),EG(Zo)}function Nl(){xn||(xn=!0,us(),Nn(!0),t(!0))}function Wc(Zo){const $a=ws(Zo.clientX);if($a<=kG){Nl();return}Qn(r6t($a))}Nn=function($a){document.body.style.cursor=Ge,document.body.style.userSelect=mt,window.removeEventListener("pointermove",Wc),window.removeEventListener("pointerup",Vc),window.removeEventListener("pointercancel",ai),Ys.current=null,$a&&on(!1)};function Vc(Zo){const $a=ws(Zo.clientX);if($a<=kG){Nl();return}const dh=Dv($a);Qn(dh),EG(dh),Nn(!0)}function ai(){Nn(!0)}Ys.current=Nn,window.addEventListener("pointermove",Wc),window.addEventListener("pointerup",Vc,{once:!0}),window.addEventListener("pointercancel",ai,{once:!0})},[e,t,sr]),zk=Sn?t6t(Sn):"",Rp=Ln!=null&&Ln.session.color&&u1.includes(Ln.session.color)?Ln.session.color:null,Mg=!Rp&&(Ln!=null&&Ln.session.groupId)&&Ce.some(G=>G.id===Ln.session.groupId)?Ln.session.groupId:null,Y5=Ft.length>0?Ft:u1,Ty=Mg===null&&Rp===null,Fk=(lr==null?void 0:lr.group.name)??"",lh=Ft.length>0?Ft:["blue"],Dp=CG(Bs,lh),Hk=!lh.includes(Bs),qk=Rs.trim().length>0&&Dp!==void 0&&!Xe,Uk=(qn==null?void 0:qn.mode)==="create"?j("sidebar.groupCreate"):j("sidebar.groupRename"),qc=h.useCallback((G,Ie={})=>{const{isArchived:Re=!1}=Ie,Ge=Ie.readOnly??Fc(G),mt=rr(G),xn=k4(G),Nn=G.updatedAt||G.createdAt,ws=Nn?Lx(Nn,j):"",us=ft.has(mt),Nl=Tn.has(mt),Wc=!ii(G)&&Le.has(mt),Vc=l.jsxs("div",{className:Be.tooltipContent,children:[l.jsx("div",{className:Be.tooltipTitle,children:xn}),l.jsxs("div",{className:Be.tooltipTags,children:[G.hasActivePrompt&&l.jsx("span",{className:hc(Be.tooltipTag,Be.tooltipTagRunning),children:j("sidebar.running")}),Wc&&l.jsx("span",{className:hc(Be.tooltipTag,Be.tooltipTagNew),children:j("sidebar.completedUnread")}),l.jsx("span",{className:Be.tooltipTag,children:j("sidebar.clients",{count:G.clientCount??0})})]}),l.jsx("div",{className:Be.tooltipMeta,children:G.sessionId})]});if(Re){const Wr=Dt(G),$o=V.has("details"),$p=V.has("export")&&!!Wr,yi=ps(G),Il=qr(G),s_=$o||$p||yi||Il;return l.jsxs("div",{className:hc(Be.sessionRow,Be.archivedRow,us&&Be.busySession),children:[l.jsx("span",{className:Be.sessionText,title:xn,children:xn}),l.jsxs("div",{className:Be.sessionMetaSlot,children:[l.jsx("span",{className:Be.sessionTime,children:ws}),s_&&l.jsx("div",{className:Be.sessionActions,onClick:Bo=>Bo.stopPropagation(),onKeyDown:Bo=>Bo.stopPropagation(),children:l.jsxs(Hh,{children:[l.jsx(qh,{asChild:!0,children:l.jsx("button",{className:Be.sessionActionButton,type:"button","aria-label":j("sidebar.moreActions"),title:j("sidebar.moreActions"),children:l.jsx(fm,{})})}),l.jsx(Uh,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{Kn.current=!0},onCloseAutoFocus:Bo=>{Kn.current&&(Kn.current=!1,Bo.preventDefault())},children:l.jsxs(Lm,{children:[$o&&l.jsxs(VM,{children:[l.jsxs(GM,{children:[l.jsx(cC,{}),j("sidebar.details")]}),l.jsx(KM,{className:"min-w-64 p-3",children:Vc})]}),$p&&l.jsxs(ho,{disabled:Nl,onSelect:()=>tl(G),children:[l.jsx(R8,{}),j("sidebar.export")]}),yi&&l.jsxs(ho,{onSelect:()=>jf(G),children:[l.jsx(Mbe,{}),j("sidebar.unarchive")]}),Il&&l.jsxs(ho,{variant:"destructive",onSelect:()=>Qs(G),children:[l.jsx(mm,{}),j("sidebar.delete")]})]})})]})})]})]},mt)}const ai=ii(G),nd=ai&&Ht===mt,Zo=!G.isWaitingForPermission&&G.isWaitingForUserQuestion,$a=G.isWaitingForPermission?j("sidebar.waitingForApproval"):Zo?j("sidebar.userInputNeeded"):null,dh=!Fc(G),Af=se(G,"pin"),Ml=V.has("archive")&&tn(G),Qi=V.has("rename")&&dh,Lp=ct(G),Iy=V.has("export")&&!!Lp,Op=el(G);return l.jsx("div",{className:hc(Be.sessionRow,ai&&Be.currentSession,G.isPinned&&Be.pinnedSession,G.hasActivePrompt&&Be.runningSession,us&&Be.busySession),role:"button",tabIndex:0,"aria-current":ai?"page":void 0,onClick:()=>jn(G.sessionId,G.workspaceCwd),onDoubleClick:()=>{!e&&Bi(G)&&Yn(G)},onKeyDown:Wr=>{Wr.key==="Enter"&&jn(G.sessionId,G.workspaceCwd)},children:!e&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Be.sessionStatusSlot,children:Wc?l.jsx("span",{className:Be.sessionStatusDot,"aria-hidden":"true"}):null}),nd&&Bi(G)?l.jsx("form",{className:Be.renameForm,onClick:Wr=>Wr.stopPropagation(),onSubmit:Wr=>{Wr.preventDefault(),ys()},children:l.jsx("input",{autoFocus:!0,className:Be.renameInput,value:Fn,onChange:Wr=>Ve(Wr.target.value),onBlur:rs,onKeyDown:Wr=>{Wr.key==="Escape"&&(Wr.preventDefault(),rs())}})}):l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:Be.sessionText,title:xn,children:[G.worktree&&l.jsx(lC,{size:11,strokeWidth:1.5,className:Be.sessionBadgeIcon,"aria-label":j("sidebar.newWorktreeTask")}),G.branch&&l.jsx(aC,{size:11,strokeWidth:1.5,className:Be.sessionBadgeIcon,"aria-label":G.branch.name}),xn]}),l.jsxs("div",{className:Be.sessionMetaSlot,children:[$a&&l.jsx("span",{className:hc(Be.sessionAttention,Zo&&Be.sessionAttentionUserInput),"aria-label":$a,children:$a}),G.hasActivePrompt?l.jsx("span",{className:Be.sessionLoading,"aria-label":j("sidebar.running")}):$a?null:l.jsx("span",{className:Be.sessionTime,children:ws}),Ge&&Ml&&l.jsx("div",{className:Be.sessionActions,onClick:Wr=>Wr.stopPropagation(),onKeyDown:Wr=>Wr.stopPropagation(),children:ee.has("archive")?l.jsx("button",{className:Be.sessionActionButton,type:"button",disabled:us||ai,"aria-label":j("sidebar.archive"),title:j(ai?"sidebar.archiveCurrentDisabled":"sidebar.archive"),onClick:()=>td(G),children:l.jsx(sS,{})}):l.jsxs(Hh,{children:[l.jsx(qh,{asChild:!0,children:l.jsx("button",{className:Be.sessionActionButton,type:"button","aria-label":j("sidebar.moreActions"),title:j("sidebar.moreActions"),children:l.jsx(fm,{})})}),l.jsx(Uh,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{Kn.current=!0},onCloseAutoFocus:Wr=>{Kn.current&&(Kn.current=!1,Wr.preventDefault())},children:l.jsx(Lm,{children:l.jsxs(ho,{disabled:us||ai,title:ai?j("sidebar.archiveCurrentDisabled"):void 0,onSelect:()=>td(G),children:[l.jsx(sS,{}),j("sidebar.archive")]})})})]})}),(!Ge||Af)&&l.jsxs("div",{className:Be.sessionActions,onClick:Wr=>Wr.stopPropagation(),onKeyDown:Wr=>Wr.stopPropagation(),children:[[{key:"pin",icon:l.jsx(UB,{size:16,strokeWidth:1.2}),label:G.isPinned?j("sidebar.unpin"):j("sidebar.pin"),disabled:us,active:G.isPinned,visible:Af&&ee.has("pin"),onClick:()=>jg(G)},{key:"archive",icon:l.jsx(sS,{size:16,strokeWidth:1.2}),label:j("sidebar.archive"),disabled:us||ai,title:j(ai?"sidebar.archiveCurrentDisabled":"sidebar.archive"),visible:Ml&&ee.has("archive"),onClick:()=>td(G)},{key:"rename",icon:l.jsx(Sb,{size:16,strokeWidth:1.2}),label:j("sidebar.rename"),disabled:!ai,title:ai?void 0:j("sidebar.renameCurrentOnly"),visible:Qi&&ee.has("rename"),onClick:()=>ed(G)},{key:"export",icon:l.jsx(R8,{size:16,strokeWidth:1.2}),label:j("sidebar.export"),disabled:Nl,visible:Iy&&ee.has("export"),onClick:()=>tl(G)},{key:"delete",icon:l.jsx(mm,{size:16,strokeWidth:1.2}),label:j("sidebar.delete"),disabled:ai,destructive:!0,title:ai?j("sidebar.currentDeleteDisabled"):void 0,visible:Op&&ee.has("delete"),onClick:()=>Qs(G)}].filter($o=>$o.visible).map($o=>l.jsx("button",{className:hc(Be.sessionActionButton,$o.active&&Be.activeSessionActionButton),type:"button",disabled:$o.disabled,"aria-label":$o.label,title:$o.title??$o.label,onClick:$o.onClick,style:$o.destructive&&!$o.disabled?{color:"var(--destructive, #dc2626)"}:void 0,children:$o.icon??l.jsx("span",{style:{fontSize:12},children:$o.label})},$o.key)),Af&&!ee.has("pin")||Ml&&!ee.has("archive")||V.has("details")||Qi&&!ee.has("rename")||se(G,"group")||Iy&&!ee.has("export")||Op&&!ee.has("delete")?l.jsxs(Hh,{children:[l.jsx(qh,{asChild:!0,children:l.jsx("button",{className:Be.sessionActionButton,type:"button","aria-label":j("sidebar.moreActions"),title:j("sidebar.moreActions"),children:l.jsx(fm,{})})}),l.jsx(Uh,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{Kn.current=!0},onCloseAutoFocus:Wr=>{Kn.current&&(Kn.current=!1,Wr.preventDefault())},children:l.jsxs(Lm,{children:[Af&&!ee.has("pin")&&l.jsxs(ho,{disabled:us,onSelect:()=>jg(G),children:[l.jsx(UB,{}),G.isPinned?j("sidebar.unpin"):j("sidebar.pin")]}),Ml&&!ee.has("archive")&&l.jsxs(ho,{disabled:us||ai,title:ai?j("sidebar.archiveCurrentDisabled"):void 0,onSelect:()=>td(G),children:[l.jsx(sS,{}),j("sidebar.archive")]}),V.has("details")&&l.jsxs(VM,{children:[l.jsxs(GM,{children:[l.jsx(cC,{}),j("sidebar.details")]}),l.jsx(KM,{className:"min-w-64 p-3",children:Vc})]}),Qi&&!ee.has("rename")&&l.jsxs(ho,{disabled:!ai,title:ai?void 0:j("sidebar.renameCurrentOnly"),onSelect:()=>ed(G),children:[l.jsx(Sb,{}),j("sidebar.rename")]}),se(G,"group")&&l.jsxs(ho,{disabled:us,onSelect:Wr=>Sy(Wr.currentTarget,G),children:[l.jsx(Sye,{}),j("sidebar.sessionGroup")]}),Iy&&!ee.has("export")&&l.jsxs(ho,{disabled:Nl,onSelect:()=>tl(G),children:[l.jsx(R8,{}),j("sidebar.export")]}),Op&&!ee.has("delete")&&l.jsxs(ho,{variant:"destructive",disabled:ai,title:ai?j("sidebar.currentDeleteDisabled"):void 0,onSelect:()=>Qs(G),children:[l.jsx(mm,{}),j("sidebar.delete")]})]})})]}):null]})]})]})]})},mt)},[ft,qr,el,se,Bi,ps,tn,rs,e,Le,Fn,Ht,Tn,Dt,ct,rr,td,Qs,tl,jn,ed,jg,jf,ii,Sy,ys,V,ee,Fc,Yn,j]),oi=h.useMemo(()=>be&&ue.length===0?l.jsx("div",{className:Be.notice,children:j("sidebar.loadingSessions")}):rt&&ue.length===0?l.jsx("button",{className:Be.retry,type:"button",onClick:Me,children:j("sidebar.loadFailed")}):oh.length===0&&(Je.trim()||!K||ah.length===0)?l.jsx("div",{className:Be.notice,children:j("sidebar.searchEmpty")}):K?ah.length===0?oh.map(G=>qc(G)):ah.map(G=>{const Ie=!gi.has(G.id),Re=G.group;return l.jsx(c9,{id:G.id,label:G.label,count:G.sessions.length,color:G.color,expanded:Ie,onToggle:()=>Ng(G.id),onRename:G.kind==="group"&&Re&&fe()?()=>_y(Re):void 0,onDelete:G.kind==="group"&&Re&&fe()?()=>Ip(Re):void 0,renameLabel:j("sidebar.groupRename"),deleteLabel:j("sidebar.groupDelete"),actionsDisabled:Xe,children:G.sessions.map(Ge=>qc(Ge))},G.id)}):oh.map(G=>qc(G)),[gi,fe,rt,oh,Xe,Ip,_y,be,K,Me,qc,Je,ah,ue.length,j,Ng]),Wk=h.useMemo(()=>{if(!de||e||Je.trim())return null;const G=l.jsxs("button",{type:"button",className:Be.archivedHeader,"aria-expanded":ae,onClick:()=>je(Ge=>!Ge),children:[l.jsx("span",{className:Be.archivedTitle,style:{flex:"0 1 auto"},children:j("sidebar.archivedTitle")}),l.jsx("span",{className:Be.archivedChevron,"aria-hidden":"true",children:ae?l.jsx(gc,{}):l.jsx(ok,{})}),ae&&Ts.length>0&&l.jsx("span",{className:Be.archivedCount,children:Ts.length})]});if(!ae)return l.jsx("div",{className:Be.archivedSection,children:G});const Ie=l.jsx("button",{className:Be.retry,type:"button",onClick:()=>{Oe(),Ae(Ge=>Ge+1)},children:j("sidebar.loadFailed")});let Re;return hs&&Ts.length===0?Re=l.jsx("div",{className:Be.notice,children:j("sidebar.loadingSessions")}):$r&&Ts.length===0?Re=Ie:Ts.length===0?Re=l.jsx("div",{className:Be.notice,children:j("sidebar.archivedEmpty")}):Re=l.jsxs(l.Fragment,{children:[Ts.map(Ge=>qc(Ge,{isArchived:!0})),$r&&Ie]}),l.jsxs("div",{className:Be.archivedSection,children:[G,l.jsx("div",{className:Be.archivedList,children:Re})]})},[ae,Ts,e,$r,hs,Oe,qc,Je,de,Ae,j]);return l.jsx(l.Fragment,{children:l.jsxs("aside",{className:hc(Be.sidebar,e&&Be.collapsed,On&&Be.resizing,w&&Be.mobileOpen),"aria-label":j("sidebar.label"),style:vr,children:[Ln&&l.jsxs("div",{ref:Un,className:Be.groupMenu,role:"menu","aria-label":j("sidebar.sessionGroup"),style:{top:Ln.top,left:Ln.left},onClick:G=>G.stopPropagation(),onKeyDown:ba,onMouseDown:G=>G.stopPropagation(),children:[l.jsxs("button",{className:hc(Be.groupMenuItem,Ty&&Be.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":Ty,onClick:()=>Hc(Ln.session,null),children:[l.jsx("span",{className:Be.groupMenuEmptyDot}),l.jsx("span",{className:Be.groupMenuName,children:j("sidebar.groupUngrouped")}),Ty&&l.jsx("span",{className:Be.groupMenuCheck,children:"✓"})]}),Y5.map(G=>{const Ie=Rp===G;return l.jsxs("button",{className:hc(Be.groupMenuItem,Ie&&Be.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":Ie,onClick:()=>Ag(Ln.session,G),children:[l.jsx("span",{className:hc(Be.groupMenuDot,TG(G))}),l.jsx("span",{className:Be.groupMenuName,children:j(`sidebar.groupColor.${G}`)}),Ie&&l.jsx("span",{className:Be.groupMenuCheck,children:"✓"})]},`color:${G}`)}),Ce.map(G=>{const Ie=Mg===G.id;return l.jsxs("button",{className:hc(Be.groupMenuItem,Ie&&Be.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":Ie,onClick:()=>Hc(Ln.session,G.id),children:[l.jsx("span",{className:hc(Be.groupMenuDot,TG(G.color)),style:s6t(G.color)}),l.jsx("span",{className:Be.groupMenuName,children:G.name}),Ie&&l.jsx("span",{className:Be.groupMenuCheck,children:"✓"})]},G.id)}),l.jsx("div",{className:Be.groupMenuSeparator}),l.jsxs("button",{className:Be.groupMenuItem,type:"button",role:"menuitem",onClick:()=>Bk(Ln.session),children:[l.jsx("span",{className:Be.groupMenuIcon,children:l.jsx(o6t,{})}),l.jsx("span",{className:Be.groupMenuName,children:j("sidebar.groupCreate")})]})]}),Sn&&l.jsx(Ii,{title:j("delete.title"),size:"sm",onClose:()=>Hn(null),children:l.jsxs("div",{className:Be.confirmContent,children:[l.jsx("p",{className:Be.confirmDescription,children:j("sidebar.deleteConfirmDescription",{name:zk})}),l.jsxs("div",{className:Be.confirmActions,children:[l.jsx("button",{className:Be.secondaryButton,type:"button",onClick:()=>Hn(null),children:j("common.cancel")}),l.jsx("button",{className:Be.dangerButton,type:"button",onClick:Zu,children:j("sidebar.delete")})]})]})}),Gs&&l.jsx(Ii,{title:j("sidebar.removeWorkspaceTitle"),size:"sm",onClose:()=>{(!Jn||Hr)&&(wr.current=!0,vo(null),bi(null),Ir(!1))},children:l.jsxs("div",{className:Be.confirmContent,children:[l.jsx("p",{className:Be.confirmDescription,children:Ks?j("sidebar.removeWorkspaceBusy",{name:Gs.cwd}):j("sidebar.removeWorkspaceConfirm",{name:Gs.cwd})}),Ks&&l.jsxs("ul",{className:Be.workspaceRemovalActivityList,children:[l.jsx("li",{children:j("sidebar.removeWorkspaceSessions",{count:Ks.sessions})}),l.jsx("li",{children:j("sidebar.removeWorkspacePrompts",{count:Ks.activePrompts})}),l.jsx("li",{children:j("sidebar.removeWorkspaceStarts",{count:Ks.pendingSessionStarts})}),l.jsx("li",{children:j("sidebar.removeWorkspaceConnections",{count:Ks.acpConnections})}),l.jsx("li",{children:j("sidebar.removeWorkspaceMemoryTasks",{count:Ks.memoryTasks})}),l.jsx("li",{children:j("sidebar.removeWorkspaceWorkers",{count:Ks.channelWorkers})}),l.jsx("li",{children:j("sidebar.removeWorkspaceVoiceSessions",{count:Ks.voiceSessions??0})})]}),Ks&&H.sessionId&&H.workspaceCwd===Gs.cwd&&l.jsx("p",{className:Be.confirmDescription,children:j("sidebar.removeWorkspaceCurrentSession")}),Hr&&l.jsx("p",{className:Be.confirmDescription,children:j("sidebar.removeWorkspaceInProgress")}),l.jsxs("div",{className:Be.confirmActions,children:[l.jsx("button",{className:Be.secondaryButton,type:"button",disabled:Jn&&!Hr,onClick:()=>{wr.current=!0,vo(null),bi(null),Ir(!1)},children:j("common.cancel")}),l.jsx("button",{className:Be.dangerButton,type:"button",disabled:Jn||Hr||Ks!==null&&!!H.sessionId&&H.workspaceCwd===Gs.cwd,onClick:()=>void cn(),children:j(Ks?"sidebar.forceRemoveWorkspace":"sidebar.removeWorkspace")})]})]})}),qn&&l.jsx(Ii,{title:Uk,size:"sm",onClose:Tg,children:l.jsxs("form",{className:"flex flex-col gap-6",onSubmit:G=>{G.preventDefault(),K5()},children:[l.jsxs(hb,{children:[l.jsxs(to,{children:[l.jsx(qo,{htmlFor:"session-group-name",children:j("sidebar.groupNamePrompt")}),l.jsx(Pr,{id:"session-group-name",value:Rs,autoFocus:!0,maxLength:64,onChange:G=>ts(G.target.value)})]}),l.jsxs(to,{children:[l.jsx(qo,{htmlFor:"session-group-color",children:j("sidebar.groupColor")}),l.jsxs(xl,{value:Hk?rj:Bs,onValueChange:G=>{Sr(G===rj?Nr:G)},children:[l.jsx(_l,{id:"session-group-color",className:"w-full",children:l.jsx(kl,{})}),l.jsx(Sl,{children:l.jsxs(aie,{children:[lh.map(G=>l.jsx(Ti,{value:G,children:j(`sidebar.groupColor.${G}`)},G)),l.jsx(Ti,{value:rj,children:j("sidebar.groupColor.custom")})]})})]})]}),Hk&&l.jsxs(to,{children:[l.jsx(qo,{htmlFor:"session-group-hex-color",children:j("sidebar.groupColor.hex")}),l.jsxs("div",{className:Be.groupCustomColorRow,children:[l.jsx(Pr,{className:Be.groupColorPicker,type:"color",value:Nr,"aria-label":j("sidebar.groupColor.picker"),onChange:G=>{const Ie=G.target.value.toLowerCase();pi(Ie),Sr(Ie)}}),l.jsx(Pr,{id:"session-group-hex-color",value:Bs,maxLength:7,spellCheck:!1,"aria-invalid":Dp===void 0,onChange:G=>{const Ie=G.target.value,Re=Ie.trim(),Ge=Re&&!Re.startsWith("#")?`#${Re}`:Ie;Sr(Ge);const mt=u9(Ge);mt&&pi(mt)}})]}),Dp===void 0&&l.jsx("span",{className:Be.groupColorError,role:"alert",children:j("sidebar.groupColor.invalid")})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Jt,{type:"button",variant:"outline",disabled:Xe,onClick:Tg,children:j("common.cancel")}),l.jsx(Jt,{type:"submit",disabled:!qk,children:j("common.save")})]})]})}),lr&&l.jsx(Ii,{title:j("sidebar.groupDelete"),size:"sm",onClose:()=>{Xe||Ds(null)},children:l.jsxs("div",{className:Be.confirmContent,children:[l.jsx("p",{className:Be.confirmDescription,children:j("sidebar.groupDeleteConfirm",{name:Fk})}),l.jsxs("div",{className:Be.confirmActions,children:[l.jsx("button",{className:Be.secondaryButton,type:"button",disabled:Xe,onClick:()=>Ds(null),children:j("common.cancel")}),l.jsx("button",{className:Be.dangerButton,type:"button",disabled:Xe,onClick:Eg,children:j("sidebar.groupDelete")})]})]})}),q&&l.jsx("div",{className:Be.topRow,children:M!=null&&M.render?M.render():l.jsxs(l.Fragment,{children:[l.jsx("span",{className:Be.brandLogo,"aria-hidden":"true",children:l.jsx(a6t,{})}),!e&&l.jsx("span",{className:Be.brandName,children:"Qwen Code"})]})}),l.jsxs("div",{className:Be.primaryNav,children:[P.has("newTask")&&l.jsxs("button",{className:Be.newChatButton,type:"button",title:j("sidebar.newTask"),"aria-label":j("sidebar.newTask"),disabled:Ur,onClick:()=>En(),children:[l.jsx("span",{className:Be.navIcon,children:l.jsx(WB,{size:16,strokeWidth:1.2})}),!e&&l.jsx("span",{children:j("sidebar.newTask")})]}),P.has("plugins")&&l.jsxs("button",{className:Be.pluginButton,type:"button",title:j("sidebar.plugins"),"aria-label":j("sidebar.plugins"),onClick:s,children:[l.jsx("span",{className:Be.navIcon,children:l.jsx(Bbe,{size:16,strokeWidth:1.2})}),!e&&l.jsx("span",{children:j("sidebar.plugins")})]}),P.has("channels")&&l.jsxs("button",{className:Be.pluginButton,type:"button",title:j("sidebar.channels"),"aria-label":j("sidebar.channels"),onClick:r,children:[l.jsx("span",{className:Be.navIcon,children:l.jsx(FQ,{size:16,strokeWidth:1.2})}),!e&&l.jsx("span",{children:j("sidebar.channels")})]}),P.has("scheduledTasks")&&l.jsxs("button",{className:Be.pluginButton,type:"button",title:j("sidebar.scheduledTasks"),"aria-label":j("sidebar.scheduledTasks"),onClick:o,children:[l.jsx("span",{className:Be.navIcon,children:l.jsx(Ube,{size:16,strokeWidth:1.2})}),!e&&l.jsx("span",{children:j("sidebar.scheduledTasks")})]}),P.has("goals")&&l.jsxs("button",{className:Be.pluginButton,type:"button",title:j("sidebar.goals"),"aria-label":j("sidebar.goals"),onClick:a,children:[l.jsx("span",{className:Be.navIcon,children:l.jsx(Nwe,{size:16,strokeWidth:1.2})}),!e&&l.jsx("span",{children:j("sidebar.goals")})]}),(t_=D==null?void 0:D.render)==null?void 0:t_.call(D)]}),l.jsx("div",{className:Be.body,children:l.jsxs("div",{className:Be.sessionList,children:[!e&&pr.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Be.projectsHeader,children:l.jsxs("button",{className:Be.projectsHeaderToggle,type:"button","aria-expanded":it,onClick:()=>gt(G=>!G),children:[l.jsx("span",{children:j("sidebar.pinnedSessions")}),l.jsx(jG,{expanded:it})]})}),it&&l.jsx("div",{className:Be.pinnedSessionList,children:pr.map(G=>qc(G,{readOnly:Fc(G)}))})]}),!e&&!$&&l.jsxs("div",{className:Be.projectsHeader,children:[l.jsxs("button",{className:Be.projectsHeaderToggle,type:"button","aria-expanded":Fr,onClick:()=>yr(G=>!G),children:[l.jsx("span",{children:j("sidebar.project")}),l.jsx(jG,{expanded:Fr})]}),l.jsxs("div",{className:Be.projectsHeaderActions,children:[l.jsx("button",{className:Be.projectsHeaderAction,type:"button",title:j("sidebar.search"),"aria-label":j("sidebar.search"),onClick:()=>{Pn(G=>(G&&qt(""),!G)),yr(!0)},children:l.jsx(Pc,{})}),!A&&S&&l.jsx("button",{className:Be.projectsHeaderAction,type:"button",title:j("sidebar.addWorkspace"),"aria-label":j("sidebar.addWorkspace"),onClick:S,children:l.jsx(z0,{})})]})]}),Mr&&!e&&!$&&l.jsxs("div",{className:Be.projectSearch,children:[l.jsx(Pc,{"aria-hidden":"true"}),l.jsx(Pr,{value:Je,placeholder:j("sidebar.searchPlaceholder"),"aria-label":j("sidebar.search"),autoFocus:!0,onChange:G=>qt(G.target.value),onKeyDown:G=>{G.key==="Escape"&&(qt(""),Pn(!1))}})]}),(e||Fr)&&l.jsx(l.Fragment,{children:!e&&l.jsx("div",{className:Be.workspacePicker,children:l.jsx("div",{className:Be.workspaceList,children:Yr.map(G=>l.jsxs(h.Fragment,{children:[l.jsx(F5t,{workspace:G,renderHeader:A&&(O!=null&&O.render)?Ie=>{var Re;return(Re=O.render)==null?void 0:Re.call(O,G,{expanded:Ie})}:void 0,client:J.client,reloadToken:_t,untrustedLabel:j("sidebar.workspaceUntrusted"),readOnlyLabel:j("sidebar.workspaceReadOnly"),trustToOpenLabel:j("sidebar.workspaceTrustToOpen"),noSessionsLabel:j("sidebar.noSessions"),loadErrorLabel:j("sidebar.loadFailed"),organizationEnabled:K,ungroupedLabel:j("sidebar.groupUngrouped"),onRenameGroup:fe(G.cwd)?_y:void 0,onDeleteGroup:fe(G.cwd)?Ip:void 0,renameGroupLabel:j("sidebar.groupRename"),deleteGroupLabel:j("sidebar.groupDelete"),groupActionsDisabled:Xe,excludePinned:!0,onOpenGitDiff:T,onOpenCommit:_,formatTime:Ie=>Lx(Ie,j),searchQuery:Je,expanded:G.primary?br:void 0,autoExpandKey:(ds==null?void 0:ds.id)===G.id?ds==null?void 0:ds.key:void 0,onExpandedChange:G.primary?Ns:void 0,renderSessions:!G.primary,renderSession:Ie=>qc({...Ie,workspaceCwd:G.cwd},{readOnly:Fc({...Ie,workspaceCwd:G.cwd})}),headerActions:Ie=>{if(A&&(O!=null&&O.render))return null;const Re=!A&&Xs&&!G.primary&&G.removable===!0;if(!G.trusted&&!Re)return null;const Ge=G.primary?void 0:G.cwd;return l.jsxs("div",{className:Be.workspaceHeaderActions,style:{visibility:Ie?"visible":"hidden"},children:[G.trusted&&l.jsxs(l.Fragment,{children:[fe(G.cwd)&&l.jsx("button",{className:Be.workspaceHeaderAction,type:"button","aria-label":j("sidebar.groupCreate"),onClick:mt=>{mt.preventDefault(),mt.stopPropagation(),G.primary?Cg():G5(G.cwd)},children:l.jsx(z0,{size:16,strokeWidth:1.2})}),l.jsx("button",{className:Be.workspaceHeaderAction,type:"button",title:j("sidebar.newTask"),"aria-label":j("sidebar.newTask"),onClick:mt=>{mt.preventDefault(),mt.stopPropagation(),En(Ge)},children:l.jsx(WB,{size:16,strokeWidth:1.2})})]}),Re&&l.jsxs(Hh,{children:[l.jsx(qh,{asChild:!0,children:l.jsx("button",{className:Be.workspaceHeaderAction,type:"button","aria-label":j("sidebar.workspaceActions"),disabled:Jn&&(Gs==null?void 0:Gs.id)===G.id,children:l.jsx(fm,{size:16,strokeWidth:1.2})})}),l.jsx(Uh,{align:"end",className:"w-auto min-w-40",children:l.jsxs(ho,{variant:"destructive","aria-label":`${j("sidebar.removeWorkspace")}: ${G.cwd}`,onSelect:()=>kt(G),children:[l.jsx(mm,{}),j("sidebar.removeWorkspace")]})})]})]})}}),G.primary&&(br||Je.trim())?l.jsx("div",{className:Be.workspaceSessionBody,children:oi}):null]},G.id))})})}),Wk]})}),B!==!1&&l.jsxs("div",{className:hc(Be.footer,xs&&Be.footerCompact,La&&Be.footerTight),children:[l.jsxs("div",{className:Be.footerPrimary,children:[B&&typeof B=="object"&&((n_=B.render)==null?void 0:n_.call(B)),W.has("settings")&&l.jsxs("button",{className:Be.footerButton,type:"button",title:j("sidebar.settings"),"aria-label":j("sidebar.settings"),onClick:n,children:[l.jsx("span",{className:`${Be.navIcon} ${Be.settingsIcon}`,children:l.jsx(bwe,{size:16,strokeWidth:1.2})}),!e&&!xs&&l.jsx("span",{className:Be.footerButtonLabel,children:j("sidebar.settings")})]}),!e&&!La&&es&&W.has("version")&&l.jsx("span",{className:Be.version,title:`Qwen Code ${es}`,children:es})]}),l.jsxs("div",{className:Be.footerActions,children:[W.has("theme")&&l.jsx("button",{className:Be.collapseButton,type:"button",title:v===ei.Dark?j("sidebar.themeLight"):j("sidebar.themeDark"),"aria-label":v===ei.Dark?j("sidebar.themeLight"):j("sidebar.themeDark"),onClick:()=>y(v===ei.Dark?ei.Light:ei.Dark),children:v===ei.Dark?l.jsx(Ewe,{size:16,strokeWidth:1.2}):l.jsx(Xye,{size:16,strokeWidth:1.2})}),u&&W.has("sessionsOverview")&&l.jsx("button",{className:Be.collapseButton,type:"button",title:j("sidebar.sessionsOverview"),"aria-label":j("sidebar.sessionsOverview"),onClick:c,children:l.jsx(qye,{size:16,strokeWidth:1.2})}),f&&W.has("splitView")&&l.jsx("button",{className:Be.collapseButton,type:"button",title:j("sidebar.splitView"),"aria-label":j("sidebar.splitView"),onClick:d,children:l.jsx(oye,{size:16,strokeWidth:1.2})}),W.has("daemonStatus")&&l.jsx("button",{className:Be.collapseButton,type:"button",title:j("sidebar.daemonStatus"),"aria-label":j("sidebar.daemonStatus"),onClick:i,children:l.jsx(Abe,{size:16,strokeWidth:1.2})}),!w&&W.has("collapse")&&l.jsx("button",{className:Be.collapseButton,type:"button",title:j(e?"sidebar.expand":"sidebar.collapse"),"aria-label":j(e?"sidebar.expand":"sidebar.collapse"),onClick:()=>t(!e),children:e?l.jsx(swe,{size:16,strokeWidth:1.2}):l.jsx(twe,{size:16,strokeWidth:1.2})})]})]}),l.jsx("div",{className:Be.resizeHandle,role:"separator","aria-orientation":"vertical",onPointerDown:Cy})]})})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function c6t(e){return e.key!=="b"&&e.key!=="B"||e.altKey||e.shiftKey?!1:e.metaKey!==e.ctrlKey}function u6t(e){const[t,n]=h.useState(e);return h.useEffect(()=>{const s=window.requestAnimationFrame(()=>{n(e)});return()=>window.cancelAnimationFrame(s)},[e]),t}const d6t=3e3,h6t=2;function AG(e){return e.some(t=>t.status==="running"||t.status==="paused")}function f6t(e,t,n,s=0){const r=ug(),[i,o]=h.useState([]),[a,c]=h.useState(!1),[u,d]=h.useState(!1),f=h.useRef(0),m=h.useRef(null);h.useEffect(()=>{o([]),c(!1),f.current=0},[n,e]),h.useEffect(()=>{!n||!e||!t||(f.current=0,c(!0))},[n,e,t]),h.useEffect(()=>{!n||!e||s===0||(f.current=0,c(!0))},[n,s,e]),h.useEffect(()=>{if(u||!n||!e||!a)return;let g=!1;const b=()=>{var w;if(((w=m.current)==null?void 0:w.sessionId)===e)return;const y={};m.current={sessionId:e,request:y},r.getTasks().then(x=>{if(g||x.sessionId!==e)return;const k=x.tasks.filter($ce);if(o(k),k.length===0){f.current+=1,f.current>=h6t&&c(!1);return}f.current=0,AG(k)||c(!1)}).catch(x=>{g||console.warn("[web-shell] failed to refresh tasks:",x)}).finally(()=>{var x;((x=m.current)==null?void 0:x.request)===y&&(m.current=null)})};b();const v=setInterval(b,d6t);return()=>{g=!0,clearInterval(v)}},[r,n,a,e,u]);const p=h.useRef(i);return p.current=i,h.useEffect(()=>{const g=b=>{const v=b.detail,y=(v==null?void 0:v.active)===!0;d(y),!y&&AG(p.current)&&c(!0)};return window.addEventListener(Dx,g),()=>window.removeEventListener(Dx,g)},[]),i}function m6t(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 p6t(e){const t=h.useRef(e);return m6t(t.current,e)||(t.current=e),t.current}function g6t(e,t){const n=h.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 Wo={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"},NG=1024,b6t=new RegExp(String.raw`(?<![\w$])\$(?![\s\d$])(?=[^$\n]{1,${NG}}\S\$)([^$\n]{1,${NG}})\$(?![\w$])`,"g");function y6t(e){var u,d,f;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&&((f=p[1])!=null&&f.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 w6t(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 v6t(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(b6t)){const f=d[1];f&&t.push({content:f,index:t.length+1})}}return t}function MG(e,t){return t&&e.langIndex!==null?`${t} code block ${e.langIndex}`:`Code block ${e.index}`}function x6t(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=y6t(e);if(r.length===0)return null;let i=null,o=null;const a=s==="code"?n.slice(1):n;for(const f of a)/^\d+$/.test(f)?o=Number(f):f.toLowerCase()!=="code"&&(i=f.toLowerCase());const c=i?r.filter(f=>f.lang===i):r;if(c.length===0)return null;if(o!==null){const f=i?c.find(m=>m.langIndex===o):r.find(m=>m.index===o);return f?{content:f.content,label:MG(f,i)}:null}const u=c[c.length-1];return u?{content:u.content,label:MG(u,i)}:null}function IG(e,t){const n=v6t(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 k6t(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 IG(e,n.slice(1));const r=n.slice(1),i=r.findIndex(d=>d.toLowerCase()==="inline");if(i!==-1)return IG(e,r.filter((d,f)=>f!==i));const o=w6t(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 _6t(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 S6t(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 C6t(e,t,n=S6t){const s=_6t(e);if(s===null)return{status:"info",message:Wo.NO_OUTPUT};if(!s)return{status:"info",message:Wo.NO_TEXT};try{const r=k6t(s,t);if(r===null)return{status:"info",message:t.trim().split(/\s+/).some(c=>c==="inline")||t.trim().toLowerCase().startsWith("inline-latex")?Wo.INLINE_LATEX_MISSING:Wo.LATEX_MISSING};if(r!==void 0)return await n(r.content),{status:"info",message:`${r.label}${Wo.COPIED_SUFFIX}`};const i=x6t(s,t);if(i===null)return{status:"info",message:Wo.CODE_MISSING};const o=(i==null?void 0:i.content)??s;return await n(o),{status:"info",message:i?`${i.label}${Wo.COPIED_SUFFIX}`:Wo.OUTPUT_COPIED}}catch(r){const i=r instanceof Error?r.message:String(r);return{status:"error",message:`${Wo.CLIPBOARD_PREFIX}${i}`}}}function T6t(e){return typeof e=="object"&&e!==null}function bde(e){const t="Model switched: ";return e.startsWith(t)?e.slice(t.length).trim().replace(/\([^()]+\)$/,""):null}function FP(e){return e.role==="system"&&e.variant==="info"&&e.source==="model_switch_summary"}function E6t(e){if(!FP(e)||!T6t(e.data))return null;const t=e.data.modelId;return typeof t=="string"&&t?t:null}function j6t(e){const t=new Set;for(const n of e){if(!FP(n))continue;const s=E6t(n);s&&t.add(s)}return t.size===0?[...e]:e.filter(n=>{if(n.role!=="system"||n.variant!=="info")return!0;const s=bde(n.content);return!s||!t.has(s)})}function A6t(e){return e.role!=="system"||e.variant!=="info"?!1:bde(e.content)!==null||FP(e)}function N6t(e){const t=e.findIndex(n=>!A6t(n));return t<0?[]:e.slice(t)}function RG(e){return N6t(j6t(e))}function M6t(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 DG(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 I6t(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?`${t[2]}:${t[1]}`:e}function PG(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?t[1]:e}function R6t(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 D6t=12,P6t=2,L6t=8,O6t=.35,$6t=2,B6t=.1,z6t=700,F6t=10*60*1e3,H6t=.75,q6t=280,U6t=[/^继续[吧呢]?$/,/^行[吧吗]?$/,/^好的?$/,/^再[看试说解释改跑补].*/,/^顺手.*/,/^上面.*/,/^刚才.*/,/^这个报错.*/,/^那你.*/,/^帮我修.*/,/^帮我看下.*/,/^跑(一下)?(测试|看看).*/,/^这个实现.*/,/^这个 PR.*/i,/^继续当前.*/,/^continue$/i,/^ok(?:ay)?$/i,/^retry$/i,/^fix (?:that|this|it)/i,/^run (?:the )?tests?/i],W6t=[/新的?(功能|任务|方向|话题)/,/写(一篇)?(设计文档|文档|spec|方案)/i,/产品方案/,/脑爆/,/另一个(功能|方向|任务|主题)/,/不继续当前/,/切到(一个)?新的?(任务|方向|话题)/,/start (a )?new/i,/new (feature|task|design|spec|doc|workflow)/i,/product (design|plan|spec)/i,/brainstorm/i];function V6t(e){const t=e.trim();return U6t.some(n=>n.test(t))}function G6t(e){const t=e.trim();return W6t.some(n=>n.test(t))}function K6t(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,q6t)}))}function Y6t(e){const t=e.recentMessages.map((n,s)=>`${s+1}. ${n.role}: ${n.text}`).join(`
`);return["You are deciding how a user's new message should be handled in the current coding session.",'Choose "new_session" only when the message is clearly a different task or topic and continuing here would add context noise.','Choose "btw" only for a brief side question that can be answered without changing the main task or adding its answer to the main conversation context.','Choose "none" for follow-ups, implementation continuations, debugging iterations, review follow-ups, and adjacent discussion about the same repo, PR, bug, or feature.','Be conservative. When in doubt, choose "none".',`Allowed actions: btw=${e.allowBtw?"yes":"no"}, new_session=${e.allowNewSession?"yes":"no"}. Never choose an action marked no.`,'Return JSON only with keys: suggestion ("btw", "new_session", or "none") 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 LG(e){try{const t=JSON.parse(e);return t.suggestion!=="btw"&&t.suggestion!=="new_session"&&t.suggestion!=="none"||typeof t.confidence!="number"||!Number.isFinite(t.confidence)||t.confidence<0||t.confidence>1?null:{suggestion:t.suggestion,confidence:t.confidence}}catch{return null}}function X6t(e){const t=LG(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:LG(r)}function Q6t({enabled:e,inputText:t,messages:n,sessionId:s,contextUsageRatio:r,isRunning:i,dialogOpen:o,hasAttachments:a,generateContent:c}){const[u,d]=h.useState(null),f=h.useRef(null),m=h.useRef(null),p=h.useRef(0),g=h.useRef(s),b=h.useMemo(()=>K6t(n),[n]),v=h.useCallback(()=>{var x;f.current&&(clearTimeout(f.current),f.current=null),(x=m.current)==null||x.abort(),m.current=null},[]),y=h.useCallback(()=>{d(null),v()},[v]),w=h.useCallback(()=>{p.current=Date.now()+F6t,d(null),v()},[v]);return h.useEffect(()=>{g.current!==s&&(d(null),v(),g.current=s)},[v,s]),h.useEffect(()=>{if(v(),!e||!c||!s){d(null);return}const x=t.trim();if(x.length<D6t){d(null);return}const k=G6t(x);if(i||o){d(null);return}const C=a===!1&&b.length>=P6t,T=!V6t(x)&&(k?b.length>=$6t||r>=B6t:b.length>=L6t||r>=O6t);if(!C&&!T){d(null);return}if(Date.now()<p.current){d(null);return}return d(null),f.current=setTimeout(()=>{const _=new AbortController;m.current=_;const S=Y6t({recentMessages:b,currentInput:x,contextUsageRatio:r,messageCount:b.length,allowBtw:C,allowNewSession:T});(async()=>{let R="";try{for await(const O of c(S,{signal:_.signal})){if(m.current!==_)return;if(O.type==="delta")R+=O.text;else if(O.type==="error"){m.current===_&&d(null);return}}if(m.current!==_)return;const A=X6t(R.trim());if(A&&A.suggestion!=="none"&&(A.suggestion==="btw"&&C||A.suggestion==="new_session"&&T)&&A.confidence>=H6t){d({suggestion:A.suggestion,classifiedInput:x,sourceSessionId:s});return}d(null)}catch{_.signal.aborted||d(null)}finally{m.current===_&&(m.current=null)}})()},z6t),()=>{v()}},[v,r,o,e,c,a,t,i,b,s]),{suggestion:u,dismiss:y,suppress:w}}const sg=h.createContext(!1),HP=h.createContext(new Map),yde=h.createContext(new Map);function J6t({timeline:e,details:t,children:n}){return l.jsx(HP.Provider,{value:e,children:l.jsx(yde.Provider,{value:t,children:n})})}const Aw=Jb,ij=760,d1=320,T2=500,Z6t=20,e8t=3e4;function t8t(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 n8t="ui.compactMode",s8t="ui.hideTips",r8t={main:"model.select",fast:"model.setFast",voice:"model.setVoice",vision:"model.setVision"};function oj(e){return e.trim().replace(/^\/+/,"").toLowerCase()}function i8t(e){const t=e;return t.source!=="goal"?null:_3(t.data)??_3(t.text)}function o8t(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind!=="status")continue;const s=i8t(n);if(s)return s.kind==="set"||s.kind==="checking"?{condition:s.condition,setAt:s.setAt??n.serverTimestamp??n.createdAt}:null}return null}const OG={insertText:()=>{},setText:()=>{},addTags:()=>{},removeTag:()=>{},clear:()=>{},submit:()=>{}},a8t=[],wde=1e3,$G=6,BG=40,vde="qwen-code-web-shell-chat-width",l8t=40,xde="qwen-code-web-shell-sidebar-collapsed";function c8t(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 u8t(e){if(typeof window>"u")return e;try{const t=window.localStorage.getItem(xde);if(t==="true")return!0;if(t==="false")return!1}catch{}return e}function zG(e){try{window.localStorage.setItem(xde,String(e))}catch{}}function _4(){return`${wde}`}function d8t(){if(typeof window>"u")return _4();try{return window.localStorage.getItem(vde)==="wide"?"wide":_4()}catch{return _4()}}function h8t(e){try{window.localStorage.setItem(vde,e)}catch{}}function kde(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:wde}function f8t(e,t){const n=`${kde(t)}px`,s=`calc(${n} + ${l8t}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 FG(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function HG(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function m8t(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}function p8t(){if(typeof window>"u")return"en";const e=new URLSearchParams(window.location.search);return Yh(e.get("language")??e.get("lang")??navigator.language)}function g8t(e,t){return e instanceof Error?e.message:t}function aj(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function h1(e){return typeof e=="object"&&e!==null&&e._alreadyDispatched===!0}function b8t(e){return e.category==="validation"||e.category==="user_action"||e.category==="system"}function y8t(e){return e.severity==="warning"?"warning":e.severity==="info"?"info":"error"}function lj(e){return typeof e=="object"&&e!==null}function w8t(e){if(!lj(e))return null;const t=e._meta;if(!lj(t))return null;const n=t.qwenModelSwitch;if(!lj(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 v8t(e,t){return t("model.usingModel",{isRuntime:e.isRuntime?1:0,modelId:e.modelId})}function x8t(e){return e.toolKind==="edit"}function k8t(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 _8t(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 S8t(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const s of n.tools)(_8t(s)||s.toolName.toLowerCase()==="monitor")&&t.push(`${s.callId}:${s.status}`);return t.join("|")}function qG(e,t){return e.status!=="running"&&t.status==="running"?e:t}function C8t(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 T8t(e,t){return e===Wo.NO_OUTPUT?t("copy.noOutput"):e===Wo.NO_TEXT?t("copy.noText"):e===Wo.CODE_MISSING?t("copy.codeMissing"):e===Wo.LATEX_MISSING?t("copy.latexMissing"):e===Wo.INLINE_LATEX_MISSING?t("copy.inlineLatexMissing"):e===Wo.OUTPUT_COPIED?t("copy.outputCopied"):e.startsWith(Wo.CLIPBOARD_PREFIX)?`${t("copy.failedFallback")}. ${e.slice(Wo.CLIPBOARD_PREFIX.length)}`:e.endsWith(Wo.COPIED_SUFFIX)?t("copy.toClipboard",{label:e.slice(0,-Wo.COPIED_SUFFIX.length)}):e}function UG(e,t){return e===t?!0:!e||!t?!1:e.v===t.v&&e.workspaceCwd===t.workspaceCwd&&e.branch===t.branch&&e.detached===t.detached&&e.staged===t.staged&&e.unstaged===t.unstaged&&e.untracked===t.untracked&&e.conflicted===t.conflicted&&e.hasUpstream===t.hasUpstream&&e.ahead===t.ahead&&e.behind===t.behind&&e.stashCount===t.stashCount&&e.operation===t.operation}function E2(e,t,n){const s=e.find(r=>r.key===n);if(s)return t==="user"?s.values.user:s.values.workspace}function E8t({onSessionIdChange:e,onSessionCreated:t,theme:n,onThemeChange:s,language:r,onLanguageChange:i,className:o,style:a,shadowDom:c,onConnectionChange:u,onStreamingStateChange:d,onError:f,onBugReport:m,hiddenSlashCommands:p,slashCommandCategoryOrder:g,onSlashCommand:b,builtinAtProviders:v,atProviders:y,composerTagIcons:w,renderToolHeaderExtra:x,renderWelcomeHeader:k,renderWelcomeFooter:C,mobileWelcomeFooterMiddle:T=!1,parseUserMessageContent:_,renderUserMessageContent:S,renderComposerTag:R,renderComposerTagTooltip:A,onComposerTagClick:O,renderAssistantTurnFooter:M,renderComposerToolbarStart:D,renderComposerToolbarEnd:$,renderComposerToolbarRight:z,renderComposerHeader:B,renderComposerFooter:j,renderChatHeader:H,renderFooter:Q,bottomStatusItems:I,chatMaxWidth:J,sidebar:W,splitSessionIds:P,onSplitSessionIdsChange:V,onRightPanelOpen:ee,messageTurnOutputs:q,shellRef:K,composerToolbarActions:de,composerPlaceholders:re,compactThinking:ne=!1,collapseCompletedTurns:U=!0,markdownTableMode:Z="basic",virtualScrollThreshold:ge,markdown:ce,loadingPhrases:ue,onTranscriptChange:be,onToast:rt,composerRef:le,onComposerReady:Me,composerInput:We,composerInputVersion:at,onSessionChange:ze,onSubmitBefore:rn,restartSseOnPrompt:Wt,historyPageSize:zt,initialSelectedWorkspaceCwd:ae,lockedWorkspaceCwd:je,lockedWorkspaceCapability:it}={}){var eO,tO,nO,sO,rO,iO,oO,aO,lO,cO,uO,dO,hO,fO,mO,pO,gO,bO,yO,wO,vO,xO,kO,_O;const[gt,wt]=h.useState(d8t),[Ke,un]=h.useState(()=>r===void 0?p8t():Yh(r)),me=h.useMemo(()=>DI(Ke),[Ke]),ht=h.useMemo(()=>m4t(c),[c]),Oe=h.useMemo(()=>c8t(W),[W]),[Ne,St]=h.useState(()=>u8t(Oe.defaultCollapsed)),[Ue,ve]=h.useState(null),[Fe,ie]=h.useState(!1),[Pe,et]=h.useState(!1),He=h.useCallback(()=>{ie(!1),et(!1)},[]),Ae=KE(),vt=KE("(min-width: 1001px)"),vn=KE("(min-width: 1200px)");h.useEffect(()=>{Oe.enabled||He()},[He,Oe.enabled]),h.useEffect(()=>{const E=window.matchMedia("(max-width: 760px)"),F=X=>{X.matches||He()};return E.addEventListener("change",F),()=>E.removeEventListener("change",F)},[He]),h.useEffect(()=>{if(!Fe)return;const E=oe=>{if(oe.key!=="Escape"||ys.current)return;const Te=oe.target;eg(Te)&&!(Te!=null&&Te.closest("[data-sidebar-shell]"))||(oe.stopPropagation(),oe.preventDefault(),He())},F=document.body.style.overflow;document.body.style.overflow="hidden";const X=oe=>{const Te=oe.target;Te!=null&&Te.closest("[data-sidebar-shell]")&&!Te.closest(`.${Ot.mobileBackdrop}`)||oe.preventDefault()};return document.addEventListener("touchmove",X,{passive:!1}),window.addEventListener("keydown",E,!0),()=>{document.body.style.overflow=F,document.removeEventListener("touchmove",X),window.removeEventListener("keydown",E,!0)}},[Fe,He]);const Ce=h.useCallback(E=>{St(E),zG(E)},[]);h.useEffect(()=>{if(!Oe.enabled)return;const E=F=>{if(!c6t(F))return;const X=F.target;if(eg(X)&&!(X!=null&&X.closest("[data-web-shell-composer-editor]")))return;if(F.preventDefault(),Pe||window.matchMedia("(max-width: 760px)").matches){Fe?(ie(!1),et(!1)):ie(!0);return}const oe=!Ne;St(oe),zG(oe)};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[Oe.enabled,Fe,Pe,Ne]);const yt=h.useMemo(()=>({composerTagIcons:w,renderToolHeaderExtra:x,renderWelcomeHeader:k,renderWelcomeFooter:C,parseUserMessageContent:_,renderUserMessageContent:S,renderComposerTag:R,renderComposerTagTooltip:A,onComposerTagClick:O,renderAssistantTurnFooter:M,renderComposerToolbarStart:D,renderComposerToolbarEnd:$,renderComposerToolbarRight:z,renderComposerHeader:B,renderComposerFooter:j,renderFooter:Q,compactThinking:ne,collapseCompletedTurns:U,markdownTableMode:Z,markdown:ce,loadingPhrases:ue}),[w,x,k,C,_,S,R,A,O,M,D,$,z,B,j,Q,ne,U,Z,ce,ue]),Ft=Q,De=B,Xe=j,$e=nT(),Ht=rk(),ke=Ra(),Fn=MQ(),Ve=io(),ft=Ve.refreshCapabilities,Lt=h.useMemo(()=>{var F;const E=((F=Ve.capabilities)==null?void 0:F.workspaces)??[];return it&&!E.some(X=>X.cwd===it.cwd)?[...E,it]:E},[it,(eO=Ve.capabilities)==null?void 0:eO.workspaces]),gn=h.useRef(void 0),Tn=je?void 0:Lt.map(E=>({id:E.id,cwd:E.cwd,label:z5(E),primary:E.primary,trusted:E.trusted})),Xn=gn.current;((Xn==null?void 0:Xn.length)!==(Tn==null?void 0:Tn.length)||Xn!=null&&Xn.some((E,F)=>{const X=Tn==null?void 0:Tn[F];return!X||E.id!==X.id||E.cwd!==X.cwd||E.label!==X.label||E.primary!==X.primary||E.trusted!==X.trusted}))&&(gn.current=Tn);const _r=gn.current,zr=h.useRef(Lt);zr.current=Lt;const Ar=h.useMemo(()=>je?Lt.filter(E=>E.cwd===je):Lt,[je,Lt]),jt=ug(),Sn=h.useCallback(async E=>{ke.sessionId&&await jt.reloadSession(E)},[ke.sessionId,jt]),Hn=((tO=ke.capabilities)==null?void 0:tO.features.includes(qQ))===!0,Ln=((nO=ke.capabilities)==null?void 0:nO.features.includes(Fwe))===!0,{notices:gs,dismissNotice:qn}=tbe(),Dn=pa(),Rs=((rO=(sO=Ve.capabilities)==null?void 0:sO.features)==null?void 0:rO.includes("dynamic_workspace_registration"))===!0,ts=((oO=(iO=Ve.capabilities)==null?void 0:iO.features)==null?void 0:oO.includes("persistent_workspace_registration"))===!0,Bs=((lO=(aO=Ve.capabilities)==null?void 0:aO.features)==null?void 0:lO.includes("scratch_workspace_registration"))===!0,Sr=((uO=(cO=Ve.capabilities)==null?void 0:cO.features)==null?void 0:uO.includes("workspace_display_name"))===!0,Nr=((hO=(dO=Ve.capabilities)==null?void 0:dO.features)==null?void 0:hO.includes("workspace_github_prs"))===!0,[pi,lr]=h.useState(!1),[Ds,gi]=h.useState(!1),xe=h.useRef(null),Ye=h.useRef(null),st=h.useRef(0),Et=h.useRef("clear"),Mt=h.useRef(void 0),[cs,bs]=h.useState("clear"),sr=h.useCallback(E=>{Et.current=E,bs(E)},[]),[Qn,br]=h.useState(ae),Ns=h.useRef(Qn);Ns.current=Qn;const[Fr,yr]=h.useState(void 0);h.useEffect(()=>{if(!Ve.capabilities||!Qn)return;const E=Lt.find(F=>F.cwd===Qn);E!=null&&E.trusted||(st.current+=1,Ns.current=void 0,br(void 0))},[Qn,Ve.capabilities,Lt]);const Mr=h.useRef(void 0),[Pn,Gs]=h.useState(void 0),[vo,Ks]=h.useState(void 0),bi=h.useRef(void 0);h.useEffect(()=>{const E=ke.sessionId;if(bi.current=E,!E){Gs(void 0),Ks(void 0);return}Ve.client.sessionStatus(E).then(F=>{bi.current===E&&(Gs(F.worktree),Ks(F.branch))}).catch(()=>{bi.current===E&&(Gs(void 0),Ks(void 0))})},[ke.sessionId,Ve.client]);const Jn=h.useMemo(()=>{var E;return ke.sessionId?ke.workspaceCwd:je??Qn??((E=Lt.find(F=>F.primary))==null?void 0:E.cwd)},[ke.sessionId,ke.workspaceCwd,je,Qn,Lt]);h.useEffect(()=>{if(!Jn){Mr.current=void 0,yr(void 0);return}const E=(Pn==null?void 0:Pn.path)??Jn;Mr.current!==E&&(Mr.current=E,yr(void 0));let F=!1;const X=()=>{const tt=Ve.client.workspaceByCwd(Jn);tt.workspaceGit({cwd:Pn==null?void 0:Pn.path}).then(It=>{F||yr(Rt=>UG(Rt,It)?Rt:It)}).catch(()=>{F||yr(void 0)}),Pn||tt.workspaceGit({wait:!0}).then(It=>{F||yr(Rt=>UG(Rt,It)?Rt:It)}).catch(It=>{console.warn("[web-shell] git status fresh path failed:",It)})};X();const oe=()=>X();window.addEventListener("focus",oe);const Te=window.setInterval(()=>{document.visibilityState==="visible"&&X()},3e4);return()=>{F=!0,window.removeEventListener("focus",oe),window.clearInterval(Te)}},[Jn,ke.gitBranch,Ve.client,Pn]),h.useEffect(()=>{const E=ke.gitStatus;!E||Pn||E.workspaceCwd===Jn&&yr(E)},[ke.gitStatus,Jn,Pn]);const xi=h.useRef(rt);xi.current=rt;const qs=h.useRef(0),[wr,Hr]=h.useState([]),Ir=h.useCallback(E=>{Hr(F=>F.filter(X=>X.id!==E))},[]),_t=h.useCallback((E,F)=>{if(xi.current){xi.current(E,F);return}const X={id:`web-shell-toast-${Date.now()}-${++qs.current}`,tone:E,message:F};Hr(oe=>[...oe.filter(tt=>tt.tone!==E||tt.message!==F),X].slice(-4))},[]),Zn=H5(me),ds=h.useRef(Zn);ds.current=Zn;const[Kr,_e]=h.useState(null),[Je,qt]=h.useState(null),On=h.useRef(1),on=h.useRef(1),Le=h.useRef(null),Qt=h.useRef(null),Un=h.useRef(ke.sessionId),Kn=h.useRef(void 0),zs=h.useRef(void 0),ns=h.useRef(void 0),si=h.useRef(ke.sessionId),Ys=h.useMemo(()=>{const E=[Kr].filter(X=>X!==null);if(E.length===0)return RG(Zn);const F=[...Zn];for(const X of E.sort((oe,Te)=>oe.anchorIndex-Te.anchorIndex)){const oe=X.anchorAfterId?F.findIndex(tt=>tt.id===X.anchorAfterId):-1,Te=oe>=0?oe+1:Math.min(X.anchorIndex,F.length);F.splice(Te,0,X.message)}return RG(F)},[Zn,Kr]),{artifacts:Ps,loading:Xs,error:Ai}=aue(),[oo,xo]=h.useState([]),[ki,Pa]=h.useState(()=>new Map),[Yr,pr]=h.useState([]);h.useEffect(()=>{if(oo.length===0||Ps.length===0)return;const E=new Set(Ps.map(X=>X.id)),F=new Set(Yr.filter(X=>X.kind==="artifact"&&X.workspaceActions).map(X=>X.kind==="artifact"?X.artifactId:""));xo(X=>{const oe=X.filter(Te=>!E.has(Te.id)||F.has(Te.id));return oe.length===X.length?X:oe})},[Ps,oo.length,Yr]);const os=h.useMemo(()=>Array.from(ki.values()).flatMap(E=>[...E.artifacts]),[ki]),_i=h.useMemo(()=>{if(oo.length===0&&os.length===0)return Ps;const E=[...Ps];for(const F of[...oo,...os])E.findIndex(oe=>oe.id===F.id)<0&&E.push(F);return E},[Ps,oo,os]),ri=h.useCallback((E,F,X)=>{Pa(Te=>{const tt=Te.get(E);if((tt==null?void 0:tt.workspaceActions)===X&&tt.artifacts.length===F.length&&tt.artifacts.every((Kt,xt)=>{const Ct=F[xt];return(Ct==null?void 0:Ct.id)===Kt.id&&Ct.updatedAt===Kt.updatedAt&&Ct.sizeBytes===Kt.sizeBytes}))return Te;const Rt=new Map(Te);return F.length===0?Rt.delete(E):Rt.set(E,{artifacts:[...F],workspaceActions:X}),Rt});const oe=new Set(F.map(Te=>Te.id));pr(Te=>{let tt=!1;const It=Te.map(Rt=>{if(Rt.kind!=="artifact"||!oe.has(Rt.artifactId))return Rt;const Kt={id:Rt.id,kind:"artifact",title:Rt.title,artifactId:Rt.artifactId,workspaceActions:Rt.workspaceActions??X};return Rt.previewContent!==void 0&&(tt=!0),Rt.workspaceActions||(tt=!0),Kt});return tt?It:Te})},[]),Cu=h.useMemo(()=>kue(Ys,Ps,ke.workspaceCwd||""),[Ys,Ps,ke.workspaceCwd]),Ju=h.useMemo(()=>Sue(Ys,Cu,ke.workspaceCwd||""),[Ys,Cu,ke.workspaceCwd]),Fc=h.useMemo(()=>Cue(Ys),[Ys]),ga=h.useMemo(()=>new Set(q??yce),[q]),[rr,ii]=h.useState(!1),Bi=h.useRef(rr);Bi.current=rr;const[el,qr]=h.useState(null),se=h.useRef(el);se.current=el;const[ye,fe]=h.useState([]),[Qe,tn]=h.useState(null),[ct,Dt]=h.useState(ij),Vn=h.useRef(null),ps=h.useRef(null),Ts=h.useRef(new Map),hs=h.useRef(ke.sessionId);ps.current={open:rr,tabs:Yr,activeTabId:el,reviewChanges:ye,selectedReviewPath:Qe,extraArtifacts:oo,width:ct},h.useEffect(()=>{const E=hs.current;if(E){const oe=ps.current;if(oe&&(Ts.current.set(E,oe),Ts.current.size>Z6t)){const Te=Ts.current.keys().next().value;Te&&Ts.current.delete(Te)}}const F=ke.sessionId;hs.current=F;const X=F?Ts.current.get(F):void 0;if(!X){ii(!1),pr([]),qr(null),fe([]),tn(null),xo([]),Pa(new Map),Dt(ij);return}ii(X.open),pr(X.tabs),qr(X.activeTabId),fe(X.reviewChanges),tn(X.selectedReviewPath),xo(X.extraArtifacts),Pa(new Map),Dt(X.width)},[ke.sessionId]);const $r=h.useCallback(()=>{var F;const E=(F=Qt.current)==null?void 0:F.getBoundingClientRect().width;return E?Math.max(d1,ct+E-T2):Math.max(d1,window.innerWidth-T2)},[ct]),Cs=h.useCallback(()=>{var X;const E=((X=Qt.current)==null?void 0:X.getBoundingClientRect().width)??window.innerWidth,F=Math.max(d1,E-T2);return Math.min(F,Math.max(ij,Math.round(E*.56)))},[]),es=h.useCallback((E,F)=>{if(!E)return;const X=_i.find(Te=>Te.id===E),oe={id:`artifact:${E}`,kind:"artifact",artifactId:E,title:(X==null?void 0:X.title)??"Artifact",...F!==void 0?{previewContent:F}:{}};pr(Te=>Te.some(tt=>tt.id===oe.id)?Te.map(tt=>tt.id===oe.id?{...tt,...oe}:tt):[...Te,oe]),qr(oe.id),Dt(Te=>Bi.current?Te:Cs()),ii(!0)},[_i,Cs]),xs=h.useCallback((E,F,X,oe)=>{const Te={id:"review",kind:"review",title:me("turnOutputs.review"),...X?{workspaceActions:X}:{},...oe?{workspaceCwd:oe}:{}};pr(tt=>tt.some(It=>It.id===Te.id)?tt.map(It=>It.id===Te.id?Te:It):[Te,...tt]),qr(Te.id),fe(E),tn(F??null),Dt(tt=>Bi.current?tt:Cs()),ii(!0)},[Cs,me]),La=h.useCallback((E,F)=>{const X={id:`scheduled-task:${E.toolCallId}`,kind:"scheduled_task",title:me("scheduledTasks.title"),task:E,...F?{workspaceActions:F}:{}};pr(oe=>oe.some(Te=>Te.id===X.id)?oe.map(Te=>Te.id===X.id?X:Te):[...oe,X]),qr(X.id),Dt(oe=>Bi.current?oe:Cs()),ii(!0)},[Cs,me]),vr=h.useCallback(E=>{const F={id:`monitor:${E.id}`,kind:"monitor",title:E.description,task:E};pr(X=>X.some(oe=>oe.id===F.id)?X.map(oe=>{if(oe.id!==F.id||oe.kind!=="monitor")return oe;const Te=qG(oe.task,E);return{...F,title:Te.description,task:Te}}):[...X,F]),qr(F.id),Dt(X=>Bi.current?X:Cs()),ii(!0)},[Cs]),Ur=h.useCallback((E,F,X)=>{var It;const oe=E.rawOutput&&typeof E.rawOutput=="object"?E.rawOutput:void 0,Te=(typeof((It=E.args)==null?void 0:It.subagent_type)=="string"?E.args.subagent_type:void 0)??(typeof(oe==null?void 0:oe.subagentName)=="string"?oe.subagentName:void 0),tt={id:`subagent:${F}:${E.callId}`,kind:"subagent",title:E.title||Te||me("agent.label"),sessionId:F,rootToolCallId:E.callId,rootTool:E,...X?{workspaceCwd:X}:{}};pr(Rt=>Rt.some(Kt=>Kt.id===tt.id)?Rt.map(Kt=>Kt.id===tt.id?tt:Kt):[...Rt,tt]),qr(tt.id),Dt(Rt=>Bi.current?Rt:Cs()),ii(!0)},[Cs,me]),Os=h.useCallback(E=>{ke.sessionId&&Ur(E,ke.sessionId,ke.workspaceCwd)},[ke.sessionId,ke.workspaceCwd,Ur]),ko=h.useCallback(E=>{if(ee){ee(E);return}if(E.kind==="review"){xs(E.changes,E.selectedPath,E.workspaceActions,E.workspaceCwd);return}if(E.kind==="scheduled_task"){La(E.task,E.workspaceActions);return}if(E.kind==="subagent"){Ur(E.tool,E.sessionId,E.workspaceCwd);return}E.workspaceActions||xo(X=>{const oe=X.findIndex(tt=>tt.id===E.artifact.id);if(oe<0)return[...X,E.artifact];const Te=[...X];return Te[oe]=E.artifact,Te});const F={id:E.id,kind:"artifact",title:E.title,artifactId:E.artifactId,...E.workspaceActions?{workspaceActions:E.workspaceActions}:{},...E.previewContent!==void 0?{previewContent:E.previewContent}:{}};pr(X=>X.some(oe=>oe.id===F.id)?X.map(oe=>oe.id===F.id?{...oe,...F}:oe):[...X,F]),qr(F.id),Dt(X=>Bi.current?X:Cs()),ii(!0)},[Cs,ee,xs,La,Ur]),ba=h.useCallback((E,F,X)=>{const oe=wce(E),Te={id:`file:${X??""}:${E.path}`,kind:"file",title:O5(E.path,X),workspacePath:E.path,workspaceActions:F,...oe!==void 0?{previewContent:oe}:{}};pr(tt=>tt.some(It=>It.id===Te.id)?tt.map(It=>It.id===Te.id?Te:It):[...tt,Te]),qr(Te.id)},[]),Oo=h.useCallback(()=>{ii(!1),pr([]),qr(null),fe([]),tn(null),xo([]),Pa(new Map)},[]);h.useLayoutEffect(()=>{if(!rr)return;const E=()=>{Dt(oe=>{var It;const Te=((It=Qt.current)==null?void 0:It.getBoundingClientRect().width)??window.innerWidth-oe,tt=Math.max(d1,oe+Te-T2);return Math.min(oe,tt)})};E(),window.addEventListener("resize",E);const F=Qt.current,X=new ResizeObserver(E);return F&&X.observe(F),()=>{window.removeEventListener("resize",E),X.disconnect()}},[rr]);const sc=h.useCallback(E=>{pr(F=>{const X=F.filter(oe=>oe.id!==E);if(X.length===0)return ii(!1),qr(null),fe([]),tn(null),xo([]),Pa(new Map),X;if(se.current===E){const oe=F.findIndex(tt=>tt.id===E),Te=X[Math.min(oe,X.length-1)]??X[0];qr(Te.id)}return X})},[]),Al=h.useCallback(E=>{E.preventDefault();const F=E.currentTarget;F.setPointerCapture(E.pointerId);const X=E.clientX,oe=ct,Te=$r(),tt=document.body.style.cursor,It=document.body.style.userSelect;let Rt=oe,Kt=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const xt=()=>{Kt=null,Dt(Rt)},Ct=Cr=>{Rt=Math.min(Te,Math.max(d1,oe-(Cr.clientX-X))),Kt===null&&(Kt=window.requestAnimationFrame(xt))};let In=()=>{};const as=Cr=>{Vn.current=null,Kt!==null&&(window.cancelAnimationFrame(Kt),Kt=null),Cr&&Dt(Rt),F.hasPointerCapture(E.pointerId)&&F.releasePointerCapture(E.pointerId),document.body.style.cursor=tt,document.body.style.userSelect=It,window.removeEventListener("pointermove",Ct),window.removeEventListener("pointerup",In),window.removeEventListener("pointercancel",In)};In=()=>as(!0),Vn.current=()=>as(!1),window.addEventListener("pointermove",Ct),window.addEventListener("pointerup",In),window.addEventListener("pointercancel",In)},[ct,$r]);h.useEffect(()=>()=>{var E;return(E=Vn.current)==null?void 0:E.call(Vn)},[]);const kt=u6t(Ht),cn=h.useMemo(()=>SA(kt),[kt]),En=p6t(cn),jn=!(ke.catchingUp&&Ue!==null),Yn=e9(En)&&jn?En:null,rs=En&&!e9(En)&&jn?En:null,ys=h.useRef(En);ys.current=jn?En:null;const Qs=rs!==null||Yn!==null,Oa=h.useRef(Qs);Oa.current=Qs||jn&&SA(Ht)!==null;const tl=h.useMemo(()=>TXe(Zn),[Zn]),Zu=h.useRef(null),ed=h.useMemo(()=>{const E=jXe(Zn),F=Zu.current;if(F&&F.signature===E)return F.timeline;const X=EXe(Zn);return Zu.current={signature:E,timeline:X},X},[Zn]),Cg=h.useRef(null),G5=h.useMemo(()=>{const E=AXe(Zn),F=Cg.current;if(F&&F.signature===E)return F.details;const X=PXe(Zn);return Cg.current={signature:E,details:X},X},[Zn]),Bk=g6t(tl.todos,E=>`${E.id}:${E.status}:${E.content}`),_y=tl.allCompleted,[Tg,K5]=h.useState("hidden"),Ip=ke.catchingUp||Bk.length===0||_y?"hidden":"active";Ip!==Tg&&K5(Ip);const Eg=Ip!=="hidden",jg=I??a8t,td=Eg||jg.length>0,jf=h.useRef(null),Sy=h.useRef(null),[Hc,Ag]=h.useState(null),oh=h.useRef(new Set),ah=h.useRef(null),[Ng,Cy]=h.useState(0),[zk,Rp]=h.useState(0);h.useLayoutEffect(()=>{if(!td){Cy(0),Rp(0);return}const E=ah.current;if(!E){Cy(BG),Rp(0);return}const F=()=>{const oe=jf.current,Te=E.getBoundingClientRect(),tt=oe==null?void 0:oe.getBoundingClientRect(),It=Math.ceil(Te.height),Rt=tt?Math.max(0,tt.top-Te.top):It+$G;Rp(It),Cy(Math.max(BG,Math.ceil(Rt)))};if(F(),typeof ResizeObserver>"u")return;const X=new ResizeObserver(F);return X.observe(E),jf.current&&X.observe(jf.current),()=>X.disconnect()},[td]);const Mg=h.useMemo(()=>({"--web-shell-bottom-panel-inset":`${Ng}px`,"--web-shell-bottom-panel-height":`${zk}px`,"--web-shell-bottom-panel-gap":`${$G}px`}),[zk,Ng]),Y5=h.useMemo(()=>S8t(Zn),[Zn]),[Ty,Fk]=h.useState(0),lh=f6t(ke.sessionId,Y5,ke.status==="connected",Ty),Dp=h.useRef(ke.sessionId);Dp.current=ke.sessionId;const Hk=h.useCallback(async E=>{const F=Dp.current;if(!F)return!1;try{const X=await jt.getTasks();if(Dp.current!==F||X.sessionId!==F)return!1;const oe=Ntt(X.tasks,E);return oe?(Fk(Te=>Te+1),vr(oe),!0):!1}catch{return!1}},[vr,jt]);h.useEffect(()=>{const E=new Map(lh.filter(F=>F.kind==="monitor").map(F=>[F.id,F]));E.size!==0&&pr(F=>{let X=!1;const oe=F.map(Te=>{if(Te.kind!=="monitor")return Te;const tt=E.get(Te.task.id);if(!tt||tt===Te.task)return Te;const It=qG(Te.task,tt);return It===Te.task?Te:(X=!0,{...Te,title:It.description,task:It})});return X?oe:F})},[lh]);const qk=h.useMemo(()=>Q?lh.map(C8t):[],[lh,Q]),Uk=h.useRef(null),qc=h.useRef(null),oi=h.useRef(null),Wk=h.useRef(null),[Vk,Gk]=h.useState(!1),Ey=h.useRef(null),jy=h.useRef(!1),Uc=h.useCallback((E="smooth")=>{requestAnimationFrame(()=>{var F;(F=qc.current)==null||F.scrollToBottom(E),requestAnimationFrame(()=>{var X;(X=qc.current)==null||X.scrollToBottom(E)})})},[]),Kk=h.useCallback(E=>{oi.current=E,FG(le,E??OG),E&&Wk.current!==E&&(Wk.current=E,Me==null||Me(E))},[le,Me]);h.useEffect(()=>{FG(le,oi.current??OG)},[le]);const[Pp,ch]=h.useState(null),[Yk,Ay]=h.useState(!1),Ig=h.useRef(!1),Ny=h.useRef(null);Ny.current=Pp;const{followupState:Xk,onAcceptFollowup:Qk,onDismissFollowup:Jk,clear:My}=PQ({onAccept:E=>{var F;(F=oi.current)==null||F.insertText(E)}}),Rg=h.useRef(""),uh=h.useRef(null),[Zk,e_]=h.useState(""),[t_,n_]=h.useState(null),[G,Ie]=h.useState(!1),Re=sT(),Ge=h.useRef(Re),mt=h.useRef([]),xn=h.useRef(0),Nn=h.useRef(!1),ws=h.useRef(!1),us=h.useRef(Date.now()),Nl=h.useRef(Re);Nl.current==="idle"&&Re!=="idle"&&(us.current=Date.now()),Nl.current=Re;const Wc=h.useMemo(()=>{if(Re!=="idle"){for(let E=Ys.length-1;E>=0;E--){const F=Ys[E];if((F==null?void 0:F.role)==="user")return F.timestamp??us.current}return us.current}},[Ys,Re]),Vc=h.useRef(""),ai=h.useRef(void 0),nd=h.useRef(null),Zo=h.useRef(null),[$a,dh]=h.useState(!1),Af=h.useRef($a);Af.current=$a;const Ml=ke.status==="connected",Qi=Xd(),[Lp,Iy]=h.useState([]),[Op,Wr]=h.useState(!1),$o=h.useRef(0),$p=h.useCallback(async E=>{const F=++$o.current;try{const X=E&&Ve.client?await Ve.client.workspaceByCwd(E).workspaceSkills():await Dn.loadSkillsStatus();if(F!==$o.current)return;Iy(t8t(X)),Wr(!0)}catch{return}},[Ve.client,Dn]);h.useEffect(()=>{Ml&&$p(ke.workspaceCwd)},[Ml,ke.workspaceCwd,$p]);const[yi,Il]=h.useState(null),s_=h.useRef(yi),[Bo,Ry]=h.useState("workspace"),[Nf,r_]=h.useState(!1),qP=h.useRef(Nf),[Tde,Ede]=h.useState([]),[Dg,Pg]=h.useState(!1),[UP,X5]=h.useState(!1),[WP,Q5]=h.useState(!1),[VP,J5]=h.useState(!1),[GP,Z5]=h.useState(!1),[KP,e6]=h.useState(!1),[YP,t6]=h.useState(!1),[XP,QP]=h.useState(!1),[Mf,If]=h.useState(void 0),[Js,ao]=h.useState("chat"),JP=h.useRef(Js),jde=!vt||Js==="split",[hh,n6]=h.useState([]),s6=h.useRef(hh);s6.current=hh;const[i_,r6]=h.useState(null),[$n,fh]=h.useState(null),i6=h.useRef($n),lo=h.useCallback(()=>fh(null),[]),ZP=h.useCallback(E=>{lo(),window.setTimeout(()=>{var F,X;(F=oi.current)==null||F.setText(`/${E} `),(X=oi.current)==null||X.focus()},0)},[lo]),Ba=h.useCallback(E=>{ao("chat"),fh(E)},[]),Ade=h.useCallback(async()=>{const E=await Dn.loadMcpStatus();r6({status:E,toolsByServer:{},resourcesByServer:{},showDescriptions:!1,showSchema:!1,showTips:!1})},[Dn]),o6=h.useCallback(()=>{fh(null),ao("scheduledTasks")},[]),Lg=h.useCallback(()=>{fh(null),ao("goals")},[]),eL=h.useCallback(()=>{Oe.enabled&&(fh(null),ao("chat"),et(!0),ie(!0))},[Oe.enabled]),Bp=h.useCallback(E=>{fh(null),n6(F=>{const X=Array.from(new Set((E??[]).filter(Boolean))).slice(0,Om);return X.length>0?X:F.length>0?F:ke.sessionId?[ke.sessionId]:[]}),ao("split")},[ke.sessionId]),a6=h.useMemo(()=>Array.from(new Set((P??[]).filter(Boolean))).slice(0,Om).join("\0"),[P]),za=P!==void 0,sd=h.useRef(V);sd.current=V;const tL=h.useCallback(()=>{var F;if(!za){Bp();return}const E=hh.length>0?hh:ke.sessionId?[ke.sessionId]:[];(F=sd.current)==null||F.call(sd,E)},[ke.sessionId,za,Bp,hh]);h.useEffect(()=>{if(!za)return;const E=a6?a6.split("\0"):[];n6(F=>m8t(F,E)?F:E),E.length>0?(fh(F=>F===null?F:null),ao(F=>F==="split"?F:"split")):ao(F=>F==="split"?"chat":F)},[za,a6]);const Nde=h.useCallback(E=>{var F;za||n6(E),(F=sd.current)==null||F.call(sd,E)},[za]),o_=h.useCallback(()=>{var E;za&&((E=sd.current)==null||E.call(sd,[]))},[za]),Mde=h.useCallback(()=>{o_(),m0t(),Ba("sessions")},[o_,Ba]);h.useEffect(()=>{const E=d0t(window.location.search);if(E.length>0){const X=new URL(window.location.href);X.searchParams.delete("split"),window.history.replaceState(null,"",X),za||Bp(E);return}if(za)return;const F=f0t();F.length>0&&Bp(F)},[za,Bp]),h.useEffect(()=>{za||Js==="split"&&hh.length>0&&h0t(hh)},[Js,hh,za]);const l6=h.useRef(!1),c6=h.useRef(!1);h.useEffect(()=>{if(Ae){c6.current&&(c6.current=!1,!za&&s6.current.length>0&&ao(E=>E==="chat"?"split":E));return}if($n==="sessions"&&fh(null),Js==="split"&&(o_(),ao("chat"),l6.current=!0,!za)){c6.current=!0;const E=s6.current[0];E&&!Un.current&&jt.loadSession(E).catch(()=>{})}},[Ae,$n,Js,o_,za,jt]),h.useEffect(()=>{var E;Js!=="chat"||!l6.current||(l6.current=!1,!$n&&!Qs&&((E=oi.current)==null||E.focus()))},[Js,$n,Qs]);const nL=h.useRef(null),a_=h.useRef(null),u6=h.useRef(null),sL=h.useRef($n),rL=h.useRef(Qs);h.useEffect(()=>{var X,oe,Te,tt,It;const E=sL.current,F=rL.current;if(sL.current=$n,rL.current=Qs,$n){if($n==="extensions"||$n==="channels"){(X=a_.current)==null||X.focus();return}if($n==="plugins"){(oe=u6.current)==null||oe.focus();return}(Te=nL.current)==null||Te.focus()}else E?Qs||(tt=oi.current)==null||tt.focus():F&&!Qs&&((It=oi.current)==null||It.focus())},[$n,Qs]),h.useEffect(()=>{Qs&&($n&&fh(null),yi&&Il(null),Dg&&Pg(!1),(Js==="scheduledTasks"||Js==="goals")&&ao("chat"))},[Qs,$n,yi,Dg,Js]);const Ide=rs!==null&&!$n&&yi===null&&!Dg&&Js==="chat",Rde=Yn!==null&&!$n&&yi===null&&!Dg&&Js==="chat",[iL,oL]=h.useState(!1),[mh,d6]=h.useState(!1),aL=h.useRef(mh),[Dde,Pde]=h.useState(0),[Lde,Ode]=h.useState(0),[$de,lL]=h.useState(0),Bde=h.useCallback(()=>{let E=!1;return lL(F=>F+1),()=>{E||(E=!0,lL(F=>Math.max(0,F-1)))}},[]),cL=h.useRef((Qi==null?void 0:Qi.extensionsVersion)??0);h.useEffect(()=>{const E=(Qi==null?void 0:Qi.extensionsVersion)??0;if(E!==cL.current){cL.current=E;const F=Qi==null?void 0:Qi.lastExtensionChange;if((F==null?void 0:F.status)==="failed"){$e.dispatch([{type:"error",text:me("extensions.action.failed",{name:F.name??"",source:F.source??"",error:F.error??me("error.unknown")})}]);return}if((F==null?void 0:F.status)==="installed"){const X=F.name??F.source??me("extensions.label");$e.dispatch([{type:"status",text:F.version?me("extensions.install.installedWithVersion",{name:X,version:F.version}):me("extensions.install.installed",{name:X})}])}else if(F!=null&&F.status){const X=F.name??F.source??me("extensions.label"),oe=F.status==="updated"&&F.version?"extensions.manage.updatedWithVersion":`extensions.manage.${F.status}`;$e.dispatch([{type:"status",text:me(oe,{name:X,version:F.version??""})}])}jt.refreshCommands().catch(()=>{$e.dispatch([{type:"error",text:me("extensions.commands.refreshFailed")}])})}},[Qi==null?void 0:Qi.extensionsVersion,Qi==null?void 0:Qi.lastExtensionChange,jt,$e,me]);const[zde,Fde]=h.useState("workspace"),[Hde,Dy]=h.useState(null),[qde,uL]=h.useState(!1),[Ude,dL]=h.useState(!1),l_=h.useRef(null),Og=h.useRef(null),[h6,Py]=h.useState(null),Wde=h.useCallback(E=>{Py(null),Fk(F=>F+1),vr(E)},[vr]),[ph,f6]=h.useState(n??ei.Dark),[gh,hL]=h.useState(""),c_=h.useRef(gh);c_.current=gh;const $g=h.useCallback(E=>{c_.current=E,hL(E)},[]),vs=h.useRef(ke);vs.current=ke;const ya=h.useCallback(()=>vs.current.sessionId?!0:(_t("info",me("localCommand.noSession")),!1),[_t,me]),u_=ke.displayName,[rc,m6]=h.useState("default"),p6=h.useRef(rc);p6.current=rc;const Ly=h.useCallback(E=>{p6.current=E,m6(E)},[]),[g6,bh]=h.useState(!1),Oy=h.useRef(null),d_=h.useRef(null),[h_,$y]=h.useState({mode:"current"}),By=h.useRef(h_);h.useEffect(()=>{By.current=h_},[h_]);const fL=h.useRef(0),rd=h.useRef(null),mL=h.useRef(t);mL.current=t;const f_=h.useRef(void 0);h.useEffect(()=>{Js!=="goals"&&(f_.current=void 0)},[Js]);const m_=h.useCallback(()=>{const E=vs.current.sessionId;if(Oy.current)return!E||E===d_.current?Oy.current:Promise.resolve(void 0);if(E)return Promise.resolve(void 0);const F=(async()=>{var xt,Ct;let oe;const Te=c_.current||vs.current.currentModel,tt=p6.current||vs.current.currentMode,It=(xt=Lt.find(In=>In.primary))==null?void 0:xt.cwd,Rt=Ns.current,Kt=Rt?(Ct=Lt.find(In=>In.cwd===Rt&&In.trusted===!0))==null?void 0:Ct.cwd:void 0;return await Ugt({sessionActions:jt,modelId:Te,modeId:tt,workspaceCwd:je??Kt??It,worktree:By.current.mode==="worktree"?{slug:By.current.slug}:void 0,branch:By.current.mode==="branch"?{name:By.current.name}:void 0,onSessionCreated:mL.current,onSessionAllocated:In=>{d_.current=In,oe=In},getCurrentSessionId:()=>vs.current.sessionId}).then(In=>{In.worktree&&Gs(In.worktree),In.branch&&Ks(In.branch),$y({mode:"current"})}),br(void 0),oe})();Oy.current=F;const X=()=>{Oy.current===F&&(Oy.current=null,d_.current=null)};return F.then(X,X),F},[je,jt,Lt]),yh=h.useRef(rn);yh.current=rn;const pL=h.useRef(b);pL.current=b;const Bg=h.useCallback(()=>{var E;return vs.current.sessionId?vs.current.workspaceCwd:je??Ns.current??((E=zr.current.find(F=>F.primary))==null?void 0:E.cwd)},[je]),[gL,bL]=h.useState(0),zy=h.useRef(null);h.useEffect(()=>()=>{zy.current!==null&&clearTimeout(zy.current)},[]);const p_=h.useCallback(()=>{zy.current!==null&&clearTimeout(zy.current),zy.current=setTimeout(()=>{bL(E=>E+1)},2e3)},[]),yL=h.useCallback(E=>{ze==null||ze(E),bL(F=>F+1)},[ze]),zo=h.useRef(yL);zo.current=yL;const nl=h.useCallback(async(E,F,X)=>{var Cr,zi;const oe=!E.trimStart().startsWith("/"),Te=Vc.current,tt=ai.current,It=Zo.current,Rt=Af.current,Kt=()=>{bh(!1),Vc.current=Te,ai.current=tt,Zo.current=It,dh(Rt)};!(X!=null&&X.retry)&&oe&&(Vc.current=E,ai.current=F,Zo.current=null),dh(!1);const xt=!vs.current.sessionId;if(yh.current){const rl=vs.current.sessionId,ac=Bg(),Dl=st.current;bh(!0);try{await yh.current({sessionId:rl,prompt:E})}catch(Yc){console.warn("[web-shell] onSubmitBefore rejected, prompt cancelled",Yc),Kt();return}if(vs.current.sessionId!==rl||Bg()!==ac||st.current!==Dl){Kt();return}xt||bh(!1)}!yh.current&&xt&&bh(!0),My();try{await m_()}finally{xt&&bh(!1)}const Ct={images:F,inputAnnotations:X==null?void 0:X.inputAnnotations,optimisticUserMessage:X==null?void 0:X.optimisticUserMessage,retry:X==null?void 0:X.retry,...X!=null&&X.onAdmitted?{onAdmitted:X.onAdmitted}:{}};X!=null&&X.commitComposerAccepted?X.commitComposerAccepted():X!=null&&X.clearComposerOnPromptStart&&((Cr=oi.current)==null||Cr.clear());const In=vs.current.sessionId;return In&&E.trim()&&((zi=zo.current)==null||zi.call(zo,{type:"submit",sessionId:In,prompt:E,queued:!1}),p_()),await jt.sendPrompt(E,Ct)},[My,m_,Bg,p_,jt]),Vde=h.useCallback(async(E,F)=>{try{if(!F){const oe=(Pn==null?void 0:Pn.path)??Jn;if(ke.sessionId&&oe===E)return ke.sessionId;const Te=await Ve.client.workspaceByCwd(E).listWorkspaceSessions({pageSize:1,archiveState:"active"});if(Te.length>0)return Te[0].sessionId}return(await jt.createSession({workspaceCwd:E})).sessionId}catch{return}},[ke.sessionId,Jn,Ve.client,jt,Pn]),Gde=h.useMemo(()=>(ke.models??[]).filter(Qw).map(E=>({id:E.id,label:vm(E.label||E.id)})),[ke.models]),sl=Jn,g_=!!(!ke.sessionId&&((fO=Lt.find(E=>E.cwd===Jn))!=null&&fO.trusted)&&(Fr!=null&&Fr.branch));h.useEffect(()=>{g_||$y({mode:"current"})},[g_]);const Kde=h.useCallback(()=>{sl&&If({workspaceCwd:sl,gitCwd:Pn==null?void 0:Pn.path,view:"diff"})},[sl,Pn==null?void 0:Pn.path]),Yde=h.useCallback(()=>{sl&&If({workspaceCwd:sl,gitCwd:Pn==null?void 0:Pn.path,view:"commit"})},[sl,Pn==null?void 0:Pn.path]),Tu=UP||WP||VP||GP||KP||YP||XP||Mf!==void 0||yi!==null||Dg||h6!==null||i_!==null||iL||mh||pi||cs!=="clear"||$de>0||$n!==null||Js!=="chat",Es=h.useMemo(()=>{var E;return jce({capabilities:Ve.capabilities,intendedCwd:Jn,sessionId:ke.sessionId,workspaces:(E=Ve.capabilities)!=null&&E.workspaces||it?Lt:void 0})},[Jn,ke.sessionId,it,Ve.capabilities,Lt]),[b_,Xde]=h.useState(0),[b6,Qde]=h.useState({}),wL=h.useMemo(()=>({user:b_,workspace:Es?b6[Es.workspaceKey]??0:0}),[Es,b_,b6]),zp=o2(Es,((mO=Ve.capabilities)==null?void 0:mO.features)??[]),Jde=(Es==null?void 0:Es.sessionId)===ke.sessionId&&(!(Es!=null&&Es.cwd)||Es.cwd===ke.workspaceCwd)?Qi==null?void 0:Qi.settingsVersion:void 0,{descriptor:y_,reload:Fy}=qtt(Ve.client,Es,zp&&Js!=="split",JSON.stringify([b_,wL.workspace,Jde??null])),nn=h.useCallback((E,F)=>{if(aj(E)||QX(E)||h1(E))return;const X=g8t(E,F);console.error("[web-shell]",X,E),_t("error",X)},[_t]),Zde=h.useCallback(E=>_t("success",E),[_t]),{queuedPrompts:ehe,queuedTexts:the,enqueuePrompt:y6,removeQueuedPrompt:nhe,insertQueuedPrompt:she,editQueuedPrompt:rhe,editLastQueuedPrompt:ihe,clearQueuedPrompts:ohe}=cue({connected:Ml,sessionId:ke.sessionId,clientId:ke.clientId,streamingState:Re,sessionActions:jt,store:$e,editorRef:oi,reportError:nn,notifySuccess:Zde,t:me}),Fp=h.useCallback((E,F,X,oe,Te)=>{var Rt;if(yh.current){const Kt=vs.current.sessionId,xt=Bg(),Ct=st.current;return yh.current({sessionId:Kt,prompt:E}).then(()=>{var as,Cr;if(vs.current.sessionId!==Kt||Bg()!==xt||st.current!==Ct)return;y6(E,F,X,Te)!==!1&&(oe?oe():(as=oi.current)==null||as.clear()),Kt&&E.trim()&&((Cr=zo.current)==null||Cr.call(zo,{type:"submit",sessionId:Kt,prompt:E,queued:!0}))}).catch(In=>{console.warn("[web-shell] onSubmitBefore rejected queued prompt, cancelled",In)}),!1}const tt=y6(E,F,X,Te),It=vs.current.sessionId;return It&&E.trim()&&((Rt=zo.current)==null||Rt.call(zo,{type:"submit",sessionId:It,prompt:E,queued:!0})),tt},[Bg,y6]);h.useEffect(()=>{for(const E of gs)b8t(E)?_t(y8t(E),E.message):E.category!=="lifecycle"&&console.warn("[web-shell] daemon notice",E),qn(E.id)},[qn,gs,_t]);const w6=h.useRef(m);w6.current=m,h.useEffect(()=>{var E;Un.current=ke.sessionId,(E=Le.current)==null||E.abort(),Le.current=null,_e(null),qt(null),Py(null),C_.current=0},[ke.sessionId]);const vL=h.useCallback(()=>{var Te;if(!ya())return;const E=`local-recap-${On.current++}`,F=Zn.length,X=(Te=Zn.at(-1))==null?void 0:Te.id,oe=ke.sessionId;_e({anchorAfterId:X,anchorIndex:F,message:{id:E,role:"system",content:`※ ${me("recap.label")}: ${me("recap.loading")}`,variant:"info",source:"recap"}}),jt.recapSession().then(tt=>{Un.current===oe&&_e({anchorAfterId:X,anchorIndex:F,message:{id:E,role:"system",content:tt.recap?`※ ${me("recap.label")}: ${tt.recap}`:me("recap.empty"),variant:"info",source:"recap"}})},tt=>{Un.current===oe&&(_e(null),!aj(tt)&&!h1(tt)&&console.warn("[web-shell] unhandled recap failure",tt))})},[ke.sessionId,Zn,ya,jt,me]),xL=h.useCallback(E=>{var tt;const F=E.trim();if(!F){_t("error",me("btw.empty"));return}if(!ya())return;const X=`local-btw-${on.current++}`,oe=ke.sessionId;(tt=Le.current)==null||tt.abort();const Te=new AbortController;Le.current=Te,qt({id:X,role:"btw",question:F,answer:"",isPending:!0}),jt.btwSession(F,{signal:Te.signal}).then(It=>{Un.current===oe&&Le.current===Te&&(Le.current=null,qt({id:X,role:"btw",question:F,answer:It.answer||me("btw.emptyAnswer"),isPending:!1}))},It=>{Un.current===oe&&Le.current===Te&&(Le.current=null,qt(null),!aj(It)&&!h1(It)&&console.warn("[web-shell] unhandled btw failure",It))})},[ke.sessionId,_t,ya,jt,me]),kL=h.useCallback(()=>{var E;(E=Le.current)==null||E.abort(),Le.current=null,qt(null)},[]);h.useEffect(()=>{const E=F=>{var It;if(Tu||En)return;const X=Je;if(!X||X.role!=="btw")return;const oe=F.key.toLowerCase(),Te=F.key==="Escape"&&!F.ctrlKey&&!F.metaKey&&!F.altKey&&!F.shiftKey,tt=F.ctrlKey&&!F.metaKey&&!F.altKey&&!F.shiftKey&&(oe==="c"||oe==="d");if(X.isPending){if(!Te&&!tt)return}else{const Rt=((It=oi.current)==null?void 0:It.hasInput())??!1;if(!(!F.ctrlKey&&!F.metaKey&&!F.altKey&&!F.shiftKey&&(F.key==="Escape"||!Rt&&(F.key==="Enter"||F.key===" "))))return}F.preventDefault(),F.stopPropagation(),kL()};return window.addEventListener("keydown",E,!0),()=>window.removeEventListener("keydown",E,!0)},[Tu,Je,kL,En]);const wh=h.useCallback((E,F)=>zgt(Ge.current!=="idle",E,F,{append:X=>$e.appendLocalUserMessage(X)}),[$e]),id=h.useCallback(()=>(_t("error",me("queue.commandBlocked")),!1),[_t,me]),Hy=h.useCallback(E=>{f6(E),s==null||s(E)},[s]),zg=h.useCallback(E=>{un(E),i==null||i(E)},[i]),_L=h.useCallback(()=>{e6(!0)},[]),SL=jI({autoLoad:!0}),w_=dbe({autoLoad:!0}),v_=w_.reload,[ahe,x_]=h.useState(!1),{settings:Gc,setValue:Eu,reload:ic}=SL,lhe=h.useCallback(async()=>{const E=await ic();return(Es==null?void 0:Es.route)==="workspace-qualified"&&await Fy(),E},[Es==null?void 0:Es.route,Fy,ic]),CL=h.useMemo(()=>{const E=Gc.filter(X=>X.key!=="voiceModel");return Js==="split"?E:(Es==null?void 0:Es.route)==="legacy-primary"?Gc:!zp||!y_?E:Gc.findIndex(X=>X.key==="voiceModel")<0?[...E,y_]:Gc.map(X=>X.key==="voiceModel"?y_:X)},[Js,Es==null?void 0:Es.route,y_,zp,Gc]),che={...SL,settings:CL,reload:lhe},Fg=Gc.find(E=>E.key===y0),Hg=Gc.find(E=>E.key===s8t),qg=Gc.find(E=>E.key===hC),uhe=(()=>{const E=E2(CL,Bo,"voiceModel");return typeof E=="string"&&E.trim()?E.trim():void 0})(),dhe=(()=>{const E=E2(Gc,Bo,"visionModel");if(!(typeof E!="string"||!E.trim()))return R6t(E.trim())})(),hhe=(()=>{const E=E2(Gc,Bo,"fastModel");return typeof E=="string"&&E.trim()?E.trim():void 0})(),fhe=h.useMemo(()=>{const E=E2(Gc,Bo,"modelFallbacks");return typeof E=="string"?E.split(",").map(F=>F.trim()).filter(Boolean):[]},[Gc,Bo]),v6=h.useCallback((E,F)=>{if(E){if(F==="user"){Xde(X=>X+1);return}Qde(X=>({...X,[E.workspaceKey]:(X[E.workspaceKey]??0)+1}))}},[]),k_=h.useCallback(async(E,F,X=Es)=>{var oe;if(!X||!o2(X,((oe=Ve.capabilities)==null?void 0:oe.features)??[]))throw new Error("Voice model settings are unavailable for this workspace.");try{X.route==="legacy-primary"||F==="user"?await Eu(F,"voiceModel",E):await Htt(Ve.client,X,F,E)}catch(Te){throw v6(X,F),X.route==="legacy-primary"?await ic().catch(()=>{}):await Fy().catch(()=>{}),Te}v6(X,F),X.route==="legacy-primary"?await ic().catch(()=>{}):await Fy().catch(()=>{})},[v6,Es,Fy,ic,Eu,(pO=Ve.capabilities)==null?void 0:pO.features,Ve.client]),qy=h.useRef(Es),TL=h.useRef(((gO=Ve.capabilities)==null?void 0:gO.features)??[]);h.useLayoutEffect(()=>{var E;s_.current=yi,qP.current=Nf,JP.current=Js,i6.current=$n,aL.current=mh,qy.current=Es,TL.current=((E=Ve.capabilities)==null?void 0:E.features)??[]},[$n,Js,Es,yi,mh,Nf,(bO=Ve.capabilities)==null?void 0:bO.features]);const Rf=h.useRef(0),Kc=h.useRef(void 0),EL=h.useRef(void 0),x6=h.useRef(Es);h.useEffect(()=>()=>{Rf.current++,Kc.current=void 0},[]);const k6=h.useCallback(async(E,F)=>{var tt;const X=qy.current;if(!X||!o2(X,((tt=Ve.capabilities)==null?void 0:tt.features)??[])){nn(new Error("Voice model settings are unavailable for this workspace."),me("model.setVoice"));return}const oe=++Rf.current;Kc.current=F,EL.current=X.ownerKey;const Te=()=>{var It;return oe===Rf.current&&((It=qy.current)==null?void 0:It.ownerKey)===X.ownerKey&&o2(qy.current,TL.current)&&(F==="settings"?i6.current==="settings":i6.current===null)&&JP.current==="chat"&&s_.current===null&&!qP.current&&!aL.current};try{const It=await ztt(Ve.client,X);if(!Te()){oe===Rf.current&&(Kc.current=void 0);return}Kc.current=void 0,x6.current=X,Ede(Itt(It)),Ry(E),Il("voice")}catch(It){if(!Te()){oe===Rf.current&&(Kc.current=void 0);return}Kc.current=void 0,nn(It,me("model.setVoice"))}},[nn,me,(yO=Ve.capabilities)==null?void 0:yO.features,Ve.client]);h.useEffect(()=>{Kc.current&&(EL.current!==(Es==null?void 0:Es.ownerKey)||!zp)&&(Rf.current++,Kc.current=void 0)},[Es==null?void 0:Es.ownerKey,zp]),h.useEffect(()=>{const E=Kc.current;E&&!(E==="settings"?$n==="settings":$n===null)&&(Rf.current++,Kc.current=void 0)},[$n]),h.useEffect(()=>{Kc.current&&(Js!=="chat"||yi!==null||Nf||mh)&&(Rf.current++,Kc.current=void 0)},[Js,yi,mh,Nf]),h.useEffect(()=>{const E=x6.current;yi==="voice"&&((E==null?void 0:E.ownerKey)!==(Es==null?void 0:Es.ownerKey)||!zp||Js!=="chat")&&Il(null)},[Js,Es==null?void 0:Es.ownerKey,yi,zp]);const mhe=h.useMemo(()=>{const E=new Set,F=[];for(const X of(ke.models??[]).filter(Qw).filter(oe=>!oe.isRuntime)){const oe=X.baseModelId??PG(X.id);E.has(oe)||(E.add(oe),F.push({baseId:oe,label:vm(X.label||X.baseModelId||X.id)}))}return F},[ke.models]),[__,jL]=h.useState(!1),_6=h.useRef(__);_6.current=__,h.useEffect(()=>{if(n){f6(n);return}const E=$I(Fg==null?void 0:Fg.values.effective);E&&f6(E)},[n,Fg==null?void 0:Fg.values.effective]),h.useEffect(()=>{if(r!==void 0){un(Yh(r));return}const E=II(qg==null?void 0:qg.values.effective);E&&un(E)},[r,qg==null?void 0:qg.values.effective]);const phe=h.useCallback((E,F="user")=>{const X=Ke,Te=`/language ui ${E}${F==="workspace"?" --project":" --global"}`;zg(E);const tt=()=>Promise.all([jt.refreshCommands(),ic()]);if(Ge.current!=="idle"){zg(X),id();return}nl(Te,void 0).then(tt).catch(It=>{zg(X),nn(It,"Failed to sync /language command")})},[id,zg,ic,nn,nl,Ke,jt]),AL=h.useCallback(()=>{if(Ge.current!=="idle"){$e.dispatch([{type:"status",text:me("clear.blocked")}]);return}$e.reset()},[$e,me]),NL=h.useCallback(()=>{const E=_6.current,F=!_6.current;jL(F),Eu("workspace",n8t,F).catch(X=>{jL(E),nn(X,me("compact.saveFailed"))})},[nn,Eu,me]),Df=h.useCallback(E=>{if(!N3(E)){nn(new Error(`Unsupported approval mode: ${E}`),me("local.approvalMode"));return}if(!vs.current.sessionId){Ly(E);return}jt.setApprovalMode(E).then(F=>{const X=F.mode||E;m6(X);const oe=ys.current;if(!oe)return;if(E==="yolo"||E==="auto-edit"&&x8t(oe)){const tt=oe.options.find(It=>It.kind==="allow_once");if(tt){const It=oe.title||"";$e.dispatch([{type:"status",text:me("mode.autoApproved",{tool:It})}]),jt.submitPermission(oe.id,tt.id).catch(Rt=>{nn(Rt,"Failed to auto-approve tool call")})}}}).catch(F=>{nn(F,me("local.approvalMode"))})},[jt,nn,$e,me,Ly]);h.useEffect(()=>{Ge.current=Re},[Re]);const ML=h.useRef(ke.sessionId);h.useEffect(()=>{if(ML.current===ke.sessionId)return;ML.current=ke.sessionId;const E=mt.current.length;mt.current=[],ke.sessionId!==d_.current&&(xn.current++,ws.current=!1),E>0&&_t("warning",me("queue.shellDropped",{count:E}))},[ke.sessionId,_t,me]);const IL=h.useRef(Re);h.useEffect(()=>{const E=IL.current;if(IL.current=Re,E==="idle"||Re!=="idle"||ws.current)return;const F=mt.current;if(F.length===0)return;mt.current=[],ws.current=!0;const X=++xn.current,oe=vs.current.sessionId;(async()=>{try{let Te=F;for(;Te.length>0;){for(let tt=0;tt<Te.length;tt++){const It=xn.current!==X;if(It||vs.current.sessionId!==oe||vs.current.status!=="connected"){let Rt=Te.length-tt;It||(Rt+=mt.current.length,mt.current=[]),console.warn("[web-shell] dropping %d queued shell command(s)",Rt),_t("warning",me("queue.shellDropped",{count:Rt}));return}try{await jt.sendShellCommand(Te[tt])}catch(Rt){nn(Rt,`Failed to execute shell command: !${Te[tt]}`)}}Te=mt.current,mt.current=[]}}finally{xn.current===X&&(ws.current=!1)}})()},[Re,jt,nn,_t,me]),h.useEffect(()=>{let E=null;for(let X=Ht.length-1;X>=0;X--){const oe=Ht[X];if((oe==null?void 0:oe.kind)==="user")break;if((oe==null?void 0:oe.kind)==="error"&&oe.source==="turn_error"){E=oe.id;break}if((oe==null?void 0:oe.kind)!=="debug")break}const F=Ml&&E!==null&&E!==Zo.current&&Vc.current.length>0;nd.current=F?E:null,dh(F)},[Ht,Ml]),h.useEffect(()=>{d==null||d(Re)},[Re,d]);const RL=h.useRef(Re),DL=h.useRef(void 0);h.useEffect(()=>{var F;const E=RL.current;if(RL.current=Re,Re!=="idle"&&(DL.current=vs.current.sessionId),E!=="idle"&&Re==="idle"){const X=vs.current.sessionId;if(!X||X!==DL.current)return;const oe=nd.current!=null?new Error(`Turn error (block ${nd.current})`):void 0;(F=zo.current)==null||F.call(zo,{type:"turn_complete",sessionId:X,error:oe})}},[Re]),h.useEffect(()=>{u==null||u(ke.status)},[ke.status,u]),h.useEffect(()=>{be==null||be(Ht)},[Ht,be]),h.useEffect(()=>{if(ke.error){const E=new Error(ke.error);f==null||f(E)}},[ke.error,f]),h.useEffect(()=>{hL(ke.currentModel??"")},[ke.currentModel,ke.sessionId]),h.useEffect(()=>{m6(ke.currentMode??"default")},[ke.currentMode,ke.sessionId]),h.useEffect(()=>{const E=si.current;if(ke.sessionId&&ke.sessionId!==E&&ch(null),si.current=ke.sessionId,!ke.sessionId&&ke.missingSession){Kn.current=ke.sessionId,zs.current=void 0,ns.current=void 0;return}const F=Jn??ke.workspaceCwd,X=Lt.find(Te=>Te.cwd===F);if(ke.sessionId&&!Ve.capabilities)return;const oe=X&&!X.primary?X.id:void 0;Kn.current===ke.sessionId&&zs.current===oe&&ns.current===F||(Kn.current=ke.sessionId,zs.current=oe,ns.current=F,e==null||e(ke.sessionId,oe,F))},[ke.missingSession,ke.sessionId,ke.workspaceCwd,e,Jn,Ve.capabilities,Lt]);const PL=h.useRef(void 0),S6=h.useRef(void 0);h.useEffect(()=>{var X;const E=ke.sessionId,F=ke.displayName;if(!(!E||!F)){if(E!==PL.current){PL.current=E,S6.current=F;return}F!==S6.current&&(S6.current=F,(X=zo.current)==null||X.call(zo,{type:"rename",sessionId:E,newName:F}))}},[ke.sessionId,ke.displayName]),h.useEffect(()=>{const E=o8t(Ht);ch(F=>E?(F==null?void 0:F.condition)===E.condition&&F.setAt===E.setAt?F:E:F&&null)},[Ht]),h.useEffect(()=>{const E=F=>{const X=F.detail;if(!(X!=null&&X.active)){ch(null);return}X.condition&&ch({condition:X.condition,setAt:X.setAt??Date.now()})};return window.addEventListener(LM,E),()=>window.removeEventListener(LM,E)},[]);const S_=h.useRef(null),C_=h.useRef(0);h.useEffect(()=>{C_.current=0},[ke.sessionId]),h.useEffect(()=>{function X(){if(document.hidden){S_.current===null&&(S_.current=Date.now());return}const oe=S_.current;if(S_.current=null,oe===null||Date.now()-oe<18e4||Ge.current!=="idle"||!ke.sessionId)return;const Te=$e.getSnapshot().blocks.length;Te-C_.current<4||(C_.current=Te,jt.recapSession().then(tt=>{tt.recap&&$e.dispatch([{type:"status",text:`※ ${me("recap.label")}: ${tt.recap}`,source:"recap"}])},tt=>{console.error("[auto-recap] failed:",tt)}))}return document.addEventListener("visibilitychange",X),()=>document.removeEventListener("visibilitychange",X)},[ke.sessionId,jt,$e,me]);const C6=h.useCallback(()=>{const E=N3(rc)?Aw.indexOf(rc):-1,F=Aw[(E+1)%Aw.length];Df(F)},[rc,Df]),Uy=h.useCallback((E,F)=>{ya()&&(wh(E)||jt.getContextUsage({detail:F}).then(X=>{$e.dispatch([{type:"status",text:QUe(X)}]),Uc("smooth")}).catch(X=>{nn(X,"Failed to load context usage")}))},[wh,$e,ya,jt,nn,Uc]),ghe=h.useCallback(()=>{Uy("/context detail",!0)},[Uy]),T_=h.useCallback(E=>{ya()&&jt.branchSession(E||void 0).then(F=>{$e.dispatch([{type:"status",text:me("branch.success",{name:F.displayName})}])}).catch(F=>{nn(F,me("branch.failed"))})},[nn,ya,jt,$e,me]),bhe=h.useCallback(()=>{T_()},[T_]),Wy=h.useRef(0),E_=h.useCallback(E=>{const F=++Wy.current;return window.setTimeout(()=>{var X;F!==Wy.current||Oa.current||E!==void 0&&vs.current.sessionId!==E||(X=oi.current)==null||X.focus()},0),F},[]),Rl=h.useCallback(async(E,F)=>{const X=je??E;st.current+=1,Ns.current=X,br(X),$y({mode:"current"}),He(),lo(),F!=null&&F.keepView||ao("chat");let oe;try{const Te=jt.clearSession();return oe=E_(),await Promise.all([Te,$p(X)]),Gs(void 0),Ks(void 0),!0}catch(Te){return Wy.current===oe&&(Wy.current+=1),nn(Te,"Failed to start a new chat"),!1}},[He,lo,je,nn,$p,E_,jt]),Ug=h.useCallback(async(E,F=zr.current)=>{var oe;if(Ye.current)return;const X=Symbol("workspace-switch");Ye.current=X;try{const Te=(oe=F.find(It=>It.primary))==null?void 0:oe.cwd,tt=E??Te;if(E){const It=F.find(Rt=>Rt.cwd===E);if(!(It!=null&&It.trusted))return}if(vs.current.sessionId){if(vs.current.workspaceCwd===tt)return;await Rl(E);return}st.current+=1,Ns.current=E,br(E)}finally{Ye.current===X&&(Ye.current=null)}},[Rl]),j_=h.useCallback(async E=>{try{const F=await(ft==null?void 0:ft()),X=(F==null?void 0:F.workspaces)??[],oe=X.find(Te=>Te.cwd===E);return oe!=null&&oe.trusted&&await Ug(oe.primary?void 0:oe.cwd,X),F!==void 0}catch(F){return nn(F,"Failed to refresh the workspace list"),!1}},[ft,nn,Ug]),yhe=h.useCallback(async(E,F,X)=>{if(xe.current)throw new Error(me("sidebar.addWorkspaceBusyError"));const oe=Symbol("workspace-mutation");xe.current=oe,gi(!0);try{const Te=ts===!0&&F,tt=Sr?X:void 0,It=await Dn.addWorkspace(E,{persist:Te,...tt?{displayName:tt}:{}});if(Te&&It.persisted!==!0)throw new Error(me("sidebar.addWorkspacePersistenceError"));if(!await j_(It.cwd))throw new Error(me("sidebar.addWorkspaceRefreshError"))}finally{xe.current===oe&&(xe.current=null,gi(!1))}},[ts,j_,me,Sr,Dn]),T6=h.useCallback(async()=>{sr("refreshing");try{const E=await(ft==null?void 0:ft());if(!E)return;const F=E.workspaces??[],X=Mt.current;if(X){const oe=F.find(Te=>Te.cwd===X);oe!=null&&oe.trusted&&await Ug(oe.primary?void 0:oe.cwd,F),Mt.current=void 0,sr("clear")}else sr("awaiting-ack")}catch(E){nn(E,"Failed to refresh the workspace list")}},[nn,sr,Ug,ft]),LL=h.useCallback(async()=>{if(Et.current!=="clear"||xe.current)return;const E=Symbol("workspace-mutation");xe.current=E,gi(!0);try{const F=await Dn.addScratchWorkspace();await j_(F.cwd)||(Mt.current=F.cwd,sr("refreshing"))}catch(F){F instanceof Rc&&(F.status<500||F.status===501)?nn(F,me("sidebar.addWorkspaceError")):(Mt.current=void 0,sr("refreshing"),await T6())}finally{xe.current===E&&(xe.current=null,gi(!1))}},[j_,T6,nn,sr,me,Dn]),whe=h.useCallback(E=>{Ug(E)},[Ug]),vhe=h.useCallback(()=>{LL()},[LL]),xhe=h.useCallback(()=>{lr(!0)},[]);h.useEffect(()=>()=>{uh.current&&clearTimeout(uh.current)},[]);const khe=h.useCallback(E=>{Rg.current=E,uh.current&&clearTimeout(uh.current),uh.current=setTimeout(()=>{e_(E),uh.current=null},120)},[]),_he=h.useCallback(E=>{n_(E)},[]),{suggestion:ea,dismiss:Vy,suppress:OL}=Q6t({enabled:((wO=ke.capabilities)==null?void 0:wO.features.includes("session_generation"))===!0,inputText:Zk,messages:Zn,sessionId:ke.sessionId,contextUsageRatio:(ke.contextWindow??0)>0?(ke.tokenCount??0)/(ke.contextWindow??0):0,isRunning:Re!=="idle",dialogOpen:Tu||Qs,hasAttachments:t_,generateContent:jt.generateSessionContent}),A_=h.useCallback(E=>{const F=rd.current;if(!F||E!==void 0&&F.token!==E)return;const X=vs.current.sessionId;if(F.sourceSessionId!==void 0&&X!==void 0&&X!==F.sourceSessionId){rd.current=null,Ie(!1);return}F.sessionClearCompleted&&X===void 0&&(F.submitScheduled||(rd.current={...F,submitScheduled:!0},window.setTimeout(()=>{var Te,tt;const oe=rd.current;if(!(!oe||oe.token!==F.token)){if(vs.current.sessionId!==void 0){rd.current=null,Ie(!1);return}rd.current=null,(Te=oi.current)==null||Te.submit(),(tt=oi.current)==null||tt.focus(),Ie(!1)}},0)))},[]);h.useEffect(()=>{A_()},[ke.sessionId,A_]);const She=h.useCallback(()=>{const E=Rg.current.trim();if(!E||G)return;if((ea==null?void 0:ea.suggestion)!=="new_session"||ea.classifiedInput!==E||ea.sourceSessionId!==vs.current.sessionId){Vy();return}OL(),Ie(!0);const F=fL.current+1;fL.current=F,rd.current={token:F,sourceSessionId:vs.current.sessionId,sessionClearCompleted:!1,submitScheduled:!1},Rl().then(X=>{const oe=rd.current;if(!X||(oe==null?void 0:oe.token)!==F){(oe==null?void 0:oe.token)===F&&(rd.current=null),Ie(!1);return}rd.current={...oe,sessionClearCompleted:!0},e==null||e(void 0),A_(F)})},[Rl,Vy,A_,G,ea,e,OL]),Che=h.useCallback(()=>{var F,X,oe;const E=Rg.current.trim();if(!E||(ea==null?void 0:ea.suggestion)!=="btw"||ea.classifiedInput!==E||ea.sourceSessionId!==vs.current.sessionId||((F=oi.current)==null?void 0:F.hasAttachments())!==!1){Vy();return}Vy(),(X=oi.current)==null||X.submit({text:`/btw ${E}`}),(oe=oi.current)==null||oe.focus()},[Vy,ea]),$L=h.useMemo(()=>({openSplitView:()=>{He(),tL()},openSessionOverview:()=>{He(),Ba("sessions")},openSessionDrawer:eL,createNewSession:()=>Rl()}),[He,Rl,Ba,eL,tL]);h.useEffect(()=>{HG(K,$L)},[$L,K]),h.useEffect(()=>()=>{HG(K,null)},[K]);const The=h.useCallback(async()=>{if(!Ig.current){Ig.current=!0,Ay(!0);try{await Rl()&&(e==null||e(void 0))}finally{Ig.current=!1,Ay(!1)}}},[Rl,e]),Hp=h.useCallback(async(E,F)=>{Wy.current+=1,ve(E),$y({mode:"current"}),Gs(void 0),Ks(void 0),He(),lo();try{await jt.loadSession(E,{workspaceCwd:F})}catch(X){throw ve(oe=>oe===E?null:oe),X}},[He,lo,jt]),E6=h.useCallback(E=>{ao("chat"),Hp(E).catch(F=>{nn(F,"Failed to open session")})},[Hp,nn]);h.useEffect(()=>{const E=F=>{const X=F.detail;typeof X=="string"&&X&&E6(X)};return window.addEventListener("qwen:open-session",E),()=>window.removeEventListener("qwen:open-session",E)},[E6]),h.useEffect(()=>{Ue!==null&&ke.sessionId===Ue&&!ke.loadingTranscript&&!ke.catchingUp&&(ve(null),E_(Ue))},[ke.catchingUp,ke.loadingTranscript,ke.sessionId,E_,Ue]);const qp=h.useRef(null),j6=h.useCallback(E=>{const F=qp.current;F&&F.sessionId===E&&(clearTimeout(F.timer),qp.current=null)},[]),N_=h.useCallback(E=>new Promise((F,X)=>{let oe=!1;nl(E,void 0,{onAdmitted:()=>{oe||(oe=!0,F())}}).then(()=>{oe||X(new Error("Run was cancelled before it started"))},tt=>{oe||X(tt)})}),[nl]),M_=h.useCallback(()=>{const E=qp.current,F=vs.current;!E||F.sessionId!==E.sessionId||F.loadingTranscript||F.catchingUp||(clearTimeout(E.timer),qp.current=null,N_(E.prompt).then(()=>E.resolve(),X=>E.reject(X)))},[N_]),Ehe=h.useCallback((E,F)=>{if(ao("chat"),!F)return N_(E);const X=qp.current;return X&&(clearTimeout(X.timer),qp.current=null,X.reject(new Error("superseded by another run"))),new Promise((oe,Te)=>{const tt=setTimeout(()=>{j6(F),Te(new Error("Timed out switching to the task session"))},e8t);qp.current={sessionId:F,prompt:E,resolve:oe,reject:Te,timer:tt},Hp(F).then(()=>M_()).catch(It=>{j6(F),Te(It)})})},[N_,Hp,j6,M_]);h.useEffect(()=>{M_()},[ke.sessionId,ke.loadingTranscript,ke.catchingUp,M_]);const A6=h.useCallback(()=>{ya()&&jt.getTasks().then(E=>{Py({snapshot:E})}).catch(E=>{nn(E,"Failed to load tasks")})},[nn,ya,jt]),BL=h.useCallback((E,F)=>{ch({condition:E,setAt:F}),$e.dispatch([{type:"status",text:bW({kind:"set",condition:E,setAt:F})}])},[$e]),zL=h.useCallback(E=>{E&&($e.dispatch([{type:"status",text:bW({kind:"cleared",condition:E.condition,durationMs:Date.now()-E.setAt})}]),ch(null))},[$e]),I_=h.useCallback(E=>ya()?($e.appendLocalUserMessage(E),jt.clearGoal().catch(F=>{nn(F,"Failed to clear /goal")}),!0):!1,[nn,ya,jt,$e]),jhe=h.useCallback(()=>jt.getRewindSnapshots(),[jt]),Ahe=h.useCallback(E=>jt.rewindSession(E,{rewindFiles:!1}).then(()=>{}),[jt]),Nhe=h.useCallback(E=>{if(h1(E))return;const F=E instanceof Error?E.message:String(E);_t("error",me("rewind.failed",{reason:F}))},[_t,me]),FL=h.useCallback((E,F,X)=>{const oe=r9(E),Te=(X==null?void 0:X.sendToDaemon)??!0,tt=()=>{const It=!!yh.current,Rt=!vs.current.sessionId||It;return nl(E,F,{clearComposerOnPromptStart:Rt,commitComposerAccepted:Rt?X==null?void 0:X.commitComposerAccepted:void 0}).catch(Kt=>{nn(Kt,"Failed to send /goal command")}),!Rt};return oe&&BP(oe)?Te?I_(E):($e.appendLocalUserMessage(E),zL(Ny.current),!0):oe?Te?tt():($e.appendLocalUserMessage(E),BL(oe,Date.now()),!0):(Lg(),!0)},[zL,BL,I_,Lg,nn,nl,$e,vs]),Gy=h.useMemo(()=>new Set((p??[]).map(oj).filter(Boolean)),[p]),Mhe=Gy.has("settings"),HL=h.useCallback((E,F,X,oe)=>{var It;if(fue(E,pL.current,nn))return!0;if(vs.current.loadingTranscript)return _t("warning",me("editor.sessionLoading")),!1;if(due({connectionStatus:vs.current.status,hasSession:!!vs.current.sessionId,restartSseOnPrompt:!!Wt}))return _t("warning",me("editor.connectionDisconnected")),!1;const Te=Ge.current!=="idle",tt=(Rt,Kt,xt,Ct)=>{const In=!!yh.current,as=!vs.current.sessionId||In;return nl(Rt,Kt,{...Ct,clearComposerOnPromptStart:as,commitComposerAccepted:as?X:void 0}).catch(Cr=>nn(Cr,xt)),!as};if(E.startsWith("/")){const Rt=E.match(hue);if(Rt){const Kt=Rt[1];if(Gy.has(oj(Kt)))return Te?Fp(E,F,void 0,X,oe==null?void 0:oe.inputAnnotations):tt(E,F,"Failed to send hidden slash command",{inputAnnotations:oe==null?void 0:oe.inputAnnotations});if(Kt==="help")return e6(!0),!0;if(Kt==="diff")return sl?(If({workspaceCwd:sl,gitCwd:Pn==null?void 0:Pn.path,view:"diff"}),!0):(_t("info",me("localCommand.diffNoWorkspace")),!0);if(Kt==="log")return sl?(If({workspaceCwd:sl,gitCwd:Pn==null?void 0:Pn.path,view:"log"}),!0):(_t("info",me("localCommand.logNoWorkspace")),!0);if(Kt==="prs")return sl?Nr?(If({workspaceCwd:sl,view:"prs"}),!0):(_t("info",me("localCommand.prsUnsupported")),!0):(_t("info",me("localCommand.prsNoWorkspace")),!0);if(Kt==="tasks")return A6(),!0;if(Kt==="goal")return r9(E)?Te?eSt(E)?I_(E):id():FL(E,F,{commitComposerAccepted:X}):(Lg(),!0);if(Kt==="theme"){const xt=E.slice(Rt[0].length).trim().toLowerCase();return xt==="dark"||xt==="light"?Hy(xt):xt?_t("error",me("error.unsupportedTheme")):t6(!0),!0}if(Kt==="language"){const xt=E.slice(Rt[0].length).trim(),[Ct,In]=xt.split(/\s+/);if(!xt)return $e.dispatch([{type:"status",text:[me("language.current",{language:RI(Ke)}),me("language.usage"),me("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;if((Ct==null?void 0:Ct.toLowerCase())==="ui"){if(!In)return $e.dispatch([{type:"status",text:[me("language.set"),"",me("language.usage"),"",me("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;const as=In.toLowerCase();if(!["en","zh","zh-cn","zh_cn"].includes(as))return _t("error",me("language.invalid")),!0;const zi=Yh(In);if(zg(zi),!Te){const rl=!!yh.current,ac=!vs.current.sessionId||rl;return nl(`/language ui ${zi}`,void 0,{clearComposerOnPromptStart:ac,commitComposerAccepted:ac?X:void 0}).then(()=>jt.refreshCommands()).catch(Dl=>{nn(Dl,"Failed to sync /language command")}),!ac}return!0}}if(Kt==="copy"){const xt=E.slice(Rt[0].length).trim();return C6t(ds.current,xt).then(Ct=>{$e.dispatch([{type:Ct.status==="error"?"error":"status",text:T8t(Ct.message,me)}])}).catch(Ct=>{nn(Ct,me("copy.failedFallback"))}),!0}if(Kt==="delete")return Q5(!0),!0;if(Kt==="release")return J5(!0),!0;if(Kt==="rewind")return ya()?(Z5(!0),!0):!1;if(Kt==="branch"){if(Te)return id();const xt=E.slice(Rt[0].length).trim();return T_(xt||void 0),!0}if(Kt==="fork"){if(Te)return id();if(!ya())return!1;const xt=E.slice(Rt[0].length).trim();return xt?(jt.forkSession(xt).then(Ct=>{if(!Ct.launched){_t("warning",me("fork.notStarted"));return}_t("success",me("fork.started",{name:Ct.description}))}).catch(Ct=>{const In=Ct instanceof Error?Ct.message:String(Ct);nn(Ct,me("fork.failed",{reason:In}))}),!0):(_t("error",me("fork.empty")),!0)}if(Kt==="auth")return d6(!0),!0;if(Kt==="model"){const xt=E.slice(Rt[0].length).trim();if(xt==="--fast")return Il("fast"),!0;if(xt.startsWith("--fast "))return Te?Fp(E,F,void 0,X,oe==null?void 0:oe.inputAnnotations):tt(E,F,"Failed to send /model --fast",{inputAnnotations:oe==null?void 0:oe.inputAnnotations});if(xt==="--voice")return wh(E,F)||k6("workspace","command"),!0;if(xt.startsWith("--voice ")){const Ct=xt.replace(/^--voice\s+/,"");return k_(Ct,"workspace").catch(In=>nn(In,me("model.setVoice"))),!0}if(xt==="--vision")return Il("vision"),!0;if(xt.startsWith("--vision ")){const Ct=xt.replace(/^--vision\s+/,"");return Eu("workspace","visionModel",Ct).catch(In=>nn(In,me("model.setVision"))),!0}if(xt){if(!vs.current.sessionId)return $g(xt),!0;jt.setModel(xt).then(()=>{$g(xt)}).catch(Ct=>{nn(Ct,me("model.switch"))})}else Il("main");return!0}if(Kt==="plan"){if(Te)return id();const xt=E.slice(Rt[0].length).trim();return vs.current.sessionId?(xt&&bh(!0),jt.setApprovalMode("plan").then(()=>{if(Ly("plan"),xt)return nl(xt,F,{clearComposerOnPromptStart:!0,inputAnnotations:oe==null?void 0:oe.inputAnnotations}).catch(Ct=>nn(Ct,"Failed to send plan prompt"))}).catch(Ct=>{nn(Ct,me("mode.plan"))}).finally(()=>{xt&&bh(!1)}),!xt):(Ly("plan"),xt?tt(xt,F,"Failed to send plan prompt",{inputAnnotations:oe==null?void 0:oe.inputAnnotations}):!0)}if(Kt==="approval-mode"){const xt=E.slice(Rt[0].length).trim();return xt?Df(xt):Pg(!0),!0}if(Kt==="mcp"){const xt=E.slice(Rt[0].length).trim().toLowerCase();return Dn.loadMcpStatus().then(Ct=>{r6({status:Ct,toolsByServer:{},resourcesByServer:{},showDescriptions:xt==="desc",showSchema:xt==="schema",showTips:!xt}),Ba("mcp")}).catch(Ct=>{nn(Ct,"Failed to load MCP status")}),!0}if(Kt==="skills"){const xt=E.slice(Rt[0].length).trim();if(!xt||xt==="detail"||xt==="details")Ba("skills");else return Te?Fp(E,F,void 0,X,oe==null?void 0:oe.inputAnnotations):tt(E,F,"Failed to send /skills command",{inputAnnotations:oe==null?void 0:oe.inputAnnotations});return!0}if(Kt==="tools"){const xt=E.slice(Rt[0].length).trim().toLowerCase();if(xt==="desc"||xt==="descriptions")QP(!0);else{if(wh(E,F))return!0;Dn.loadToolsStatus().then(Ct=>{const In=(Ct==null?void 0:Ct.tools)??[];if(In.length===0)$e.dispatch([{type:"status",text:me("tools.none")}]);else{const as=In.map(Cr=>`- ${Cr.displayName||Cr.name}`).join(`
`);$e.dispatch([{type:"status",text:`${me("tools.available")}

${as}`}])}Uc("smooth")}).catch(Ct=>{nn(Ct,"Failed to load tools")})}return!0}if(Kt==="settings")return Ba("settings"),!0;if(Kt==="schedule")return o6(),!0;if(Kt==="context"){const xt=E.slice(Rt[0].length).trim().toLowerCase();if(xt===""||xt==="detail"||xt==="-d")return Uy(E,xt==="detail"||xt==="-d"),!0}if(Kt==="memory"){const xt=E.slice(Rt[0].length).trim().toLowerCase();if(xt==="refresh")Pde(Ct=>Ct+1);else if(xt==="add"||xt.startsWith("add ")){const Ct=xt.slice(3).trim();Fde(Ct==="user"||Ct==="global"?"global":"workspace"),Ode(In=>In+1)}return oL(!0),!0}if(Kt==="agents"){const xt=E.slice(Rt[0].length).trim().toLowerCase();return Dy(xt==="create"||xt==="create user"||xt==="create global"?"global":xt==="create project"||xt==="create workspace"?"workspace":null),Ba("agents"),!0}if(Kt==="extensions"){const xt=E.slice(Rt[0].length).trim(),Ct=(It=xt.split(/\s+/)[0])==null?void 0:It.toLowerCase();if(!Ct||Ct==="manage")return Ba("extensions"),!0;if(Ct==="install"){if(Te)return id();const In=xt.slice(7).trim().split(/\s+/);let as="",Cr,zi,rl,ac,Dl=null;for(let Xc=0;Xc<In.length;Xc++){const il=In[Xc];if(il)if(il==="--auto-update")rl=!0;else if(il==="--pre-release"||il==="--allow-pre-release")ac=!0;else if(il==="--ref"||il==="--registry"){const Up=In[Xc+1];if(!Up||Up.startsWith("--")){Dl=me("extensions.install.missingOptionValue",{option:il});break}il==="--ref"?Cr=Up:zi=Up,Xc+=1}else if(il.startsWith("--")){Dl=me("extensions.install.unknownOption",{option:il});break}else if(!as)as=il;else{Dl=me("extensions.install.usage");break}}if(Dl)return $e.appendLocalUserMessage(E),$e.dispatch([{type:"error",text:Dl}]),!0;if(!as)return $e.appendLocalUserMessage(E),$e.dispatch([{type:"error",text:me("extensions.install.usage")}]),!0;const Yc=vs.current.clientId;return Yc?($e.appendLocalUserMessage(E),$e.dispatch([{type:"status",text:me("extensions.install.started",{source:as})}]),Dn.installExtension({source:as,...Cr?{ref:Cr}:{},...zi?{registry:zi}:{},...rl!==void 0?{autoUpdate:rl}:{},...ac!==void 0?{allowPreRelease:ac}:{},consent:!0},Yc).then(()=>{}).catch(Xc=>{nn(Xc,me("extensions.install.requestFailed"))}),!0):(_t("warning",me("extensions.install.waitForSession")),!0)}return wh(E,F)||$e.dispatch([{type:"error",text:me("extensions.install.usage")}]),!0}if(Kt==="clear"||Kt==="new"||Kt==="reset")return Rl(),!0;if(Kt==="rename"){const xt=k8t(E.slice(Rt[0].length));if(xt.type==="auto"||xt.type==="delegate")return Te?Fp(E,F,void 0,X,oe==null?void 0:oe.inputAnnotations):tt(E,F,"Failed to send /rename command",{inputAnnotations:oe==null?void 0:oe.inputAnnotations});const Ct=xt.displayName;return Ct?ya()?(jt.renameSession(Ct).then(()=>{$e.dispatch([{type:"status",text:me("rename.success",{name:Ct})}])}).catch(In=>{nn(In,"Failed to rename session")}),!0):!1:(_t("error",me("rename.empty")),!0)}if(Kt==="resume"){const xt=E.slice(Rt[0].length).trim();return xt?(He(),lo(),jt.loadSession(xt).catch(Ct=>{nn(Ct,"Failed to load session")})):(He(),X5(!0)),!0}if(Kt==="recap")return vL(),!0;if(Kt==="btw")return xL(E.slice(Rt[0].length)),!0;if(Kt==="stats"){const xt=E.slice(Rt[0].length).trim().toLowerCase();let Ct="overview";return xt==="model"?Ct="model":xt==="tools"&&(Ct="tools"),ya()?(wh(E,F)||jt.getStats().then(In=>{$e.dispatch([{type:"status",text:BWe(In,Ct)}]),Uc("smooth")}).catch(()=>{}),!0):!1}if(Kt==="status"||Kt==="about")return wh(E,F)||Promise.all([Dn.loadPreflight().catch(()=>null),Dn.loadProviders().catch(()=>null),Dn.loadEnv().catch(()=>null)]).then(([xt,Ct,In])=>{var Up,SO,CO,TO,EO,jO;const as=DG(xt,In);let Cr=as.authSource;!Cr&&((Up=Ct==null?void 0:Ct.current)!=null&&Up.authType)&&(Cr=Ct.current.authType);const zi=[];as.nodeVersion&&zi.push(`Node.js v${as.nodeVersion}`),as.npmVersion&&zi.push(`npm ${as.npmVersion}`);let rl="";Cr&&(Cr.startsWith("oauth")||Cr==="qwen-oauth"?rl="Qwen OAuth":rl=`API Key - ${Cr}`);const ac=`${as.platform} ${as.arch}`.trim(),Dl=c_.current,Yc=vs.current,il={cliVersion:((SO=Yc.capabilities)==null?void 0:SO.qwenCodeVersion)||"",runtime:zi.join(" / "),platform:ac,auth:rl,baseUrl:((CO=Ct==null?void 0:Ct.current)==null?void 0:CO.baseUrl)||"",model:Dl||Yc.currentModel||((TO=Ct==null?void 0:Ct.current)==null?void 0:TO.modelId)||"",fastModel:((EO=Ct==null?void 0:Ct.current)==null?void 0:EO.fastModelId)||Dl||Yc.currentModel||((jO=Ct==null?void 0:Ct.current)==null?void 0:jO.modelId)||"",sessionId:Yc.sessionId||"",sandbox:as.sandbox,proxy:as.proxy,memoryUsage:as.memoryUsage};$e.dispatch([{type:"status",text:nVe(il)}]),Uc("smooth")}),!0;if(Kt==="bug"){const xt=E.slice(Rt[0].length).trim();return wh(E,F)||Promise.all([Dn.loadPreflight().catch(()=>null),Dn.loadEnv().catch(()=>null)]).then(([Ct,In])=>{var rl;const as=DG(Ct,In),Cr=((rl=vs.current.capabilities)==null?void 0:rl.qwenCodeVersion)||"",zi={};if(Cr&&(zi.cliVersion=Cr),as.nodeVersion&&(zi.nodeVersion=as.nodeVersion),as.npmVersion&&(zi.npmVersion=as.npmVersion),as.platform&&(zi.platform=as.platform),as.arch&&(zi.arch=as.arch),as.sandbox&&(zi.sandbox=as.sandbox),as.memoryUsage&&(zi.memoryUsage=as.memoryUsage),w6.current)w6.current({title:xt,systemInfo:zi}),$e.dispatch([{type:"status",text:me("bug.submitted")}]);else{const ac=Object.entries(zi).filter(([,Xc])=>Xc).map(([Xc,il])=>`${Xc}: ${il}`).join(`
`),Dl=`https://github.com/QwenLM/qwen-code/issues/new?template=bug_report.yml&title=${encodeURIComponent(xt)}&info=${encodeURIComponent(`
`+ac+`
`)}`,Yc=window.open(Dl,"_blank");Yc?(Yc.opener=null,$e.dispatch([{type:"status",text:me("bug.submitted")}])):_t("error",me("bug.popupBlocked"))}}).catch(Ct=>{nn(Ct,me("bug.failed"))}),!0}}return Te?Fp(E,F,void 0,X,oe==null?void 0:oe.inputAnnotations):tt(E,F,"Failed to send command",{inputAnnotations:oe==null?void 0:oe.inputAnnotations})}else if(E.startsWith("!")){const Rt=E.slice(1).trim();if(!Rt)return!1;if(Te)return mt.current.push(Rt),_t("info",me("queue.shellQueued")),!0;const Kt=!vs.current.sessionId;if(Kt){if(Nn.current)return!1;Nn.current=!0,bh(!0)}let xt=!1;const Ct=xn.current;return m_().finally(()=>{Kt&&(bh(!1),Nn.current=!1)}).then(In=>{var as,Cr;if(xn.current===Ct)return Kt&&In&&(xt=!0,X?X():(as=oi.current)==null||as.clear(),(Cr=zo.current)==null||Cr.call(zo,{type:"submit",sessionId:In,prompt:`!${Rt}`,queued:!1}),p_()),jt.sendShellCommand(Rt)}).catch(In=>{nn(In,Kt&&!xt?"Failed to create session for shell command":"Failed to execute shell command")}),!Kt}else return Te?Fp(E,F,void 0,X,oe==null?void 0:oe.inputAnnotations):tt(E,F,"Failed to send message",{inputAnnotations:oe==null?void 0:oe.inputAnnotations})},[nl,jt,$e,Fp,wh,T_,He,lo,Ba,o6,Lg,Rl,m_,p_,sl,Pn,Nr,I_,FL,Hy,Df,zg,id,A6,Gy,_t,nn,vL,xL,ya,Wt,Uc,Ke,$g,Ly,Eu,k6,k_,Uy,me,Dn]),qL=h.useRef(HL);qL.current=HL;const Ihe=h.useCallback((E,F,X,oe)=>{const Te=qL.current(E,F,X,oe);return Te!==!1&&Uc("smooth"),Te},[Uc]),UL=h.useCallback((E,F,X)=>{jt.submitPermission(E,F,X).catch(oe=>{nn(oe,"Failed to submit permission choice")})},[jt,nn]),N6=h.useCallback(()=>{const E=mt.current.length;mt.current=[],xn.current++,ws.current=!1,Nn.current=!1,E>0&&_t("warning",me("queue.shellDropped",{count:E})),jt.cancel().catch(F=>{nn(F,"Failed to cancel request")})},[jt,nn,_t,me]),Rhe=h.useCallback(()=>{var E;return Tu?!1:((E=Uk.current)==null?void 0:E.focusTaskPill())??!1},[Tu]),Dhe=h.useCallback(E=>{var F,X;if(E){(F=oi.current)==null||F.insertText(E);return}(X=oi.current)==null||X.focus()},[]),Phe=h.useCallback(E=>{Gk(E)},[]),M6=h.useCallback(()=>{Af.current&&Ml&&Ge.current==="idle"&&nd.current&&Vc.current?(Zo.current=nd.current,dh(!1),nl(Vc.current,ai.current,{optimisticUserMessage:!1,retry:!0}).catch(E=>nn(E,"Failed to retry prompt"))):$e.dispatch([{type:"status",text:me("retry.none")}])},[Ml,nl,nn,$e,me]);h.useEffect(()=>{const E=F=>{if(!Tu&&F.ctrlKey&&!F.metaKey&&!F.altKey&&!F.shiftKey){if(F.key==="l"){F.preventDefault(),AL();return}if(F.key==="o"){F.preventDefault(),NL();return}if(F.key==="y"){F.preventDefault(),M6();return}}};return window.addEventListener("keydown",E,!0),()=>window.removeEventListener("keydown",E,!0)},[Tu,AL,NL,M6,$e,me]);const Pf=h.useCallback(()=>{l_.current=null,uL(!1),dL(!1),Og.current&&(clearTimeout(Og.current),Og.current=null)},[]),WL=h.useRef({streamingState:Re,pendingApproval:En,interactionBlocked:Tu,activePanel:$n,closePanel:lo,handleCancel:N6,handleCycleMode:C6});WL.current={streamingState:Re,pendingApproval:En,interactionBlocked:Tu,activePanel:$n,closePanel:lo,handleCancel:N6,handleCycleMode:C6};const Lhe=Re!=="idle";h.useEffect(()=>{Pf()},[Lhe,Pf]),h.useEffect(()=>{const X=(Te,tt)=>{l_.current=Te,Te==="cancel"?dL(!0):uL(!0),Og.current&&clearTimeout(Og.current),Og.current=setTimeout(Pf,tt)},oe=Te=>{var Rt,Kt;if(Te.defaultPrevented||Te.isComposing)return;const tt=WL.current;if(Te.key==="Escape"&&tt.activePanel){const xt=Te.target;xt!=null&&xt.closest("[data-sidebar-shell]")||(Te.preventDefault(),tt.closePanel());return}if(Te.key!=="Escape"){l_.current!==null&&Pf(),Te.key==="Tab"&&Te.shiftKey&&!tt.interactionBlocked&&(Te.preventDefault(),tt.handleCycleMode());return}const It=M6t({blocked:!!tt.pendingApproval||tt.interactionBlocked,streaming:tt.streamingState!=="idle",hasInput:!!((Rt=oi.current)!=null&&Rt.hasInput()),armed:l_.current});if(It.kind!=="ignore")switch(Te.preventDefault(),It.kind){case"cancel":tt.handleCancel(),Pf();break;case"clear":(Kt=oi.current)==null||Kt.clear(),Pf();break;case"arm":X(It.action,It.action==="cancel"?2e3:500);break}};return window.addEventListener("keydown",oe),()=>{window.removeEventListener("keydown",oe),Pf()}},[Pf]);const I6=Vgt({catchingUp:!!ke.catchingUp,pendingApproval:En!==null,isPreparingPrompt:g6}),VL={catchingUp:!!ke.catchingUp,isPreparingPrompt:g6,isStreaming:Re!=="idle"},Ohe=uue(VL),R_=re==null?void 0:re[Ohe],$he=R_!=null&&R_.trim()?R_:me(Ggt(VL)),Ky=h.useCallback(E=>{if(!vs.current.sessionId){$g(E);return}x_(!0),jt.setModel(E).then(F=>{const X=w8t(F);$g((X==null?void 0:X.modelId)??E),X&&$e.dispatch({type:"debug",text:v8t(X,me),source:"model_switch_summary",data:X})}).catch(F=>{nn(F,me("model.switch"))}).finally(()=>x_(!1))},[jt,$e,nn,me,$g]),Bhe=h.useCallback(E=>{x_(!0),Dn.deleteModel(E).then(F=>{F!=null&&F.requiresRestart&&$e.dispatch([{type:"status",text:me("settings.requiresRestart")}]),v_().catch(X=>{console.warn("[web-shell] failed to reload providers after delete",X)}),ic().catch(X=>{console.warn("[web-shell] failed to reload settings after delete",X)})}).catch(F=>{nn(F,me("settings.models.deleteFailed"))}).finally(()=>x_(!1))},[Dn,v_,ic,nn,$e,me]),GL=h.useCallback(()=>{d6(!1),v_().catch(E=>{console.warn("[web-shell] failed to reload providers after auth dialog close",E)})},[v_]),zhe=h.useCallback(E=>{r_(!1),Eu(Bo,"modelFallbacks",E.join(",")).then(F=>{F!=null&&F.requiresRestart&&$e.dispatch([{type:"status",text:me("settings.requiresRestart")}]),ic().catch(X=>{console.warn("[web-shell] failed to reload settings after fallbacks save",X)})}).catch(F=>nn(F,me("settings.models.fallbacks.saveFailed")))},[Bo,Eu,ic,nn,$e,me]),Fhe=h.useCallback(E=>{if(Re!=="idle"){id();return}lo(),nl(`/model --fast ${E}${Bo==="user"?" --global":" --project"}`).then(()=>{ic().catch(X=>{console.warn("[web-shell] failed to reload workspace settings after fast-model switch",X)})}).catch(X=>{nn(X,"Failed to switch fast model")})},[id,lo,nl,Re,nn,ic,Bo]),Hhe=h.useCallback(E=>{var oe;const F=PG(E),X=x6.current;if(!X||X.ownerKey!==((oe=qy.current)==null?void 0:oe.ownerKey)){nn(new Error("The Voice workspace changed before the selection applied."),me("model.setVoice"));return}k_(F,Bo,X).catch(Te=>nn(Te,me("model.setVoice")))},[Bo,nn,me,k_]),qhe=h.useCallback(E=>{const F=I6t(E);Eu(Bo,"visionModel",F).catch(X=>nn(X,me("model.setVision")))},[Bo,nn,Eu,me]),Uhe={main:Ky,fast:Fhe,voice:Hhe,vision:qhe};h.useEffect(()=>{!yi&&!Nf&&!mh&&Ry("workspace")},[yi,Nf,mh]);const KL=h.useMemo(()=>{const E=new Set((ke.skills??[]).map(oe=>oe.toLowerCase())),F=Op?(ke.commands??[]).filter(oe=>oe.source!=="skill"&&!E.has(oe.name.toLowerCase())):ke.commands??[],X=Op?Lp.map(oe=>({name:oe.name,description:oe.description,...oe.argumentHint?{argumentHint:oe.argumentHint}:{},source:"skill",displayCategory:"skill"})):[];return gue(bue(F,X,mue(me)),me).filter(oe=>!Gy.has(oj(oe.name))).map(oe=>{const Te=pue(oe.name);return Te?{...oe,displayCategory:"skill",description:me(Te)}:oe})},[ke.commands,ke.skills,Gy,Lp,Op,me]),Yy=h.useMemo(()=>{var E;return{version:((E=ke.capabilities)==null?void 0:E.qwenCodeVersion)||"",cwd:ke.workspaceCwd||"",currentModel:gh,currentMode:rc,hideTips:(Hg==null?void 0:Hg.values.effective)===!0}},[(vO=ke.capabilities)==null?void 0:vO.qwenCodeVersion,ke.workspaceCwd,gh,rc,Hg==null?void 0:Hg.values.effective]),Whe=h.useMemo(()=>l.jsx(l.Fragment,{children:k?k(Yy):l.jsx(Elt,{...Yy})}),[k,Yy]),D_=h.useMemo(()=>C==null?void 0:C(Yy),[C,Yy]),oc=!ke.sessionId&&Ys.length===0&&!Eg&&!En&&!Je,YL=oc&&T,Xy=YL&&!!D_,Vhe=oc&&Xy,R6=oc&&YL,XL=ke.status!=="connecting"&&!ke.sessionId&&ke.missingSession===!0&&!$n&&Js==="chat",D6=oc?_4():gt,Ghe=kde(J),QL=[Ot.app,Ot.appChat,oc?Ot.appChatEmpty:void 0,Oe.enabled?Ot.appWithSidebar:void 0,ph===ei.Light?Ot.themeLight:Ot.themeDark,ph===ei.Dark?"dark":void 0,o].filter(Boolean).join(" "),JL=h.useMemo(()=>({...a,...f8t(D6,J)}),[J,D6,a]),ZL=h.useCallback(E=>{wt(E),h8t(E)},[]);return h.useLayoutEffect(()=>{const E=jf.current;if(!E)return;const F=Ey.current,X=jy.current,oe=E.getBoundingClientRect();if(X&&!oc&&F){const Te=F.top-oe.top;Math.abs(Te)>1&&(E.style.transition="width 320ms ease",E.style.transform=`translateY(${Te}px)`,requestAnimationFrame(()=>{E.style.transition="width 320ms ease, transform 280ms ease",E.style.transform=""}),window.setTimeout(()=>{E.style.transition=""},320))}Ey.current=oe,jy.current=oc},[oc]),h.useLayoutEffect(()=>{const E=ht.portals?document.createElement("div"):null,F=(E==null?void 0:E.attachShadow({mode:"open"}))??null,X=document.createElement("div");if(X.dataset.webShellPortalRoot="",X.dataset.webShellShadcn="",E&&F){E.dataset.webShellShadowHost="portals",E.style.setProperty("all","initial","important"),E.style.setProperty("position","fixed","important"),E.style.setProperty("inset","0","important"),E.style.setProperty("width","0","important"),E.style.setProperty("height","0","important"),E.style.setProperty("z-index","var(--web-shell-portal-root-z-index, 1000)","important");const oe=ade(F,ht.styles);return F.appendChild(X),document.body.appendChild(E),Ag(X),()=>{E.remove(),oe(),Ag(null)}}else return document.body.appendChild(X),Ag(X),()=>{X.remove(),Ag(null)}},[ht.portals,ht.styles]),h.useLayoutEffect(()=>{const E=Sy.current;if(!E||!Hc)return;const F=Hc.getRootNode(),X=F instanceof ShadowRoot?F.host:null;let oe=null;const Te=()=>{oe=null;const Kt=getComputedStyle(E),xt=new Set;Hc.dataset.webShellShadcn="",Hc.classList.toggle("dark",ph===ei.Dark),Hc.lang=Ke;for(let Ct=0;Ct<Kt.length;Ct+=1){const In=Kt[Ct];if(!In.startsWith("--"))continue;xt.add(In);const as=Kt.getPropertyValue(In);Hc.style.setProperty(In,as),X==null||X.style.setProperty(In,as)}for(const Ct of oh.current)xt.has(Ct)||(Hc.style.removeProperty(Ct),X==null||X.style.removeProperty(Ct));oh.current=xt},tt=()=>{oe===null&&(oe=requestAnimationFrame(Te))};Te();const It=new MutationObserver(tt);let Rt=E;for(;Rt;)It.observe(Rt,{attributes:!0,attributeFilter:["class","style","data-theme","lang"]}),Rt=Rt.parentElement;return window.addEventListener("resize",tt),()=>{It.disconnect(),window.removeEventListener("resize",tt),oe!==null&&cancelAnimationFrame(oe)}},[QL,JL,Hc,Ke,ph]),l.jsx(Rve,{value:ph,children:l.jsx(fve,{language:Ke,children:l.jsx(XQ.Provider,{value:Hc,children:l.jsxs("div",{ref:Sy,className:QL,style:JL,"data-web-shell-root":!0,"data-web-shell-shadcn":!0,lang:Ke,children:[!rt&&l.jsx(tlt,{toasts:wr,onDismiss:Ir}),UP&&l.jsx(Ii,{title:me("resume.title"),size:"lg",onClose:()=>X5(!1),children:l.jsx(Glt,{workspaceCwd:je,onSelect:E=>{He(),lo(),jt.loadSession(E).catch(F=>{nn(F,"Failed to load session")})},onClose:()=>X5(!1)})}),yi&&l.jsx(Ii,{title:me(r8t[yi]),size:"lg",onClose:()=>Il(null),children:l.jsx(mct,{mode:yi,models:yi==="voice"?Tde:void 0,currentModelId:yi==="voice"?uhe:yi==="vision"?dhe:yi==="fast"?hhe:void 0,onSelect:E=>{yi&&Uhe[yi](E),Il(null)}})}),Dg&&l.jsx(Ii,{title:me("mode.select"),size:"sm",onClose:()=>Pg(!1),children:l.jsx(Vlt,{currentMode:rc,onSelect:E=>{Df(E),Pg(!1)}})}),XP&&l.jsx(Ii,{title:me("tools.title"),size:"lg",onClose:()=>QP(!1),children:l.jsx(Kut,{})}),Mf&&l.jsx(oft,{workspaceCwd:Mf.workspaceCwd,gitCwd:Mf.gitCwd,initialView:Mf.view,sessionId:ke.sessionId,resolveSessionForWorkspace:Vde,onClose:()=>If(void 0)},`${Mf.workspaceCwd}:${Mf.gitCwd??""}:${Mf.view}`),h6&&l.jsx(Ii,{title:me("tasks.title"),size:"lg",onClose:()=>Py(null),children:l.jsx(Gle,{message:h6,embedded:!0,manageActiveEvent:!1,onClose:()=>Py(null),onOpenMonitor:Wde})}),iL&&l.jsx(Ii,{title:me("memory.menu"),size:"lg",onClose:()=>oL(!1),children:l.jsx(wut,{refreshSignal:Dde,addSignal:Lde,addScope:zde,onMessage:(E,F="status")=>{$e.dispatch([{type:F,text:E}])}})}),KP&&l.jsx(Ii,{title:me("help.title"),size:"md",onClose:()=>e6(!1),children:l.jsx(_Ct,{commands:KL})}),YP&&l.jsx(Ii,{title:me("theme.title"),size:"sm",onClose:()=>t6(!1),children:l.jsx(SCt,{currentTheme:ph,onSelect:Hy,onClose:()=>t6(!1)})}),mh&&l.jsx(Ii,{title:me("auth.title"),size:"lg",onClose:GL,children:l.jsx(Vut,{onMessage:(E,F="status")=>{$e.dispatch([F==="error"?{type:"error",text:E}:{type:"status",text:E}])},onClose:GL})}),Nf&&l.jsx(Ii,{title:me("settings.models.fallbacks.title"),size:"md",onClose:()=>r_(!1),children:l.jsx(jct,{models:mhe,current:fhe,max:3,onConfirm:zhe,onClose:()=>r_(!1)})}),WP&&l.jsx(Ii,{title:me("delete.title"),size:"lg",onClose:()=>Q5(!1),children:l.jsx(CCt,{workspaceCwd:je,onDeleted:E=>{$e.dispatch([{type:"status",text:E.length===1?`${me("delete.deleted")} (${E[0].slice(0,8)})`:me("delete.deletedCount",{count:E.length})}])},onError:E=>{if(h1(E))return;const F=E instanceof Error?E.message:String(E);_t("error",me("delete.failed",{reason:F}))},onClose:()=>Q5(!1)})}),VP&&l.jsx(Ii,{title:me("release.title"),size:"lg",onClose:()=>J5(!1),children:l.jsx(TCt,{workspaceCwd:je,onReleased:E=>{$e.dispatch([{type:"status",text:`${me("release.released")} (${E.slice(0,8)})`}])},onError:E=>{if(h1(E))return;const F=E instanceof Error?E.message:String(E);_t("error",me("release.failed",{reason:F}))},onClose:()=>J5(!1)})}),GP&&l.jsx(Ii,{title:me("rewind.title"),subtitle:me("rewind.subtitle"),size:"lg",onClose:()=>Z5(!1),children:l.jsx(qCt,{blocks:Ht,loadSnapshots:jhe,rewind:Ahe,onError:Nhe,onClose:()=>Z5(!1)})}),!je&&pi&&l.jsx(WCt,{onClose:()=>lr(!1),onAdd:yhe,onSuggest:E=>Dn.suggestWorkspacePaths(E),onPick:async()=>{const E=await Dn.pickWorkspaceDirectory();return E.selected?E.path:void 0},persistenceSupported:ts,displayNameEnabled:Sr}),cs!=="clear"&&l.jsx(Ii,{title:me("sidebar.scratchOutcomeUnknownTitle"),size:"md",dismissible:!1,onClose:()=>{},children:l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsx("p",{children:me("sidebar.scratchOutcomeUnknown")}),l.jsx("ul",{className:"max-h-48 overflow-y-auto text-sm text-muted-foreground",children:Lt.map(E=>l.jsx("li",{children:E.cwd},E.id))}),l.jsx("div",{className:"flex justify-end",children:cs==="refreshing"?l.jsx(Jt,{type:"button",onClick:()=>void T6(),children:me("sidebar.scratchOutcomeRefresh")}):l.jsx(Jt,{type:"button",onClick:()=>sr("clear"),children:me("sidebar.scratchOutcomeAcknowledge")})})]})}),l.jsxs("div",{className:Ot.appShell,children:[Oe.enabled&&l.jsxs("div",{"data-sidebar-shell":"",...Fe?{role:"dialog","aria-modal":"true"}:{},"aria-label":me("sidebar.label"),className:[Ot.mobileDrawer,Fe?Ot.mobileDrawerOpen:void 0,Pe?Ot.mobileDrawerForced:void 0].filter(Boolean).join(" "),children:[l.jsx("div",{className:Ot.mobileBackdrop,onClick:He,"aria-hidden":"true"}),l.jsx(l6t,{collapsed:(Ne||Js==="split"&&!vn)&&!Fe,onCollapsedChange:Ce,onOpenSettings:()=>{He(),Ba("settings")},onOpenPlugins:()=>{He(),Ba("plugins")},onOpenChannels:()=>{He(),Ba("channels")},onOpenDaemonStatus:()=>{He(),Ba("status")},onOpenScheduledTasks:()=>{He(),o6()},onOpenGoals:()=>{He(),Lg()},onOpenSessions:()=>{He(),Ba("sessions")},canOpenSessionsOverview:Ae,onOpenSplitView:()=>{He(),Bp()},canOpenSplitView:Ae,theme:ph,onThemeChange:E=>{Hy(E),Eu("workspace",y0,eJ(E))},onNewSession:E=>Rl(E),onLoadSession:(E,F)=>(ao("chat"),Hp(E,F)),onSelectCurrentSession:()=>{He(),ao("chat"),lo()},onError:nn,mobileOpen:Fe,sessionListReloadToken:gL,selectedWorkspaceCwd:Qn,onSelectWorkspace:br,onOpenGitDiff:E=>If({workspaceCwd:E,gitCwd:E===Jn?Pn==null?void 0:Pn.path:void 0,view:"diff"}),onOpenCommit:E=>If({workspaceCwd:E,gitCwd:E===Jn?Pn==null?void 0:Pn.path:void 0,view:"commit"}),onOpenAddWorkspace:Rs?()=>lr(!0):void 0,workspaces:Lt,lockedWorkspaceCwd:je,lockedWorkspace:Oe.lockedWorkspace,branding:Oe.branding,primaryNav:Oe.primaryNav,hideProjectHeader:Oe.hideProjectHeader,sessionActions:Oe.sessionActions,footer:Oe.footer})]}),l.jsxs("div",{ref:Qt,className:[Ot.chatPane,Js!=="chat"?Ot.chatPaneShowingPage:void 0,R6?Ot.chatPaneWithMobileComposerBottom:void 0].filter(Boolean).join(" "),children:[Oe.enabled&&Oe.showCompactToggle&&!$n&&Js==="chat"&&l.jsx("button",{type:"button",className:[Ot.hamburgerButton,oc?Ot.hamburgerButtonFloating:void 0].filter(Boolean).join(" "),onClick:()=>{et(!1),ie(E=>!E)},"aria-label":me("sidebar.toggleMenu"),"aria-expanded":Fe,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"})]})}),$n&&l.jsxs("section",{className:Ot.panelHost,role:"region","data-testid":"inline-panel","aria-label":me($n==="settings"?"settings.title":$n==="status"?"daemon.title":$n==="extensions"?"extensions.manage.title":$n==="mcp"?"mcp.title":$n==="skills"?"skills.title":$n==="agents"?"agents.title":$n==="plugins"?"plugins.title":$n==="channels"?"channels.title":"sessionsOverview.title"),children:[$n!=="extensions"&&$n!=="mcp"&&$n!=="skills"&&$n!=="agents"&&$n!=="plugins"&&$n!=="channels"&&l.jsxs("div",{className:Ot.panelHeader,children:[l.jsx("button",{ref:nL,type:"button",className:Ot.panelBack,"data-testid":"panel-back",onClick:lo,"aria-label":me("common.back"),title:me("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:Ot.panelTitle,children:me($n==="settings"?"settings.title":$n==="status"?"daemon.title":"sessionsOverview.title")})]}),l.jsx("div",{className:Ot.panelBody,children:l.jsx(b4t,{enabled:ht.plugins&&f4t($n),language:Ke,themeClassName:[ph===ei.Light?Ot.themeLight:Ot.themeDark,ph===ei.Dark?"dark":void 0].filter(Boolean).join(" "),styles:ht.styles,initialFocusRef:$n==="plugins"?u6:$n==="extensions"||$n==="channels"?a_:void 0,children:$n==="settings"?l.jsx(W4t,{settingsState:che,embedded:!0,onLanguageChange:phe,onThemeChange:Hy,chatWidthMode:gt,onChatWidthModeChange:ZL,modelManagement:{providers:w_.providers,currentModelId:ke.currentModel??void 0,loading:w_.loading,error:w_.error,busy:ahe,onSelectModel:Ky,onDeleteModel:Bhe,onAddModel:()=>d6(!0)},onSubDialog:(E,F)=>{E==="fastModel"?(Ry(F),Il("fast")):E==="visionModel"?(Ry(F),Il("vision")):E==="voiceModel"?k6(F,"settings"):E==="modelFallbacks"?(Ry(F),r_(!0)):E==="tools.approvalMode"&&Pg(!0)}}):$n==="status"?l.jsx(c0t,{}):$n==="extensions"?l.jsx(nde,{onClose:lo,initialFocusRef:a_}):$n==="mcp"&&i_?l.jsx(rde,{message:i_,onClose:()=>{r6(null),lo()}}):$n==="skills"?l.jsx(Gce,{onClose:lo,onUseSkill:ZP}):$n==="agents"?l.jsx(Uce,{onClose:()=>{Dy(null),lo()},initialCreateScope:Hde}):$n==="plugins"?l.jsx(YSt,{mcpMessage:i_,loadMcpMessage:async()=>{try{await Ade()}catch(E){throw nn(E,"Failed to load MCP status"),E}},onClose:lo,onUseSkill:ZP,initialFocusRef:u6}):$n==="channels"?l.jsx(d4t,{onClose:lo,initialFocusRef:a_}):l.jsx(igt,{onOpenSession:E6,onOpenSplit:Bp,includeOtherWorkspaces:!je,workspaceCwd:je})})},$n)]}),Js==="scheduledTasks"&&l.jsxs("div",{className:Ot.fullPage,"data-testid":"scheduled-tasks-page",children:[l.jsxs("div",{className:Ot.fullPageHeader,children:[l.jsx("button",{type:"button",className:Ot.fullPageBack,onClick:()=>ao("chat"),"aria-label":me("common.back"),title:me("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:Ot.fullPageTitle,children:me("scheduledTasks.title")})]}),l.jsx("div",{className:Ot.fullPageBody,children:l.jsx(J_t,{onRunPrompt:Ehe,workspaces:je?Ar:Lt,lockedWorkspace:it,onCreateViaChat:()=>{Rl().then(E=>{E&&(e==null||e(void 0),window.setTimeout(()=>{var F,X;(F=oi.current)==null||F.insertText(me("scheduledTasks.chatStarter"),{mode:"replace"}),(X=oi.current)==null||X.focus()},0))})},onOpenSession:E=>{ao("chat"),Hp(E).catch(F=>{nn(F,"Failed to open session")})},onError:nn})})]}),Js==="goals"&&l.jsxs("div",{className:Ot.fullPage,"data-testid":"goals-page",children:[l.jsxs("div",{className:Ot.fullPageHeader,children:[l.jsx("button",{type:"button",className:Ot.fullPageBack,onClick:()=>ao("chat"),"aria-label":me("common.back"),title:me("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:Ot.fullPageTitle,children:me("goals.title")})]}),l.jsx("div",{className:Ot.fullPageBody,children:l.jsx(PSt,{onCreateGoal:async E=>{const F=f_.current;if(!(F!==void 0&&vs.current.sessionId===F)){if(!await Rl(void 0,{keepView:!0}))return!1;e==null||e(void 0)}try{await nl(`/goal ${E}`,void 0,{clearComposerOnPromptStart:!0})}catch(oe){throw f_.current=vs.current.sessionId,oe}f_.current=void 0,ao("chat")},onOpenSession:E=>{ao("chat"),Hp(E).catch(F=>{nn(F,"Failed to open session")})},onError:nn})})]}),Js==="split"&&l.jsxs("div",{className:Ot.fullPage,"data-testid":"split-view-page",children:[Qs&&l.jsxs("div",{className:Ot.splitApprovalNotice,role:"status","data-testid":"split-approval-notice",children:[l.jsx("span",{children:me("splitView.outerApprovalPending")}),l.jsx("button",{type:"button",onClick:()=>ao("chat"),children:me("splitView.goToApproval")})]}),l.jsx(XB,{value:yt,children:l.jsx(sg.Provider,{value:__,children:l.jsx(Cwt,{sessionIds:hh,onPanesChange:Nde,sessionListReloadToken:gL,includeOtherWorkspaces:!je,workspaceCwd:je,onExit:Mde,onError:nn,onSlashCommand:b,onRightPanelOpen:ko,onPaneArtifactsChange:ri,messageTurnOutputs:q,restartSseOnPrompt:Wt,historyPageSize:zt,voiceUserRevision:b_,voiceWorkspaceRevisions:b6,voiceWorkspaces:(xO=Ve.capabilities)!=null&&xO.workspaces||it?Lt:void 0})})})]}),l.jsxs("div",{className:[Ot.chatViewWrap,R6?Ot.chatViewWithMobileComposerBottom:void 0,Vhe?Ot.chatViewWithWelcomeMiddle:void 0,$n||Js!=="chat"?Ot.chatViewHidden:void 0].filter(Boolean).join(" "),"aria-hidden":$n||Js!=="chat"?!0:void 0,children:[XL&&l.jsxs("div",{className:Ot.missingSessionState,children:[l.jsx("div",{className:Ot.missingSessionMessage,children:me("session.missing")}),l.jsx("button",{type:"button",className:Ot.missingSessionButton,disabled:Yk,onClick:The,children:me("session.new")})]}),l.jsx("div",{className:XL?Ot.chatSubtreeHidden:Ot.chatSubtree,children:l.jsxs(XB,{value:yt,children:[l.jsx(sg.Provider,{value:__,children:l.jsx(J6t,{timeline:ed,details:G5,children:l.jsx(tte.Provider,{value:Bde,children:(()=>{var It;const E=[Ot.content,Eg||Ys.length>0||En?Ot.contentHasMessages:void 0].filter(Boolean).join(" "),F=l.jsx(_P,{ref:qc,messages:Ys,pendingApproval:rs,onShowContextDetail:ghe,loadingTranscript:ke.loadingTranscript,catchingUp:ke.catchingUp,hasOlderHistory:Fn.hasMore,loadingOlderHistory:Fn.loading,historyCapacityReached:Fn.capacityReached,historyPaginationError:Fn.paginationError,onLoadOlderHistory:Fn.loadMore,transcriptBlockCount:Ht.length,transcriptActivity:$e,onReloadTranscript:Hn?Sn:void 0,isResponding:Re!=="idle",activeTurnStartedAt:Wc,workspaceCwd:ke.workspaceCwd||"",hideSessionTimeline:D6==="wide",showRetryHint:$a,onRetryClick:M6,onBranchSession:bhe,bottomOverlayInset:Ng,welcomeHeader:oc?Whe:void 0,centerWelcomeHeader:Xy||void 0,tailContent:void 0,tailKey:void 0,onCanScrollToBottomChange:Phe,virtualScrollThreshold:ge,turnFileChanges:ga.has("file")?Ju:void 0,turnArtifacts:ga.has("artifact")?Cu:void 0,turnScheduledTasks:ga.has("scheduled_task")?Fc:void 0,onTurnOutputOpen:ko,onReviewChanges:xs,onOpenArtifact:es,onOpenScheduledTask:La,generateContent:(It=ke.capabilities)!=null&&It.features.includes("session_generation")?jt.generateSessionContent:void 0}),X=l.jsx(Zle,{onOpen:Os,children:F}),oe=Ln?l.jsx(zXe,{onOpen:Hk,children:X}):X,Te=!Xy&&(Je==null?void 0:Je.role)==="btw"?l.jsx("div",{className:Ot.btwPanel,children:l.jsx(hce,{question:Je.question,answer:Je.answer,isPending:Je.isPending})}):null;if(Xy)return l.jsxs("div",{className:Ot.mobileWelcomeGroup,children:[l.jsxs("div",{style:Mg,className:E,children:[oe,Te]}),l.jsx("div",{className:Ot.mobileWelcomeFooterMiddle,children:D_})]});const tt=!oc&&H?l.jsx("div",{className:Ot.chatHeader,children:H({sessionId:ke.sessionId,sessionName:u_,workspaceCwd:ke.workspaceCwd})}):null;return l.jsxs(l.Fragment,{children:[tt,l.jsxs("div",{style:Mg,className:E,children:[oe,Te]})]})})()})})}),l.jsxs("div",{ref:jf,style:Mg,className:Ft?`${Ot.footer} ${Ot.footerWithCustomFooter}`:Ot.footer,children:[Vk&&l.jsx("div",{className:td?`${Ot.scrollToBottomLayer} ${Ot.scrollToBottomLayerWithTodos}`:Ot.scrollToBottomLayer,children:l.jsx("button",{type:"button",className:Ot.scrollToBottomButton,"aria-label":me("chat.scrollToBottom"),onClick:()=>Uc("smooth"),children:l.jsx("svg",{className:Ot.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"})})})}),td&&l.jsx("div",{ref:ah,className:Ot.bottomPanels,children:l.jsx(klt,{todos:Eg?Bk:[],statusItems:jg})}),rs&&Js==="chat"&&l.jsx("div",{"data-testid":"approval-overlay",className:Ot.approvalOverlay,children:l.jsx(wue,{request:rs,onConfirm:UL,variant:"floating",keyboardActive:Ide})}),Yn&&Js==="chat"&&l.jsx("div",{"data-testid":"approval-overlay",className:Ot.approvalOverlay,children:l.jsx(vue,{request:Yn,onConfirm:UL,variant:"floating",keyboardActive:Rde})}),l.jsxs("div",{className:Ot.composer,children:[Re!=="idle"?l.jsx(Bce,{startedAt:Wc}):ea?l.jsxs("div",{className:Ot.composerActionTip,role:"status","data-testid":ea.suggestion==="btw"?"btw-suggestion":"new-session-suggestion",children:[l.jsx("span",{className:Ot.composerActionTipIcon,"aria-hidden":"true",children:"✦"}),l.jsx("span",{className:Ot.composerActionTipText,children:ea.suggestion==="btw"?me("editor.btwSuggestionTitle"):me("editor.newSessionSuggestionTitle")}),l.jsx("div",{className:Ot.composerActionTipActions,children:l.jsx("button",{type:"button",className:`${Ot.composerActionTipButton} ${Ot.composerActionTipButtonPrimary}`,"data-testid":ea.suggestion==="btw"?"btw-suggestion-send":"new-session-suggestion-start",onMouseDown:E=>E.preventDefault(),onClick:ea.suggestion==="btw"?Che:She,children:ea.suggestion==="btw"?me("editor.btwSuggestionSend"):me("editor.newSessionSuggestionStart")})})]}):qde&&Re==="idle"?l.jsx("div",{className:Ot.escClearStatus,role:"status",children:me("editor.escClearHint")}):null,l.jsx(yue,{prompts:ehe,t:me,onDelete:nhe,onInsert:she,onEdit:rhe}),De&&l.jsx("div",{className:Ot.composerHeader,children:l.jsx(De,{disabled:I6,isRunning:Re!=="idle",currentMode:rc,currentModel:gh,sessionName:u_})}),l.jsx(Oce,{ref:Kk,onSubmit:Ihe,onInputTextChange:khe,onAttachmentsChange:_he,onCycleMode:C6,onToggleShortcuts:_L,onCancel:N6,isRunning:Re!=="idle",isPreparing:g6||G,cancelArmed:Ude,disabled:I6||G||Tu||Qs,commands:KL,skills:Lp,slashCommandCategoryOrder:g,builtinAtProviders:v,atProviders:y,composerTagIcons:w,voiceTarget:$n!==null||Js!=="chat"?void 0:Es,voiceStatusRevision:wL,queuedMessages:the,onFocusFooter:Rhe,onPopQueuedMessages:ihe,onClearQueuedMessages:ohe,currentMode:rc,currentModel:gh,gitBranch:Pn?(Fr==null?void 0:Fr.branch)??Pn.branch:vo?(Fr==null?void 0:Fr.branch)??vo.name:ke.sessionId?ke.gitBranch:(Fr==null?void 0:Fr.branch)??void 0,gitWorktree:!!Pn,gitCwd:Pn==null?void 0:Pn.path,gitModeIntent:g_?h_:void 0,onGitModeIntentChange:g_?$y:void 0,gitStatus:Fr,onOpenGitDiff:sl?Kde:void 0,onOpenCommit:sl?Yde:void 0,chatWidthMode:gt,showChatWidthToggle:!oc,chatWidthToggleMin:Ghe,visibleToolbarActions:de,availableModels:Gde,onSelectMode:Df,onSelectModel:Ky,workspaces:_r,selectedWorkspaceCwd:ke.sessionId?(kO=Lt.find(E=>E.cwd===ke.workspaceCwd))!=null&&kO.primary?void 0:ke.workspaceCwd:Qn,workspaceSelectionDisabled:!1,atWorkspaceCwd:je??(ke.sessionId?ke.workspaceCwd:Qn??((_O=Lt.find(E=>E.primary))==null?void 0:_O.cwd)),onSelectWorkspace:whe,scratchWorkspaceSupported:Bs,existingFolderWorkspaceSupported:Rs,workspaceMutationBusy:Ds,onCreateScratchWorkspace:vhe,onOpenExistingWorkspace:xhe,onChatWidthModeChange:ZL,sessionId:ke.sessionId,sessionName:u_,dialogOpen:Tu||Qs,followupState:Xk,onAcceptFollowup:Qk,onDismissFollowup:Jk,composerInput:We,composerInputVersion:at,placeholderText:$he}),Xe&&l.jsx(Xe,{disabled:I6,isRunning:Re!=="idle",currentMode:rc,currentModel:gh,sessionName:u_})]}),Ft?R6?l.jsx("div",{className:Ot.customFooter,children:l.jsx(Ft,{connected:Ml,mode:rc,model:gh,streamingState:Re,contextUsageRatio:(ke.contextWindow??0)>0?(ke.tokenCount??0)/(ke.contextWindow??0):0,activeGoal:Pp,tasks:qk,availableModes:Aw,availableModels:(ke.models??[]).filter(Qw).map(E=>({id:E.id,label:vm(E.label||E.id),contextWindow:E.contextWindow})),skills:Lp,onSelectMode:Df,onSelectModel:Ky})}):l.jsx(Ft,{connected:Ml,mode:rc,model:gh,streamingState:Re,contextUsageRatio:(ke.contextWindow??0)>0?(ke.tokenCount??0)/(ke.contextWindow??0):0,activeGoal:Pp,tasks:qk,availableModes:Aw,availableModels:(ke.models??[]).filter(Qw).map(E=>({id:E.id,label:vm(E.label||E.id),contextWindow:E.contextWindow})),skills:Lp,onSelectMode:Df,onSelectModel:Ky}):l.jsx(Pat,{onSelectMode:()=>Pg(E=>!E),onSelectModel:()=>Il(E=>E?null:"main"),onShowContext:()=>Uy("/context",!1),onOpenSettings:()=>Ba("settings"),ref:Uk,onOpenTasks:()=>A6(),onReturnToInput:Dhe,tasks:lh,activeGoal:Pp,onOpenGoals:Lg,hideSettings:Mhe,onToggleShortcuts:_L,compact:!0}),oc&&D_&&l.jsx("div",{className:[Ot.emptyWelcomeFooter,Xy?Ot.desktopWelcomeFooter:void 0].filter(Boolean).join(" "),children:D_})]})]})})]})]}),rr&&jde?l.jsx(j_t,{open:!0,direction:"right",shouldScaleBackground:!1,onOpenChange:E=>{E||Oo()},children:l.jsxs(M_t,{className:"data-[vaul-drawer-direction=right]:w-[min(520px,calc(100vw-16px))] data-[vaul-drawer-direction=right]:sm:max-w-[520px]",children:[l.jsx(I_t,{className:"sr-only",children:"Right panel"}),l.jsx(UV,{artifacts:_i,tabs:Yr,activeTabId:el,reviewChanges:ye,selectedReviewPath:Qe,workspaceCwd:ke.workspaceCwd||"",loading:Xs,error:Ai,onSelectTab:qr,onCloseTab:sc,onOpenFilePreview:ba,onClose:Oo,variant:"drawer"})]})}):rr?l.jsxs("div",{className:Ot.artifactPanelDock,style:{"--artifact-panel-dock-width":`${ct+4}px`},children:[l.jsx("div",{className:Ot.artifactResizeHandle,role:"separator","aria-orientation":"vertical","aria-valuemin":d1,"aria-valuemax":$r(),"aria-valuenow":ct,onPointerDown:Al}),l.jsx("div",{className:Ot.artifactPanelClip,children:l.jsx(UV,{artifacts:_i,tabs:Yr,activeTabId:el,reviewChanges:ye,selectedReviewPath:Qe,panelWidth:ct,workspaceCwd:ke.workspaceCwd||"",loading:Xs,error:Ai,onSelectTab:qr,onCloseTab:sc,onOpenFilePreview:ba,onClose:Oo})})]}):null]})]})})})})}function cj({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($u,{className:"border",children:[l.jsxs(Bu,{children:[l.jsx(zu,{variant:"icon",children:i??l.jsx(Aye,{})}),l.jsx(Fu,{children:e}),l.jsx(ky,{children:t})]}),l.jsx(Xct,{children:l.jsx(Jt,{onClick:s,children:n})})]})})}function j8t({sessionId:e,workspaceId:t,workspaceCwd:n,lockWorkspaceCwd:s,clientId:r,restartSseOnPrompt:i,historyPageSize:o=UQ,webShellProps:a}){var S,R,A,O;const c=io(),u=pa(),[d,f]=h.useState(!1),[m,p]=h.useState(),[g,b]=h.useState(),v=h.useRef(void 0);h.useEffect(()=>f(!1),[e,s,n,t]);const y=d?void 0:e,w=d?void 0:s??n,x=w?void 0:t,k=h.useMemo(()=>{var D,$,z;const M=($=(D=c.capabilities)==null?void 0:D.workspaces)==null?void 0:$.find(B=>B.cwd===w);if(M)return M;if(w&&w===((z=c.capabilities)==null?void 0:z.workspaceCwd))return{id:"primary",cwd:w,primary:!0,trusted:!0}},[w,(S=c.capabilities)==null?void 0:S.workspaceCwd,(R=c.capabilities)==null?void 0:R.workspaces]),C=s&&(m==null?void 0:m.requestedCwd)===s?m.workspace:void 0,T=w?k??C:(O=(A=c.capabilities)==null?void 0:A.workspaces)==null?void 0:O.find(M=>M.id===x),_=h.useMemo(()=>DI(Yh(a.language)),[a.language]);return h.useEffect(()=>{var D;if(!s||!c.capabilities||k||(m==null?void 0:m.requestedCwd)===s||g===s)return;((D=v.current)==null?void 0:D.cwd)!==s&&(v.current={cwd:s,promise:u.addWorkspace(s,{persist:!0}).then($=>{if($.persisted!==!0)throw new Error("Workspace registration was not persisted");return $})});let M=!1;return v.current.promise.then(async $=>{var z;if(!M){p({requestedCwd:s,workspace:$}),b(void 0);try{await((z=c.refreshCapabilities)==null?void 0:z.call(c))}catch{}}}).catch(()=>{M||b(s)}),()=>{M=!0}},[k,m,g,c,c.capabilities,c.refreshCapabilities,u,s]),(w||x)&&c.status==="error"?l.jsx(cj,{title:_("workspace.loadFailed"),description:_("workspace.loadFailedDescription"),actionLabel:_("common.retry"),theme:a.theme,icon:l.jsx(GB,{}),onAction:()=>{var M;(M=c.refreshCapabilities)==null||M.call(c).catch(()=>{})}}):(w||x)&&!c.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 ${a.theme==="dark"?"dark":""}`,role:"status","aria-live":"polite",children:[l.jsx(fr,{}),l.jsx("span",{children:_("common.loading")})]}):s&&g===s?l.jsx(cj,{title:_("workspace.loadFailed"),description:_("workspace.loadFailedDescription"),actionLabel:_("common.retry"),theme:a.theme,icon:l.jsx(GB,{}),onAction:()=>{v.current=void 0,b(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 ${a.theme==="dark"?"dark":""}`,role:"status","aria-live":"polite",children:[l.jsx(fr,{}),l.jsx("span",{children:_("common.loading")})]}):(w||x)&&!T?l.jsx(cj,{title:_("workspace.notFound"),description:_("workspace.notFoundDescription"),actionLabel:_("session.new"),theme:a.theme,onAction:()=>{var M;f(!0),(M=a.onSessionIdChange)==null||M.call(a,void 0,void 0)}}):l.jsx(TI,{sessionId:y,workspaceCwd:T==null?void 0:T.cwd,clientId:r,historyPageSize:o,subagentTranscriptMode:"summary",maxBlocks:WQ,suppressOwnUserEcho:!0,restartEventStreamOnPrompt:i,children:l.jsx(E8t,{...a,historyPageSize:o,restartSseOnPrompt:i,initialSelectedWorkspaceCwd:!s&&T?T.cwd:void 0,lockedWorkspaceCwd:s?T==null?void 0:T.cwd:void 0,lockedWorkspaceCapability:s?T:void 0})},`${(T==null?void 0:T.id)??x??"primary"}:${y??"new"}`)}const A8t=g0t(),_de="qwen-code-web-shell-language",Sde="qwen-code-web-shell-theme";function Cde(e){if(e===ei.Dark||e===ei.Light)return e}function N8t(){const e=new URLSearchParams(window.location.search).get("theme");return Cde(e)}function M8t(){try{return Cde(window.localStorage.getItem(Sde))}catch{return}}function I8t(e){try{window.localStorage.setItem(Sde,e)}catch{}}function R8t(){return N8t()??M8t()??ei.Dark}function D8t(){try{const e=window.localStorage.getItem(_de);return e?Yh(e):void 0}catch{return}}function P8t(e){try{window.localStorage.setItem(_de,e)}catch{}}function L8t(){const e=new URLSearchParams(window.location.search),t=e.get("language")??e.get("lang");return Yh(t||(D8t()??navigator.language))}function O8t(){const e=window.location.pathname.match(/\/session\/([^/]+)/);if(e)try{return decodeURIComponent(e[1])}catch{return}}function $8t(){return new URLSearchParams(window.location.search).get("workspace")||void 0}function B8t(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 z8t({daemonToken:e}){const[t,n]=h.useState(()=>R8t()),[s,r]=h.useState(()=>L8t()),[i]=h.useState(()=>O8t()),[o]=h.useState(()=>$8t()),a=A8t||window.location.origin;h.useEffect(()=>{const f=document.documentElement;f.classList.remove("theme-dark","theme-light","dark"),f.classList.add(`theme-${t}`),f.classList.toggle("dark",t===ei.Dark);const m=document.querySelector('meta[name="theme-color"]');m&&m.setAttribute("content",t==="light"?"#ffffff":"#0d0d0d")},[t]);const c=h.useCallback(f=>{n(f),I8t(f)},[]),u=h.useCallback(f=>{r(f),P8t(f)},[]),d=h.useCallback((f,m)=>{B8t(f,m)},[]);return l.jsx(df,{label:"web-shell-root",fallback:(f,m)=>l.jsx(xbe,{error:f,onRetry:m,language:s}),children:l.jsx(_1e,{baseUrl:a,token:e,children:l.jsx(j8t,{sessionId:i,workspaceId:o,webShellProps:{theme:t,onThemeChange:c,language:s,onLanguageChange:u,onSessionIdChange:d,sidebar:!0,compactThinking:!0}})})})}async function F8t(){const e=nue()??await x0t();k0t(),Vpe.createRoot(document.getElementById("root")).render(l.jsx(kn.StrictMode,{children:l.jsx(z8t,{daemonToken:e})}))}F8t();export{vg as C,Rn as D,Vt as E,yn as F,bf as G,Ap as P,tr as R,Da as S,kr as T,Oi as V,zc as W,he as _,Ss as a,dr as b,Go as c,ip as d,Wd as e,p7t as f,IOe as g,r$e as h,S4 as i,M3 as j,J8t as k,up as l};
