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 N0e=Object.defineProperty;var OB=e=>{throw TypeError(e)};var I0e=(e,t,n)=>t in e?N0e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var He=(e,t,n)=>I0e(e,typeof t!="symbol"?t+"":t,n),$B=(e,t,n)=>t.has(e)||OB("Cannot "+n);var ar=(e,t,n)=>($B(e,t,"read from private field"),n?n.call(e):t.get(e)),Dd=(e,t,n)=>t.has(e)?OB("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Xi=(e,t,n,s)=>($B(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n);var BB=(e,t,n,s)=>({set _(r){Xi(e,t,r,n)},get _(){return ar(e,t,s)}});function M0e(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 lk=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function h_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var MX={exports:{}},U3={};/**
 * @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 R0e=Symbol.for("react.transitional.element"),D0e=Symbol.for("react.fragment");function RX(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:R0e,type:e,key:s,ref:t!==void 0?t:null,props:n}}U3.Fragment=D0e;U3.jsx=RX;U3.jsxs=RX;MX.exports=U3;var a=MX.exports,DX={exports:{}},Ds={};/**
 * @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 BR=Symbol.for("react.transitional.element"),L0e=Symbol.for("react.portal"),P0e=Symbol.for("react.fragment"),O0e=Symbol.for("react.strict_mode"),$0e=Symbol.for("react.profiler"),B0e=Symbol.for("react.consumer"),z0e=Symbol.for("react.context"),F0e=Symbol.for("react.forward_ref"),q0e=Symbol.for("react.suspense"),H0e=Symbol.for("react.memo"),LX=Symbol.for("react.lazy"),U0e=Symbol.for("react.activity"),zB=Symbol.iterator;function W0e(e){return e===null||typeof e!="object"?null:(e=zB&&e[zB]||e["@@iterator"],typeof e=="function"?e:null)}var PX={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},OX=Object.assign,$X={};function av(e,t,n){this.props=e,this.context=t,this.refs=$X,this.updater=n||PX}av.prototype.isReactComponent={};av.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")};av.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function BX(){}BX.prototype=av.prototype;function zR(e,t,n){this.props=e,this.context=t,this.refs=$X,this.updater=n||PX}var FR=zR.prototype=new BX;FR.constructor=zR;OX(FR,av.prototype);FR.isPureReactComponent=!0;var FB=Array.isArray;function DN(){}var Pi={H:null,A:null,T:null,S:null},zX=Object.prototype.hasOwnProperty;function qR(e,t,n){var s=n.ref;return{$$typeof:BR,type:e,key:t,ref:s!==void 0?s:null,props:n}}function V0e(e,t){return qR(e.type,t,e.props)}function HR(e){return typeof e=="object"&&e!==null&&e.$$typeof===BR}function G0e(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var qB=/\/+/g;function s8(e,t){return typeof e=="object"&&e!==null&&e.key!=null?G0e(""+e.key):t.toString(36)}function K0e(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(DN,DN):(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 yb(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 BR:case L0e:o=!0;break;case LX:return o=e._init,yb(o(e._payload),t,n,s,r)}}if(o)return r=r(e),o=s===""?"."+s8(e,0):s,FB(r)?(n="",o!=null&&(n=o.replace(qB,"$&/")+"/"),yb(r,t,n,"",function(u){return u})):r!=null&&(HR(r)&&(r=V0e(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(qB,"$&/")+"/")+o)),t.push(r)),1;o=0;var l=s===""?".":s+":";if(FB(e))for(var c=0;c<e.length;c++)s=e[c],i=l+s8(s,c),o+=yb(s,t,n,i,r);else if(c=W0e(e),typeof c=="function")for(e=c.call(e),c=0;!(s=e.next()).done;)s=s.value,i=l+s8(s,c++),o+=yb(s,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return yb(K0e(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 QS(e,t,n){if(e==null)return e;var s=[],r=0;return yb(e,s,"","",function(i){return t.call(n,i,r++)}),s}function Y0e(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 HB=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)},X0e={map:QS,forEach:function(e,t,n){QS(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return QS(e,function(){t++}),t},toArray:function(e){return QS(e,function(t){return t})||[]},only:function(e){if(!HR(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ds.Activity=U0e;Ds.Children=X0e;Ds.Component=av;Ds.Fragment=P0e;Ds.Profiler=$0e;Ds.PureComponent=zR;Ds.StrictMode=O0e;Ds.Suspense=q0e;Ds.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Pi;Ds.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Pi.H.useMemoCache(e)}};Ds.cache=function(e){return function(){return e.apply(null,arguments)}};Ds.cacheSignal=function(){return null};Ds.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var s=OX({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!zX.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),l=0;l<i;l++)o[l]=arguments[l+2];s.children=o}return qR(e.type,r,s)};Ds.createContext=function(e){return e={$$typeof:z0e,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:B0e,_context:e},e};Ds.createElement=function(e,t,n){var s,r={},i=null;if(t!=null)for(s in t.key!==void 0&&(i=""+t.key),t)zX.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 l=Array(o),c=0;c<o;c++)l[c]=arguments[c+2];r.children=l}if(e&&e.defaultProps)for(s in o=e.defaultProps,o)r[s]===void 0&&(r[s]=o[s]);return qR(e,i,r)};Ds.createRef=function(){return{current:null}};Ds.forwardRef=function(e){return{$$typeof:F0e,render:e}};Ds.isValidElement=HR;Ds.lazy=function(e){return{$$typeof:LX,_payload:{_status:-1,_result:e},_init:Y0e}};Ds.memo=function(e,t){return{$$typeof:H0e,type:e,compare:t===void 0?null:t}};Ds.startTransition=function(e){var t=Pi.T,n={};Pi.T=n;try{var s=e(),r=Pi.S;r!==null&&r(n,s),typeof s=="object"&&s!==null&&typeof s.then=="function"&&s.then(DN,HB)}catch(i){HB(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),Pi.T=t}};Ds.unstable_useCacheRefresh=function(){return Pi.H.useCacheRefresh()};Ds.use=function(e){return Pi.H.use(e)};Ds.useActionState=function(e,t,n){return Pi.H.useActionState(e,t,n)};Ds.useCallback=function(e,t){return Pi.H.useCallback(e,t)};Ds.useContext=function(e){return Pi.H.useContext(e)};Ds.useDebugValue=function(){};Ds.useDeferredValue=function(e,t){return Pi.H.useDeferredValue(e,t)};Ds.useEffect=function(e,t){return Pi.H.useEffect(e,t)};Ds.useEffectEvent=function(e){return Pi.H.useEffectEvent(e)};Ds.useId=function(){return Pi.H.useId()};Ds.useImperativeHandle=function(e,t,n){return Pi.H.useImperativeHandle(e,t,n)};Ds.useInsertionEffect=function(e,t){return Pi.H.useInsertionEffect(e,t)};Ds.useLayoutEffect=function(e,t){return Pi.H.useLayoutEffect(e,t)};Ds.useMemo=function(e,t){return Pi.H.useMemo(e,t)};Ds.useOptimistic=function(e,t){return Pi.H.useOptimistic(e,t)};Ds.useReducer=function(e,t,n){return Pi.H.useReducer(e,t,n)};Ds.useRef=function(e){return Pi.H.useRef(e)};Ds.useState=function(e){return Pi.H.useState(e)};Ds.useSyncExternalStore=function(e,t,n){return Pi.H.useSyncExternalStore(e,t,n)};Ds.useTransition=function(){return Pi.H.useTransition()};Ds.version="19.2.4";DX.exports=Ds;var h=DX.exports;const Rn=h_(h),W3=M0e({__proto__:null,default:Rn},[h]);var FX={exports:{}},V3={},qX={exports:{}},HX={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(e){function t(z,I){var $=z.length;z.push(I);e:for(;0<$;){var K=$-1>>>1,R=z[K];if(0<r(R,I))z[K]=I,z[$]=R,$=K;else break e}}function n(z){return z.length===0?null:z[0]}function s(z){if(z.length===0)return null;var I=z[0],$=z.pop();if($!==I){z[0]=$;e:for(var K=0,R=z.length,Y=R>>>1;K<Y;){var W=2*(K+1)-1,M=z[W],F=W+1,J=z[F];if(0>r(M,$))F<R&&0>r(J,M)?(z[K]=J,z[F]=$,K=F):(z[K]=M,z[W]=$,K=W);else if(F<R&&0>r(J,$))z[K]=J,z[F]=$,K=F;else break e}}return I}function r(z,I){var $=z.sortIndex-I.sortIndex;return $!==0?$:z.id-I.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,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,m=3,p=!1,g=!1,b=!1,w=!1,y=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;function k(z){for(var I=n(u);I!==null;){if(I.callback===null)s(u);else if(I.startTime<=z)s(u),I.sortIndex=I.expirationTime,t(c,I);else break;I=n(u)}}function _(z){if(b=!1,k(z),!g)if(n(c)!==null)g=!0,T||(T=!0,B());else{var I=n(u);I!==null&&L(_,I.startTime-z)}}var T=!1,S=-1,C=5,N=-1;function E(){return w?!0:!(e.unstable_now()-N<C)}function O(){if(w=!1,T){var z=e.unstable_now();N=z;var I=!0;try{e:{g=!1,b&&(b=!1,v(S),S=-1),p=!0;var $=m;try{t:{for(k(z),f=n(c);f!==null&&!(f.expirationTime>z&&E());){var K=f.callback;if(typeof K=="function"){f.callback=null,m=f.priorityLevel;var R=K(f.expirationTime<=z);if(z=e.unstable_now(),typeof R=="function"){f.callback=R,k(z),I=!0;break t}f===n(c)&&s(c),k(z)}else s(c);f=n(c)}if(f!==null)I=!0;else{var Y=n(u);Y!==null&&L(_,Y.startTime-z),I=!1}}break e}finally{f=null,m=$,p=!1}I=void 0}}finally{I?B():T=!1}}}var B;if(typeof x=="function")B=function(){x(O)};else if(typeof MessageChannel<"u"){var D=new MessageChannel,j=D.port2;D.port1.onmessage=O,B=function(){j.postMessage(null)}}else B=function(){y(O,0)};function L(z,I){S=y(function(){z(e.unstable_now())},I)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(z){z.callback=null},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(z){switch(m){case 1:case 2:case 3:var I=3;break;default:I=m}var $=m;m=I;try{return z()}finally{m=$}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(z,I){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var $=m;m=z;try{return I()}finally{m=$}},e.unstable_scheduleCallback=function(z,I,$){var K=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?K+$:K):$=K,z){case 1:var R=-1;break;case 2:R=250;break;case 5:R=1073741823;break;case 4:R=1e4;break;default:R=5e3}return R=$+R,z={id:d++,callback:I,priorityLevel:z,startTime:$,expirationTime:R,sortIndex:-1},$>K?(z.sortIndex=$,t(u,z),n(c)===null&&z===n(u)&&(b?(v(S),S=-1):b=!0,L(_,$-K))):(z.sortIndex=R,t(c,z),g||p||(g=!0,T||(T=!0,B()))),z},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(z){var I=m;return function(){var $=m;m=I;try{return z.apply(this,arguments)}finally{m=$}}}})(HX);qX.exports=HX;var Q0e=qX.exports,UX={exports:{}},Yl={};/**
 * @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 J0e=h;function WX(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 Cm(){}var Wl={d:{f:Cm,r:function(){throw Error(WX(522))},D:Cm,C:Cm,L:Cm,m:Cm,X:Cm,S:Cm,M:Cm},p:0,findDOMNode:null},Z0e=Symbol.for("react.portal");function ege(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Z0e,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}var Cx=J0e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function G3(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Yl.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Wl;Yl.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(WX(299));return ege(e,t,null,n)};Yl.flushSync=function(e){var t=Cx.T,n=Wl.p;try{if(Cx.T=null,Wl.p=2,e)return e()}finally{Cx.T=t,Wl.p=n,Wl.d.f()}};Yl.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))};Yl.prefetchDNS=function(e){typeof e=="string"&&Wl.d.D(e)};Yl.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,s=G3(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})}};Yl.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=G3(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)};Yl.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,s=G3(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})}};Yl.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=G3(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)};Yl.requestFormReset=function(e){Wl.d.r(e)};Yl.unstable_batchedUpdates=function(e,t){return e(t)};Yl.useFormState=function(e,t,n){return Cx.H.useFormState(e,t,n)};Yl.useFormStatus=function(){return Cx.H.useHostTransitionStatus()};Yl.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(),UX.exports=Yl;var kd=UX.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 fa=Q0e,GX=h,tge=kd;function yt(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 KX(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f_(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 YX(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 XX(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 UB(e){if(f_(e)!==e)throw Error(yt(188))}function nge(e){var t=e.alternate;if(!t){if(t=f_(e),t===null)throw Error(yt(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 UB(r),e;if(i===s)return UB(r),t;i=i.sibling}throw Error(yt(188))}if(n.return!==s.return)n=r,s=i;else{for(var o=!1,l=r.child;l;){if(l===n){o=!0,n=r,s=i;break}if(l===s){o=!0,s=r,n=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===n){o=!0,n=i,s=r;break}if(l===s){o=!0,s=i,n=r;break}l=l.sibling}if(!o)throw Error(yt(189))}}if(n.alternate!==s)throw Error(yt(190))}if(n.tag!==3)throw Error(yt(188));return n.stateNode.current===n?e:t}function QX(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=QX(e),t!==null)return t;e=e.sibling}return null}var Oi=Object.assign,sge=Symbol.for("react.element"),JS=Symbol.for("react.transitional.element"),sx=Symbol.for("react.portal"),Ab=Symbol.for("react.fragment"),JX=Symbol.for("react.strict_mode"),LN=Symbol.for("react.profiler"),ZX=Symbol.for("react.consumer"),yf=Symbol.for("react.context"),UR=Symbol.for("react.forward_ref"),PN=Symbol.for("react.suspense"),ON=Symbol.for("react.suspense_list"),WR=Symbol.for("react.memo"),Bm=Symbol.for("react.lazy"),$N=Symbol.for("react.activity"),rge=Symbol.for("react.memo_cache_sentinel"),WB=Symbol.iterator;function _w(e){return e===null||typeof e!="object"?null:(e=WB&&e[WB]||e["@@iterator"],typeof e=="function"?e:null)}var ige=Symbol.for("react.client.reference");function BN(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ige?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ab:return"Fragment";case LN:return"Profiler";case JX:return"StrictMode";case PN:return"Suspense";case ON:return"SuspenseList";case $N:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case sx:return"Portal";case yf:return e.displayName||"Context";case ZX:return(e._context.displayName||"Context")+".Consumer";case UR:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case WR:return t=e.displayName||null,t!==null?t:BN(e.type)||"Memo";case Bm:t=e._payload,e=e._init;try{return BN(e(t))}catch{}}return null}var rx=Array.isArray,hs=GX.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Wr=tge.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ag={pending:!1,data:null,method:null,action:null},zN=[],jb=-1;function Eh(e){return{current:e}}function $a(e){0>jb||(e.current=zN[jb],zN[jb]=null,jb--)}function ji(e,t){jb++,zN[jb]=e.current,e.current=t}var vh=Eh(null),ck=Eh(null),hp=Eh(null),z4=Eh(null);function F4(e,t){switch(ji(hp,t),ji(ck,e),ji(vh,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Qz(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Qz(t),e=vZ(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}$a(vh),ji(vh,e)}function yy(){$a(vh),$a(ck),$a(hp)}function FN(e){e.memoizedState!==null&&ji(z4,e);var t=vh.current,n=vZ(t,e.type);t!==n&&(ji(ck,e),ji(vh,n))}function q4(e){ck.current===e&&($a(vh),$a(ck)),z4.current===e&&($a(z4),wk._currentValue=Ag)}var r8,VB;function sg(e){if(r8===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);r8=t&&t[1]||"",VB=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+r8+e+VB}var i8=!1;function o8(e,t){if(!e||i8)return"";i8=!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],l=i[1];if(o&&l){var c=o.split(`
`),u=l.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{i8=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?sg(n):""}function oge(e,t){switch(e.tag){case 26:case 27:case 5:return sg(e.type);case 16:return sg("Lazy");case 13:return e.child!==t&&t!==null?sg("Suspense Fallback"):sg("Suspense");case 19:return sg("SuspenseList");case 0:case 15:return o8(e.type,!1);case 11:return o8(e.type.render,!1);case 1:return o8(e.type,!0);case 31:return sg("Activity");default:return""}}function GB(e){try{var t="",n=null;do t+=oge(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
Error generating stack: `+s.message+`
`+s.stack}}var qN=Object.prototype.hasOwnProperty,VR=fa.unstable_scheduleCallback,a8=fa.unstable_cancelCallback,age=fa.unstable_shouldYield,lge=fa.unstable_requestPaint,Uc=fa.unstable_now,cge=fa.unstable_getCurrentPriorityLevel,eQ=fa.unstable_ImmediatePriority,tQ=fa.unstable_UserBlockingPriority,H4=fa.unstable_NormalPriority,uge=fa.unstable_LowPriority,nQ=fa.unstable_IdlePriority,dge=fa.log,hge=fa.unstable_setDisableYieldValue,m_=null,Wc=null;function Qm(e){if(typeof dge=="function"&&hge(e),Wc&&typeof Wc.setStrictMode=="function")try{Wc.setStrictMode(m_,e)}catch{}}var Vc=Math.clz32?Math.clz32:pge,fge=Math.log,mge=Math.LN2;function pge(e){return e>>>=0,e===0?32:31-(fge(e)/mge|0)|0}var ZS=256,e2=262144,t2=4194304;function rg(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 K3(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 l=s&134217727;return l!==0?(s=l&~i,s!==0?r=rg(s):(o&=l,o!==0?r=rg(o):n||(n=l&~e,n!==0&&(r=rg(n))))):(l=s&~i,l!==0?r=rg(l):o!==0?r=rg(o):n||(n=s&~e,n!==0&&(r=rg(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 p_(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function gge(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 sQ(){var e=t2;return t2<<=1,!(t2&62914560)&&(t2=4194304),e}function l8(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function g_(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function bge(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 l=e.entanglements,c=e.expirationTimes,u=e.hiddenUpdates;for(n=o&~n;0<n;){var d=31-Vc(n),f=1<<d;l[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&&rQ(e,s,0),i!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=i&~(o&~t))}function rQ(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-Vc(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function iQ(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Vc(n),r=1<<s;r&t|e[s]&t&&(e[s]|=t),n&=~r}}function oQ(e,t){var n=t&-t;return n=n&42?1:GR(n),n&(e.suspendedLanes|t)?0:n}function GR(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 KR(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function aQ(){var e=Wr.p;return e!==0?e:(e=window.event,e===void 0?32:NZ(e.type))}function KB(e,t){var n=Wr.p;try{return Wr.p=e,t()}finally{Wr.p=n}}var i0=Math.random().toString(36).slice(2),nl="__reactFiber$"+i0,yc="__reactProps$"+i0,lv="__reactContainer$"+i0,HN="__reactEvents$"+i0,yge="__reactListeners$"+i0,vge="__reactHandles$"+i0,YB="__reactResources$"+i0,b_="__reactMarker$"+i0;function YR(e){delete e[nl],delete e[yc],delete e[HN],delete e[yge],delete e[vge]}function Nb(e){var t=e[nl];if(t)return t;for(var n=e.parentNode;n;){if(t=n[lv]||n[nl]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=nF(e);e!==null;){if(n=e[nl])return n;e=nF(e)}return t}e=n,n=e.parentNode}return null}function cv(e){if(e=e[nl]||e[lv]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ix(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(yt(33))}function Yb(e){var t=e[YB];return t||(t=e[YB]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Da(e){e[b_]=!0}var lQ=new Set,cQ={};function o1(e,t){vy(e,t),vy(e+"Capture",t)}function vy(e,t){for(cQ[e]=t,e=0;e<t.length;e++)lQ.add(t[e])}var wge=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]*$"),XB={},QB={};function xge(e){return qN.call(QB,e)?!0:qN.call(XB,e)?!1:wge.test(e)?QB[e]=!0:(XB[e]=!0,!1)}function FC(e,t,n){if(xge(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 n2(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 Qh(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 yu(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function uQ(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function kge(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 UN(e){if(!e._valueTracker){var t=uQ(e)?"checked":"value";e._valueTracker=kge(e,t,""+e[t])}}function dQ(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=uQ(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function U4(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 _ge=/[\n"\\]/g;function Su(e){return e.replace(_ge,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function WN(e,t,n,s,r,i,o,l){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=""+yu(t)):e.value!==""+yu(t)&&(e.value=""+yu(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?VN(e,o,yu(t)):n!=null?VN(e,o,yu(n)):s!=null&&e.removeAttribute("value"),r==null&&i!=null&&(e.defaultChecked=!!i),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.name=""+yu(l):e.removeAttribute("name")}function hQ(e,t,n,s,r,i,o,l){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)){UN(e);return}n=n!=null?""+yu(n):"",t=t!=null?""+yu(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}s=s??r,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=l?e.checked:!!s,e.defaultChecked=!!s,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.name=o),UN(e)}function VN(e,t,n){t==="number"&&U4(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Xb(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=""+yu(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 fQ(e,t,n){if(t!=null&&(t=""+yu(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+yu(n):""}function mQ(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(yt(92));if(rx(s)){if(1<s.length)throw Error(yt(93));s=s[0]}n=s}n==null&&(n=""),t=n}n=yu(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),UN(e)}function wy(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Sge=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 JB(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||Sge.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function pQ(e,t,n){if(t!=null&&typeof t!="object")throw Error(yt(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&&JB(e,r,s)}else for(var i in t)t.hasOwnProperty(i)&&JB(e,i,t[i])}function XR(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 Cge=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"]]),Tge=/^[\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 qC(e){return Tge.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function vf(){}var GN=null;function QR(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ib=null,Qb=null;function ZB(e){var t=cv(e);if(t&&(e=t.stateNode)){var n=e[yc]||null;e:switch(e=t.stateNode,t.type){case"input":if(WN(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="'+Su(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var r=s[yc]||null;if(!r)throw Error(yt(90));WN(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&&dQ(s)}break e;case"textarea":fQ(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Xb(e,!!n.multiple,t,!1)}}}var c8=!1;function gQ(e,t,n){if(c8)return e(t,n);c8=!0;try{var s=e(t);return s}finally{if(c8=!1,(Ib!==null||Qb!==null)&&(o5(),Ib&&(t=Ib,e=Qb,Qb=Ib=null,ZB(t),e)))for(t=0;t<e.length;t++)ZB(e[t])}}function uk(e,t){var n=e.stateNode;if(n===null)return null;var s=n[yc]||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(yt(231,t,typeof n));return n}var Bf=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),KN=!1;if(Bf)try{var Sw={};Object.defineProperty(Sw,"passive",{get:function(){KN=!0}}),window.addEventListener("test",Sw,Sw),window.removeEventListener("test",Sw,Sw)}catch{KN=!1}var Jm=null,JR=null,HC=null;function bQ(){if(HC)return HC;var e,t=JR,n=t.length,s,r="value"in Jm?Jm.value:Jm.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 HC=r.slice(e,1<s?1-s:void 0)}function UC(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 s2(){return!0}function ez(){return!1}function wc(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 l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?s2:ez,this.isPropagationStopped=ez,this}return Oi(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=s2)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=s2)},persist:function(){},isPersistent:s2}),t}var a1={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Y3=wc(a1),y_=Oi({},a1,{view:0,detail:0}),Ege=wc(y_),u8,d8,Cw,X3=Oi({},y_,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ZR,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!==Cw&&(Cw&&e.type==="mousemove"?(u8=e.screenX-Cw.screenX,d8=e.screenY-Cw.screenY):d8=u8=0,Cw=e),u8)},movementY:function(e){return"movementY"in e?e.movementY:d8}}),tz=wc(X3),Age=Oi({},X3,{dataTransfer:0}),jge=wc(Age),Nge=Oi({},y_,{relatedTarget:0}),h8=wc(Nge),Ige=Oi({},a1,{animationName:0,elapsedTime:0,pseudoElement:0}),Mge=wc(Ige),Rge=Oi({},a1,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Dge=wc(Rge),Lge=Oi({},a1,{data:0}),nz=wc(Lge),Pge={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Oge={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"},$ge={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Bge(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=$ge[e])?!!t[e]:!1}function ZR(){return Bge}var zge=Oi({},y_,{key:function(e){if(e.key){var t=Pge[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=UC(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Oge[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ZR,charCode:function(e){return e.type==="keypress"?UC(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?UC(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Fge=wc(zge),qge=Oi({},X3,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),sz=wc(qge),Hge=Oi({},y_,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ZR}),Uge=wc(Hge),Wge=Oi({},a1,{propertyName:0,elapsedTime:0,pseudoElement:0}),Vge=wc(Wge),Gge=Oi({},X3,{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}),Kge=wc(Gge),Yge=Oi({},a1,{newState:0,oldState:0}),Xge=wc(Yge),Qge=[9,13,27,32],e9=Bf&&"CompositionEvent"in window,Tx=null;Bf&&"documentMode"in document&&(Tx=document.documentMode);var Jge=Bf&&"TextEvent"in window&&!Tx,yQ=Bf&&(!e9||Tx&&8<Tx&&11>=Tx),rz=" ",iz=!1;function vQ(e,t){switch(e){case"keyup":return Qge.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wQ(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Mb=!1;function Zge(e,t){switch(e){case"compositionend":return wQ(t);case"keypress":return t.which!==32?null:(iz=!0,rz);case"textInput":return e=t.data,e===rz&&iz?null:e;default:return null}}function e1e(e,t){if(Mb)return e==="compositionend"||!e9&&vQ(e,t)?(e=bQ(),HC=JR=Jm=null,Mb=!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 yQ&&t.locale!=="ko"?null:t.data;default:return null}}var t1e={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 oz(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!t1e[e.type]:t==="textarea"}function xQ(e,t,n,s){Ib?Qb?Qb.push(s):Qb=[s]:Ib=s,t=lT(t,"onChange"),0<t.length&&(n=new Y3("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var Ex=null,dk=null;function n1e(e){gZ(e,0)}function Q3(e){var t=ix(e);if(dQ(t))return e}function az(e,t){if(e==="change")return t}var kQ=!1;if(Bf){var f8;if(Bf){var m8="oninput"in document;if(!m8){var lz=document.createElement("div");lz.setAttribute("oninput","return;"),m8=typeof lz.oninput=="function"}f8=m8}else f8=!1;kQ=f8&&(!document.documentMode||9<document.documentMode)}function cz(){Ex&&(Ex.detachEvent("onpropertychange",_Q),dk=Ex=null)}function _Q(e){if(e.propertyName==="value"&&Q3(dk)){var t=[];xQ(t,dk,e,QR(e)),gQ(n1e,t)}}function s1e(e,t,n){e==="focusin"?(cz(),Ex=t,dk=n,Ex.attachEvent("onpropertychange",_Q)):e==="focusout"&&cz()}function r1e(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Q3(dk)}function i1e(e,t){if(e==="click")return Q3(t)}function o1e(e,t){if(e==="input"||e==="change")return Q3(t)}function a1e(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Xc=typeof Object.is=="function"?Object.is:a1e;function hk(e,t){if(Xc(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(!qN.call(t,r)||!Xc(e[r],t[r]))return!1}return!0}function uz(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function dz(e,t){var n=uz(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=uz(n)}}function SQ(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?SQ(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function CQ(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=U4(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=U4(e.document)}return t}function t9(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 l1e=Bf&&"documentMode"in document&&11>=document.documentMode,Rb=null,YN=null,Ax=null,XN=!1;function hz(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;XN||Rb==null||Rb!==U4(s)||(s=Rb,"selectionStart"in s&&t9(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}),Ax&&hk(Ax,s)||(Ax=s,s=lT(YN,"onSelect"),0<s.length&&(t=new Y3("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=Rb)))}function W0(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Db={animationend:W0("Animation","AnimationEnd"),animationiteration:W0("Animation","AnimationIteration"),animationstart:W0("Animation","AnimationStart"),transitionrun:W0("Transition","TransitionRun"),transitionstart:W0("Transition","TransitionStart"),transitioncancel:W0("Transition","TransitionCancel"),transitionend:W0("Transition","TransitionEnd")},p8={},TQ={};Bf&&(TQ=document.createElement("div").style,"AnimationEvent"in window||(delete Db.animationend.animation,delete Db.animationiteration.animation,delete Db.animationstart.animation),"TransitionEvent"in window||delete Db.transitionend.transition);function l1(e){if(p8[e])return p8[e];if(!Db[e])return e;var t=Db[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in TQ)return p8[e]=t[n];return e}var EQ=l1("animationend"),AQ=l1("animationiteration"),jQ=l1("animationstart"),c1e=l1("transitionrun"),u1e=l1("transitionstart"),d1e=l1("transitioncancel"),NQ=l1("transitionend"),IQ=new Map,QN="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(" ");QN.push("scrollEnd");function _d(e,t){IQ.set(e,t),o1(t,[e])}var W4=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)},gu=[],Lb=0,n9=0;function J3(){for(var e=Lb,t=n9=Lb=0;t<e;){var n=gu[t];gu[t++]=null;var s=gu[t];gu[t++]=null;var r=gu[t];gu[t++]=null;var i=gu[t];if(gu[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&&MQ(n,r,i)}}function Z3(e,t,n,s){gu[Lb++]=e,gu[Lb++]=t,gu[Lb++]=n,gu[Lb++]=s,n9|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function s9(e,t,n,s){return Z3(e,t,n,s),V4(e)}function c1(e,t){return Z3(e,null,null,t),V4(e)}function MQ(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-Vc(n),e=i.hiddenUpdates,s=e[r],s===null?e[r]=[t]:s.push(t),t.lane=n|536870912),i):null}function V4(e){if(50<Ox)throw Ox=0,y7=null,Error(yt(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Pb={};function h1e(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 zc(e,t,n,s){return new h1e(e,t,n,s)}function r9(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Tf(e,t){var n=e.alternate;return n===null?(n=zc(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 RQ(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 WC(e,t,n,s,r,i){var o=0;if(s=e,typeof e=="function")r9(e)&&(o=1);else if(typeof e=="string")o=bbe(e,n,vh.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case $N:return e=zc(31,n,t,r),e.elementType=$N,e.lanes=i,e;case Ab:return jg(n.children,r,i,t);case JX:o=8,r|=24;break;case LN:return e=zc(12,n,t,r|2),e.elementType=LN,e.lanes=i,e;case PN:return e=zc(13,n,t,r),e.elementType=PN,e.lanes=i,e;case ON:return e=zc(19,n,t,r),e.elementType=ON,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case yf:o=10;break e;case ZX:o=9;break e;case UR:o=11;break e;case WR:o=14;break e;case Bm:o=16,s=null;break e}o=29,n=Error(yt(130,e===null?"null":typeof e,"")),s=null}return t=zc(o,n,t,r),t.elementType=e,t.type=s,t.lanes=i,t}function jg(e,t,n,s){return e=zc(7,e,s,t),e.lanes=n,e}function g8(e,t,n){return e=zc(6,e,null,t),e.lanes=n,e}function DQ(e){var t=zc(18,null,null,0);return t.stateNode=e,t}function b8(e,t,n){return t=zc(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var fz=new WeakMap;function Cu(e,t){if(typeof e=="object"&&e!==null){var n=fz.get(e);return n!==void 0?n:(t={value:e,source:t,stack:GB(t)},fz.set(e,t),t)}return{value:e,source:t,stack:GB(t)}}var Ob=[],$b=0,G4=null,fk=0,vu=[],wu=0,jp=null,lh=1,ch="";function cf(e,t){Ob[$b++]=fk,Ob[$b++]=G4,G4=e,fk=t}function LQ(e,t,n){vu[wu++]=lh,vu[wu++]=ch,vu[wu++]=jp,jp=e;var s=lh;e=ch;var r=32-Vc(s)-1;s&=~(1<<r),n+=1;var i=32-Vc(t)+r;if(30<i){var o=r-r%5;i=(s&(1<<o)-1).toString(32),s>>=o,r-=o,lh=1<<32-Vc(t)+r|n<<r|s,ch=i+e}else lh=1<<i|n<<r|s,ch=e}function i9(e){e.return!==null&&(cf(e,1),LQ(e,1,0))}function o9(e){for(;e===G4;)G4=Ob[--$b],Ob[$b]=null,fk=Ob[--$b],Ob[$b]=null;for(;e===jp;)jp=vu[--wu],vu[wu]=null,ch=vu[--wu],vu[wu]=null,lh=vu[--wu],vu[wu]=null}function PQ(e,t){vu[wu++]=lh,vu[wu++]=ch,vu[wu++]=jp,lh=t.id,ch=t.overflow,jp=e}var sl=null,Li=null,xr=!1,fp=null,Tu=!1,JN=Error(yt(519));function Np(e){var t=Error(yt(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw mk(Cu(t,e)),JN}function mz(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[nl]=e,t[yc]=s,n){case"dialog":lr("cancel",t),lr("close",t);break;case"iframe":case"object":case"embed":lr("load",t);break;case"video":case"audio":for(n=0;n<yk.length;n++)lr(yk[n],t);break;case"source":lr("error",t);break;case"img":case"image":case"link":lr("error",t),lr("load",t);break;case"details":lr("toggle",t);break;case"input":lr("invalid",t),hQ(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":lr("invalid",t);break;case"textarea":lr("invalid",t),mQ(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||yZ(t.textContent,n)?(s.popover!=null&&(lr("beforetoggle",t),lr("toggle",t)),s.onScroll!=null&&lr("scroll",t),s.onScrollEnd!=null&&lr("scrollend",t),s.onClick!=null&&(t.onclick=vf),t=!0):t=!1,t||Np(e,!0)}function pz(e){for(sl=e.return;sl;)switch(sl.tag){case 5:case 31:case 13:Tu=!1;return;case 27:case 3:Tu=!0;return;default:sl=sl.return}}function Y1(e){if(e!==sl)return!1;if(!xr)return pz(e),xr=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||_7(e.type,e.memoizedProps)),n=!n),n&&Li&&Np(e),pz(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(yt(317));Li=tF(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(yt(317));Li=tF(e)}else t===27?(t=Li,o0(e.type)?(e=E7,E7=null,Li=e):Li=t):Li=sl?Ou(e.stateNode.nextSibling):null;return!0}function Bg(){Li=sl=null,xr=!1}function y8(){var e=fp;return e!==null&&(oc===null?oc=e:oc.push.apply(oc,e),fp=null),e}function mk(e){fp===null?fp=[e]:fp.push(e)}var ZN=Eh(null),u1=null,wf=null;function Wm(e,t,n){ji(ZN,t._currentValue),t._currentValue=n}function Ef(e){e._currentValue=ZN.current,$a(ZN)}function e7(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 t7(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 l=i;i=r;for(var c=0;c<t.length;c++)if(l.context===t[c]){i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),e7(i.return,n,e),s||(o=null);break e}i=l.next}}else if(r.tag===18){if(o=r.return,o===null)throw Error(yt(341));o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),e7(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 uv(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(yt(387));if(o=o.memoizedProps,o!==null){var l=r.type;Xc(r.pendingProps.value,o.value)||(e!==null?e.push(l):e=[l])}}else if(r===z4.current){if(o=r.alternate,o===null)throw Error(yt(387));o.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(wk):e=[wk])}r=r.return}e!==null&&t7(t,e,n,s),t.flags|=262144}function K4(e){for(e=e.firstContext;e!==null;){if(!Xc(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function zg(e){u1=e,wf=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function rl(e){return OQ(u1,e)}function r2(e,t){return u1===null&&zg(e),OQ(e,t)}function OQ(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},wf===null){if(e===null)throw Error(yt(308));wf=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else wf=wf.next=t;return n}var f1e=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()})}},m1e=fa.unstable_scheduleCallback,p1e=fa.unstable_NormalPriority,Ho={$$typeof:yf,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function a9(){return{controller:new f1e,data:new Map,refCount:0}}function v_(e){e.refCount--,e.refCount===0&&m1e(p1e,function(){e.controller.abort()})}var jx=null,n7=0,xy=0,Jb=null;function g1e(e,t){if(jx===null){var n=jx=[];n7=0,xy=M9(),Jb={status:"pending",value:void 0,then:function(s){n.push(s)}}}return n7++,t.then(gz,gz),t}function gz(){if(--n7===0&&jx!==null){Jb!==null&&(Jb.status="fulfilled");var e=jx;jx=null,xy=0,Jb=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function b1e(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 bz=hs.S;hs.S=function(e,t){QJ=Uc(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&g1e(e,t),bz!==null&&bz(e,t)};var Ng=Eh(null);function l9(){var e=Ng.current;return e!==null?e:xi.pooledCache}function VC(e,t){t===null?ji(Ng,Ng.current):ji(Ng,t.pool)}function $Q(){var e=l9();return e===null?null:{parent:Ho._currentValue,pool:e}}var dv=Error(yt(460)),c9=Error(yt(474)),e5=Error(yt(542)),Y4={then:function(){}};function yz(e){return e=e.status,e==="fulfilled"||e==="rejected"}function BQ(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(vf,vf),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,wz(e),e;default:if(typeof t.status=="string")t.then(vf,vf);else{if(e=xi,e!==null&&100<e.shellSuspendCounter)throw Error(yt(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,wz(e),e}throw Ig=t,dv}}function ig(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Ig=n,dv):n}}var Ig=null;function vz(){if(Ig===null)throw Error(yt(459));var e=Ig;return Ig=null,e}function wz(e){if(e===dv||e===e5)throw Error(yt(483))}var Zb=null,pk=0;function i2(e){var t=pk;return pk+=1,Zb===null&&(Zb=[]),BQ(Zb,e,t)}function Tw(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function o2(e,t){throw t.$$typeof===sge?Error(yt(525)):(e=Object.prototype.toString.call(t),Error(yt(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function zQ(e){function t(y,v){if(e){var x=y.deletions;x===null?(y.deletions=[v],y.flags|=16):x.push(v)}}function n(y,v){if(!e)return null;for(;v!==null;)t(y,v),v=v.sibling;return null}function s(y){for(var v=new Map;y!==null;)y.key!==null?v.set(y.key,y):v.set(y.index,y),y=y.sibling;return v}function r(y,v){return y=Tf(y,v),y.index=0,y.sibling=null,y}function i(y,v,x){return y.index=x,e?(x=y.alternate,x!==null?(x=x.index,x<v?(y.flags|=67108866,v):x):(y.flags|=67108866,v)):(y.flags|=1048576,v)}function o(y){return e&&y.alternate===null&&(y.flags|=67108866),y}function l(y,v,x,k){return v===null||v.tag!==6?(v=g8(x,y.mode,k),v.return=y,v):(v=r(v,x),v.return=y,v)}function c(y,v,x,k){var _=x.type;return _===Ab?d(y,v,x.props.children,k,x.key):v!==null&&(v.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Bm&&ig(_)===v.type)?(v=r(v,x.props),Tw(v,x),v.return=y,v):(v=WC(x.type,x.key,x.props,null,y.mode,k),Tw(v,x),v.return=y,v)}function u(y,v,x,k){return v===null||v.tag!==4||v.stateNode.containerInfo!==x.containerInfo||v.stateNode.implementation!==x.implementation?(v=b8(x,y.mode,k),v.return=y,v):(v=r(v,x.children||[]),v.return=y,v)}function d(y,v,x,k,_){return v===null||v.tag!==7?(v=jg(x,y.mode,k,_),v.return=y,v):(v=r(v,x),v.return=y,v)}function f(y,v,x){if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return v=g8(""+v,y.mode,x),v.return=y,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case JS:return x=WC(v.type,v.key,v.props,null,y.mode,x),Tw(x,v),x.return=y,x;case sx:return v=b8(v,y.mode,x),v.return=y,v;case Bm:return v=ig(v),f(y,v,x)}if(rx(v)||_w(v))return v=jg(v,y.mode,x,null),v.return=y,v;if(typeof v.then=="function")return f(y,i2(v),x);if(v.$$typeof===yf)return f(y,r2(y,v),x);o2(y,v)}return null}function m(y,v,x,k){var _=v!==null?v.key:null;if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return _!==null?null:l(y,v,""+x,k);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case JS:return x.key===_?c(y,v,x,k):null;case sx:return x.key===_?u(y,v,x,k):null;case Bm:return x=ig(x),m(y,v,x,k)}if(rx(x)||_w(x))return _!==null?null:d(y,v,x,k,null);if(typeof x.then=="function")return m(y,v,i2(x),k);if(x.$$typeof===yf)return m(y,v,r2(y,x),k);o2(y,x)}return null}function p(y,v,x,k,_){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return y=y.get(x)||null,l(v,y,""+k,_);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case JS:return y=y.get(k.key===null?x:k.key)||null,c(v,y,k,_);case sx:return y=y.get(k.key===null?x:k.key)||null,u(v,y,k,_);case Bm:return k=ig(k),p(y,v,x,k,_)}if(rx(k)||_w(k))return y=y.get(x)||null,d(v,y,k,_,null);if(typeof k.then=="function")return p(y,v,x,i2(k),_);if(k.$$typeof===yf)return p(y,v,x,r2(v,k),_);o2(v,k)}return null}function g(y,v,x,k){for(var _=null,T=null,S=v,C=v=0,N=null;S!==null&&C<x.length;C++){S.index>C?(N=S,S=null):N=S.sibling;var E=m(y,S,x[C],k);if(E===null){S===null&&(S=N);break}e&&S&&E.alternate===null&&t(y,S),v=i(E,v,C),T===null?_=E:T.sibling=E,T=E,S=N}if(C===x.length)return n(y,S),xr&&cf(y,C),_;if(S===null){for(;C<x.length;C++)S=f(y,x[C],k),S!==null&&(v=i(S,v,C),T===null?_=S:T.sibling=S,T=S);return xr&&cf(y,C),_}for(S=s(S);C<x.length;C++)N=p(S,y,C,x[C],k),N!==null&&(e&&N.alternate!==null&&S.delete(N.key===null?C:N.key),v=i(N,v,C),T===null?_=N:T.sibling=N,T=N);return e&&S.forEach(function(O){return t(y,O)}),xr&&cf(y,C),_}function b(y,v,x,k){if(x==null)throw Error(yt(151));for(var _=null,T=null,S=v,C=v=0,N=null,E=x.next();S!==null&&!E.done;C++,E=x.next()){S.index>C?(N=S,S=null):N=S.sibling;var O=m(y,S,E.value,k);if(O===null){S===null&&(S=N);break}e&&S&&O.alternate===null&&t(y,S),v=i(O,v,C),T===null?_=O:T.sibling=O,T=O,S=N}if(E.done)return n(y,S),xr&&cf(y,C),_;if(S===null){for(;!E.done;C++,E=x.next())E=f(y,E.value,k),E!==null&&(v=i(E,v,C),T===null?_=E:T.sibling=E,T=E);return xr&&cf(y,C),_}for(S=s(S);!E.done;C++,E=x.next())E=p(S,y,C,E.value,k),E!==null&&(e&&E.alternate!==null&&S.delete(E.key===null?C:E.key),v=i(E,v,C),T===null?_=E:T.sibling=E,T=E);return e&&S.forEach(function(B){return t(y,B)}),xr&&cf(y,C),_}function w(y,v,x,k){if(typeof x=="object"&&x!==null&&x.type===Ab&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case JS:e:{for(var _=x.key;v!==null;){if(v.key===_){if(_=x.type,_===Ab){if(v.tag===7){n(y,v.sibling),k=r(v,x.props.children),k.return=y,y=k;break e}}else if(v.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Bm&&ig(_)===v.type){n(y,v.sibling),k=r(v,x.props),Tw(k,x),k.return=y,y=k;break e}n(y,v);break}else t(y,v);v=v.sibling}x.type===Ab?(k=jg(x.props.children,y.mode,k,x.key),k.return=y,y=k):(k=WC(x.type,x.key,x.props,null,y.mode,k),Tw(k,x),k.return=y,y=k)}return o(y);case sx:e:{for(_=x.key;v!==null;){if(v.key===_)if(v.tag===4&&v.stateNode.containerInfo===x.containerInfo&&v.stateNode.implementation===x.implementation){n(y,v.sibling),k=r(v,x.children||[]),k.return=y,y=k;break e}else{n(y,v);break}else t(y,v);v=v.sibling}k=b8(x,y.mode,k),k.return=y,y=k}return o(y);case Bm:return x=ig(x),w(y,v,x,k)}if(rx(x))return g(y,v,x,k);if(_w(x)){if(_=_w(x),typeof _!="function")throw Error(yt(150));return x=_.call(x),b(y,v,x,k)}if(typeof x.then=="function")return w(y,v,i2(x),k);if(x.$$typeof===yf)return w(y,v,r2(y,x),k);o2(y,x)}return typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint"?(x=""+x,v!==null&&v.tag===6?(n(y,v.sibling),k=r(v,x),k.return=y,y=k):(n(y,v),k=g8(x,y.mode,k),k.return=y,y=k),o(y)):n(y,v)}return function(y,v,x,k){try{pk=0;var _=w(y,v,x,k);return Zb=null,_}catch(S){if(S===dv||S===e5)throw S;var T=zc(29,S,null,y.mode);return T.lanes=k,T.return=y,T}finally{}}}var Fg=zQ(!0),FQ=zQ(!1),zm=!1;function u9(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function s7(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 mp(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function pp(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,qr&2){var r=s.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),s.pending=t,t=V4(e),MQ(e,null,n),t}return Z3(e,s,t,n),V4(e)}function Nx(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,iQ(e,n)}}function v8(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 r7=!1;function Ix(){if(r7){var e=Jb;if(e!==null)throw e}}function Mx(e,t,n,s){r7=!1;var r=e.updateQueue;zm=!1;var i=r.firstBaseUpdate,o=r.lastBaseUpdate,l=r.shared.pending;if(l!==null){r.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=r.baseState;o=0,d=u=c=null,l=i;do{var m=l.lane&-536870913,p=m!==l.lane;if(p?(fr&m)===m:(s&m)===m){m!==0&&m===xy&&(r7=!0),d!==null&&(d=d.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var g=e,b=l;m=t;var w=n;switch(b.tag){case 1:if(g=b.payload,typeof g=="function"){f=g.call(w,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(w,f,m):g,m==null)break e;f=Oi({},f,m);break e;case 2:zm=!0}}m=l.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:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,o|=m;if(l=l.next,l===null){if(l=r.shared.pending,l===null)break;p=l,l=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),Mp|=o,e.lanes=o,e.memoizedState=f}}function qQ(e,t){if(typeof e!="function")throw Error(yt(191,e));e.call(t)}function HQ(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)qQ(n[e],t)}var ky=Eh(null),X4=Eh(0);function xz(e,t){e=Hf,ji(X4,e),ji(ky,t),Hf=e|t.baseLanes}function i7(){ji(X4,Hf),ji(ky,ky.current)}function d9(){Hf=X4.current,$a(ky),$a(X4)}var Qc=Eh(null),Pu=null;function Vm(e){var t=e.alternate;ji(Ro,Ro.current&1),ji(Qc,e),Pu===null&&(t===null||ky.current!==null||t.memoizedState!==null)&&(Pu=e)}function o7(e){ji(Ro,Ro.current),ji(Qc,e),Pu===null&&(Pu=e)}function UQ(e){e.tag===22?(ji(Ro,Ro.current),ji(Qc,e),Pu===null&&(Pu=e)):Gm()}function Gm(){ji(Ro,Ro.current),ji(Qc,Qc.current)}function $c(e){$a(Qc),Pu===e&&(Pu=null),$a(Ro)}var Ro=Eh(0);function Q4(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||C7(n)||T7(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 zf=0,Ps=null,li=null,Fo=null,J4=!1,ey=!1,qg=!1,Z4=0,gk=0,ty=null,y1e=0;function yo(){throw Error(yt(321))}function h9(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Xc(e[n],t[n]))return!1;return!0}function f9(e,t,n,s,r,i){return zf=i,Ps=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,hs.H=e===null||e.memoizedState===null?xJ:S9,qg=!1,i=n(s,r),qg=!1,ey&&(i=VQ(t,n,s,r)),WQ(e),i}function WQ(e){hs.H=bk;var t=li!==null&&li.next!==null;if(zf=0,Fo=li=Ps=null,J4=!1,gk=0,ty=null,t)throw Error(yt(300));e===null||Vo||(e=e.dependencies,e!==null&&K4(e)&&(Vo=!0))}function VQ(e,t,n,s){Ps=e;var r=0;do{if(ey&&(ty=null),gk=0,ey=!1,25<=r)throw Error(yt(301));if(r+=1,Fo=li=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}hs.H=kJ,i=t(n,s)}while(ey);return i}function v1e(){var e=hs.H,t=e.useState()[0];return t=typeof t.then=="function"?w_(t):t,e=e.useState()[0],(li!==null?li.memoizedState:null)!==e&&(Ps.flags|=1024),t}function m9(){var e=Z4!==0;return Z4=0,e}function p9(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function g9(e){if(J4){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}J4=!1}zf=0,Fo=li=Ps=null,ey=!1,gk=Z4=0,ty=null}function Dl(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Fo===null?Ps.memoizedState=Fo=e:Fo=Fo.next=e,Fo}function Do(){if(li===null){var e=Ps.alternate;e=e!==null?e.memoizedState:null}else e=li.next;var t=Fo===null?Ps.memoizedState:Fo.next;if(t!==null)Fo=t,li=e;else{if(e===null)throw Ps.alternate===null?Error(yt(467)):Error(yt(310));li=e,e={memoizedState:li.memoizedState,baseState:li.baseState,baseQueue:li.baseQueue,queue:li.queue,next:null},Fo===null?Ps.memoizedState=Fo=e:Fo=Fo.next=e}return Fo}function t5(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function w_(e){var t=gk;return gk+=1,ty===null&&(ty=[]),e=BQ(ty,e,t),t=Ps,(Fo===null?t.memoizedState:Fo.next)===null&&(t=t.alternate,hs.H=t===null||t.memoizedState===null?xJ:S9),e}function n5(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return w_(e);if(e.$$typeof===yf)return rl(e)}throw Error(yt(438,String(e)))}function b9(e){var t=null,n=Ps.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=Ps.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=t5(),Ps.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]=rge;return t.index++,n}function Ff(e,t){return typeof t=="function"?t(e):t}function GC(e){var t=Do();return y9(t,li,e)}function y9(e,t,n){var s=e.queue;if(s===null)throw Error(yt(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 l=o=null,c=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f!==u.lane?(fr&f)===f:(zf&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===xy&&(d=!0);else if((zf&m)===m){u=u.next,m===xy&&(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?(l=c=f,o=i):c=c.next=f,Ps.lanes|=m,Mp|=m;f=u.action,qg&&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?(l=c=m,o=i):c=c.next=m,Ps.lanes|=f,Mp|=f;u=u.next}while(u!==null&&u!==t);if(c===null?o=i:c.next=l,!Xc(i,e.memoizedState)&&(Vo=!0,d&&(n=Jb,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 w8(e){var t=Do(),n=t.queue;if(n===null)throw Error(yt(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);Xc(i,t.memoizedState)||(Vo=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,s]}function GQ(e,t,n){var s=Ps,r=Do(),i=xr;if(i){if(n===void 0)throw Error(yt(407));n=n()}else n=t();var o=!Xc((li||r).memoizedState,n);if(o&&(r.memoizedState=n,Vo=!0),r=r.queue,v9(XQ.bind(null,s,r,e),[e]),r.getSnapshot!==t||o||Fo!==null&&Fo.memoizedState.tag&1){if(s.flags|=2048,_y(9,{destroy:void 0},YQ.bind(null,s,r,n,t),null),xi===null)throw Error(yt(349));i||zf&127||KQ(s,t,n)}return n}function KQ(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ps.updateQueue,t===null?(t=t5(),Ps.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function YQ(e,t,n,s){t.value=n,t.getSnapshot=s,QQ(t)&&JQ(e)}function XQ(e,t,n){return n(function(){QQ(t)&&JQ(e)})}function QQ(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Xc(e,n)}catch{return!0}}function JQ(e){var t=c1(e,2);t!==null&&pc(t,e,2)}function a7(e){var t=Dl();if(typeof e=="function"){var n=e;if(e=n(),qg){Qm(!0);try{n()}finally{Qm(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ff,lastRenderedState:e},t}function ZQ(e,t,n,s){return e.baseState=n,y9(e,li,typeof s=="function"?s:Ff)}function w1e(e,t,n,s,r){if(r5(e))throw Error(yt(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)}};hs.T!==null?n(!0):i.isTransition=!1,s(i),n=t.pending,n===null?(i.next=t.pending=i,eJ(t,i)):(i.next=n.next,t.pending=n.next=i)}}function eJ(e,t){var n=t.action,s=t.payload,r=e.state;if(t.isTransition){var i=hs.T,o={};hs.T=o;try{var l=n(r,s),c=hs.S;c!==null&&c(o,l),kz(e,t,l)}catch(u){l7(e,t,u)}finally{i!==null&&o.types!==null&&(i.types=o.types),hs.T=i}}else try{i=n(r,s),kz(e,t,i)}catch(u){l7(e,t,u)}}function kz(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){_z(e,t,s)},function(s){return l7(e,t,s)}):_z(e,t,n)}function _z(e,t,n){t.status="fulfilled",t.value=n,tJ(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,eJ(e,n)))}function l7(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,tJ(t),t=t.next;while(t!==s)}e.action=null}function tJ(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function nJ(e,t){return t}function Sz(e,t){if(xr){var n=xi.formState;if(n!==null){e:{var s=Ps;if(xr){if(Li){t:{for(var r=Li,i=Tu;r.nodeType!==8;){if(!i){r=null;break t}if(r=Ou(r.nextSibling),r===null){r=null;break t}}i=r.data,r=i==="F!"||i==="F"?r:null}if(r){Li=Ou(r.nextSibling),s=r.data==="F!";break e}}Np(s)}s=!1}s&&(t=n[0])}}return n=Dl(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nJ,lastRenderedState:t},n.queue=s,n=yJ.bind(null,Ps,s),s.dispatch=n,s=a7(!1),i=_9.bind(null,Ps,!1,s.queue),s=Dl(),r={state:t,dispatch:null,action:e,pending:null},s.queue=r,n=w1e.bind(null,Ps,r,i,n),r.dispatch=n,s.memoizedState=e,[t,n,!1]}function Cz(e){var t=Do();return sJ(t,li,e)}function sJ(e,t,n){if(t=y9(e,t,nJ)[0],e=GC(Ff)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=w_(t)}catch(o){throw o===dv?e5:o}else s=t;t=Do();var r=t.queue,i=r.dispatch;return n!==t.memoizedState&&(Ps.flags|=2048,_y(9,{destroy:void 0},x1e.bind(null,r,n),null)),[s,i,e]}function x1e(e,t){e.action=t}function Tz(e){var t=Do(),n=li;if(n!==null)return sJ(t,n,e);Do(),t=t.memoizedState,n=Do();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function _y(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=Ps.updateQueue,t===null&&(t=t5(),Ps.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 rJ(){return Do().memoizedState}function KC(e,t,n,s){var r=Dl();Ps.flags|=e,r.memoizedState=_y(1|t,{destroy:void 0},n,s===void 0?null:s)}function s5(e,t,n,s){var r=Do();s=s===void 0?null:s;var i=r.memoizedState.inst;li!==null&&s!==null&&h9(s,li.memoizedState.deps)?r.memoizedState=_y(t,i,n,s):(Ps.flags|=e,r.memoizedState=_y(1|t,i,n,s))}function Ez(e,t){KC(8390656,8,e,t)}function v9(e,t){s5(2048,8,e,t)}function k1e(e){Ps.flags|=4;var t=Ps.updateQueue;if(t===null)t=t5(),Ps.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function iJ(e){var t=Do().memoizedState;return k1e({ref:t,nextImpl:e}),function(){if(qr&2)throw Error(yt(440));return t.impl.apply(void 0,arguments)}}function oJ(e,t){return s5(4,2,e,t)}function aJ(e,t){return s5(4,4,e,t)}function lJ(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 cJ(e,t,n){n=n!=null?n.concat([e]):null,s5(4,4,lJ.bind(null,t,e),n)}function w9(){}function uJ(e,t){var n=Do();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&h9(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function dJ(e,t){var n=Do();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&h9(t,s[1]))return s[0];if(s=e(),qg){Qm(!0);try{e()}finally{Qm(!1)}}return n.memoizedState=[s,t],s}function x9(e,t,n){return n===void 0||zf&1073741824&&!(fr&261930)?e.memoizedState=t:(e.memoizedState=n,e=ZJ(),Ps.lanes|=e,Mp|=e,n)}function hJ(e,t,n,s){return Xc(n,t)?n:ky.current!==null?(e=x9(e,n,s),Xc(e,t)||(Vo=!0),e):!(zf&42)||zf&1073741824&&!(fr&261930)?(Vo=!0,e.memoizedState=n):(e=ZJ(),Ps.lanes|=e,Mp|=e,t)}function fJ(e,t,n,s,r){var i=Wr.p;Wr.p=i!==0&&8>i?i:8;var o=hs.T,l={};hs.T=l,_9(e,!1,t,n);try{var c=r(),u=hs.S;if(u!==null&&u(l,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=b1e(c,s);Rx(e,t,d,Gc(e))}else Rx(e,t,s,Gc(e))}catch(f){Rx(e,t,{then:function(){},status:"rejected",reason:f},Gc())}finally{Wr.p=i,o!==null&&l.types!==null&&(o.types=l.types),hs.T=o}}function _1e(){}function c7(e,t,n,s){if(e.tag!==5)throw Error(yt(476));var r=mJ(e).queue;fJ(e,r,t,Ag,n===null?_1e:function(){return pJ(e),n(s)})}function mJ(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Ag,baseState:Ag,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ff,lastRenderedState:Ag},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ff,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function pJ(e){var t=mJ(e);t.next===null&&(t=e.alternate.memoizedState),Rx(e,t.next.queue,{},Gc())}function k9(){return rl(wk)}function gJ(){return Do().memoizedState}function bJ(){return Do().memoizedState}function S1e(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Gc();e=mp(n);var s=pp(t,e,n);s!==null&&(pc(s,t,n),Nx(s,t,n)),t={cache:a9()},e.payload=t;return}t=t.return}}function C1e(e,t,n){var s=Gc();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},r5(e)?vJ(t,n):(n=s9(e,t,n,s),n!==null&&(pc(n,e,s),wJ(n,t,s)))}function yJ(e,t,n){var s=Gc();Rx(e,t,n,s)}function Rx(e,t,n,s){var r={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(r5(e))vJ(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,l=i(o,n);if(r.hasEagerState=!0,r.eagerState=l,Xc(l,o))return Z3(e,t,r,0),xi===null&&J3(),!1}catch{}finally{}if(n=s9(e,t,r,s),n!==null)return pc(n,e,s),wJ(n,t,s),!0}return!1}function _9(e,t,n,s){if(s={lane:2,revertLane:M9(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},r5(e)){if(t)throw Error(yt(479))}else t=s9(e,n,s,2),t!==null&&pc(t,e,2)}function r5(e){var t=e.alternate;return e===Ps||t!==null&&t===Ps}function vJ(e,t){ey=J4=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function wJ(e,t,n){if(n&4194048){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,iQ(e,n)}}var bk={readContext:rl,use:n5,useCallback:yo,useContext:yo,useEffect:yo,useImperativeHandle:yo,useLayoutEffect:yo,useInsertionEffect:yo,useMemo:yo,useReducer:yo,useRef:yo,useState:yo,useDebugValue:yo,useDeferredValue:yo,useTransition:yo,useSyncExternalStore:yo,useId:yo,useHostTransitionStatus:yo,useFormState:yo,useActionState:yo,useOptimistic:yo,useMemoCache:yo,useCacheRefresh:yo};bk.useEffectEvent=yo;var xJ={readContext:rl,use:n5,useCallback:function(e,t){return Dl().memoizedState=[e,t===void 0?null:t],e},useContext:rl,useEffect:Ez,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,KC(4194308,4,lJ.bind(null,t,e),n)},useLayoutEffect:function(e,t){return KC(4194308,4,e,t)},useInsertionEffect:function(e,t){KC(4,2,e,t)},useMemo:function(e,t){var n=Dl();t=t===void 0?null:t;var s=e();if(qg){Qm(!0);try{e()}finally{Qm(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=Dl();if(n!==void 0){var r=n(t);if(qg){Qm(!0);try{n(t)}finally{Qm(!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=C1e.bind(null,Ps,e),[s.memoizedState,e]},useRef:function(e){var t=Dl();return e={current:e},t.memoizedState=e},useState:function(e){e=a7(e);var t=e.queue,n=yJ.bind(null,Ps,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:w9,useDeferredValue:function(e,t){var n=Dl();return x9(n,e,t)},useTransition:function(){var e=a7(!1);return e=fJ.bind(null,Ps,e.queue,!0,!1),Dl().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=Ps,r=Dl();if(xr){if(n===void 0)throw Error(yt(407));n=n()}else{if(n=t(),xi===null)throw Error(yt(349));fr&127||KQ(s,t,n)}r.memoizedState=n;var i={value:n,getSnapshot:t};return r.queue=i,Ez(XQ.bind(null,s,i,e),[e]),s.flags|=2048,_y(9,{destroy:void 0},YQ.bind(null,s,i,n,t),null),n},useId:function(){var e=Dl(),t=xi.identifierPrefix;if(xr){var n=ch,s=lh;n=(s&~(1<<32-Vc(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Z4++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=y1e++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:k9,useFormState:Sz,useActionState:Sz,useOptimistic:function(e){var t=Dl();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=_9.bind(null,Ps,!0,n),n.dispatch=t,[e,t]},useMemoCache:b9,useCacheRefresh:function(){return Dl().memoizedState=S1e.bind(null,Ps)},useEffectEvent:function(e){var t=Dl(),n={impl:e};return t.memoizedState=n,function(){if(qr&2)throw Error(yt(440));return n.impl.apply(void 0,arguments)}}},S9={readContext:rl,use:n5,useCallback:uJ,useContext:rl,useEffect:v9,useImperativeHandle:cJ,useInsertionEffect:oJ,useLayoutEffect:aJ,useMemo:dJ,useReducer:GC,useRef:rJ,useState:function(){return GC(Ff)},useDebugValue:w9,useDeferredValue:function(e,t){var n=Do();return hJ(n,li.memoizedState,e,t)},useTransition:function(){var e=GC(Ff)[0],t=Do().memoizedState;return[typeof e=="boolean"?e:w_(e),t]},useSyncExternalStore:GQ,useId:gJ,useHostTransitionStatus:k9,useFormState:Cz,useActionState:Cz,useOptimistic:function(e,t){var n=Do();return ZQ(n,li,e,t)},useMemoCache:b9,useCacheRefresh:bJ};S9.useEffectEvent=iJ;var kJ={readContext:rl,use:n5,useCallback:uJ,useContext:rl,useEffect:v9,useImperativeHandle:cJ,useInsertionEffect:oJ,useLayoutEffect:aJ,useMemo:dJ,useReducer:w8,useRef:rJ,useState:function(){return w8(Ff)},useDebugValue:w9,useDeferredValue:function(e,t){var n=Do();return li===null?x9(n,e,t):hJ(n,li.memoizedState,e,t)},useTransition:function(){var e=w8(Ff)[0],t=Do().memoizedState;return[typeof e=="boolean"?e:w_(e),t]},useSyncExternalStore:GQ,useId:gJ,useHostTransitionStatus:k9,useFormState:Tz,useActionState:Tz,useOptimistic:function(e,t){var n=Do();return li!==null?ZQ(n,li,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:b9,useCacheRefresh:bJ};kJ.useEffectEvent=iJ;function x8(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:Oi({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var u7={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=Gc(),r=mp(s);r.payload=t,n!=null&&(r.callback=n),t=pp(e,r,s),t!==null&&(pc(t,e,s),Nx(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=Gc(),r=mp(s);r.tag=1,r.payload=t,n!=null&&(r.callback=n),t=pp(e,r,s),t!==null&&(pc(t,e,s),Nx(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Gc(),s=mp(n);s.tag=2,t!=null&&(s.callback=t),t=pp(e,s,n),t!==null&&(pc(t,e,n),Nx(t,e,n))}};function Az(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?!hk(n,s)||!hk(r,i):!0}function jz(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&&u7.enqueueReplaceState(t,t.state,null)}function Hg(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=Oi({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}function _J(e){W4(e)}function SJ(e){console.error(e)}function CJ(e){W4(e)}function eT(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Nz(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 d7(e,t,n){return n=mp(n),n.tag=3,n.payload={element:null},n.callback=function(){eT(e,t)},n}function TJ(e){return e=mp(e),e.tag=3,e}function EJ(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(){Nz(t,n,s)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){Nz(t,n,s),typeof r!="function"&&(gp===null?gp=new Set([this]):gp.add(this));var l=s.stack;this.componentDidCatch(s.value,{componentStack:l!==null?l:""})})}function T1e(e,t,n,s,r){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&uv(t,n,r,!0),n=Qc.current,n!==null){switch(n.tag){case 31:case 13:return Pu===null?iT():n.alternate===null&&_o===0&&(_o=3),n.flags&=-257,n.flags|=65536,n.lanes=r,s===Y4?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),M8(e,s,r)),!1;case 22:return n.flags|=65536,s===Y4?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)),M8(e,s,r)),!1}throw Error(yt(435,n.tag))}return M8(e,s,r),iT(),!1}if(xr)return t=Qc.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=r,s!==JN&&(e=Error(yt(422),{cause:s}),mk(Cu(e,n)))):(s!==JN&&(t=Error(yt(423),{cause:s}),mk(Cu(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,s=Cu(s,n),r=d7(e.stateNode,s,r),v8(e,r),_o!==4&&(_o=2)),!1;var i=Error(yt(520),{cause:s});if(i=Cu(i,n),Px===null?Px=[i]:Px.push(i),_o!==4&&(_o=2),t===null)return!0;s=Cu(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=d7(n.stateNode,s,e),v8(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"&&(gp===null||!gp.has(i))))return n.flags|=65536,r&=-r,n.lanes|=r,r=TJ(r),EJ(r,e,n,s),v8(n,r),!1}n=n.return}while(n!==null);return!1}var C9=Error(yt(461)),Vo=!1;function Qa(e,t,n,s){t.child=e===null?FQ(t,null,n,s):Fg(t,e.child,n,s)}function Iz(e,t,n,s,r){n=n.render;var i=t.ref;if("ref"in s){var o={};for(var l in s)l!=="ref"&&(o[l]=s[l])}else o=s;return zg(t),s=f9(e,t,n,o,i,r),l=m9(),e!==null&&!Vo?(p9(e,t,r),qf(e,t,r)):(xr&&l&&i9(t),t.flags|=1,Qa(e,t,s,r),t.child)}function Mz(e,t,n,s,r){if(e===null){var i=n.type;return typeof i=="function"&&!r9(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,AJ(e,t,i,s,r)):(e=WC(n.type,null,s,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!T9(e,r)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:hk,n(o,s)&&e.ref===t.ref)return qf(e,t,r)}return t.flags|=1,e=Tf(i,s),e.ref=t.ref,e.return=t,t.child=e}function AJ(e,t,n,s,r){if(e!==null){var i=e.memoizedProps;if(hk(i,s)&&e.ref===t.ref)if(Vo=!1,t.pendingProps=s=i,T9(e,r))e.flags&131072&&(Vo=!0);else return t.lanes=e.lanes,qf(e,t,r)}return h7(e,t,n,s,r)}function jJ(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 Rz(e,t,i,n,s)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&VC(t,i!==null?i.cachePool:null),i!==null?xz(t,i):i7(),UQ(t);else return s=t.lanes=536870912,Rz(e,t,i!==null?i.baseLanes|n:n,n,s)}else i!==null?(VC(t,i.cachePool),xz(t,i),Gm(),t.memoizedState=null):(e!==null&&VC(t,null),i7(),Gm());return Qa(e,t,r,n),t.child}function ox(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Rz(e,t,n,s,r){var i=l9();return i=i===null?null:{parent:Ho._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&VC(t,null),i7(),UQ(t),e!==null&&uv(e,t,s,!0),t.childLanes=r,null}function YC(e,t){return t=tT({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Dz(e,t,n){return Fg(t,e.child,null,n),e=YC(t,t.pendingProps),e.flags|=2,$c(t),t.memoizedState=null,e}function E1e(e,t,n){var s=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(xr){if(s.mode==="hidden")return e=YC(t,s),t.lanes=536870912,ox(null,e);if(o7(t),(e=Li)?(e=xZ(e,Tu),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:jp!==null?{id:lh,overflow:ch}:null,retryLane:536870912,hydrationErrors:null},n=DQ(e),n.return=t,t.child=n,sl=t,Li=null)):e=null,e===null)throw Np(t);return t.lanes=536870912,null}return YC(t,s)}var i=e.memoizedState;if(i!==null){var o=i.dehydrated;if(o7(t),r)if(t.flags&256)t.flags&=-257,t=Dz(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(yt(558));else if(Vo||uv(e,t,n,!1),r=(n&e.childLanes)!==0,Vo||r){if(s=xi,s!==null&&(o=oQ(s,n),o!==0&&o!==i.retryLane))throw i.retryLane=o,c1(e,o),pc(s,e,o),C9;iT(),t=Dz(e,t,n)}else e=i.treeContext,Li=Ou(o.nextSibling),sl=t,xr=!0,fp=null,Tu=!1,e!==null&&PQ(t,e),t=YC(t,s),t.flags|=4096;return t}return e=Tf(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function XC(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(yt(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function h7(e,t,n,s,r){return zg(t),n=f9(e,t,n,s,void 0,r),s=m9(),e!==null&&!Vo?(p9(e,t,r),qf(e,t,r)):(xr&&s&&i9(t),t.flags|=1,Qa(e,t,n,r),t.child)}function Lz(e,t,n,s,r,i){return zg(t),t.updateQueue=null,n=VQ(t,s,n,r),WQ(e),s=m9(),e!==null&&!Vo?(p9(e,t,i),qf(e,t,i)):(xr&&s&&i9(t),t.flags|=1,Qa(e,t,n,i),t.child)}function Pz(e,t,n,s,r){if(zg(t),t.stateNode===null){var i=Pb,o=n.contextType;typeof o=="object"&&o!==null&&(i=rl(o)),i=new n(s,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=u7,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=s,i.state=t.memoizedState,i.refs={},u9(t),o=n.contextType,i.context=typeof o=="object"&&o!==null?rl(o):Pb,i.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o=="function"&&(x8(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&&u7.enqueueReplaceState(i,i.state,null),Mx(t,s,i,r),Ix(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){i=t.stateNode;var l=t.memoizedProps,c=Hg(n,l);i.props=c;var u=i.context,d=n.contextType;o=Pb,typeof d=="object"&&d!==null&&(o=rl(d));var f=n.getDerivedStateFromProps;d=typeof f=="function"||typeof i.getSnapshotBeforeUpdate=="function",l=t.pendingProps!==l,d||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l||u!==o)&&jz(t,i,s,o),zm=!1;var m=t.memoizedState;i.state=m,Mx(t,s,i,r),Ix(),u=t.memoizedState,l||m!==u||zm?(typeof f=="function"&&(x8(t,n,f,s),u=t.memoizedState),(c=zm||Az(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,s7(e,t),o=t.memoizedProps,d=Hg(n,o),i.props=d,f=t.pendingProps,m=i.context,u=n.contextType,c=Pb,typeof u=="object"&&u!==null&&(c=rl(u)),l=n.getDerivedStateFromProps,(u=typeof l=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o!==f||m!==c)&&jz(t,i,s,c),zm=!1,m=t.memoizedState,i.state=m,Mx(t,s,i,r),Ix();var p=t.memoizedState;o!==f||m!==p||zm||e!==null&&e.dependencies!==null&&K4(e.dependencies)?(typeof l=="function"&&(x8(t,n,l,s),p=t.memoizedState),(d=zm||Az(t,n,d,s,m,p,c)||e!==null&&e.dependencies!==null&&K4(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,XC(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=Fg(t,e.child,null,r),t.child=Fg(t,null,n,r)):Qa(e,t,n,r),t.memoizedState=i.state,e=t.child):e=qf(e,t,r),e}function Oz(e,t,n,s){return Bg(),t.flags|=256,Qa(e,t,n,s),t.child}var k8={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _8(e){return{baseLanes:e,cachePool:$Q()}}function S8(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Fc),e}function NJ(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:(Ro.current&2)!==0),o&&(r=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(xr){if(r?Vm(t):Gm(),(e=Li)?(e=xZ(e,Tu),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:jp!==null?{id:lh,overflow:ch}:null,retryLane:536870912,hydrationErrors:null},n=DQ(e),n.return=t,t.child=n,sl=t,Li=null)):e=null,e===null)throw Np(t);return T7(e)?t.lanes=32:t.lanes=536870912,null}var l=s.children;return s=s.fallback,r?(Gm(),r=t.mode,l=tT({mode:"hidden",children:l},r),s=jg(s,r,n,null),l.return=t,s.return=t,l.sibling=s,t.child=l,s=t.child,s.memoizedState=_8(n),s.childLanes=S8(e,o,n),t.memoizedState=k8,ox(null,s)):(Vm(t),f7(t,l))}var c=e.memoizedState;if(c!==null&&(l=c.dehydrated,l!==null)){if(i)t.flags&256?(Vm(t),t.flags&=-257,t=C8(e,t,n)):t.memoizedState!==null?(Gm(),t.child=e.child,t.flags|=128,t=null):(Gm(),l=s.fallback,r=t.mode,s=tT({mode:"visible",children:s.children},r),l=jg(l,r,n,null),l.flags|=2,s.return=t,l.return=t,s.sibling=l,t.child=s,Fg(t,e.child,null,n),s=t.child,s.memoizedState=_8(n),s.childLanes=S8(e,o,n),t.memoizedState=k8,t=ox(null,s));else if(Vm(t),T7(l)){if(o=l.nextSibling&&l.nextSibling.dataset,o)var u=o.dgst;o=u,s=Error(yt(419)),s.stack="",s.digest=o,mk({value:s,source:null,stack:null}),t=C8(e,t,n)}else if(Vo||uv(e,t,n,!1),o=(n&e.childLanes)!==0,Vo||o){if(o=xi,o!==null&&(s=oQ(o,n),s!==0&&s!==c.retryLane))throw c.retryLane=s,c1(e,s),pc(o,e,s),C9;C7(l)||iT(),t=C8(e,t,n)}else C7(l)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,Li=Ou(l.nextSibling),sl=t,xr=!0,fp=null,Tu=!1,e!==null&&PQ(t,e),t=f7(t,s.children),t.flags|=4096);return t}return r?(Gm(),l=s.fallback,r=t.mode,c=e.child,u=c.sibling,s=Tf(c,{mode:"hidden",children:s.children}),s.subtreeFlags=c.subtreeFlags&65011712,u!==null?l=Tf(u,l):(l=jg(l,r,n,null),l.flags|=2),l.return=t,s.return=t,s.sibling=l,t.child=s,ox(null,s),s=t.child,l=e.child.memoizedState,l===null?l=_8(n):(r=l.cachePool,r!==null?(c=Ho._currentValue,r=r.parent!==c?{parent:c,pool:c}:r):r=$Q(),l={baseLanes:l.baseLanes|n,cachePool:r}),s.memoizedState=l,s.childLanes=S8(e,o,n),t.memoizedState=k8,ox(e.child,s)):(Vm(t),n=e.child,e=n.sibling,n=Tf(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 f7(e,t){return t=tT({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function tT(e,t){return e=zc(22,e,null,t),e.lanes=0,e}function C8(e,t,n){return Fg(t,e.child,null,n),e=f7(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function $z(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),e7(e.return,t,n)}function T8(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 IJ(e,t,n){var s=t.pendingProps,r=s.revealOrder,i=s.tail;s=s.children;var o=Ro.current,l=(o&2)!==0;if(l?(o=o&1|2,t.flags|=128):o&=1,ji(Ro,o),Qa(e,t,s,n),s=xr?fk:0,!l&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&$z(e,n,t);else if(e.tag===19)$z(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&&Q4(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),T8(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&&Q4(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}T8(t,!0,n,null,i,s);break;case"together":T8(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function qf(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Mp|=t.lanes,!(n&t.childLanes))if(e!==null){if(uv(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(yt(153));if(t.child!==null){for(e=t.child,n=Tf(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Tf(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function T9(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&K4(e)))}function A1e(e,t,n){switch(t.tag){case 3:F4(t,t.stateNode.containerInfo),Wm(t,Ho,e.memoizedState.cache),Bg();break;case 27:case 5:FN(t);break;case 4:F4(t,t.stateNode.containerInfo);break;case 10:Wm(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,o7(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Vm(t),t.flags|=128,null):n&t.child.childLanes?NJ(e,t,n):(Vm(t),e=qf(e,t,n),e!==null?e.sibling:null);Vm(t);break;case 19:var r=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(uv(e,t,n,!1),s=(n&t.childLanes)!==0),r){if(s)return IJ(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),ji(Ro,Ro.current),s)break;return null;case 22:return t.lanes=0,jJ(e,t,n,t.pendingProps);case 24:Wm(t,Ho,e.memoizedState.cache)}return qf(e,t,n)}function MJ(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Vo=!0;else{if(!T9(e,n)&&!(t.flags&128))return Vo=!1,A1e(e,t,n);Vo=!!(e.flags&131072)}else Vo=!1,xr&&t.flags&1048576&&LQ(t,fk,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=ig(t.elementType),t.type=e,typeof e=="function")r9(e)?(s=Hg(e,s),t.tag=1,t=Pz(null,t,e,s,n)):(t.tag=0,t=h7(null,t,e,s,n));else{if(e!=null){var r=e.$$typeof;if(r===UR){t.tag=11,t=Iz(null,t,e,s,n);break e}else if(r===WR){t.tag=14,t=Mz(null,t,e,s,n);break e}}throw t=BN(e)||e,Error(yt(306,t,""))}}return t;case 0:return h7(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,r=Hg(s,t.pendingProps),Pz(e,t,s,r,n);case 3:e:{if(F4(t,t.stateNode.containerInfo),e===null)throw Error(yt(387));s=t.pendingProps;var i=t.memoizedState;r=i.element,s7(e,t),Mx(t,s,null,n);var o=t.memoizedState;if(s=o.cache,Wm(t,Ho,s),s!==i.cache&&t7(t,[Ho],n,!0),Ix(),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=Oz(e,t,s,n);break e}else if(s!==r){r=Cu(Error(yt(424)),t),mk(r),t=Oz(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(Li=Ou(e.firstChild),sl=t,xr=!0,fp=null,Tu=!0,n=FQ(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Bg(),s===r){t=qf(e,t,n);break e}Qa(e,t,s,n)}t=t.child}return t;case 26:return XC(e,t),e===null?(n=rF(t.type,null,t.pendingProps,null))?t.memoizedState=n:xr||(n=t.type,e=t.pendingProps,s=cT(hp.current).createElement(n),s[nl]=t,s[yc]=e,ol(s,n,e),Da(s),t.stateNode=s):t.memoizedState=rF(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return FN(t),e===null&&xr&&(s=t.stateNode=kZ(t.type,t.pendingProps,hp.current),sl=t,Tu=!0,r=Li,o0(t.type)?(E7=r,Li=Ou(s.firstChild)):Li=r),Qa(e,t,t.pendingProps.children,n),XC(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&xr&&((r=s=Li)&&(s=rbe(s,t.type,t.pendingProps,Tu),s!==null?(t.stateNode=s,sl=t,Li=Ou(s.firstChild),Tu=!1,r=!0):r=!1),r||Np(t)),FN(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,_7(r,i)?s=null:o!==null&&_7(r,o)&&(t.flags|=32),t.memoizedState!==null&&(r=f9(e,t,v1e,null,null,n),wk._currentValue=r),XC(e,t),Qa(e,t,s,n),t.child;case 6:return e===null&&xr&&((e=n=Li)&&(n=ibe(n,t.pendingProps,Tu),n!==null?(t.stateNode=n,sl=t,Li=null,e=!0):e=!1),e||Np(t)),null;case 13:return NJ(e,t,n);case 4:return F4(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Fg(t,null,s,n):Qa(e,t,s,n),t.child;case 11:return Iz(e,t,t.type,t.pendingProps,n);case 7:return Qa(e,t,t.pendingProps,n),t.child;case 8:return Qa(e,t,t.pendingProps.children,n),t.child;case 12:return Qa(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,Wm(t,t.type,s.value),Qa(e,t,s.children,n),t.child;case 9:return r=t.type._context,s=t.pendingProps.children,zg(t),r=rl(r),s=s(r),t.flags|=1,Qa(e,t,s,n),t.child;case 14:return Mz(e,t,t.type,t.pendingProps,n);case 15:return AJ(e,t,t.type,t.pendingProps,n);case 19:return IJ(e,t,n);case 31:return E1e(e,t,n);case 22:return jJ(e,t,n,t.pendingProps);case 24:return zg(t),s=rl(Ho),e===null?(r=l9(),r===null&&(r=xi,i=a9(),r.pooledCache=i,i.refCount++,i!==null&&(r.pooledCacheLanes|=n),r=i),t.memoizedState={parent:s,cache:r},u9(t),Wm(t,Ho,r)):(e.lanes&n&&(s7(e,t),Mx(t,null,null,n),Ix()),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),Wm(t,Ho,s)):(s=i.cache,Wm(t,Ho,s),s!==r.cache&&t7(t,[Ho],n,!0))),Qa(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(yt(156,t.tag))}function Jh(e){e.flags|=4}function E8(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(nZ())e.flags|=8192;else throw Ig=Y4,c9}else e.flags&=-16777217}function Bz(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!CZ(t))if(nZ())e.flags|=8192;else throw Ig=Y4,c9}function a2(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?sQ():536870912,e.lanes|=t,Sy|=t)}function Ew(e,t){if(!xr)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 Di(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 j1e(e,t,n){var s=t.pendingProps;switch(o9(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Di(t),null;case 1:return Di(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Ef(Ho),yy(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Y1(t)?Jh(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,y8())),Di(t),null;case 26:var r=t.type,i=t.memoizedState;return e===null?(Jh(t),i!==null?(Di(t),Bz(t,i)):(Di(t),E8(t,r,null,s,n))):i?i!==e.memoizedState?(Jh(t),Di(t),Bz(t,i)):(Di(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&Jh(t),Di(t),E8(t,r,e,s,n)),null;case 27:if(q4(t),n=hp.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Jh(t);else{if(!s){if(t.stateNode===null)throw Error(yt(166));return Di(t),null}e=vh.current,Y1(t)?mz(t):(e=kZ(r,s,n),t.stateNode=e,Jh(t))}return Di(t),null;case 5:if(q4(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Jh(t);else{if(!s){if(t.stateNode===null)throw Error(yt(166));return Di(t),null}if(i=vh.current,Y1(t))mz(t);else{var o=cT(hp.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[nl]=t,i[yc]=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(ol(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&&Jh(t)}}return Di(t),E8(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&Jh(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(yt(166));if(e=hp.current,Y1(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,r=sl,r!==null)switch(r.tag){case 27:case 5:s=r.memoizedProps}e[nl]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||yZ(e.nodeValue,n)),e||Np(t,!0)}else e=cT(e).createTextNode(s),e[nl]=t,t.stateNode=e}return Di(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=Y1(t),n!==null){if(e===null){if(!s)throw Error(yt(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(yt(557));e[nl]=t}else Bg(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Di(t),e=!1}else n=y8(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?($c(t),t):($c(t),null);if(t.flags&128)throw Error(yt(558))}return Di(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Y1(t),s!==null&&s.dehydrated!==null){if(e===null){if(!r)throw Error(yt(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(yt(317));r[nl]=t}else Bg(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Di(t),r=!1}else r=y8(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?($c(t),t):($c(t),null)}return $c(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),a2(t,t.updateQueue),Di(t),null);case 4:return yy(),e===null&&R9(t.stateNode.containerInfo),Di(t),null;case 10:return Ef(t.type),Di(t),null;case 19:if($a(Ro),s=t.memoizedState,s===null)return Di(t),null;if(r=(t.flags&128)!==0,i=s.rendering,i===null)if(r)Ew(s,!1);else{if(_o!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=Q4(e),i!==null){for(t.flags|=128,Ew(s,!1),e=i.updateQueue,t.updateQueue=e,a2(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)RQ(n,e),n=n.sibling;return ji(Ro,Ro.current&1|2),xr&&cf(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Uc()>sT&&(t.flags|=128,r=!0,Ew(s,!1),t.lanes=4194304)}else{if(!r)if(e=Q4(i),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,a2(t,e),Ew(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!xr)return Di(t),null}else 2*Uc()-s.renderingStartTime>sT&&n!==536870912&&(t.flags|=128,r=!0,Ew(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=Uc(),e.sibling=null,n=Ro.current,ji(Ro,r?n&1|2:n&1),xr&&cf(t,s.treeForkCount),e):(Di(t),null);case 22:case 23:return $c(t),d9(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?n&536870912&&!(t.flags&128)&&(Di(t),t.subtreeFlags&6&&(t.flags|=8192)):Di(t),n=t.updateQueue,n!==null&&a2(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&&$a(Ng),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ef(Ho),Di(t),null;case 25:return null;case 30:return null}throw Error(yt(156,t.tag))}function N1e(e,t){switch(o9(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ef(Ho),yy(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return q4(t),null;case 31:if(t.memoizedState!==null){if($c(t),t.alternate===null)throw Error(yt(340));Bg()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if($c(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(yt(340));Bg()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $a(Ro),null;case 4:return yy(),null;case 10:return Ef(t.type),null;case 22:case 23:return $c(t),d9(),e!==null&&$a(Ng),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ef(Ho),null;case 25:return null;default:return null}}function RJ(e,t){switch(o9(t),t.tag){case 3:Ef(Ho),yy();break;case 26:case 27:case 5:q4(t);break;case 4:yy();break;case 31:t.memoizedState!==null&&$c(t);break;case 13:$c(t);break;case 19:$a(Ro);break;case 10:Ef(t.type);break;case 22:case 23:$c(t),d9(),e!==null&&$a(Ng);break;case 24:Ef(Ho)}}function x_(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(l){ni(t,t.return,l)}}function Ip(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,l=o.destroy;if(l!==void 0){o.destroy=void 0,r=t;var c=n,u=l;try{u()}catch(d){ni(r,c,d)}}}s=s.next}while(s!==i)}}catch(d){ni(t,t.return,d)}}function DJ(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{HQ(t,n)}catch(s){ni(e,e.return,s)}}}function LJ(e,t,n){n.props=Hg(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){ni(e,t,s)}}function Dx(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){ni(e,t,r)}}function uh(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(r){ni(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){ni(e,t,r)}else n.current=null}function PJ(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){ni(e,e.return,r)}}function A8(e,t,n){try{var s=e.stateNode;J1e(s,e.type,n,t),s[yc]=t}catch(r){ni(e,e.return,r)}}function OJ(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&o0(e.type)||e.tag===4}function j8(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||OJ(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&&o0(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 m7(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=vf));else if(s!==4&&(s===27&&o0(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(m7(e,t,n),e=e.sibling;e!==null;)m7(e,t,n),e=e.sibling}function nT(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&&o0(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(nT(e,t,n),e=e.sibling;e!==null;)nT(e,t,n),e=e.sibling}function $J(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);ol(t,s,n),t[nl]=e,t[yc]=n}catch(i){ni(e,e.return,i)}}var mf=!1,qo=!1,N8=!1,zz=typeof WeakSet=="function"?WeakSet:Set,Ma=null;function I1e(e,t){if(e=e.containerInfo,x7=fT,e=CQ(e),t9(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,l=-1,c=-1,u=0,d=0,f=e,m=null;t:for(;;){for(var p;f!==n||r!==0&&f.nodeType!==3||(l=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&&(l=o),m===i&&++d===s&&(c=o),(p=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(k7={focusedElem:e,selectionRange:n},fT=!1,Ma=t;Ma!==null;)if(t=Ma,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ma=e;else for(;Ma!==null;){switch(t=Ma,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=Hg(n.type,r);e=s.getSnapshotBeforeUpdate(g,i),s.__reactInternalSnapshotBeforeUpdate=e}catch(b){ni(n,n.return,b)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)S7(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":S7(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(yt(163))}if(e=t.sibling,e!==null){e.return=t.return,Ma=e;break}Ma=t.return}}function BJ(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:ef(e,n),s&4&&x_(5,n);break;case 1:if(ef(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(o){ni(n,n.return,o)}else{var r=Hg(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){ni(n,n.return,o)}}s&64&&DJ(n),s&512&&Dx(n,n.return);break;case 3:if(ef(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{HQ(e,t)}catch(o){ni(n,n.return,o)}}break;case 27:t===null&&s&4&&$J(n);case 26:case 5:ef(e,n),t===null&&s&4&&PJ(n),s&512&&Dx(n,n.return);break;case 12:ef(e,n);break;case 31:ef(e,n),s&4&&qJ(e,n);break;case 13:ef(e,n),s&4&&HJ(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=z1e.bind(null,n),obe(e,n))));break;case 22:if(s=n.memoizedState!==null||mf,!s){t=t!==null&&t.memoizedState!==null||qo,r=mf;var i=qo;mf=s,(qo=t)&&!i?lf(e,n,(n.subtreeFlags&8772)!==0):ef(e,n),mf=r,qo=i}break;case 30:break;default:ef(e,n)}}function zJ(e){var t=e.alternate;t!==null&&(e.alternate=null,zJ(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&YR(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 zi=null,ic=!1;function Zh(e,t,n){for(n=n.child;n!==null;)FJ(e,t,n),n=n.sibling}function FJ(e,t,n){if(Wc&&typeof Wc.onCommitFiberUnmount=="function")try{Wc.onCommitFiberUnmount(m_,n)}catch{}switch(n.tag){case 26:qo||uh(n,t),Zh(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:qo||uh(n,t);var s=zi,r=ic;o0(n.type)&&(zi=n.stateNode,ic=!1),Zh(e,t,n),$x(n.stateNode),zi=s,ic=r;break;case 5:qo||uh(n,t);case 6:if(s=zi,r=ic,zi=null,Zh(e,t,n),zi=s,ic=r,zi!==null)if(ic)try{(zi.nodeType===9?zi.body:zi.nodeName==="HTML"?zi.ownerDocument.body:zi).removeChild(n.stateNode)}catch(i){ni(n,t,i)}else try{zi.removeChild(n.stateNode)}catch(i){ni(n,t,i)}break;case 18:zi!==null&&(ic?(e=zi,Zz(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Ay(e)):Zz(zi,n.stateNode));break;case 4:s=zi,r=ic,zi=n.stateNode.containerInfo,ic=!0,Zh(e,t,n),zi=s,ic=r;break;case 0:case 11:case 14:case 15:Ip(2,n,t),qo||Ip(4,n,t),Zh(e,t,n);break;case 1:qo||(uh(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&LJ(n,t,s)),Zh(e,t,n);break;case 21:Zh(e,t,n);break;case 22:qo=(s=qo)||n.memoizedState!==null,Zh(e,t,n),qo=s;break;default:Zh(e,t,n)}}function qJ(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ay(e)}catch(n){ni(t,t.return,n)}}}function HJ(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ay(e)}catch(n){ni(t,t.return,n)}}function M1e(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new zz),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new zz),t;default:throw Error(yt(435,e.tag))}}function l2(e,t){var n=M1e(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var r=F1e.bind(null,e,s);s.then(r,r)}})}function tc(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,l=o;e:for(;l!==null;){switch(l.tag){case 27:if(o0(l.type)){zi=l.stateNode,ic=!1;break e}break;case 5:zi=l.stateNode,ic=!1;break e;case 3:case 4:zi=l.stateNode.containerInfo,ic=!0;break e}l=l.return}if(zi===null)throw Error(yt(160));FJ(i,o,r),zi=null,ic=!1,i=r.alternate,i!==null&&(i.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)UJ(t,e),t=t.sibling}var ld=null;function UJ(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:tc(t,e),nc(e),s&4&&(Ip(3,e,e.return),x_(3,e),Ip(5,e,e.return));break;case 1:tc(t,e),nc(e),s&512&&(qo||n===null||uh(n,n.return)),s&64&&mf&&(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=ld;if(tc(t,e),nc(e),s&512&&(qo||n===null||uh(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[b_]||i[nl]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=r.createElement(s),r.head.insertBefore(i,r.querySelector("head > title"))),ol(i,s,n),i[nl]=e,Da(i),s=i;break e;case"link":var o=oF("link","href",r).get(s+(n.href||""));if(o){for(var l=0;l<o.length;l++)if(i=o[l],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(l,1);break t}}i=r.createElement(s),ol(i,s,n),r.head.appendChild(i);break;case"meta":if(o=oF("meta","content",r).get(s+(n.content||""))){for(l=0;l<o.length;l++)if(i=o[l],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(l,1);break t}}i=r.createElement(s),ol(i,s,n),r.head.appendChild(i);break;default:throw Error(yt(468,s))}i[nl]=e,Da(i),s=i}e.stateNode=s}else aF(r,e.type,e.stateNode);else e.stateNode=iF(r,s,e.memoizedProps);else i!==s?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,s===null?aF(r,e.type,e.stateNode):iF(r,s,e.memoizedProps)):s===null&&e.stateNode!==null&&A8(e,e.memoizedProps,n.memoizedProps)}break;case 27:tc(t,e),nc(e),s&512&&(qo||n===null||uh(n,n.return)),n!==null&&s&4&&A8(e,e.memoizedProps,n.memoizedProps);break;case 5:if(tc(t,e),nc(e),s&512&&(qo||n===null||uh(n,n.return)),e.flags&32){r=e.stateNode;try{wy(r,"")}catch(g){ni(e,e.return,g)}}s&4&&e.stateNode!=null&&(r=e.memoizedProps,A8(e,r,n!==null?n.memoizedProps:r)),s&1024&&(N8=!0);break;case 6:if(tc(t,e),nc(e),s&4){if(e.stateNode===null)throw Error(yt(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(g){ni(e,e.return,g)}}break;case 3:if(ZC=null,r=ld,ld=uT(t.containerInfo),tc(t,e),ld=r,nc(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{Ay(t.containerInfo)}catch(g){ni(e,e.return,g)}N8&&(N8=!1,WJ(e));break;case 4:s=ld,ld=uT(e.stateNode.containerInfo),tc(t,e),nc(e),ld=s;break;case 12:tc(t,e),nc(e);break;case 31:tc(t,e),nc(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,l2(e,s)));break;case 13:tc(t,e),nc(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(i5=Uc()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,l2(e,s)));break;case 22:r=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,u=mf,d=qo;if(mf=u||r,qo=d||c,tc(t,e),qo=d,mf=u,nc(e),s&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(n===null||c||mf||qo||og(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{l=c.stateNode;var f=c.memoizedProps.style,m=f!=null&&f.hasOwnProperty("display")?f.display:null;l.style.display=m==null||typeof m=="boolean"?"":(""+m).trim()}}catch(g){ni(c,c.return,g)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=r?"":c.memoizedProps}catch(g){ni(c,c.return,g)}}}else if(t.tag===18){if(n===null){c=t;try{var p=c.stateNode;r?eF(p,!0):eF(c.stateNode,!1)}catch(g){ni(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,l2(e,n))));break;case 19:tc(t,e),nc(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,l2(e,s)));break;case 30:break;case 21:break;default:tc(t,e),nc(e)}}function nc(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(OJ(s)){n=s;break}s=s.return}if(n==null)throw Error(yt(160));switch(n.tag){case 27:var r=n.stateNode,i=j8(e);nT(e,i,r);break;case 5:var o=n.stateNode;n.flags&32&&(wy(o,""),n.flags&=-33);var l=j8(e);nT(e,l,o);break;case 3:case 4:var c=n.stateNode.containerInfo,u=j8(e);m7(e,u,c);break;default:throw Error(yt(161))}}catch(d){ni(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function WJ(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;WJ(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ef(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)BJ(e,t.alternate,t),t=t.sibling}function og(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ip(4,t,t.return),og(t);break;case 1:uh(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&LJ(t,t.return,n),og(t);break;case 27:$x(t.stateNode);case 26:case 5:uh(t,t.return),og(t);break;case 22:t.memoizedState===null&&og(t);break;case 30:og(t);break;default:og(t)}e=e.sibling}}function lf(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:lf(r,i,n),x_(4,i);break;case 1:if(lf(r,i,n),s=i,r=s.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(u){ni(s,s.return,u)}if(s=i,r=s.updateQueue,r!==null){var l=s.stateNode;try{var c=r.shared.hiddenCallbacks;if(c!==null)for(r.shared.hiddenCallbacks=null,r=0;r<c.length;r++)qQ(c[r],l)}catch(u){ni(s,s.return,u)}}n&&o&64&&DJ(i),Dx(i,i.return);break;case 27:$J(i);case 26:case 5:lf(r,i,n),n&&s===null&&o&4&&PJ(i),Dx(i,i.return);break;case 12:lf(r,i,n);break;case 31:lf(r,i,n),n&&o&4&&qJ(r,i);break;case 13:lf(r,i,n),n&&o&4&&HJ(r,i);break;case 22:i.memoizedState===null&&lf(r,i,n),Dx(i,i.return);break;case 30:break;default:lf(r,i,n)}t=t.sibling}}function E9(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&v_(n))}function A9(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&v_(e))}function td(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)VJ(e,t,n,s),t=t.sibling}function VJ(e,t,n,s){var r=t.flags;switch(t.tag){case 0:case 11:case 15:td(e,t,n,s),r&2048&&x_(9,t);break;case 1:td(e,t,n,s);break;case 3:td(e,t,n,s),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&v_(e)));break;case 12:if(r&2048){td(e,t,n,s),e=t.stateNode;try{var i=t.memoizedProps,o=i.id,l=i.onPostCommit;typeof l=="function"&&l(o,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){ni(t,t.return,c)}}else td(e,t,n,s);break;case 31:td(e,t,n,s);break;case 13:td(e,t,n,s);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,t.memoizedState!==null?i._visibility&2?td(e,t,n,s):Lx(e,t):i._visibility&2?td(e,t,n,s):(i._visibility|=2,vb(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),r&2048&&E9(o,t);break;case 24:td(e,t,n,s),r&2048&&A9(t.alternate,t);break;default:td(e,t,n,s)}}function vb(e,t,n,s,r){for(r=r&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,o=t,l=n,c=s,u=o.flags;switch(o.tag){case 0:case 11:case 15:vb(i,o,l,c,r),x_(8,o);break;case 23:break;case 22:var d=o.stateNode;o.memoizedState!==null?d._visibility&2?vb(i,o,l,c,r):Lx(i,o):(d._visibility|=2,vb(i,o,l,c,r)),r&&u&2048&&E9(o.alternate,o);break;case 24:vb(i,o,l,c,r),r&&u&2048&&A9(o.alternate,o);break;default:vb(i,o,l,c,r)}t=t.sibling}}function Lx(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:Lx(n,s),r&2048&&E9(s.alternate,s);break;case 24:Lx(n,s),r&2048&&A9(s.alternate,s);break;default:Lx(n,s)}t=t.sibling}}var ax=8192;function X1(e,t,n){if(e.subtreeFlags&ax)for(e=e.child;e!==null;)GJ(e,t,n),e=e.sibling}function GJ(e,t,n){switch(e.tag){case 26:X1(e,t,n),e.flags&ax&&e.memoizedState!==null&&ybe(n,ld,e.memoizedState,e.memoizedProps);break;case 5:X1(e,t,n);break;case 3:case 4:var s=ld;ld=uT(e.stateNode.containerInfo),X1(e,t,n),ld=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=ax,ax=16777216,X1(e,t,n),ax=s):X1(e,t,n));break;default:X1(e,t,n)}}function KJ(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 Aw(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];Ma=s,XJ(s,e)}KJ(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)YJ(e),e=e.sibling}function YJ(e){switch(e.tag){case 0:case 11:case 15:Aw(e),e.flags&2048&&Ip(9,e,e.return);break;case 3:Aw(e);break;case 12:Aw(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,QC(e)):Aw(e);break;default:Aw(e)}}function QC(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];Ma=s,XJ(s,e)}KJ(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ip(8,t,t.return),QC(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,QC(t));break;default:QC(t)}e=e.sibling}}function XJ(e,t){for(;Ma!==null;){var n=Ma;switch(n.tag){case 0:case 11:case 15:Ip(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var s=n.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:v_(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,Ma=s;else e:for(n=e;Ma!==null;){s=Ma;var r=s.sibling,i=s.return;if(zJ(s),s===n){Ma=null;break e}if(r!==null){r.return=i,Ma=r;break e}Ma=i}}}var R1e={getCacheForType:function(e){var t=rl(Ho),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return rl(Ho).controller.signal}},D1e=typeof WeakMap=="function"?WeakMap:Map,qr=0,xi=null,cr=null,fr=0,ti=0,Lc=null,Zm=!1,hv=!1,j9=!1,Hf=0,_o=0,Mp=0,Mg=0,N9=0,Fc=0,Sy=0,Px=null,oc=null,p7=!1,i5=0,QJ=0,sT=1/0,rT=null,gp=null,da=0,bp=null,Cy=null,Af=0,g7=0,b7=null,JJ=null,Ox=0,y7=null;function Gc(){return qr&2&&fr!==0?fr&-fr:hs.T!==null?M9():aQ()}function ZJ(){if(Fc===0)if(!(fr&536870912)||xr){var e=e2;e2<<=1,!(e2&3932160)&&(e2=262144),Fc=e}else Fc=536870912;return e=Qc.current,e!==null&&(e.flags|=32),Fc}function pc(e,t,n){(e===xi&&(ti===2||ti===9)||e.cancelPendingCommit!==null)&&(Ty(e,0),ep(e,fr,Fc,!1)),g_(e,n),(!(qr&2)||e!==xi)&&(e===xi&&(!(qr&2)&&(Mg|=n),_o===4&&ep(e,fr,Fc,!1)),Ah(e))}function eZ(e,t,n){if(qr&6)throw Error(yt(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||p_(e,t),r=s?O1e(e,t):I8(e,t,!0),i=s;do{if(r===0){hv&&!s&&ep(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!L1e(n)){r=I8(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 l=e;r=Px;var c=l.current.memoizedState.isDehydrated;if(c&&(Ty(l,o).flags|=256),o=I8(l,o,!1),o!==2){if(j9&&!c){l.errorRecoveryDisabledLanes|=i,Mg|=i,r=4;break e}i=oc,oc=r,i!==null&&(oc===null?oc=i:oc.push.apply(oc,i))}r=o}if(i=!1,r!==2)continue}}if(r===1){Ty(e,0),ep(e,t,0,!0);break}e:{switch(s=e,i=r,i){case 0:case 1:throw Error(yt(345));case 4:if((t&4194048)!==t)break;case 6:ep(s,t,Fc,!Zm);break e;case 2:oc=null;break;case 3:case 5:break;default:throw Error(yt(329))}if((t&62914560)===t&&(r=i5+300-Uc(),10<r)){if(ep(s,t,Fc,!Zm),K3(s,0,!0)!==0)break e;Af=t,s.timeoutHandle=wZ(Fz.bind(null,s,n,oc,rT,p7,t,Fc,Mg,Sy,Zm,i,"Throttled",-0,0),r);break e}Fz(s,n,oc,rT,p7,t,Fc,Mg,Sy,Zm,i,null,-0,0)}}break}while(!0);Ah(e)}function Fz(e,t,n,s,r,i,o,l,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:vf},GJ(t,i,f);var g=(i&62914560)===i?i5-Uc():(i&4194048)===i?QJ-Uc():0;if(g=vbe(f,g),g!==null){Af=i,e.cancelPendingCommit=g(Hz.bind(null,e,t,i,n,s,r,o,l,c,d,f,null,m,p)),ep(e,i,o,!u);return}}Hz(e,t,i,n,s,r,o,l,c)}function L1e(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(!Xc(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 ep(e,t,n,s){t&=~N9,t&=~Mg,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var r=t;0<r;){var i=31-Vc(r),o=1<<i;s[i]=-1,r&=~o}n!==0&&rQ(e,n,t)}function o5(){return qr&6?!0:(k_(0),!1)}function I9(){if(cr!==null){if(ti===0)var e=cr.return;else e=cr,wf=u1=null,g9(e),Zb=null,pk=0,e=cr;for(;e!==null;)RJ(e.alternate,e),e=e.return;cr=null}}function Ty(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,tbe(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Af=0,I9(),xi=e,cr=n=Tf(e.current,null),fr=t,ti=0,Lc=null,Zm=!1,hv=p_(e,t),j9=!1,Sy=Fc=N9=Mg=Mp=_o=0,oc=Px=null,p7=!1,t&8&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var r=31-Vc(s),i=1<<r;t|=e[r],s&=~i}return Hf=t,J3(),n}function tZ(e,t){Ps=null,hs.H=bk,t===dv||t===e5?(t=vz(),ti=3):t===c9?(t=vz(),ti=4):ti=t===C9?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Lc=t,cr===null&&(_o=1,eT(e,Cu(t,e.current)))}function nZ(){var e=Qc.current;return e===null?!0:(fr&4194048)===fr?Pu===null:(fr&62914560)===fr||fr&536870912?e===Pu:!1}function sZ(){var e=hs.H;return hs.H=bk,e===null?bk:e}function rZ(){var e=hs.A;return hs.A=R1e,e}function iT(){_o=4,Zm||(fr&4194048)!==fr&&Qc.current!==null||(hv=!0),!(Mp&134217727)&&!(Mg&134217727)||xi===null||ep(xi,fr,Fc,!1)}function I8(e,t,n){var s=qr;qr|=2;var r=sZ(),i=rZ();(xi!==e||fr!==t)&&(rT=null,Ty(e,t)),t=!1;var o=_o;e:do try{if(ti!==0&&cr!==null){var l=cr,c=Lc;switch(ti){case 8:I9(),o=6;break e;case 3:case 2:case 9:case 6:Qc.current===null&&(t=!0);var u=ti;if(ti=0,Lc=null,Bb(e,l,c,u),n&&hv){o=0;break e}break;default:u=ti,ti=0,Lc=null,Bb(e,l,c,u)}}P1e(),o=_o;break}catch(d){tZ(e,d)}while(!0);return t&&e.shellSuspendCounter++,wf=u1=null,qr=s,hs.H=r,hs.A=i,cr===null&&(xi=null,fr=0,J3()),o}function P1e(){for(;cr!==null;)iZ(cr)}function O1e(e,t){var n=qr;qr|=2;var s=sZ(),r=rZ();xi!==e||fr!==t?(rT=null,sT=Uc()+500,Ty(e,t)):hv=p_(e,t);e:do try{if(ti!==0&&cr!==null){t=cr;var i=Lc;t:switch(ti){case 1:ti=0,Lc=null,Bb(e,t,i,1);break;case 2:case 9:if(yz(i)){ti=0,Lc=null,qz(t);break}t=function(){ti!==2&&ti!==9||xi!==e||(ti=7),Ah(e)},i.then(t,t);break e;case 3:ti=7;break e;case 4:ti=5;break e;case 7:yz(i)?(ti=0,Lc=null,qz(t)):(ti=0,Lc=null,Bb(e,t,i,7));break;case 5:var o=null;switch(cr.tag){case 26:o=cr.memoizedState;case 5:case 27:var l=cr;if(o?CZ(o):l.stateNode.complete){ti=0,Lc=null;var c=l.sibling;if(c!==null)cr=c;else{var u=l.return;u!==null?(cr=u,a5(u)):cr=null}break t}}ti=0,Lc=null,Bb(e,t,i,5);break;case 6:ti=0,Lc=null,Bb(e,t,i,6);break;case 8:I9(),_o=6;break e;default:throw Error(yt(462))}}$1e();break}catch(d){tZ(e,d)}while(!0);return wf=u1=null,hs.H=s,hs.A=r,qr=n,cr!==null?0:(xi=null,fr=0,J3(),_o)}function $1e(){for(;cr!==null&&!age();)iZ(cr)}function iZ(e){var t=MJ(e.alternate,e,Hf);e.memoizedProps=e.pendingProps,t===null?a5(e):cr=t}function qz(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Lz(n,t,t.pendingProps,t.type,void 0,fr);break;case 11:t=Lz(n,t,t.pendingProps,t.type.render,t.ref,fr);break;case 5:g9(t);default:RJ(n,t),t=cr=RQ(t,Hf),t=MJ(n,t,Hf)}e.memoizedProps=e.pendingProps,t===null?a5(e):cr=t}function Bb(e,t,n,s){wf=u1=null,g9(t),Zb=null,pk=0;var r=t.return;try{if(T1e(e,r,t,n,fr)){_o=1,eT(e,Cu(n,e.current)),cr=null;return}}catch(i){if(r!==null)throw cr=r,i;_o=1,eT(e,Cu(n,e.current)),cr=null;return}t.flags&32768?(xr||s===1?e=!0:hv||fr&536870912?e=!1:(Zm=e=!0,(s===2||s===9||s===3||s===6)&&(s=Qc.current,s!==null&&s.tag===13&&(s.flags|=16384))),oZ(t,e)):a5(t)}function a5(e){var t=e;do{if(t.flags&32768){oZ(t,Zm);return}e=t.return;var n=j1e(t.alternate,t,Hf);if(n!==null){cr=n;return}if(t=t.sibling,t!==null){cr=t;return}cr=t=e}while(t!==null);_o===0&&(_o=5)}function oZ(e,t){do{var n=N1e(e.alternate,e);if(n!==null){n.flags&=32767,cr=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){cr=e;return}cr=e=n}while(e!==null);_o=6,cr=null}function Hz(e,t,n,s,r,i,o,l,c){e.cancelPendingCommit=null;do l5();while(da!==0);if(qr&6)throw Error(yt(327));if(t!==null){if(t===e.current)throw Error(yt(177));if(i=t.lanes|t.childLanes,i|=n9,bge(e,n,i,o,l,c),e===xi&&(cr=xi=null,fr=0),Cy=t,bp=e,Af=n,g7=i,b7=r,JJ=s,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,q1e(H4,function(){return dZ(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,t.subtreeFlags&13878||s){s=hs.T,hs.T=null,r=Wr.p,Wr.p=2,o=qr,qr|=4;try{I1e(e,t,n)}finally{qr=o,Wr.p=r,hs.T=s}}da=1,aZ(),lZ(),cZ()}}function aZ(){if(da===1){da=0;var e=bp,t=Cy,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=hs.T,hs.T=null;var s=Wr.p;Wr.p=2;var r=qr;qr|=4;try{UJ(t,e);var i=k7,o=CQ(e.containerInfo),l=i.focusedElem,c=i.selectionRange;if(o!==l&&l&&l.ownerDocument&&SQ(l.ownerDocument.documentElement,l)){if(c!==null&&t9(l)){var u=c.start,d=c.end;if(d===void 0&&(d=u),"selectionStart"in l)l.selectionStart=u,l.selectionEnd=Math.min(d,l.value.length);else{var f=l.ownerDocument||document,m=f&&f.defaultView||window;if(m.getSelection){var p=m.getSelection(),g=l.textContent.length,b=Math.min(c.start,g),w=c.end===void 0?b:Math.min(c.end,g);!p.extend&&b>w&&(o=w,w=b,b=o);var y=dz(l,b),v=dz(l,w);if(y&&v&&(p.rangeCount!==1||p.anchorNode!==y.node||p.anchorOffset!==y.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var x=f.createRange();x.setStart(y.node,y.offset),p.removeAllRanges(),b>w?(p.addRange(x),p.extend(v.node,v.offset)):(x.setEnd(v.node,v.offset),p.addRange(x))}}}}for(f=[],p=l;p=p.parentNode;)p.nodeType===1&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<f.length;l++){var k=f[l];k.element.scrollLeft=k.left,k.element.scrollTop=k.top}}fT=!!x7,k7=x7=null}finally{qr=r,Wr.p=s,hs.T=n}}e.current=t,da=2}}function lZ(){if(da===2){da=0;var e=bp,t=Cy,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=hs.T,hs.T=null;var s=Wr.p;Wr.p=2;var r=qr;qr|=4;try{BJ(e,t.alternate,t)}finally{qr=r,Wr.p=s,hs.T=n}}da=3}}function cZ(){if(da===4||da===3){da=0,lge();var e=bp,t=Cy,n=Af,s=JJ;t.subtreeFlags&10256||t.flags&10256?da=5:(da=0,Cy=bp=null,uZ(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(gp=null),KR(n),t=t.stateNode,Wc&&typeof Wc.onCommitFiberRoot=="function")try{Wc.onCommitFiberRoot(m_,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=hs.T,r=Wr.p,Wr.p=2,hs.T=null;try{for(var i=e.onRecoverableError,o=0;o<s.length;o++){var l=s[o];i(l.value,{componentStack:l.stack})}}finally{hs.T=t,Wr.p=r}}Af&3&&l5(),Ah(e),r=e.pendingLanes,n&261930&&r&42?e===y7?Ox++:(Ox=0,y7=e):Ox=0,k_(0)}}function uZ(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,v_(t)))}function l5(){return aZ(),lZ(),cZ(),dZ()}function dZ(){if(da!==5)return!1;var e=bp,t=g7;g7=0;var n=KR(Af),s=hs.T,r=Wr.p;try{Wr.p=32>n?32:n,hs.T=null,n=b7,b7=null;var i=bp,o=Af;if(da=0,Cy=bp=null,Af=0,qr&6)throw Error(yt(331));var l=qr;if(qr|=4,YJ(i.current),VJ(i,i.current,o,n),qr=l,k_(0,!1),Wc&&typeof Wc.onPostCommitFiberRoot=="function")try{Wc.onPostCommitFiberRoot(m_,i)}catch{}return!0}finally{Wr.p=r,hs.T=s,uZ(e,t)}}function Uz(e,t,n){t=Cu(n,t),t=d7(e.stateNode,t,2),e=pp(e,t,2),e!==null&&(g_(e,2),Ah(e))}function ni(e,t,n){if(e.tag===3)Uz(e,e,n);else for(;t!==null;){if(t.tag===3){Uz(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(gp===null||!gp.has(s))){e=Cu(n,e),n=TJ(2),s=pp(t,n,2),s!==null&&(EJ(n,s,t,e),g_(s,2),Ah(s));break}}t=t.return}}function M8(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new D1e;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)||(j9=!0,r.add(n),e=B1e.bind(null,e,t,n),t.then(e,e))}function B1e(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,xi===e&&(fr&n)===n&&(_o===4||_o===3&&(fr&62914560)===fr&&300>Uc()-i5?!(qr&2)&&Ty(e,0):N9|=n,Sy===fr&&(Sy=0)),Ah(e)}function hZ(e,t){t===0&&(t=sQ()),e=c1(e,t),e!==null&&(g_(e,t),Ah(e))}function z1e(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),hZ(e,n)}function F1e(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(yt(314))}s!==null&&s.delete(t),hZ(e,n)}function q1e(e,t){return VR(e,t)}var oT=null,wb=null,v7=!1,aT=!1,R8=!1,tp=0;function Ah(e){e!==wb&&e.next===null&&(wb===null?oT=wb=e:wb=wb.next=e),aT=!0,v7||(v7=!0,U1e())}function k_(e,t){if(!R8&&aT){R8=!0;do for(var n=!1,s=oT;s!==null;){if(e!==0){var r=s.pendingLanes;if(r===0)var i=0;else{var o=s.suspendedLanes,l=s.pingedLanes;i=(1<<31-Vc(42|e)+1)-1,i&=r&~(o&~l),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,Wz(s,i))}else i=fr,i=K3(s,s===xi?i:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),!(i&3)||p_(s,i)||(n=!0,Wz(s,i));s=s.next}while(n);R8=!1}}function H1e(){fZ()}function fZ(){aT=v7=!1;var e=0;tp!==0&&ebe()&&(e=tp);for(var t=Uc(),n=null,s=oT;s!==null;){var r=s.next,i=mZ(s,t);i===0?(s.next=null,n===null?oT=r:n.next=r,r===null&&(wb=n)):(n=s,(e!==0||i&3)&&(aT=!0)),s=r}da!==0&&da!==5||k_(e),tp!==0&&(tp=0)}function mZ(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,r=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var o=31-Vc(i),l=1<<o,c=r[o];c===-1?(!(l&n)||l&s)&&(r[o]=gge(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}if(t=xi,n=fr,n=K3(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(ti===2||ti===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&a8(s),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||p_(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&a8(s),KR(n)){case 2:case 8:n=tQ;break;case 32:n=H4;break;case 268435456:n=nQ;break;default:n=H4}return s=pZ.bind(null,e),n=VR(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&a8(s),e.callbackPriority=2,e.callbackNode=null,2}function pZ(e,t){if(da!==0&&da!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(l5()&&e.callbackNode!==n)return null;var s=fr;return s=K3(e,e===xi?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(eZ(e,s,t),mZ(e,Uc()),e.callbackNode!=null&&e.callbackNode===n?pZ.bind(null,e):null)}function Wz(e,t){if(l5())return null;eZ(e,t,!0)}function U1e(){nbe(function(){qr&6?VR(eQ,H1e):fZ()})}function M9(){if(tp===0){var e=xy;e===0&&(e=ZS,ZS<<=1,!(ZS&261888)&&(ZS=256)),tp=e}return tp}function Vz(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:qC(""+e)}function Gz(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 W1e(e,t,n,s,r){if(t==="submit"&&n&&n.stateNode===r){var i=Vz((r[yc]||null).action),o=s.submitter;o&&(t=(t=o[yc]||null)?Vz(t.formAction):o.getAttribute("formAction"),t!==null&&(i=t,o=null));var l=new Y3("action","action",null,s,r);e.push({event:l,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(tp!==0){var c=o?Gz(r,o):new FormData(r);c7(n,{pending:!0,data:c,method:r.method,action:i},null,c)}}else typeof i=="function"&&(l.preventDefault(),c=o?Gz(r,o):new FormData(r),c7(n,{pending:!0,data:c,method:r.method,action:i},i,c))},currentTarget:r}]})}}for(var D8=0;D8<QN.length;D8++){var L8=QN[D8],V1e=L8.toLowerCase(),G1e=L8[0].toUpperCase()+L8.slice(1);_d(V1e,"on"+G1e)}_d(EQ,"onAnimationEnd");_d(AQ,"onAnimationIteration");_d(jQ,"onAnimationStart");_d("dblclick","onDoubleClick");_d("focusin","onFocus");_d("focusout","onBlur");_d(c1e,"onTransitionRun");_d(u1e,"onTransitionStart");_d(d1e,"onTransitionCancel");_d(NQ,"onTransitionEnd");vy("onMouseEnter",["mouseout","mouseover"]);vy("onMouseLeave",["mouseout","mouseover"]);vy("onPointerEnter",["pointerout","pointerover"]);vy("onPointerLeave",["pointerout","pointerover"]);o1("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));o1("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));o1("onBeforeInput",["compositionend","keypress","textInput","paste"]);o1("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));o1("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));o1("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var yk="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(" "),K1e=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(yk));function gZ(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 l=s[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&r.isPropagationStopped())break e;i=l,r.currentTarget=u;try{i(r)}catch(d){W4(d)}r.currentTarget=null,i=c}else for(o=0;o<s.length;o++){if(l=s[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&r.isPropagationStopped())break e;i=l,r.currentTarget=u;try{i(r)}catch(d){W4(d)}r.currentTarget=null,i=c}}}}function lr(e,t){var n=t[HN];n===void 0&&(n=t[HN]=new Set);var s=e+"__bubble";n.has(s)||(bZ(t,e,2,!1),n.add(s))}function P8(e,t,n){var s=0;t&&(s|=4),bZ(n,e,s,t)}var c2="_reactListening"+Math.random().toString(36).slice(2);function R9(e){if(!e[c2]){e[c2]=!0,lQ.forEach(function(n){n!=="selectionchange"&&(K1e.has(n)||P8(n,!1,e),P8(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[c2]||(t[c2]=!0,P8("selectionchange",!1,t))}}function bZ(e,t,n,s){switch(NZ(t)){case 2:var r=kbe;break;case 8:r=_be;break;default:r=O9}n=r.bind(null,t,n,e),r=void 0,!KN||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 O8(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 l=s.stateNode.containerInfo;if(l===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(;l!==null;){if(o=Nb(l),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){s=i=o;continue e}l=l.parentNode}}s=s.return}gQ(function(){var u=i,d=QR(n),f=[];e:{var m=IQ.get(e);if(m!==void 0){var p=Y3,g=e;switch(e){case"keypress":if(UC(n)===0)break e;case"keydown":case"keyup":p=Fge;break;case"focusin":g="focus",p=h8;break;case"focusout":g="blur",p=h8;break;case"beforeblur":case"afterblur":p=h8;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=tz;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=jge;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Uge;break;case EQ:case AQ:case jQ:p=Mge;break;case NQ:p=Vge;break;case"scroll":case"scrollend":p=Ege;break;case"wheel":p=Kge;break;case"copy":case"cut":case"paste":p=Dge;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=sz;break;case"toggle":case"beforetoggle":p=Xge}var b=(t&4)!==0,w=!b&&(e==="scroll"||e==="scrollend"),y=b?m!==null?m+"Capture":null:m;b=[];for(var v=u,x;v!==null;){var k=v;if(x=k.stateNode,k=k.tag,k!==5&&k!==26&&k!==27||x===null||y===null||(k=uk(v,y),k!=null&&b.push(vk(v,k,x))),w)break;v=v.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!==GN&&(g=n.relatedTarget||n.fromElement)&&(Nb(g)||g[lv]))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?Nb(g):null,g!==null&&(w=f_(g),b=g.tag,g!==w||b!==5&&b!==27&&b!==6)&&(g=null)):(p=null,g=u),p!==g)){if(b=tz,k="onMouseLeave",y="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(b=sz,k="onPointerLeave",y="onPointerEnter",v="pointer"),w=p==null?m:ix(p),x=g==null?m:ix(g),m=new b(k,v+"leave",p,n,d),m.target=w,m.relatedTarget=x,k=null,Nb(d)===u&&(b=new b(y,v+"enter",g,n,d),b.target=x,b.relatedTarget=w,k=b),w=k,p&&g)t:{for(b=Y1e,y=p,v=g,x=0,k=y;k;k=b(k))x++;k=0;for(var _=v;_;_=b(_))k++;for(;0<x-k;)y=b(y),x--;for(;0<k-x;)v=b(v),k--;for(;x--;){if(y===v||v!==null&&y===v.alternate){b=y;break t}y=b(y),v=b(v)}b=null}else b=null;p!==null&&Kz(f,m,p,b,!1),g!==null&&w!==null&&Kz(f,w,g,b,!0)}}e:{if(m=u?ix(u):window,p=m.nodeName&&m.nodeName.toLowerCase(),p==="select"||p==="input"&&m.type==="file")var T=az;else if(oz(m))if(kQ)T=o1e;else{T=r1e;var S=s1e}else p=m.nodeName,!p||p.toLowerCase()!=="input"||m.type!=="checkbox"&&m.type!=="radio"?u&&XR(u.elementType)&&(T=az):T=i1e;if(T&&(T=T(e,u))){xQ(f,T,n,d);break e}S&&S(e,m,u),e==="focusout"&&u&&m.type==="number"&&u.memoizedProps.value!=null&&VN(m,"number",m.value)}switch(S=u?ix(u):window,e){case"focusin":(oz(S)||S.contentEditable==="true")&&(Rb=S,YN=u,Ax=null);break;case"focusout":Ax=YN=Rb=null;break;case"mousedown":XN=!0;break;case"contextmenu":case"mouseup":case"dragend":XN=!1,hz(f,n,d);break;case"selectionchange":if(l1e)break;case"keydown":case"keyup":hz(f,n,d)}var C;if(e9)e:{switch(e){case"compositionstart":var N="onCompositionStart";break e;case"compositionend":N="onCompositionEnd";break e;case"compositionupdate":N="onCompositionUpdate";break e}N=void 0}else Mb?vQ(e,n)&&(N="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(yQ&&n.locale!=="ko"&&(Mb||N!=="onCompositionStart"?N==="onCompositionEnd"&&Mb&&(C=bQ()):(Jm=d,JR="value"in Jm?Jm.value:Jm.textContent,Mb=!0)),S=lT(u,N),0<S.length&&(N=new nz(N,e,null,n,d),f.push({event:N,listeners:S}),C?N.data=C:(C=wQ(n),C!==null&&(N.data=C)))),(C=Jge?Zge(e,n):e1e(e,n))&&(N=lT(u,"onBeforeInput"),0<N.length&&(S=new nz("onBeforeInput","beforeinput",null,n,d),f.push({event:S,listeners:N}),S.data=C)),W1e(f,e,u,n,d)}gZ(f,t)})}function vk(e,t,n){return{instance:e,listener:t,currentTarget:n}}function lT(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=uk(e,n),r!=null&&s.unshift(vk(e,r,i)),r=uk(e,t),r!=null&&s.push(vk(e,r,i))),e.tag===3)return s;e=e.return}return[]}function Y1e(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Kz(e,t,n,s,r){for(var i=t._reactName,o=[];n!==null&&n!==s;){var l=n,c=l.alternate,u=l.stateNode;if(l=l.tag,c!==null&&c===s)break;l!==5&&l!==26&&l!==27||u===null||(c=u,r?(u=uk(n,i),u!=null&&o.unshift(vk(n,u,c))):r||(u=uk(n,i),u!=null&&o.push(vk(n,u,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var X1e=/\r\n?/g,Q1e=/\u0000|\uFFFD/g;function Yz(e){return(typeof e=="string"?e:""+e).replace(X1e,`
`).replace(Q1e,"")}function yZ(e,t){return t=Yz(t),Yz(e)===t}function oi(e,t,n,s,r,i){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||wy(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&wy(e,""+s);break;case"className":n2(e,"class",s);break;case"tabIndex":n2(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":n2(e,n,s);break;case"style":pQ(e,s,i);break;case"data":if(t!=="object"){n2(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=qC(""+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"&&oi(e,t,"name",r.name,r,null),oi(e,t,"formEncType",r.formEncType,r,null),oi(e,t,"formMethod",r.formMethod,r,null),oi(e,t,"formTarget",r.formTarget,r,null)):(oi(e,t,"encType",r.encType,r,null),oi(e,t,"method",r.method,r,null),oi(e,t,"target",r.target,r,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=qC(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=vf);break;case"onScroll":s!=null&&lr("scroll",e);break;case"onScrollEnd":s!=null&&lr("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(yt(61));if(n=s.__html,n!=null){if(r.children!=null)throw Error(yt(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=qC(""+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":lr("beforetoggle",e),lr("toggle",e),FC(e,"popover",s);break;case"xlinkActuate":Qh(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Qh(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Qh(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Qh(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Qh(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Qh(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Qh(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Qh(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Qh(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":FC(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=Cge.get(n)||n,FC(e,n,s))}}function w7(e,t,n,s,r,i){switch(n){case"style":pQ(e,s,i);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(yt(61));if(n=s.__html,n!=null){if(r.children!=null)throw Error(yt(60));e.innerHTML=n}}break;case"children":typeof s=="string"?wy(e,s):(typeof s=="number"||typeof s=="bigint")&&wy(e,""+s);break;case"onScroll":s!=null&&lr("scroll",e);break;case"onScrollEnd":s!=null&&lr("scrollend",e);break;case"onClick":s!=null&&(e.onclick=vf);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!cQ.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[yc]||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,""):FC(e,n,s)}}}function ol(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":lr("error",e),lr("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(yt(137,t));default:oi(e,t,i,o,n,null)}}r&&oi(e,t,"srcSet",n.srcSet,n,null),s&&oi(e,t,"src",n.src,n,null);return;case"input":lr("invalid",e);var l=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":l=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(yt(137,t));break;default:oi(e,t,s,d,n,null)}}hQ(e,i,l,c,u,o,r,!1);return;case"select":lr("invalid",e),s=o=i=null;for(r in n)if(n.hasOwnProperty(r)&&(l=n[r],l!=null))switch(r){case"value":i=l;break;case"defaultValue":o=l;break;case"multiple":s=l;default:oi(e,t,r,l,n,null)}t=i,n=o,e.multiple=!!s,t!=null?Xb(e,!!s,t,!1):n!=null&&Xb(e,!!s,n,!0);return;case"textarea":lr("invalid",e),i=r=s=null;for(o in n)if(n.hasOwnProperty(o)&&(l=n[o],l!=null))switch(o){case"value":s=l;break;case"defaultValue":r=l;break;case"children":i=l;break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(yt(91));break;default:oi(e,t,o,l,n,null)}mQ(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:oi(e,t,c,s,n,null)}return;case"dialog":lr("beforetoggle",e),lr("toggle",e),lr("cancel",e),lr("close",e);break;case"iframe":case"object":lr("load",e);break;case"video":case"audio":for(s=0;s<yk.length;s++)lr(yk[s],e);break;case"image":lr("error",e),lr("load",e);break;case"details":lr("toggle",e);break;case"embed":case"source":case"link":lr("error",e),lr("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(yt(137,t));default:oi(e,t,u,s,n,null)}return;default:if(XR(t)){for(d in n)n.hasOwnProperty(d)&&(s=n[d],s!==void 0&&w7(e,t,d,s,n,void 0));return}}for(l in n)n.hasOwnProperty(l)&&(s=n[l],s!=null&&oi(e,t,l,s,n,null))}function J1e(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,l=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)||oi(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":l=p;break;case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(yt(137,t));break;default:p!==f&&oi(e,t,m,p,s,f)}}WN(e,o,l,c,u,d,i,r);return;case"select":p=o=l=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)||oi(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":l=i;break;case"multiple":o=i;default:i!==c&&oi(e,t,r,i,s,c)}t=l,n=o,s=p,m!=null?Xb(e,!!n,m,!1):!!s!=!!n&&(t!=null?Xb(e,!!n,t,!0):Xb(e,!!n,n?[]:"",!1));return;case"textarea":p=m=null;for(l in n)if(r=n[l],n.hasOwnProperty(l)&&r!=null&&!s.hasOwnProperty(l))switch(l){case"value":break;case"children":break;default:oi(e,t,l,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(yt(91));break;default:r!==i&&oi(e,t,o,r,s,i)}fQ(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:oi(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:oi(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)&&oi(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(yt(137,t));break;default:oi(e,t,u,m,s,p)}return;default:if(XR(t)){for(var w in n)m=n[w],n.hasOwnProperty(w)&&m!==void 0&&!s.hasOwnProperty(w)&&w7(e,t,w,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||w7(e,t,d,m,s,p);return}}for(var y in n)m=n[y],n.hasOwnProperty(y)&&m!=null&&!s.hasOwnProperty(y)&&oi(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||oi(e,t,f,m,s,p)}function Xz(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Z1e(){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,l=r.duration;if(i&&l&&Xz(o)){for(o=0,l=r.responseEnd,s+=1;s<n.length;s++){var c=n[s],u=c.startTime;if(u>l)break;var d=c.transferSize,f=c.initiatorType;d&&Xz(f)&&(c=c.responseEnd,o+=d*(c<l?1:(l-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 x7=null,k7=null;function cT(e){return e.nodeType===9?e:e.ownerDocument}function Qz(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 vZ(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 _7(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 $8=null;function ebe(){var e=window.event;return e&&e.type==="popstate"?e===$8?!1:($8=e,!0):($8=null,!1)}var wZ=typeof setTimeout=="function"?setTimeout:void 0,tbe=typeof clearTimeout=="function"?clearTimeout:void 0,Jz=typeof Promise=="function"?Promise:void 0,nbe=typeof queueMicrotask=="function"?queueMicrotask:typeof Jz<"u"?function(e){return Jz.resolve(null).then(e).catch(sbe)}:wZ;function sbe(e){setTimeout(function(){throw e})}function o0(e){return e==="head"}function Zz(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),Ay(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")$x(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,$x(n);for(var i=n.firstChild;i;){var o=i.nextSibling,l=i.nodeName;i[b_]||l==="SCRIPT"||l==="STYLE"||l==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}else n==="body"&&$x(e.ownerDocument.body);n=r}while(n);Ay(t)}function eF(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 S7(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":S7(n),YR(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function rbe(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[b_])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=Ou(e.nextSibling),e===null)break}return null}function ibe(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Ou(e.nextSibling),e===null))return null;return e}function xZ(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Ou(e.nextSibling),e===null))return null;return e}function C7(e){return e.data==="$?"||e.data==="$~"}function T7(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function obe(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 Ou(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 E7=null;function tF(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Ou(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function nF(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 kZ(e,t,n){switch(t=cT(n),e){case"html":if(e=t.documentElement,!e)throw Error(yt(452));return e;case"head":if(e=t.head,!e)throw Error(yt(453));return e;case"body":if(e=t.body,!e)throw Error(yt(454));return e;default:throw Error(yt(451))}}function $x(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);YR(e)}var zu=new Map,sF=new Set;function uT(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var sm=Wr.d;Wr.d={f:abe,r:lbe,D:cbe,C:ube,L:dbe,m:hbe,X:mbe,S:fbe,M:pbe};function abe(){var e=sm.f(),t=o5();return e||t}function lbe(e){var t=cv(e);t!==null&&t.tag===5&&t.type==="form"?pJ(t):sm.r(e)}var fv=typeof document>"u"?null:document;function _Z(e,t,n){var s=fv;if(s&&typeof t=="string"&&t){var r=Su(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n=="string"&&(r+='[crossorigin="'+n+'"]'),sF.has(r)||(sF.add(r),e={rel:e,crossOrigin:n,href:t},s.querySelector(r)===null&&(t=s.createElement("link"),ol(t,"link",e),Da(t),s.head.appendChild(t)))}}function cbe(e){sm.D(e),_Z("dns-prefetch",e,null)}function ube(e,t){sm.C(e,t),_Z("preconnect",e,t)}function dbe(e,t,n){sm.L(e,t,n);var s=fv;if(s&&e&&t){var r='link[rel="preload"][as="'+Su(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+Su(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+Su(n.imageSizes)+'"]')):r+='[href="'+Su(e)+'"]';var i=r;switch(t){case"style":i=Ey(e);break;case"script":i=mv(e)}zu.has(i)||(e=Oi({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),zu.set(i,e),s.querySelector(r)!==null||t==="style"&&s.querySelector(__(i))||t==="script"&&s.querySelector(S_(i))||(t=s.createElement("link"),ol(t,"link",e),Da(t),s.head.appendChild(t)))}}function hbe(e,t){sm.m(e,t);var n=fv;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+Su(s)+'"][href="'+Su(e)+'"]',i=r;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=mv(e)}if(!zu.has(i)&&(e=Oi({rel:"modulepreload",href:e},t),zu.set(i,e),n.querySelector(r)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(S_(i)))return}s=n.createElement("link"),ol(s,"link",e),Da(s),n.head.appendChild(s)}}}function fbe(e,t,n){sm.S(e,t,n);var s=fv;if(s&&e){var r=Yb(s).hoistableStyles,i=Ey(e);t=t||"default";var o=r.get(i);if(!o){var l={loading:0,preload:null};if(o=s.querySelector(__(i)))l.loading=5;else{e=Oi({rel:"stylesheet",href:e,"data-precedence":t},n),(n=zu.get(i))&&D9(e,n);var c=o=s.createElement("link");Da(c),ol(c,"link",e),c._p=new Promise(function(u,d){c.onload=u,c.onerror=d}),c.addEventListener("load",function(){l.loading|=1}),c.addEventListener("error",function(){l.loading|=2}),l.loading|=4,JC(o,t,s)}o={type:"stylesheet",instance:o,count:1,state:l},r.set(i,o)}}}function mbe(e,t){sm.X(e,t);var n=fv;if(n&&e){var s=Yb(n).hoistableScripts,r=mv(e),i=s.get(r);i||(i=n.querySelector(S_(r)),i||(e=Oi({src:e,async:!0},t),(t=zu.get(r))&&L9(e,t),i=n.createElement("script"),Da(i),ol(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},s.set(r,i))}}function pbe(e,t){sm.M(e,t);var n=fv;if(n&&e){var s=Yb(n).hoistableScripts,r=mv(e),i=s.get(r);i||(i=n.querySelector(S_(r)),i||(e=Oi({src:e,async:!0,type:"module"},t),(t=zu.get(r))&&L9(e,t),i=n.createElement("script"),Da(i),ol(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},s.set(r,i))}}function rF(e,t,n,s){var r=(r=hp.current)?uT(r):null;if(!r)throw Error(yt(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Ey(n.href),n=Yb(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=Ey(n.href);var i=Yb(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(__(e)))&&!i._p&&(o.instance=i,o.state.loading=5),zu.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},zu.set(e,n),i||gbe(r,e,n,o.state))),t&&s===null)throw Error(yt(528,""));return o}if(t&&s!==null)throw Error(yt(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=mv(n),n=Yb(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(yt(444,e))}}function Ey(e){return'href="'+Su(e)+'"'}function __(e){return'link[rel="stylesheet"]['+e+"]"}function SZ(e){return Oi({},e,{"data-precedence":e.precedence,precedence:null})}function gbe(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}),ol(t,"link",n),Da(t),e.head.appendChild(t))}function mv(e){return'[src="'+Su(e)+'"]'}function S_(e){return"script[async]"+e}function iF(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Su(n.href)+'"]');if(s)return t.instance=s,Da(s),s;var r=Oi({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Da(s),ol(s,"style",r),JC(s,n.precedence,e),t.instance=s;case"stylesheet":r=Ey(n.href);var i=e.querySelector(__(r));if(i)return t.state.loading|=4,t.instance=i,Da(i),i;s=SZ(n),(r=zu.get(r))&&D9(s,r),i=(e.ownerDocument||e).createElement("link"),Da(i);var o=i;return o._p=new Promise(function(l,c){o.onload=l,o.onerror=c}),ol(i,"link",s),t.state.loading|=4,JC(i,n.precedence,e),t.instance=i;case"script":return i=mv(n.src),(r=e.querySelector(S_(i)))?(t.instance=r,Da(r),r):(s=n,(r=zu.get(i))&&(s=Oi({},n),L9(s,r)),e=e.ownerDocument||e,r=e.createElement("script"),Da(r),ol(r,"link",s),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(yt(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(s=t.instance,t.state.loading|=4,JC(s,n.precedence,e));return t.instance}function JC(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 l=s[o];if(l.dataset.precedence===t)i=l;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 D9(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function L9(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var ZC=null;function oF(e,t,n){if(ZC===null){var s=new Map,r=ZC=new Map;r.set(n,s)}else r=ZC,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[b_]||i[nl]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var o=i.getAttribute(t)||"";o=e+o;var l=s.get(o);l?l.push(i):s.set(o,[i])}}return s}function aF(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function bbe(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 CZ(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function ybe(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=Ey(s.href),i=t.querySelector(__(r));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=dT.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,Da(i);return}i=t.ownerDocument||t,s=SZ(s),(r=zu.get(r))&&D9(s,r),i=i.createElement("link"),Da(i);var o=i;o._p=new Promise(function(l,c){o.onload=l,o.onerror=c}),ol(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=dT.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var B8=0;function vbe(e,t){return e.stylesheets&&e.count===0&&e4(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&e4(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&B8===0&&(B8=62500*Z1e());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&e4(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 dT(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)e4(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var hT=null;function e4(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,hT=new Map,t.forEach(wbe,e),hT=null,dT.call(e))}function wbe(e,t){if(!(t.state.loading&4)){var n=hT.get(e);if(n)var s=n.get(null);else{n=new Map,hT.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=dT.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 wk={$$typeof:yf,Provider:null,Consumer:null,_currentValue:Ag,_currentValue2:Ag,_threadCount:0};function xbe(e,t,n,s,r,i,o,l,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=l8(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=l8(0),this.hiddenUpdates=l8(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 TZ(e,t,n,s,r,i,o,l,c,u,d,f){return e=new xbe(e,t,n,o,c,u,d,f,l),t=1,i===!0&&(t|=24),i=zc(3,null,null,t),e.current=i,i.stateNode=e,t=a9(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:s,isDehydrated:n,cache:t},u9(i),e}function EZ(e){return e?(e=Pb,e):Pb}function AZ(e,t,n,s,r,i){r=EZ(r),s.context===null?s.context=r:s.pendingContext=r,s=mp(t),s.payload={element:n},i=i===void 0?null:i,i!==null&&(s.callback=i),n=pp(e,s,t),n!==null&&(pc(n,e,t),Nx(n,e,t))}function lF(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function P9(e,t){lF(e,t),(e=e.alternate)&&lF(e,t)}function jZ(e){if(e.tag===13||e.tag===31){var t=c1(e,67108864);t!==null&&pc(t,e,67108864),P9(e,67108864)}}function cF(e){if(e.tag===13||e.tag===31){var t=Gc();t=GR(t);var n=c1(e,t);n!==null&&pc(n,e,t),P9(e,t)}}var fT=!0;function kbe(e,t,n,s){var r=hs.T;hs.T=null;var i=Wr.p;try{Wr.p=2,O9(e,t,n,s)}finally{Wr.p=i,hs.T=r}}function _be(e,t,n,s){var r=hs.T;hs.T=null;var i=Wr.p;try{Wr.p=8,O9(e,t,n,s)}finally{Wr.p=i,hs.T=r}}function O9(e,t,n,s){if(fT){var r=A7(s);if(r===null)O8(e,t,s,mT,n),uF(e,s);else if(Cbe(r,e,t,n,s))s.stopPropagation();else if(uF(e,s),t&4&&-1<Sbe.indexOf(e)){for(;r!==null;){var i=cv(r);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var o=rg(i.pendingLanes);if(o!==0){var l=i;for(l.pendingLanes|=2,l.entangledLanes|=2;o;){var c=1<<31-Vc(o);l.entanglements[1]|=c,o&=~c}Ah(i),!(qr&6)&&(sT=Uc()+500,k_(0))}}break;case 31:case 13:l=c1(i,2),l!==null&&pc(l,i,2),o5(),P9(i,2)}if(i=A7(s),i===null&&O8(e,t,s,mT,n),i===r)break;r=i}r!==null&&s.stopPropagation()}else O8(e,t,s,null,n)}}function A7(e){return e=QR(e),$9(e)}var mT=null;function $9(e){if(mT=null,e=Nb(e),e!==null){var t=f_(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=YX(t),e!==null)return e;e=null}else if(n===31){if(e=XX(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 mT=e,null}function NZ(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(cge()){case eQ:return 2;case tQ:return 8;case H4:case uge:return 32;case nQ:return 268435456;default:return 32}default:return 32}}var j7=!1,yp=null,vp=null,wp=null,xk=new Map,kk=new Map,Km=[],Sbe="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 uF(e,t){switch(e){case"focusin":case"focusout":yp=null;break;case"dragenter":case"dragleave":vp=null;break;case"mouseover":case"mouseout":wp=null;break;case"pointerover":case"pointerout":xk.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":kk.delete(t.pointerId)}}function jw(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=cv(t),t!==null&&jZ(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function Cbe(e,t,n,s,r){switch(t){case"focusin":return yp=jw(yp,e,t,n,s,r),!0;case"dragenter":return vp=jw(vp,e,t,n,s,r),!0;case"mouseover":return wp=jw(wp,e,t,n,s,r),!0;case"pointerover":var i=r.pointerId;return xk.set(i,jw(xk.get(i)||null,e,t,n,s,r)),!0;case"gotpointercapture":return i=r.pointerId,kk.set(i,jw(kk.get(i)||null,e,t,n,s,r)),!0}return!1}function IZ(e){var t=Nb(e.target);if(t!==null){var n=f_(t);if(n!==null){if(t=n.tag,t===13){if(t=YX(n),t!==null){e.blockedOn=t,KB(e.priority,function(){cF(n)});return}}else if(t===31){if(t=XX(n),t!==null){e.blockedOn=t,KB(e.priority,function(){cF(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 t4(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=A7(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);GN=s,n.target.dispatchEvent(s),GN=null}else return t=cv(n),t!==null&&jZ(t),e.blockedOn=n,!1;t.shift()}return!0}function dF(e,t,n){t4(e)&&n.delete(t)}function Tbe(){j7=!1,yp!==null&&t4(yp)&&(yp=null),vp!==null&&t4(vp)&&(vp=null),wp!==null&&t4(wp)&&(wp=null),xk.forEach(dF),kk.forEach(dF)}function u2(e,t){e.blockedOn===t&&(e.blockedOn=null,j7||(j7=!0,fa.unstable_scheduleCallback(fa.unstable_NormalPriority,Tbe)))}var d2=null;function hF(e){d2!==e&&(d2=e,fa.unstable_scheduleCallback(fa.unstable_NormalPriority,function(){d2===e&&(d2=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($9(s||n)===null)continue;break}var i=cv(n);i!==null&&(e.splice(t,3),t-=3,c7(i,{pending:!0,data:r,method:n.method,action:s},s,r))}}))}function Ay(e){function t(c){return u2(c,e)}yp!==null&&u2(yp,e),vp!==null&&u2(vp,e),wp!==null&&u2(wp,e),xk.forEach(t),kk.forEach(t);for(var n=0;n<Km.length;n++){var s=Km[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Km.length&&(n=Km[0],n.blockedOn===null);)IZ(n),n.blockedOn===null&&Km.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[yc]||null;if(typeof i=="function")o||hF(n);else if(o){var l=null;if(i&&i.hasAttribute("formAction")){if(r=i,o=i[yc]||null)l=o.formAction;else if($9(r)!==null)continue}else l=o.action;typeof l=="function"?n[s+1]=l:(n.splice(s,3),s-=3),hF(n)}}}function MZ(){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 B9(e){this._internalRoot=e}c5.prototype.render=B9.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(yt(409));var n=t.current,s=Gc();AZ(n,s,e,t,null,null)};c5.prototype.unmount=B9.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;AZ(e.current,2,null,e,null,null),o5(),t[lv]=null}};function c5(e){this._internalRoot=e}c5.prototype.unstable_scheduleHydration=function(e){if(e){var t=aQ();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Km.length&&t!==0&&t<Km[n].priority;n++);Km.splice(n,0,e),n===0&&IZ(e)}};var fF=GX.version;if(fF!=="19.2.4")throw Error(yt(527,fF,"19.2.4"));Wr.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(yt(188)):(e=Object.keys(e).join(","),Error(yt(268,e)));return e=nge(t),e=e!==null?QX(e):null,e=e===null?null:e.stateNode,e};var Ebe={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:hs,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var h2=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!h2.isDisabled&&h2.supportsFiber)try{m_=h2.inject(Ebe),Wc=h2}catch{}}V3.createRoot=function(e,t){if(!KX(e))throw Error(yt(299));var n=!1,s="",r=_J,i=SJ,o=CJ;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=TZ(e,1,!1,null,null,n,s,null,r,i,o,MZ),e[lv]=t.current,R9(e),new B9(t)};V3.hydrateRoot=function(e,t,n){if(!KX(e))throw Error(yt(299));var s=!1,r="",i=_J,o=SJ,l=CJ,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&&(l=n.onRecoverableError),n.formState!==void 0&&(c=n.formState)),t=TZ(e,1,!0,t,n??null,s,r,c,i,o,l,MZ),t.context=EZ(null),n=t.current,s=Gc(),s=GR(s),r=mp(s),r.callback=null,pp(n,r,s),n=s,t.current.lanes=n,g_(t,n),Ah(t),e[lv]=t.current,R9(e),new c5(t)};V3.version="19.2.4";function RZ(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(RZ)}catch(e){console.error(e)}}RZ(),FX.exports=V3;var N7=FX.exports;const Abe=h_(N7);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const jbe="agent";function Nbe(e){return e===jbe}var Ibe=3e4,Mbe=new Set(["authorized","expired","error","cancelled"]),Rbe=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 Dbe(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 Dbe(e,t,n,s){return await Lbe(e,t,n,s)}async function mF(e,t,n,s){try{return await e.getDeviceFlow(t.deviceFlowId,{clientId:n,signal:s})}catch(r){if(r instanceof Jc&&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 pF(e,t={}){if(e!==void 0&&Number.isFinite(e)&&!(t.allowZero?e<0:e<=0))return e}async function Lbe(e,t,n,s){var d;let r=s.signal,i=pF(s.timeoutMs,{allowZero:!0}),o=pF(s.pollOverrideMs),l=i!==void 0?Date.now()+i:t.expiresAt+Ibe,c=Math.max(1e3,o??t.intervalMs??5e3),u=c;for(;;){if(r!=null&&r.aborted)throw I7(r);if(Date.now()>=l)return await mF(e,t,n,r);let f=await mF(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)),Mbe.has(f.status))return f;await Pbe(c,r)}}async function Pbe(e,t){if(t!=null&&t.aborted)throw I7(t);await new Promise((n,s)=>{let r=setTimeout(()=>{o(),n()},e),i=()=>{o(),s(I7(t))};function o(){clearTimeout(r),t==null||t.removeEventListener("abort",i)}t&&t.addEventListener("abort",i,{once:!0})})}function I7(e){let t=e==null?void 0:e.reason;return t instanceof Error?t:typeof t=="string"?new Error(t):new Error("aborted")}var Jc=class extends Error{constructor(n,s,r){super(r);He(this,"status");He(this,"body");this.name="DaemonHttpError",this.status=n,this.body=s}},gF=class extends Error{constructor(e){super(e??"Transport connection closed"),this.name="DaemonTransportClosedError"}},Obe=class extends Error{constructor(e){super(e),this.name="SseFramingError"}},bF=16*1024*1024;async function*DZ(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,l;try{({value:o,done:l}=await n.read())}catch(u){if(t!=null&&t.aborted)return;throw u}if(l){if(r+=s.decode(),r.length>0){let u=yF(r);for(let d of u.frames){let f=z8(d);f&&(yield f)}if(u.tail.length>0){let d=z8(u.tail);d&&(yield d)}}return}if(r+=s.decode(o,{stream:!0}),r.length>bF)throw new Obe(`parseSseStream: unread buffer exceeded ${bF} UTF-16 code units without a frame separator — upstream likely not SSE`);let c=yF(r);if(c.frames.length>0)for(let u of c.frames){let d=z8(u);d&&(yield d)}r=c.tail}}finally{t&&i&&t.removeEventListener("abort",i);try{await n.cancel()}catch{}}}function yF(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 z8(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 $be=class{constructor(e,t,n){He(this,"baseUrl");He(this,"token");He(this,"_fetch");He(this,"activeSseRequests",new Set);He(this,"_disposed",!1);He(this,"type","rest");He(this,"supportsReplay",!0);He(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 gF;return this._fetch(e,t)}async*subscribeEvents(e,t={}){var s,r;if(this._disposed)throw new gF;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?Bbe([t.signal,n.signal]):n.signal,l=`${this.baseUrl}/session/${encodeURIComponent(e)}/events`;t.maxQueued!==void 0&&(l+=`?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(l,{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 Jc(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 Jc(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*DZ(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 Bbe(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 zbe=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.`);He(this,"capability");this.name="DaemonCapabilityMissingError",this.capability=t}},Fbe=["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"],pv=["plan","default","auto-edit","auto","yolo"],f2="/workspace/memory/remember",m2="/workspace/memory/forget",p2="/workspace/memory/dream";function vF(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=l=>l===void 0||typeof l=="number"&&Number.isSafeInteger(l)&&l>=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 pT=20,qbe=3e4,Hbe=65e3,Ube=9e4,LZ=35e3,wF=2147483647,Wbe=5,xb=33e4,Vbe="X-Qwen-Client-Id",Ke=encodeURIComponent;function PZ(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 xF(e){let t=e.trim();if(!t)throw new Error("rule must be a non-empty string");return t}function OZ(e){if(e===void 0)return Wbe;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 Gbe(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}function Kbe(){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 kF=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 $Z(e){return typeof e=="object"&&e!==null&&e._daemonTurnError===!0}var M7=class{constructor(e){He(this,"baseUrl");He(this,"token");He(this,"_fetch");He(this,"fetchTimeoutMs");He(this,"promptLimit");He(this,"promptCounts",Object.create(null));He(this,"transport");He(this,"_authFlow");var n;this.baseUrl=Gbe(e.baseUrl),this.token=e.token??Kbe(),this._fetch=e.fetch??((n=e.transport)==null?void 0:n.restFetch)??globalThis.fetch.bind(globalThis);let t=e.fetchTimeoutMs??qbe;this.fetchTimeoutMs=Number.isFinite(t)&&t>0?t:0,this.promptLimit=OZ(e.maxPendingPromptsPerSession),this.transport=e.transport??new $be(this.baseUrl,this.token,this._fetch)}get auth(){return this._authFlow||(this._authFlow=new Rbe(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 kF(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,l=setTimeout(()=>{o.abort(new DOMException("timeout","TimeoutError"))},i);typeof l=="object"&&l&&"unref"in l&&l.unref();let c=t.signal??void 0,u=c?F8([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(l)}}headers(e={},t){let n={...e};return this.token&&(n.Authorization=`Bearer ${this.token}`),t&&(n[Vbe]=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 kF(typeof i.sessionId=="string"?i.sessionId:n,typeof i.limit=="number"?i.limit:0,typeof i.pendingCount=="number"?i.pendingCount:0)}return new Jc(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=${Ke(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(),l=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:l,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 l=await this.failOnError(r,n);if(((o=l.body)==null?void 0:o.code)===s.okNotFoundCode)return;throw l}throw await this.failOnError(r,n)},s.timeoutMs)}workspaceById(e){return new _F(this,Ke(e))}workspaceByCwd(e){return new _F(this,Ke(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)??LZ,mode:"rest"})}async requireCapability(e){if(!(await this.capabilities()).features.includes(e))throw new zbe(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=${Ke(e)}`+(t!=null?`&oldPath=${Ke(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=${Ke(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/${Ke(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/${Ke(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/${Ke(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/${Ke(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/${Ke(e)}/interactions/${Ke(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/${Ke(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/${Ke(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/${Ke(e)}/update`,"POST /workspace/extensions/:name/update",{method:"POST",body:{},clientId:t,mode:"rest"})}async uninstallExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${Ke(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/${Ke(e)}/update`,"POST /extensions/:extensionId/update",{method:"POST",body:{},clientId:t,mode:"rest"})}async uninstallUserExtension(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/extensions/${Ke(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/${Ke(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/${Ke(e)}`,"GET /extensions/operations/:operationId",t?{signal:t,mode:"rest"}:{mode:"rest"})}async waitForExtensionOperation(e,t={}){var l;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(;;){(l=t.signal)==null||l.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?F8([t.signal,f.signal]):f.signal,p,g=new Promise((b,w)=>{let y=()=>{let x=o();w(x),f.abort(x)},v=()=>{let x=i-Date.now();if(x<=0){y();return}p=setTimeout(()=>{Date.now()>=i?y():v()},Math.min(x,wF))};v()});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,w;let p=setTimeout(()=>{var y;(y=t.signal)==null||y.removeEventListener("abort",g),f()},Math.min(n,d,wF)),g=()=>{var y,v;clearTimeout(p),(y=t.signal)==null||y.removeEventListener("abort",g),m(((v=t.signal)==null?void 0:v.reason)??new DOMException("Aborted","AbortError"))};(b=t.signal)==null||b.addEventListener("abort",g,{once:!0}),(w=t.signal)!=null&&w.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)),t.cursor!==void 0&&s.searchParams.set("cursor",t.cursor),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(f2,`POST ${f2}`,{method:"POST",body:{content:e,contextMode:t.contextMode??"workspace"},clientId:t.clientId})}async getWorkspaceMemoryRememberTask(e,t){return await this.jsonRequest(`${f2}/${Ke(e)}`,`GET ${f2}/:taskId`,{clientId:t==null?void 0:t.clientId})}async forgetWorkspaceMemory(e,t={}){return await this.jsonRequest(m2,`POST ${m2}`,{method:"POST",body:{query:e},clientId:t.clientId})}async getWorkspaceMemoryForgetTask(e,t){return await this.jsonRequest(`${m2}/${Ke(e)}`,`GET ${m2}/:taskId`,{clientId:t==null?void 0:t.clientId})}async dreamWorkspaceMemory(e={}){return await this.jsonRequest(p2,`POST ${p2}`,{method:"POST",body:{},clientId:e.clientId})}async getWorkspaceMemoryDreamTask(e,t){return await this.jsonRequest(`${p2}/${Ke(e)}`,`GET ${p2}/: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()},xb)}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 l=!1;for await(let u of DZ(o.body,s==null?void 0:s.signal)){let d=r(u);if(d&&(l=d.type==="done"||d.type==="error",yield d,i&&l))return}if(i&&!((c=s==null?void 0:s.signal)!=null&&c.aborted)&&!l)throw new Error("Stream ended without terminal event")}async*generateWorkspaceContent(e,t){yield*this.generateContentEvents("/workspace/generate","POST /workspace/generate",{prompt:e},t,vF,!0)}async getWorkspaceAgent(e,t={}){let n=t.scope?`${this.baseUrl}/workspace/agents/${Ke(e)}?scope=${Ke(t.scope)}`:`${this.baseUrl}/workspace/agents/${Ke(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/${Ke(e)}?scope=${Ke(n.scope)}`:`${this.baseUrl}/workspace/agents/${Ke(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/${Ke(e)}?scope=${Ke(t.scope)}`:`${this.baseUrl}/workspace/agents/${Ke(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"),l=o.body;if(l&&l.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)??pT,s=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(n)?n:pT))),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/${Ke(e)}/sessions?${r.toString()}`,"GET /workspace/sessions")}async listSessionGroups(e){return await this.jsonRequest(`/workspace/${Ke(e)}/session-groups`,"GET /workspace/session-groups")}async createSessionGroup(e,t){return(await this.jsonRequest(`/workspace/${Ke(e)}/session-groups`,"POST /workspace/session-groups",{method:"POST",body:t})).group}async updateSessionGroup(e,t,n){return(await this.jsonRequest(`/workspace/${Ke(e)}/session-groups/${Ke(t)}`,"PATCH /workspace/session-groups/:groupId",{method:"PATCH",body:n})).group}async deleteSessionGroup(e,t){return await this.jsonRequest(`/workspace/${Ke(e)}/session-groups/${Ke(t)}`,"DELETE /workspace/session-groups/:groupId",{method:"DELETE"})}async updateSessionOrganization(e,t,n){return await this.jsonRequest(`/session/${Ke(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/${Ke(e)}/export`,"GET /session/:id/export",t)}async getSessionTranscriptPage(e,t={}){return await this.jsonRequest(`/session/${Ke(e)}/transcript${PZ(t)}`,"GET /session/:id/transcript",{clientId:t.clientId,mode:"rest"})}async resolveSubagentSession(e,t,n){return await this.jsonRequest(`/session/${Ke(e)}/subagents/${Ke(t)}`,"GET /session/:id/subagents/:toolCallId",{clientId:n,mode:"rest"})}async cancelSubagentSession(e,t,n){return await this.jsonRequest(`/session/${Ke(e)}/subagents/${Ke(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/${Ke(e)}/branch`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({...t.name!==void 0?{name:t.name}:{}})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/branch");return await s.json()})}async createSideTaskSession(e,t={},n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Ke(e)}/side-task`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({...t.name!==void 0?{name:t.name}:{}})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/side-task");return await s.json()})}async forkSession(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Ke(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/${Ke(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/${Ke(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/${Ke(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/${Ke(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/${Ke(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/${Ke(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/${Ke(e)}/tasks/${Ke(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/${Ke(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/${Ke(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/${Ke(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/${Ke(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/${Ke(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/${Ke(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/${Ke(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/${Ke(e)}/generate`,"POST /session/:id/generate",{prompt:t},n,vF,!1)}async btwSession(e,t,n){let s=await this.transport.fetch(`${this.baseUrl}/session/${Ke(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/${Ke(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 removeMidTurnMessage(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Ke(e)}/mid-turn-messages/${Ke(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/mid-turn-messages/:messageId");return await s.json()})}async getPendingPrompts(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Ke(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/${Ke(e)}/pending-prompts/${Ke(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/${Ke(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/${Ke(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/${Ke(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/${Ke(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??Hbe,"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=xF(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=xF(n),i=await this.workspacePermissions(s),o=i[e].rules[t];return o.includes(r)?await this.setWorkspacePermissionRules(e,t,o.filter(l=>l!==r),s):i}async restartMcpServer(e,t){let n=(t==null?void 0:t.entryIndex)===void 0?"":`?entryIndex=${Ke(String(t.entryIndex))}`;return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${Ke(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)??xb)}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/${Ke(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/${Ke(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/${Ke(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/${Ke(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/${Ke(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"})}workspaceChannelPairingApprovals(e,t){return this.jsonRequest(`/workspace/channels/${Ke(e)}/pairing-approvals`,"GET /workspace/channels/:name/pairing-approvals",{clientId:t==null?void 0:t.clientId,timeoutMs:t==null?void 0:t.timeoutMs,mode:"rest"})}revokeWorkspaceChannelPairingApproval(e,t,n){return this.jsonRequest(`/workspace/channels/${Ke(e)}/pairing-approvals`,"DELETE /workspace/channels/:name/pairing-approvals",{method:"DELETE",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/${Ke(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/${Ke(e)}/${Ke(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)??xb)}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)??xb)}async removeRuntimeMcpServer(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/servers/${Ke(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)??xb)}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:Ube})}async setSessionModel(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Ke(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/${Ke(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/${Ke(e)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify(t),signal:n});if(o.status===202){let l=await o.json();i=!1;try{return await this._awaitTurnComplete(e,l.promptId,l.lastEventId,n,s,l.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/${Ke(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,l=s?F8([s,o.signal]):o.signal;try{let c=this.subscribeEvents(e,{lastEventId:n,...i!==void 0?{epoch:i}:{},signal:l});for await(let u of c){let d=z9(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/${Ke(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/${Ke(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/${Ke(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/${Ke(e)}/permission/${Ke(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/${Ke(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/${Ke(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/${Ke(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/${Ke(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(Ke(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/${Ke(e)}/artifacts`,"GET /session/:id/artifacts",{clientId:t})}async addSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${Ke(e)}/artifacts`,"POST /session/:id/artifacts",{method:"POST",body:t,clientId:n})}async removeSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${Ke(e)}/artifacts/${Ke(t)}`,"DELETE /session/:id/artifacts/:artifactId",{method:"DELETE",clientId:n})}async updateSessionMetadata(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${Ke(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")})}},_F=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)??LZ,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/${Ke(e)}`,"PUT /workspaces/:workspace/channels/:name",{method:"PUT",body:t},n)}deleteWorkspaceChannel(e,t,n){return this.channelRequest(`/channels/${Ke(e)}`,"DELETE /workspaces/:workspace/channels/:name",{method:"DELETE",body:t},n)}setWorkspaceChannelStartup(e,t,n){return this.channelRequest(`/channels/${Ke(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/${Ke(e)}/pairing-requests`,"GET /workspaces/:workspace/channels/:name/pairing-requests",void 0,t)}approveWorkspaceChannelPairing(e,t,n){return this.channelRequest(`/channels/${Ke(e)}/pairing-requests/approve`,"POST /workspaces/:workspace/channels/:name/pairing-requests/approve",{method:"POST",body:t},n)}workspaceChannelPairingApprovals(e,t){return this.channelRequest(`/channels/${Ke(e)}/pairing-approvals`,"GET /workspaces/:workspace/channels/:name/pairing-approvals",void 0,t)}revokeWorkspaceChannelPairingApproval(e,t,n){return this.channelRequest(`/channels/${Ke(e)}/pairing-approvals`,"DELETE /workspaces/:workspace/channels/:name/pairing-approvals",{method:"DELETE",body:t},n)}channelAction(e,t,n){return this.channelRequest(`/channels/${Ke(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=${Ke(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=${Ke(e)}`+(t!=null?`&oldPath=${Ke(t)}`:"")+(n!=null?`&cwd=${Ke(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=${Ke(e)}`+(t!=null?`&cwd=${Ke(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=${Ke(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=${Ke(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=${Ke(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=${Ke(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=${Ke(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=${Ke(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=${Ke(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/${Ke(e)}`,"GET /workspaces/:workspace/agents/:agentType")}updateWorkspaceAgent(e,t,n={}){let s=n.scope?`?scope=${Ke(n.scope)}`:"";return this.post(`/agents/${Ke(e)}${s}`,"POST /workspaces/:workspace/agents/:agentType",t,n.clientId)}async deleteWorkspaceAgent(e,t={}){let n=t.scope?`?scope=${Ke(t.scope)}`:"";return await this.client.workspaceNoContentRequest(this.workspaceSelector,`/agents/${Ke(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)??pT,n=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(t)?t:pT))),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/${Ke(e)}/transcript${PZ(t)}`,"GET /workspaces/:workspace/session/:id/transcript",{clientId:t.clientId,mode:"rest"})}exportSession(e,t={}){return this.client.sessionExportRequest(`/workspaces/${this.workspaceSelector}/session/${Ke(e)}/export`,"GET /workspaces/:workspace/session/:id/export",t)}exportArchivedSession(e,t={}){return this.client.sessionExportRequest(`/workspaces/${this.workspaceSelector}/session/${Ke(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/${Ke(e)}`,"PATCH /workspaces/:workspace/session-groups/:groupId",{method:"PATCH",body:t})).group}deleteSessionGroup(e){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session-groups/${Ke(e)}`,"DELETE /workspaces/:workspace/session-groups/:groupId",{method:"DELETE"})}updateSessionOrganization(e,t,n){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session/${Ke(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)),t.cursor!==void 0&&s.set("cursor",t.cursor),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/${Ke(e)}/enable`,"POST /workspaces/:workspace/tools/:name/enable",{enabled:t},n==null?void 0:n.clientId)}setWorkspaceSkillEnabled(e,t,n){return this.post(`/skills/${Ke(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=${Ke(String(t.entryIndex))}`;return this.post(`/mcp/${Ke(e)}/restart${n}`,"POST /workspaces/:workspace/mcp/:server/restart",{},t==null?void 0:t.clientId,(t==null?void 0:t.timeoutMs)??xb)}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/${Ke(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/${Ke(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 F8(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 z9(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 Jc(500,n.code??"turn_error",n.message??"Prompt failed"),{_daemonTurnError:!0})}}function SF(e){return"promptId"in e&&"lastEventId"in e}var Nw=class n4{constructor(t){He(this,"client");He(this,"session");He(this,"state");He(this,"replaySnapshot");He(this,"hasActivePrompt");He(this,"historyHasMore");He(this,"historyAnchorRecordId");He(this,"replayDegraded");He(this,"lastSeenEventId");He(this,"lastSeenEpoch");He(this,"subscriptionActive",!1);He(this,"reattaching");He(this,"cancelling");He(this,"promptLimit");He(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=g2(t.lastEventId),this.lastSeenEpoch=t.eventEpoch,this.promptLimit=t.maxPendingPromptsPerSession===void 0?t.client.maxPendingPromptsPerSession:OZ(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 n4({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:l,liveJournal:c,historyHasMore:u,historyAnchorRecordId:d,replayDegraded:f,lastEventId:m,eventEpoch:p,...g}=await t.loadSession(n,s,r);return new n4({client:t,session:g,hasActivePrompt:o,state:i,lastEventId:m??0,eventEpoch:p,replaySnapshot:{compactedReplay:l??[],liveJournal:c??[]},historyHasMore:u,historyAnchorRecordId:d,replayDegraded:f})}static async resume(t,n,s={},r){let{state:i,hasActivePrompt:o,lastEventId:l,eventEpoch:c,...u}=await t.resumeSession(n,s,r);return new n4({client:t,session:u,hasActivePrompt:o,state:i,lastEventId:l??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=g2(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)),!SF(r))return s(),r;if(!this.subscriptionActive)throw Error("SSE stream ended")}catch(i){throw s(),i}return new Promise((i,o)=>{let l=()=>{let u=this._pendingPrompts.get(r.promptId);u&&this._pendingPrompts.delete(r.promptId)&&(this.cancel().catch(()=>{}),u.reject(n.reason??new DOMException("Aborted","AbortError")))},c=()=>n==null?void 0:n.removeEventListener("abort",l);this._pendingPrompts.set(r.promptId,{resolve:u=>{c(),s(),i(u)},reject:u=>{c(),s(),o(u)}}),n!=null&&n.aborted?l():n==null||n.addEventListener("abort",l,{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(!SF(s))throw new Error("Expected non-blocking prompt acceptance");return s}async withClientIdSelfHeal(t){try{return await t()}catch(n){if(!Ybe(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(){let t=this.cancelling??this.client.cancel(this.sessionId,this.clientId);this.cancelling=t;try{await t}finally{this.cancelling===t&&(this.cancelling=void 0)}}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 removeMidTurnMessage(t){return await this.client.removeMidTurnMessage(this.sessionId,t,{...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=g2(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}},l=this.iterateEvents({...t,lastEventId:n},i);return{next:async c=>(r||o(),await l.next(c)),return:async()=>{try{return await l.return(void 0)}finally{i()}},throw:async c=>{try{return await l.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),l=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,l==null||l(u)}}))this._dispatchTurnEvent(c),yield c,c.id!==void 0&&(this.lastSeenEventId=Math.max(this.lastSeenEventId??0,g2(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=z9(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 g2(e){if(e!==void 0){if(!Number.isInteger(e)||e<0)throw new TypeError("invalid lastEventId");return e}}function Ybe(e){return e instanceof Jc&&e.status===400&&typeof e.body=="object"&&e.body!==null&&e.body.code==="invalid_client_id"}var BZ="mid_turn_message_injected",F9="pending_prompt_added",q9="pending_prompt_started",H9="pending_prompt_completed",Xbe=["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",BZ,F9,q9,H9,"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(Xbe);var R7="daemon-plan";function tn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ft(e,t){if(!tn(e))return;let n=e[t];return typeof n=="string"?n:void 0}function Pr(e,t){if(tn(e))for(let n of t){let s=e[n];if(typeof s=="string"&&s.trim().length>0)return s}}function Rp(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 Rp(xf(e))}function xf(e,t=0){return t>16?"[truncated]":Array.isArray(e)?e.map(n=>xf(n,t+1)):tn(e)?Object.fromEntries(Object.entries(e).map(([n,s])=>[n,zZ(n)?"[redacted]":xf(s,t+1)])):e}function zZ(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 q8(e){if(typeof e=="string")return e;if(!tn(e))return"";let t=e.text;return typeof t=="string"?t:""}function Qbe(e){if(typeof e=="string")return{kind:"text",text:e};if(!tn(e))return;let t=e.type;if(t==="text"||t===void 0){let n=e.text;return typeof n=="string"?{kind:"text",text:n}:void 0}if(t==="image"){let n=tn(e.source)?e.source:void 0,s,r;return n&&(s=typeof n.url=="string"?n.url:void 0,r=typeof n.data=="string"?n.data:void 0),!s&&!r&&(r=typeof e.data=="string"?e.data:void 0,s=typeof e.url=="string"?e.url:void 0),!s&&!r?void 0:{kind:"image",mediaType:(typeof e.mediaType=="string"?e.mediaType:void 0)??(typeof e.mimeType=="string"?e.mimeType:void 0)??(typeof e.media_type=="string"?e.media_type:void 0)??(n&&typeof n.mediaType=="string"?n.mediaType:void 0)??"image/*",source:{...s?{url:s}:{},...r?{data:r}:{}}}}if(t==="audio"){let n=tn(e.source)?e.source:void 0;if(!n)return;let s=(typeof e.mediaType=="string"?e.mediaType:void 0)??"audio/*",r=typeof n.url=="string"?n.url:void 0,i=typeof n.data=="string"?n.data:void 0;return!r&&!i?void 0:{kind:"audio",mediaType:s,source:{...r?{url:r}:{},...i?{data:i}:{}}}}if(t==="resource"||t==="resource_link"){let n=typeof e.uri=="string"?e.uri:void 0;if(!n)return;let s=typeof e.mediaType=="string"?e.mediaType:void 0,r=typeof e.description=="string"?e.description:void 0;return{kind:"resource",uri:n,...s?{mediaType:s}:{},...r?{description:r}:{}}}}var Jbe=64;function gT(e,t=0){if(t>Jbe)return"[output truncated]";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(s=>gT(s,t+1)).filter(Boolean).join(`
`);if(!tn(e))return e===void 0?"":Rp(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=gT(n,t+1);if(s)return s}return Rp(e)}var Zbe=new Set(Fbe),FZ=new Set(["qwen","qwen-oauth"]),eye=new Set(["in_flight","disabled","budget_would_exceed","authentication_required"]),CF="malformed memory_changed payload",TF=4096,EF="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 tye(e,t={}){let n=cye(e,t);switch(e.type){case"session_update":return dye(e,n,t);case"shell_output":{let s=gT(e.data),r=L7(e.data),i=P7(e.data);return s?[{...n,type:i==="user-shell"?"user.shell.output":"shell.output",text:s,...r?{stream:r}:{}}]:[]}case"permission_request":return vye(e,n);case"permission_resolved":case"permission_already_resolved":return wye(e,n);case"model_switched":return[{...n,type:"model.changed",modelId:ft(e.data,"modelId")??"unknown"}];case"model_switch_failed":return[{...n,type:"error",recoverable:!0,text:ft(e.data,"error")??"Model switch failed (no details available)"}];case"session_died":{let s=H8(ft(e.data,"errorKind"));return[{...n,type:"error",recoverable:!1,...s?{errorKind:s}:{},text:ft(e.data,"reason")??"Session died (no details available)"}]}case"session_closed":return[{...n,type:"status",text:`Session closed: ${ft(e.data,"reason")??"closed"}`}];case"session_recording_degraded":return!ft(e.data,"sessionId")||ft(e.data,"reason")!=="write_failed"?mr(e,n,"malformed recording state"):[{...n,type:"error",recoverable:!0,code:"session_recording_degraded",text:EF}];case"session_snapshot":{if(!tn(e.data)||!ft(e.data,"sessionId"))return mr(e,n,"malformed recording snapshot");let s=e.data.recordingDegraded;return s!==void 0&&typeof s!="boolean"?mr(e,n,"malformed recording snapshot"):s===!0?[{...n,type:"error",recoverable:!0,code:"session_recording_degraded",text:EF}]:[]}case"client_evicted":return[{...n,type:"error",recoverable:!0,text:ft(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=H8(ft(e.data,"errorKind"));return[{...n,type:"error",recoverable:!0,...s?{errorKind:s}:{},text:ft(e.data,"error")??"SSE stream error (no details available)"}]}case"turn_error":{let s=ft(e.data,"code"),r=H8(ft(e.data,"errorKind")),i=ft(e.data,"promptId");return[{...n,type:"error",source:"turn_error",recoverable:!0,...s?{code:s}:{},...r?{errorKind:r}:{},...i?{promptId:i}:{},text:ft(e.data,"message")??"Prompt failed (no details available)"}]}case"state_resync_required":return sye(e,n);case"history_truncated":return rye(e,n);case"session_rewound":return iye(e,n);case"session_branched":return oye(e,n);case"prompt_cancelled":{let s=Vye(e.data,"reason");return[{...n,type:"prompt.cancelled",...s?{reason:s}:{}}]}case"followup_suggestion":return aye(e,n);case"mid_turn_message_injected":return lye(e,n);case"pending_prompt_added":case"pending_prompt_started":case"pending_prompt_completed":return[];case"user_shell_command":{let s=ft(e.data,"command"),r=ft(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=vi(e.data,"exitCode"),r=tn(e.data)&&e.data.aborted===!0?"Shell command was aborted":`Shell command exited with code ${s??"unknown"}`;return[{...n,type:"status",text:r}]}case"replay_complete":{let s=vi(e.data,"replayedCount")??0,r=vi(e.data,"lastReplayedEventId")??vi(e.data,"lastEventId");return[{...n,type:"session.replay_complete",replayedCount:s,...r!==void 0?{lastReplayedEventId:r}:{}}]}case"session_metadata_updated":return Sye(e,n);case"approval_mode_changed":return Tye(e,n);case"git_branch_changed":return[];case"git_status_changed":return[];case"memory_changed":return Eye(e,n);case"agent_changed":return Aye(e,n);case"tool_toggled":return jye(e,n);case"settings_changed":return Nye(e,n);case"settings_reloaded":return Iye(e,n);case"trust_change_requested":return Rye(e,n);case"workspace_initialized":return Mye(e,n);case"github_setup_completed":return Dye(e,n);case"mcp_budget_warning":return Lye(e,n);case"mcp_child_refused_batch":return Pye(e,n);case"mcp_server_restarted":return Oye(e,n);case"mcp_server_restart_refused":return $ye(e,n);case"mcp_server_added":return U8(e,n,"added");case"mcp_server_removed":return U8(e,n,"removed");case"mcp_server_changed":return U8(e,n);case"extensions_changed":return Bye(e,n);case"artifact_changed":return Cye(e,n);case"auth_device_flow_started":return zye(e,n);case"auth_device_flow_throttled":return Fye(e,n);case"auth_device_flow_authorized":return qye(e,n);case"auth_device_flow_failed":return Hye(e,n);case"auth_device_flow_cancelled":return Wye(e,n);default:return nye(e,n)}}function nye(e,t){return[{...t,type:"debug",text:`${e.type} (unrecognized daemon event): ${Uf(e.data)}`}]}function sye(e,t){let n=ft(e.data,"reason"),s=vi(e.data,"lastDeliveredId"),r=vi(e.data,"earliestAvailableId");return!n||s===void 0||r===void 0?mr(e,t,"malformed state_resync_required payload"):[{...t,type:"session.state_resync_required",reason:n,lastDeliveredId:s,earliestAvailableId:r}]}function rye(e,t){let n=ft(e.data,"reason"),s=vi(e.data,"truncatedEvents"),r=vi(e.data,"retainedEvents"),i=vi(e.data,"maxBytes");return n!=="replay_window_exceeded"||s===void 0||r===void 0||i===void 0||!tn(e.data)||typeof e.data.fullTranscriptAvailable!="boolean"?mr(e,t,"malformed history_truncated payload"):[{...t,type:"status",text:`History truncated: retained ${r}, dropped ${s} (window ${i} bytes).`,source:"history_truncated"}]}function iye(e,t){let n=ft(e.data,"promptId"),s=vi(e.data,"targetTurnIndex");if(!n||s===void 0)return mr(e,t,"malformed session_rewound payload");let r=ft(e.data,"sessionId");return[{...t,type:"session.rewound",promptId:n,targetTurnIndex:s,...r?{sessionId:r}:{}}]}function oye(e,t){let n=ft(e.data,"sourceSessionId"),s=ft(e.data,"newSessionId"),r=ft(e.data,"displayName");return!n||!s||!r?mr(e,t,"malformed session_branched payload"):[{...t,type:"session.branched",sourceSessionId:n,newSessionId:s,displayName:r}]}function aye(e,t){let n=ft(e.data,"sessionId"),s=ft(e.data,"suggestion"),r=ft(e.data,"promptId");return!n||!s||!r?mr(e,t,"malformed followup_suggestion payload"):[{...t,type:"followup.suggestion",sessionId:n,suggestion:s,promptId:r}]}function lye(e,t){if(!tn(e.data))return mr(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?mr(e,t,"malformed mid_turn_message_injected"):[{...t,type:"status",text:`Inserted message: ${n.join(`
`)}`,source:"mid_turn_message_injected",data:e.data}]}function cye(e,t){let n=qZ(e),s=hye(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:xf(e.data)}}:{}}}function qZ(e){let t=e.serverTimestamp;if(typeof t=="number"&&Number.isFinite(t))return t;let n=e._meta;if(tn(n)){let s=n.serverTimestamp;if(typeof s=="number"&&Number.isFinite(s))return s}if(tn(e.data)){let s=e.data._meta,r=e.data.update,i=tn(r)?r._meta:void 0;if(tn(s)){let l=s.serverTimestamp;if(typeof l=="number"&&Number.isFinite(l))return l}if(tn(i)){let l=i.serverTimestamp;if(typeof l=="number"&&Number.isFinite(l))return l}let o=[tn(i)?i.timestamp:void 0,tn(r)?r.timestamp:void 0,tn(s)?s.timestamp:void 0,e.data.timestamp];for(let l of o){let c=uye(l);if(c!==void 0)return c}}}function uye(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 dye(e,t,n){let s=HZ(e.data);if(!s)return[{...t,type:"debug",text:`session_update: ${Uf(e.data)}`}];let r=ft(s,"sessionUpdate");switch(r){case"user_message_chunk":{if(n.suppressOwnUserEcho&&n.clientId&&e.originatorClientId===n.clientId)return[];let i=jF(s),o=s.content,l=Qbe(o);if(l){if(l.kind==="image"){let u=l.source.data,d=l.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 l.kind==="text"?l.text?[{...t,type:"user.text.delta",text:l.text,...i?{meta:i}:{}}]:[]:[]}let c=q8(o);return c?[{...t,type:"user.text.delta",text:c,...i?{meta:i}:{}}]:[]}case"agent_message_chunk":{let i=q8(s.content),o=AF(s),l=jF(s),c=[];i&&c.push({...t,type:"assistant.text.delta",text:i,...o?{parentToolCallId:o}:{},...l?{meta:l}:{}});let u=fye(s);return u&&c.push({...t,type:"assistant.usage",usage:u,...o?{parentToolCallId:o}:{}}),c}case"agent_thought_chunk":{let i=q8(s.content);if(!i)return[];let o=AF(s);return[{...t,type:"thought.text.delta",text:i,...o?{parentToolCallId:o}:{}}]}case"tool_call":case"tool_call_update":{let i=tn(s._meta)?s._meta:void 0;return ft(s,"status")==="in_progress"&&ft(s,"kind")===void 0&&(i==null?void 0:i.shellProgress)!==void 0?[]:[mye(s,t)]}case"shell_output":case"tool_output":{let i=gT(s),o=L7(s)??L7(e.data),l=P7(s)??P7(e.data);return i?[{...t,type:l==="user-shell"?"user.shell.output":"shell.output",text:i,...o?{stream:o}:{}}]:[]}case"available_commands_update":{let i=(Array.isArray(s.availableCommands)?s.availableCommands:[]).filter(tn);return[{...t,type:"session.available_commands",count:i.length,commands:i}]}case"plan":return[pye(s,t)];case"current_mode_update":return[];default:return[{...t,type:"debug",text:`${r??"session_update"}: ${Uf(s)}`}]}}function AF(e){let t=tn(e._meta)?e._meta:void 0;return t?ft(t,"parentToolCallId"):void 0}function jF(e){let t=tn(e._meta)?e._meta:void 0;if(!t)return;let{qwenTranscript:n,...s}=t;return Object.keys(s).length>0?s:void 0}function hye(e){var i;if(!tn(e.data))return;let t=HZ(e.data),n=t&&tn(t._meta)?t._meta:void 0,s=(i=n&&tn(n.qwenTranscript)?n.qwenTranscript:void 0)==null?void 0:i.sourceRecordIds;if(!Array.isArray(s))return;let r=[...new Set(s.filter(o=>typeof o=="string"))];return r.length>0?r:void 0}function fye(e){let t=tn(e._meta)?e._meta:void 0,n=t&&tn(t.usage)?t.usage:void 0;if(!n)return;let s=vi(n,"inputTokens"),r=vi(n,"outputTokens");if(s===void 0&&r===void 0)return;let i=vi(n,"cachedReadTokens");return{inputTokens:s??0,outputTokens:r??0,...i!==void 0?{cachedTokens:i}:{}}}function mye(e,t){let n=tn(e._meta)?e._meta:void 0,s=ft(e,"toolName")??ft(e,"name")??(n?ft(n,"toolName"):void 0)??(n?ft(n,"name"):void 0),r=ft(e,"kind"),i=ft(e,"title")??(ft(e,"sessionUpdate")==="tool_call"?s??r:void 0),o=e.rawInput??e.input??e.args,l=e.rawOutput??e.output??e.result,c=o!==void 0?xf(o):void 0,u=l!==void 0?xf(l):void 0,d=e.content!==void 0?xf(e.content):void 0,f=e.locations!==void 0?xf(e.locations):void 0,m=ft(e,"toolCallId"),p=ft(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}=yye(e,s),w=ft(e,"parentToolCallId")??(n?ft(n,"parentToolCallId"):void 0),y=w&&w!==m?w:void 0,v=ft(e,"subagentType")??(n?ft(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}:{},...v?{subagentType:v}:{},...c!==void 0?{rawInput:c}:{},...u!==void 0?{rawOutput:u}:{},...c!==void 0?{details:D7(Uf(c))}:u!==void 0?{details:D7(Uf(u))}:{}}}function pye(e,t){let n=Array.isArray(e.entries)?e.entries:[],s=D7(gye(n)),r=tn(e._meta)?e._meta:void 0,i=r&&tn(r.qwenTranscript)?r.qwenTranscript:void 0,o=ft(i,"planToolCallId")??(t.eventId!==void 0?`${R7}-${t.eventId}`:R7),l=r&&tn(r.stats)?r.stats:void 0,c=r&&tn(r.qwenTodoPlan)?r.qwenTodoPlan:void 0,u=ft(c,"id");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:{entries:n,...l?{stats:l}:{},...u?{plan:{id:u,sourceCallId:o}}:{}}}}function gye(e){return e.flatMap(t=>{if(!tn(t))return[];let n=ft(t,"content");return n?[`- [${bye(ft(t,"status"))}] ${n}`]:[]}).join(`
`)}function bye(e){switch(e){case"completed":return"x";case"in_progress":return"-";default:return" "}}function yye(e,t){let n=ft(e,"provenance"),s=ft(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 H8(e){if(e)return Zbe.has(e)?e:void 0}function D7(e){return e.length<=TF?e:`${e.slice(0,TF)}... [truncated]`}function vye(e,t){if(!tn(e.data))return[{...t,type:"debug",text:`permission_request: ${Uf(e.data)}`}];let n=ft(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`permission_request: ${Uf(e.data)}`}];let s=e.data.toolCall!==void 0?xf(e.data.toolCall):void 0;return[{...t,type:"permission.request",requestId:n,sessionId:ft(e.data,"sessionId"),title:_ye(s),options:xye(e.data.options),toolCall:s}]}function wye(e,t){let n=ft(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`${e.type}: ${Uf(e.data)}`}];let s=ft(e.data,"voterClientId")??t.originatorClientId;return[{...t,type:"permission.resolved",requestId:n,outcome:kye(e.data),...s?{voterClientId:s}:{}}]}function HZ(e){if(!tn(e))return;let t=e.update;return tn(t)?t:e}function xye(e){return Array.isArray(e)?e.flatMap(t=>{if(!tn(t))return[];let n=ft(t,"optionId");return n?[{optionId:n,label:ft(t,"label")??ft(t,"title")??ft(t,"name")??n,...ft(t,"description")?{description:ft(t,"description")}:{},raw:t}]:[]}):[]}function kye(e){if(!tn(e))return Rp(e);let t=e.outcome;if(typeof t=="string")return t;if(tn(t)){let n=ft(t,"outcome")??"selected",s=ft(t,"optionId");return s?`${n}:${s}`:n}return Pr(e,["status","reason"])??Rp(e)}function _ye(e){return tn(e)?ft(e,"title")??ft(e,"name")??ft(e,"kind")??ft(e,"toolName")??"Tool permission":"Tool permission"}function L7(e){let t=ft(e,"stream");return t==="stdout"||t==="stderr"?t:void 0}function P7(e){if(!tn(e))return;let t=ft(e,"source");if(t)return t;let n=e._meta;return tn(n)?ft(n,"source"):void 0}function mr(e,t,n){return[{...t,type:"debug",text:`${e.type}: ${n}`}]}function Sye(e,t){let n=ft(e.data,"sessionId");if(!n)return mr(e,t,"missing sessionId");let s=ft(e.data,"displayName");return[{...t,type:"session.metadata.changed",sessionId:n,...s!==void 0?{displayName:s}:{}}]}function Cye(e,t){let n=ft(e.data,"sessionId"),s=tn(e.data)?e.data.change:void 0;if(!n||!tn(s))return mr(e,t,"malformed artifact_changed payload");let r=ft(s,"action"),i=ft(s,"artifactId");return!r||!i?mr(e,t,"missing action or artifactId"):[{...t,type:"session.artifact.changed",sessionId:n,change:s}]}function Tye(e,t){let n=ft(e.data,"sessionId"),s=ft(e.data,"previous"),r=ft(e.data,"next");if(!n||!s||!r)return mr(e,t,"missing sessionId / previous / next");let i=tn(e.data)&&typeof e.data.persisted=="boolean"?e.data.persisted:!1;return[{...t,type:"session.approval_mode.changed",sessionId:n,previous:s,next:r,persisted:i}]}function Eye(e,t){var o;let n=ft(e.data,"scope");if(n==="managed"){let l=ft(e.data,"source"),c=ft(e.data,"taskId"),u=(o=e.data)==null?void 0:o.touchedScopes;return!(l&&c&&Array.isArray(u))||u.some(d=>d!=="user"&&d!=="project")?mr(e,t,CF):[{...t,type:"workspace.memory.changed",scope:n,source:l,taskId:c,touchedScopes:u}]}let s=ft(e.data,"filePath"),r=ft(e.data,"mode"),i=vi(tn(e.data)?e.data:void 0,"bytesWritten");return n!=="workspace"&&n!=="global"||!s||r!=="append"&&r!=="replace"||i===void 0?mr(e,t,CF):[{...t,type:"workspace.memory.changed",scope:n,filePath:s,mode:r,bytesWritten:i}]}function Aye(e,t){let n=ft(e.data,"change"),s=ft(e.data,"name"),r=ft(e.data,"level");return n!=="created"&&n!=="updated"&&n!=="deleted"||!s||r!=="project"&&r!=="user"?mr(e,t,"malformed agent_changed payload"):[{...t,type:"workspace.agent.changed",change:n,name:s,level:r}]}function jye(e,t){let n=ft(e.data,"toolName"),s=tn(e.data)&&typeof e.data.enabled=="boolean"?e.data.enabled:void 0;return!n||s===void 0?mr(e,t,"malformed tool_toggled payload"):[{...t,type:"workspace.tool.toggled",toolName:n,enabled:s}]}function Nye(e,t){let n=ft(e.data,"key"),s=ft(e.data,"scope");return n?[{...t,type:"workspace.settings.changed",key:n,scope:s??"workspace",value:tn(e.data)?e.data.value:void 0}]:mr(e,t,"malformed settings_changed payload")}function Iye(e,t){return tn(e.data)?[{...t,type:"workspace.settings.changed",key:"settings_reloaded",scope:"workspace",value:e.data}]:mr(e,t,"malformed settings_reloaded payload")}function Mye(e,t){let n=ft(e.data,"path"),s=ft(e.data,"action");return!n||s!=="created"&&s!=="overwrote"&&s!=="noop"?mr(e,t,"malformed workspace_initialized payload"):[{...t,type:"workspace.initialized",path:n,action:s}]}function Rye(e,t){let n=ft(e.data,"workspaceCwd"),s=ft(e.data,"desiredState"),r=ft(e.data,"reason");return!n||s!=="trusted"&&s!=="untrusted"?mr(e,t,"bad trust_change_requested payload"):[{...t,type:"workspace.trust.change.requested",workspaceCwd:n,desiredState:s,...r!==void 0?{reason:r}:{}}]}function Dye(e,t){let n=ft(e.data,"releaseTag"),s=ft(e.data,"readmeUrl");if(!n||!s||!tn(e.data))return mr(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 Lye(e,t){if(!tn(e.data))return mr(e,t,"non-object payload");let n=vi(e.data,"liveCount"),s=vi(e.data,"reservedCount"),r=vi(e.data,"budget"),i=vi(e.data,"thresholdRatio"),o=ft(e.data,"mode");return n===void 0||s===void 0||r===void 0||i===void 0||o!=="warn"&&o!=="enforce"?mr(e,t,"malformed mcp_budget_warning payload"):[{...t,type:"workspace.mcp.budget_warning",liveCount:n,reservedCount:s,budget:r,thresholdRatio:i,mode:o}]}function Pye(e,t){if(!tn(e.data))return mr(e,t,"non-object payload");let n=Array.isArray(e.data.refusedServers)?e.data.refusedServers.filter(tn).map(o=>{let l=ft(o,"name"),c=ft(o,"transport"),u=ft(o,"reason");return!l||!c||u!=="budget_exhausted"?null:{name:l,transport:c,reason:"budget_exhausted"}}).filter(o=>o!==null):[],s=vi(e.data,"budget"),r=vi(e.data,"liveCount"),i=vi(e.data,"reservedCount");return n.length===0||s===void 0||r===void 0||i===void 0?mr(e,t,"malformed mcp_child_refused_batch payload"):[{...t,type:"workspace.mcp.child_refused",refusedServers:n,budget:s,liveCount:r,reservedCount:i}]}function Oye(e,t){let n=ft(e.data,"serverName"),s=vi(e.data,"durationMs");return!n||s===void 0?mr(e,t,"malformed mcp_server_restarted payload"):[{...t,type:"workspace.mcp.server_restarted",serverName:n,durationMs:s}]}function $ye(e,t){let n=ft(e.data,"serverName"),s=ft(e.data,"reason");return!n||!s||!eye.has(s)?mr(e,t,"malformed mcp_server_restart_refused payload"):[{...t,type:"workspace.mcp.server_restart_refused",serverName:n,reason:s}]}function U8(e,t,n){let s=ft(e.data,n?"name":"serverName"),r=n??ft(e.data,"action");return!s||!r||!["added","removed","approve","enable","disable","authenticate","clear-auth"].includes(r)?mr(e,t,`malformed ${e.type} payload`):[{...t,type:"workspace.mcp.server_changed",serverName:s,action:r}]}function Bye(e,t){let n=vi(e.data,"refreshed"),s=vi(e.data,"failed"),r=ft(e.data,"status"),i=ft(e.data,"source"),o=ft(e.data,"name"),l=ft(e.data,"version"),c=ft(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"?mr(e,t,"malformed extensions_changed payload"):[{...t,type:"workspace.extensions.changed",refreshed:n,failed:s,...r?{status:r}:{},...i?{source:i}:{},...o?{name:o}:{},...l?{version:l}:{},...c?{error:c}:{}}]}function zye(e,t){let n=ft(e.data,"deviceFlowId"),s=ft(e.data,"providerId"),r=vi(e.data,"expiresAt");return!n||!s||!FZ.has(s)||r===void 0?mr(e,t,"malformed auth_device_flow_started payload"):[{...t,type:"auth.device_flow.started",deviceFlowId:n,providerId:s,expiresAt:r}]}function Fye(e,t){let n=ft(e.data,"deviceFlowId"),s=vi(e.data,"intervalMs");return!n||s===void 0?mr(e,t,"malformed auth_device_flow_throttled payload"):[{...t,type:"auth.device_flow.throttled",deviceFlowId:n,intervalMs:s}]}function qye(e,t){let n=ft(e.data,"deviceFlowId"),s=ft(e.data,"providerId");if(!n||!s||!FZ.has(s))return mr(e,t,"malformed auth_device_flow_authorized payload");let r=vi(e.data,"expiresAt"),i=ft(e.data,"accountAlias");return[{...t,type:"auth.device_flow.authorized",deviceFlowId:n,providerId:s,...r!==void 0?{expiresAt:r}:{},...i?{accountAlias:i}:{}}]}function Hye(e,t){let n=ft(e.data,"deviceFlowId"),s=ft(e.data,"errorKind");if(!n||!Uye(s))return mr(e,t,"malformed auth_device_flow_failed payload");let r=ft(e.data,"hint");return[{...t,type:"auth.device_flow.failed",deviceFlowId:n,errorKind:s,...r?{hint:r}:{}}]}function Uye(e){return typeof e=="string"&&e.trim().length>0}function Wye(e,t){let n=ft(e.data,"deviceFlowId");return n?[{...t,type:"auth.device_flow.cancelled",deviceFlowId:n}]:mr(e,t,"malformed auth_device_flow_cancelled payload")}function vi(e,t){if(!tn(e))return;let n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Vye(e,t){if(!tn(e))return;let n=e[t];return typeof n=="string"&&n.length>0?n:void 0}var Gye=8;function bT(e,t={},n=0){if(n>Gye){let g=t.title??t.toolName??t.toolKind;return{kind:"generic",...g?{summary:g}:{}}}if(tn(e)){let g=e.rawInput??e.input??e.args;if(g!==void 0&&g!==e){let b=bT(g,{title:t.title??Pr(e,["title"]),toolName:t.toolName??Pr(e,["toolName","name"]),toolKind:t.toolKind??Pr(e,["kind"])},n+1);if(b.kind!=="generic"||!b.summary)return b}}let s=Jye(e);if(s.length>0)return{kind:"ask_user_question",questions:s};let r=Qye(e,t);if(r)return r;let i=nve(e,t);if(i)return i;let o=sve(e,t);if(o)return o;let l=rve(e,t);if(l)return l;let c=Kye(e,t);if(c)return c;let u=Yye(e,t);if(u)return u;let d=Xye(e);if(d)return d;let f=ive(e,t);if(f)return f;let m=ove(e);if(m)return m;if(tn(e)){let g=Pr(e,["command","cmd"]);if(g){let w=Pr(e,["cwd","directory","workingDirectory"]);return{kind:"command",command:g,...w?{cwd:w}:{}}}let b=eve(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 Kye(e,t={}){if(!tn(e))return;let n=Pr(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let s=Pr(e,["oldText","old_text","old_str","oldString"]),r=Pr(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,l=r===void 0&&o?Pr(e,["content"]):void 0,c=r??l,u=Pr(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 Yye(e,t){if(!tn(e))return;let n=Pr(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let s=t.toolName??Pr(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 l=e.offset,c=e.limit;typeof l=="number"&&typeof c=="number"&&c>0&&(o=[l+1,l+c])}if(!(!r&&!o))return{kind:"file_read",path:n,...o?{range:o}:{}}}function Xye(e){if(!tn(e))return;let t=Pr(e,["url","uri","href"]);if(!t||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t))return;let n=Pr(e,["method","httpMethod"]);return{kind:"web_fetch",url:t,...n?{method:n}:{}}}function Qye(e,t){let n=t.toolName??(tn(e)?Pr(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),l;if(tn(e)){let c=e.arguments??e.args??e;if(tn(c)){let u=Object.entries(c).filter(([d])=>d!=="name"&&d!=="toolName").slice(0,1).map(([d,f])=>{let m=typeof f=="string"?f:JSON.stringify(f),p=m.length>60?`${m.slice(0,60)}…`:m;return`${d}=${p}`})[0];u&&(l=u)}}return{kind:"mcp_invocation",serverId:i,toolName:o,...l?{argsSummary:l}:{}}}function Jye(e){return!tn(e)||!Array.isArray(e.questions)?[]:e.questions.filter(tn).map(t=>{let n=Pr(t,["header","title","label"]),s=Pr(t,["question","prompt","text"])??"Question",r=Array.isArray(t.options)?t.options.filter(tn).map(Zye):[];return{...n?{header:n}:{},question:s,options:r,raw:t}})}function Zye(e){let t=Pr(e,["label","title","value"])??"Option",n=Pr(e,["description","detail","text"]);return{label:t,...n?{description:n}:{},raw:e}}function eve(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=Pr(e,r);i&&t.push({label:s,value:i})}if(t.length>0)return t;for(let[s,r]of Object.entries(e).slice(0,4))r==null||Array.isArray(r)||tn(r)||t.push({label:s,value:zZ(s)?"[redacted]":Uf(r)});return t}var NF=50,tve=5;function nve(e,t){let n=t.toolName??"";if(!(/^task$/i.test(n)||/(?:^|_)(?:delegate|subagent|spawn[_-]?task)$/i.test(n)||/agent/i.test(t.toolKind??""))||!tn(e))return;let s=Pr(e,["subagent_type","agent","agentName","agent_name","subagent"]),r=Pr(e,["prompt","task","description","instruction","query"]);if(!s&&!r)return;let i=Pr(e,["parentDelegationId","parent_delegation_id","parent_id"]);return{kind:"subagent_delegation",agentName:s??"subagent",task:r??"(no task description)",...i?{parentDelegationId:i}:{}}}function sve(e,t){if(!tn(e))return;let n=Pr(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,tve).map(l=>typeof l=="string"?l:tn(l)?Pr(l,["path","file","name","title","text"])??Rp(l).slice(0,120):String(l)).filter(Boolean),i.length===0&&(i=void 0)),{kind:"search",query:n,...r!==void 0?{resultCount:r}:{},...i?{top:i}:{}}}function rve(e,t){let n=t.toolName??"";if(!/(image[_-]?gen|generate[_-]?image|diffusion|dalle|imagen|flux|stable[_-]?diffusion|midjourney|sora)/i.test(n)||!tn(e))return;let s=Pr(e,["prompt","description","query"]);if(!s)return;let r=Pr(e,["thumbnailUrl","thumbnail","url","imageUrl","preview"]),i=Pr(e,["model","modelId","model_name"]);return{kind:"image_generation",prompt:s,...r?{thumbnailUrl:r}:{},...i?{model:i}:{}}}function ive(e,t){if(!tn(e))return;let n=Pr(e,["code","snippet","source"]);if(!n)return;let s=Pr(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=Pr(e,["origin","source_location","path"]);return{kind:"code_block",code:n,...s?{language:s}:{},...o?{origin:o}:{}}}function ove(e){if(!tn(e))return;let t=e.columns,n=e.rows;if(Array.isArray(t)&&Array.isArray(n)){let r=t.filter(o=>typeof o=="string").slice(0,30);if(r.length===0)return;let i=n.slice(0,NF).map(o=>Array.isArray(o)?o.map(l=>typeof l=="string"?l:Rp(l).slice(0,80)):[]);return{kind:"tabular",columns:r,rows:i,...n.length>i.length?{totalRows:n.length}:{}}}let s=e.data??e.records;if(Array.isArray(s)&&s.length>0&&tn(s[0])){let r=Object.keys(s[0]).slice(0,30);if(r.length===0)return;let i=s.slice(0,NF).map(o=>{let l=o;return r.map(c=>{let u=l[c];return typeof u=="string"?u:Rp(u).slice(0,80)})});return{kind:"tabular",columns:r,rows:i,...s.length>i.length?{totalRows:s.length}:{}}}}var ave=1e3,xp="__trimmed_tool_block__",u5="__trimmed_permission_block__",O7=1e5,IF=`
[truncated]
`,lve=16,_k=new WeakMap;function cve(e={}){let t={blocks:[],blockIndexById:Uo(),toolBlockByCallId:Uo(),trimmedToolNotificationByCallId:Uo(),permissionBlockByRequestId:Uo(),activeAssistantBlockByParent:Uo(),activeThoughtBlockByParent:Uo(),toolProgress:Uo(),awaitingResync:!1,resyncRequiredCount:0,nextOrdinal:1,now:e.now??Date.now(),maxBlocks:e.maxBlocks??ave,retainSubagentBlocks:e.retainSubagentBlocks??!0};return e.onTruncation&&_k.set(t,e.onTruncation),t}var U9=new Set(["pending","confirming","running","in_progress"]),uve=new Set(["completed","success","failed","error","canceled","cancelled"]),dve=new Set(["session.state_resync_required","assistant.done","status","debug","error"]);function hve(e,t,n={}){let s=GZ(e,n);G9(s);let r=K9(s,"user",t,void 0,void 0,n.meta);return n.images&&n.images.length>0&&(r.images=[...n.images]),jh(s,r),s.activeUserBlockId=r.id,KZ(s)}function fve(e,t,n={}){if(t.length===0)return e;let s=GZ(e,n);for(let i of t)mve(s,i);return KZ(s)}function d5(e){let t=Uo();return e.forEach((n,s)=>{t[n.id]=s}),t}function mve(e,t){var n;if(t.eventId!==void 0&&(e.lastEventId=Math.max(e.lastEventId??0,t.eventId)),e.awaitingResync&&!dve.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),W8(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"||!XZ(r.sourceRecordIds,t.sourceRecordIds)){let i=K9(e,"user","",t.eventId,t.serverTimestamp,void 0,t.sourceRecordIds);i.images=[{data:t.data,mimeType:t.mimeType}],jh(e,i),e.activeUserBlockId=i.id}else{let i=Zc(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;W8(e,"assistant","activeAssistantBlockId",t.text,t);break;case"assistant.done":G9(e,t),(t.reason==="cancelled"||t.reason==="error")&&$7(e);break;case"assistant.usage":t.parentToolCallId&&!e.retainSubagentBlocks?yve(e,t):bve(e,t);break;case"thought.text.delta":if(t.parentToolCallId&&!e.retainSubagentBlocks)break;W8(e,"thought","activeThoughtBlockId",t.text,t);break;case"tool.update":if(t.parentToolCallId&&!e.retainSubagentBlocks){wve(e,t.toolCallId);break}VZ(e,t);break;case"shell.output":_ve(e,t);break;case"user.shell.output":Sve(e,t);break;case"permission.request":Cve(e,t);break;case"permission.resolved":Tve(e,t);break;case"model.changed":Bx(e,"status",`Model switched: ${t.modelId}`,t);break;case"status":case"debug":case"error":Bx(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":pve(e,t);break;case"prompt.cancelled":$7(e),t.reason!=="forward_failed"&&Eve(e,t);break;case"followup.suggestion":e.lastFollowupSuggestion={suggestion:t.suggestion,promptId:t.promptId};break;case"session.replay_complete":break;case"session.rewound":jve(e,t.targetTurnIndex);break;case"session.branched":Bx(e,"status",`Branched conversation "${t.displayName}". You are now in the branch.`,t);break}}function pve(e,t){e.awaitingResync=!0,e.resyncRequiredCount+=1,e.lastResyncRequired={reason:t.reason,lastDeliveredId:t.lastDeliveredId,earliestAvailableId:t.earliestAvailableId},$7(e),Bx(e,"error",`State resync required: ${gve(t.lastDeliveredId,t.earliestAvailableId)}.`,t)}function gve(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 h5(e,t,n){let s=Zc(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 UZ(e,t){h5(e,e.activeAssistantBlockId,t),e.activeAssistantBlockId=void 0}function bve(e,t){let n=Zc(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 yve(e,t){if(!t.parentToolCallId)return;let n=Zc(e,e.toolBlockByCallId[t.parentToolCallId]);if((n==null?void 0:n.kind)!=="tool")return;let s=tn(n.rawOutput)?n.rawOutput:void 0,r=tn(s==null?void 0:s.executionSummary)?s.executionSummary:void 0,i=ad(r==null?void 0:r.inputTokens)+t.usage.inputTokens,o=ad(r==null?void 0:r.outputTokens)+t.usage.outputTokens,l=ad(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:l,totalTokens:i+o}},n.updatedAt=e.now}function ad(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function WZ(e,t){h5(e,e.activeThoughtBlockId,t),e.activeThoughtBlockId=void 0}function W9(e,t,n){h5(e,e.activeAssistantBlockByParent[t],n),delete e.activeAssistantBlockByParent[t]}function V9(e,t,n){h5(e,e.activeThoughtBlockByParent[t],n),delete e.activeThoughtBlockByParent[t]}function W8(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,l=o&&i!=null?o[i]:e[n],c=Zc(e,l);if(c&&c.kind===t&&vve(c,r)){c.text=Y9(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=K9(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),jh(e,u),o&&i!=null?o[i]=u.id:e[n]=u.id,i!=null?(t==="assistant"&&V9(e,i),t==="thought"&&W9(e,i)):(t!=="user"&&(e.activeUserBlockId=void 0),t!=="assistant"&&UZ(e),t!=="thought"&&WZ(e))}function vve(e,t){var n,s;return e.kind!=="user"&&e.kind!=="assistant"&&e.kind!=="thought"||((n=e.meta)==null?void 0:n.qwenDiscreteMessage)===!0||!XZ(e.sourceRecordIds,t.sourceRecordIds)?!1:!("meta"in t)||((s=t.meta)==null?void 0:s.qwenDiscreteMessage)!==!0}function G9(e,t){UZ(e,t);for(let n of Object.keys(e.activeAssistantBlockByParent))W9(e,n,t);for(let n of Object.keys(e.activeThoughtBlockByParent))V9(e,n,t);WZ(e,t)}function VZ(e,t){let n=!e.retainSubagentBlocks&&tn(t.rawOutput)&&t.rawOutput.type==="task_execution",s=xve(t.rawOutput,e.retainSubagentBlocks),r=e.toolBlockByCallId[t.toolCallId];if(r===xp){if(Ave(t))return delete e.toolBlockByCallId[t.toolCallId],delete e.trimmedToolNotificationByCallId[t.toolCallId],VZ(e,t);e.trimmedToolNotificationByCallId[t.toolCallId]||(e.trimmedToolNotificationByCallId[t.toolCallId]=!0,Bx(e,"error",`Tool ${t.toolCallId} output trimmed (max blocks reached)`,t,{clearActiveText:!1}));return}let i=Zc(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=bT(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&&tn(s)&&tn(i.rawOutput)){let c=tn(i.rawOutput.executionSummary)?i.rawOutput.executionSummary:void 0,u=tn(s.executionSummary)?s.executionSummary:void 0;if(c&&u){let d=Math.max(ad(c.inputTokens),ad(u.inputTokens)),f=Math.max(ad(c.outputTokens),ad(u.outputTokens));s={...s,executionSummary:{...u,inputTokens:d,outputTokens:f,cachedTokens:Math.max(ad(c.cachedTokens),ad(u.cachedTokens)),totalTokens:Math.max(ad(c.totalTokens),ad(u.totalTokens),d+f)}}}else c&&(s={...s,executionSummary:{...c}})}i.rawOutput=s}if(i.sourceRecordIds=Mve(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!==xp&&(i.parentBlockId=c)}t.subagentType&&!i.subagentType&&(i.subagentType=t.subagentType),MF(e,t.toolCallId,t.status);return}let o=t.parentToolCallId&&e.toolBlockByCallId[t.parentToolCallId]!==xp?e.toolBlockByCallId[t.parentToolCallId]:void 0,l={id:a0(e,"tool"),kind:"tool",toolCallId:t.toolCallId,title:t.title??t.toolName??t.toolKind??"Tool",status:t.status??"pending",preview:bT(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}:{}};jh(e,l),e.toolBlockByCallId[t.toolCallId]=l.id;for(let c of e.blocks)if(c.kind==="tool"&&c.parentToolCallId===t.toolCallId&&!c.parentBlockId){let u=Zc(e,c.id);(u==null?void 0:u.kind)==="tool"&&(u.parentBlockId=l.id)}MF(e,t.toolCallId,t.status??"pending"),d1(e,t.parentToolCallId)}function wve(e,t){let n=e.toolBlockByCallId[t];!n||n===xp||(f5(e),e.blocks=e.blocks.filter(s=>s.id!==n),e.blockIndexById=d5(e.blocks),delete e.toolBlockByCallId[t],delete e.toolProgress[t],e.currentToolCallId===t&&(e.currentToolCallId=void 0))}function xve(e,t){if(t||!tn(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 MF(e,t,n){if(n!==void 0){if(U9.has(n)){e.currentToolCallId=t;return}if(uve.has(n)){e.currentToolCallId===t&&(e.currentToolCallId=kve(e));return}}}function kve(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"&&U9.has(n.status))return n.toolCallId}}function $7(e){for(let t of Object.values(e.toolBlockByCallId)){if(t===xp)continue;let n=Zc(e,t);!n||n.kind!=="tool"||U9.has(n.status)&&(n.status="cancelled",n.updatedAt=e.now)}e.currentToolCallId=void 0}function _ve(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=Zc(e,n.id);(i==null?void 0:i.kind)==="shell"&&(i.text=Y9(e,i,t.text),i.updatedAt=e.now,t.eventId!==void 0&&(i.eventId=t.eventId));return}let s=a0(e,"shell"),r={id:s,kind:"shell",text:C_(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}:{}};jh(e,r),d1(e)}function Sve(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 l=Zc(e,n.id);(l==null?void 0:l.kind)==="user_shell"&&(l.text=Y9(e,l,t.text),l.updatedAt=e.now,t.eventId!==void 0&&(l.eventId=t.eventId));return}let s=e.pendingUserShellCommand,r=(n==null?void 0:n.kind)==="user_shell"?n:void 0,i=a0(e,"user-shell"),o={id:i,kind:"user_shell",text:C_(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,jh(e,o),d1(e)}function Cve(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===u5)return;let s=Zc(e,n),r=bT(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:a0(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}:{}};jh(e,i),e.permissionBlockByRequestId[t.requestId]=i.id,d1(e)}function Tve(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===void 0||n===u5)return;let s=Zc(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:a0(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}:{}};jh(e,r),e.permissionBlockByRequestId[t.requestId]=r.id,d1(e)}function Bx(e,t,n,s,r={}){let i=a0(e,t),o={id:i,kind:t,text:C_(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}}:{}};jh(e,o),r.clearActiveText!==!1&&d1(e)}function Eve(e,t){let n={id:a0(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}:{}};jh(e,n),d1(e)}function K9(e,t,n,s,r,i,o){let l=a0(e,t);return{id:l,kind:t,text:C_(e,l,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 GZ(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:Uo(e.toolBlockByCallId),activeAssistantBlockByParent:Uo(e.activeAssistantBlockByParent),activeThoughtBlockByParent:Uo(e.activeThoughtBlockByParent),trimmedToolNotificationByCallId:Uo(e.trimmedToolNotificationByCallId),permissionBlockByRequestId:Uo(e.permissionBlockByRequestId),toolProgress:Uo(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??_k.get(e);return s&&_k.set(n,s),n}function KZ(e){var s;if(e.blocks.length<=e.maxBlocks)return e;(s=_k.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=d5(t),yT.set(e,e.blocks);for(let[r,i]of Object.entries(e.toolBlockByCallId))n.has(i)||(e.toolBlockByCallId[r]=xp);Rve(e);for(let[r]of Object.entries(e.trimmedToolNotificationByCallId))e.toolBlockByCallId[r]!==xp&&delete e.trimmedToolNotificationByCallId[r];for(let[r,i]of Object.entries(e.permissionBlockByRequestId))n.has(i)||(e.permissionBlockByRequestId[r]=u5);Dve(e);for(let r of e.blocks)if(r.kind==="tool"&&r.parentBlockId&&!n.has(r.parentBlockId)){let i=Zc(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 Ave(e){return e.toolCallId===R7||e.toolKind==="updated_plan"}var yT=new WeakMap;function f5(e){yT.get(e)!==e.blocks&&(e.blocks=[...e.blocks],e.blockIndexById=Uo(e.blockIndexById),yT.set(e,e.blocks))}function jve(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){RF(e,i);return}n+=1}s>=0&&t>=n&&RF(e,s)}function RF(e,t){f5(e),e.blocks=e.blocks.slice(0,t),yT.set(e,e.blocks),Nve(e)}function Nve(e){e.blockIndexById=d5(e.blocks),e.toolBlockByCallId=Uo(),e.permissionBlockByRequestId=Uo(),e.trimmedToolNotificationByCallId=Uo(),e.activeUserBlockId=void 0,e.activeAssistantBlockId=void 0,e.activeThoughtBlockId=void 0,e.activeAssistantBlockByParent=Uo(),e.activeThoughtBlockByParent=Uo(),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 jh(e,t){f5(e),e.blockIndexById[t.id]=e.blocks.length,e.blocks.push(t)}function Zc(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=Ive(s);return f5(e),e.blocks[n]=r,r}function Ive(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 a0(e,t){let n=`${t}-${e.nextOrdinal}`;return e.nextOrdinal+=1,n}function d1(e,t){t?(W9(e,t),V9(e,t)):(G9(e),e.activeUserBlockId=void 0)}function Y9(e,t,n){let s="text"in t?t.text:"";return s.length>=O7?(n&&YZ(e,t.id,t.sourceRecordIds),s):C_(e,t.id,t.sourceRecordIds,s+n)}function C_(e,t,n,s){if(s.length<=O7)return s;YZ(e,t,n);let r=Math.max(0,O7-IF.length);return`${s.slice(0,r)}${IF}`}function YZ(e,t,n){var s;(s=_k.get(e))==null||s({kind:"text",blockId:t,sourceRecordIds:n})}function Uo(e){return Object.assign(Object.create(null),e)}function XZ(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,s)=>n===t[s])}function Mve(e,t){if(!(!e&&!t))return[...new Set([...e??[],...t??[]])]}function Rve(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.toolBlockByCallId).filter(([,r])=>r===xp).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 Dve(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.permissionBlockByRequestId).filter(([,r])=>r===u5).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>lve?e:Array.isArray(e)?e.map(n=>Xd(n,t+1)):tn(e)?Object.fromEntries(Object.entries(e).map(([n,s])=>[n,Xd(s,t+1)])):e}function B7(e={}){let t=DF(e),n=new Set,s=!1,r=()=>{for(let o of n)try{o()}catch(l){Lve(l)}},i=()=>{s||(s=!0,queueMicrotask(()=>{s=!1,r()}))};return{getSnapshot(){return t},subscribe(o){return n.add(o),()=>{n.delete(o)}},dispatch(o){let l=Array.isArray(o)?o:[o];l.length!==0&&(t=fve(t,l),i())},appendLocalUserMessage(o,l,c){t=hve(t,o,{images:l,meta:c}),i()},reset(o={}){t=DF({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 Lve(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 DF(e){let t=e.blocks?[...e.blocks]:[];return{...cve({maxBlocks:e.maxBlocks,now:e.now}),...e,blocks:t,blockIndexById:d5(t),toolBlockByCallId:Q1(e.toolBlockByCallId),trimmedToolNotificationByCallId:Q1(e.trimmedToolNotificationByCallId),permissionBlockByRequestId:Q1(e.permissionBlockByRequestId),toolProgress:Q1(e.toolProgress),activeAssistantBlockByParent:Q1(e.activeAssistantBlockByParent),activeThoughtBlockByParent:Q1(e.activeThoughtBlockByParent),lastResyncRequired:e.lastResyncRequired!==void 0?{...e.lastResyncRequired}:void 0,lastFollowupSuggestion:e.lastFollowupSuggestion!==void 0?{...e.lastFollowupSuggestion}:void 0}}function Q1(e){return Object.assign(Object.create(null),e)}var Pve="web-shell:goal-status:v1:";/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Sk(e){if(e instanceof Jc||Mo(e)&&typeof e.status=="number")return e.status}function Mo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function LF(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 l;for(const c of e.providers)for(const u of c.models){!i&&u.isCurrent&&(i=u.modelId),l===void 0&&(i?u.modelId===i:u.isCurrent)&&(l=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:l}}function Ove(e){var t;const n=Ra((t=e==null?void 0:e.state)==null?void 0:t.models);if(!n)return;const s=io(n,"currentModelId")??io(n,"currentModel"),r=n.availableModels,i=[];let o;if(Array.isArray(r))for(const l of r){const c=Ra(l),u=io(c,"modelId")??io(c,"id")??io(c,"value");if(!u)continue;const d=Ra(c==null?void 0:c._meta),f=lx(d,"contextLimit")??lx(d,"contextWindow")??lx(c,"contextLimit")??lx(c,"contextWindow");o===void 0&&s!==void 0&&u===s&&(o=f),i.push({id:u,baseModelId:io(c,"baseModelId")??qve(u),label:io(c,"name")??io(c,"label")??u,...f!==void 0?{contextWindow:f}:{}})}if(!(!s&&i.length===0))return{models:i,currentModel:s,contextWindow:o}}function QZ(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}:{},...eee(s._meta),raw:s}}),n=e.availableSkills.map(s=>({name:s,description:"",raw:{name:s,description:"",input:null,_meta:{source:"skill"}}}));return{commands:JZ(t,n),skills:e.availableSkills}}function PF(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 JZ(...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 $ve(e,t){var n;if(e.type==="session_update"){const s=Ra((n=Ra(e.data))==null?void 0:n.update),r=ZZ(s);if(r&&t(i=>({...i,tokenUsage:r,tokenCount:X9(r)})),io(s,"sessionUpdate")==="available_commands_update"){const{commands:i,skills:o}=Fve(s);t(l=>({...l,commands:i,skills:o}))}return}switch(e.type){case"git_branch_changed":{const s=Ra(e.data),r=io(s,"workspaceCwd"),i=io(s,"branch");t(o=>r&&r!==o.workspaceCwd?o:{...o,gitBranch:i});break}case"git_status_changed":{const s=Ra(e.data),r=io(s,"workspaceCwd");t(i=>r&&r!==i.workspaceCwd?i:{...i,gitStatus:s});break}case"session_metadata_updated":{const s=Ra(e.data);Object.prototype.hasOwnProperty.call(s??{},"displayName")&&t(r=>({...r,displayName:io(s,"displayName")}));break}case"model_switched":{const s=io(Ra(e.data),"modelId");s&&t(r=>({...r,currentModel:s}));break}case"approval_mode_changed":{const s=Ra(e.data),r=io(s,"next")??io(s,"mode");r&&t(i=>({...i,currentMode:r}));break}}}function OF(e){const t=io(e,"displayName");return t!=null&&t.trim()?t:void 0}function Bve(e){var t;const n=Ra((t=e==null?void 0:e.state)==null?void 0:t.modes);return io(n,"currentModeId")??io(n,"currentMode")}function X9(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 zve(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=Ra((t=Ra(s.data))==null?void 0:t.update),i=ZZ(r);if(i)return i}catch{}}function ZZ(e){const t=Ra(e==null?void 0:e._meta);if((t==null?void 0:t.parentToolCallId)!==void 0)return;const n=Ra(t==null?void 0:t.usage),s={...Iw(n,"inputTokens"),...Iw(n,"outputTokens"),...Iw(n,"totalTokens"),...Iw(n,"thoughtTokens"),...Iw(n,"cachedReadTokens")};return X9(s)!==void 0?s:void 0}function Iw(e,t){const n=lx(e,t);return n!==void 0&&n>=0?{[t]:n}:{}}function Fve(e){if(!e)return{commands:[],skills:[]};const n=(Array.isArray(e.availableCommands)?e.availableCommands:[]).flatMap(i=>{var o;const l=Ra(i),c=io(l,"name");if(!c)return[];const u=Ra(l==null?void 0:l.input),d={name:c,description:io(l,"description")??"",input:u?{hint:io(u,"hint")??""}:null,_meta:Ra(l==null?void 0:l._meta)??null};return[{name:c,description:d.description??"",...(o=d.input)!=null&&o.hint?{argumentHint:d.input.hint}:{},...eee(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:JZ(n,r),skills:s}}function eee(e){const n=io(e??void 0,"source");return{...n?{source:n}:{}}}function Ra(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function io(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function lx(e,t){const n=e==null?void 0:e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function qve(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 $F(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 Hve=3e4;function Uve(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),l=.8+Math.random()*.4;return Math.min(r,Math.max(1,Math.round(o*l)))}async function vt(e,t,n=Hve){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 Wve(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 jo(e){e.current!==void 0&&(clearTimeout(e.current),e.current=void 0)}function Vve(e,t,n="replay",s=80,r){jo(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 Gve="qwen-code-webui-client-id:session:";function V8(e,t){if(e)return e;if(typeof window>"u")return G8();try{if(t){const n=window.sessionStorage.getItem(Q9(t));if(n)return n}return G8()}catch{return G8()}}function Kve(e){if(!(typeof window>"u"))try{return window.sessionStorage.getItem(Q9(e))??void 0}catch{return}}function s4(e,t){if(!(!e||!t||typeof window>"u"))try{window.sessionStorage.setItem(Q9(t),e)}catch{}}async function BF(e){if(!e.clientId)return;const t={"X-Qwen-Client-Id":e.clientId};e.token&&(t.Authorization=`Bearer ${e.token}`);const n=`${Yve(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 G8(){return`webui_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function Q9(e){return`${Gve}${encodeURIComponent(e)}`}function Yve(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 Xve(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 Qve({store:e,sessionRef:t,activePromptsRef:n,settledPromptsRef:s,pendingSessionLoadRef:r,pendingSessionLoadIdRef:i,heartbeatSupportedRef:o,manualSessionClearRef:l,skipNextCleanupDetachSessionIdRef:c,passiveAssistantDoneTimerRef:u,getCreateSessionRequest:d,createDetachedSession:f,getConnection:m,hasSessionActivePrompt:p,resetCurrentSessionActivePrompt:g,restartEventStream:b,addNotice:w,setConnection:y,setPromptStatus:v,setRestoreSessionId:x,setRestoreWorkspaceCwd:k,setRestoreMode:_,setRestoreSessionNonce:T,setAttachSessionNonce:S,setNewSessionNonce:C}){const N=new Set;function E(){N.clear();for(const[,D]of n.current)D.controller.abort();n.current.clear(),s.current.clear(),v("idle"),jo(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 O(D,j,L){const z=i.current+1;return i.current=z,r.current&&(clearTimeout(r.current.timeout),r.current.reject(new DOMException(`Session ${j} superseded by a newer request`,"AbortError"))),new Promise(($,K)=>{const R=setTimeout(()=>{var Y;((Y=r.current)==null?void 0:Y.id)===z&&(r.current=void 0,K(Xr(w,`${rwe(j)} session failed`,new Error(`Session ${j} timed out`),iwe(j))))},3e4);r.current={id:z,sessionId:D,mode:j,timeout:R,resolve:$,reject:K,...L?{signal:L}:{}}})}function B(D,j,L,z){var I;if(z!=null&&z.aborted)return Promise.reject(new DOMException("Session load cancelled","AbortError"));l.current=!1;const $=O(D,j,z),K=t.current,R=K==null?void 0:K.sessionId,Y=R?n.current.get(R):void 0;(I=Y==null?void 0:Y.reject)==null||I.call(Y,new DOMException("Session switch interrupted prompt wait","AbortError")),R&&n.current.delete(R),g();const W=j==="load"&&R===D;if(K){const M=()=>K.detach().catch(F=>{console.warn("[DaemonSessionActions] detach before session switch failed:",F)});W?(c.current=D,$.then(M,()=>{})):M()}return W||(t.current=void 0),W||y(M=>({...M,status:"connecting",sessionId:D,clientId:void 0,displayName:void 0,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0,catchingUp:void 0})),v("idle"),s.current.clear(),jo(u),W||e.reset(),_(j),x(D),k(L??m().workspaceCwd),T(M=>M+1),$.catch(M=>{throw zb(M)||y(F=>({...F,loadingTranscript:void 0,catchingUp:void 0})),M})}return{async sendPrompt(D,j){var L,z,I,$,K;const R=pi(w,t.current,"Prompt failed","send_prompt"),Y=R.sessionId;if(n.current.has(Y))throw Xr(w,"Prompt failed","A prompt is already in progress","send_prompt");jo(u),v("waiting");const W=new AbortController;n.current.set(Y,{controller:W});try{const M=((j==null?void 0:j.images)??[]).map(U=>({data:U.data,mimeType:U.mimeType||U.mediaType||U.media_type||"image/*"})),F=j!=null&&j.inputAnnotations&&j.inputAnnotations.length>0?j.inputAnnotations:void 0;(j==null?void 0:j.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(D,M,F?{inputAnnotations:F}:void 0);const J={prompt:$F(D,M)};F&&(J._meta={inputAnnotations:F}),j!=null&&j.retry&&(J.retry=!0);const V=await R.submitPrompt(J,W.signal);return((L=n.current.get(Y))==null?void 0:L.controller)===W&&b(Y),(z=j==null?void 0:j.onAdmitted)==null||z.call(j),await Jve(n.current,s.current,Y,W,V.promptId)}catch(M){if(zb(M))return((I=t.current)==null?void 0:I.sessionId)===Y&&e.dispatch({type:"assistant.done",reason:"cancelled"}),{stopReason:"cancelled"};throw $Z(M)?M:((($=t.current)==null?void 0:$.sessionId)===Y&&e.dispatch({type:"assistant.done",reason:"error"}),Xr(w,"Prompt failed",M,"send_prompt"))}finally{const M=n.current.get(Y);(M==null?void 0:M.controller)===W&&n.current.delete(Y),((K=t.current)==null?void 0:K.sessionId)===Y&&!p()&&v("idle")}},async submitPrompt(D,j){var L;const z=pi(w,t.current,"Prompt failed","send_prompt");if(j!=null&&j.sessionId&&z.sessionId!==j.sessionId)throw new Error("Session changed before prompt submission");const I=((j==null?void 0:j.images)??[]).map(Y=>({data:Y.data,mimeType:Y.mimeType||Y.mediaType||Y.media_type||"image/*"})),$=j!=null&&j.inputAnnotations&&j.inputAnnotations.length>0?j.inputAnnotations:void 0;(j==null?void 0:j.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(D,I,$?{inputAnnotations:$}:void 0);const K={prompt:$F(D,I)};$&&(K._meta={inputAnnotations:$}),j!=null&&j.retry&&(K.retry=!0);const R=await z.submitPrompt(K);if((L=j==null?void 0:j.signal)!=null&&L.aborted)throw await z.removePendingPrompt(R.promptId).catch(Y=>{console.warn("[submitPrompt] removePendingPrompt failed after abort",Y),w({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:Y instanceof Error?Y.message:String(Y),recoverable:!0})}),j.signal.reason??new DOMException("Aborted","AbortError");return{promptId:R.promptId}},async cancel(){var D,j;const L=pi(w,t.current,"Cancel failed","cancel_prompt"),z=n.current.get(L.sessionId);z==null||z.controller.abort(),jo(u);const I=z?new AbortController:void 0;I&&n.current.set(L.sessionId,{controller:I});try{await vt(L.cancel(),"Cancel timed out")}catch($){throw Xr(w,"Cancel failed",$,"cancel_prompt")}finally{I&&((D=n.current.get(L.sessionId))==null?void 0:D.controller)===I&&n.current.delete(L.sessionId),((j=t.current)==null?void 0:j.sessionId)===L.sessionId&&!p()&&v("idle")}},async setModel(D){const j=pi(w,t.current,"Set model failed","switch_model");try{const L=await vt(j.setModel(D),"Set model timed out");return y(z=>({...z,currentModel:D})),L}catch(L){throw Xr(w,"Set model failed",L,"switch_model")}},async setApprovalMode(D,j){const L=pi(w,t.current,"Set approval mode failed","set_approval_mode");try{const z=await vt(L.client.setSessionApprovalMode(L.sessionId,D,{persist:j==null?void 0:j.persist,clientId:L.clientId}),"Set approval mode timed out");return y(I=>({...I,currentMode:z.mode||D})),z}catch(z){throw Xr(w,"Set approval mode failed",z,"set_approval_mode")}},async respondToPermission(D,j){const L=pi(w,t.current,"Permission response failed","submit_permission");try{return await vt(L.respondToSessionPermission(D,j),"Permission response timed out")}catch(z){throw Xr(w,"Permission response failed",z,"submit_permission")}},async submitPermission(D,j,L){const z=pi(w,t.current,"Permission response failed","submit_permission"),I=j!==void 0&&j.length>0?{outcome:{outcome:"selected",optionId:j},...L?{answers:L}:{}}:{outcome:{outcome:"cancelled"},...L?{answers:L}:{}};try{return await vt(z.respondToSessionPermission(D,I),"Permission response timed out")}catch($){throw Xr(w,"Permission response failed",$,"submit_permission")}},async heartbeat(){const D=t.current;if(!(!D||!o.current))return vt(D.heartbeat(),"Heartbeat timed out")},async listSessions(D){const j=t.current;if(!j)return[];try{return await vt(j.client.listWorkspaceSessions(j.workspaceCwd,D),"List sessions timed out")}catch(L){throw Xr(w,"List sessions failed",L,"list_sessions")}},async loadSession(D,j){return B(D,"load",j==null?void 0:j.workspaceCwd)},async reloadSession(D){const j=pi(w,t.current,"Reload session failed","load_session");return B(j.sessionId,"load",j.workspaceCwd,D)},async resumeSession(D,j){return B(D,"resume",j==null?void 0:j.workspaceCwd)},async createSession(D){try{l.current=!1;const j={...(D==null?void 0:D.approvalMode)!==void 0?{approvalMode:D.approvalMode}:{},...(D==null?void 0:D.sourceType)!==void 0?{sourceType:D.sourceType}:{},...(D==null?void 0:D.worktree)!==void 0?{worktree:D.worktree}:{},...(D==null?void 0:D.branch)!==void 0?{branch:D.branch}:{}},L=t.current,z=L&&m().sessionId===L.sessionId?L:void 0;if(z){const $=await vt(z.client.createOrAttachSession({...d(),...(D==null?void 0:D.workspaceCwd)!==void 0?{workspaceCwd:D.workspaceCwd}:{},...j}),"Create session timed out");return s4($.clientId,$.sessionId),$}const I=await vt(f(D==null?void 0:D.workspaceCwd,j),"Create session timed out");if(l.current){try{await vt(I.detach(),"Detach cleared session timed out")}catch($){console.warn("[DaemonSessionActions] detach after interrupted create failed:",$)}throw new DOMException("Session creation interrupted","AbortError")}return s4(I.clientId,I.sessionId),t.current=I,c.current=I.sessionId,y($=>({...$,status:"connected",sessionId:I.sessionId,...I.clientId?{clientId:I.clientId}:{},workspaceCwd:I.workspaceCwd,error:void 0,errorStatus:void 0,missingSession:!1})),I}catch(j){throw Xr(w,`Create session failed${D!=null&&D.workspaceCwd?` (workspace: ${D.workspaceCwd})`:""}`,j,"create_session")}},async attachSession(){const D=pi(w,t.current,"Attach session failed","attach_session"),j=O(D.sessionId,"attach");return S(L=>L+1),j},async clearSession(){const D=t.current;if(l.current=!0,E(),t.current=void 0,y(j=>Xve(j,D==null?void 0:D.sessionId)),D)try{await vt(D.detach(),"Clear session timed out")}catch(j){console.warn("[DaemonSessionActions] detach on clear failed:",j)}},async newSession(){l.current=!1,E(),y(D=>({...D,missingSession:!1,error:void 0,errorStatus:void 0})),C(D=>D+1)},async releaseSession(D){try{const j=pi(w,t.current,"Release session failed","release_session");await vt(j.client.closeSession(D),"Release session timed out")}catch(j){throw Xr(w,"Release session failed",j,"release_session")}},async closeSession(){const D=pi(w,t.current,"Close session failed","close_session");try{await vt(D.close(),"Close session timed out")}catch(j){throw Xr(w,"Close session failed",j,"close_session")}},async refreshCommands(){const D=pi(w,t.current,"Refresh commands failed","refresh_commands");try{const j=await vt(D.supportedCommands(),"Refresh commands timed out"),{commands:L,skills:z}=QZ(j);y(I=>({...I,commands:L,skills:z,supportedCommands:j}))}catch(j){throw Xr(w,"Refresh commands failed",j,"refresh_commands")}},async getContext(){const D=pi(w,t.current,"Load context failed","load_context");try{const j=await vt(D.context(),"Load context timed out");return y(L=>({...L,context:j,currentMode:Zve(j)??L.currentMode,currentModel:ewe(j)??L.currentModel})),j}catch(j){throw Xr(w,"Load context failed",j,"load_context")}},async getContextUsage(D){const j=pi(w,t.current,"Load context usage failed","load_context_usage");try{return await vt(j.contextUsage(D),"Load context usage timed out")}catch(L){throw Xr(w,"Load context usage failed",L,"load_context_usage")}},async renameSession(D){const j=pi(w,t.current,"Rename session failed","rename_session");try{return await vt(j.updateMetadata({displayName:D}),"Rename session timed out")}catch(L){throw Xr(w,"Rename session failed",L,"rename_session")}},async recapSession(){const D=pi(w,t.current,"Recap session failed","recap_session");try{return await vt(D.recap(),"Recap session timed out")}catch(j){throw Xr(w,"Recap session failed",j,"recap_session")}},async*generateSessionContent(D,j){yield*pi(w,t.current,"Generate content failed","generate_session_content").generateContent(D,j)},async getRewindSnapshots(){const D=pi(w,t.current,"Load rewind snapshots failed","rewind_snapshots");try{return await vt(D.getRewindSnapshots(),"Load rewind snapshots timed out")}catch(j){throw Xr(w,"Load rewind snapshots failed",j,"rewind_snapshots")}},async rewindSession(D,j){const L=pi(w,t.current,"Rewind session failed","rewind_session");try{return await vt(L.rewind(D,j),"Rewind session timed out")}catch(z){throw Xr(w,"Rewind session failed",z,"rewind_session")}},async btwSession(D,j){var L;const z=pi(w,t.current,"Side question failed","btw_session");try{return await vt(z.btw(D,j),"Side question timed out")}catch(I){throw(L=j==null?void 0:j.signal)!=null&&L.aborted||zb(I)?I:Xr(w,"Side question failed",I,"btw_session")}},async enqueueMidTurnMessage(D,j){const L=t.current;if(!L)return{accepted:!1};try{return await L.enqueueMidTurnMessage(D,j)}catch(z){return z instanceof DOMException&&z.name==="AbortError"||console.debug("[enqueueMidTurnMessage] push failed; kept for next turn",z),{accepted:!1}}},async removeMidTurnMessage(D,j){const L=t.current;if(!L)return{removed:!1};if(j!=null&&j.sessionId&&L.sessionId!==j.sessionId){const z=Kve(j.sessionId)??L.clientId;return await L.client.removeMidTurnMessage(j.sessionId,D,{...z?{clientId:z}:{}})}return await L.removeMidTurnMessage(D)},async getPendingPrompts(D){const j=t.current;if(!j)return{pendingPrompts:[]};if(D!=null&&D.sessionId&&j.sessionId!==D.sessionId)throw new Error("Session changed before pending prompts refresh");return await j.getPendingPrompts()},async removePendingPrompt(D,j){const L=t.current;return L?j!=null&&j.sessionId&&L.sessionId!==j.sessionId?await L.client.removePendingPrompt(j.sessionId,D):await L.removePendingPrompt(D):{removed:!1}},async sendShellCommand(D){var j,L;const z=pi(w,t.current,"Shell command failed","send_shell_command"),I=`${z.sessionId}:shell`;v("waiting");const $=new AbortController;n.current.set(I,{controller:$});try{return await z.shellCommand(D,$.signal)}catch(K){throw Xr(w,"Shell command failed",K,"send_shell_command")}finally{((j=n.current.get(I))==null?void 0:j.controller)===$&&n.current.delete(I),((L=t.current)==null?void 0:L.sessionId)===z.sessionId&&!p()&&v("idle")}},async getTasks(D){const j=t.current;if(!j)throw new Error("Daemon session is not connected");try{return await vt(j.tasks(),"Get tasks timed out")}catch(L){throw L instanceof Error&&L.message==="Daemon session is not connected"||D!=null&&D.silent&&nwe(L)?L:Xr(w,"Get tasks failed",L,"load_tasks",D!=null&&D.silent?{dispatchedNoticeKeys:N,noticeOnceKey:twe("load_tasks",L)}:void 0)}},async cancelTask(D,j){const L=pi(w,t.current,"Cancel task failed","cancel_task");try{return await vt(L.cancelTask(D,j),"Cancel task timed out")}catch(z){throw Xr(w,"Cancel task failed",z,"cancel_task")}},async clearGoal(){const D=pi(w,t.current,"Clear goal failed","clear_goal");try{return await vt(D.clearGoal(),"Clear goal timed out")}catch(j){throw Xr(w,"Clear goal failed",j,"clear_goal")}},async getStats(){const D=pi(w,t.current,"Load stats failed","load_stats");try{return await vt(D.stats(),"Load stats timed out")}catch(j){throw Xr(w,"Load stats failed",j,"load_stats")}},async loadArtifacts(){const D=t.current;if(!D)throw new Error("Daemon session is not connected");return vt(D.artifacts(),"Load artifacts timed out")},async respondToGlobalPermission(D,j){const L=pi(w,t.current,"Global permission response failed","submit_permission");try{return await vt(L.client.respondToPermission(D,j),"Global permission response timed out")}catch(z){throw Xr(w,"Global permission response failed",z,"submit_permission")}},async branchSession(D){const j=pi(w,t.current,"Branch session failed","branch_session");try{const L=await vt(j.client.branchSession(j.sessionId,{name:D},j.clientId),"Branch session timed out");return s4(L.clientId,L.sessionId),B(L.sessionId,"load").catch(z=>{zb(z)||Xr(w,"Branch session failed",z,"branch_session")}),{sessionId:L.sessionId,displayName:L.displayName}}catch(L){throw Xr(w,"Branch session failed",L,"branch_session")}},async forkSession(D){const j=pi(w,t.current,"Fork session failed","fork_session");try{return await vt(j.fork(D),"Fork session timed out")}catch(L){throw Xr(w,"Fork session failed",L,"fork_session")}}}}function Jve(e,t,n,s,r){return new Promise((i,o)=>{const l=z7(n,r),c=t.get(l);if(c){t.delete(l),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 z7(e,t){return JSON.stringify([e,t])}function Zve(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 ewe(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 pi(e,t,n,s){if(!t)throw Xr(e,n,"Daemon session is not connected",s);return t}function Xr(e,t,n,s,r){if(zb(n)){if(n instanceof Error)return n;const c=n instanceof DOMException?n.message:"Aborted",u=new Error(c);return u.name="AbortError",u}const i=n instanceof Error?n.message:String(n),o=r==null?void 0:r.noticeOnceKey,l=r==null?void 0:r.dispatchedNoticeKeys;return(!o||!(l!=null&&l.has(o)))&&(e({severity:"error",category:"user_action",operation:s,code:`daemon.${s}.failed`,message:`${t}: ${i}`,debugMessage:i,recoverable:!0}),o&&(l==null||l.add(o))),swe(n instanceof Error?n:new Error(i))}function twe(e,t){return`${e}:${tee(t)}`}function tee(e){return e instanceof Error?e.message:String(e)}function nwe(e){if(zb(e))return!0;const t=Sk(e);if(t!==void 0)return t>=500||t===408||t===429;const n=tee(e).toLowerCase();return n.includes("timed out")||n.includes("failed to fetch")||n.includes("network error")||n.includes("networkerror")}function zb(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function swe(e){return Object.assign(e,{_alreadyDispatched:!0})}function rwe(e){return e.charAt(0).toUpperCase()+e.slice(1)}function iwe(e){return e==="resume"?"resume_session":e==="attach"?"attach_session":"load_session"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const owe=33e4;function awe({getClient:e,getWorkspaceCwd:t,baseUrl:n,token:s}){return{async listSessions(r){const i=nn(e,"List sessions failed"),o=t();return o?vt(i.listWorkspaceSessionsPage(o,r).then(l=>l.sessions),"List sessions timed out"):[]},async listSessionsPage(r){const i=nn(e,"List sessions failed"),o=t();return o?vt(i.listWorkspaceSessionsPage(o,r),"List sessions timed out"):{sessions:[]}},async listSessionGroups(){const r=nn(e,"List session groups failed"),i=t();return i?vt(r.listSessionGroups(i),"List session groups timed out"):{groups:[],colorOptions:[]}},async createSessionGroup(r){const i=nn(e,"Create session group failed"),o=r4(t);return vt(i.createSessionGroup(o,r),"Create session group timed out")},async updateSessionGroup(r,i){const o=nn(e,"Update session group failed"),l=r4(t);return vt(o.updateSessionGroup(l,r,i),"Update session group timed out")},async deleteSessionGroup(r){const i=nn(e,"Delete session group failed"),o=r4(t);return vt(i.deleteSessionGroup(o,r),"Delete session group timed out")},async updateSessionOrganization(r,i){const o=nn(e,"Update session organization failed");return vt(o.updateSessionOrganization(r,i),"Update session organization timed out")},async deleteSession(r){const i=nn(e,"Delete session failed"),o=await vt(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=nn(e,"Delete sessions failed");return vt(i.deleteSessionsData(r),"Delete sessions timed out")},async exportSession(r,i="html"){const o=nn(e,"Export session failed");return vt(o.exportSession(r,{format:i}),"Export session timed out")},async archiveSession(r){const i=nn(e,"Archive session failed"),o=await vt(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=nn(e,"Unarchive session failed"),o=await vt(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=nd(e,t,"Load channels failed"),[i,o]=await vt(Promise.all([r.workspaceChannelTypes(),r.workspaceChannels()]),"Load channels timed out");return{catalog:i,snapshot:o}},async upsertChannel(r,i){return nd(e,t,"Update channel failed").upsertWorkspaceChannel(r,i)},async removeChannel(r,i){return nd(e,t,"Remove channel failed").deleteWorkspaceChannel(r,i)},async setChannelStartup(r,i){return nd(e,t,"Update channel startup failed").setWorkspaceChannelStartup(r,i)},async startChannel(r){return nd(e,t,"Start channel failed").startWorkspaceChannel(r)},async stopChannel(r){return nd(e,t,"Stop channel failed").stopWorkspaceChannel(r)},async restartChannel(r){return nd(e,t,"Restart channel failed").restartWorkspaceChannel(r)},channelPairing:{async list(r){const i=nd(e,t,"Load channel pairing requests failed");return vt(i.workspaceChannelPairingRequests(r),"Load channel pairing requests timed out")},async approve(r,i){return nd(e,t,"Approve channel pairing failed").approveWorkspaceChannelPairing(r,{code:i})},async approvals(r){const i=nd(e,t,"Load channel pairing approvals failed");return vt(i.workspaceChannelPairingApprovals(r),"Load channel pairing approvals timed out")},async revoke(r,i){return nd(e,t,"Revoke channel pairing approval failed").revokeWorkspaceChannelPairingApproval(r,{senderId:i})}},async loadMcpStatus(){const r=nn(e,"Load MCP status failed");return vt(r.workspaceMcp(),"Load MCP status timed out")},async initializeMcp(){const r=nn(e,"Initialize MCP failed");return vt(r.initializeWorkspaceMcp(),"Initialize MCP timed out")},async reloadMcp(){const r=nn(e,"Reload MCP failed");return vt(r.reloadWorkspaceMcp(),"Reload MCP timed out")},async loadMcpTools(r){const i=nn(e,"Load MCP tools failed");try{return await vt(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=nn(e,"Load MCP resources failed");try{return await vt(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=nn(e,"Restart MCP server failed");return vt(i.restartMcpServer(r),"Restart MCP server timed out",5*6e4)},async manageMcpServer(r,i){const o=nn(e,"Manage MCP server failed"),l=i==="authenticate"?10*6e4:5*6e4;return vt(o.manageMcpServer(r,i),"Manage MCP server timed out",l)},async addRuntimeMcpServer(r){const i=nn(e,"Add MCP server failed");return vt(i.addRuntimeMcpServer(r),"Add MCP server timed out",5*6e4)},async removeRuntimeMcpServer(r){const i=nn(e,"Remove MCP server failed");return vt(i.removeRuntimeMcpServer(r),"Remove MCP server timed out",5*6e4)},async loadDaemonStatus(r){const i=nn(e,"Load daemon status failed");return vt(i.daemonStatus(r),"Load daemon status timed out")},async loadUsageDashboard(r){const i=nn(e,"Load usage dashboard failed");return vt(i.usageDashboard(r),"Load usage dashboard timed out")},async loadSkillsStatus(){const r=nn(e,"Load skills failed");return vt(r.workspaceSkills(),"Load skills timed out")},async setWorkspaceSkillEnabled(r,i){const o=nn(e,"Set skill enabled failed");return vt(o.setWorkspaceSkillEnabled(r,i),"Set skill enabled timed out")},async installWorkspaceSkill(r){const i=nn(e,"Install skill failed");return vt(i.installWorkspaceSkill(r),"Install skill timed out")},async deleteWorkspaceSkill(r,i){const o=nn(e,"Delete skill failed");return vt(o.deleteWorkspaceSkill(r,i),"Delete skill timed out")},async loadExtensionsStatus(){const r=nn(e,"Load extensions failed");return vt(r.workspaceExtensions(),"Load extensions timed out")},async loadToolsStatus(){const r=nn(e,"Load tools failed");return vt(r.workspaceTools(),"Load tools timed out")},async preheatAcp(r){const i=nn(e,"Preheat ACP failed");return vt(i.workspaceAcpPreheat(r),"Preheat ACP timed out",r===void 0?void 0:r+2e3)},async setWorkspaceToolEnabled(r,i){const o=nn(e,"Set tool enabled failed");return vt(o.setWorkspaceToolEnabled(r,i),"Set tool enabled timed out")},async loadSettingsStatus(){const r=nn(e,"Load settings failed");return vt(r.workspaceSettings(),"Load settings timed out")},async setWorkspaceSetting(r,i,o,l){const c=nn(e,"Set setting failed");return vt(c.setWorkspaceSetting(r,i,o,l),"Set setting timed out")},async loadMemoryStatus(){const r=nn(e,"Load memory failed");return vt(r.workspaceMemory(),"Load memory timed out")},async readWorkspaceFile(r){const i=nn(e,"Read workspace file failed");return vt(i.readWorkspaceFile(r),"Read workspace file timed out")},async writeMemory(r){const i=nn(e,"Write memory failed");return vt(i.writeWorkspaceMemory(r),"Write memory timed out")},async*generateContent(r,i){yield*nn(e,"Generate content failed").generateWorkspaceContent(r,{signal:i==null?void 0:i.signal})},async listAgents(){const r=nn(e,"List agents failed");return vt(r.listWorkspaceAgents(),"List agents timed out")},async getAgent(r,i){const o=nn(e,"Get agent failed");return vt(o.getWorkspaceAgent(r,i?{scope:i}:{}),"Get agent timed out")},async createAgent(r){const i=nn(e,"Create agent failed");return vt(i.createWorkspaceAgent(r),"Create agent timed out")},async generateAgent(r){const i=nn(e,"Generate agent failed");return vt(i.generateWorkspaceAgent(r),"Generate agent timed out",owe)},async deleteAgent(r,i){const o=nn(e,"Delete agent failed");return vt(o.deleteWorkspaceAgent(r,i?{scope:i}:{}),"Delete agent timed out")},async globWorkspace(r,i){nn(e,"Glob workspace failed");const o=Ld(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 l=await vt(fetch(Pd(o,n),{headers:J1(s)}),"Glob workspace timed out");if(!l.ok)throw new Error(await Od(l,"GET /glob"));const c=await l.json();return{matches:Array.isArray(c.matches)?c.matches.filter(u=>typeof u=="string"):[]}},async loadProviders(){const r=nn(e,"Load providers failed");return vt(r.workspaceProviders(),"Load providers timed out")},async readFileBytes(r,i){const o=nn(e,"Read file bytes failed");return vt(o.readWorkspaceFileBytes(r,i??{}),"Read file bytes timed out")},async writeFile(r){const i=nn(e,"Write file failed");return vt(i.writeWorkspaceFile(r),"Write file timed out")},async editFile(r){const i=nn(e,"Edit file failed");return vt(i.editWorkspaceFile(r),"Edit file timed out")},async stat(r){nn(e,"Stat file failed");const i=Ld(n,"/stat");i.searchParams.set("path",r);const o=await vt(fetch(Pd(i,n),{headers:J1(s)}),"Stat file timed out");if(!o.ok)throw new Error(await Od(o,"GET /stat"));return await o.json()},async listDirectory(r){nn(e,"List directory failed");const i=Ld(n,"/list");i.searchParams.set("path",r);const o=await vt(fetch(Pd(i,n),{headers:J1(s)}),"List directory timed out");if(!o.ok)throw new Error(await Od(o,"GET /list"));return await o.json()},async listScheduledTasks(r){nn(e,"List scheduled tasks failed");const i=Mw(r),o=Ld(n,i),l=await vt(fetch(Pd(o,n),{headers:J1(s)}),"List scheduled tasks timed out");if(!l.ok)throw new Error(await Od(l,`GET ${i}`));const c=await l.json();return Array.isArray(c.tasks)?c.tasks:[]},async createScheduledTask(r,i){nn(e,"Create scheduled task failed");const o=Mw(i),l=Ld(n,o),c=await vt(fetch(Pd(l,n),{method:"POST",headers:b2(s),body:JSON.stringify(r)}),"Create scheduled task timed out");if(!c.ok)throw new Error(await Od(c,`POST ${o}`));return await c.json()},async updateScheduledTask(r,i,o){nn(e,"Update scheduled task failed");const l=Mw(o,`/${encodeURIComponent(r)}`),c=Ld(n,l),u=await vt(fetch(Pd(c,n),{method:"PATCH",headers:b2(s),body:JSON.stringify(i)}),"Update scheduled task timed out");if(!u.ok)throw new Error(await Od(u,`PATCH ${l}`));return await u.json()},async runScheduledTask(r,i){nn(e,"Run scheduled task failed");const o=Mw(i,`/${encodeURIComponent(r)}/run`),l=Ld(n,o),c=await vt(fetch(Pd(l,n),{method:"POST",headers:b2(s)}),"Run scheduled task timed out");if(!c.ok)throw new Error(await Od(c,`POST ${o}`));return await c.json()},async deleteScheduledTask(r,i){nn(e,"Delete scheduled task failed");const o=Mw(i,`/${encodeURIComponent(r)}`),l=Ld(n,o),c=await vt(fetch(Pd(l,n),{method:"DELETE",headers:J1(s)}),"Delete scheduled task timed out");if(!c.ok)throw new Error(await Od(c,`DELETE ${o}`))},async listGoals(){nn(e,"List goals failed");const r=Ld(n,"/goals"),i=await vt(fetch(Pd(r,n),{headers:J1(s)}),"List goals timed out");if(!i.ok)throw new Error(await Od(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){nn(e,"Clear goal failed");const i=Ld(n,`/session/${encodeURIComponent(r)}/goal/clear`),o=await vt(fetch(Pd(i,n),{method:"POST",headers:b2(s),body:"{}"}),"Clear goal timed out");if(!o.ok)throw new Error(await Od(o,`POST /session/${r}/goal/clear`));return await o.json()},async loadEnv(){const r=nn(e,"Load env failed");return vt(r.workspaceEnv(),"Load env timed out")},async loadPreflight(){const r=nn(e,"Load preflight failed");return vt(r.workspacePreflight(),"Load preflight timed out")},async initWorkspace(r){const i=nn(e,"Init workspace failed");return vt(i.initWorkspace(r),"Init workspace timed out")},async updateAgent(r,i,o){const l=nn(e,"Update agent failed");return vt(l.updateWorkspaceAgent(r,i,o?{scope:o}:{}),"Update agent timed out")},async installExtension(r,i){const o=nn(e,"Install extension failed");return vt(o.installExtension(r,i),"Install extension timed out")},async extensionOperationStatus(r){const i=nn(e,"Load extension operation failed");return vt(i.extensionOperationStatus(r),"Load extension operation timed out")},async activeExtensionOperations(){const r=nn(e,"Load active extension operations failed");return vt(r.activeExtensionOperations(),"Load active extension operations timed out")},async respondToExtensionInteraction(r,i,o,l){const c=nn(e,"Respond to extension interaction failed");return vt(c.respondToExtensionInteraction(r,i,o,l),"Respond to extension interaction timed out")},async checkExtensionUpdates(r){const i=nn(e,"Check extension updates failed");return vt(i.checkExtensionUpdates(r),"Check extension updates timed out")},async refreshExtensions(r){const i=nn(e,"Refresh extensions failed");return vt(i.refreshExtensions(r),"Refresh extensions timed out")},async enableExtension(r,i,o){const l=nn(e,"Enable extension failed");return vt(l.enableExtension(r,i,o),"Enable extension timed out")},async disableExtension(r,i,o){const l=nn(e,"Disable extension failed");return vt(l.disableExtension(r,i,o),"Disable extension timed out")},async updateExtension(r,i){const o=nn(e,"Update extension failed");return vt(o.updateExtension(r,i),"Update extension timed out")},async uninstallExtension(r,i){const o=nn(e,"Uninstall extension failed");return vt(o.uninstallExtension(r,i),"Uninstall extension timed out")},async startDeviceFlow(r){const i=nn(e,"Start device flow failed");return vt(i.startDeviceFlow({providerId:r}),"Start device flow timed out")},async getDeviceFlow(r,i){const o=nn(e,"Get device flow failed");return vt(o.getDeviceFlow(r,i),"Get device flow timed out")},async cancelDeviceFlow(r){const i=nn(e,"Cancel device flow failed");return vt(i.cancelDeviceFlow(r),"Cancel device flow timed out")},async getAuthStatus(){const r=nn(e,"Get auth status failed");return vt(r.getAuthStatus(),"Get auth status timed out")},async getAuthProviders(){const r=nn(e,"Get auth providers failed");return vt(r.getAuthProviders(),"Get auth providers timed out")},async installAuthProvider(r){const i=nn(e,"Install auth provider failed");return vt(i.installAuthProvider(r),"Install auth provider timed out")},async deleteModel(r){const i=nn(e,"Delete model failed");return vt(i.deleteModel(r),"Delete model timed out")},async addWorkspace(r,i){const o=nn(e,"Add workspace failed");return vt(o.addWorkspace(r,i),"Add workspace timed out")},async addScratchWorkspace(){const r=nn(e,"Add scratch workspace failed");return vt(r.addScratchWorkspace(),"Add scratch workspace timed out")},async suggestWorkspacePaths(r){const i=nn(e,"Suggest workspace paths failed");return await vt(i.workspacePathSuggestions(r),"Suggest workspace paths timed out")},async pickWorkspaceDirectory(){const r=nn(e,"Open directory picker failed");return await vt(r.workspaceDirectoryPicker(),"Open directory picker timed out",32e4)},async updateWorkspace(r,i){const o=nn(e,"Update workspace failed");return vt(o.updateWorkspace(r,i),"Update workspace timed out")},async removeWorkspace(r,i){const l=nn(e,"Remove workspace failed").workspaceById(r).remove(i);return(i==null?void 0:i.timeoutMs)===0?l:vt(l,"Remove workspace timed out",i==null?void 0:i.timeoutMs)}}}function nn(e,t){const n=e();if(!n)throw new Error(`${t}: DaemonClient is not connected`);return n}function r4(e){const t=e();if(!t)throw new Error("Daemon workspace is not connected");return t}function nd(e,t,n){return nn(e,n).workspaceByCwd(r4(t))}function Mw(e,t=""){return e?`/workspaces/${encodeURIComponent(e)}/scheduled-tasks${t}`:`/scheduled-tasks${t}`}function J1(e){const t={};return e&&(t.Authorization=`Bearer ${e}`),t}function b2(e){const t={"Content-Type":"application/json"};return e&&(t.Authorization=`Bearer ${e}`),t}function Ld(e,t){const n=nee(e),s=typeof window>"u"?"http://localhost":window.location.origin;return new URL(`${n}${t}`,s)}function Pd(e,t){return nee(t)?e.toString():`${e.pathname}${e.search}`}function nee(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 Od(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 J9=h.createContext(void 0);let Rw;function lwe({baseUrl:e,token:t,workspaceCwd:n,autoConnect:s=!0,transport:r,children:i}){const o=h.useMemo(()=>s?new M7({baseUrl:e,token:t,transport:r}):void 0,[s,e,t,r]),l=h.useRef(o);l.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"),[w,y]=h.useState(void 0),v=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(S=>{throw u.current===T&&(u.current=void 0),S});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,S=()=>{const N=u.current;return c.current===o&&N&&d.current!==T?N:Promise.reject(new Error("Capabilities refresh was superseded by a client change"))},C=o.capabilities().then(N=>c.current!==o||d.current!==T?S():(p(N),b("connected"),y(void 0),N),N=>{if(c.current!==o||d.current!==T)return S();throw y(N instanceof Error?N:new Error(String(N))),b("error"),N});return u.current=C,C},[o]);h.useEffect(()=>{if(!o)return;b("connecting"),y(void 0),p(void 0),Rw===o&&(Rw=void 0);let T=!1;const S=v();return S.then(C=>{!T&&c.current===o&&u.current===S&&(p(C),b("connected"))}).catch(C=>{!T&&c.current===o&&u.current===S&&(y(C instanceof Error?C:new Error(String(C))),b("error"))}),()=>{T=!0,Rw=o,queueMicrotask(()=>{Rw===o&&(Rw=void 0,o.dispose())})}},[o,v]),f.current=(m==null?void 0:m.workspaceCwd)??n;const k=h.useMemo(()=>awe({getClient:()=>l.current,getWorkspaceCwd:()=>f.current,baseUrl:e,token:t}),[e,t]),_=h.useMemo(()=>{if(o)return{client:o,token:t,baseUrl:e,workspaceCwd:(m==null?void 0:m.workspaceCwd)??n,status:g,error:w,capabilities:m,getCapabilities:v,refreshCapabilities:x,actions:k}},[o,t,e,n,g,w,m,v,x,k]);return a.jsx(J9.Provider,{value:_,children:i})}function Co(){const e=h.useContext(J9);if(!e)throw new Error("useDaemonWorkspace must be used within DaemonWorkspaceProvider");return e}function Qo(){return Co().actions}function see(){return h.useContext(J9)}function cwe(e){if(e.length===0)return"idle";const t=e[e.length-1];if((t==null?void 0:t.kind)==="thought"&&zF(t))return"thinking";if((t==null?void 0:t.kind)==="assistant"&&zF(t)||(t==null?void 0:t.kind)==="tool"&&FF(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"&&FF(s))return"responding"}return"idle"}function uwe(e,t){const n=cwe(e);return t==="idle"?"idle":n!=="idle"||t===void 0?n:t==="waiting"?"waiting":"responding"}function zF(e){return e.streaming===!0}function FF(e){return e.status==="running"||e.status==="in_progress"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const F7=new Set;let vT;function qF(){return vT}function dwe(e){return F7.add(e),()=>{F7.delete(e)}}function hwe(e){vT={...e},ree()}function y2(){vT!==void 0&&(vT=void 0,ree())}function ree(){for(const e of F7)e()}function fwe(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 q7=new Set,iee=Object.freeze([]),K8=64;let np=iee;function HF(){return np}function mwe(e){return q7.add(e),()=>{q7.delete(e)}}function pwe(e){const t=[...np,{sessionId:e.sessionId,messages:[...e.messages],...e.messageIds?{messageIds:[...e.messageIds]}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{}}];if(t.length>K8){const n=t.length-K8;console.debug(`[mid-turn] sidechannel buffer over ${K8}; evicting ${n} oldest batch(es)`),np=t.slice(n)}else np=t;oee()}function gwe(e){if(e.length===0||np.length===0)return;const t=new Set(e),n=np.filter(s=>!t.has(s));n.length!==np.length&&(np=n.length===0?iee:n,oee())}function oee(){for(const e of q7)e()}function bwe(e){if(!e||typeof e!="object")return;const t=e;if(t.type!==BZ)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(d=>typeof d=="string"&&d.length>0);if(o.length===0)return;const l=s.messageIds,c=Array.isArray(l)&&l.length===i.length&&o.length===i.length&&l.every(d=>typeof d=="string"&&d.length>0)?l:void 0,u=t.originatorClientId;return{sessionId:r,messages:o,...c?{messageIds:c}:{},...typeof u=="string"?{originatorClientId:u}:{}}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const H7=new Set,U7=new Set;let aee=0,ny=[];function ywe(){return aee}function UF(){return ny}function vwe(e){return H7.add(e),()=>{H7.delete(e)}}function wwe(e){return U7.add(e),()=>{U7.delete(e)}}function xwe(){aee++;for(const e of H7)try{e()}catch(t){console.error("[pendingPromptVersion] listener error",t)}}function lee(){for(const e of U7)try{e()}catch(t){console.error("[pendingPromptEvents] listener error",t)}}function kwe(e){if(e.length===0)return;const t=new Set(e),n=ny.filter(s=>!t.has(s));n.length!==ny.length&&(ny=n,lee())}function _we(e){const t=cee(e);return t?(ny=[...ny,t].slice(-200),lee(),(t.type===F9||t.type===q9||t.type===H9)&&xwe(),!0):!1}function Swe(e){return cee(e)!==void 0}function cee(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===F9||n===q9||n===H9)&&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 uee=[404,410],Cwe=new Set(uee);function zx(e){return e!==void 0&&Cwe.has(e)}function $d(e,t){return zx(t)&&!zx(e)?t:e}const WF="session_transcript_pagination",Twe="workspace_acp_preheat",Ewe="workspace_acp_status";function Fm(e,t){const n=qZ(e);return{type:"assistant.done",reason:t,eventId:e.id,...n!==void 0?{serverTimestamp:n}:{}}}function Y8(e){if(e.type==="history_truncated")try{return Mo(e.data)?$u(e.data,"recordId"):void 0}catch{return}if(e.type==="session_update")try{if(!Mo(e.data))return;const t=e.data.update,n=Mo(t)?t._meta:e.data._meta;return Mo(n)?$u(n,"qwen.session.recordId"):void 0}catch{return}}function dee(e){return e.type==="history_truncated"&&Mo(e.data)&&e.data.fullTranscriptAvailable===!0}function Awe(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=B7({maxBlocks:Number.MAX_SAFE_INTEGER,nextOrdinal:s.nextOrdinal,retainSubagentBlocks:s.retainSubagentBlocks});o.dispatch(i);const l=o.getSnapshot();return l.blocks.length+s.blocks.length>n?!1:(e.reset({...s,blocks:[...l.blocks,...s.blocks],nextOrdinal:l.nextOrdinal,toolBlockByCallId:{...l.toolBlockByCallId,...s.toolBlockByCallId},permissionBlockByRequestId:{...l.permissionBlockByRequestId,...s.permissionBlockByRequestId}}),!0)}function Tm(e,t){if(!(typeof e!="string"||e.length===0))return e.length<=t?e:`${e.slice(0,t)}…`}function jwe(e){var t;const n=Mo(e.rawInput)?e.rawInput:void 0,s=Mo(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=Mo(s==null?void 0:s.executionSummary)?s.executionSummary:void 0,l=Tm(n==null?void 0:n.subagent_type,120),c=Tm(n==null?void 0:n.prompt,240),u=Tm(n==null?void 0:n.description,240),d=typeof(n==null?void 0:n.todo_id)=="string"?n.todo_id:void 0,f=Tm(s==null?void 0:s.subagentName,120),m=Tm(s==null?void 0:s.subagentColor,80),p=Tm(s==null?void 0:s.taskDescription,240),g=Tm(s==null?void 0:s.status,80),b=Tm(s==null?void 0:s.terminateReason,240),w=n?{...l?{subagent_type:l}:{},...c?{prompt:c}:{},...u?{description:u}:{},...d?{todo_id:d}:{},...n.run_in_background===!0?{run_in_background:!0}:{}}:void 0,y=s?{...s.type==="task_execution"?{type:"task_execution"}:{},...f?{subagentName:f}:{},...m?{subagentColor:m}:{},...p?{taskDescription:p}:{},...g?{status:g}:{},...b?{terminateReason:b}:{},...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,...w&&Object.keys(w).length>0?{rawInput:w}:{rawInput:void 0},...y&&Object.keys(y).length>0?{rawOutput:y}:{rawOutput:void 0},content:void 0,details:void 0}}function X8(e){const t=[];for(const n of e)"parentToolCallId"in n&&n.parentToolCallId&&n.type!=="assistant.usage"||t.push(n.type==="tool.update"?jwe(n):n);return t}const hee=h.createContext(void 0),fee=h.createContext(void 0),Z9=h.createContext(void 0),mee=h.createContext(void 0),pee=h.createContext(void 0),gee=h.createContext(void 0),bee=h.createContext(void 0),eD=new Set([401,403]),Nwe=new Set([...eD,...uee]),Iwe=2e5,Mwe={memoryVersion:0,agentsVersion:0,toolsVersion:0,settingsVersion:0,mcpVersion:0,extensionsVersion:0,artifactsVersion:0,initVersion:0,authVersion:0},Rwe=Symbol("unhandled session");function m5(e){const{baseUrl:t,token:n,workspaceCwd:s,sessionId:r,clientId:i,createSessionRequest:o,maxQueued:l=1024,maxBlocks:c=Iwe,historyPageSize:u,subagentTranscriptMode:d="full",suppressOwnUserEcho:f=!0,includeRawEvent:m=!1,autoConnect:p=!0,autoReconnect:g=!0,restartEventStreamOnPrompt:b=!1,reconnectDelayMs:w=1e3,maxReconnectDelayMs:y=1e4,heartbeatIntervalMs:v=3e4,heartbeatFailureThreshold:x=3,loadWarnings:k,children:_}=e,T=see(),S=t??(T==null?void 0:T.baseUrl),C=n??(T==null?void 0:T.token),N=s??(T==null?void 0:T.workspaceCwd),E=h.useRef(T==null?void 0:T.client);E.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 B=h.useRef(T==null?void 0:T.getCapabilities);B.current=T==null?void 0:T.getCapabilities;const D=h.useRef(!1),L=h.useRef(r).current,z=L===void 0,I=h.useRef(N);I.current=N;const $=h.useRef(N);N&&($.current=N);const K=h.useMemo(()=>B7({maxBlocks:c,retainSubagentBlocks:d==="full"}),[c,d]),R=h.useRef(void 0),Y=h.useRef({hasMore:!1,loading:!1,capacityReached:!1,paginationError:!1}),[W,M]=h.useState({hasMore:!1,loading:!1,capacityReached:!1,paginationError:!1}),F=h.useRef(void 0),J=h.useRef(void 0),V=h.useRef(new Map),U=h.useRef(new Map),le=h.useRef(void 0),pe=h.useRef(0),fe=h.useRef(void 0),Q=h.useRef(!1),ne=h.useRef({consecutiveFailures:0}),de=h.useRef(!1),ue=h.useRef(void 0),me=h.useRef(new WeakSet),te=h.useRef({suppressOwnUserEcho:f,includeRawEvent:m}),ae=h.useRef({reconnectDelayMs:w,maxReconnectDelayMs:y}),be=h.useRef(k),se=h.useRef(u),ve=h.useRef(d),ze=h.useRef(void 0);(!ze.current||i)&&(ze.current=V8(i)),te.current={suppressOwnUserEcho:f,includeRawEvent:m},ae.current={reconnectDelayMs:w,maxReconnectDelayMs:y},be.current=k,se.current=u,ve.current=d;const Pe=o==null?void 0:o.modelServiceId,_t=o==null?void 0:o.sessionScope,Pt=h.useRef(o);Pt.current=o;const[St,he]=h.useState("idle"),[Ae,rt]=h.useState(L),[dt,jt]=h.useState(void 0),[et,Mt]=h.useState("load"),[sn,Ye]=h.useState(0),[$n,Te]=h.useState(0),[ie,it]=h.useState(0),[we,We]=h.useState({status:p?"connecting":"idle",...L?{sessionId:L}:{}}),ce=h.useRef(we);ce.current=we,h.useEffect(()=>{T!=null&&T.capabilities&&We(lt=>lt.capabilities===T.capabilities?lt:{...lt,capabilities:T.capabilities})},[T==null?void 0:T.capabilities]);const De=h.useRef(0),[ct,qe]=h.useState([]),Ve=h.useCallback(lt=>{const Xe={...lt,id:lt.id??`daemon-notice-${Date.now()}-${++De.current}`,createdAt:lt.createdAt??Date.now()};return qe(ot=>ot.some(Tt=>Tt.id===Xe.id)?ot:[...ot.slice(-49),Xe]),Xe},[]),Qt=h.useCallback(lt=>{qe(Xe=>Xe.filter(ot=>ot.id!==lt))},[]),Un=h.useCallback(()=>{qe([])},[]),Ie=h.useMemo(()=>({notices:ct,dismissNotice:Qt,clearNotices:Un}),[Un,Qt,ct]),[wt,Wt]=h.useState(Mwe),Me=h.useRef(()=>!1),Je=h.useRef(!1);h.useEffect(()=>(Je.current=!0,()=>{Je.current=!1}),[]),h.useEffect(()=>{var lt;if(!p)return;if(!E.current&&!S){We({status:"error",error:"DaemonSessionProvider requires a baseUrl prop or an ancestor DaemonWorkspaceProvider."});return}const Xe=new AbortController;let ot=!1;const Tt=et==="load"&&Ae!==void 0&&Ae===((lt=R.current)==null?void 0:lt.sessionId)&&Ae===ue.current;let fn=[],Qn;const Os=()=>{if(Qn=void 0,fn.length===0)return;const mn=fn;fn=[];try{K.dispatch(mn)}catch(gt){console.error("[DaemonSessionProvider] batched transcript dispatch failed",{eventCount:mn.length,error:gt})}},rr=()=>{Qn!==void 0&&(clearTimeout(Qn),Qn=void 0)},Es=mn=>{if(mn.length!==0){for(const gt of mn)fn.push(gt);Qn===void 0&&(Qn=setTimeout(Os,0))}},cs=()=>{rr(),Os()},$t=mn=>{cs(),K.dispatch(mn)},xs=()=>{rr(),fn=[]};return(async()=>{var mn,gt,wn,Wn,di,$s,Gr,Gs,Ks,Qr,Rt,Ii,uo,Or,hi;const us=E.current??new M7({baseUrl:S,token:C});let Jt,Ys,Bs=Ae,ho=!Ae&&ie>0,Si=0,si=!1,pr=()=>!1,xe=!1;for(;!ot&&!Xe.signal.aborted;){const Ge=si;si=!1;let tt=!1,Zt,Tn;const Gn=()=>{Tn==null||Tn(),Tn=void 0,F.current===Zt&&(F.current=void 0)};try{let vs=!1,$r=!1,Xs=!1,fs=!1,ks,gr;if(!Jt){const X=R.current;X&&!Ae&&!Bs&&!ho&&(Jt=X,Bs=X.sessionId,J.current=X.sessionId,fs=!0)}if(!Jt){Tt||We(Zs=>({...Zs,status:"connecting",error:void 0,errorStatus:$d(void 0,Zs.errorStatus)}));const X=B.current,ge=O.current??(X?await X():await us.capabilities());if(ot||Xe.signal.aborted)return;Ys=ge;const Le=Array.isArray(ge.features)&&ge.features.includes(WF);Q.current=Array.isArray(ge.features)&&ge.features.includes("client_heartbeat");const Ze=dt??I.current??ge.workspaceCwd;$.current=Ze;const Bt=Array.isArray(ge.features)?ge.features:[],Et=Ze===ge.workspaceCwd&&Bt.includes(Twe),In=Et&&Bt.includes(Ewe);if((z||de.current)&&!Ae&&!Bs&&!ho){const[Zs,mo,ba,po]=await Promise.allSettled([us.workspaceProviders(),us.workspaceSkills(),In?us.workspaceAcpStatus():Promise.resolve(void 0),Ze?us.workspaceByCwd(Ze).workspaceGit():us.workspaceGit()]);Zs.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceProviders failed in deferred connect:",Zs.reason),mo.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceSkills failed in deferred connect:",mo.reason),In&&ba.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceAcpStatus failed in deferred connect:",ba.reason);const er=Zs.status==="fulfilled"?Zs.value:void 0,Gi=LF(er),{commands:Ar,skills:fi}=PF(mo.status==="fulfilled"?mo.value:void 0),ou=mo.status==="rejected"||de.current&&Ar.length===0;We(Ci=>({...Ci,status:"connected",workspaceCwd:Ze,gitBranch:po.status==="fulfilled"?po.value.branch??void 0:void 0,models:Gi.models,currentModel:Gi.currentModel,currentMode:Gi.currentMode,contextWindow:Gi.contextWindow,providers:er,capabilities:ge,commands:ou?Ci.commands:Ar,skills:ou?Ci.skills:fi})),Et&&!(ba.status==="fulfilled"&&((mn=ba.value)==null?void 0:mn.channelLive)===!0)&&!D.current&&(D.current=!0,(async()=>{try{const Ci=await us.workspaceAcpPreheat(5e3);if(ot||Xe.signal.aborted||!Ci.ready||ce.current.sessionId)return;const xt=await us.workspaceSkills();if(ot||Xe.signal.aborted||ce.current.sessionId)return;const{commands:vn,skills:Xn}=PF(xt);We(xn=>xn.sessionId?xn:{...xn,commands:vn,skills:Xn})}catch(Ci){console.warn("[DaemonSessionProvider] ACP preheat for workspace skills failed:",Ci)}finally{D.current=!1}})());return}const ms=Ae&&et==="resume"?Nw.resume:Nw.load,as=Ae??Bs,ps=i?ze.current:V8(void 0,as);tt=!!Ae,as&&!Tt&&We(Zs=>({...Zs,sessionId:as,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0}));const En=((gt=le.current)==null?void 0:gt.sessionId)===as?le.current:void 0,Ln=Ae?await ms(us,Ae,{workspaceCwd:Ze,...Le&&et==="load"&&se.current!==void 0?{historyPageSize:se.current}:{}},ps):Bs?await Nw.load(us,Bs,{workspaceCwd:Ze,...Le&&se.current!==void 0?{historyPageSize:se.current}:{}},ps):await Nw.createOrAttach(us,{...Pe!==void 0?{modelServiceId:Pe}:{},...ho?{sessionScope:"thread"}:_t!==void 0?{sessionScope:_t}:{},workspaceCwd:Ze},ps);if(tt=!1,!i&&Ln.clientId&&(ze.current=Ln.clientId,s4(Ln.clientId,Ln.sessionId)),ot||Xe.signal.aborted){BF({baseUrl:S,token:C,sessionId:Ln.sessionId,clientId:Ln.clientId}).catch(Zs=>console.warn("[DaemonSessionProvider] detach failed:",Zs));return}if(Tt&&(En==null?void 0:En.sessionId)===Ln.sessionId&&((wn=En.signal)!=null&&wn.aborted||le.current!==En)){const Zs=R.current;if(Ln!==Zs&&await Ln.detach().catch(mo=>{console.warn("[DaemonSessionProvider] detach cancelled reload failed:",mo)}),le.current===En&&(le.current=void 0,clearTimeout(En.timeout),En.reject(new DOMException("Session load cancelled","AbortError"))),ue.current===Ln.sessionId&&(ue.current=void 0),tt=!1,(Zs==null?void 0:Zs.sessionId)===Ln.sessionId){Jt=Zs,Bs=Zs.sessionId,Si=0,si=!0;continue}return}const gs=J.current;gs!==Ln.sessionId&&Un(),gs!==void 0&&Ln.sessionId!==gs?(he("idle"),jo(fe),Xs=!0):gs!==void 0&&(Ln.replaySnapshot.compactedReplay.length+Ln.replaySnapshot.liveJournal.length>0?(he("idle"),jo(fe),Xs=!0):(K.dispatch({type:"assistant.done",reason:"reconnected"}),K.getSnapshot().awaitingResync&&K.clearAwaitingResync())),vs=gs!==void 0&&gs===Ln.sessionId,$r=Ln.replaySnapshot.compactedReplay.length>0||Ln.replaySnapshot.liveJournal.length>0;const jl=[...Ln.replaySnapshot.compactedReplay,...Ln.replaySnapshot.liveJournal];ks=zve(jl),gr=X9(ks),Jt=Ln,Bs=Jt.sessionId,ho=!1,J.current=Jt.sessionId,R.current=Jt}const Vt=Jt,Sr=me.current.has(Vt);let ir=Vt.hasActivePrompt===!0&&!Sr;const Ot=()=>{me.current.add(Vt),ir=!1},Ns=()=>ir||V.current.has(Vt.sessionId);pr=Ns,Me.current=Ns,he(Ns()?"streaming":"idle");const Qs=le.current,Cr=(Qs==null?void 0:Qs.sessionId)===Vt.sessionId?Qs:void 0,{compactedReplay:$e,liveJournal:ut}=Vt.replaySnapshot,Ht=[...$e,...ut],pn=Ht.filter(X=>X.type==="session_update").map(Y8).find(X=>X!==void 0)??Ht.filter(X=>X.type==="history_truncated").map(Y8).find(X=>X!==void 0)??Vt.historyAnchorRecordId,an=Ht.some(dee),Be=Array.isArray(Ys==null?void 0:Ys.features)&&Ys.features.includes(WF)&&(Vt.historyHasMore||an)&&pn!==void 0;Y.current={sessionId:Vt.sessionId,...pn!==void 0?{beforeRecordId:pn}:{},hasMore:Be,loading:!1,capacityReached:!1,paginationError:!1},M({hasMore:Be,loading:!1,capacityReached:!1,paginationError:!1});const cn=$r&&Ht.length>0;if(Xs&&!cn&&K.reset(),cn){const X={...te.current,suppressOwnUserEcho:!1},ge=[];for(const Ze of Ht)try{const Bt=Q8(Ze,Vt.clientId,X,We,{updateConnection:!1}),Et=J8(Ze,Bt,Ve,Qt,{hideHistoryTruncation:Be});if(ge.push(...ve.current==="summary"?X8(Et):Et),Ze.type==="turn_complete"){const In=((Wn=Ze.data)==null?void 0:Wn.stopReason)??"end_turn";ge.push(Fm(Ze,In))}else Ze.type==="turn_error"&&ge.push(Fm(Ze,"error"))}catch(Bt){const Et=Bt instanceof Error?Bt.message:String(Bt);Ve({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed replay event",debugMessage:Et,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed replay event:",Bt)}let Le=!1;if(Xs||K.getSnapshot().blocks.length===0){const Ze=B7({maxBlocks:Number.MAX_SAFE_INTEGER,retainSubagentBlocks:ve.current==="full"});Ze.dispatch(ge);const Bt=Ze.getSnapshot();Le=Bt.blocks.length>c,K.reset({...Bt,maxBlocks:Math.max(c,Bt.blocks.length)})}else ge.length>0&&K.dispatch(ge);ge.length>0&&KF(ge,Wt),Le&&Be&&(Y.current.hasMore=!1,Y.current.capacityReached=!0,M({hasMore:!1,loading:!1,capacityReached:!0,paginationError:!1}));for(const Ze of Ht)VF(V.current,U.current,Vt.sessionId,Ze,K,he,fe,{requireBoundPromptId:!0});We(Ze=>({...Ze,catchingUp:void 0}))}We(X=>({...X,status:"connected",sessionId:Vt.sessionId,...Vt.clientId?{clientId:Vt.clientId}:{},workspaceCwd:Vt.workspaceCwd,displayName:OF(Vt.state)??(X.sessionId===Vt.sessionId?X.displayName:void 0),tokenUsage:ks!==void 0?ks:X.sessionId===Vt.sessionId?X.tokenUsage:void 0,tokenCount:gr!==void 0?gr:X.sessionId===Vt.sessionId?X.tokenCount??0:0,loadingTranscript:void 0,catchingUp:cn?X.catchingUp:vs||Vt.lastEventId!=null||void 0})),Cr&&(le.current=void 0,clearTimeout(Cr.timeout),ue.current===Vt.sessionId&&(ue.current=void 0),Cr.resolve());const Jn=Ge||fs&&ce.current.commands!==void 0&&ce.current.skills!==void 0&&ce.current.supportedCommands!==void 0&&ce.current.context!==void 0,Us=Ge?Promise.resolve({branch:ce.current.gitBranch}):Vt.workspaceCwd?us.workspaceByCwd(Vt.workspaceCwd).workspaceGit():us.workspaceGit(),[dn,hn,Tr,br]=await Promise.allSettled([Jn?Promise.resolve(void 0):us.workspaceProviders(),Jn?Promise.resolve(void 0):Vt.supportedCommands(),Jn?Promise.resolve(void 0):Vt.context(),Us]),Lo=(dn==null?void 0:dn.status)==="fulfilled"?dn.value:void 0,Js=(hn==null?void 0:hn.status)==="fulfilled"?hn.value:void 0,Er=(Tr==null?void 0:Tr.status)==="fulfilled"?Tr.value:void 0,To=(br==null?void 0:br.status)==="fulfilled"?br.value.branch??void 0:void 0,Kr=[(dn==null?void 0:dn.status)==="rejected"?(di=be.current)==null?void 0:di.models:void 0,(hn==null?void 0:hn.status)==="rejected"?($s=be.current)==null?void 0:$s.commands:void 0,(Tr==null?void 0:Tr.status)==="rejected"?(Gr=be.current)==null?void 0:Gr.context:void 0].filter(X=>!!X),ga=LF(Lo),ri=Ove(Er),Zr=ri&&ri.models.length>0?ri.models:ga.models,_s=(ri==null?void 0:ri.currentModel)??ga.currentModel,Po=_s===ga.currentModel?ga.contextWindow:(Gs=ga.models.find(X=>X.id===_s))==null?void 0:Gs.contextWindow,Mi=(ri==null?void 0:ri.contextWindow)??((Ks=Zr.find(X=>X.id===_s))==null?void 0:Ks.contextWindow)??Po,{commands:Ri,skills:Ql}=QZ(Js),kc=Bve(Er)??ga.currentMode;We(X=>X.sessionId!==Vt.sessionId?X:{...X,status:"connected",sessionId:Vt.sessionId,...Vt.clientId?{clientId:Vt.clientId}:{},workspaceCwd:Vt.workspaceCwd,commands:Js!==void 0?Ri:X.commands,skills:Js!==void 0?Ql:X.skills,models:Zr.length>0?Zr:X.models,currentModel:_s??X.currentModel,currentMode:kc??X.currentMode,displayName:OF(Vt.state)??X.displayName,contextWindow:Mi??X.contextWindow,providers:Lo??X.providers,supportedCommands:Js??X.supportedCommands,context:Er??X.context,gitBranch:br.status==="fulfilled"?To:X.gitBranch,capabilities:Ys??X.capabilities,loadingTranscript:void 0,catchingUp:cn?X.catchingUp:vs||Vt.lastEventId!=null||void 0}),Kr.length>0&&K.dispatch(Kr.map(X=>({type:"status",text:X})));let Fa=!1,Rr=!1;const fo=()=>{const X=V.current.get(Vt.sessionId);X==null||X.controller.abort(),V.current.delete(Vt.sessionId),ir&&Ot(),jo(fe),he("idle"),xs(),K.reset(),Vt.setLastEventId(0),Bs=Vt.sessionId,Rr=!0,Jt=void 0,R.current=void 0,Me.current=()=>!1,We(ge=>({...ge,status:"connecting",error:void 0,errorStatus:$d(void 0,ge.errorStatus)}))},Zo=new AbortController;Zt={sessionId:Vt.sessionId,controller:Zo,restartRequested:!1},F.current=Zt;const Jl=()=>Zo.abort(Xe.signal.reason);Xe.signal.addEventListener("abort",Jl,{once:!0}),Tn=()=>Xe.signal.removeEventListener("abort",Jl);for await(const X of Vt.events({signal:Zo.signal,maxQueued:l})){if(((Qr=R.current)==null?void 0:Qr.sessionId)!==Vt.sessionId)break;Fa||(Fa=!0,Si=0);try{const ge=fwe(X);if(ge){hwe(ge);continue}const Le=bwe(X);Le&&pwe(Le),Swe(X)&&(_we(X),X.type==="pending_prompt_started"&&(jo(fe),he("waiting")));const Ze=Q8(X,Vt.clientId,te.current,We),Bt=J8(X,Ze,Ve,Qt),Et=ve.current==="summary"?X8(Bt):Bt;if(X.type==="state_resync_required"&&(typeof X.data=="object"&&X.data!==null?X.data.reason:void 0)==="epoch_reset"){fo();break}if(KF(Bt,Wt),Bt.length>0){const Ln=Z8(Bt);he(gs=>gs==="waiting"||gs==="idle"&&Ln?"streaming":gs)}(X.type==="turn_complete"||X.type==="turn_error")&&cs();const In=VF(V.current,U.current,Vt.sessionId,X,K,he,fe);let ms=!1;if(!In&&ir&&(X.type==="turn_complete"||X.type==="turn_error")){Ot(),ms=!0,jo(fe);const Ln=X.type==="turn_complete"?((Rt=X.data)==null?void 0:Rt.stopReason)??"end_turn":"error";$t(Fm(X,Ln)),Ns()||he("idle")}!Ns()&&Bt.some(Ln=>Ln.type==="debug")&&cs();const ps=!Ns()&&K.getSnapshot().activeAssistantBlockId!=null?Et.filter(Ln=>Ln.type!=="debug"):Et;Es(ps);for(const Ln of Bt)if(Ln.type==="prompt.cancelled"&&(ir||Ln.originatorClientId!==Vt.clientId)){$t(Fm(X,"cancelled"));const gs=ir;Ot(),ms=!0,jo(fe),gs||V.current.delete(Vt.sessionId),Ns()||he("idle")}else Ln.type==="session.replay_complete"&&(cs(),We(gs=>({...gs,catchingUp:void 0})),K.getSnapshot().awaitingResync&&K.clearAwaitingResync(),Ns()||(jo(fe),$t({type:"assistant.done",reason:"replay_complete"}),he("idle")));const En=!In&&!ms&&!Ns();if(En&&(Bt.some(gs=>gs.type==="user.text.delta")?he("waiting"):Z8(Bt)&&he(gs=>gs==="idle"?"streaming":gs)),En&&X.type==="turn_complete"){jo(fe);const Ln=((Ii=X.data)==null?void 0:Ii.stopReason)??"end_turn";$t(Fm(X,Ln)),he("idle")}else En&&X.type==="turn_error"?(jo(fe),$t(Fm(X,"error")),he("idle")):En&&Z8(Bt)&&Vve(K,fe,"passive_observer",3e3,()=>he("idle"));if(X.type==="state_resync_required"&&(typeof X.data=="object"&&X.data!==null?X.data.reason:void 0)!=="epoch_reset"){Ns()||(he("idle"),jo(fe)),xs(),K.reset(),console.warn("[DaemonSessionProvider] ring eviction detected, reloading session (sessionId=%s)",Vt.sessionId),Rr=!0,Jt=void 0,R.current=void 0,Me.current=()=>!1,We(gs=>({...gs,status:"connecting",error:void 0,errorStatus:$d(void 0,gs.errorStatus)}));break}if(X.type==="session_closed"&&((uo=X.data)==null?void 0:uo.reason)==="client_close"){xe=!0;const Ln=Vt.sessionId,gs=V.current.get(Ln);gs==null||gs.controller.abort(),V.current.delete(Ln),Jt=void 0,R.current=void 0;break}}catch(ge){const Le=ge instanceof Error?ge.message:String(ge);Ve({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.event_malformed",message:"Skipped malformed daemon event",debugMessage:Le,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed daemon event:",ge)}}cs();const cl=Zt.restartRequested;if(Gn(),cl){Si=0,si=!0;continue}if(xe){$t({type:"assistant.done",reason:"cancelled"}),he("idle"),jo(fe),We(X=>({...X,status:"disconnected",sessionId:void 0,error:void 0,errorStatus:void 0,missingSession:!1}));return}if(de.current){Jt=void 0,R.current=void 0,Me.current=()=>!1;return}!ot&&!Xe.signal.aborted&&!Rr&&(((Or=R.current)==null?void 0:Or.sessionId)===Vt.sessionId&&(console.debug("[DaemonSessionProvider] SSE stream ended"),Ns()||(jo(fe),he("idle"),$t({type:"assistant.done",reason:"stream_ended"}))),We(X=>({...X,status:X.status==="error"?"error":"disconnected",error:X.status==="error"?X.error:void 0,errorStatus:$d(void 0,X.errorStatus)})))}catch(vs){const $r=(Zt==null?void 0:Zt.restartRequested)===!0;if(Gn(),$r&&!ot&&!Xe.signal.aborted){cs(),Si=0,si=!0;continue}if(ot||Xe.signal.aborted)return;cs();const Xs=vs instanceof Error?vs.message:String(vs),fs=Sk(vs),ks=Jt==null?void 0:Jt.sessionId,gr=Wwe(vs),Vt=Uwe(vs);if(ks&&(gr||Vt)){const ir=V.current.get(ks);ir==null||ir.controller.abort(),V.current.delete(ks)}(gr||Vt||!pr())&&(jo(fe),he("idle"));const Sr=le.current;if(Sr&&(Sr.sessionId===Ae||Sr.sessionId===Bs)&&(ue.current===Sr.sessionId&&(ue.current=void 0),le.current=void 0,clearTimeout(Sr.timeout),Sr.reject(vs)),gr||Vt){if(Jt=void 0,R.current=void 0,gr){We(Ot=>({...Ot,status:"error",sessionId:void 0,error:Xs,errorStatus:$d(fs,Ot.errorStatus),missingSession:!1,capabilities:Ys??Ot.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}const ir=tt&&zx(fs);console.warn("[DaemonSessionProvider] terminal session error (sessionId=%s, status=%d, message=%s)",ks,fs,Xs),We(Ot=>({...Ot,status:"disconnected",sessionId:void 0,error:Xs,errorStatus:$d(fs,Ot.errorStatus),missingSession:ir||Ot.missingSession===!0,capabilities:Ys??Ot.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}else if(Tt&&Jt===void 0&&(Sr==null?void 0:Sr.sessionId)===Ae&&((hi=R.current)==null?void 0:hi.sessionId)===Ae){Jt=R.current,Bs=Jt.sessionId,Si=0,si=!0;continue}else console.debug("[DaemonSessionProvider] retriable SSE error, preserving session for delta resume (sessionId=%s)",Jt==null?void 0:Jt.sessionId);if(!g){Jt=void 0,R.current=void 0,We(ir=>({...ir,status:"error",error:Xs,errorStatus:$d(fs,ir.errorStatus),missingSession:!1}));return}We(ir=>({...ir,status:"disconnected",error:Xs,errorStatus:$d(fs,ir.errorStatus),missingSession:!1,loadingTranscript:void 0}))}if(!g){R.current=void 0,We(vs=>({...vs,status:"disconnected",loadingTranscript:void 0,catchingUp:void 0}));return}Si+=1;const Jr=ae.current,zs=Uve(Si,Jr.reconnectDelayMs,Jr.maxReconnectDelayMs);We(vs=>({...vs,status:"disconnected",error:`Reconnecting in ${zs}ms`})),await Wve(zs,Xe.signal)}})(),()=>{const mn=R.current;ot=!0,Xe.abort(),cs(),Me.current=()=>!1,he("idle"),jo(fe);const gt=(mn==null?void 0:mn.sessionId)===ue.current,wn=!Je.current;le.current&&(!gt||wn)&&(clearTimeout(le.current.timeout),le.current.reject(new DOMException("Session load interrupted by cleanup","AbortError")),le.current=void 0),(!gt||wn)&&(mn!=null&&mn.clientId)&&BF({baseUrl:S,token:C,sessionId:mn.sessionId,clientId:mn.clientId}).catch(Wn=>console.warn("[DaemonSessionProvider] detach failed:",Wn)),(!gt||wn)&&(R.current=void 0)}},[p,g,S,C,s,Pe,_t,l,c,K,Ae,dt,et,sn,$n,ie,i,z,Un,Ve,Qt]),h.useEffect(()=>{if(!Q.current||we.status!=="connected"||v<=0||x<=0||!we.sessionId)return;ne.current.sessionId!==we.sessionId&&(ne.current={sessionId:we.sessionId,consecutiveFailures:0});const lt=ne.current;let Xe=!1;const ot=setInterval(()=>{const Tt=R.current;Tt&&Tt.heartbeat().then(()=>{Xe||(lt.consecutiveFailures>=x&&We(fn=>fn.sessionId===Tt.sessionId?{...fn,status:"connected",error:void 0,errorStatus:void 0}:fn),lt.consecutiveFailures=0,lt.lastHttpError=void 0)}).catch(fn=>{var Qn,Os,rr,Es,cs;if(Xe)return;lt.consecutiveFailures+=1;const $t=fn instanceof Error?fn.message:"Session heartbeat failed",xs=Sk(fn);if(xs!==void 0){const Wn=(Qn=lt.lastHttpError)==null?void 0:Qn.status;lt.lastHttpError={status:$d(xs,Wn)??xs,message:zx(Wn)?((Os=lt.lastHttpError)==null?void 0:Os.message)??$t:$t}}if(lt.consecutiveFailures<x)return;const Ce=(rr=lt.lastHttpError)==null?void 0:rr.status,mn=((Es=lt.lastHttpError)==null?void 0:Es.message)??$t,gt=Ce!==void 0&&eD.has(Ce),wn=zx(Ce);if(gt||wn){const Wn=Tt.sessionId;console.warn(wn?"[DaemonSessionProvider] heartbeat detected missing session (sessionId=%s, status=%d)":"[DaemonSessionProvider] heartbeat auth failure (sessionId=%s, status=%d)",Wn,Ce);const di=V.current.get(Wn);di==null||di.controller.abort(),V.current.delete(Wn),jo(fe),he("idle"),((cs=R.current)==null?void 0:cs.sessionId)===Wn&&(wn&&(de.current=!0),R.current=void 0)}We(Wn=>Wn.sessionId===Tt.sessionId?{...Wn,status:gt?"error":"disconnected",error:mn,errorStatus:$d(Ce,Wn.errorStatus),missingSession:wn,...gt||wn?{sessionId:void 0,loadingTranscript:void 0,catchingUp:void 0}:{}}:Wn)})},v);return()=>{Xe=!0,clearInterval(ot)}},[we.sessionId,we.status,x,v]);const pt=h.useMemo(()=>Qve({store:K,sessionRef:R,activePromptsRef:V,settledPromptsRef:U,pendingSessionLoadRef:le,pendingSessionLoadIdRef:pe,heartbeatSupportedRef:Q,manualSessionClearRef:de,skipNextCleanupDetachSessionIdRef:ue,passiveAssistantDoneTimerRef:fe,hasSessionActivePrompt:()=>Me.current(),resetCurrentSessionActivePrompt:()=>{Me.current=()=>!1},restartEventStream:lt=>{if(!b)return;const Xe=F.current;(Xe==null?void 0:Xe.sessionId)===lt&&(Xe.restartRequested=!0,Xe.controller.abort())},getCreateSessionRequest:()=>{var lt;return{...Pt.current,sessionScope:"thread",workspaceCwd:$.current??((lt=R.current)==null?void 0:lt.workspaceCwd)}},createDetachedSession:(lt,Xe)=>{var ot;const Tt=E.current??new M7({baseUrl:S,token:C}),fn={...Pt.current,sessionScope:"thread",workspaceCwd:lt??$.current??((ot=R.current)==null?void 0:ot.workspaceCwd),...(Xe==null?void 0:Xe.approvalMode)!==void 0?{approvalMode:Xe.approvalMode}:{},...(Xe==null?void 0:Xe.sourceType)!==void 0?{sourceType:Xe.sourceType}:{},...(Xe==null?void 0:Xe.worktree)!==void 0?{worktree:Xe.worktree}:{},...(Xe==null?void 0:Xe.branch)!==void 0?{branch:Xe.branch}:{}},Qn=i?ze.current:V8(void 0);return Nw.createOrAttach(Tt,fn,Qn)},getConnection:()=>ce.current,addNotice:Ve,setConnection:We,setPromptStatus:he,setRestoreSessionId:rt,setRestoreWorkspaceCwd:jt,setRestoreMode:Mt,setRestoreSessionNonce:Ye,setAttachSessionNonce:Te,setNewSessionNonce:it}),[Ve,i,S,C,b,K]),ln=h.useCallback(async()=>{const lt=Y.current,Xe=R.current;if(!lt.hasMore||lt.loading||lt.paginationError||!Xe||Xe.sessionId!==lt.sessionId)return;lt.loading=!0,M({hasMore:!0,loading:!0,capacityReached:!1,paginationError:!1});let ot=!1;try{const Tt=await Xe.client.getSessionTranscriptPage(Xe.sessionId,{...lt.cursor!==void 0?{cursor:lt.cursor}:lt.beforeRecordId!==void 0?{beforeRecordId:lt.beforeRecordId}:{},limit:se.current??100,clientId:Xe.clientId});if(R.current!==Xe||Y.current!==lt)return;if(Tt.partial||Tt.replayError)throw ot=!0,new Error(Tt.replayError??"Earlier session history was only partially read");const fn={...te.current,suppressOwnUserEcho:!1},Qn=Tt.events.map(Y8).find(Es=>Es!==void 0),Os=[];for(const Es of Tt.events)try{const cs=J8(Es,Q8(Es,Xe.clientId,fn,We,{updateConnection:!1}),Ve,Qt);Os.push(...ve.current==="summary"?X8(cs):cs)}catch(cs){const $t=cs instanceof Error?cs.message:String(cs);Ve({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed history event",debugMessage:$t,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed history event:",cs)}if(Os.length>0&&!Awe(K,Os,c)){lt.hasMore=!1,lt.loading=!1,lt.capacityReached=!0,M({hasMore:!1,loading:!1,capacityReached:!0,paginationError:!1});return}const rr=K.getSnapshot().blocks.length<c;lt.capacityReached=Tt.hasMore&&!rr,lt.cursor=Qn===void 0?Tt.nextCursor:void 0,lt.beforeRecordId=Qn,lt.hasMore=Tt.hasMore&&rr,lt.loading=!1,M({hasMore:lt.hasMore,loading:!1,capacityReached:lt.capacityReached,paginationError:!1})}catch(Tt){if(R.current!==Xe||Y.current!==lt)return;const fn=!ot&&(!(Tt instanceof Jc)||Tt.status>=500||Tt.status===408||Tt.status===429);throw lt.hasMore=fn,lt.loading=!1,lt.capacityReached=!1,lt.paginationError=!fn,M({hasMore:fn,loading:!1,capacityReached:!1,paginationError:!fn}),fn&&Ve({severity:"warning",category:"user_action",operation:"load_session",code:"daemon.transcript_history.failed",message:"Failed to load earlier session history",debugMessage:Tt instanceof Error?Tt.message:String(Tt),recoverable:fn}),Tt}},[Ve,Qt,c,K]),Bn=h.useMemo(()=>{var lt;const Xe=we.sessionId===Y.current.sessionId&&((lt=R.current)==null?void 0:lt.sessionId)===Y.current.sessionId;return{hasMore:Xe&&W.hasMore,loading:Xe&&W.loading,capacityReached:Xe&&W.capacityReached,paginationError:Xe&&W.paginationError,loadMore:ln}},[we.sessionId,ln,W]),ns=h.useRef(Rwe);return h.useEffect(()=>{if(ns.current===r)return;ns.current=r;const lt=ce.current.sessionId;if(r===lt)return;const Xe=r?pt.loadSession(r):lt?pt.clearSession():void 0;Xe&&Xe.catch(ot=>{console.warn("[DaemonSessionProvider] controlled session transition failed:",ot)})},[pt,r]),a.jsx(hee.Provider,{value:K,children:a.jsx(fee.Provider,{value:we,children:a.jsx(pee.Provider,{value:St,children:a.jsx(gee.Provider,{value:Ie,children:a.jsx(bee.Provider,{value:wt,children:a.jsx(Z9.Provider,{value:pt,children:a.jsx(mee.Provider,{value:Bn,children:_})})})})})})})}function VF(e,t,n,s,r,i,o,l={}){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||l.requireBoundPromptId&&d.promptId===void 0||d.promptId!==void 0&&d.promptId!==u)return!1;jo(o);try{const f=z9(s,u);if(!f)return!1;r.dispatch(Fm(s,f.stopReason)),i("idle"),d.resolve?(e.delete(n),d.resolve(f)):(e.delete(n),t.set(z7(n,u),{status:"resolved",result:f}))}catch(f){r.dispatch(Fm(s,"error")),i("idle"),d.reject?(e.delete(n),d.reject(f)):(e.delete(n),t.set(z7(n,u),{status:"rejected",error:f}))}return!0}function Dwe(e){return e.type==="turn_complete"}function Q8(e,t,n,s,r={}){Lwe(e),r.updateConnection!==!1&&$ve(e,s);const i=tye(e,{clientId:t,suppressOwnUserEcho:n.suppressOwnUserEcho,includeRawEvent:n.includeRawEvent}),o=Fwe(e);return Dwe(e)?o?[o]:[]:o?[...i,o]:i}function Lwe(e){e.type==="settings_reloaded"&&console.debug("[DaemonSessionProvider] settings reloaded:",Pwe(e))}function Pwe(e){const t={};if(e.id!==void 0&&(t.eventId=e.id),!Mo(e.data))return t.payload="non-object",t;const n=Owe(e.data.env),s=Fx(e.data.changedKeys),r=Fx(e.data.sessionsRefreshed),i=Fx(e.data.sessionsSkipped),o=e.data.childReloaded,l=$u(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),l&&(t.childError=l),t}function Owe(e){if(Mo(e))return{updatedKeys:Fx(e.updatedKeys)??[],removedKeys:Fx(e.removedKeys)??[]}}function Fx(e){if(Array.isArray(e))return e.filter(t=>typeof t=="string")}function J8(e,t,n,s,r={}){if(r.hideHistoryTruncation&&dee(e))return[];if(e.type==="session_snapshot"&&Mo(e.data)&&e.data.recordingDegraded===!1){const o=$u(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 l=n($we(e,o));(l.category==="protocol"||l.category==="connection")&&console.warn("[DaemonSessionProvider] daemon notice:",l)}return i}function $we(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=Mo(e.data)?$u(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 gv(){const e=h.useContext(hee);if(!e)throw new Error("useDaemonTranscriptStore must be used within DaemonSessionProvider");return e}function tD(){const e=h.useContext(mee);if(!e)throw new Error("useDaemonTranscriptHistory must be used within DaemonSessionProvider");return e}function nD(){const e=gv(),t=h.useCallback(()=>e.getSnapshot().blocks,[e]);return h.useSyncExternalStore(e.subscribe,t,t)}function p5(){const e=gv(),t=yee(),n=h.useCallback(()=>uwe(e.getSnapshot().blocks,t),[t,e]);return h.useSyncExternalStore(e.subscribe,n,n)}function rm(){const e=h.useContext(Z9);if(!e)throw new Error("useDaemonActions must be used within DaemonSessionProvider");return e}function Bwe(){return h.useContext(Z9)}function Nh(){return h.useContext(bee)}function yee(){const e=h.useContext(pee);if(!e)throw new Error("useDaemonPromptStatus must be used within DaemonSessionProvider");return e}function za(){const e=h.useContext(fee);if(!e)throw new Error("useDaemonConnection must be used within DaemonSessionProvider");return e}function zwe(){const e=h.useContext(gee);if(!e)throw new Error("useDaemonSessionNotices must be used within DaemonSessionProvider");return e}function Z8(e){return e.some(t=>t.type==="assistant.text.delta"||t.type==="thought.text.delta"||t.type==="tool.update")}function Fwe(e){if(e.type!=="session_update")return null;const t=Mo(e.data)?e.data:void 0,n=Mo(t==null?void 0:t.update)?t.update:Mo(e.data)?e.data:void 0;if(!n||n.sessionUpdate!=="agent_message_chunk")return null;const s=n._meta;if(!Mo(s))return null;const r=qwe(s.goalStatus);if(r)return GF(e,r);const i=Hwe(s.goalTerminal);if(i)return GF(e,i);const o=s.stopHookLoop;if(!Mo(o))return null;const l=o.goal;return!Mo(l)||!$u(l,"condition"),null}function GF(e,t){return{type:"status",...e.id!==void 0?{eventId:e.id}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},text:"",source:"goal",data:t}}function qwe(e){if(!Mo(e))return null;const t=$u(e,"kind");if(t!=="set"&&t!=="cleared"&&t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=$u(e,"condition");if(!n)return null;const s=qx(e,"iterations"),r=qx(e,"durationMs"),i=qx(e,"setAt"),o=$u(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 Hwe(e){if(!Mo(e))return null;const t=$u(e,"kind");if(t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=$u(e,"condition");if(!n)return null;const s=qx(e,"iterations"),r=qx(e,"durationMs"),i=$u(e,"lastReason");return{kind:t,condition:n,...s!==void 0?{iterations:s}:{},...r!==void 0?{durationMs:r}:{},...i?{lastReason:i}:{}}}function $u(e,t){const n=e[t];return typeof n=="string"?n:void 0}function qx(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function KF(e,t){let n=0,s=0,r=0,i=0,o=0,l=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":l+=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+l+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+l,artifactsVersion:m.artifactsVersion+c,...u?{lastExtensionChange:u}:{},initVersion:m.initVersion+d,authVersion:m.authVersion+f}))}function Uwe(e){const t=Sk(e);return t!==void 0&&Nwe.has(t)}function Wwe(e){const t=Sk(e);return t!==void 0&&eD.has(t)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Sd(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),l=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||l()},[n,s,l]),{...r,reload:l}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function bv(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 vee(e={}){var t;const n=Qo(),s=h.useCallback(()=>n.listAgents(),[n]),r=Sd(s,e),i=Nh();return bv(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 Vwe(e={}){var t;const{actions:n,workspaceCwd:s}=Co(),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=Sd(i,{...e,autoLoad:!1,enabled:r}),l=o.reload,c=h.useRef(!1),u=h.useRef(s),d=h.useCallback(async()=>(c.current=!0,l()),[l]),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 _=await k();return await f.current(),_},[]),p=h.useCallback((k,_)=>m(()=>n.upsertChannel(k,_)),[n,m]),g=h.useCallback((k,_)=>m(()=>n.removeChannel(k,_)),[n,m]),b=h.useCallback((k,_)=>m(()=>n.setChannelStartup(k,_)),[n,m]),w=h.useCallback(k=>m(()=>n.startChannel(k)),[n,m]),y=h.useCallback(k=>m(()=>n.stopChannel(k)),[n,m]),v=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:w,stop:y,restart:v,pairing:n.channelPairing}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function sD(e={}){const t=Qo(),n=h.useCallback(()=>t.loadMcpStatus(),[t]),s=Sd(n,e),r=Nh();return bv(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 Gwe(e={}){var t;const n=Qo(),s=h.useCallback(()=>n.loadMemoryStatus(),[n]),r=Sd(s,e),i=Nh();return bv(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 i4(e={}){const{pageSize:t,cursor:n,archiveState:s,view:r,group:i,sourceType:o,...l}=e,c=Co(),u=Bwe(),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=Sd(d,{...l,enabled:(l.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,w=(b==null?void 0:b.sessions)??[],y=h.useCallback(async T=>{const S=await c.actions.deleteSession(T);return S&&g(),S},[c.actions,g]),v=h.useCallback(async T=>{const S=await c.actions.deleteSessions(T);return(S.removed.length>0||S.notFound.length>0)&&g(),S},[c.actions,g]),x=h.useCallback((T,S="html")=>c.actions.exportSession(T,S),[c.actions]),k=h.useCallback(async T=>{const S=await c.actions.archiveSession(T);return S&&g(),S},[c.actions,g]),_=h.useCallback(async T=>{const S=await c.actions.unarchiveSession(T);return S&&g(),S},[c.actions,g]);return{...m,data:b!==void 0?w:void 0,reload:g,sessions:w,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:v,exportSession:x,archiveSession:k,unarchiveSession:_}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Kwe(e={}){var t;const n=Qo(),s=h.useCallback(()=>n.loadSkillsStatus(),[n]),r=Sd(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 W7(e={}){const{detail:t="summary",...n}=e,s=Qo(),r=h.useCallback(()=>s.loadDaemonStatus(t),[s,t]),i=Sd(r,n);return{...i,report:i.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Ywe(e={}){const{range:t,heatmapDays:n,...s}=e,r=Qo(),i=h.useCallback(()=>r.loadUsageDashboard({range:t,heatmapDays:n}),[r,t,n]),o=Sd(i,s);return{...o,dashboard:o.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function wee(e={}){var t;const n=Qo(),s=h.useCallback(()=>n.loadToolsStatus(),[n]),r=Sd(s,e),i=Nh();return bv(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 rD(e={}){var t;const n=Qo(),s=h.useCallback(()=>n.loadSettingsStatus(),[n]),r=Sd(s,e),i=Nh();return bv(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 Xwe(e={}){var t,n;const s=Qo(),r=h.useCallback(()=>s.loadProviders(),[s]),i=Sd(r,e),o=Nh();return bv(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 Qwe=300,Jwe=100,kb=Object.freeze({suggestion:null,isVisible:!1,shownAt:0});function eA(e){var t;const n=e;(t=n.clearFollowupSuggestion)==null||t.call(n)}function Zwe(e){const{enabled:t=!0,onStateChange:n,getOnAccept:s,getOnOutcome:r}=e;let i=kb,o=null,l=!1,c=null;function u(w){i=w,n(w)}function d(){o&&(clearTimeout(o),o=null),c&&(clearTimeout(c),c=null)}return{setSuggestion:w=>{if(o&&(clearTimeout(o),o=null),!w){u(kb);return}t&&(o=setTimeout(()=>{u({suggestion:w,isVisible:!0,shownAt:Date.now()})},Qwe))},accept:(w,y)=>{var v;if(l)return;o&&(clearTimeout(o),o=null),l=!0;const x=i.suggestion,{shownAt:k}=i;if(!x){l=!1;return}try{(v=r())==null||v({outcome:"accepted",accept_method:w,time_ms:k>0?Date.now()-k:0,suggestion_length:x.length})}catch(_){console.error("[followup] onOutcome callback threw:",_)}u(kb),queueMicrotask(()=>{var _;try{y!=null&&y.skipOnAccept||(_=s())==null||_(x)}catch(T){console.error("[followup] onAccept callback threw:",T)}finally{c&&clearTimeout(c),c=setTimeout(()=>{l=!1},Jwe)}})},dismiss:()=>{var w;if(o&&(clearTimeout(o),o=null),!(!i.isVisible&&!i.suggestion)){if(i.isVisible&&i.suggestion)try{(w=r())==null||w({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(kb)}},clear:()=>{d(),l=!1,u(kb)},cleanup:()=>{d(),l=!1}}}function xee(e={}){const{enabled:t=!0,onAccept:n,onOutcome:s}=e,r=gv(),i=za().sessionId,[o,l]=h.useState(kb),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(dwe,qF,qF),m=(f==null?void 0:f.sessionId)===i?f:d,p=h.useMemo(()=>Zwe({enabled:t,onStateChange:l,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),w=h.useRef(i);h.useEffect(()=>{const k=w.current;w.current=i,k!==void 0&&i!==void 0&&k!==i&&(p.clear(),y2(),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(),eA(r),y2(),b.current=void 0},[p,r]),v=h.useCallback((k,_)=>{p.accept(k,_),eA(r),y2(),b.current=void 0},[p,r]),x=h.useCallback(()=>{p.dismiss(),eA(r),y2(),b.current=void 0},[p,r]);return h.useMemo(()=>({followupState:o,onAcceptFollowup:v,onDismissFollowup:x,clear:y}),[o,v,x,y])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function exe(){const e=h.useSyncExternalStore(mwe,HF,HF),t=h.useCallback(n=>gwe(n),[]);return{batches:e,consume:t}}const YF=[];function txe(e,t){return e===t?!1:e.length!==t.length?!0:e.some((n,s)=>!Object.is(n,t[s]))}class Wf extends h.Component{constructor(){super(...arguments);He(this,"state",{error:null,resetKeys:this.props.resetKeys??YF});He(this,"reset",()=>{this.setState({error:null})})}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,s){const r=n.resetKeys??YF;return txe(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 XF={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:"重试"}},nxe={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},sxe={margin:0,fontSize:"1rem",fontWeight:600},rxe={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},ixe={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 oxe({error:e,onRetry:t,language:n="en"}){const s=XF[n]??XF.en;return a.jsxs("div",{role:"alert",style:nxe,"data-web-shell-error":!0,children:[a.jsx("p",{style:sxe,children:s.title}),a.jsx("p",{style:rxe,children:s.body}),!1,a.jsx("button",{type:"button",style:ixe,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 kee=(...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 axe=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 lxe=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 QF=e=>{const t=lxe(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 tA={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 cxe=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},uxe=h.createContext({}),dxe=()=>h.useContext(uxe),hxe=h.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:s,className:r="",children:i,iconNode:o,...l},c)=>{const{size:u=24,strokeWidth:d=2,absoluteStrokeWidth:f=!1,color:m="currentColor",className:p=""}=dxe()??{},g=s??f?Number(n??d)*24/Number(t??u):n??d;return h.createElement("svg",{ref:c,...tA,width:t??u??tA.width,height:t??u??tA.height,stroke:e??m,strokeWidth:g,className:kee("lucide",p,r),...!i&&!cxe(l)&&{"aria-hidden":"true"},...l},[...o.map(([b,w])=>h.createElement(b,w)),...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 It=(e,t)=>{const n=h.forwardRef(({className:s,...r},i)=>h.createElement(hxe,{ref:i,iconNode:t,className:kee(`lucide-${axe(QF(e))}`,`lucide-${e}`,s),...r}));return n.displayName=QF(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 fxe=[["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"}]],mxe=It("activity",fxe);/**
 * @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 pxe=[["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"}]],gxe=It("archive-restore",pxe);/**
 * @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 bxe=[["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"}]],v2=It("archive",bxe);/**
 * @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 yxe=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],vxe=It("arrow-down-to-line",yxe);/**
 * @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 wxe=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]],xxe=It("arrow-down-up",wxe);/**
 * @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 kxe=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],_xe=It("arrow-down",kxe);/**
 * @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 Sxe=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],T_=It("arrow-left",Sxe);/**
 * @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 Cxe=[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]],Txe=It("arrow-up-from-line",Cxe);/**
 * @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 Exe=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Axe=It("arrow-up",Exe);/**
 * @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 jxe=[["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"}]],Nxe=It("blocks",jxe);/**
 * @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 Ixe=[["path",{d:"M21 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]],Mxe=It("bolt",Ixe);/**
 * @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 Rxe=[["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"}]],sy=It("bot",Rxe);/**
 * @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 Dxe=[["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"}]],Lxe=It("box",Dxe);/**
 * @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 Pxe=[["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"}]],Oxe=It("calendar-clock",Pxe);/**
 * @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 $xe=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],kh=It("check",$xe);/**
 * @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 Bxe=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Pc=It("chevron-down",Bxe);/**
 * @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 zxe=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Eu=It("chevron-right",zxe);/**
 * @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 Fxe=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],qxe=It("chevron-up",Fxe);/**
 * @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 Hxe=[["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"}]],La=It("circle-alert",Hxe);/**
 * @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 Uxe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],g5=It("circle-check",Uxe);/**
 * @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 Wxe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],_ee=It("circle-dot",Wxe);/**
 * @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 Vxe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],Gxe=It("circle-minus",Vxe);/**
 * @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 Kxe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],Yxe=It("circle-plus",Kxe);/**
 * @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 Xxe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],Qxe=It("circle-stop",Xxe);/**
 * @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 Jxe=[["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"}]],See=It("circle-x",Jxe);/**
 * @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 Zxe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],eke=It("clock",Zxe);/**
 * @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 tke=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],nke=It("columns-2",tke);/**
 * @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 ske=[["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"}]],rke=It("command",ske);/**
 * @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 ike=[["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"}]],iD=It("copy",ike);/**
 * @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 oke=[["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"}]],V7=It("database",oke);/**
 * @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 ake=[["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"}]],Hx=It("download",ake);/**
 * @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 lke=[["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"}]],sp=It("ellipsis-vertical",lke);/**
 * @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 cke=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],uke=It("ellipsis",cke);/**
 * @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 dke=[["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"}]],hke=It("eye",dke);/**
 * @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 fke=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],mke=It("file-code-corner",fke);/**
 * @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 pke=[["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"}]],Cee=It("file-diff",pke);/**
 * @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 gke=[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],bke=It("file-headphone",gke);/**
 * @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 yke=[["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"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],vke=It("file-image",yke);/**
 * @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 wke=[["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:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],xke=It("file-play",wke);/**
 * @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 kke=[["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"}]],Tee=It("file-text",kke);/**
 * @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 _ke=[["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"}]],Ske=It("file",_ke);/**
 * @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 Cke=[["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"}]],Tke=It("flask-conical",Cke);/**
 * @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 Eke=[["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"}]],Ck=It("folder-closed",Eke);/**
 * @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 Ake=[["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"}]],jke=It("folder-input",Ake);/**
 * @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 Nke=[["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"}]],Eee=It("folder-open",Nke);/**
 * @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 Ike=[["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"}]],Mke=It("folder-plus",Ike);/**
 * @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 Rke=[["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"}]],Dke=It("folder-x",Rke);/**
 * @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 Lke=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Pke=It("funnel",Lke);/**
 * @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 Oke=[["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"}]],jy=It("git-branch",Oke);/**
 * @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 $ke=[["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"}]],Bke=It("git-commit-horizontal",$ke);/**
 * @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 zke=[["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"}]],wT=It("git-fork",zke);/**
 * @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 Fke=[["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"}]],qke=It("git-pull-request-draft",Fke);/**
 * @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 Hke=[["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"}]],Uke=It("git-pull-request",Hke);/**
 * @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 Wke=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Vke=It("grip-vertical",Wke);/**
 * @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 Gke=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],b5=It("info",Gke);/**
 * @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 Kke=[["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"}]],JF=It("key-round",Kke);/**
 * @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 Yke=[["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"}]],Xke=It("layers",Yke);/**
 * @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 Qke=[["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"}]],Jke=It("layout-grid",Qke);/**
 * @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 Zke=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]],e_e=It("layout-list",Zke);/**
 * @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 t_e=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],n_e=It("link",t_e);/**
 * @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 s_e=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Rg=It("loader-circle",s_e);/**
 * @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 r_e=[["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"}]],i_e=It("lock",r_e);/**
 * @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 o_e=[["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"}]],Aee=It("maximize-2",o_e);/**
 * @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 a_e=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],w2=It("message-circle-plus",a_e);/**
 * @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 l_e=[["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"}]],jee=It("minimize-2",l_e);/**
 * @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 c_e=[["path",{d:"M5 12h14",key:"1ays0h"}]],u_e=It("minus",c_e);/**
 * @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 d_e=[["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"}]],h_e=It("moon",d_e);/**
 * @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 f_e=[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M15 2v20",key:"dcj49h"}],["path",{d:"M15 7h5",key:"1xj5lc"}],["path",{d:"M15 12h5",key:"w5shd9"}],["path",{d:"M15 17h5",key:"1qaofu"}]],m_e=It("notebook-tabs",f_e);/**
 * @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 p_e=[["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"}]],ZF=It("package",p_e);/**
 * @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 g_e=[["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"}]],b_e=It("palette",g_e);/**
 * @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 y_e=[["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"}]],v_e=It("panel-left-close",y_e);/**
 * @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 w_e=[["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"}]],x_e=It("panel-left-open",w_e);/**
 * @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 k_e=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],Nee=It("panel-right",k_e);/**
 * @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 __e=[["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"}]],Ny=It("pencil",__e);/**
 * @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 S_e=[["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"}]],eq=It("pin",S_e);/**
 * @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 C_e=[["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"}]],T_e=It("play",C_e);/**
 * @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 E_e=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Vf=It("plus",E_e);/**
 * @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 A_e=[["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"}]],Iee=It("radio-tower",A_e);/**
 * @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 j_e=[["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"}]],Ug=It("refresh-cw",j_e);/**
 * @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 N_e=[["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"}]],I_e=It("rotate-cw",N_e);/**
 * @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 M_e=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],R_e=It("rows-3",M_e);/**
 * @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 D_e=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],eu=It("search",D_e);/**
 * @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 L_e=[["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"}]],ry=It("server",L_e);/**
 * @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 P_e=[["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"}]],Mee=It("settings-2",P_e);/**
 * @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 O_e=[["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"}]],$_e=It("settings",O_e);/**
 * @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 B_e=[["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"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],tq=It("shield-check",B_e);/**
 * @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 z_e=[["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"}]],F_e=It("shield",z_e);/**
 * @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 q_e=[["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"}]],H_e=It("sliders-horizontal",q_e);/**
 * @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 U_e=[["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"}]],iy=It("sparkles",U_e);/**
 * @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 W_e=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M17 12h-2l-2 5-2-10-2 5H7",key:"15hlnc"}]],Ree=It("square-activity",W_e);/**
 * @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 V_e=[["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"}]],nq=It("square-pen",V_e);/**
 * @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 G_e=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],Dee=It("square-terminal",G_e);/**
 * @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 K_e=[["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"}]],Y_e=It("star",K_e);/**
 * @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 X_e=[["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"}]],Q_e=It("sun",X_e);/**
 * @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 J_e=[["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"}]],sq=It("tag",J_e);/**
 * @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 Z_e=[["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"}]],eSe=It("target",Z_e);/**
 * @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 tSe=[["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"}]],kf=It("trash-2",tSe);/**
 * @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 nSe=[["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"}]],sSe=It("triangle-alert",nSe);/**
 * @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 rSe=[["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"}]],iSe=It("upload",rSe);/**
 * @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 oSe=[["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"}]],aSe=It("users-round",oSe);/**
 * @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 lSe=[["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"}]],rq=It("wifi-off",lSe);/**
 * @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 cSe=[["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"}]],G7=It("wrench",cSe);/**
 * @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 uSe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],yv=It("x",uSe);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const nh=1e3,oD="session_organization",Lee="session_transcript_pagination",Pee="session_monitor_tool_correlation",dSe="session_side_task",sh="default",hSe="side_task",aD=100,fSe=500,lD=5e4;function K7(e){for(const t of e){if(!pSe(t))continue;const n=t;if(n.resolved)continue;const s=rp(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=rp(s==null?void 0:s._meta),l=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:l,content:mSe(s,n.title),options:n.options.map(c=>({id:c.optionId,label:c.label,kind:bSe(c.raw)})),rawInput:gSe(n.toolCall)}}return null}function mSe(e,t){const n=e==null?void 0:e.content;if(Array.isArray(n)){const s=n.flatMap(r=>{const i=rp(r),o=rp(i==null?void 0:i.content),l=(i==null?void 0:i.type)==="text"&&typeof i.text=="string"?i.text:(o==null?void 0:o.type)==="text"&&typeof o.text=="string"?o.text:void 0;return l?[{type:"text",text:l}]:[]});if(s.length>0)return s}return[{type:"text",text:t||"Tool permission"}]}function pSe(e){return e.kind==="permission"}function gSe(e){const t=rp(e);return t?rp(t.rawInput)??rp(t.input)??rp(t.args)??t:void 0}function rp(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function bSe(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 ySe(e,t,n){const s=new Array(e);return new Proxy(s,{get(r,i,o){if(typeof i=="string"){const l=i.charCodeAt(0);if(l>=48&&l<=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 Z1(e,t,n){let s=n.initialDeps??[],r,i=!0;function o(){const l=e();return(l.length!==s.length||l.some((u,d)=>s[d]!==u))&&(s=l,r=t(...l),n!=null&&n.onChange&&!(i&&n.skipInitialOnChange)&&n.onChange(r),i=!1),r}return o.updateDeps=l=>{s=l},o}function iq(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const vSe=(e,t)=>Math.abs(e-t)<1.01,wSe=(e,t,n)=>{let s;return function(...r){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,r),n)}};let Dw;const nA=()=>{if(Dw!==void 0)return Dw;if(typeof navigator>"u")return Dw=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Dw=!0;const e=navigator.maxTouchPoints;return Dw=navigator.platform==="MacIntel"&&e!==void 0&&e>0},oq=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},xSe=e=>e,kSe=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},_Se=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const r=o=>{const{width:l,height:c}=o;t({width:Math.round(l),height:Math.round(c)})};if(r(oq(n)),!s.ResizeObserver)return()=>{};const i=new s.ResizeObserver(o=>{const l=()=>{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(oq(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},xT={passive:!0},SSe=typeof window>"u"?!0:"onscrollend"in window,CSe=(e,t,n)=>{const s=e.scrollElement;if(!s)return;const r=e.targetWindow;if(!r)return;const i=e.options.useScrollendEvent&&SSe;let o=0;const l=i?null:wSe(r,()=>t(o,!1),e.options.isScrollingResetDelay),c=f=>()=>{o=n(s),l==null||l(),t(o,f)},u=c(!0),d=c(!1);return s.addEventListener("scroll",u,xT),i&&s.addEventListener("scrollend",d,xT),()=>{s.removeEventListener("scroll",u),i&&s.removeEventListener("scrollend",d)}},TSe=(e,t)=>CSe(e,t,n=>{const{horizontal:s,isRtl:r}=e.options;return s?n.scrollLeft*(r&&-1||1):n.scrollTop}),ESe=(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"]},ASe=(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})},jSe=ASe;class NSe{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 l=i.target,c=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l);for(const[u,d]of this.elementsCache)if(d===l){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(l,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:xSe,rangeExtractor:kSe,onChange:()=>{},measureElement:ESe,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 l=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,w=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)!==w)){u=!0;const x=m>0?this.getVirtualItemForOffset(this.getScrollOffset())??g[0]:null;x&&(l=[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)!==w)&&(c=k)}}this.options=i,u&&(this.pendingMin=0,this.itemSizeCacheVersion++);let d=!1,f=0;if(l&&this.scrollOffset!==null){const[m,p]=l,g=this.getMeasurements(),{count:b,getItemKey:w}=this.options;let y=0;for(;y<b&&w(y)!==m;)y++;if(y<b){const v=g[y];if(v){const x=v.start+p;x!==this.scrollOffset&&(f=x-this.scrollOffset,this.scrollOffset=x,d=!0)}}}(d||c)&&(this.pendingScrollAnchor=[d?l[0]:null,d?l[1]:0,c,f])},this.notify=n=>{var s,r;(r=(s=this.options).onChange)==null||r.call(s,this,n)},this.maybeNotify=Z1(()=>(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)},l=()=>{this._iosTouching=!1,!(!nA()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",o,xT),i.addEventListener("touchend",l,xT),this.unsubs.push(()=>{i.removeEventListener("touchstart",o),i.removeEventListener("touchend",l),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,l,c]=r;i!==null&&!l&&(nA()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?c!==0&&(this._iosDeferredAdjustment+=c):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),l&&this.scrollToEnd({behavior:l})}},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 l=n[o];if(r.has(l.lane))continue;const c=i.get(l.lane);if(c==null||l.end>c.end?i.set(l.lane,l):l.end<c.end&&r.set(l.lane,!0),r.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((o,l)=>o.end===l.end?o.index-l.index:o.end-l.end)[0]:void 0},this.getMeasurementOptions=Z1(()=>[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,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMin=null,{count:n,paddingStart:s,scrollMargin:r,getItemKey:i,enabled:o,lanes:l,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=Z1(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:s,scrollMargin:r,getItemKey:i,enabled:o,lanes:l,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),l===1){const g=this.options.gap,b=n*2;let w=this._flatMeasurements;if(!w||w.length<b){const x=new Float64Array(b);w&&f>0&&x.set(w.subarray(0,f*2)),w=x,this._flatMeasurements=w}let y;if(f===0)y=s+r;else{const x=f-1;y=w[x*2]+w[x*2+1]+g}for(let x=f;x<n;x++){const k=i(x),_=d.get(k),T=typeof _=="number"?_:this.options.estimateSize(x);w[x*2]=y,w[x*2+1]=T,y+=T+g}const v=ySe(n,w,i);return this.measurementsCache=v,v}const m=this.measurementsCache.slice(0,f),p=new Array(l).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),w=this.laneAssignments.get(g);let y,v;const x=c==="estimate"||d.has(b);if(w!==void 0&&this.options.lanes>1){y=w;const S=p[y],C=S!==void 0?m[S]:void 0;v=C?C.end+this.options.gap:s+r}else{const S=this.options.lanes===1?m[g-1]:this.getFurthestMeasurement(m,g);v=S?S.end+this.options.gap:s+r,y=S?S.lane:g%this.options.lanes,this.options.lanes>1&&x&&this.laneAssignments.set(g,y)}const k=d.get(b),_=typeof k=="number"?k:this.options.estimateSize(g),T=v+_;m[g]={index:g,start:v,size:_,end:T,key:b,lane:y},p[y]=g}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Z1(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,r,i)=>this.range=n.length>0&&s>0?ISe({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=Z1(()=>{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),l=Math.min(this.options.count-1,r+i);return n>=o&&n<=l}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((o,l)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(l))});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,l,c;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)c=this.options.getItemKey(n),l=u[n*2],o=u[n*2+1];else{const m=this.measurementsCache[n];if(!m)return;c=m.key,l=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:l,size:o,end:l+o,lane:0},f,this):l<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=Z1(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const r=[];for(let i=0,o=n.length;i<o;i++){const l=n[i],c=s[l];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=Oee(0,s.length-1,i?l=>r[l*2]:l=>iq(s[l]).start,n);return iq(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 l=this.getMaxScrollOffset();return Math.max(Math.min(l,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 l=s==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,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,l]=i,c=this.now();this.scrollState={index:n,align:l,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(l=>l===null);){const l=s[o];i[l.lane]===null&&(i[l.lane]=l.end),o--}r=Math.max(...i.filter(l=>l!==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&&(nA()&&(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&&vSe(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 l=this.getSize()||600,c=Math.abs(r-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&c>l;this.scrollState.lastTargetOffset=r,u||(this.scrollState.behavior="auto"),this._scrollToOffset(r,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Oee=(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 ISe({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,l=r?d=>r[d*2]+r[d*2+1]:d=>e[d].end;if(e.length<=s)return{startIndex:0,endIndex:i};let c=Oee(0,i,o,n),u=c;if(s===1)for(;u<i&&l(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 sA=typeof document<"u"?h.useLayoutEffect:h.useEffect;function MSe({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,w=u.getVirtualItems();for(const y of w){const v=y.start-b,x=u.elementsCache.get(y.key);x&&d.lastPositions.get(x)!==v&&(d.lastPositions.set(x,v),p?x.style.transform=m?`translate3d(${v}px, 0, 0)`:`translate3d(0, ${v}px, 0)`:x.style[g]=`${v}px`)}},l={...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?kd.flushSync(r):r()),(f=s.onChange)==null||f.call(s,u,d)}},[c]=h.useState(()=>{const u=new NSe(l);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(l),sA(()=>c._didMount(),[]),sA(()=>c._willUpdate()),sA(()=>{o(c)}),c}function RSe(e){return MSe({observeElementRect:_Se,observeElementOffset:TSe,scrollToFn:jSe,...e})}function $ee(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function DSe(e){var t;return((t=$ee(e))==null?void 0:t.type)==="task_execution"}function l0(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||DSe(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function yd(e){if(!l0(e))return!1;const t=$ee(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 Bee=h.createContext({}),aq=Bee.Provider;function Vu(){return h.useContext(Bee)}const LSe=["en","zh-CN"],cD={"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.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.","agentType.general-purpose":"General-purpose","agentType.explore":"Explore","agentType.statusline-setup":"Status Line Setup","agentType.test-engineer":"Test Engineer","agentType.fork":"Fork","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.download":"Download","common.downloading":"Downloading…","common.downloadFailed":e=>`Download failed: ${(e==null?void 0:e.message)??""}`,"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.allowOnceAndSwitchToDefault":"Allow once and switch to Default mode","approval.option.restorePrevious":"Yes, restore previous mode","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.submitting":"Submitting...","askUser.submitFailed":"Failed to submit answer","askUser.submitOptionUnavailable":"Submit option is unavailable","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.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.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.copyTsvHint":"Copy as TSV for pasting into spreadsheet apps","markdownTable.copyVisible":"Copy table","markdownTable.customColumns":"Custom columns","markdownTable.customColumns.tableSection":"Columns shown in the table","markdownTable.customColumns.detailSection":"Fields shown in expanded rows","markdownTable.customColumns.toggleAllTable":"Toggle all table columns","markdownTable.customColumns.toggleAllDetails":"Toggle all expanded-row fields","markdownTable.customColumns.reset":"Reset","markdownTable.customColumns.noDetails":"No expanded-row fields selected.","markdownTable.freezeFirstColumn":"Freeze first column","markdownTable.unfreezeFirstColumn":"Unfreeze first column","markdownTable.densityLabel":"Table density","markdownTable.densityCurrent":e=>`${(e==null?void 0:e.density)??""} density`.trim(),"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.reviewLatest":"View recent file changes","sideTask.title":"Side task","sideTask.description":"View or create side tasks","sideTask.new":"New","sideTask.create":"New side task","rightPanel.add":"Add panel","sideTask.creating":"Creating side task…","sideTask.createFailed":"Failed to create side task","sideTask.promptFailed":"Failed to send the side-task question","sideTask.renameFailed":"Failed to name side task","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.copySessionId":"Copy session ID","sidebar.copySessionIdFailed":"Failed to copy session ID","sidebar.sessionIdCopied":"Session ID copied","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.cleared":"Queue cleared.","queue.deleteTip":"Remove from queue","queue.editTip":"Remove from queue and edit again","queue.submitting":"Submitting...","queue.midTurnQueued":"Queued...","queue.serverQueued":"Queued on server...","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.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":"Review and fix local changes or run repository Autofix workflows","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.side.empty":"Please provide a question. Usage: /btw side <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","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.installTitle":"Add Extension","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.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","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","planExecution.dialogTitle":"Plan & tasks","planExecution.title":"Plan execution","planExecution.stepDetails":"Step details","planExecution.subagents":"Subagents","planExecution.openDetails":"Open subagent details","planExecution.view":"View plan execution","planExecution.dependsOn":"Depends on:","planExecution.unassigned":"Unassigned executions","planExecution.attention":"Needs attention","planExecution.status.running":"Running","planExecution.status.paused":"Paused","planExecution.status.completed":"Completed","planExecution.status.blocked":"Blocked","planExecution.status.in_progress":"In progress","planExecution.status.ready":"Ready","chat.scrollToBottom":"Scroll to bottom","chatHeader.toggleEnvironment":"Toggle environment information","chatHeader.toggleRightPanel":"Toggle right panel","environment.title":"Environment","environment.changes":"Changes","environment.changeCount":e=>`${(e==null?void 0:e.count)??0} changed`,"environment.clean":"Clean","environment.workspace":"Workspace","environment.branch":"Branch","environment.history":"Commit history","environment.agents":"Subagents","environment.unnamedAgent":e=>`Agent (${(e==null?void 0:e.index)??0})`,"environment.unavailable":"Unavailable","userMessage.showMore":"Show more","userMessage.showLess":"Collapse","userMessage.sendFailed":"Failed to send","userMessage.retrySend":"Retry sending message","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.morePaneActions":"More pane actions","splitView.defaultActionLabel":"Action","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. Approvals take effect immediately; Save and Cancel do not undo them.","channels.editor.pairing.refresh":"Refresh pairing requests","channels.editor.pairing.approve":"Approve","channels.editor.pairing.approveFor":e=>`Approve ${(e==null?void 0:e.sender)??"request"}, code ${(e==null?void 0:e.code)??""}`,"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.unavailable":"Pairing requests are temporarily unavailable. Try again.","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.pairing.approvals.title":"Pairing approvals","channels.editor.pairing.approvals.description":"Sender IDs approved through pairing for this Channel.","channels.editor.pairing.approvals.refresh":"Refresh pairing approvals","channels.editor.pairing.approvals.revoke":"Revoke","channels.editor.pairing.approvals.revokeFor":e=>`Revoke ${(e==null?void 0:e.senderId)??"pairing approval"}`,"channels.editor.pairing.approvals.revoked":e=>`Pairing approval for ${(e==null?void 0:e.senderId)??"this sender"} was revoked.`,"channels.editor.pairing.approvals.error":"Pairing approvals were not updated","channels.editor.pairing.approvals.unavailable":"Pairing approvals are temporarily unavailable. Try again.","channels.editor.pairing.approvals.empty.title":"No pairing approvals","channels.editor.pairing.approvals.empty.description":"Approved sender IDs will appear here.","channels.editor.pairing.approvals.confirm.title":e=>`Revoke pairing approval for ${(e==null?void 0:e.senderId)||"this sender"}?`,"channels.editor.pairing.approvals.confirm.description":"Only the approval created through pairing will be removed. Access configured in the Channel allowlist is not changed.","channels.editor.pairing.approvals.confirm.action":"Revoke approval","channels.editor.pairing.allowlist.title":"Configured allowlist","channels.editor.pairing.allowlist.description":"Configured allowlist users remain allowed after a pairing approval is revoked.","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:"},PSe={...cD,"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.display_image":"显示图片","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":"子智能体详情加载失败。","agentType.general-purpose":"通用","agentType.explore":"探索","agentType.statusline-setup":"状态栏设置","agentType.test-engineer":"测试工程师","agentType.fork":"分支","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.download":"下载","common.downloading":"正在下载…","common.downloadFailed":e=>`下载失败：${(e==null?void 0:e.message)??""}`,"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.allowOnceAndSwitchToDefault":"允许一次并切换到默认模式","approval.option.restorePrevious":"是，恢复之前的模式","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.submitting":"提交中...","askUser.submitFailed":"提交回答失败","askUser.submitOptionUnavailable":"提交选项不可用","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.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.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.copyTsvHint":"复制为 TSV，可粘贴到 Excel 等表格应用","markdownTable.copyVisible":"复制表格","markdownTable.customColumns":"自定义列","markdownTable.customColumns.tableSection":"显示在表格列的信息","markdownTable.customColumns.detailSection":"显示在折叠面板的信息","markdownTable.customColumns.toggleAllTable":"切换全部表格列","markdownTable.customColumns.toggleAllDetails":"切换全部折叠面板字段","markdownTable.customColumns.reset":"重置","markdownTable.customColumns.noDetails":"未选择折叠面板字段","markdownTable.freezeFirstColumn":"冻结首列","markdownTable.unfreezeFirstColumn":"取消冻结首列","markdownTable.densityLabel":"表格密度","markdownTable.densityCurrent":e=>`${(e==null?void 0:e.density)??""}密度`,"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.reviewLatest":"查看最近文件修改","sideTask.title":"侧边任务","sideTask.description":"查看或新增侧边任务","sideTask.new":"新增","sideTask.create":"新建侧边任务","rightPanel.add":"添加页签","sideTask.creating":"正在创建侧边任务…","sideTask.createFailed":"创建侧边任务失败","sideTask.promptFailed":"发送侧边任务问题失败","sideTask.renameFailed":"侧边任务命名失败","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.copySessionId":"复制会话 ID","sidebar.copySessionIdFailed":"复制会话 ID 失败","sidebar.sessionIdCopied":"会话 ID 已复制","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.cleared":"队列已清空。","queue.deleteTip":"移出队列","queue.editTip":"移出队列并将内容放回输入框","queue.submitting":"提交中...","queue.midTurnQueued":"排队中...","queue.serverQueued":"服务器排队中...","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.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":"审查并修复本地改动，或运行仓库 Autofix 工作流","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.side.empty":"请提供一个问题。用法：/btw side <你的问题>","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.installTitle":"添加扩展","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.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":"当前任务","planExecution.dialogTitle":"计划与任务","planExecution.title":"计划执行","planExecution.stepDetails":"步骤详情","planExecution.subagents":"子智能体","planExecution.openDetails":"打开子智能体详情","planExecution.view":"查看计划执行","planExecution.dependsOn":"依赖：","planExecution.unassigned":"未关联的执行","planExecution.attention":"需要关注","planExecution.status.running":"运行中","planExecution.status.paused":"已暂停","planExecution.status.completed":"已完成","planExecution.status.blocked":"被阻塞","planExecution.status.in_progress":"进行中","planExecution.status.ready":"就绪","chat.scrollToBottom":"回到底部","chatHeader.toggleEnvironment":"切换环境信息","chatHeader.toggleRightPanel":"切换右侧扩展区","environment.title":"环境信息","environment.changes":"变更","environment.changeCount":e=>`${(e==null?void 0:e.count)??0} 项变更`,"environment.clean":"无变更","environment.workspace":"工作区","environment.branch":"分支","environment.history":"提交历史","environment.agents":"子智能体","environment.unnamedAgent":e=>`智能体（${(e==null?void 0:e.index)??0}）`,"environment.unavailable":"不可用","userMessage.showMore":"显示更多","userMessage.showLess":"收起","userMessage.sendFailed":"发送失败","userMessage.retrySend":"重新发送消息","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.morePaneActions":"更多窗格操作","splitView.defaultActionLabel":"操作","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.approveFor":e=>`批准${(e==null?void 0:e.sender)??"该请求"}，配对码 ${(e==null?void 0:e.code)??""}`,"channels.editor.pairing.approved":e=>`${(e==null?void 0:e.sender)??"该用户"}现在可以使用此频道。`,"channels.editor.pairing.error":"未能更新配对请求","channels.editor.pairing.unavailable":"暂时无法获取配对请求，请重试。","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.pairing.approvals.title":"已配对用户","channels.editor.pairing.approvals.description":"通过配对获得此频道访问权限的用户 ID。","channels.editor.pairing.approvals.refresh":"刷新已配对用户","channels.editor.pairing.approvals.revoke":"撤销","channels.editor.pairing.approvals.revokeFor":e=>`撤销 ${(e==null?void 0:e.senderId)??"该用户"} 的配对授权`,"channels.editor.pairing.approvals.revoked":e=>`已撤销 ${(e==null?void 0:e.senderId)??"该用户"} 的配对授权。`,"channels.editor.pairing.approvals.error":"未能更新已配对用户","channels.editor.pairing.approvals.unavailable":"暂时无法获取已配对用户，请重试。","channels.editor.pairing.approvals.empty.title":"暂无已配对用户","channels.editor.pairing.approvals.empty.description":"批准配对请求后，用户 ID 会显示在这里。","channels.editor.pairing.approvals.confirm.title":e=>`撤销 ${(e==null?void 0:e.senderId)||"该用户"} 的配对授权？`,"channels.editor.pairing.approvals.confirm.description":"只会移除通过配对获得的授权，不会更改频道配置中的白名单访问权限。","channels.editor.pairing.approvals.confirm.action":"撤销授权","channels.editor.pairing.allowlist.title":"配置白名单","channels.editor.pairing.allowlist.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":"提示："},OSe={en:cD,"zh-CN":PSe},$Se={en:"English [en]","zh-CN":"中文 [zh-CN]"},zee=h.createContext({language:"en",t:e=>e});function jf(e){const t=e==null?void 0:e.trim().toLowerCase();return t&&(t==="zh"||t==="zh-cn"||t==="zh_cn")?"zh-CN":"en"}function uD(e){if(typeof e!="string")return;const t=e.trim().toLowerCase().replace(/_/g,"-");if(t){if(t==="auto")return jf(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 dD(e){return $Se[e]}function hD(e){const t=OSe[e];return(n,s)=>{const r=t[n]??cD[n]??n;return typeof r=="function"?r(s):r}}function BSe({language:e,children:t}){const n=h.useMemo(()=>({language:e,t:hD(e)}),[e]);return a.jsx(zee.Provider,{value:n,children:t})}function nt(){return h.useContext(zee)}const Fee=h.createContext(null);function Gu(){return h.useContext(Fee)}const zSe="_row_19m4s_1",FSe="_tip_19m4s_13",qSe="_chatRow_19m4s_35",HSe="_chatTip_19m4s_43",USe="_chatActions_19m4s_56",WSe="_copyButton_19m4s_71",Em={row:zSe,tip:FSe,chatRow:qSe,chatTip:HSe,chatActions:USe,copyButton:WSe};function Y7({timestamp:e,children:t,chatMode:n=!1,copyText:s,copyTitle:r="Copy"}){const[i,o]=h.useState(!1),l=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 a.jsx(a.Fragment,{children:t});const c=s?a.jsx("button",{type:"button",className:Em.copyButton,title:r,"aria-label":r,onClick:l,children:i?a.jsx(GSe,{}):a.jsx(VSe,{})}):null;return e===void 0?a.jsxs("div",{className:n?Em.chatRow:Em.row,children:[t,c]}):a.jsxs("div",{className:n?Em.chatRow:Em.row,children:[t,n?a.jsxs("span",{className:Em.chatActions,children:[a.jsx("span",{className:Em.chatTip,"aria-hidden":"true",children:Iy(e)}),c]}):a.jsx("span",{className:Em.tip,"aria-hidden":"true",children:Iy(e)})]})}function VSe(){return a.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[a.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"}),a.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function GSe(){return a.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function Iy(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 KSe="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",YSe="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",XSe="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",QSe="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 JSe(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 ZSe(e){if(!e||typeof e!="object")return!1;const t=e;return t.type==="text"?typeof t.text=="string":t.type!=="tag"?!1:JSe(t.tag)}function fD(e,t,n,s={}){if(!t)return null;try{const r=t(e);return!Array.isArray(r)||r.length===0||!r.every(ZSe)||s.requireSourcePreservation&&r.map(i=>i.type==="text"?i.text:y5(i.tag)).join("")!==e?null:r}catch(r){return console.warn(n,r),null}}const mD={extension:KSe,file:YSe,mcp:XSe,skill:QSe},e2e=new Set(Object.values(mD));function X7(e,t){if(!e||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return typeof n=="string"?n:void 0}function y5(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 h1(e,t){if(e)return X7(t,e)??X7(mD,e)}function pD(e){return e!==void 0&&e2e.has(e)}function t2e(e,t){const n=[];let s=0;for(const r of t){const i=y5(r);if(!i)continue;const o=e.indexOf(i,s);if(o<0)continue;const l=o+i.length;n.push({type:"reference",start:o,end:l,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=l}return n}function qee(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:l}=r,c=r.reference;!c||typeof c.id!="string"||i<s||o<=i||o>e.length||e.slice(i,o)!==l||(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??l,...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 n2e(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?X7(mD,e.kind):void 0)?"":n,tagValue:s,fallback:e.id,iconUrl:h1(e.kind,t)}}const s2e="modulepreload",r2e=function(e){return"/"+e},lq={},ye=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=Promise.allSettled(n.map(c=>{if(c=r2e(c),c in lq)return;lq[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":s2e,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),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 l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return r.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},Fr={Dark:"dark",Light:"light"},Hee=[Fr.Dark,Fr.Light],Uee=h.createContext(Fr.Dark),i2e=Uee.Provider;function im(){return h.useContext(Uee)}const vg="ui.theme",kT="general.language";function gD(e,t){return e===Fr.Light||e==="Qwen Light"?Fr.Light:e===Fr.Dark||e==="Qwen Dark"?Fr.Dark:t}function Wee(e){return e===Fr.Light?"Qwen Light":"Qwen Dark"}const Vee=h.createContext("interactive");Vee.Provider;function bD(){return h.useContext(Vee)}function cq(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 Gee(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const o2e=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,a2e=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,l2e={};function uq(e,t){return(l2e.jsx?a2e:o2e).test(e)}const c2e=/[ \t\n\f\r]/g;function v5(e){return typeof e=="object"?e.type==="text"?dq(e.value):!1:dq(e)}function dq(e){return e.replace(c2e,"")===""}class E_{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}E_.prototype.normal={};E_.prototype.property={};E_.prototype.space=void 0;function Kee(e,t){const n={},s={};for(const r of e)Object.assign(n,r.property),Object.assign(s,r.normal);return new E_(n,s,t)}function Tk(e){return e.toLowerCase()}class xc{constructor(t,n){this.attribute=n,this.property=t}}xc.prototype.attribute="";xc.prototype.booleanish=!1;xc.prototype.boolean=!1;xc.prototype.commaOrSpaceSeparated=!1;xc.prototype.commaSeparated=!1;xc.prototype.defined=!1;xc.prototype.mustUseProperty=!1;xc.prototype.number=!1;xc.prototype.overloadedBoolean=!1;xc.prototype.property="";xc.prototype.spaceSeparated=!1;xc.prototype.space=void 0;let u2e=0;const Ss=f1(),Bo=f1(),Q7=f1(),Ft=f1(),gi=f1(),Dg=f1(),Mc=f1();function f1(){return 2**++u2e}const J7=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ss,booleanish:Bo,commaOrSpaceSeparated:Mc,commaSeparated:Dg,number:Ft,overloadedBoolean:Q7,spaceSeparated:gi},Symbol.toStringTag,{value:"Module"})),rA=Object.keys(J7);class yD extends xc{constructor(t,n,s,r){let i=-1;if(super(t,n),hq(this,"space",r),typeof s=="number")for(;++i<rA.length;){const o=rA[i];hq(this,rA[i],(s&J7[o])===J7[o])}}}yD.prototype.defined=!0;function hq(e,t,n){n&&(e[t]=n)}function vv(e){const t={},n={};for(const[s,r]of Object.entries(e.properties)){const i=new yD(s,e.transform(e.attributes||{},s),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,n[Tk(s)]=s,n[Tk(i.attribute)]=s}return new E_(t,n,e.space)}const Yee=vv({properties:{ariaActiveDescendant:null,ariaAtomic:Bo,ariaAutoComplete:null,ariaBusy:Bo,ariaChecked:Bo,ariaColCount:Ft,ariaColIndex:Ft,ariaColSpan:Ft,ariaControls:gi,ariaCurrent:null,ariaDescribedBy:gi,ariaDetails:null,ariaDisabled:Bo,ariaDropEffect:gi,ariaErrorMessage:null,ariaExpanded:Bo,ariaFlowTo:gi,ariaGrabbed:Bo,ariaHasPopup:null,ariaHidden:Bo,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:gi,ariaLevel:Ft,ariaLive:null,ariaModal:Bo,ariaMultiLine:Bo,ariaMultiSelectable:Bo,ariaOrientation:null,ariaOwns:gi,ariaPlaceholder:null,ariaPosInSet:Ft,ariaPressed:Bo,ariaReadOnly:Bo,ariaRelevant:null,ariaRequired:Bo,ariaRoleDescription:gi,ariaRowCount:Ft,ariaRowIndex:Ft,ariaRowSpan:Ft,ariaSelected:Bo,ariaSetSize:Ft,ariaSort:null,ariaValueMax:Ft,ariaValueMin:Ft,ariaValueNow:Ft,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Xee(e,t){return t in e?e[t]:t}function Qee(e,t){return Xee(e,t.toLowerCase())}const d2e=vv({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Dg,acceptCharset:gi,accessKey:gi,action:null,allow:null,allowFullScreen:Ss,allowPaymentRequest:Ss,allowUserMedia:Ss,alpha:Ss,alt:null,as:null,async:Ss,autoCapitalize:null,autoComplete:gi,autoFocus:Ss,autoPlay:Ss,blocking:gi,capture:null,charSet:null,checked:Ss,cite:null,className:gi,closedBy:null,colorSpace:null,cols:Ft,colSpan:Ft,command:null,commandFor:null,content:null,contentEditable:Bo,controls:Ss,controlsList:gi,coords:Ft|Dg,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ss,defer:Ss,dir:null,dirName:null,disabled:Ss,download:Q7,draggable:Bo,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ss,formTarget:null,headers:gi,height:Ft,hidden:Q7,high:Ft,href:null,hrefLang:null,htmlFor:gi,httpEquiv:gi,id:null,imageSizes:null,imageSrcSet:null,inert:Ss,inputMode:null,integrity:null,is:null,isMap:Ss,itemId:null,itemProp:gi,itemRef:gi,itemScope:Ss,itemType:gi,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ss,low:Ft,manifest:null,max:null,maxLength:Ft,media:null,method:null,min:null,minLength:Ft,multiple:Ss,muted:Ss,name:null,nonce:null,noModule:Ss,noValidate:Ss,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:Ss,optimum:Ft,pattern:null,ping:gi,placeholder:null,playsInline:Ss,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ss,referrerPolicy:null,rel:gi,required:Ss,reversed:Ss,rows:Ft,rowSpan:Ft,sandbox:gi,scope:null,scoped:Ss,seamless:Ss,selected:Ss,shadowRootClonable:Ss,shadowRootCustomElementRegistry:Ss,shadowRootDelegatesFocus:Ss,shadowRootMode:null,shadowRootSerializable:Ss,shape:null,size:Ft,sizes:null,slot:null,span:Ft,spellCheck:Bo,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ft,step:null,style:null,tabIndex:Ft,target:null,title:null,translate:null,type:null,typeMustMatch:Ss,useMap:null,value:Bo,width:Ft,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:gi,axis:null,background:null,bgColor:null,border:Ft,borderColor:null,bottomMargin:Ft,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ss,declare:Ss,event:null,face:null,frame:null,frameBorder:null,hSpace:Ft,leftMargin:Ft,link:null,longDesc:null,lowSrc:null,marginHeight:Ft,marginWidth:Ft,noResize:Ss,noHref:Ss,noShade:Ss,noWrap:Ss,object:null,profile:null,prompt:null,rev:null,rightMargin:Ft,rules:null,scheme:null,scrolling:Bo,standby:null,summary:null,text:null,topMargin:Ft,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ft,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ss,disablePictureInPicture:Ss,disableRemotePlayback:Ss,exportParts:Dg,part:gi,prefix:null,property:null,results:Ft,security:null,unselectable:null},space:"html",transform:Qee}),h2e=vv({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:Mc,accentHeight:Ft,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ft,amplitude:Ft,arabicForm:null,ascent:Ft,attributeName:null,attributeType:null,azimuth:Ft,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ft,by:null,calcMode:null,capHeight:Ft,className:gi,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:Ft,diffuseConstant:Ft,direction:null,display:null,dur:null,divisor:Ft,dominantBaseline:null,download:Ss,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ft,enableBackground:null,end:null,event:null,exponent:Ft,externalResourcesRequired:null,fill:null,fillOpacity:Ft,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:Dg,g2:Dg,glyphName:Dg,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ft,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ft,horizOriginX:Ft,horizOriginY:Ft,id:null,ideographic:Ft,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ft,k:Ft,k1:Ft,k2:Ft,k3:Ft,k4:Ft,kernelMatrix:Mc,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ft,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:Ft,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:Ft,overlineThickness:Ft,paintOrder:null,panose1:null,path:null,pathLength:Ft,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:gi,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ft,pointsAtY:Ft,pointsAtZ:Ft,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Mc,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Mc,rev:Mc,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Mc,requiredFeatures:Mc,requiredFonts:Mc,requiredFormats:Mc,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:Ft,specularExponent:Ft,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ft,strikethroughThickness:Ft,string:null,stroke:null,strokeDashArray:Mc,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ft,strokeOpacity:Ft,strokeWidth:null,style:null,surfaceScale:Ft,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Mc,tabIndex:Ft,tableValues:null,target:null,targetX:Ft,targetY:Ft,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Mc,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ft,underlineThickness:Ft,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ft,values:null,vAlphabetic:Ft,vMathematical:Ft,vectorEffect:null,vHanging:Ft,vIdeographic:Ft,version:null,vertAdvY:Ft,vertOriginX:Ft,vertOriginY:Ft,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ft,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Xee}),Jee=vv({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()}}),Zee=vv({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Qee}),ete=vv({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),f2e={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"},m2e=/[A-Z]/g,fq=/-[a-z]/g,p2e=/^data[-\w.:]+$/i;function vD(e,t){const n=Tk(t);let s=t,r=xc;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&p2e.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(fq,b2e);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!fq.test(i)){let o=i.replace(m2e,g2e);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}r=yD}return new r(s,t)}function g2e(e){return"-"+e.toLowerCase()}function b2e(e){return e.charAt(1).toUpperCase()}const wD=Kee([Yee,d2e,Jee,Zee,ete],"html"),wv=Kee([Yee,h2e,Jee,Zee,ete],"svg");function mq(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function tte(e){return e.join(" ").trim()}var xD={},pq=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,y2e=/\n/g,v2e=/^\s*/,w2e=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,x2e=/^:\s*/,k2e=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,_2e=/^[;\s]*/,S2e=/^\s+|\s+$/g,C2e=`
`,gq="/",bq="*",hg="",T2e="comment",E2e="declaration";function A2e(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(y2e);b&&(n+=b.length);var w=g.lastIndexOf(C2e);s=~w?g.length-w: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 l(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 w=b[0];return r(w),e=e.slice(w.length),b}}function u(){c(v2e)}function d(g){var b;for(g=g||[];b=f();)b!==!1&&g.push(b);return g}function f(){var g=i();if(!(gq!=e.charAt(0)||bq!=e.charAt(1))){for(var b=2;hg!=e.charAt(b)&&(bq!=e.charAt(b)||gq!=e.charAt(b+1));)++b;if(b+=2,hg===e.charAt(b-1))return l("End of comment missing");var w=e.slice(2,b-2);return s+=2,r(w),e=e.slice(b),s+=2,g({type:T2e,comment:w})}}function m(){var g=i(),b=c(w2e);if(b){if(f(),!c(x2e))return l("property missing ':'");var w=c(k2e),y=g({type:E2e,property:yq(b[0].replace(pq,hg)),value:w?yq(w[0].replace(pq,hg)):hg});return c(_2e),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 yq(e){return e?e.replace(S2e,hg):hg}var j2e=A2e,N2e=lk&&lk.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xD,"__esModule",{value:!0});xD.default=M2e;const I2e=N2e(j2e);function M2e(e,t){let n=null;if(!e||typeof e!="string")return n;const s=(0,I2e.default)(e),r=typeof t=="function";return s.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:l}=i;r?t(o,l,i):l&&(n=n||{},n[o]=l)}),n}var w5={};Object.defineProperty(w5,"__esModule",{value:!0});w5.camelCase=void 0;var R2e=/^--[a-zA-Z0-9_-]+$/,D2e=/-([a-z])/g,L2e=/^[^-]+$/,P2e=/^-(webkit|moz|ms|o|khtml)-/,O2e=/^-(ms)-/,$2e=function(e){return!e||L2e.test(e)||R2e.test(e)},B2e=function(e,t){return t.toUpperCase()},vq=function(e,t){return"".concat(t,"-")},z2e=function(e,t){return t===void 0&&(t={}),$2e(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(O2e,vq):e=e.replace(P2e,vq),e.replace(D2e,B2e))};w5.camelCase=z2e;var F2e=lk&&lk.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},q2e=F2e(xD),H2e=w5;function Z7(e,t){var n={};return!e||typeof e!="string"||(0,q2e.default)(e,function(s,r){s&&r&&(n[(0,H2e.camelCase)(s,t)]=r)}),n}Z7.default=Z7;var U2e=Z7;const W2e=h_(U2e),nte=ste("end"),kD=ste("start");function ste(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 V2e(e){const t=kD(e),n=nte(e);if(t&&n)return{start:t,end:n}}function Ux(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?wq(e.position):"start"in e||"end"in e?wq(e):"line"in e||"column"in e?eI(e):""}function eI(e){return xq(e&&e.line)+":"+xq(e&&e.column)}function wq(e){return eI(e&&e.start)+"-"+eI(e&&e.end)}function xq(e){return e&&typeof e=="number"?e:1}class Sl 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 l=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=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=l?l.line:void 0,this.name=Ux(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}}Sl.prototype.file="";Sl.prototype.name="";Sl.prototype.reason="";Sl.prototype.message="";Sl.prototype.stack="";Sl.prototype.column=void 0;Sl.prototype.line=void 0;Sl.prototype.ancestors=void 0;Sl.prototype.cause=void 0;Sl.prototype.fatal=void 0;Sl.prototype.place=void 0;Sl.prototype.ruleId=void 0;Sl.prototype.source=void 0;const _D={}.hasOwnProperty,G2e=new Map,K2e=/[A-Z]/g,Y2e=new Set(["table","tbody","thead","tfoot","tr"]),X2e=new Set(["td","th"]),rte="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Q2e(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=iCe(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=rCe(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"?wv:wD,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=ite(r,e,void 0);return i&&typeof i!="string"?i:r.create(e,r.Fragment,{children:i||void 0},void 0)}function ite(e,t,n){if(t.type==="element")return J2e(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Z2e(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return tCe(e,t,n);if(t.type==="mdxjsEsm")return eCe(e,t);if(t.type==="root")return nCe(e,t,n);if(t.type==="text")return sCe(e,t)}function J2e(e,t,n){const s=e.schema;let r=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(r=wv,e.schema=r),e.ancestors.push(t);const i=ate(e,t.tagName,!1),o=oCe(e,t);let l=CD(e,t);return Y2e.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!v5(c):!0})),ote(e,o,i,t),SD(o,l),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function Z2e(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)}Ek(e,t.position)}function eCe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ek(e,t.position)}function tCe(e,t,n){const s=e.schema;let r=s;t.name==="svg"&&s.space==="html"&&(r=wv,e.schema=r),e.ancestors.push(t);const i=t.name===null?e.Fragment:ate(e,t.name,!0),o=aCe(e,t),l=CD(e,t);return ote(e,o,i,t),SD(o,l),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function nCe(e,t,n){const s={};return SD(s,CD(e,t)),e.create(t,e.Fragment,s,n)}function sCe(e,t){return t.value}function ote(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function SD(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function rCe(e,t,n){return s;function s(r,i,o,l){const u=Array.isArray(o.children)?n:t;return l?u(i,o,l):u(i,o)}}function iCe(e,t){return n;function n(s,r,i,o){const l=Array.isArray(i.children),c=kD(s);return t(r,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function oCe(e,t){const n={};let s,r;for(r in t.properties)if(r!=="children"&&_D.call(t.properties,r)){const i=lCe(e,r,t.properties[r]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&X2e.has(t.tagName)?s=l:n[o]=l}}if(s){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function aCe(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 l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Ek(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 l=s.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else Ek(e,t.position);else i=s.value===null?!0:s.value;n[r]=i}return n}function CD(e,t){const n=[];let s=-1;const r=e.passKeys?new Map:G2e;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 l=ite(e,i,o);l!==void 0&&n.push(l)}return n}function lCe(e,t,n){const s=vD(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?Gee(n):tte(n)),s.property==="style"){let r=typeof n=="object"?n:cCe(e,String(n));return e.stylePropertyNameCase==="css"&&(r=uCe(r)),["style",r]}return[e.elementAttributeNameCase==="react"&&s.space?f2e[s.property]||s.property:s.attribute,n]}}function cCe(e,t){try{return W2e(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,r=new Sl("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=rte+"#cannot-parse-style-attribute",r}}function ate(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 l=uq(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}s=o}else s=uq(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const r=s.value;return _D.call(e.components,r)?e.components[r]:r}if(e.evaluater)return e.evaluater.evaluateExpression(s);Ek(e)}function Ek(e,t){const n=new Sl("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=rte+"#cannot-handle-mdx-estrees-without-createevaluater",n}function uCe(e){const t={};let n;for(n in e)_D.call(e,n)&&(t[dCe(n)]=e[n]);return t}function dCe(e){let t=e.replace(K2e,hCe);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function hCe(e){return"-"+e.toLowerCase()}const iA={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"]},fCe={};function TD(e,t){const n=fCe,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,r=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return lte(e,s,r)}function lte(e,t,n){if(mCe(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 kq(e.children,t,n)}return Array.isArray(e)?kq(e,t,n):""}function kq(e,t,n){const s=[];let r=-1;for(;++r<e.length;)s[r]=lte(e[r],t,n);return s.join("")}function mCe(e){return!!(e&&typeof e=="object")}const _q=document.createElement("i");function ED(e){const t="&"+e+";";_q.innerHTML=t;const n=_q.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Kc(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 xu(e,t){return e.length>0?(Kc(e,e.length,0,t),e):t}const Sq={}.hasOwnProperty;function cte(e){const t={};let n=-1;for(;++n<e.length;)pCe(t,e[n]);return t}function pCe(e,t){let n;for(n in t){const r=(Sq.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){Sq.call(r,o)||(r[o]=[]);const l=i[o];gCe(r[o],Array.isArray(l)?l:l?[l]:[])}}}function gCe(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);Kc(e,0,0,s)}function ute(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 fd(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const zl=c0(/[A-Za-z]/),bl=c0(/[\dA-Za-z]/),bCe=c0(/[#-'*+\--9=?A-Z^-~]/);function _T(e){return e!==null&&(e<32||e===127)}const tI=c0(/\d/),yCe=c0(/[\dA-Fa-f]/),vCe=c0(/[!-/:-@[-`{-~]/);function Yn(e){return e!==null&&e<-2}function ki(e){return e!==null&&(e<0||e===32)}function dr(e){return e===-2||e===-1||e===32}const x5=c0(new RegExp("\\p{P}|\\p{S}","u")),Wg=c0(/\s/);function c0(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function xv(e){const t=[];let n=-1,s=0,r=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&bl(e.charCodeAt(n+1))&&bl(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 l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),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 sr(e,t,n,s){const r=s?s-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return dr(c)?(e.enter(n),l(c)):t(c)}function l(c){return dr(c)&&i++<r?(e.consume(c),l):(e.exit(n),t(c))}}const wCe={tokenize:xCe};function xCe(e){const t=e.attempt(this.parser.constructs.contentInitial,s,r);let n;return t;function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),sr(e,t,"linePrefix")}function r(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Yn(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),o)}}const kCe={tokenize:_Ce},Cq={tokenize:SCe};function _Ce(e){const t=this,n=[];let s=0,r,i,o;return l;function l(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&&v();const k=t.events.length;let _=k,T;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){T=t.events[_][1].end;break}y(s);let S=k;for(;S<t.events.length;)t.events[S][1].end={...T},S++;return Kc(t.events,_+1,0,t.events.slice(k)),t.events.length=S,u(x)}return l(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(Cq,d,f)(x)}function d(x){return r&&v(),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(Cq,p,g)(x)}function p(x){return s++,n.push([t.currentConstruct,t.containerState]),m(x)}function g(x){if(x===null){r&&v(),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){w(e.exit("chunkFlow"),!0),y(0),e.consume(x);return}return Yn(x)?(e.consume(x),w(e.exit("chunkFlow")),s=0,t.interrupt=void 0,l):(e.consume(x),b)}function w(x,k){const _=t.sliceStream(x);if(k&&_.push(null),x.previous=i,i&&(i.next=x),i=x,r.defineSkip(x.start),r.write(_),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 S=t.events.length;let C=S,N,E;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){if(N){E=t.events[C][1].end;break}N=!0}for(y(s),T=S;T<t.events.length;)t.events[T][1].end={...E},T++;Kc(t.events,C+1,0,t.events.slice(S)),t.events.length=T}}function y(x){let k=n.length;for(;k-- >x;){const _=n[k];t.containerState=_[1],_[0].exit.call(t,e)}n.length=x}function v(){r.write([null]),i=void 0,r=void 0,t.containerState._closeFlow=void 0}}function SCe(e,t,n){return sr(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function My(e){if(e===null||ki(e)||Wg(e))return 1;if(x5(e))return 2}function k5(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 nI={name:"attention",resolveAll:CCe,tokenize:TCe};function CCe(e,t){let n=-1,s,r,i,o,l,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};Tq(f,-c),Tq(m,c),o={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[s][1].end}},l={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:{...l.end}},e[s][1].end={...o.start},e[n][1].start={...l.end},u=[],e[s][1].end.offset-e[s][1].start.offset&&(u=xu(u,[["enter",e[s][1],t],["exit",e[s][1],t]])),u=xu(u,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=xu(u,k5(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),u=xu(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",r,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=xu(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Kc(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 TCe(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,r=My(s);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const u=e.exit("attentionSequence"),d=My(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 Tq(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const ECe={name:"autolink",tokenize:ACe};function ACe(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 zl(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||bl(p)?(s=1,l(p)):u(p)}function l(p){return p===58?(e.consume(p),s=0,c):(p===43||p===45||p===46||bl(p))&&s++<32?(e.consume(p),l):(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||_T(p)?n(p):(e.consume(p),c)}function u(p){return p===64?(e.consume(p),d):bCe(p)?(e.consume(p),u):n(p)}function d(p){return bl(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||bl(p))&&s++<63){const g=p===45?m:f;return e.consume(p),g}return n(p)}}const A_={partial:!0,tokenize:jCe};function jCe(e,t,n){return s;function s(i){return dr(i)?sr(e,r,"linePrefix")(i):r(i)}function r(i){return i===null||Yn(i)?t(i):n(i)}}const dte={continuation:{tokenize:ICe},exit:MCe,name:"blockQuote",tokenize:NCe};function NCe(e,t,n){const s=this;return r;function r(o){if(o===62){const l=s.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return dr(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function ICe(e,t,n){const s=this;return r;function r(o){return dr(o)?sr(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(dte,t,n)(o)}}function MCe(e){e.exit("blockQuote")}const hte={name:"characterEscape",tokenize:RCe};function RCe(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 vCe(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const fte={name:"characterReference",tokenize:DCe};function DCe(e,t,n){const s=this;let r=0,i,o;return l;function l(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=bl,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=yCe,d):(e.enter("characterReferenceValue"),i=7,o=tI,d(f))}function d(f){if(f===59&&r){const m=e.exit("characterReferenceValue");return o===bl&&!ED(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 Eq={partial:!0,tokenize:PCe},Aq={concrete:!0,name:"codeFenced",tokenize:LCe};function LCe(e,t,n){const s=this,r={partial:!0,tokenize:_};let i=0,o=0,l;return c;function c(T){return u(T)}function u(T){const S=s.events[s.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,l=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(T)}function d(T){return T===l?(o++,e.consume(T),d):o<3?n(T):(e.exit("codeFencedFenceSequence"),dr(T)?sr(e,f,"whitespace")(T):f(T))}function f(T){return T===null||Yn(T)?(e.exit("codeFencedFence"),s.interrupt?t(T):e.check(Eq,b,k)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(T))}function m(T){return T===null||Yn(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(T)):dr(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),sr(e,p,"whitespace")(T)):T===96&&T===l?n(T):(e.consume(T),m)}function p(T){return T===null||Yn(T)?f(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||Yn(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(T)):T===96&&T===l?n(T):(e.consume(T),g)}function b(T){return e.attempt(r,k,w)(T)}function w(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),y}function y(T){return i>0&&dr(T)?sr(e,v,"linePrefix",i+1)(T):v(T)}function v(T){return T===null||Yn(T)?e.check(Eq,b,k)(T):(e.enter("codeFlowValue"),x(T))}function x(T){return T===null||Yn(T)?(e.exit("codeFlowValue"),v(T)):(e.consume(T),x)}function k(T){return e.exit("codeFenced"),t(T)}function _(T,S,C){let N=0;return E;function E(L){return T.enter("lineEnding"),T.consume(L),T.exit("lineEnding"),O}function O(L){return T.enter("codeFencedFence"),dr(L)?sr(T,B,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):B(L)}function B(L){return L===l?(T.enter("codeFencedFenceSequence"),D(L)):C(L)}function D(L){return L===l?(N++,T.consume(L),D):N>=o?(T.exit("codeFencedFenceSequence"),dr(L)?sr(T,j,"whitespace")(L):j(L)):C(L)}function j(L){return L===null||Yn(L)?(T.exit("codeFencedFence"),S(L)):C(L)}}}function PCe(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 oA={name:"codeIndented",tokenize:$Ce},OCe={partial:!0,tokenize:BCe};function $Ce(e,t,n){const s=this;return r;function r(u){return e.enter("codeIndented"),sr(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):Yn(u)?e.attempt(OCe,o,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||Yn(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function BCe(e,t,n){const s=this;return r;function r(o){return s.parser.lazy[s.now().line]?n(o):Yn(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r):sr(e,i,"linePrefix",5)(o)}function i(o){const l=s.events[s.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):Yn(o)?r(o):n(o)}}const zCe={name:"codeText",previous:qCe,resolve:FCe,tokenize:HCe};function FCe(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 qCe(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function HCe(e,t,n){let s=0,r,i;return o;function o(f){return e.enter("codeText"),e.enter("codeTextSequence"),l(f)}function l(f){return f===96?(e.consume(f),s++,l):(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)):Yn(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||Yn(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 UCe{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&&Lw(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),Lw(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Lw(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);Lw(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Lw(this.left,n.reverse())}}}function Lw(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 mte(e){const t={};let n=-1,s,r,i,o,l,c,u;const d=new UCe(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,WCe(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},l=d.slice(r,n),l.unshift(s),d.splice(r,n-r+1,l))}}return Kc(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function WCe(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 l=o.events,c=[],u={};let d,f,m=-1,p=n,g=0,b=0;const w=[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<l.length;)l[m][0]==="exit"&&l[m-1][0]==="enter"&&l[m][1].type===l[m-1][1].type&&l[m][1].start.line!==l[m][1].end.line&&(b=m+1,w.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):w.pop(),m=w.length;m--;){const y=l.slice(w[m],w[m+1]),v=i.pop();c.push([v,v+y.length-1]),e.splice(v,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 VCe={resolve:KCe,tokenize:YCe},GCe={partial:!0,tokenize:XCe};function KCe(e){return mte(e),e}function YCe(e,t){let n;return s;function s(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(l)}function r(l){return l===null?i(l):Yn(l)?e.check(GCe,o,i)(l):(e.consume(l),r)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}function XCe(e,t,n){const s=this;return r;function r(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),sr(e,i,"linePrefix")}function i(o){if(o===null||Yn(o))return n(o);const l=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(s.parser.constructs.flow,n,t)(o)}}function pte(e,t,n,s,r,i,o,l,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||_T(y)?n(y):(e.enter(s),e.enter(o),e.enter(l),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(l),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(l),m(y)):y===null||y===60||Yn(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||ki(y))?(e.exit("chunkString"),e.exit(l),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||_T(y)?n(y):(e.consume(y),y===92?w:b)}function w(y){return y===40||y===41||y===92?(e.consume(y),b):b(y)}}function gte(e,t,n,s,r,i){const o=this;let l=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 l>999||p===null||p===91||p===93&&!c||p===94&&!l&&"_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):Yn(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||Yn(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!dr(p)),p===92?m:f)}function m(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function bte(e,t,n,s,r,i){let o;return l;function l(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):Yn(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),sr(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===o||m===null||Yn(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 Wx(e,t){let n;return s;function s(r){return Yn(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),n=!0,s):dr(r)?sr(e,s,n?"linePrefix":"lineSuffix")(r):t(r)}}const QCe={name:"definition",tokenize:ZCe},JCe={partial:!0,tokenize:e4e};function ZCe(e,t,n){const s=this;let r;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return gte.call(s,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return r=fd(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 ki(p)?Wx(e,u)(p):u(p)}function u(p){return pte(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(JCe,f,f)(p)}function f(p){return dr(p)?sr(e,m,"whitespace")(p):m(p)}function m(p){return p===null||Yn(p)?(e.exit("definition"),s.parser.defined.push(r),t(p)):n(p)}}function e4e(e,t,n){return s;function s(l){return ki(l)?Wx(e,r)(l):n(l)}function r(l){return bte(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return dr(l)?sr(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Yn(l)?t(l):n(l)}}const t4e={name:"hardBreakEscape",tokenize:n4e};function n4e(e,t,n){return s;function s(i){return e.enter("hardBreakEscape"),e.consume(i),r}function r(i){return Yn(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const s4e={name:"headingAtx",resolve:r4e,tokenize:i4e};function r4e(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"},Kc(e,s,n-s+1,[["enter",r,t],["enter",i,t],["exit",i,t],["exit",r,t]])),e}function i4e(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||ki(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||Yn(d)?(e.exit("atxHeading"),t(d)):dr(d)?sr(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||ki(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const o4e=["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"],jq=["pre","script","style","textarea"],a4e={concrete:!0,name:"htmlFlow",resolveTo:u4e,tokenize:d4e},l4e={partial:!0,tokenize:f4e},c4e={partial:!0,tokenize:h4e};function u4e(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 d4e(e,t,n){const s=this;let r,i,o,l,c;return u;function u(M){return d(M)}function d(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),f}function f(M){return M===33?(e.consume(M),m):M===47?(e.consume(M),i=!0,b):M===63?(e.consume(M),r=3,s.interrupt?t:R):zl(M)?(e.consume(M),o=String.fromCharCode(M),w):n(M)}function m(M){return M===45?(e.consume(M),r=2,p):M===91?(e.consume(M),r=5,l=0,g):zl(M)?(e.consume(M),r=4,s.interrupt?t:R):n(M)}function p(M){return M===45?(e.consume(M),s.interrupt?t:R):n(M)}function g(M){const F="CDATA[";return M===F.charCodeAt(l++)?(e.consume(M),l===F.length?s.interrupt?t:B:g):n(M)}function b(M){return zl(M)?(e.consume(M),o=String.fromCharCode(M),w):n(M)}function w(M){if(M===null||M===47||M===62||ki(M)){const F=M===47,J=o.toLowerCase();return!F&&!i&&jq.includes(J)?(r=1,s.interrupt?t(M):B(M)):o4e.includes(o.toLowerCase())?(r=6,F?(e.consume(M),y):s.interrupt?t(M):B(M)):(r=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(M):i?v(M):x(M))}return M===45||bl(M)?(e.consume(M),o+=String.fromCharCode(M),w):n(M)}function y(M){return M===62?(e.consume(M),s.interrupt?t:B):n(M)}function v(M){return dr(M)?(e.consume(M),v):E(M)}function x(M){return M===47?(e.consume(M),E):M===58||M===95||zl(M)?(e.consume(M),k):dr(M)?(e.consume(M),x):E(M)}function k(M){return M===45||M===46||M===58||M===95||bl(M)?(e.consume(M),k):_(M)}function _(M){return M===61?(e.consume(M),T):dr(M)?(e.consume(M),_):x(M)}function T(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),c=M,S):dr(M)?(e.consume(M),T):C(M)}function S(M){return M===c?(e.consume(M),c=null,N):M===null||Yn(M)?n(M):(e.consume(M),S)}function C(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||ki(M)?_(M):(e.consume(M),C)}function N(M){return M===47||M===62||dr(M)?x(M):n(M)}function E(M){return M===62?(e.consume(M),O):n(M)}function O(M){return M===null||Yn(M)?B(M):dr(M)?(e.consume(M),O):n(M)}function B(M){return M===45&&r===2?(e.consume(M),z):M===60&&r===1?(e.consume(M),I):M===62&&r===4?(e.consume(M),Y):M===63&&r===3?(e.consume(M),R):M===93&&r===5?(e.consume(M),K):Yn(M)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(l4e,W,D)(M)):M===null||Yn(M)?(e.exit("htmlFlowData"),D(M)):(e.consume(M),B)}function D(M){return e.check(c4e,j,W)(M)}function j(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),L}function L(M){return M===null||Yn(M)?D(M):(e.enter("htmlFlowData"),B(M))}function z(M){return M===45?(e.consume(M),R):B(M)}function I(M){return M===47?(e.consume(M),o="",$):B(M)}function $(M){if(M===62){const F=o.toLowerCase();return jq.includes(F)?(e.consume(M),Y):B(M)}return zl(M)&&o.length<8?(e.consume(M),o+=String.fromCharCode(M),$):B(M)}function K(M){return M===93?(e.consume(M),R):B(M)}function R(M){return M===62?(e.consume(M),Y):M===45&&r===2?(e.consume(M),R):B(M)}function Y(M){return M===null||Yn(M)?(e.exit("htmlFlowData"),W(M)):(e.consume(M),Y)}function W(M){return e.exit("htmlFlow"),t(M)}}function h4e(e,t,n){const s=this;return r;function r(o){return Yn(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 f4e(e,t,n){return s;function s(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(A_,t,n)}}const m4e={name:"htmlText",tokenize:p4e};function p4e(e,t,n){const s=this;let r,i,o;return l;function l(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),c}function c(R){return R===33?(e.consume(R),u):R===47?(e.consume(R),_):R===63?(e.consume(R),x):zl(R)?(e.consume(R),C):n(R)}function u(R){return R===45?(e.consume(R),d):R===91?(e.consume(R),i=0,g):zl(R)?(e.consume(R),v):n(R)}function d(R){return R===45?(e.consume(R),p):n(R)}function f(R){return R===null?n(R):R===45?(e.consume(R),m):Yn(R)?(o=f,I(R)):(e.consume(R),f)}function m(R){return R===45?(e.consume(R),p):f(R)}function p(R){return R===62?z(R):R===45?m(R):f(R)}function g(R){const Y="CDATA[";return R===Y.charCodeAt(i++)?(e.consume(R),i===Y.length?b:g):n(R)}function b(R){return R===null?n(R):R===93?(e.consume(R),w):Yn(R)?(o=b,I(R)):(e.consume(R),b)}function w(R){return R===93?(e.consume(R),y):b(R)}function y(R){return R===62?z(R):R===93?(e.consume(R),y):b(R)}function v(R){return R===null||R===62?z(R):Yn(R)?(o=v,I(R)):(e.consume(R),v)}function x(R){return R===null?n(R):R===63?(e.consume(R),k):Yn(R)?(o=x,I(R)):(e.consume(R),x)}function k(R){return R===62?z(R):x(R)}function _(R){return zl(R)?(e.consume(R),T):n(R)}function T(R){return R===45||bl(R)?(e.consume(R),T):S(R)}function S(R){return Yn(R)?(o=S,I(R)):dr(R)?(e.consume(R),S):z(R)}function C(R){return R===45||bl(R)?(e.consume(R),C):R===47||R===62||ki(R)?N(R):n(R)}function N(R){return R===47?(e.consume(R),z):R===58||R===95||zl(R)?(e.consume(R),E):Yn(R)?(o=N,I(R)):dr(R)?(e.consume(R),N):z(R)}function E(R){return R===45||R===46||R===58||R===95||bl(R)?(e.consume(R),E):O(R)}function O(R){return R===61?(e.consume(R),B):Yn(R)?(o=O,I(R)):dr(R)?(e.consume(R),O):N(R)}function B(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),r=R,D):Yn(R)?(o=B,I(R)):dr(R)?(e.consume(R),B):(e.consume(R),j)}function D(R){return R===r?(e.consume(R),r=void 0,L):R===null?n(R):Yn(R)?(o=D,I(R)):(e.consume(R),D)}function j(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||ki(R)?N(R):(e.consume(R),j)}function L(R){return R===47||R===62||ki(R)?N(R):n(R)}function z(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function I(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),$}function $(R){return dr(R)?sr(e,K,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):K(R)}function K(R){return e.enter("htmlTextData"),o(R)}}const AD={name:"labelEnd",resolveAll:v4e,resolveTo:w4e,tokenize:x4e},g4e={tokenize:k4e},b4e={tokenize:_4e},y4e={tokenize:S4e};function v4e(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&&Kc(e,0,e.length,n),e}function w4e(e,t){let n=e.length,s=0,r,i,o,l;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 l=[["enter",c,t],["enter",u,t]],l=xu(l,e.slice(i+1,i+s+3)),l=xu(l,[["enter",d,t]]),l=xu(l,k5(t.parser.constructs.insideSpan.null,e.slice(i+s+4,o-3),t)),l=xu(l,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),l=xu(l,e.slice(o+1)),l=xu(l,[["exit",c,t]]),Kc(e,i,e.length,l),e}function x4e(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 l;function l(m){return i?i._inactive?f(m):(o=s.parser.defined.includes(fd(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(g4e,d,o?d:f)(m):m===91?e.attempt(b4e,d,o?u:f)(m):o?d(m):f(m)}function u(m){return e.attempt(y4e,d,f)(m)}function d(m){return t(m)}function f(m){return i._balanced=!0,n(m)}}function k4e(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 ki(f)?Wx(e,i)(f):i(f)}function i(f){return f===41?d(f):pte(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function o(f){return ki(f)?Wx(e,c)(f):d(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?bte(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return ki(f)?Wx(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 _4e(e,t,n){const s=this;return r;function r(l){return gte.call(s,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return s.parser.defined.includes(fd(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function S4e(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 C4e={name:"labelStartImage",resolveAll:AD.resolveAll,tokenize:T4e};function T4e(e,t,n){const s=this;return r;function r(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(l):t(l)}}const E4e={name:"labelStartLink",resolveAll:AD.resolveAll,tokenize:A4e};function A4e(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 aA={name:"lineEnding",tokenize:j4e};function j4e(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),sr(e,t,"linePrefix")}}const o4={name:"thematicBreak",tokenize:N4e};function N4e(e,t,n){let s=0,r;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return r=u,l(u)}function l(u){return u===r?(e.enter("thematicBreakSequence"),c(u)):s>=3&&(u===null||Yn(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===r?(e.consume(u),s++,c):(e.exit("thematicBreakSequence"),dr(u)?sr(e,l,"whitespace")(u):l(u))}}const sc={continuation:{tokenize:D4e},exit:P4e,name:"list",tokenize:R4e},I4e={partial:!0,tokenize:O4e},M4e={partial:!0,tokenize:L4e};function R4e(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 l;function l(p){const g=s.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!s.containerState.marker||p===s.containerState.marker:tI(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(o4,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 tI(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(A_,s.interrupt?n:d,e.attempt(I4e,m,f))}function d(p){return s.containerState.initialBlankLine=!0,i++,m(p)}function f(p){return dr(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 D4e(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(A_,r,i);function r(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,sr(e,t,"listItemIndent",s.containerState.size+1)(l)}function i(l){return s.containerState.furtherBlankLines||!dr(l)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,o(l)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(M4e,t,o)(l))}function o(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,sr(e,e.attempt(sc,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function L4e(e,t,n){const s=this;return sr(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 P4e(e){e.exit(this.containerState.type)}function O4e(e,t,n){const s=this;return sr(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!dr(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Nq={name:"setextUnderline",resolveTo:$4e,tokenize:B4e};function $4e(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 B4e(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"),l(u)}function l(u){return u===r?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),dr(u)?sr(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Yn(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const z4e={tokenize:F4e};function F4e(e){const t=this,n=e.attempt(A_,s,e.attempt(this.parser.constructs.flowInitial,r,sr(e,e.attempt(this.parser.constructs.flow,r,e.attempt(VCe,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 q4e={resolveAll:vte()},H4e=yte("string"),U4e=yte("text");function yte(e){return{resolveAll:vte(e==="text"?W4e:void 0),tokenize:t};function t(n){const s=this,r=this.parser.constructs[e],i=n.attempt(r,o,l);return o;function o(d){return u(d)?i(d):l(d)}function l(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 vte(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 W4e(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,l=0,c;for(;i--;){const u=r[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(u===-2)c=!0,l++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:s.start._bufferIndex+o,_index:s.start._index+i,line:s.end.line,column:s.end.column-l,offset:s.end.offset-l},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 V4e={42:sc,43:sc,45:sc,48:sc,49:sc,50:sc,51:sc,52:sc,53:sc,54:sc,55:sc,56:sc,57:sc,62:dte},G4e={91:QCe},K4e={[-2]:oA,[-1]:oA,32:oA},Y4e={35:s4e,42:o4,45:[Nq,o4],60:a4e,61:Nq,95:o4,96:Aq,126:Aq},X4e={38:fte,92:hte},Q4e={[-5]:aA,[-4]:aA,[-3]:aA,33:C4e,38:fte,42:nI,60:[ECe,m4e],91:E4e,92:[t4e,hte],93:AD,95:nI,96:zCe},J4e={null:[nI,q4e]},Z4e={null:[42,95]},eTe={null:[]},tTe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Z4e,contentInitial:G4e,disable:eTe,document:V4e,flow:Y4e,flowInitial:K4e,insideSpan:J4e,string:X4e,text:Q4e},Symbol.toStringTag,{value:"Module"}));function nTe(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=[],l=[];const c={attempt:S(_),check:S(T),consume:v,enter:x,exit:k,interrupt:S(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=xu(o,O),w(),o[o.length-1]!==null?[]:(C(t,0),u.events=k5(i,u.events,u),u.events)}function m(O,B){return rTe(p(O),B)}function p(O){return sTe(o,O)}function g(){const{_bufferIndex:O,_index:B,line:D,column:j,offset:L}=s;return{_bufferIndex:O,_index:B,line:D,column:j,offset:L}}function b(O){r[O.line]=O.column,E()}function w(){let O;for(;s._index<o.length;){const B=o[s._index];if(typeof B=="string")for(O=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===O&&s._bufferIndex<B.length;)y(B.charCodeAt(s._bufferIndex));else y(B)}}function y(O){d=d(O)}function v(O){Yn(O)?(s.line++,s.column=1,s.offset+=O===-3?2:1,E()):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,B){const D=B||{};return D.type=O,D.start=g(),u.events.push(["enter",D,u]),l.push(D),D}function k(O){const B=l.pop();return B.end=g(),u.events.push(["exit",B,u]),B}function _(O,B){C(O,B.from)}function T(O,B){B.restore()}function S(O,B){return D;function D(j,L,z){let I,$,K,R;return Array.isArray(j)?W(j):"tokenize"in j?W([j]):Y(j);function Y(V){return U;function U(le){const pe=le!==null&&V[le],fe=le!==null&&V.null,Q=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(fe)?fe:fe?[fe]:[]];return W(Q)(le)}}function W(V){return I=V,$=0,V.length===0?z:M(V[$])}function M(V){return U;function U(le){return R=N(),K=V,V.partial||(u.currentConstruct=V),V.name&&u.parser.constructs.disable.null.includes(V.name)?J():V.tokenize.call(B?Object.assign(Object.create(u),B):u,c,F,J)(le)}}function F(V){return O(K,R),L}function J(V){return R.restore(),++$<I.length?M(I[$]):z}}}function C(O,B){O.resolveAll&&!i.includes(O)&&i.push(O),O.resolve&&Kc(u.events,B,u.events.length-B,O.resolve(u.events.slice(B),u)),O.resolveTo&&(u.events=O.resolveTo(u.events,u))}function N(){const O=g(),B=u.previous,D=u.currentConstruct,j=u.events.length,L=Array.from(l);return{from:j,restore:z};function z(){s=O,u.previous=B,u.currentConstruct=D,u.events.length=j,l=L,E()}}function E(){s.line in r&&s.column<2&&(s.column=r[s.line],s.offset+=r[s.line]-1)}}function sTe(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 l=o[0];typeof l=="string"?o[0]=l.slice(s):o.shift()}i>0&&o.push(e[r].slice(0,i))}return o}function rTe(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 iTe(e){const s={constructs:cte([tTe,...(e||{}).extensions||[]]),content:r(wCe),defined:[],document:r(kCe),flow:r(z4e),lazy:{},string:r(H4e),text:r(U4e)};return s;function r(i){return o;function o(l){return nTe(s,i,l)}}}function oTe(e){for(;!mte(e););return e}const Iq=/[\0\t\n\r]/g;function aTe(){let e=1,t="",n=!0,s;return r;function r(i,o,l){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(Iq.lastIndex=f,u=Iq.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 l&&(s&&c.push(-5),t&&c.push(t),c.push(null)),c}}const lTe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function cTe(e){return e.replace(lTe,uTe)}function uTe(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const r=n.charCodeAt(1),i=r===120||r===88;return ute(n.slice(i?2:1),i?16:10)}return ED(n)||e}const wte={}.hasOwnProperty;function dTe(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),hTe(n)(oTe(iTe(n).document().write(aTe()(e,t,!0))))}function hTe(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(se),autolinkProtocol:N,autolinkEmail:N,atxHeading:i(me),blockQuote:i(fe),characterEscape:N,characterReference:N,codeFenced:i(Q),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(Q,o),codeText:i(ne,o),codeTextData:N,data:N,codeFlowValue:N,definition:i(de),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(ue),hardBreakEscape:i(te),hardBreakTrailing:i(te),htmlFlow:i(ae,o),htmlFlowData:N,htmlText:i(ae,o),htmlTextData:N,image:i(be),label:o,link:i(se),listItem:i(ze),listItemValue:m,listOrdered:i(ve,f),listUnordered:i(ve),paragraph:i(Pe),reference:M,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(me),strong:i(_t),thematicBreak:i(St)},exit:{atxHeading:c(),atxHeadingSequence:_,autolink:c(),autolinkEmail:pe,autolinkProtocol:le,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:J,characterReferenceMarkerNumeric:J,characterReferenceValue:V,characterReference:U,codeFenced:c(w),codeFencedFence:b,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:E,codeIndented:c(y),codeText:c(L),codeTextData:E,data:E,definition:c(),definitionDestinationString:k,definitionLabelString:v,definitionTitleString:x,emphasis:c(),hardBreakEscape:c(B),hardBreakTrailing:c(B),htmlFlow:c(D),htmlFlowData:E,htmlText:c(j),htmlTextData:E,image:c(I),label:K,labelText:$,lineEnding:O,link:c(z),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:F,resourceDestinationString:R,resourceTitleString:Y,resource:W,setextHeading:c(C),setextHeadingLineSequence:S,setextHeadingText:T,strong:c(),thematicBreak:c()}};xte(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(he){let Ae={type:"root",children:[]};const rt={stack:[Ae],tokenStack:[],config:t,enter:l,exit:u,buffer:o,resume:d,data:n},dt=[];let jt=-1;for(;++jt<he.length;)if(he[jt][1].type==="listOrdered"||he[jt][1].type==="listUnordered")if(he[jt][0]==="enter")dt.push(jt);else{const et=dt.pop();jt=r(he,et,jt)}for(jt=-1;++jt<he.length;){const et=t[he[jt][0]];wte.call(et,he[jt][1].type)&&et[he[jt][1].type].call(Object.assign({sliceSerialize:he[jt][2].sliceSerialize},rt),he[jt][1])}if(rt.tokenStack.length>0){const et=rt.tokenStack[rt.tokenStack.length-1];(et[1]||Mq).call(rt,void 0,et[0])}for(Ae.position={start:Am(he.length>0?he[0][1].start:{line:1,column:1,offset:0}),end:Am(he.length>0?he[he.length-2][1].end:{line:1,column:1,offset:0})},jt=-1;++jt<t.transforms.length;)Ae=t.transforms[jt](Ae)||Ae;return Ae}function r(he,Ae,rt){let dt=Ae-1,jt=-1,et=!1,Mt,sn,Ye,$n;for(;++dt<=rt;){const Te=he[dt];switch(Te[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Te[0]==="enter"?jt++:jt--,$n=void 0;break}case"lineEndingBlank":{Te[0]==="enter"&&(Mt&&!$n&&!jt&&!Ye&&(Ye=dt),$n=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:$n=void 0}if(!jt&&Te[0]==="enter"&&Te[1].type==="listItemPrefix"||jt===-1&&Te[0]==="exit"&&(Te[1].type==="listUnordered"||Te[1].type==="listOrdered")){if(Mt){let ie=dt;for(sn=void 0;ie--;){const it=he[ie];if(it[1].type==="lineEnding"||it[1].type==="lineEndingBlank"){if(it[0]==="exit")continue;sn&&(he[sn][1].type="lineEndingBlank",et=!0),it[1].type="lineEnding",sn=ie}else if(!(it[1].type==="linePrefix"||it[1].type==="blockQuotePrefix"||it[1].type==="blockQuotePrefixWhitespace"||it[1].type==="blockQuoteMarker"||it[1].type==="listItemIndent"))break}Ye&&(!sn||Ye<sn)&&(Mt._spread=!0),Mt.end=Object.assign({},sn?he[sn][1].start:Te[1].end),he.splice(sn||dt,0,["exit",Mt,Te[2]]),dt++,rt++}if(Te[1].type==="listItemPrefix"){const ie={type:"listItem",_spread:!1,start:Object.assign({},Te[1].start),end:void 0};Mt=ie,he.splice(dt,0,["enter",ie,Te[2]]),dt++,rt++,Ye=void 0,$n=!0}}}return he[Ae][1]._spread=et,rt}function i(he,Ae){return rt;function rt(dt){l.call(this,he(dt),dt),Ae&&Ae.call(this,dt)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(he,Ae,rt){this.stack[this.stack.length-1].children.push(he),this.stack.push(he),this.tokenStack.push([Ae,rt||void 0]),he.position={start:Am(Ae.start),end:void 0}}function c(he){return Ae;function Ae(rt){he&&he.call(this,rt),u.call(this,rt)}}function u(he,Ae){const rt=this.stack.pop(),dt=this.tokenStack.pop();if(dt)dt[0].type!==he.type&&(Ae?Ae.call(this,he,dt[0]):(dt[1]||Mq).call(this,he,dt[0]));else throw new Error("Cannot close `"+he.type+"` ("+Ux({start:he.start,end:he.end})+"): it’s not open");rt.position.end=Am(he.end)}function d(){return TD(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function m(he){if(this.data.expectingFirstListItemValue){const Ae=this.stack[this.stack.length-2];Ae.start=Number.parseInt(this.sliceSerialize(he),10),this.data.expectingFirstListItemValue=void 0}}function p(){const he=this.resume(),Ae=this.stack[this.stack.length-1];Ae.lang=he}function g(){const he=this.resume(),Ae=this.stack[this.stack.length-1];Ae.meta=he}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const he=this.resume(),Ae=this.stack[this.stack.length-1];Ae.value=he.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const he=this.resume(),Ae=this.stack[this.stack.length-1];Ae.value=he.replace(/(\r?\n|\r)$/g,"")}function v(he){const Ae=this.resume(),rt=this.stack[this.stack.length-1];rt.label=Ae,rt.identifier=fd(this.sliceSerialize(he)).toLowerCase()}function x(){const he=this.resume(),Ae=this.stack[this.stack.length-1];Ae.title=he}function k(){const he=this.resume(),Ae=this.stack[this.stack.length-1];Ae.url=he}function _(he){const Ae=this.stack[this.stack.length-1];if(!Ae.depth){const rt=this.sliceSerialize(he).length;Ae.depth=rt}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function S(he){const Ae=this.stack[this.stack.length-1];Ae.depth=this.sliceSerialize(he).codePointAt(0)===61?1:2}function C(){this.data.setextHeadingSlurpLineEnding=void 0}function N(he){const rt=this.stack[this.stack.length-1].children;let dt=rt[rt.length-1];(!dt||dt.type!=="text")&&(dt=Pt(),dt.position={start:Am(he.start),end:void 0},rt.push(dt)),this.stack.push(dt)}function E(he){const Ae=this.stack.pop();Ae.value+=this.sliceSerialize(he),Ae.position.end=Am(he.end)}function O(he){const Ae=this.stack[this.stack.length-1];if(this.data.atHardBreak){const rt=Ae.children[Ae.children.length-1];rt.position.end=Am(he.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Ae.type)&&(N.call(this,he),E.call(this,he))}function B(){this.data.atHardBreak=!0}function D(){const he=this.resume(),Ae=this.stack[this.stack.length-1];Ae.value=he}function j(){const he=this.resume(),Ae=this.stack[this.stack.length-1];Ae.value=he}function L(){const he=this.resume(),Ae=this.stack[this.stack.length-1];Ae.value=he}function z(){const he=this.stack[this.stack.length-1];if(this.data.inReference){const Ae=this.data.referenceType||"shortcut";he.type+="Reference",he.referenceType=Ae,delete he.url,delete he.title}else delete he.identifier,delete he.label;this.data.referenceType=void 0}function I(){const he=this.stack[this.stack.length-1];if(this.data.inReference){const Ae=this.data.referenceType||"shortcut";he.type+="Reference",he.referenceType=Ae,delete he.url,delete he.title}else delete he.identifier,delete he.label;this.data.referenceType=void 0}function $(he){const Ae=this.sliceSerialize(he),rt=this.stack[this.stack.length-2];rt.label=cTe(Ae),rt.identifier=fd(Ae).toLowerCase()}function K(){const he=this.stack[this.stack.length-1],Ae=this.resume(),rt=this.stack[this.stack.length-1];if(this.data.inReference=!0,rt.type==="link"){const dt=he.children;rt.children=dt}else rt.alt=Ae}function R(){const he=this.resume(),Ae=this.stack[this.stack.length-1];Ae.url=he}function Y(){const he=this.resume(),Ae=this.stack[this.stack.length-1];Ae.title=he}function W(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function F(he){const Ae=this.resume(),rt=this.stack[this.stack.length-1];rt.label=Ae,rt.identifier=fd(this.sliceSerialize(he)).toLowerCase(),this.data.referenceType="full"}function J(he){this.data.characterReferenceType=he.type}function V(he){const Ae=this.sliceSerialize(he),rt=this.data.characterReferenceType;let dt;rt?(dt=ute(Ae,rt==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):dt=ED(Ae);const jt=this.stack[this.stack.length-1];jt.value+=dt}function U(he){const Ae=this.stack.pop();Ae.position.end=Am(he.end)}function le(he){E.call(this,he);const Ae=this.stack[this.stack.length-1];Ae.url=this.sliceSerialize(he)}function pe(he){E.call(this,he);const Ae=this.stack[this.stack.length-1];Ae.url="mailto:"+this.sliceSerialize(he)}function fe(){return{type:"blockquote",children:[]}}function Q(){return{type:"code",lang:null,meta:null,value:""}}function ne(){return{type:"inlineCode",value:""}}function de(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ue(){return{type:"emphasis",children:[]}}function me(){return{type:"heading",depth:0,children:[]}}function te(){return{type:"break"}}function ae(){return{type:"html",value:""}}function be(){return{type:"image",title:null,url:"",alt:null}}function se(){return{type:"link",title:null,url:"",children:[]}}function ve(he){return{type:"list",ordered:he.type==="listOrdered",start:null,spread:he._spread,children:[]}}function ze(he){return{type:"listItem",spread:he._spread,checked:null,children:[]}}function Pe(){return{type:"paragraph",children:[]}}function _t(){return{type:"strong",children:[]}}function Pt(){return{type:"text",value:""}}function St(){return{type:"thematicBreak"}}}function Am(e){return{line:e.line,column:e.column,offset:e.offset}}function xte(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?xte(e,s):fTe(e,s)}}function fTe(e,t){let n;for(n in t)if(wte.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 Mq(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ux({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ux({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ux({start:t.start,end:t.end})+") is still open")}function mTe(e){const t=this;t.parser=n;function n(s){return dTe(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function pTe(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 gTe(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function bTe(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 yTe(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vTe(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function wTe(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),r=xv(s.toLowerCase()),i=e.footnoteOrder.indexOf(s);let o,l=e.footnoteCounts.get(s);l===void 0?(l=0,e.footnoteOrder.push(s),o=e.footnoteOrder.length):o=i+1,l+=1,e.footnoteCounts.set(s,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(l>1?"-"+l:""),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 xTe(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 kTe(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function kte(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 _Te(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return kte(e,t);const r={src:xv(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 STe(e,t){const n={src:xv(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 CTe(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 TTe(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return kte(e,t);const r={href:xv(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 ETe(e,t){const n={href:xv(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 ATe(e,t,n){const s=e.all(t),r=n?jTe(n):_te(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 l=-1;for(;++l<s.length;){const d=s[l];(r||l!==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 jTe(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=_te(n[s])}return t}function _te(e){const t=e.spread;return t??e.children.length>1}function NTe(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 ITe(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function MTe(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function RTe(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function DTe(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)},l=kD(t.children[1]),c=nte(t.children[t.children.length-1]);l&&c&&(o.position={start:l,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 LTe(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,l=o?o.length:t.children.length;let c=-1;const u=[];for(;++c<l;){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 PTe(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Rq=9,Dq=32;function OTe(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),r=0;const i=[];for(;s;)i.push(Lq(t.slice(r,s.index),r>0,!0),s[0]),r=s.index+s[0].length,s=n.exec(t);return i.push(Lq(t.slice(r),r>0,!1)),i.join("")}function Lq(e,t,n){let s=0,r=e.length;if(t){let i=e.codePointAt(s);for(;i===Rq||i===Dq;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(r-1);for(;i===Rq||i===Dq;)r--,i=e.codePointAt(r-1)}return r>s?e.slice(s,r):""}function $Te(e,t){const n={type:"text",value:OTe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function BTe(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const zTe={blockquote:pTe,break:gTe,code:bTe,delete:yTe,emphasis:vTe,footnoteReference:wTe,heading:xTe,html:kTe,imageReference:_Te,image:STe,inlineCode:CTe,linkReference:TTe,link:ETe,listItem:ATe,list:NTe,paragraph:ITe,root:MTe,strong:RTe,table:DTe,tableCell:PTe,tableRow:LTe,text:$Te,thematicBreak:BTe,toml:x2,yaml:x2,definition:x2,footnoteDefinition:x2};function x2(){}const Ste=-1,_5=0,Vx=1,ST=2,jD=3,ND=4,ID=5,MD=6,Cte=7,Tte=8,Pq=typeof self=="object"?self:globalThis,FTe=(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 _5:case Ste:return n(o,r);case Vx:{const l=n([],r);for(const c of o)l.push(s(c));return l}case ST:{const l=n({},r);for(const[c,u]of o)l[s(c)]=s(u);return l}case jD:return n(new Date(o),r);case ND:{const{source:l,flags:c}=o;return n(new RegExp(l,c),r)}case ID:{const l=n(new Map,r);for(const[c,u]of o)l.set(s(c),s(u));return l}case MD:{const l=n(new Set,r);for(const c of o)l.add(s(c));return l}case Cte:{const{name:l,message:c}=o;return n(new Pq[l](c),r)}case Tte: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:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new Pq[i](o),r)};return s},Oq=e=>FTe(new Map,e)(0),eb="",{toString:qTe}={},{keys:HTe}=Object,Pw=e=>{const t=typeof e;if(t!=="object"||!e)return[_5,t];const n=qTe.call(e).slice(8,-1);switch(n){case"Array":return[Vx,eb];case"Object":return[ST,eb];case"Date":return[jD,eb];case"RegExp":return[ND,eb];case"Map":return[ID,eb];case"Set":return[MD,eb];case"DataView":return[Vx,n]}return n.includes("Array")?[Vx,n]:n.includes("Error")?[Cte,n]:[ST,n]},k2=([e,t])=>e===_5&&(t==="function"||t==="symbol"),UTe=(e,t,n,s)=>{const r=(o,l)=>{const c=s.push(o)-1;return n.set(l,c),c},i=o=>{if(n.has(o))return n.get(o);let[l,c]=Pw(o);switch(l){case _5:{let d=o;switch(c){case"bigint":l=Tte,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return r([Ste],o)}return r([l,d],o)}case Vx:{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([l,d],o);for(const m of o)d.push(i(m));return f}case ST:{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([l,d],o);for(const m of HTe(o))(e||!k2(Pw(o[m])))&&d.push([i(m),i(o[m])]);return f}case jD:return r([l,o.toISOString()],o);case ND:{const{source:d,flags:f}=o;return r([l,{source:d,flags:f}],o)}case ID:{const d=[],f=r([l,d],o);for(const[m,p]of o)(e||!(k2(Pw(m))||k2(Pw(p))))&&d.push([i(m),i(p)]);return f}case MD:{const d=[],f=r([l,d],o);for(const m of o)(e||!k2(Pw(m)))&&d.push(i(m));return f}}const{message:u}=o;return r([l,{name:c,message:u}],o)};return i},$q=(e,{json:t,lossy:n}={})=>{const s=[];return UTe(!(t||n),!!t,new Map,s)(e),s},CT=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Oq($q(e,t)):structuredClone(e):(e,t)=>Oq($q(e,t));function WTe(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 VTe(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function GTe(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||WTe,s=e.options.footnoteBackLabel||VTe,r=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];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=xv(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 v=typeof n=="string"?n:n(c,p);typeof v=="string"&&(v={type:"text",value:v}),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(v)?v:[v]})}const w=d[d.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const v=w.children[w.children.length-1];v&&v.type==="text"?v.value+=" ":w.children.push({type:"text",value:" "}),w.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),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...CT(o),id:"footnote-label"},children:[{type:"text",value:r}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
`}]}}const j_=function(e){if(e==null)return QTe;if(typeof e=="function")return S5(e);if(typeof e=="object")return Array.isArray(e)?KTe(e):YTe(e);if(typeof e=="string")return XTe(e);throw new Error("Expected function, string, or object as test")};function KTe(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=j_(e[n]);return S5(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function YTe(e){const t=e;return S5(n);function n(s){const r=s;let i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function XTe(e){return S5(t);function t(n){return n&&n.type===e}}function S5(e){return t;function t(n,s,r){return!!(JTe(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function QTe(){return!0}function JTe(e){return e!==null&&typeof e=="object"&&"type"in e}const Ete=[],ZTe=!0,sI=!1,Ate="skip";function RD(e,t,n,s){let r;typeof t=="function"&&typeof n!="function"?(s=n,n=t):r=t;const i=j_(r),o=s?-1:1;l(e,void 0,[])();function l(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=Ete,g,b,w;if((!t||i(c,u,d[d.length-1]||void 0))&&(p=e3e(n(c,d)),p[0]===sI))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==Ate)for(b=(s?y.children.length:-1)+o,w=d.concat(y);b>-1&&b<y.children.length;){const v=y.children[b];if(g=l(v,b,w)(),g[0]===sI)return g;b=typeof g[1]=="number"?g[1]:b+o}}return p}}}function e3e(e){return Array.isArray(e)?e:typeof e=="number"?[ZTe,e]:e==null?Ete:[e]}function DD(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),RD(e,i,l,r);function l(c,u){const d=u[u.length-1],f=d?d.children.indexOf(c):void 0;return o(c,f,d)}}const rI={}.hasOwnProperty,t3e={};function n3e(e,t){const n=t||t3e,s=new Map,r=new Map,i=new Map,o={...zTe,...n.handlers},l={all:u,applyData:r3e,definitionById:s,footnoteById:r,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:s3e,wrap:o3e};return DD(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)}}),l;function c(d,f){const m=d.type,p=l.handlers[m];if(rI.call(l.handlers,m)&&p)return p(l,d,f);if(l.options.passThrough&&l.options.passThrough.includes(m)){if("children"in d){const{children:b,...w}=d,y=CT(w);return y.children=l.all(d),y}return CT(d)}return(l.options.unknownHandler||i3e)(l,d,f)}function u(d){const f=[];if("children"in d){const m=d.children;let p=-1;for(;++p<m.length;){const g=l.one(m[p],d);if(g){if(p&&m[p-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=Bq(g.value)),!Array.isArray(g)&&g.type==="element")){const b=g.children[0];b&&b.type==="text"&&(b.value=Bq(b.value))}Array.isArray(g)?f.push(...g):f.push(g)}}}return f}}function s3e(e,t){e.position&&(t.position=V2e(e))}function r3e(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,CT(i)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function i3e(e,t){const n=t.data||{},s="value"in t&&!(rI.call(n,"hProperties")||rI.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 o3e(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 Bq(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function zq(e,t){const n=n3e(e,t),s=n.one(e,void 0),r=GTe(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return r&&i.children.push({type:"text",value:`
`},r),i}function a3e(e,t){return e&&"run"in e?async function(n,s){const r=zq(n,{file:s,...t});await e.run(r,s)}:function(n,s){return zq(n,{file:s,...e||t})}}function Fq(e){if(e)throw e}var a4=Object.prototype.hasOwnProperty,jte=Object.prototype.toString,qq=Object.defineProperty,Hq=Object.getOwnPropertyDescriptor,Uq=function(t){return typeof Array.isArray=="function"?Array.isArray(t):jte.call(t)==="[object Array]"},Wq=function(t){if(!t||jte.call(t)!=="[object Object]")return!1;var n=a4.call(t,"constructor"),s=t.constructor&&t.constructor.prototype&&a4.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!s)return!1;var r;for(r in t);return typeof r>"u"||a4.call(t,r)},Vq=function(t,n){qq&&n.name==="__proto__"?qq(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Gq=function(t,n){if(n==="__proto__")if(a4.call(t,n)){if(Hq)return Hq(t,n).value}else return;return t[n]},l3e=function e(){var t,n,s,r,i,o,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)s=Gq(l,n),r=Gq(t,n),l!==r&&(d&&r&&(Wq(r)||(i=Uq(r)))?(i?(i=!1,o=s&&Uq(s)?s:[]):o=s&&Wq(s)?s:{},Vq(l,{name:n,newValue:e(d,o,r)})):typeof r<"u"&&Vq(l,{name:n,newValue:r}));return l};const lA=h_(l3e);function iI(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 c3e(){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);l(null,...r);function l(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?u3e(d,l)(...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 u3e(e,t){let n;return s;function s(...o){const l=e.length>o.length;let c;l&&o.push(r);try{c=e.apply(this,o)}catch(u){const d=u;if(l&&n)throw d;return r(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,r):c instanceof Error?r(c):i(c))}function r(o,...l){n||(n=!0,t(o,...l))}function i(o){r(null,o)}}const Qd={basename:d3e,dirname:h3e,extname:f3e,join:m3e,sep:"/"};function d3e(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');N_(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,l=t.length-1;for(;r--;)if(e.codePointAt(r)===47){if(i){n=r+1;break}}else o<0&&(i=!0,o=r+1),l>-1&&(e.codePointAt(r)===t.codePointAt(l--)?l<0&&(s=r):(l=-1,s=o));return n===s?s=o:s<0&&(s=e.length),e.slice(n,s)}function h3e(e){if(N_(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 f3e(e){N_(e);let t=e.length,n=-1,s=0,r=-1,i=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){s=t+1;break}continue}n<0&&(o=!0,n=t+1),l===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 m3e(...e){let t=-1,n;for(;++t<e.length;)N_(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":p3e(n)}function p3e(e){N_(e);const t=e.codePointAt(0)===47;let n=g3e(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function g3e(e,t){let n="",s=0,r=-1,i=0,o=-1,l,c;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===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 l===46&&i>-1?i++:i=-1}return n}function N_(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const b3e={cwd:y3e};function y3e(){return"/"}function oI(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function v3e(e){if(typeof e=="string")e=new URL(e);else if(!oI(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 w3e(e)}function w3e(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 cA=["history","path","basename","stem","extname","dirname"];class Nte{constructor(t){let n;t?oI(t)?n={path:t}:typeof t=="string"||x3e(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":b3e.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<cA.length;){const i=cA[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)cA.includes(r)||(this[r]=n[r])}get basename(){return typeof this.path=="string"?Qd.basename(this.path):void 0}set basename(t){dA(t,"basename"),uA(t,"basename"),this.path=Qd.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Qd.dirname(this.path):void 0}set dirname(t){Kq(this.basename,"dirname"),this.path=Qd.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Qd.extname(this.path):void 0}set extname(t){if(uA(t,"extname"),Kq(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=Qd.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){oI(t)&&(t=v3e(t)),dA(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Qd.basename(this.path,this.extname):void 0}set stem(t){dA(t,"stem"),uA(t,"stem"),this.path=Qd.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 Sl(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 uA(e,t){if(e&&e.includes(Qd.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Qd.sep+"`")}function dA(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Kq(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function x3e(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const k3e=function(e){const s=this.constructor.prototype,r=s[e],i=function(){return r.apply(i,arguments)};return Object.setPrototypeOf(i,s),i},_3e={}.hasOwnProperty;class LD extends k3e{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=c3e()}copy(){const t=new LD;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(lA(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(mA("data",this.frozen),this.namespace[t]=n,this):_3e.call(this.namespace,t)&&this.namespace[t]||void 0:t?(mA("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=_2(t),s=this.parser||this.Parser;return hA("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),hA("process",this.parser||this.Parser),fA("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(i,o){const l=_2(t),c=s.parse(l);s.run(c,l,function(d,f,m){if(d||!f||!m)return u(d);const p=f,g=s.stringify(p,m);T3e(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(),hA("processSync",this.parser||this.Parser),fA("processSync",this.compiler||this.Compiler),this.process(t,r),Xq("processSync","process",n),s;function r(i,o){n=!0,Fq(i),s=o}}run(t,n,s){Yq(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,l){const c=_2(n);r.run(t,c,u);function u(d,f,m){const p=f||t;d?l(d):o?o(p):s(void 0,p,m)}}}runSync(t,n){let s=!1,r;return this.run(t,n,i),Xq("runSync","run",s),r;function i(o,l){Fq(o),r=l,s=!0}}stringify(t,n){this.freeze();const s=_2(n),r=this.compiler||this.Compiler;return fA("stringify",r),Yq(t),r(t,s)}use(t,...n){const s=this.attachers,r=this.namespace;if(mA("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(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");l(u.plugins),u.settings&&(r.settings=lA(!0,r.settings,u.settings))}function l(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];iI(b)&&iI(p)&&(p=lA(!0,b,p)),s[m]=[u,p,...g]}}}}const S3e=new LD().freeze();function hA(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function fA(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function mA(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 Yq(e){if(!iI(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Xq(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function _2(e){return C3e(e)?e:new Nte(e)}function C3e(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function T3e(e){return typeof e=="string"||E3e(e)}function E3e(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const A3e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Qq=[],Jq={allowDangerousHtml:!0},j3e=/^(https?|ircs?|mailto|xmpp)$/i,N3e=[{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 I3e(e){const t=M3e(e),n=R3e(e);return D3e(t.runSync(t.parse(n),n),e)}function M3e(e){const t=e.rehypePlugins||Qq,n=e.remarkPlugins||Qq,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Jq}:Jq;return S3e().use(mTe).use(n).use(a3e,s).use(t)}function R3e(e){const t=e.children||"",n=new Nte;return typeof t=="string"&&(n.value=t),n}function D3e(e,t){const n=t.allowedElements,s=t.allowElement,r=t.components,i=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||Ite;for(const d of N3e)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+A3e+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),DD(e,u),Q2e(e,{Fragment:a.Fragment,components:r,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.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 iA)if(Object.hasOwn(iA,p)&&Object.hasOwn(d.properties,p)){const g=d.properties[p],b=iA[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 l&&d.children?m.children.splice(f,1,...d.children):m.children.splice(f,1),f}}}function Ite(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||j3e.test(e.slice(0,t))?e:""}var l4="markdown-chart",bn=class extends Error{constructor(t,n,s){super(n);He(this,"code");He(this,"cause");this.name="MarkdownChartError",this.code=t,this.cause=s==null?void 0:s.cause}},PD=Object.freeze({maxCharacters:5e5,maxDepth:40,maxNodes:1e5}),L3e=new Set(["__proto__","prototype","constructor"]);function Mte(e,t){const n=t.maxCharacters??PD.maxCharacters;if(e.length>n)throw new bn("LIMIT_EXCEEDED",`Chart fence exceeds the ${n} character limit`)}function Mr(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function TT(e,t,n,s,r){if(n.nodes+=1,n.nodes>t.maxNodes)throw new bn("LIMIT_EXCEEDED",`Chart JSON exceeds the ${t.maxNodes} node limit`);if(s>t.maxDepth)throw new bn("LIMIT_EXCEEDED",`Chart JSON exceeds the ${t.maxDepth} level depth limit`);if(!(e===null||typeof e=="string"||typeof e=="boolean")){if(typeof e=="number"){if(!Number.isFinite(e))throw new bn("INVALID_JSON",`${r} contains a non-finite number`);return}if(Array.isArray(e)){for(const i of Reflect.ownKeys(e))if(i!=="length"&&(typeof i!="string"||!/^(0|[1-9]\d*)$/.test(i)||Number(i)>=e.length))throw new bn("INVALID_JSON",`${r} contains a non-JSON array property`);for(let i=0;i<e.length;i+=1){const o=Object.getOwnPropertyDescriptor(e,String(i));if(!o||!o.enumerable||!("value"in o))throw new bn("INVALID_JSON",`${r}[${i}] is not a JSON data property`);TT(o.value,t,n,s+1,`${r}[${i}]`)}return}if(!Mr(e))throw new bn("INVALID_JSON",`${r} contains a non-JSON value`);for(const i of Reflect.ownKeys(e)){if(typeof i!="string")throw new bn("INVALID_JSON",`${r} contains a symbol key`);if(L3e.has(i))throw new bn("UNSAFE_SPEC",`${r} contains forbidden key ${i}`);const o=Object.getOwnPropertyDescriptor(e,i);if(!o||!o.enumerable||!("value"in o))throw new bn("INVALID_JSON",`${r}.${i} is not a JSON data property`);TT(o.value,t,n,s+1,`${r}.${i}`)}}}function Rte(e,t={}){const n={...PD,...t};return TT(e,n,{nodes:0},0,"$"),e}function Dte(e,t={}){const n={...PD,...t};Mte(e,n);let s;try{s=JSON.parse(e)}catch(r){throw new bn("INVALID_JSON","Chart fence must contain valid JSON",{cause:r})}return TT(s,n,{nodes:0},0,"$"),s}function P3e(e){if(e!==void 0){if(!Array.isArray(e)||e.some(t=>typeof t!="string"||t.length===0))throw new bn("SCHEMA_INVALID","markdown-chart.data.dimensions must be an array of non-empty strings");return[...e]}}function O3e(e){if(!Array.isArray(e))throw new bn("SCHEMA_INVALID","markdown-chart.data.source must be an array");return e.map((t,n)=>{if(Array.isArray(t)){if(t.some(s=>s!==null&&!["string","number","boolean"].includes(typeof s)))throw new bn("SCHEMA_INVALID",`markdown-chart.data.source[${n}] must contain only JSON scalars`);return[...t]}if(Mr(t)){const s={};for(const[r,i]of Object.entries(t)){if(i!==null&&!["string","number","boolean"].includes(typeof i))throw new bn("SCHEMA_INVALID",`markdown-chart.data.source[${n}].${r} must be a JSON scalar`);s[r]=i}return s}throw new bn("SCHEMA_INVALID",`markdown-chart.data.source[${n}] must be an array or object`)})}function $3e(e){if(!Mr(e)||typeof e.kind!="string")throw new bn("SCHEMA_INVALID","markdown-chart.data must be an inline or ref dataset object");const t=P3e(e.dimensions);if(e.kind==="inline"){const n=O3e(e.source);return t?{kind:"inline",dimensions:t,source:n}:{kind:"inline",source:n}}if(e.kind==="ref"){if(typeof e.ref!="string"||e.ref.length===0)throw new bn("SCHEMA_INVALID","markdown-chart.data.ref must be a non-empty string");if(e.format!==void 0&&e.format!=="csv"&&e.format!=="json")throw new bn("SCHEMA_INVALID","markdown-chart.data.format must be csv or json");return{kind:"ref",ref:e.ref,...e.format?{format:e.format}:{},...t?{dimensions:t}:{}}}throw new bn("SCHEMA_INVALID",`Unsupported markdown-chart.data.kind: ${e.kind}`)}function aI(e,t){const n=e.trim().toLowerCase();if(!/^[a-z][a-z0-9._-]*$/.test(n))throw new bn("SCHEMA_INVALID",`Invalid ${t}: ${e}`);return n}function B3e(e){return e.trim().split(/\s+/,1)[0]??""}function z3e(e,t={}){const n=Dte(e,t);if(!Mr(n))throw new bn("SCHEMA_INVALID","The canonical markdown-chart fence must contain an object");if(n.version!==1)throw new bn("UNSUPPORTED_VERSION","Only markdown-chart protocol version 1 is supported");if(typeof n.renderer!="string")throw new bn("SCHEMA_INVALID","markdown-chart.renderer must be a string");if(!Object.prototype.hasOwnProperty.call(n,"spec"))throw new bn("SCHEMA_INVALID","markdown-chart.spec is required");return{version:1,renderer:aI(n.renderer,"renderer id"),data:n.data===void 0?void 0:$3e(n.data),spec:n.spec}}var Zd,Xm,Eg,NX,F3e=(NX=class{constructor(e={}){Dd(this,Zd,new Map);Dd(this,Xm,new Map);Dd(this,Eg);Xi(this,Eg,e.jsonLimits??{})}register(e){const t=aI(e.id,"renderer id"),n=(e.aliases??[]).map(o=>aI(o,"renderer alias")),s=ar(this,Xm).get(t);if(ar(this,Zd).has(t)||s)throw new bn("RENDERER_CONFLICT",`Renderer id ${t} is already owned by ${s??t}`);const r=new Set;for(const o of n){if(o===l4)throw new bn("RENDERER_CONFLICT","The canonical markdown-chart fence cannot be a renderer alias");if(r.has(o))throw new bn("RENDERER_CONFLICT",`Renderer alias ${o} is declared more than once`);r.add(o);const l=ar(this,Xm).get(o)??(o!==t&&ar(this,Zd).has(o)?o:void 0);if(l)throw new bn("RENDERER_CONFLICT",`Renderer alias ${o} is already owned by ${l}`)}const i=e;return ar(this,Zd).set(t,i),n.forEach(o=>ar(this,Xm).set(o,t)),this}has(e){const t=e.trim().toLowerCase();return t===l4||ar(this,Xm).has(t)||[...ar(this,Zd).values()].some(n=>{var s;return((s=n.matchLanguage)==null?void 0:s.call(n,t))===!0})}get rendererIds(){return[...ar(this,Zd).keys()]}async prepare(e,t){const n=B3e(e),s=n.toLowerCase();let r,i,o,l=!1;if(s===l4){const f=z3e(t,ar(this,Eg));r=f.renderer,i=f.spec,o=f.data}else{const f=ar(this,Xm).get(s),m=f?[]:[...ar(this,Zd).entries()].filter(([,p])=>{var g;return((g=p.matchLanguage)==null?void 0:g.call(p,s))===!0}).map(([p])=>p);if(!f&&m.length===0)throw new bn("RENDERER_NOT_FOUND",`No renderer is registered for ${s||"this fence"}`);if(m.length>1)throw new bn("RENDERER_CONFLICT",`Multiple renderers match the dynamic fence language ${s}`);r=f??m[0],l=!f,l&&Mte(t,ar(this,Eg)),i=l?null:Dte(t,ar(this,Eg))}const c=ar(this,Zd).get(r);if(!c)throw new bn("RENDERER_NOT_FOUND",`Renderer ${r} is not registered`);const u={language:s,rawLanguage:n,rendererId:r,data:o};if(l&&!c.parseSource)throw new bn("SCHEMA_INVALID",`Renderer ${r} matched ${s} but cannot parse its source`);const d=l?await c.parseSource(t,u):await c.parse(i,u);return{renderer:c,parsed:d,data:o,language:s,rawLanguage:n,rendererId:r}}},Zd=new WeakMap,Xm=new WeakMap,Eg=new WeakMap,NX),q3e="Rendering chart…",Zq=Object.freeze({chartUnavailable:"Chart unavailable",viewMode:"View mode",chart:"Chart",data:"Data",showChart:"Show chart",showData:"Show data",noData:"No data",tableNotice:({visibleRows:e,totalRows:t,visibleColumns:n,totalColumns:s})=>`Showing ${e} of ${t} rows and ${n} of ${s} columns.`});function Lte(e){return e?Object.freeze({...Zq,...e}):Zq}var H3e=/^ {0,3}(`{3,}|~{3,})/,Pte=/^ {0,3}>[ \t]?/;function U3e(e,t){var s;let n=e;for(let r=0;r<t;r+=1){const i=(s=Pte.exec(n))==null?void 0:s[0];if(!i)return;n=n.slice(i.length)}return n}function Ote(e){var c;const t=e.replace(/\r\n?/g,`
`).split(`
`);let n=t[0]??"",s=0;for(;;){const u=(c=Pte.exec(n))==null?void 0:c[0];if(!u)break;s+=1,n=n.slice(u.length)}const r=H3e.exec(n),i=r==null?void 0:r[1];if(!i)return!1;const o=i[0];if(!o)return!1;const l=new RegExp(`^ {0,3}${o==="`"?"`":"~"}{${i.length},}[\\t ]*$`);return t.slice(1).some(u=>{const d=U3e(u,s);return d!==void 0&&l.test(d)})}var W3e=500,V3e=50;function G3e(e){if(e.dimensions&&e.dimensions.length>0)return[...e.dimensions];const t=[],n=new Set;for(const s of e.source)if(Array.isArray(s))for(let r=0;r<s.length;r+=1){const i=String(r+1);n.has(i)||(n.add(i),t.push(i))}else for(const r of Object.keys(s))n.has(r)||(n.add(r),t.push(r));return t}function K3e(e,t,n){return Array.isArray(e)?e[n]:e[t]}function gl(e,t){Object.assign(e.style,t)}var Y3e="http://www.w3.org/2000/svg";function _f(e){return document.createElementNS(Y3e,e)}function X3e(){const e=_f("svg");e.setAttribute("viewBox","0 0 20 20"),e.setAttribute("aria-hidden","true"),gl(e,{width:"16px",height:"16px",fill:"currentColor"});for(const t of[{x:"3",y:"10",width:"3",height:"6",rx:"1"},{x:"8.5",y:"6",width:"3",height:"10",rx:"1"},{x:"14",y:"3",width:"3",height:"13",rx:"1"}]){const n=_f("rect");Object.entries(t).forEach(([s,r])=>n.setAttribute(s,r)),e.append(n)}return e}function Q3e(){const e=_f("svg");e.setAttribute("viewBox","0 0 20 20"),e.setAttribute("aria-hidden","true"),gl(e,{width:"16px",height:"16px",fill:"none"});const t=_f("rect");Object.entries({x:"3",y:"4",width:"14",height:"12",rx:"1.5",fill:"none",stroke:"currentColor","stroke-width":"1.4"}).forEach(([s,r])=>t.setAttribute(s,r));const n=_f("path");return n.setAttribute("d","M3 8.5H17M3 12.5H17M8 4V16M13 4V16"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","1.4"),e.append(t,n),e}function J3e(){const e=_f("svg");e.classList.add("markdown-chart-loading-spinner"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","18"),e.setAttribute("height","18"),e.setAttribute("aria-hidden","true"),gl(e,{flex:"none",fill:"none"});const t=_f("circle");Object.entries({cx:"12",cy:"12",r:"9",stroke:"currentColor","stroke-width":"2",opacity:".24"}).forEach(([r,i])=>t.setAttribute(r,i));const n=_f("path");Object.entries({d:"M12 3a9 9 0 0 1 9 9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"}).forEach(([r,i])=>n.setAttribute(r,i));const s=_f("animateTransform");return Object.entries({attributeName:"transform",type:"rotate",from:"0 12 12",to:"360 12 12",dur:".8s",repeatCount:"indefinite"}).forEach(([r,i])=>s.setAttribute(r,i)),n.append(s),e.append(t,n),e}function $te(e){return[...e.children].find(t=>t.dataset.markdownChartLoading==="true")}function pA(e,t=q3e){const n=$te(e);if(n){const i=n.querySelector(".markdown-chart-loading-label");i&&(i.textContent=t),e.setAttribute("aria-busy","true");return}const s=document.createElement("div");s.className="markdown-chart-loading",s.dataset.markdownChartLoading="true",s.setAttribute("role","status"),gl(s,{display:"flex",minHeight:"inherit",width:"100%",boxSizing:"border-box",alignItems:"center",justifyContent:"center",gap:"8px",padding:"24px",color:"var(--markdown-chart-loading-color, currentColor)",opacity:".68",font:'400 12px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'});const r=document.createElement("span");r.className="markdown-chart-loading-label",r.textContent=t,s.append(J3e(),r),e.replaceChildren(s),e.setAttribute("aria-busy","true")}function Z3e(e){var t;(t=$te(e))==null||t.remove(),e.removeAttribute("aria-busy")}function eH(e,t,n){const s=document.createElement("button");return s.type="button",s.setAttribute("aria-label",t),s.setAttribute("title",e),s.className="markdown-chart-toggle-button",s.append(n),gl(s,{display:"grid",width:"30px",height:"26px",placeItems:"center",padding:"0",border:"0",borderRadius:"4px",background:"transparent",color:"color-mix(in srgb, currentColor 68%, transparent)",cursor:"pointer",transition:"background-color 0.16s ease, color 0.16s ease"}),s}function e5e(e){const t=e==="dark";return{background:`var(--markdown-chart-background, ${t?"#0d0d0d":"#ffffff"})`,subtleBackground:`var(--markdown-chart-subtle-background, ${t?"#161616":"#f7f8fa"})`}}function t5e(e,t,n){const s=G3e(e),r=s.slice(0,V3e),i=e.source.slice(0,W3e),o=document.createElement("div");if(o.className="markdown-chart-data-view",o.dataset.markdownChartDataView="true",gl(o,{minHeight:"240px",maxHeight:"min(60vh, 520px)",overflow:"auto",background:t.background,scrollbarColor:"color-mix(in srgb, currentColor 18%, transparent) transparent"}),s.length===0||e.source.length===0){const f=document.createElement("div");return f.textContent=n.noData,gl(f,{padding:"24px",textAlign:"center",opacity:"0.68"}),o.append(f),o}if(r.length<s.length||i.length<e.source.length){const f=document.createElement("div");f.className="markdown-chart-data-notice",f.textContent=n.tableNotice({visibleRows:i.length,totalRows:e.source.length,visibleColumns:r.length,totalColumns:s.length}),gl(f,{position:"sticky",top:"0",zIndex:"2",padding:"8px 12px",borderBottom:"1px solid color-mix(in srgb, currentColor 18%, transparent)",background:t.subtleBackground,fontSize:"12px",opacity:"0.75"}),o.append(f)}const l=document.createElement("table");l.className="markdown-chart-data-table",gl(l,{width:"max-content",minWidth:"100%",borderCollapse:"separate",borderSpacing:"0",fontSize:"13px"});const c=document.createElement("thead"),u=document.createElement("tr");for(const f of r){const m=document.createElement("th");m.scope="col",m.textContent=f,gl(m,{position:"sticky",top:"0",zIndex:"1",padding:"8px 12px",borderRight:"1px solid color-mix(in srgb, currentColor 18%, transparent)",borderBottom:"1px solid color-mix(in srgb, currentColor 18%, transparent)",background:t.subtleBackground,textAlign:"left",whiteSpace:"nowrap",fontSize:"12px",fontWeight:"600"}),u.append(m)}c.append(u),l.append(c);const d=document.createElement("tbody");for(const f of i){const m=document.createElement("tr");r.forEach((p,g)=>{const b=document.createElement("td"),w=K3e(f,p,g);b.textContent=w===void 0?"undefined":w===null?"null":w===""?'""':String(w),gl(b,{padding:"9px 12px",borderRight:"1px solid color-mix(in srgb, currentColor 18%, transparent)",borderBottom:"1px solid color-mix(in srgb, currentColor 18%, transparent)",textAlign:"left",verticalAlign:"top"}),m.append(b)}),d.append(m)}return l.append(d),o.append(l),o}function n5e(e,t,n,s,r,i){const o=e5e(r),l=e.classList.contains("markdown-chart-card"),c={margin:e.style.margin,minWidth:e.style.minWidth,maxWidth:e.style.maxWidth,overflow:e.style.overflow,border:e.style.border,borderRadius:e.style.borderRadius,background:e.style.background,boxShadow:e.style.boxShadow};e.classList.add("markdown-chart-card"),gl(e,{margin:"10px 0",minWidth:"0",maxWidth:"100%",overflow:"hidden",border:"1px solid color-mix(in srgb, currentColor 14%, transparent)",borderRadius:"8px",background:o.background,boxShadow:"0 8px 22px rgb(15 23 42 / 5%)"});const u=document.createElement("div");u.className="markdown-chart-toolbar",gl(u,{display:"flex",minHeight:"44px",alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"0 10px 0 14px",borderBottom:"1px solid color-mix(in srgb, currentColor 14%, transparent)",background:o.subtleBackground});const d=n==null?void 0:n.trim();let f;if(d){const S=document.createElement("div");S.className="markdown-chart-title",S.textContent=d,gl(S,{minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"13px",fontWeight:"600",lineHeight:"1.3"}),f=S}const m=document.createElement("div");m.className="markdown-chart-toggle",m.setAttribute("role","group"),m.setAttribute("aria-label",i.viewMode),gl(m,{display:"inline-grid",flex:"0 0 auto",marginLeft:"auto",gridTemplateColumns:"repeat(2, 30px)",gap:"2px",padding:"2px",overflow:"hidden",border:"1px solid color-mix(in srgb, currentColor 16%, transparent)",borderRadius:"6px",background:o.background});const p=eH(i.chart,i.showChart,X3e()),g=eH(i.data,i.showData,Q3e()),b=document.createElement("div");b.className="markdown-chart-chart-view",b.dataset.markdownChartChartView="true",b.setAttribute("role","img"),b.setAttribute("aria-label",i.chart),gl(b,{width:"calc(100% - 20px)",minHeight:"inherit",margin:"8px 10px",background:o.background});const w=t5e(t,o,i);w.hidden=!0;const y="var(--markdown-chart-accent, #0033ff)",v="var(--markdown-chart-accent-foreground, var(--markdown-chart-background, #ffffff))",x="color-mix(in srgb, currentColor 68%, transparent)",k=S=>{const C=S==="chart";p.setAttribute("aria-pressed",String(C)),g.setAttribute("aria-pressed",String(!C)),p.style.background=C?y:"transparent",p.style.color=C?v:x,g.style.background=C?"transparent":y,g.style.color=C?x:v,b.hidden=!C,w.hidden=C},_=()=>{k("chart"),s()},T=()=>k("data");return p.addEventListener("click",_),g.addEventListener("click",T),m.append(p,g),f&&u.append(f),u.append(m),e.replaceChildren(u,b,w),k("chart"),{chartContainer:b,dispose(){p.removeEventListener("click",_),g.removeEventListener("click",T),l||e.classList.remove("markdown-chart-card"),e.style.margin=c.margin,e.style.minWidth=c.minWidth,e.style.maxWidth=c.maxWidth,e.style.overflow=c.overflow,e.style.border=c.border,e.style.borderRadius=c.borderRadius,e.style.background=c.background,e.style.boxShadow=c.boxShadow}}}var d_,eh,mu,hf,pu,ff,IX,s5e=(IX=class{constructor(e){Dd(this,d_);Dd(this,eh,0);Dd(this,mu);Dd(this,hf);Dd(this,pu);Dd(this,ff,!1);Xi(this,d_,e)}async render(e,t){var r,i,o,l,c,u,d,f,m;if(t.streaming){ar(this,mu)&&(Xi(this,eh,ar(this,eh)+1),ar(this,mu).abort(),Xi(this,mu,void 0),(r=ar(this,pu))==null||r.dispose(),Xi(this,pu,void 0),e.replaceChildren(),Xi(this,ff,!1)),ar(this,ff)?e.removeAttribute("aria-busy"):pA(e,t.loadingLabel);return}const n=++BB(this,eh)._;(i=ar(this,mu))==null||i.abort(),(o=ar(this,hf))==null||o.dispose(),Xi(this,hf,void 0),(l=ar(this,pu))==null||l.dispose(),Xi(this,pu,void 0),e.replaceChildren(),Xi(this,ff,!1),pA(e,t.loadingLabel);const s=new AbortController;Xi(this,mu,s);try{const p=await ar(this,d_).prepare(t.language,t.source);if(n!==ar(this,eh)||s.signal.aborted)return;const g=p.renderer.materialize?await p.renderer.materialize(p.parsed,{signal:s.signal,theme:t.theme,language:p.language,rawLanguage:p.rawLanguage,rendererId:p.rendererId,data:p.data}):{parsed:p.parsed,data:p.data};if(n!==ar(this,eh)||s.signal.aborted)return;const b=((c=g.data)==null?void 0:c.kind)==="inline"?g.data:void 0,w=((f=(d=(u=p.renderer).getTitle)==null?void 0:d.call(u,g.parsed))==null?void 0:f.trim())||void 0,y=Lte(t.labels),v=b?n5e(e,b,w,()=>{var _,T;return(T=(_=ar(this,hf))==null?void 0:_.resize)==null?void 0:T.call(_)},t.theme,y):void 0;Xi(this,pu,v);const x=(v==null?void 0:v.chartContainer)??e;pA(x,t.loadingLabel);const k=await p.renderer.mount(x,g.parsed,{signal:s.signal,theme:t.theme,...v&&w?{externalizedTitle:w}:{}});if(n!==ar(this,eh)||s.signal.aborted){k==null||k.dispose();return}Xi(this,hf,k||void 0),Xi(this,ff,!0),Z3e(x),e.removeAttribute("aria-busy")}catch(p){if(n!==ar(this,eh)||s.signal.aborted)return;throw(m=ar(this,pu))==null||m.dispose(),Xi(this,pu,void 0),e.replaceChildren(),e.removeAttribute("aria-busy"),Xi(this,ff,!1),p}finally{ar(this,mu)===s&&Xi(this,mu,void 0)}}dispose(){var e,t,n;Xi(this,eh,ar(this,eh)+1),(e=ar(this,mu))==null||e.abort(),Xi(this,mu,void 0),(t=ar(this,hf))==null||t.dispose(),Xi(this,hf,void 0),(n=ar(this,pu))==null||n.dispose(),Xi(this,pu,void 0),Xi(this,ff,!1)}},d_=new WeakMap,eh=new WeakMap,mu=new WeakMap,hf=new WeakMap,pu=new WeakMap,ff=new WeakMap,IX);function ET(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 r5e(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function i5e(e,t,n){const r=j_((n||{}).ignore||[]),i=o5e(t);let o=-1;for(;++o<i.length;)RD(e,"text",l);function l(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 w=f.children.indexOf(u);let y=!1,v=[];m.lastIndex=0;let x=m.exec(u.value);for(;x;){const k=x.index,_={index:x.index,input:x.input,stack:[...d,u]};let T=p(...x,_);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?m.lastIndex=k+1:(g!==k&&v.push({type:"text",value:u.value.slice(g,k)}),Array.isArray(T)?v.push(...T):T&&v.push(T),g=k+x[0].length,y=!0),!m.global)break;x=m.exec(u.value)}return y?(g<u.value.length&&v.push({type:"text",value:u.value.slice(g)}),f.children.splice(w,1,...v)):v=[u],w+v.length}}function o5e(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([a5e(r[0]),l5e(r[1])])}return t}function a5e(e){return typeof e=="string"?new RegExp(r5e(e),"g"):e}function l5e(e){return typeof e=="function"?e:function(){return e}}const gA="phrasing",bA=["autolink","link","image","label"];function c5e(){return{transforms:[g5e],enter:{literalAutolink:d5e,literalAutolinkEmail:yA,literalAutolinkHttp:yA,literalAutolinkWww:yA},exit:{literalAutolink:p5e,literalAutolinkEmail:m5e,literalAutolinkHttp:h5e,literalAutolinkWww:f5e}}}function u5e(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:gA,notInConstruct:bA},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:gA,notInConstruct:bA},{character:":",before:"[ps]",after:"\\/",inConstruct:gA,notInConstruct:bA}]}}function d5e(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function yA(e){this.config.enter.autolinkProtocol.call(this,e)}function h5e(e){this.config.exit.autolinkProtocol.call(this,e)}function f5e(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 m5e(e){this.config.exit.autolinkEmail.call(this,e)}function p5e(e){this.exit(e)}function g5e(e){i5e(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,b5e],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),y5e]],{ignore:["link","linkReference"]})}function b5e(e,t,n,s,r){let i="";if(!Bte(r)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!v5e(n)))return!1;const o=w5e(n+s);if(!o[0])return!1;const l={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function y5e(e,t,n,s){return!Bte(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function v5e(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 w5e(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=ET(e,"(");let i=ET(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 Bte(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Wg(n)||x5(n))&&(!t||n!==47)}zte.peek=j5e;function x5e(){this.buffer()}function k5e(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function _5e(){this.buffer()}function S5e(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function C5e(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=fd(this.sliceSerialize(e)).toLowerCase(),n.label=t}function T5e(e){this.exit(e)}function E5e(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=fd(this.sliceSerialize(e)).toLowerCase(),n.label=t}function A5e(e){this.exit(e)}function j5e(){return"["}function zte(e,t,n,s){const r=n.createTracker(s);let i=r.move("[^");const o=n.enter("footnoteReference"),l=n.enter("reference");return i+=r.move(n.safe(n.associationId(e),{after:"]",before:i})),l(),o(),i+=r.move("]"),i}function N5e(){return{enter:{gfmFootnoteCallString:x5e,gfmFootnoteCall:k5e,gfmFootnoteDefinitionLabelString:_5e,gfmFootnoteDefinition:S5e},exit:{gfmFootnoteCallString:C5e,gfmFootnoteCall:T5e,gfmFootnoteDefinitionLabelString:E5e,gfmFootnoteDefinition:A5e}}}function I5e(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:zte},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,r,i,o){const l=i.createTracker(o);let c=l.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return c+=l.move(i.safe(i.associationId(s),{before:c,after:"]"})),d(),c+=l.move("]:"),s.children&&s.children.length>0&&(l.shift(4),c+=l.move((t?`
`:" ")+i.indentLines(i.containerFlow(s,l.current()),t?Fte:M5e))),u(),c}}function M5e(e,t,n){return t===0?e:Fte(e,t,n)}function Fte(e,t,n){return(n?"":"    ")+e}const R5e=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];qte.peek=$5e;function D5e(){return{canContainEols:["delete"],enter:{strikethrough:P5e},exit:{strikethrough:O5e}}}function L5e(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:R5e}],handlers:{delete:qte}}}function P5e(e){this.enter({type:"delete",children:[]},e)}function O5e(e){this.exit(e)}function qte(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 $5e(){return"~"}function B5e(e){return e.length}function z5e(e,t){const n=t||{},s=(n.align||[]).concat(),r=n.stringLength||B5e,i=[],o=[],l=[],c=[];let u=0,d=-1;for(;++d<e.length;){const b=[],w=[];let y=-1;for(e[d].length>u&&(u=e[d].length);++y<e[d].length;){const v=F5e(e[d][y]);if(n.alignDelimiters!==!1){const x=r(v);w[y]=x,(c[y]===void 0||x>c[y])&&(c[y]=x)}b.push(v)}o[d]=b,l[d]=w}let f=-1;if(typeof s=="object"&&"length"in s)for(;++f<u;)i[f]=tH(s[f]);else{const b=tH(s);for(;++f<u;)i[f]=b}f=-1;const m=[],p=[];for(;++f<u;){const b=i[f];let w="",y="";b===99?(w=":",y=":"):b===108?w=":":b===114&&(y=":");let v=n.alignDelimiters===!1?1:Math.max(1,c[f]-w.length-y.length);const x=w+"-".repeat(v)+y;n.alignDelimiters!==!1&&(v=w.length+v+y.length,v>c[f]&&(c[f]=v),p[f]=v),m[f]=x}o.splice(1,0,m),l.splice(1,0,p),d=-1;const g=[];for(;++d<o.length;){const b=o[d],w=l[d];f=-1;const y=[];for(;++f<u;){const v=b[f]||"";let x="",k="";if(n.alignDelimiters!==!1){const _=c[f]-(w[f]||0),T=i[f];T===114?x=" ".repeat(_):T===99?_%2?(x=" ".repeat(_/2+.5),k=" ".repeat(_/2-.5)):(x=" ".repeat(_/2),k=x):k=" ".repeat(_)}n.delimiterStart!==!1&&!f&&y.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||f)&&y.push(" "),n.alignDelimiters!==!1&&y.push(x),y.push(v),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 F5e(e){return e==null?"":String(e)}function tH(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 nH={}.hasOwnProperty;function q5e(e,t){const n=t||{};function s(r,...i){let o=s.invalid;const l=s.handlers;if(r&&nH.call(r,e)){const c=String(r[e]);o=nH.call(l,c)?l[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 H5e(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()),U5e);return r(),o}function U5e(e,t,n){return">"+(n?"":" ")+e}function W5e(e,t){return sH(e,t.inConstruct,!0)&&!sH(e,t.notInConstruct,!1)}function sH(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 rH(e,t,n,s){let r=-1;for(;++r<n.unsafe.length;)if(n.unsafe[r].character===`
`&&W5e(n.stack,n.unsafe[r]))return/[ \t]/.test(s.before)?"":" ";return`\\
`}function Hte(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 V5e(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 G5e(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 K5e(e,t,n,s){const r=G5e(n),i=e.value||"",o=r==="`"?"GraveAccent":"Tilde";if(V5e(e,n)){const f=n.enter("codeIndented"),m=n.indentLines(i,Y5e);return f(),m}const l=n.createTracker(s),c=r.repeat(Math.max(Hte(i,r)+1,3)),u=n.enter("codeFenced");let d=l.move(c);if(e.lang){const f=n.enter(`codeFencedLang${o}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${o}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:`
`,encode:["`"],...l.current()})),f()}return d+=l.move(`
`),i&&(d+=l.move(i+`
`)),d+=l.move(c),u(),d}function Y5e(e,t,n){return(n?"":"    ")+e}function OD(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 X5e(e,t,n,s){const r=OD(n),i=r==='"'?"Quote":"Apostrophe",o=n.enter("definition");let l=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("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":`
`,...c.current()}))),l(),e.title&&(l=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),l()),o(),u}function Q5e(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 Ak(e){return"&#x"+e.toString(16).toUpperCase()+";"}function AT(e,t,n){const s=My(e),r=My(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}}Ute.peek=J5e;function Ute(e,t,n,s){const r=Q5e(n),i=n.enter("emphasis"),o=n.createTracker(s),l=o.move(r);let c=o.move(n.containerPhrasing(e,{after:r,before:l,...o.current()}));const u=c.charCodeAt(0),d=AT(s.before.charCodeAt(s.before.length-1),u,r);d.inside&&(c=Ak(u)+c.slice(1));const f=c.charCodeAt(c.length-1),m=AT(s.after.charCodeAt(0),f,r);m.inside&&(c=c.slice(0,-1)+Ak(f));const p=o.move(r);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},l+c+p}function J5e(e,t,n){return n.options.emphasis||"*"}function Z5e(e,t){let n=!1;return DD(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,sI}),!!((!e.depth||e.depth<3)&&TD(e)&&(t.options.setext||n))}function e6e(e,t,n,s){const r=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(s);if(Z5e(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),l=n.enter("headingAtx"),c=n.enter("phrasing");i.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
`,...i.current()});return/^[\t ]/.test(u)&&(u=Ak(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),l(),u}Wte.peek=t6e;function Wte(e){return e.value||""}function t6e(){return"<"}Vte.peek=n6e;function Vte(e,t,n,s){const r=OD(n),i=r==='"'?"Quote":"Apostrophe",o=n.enter("image");let l=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("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=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),l()),u+=c.move(")"),o(),u}function n6e(){return"!"}Gte.peek=s6e;function Gte(e,t,n,s){const r=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const l=n.createTracker(s);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=d,i(),r==="full"||!u||u!==f?c+=l.move(f+"]"):r==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function s6e(){return"!"}Kte.peek=r6e;function Kte(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],l=n.compilePattern(o);let c;if(o.atBreak)for(;c=l.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 r6e(){return"`"}function Yte(e,t){const n=TD(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))}Xte.peek=i6e;function Xte(e,t,n,s){const r=OD(n),i=r==='"'?"Quote":"Apostrophe",o=n.createTracker(s);let l,c;if(Yte(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let f=o.move("<");return f+=o.move(n.containerPhrasing(e,{before:f,after:">",...o.current()})),f+=o.move(">"),l(),n.stack=d,f}l=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(")"),l(),u}function i6e(e,t,n){return Yte(e,n)?"<":"["}Qte.peek=o6e;function Qte(e,t,n,s){const r=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const l=n.createTracker(s);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=d,i(),r==="full"||!u||u!==f?c+=l.move(f+"]"):r==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function o6e(){return"["}function $D(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 a6e(e){const t=$D(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 l6e(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 Jte(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 c6e(e,t,n,s){const r=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?l6e(n):$D(n);const l=e.ordered?o==="."?")":".":a6e(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),Jte(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=l),n.bulletCurrent=o;const u=n.containerFlow(e,s);return n.bulletLastUsed=o,n.bulletCurrent=i,r(),u}function u6e(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 d6e(e,t,n,s){const r=u6e(n);let i=n.bulletCurrent||$D(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 l=n.createTracker(s);l.move(i+" ".repeat(o-i.length)),l.shift(o);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.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 h6e(e,t,n,s){const r=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,s);return i(),r(),o}const f6e=j_(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function m6e(e,t,n,s){return(e.children.some(function(o){return f6e(o)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function p6e(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Zte.peek=g6e;function Zte(e,t,n,s){const r=p6e(n),i=n.enter("strong"),o=n.createTracker(s),l=o.move(r+r);let c=o.move(n.containerPhrasing(e,{after:r,before:l,...o.current()}));const u=c.charCodeAt(0),d=AT(s.before.charCodeAt(s.before.length-1),u,r);d.inside&&(c=Ak(u)+c.slice(1));const f=c.charCodeAt(c.length-1),m=AT(s.after.charCodeAt(0),f,r);m.inside&&(c=c.slice(0,-1)+Ak(f));const p=o.move(r+r);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},l+c+p}function g6e(e,t,n){return n.options.strong||"*"}function b6e(e,t,n,s){return n.safe(e.value,s)}function y6e(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 v6e(e,t,n){const s=(Jte(n)+(n.options.ruleSpaces?" ":"")).repeat(y6e(n));return n.options.ruleSpaces?s.slice(0,-1):s}const ene={blockquote:H5e,break:rH,code:K5e,definition:X5e,emphasis:Ute,hardBreak:rH,heading:e6e,html:Wte,image:Vte,imageReference:Gte,inlineCode:Kte,link:Xte,linkReference:Qte,list:c6e,listItem:d6e,paragraph:h6e,root:m6e,strong:Zte,text:b6e,thematicBreak:v6e};function w6e(){return{enter:{table:x6e,tableData:iH,tableHeader:iH,tableRow:_6e},exit:{codeText:S6e,table:k6e,tableData:vA,tableHeader:vA,tableRow:vA}}}function x6e(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 k6e(e){this.exit(e),this.data.inTable=void 0}function _6e(e){this.enter({type:"tableRow",children:[]},e)}function vA(e){this.exit(e)}function iH(e){this.enter({type:"tableCell",children:[]},e)}function S6e(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,C6e));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function C6e(e,t){return t==="|"?t:e}function T6e(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:l}};function o(p,g,b,w){return u(d(p,b,w),p.align)}function l(p,g,b,w){const y=f(p,b,w),v=u([y]);return v.slice(0,v.indexOf(`
`))}function c(p,g,b,w){const y=b.enter("tableCell"),v=b.enter("phrasing"),x=b.containerPhrasing(p,{...w,before:i,after:i});return v(),y(),x}function u(p,g){return z5e(p,{align:g,alignDelimiters:s,padding:n,stringLength:r})}function d(p,g,b){const w=p.children;let y=-1;const v=[],x=g.enter("table");for(;++y<w.length;)v[y]=f(w[y],g,b);return x(),v}function f(p,g,b){const w=p.children;let y=-1;const v=[],x=g.enter("tableRow");for(;++y<w.length;)v[y]=c(w[y],p,g,b);return x(),v}function m(p,g,b){let w=ene.inlineCode(p,g,b);return b.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function E6e(){return{exit:{taskListCheckValueChecked:oH,taskListCheckValueUnchecked:oH,paragraph:j6e}}}function A6e(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:N6e}}}function oH(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function j6e(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 l=r[i];if(l.type==="paragraph"){o=l;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 N6e(e,t,n,s){const r=e.children[0],i=typeof e.checked=="boolean"&&r&&r.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=n.createTracker(s);i&&l.move(o);let c=ene.listItem(e,t,n,{...s,...l.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(d){return d+o}}function I6e(){return[c5e(),N5e(),D5e(),w6e(),E6e()]}function M6e(e){return{extensions:[u5e(),I5e(e),L5e(),T6e(e),A6e()]}}const R6e={tokenize:B6e,partial:!0},tne={tokenize:z6e,partial:!0},nne={tokenize:F6e,partial:!0},sne={tokenize:q6e,partial:!0},D6e={tokenize:H6e,partial:!0},rne={name:"wwwAutolink",tokenize:O6e,previous:one},ine={name:"protocolAutolink",tokenize:$6e,previous:ane},om={name:"emailAutolink",tokenize:P6e,previous:lne},Ih={};function L6e(){return{text:Ih}}let V0=48;for(;V0<123;)Ih[V0]=om,V0++,V0===58?V0=65:V0===91&&(V0=97);Ih[43]=om;Ih[45]=om;Ih[46]=om;Ih[95]=om;Ih[72]=[om,ine];Ih[104]=[om,ine];Ih[87]=[om,rne];Ih[119]=[om,rne];function P6e(e,t,n){const s=this;let r,i;return o;function o(f){return!lI(f)||!lne.call(s,s.previous)||BD(s.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(f))}function l(f){return lI(f)?(e.consume(f),l):f===64?(e.consume(f),c):n(f)}function c(f){return f===46?e.check(D6e,d,u)(f):f===45||f===95||bl(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&&zl(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function O6e(e,t,n){const s=this;return r;function r(o){return o!==87&&o!==119||!one.call(s,s.previous)||BD(s.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(R6e,e.attempt(tne,e.attempt(nne,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function $6e(e,t,n){const s=this;let r="",i=!1;return o;function o(f){return(f===72||f===104)&&ane.call(s,s.previous)&&!BD(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),r+=String.fromCodePoint(f),e.consume(f),l):n(f)}function l(f){if(zl(f)&&r.length<5)return r+=String.fromCodePoint(f),e.consume(f),l;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||_T(f)||ki(f)||Wg(f)||x5(f)?n(f):e.attempt(tne,e.attempt(nne,d),n)(f)}function d(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function B6e(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 z6e(e,t,n){let s,r,i;return o;function o(u){return u===46||u===95?e.check(sne,c,l)(u):u===null||ki(u)||Wg(u)||u!==45&&x5(u)?c(u):(i=!0,e.consume(u),o)}function l(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 F6e(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(sne,t,i)(o):o===null||ki(o)||Wg(o)?t(o):(e.consume(o),r)}function i(o){return o===41&&s++,e.consume(o),r}}function q6e(e,t,n){return s;function s(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),s):l===38?(e.consume(l),i):l===93?(e.consume(l),r):l===60||l===null||ki(l)||Wg(l)?t(l):n(l)}function r(l){return l===null||l===40||l===91||ki(l)||Wg(l)?t(l):s(l)}function i(l){return zl(l)?o(l):n(l)}function o(l){return l===59?(e.consume(l),s):zl(l)?(e.consume(l),o):n(l)}}function H6e(e,t,n){return s;function s(i){return e.consume(i),r}function r(i){return bl(i)?n(i):t(i)}}function one(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ki(e)}function ane(e){return!zl(e)}function lne(e){return!(e===47||lI(e))}function lI(e){return e===43||e===45||e===46||e===95||bl(e)}function BD(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 U6e={tokenize:J6e,partial:!0};function W6e(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Y6e,continuation:{tokenize:X6e},exit:Q6e}},text:{91:{name:"gfmFootnoteCall",tokenize:K6e},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:V6e,resolveTo:G6e}}}}function V6e(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 l;function l(c){if(!o||!o._balanced)return n(c);const u=fd(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 G6e(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)},l=[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,...l),e}function K6e(e,t,n){const s=this,r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i=0,o;return l;function l(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||ki(f))return n(f);if(f===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return r.includes(fd(s.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return ki(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 Y6e(e,t,n){const s=this,r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i,o=0,l;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&&!l||g===null||g===91||ki(g))return n(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return i=fd(s.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return ki(g)||(l=!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),sr(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return t(g)}}function X6e(e,t,n){return e.check(A_,t,e.attempt(U6e,t,n))}function Q6e(e){e.exit("gfmFootnoteDefinition")}function J6e(e,t,n){const s=this;return sr(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 Z6e(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,l){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,l],["enter",o[u][1],l],["exit",o[u][1],l],["enter",f,l]],p=l.parser.constructs.insideSpan.null;p&&Kc(m,m.length,0,k5(p,o.slice(u+1,c),l)),Kc(m,m.length,0,[["exit",f,l],["enter",o[c][1],l],["exit",o[c][1],l],["exit",d,l]]),Kc(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,l,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=My(u);if(g===126)return f>1?c(g):(o.consume(g),f++,p);if(f<2&&!n)return c(g);const w=o.exit("strikethroughSequenceTemporary"),y=My(g);return w._open=!y||y===2&&!!b,w._close=!b||b===2&&!!y,l(g)}}}class eEe{constructor(){this.map=[]}add(t,n,s){tEe(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 tEe(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 nEe(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 sEe(){return{flow:{null:{name:"table",tokenize:rEe,resolveAll:iEe}}}}function rEe(e,t,n){const s=this;let r=0,i=0,o;return l;function l(E){let O=s.events.length-1;for(;O>-1;){const j=s.events[O][1].type;if(j==="lineEnding"||j==="linePrefix")O--;else break}const B=O>-1?s.events[O][1].type:null,D=B==="tableHead"||B==="tableRow"?T:c;return D===T&&s.parser.lazy[s.now().line]?n(E):D(E)}function c(E){return e.enter("tableHead"),e.enter("tableRow"),u(E)}function u(E){return E===124||(o=!0,i+=1),d(E)}function d(E){return E===null?n(E):Yn(E)?i>1?(i=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),p):n(E):dr(E)?sr(e,d,"whitespace")(E):(i+=1,o&&(o=!1,r+=1),E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),f(E)))}function f(E){return E===null||E===124||ki(E)?(e.exit("data"),d(E)):(e.consume(E),E===92?m:f)}function m(E){return E===92||E===124?(e.consume(E),f):f(E)}function p(E){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(E):(e.enter("tableDelimiterRow"),o=!1,dr(E)?sr(e,g,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):g(E))}function g(E){return E===45||E===58?w(E):E===124?(o=!0,e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),b):_(E)}function b(E){return dr(E)?sr(e,w,"whitespace")(E):w(E)}function w(E){return E===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),y):E===45?(i+=1,y(E)):E===null||Yn(E)?k(E):_(E)}function y(E){return E===45?(e.enter("tableDelimiterFiller"),v(E)):_(E)}function v(E){return E===45?(e.consume(E),v):E===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(E))}function x(E){return dr(E)?sr(e,k,"whitespace")(E):k(E)}function k(E){return E===124?g(E):E===null||Yn(E)?!o||r!==i?_(E):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(E)):_(E)}function _(E){return n(E)}function T(E){return e.enter("tableRow"),S(E)}function S(E){return E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),S):E===null||Yn(E)?(e.exit("tableRow"),t(E)):dr(E)?sr(e,S,"whitespace")(E):(e.enter("data"),C(E))}function C(E){return E===null||E===124||ki(E)?(e.exit("data"),S(E)):(e.consume(E),E===92?N:C)}function N(E){return E===92||E===124?(e.consume(E),C):C(E)}}function iEe(e,t){let n=-1,s=!0,r=0,i=[0,0,0,0],o=[0,0,0,0],l=!1,c=0,u,d,f;const m=new eEe;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(l=!1,c!==0&&(aH(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],l&&(l=!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=S2(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=S2(m,t,i,r,void 0,f)),i=o,o=[i[1],n,0,0])):g.type==="tableHead"?(l=!0,c=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(c=n,i[1]!==0?(o[0]=o[1],f=S2(m,t,i,r,n,f)):o[1]!==0&&(f=S2(m,t,o,r,n,f)),r=0):r&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&aH(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=nEe(t.events,n))}return e}function S2(e,t,n,s,r,i){const o=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(i.end=Object.assign({},_b(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=_b(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=_b(t.events,n[2]),d=_b(t.events,n[3]),f={type:l,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({},_b(t.events,r)),e.add(r,0,[["exit",i,t]]),i=void 0),i}function aH(e,t,n,s,r){const i=[],o=_b(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 _b(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const oEe={name:"tasklistCheck",tokenize:lEe};function aEe(){return{text:{91:oEe}}}function lEe(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 ki(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"),l):n(c)}function l(c){return Yn(c)?t(c):dr(c)?e.check({tokenize:cEe},t,n)(c):n(c)}}function cEe(e,t,n){return sr(e,s,"whitespace");function s(r){return r===null?n(r):t(r)}}function uEe(e){return cte([L6e(),W6e(),Z6e(e),sEe(),aEe()])}const dEe={};function lH(e){const t=this,n=e||dEe,s=t.data(),r=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);r.push(uEe(n)),i.push(I6e()),o.push(M6e(n))}function hEe(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:i},exit:{mathFlow:r,mathFlowFence:s,mathFlowFenceMeta:n,mathFlowValue:l,mathText:o,mathTextData:l}};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 l(c){this.config.enter.data.call(this,c),this.config.exit.data.call(this,c)}}function fEe(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,l,c){const u=i.value||"",d=l.createTracker(c),f="$".repeat(Math.max(Hte(u,"$")+1,2)),m=l.enter("mathFlow");let p=d.move(f);if(i.meta){const g=l.enter("mathFlowMeta");p+=d.move(l.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,l){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<l.unsafe.length;){const m=l.unsafe[f];if(!m.atBreak)continue;const p=l.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 mEe={tokenize:pEe,concrete:!0,name:"mathFlow"},cH={tokenize:gEe,partial:!0};function pEe(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 l;function l(v){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),c(v)}function c(v){return v===36?(e.consume(v),o++,c):o<2?n(v):(e.exit("mathFlowFenceSequence"),sr(e,u,"whitespace")(v))}function u(v){return v===null||Yn(v)?f(v):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(v))}function d(v){return v===null||Yn(v)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),f(v)):v===36?n(v):(e.consume(v),d)}function f(v){return e.exit("mathFlowFence"),s.interrupt?t(v):e.attempt(cH,m,w)(v)}function m(v){return e.attempt({tokenize:y,partial:!0},w,p)(v)}function p(v){return(i?sr(e,g,"linePrefix",i+1):g)(v)}function g(v){return v===null?w(v):Yn(v)?e.attempt(cH,m,w)(v):(e.enter("mathFlowValue"),b(v))}function b(v){return v===null||Yn(v)?(e.exit("mathFlowValue"),g(v)):(e.consume(v),b)}function w(v){return e.exit("mathFlow"),t(v)}function y(v,x,k){let _=0;return sr(v,T,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function T(N){return v.enter("mathFlowFence"),v.enter("mathFlowFenceSequence"),S(N)}function S(N){return N===36?(_++,v.consume(N),S):_<o?k(N):(v.exit("mathFlowFenceSequence"),sr(v,C,"whitespace")(N))}function C(N){return N===null||Yn(N)?(v.exit("mathFlowFence"),x(N)):k(N)}}}function gEe(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 bEe(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:s,resolve:yEe,previous:vEe,name:"mathText"};function s(r,i,o){let l=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),l++,f):l<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):Yn(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||Yn(b)?(r.exit("mathTextData"),m(b)):(r.consume(b),p)}function g(b){return b===36?(r.consume(b),c++,g):c===l?(r.exit("mathTextSequence"),r.exit("mathText"),i(b)):(u.type="mathTextData",p(b))}}}function yEe(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 vEe(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function wEe(e){return{flow:{36:mEe},text:{36:bEe(e)}}}class zt extends Error{constructor(t,n){var s="KaTeX parse error: "+t,r,i,o=n&&n.loc;if(o&&o.start<=o.end){var l=o.lexer.input;r=o.start,i=o.end,r===l.length?s+=" at end of input: ":s+=" at position "+(r+1)+": ";var c=l.slice(r,i).replace(/[^]/g,"$&̲"),u;r>15?u="…"+l.slice(r-15,r):u=l.slice(0,r);var d;i+15<l.length?d=l.slice(i,i+15)+"…":d=l.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,zt.prototype),this.position=r,r!=null&&i!=null&&(this.length=i-r),this.rawMessage=t}}var xEe=/([A-Z])/g,kEe=e=>e.replace(xEe,"-$1").toLowerCase(),_Ee={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},SEe=/[&><"']/g,yl=e=>String(e).replace(SEe,t=>_Ee[t]),c4=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?c4(e.body[0]):e:e.type==="font"?c4(e.body):e,CEe=new Set(["mathord","textord","atom"]),am=e=>CEe.has(c4(e).type),TEe=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"},jT={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 EEe(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 AEe(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return EEe(t)}function jEe(e,t,n,s){var r=n[t];e[t]=r!==void 0?s.processor?s.processor(r):r:AEe(s)}class zD{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(jT)){var s=jT[n];s&&jEe(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 zt("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=TEe(t.url);if(n==null)return!1;t.protocol=n}var s=typeof this.trust=="function"?this.trust(t):this.trust;return!!s}}let jm=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 th[NEe[this.id]]}sub(){return th[IEe[this.id]]}fracNum(){return th[MEe[this.id]]}fracDen(){return th[REe[this.id]]}cramp(){return th[DEe[this.id]]}text(){return th[LEe[this.id]]}isTight(){return this.size>=2}};var FD=0,NT=1,oy=2,Nf=3,jk=4,Au=5,Ry=6,Vl=7,th=[new jm(FD,0,!1),new jm(NT,0,!0),new jm(oy,1,!1),new jm(Nf,1,!0),new jm(jk,2,!1),new jm(Au,2,!0),new jm(Ry,3,!1),new jm(Vl,3,!0)],NEe=[jk,Au,jk,Au,Ry,Vl,Ry,Vl],IEe=[Au,Au,Au,Au,Vl,Vl,Vl,Vl],MEe=[oy,Nf,jk,Au,Ry,Vl,Ry,Vl],REe=[Nf,Nf,Au,Au,Vl,Vl,Vl,Vl],DEe=[NT,NT,Nf,Nf,Au,Au,Vl,Vl],LEe=[FD,NT,oy,Nf,oy,Nf,oy,Nf],Cs={DISPLAY:th[FD],TEXT:th[oy],SCRIPT:th[jk],SCRIPTSCRIPT:th[Ry]},cI=[{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 PEe(e){for(var t=0;t<cI.length;t++)for(var n=cI[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 u4=[];cI.forEach(e=>e.blocks.forEach(t=>u4.push(...t)));function cne(e){for(var t=0;t<u4.length;t+=2)if(e>=u4[t]&&e<=u4[t+1])return!0;return!1}var aa=e=>e+" "+e,tb=80,OEe=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"},$Ee=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"},BEe=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"},zEe=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"},FEe=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"},qEe=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},HEe=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"},UEe=function(t,n,s){n=1e3*n;var r="";switch(t){case"sqrtMain":r=OEe(n,tb);break;case"sqrtSize1":r=$Ee(n,tb);break;case"sqrtSize2":r=BEe(n,tb);break;case"sqrtSize3":r=zEe(n,tb);break;case"sqrtSize4":r=FEe(n,tb);break;case"sqrtTall":r=HEe(n,tb,s)}return r},WEe=function(t,n){switch(t){case"⎜":return aa("M291 0 H417 V"+n+" H291z");case"∣":return aa("M145 0 H188 V"+n+" H145z");case"∥":return aa("M145 0 H188 V"+n+" H145z")+aa("M367 0 H410 V"+n+" H367z");case"⎟":return aa("M457 0 H583 V"+n+" H457z");case"⎢":return aa("M319 0 H403 V"+n+" H319z");case"⎥":return aa("M263 0 H347 V"+n+" H263z");case"⎪":return aa("M384 0 H504 V"+n+" H384z");case"⏐":return aa("M312 0 H355 V"+n+" H312z");case"‖":return aa("M257 0 H300 V"+n+" H257z")+aa("M478 0 H521 V"+n+" H478z");default:return""}},uH={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:aa("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:aa("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:aa("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:aa("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:aa("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:aa("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:aa("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:aa("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`},VEe=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 GEe(e){return"toText"in e}let kv=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(GEe(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}};var uI={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},KEe={ex:!0,em:!0,mu:!0},une=function(t){return typeof t!="string"&&(t=t.unit),t in uI||t in KEe||t==="ex"},ao=function(t,n){var s;if(t.unit in uI)s=uI[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 zt("Invalid unit: '"+t.unit+"'");r!==n&&(s*=r.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*s,n.maxSize)},Xt=function(t){return+t.toFixed(4)+"em"},Dp=function(t){return t.filter(n=>n).join(" ")},qD=function(t){var n="";for(var s of Object.keys(t)){var r=t[s];r!==void 0&&(n+=kEe(s)+":"+r+";")}return n},dne=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)}},hne=function(t){var n=document.createElement(t);n.className=Dp(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},YEe=/[\s"'>/=\x00-\x1f]/,fne=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+yl(Dp(this.classes))+'"');var s=qD(this.style);s&&(n+=' style="'+yl(s)+'"');for(var r of Object.keys(this.attributes)){if(YEe.test(r))throw new zt("Invalid attribute name '"+r+"'");n+=" "+r+'="'+yl(this.attributes[r])+'"'}n+=">";for(var i=0;i<this.children.length;i++)n+=this.children[i].toMarkup();return n+="</"+t+">",n};class _v{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,dne.call(this,t,s,r),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return hne.call(this,"span")}toMarkup(){return fne.call(this,"span")}}let C5=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,dne.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 hne.call(this,"a")}toMarkup(){return fne.call(this,"a")}};class XEe{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="'+yl(this.src)+'"'+(' alt="'+yl(this.alt)+'"'),n=qD(this.style);return n&&(t+=' style="'+yl(n)+'"'),t+="'/>",t}}var QEe={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class tu{constructor(t,n,s,r,i,o,l,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=l||[],this.style=c||{},this.maxFontSize=0;var u=PEe(this.text.charCodeAt(0));u&&this.classes.push(u+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=QEe[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=Xt(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=Dp(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+=yl(Dp(this.classes)),n+='"');var s="";this.italic>0&&(s+="margin-right:"+Xt(this.italic)+";"),s+=qD(this.style),s&&(t=!0,n+=' style="'+yl(s)+'"');var r=yl(this.text);return t?(n+=">",n+=r,n+="</span>",n):r}}class Gf{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+'="'+yl(this.attributes[n])+'"';t+=">";for(var s=0;s<this.children.length;s++)t+=this.children[s].toMarkup();return t+="</svg>",t}}class Lp{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",uH[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+yl(this.alternate)+'"/>':'<path d="'+yl(uH[this.pathName])+'"/>'}}class dI{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+'="'+yl(this.attributes[n])+'"';return t+="/>",t}}function JEe(e){if(e instanceof tu)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function ZEe(e){if(e instanceof _v)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var e8e=e=>e instanceof _v||e instanceof C5||e instanceof kv,dh={"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]}},C2={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]},dH={Å:"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 mne(e,t){dh[e]=t}function HD(e,t,n){if(!dh[t])throw new Error("Font metrics not found for font: "+t+".");var s=e.charCodeAt(0),r=dh[t][s];if(!r&&e[0]in dH&&(s=dH[e[0]].charCodeAt(0),r=dh[t][s]),!r&&n==="text"&&cne(s)&&(r=dh[t][77]),r)return{depth:r[0],height:r[1],italic:r[2],skew:r[3],width:r[4]}}var wA={};function t8e(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!wA[t]){var n=wA[t]={cssEmPerMu:C2.quad[t]/18};for(var s in C2)C2.hasOwnProperty(s)&&(n[s]=C2[s][t])}return wA[t]}var Ui={math:{},text:{}};function P(e,t,n,s,r,i){Ui[e][r]={font:t,group:n,replace:s},i&&s&&(Ui[e][s]=Ui[e][r])}var H="math",Nt="text",ee="main",_e="ams",Vi="accent-token",Dn="bin",Xl="close",Sv="inner",is="mathord",Jo="op-token",su="open",I_="punct",Se="rel",lm="spacing",je="textord";P(H,ee,Se,"≡","\\equiv",!0);P(H,ee,Se,"≺","\\prec",!0);P(H,ee,Se,"≻","\\succ",!0);P(H,ee,Se,"∼","\\sim",!0);P(H,ee,Se,"⊥","\\perp");P(H,ee,Se,"⪯","\\preceq",!0);P(H,ee,Se,"⪰","\\succeq",!0);P(H,ee,Se,"≃","\\simeq",!0);P(H,ee,Se,"∣","\\mid",!0);P(H,ee,Se,"≪","\\ll",!0);P(H,ee,Se,"≫","\\gg",!0);P(H,ee,Se,"≍","\\asymp",!0);P(H,ee,Se,"∥","\\parallel");P(H,ee,Se,"⋈","\\bowtie",!0);P(H,ee,Se,"⌣","\\smile",!0);P(H,ee,Se,"⊑","\\sqsubseteq",!0);P(H,ee,Se,"⊒","\\sqsupseteq",!0);P(H,ee,Se,"≐","\\doteq",!0);P(H,ee,Se,"⌢","\\frown",!0);P(H,ee,Se,"∋","\\ni",!0);P(H,ee,Se,"∝","\\propto",!0);P(H,ee,Se,"⊢","\\vdash",!0);P(H,ee,Se,"⊣","\\dashv",!0);P(H,ee,Se,"∋","\\owns");P(H,ee,I_,".","\\ldotp");P(H,ee,I_,"⋅","\\cdotp");P(H,ee,I_,"⋅","·");P(Nt,ee,je,"⋅","·");P(H,ee,je,"#","\\#");P(Nt,ee,je,"#","\\#");P(H,ee,je,"&","\\&");P(Nt,ee,je,"&","\\&");P(H,ee,je,"ℵ","\\aleph",!0);P(H,ee,je,"∀","\\forall",!0);P(H,ee,je,"ℏ","\\hbar",!0);P(H,ee,je,"∃","\\exists",!0);P(H,ee,je,"∇","\\nabla",!0);P(H,ee,je,"♭","\\flat",!0);P(H,ee,je,"ℓ","\\ell",!0);P(H,ee,je,"♮","\\natural",!0);P(H,ee,je,"♣","\\clubsuit",!0);P(H,ee,je,"℘","\\wp",!0);P(H,ee,je,"♯","\\sharp",!0);P(H,ee,je,"♢","\\diamondsuit",!0);P(H,ee,je,"ℜ","\\Re",!0);P(H,ee,je,"♡","\\heartsuit",!0);P(H,ee,je,"ℑ","\\Im",!0);P(H,ee,je,"♠","\\spadesuit",!0);P(H,ee,je,"§","\\S",!0);P(Nt,ee,je,"§","\\S");P(H,ee,je,"¶","\\P",!0);P(Nt,ee,je,"¶","\\P");P(H,ee,je,"†","\\dag");P(Nt,ee,je,"†","\\dag");P(Nt,ee,je,"†","\\textdagger");P(H,ee,je,"‡","\\ddag");P(Nt,ee,je,"‡","\\ddag");P(Nt,ee,je,"‡","\\textdaggerdbl");P(H,ee,Xl,"⎱","\\rmoustache",!0);P(H,ee,su,"⎰","\\lmoustache",!0);P(H,ee,Xl,"⟯","\\rgroup",!0);P(H,ee,su,"⟮","\\lgroup",!0);P(H,ee,Dn,"∓","\\mp",!0);P(H,ee,Dn,"⊖","\\ominus",!0);P(H,ee,Dn,"⊎","\\uplus",!0);P(H,ee,Dn,"⊓","\\sqcap",!0);P(H,ee,Dn,"∗","\\ast");P(H,ee,Dn,"⊔","\\sqcup",!0);P(H,ee,Dn,"◯","\\bigcirc",!0);P(H,ee,Dn,"∙","\\bullet",!0);P(H,ee,Dn,"‡","\\ddagger");P(H,ee,Dn,"≀","\\wr",!0);P(H,ee,Dn,"⨿","\\amalg");P(H,ee,Dn,"&","\\And");P(H,ee,Se,"⟵","\\longleftarrow",!0);P(H,ee,Se,"⇐","\\Leftarrow",!0);P(H,ee,Se,"⟸","\\Longleftarrow",!0);P(H,ee,Se,"⟶","\\longrightarrow",!0);P(H,ee,Se,"⇒","\\Rightarrow",!0);P(H,ee,Se,"⟹","\\Longrightarrow",!0);P(H,ee,Se,"↔","\\leftrightarrow",!0);P(H,ee,Se,"⟷","\\longleftrightarrow",!0);P(H,ee,Se,"⇔","\\Leftrightarrow",!0);P(H,ee,Se,"⟺","\\Longleftrightarrow",!0);P(H,ee,Se,"↦","\\mapsto",!0);P(H,ee,Se,"⟼","\\longmapsto",!0);P(H,ee,Se,"↗","\\nearrow",!0);P(H,ee,Se,"↩","\\hookleftarrow",!0);P(H,ee,Se,"↪","\\hookrightarrow",!0);P(H,ee,Se,"↘","\\searrow",!0);P(H,ee,Se,"↼","\\leftharpoonup",!0);P(H,ee,Se,"⇀","\\rightharpoonup",!0);P(H,ee,Se,"↙","\\swarrow",!0);P(H,ee,Se,"↽","\\leftharpoondown",!0);P(H,ee,Se,"⇁","\\rightharpoondown",!0);P(H,ee,Se,"↖","\\nwarrow",!0);P(H,ee,Se,"⇌","\\rightleftharpoons",!0);P(H,_e,Se,"≮","\\nless",!0);P(H,_e,Se,"","\\@nleqslant");P(H,_e,Se,"","\\@nleqq");P(H,_e,Se,"⪇","\\lneq",!0);P(H,_e,Se,"≨","\\lneqq",!0);P(H,_e,Se,"","\\@lvertneqq");P(H,_e,Se,"⋦","\\lnsim",!0);P(H,_e,Se,"⪉","\\lnapprox",!0);P(H,_e,Se,"⊀","\\nprec",!0);P(H,_e,Se,"⋠","\\npreceq",!0);P(H,_e,Se,"⋨","\\precnsim",!0);P(H,_e,Se,"⪹","\\precnapprox",!0);P(H,_e,Se,"≁","\\nsim",!0);P(H,_e,Se,"","\\@nshortmid");P(H,_e,Se,"∤","\\nmid",!0);P(H,_e,Se,"⊬","\\nvdash",!0);P(H,_e,Se,"⊭","\\nvDash",!0);P(H,_e,Se,"⋪","\\ntriangleleft");P(H,_e,Se,"⋬","\\ntrianglelefteq",!0);P(H,_e,Se,"⊊","\\subsetneq",!0);P(H,_e,Se,"","\\@varsubsetneq");P(H,_e,Se,"⫋","\\subsetneqq",!0);P(H,_e,Se,"","\\@varsubsetneqq");P(H,_e,Se,"≯","\\ngtr",!0);P(H,_e,Se,"","\\@ngeqslant");P(H,_e,Se,"","\\@ngeqq");P(H,_e,Se,"⪈","\\gneq",!0);P(H,_e,Se,"≩","\\gneqq",!0);P(H,_e,Se,"","\\@gvertneqq");P(H,_e,Se,"⋧","\\gnsim",!0);P(H,_e,Se,"⪊","\\gnapprox",!0);P(H,_e,Se,"⊁","\\nsucc",!0);P(H,_e,Se,"⋡","\\nsucceq",!0);P(H,_e,Se,"⋩","\\succnsim",!0);P(H,_e,Se,"⪺","\\succnapprox",!0);P(H,_e,Se,"≆","\\ncong",!0);P(H,_e,Se,"","\\@nshortparallel");P(H,_e,Se,"∦","\\nparallel",!0);P(H,_e,Se,"⊯","\\nVDash",!0);P(H,_e,Se,"⋫","\\ntriangleright");P(H,_e,Se,"⋭","\\ntrianglerighteq",!0);P(H,_e,Se,"","\\@nsupseteqq");P(H,_e,Se,"⊋","\\supsetneq",!0);P(H,_e,Se,"","\\@varsupsetneq");P(H,_e,Se,"⫌","\\supsetneqq",!0);P(H,_e,Se,"","\\@varsupsetneqq");P(H,_e,Se,"⊮","\\nVdash",!0);P(H,_e,Se,"⪵","\\precneqq",!0);P(H,_e,Se,"⪶","\\succneqq",!0);P(H,_e,Se,"","\\@nsubseteqq");P(H,_e,Dn,"⊴","\\unlhd");P(H,_e,Dn,"⊵","\\unrhd");P(H,_e,Se,"↚","\\nleftarrow",!0);P(H,_e,Se,"↛","\\nrightarrow",!0);P(H,_e,Se,"⇍","\\nLeftarrow",!0);P(H,_e,Se,"⇏","\\nRightarrow",!0);P(H,_e,Se,"↮","\\nleftrightarrow",!0);P(H,_e,Se,"⇎","\\nLeftrightarrow",!0);P(H,_e,Se,"△","\\vartriangle");P(H,_e,je,"ℏ","\\hslash");P(H,_e,je,"▽","\\triangledown");P(H,_e,je,"◊","\\lozenge");P(H,_e,je,"Ⓢ","\\circledS");P(H,_e,je,"®","\\circledR");P(Nt,_e,je,"®","\\circledR");P(H,_e,je,"∡","\\measuredangle",!0);P(H,_e,je,"∄","\\nexists");P(H,_e,je,"℧","\\mho");P(H,_e,je,"Ⅎ","\\Finv",!0);P(H,_e,je,"⅁","\\Game",!0);P(H,_e,je,"‵","\\backprime");P(H,_e,je,"▲","\\blacktriangle");P(H,_e,je,"▼","\\blacktriangledown");P(H,_e,je,"■","\\blacksquare");P(H,_e,je,"⧫","\\blacklozenge");P(H,_e,je,"★","\\bigstar");P(H,_e,je,"∢","\\sphericalangle",!0);P(H,_e,je,"∁","\\complement",!0);P(H,_e,je,"ð","\\eth",!0);P(Nt,ee,je,"ð","ð");P(H,_e,je,"╱","\\diagup");P(H,_e,je,"╲","\\diagdown");P(H,_e,je,"□","\\square");P(H,_e,je,"□","\\Box");P(H,_e,je,"◊","\\Diamond");P(H,_e,je,"¥","\\yen",!0);P(Nt,_e,je,"¥","\\yen",!0);P(H,_e,je,"✓","\\checkmark",!0);P(Nt,_e,je,"✓","\\checkmark");P(H,_e,je,"ℶ","\\beth",!0);P(H,_e,je,"ℸ","\\daleth",!0);P(H,_e,je,"ℷ","\\gimel",!0);P(H,_e,je,"ϝ","\\digamma",!0);P(H,_e,je,"ϰ","\\varkappa");P(H,_e,su,"┌","\\@ulcorner",!0);P(H,_e,Xl,"┐","\\@urcorner",!0);P(H,_e,su,"└","\\@llcorner",!0);P(H,_e,Xl,"┘","\\@lrcorner",!0);P(H,_e,Se,"≦","\\leqq",!0);P(H,_e,Se,"⩽","\\leqslant",!0);P(H,_e,Se,"⪕","\\eqslantless",!0);P(H,_e,Se,"≲","\\lesssim",!0);P(H,_e,Se,"⪅","\\lessapprox",!0);P(H,_e,Se,"≊","\\approxeq",!0);P(H,_e,Dn,"⋖","\\lessdot");P(H,_e,Se,"⋘","\\lll",!0);P(H,_e,Se,"≶","\\lessgtr",!0);P(H,_e,Se,"⋚","\\lesseqgtr",!0);P(H,_e,Se,"⪋","\\lesseqqgtr",!0);P(H,_e,Se,"≑","\\doteqdot");P(H,_e,Se,"≓","\\risingdotseq",!0);P(H,_e,Se,"≒","\\fallingdotseq",!0);P(H,_e,Se,"∽","\\backsim",!0);P(H,_e,Se,"⋍","\\backsimeq",!0);P(H,_e,Se,"⫅","\\subseteqq",!0);P(H,_e,Se,"⋐","\\Subset",!0);P(H,_e,Se,"⊏","\\sqsubset",!0);P(H,_e,Se,"≼","\\preccurlyeq",!0);P(H,_e,Se,"⋞","\\curlyeqprec",!0);P(H,_e,Se,"≾","\\precsim",!0);P(H,_e,Se,"⪷","\\precapprox",!0);P(H,_e,Se,"⊲","\\vartriangleleft");P(H,_e,Se,"⊴","\\trianglelefteq");P(H,_e,Se,"⊨","\\vDash",!0);P(H,_e,Se,"⊪","\\Vvdash",!0);P(H,_e,Se,"⌣","\\smallsmile");P(H,_e,Se,"⌢","\\smallfrown");P(H,_e,Se,"≏","\\bumpeq",!0);P(H,_e,Se,"≎","\\Bumpeq",!0);P(H,_e,Se,"≧","\\geqq",!0);P(H,_e,Se,"⩾","\\geqslant",!0);P(H,_e,Se,"⪖","\\eqslantgtr",!0);P(H,_e,Se,"≳","\\gtrsim",!0);P(H,_e,Se,"⪆","\\gtrapprox",!0);P(H,_e,Dn,"⋗","\\gtrdot");P(H,_e,Se,"⋙","\\ggg",!0);P(H,_e,Se,"≷","\\gtrless",!0);P(H,_e,Se,"⋛","\\gtreqless",!0);P(H,_e,Se,"⪌","\\gtreqqless",!0);P(H,_e,Se,"≖","\\eqcirc",!0);P(H,_e,Se,"≗","\\circeq",!0);P(H,_e,Se,"≜","\\triangleq",!0);P(H,_e,Se,"∼","\\thicksim");P(H,_e,Se,"≈","\\thickapprox");P(H,_e,Se,"⫆","\\supseteqq",!0);P(H,_e,Se,"⋑","\\Supset",!0);P(H,_e,Se,"⊐","\\sqsupset",!0);P(H,_e,Se,"≽","\\succcurlyeq",!0);P(H,_e,Se,"⋟","\\curlyeqsucc",!0);P(H,_e,Se,"≿","\\succsim",!0);P(H,_e,Se,"⪸","\\succapprox",!0);P(H,_e,Se,"⊳","\\vartriangleright");P(H,_e,Se,"⊵","\\trianglerighteq");P(H,_e,Se,"⊩","\\Vdash",!0);P(H,_e,Se,"∣","\\shortmid");P(H,_e,Se,"∥","\\shortparallel");P(H,_e,Se,"≬","\\between",!0);P(H,_e,Se,"⋔","\\pitchfork",!0);P(H,_e,Se,"∝","\\varpropto");P(H,_e,Se,"◀","\\blacktriangleleft");P(H,_e,Se,"∴","\\therefore",!0);P(H,_e,Se,"∍","\\backepsilon");P(H,_e,Se,"▶","\\blacktriangleright");P(H,_e,Se,"∵","\\because",!0);P(H,_e,Se,"⋘","\\llless");P(H,_e,Se,"⋙","\\gggtr");P(H,_e,Dn,"⊲","\\lhd");P(H,_e,Dn,"⊳","\\rhd");P(H,_e,Se,"≂","\\eqsim",!0);P(H,ee,Se,"⋈","\\Join");P(H,_e,Se,"≑","\\Doteq",!0);P(H,_e,Dn,"∔","\\dotplus",!0);P(H,_e,Dn,"∖","\\smallsetminus");P(H,_e,Dn,"⋒","\\Cap",!0);P(H,_e,Dn,"⋓","\\Cup",!0);P(H,_e,Dn,"⩞","\\doublebarwedge",!0);P(H,_e,Dn,"⊟","\\boxminus",!0);P(H,_e,Dn,"⊞","\\boxplus",!0);P(H,_e,Dn,"⋇","\\divideontimes",!0);P(H,_e,Dn,"⋉","\\ltimes",!0);P(H,_e,Dn,"⋊","\\rtimes",!0);P(H,_e,Dn,"⋋","\\leftthreetimes",!0);P(H,_e,Dn,"⋌","\\rightthreetimes",!0);P(H,_e,Dn,"⋏","\\curlywedge",!0);P(H,_e,Dn,"⋎","\\curlyvee",!0);P(H,_e,Dn,"⊝","\\circleddash",!0);P(H,_e,Dn,"⊛","\\circledast",!0);P(H,_e,Dn,"⋅","\\centerdot");P(H,_e,Dn,"⊺","\\intercal",!0);P(H,_e,Dn,"⋒","\\doublecap");P(H,_e,Dn,"⋓","\\doublecup");P(H,_e,Dn,"⊠","\\boxtimes",!0);P(H,_e,Se,"⇢","\\dashrightarrow",!0);P(H,_e,Se,"⇠","\\dashleftarrow",!0);P(H,_e,Se,"⇇","\\leftleftarrows",!0);P(H,_e,Se,"⇆","\\leftrightarrows",!0);P(H,_e,Se,"⇚","\\Lleftarrow",!0);P(H,_e,Se,"↞","\\twoheadleftarrow",!0);P(H,_e,Se,"↢","\\leftarrowtail",!0);P(H,_e,Se,"↫","\\looparrowleft",!0);P(H,_e,Se,"⇋","\\leftrightharpoons",!0);P(H,_e,Se,"↶","\\curvearrowleft",!0);P(H,_e,Se,"↺","\\circlearrowleft",!0);P(H,_e,Se,"↰","\\Lsh",!0);P(H,_e,Se,"⇈","\\upuparrows",!0);P(H,_e,Se,"↿","\\upharpoonleft",!0);P(H,_e,Se,"⇃","\\downharpoonleft",!0);P(H,ee,Se,"⊶","\\origof",!0);P(H,ee,Se,"⊷","\\imageof",!0);P(H,_e,Se,"⊸","\\multimap",!0);P(H,_e,Se,"↭","\\leftrightsquigarrow",!0);P(H,_e,Se,"⇉","\\rightrightarrows",!0);P(H,_e,Se,"⇄","\\rightleftarrows",!0);P(H,_e,Se,"↠","\\twoheadrightarrow",!0);P(H,_e,Se,"↣","\\rightarrowtail",!0);P(H,_e,Se,"↬","\\looparrowright",!0);P(H,_e,Se,"↷","\\curvearrowright",!0);P(H,_e,Se,"↻","\\circlearrowright",!0);P(H,_e,Se,"↱","\\Rsh",!0);P(H,_e,Se,"⇊","\\downdownarrows",!0);P(H,_e,Se,"↾","\\upharpoonright",!0);P(H,_e,Se,"⇂","\\downharpoonright",!0);P(H,_e,Se,"⇝","\\rightsquigarrow",!0);P(H,_e,Se,"⇝","\\leadsto");P(H,_e,Se,"⇛","\\Rrightarrow",!0);P(H,_e,Se,"↾","\\restriction");P(H,ee,je,"‘","`");P(H,ee,je,"$","\\$");P(Nt,ee,je,"$","\\$");P(Nt,ee,je,"$","\\textdollar");P(H,ee,je,"%","\\%");P(Nt,ee,je,"%","\\%");P(H,ee,je,"_","\\_");P(Nt,ee,je,"_","\\_");P(Nt,ee,je,"_","\\textunderscore");P(H,ee,je,"∠","\\angle",!0);P(H,ee,je,"∞","\\infty",!0);P(H,ee,je,"′","\\prime");P(H,ee,je,"△","\\triangle");P(H,ee,je,"Γ","\\Gamma",!0);P(H,ee,je,"Δ","\\Delta",!0);P(H,ee,je,"Θ","\\Theta",!0);P(H,ee,je,"Λ","\\Lambda",!0);P(H,ee,je,"Ξ","\\Xi",!0);P(H,ee,je,"Π","\\Pi",!0);P(H,ee,je,"Σ","\\Sigma",!0);P(H,ee,je,"Υ","\\Upsilon",!0);P(H,ee,je,"Φ","\\Phi",!0);P(H,ee,je,"Ψ","\\Psi",!0);P(H,ee,je,"Ω","\\Omega",!0);P(H,ee,je,"A","Α");P(H,ee,je,"B","Β");P(H,ee,je,"E","Ε");P(H,ee,je,"Z","Ζ");P(H,ee,je,"H","Η");P(H,ee,je,"I","Ι");P(H,ee,je,"K","Κ");P(H,ee,je,"M","Μ");P(H,ee,je,"N","Ν");P(H,ee,je,"O","Ο");P(H,ee,je,"P","Ρ");P(H,ee,je,"T","Τ");P(H,ee,je,"X","Χ");P(H,ee,je,"¬","\\neg",!0);P(H,ee,je,"¬","\\lnot");P(H,ee,je,"⊤","\\top");P(H,ee,je,"⊥","\\bot");P(H,ee,je,"∅","\\emptyset");P(H,_e,je,"∅","\\varnothing");P(H,ee,is,"α","\\alpha",!0);P(H,ee,is,"β","\\beta",!0);P(H,ee,is,"γ","\\gamma",!0);P(H,ee,is,"δ","\\delta",!0);P(H,ee,is,"ϵ","\\epsilon",!0);P(H,ee,is,"ζ","\\zeta",!0);P(H,ee,is,"η","\\eta",!0);P(H,ee,is,"θ","\\theta",!0);P(H,ee,is,"ι","\\iota",!0);P(H,ee,is,"κ","\\kappa",!0);P(H,ee,is,"λ","\\lambda",!0);P(H,ee,is,"μ","\\mu",!0);P(H,ee,is,"ν","\\nu",!0);P(H,ee,is,"ξ","\\xi",!0);P(H,ee,is,"ο","\\omicron",!0);P(H,ee,is,"π","\\pi",!0);P(H,ee,is,"ρ","\\rho",!0);P(H,ee,is,"σ","\\sigma",!0);P(H,ee,is,"τ","\\tau",!0);P(H,ee,is,"υ","\\upsilon",!0);P(H,ee,is,"ϕ","\\phi",!0);P(H,ee,is,"χ","\\chi",!0);P(H,ee,is,"ψ","\\psi",!0);P(H,ee,is,"ω","\\omega",!0);P(H,ee,is,"ε","\\varepsilon",!0);P(H,ee,is,"ϑ","\\vartheta",!0);P(H,ee,is,"ϖ","\\varpi",!0);P(H,ee,is,"ϱ","\\varrho",!0);P(H,ee,is,"ς","\\varsigma",!0);P(H,ee,is,"φ","\\varphi",!0);P(H,ee,Dn,"∗","*",!0);P(H,ee,Dn,"+","+");P(H,ee,Dn,"−","-",!0);P(H,ee,Dn,"⋅","\\cdot",!0);P(H,ee,Dn,"∘","\\circ",!0);P(H,ee,Dn,"÷","\\div",!0);P(H,ee,Dn,"±","\\pm",!0);P(H,ee,Dn,"×","\\times",!0);P(H,ee,Dn,"∩","\\cap",!0);P(H,ee,Dn,"∪","\\cup",!0);P(H,ee,Dn,"∖","\\setminus",!0);P(H,ee,Dn,"∧","\\land");P(H,ee,Dn,"∨","\\lor");P(H,ee,Dn,"∧","\\wedge",!0);P(H,ee,Dn,"∨","\\vee",!0);P(H,ee,je,"√","\\surd");P(H,ee,su,"⟨","\\langle",!0);P(H,ee,su,"∣","\\lvert");P(H,ee,su,"∥","\\lVert");P(H,ee,Xl,"?","?");P(H,ee,Xl,"!","!");P(H,ee,Xl,"⟩","\\rangle",!0);P(H,ee,Xl,"∣","\\rvert");P(H,ee,Xl,"∥","\\rVert");P(H,ee,Se,"=","=");P(H,ee,Se,":",":");P(H,ee,Se,"≈","\\approx",!0);P(H,ee,Se,"≅","\\cong",!0);P(H,ee,Se,"≥","\\ge");P(H,ee,Se,"≥","\\geq",!0);P(H,ee,Se,"←","\\gets");P(H,ee,Se,">","\\gt",!0);P(H,ee,Se,"∈","\\in",!0);P(H,ee,Se,"","\\@not");P(H,ee,Se,"⊂","\\subset",!0);P(H,ee,Se,"⊃","\\supset",!0);P(H,ee,Se,"⊆","\\subseteq",!0);P(H,ee,Se,"⊇","\\supseteq",!0);P(H,_e,Se,"⊈","\\nsubseteq",!0);P(H,_e,Se,"⊉","\\nsupseteq",!0);P(H,ee,Se,"⊨","\\models");P(H,ee,Se,"←","\\leftarrow",!0);P(H,ee,Se,"≤","\\le");P(H,ee,Se,"≤","\\leq",!0);P(H,ee,Se,"<","\\lt",!0);P(H,ee,Se,"→","\\rightarrow",!0);P(H,ee,Se,"→","\\to");P(H,_e,Se,"≱","\\ngeq",!0);P(H,_e,Se,"≰","\\nleq",!0);P(H,ee,lm," ","\\ ");P(H,ee,lm," ","\\space");P(H,ee,lm," ","\\nobreakspace");P(Nt,ee,lm," ","\\ ");P(Nt,ee,lm," "," ");P(Nt,ee,lm," ","\\space");P(Nt,ee,lm," ","\\nobreakspace");P(H,ee,lm,"","\\nobreak");P(H,ee,lm,"","\\allowbreak");P(H,ee,I_,",",",");P(H,ee,I_,";",";");P(H,_e,Dn,"⊼","\\barwedge",!0);P(H,_e,Dn,"⊻","\\veebar",!0);P(H,ee,Dn,"⊙","\\odot",!0);P(H,ee,Dn,"⊕","\\oplus",!0);P(H,ee,Dn,"⊗","\\otimes",!0);P(H,ee,je,"∂","\\partial",!0);P(H,ee,Dn,"⊘","\\oslash",!0);P(H,_e,Dn,"⊚","\\circledcirc",!0);P(H,_e,Dn,"⊡","\\boxdot",!0);P(H,ee,Dn,"△","\\bigtriangleup");P(H,ee,Dn,"▽","\\bigtriangledown");P(H,ee,Dn,"†","\\dagger");P(H,ee,Dn,"⋄","\\diamond");P(H,ee,Dn,"⋆","\\star");P(H,ee,Dn,"◃","\\triangleleft");P(H,ee,Dn,"▹","\\triangleright");P(H,ee,su,"{","\\{");P(Nt,ee,je,"{","\\{");P(Nt,ee,je,"{","\\textbraceleft");P(H,ee,Xl,"}","\\}");P(Nt,ee,je,"}","\\}");P(Nt,ee,je,"}","\\textbraceright");P(H,ee,su,"{","\\lbrace");P(H,ee,Xl,"}","\\rbrace");P(H,ee,su,"[","\\lbrack",!0);P(Nt,ee,je,"[","\\lbrack",!0);P(H,ee,Xl,"]","\\rbrack",!0);P(Nt,ee,je,"]","\\rbrack",!0);P(H,ee,su,"(","\\lparen",!0);P(H,ee,Xl,")","\\rparen",!0);P(Nt,ee,je,"<","\\textless",!0);P(Nt,ee,je,">","\\textgreater",!0);P(H,ee,su,"⌊","\\lfloor",!0);P(H,ee,Xl,"⌋","\\rfloor",!0);P(H,ee,su,"⌈","\\lceil",!0);P(H,ee,Xl,"⌉","\\rceil",!0);P(H,ee,je,"\\","\\backslash");P(H,ee,je,"∣","|");P(H,ee,je,"∣","\\vert");P(Nt,ee,je,"|","\\textbar",!0);P(H,ee,je,"∥","\\|");P(H,ee,je,"∥","\\Vert");P(Nt,ee,je,"∥","\\textbardbl");P(Nt,ee,je,"~","\\textasciitilde");P(Nt,ee,je,"\\","\\textbackslash");P(Nt,ee,je,"^","\\textasciicircum");P(H,ee,Se,"↑","\\uparrow",!0);P(H,ee,Se,"⇑","\\Uparrow",!0);P(H,ee,Se,"↓","\\downarrow",!0);P(H,ee,Se,"⇓","\\Downarrow",!0);P(H,ee,Se,"↕","\\updownarrow",!0);P(H,ee,Se,"⇕","\\Updownarrow",!0);P(H,ee,Jo,"∐","\\coprod");P(H,ee,Jo,"⋁","\\bigvee");P(H,ee,Jo,"⋀","\\bigwedge");P(H,ee,Jo,"⨄","\\biguplus");P(H,ee,Jo,"⋂","\\bigcap");P(H,ee,Jo,"⋃","\\bigcup");P(H,ee,Jo,"∫","\\int");P(H,ee,Jo,"∫","\\intop");P(H,ee,Jo,"∬","\\iint");P(H,ee,Jo,"∭","\\iiint");P(H,ee,Jo,"∏","\\prod");P(H,ee,Jo,"∑","\\sum");P(H,ee,Jo,"⨂","\\bigotimes");P(H,ee,Jo,"⨁","\\bigoplus");P(H,ee,Jo,"⨀","\\bigodot");P(H,ee,Jo,"∮","\\oint");P(H,ee,Jo,"∯","\\oiint");P(H,ee,Jo,"∰","\\oiiint");P(H,ee,Jo,"⨆","\\bigsqcup");P(H,ee,Jo,"∫","\\smallint");P(Nt,ee,Sv,"…","\\textellipsis");P(H,ee,Sv,"…","\\mathellipsis");P(Nt,ee,Sv,"…","\\ldots",!0);P(H,ee,Sv,"…","\\ldots",!0);P(H,ee,Sv,"⋯","\\@cdots",!0);P(H,ee,Sv,"⋱","\\ddots",!0);P(H,ee,je,"⋮","\\varvdots");P(Nt,ee,je,"⋮","\\varvdots");P(H,ee,Vi,"ˊ","\\acute");P(H,ee,Vi,"ˋ","\\grave");P(H,ee,Vi,"¨","\\ddot");P(H,ee,Vi,"~","\\tilde");P(H,ee,Vi,"ˉ","\\bar");P(H,ee,Vi,"˘","\\breve");P(H,ee,Vi,"ˇ","\\check");P(H,ee,Vi,"^","\\hat");P(H,ee,Vi,"⃗","\\vec");P(H,ee,Vi,"˙","\\dot");P(H,ee,Vi,"˚","\\mathring");P(H,ee,is,"","\\@imath");P(H,ee,is,"","\\@jmath");P(H,ee,je,"ı","ı");P(H,ee,je,"ȷ","ȷ");P(Nt,ee,je,"ı","\\i",!0);P(Nt,ee,je,"ȷ","\\j",!0);P(Nt,ee,je,"ß","\\ss",!0);P(Nt,ee,je,"æ","\\ae",!0);P(Nt,ee,je,"œ","\\oe",!0);P(Nt,ee,je,"ø","\\o",!0);P(Nt,ee,je,"Æ","\\AE",!0);P(Nt,ee,je,"Œ","\\OE",!0);P(Nt,ee,je,"Ø","\\O",!0);P(Nt,ee,Vi,"ˊ","\\'");P(Nt,ee,Vi,"ˋ","\\`");P(Nt,ee,Vi,"ˆ","\\^");P(Nt,ee,Vi,"˜","\\~");P(Nt,ee,Vi,"ˉ","\\=");P(Nt,ee,Vi,"˘","\\u");P(Nt,ee,Vi,"˙","\\.");P(Nt,ee,Vi,"¸","\\c");P(Nt,ee,Vi,"˚","\\r");P(Nt,ee,Vi,"ˇ","\\v");P(Nt,ee,Vi,"¨",'\\"');P(Nt,ee,Vi,"˝","\\H");P(Nt,ee,Vi,"◯","\\textcircled");var pne={"--":!0,"---":!0,"``":!0,"''":!0};P(Nt,ee,je,"–","--",!0);P(Nt,ee,je,"–","\\textendash");P(Nt,ee,je,"—","---",!0);P(Nt,ee,je,"—","\\textemdash");P(Nt,ee,je,"‘","`",!0);P(Nt,ee,je,"‘","\\textquoteleft");P(Nt,ee,je,"’","'",!0);P(Nt,ee,je,"’","\\textquoteright");P(Nt,ee,je,"“","``",!0);P(Nt,ee,je,"“","\\textquotedblleft");P(Nt,ee,je,"”","''",!0);P(Nt,ee,je,"”","\\textquotedblright");P(H,ee,je,"°","\\degree",!0);P(Nt,ee,je,"°","\\degree");P(Nt,ee,je,"°","\\textdegree",!0);P(H,ee,je,"£","\\pounds");P(H,ee,je,"£","\\mathsterling",!0);P(Nt,ee,je,"£","\\pounds");P(Nt,ee,je,"£","\\textsterling",!0);P(H,_e,je,"✠","\\maltese");P(Nt,_e,je,"✠","\\maltese");var hH='0123456789/@."';for(var xA=0;xA<hH.length;xA++){var fH=hH.charAt(xA);P(H,ee,je,fH,fH)}var mH='0123456789!@*()-=+";:?/.,';for(var kA=0;kA<mH.length;kA++){var pH=mH.charAt(kA);P(Nt,ee,je,pH,pH)}var IT="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var _A=0;_A<IT.length;_A++){var T2=IT.charAt(_A);P(H,ee,is,T2,T2),P(Nt,ee,je,T2,T2)}P(H,_e,je,"C","ℂ");P(Nt,_e,je,"C","ℂ");P(H,_e,je,"H","ℍ");P(Nt,_e,je,"H","ℍ");P(H,_e,je,"N","ℕ");P(Nt,_e,je,"N","ℕ");P(H,_e,je,"P","ℙ");P(Nt,_e,je,"P","ℙ");P(H,_e,je,"Q","ℚ");P(Nt,_e,je,"Q","ℚ");P(H,_e,je,"R","ℝ");P(Nt,_e,je,"R","ℝ");P(H,_e,je,"Z","ℤ");P(Nt,_e,je,"Z","ℤ");P(H,ee,is,"h","ℎ");P(Nt,ee,is,"h","ℎ");var ds;for(var Il=0;Il<IT.length;Il++){var bo=IT.charAt(Il);ds=String.fromCharCode(55349,56320+Il),P(H,ee,is,bo,ds),P(Nt,ee,je,bo,ds),ds=String.fromCharCode(55349,56372+Il),P(H,ee,is,bo,ds),P(Nt,ee,je,bo,ds),ds=String.fromCharCode(55349,56424+Il),P(H,ee,is,bo,ds),P(Nt,ee,je,bo,ds),ds=String.fromCharCode(55349,56580+Il),P(H,ee,is,bo,ds),P(Nt,ee,je,bo,ds),ds=String.fromCharCode(55349,56684+Il),P(H,ee,is,bo,ds),P(Nt,ee,je,bo,ds),ds=String.fromCharCode(55349,56736+Il),P(H,ee,is,bo,ds),P(Nt,ee,je,bo,ds),ds=String.fromCharCode(55349,56788+Il),P(H,ee,is,bo,ds),P(Nt,ee,je,bo,ds),ds=String.fromCharCode(55349,56840+Il),P(H,ee,is,bo,ds),P(Nt,ee,je,bo,ds),ds=String.fromCharCode(55349,56944+Il),P(H,ee,is,bo,ds),P(Nt,ee,je,bo,ds),Il<26&&(ds=String.fromCharCode(55349,56632+Il),P(H,ee,is,bo,ds),P(Nt,ee,je,bo,ds),ds=String.fromCharCode(55349,56476+Il),P(H,ee,is,bo,ds),P(Nt,ee,je,bo,ds))}ds="𝕜";P(H,ee,is,"k",ds);P(Nt,ee,je,"k",ds);for(var G0=0;G0<10;G0++){var Nm=G0.toString();ds=String.fromCharCode(55349,57294+G0),P(H,ee,is,Nm,ds),P(Nt,ee,je,Nm,ds),ds=String.fromCharCode(55349,57314+G0),P(H,ee,is,Nm,ds),P(Nt,ee,je,Nm,ds),ds=String.fromCharCode(55349,57324+G0),P(H,ee,is,Nm,ds),P(Nt,ee,je,Nm,ds),ds=String.fromCharCode(55349,57334+G0),P(H,ee,is,Nm,ds),P(Nt,ee,je,Nm,ds)}var hI="ÐÞþ";for(var SA=0;SA<hI.length;SA++){var E2=hI.charAt(SA);P(H,ee,is,E2,E2),P(Nt,ee,je,E2,E2)}var fI={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},gH={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},bH={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},n8e={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},fg={mathClass:"",textClass:"",font:""},yH={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},vH={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},wH={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},mI={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},pI={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},xH={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},gI={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},kH=[fI,fI,gH,gH,bH,bH,n8e,fg,fg,fg,yH,yH,vH,vH,wH,wH,mI,mI,pI,pI,xH,xH,fg,fg,gI,gI],s8e=[fI,fg,mI,pI,gI],r8e=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 kH[r]}else if(120782<=s&&s<=120831){var i=Math.floor((s-120782)/10);return s8e[i]}else{if(s===120485||s===120486)return kH[0];if(120486<s&&s<120782)return fg;throw new zt("Unsupported character: "+e)}},T5=function(t,n,s){if(Ui[s][t]){var r=Ui[s][t].replace;r&&(t=r)}return{value:t,metrics:HD(t,n,s)}},Ll=function(t,n,s,r,i){var o=T5(t,n,s),l=o.metrics;t=o.value;var c;if(l){var u=l.italic;(s==="text"||r&&r.font==="mathit")&&(u=0),c=new tu(t,l.height,l.depth,u,l.skew,l.width,i)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+t+"' in style '"+n+"' and mode '"+s+"'")),c=new tu(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},UD=function(t,n,s,r){return r===void 0&&(r=[]),s.font==="boldsymbol"&&T5(t,"Main-Bold",n).metrics?Ll(t,"Main-Bold",n,s,r.concat(["mathbf"])):t==="\\"||Ui[n][t].font==="main"?Ll(t,"Main-Regular",n,s,r):Ll(t,"AMS-Regular",n,s,r.concat(["amsrm"]))},i8e=function(t,n,s){return s!=="textord"&&T5(t,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},E5=function(t,n,s){var r=t.mode,i=t.text,o=["mord"],{font:l,fontFamily:c,fontWeight:u,fontShape:d}=n,f=r==="math"||r==="text"&&!!l,m=f?l:c,p="",g="";if(i.charCodeAt(0)===55349){var b=r8e(i);p=b.font,g=b[r+"Class"]}if(p)return Ll(i,p,r,n,o.concat(g));if(m){var w,y;if(m==="boldsymbol"){var v=i8e(i,r,s);w=v.fontName,y=[v.fontClass]}else f?(w=bI[l].fontName,y=[l]):(w=A2(c,u,d),y=[c,u,d]);if(T5(i,w,r).metrics)return Ll(i,w,r,n,o.concat(y));if(pne.hasOwnProperty(i)&&w.slice(0,10)==="Typewriter"){for(var x=[],k=0;k<i.length;k++)x.push(Ll(i[k],w,r,n,o.concat(y)));return cm(x)}}if(s==="mathord")return Ll(i,"Math-Italic",r,n,o.concat(["mathnormal"]));if(s==="textord"){var _=Ui[r][i]&&Ui[r][i].font;if(_==="ams"){var T=A2("amsrm",u,d);return Ll(i,T,r,n,o.concat("amsrm",u,d))}else if(_==="main"||!_){var S=A2("textrm",u,d);return Ll(i,S,r,n,o.concat(u,d))}else{var C=A2(_,u,d);return Ll(i,C,r,n,o.concat(C,u,d))}}else throw new Error("unexpected type: "+s+" in makeOrd")},o8e=(e,t)=>{if(Dp(e.classes)!==Dp(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},gne=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],s=e[t+1];n instanceof tu&&s instanceof tu&&o8e(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},WD=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},Dt=function(t,n,s,r){var i=new _v(t,n,s,r);return WD(i),i},Pp=(e,t,n,s)=>new _v(e,t,n,s),Dy=function(t,n,s){var r=Dt([t],[],n);return r.height=Math.max(s||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),r.style.borderBottomWidth=Xt(r.height),r.maxFontSize=1,r},a8e=function(t,n,s,r){var i=new C5(t,n,s,r);return WD(i),i},cm=function(t){var n=new kv(t);return WD(n),n},Ly=function(t,n){return t instanceof kv?Dt([],[t],n):t},l8e=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 l=-n[o].shift-i-n[o].elem.depth,c=l-(n[o-1].elem.height+n[o-1].elem.depth);i=i+l,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}},Hr=function(t,n){for(var{children:s,depth:r}=l8e(t),i=0,o=0;o<s.length;o++){var l=s[o];if(l.type==="elem"){var c=l.elem;i=Math.max(i,c.maxFontSize,c.height)}}i+=2;var u=Dt(["pstrut"],[]);u.style.height=Xt(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 w=b.elem,y=b.wrapperClasses||[],v=b.wrapperStyle||{},x=Dt(y,[u,w],void 0,v);x.style.top=Xt(-i-p-w.depth),b.marginLeft&&(x.style.marginLeft=b.marginLeft),b.marginRight&&(x.style.marginRight=b.marginRight),d.push(x),p+=w.height+w.depth}f=Math.min(f,p),m=Math.max(m,p)}var k=Dt(["vlist"],d);k.style.height=Xt(m);var _;if(f<0){var T=Dt([],[]),S=Dt(["vlist"],[T]);S.style.height=Xt(-f);var C=Dt(["vlist-s"],[new tu("​")]);_=[Dt(["vlist-r"],[k,C]),Dt(["vlist-r"],[S])]}else _=[Dt(["vlist-r"],[k])];var N=Dt(["vlist-t"],_);return _.length===2&&N.classes.push("vlist-t2"),N.height=m,N.depth=-f,N},bne=(e,t)=>{var n=Dt(["mspace"],[],t),s=ao(e,t);return n.style.marginRight=Xt(s),n},A2=(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},bI={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"}},yne={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},vne=function(t,n){var[s,r,i]=yne[t],o=new Lp(s),l=new Gf([o],{width:Xt(r),height:Xt(i),style:"width:"+Xt(r),viewBox:"0 0 "+1e3*r+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),c=Pp(["overlay"],[l],n);return c.height=i,c.style.height=Xt(i),c.style.width=Xt(r),c},eo={number:3,unit:"mu"},K0={number:4,unit:"mu"},tf={number:5,unit:"mu"},c8e={mord:{mop:eo,mbin:K0,mrel:tf,minner:eo},mop:{mord:eo,mop:eo,mrel:tf,minner:eo},mbin:{mord:K0,mop:K0,mopen:K0,minner:K0},mrel:{mord:tf,mop:tf,mopen:tf,minner:tf},mopen:{},mclose:{mop:eo,mbin:K0,mrel:tf,minner:eo},mpunct:{mord:eo,mop:eo,mrel:tf,mopen:eo,mclose:eo,mpunct:eo,minner:eo},minner:{mord:eo,mop:eo,mbin:K0,mrel:tf,mopen:eo,mpunct:eo,minner:eo}},u8e={mord:{mop:eo},mop:{mord:eo,mop:eo},mbin:{},mrel:{},mopen:{},mclose:{mop:eo},mpunct:{},minner:{mop:eo}},wne={},MT={},RT={};function Cn(e){for(var{type:t,names:n,props:s,handler:r,htmlBuilder:i,mathmlBuilder:o}=e,l={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)wne[n[c]]=l;t&&(i&&(MT[t]=i),o&&(RT[t]=o))}function m1(e){var{type:t,htmlBuilder:n,mathmlBuilder:s}=e;Cn({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:s})}var DT=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},Go=function(t){return t.type==="ordgroup"?t.body:[t]},d8e=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),h8e=new Set(["rightmost","mrel","mclose","mpunct"]),f8e={display:Cs.DISPLAY,text:Cs.TEXT,script:Cs.SCRIPT,scriptscript:Cs.SCRIPTSCRIPT},m8e={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},ma=function(t,n,s,r){r===void 0&&(r=[null,null]);for(var i=[],o=0;o<t.length;o++){var l=Vr(t[o],n);if(l instanceof kv){var c=l.children;i.push(...c)}else i.push(l)}if(gne(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(f8e[d.style]))}var f=Dt([r[0]||"leftmost"],[],n),m=Dt([r[1]||"rightmost"],[],n),p=s==="root";return yI(i,(g,b)=>{var w=b.classes[0],y=g.classes[0];w==="mbin"&&h8e.has(y)?b.classes[0]="mord":y==="mbin"&&d8e.has(w)&&(g.classes[0]="mord")},{node:f},m,p),yI(i,(g,b)=>{var w,y,v=wI(b),x=wI(g),k=v&&x?g.hasClass("mtight")?(w=u8e[v])==null?void 0:w[x]:(y=c8e[v])==null?void 0:y[x]:null;if(k)return bne(k,u)},{node:f},m,p),i},yI=function(t,n,s,r,i){r&&t.push(r);for(var o=0;o<t.length;o++){var l=t[o],c=xne(l);if(c){yI(c.children,n,s,null,i);continue}var u=!l.hasClass("mspace");if(u){var d=n(l,s.node);d&&(s.insertAfter?s.insertAfter(d):(t.unshift(d),o++))}u?s.node=l:i&&l.hasClass("newline")&&(s.node=Dt(["leftmost"])),s.insertAfter=(f=>m=>{t.splice(f+1,0,m),o++})(o)}r&&t.pop()},xne=function(t){return t instanceof kv||t instanceof C5||t instanceof _v&&t.hasClass("enclosing")?t:null},vI=function(t,n){var s=xne(t);if(s){var r=s.children;if(r.length){if(n==="right")return vI(r[r.length-1],"right");if(n==="left")return vI(r[0],"left")}}return t},wI=function(t,n){if(!t)return null;n&&(t=vI(t,n));var s=t.classes[0];return m8e[s]||null},Nk=function(t,n){var s=["nulldelimiter"].concat(t.baseSizingClasses());return Dt(n.concat(s))},Vr=function(t,n,s){if(!t)return Dt();if(MT[t.type]){var r=MT[t.type](t,n);if(s&&n.size!==s.size){r=Dt(n.sizingClasses(s),[r],n);var i=n.sizeMultiplier/s.sizeMultiplier;r.height*=i,r.depth*=i}return r}else throw new zt("Got group of unknown type: '"+t.type+"'")};function j2(e,t){var n=Dt(["base"],e,t),s=Dt(["strut"]);return s.style.height=Xt(n.height+n.depth),n.depth&&(s.style.verticalAlign=Xt(-n.depth)),n.children.unshift(s),n}function xI(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var s=ma(e,t,"root"),r;s.length===2&&s[1].hasClass("tag")&&(r=s.pop());for(var i=[],o=[],l=0;l<s.length;l++)if(o.push(s[l]),s[l].hasClass("mbin")||s[l].hasClass("mrel")||s[l].hasClass("allowbreak")){for(var c=!1;l<s.length-1&&s[l+1].hasClass("mspace")&&!s[l+1].hasClass("newline");)l++,o.push(s[l]),s[l].hasClass("nobreak")&&(c=!0);c||(i.push(j2(o,t)),o=[])}else s[l].hasClass("newline")&&(o.pop(),o.length>0&&(i.push(j2(o,t)),o=[]),i.push(s[l]));o.length>0&&i.push(j2(o,t));var u;n?(u=j2(ma(n,t,!0),t),u.classes=["tag"],i.push(u)):r&&i.push(r);var d=Dt(["katex-html"],i);if(d.setAttribute("aria-hidden","true"),u){var f=u.children[0];f.style.height=Xt(d.height+d.depth),d.depth&&(f.style.verticalAlign=Xt(-d.depth))}return d}function kne(e){return new kv(e)}class qt{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=Dp(this.classes));for(var s=0;s<this.children.length;s++)if(this.children[s]instanceof Ko&&this.children[s+1]instanceof Ko){for(var r=this.children[s].toText()+this.children[++s].toText();this.children[s+1]instanceof Ko;)r+=this.children[++s].toText();t.appendChild(new Ko(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+=yl(this.attributes[n]),t+='"');this.classes.length>0&&(t+=' class ="'+yl(Dp(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 Ko=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return yl(this.toText())}toText(){return this.text}};class _ne{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",Xt(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Xt(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var p8e=new Set(["\\imath","\\jmath"]),g8e=new Set(["mrow","mtable"]),Fu=function(t,n,s){return Ui[n][t]&&Ui[n][t].replace&&t.charCodeAt(0)!==55349&&!(pne.hasOwnProperty(t)&&s&&(s.fontFamily&&s.fontFamily.slice(4,6)==="tt"||s.font&&s.font.slice(4,6)==="tt"))&&(t=Ui[n][t].replace),new Ko(t)},VD=function(t){return t.length===1?t[0]:new qt("mrow",t)},b8e={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"},GD=(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=b8e[n];if(r)return typeof r=="function"?r(e):r;var i=e.text;if(p8e.has(i))return null;if(Ui[s][i]){var o=Ui[s][i].replace;o&&(i=o)}var l=bI[n].fontName;return HD(i,l,s)?bI[n].variant:null};function CA(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof Ko&&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 Ko&&n.text===","}else return!1}var ru=function(t,n,s){if(t.length===1){var r=_i(t[0],n);return s&&r instanceof qt&&r.type==="mo"&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}for(var i=[],o,l=0;l<t.length;l++){var c=_i(t[l],n);if(c instanceof qt&&o instanceof qt){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(CA(c)&&o.type==="mn"){o.children.push(...c.children);continue}else if(c.type==="mn"&&CA(o))c.children=[...o.children,...c.children],i.pop();else if((c.type==="msup"||c.type==="msub")&&c.children.length>=1&&(o.type==="mn"||CA(o))){var u=c.children[0];u instanceof qt&&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 Ko&&d.text==="̸"&&(c.type==="mo"||c.type==="mi"||c.type==="mn")){var f=c.children[0];f instanceof Ko&&f.text.length>0&&(f.text=f.text.slice(0,1)+"̸"+f.text.slice(1),i.pop())}}}i.push(c),o=c}return i},Op=function(t,n,s){return VD(ru(t,n,s))},_i=function(t,n){if(!t)return new qt("mrow");if(RT[t.type])return RT[t.type](t,n);throw new zt("Got group of unknown type: '"+t.type+"'")};function _H(e,t,n,s,r){var i=ru(e,n),o;i.length===1&&i[0]instanceof qt&&g8e.has(i[0].type)?o=i[0]:o=new qt("mrow",i);var l=new qt("annotation",[new Ko(t)]);l.setAttribute("encoding","application/x-tex");var c=new qt("semantics",[o,l]),u=new qt("math",[c]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),s&&u.setAttribute("display","block");var d=r?"katex":"katex-mathml";return Dt([d],[u])}var y8e=[[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]],SH=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],CH=function(t,n){return n.size<2?t:y8e[t-1][n.size-1]};class uf{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||uf.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=SH[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 uf(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:CH(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:SH[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=CH(uf.BASESIZE,t);return this.size===n&&this.textSize===uf.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!==uf.BASESIZE?["sizing","reset-size"+this.size,"size"+uf.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=t8e(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}uf.BASESIZE=6;var Sne=function(t){return new uf({style:t.displayMode?Cs.DISPLAY:Cs.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},Cne=function(t,n){if(n.displayMode){var s=["katex-display"];n.leqno&&s.push("leqno"),n.fleqn&&s.push("fleqn"),t=Dt(s,[t])}return t},v8e=function(t,n,s){var r=Sne(s),i;if(s.output==="mathml")return _H(t,n,r,s.displayMode,!0);if(s.output==="html"){var o=xI(t,r);i=Dt(["katex"],[o])}else{var l=_H(t,n,r,s.displayMode,!1),c=xI(t,r);i=Dt(["katex"],[l,c])}return Cne(i,s)},w8e=function(t,n,s){var r=Sne(s),i=xI(t,r),o=Dt(["katex"],[i]);return Cne(o,s)},x8e={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":"="},A5=function(t){var n=new qt("mo",[new Ko(x8e[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},k8e={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]},_8e=new Set(["widehat","widecheck","widetilde","utilde"]),j5=function(t,n){function s(){var l=4e5,c=t.label.slice(1);if(_8e.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,l=2364,m=.42,f=c+"4"):(d=312,l=2340,m=.34,f="tilde4");else{var p=[1,1,2,2,3,3][u];c==="widehat"||c==="widecheck"?(l=[0,1062,2364,2364,2364][p],d=[0,239,300,360,420][p],m=[0,.24,.3,.3,.36,.42][p],f=c+p):(l=[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 Lp(f),b=new Gf([g],{width:"100%",height:Xt(m),viewBox:"0 0 "+l+" "+d,preserveAspectRatio:"none"});return{span:Pp([],[b],n),minWidth:0,height:m}}else{var w=[],y=k8e[c];if(!y)throw new Error('No SVG data for "'+c+'".');var[v,x,k]=y,_=k/1e3,T=v.length,S,C;if(T===1){if(y.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+c+'".');S=["hide-tail"],C=[y[3]]}else if(T===2)S=["halfarrow-left","halfarrow-right"],C=["xMinYMin","xMaxYMin"];else if(T===3)S=["brace-left","brace-center","brace-right"],C=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+T+" children.");for(var N=0;N<T;N++){var E=new Lp(v[N]),O=new Gf([E],{width:"400em",height:Xt(_),viewBox:"0 0 "+l+" "+k,preserveAspectRatio:C[N]+" slice"}),B=Pp([S[N]],[O],n);if(T===1)return{span:B,minWidth:x,height:_};B.style.height=Xt(_),w.push(B)}return{span:Dt(["stretchy"],w,n),minWidth:x,height:_}}}var{span:r,minWidth:i,height:o}=s();return r.height=o,r.style.height=Xt(o),i>0&&(r.style.minWidth=Xt(i)),r},S8e=function(t,n,s,r,i){var o,l=t.height+t.depth+s+r;if(/fbox|color|angl/.test(n)){if(o=Dt(["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 dI({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&u.push(new dI({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var d=new Gf(u,{width:"100%",height:Xt(l)});o=Pp([],[d],i)}return o.height=l,o.style.height=Xt(l),o},C8e={bin:1,close:1,inner:1,open:1,punct:1,rel:1},T8e={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function E8e(e){return e in C8e}function Hs(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 N5(e){var t=I5(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 I5(e){return e&&(e.type==="atom"||T8e.hasOwnProperty(e.type))?e:null}var Tne=e=>{if(e instanceof tu)return e;if(e8e(e)&&e.children.length===1)return Tne(e.children[0])},KD=(e,t)=>{var n,s,r;e&&e.type==="supsub"?(s=Hs(e.base,"accent"),n=s.base,e.base=n,r=ZEe(Vr(e,t)),e.base=s):(s=Hs(e,"accent"),n=s.base);var i=Vr(n,t.havingCrampedStyle()),o=s.isShifty&&am(n),l=0;if(o){var c,u;l=(c=(u=Tne(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=j5(s,t),m=Hr({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:m,wrapperClasses:["svg-align"],wrapperStyle:l>0?{width:"calc(100% - "+Xt(2*l)+")",marginLeft:Xt(2*l)}:void 0}]});else{var p,g;s.label==="\\vec"?(p=vne("vec",t),g=yne.vec[1]):(p=E5({mode:s.mode,text:s.label},t,"textord"),p=JEe(p),p.italic=0,g=p.width,d&&(f+=p.depth)),m=Dt(["accent-body"],[p]);var b=s.label==="\\textcircled";b&&(m.classes.push("accent-full"),f=i.height);var w=l;b||(w-=g/2),m.style.left=Xt(w),s.label==="\\textcircled"&&(m.style.top=".2em"),m=Hr({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-f},{type:"elem",elem:m}]})}var y=Dt(["mord","accent"],[m],t);return r?(r.children[0]=y,r.height=Math.max(y.height,r.height),r.classes[0]="mord",r):y},Ene=(e,t)=>{var n=e.isStretchy?A5(e.label):new qt("mo",[Fu(e.label,e.mode)]),s=new qt("mover",[_i(e.base,t),n]);return s.setAttribute("accent","true"),s},A8e=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));Cn({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=DT(t[0]),s=!A8e.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:KD,mathmlBuilder:Ene});Cn({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:KD,mathmlBuilder:Ene});Cn({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=Vr(e.base,t),s=j5(e,t),r=e.label==="\\utilde"?.12:0,i=Hr({positionType:"top",positionData:n.height,children:[{type:"elem",elem:s,wrapperClasses:["svg-align"]},{type:"kern",size:r},{type:"elem",elem:n}]});return Dt(["mord","accentunder"],[i],t)},mathmlBuilder:(e,t)=>{var n=A5(e.label),s=new qt("munder",[_i(e.base,t),n]);return s.setAttribute("accentunder","true"),s}});var N2=e=>{var t=new qt("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};Cn({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=Ly(Vr(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=Ly(Vr(e.below,s,t),t),o.classes.push(i+"-arrow-pad"));var l=j5(e,t),c=-t.fontMetrics().axisHeight+.5*l.height,u=-t.fontMetrics().axisHeight-.5*l.height-.111;(r.depth>.25||e.label==="\\xleftequilibrium")&&(u-=r.depth);var d;if(o){var f=-t.fontMetrics().axisHeight+o.height+.5*l.height+.111;d=Hr({positionType:"individualShift",children:[{type:"elem",elem:r,shift:u},{type:"elem",elem:l,shift:c,wrapperClasses:["svg-align"]},{type:"elem",elem:o,shift:f}]})}else d=Hr({positionType:"individualShift",children:[{type:"elem",elem:r,shift:u},{type:"elem",elem:l,shift:c,wrapperClasses:["svg-align"]}]});return Dt(["mrel","x-arrow"],[d],t)},mathmlBuilder(e,t){var n=A5(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var s;if(e.body){var r=N2(_i(e.body,t));if(e.below){var i=N2(_i(e.below,t));s=new qt("munderover",[n,i,r])}else s=new qt("mover",[n,r])}else if(e.below){var o=N2(_i(e.below,t));s=new qt("munder",[n,o])}else s=N2(),s=new qt("mover",[n,s]);return s}});function Ane(e,t){var n=ma(e.body,t,!0);return Dt([e.mclass],n,t)}function jne(e,t){var n,s=ru(e.body,t);return e.mclass==="minner"?n=new qt("mpadded",s):e.mclass==="mord"?e.isCharacterBox?(n=s[0],n.type="mi"):n=new qt("mi",s):(e.isCharacterBox?(n=s[0],n.type="mo"):n=new qt("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}Cn({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:Go(r),isCharacterBox:am(r)}},htmlBuilder:Ane,mathmlBuilder:jne});var M5=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"};Cn({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:M5(t[0]),body:Go(t[1]),isCharacterBox:am(t[1])}}});Cn({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=M5(r):o="mrel";var l={type:"op",mode:r.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:s!=="\\stackrel",body:Go(r)},c={type:"supsub",mode:i.mode,base:l,sup:s==="\\underset"?null:i,sub:s==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:o,body:[c],isCharacterBox:am(c)}},htmlBuilder:Ane,mathmlBuilder:jne});Cn({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:M5(t[0]),body:Go(t[0])}},htmlBuilder(e,t){var n=ma(e.body,t,!0),s=Dt([e.mclass],n,t);return s.style.textShadow="0.02em 0.01em 0.04px",s},mathmlBuilder(e,t){var n=ru(e.body,t),s=new qt("mstyle",n);return s.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),s}});var j8e={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},TH=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),EH=e=>e.type==="textord"&&e.text==="@",N8e=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function I8e(e,t,n){var s=j8e[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],[]),l=n.callFunction("\\\\cdright",[t[1]],[]),c={type:"ordgroup",mode:"math",body:[r,o,l]};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 M8e(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 zt("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var s=[],r=[s],i=0;i<t.length;i++){for(var o=t[i],l=TH(),c=0;c<o.length;c++)if(!EH(o[c]))l.body.push(o[c]);else{s.push(l),c+=1;var u=N5(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(N8e(o[p],u)){m=!1,c=p;break}if(EH(o[p]))throw new zt("Missing a "+u+" character to complete a CD arrow.",o[p]);d[f].body.push(o[p])}if(m)throw new zt("Missing a "+u+" character to complete a CD arrow.",o[c])}else throw new zt('Expected one of "<>AV=|." after @',o[c]);var g=I8e(u,d,e),b={type:"styling",body:[g],mode:"math",style:"display",resetFont:!0};s.push(b),l=TH()}i%2===0?s.push(l):s.shift(),s=[],r.push(s)}e.gullet.endGroup(),e.gullet.endGroup();var w=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:w,colSeparationType:"CD",hLinesBeforeRow:new Array(r.length+1).fill([])}}Cn({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=Ly(Vr(e.label,n,t),t);return s.classes.push("cd-label-"+e.side),s.style.bottom=Xt(.8-s.depth),s.height=0,s.depth=0,s},mathmlBuilder(e,t){var n=new qt("mrow",[_i(e.label,t)]);return n=new qt("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new qt("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Cn({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=Ly(Vr(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new qt("mrow",[_i(e.fragment,t)])}});Cn({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,s=Hs(t[0],"ordgroup"),r=s.body,i="",o=0;o<r.length;o++){var l=Hs(r[o],"textord");i+=l.text}var c=parseInt(i),u;if(isNaN(c))throw new zt("\\@char has non-numeric argument "+i);if(c<0||c>=1114111)throw new zt("\\@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 Nne=(e,t)=>{var n=ma(e.body,t.withColor(e.color),!1);return cm(n)},Ine=(e,t)=>{var n=ru(e.body,t.withColor(e.color)),s=new qt("mstyle",n);return s.setAttribute("mathcolor",e.color),s};Cn({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,s=Hs(t[0],"color-token").color,r=t[1];return{type:"color",mode:n.mode,color:s,body:Go(r)}},htmlBuilder:Nne,mathmlBuilder:Ine});Cn({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:s}=e,r=Hs(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:Nne,mathmlBuilder:Ine});Cn({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&&Hs(r,"size").value}},htmlBuilder(e,t){var n=Dt(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=Xt(ao(e.size,t)))),n},mathmlBuilder(e,t){var n=new qt("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",Xt(ao(e.size,t)))),n}});var kI={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},Mne=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new zt("Expected a control sequence",e);return t},R8e=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},Rne=(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)};Cn({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(kI[s.text])return(n==="\\global"||n==="\\\\globallong")&&(s.text=kI[s.text]),Hs(t.parseFunction(),"internal");throw new zt("Invalid token after macro prefix",s)}});Cn({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 zt("Expected a control sequence",s);for(var i=0,o,l=[[]];t.gullet.future().text!=="{";)if(s=t.gullet.popToken(),s.text==="#"){if(t.gullet.future().text==="{"){o=t.gullet.future(),l[i].push("{");break}if(s=t.gullet.popToken(),!/^[1-9]$/.test(s.text))throw new zt('Invalid argument number "'+s.text+'"');if(parseInt(s.text)!==i+1)throw new zt('Argument number "'+s.text+'" out of order');i++,l.push([])}else{if(s.text==="EOF")throw new zt("Expected a macro definition");l[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:l},n===kI[n]),{type:"internal",mode:t.mode}}});Cn({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=Mne(t.gullet.popToken());t.gullet.consumeSpaces();var r=R8e(t);return Rne(t,s,r,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});Cn({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=Mne(t.gullet.popToken()),r=t.gullet.popToken(),i=t.gullet.popToken();return Rne(t,s,i,n==="\\\\globalfuture"),t.gullet.pushToken(i),t.gullet.pushToken(r),{type:"internal",mode:t.mode}}});var cx=function(t,n,s){var r=Ui.math[t]&&Ui.math[t].replace,i=HD(r||t,n,s);if(!i)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return i},YD=function(t,n,s,r){var i=s.havingBaseStyle(n),o=Dt(r.concat(i.sizingClasses(s)),[t],s),l=i.sizeMultiplier/s.sizeMultiplier;return o.height*=l,o.depth*=l,o.maxFontSize=i.sizeMultiplier,o},Dne=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=Xt(i),t.height-=i,t.depth+=i},D8e=function(t,n,s,r,i,o){var l=Ll(t,"Main-Regular",i,r),c=YD(l,n,r,o);return Dne(c,r,n),c},L8e=function(t,n,s,r){return Ll(t,"Size"+n+"-Regular",s,r)},Lne=function(t,n,s,r,i,o){var l=L8e(t,n,i,r),c=YD(Dt(["delimsizing","size"+n],[l],r),Cs.TEXT,r,o);return s&&Dne(c,r,Cs.TEXT),c},TA=function(t,n,s){var r;n==="Size1-Regular"?r="delim-size1":r="delim-size4";var i=Dt(["delimsizinginner",r],[Dt([],[Ll(t,n,s)])]);return{type:"elem",elem:i}},EA=function(t,n,s){var r=dh["Size4-Regular"][t.charCodeAt(0)]?dh["Size4-Regular"][t.charCodeAt(0)][4]:dh["Size1-Regular"][t.charCodeAt(0)][4],i=new Lp("inner",WEe(t,Math.round(1e3*n))),o=new Gf([i],{width:Xt(r),height:Xt(n),style:"width:"+Xt(r),viewBox:"0 0 "+1e3*r+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),l=Pp([],[o],s);return l.height=n,l.style.height=Xt(n),l.style.width=Xt(r),{type:"elem",elem:l}},_I=.008,I2={type:"kern",size:-1*_I},P8e=new Set(["|","\\lvert","\\rvert","\\vert"]),O8e=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),Pne=function(t,n,s,r,i,o){var l,c,u,d,f="",m=0;l=u=d=t,c=null;var p="Size1-Regular";t==="\\uparrow"?u=d="⏐":t==="\\Uparrow"?u=d="‖":t==="\\downarrow"?l=u="⏐":t==="\\Downarrow"?l=u="‖":t==="\\updownarrow"?(l="\\uparrow",u="⏐",d="\\downarrow"):t==="\\Updownarrow"?(l="\\Uparrow",u="‖",d="\\Downarrow"):P8e.has(t)?(u="∣",f="vert",m=333):O8e.has(t)?(u="∥",f="doublevert",m=556):t==="["||t==="\\lbrack"?(l="⎡",u="⎢",d="⎣",p="Size4-Regular",f="lbrack",m=667):t==="]"||t==="\\rbrack"?(l="⎤",u="⎥",d="⎦",p="Size4-Regular",f="rbrack",m=667):t==="\\lfloor"||t==="⌊"?(u=l="⎢",d="⎣",p="Size4-Regular",f="lfloor",m=667):t==="\\lceil"||t==="⌈"?(l="⎡",u=d="⎢",p="Size4-Regular",f="lceil",m=667):t==="\\rfloor"||t==="⌋"?(u=l="⎥",d="⎦",p="Size4-Regular",f="rfloor",m=667):t==="\\rceil"||t==="⌉"?(l="⎤",u=d="⎥",p="Size4-Regular",f="rceil",m=667):t==="("||t==="\\lparen"?(l="⎛",u="⎜",d="⎝",p="Size4-Regular",f="lparen",m=875):t===")"||t==="\\rparen"?(l="⎞",u="⎟",d="⎠",p="Size4-Regular",f="rparen",m=875):t==="\\{"||t==="\\lbrace"?(l="⎧",c="⎨",d="⎩",u="⎪",p="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(l="⎫",c="⎬",d="⎭",u="⎪",p="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(l="⎧",d="⎩",u="⎪",p="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(l="⎫",d="⎭",u="⎪",p="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(l="⎧",d="⎭",u="⎪",p="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(l="⎫",d="⎩",u="⎪",p="Size4-Regular");var g=cx(l,p,i),b=g.height+g.depth,w=cx(u,p,i),y=w.height+w.depth,v=cx(d,p,i),x=v.height+v.depth,k=0,_=1;if(c!==null){var T=cx(c,p,i);k=T.height+T.depth,_=2}var S=b+x+k,C=Math.max(0,Math.ceil((n-S)/(_*y))),N=S+C*_*y,E=r.fontMetrics().axisHeight;s&&(E*=r.sizeMultiplier);var O=N/2-E,B=[];if(f.length>0){var D=N-b-x,j=Math.round(N*1e3),L=VEe(f,Math.round(D*1e3)),z=new Lp(f,L),I=Xt(m/1e3),$=Xt(j/1e3),K=new Gf([z],{width:I,height:$,viewBox:"0 0 "+m+" "+j}),R=Pp([],[K],r);R.height=j/1e3,R.style.width=I,R.style.height=$,B.push({type:"elem",elem:R})}else{if(B.push(TA(d,p,i)),B.push(I2),c===null){var Y=N-b-x+2*_I;B.push(EA(u,Y,r))}else{var W=(N-b-x-k)/2+2*_I;B.push(EA(u,W,r)),B.push(I2),B.push(TA(c,p,i)),B.push(I2),B.push(EA(u,W,r))}B.push(I2),B.push(TA(l,p,i))}var M=r.havingBaseStyle(Cs.TEXT),F=Hr({positionType:"bottom",positionData:O,children:B});return YD(Dt(["delimsizing","mult"],[F],M),Cs.TEXT,r,o)},AA=80,jA=.08,NA=function(t,n,s,r,i){var o=UEe(t,r,s),l=new Lp(t,o),c=new Gf([l],{width:"400em",height:Xt(n),viewBox:"0 0 400000 "+s,preserveAspectRatio:"xMinYMin slice"});return Pp(["hide-tail"],[c],i)},$8e=function(t,n){var s=n.havingBaseSizing(),r=Fne("\\surd",t*s.sizeMultiplier,zne,s),i=s.sizeMultiplier,o=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),l,c,u,d,f;return r.type==="small"?(d=1e3+1e3*o+AA,t<1?i=1:t<1.4&&(i=.7),c=(1+o+jA)/i,u=(1+o)/i,l=NA("sqrtMain",c,d,o,n),l.style.minWidth="0.853em",f=.833/i):r.type==="large"?(d=(1e3+AA)*Gx[r.size],u=(Gx[r.size]+o)/i,c=(Gx[r.size]+o+jA)/i,l=NA("sqrtSize"+r.size,c,d,o,n),l.style.minWidth="1.02em",f=1/i):(c=t+o+jA,u=t+o,d=Math.floor(1e3*t+o)+AA,l=NA("sqrtTall",c,d,o,n),l.style.minWidth="0.742em",f=1.056),l.height=u,l.style.height=Xt(c),{span:l,advanceWidth:f,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*i}},One=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),B8e=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),$ne=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),Gx=[0,1.2,1.8,2.4,3],Bne=function(t,n,s,r,i){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),One.has(t)||$ne.has(t))return Lne(t,n,!1,s,r,i);if(B8e.has(t))return Pne(t,Gx[n],!1,s,r,i);throw new zt("Illegal delimiter: '"+t+"'")},z8e=[{type:"small",style:Cs.SCRIPTSCRIPT},{type:"small",style:Cs.SCRIPT},{type:"small",style:Cs.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],F8e=[{type:"small",style:Cs.SCRIPTSCRIPT},{type:"small",style:Cs.SCRIPT},{type:"small",style:Cs.TEXT},{type:"stack"}],zne=[{type:"small",style:Cs.SCRIPTSCRIPT},{type:"small",style:Cs.SCRIPT},{type:"small",style:Cs.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],q8e=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.")},Fne=function(t,n,s,r){for(var i=Math.min(2,3-r.style.size),o=i;o<s.length;o++){var l=s[o];if(l.type==="stack")break;var c=cx(t,q8e(l),"math"),u=c.height+c.depth;if(l.type==="small"){var d=r.havingBaseStyle(l.style);u*=d.sizeMultiplier}if(u>n)return l}return s[s.length-1]},SI=function(t,n,s,r,i,o){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var l;$ne.has(t)?l=z8e:One.has(t)?l=zne:l=F8e;var c=Fne(t,n,l,r);return c.type==="small"?D8e(t,c.style,s,r,i,o):c.type==="large"?Lne(t,c.size,s,r,i,o):Pne(t,n,s,r,i,o)},IA=function(t,n,s,r,i,o){var l=r.fontMetrics().axisHeight*r.sizeMultiplier,c=901,u=5/r.fontMetrics().ptPerEm,d=Math.max(n-l,s+l),f=Math.max(d/500*c,2*d-u);return SI(t,f,!0,r,i,o)},AH={"\\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}},H8e=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 jH(e){return"isMiddle"in e}function R5(e,t){var n=I5(e);if(n&&H8e.has(n.text))return n;throw n?new zt("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new zt("Invalid delimiter type '"+e.type+"'",e)}Cn({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=R5(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:AH[e.funcName].size,mclass:AH[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?Dt([e.mclass]):Bne(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(Fu(e.delim,e.mode));var n=new qt("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var s=Xt(Gx[e.size]);return n.setAttribute("minsize",s),n.setAttribute("maxsize",s),n}});function NH(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Cn({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 zt("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:R5(t[0],e).text,color:n}}});Cn({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=R5(t[0],e),s=e.parser;++s.leftrightDepth;var r=s.parseExpression(!1);--s.leftrightDepth,s.expect("\\right",!1);var i=Hs(s.parseFunction(),"leftright-right");return{type:"leftright",mode:s.mode,body:r,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{NH(e);for(var n=ma(e.body,t,!0,["mopen","mclose"]),s=0,r=0,i=!1,o=0;o<n.length;o++){var l=n[o];jH(l)?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=Nk(t,["mopen"]):c=IA(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(jH(d)){var f=d.isMiddle;n[u]=IA(f.delim,s,r,f.options,e.mode,[])}}var m;if(e.right===".")m=Nk(t,["mclose"]);else{var p=e.rightColor?t.withColor(e.rightColor):t;m=IA(e.right,s,r,p,e.mode,["mclose"])}return n.push(m),Dt(["minner"],n,t)},mathmlBuilder:(e,t)=>{NH(e);var n=ru(e.body,t);if(e.left!=="."){var s=new qt("mo",[Fu(e.left,e.mode)]);s.setAttribute("fence","true"),n.unshift(s)}if(e.right!=="."){var r=new qt("mo",[Fu(e.right,e.mode)]);r.setAttribute("fence","true"),e.rightColor&&r.setAttribute("mathcolor",e.rightColor),n.push(r)}return VD(n)}});Cn({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=R5(t[0],e);if(!e.parser.leftrightDepth)throw new zt("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return e.delim==="."?n=Nk(t,[]):(n=Bne(e.delim,1,t,e.mode,[]),n.isMiddle={delim:e.delim,options:t}),n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?Fu("|","text"):Fu(e.delim,e.mode),s=new qt("mo",[n]);return s.setAttribute("fence","true"),s.setAttribute("lspace","0.05em"),s.setAttribute("rspace","0.05em"),s}});var D5=(e,t)=>{var n=Ly(Vr(e.body,t),t),s=e.label.slice(1),r=t.sizeMultiplier,i,o,l=am(e.body);if(s==="sout")i=Dt(["stretchy","sout"]),i.height=t.fontMetrics().defaultRuleThickness/r,o=-.5*t.fontMetrics().xHeight;else if(s==="phase"){var c=ao({number:.6,unit:"pt"},t),u=ao({number:.35,unit:"ex"},t),d=t.havingBaseSizing();r=r/d.sizeMultiplier;var f=n.height+n.depth+c+u;n.style.paddingLeft=Xt(f/2+c);var m=Math.floor(1e3*f*r),p=qEe(m),g=new Gf([new Lp("phase",p)],{width:"400em",height:Xt(m/1e3),viewBox:"0 0 400000 "+m,preserveAspectRatio:"xMinYMin slice"});i=Pp(["hide-tail"],[g],t),i.style.height=Xt(f),o=n.depth+c+u}else{/cancel/.test(s)?l||n.classes.push("cancel-pad"):s==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var b,w,y=0;/box/.test(s)?(y=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),b=t.fontMetrics().fboxsep+(s==="colorbox"?0:y),w=b):s==="angl"?(y=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),b=4*y,w=Math.max(0,.25-n.depth)):(b=l?.2:0,w=b),i=S8e(n,s,b,w,t),/fbox|boxed|fcolorbox/.test(s)?(i.style.borderStyle="solid",i.style.borderWidth=Xt(y)):s==="angl"&&y!==.049&&(i.style.borderTopWidth=Xt(y),i.style.borderRightWidth=Xt(y)),o=n.depth+w,e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor,e.borderColor&&(i.style.borderColor=e.borderColor))}var v;if(e.backgroundColor)v=Hr({positionType:"individualShift",children:[{type:"elem",elem:i,shift:o},{type:"elem",elem:n,shift:0}]});else{var x=/cancel|phase/.test(s)?["svg-align"]:[];v=Hr({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:o,wrapperClasses:x}]})}return/cancel/.test(s)&&(v.height=n.height,v.depth=n.depth),/cancel/.test(s)&&!l?Dt(["mord","cancel-lap"],[v],t):Dt(["mord"],[v],t)},L5=(e,t)=>{var n,s=new qt(e.label.includes("colorbox")?"mpadded":"menclose",[_i(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: "+Xt(r)+" solid "+e.borderColor)}break;case"\\xcancel":s.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&s.setAttribute("mathbackground",e.backgroundColor),s};Cn({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,n){var{parser:s,funcName:r}=e,i=Hs(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:s.mode,label:r,backgroundColor:i,body:o}},htmlBuilder:D5,mathmlBuilder:L5});Cn({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,n){var{parser:s,funcName:r}=e,i=Hs(t[0],"color-token").color,o=Hs(t[1],"color-token").color,l=t[2];return{type:"enclose",mode:s.mode,label:r,backgroundColor:o,borderColor:i,body:l}},htmlBuilder:D5,mathmlBuilder:L5});Cn({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]}}});Cn({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:D5,mathmlBuilder:L5});Cn({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:D5,mathmlBuilder:L5});Cn({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 qne={};function Mh(e){for(var{type:t,names:n,props:s,handler:r,htmlBuilder:i,mathmlBuilder:o}=e,l={type:t,numArgs:s.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:r},c=0;c<n.length;++c)qne[n[c]]=l;i&&(MT[t]=i),o&&(RT[t]=o)}var Hne={};function oe(e,t){Hne[e]=t}class lc{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 lc(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}}class Yc{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 Yc(n,lc.range(this,t))}}function IH(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 P5=e=>{var t=e.parser.settings;if(!t.displayMode)throw new zt("{"+e.envName+"} can be used only in display mode.")},U8e=new Set(["gather","gather*"]);function XD(e){if(!e.includes("ed"))return!e.includes("*")}function u0(e,t,n){var{hskipBeforeAndAfter:s,addJot:r,cols:i,arraystretch:o,colSeparationType:l,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 zt("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var g=[],b=[g],w=[],y=[],v=c!=null?[]:void 0;function x(){c&&e.gullet.macros.set("\\@eqnsw","1",!0)}function k(){v&&(e.gullet.macros.get("\\df@tag")?(v.push(e.subparse([new Yc("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):v.push(!!c&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(x(),y.push(IH(e));;){var _=e.parseExpression(!1,u?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var T={type:"ordgroup",mode:e.mode,body:_};n&&(T={type:"styling",mode:e.mode,style:n,resetFont:!0,body:[T]}),g.push(T);var S=e.fetch().text;if(S==="&"){if(f&&g.length===f){if(u||l)throw new zt("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(S==="\\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(S==="\\\\"){e.consume();var C=void 0;e.gullet.future().text!==" "&&(C=e.parseSizeGroup(!0)),w.push(C?C.value:null),k(),y.push(IH(e)),g=[],b.push(g),x()}else throw new zt("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:w,hskipBeforeAndAfter:s,hLinesBeforeRow:y,colSeparationType:l,tags:v,leqno:m}}function QD(e){return e.slice(0,1)==="d"?"display":"text"}var Rh=function(t,n){var s,r,i=t.body.length,o=t.hLinesBeforeRow,l=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(Cs.SCRIPT).sizeMultiplier;m=.2778*(p/n.sizeMultiplier)}var g=t.colSeparationType==="CD"?ao({number:3,unit:"ex"},n):12*f,b=3*f,w=t.arraystretch*g,y=.7*w,v=.3*w,x=0;function k(rt){for(var dt=0;dt<rt.length;++dt)dt>0&&(x+=.25),u.push({pos:x,isDashed:rt[dt]})}for(k(o[0]),s=0;s<t.body.length;++s){var _=t.body[s],T=y,S=v;l<_.length&&(l=_.length);var C={cells:new Array(_.length),height:0,depth:0,pos:0};for(r=0;r<_.length;++r){var N=Vr(_[r],n);S<N.depth&&(S=N.depth),T<N.height&&(T=N.height),C.cells[r]=N}var E=t.rowGaps[s],O=0;E&&(O=ao(E,n),O>0&&(O+=v,S<O&&(S=O),O=0)),t.addJot&&s<t.body.length-1&&(S+=b),C.height=T,C.depth=S,x+=T,C.pos=x,x+=S+O,c[s]=C,k(o[s+1])}var B=x/2+n.fontMetrics().axisHeight,D=t.cols||[],j=[],L,z,I=[];if(t.tags&&t.tags.some(rt=>rt))for(s=0;s<i;++s){var $=c[s],K=$.pos-B,R=t.tags[s],Y=void 0;R===!0?Y=Dt(["eqn-num"],[],n):R===!1?Y=Dt([],[],n):Y=Dt([],ma(R,n,!0),n),Y.depth=$.depth,Y.height=$.height,I.push({type:"elem",elem:Y,shift:K})}for(r=0,z=0;r<l||z<D.length;++r,++z){for(var W,M=D[z],F=!0;((J=M)==null?void 0:J.type)==="separator";){var J;if(F||(L=Dt(["arraycolsep"],[]),L.style.width=Xt(n.fontMetrics().doubleRuleSep),j.push(L)),M.separator==="|"||M.separator===":"){var V=M.separator==="|"?"solid":"dashed",U=Dt(["vertical-separator"],[],n);U.style.height=Xt(x),U.style.borderRightWidth=Xt(d),U.style.borderRightStyle=V,U.style.margin="0 "+Xt(-d/2);var le=x-B;le&&(U.style.verticalAlign=Xt(-le)),j.push(U)}else throw new zt("Invalid separator type: "+M.separator);z++,M=D[z],F=!1}if(!(r>=l)){var pe=void 0;if(r>0||t.hskipBeforeAndAfter){var fe,Q;pe=(fe=(Q=M)==null?void 0:Q.pregap)!=null?fe:m,pe!==0&&(L=Dt(["arraycolsep"],[]),L.style.width=Xt(pe),j.push(L))}var ne=[];for(s=0;s<i;++s){var de=c[s],ue=de.cells[r];if(ue){var me=de.pos-B;ue.depth=de.depth,ue.height=de.height,ne.push({type:"elem",elem:ue,shift:me})}}var te=Hr({positionType:"individualShift",children:ne}),ae=Dt(["col-align-"+(((W=M)==null?void 0:W.align)||"c")],[te]);if(j.push(ae),r<l-1||t.hskipBeforeAndAfter){var be,se;pe=(be=(se=M)==null?void 0:se.postgap)!=null?be:m,pe!==0&&(L=Dt(["arraycolsep"],[]),L.style.width=Xt(pe),j.push(L))}}}var ve=Dt(["mtable"],j);if(u.length>0){for(var ze=Dy("hline",n,d),Pe=Dy("hdashline",n,d),_t=[{type:"elem",elem:ve,shift:0}];u.length>0;){var Pt=u.pop(),St=Pt.pos-B;Pt.isDashed?_t.push({type:"elem",elem:Pe,shift:St}):_t.push({type:"elem",elem:ze,shift:St})}ve=Hr({positionType:"individualShift",children:_t})}if(I.length===0)return Dt(["mord"],[ve],n);var he=Hr({positionType:"individualShift",children:I}),Ae=Dt(["tag"],[he],n);return cm([ve,Ae])},W8e={c:"center ",l:"left ",r:"right "},Dh=function(t,n){for(var s=[],r=new qt("mtd",[],["mtr-glue"]),i=new qt("mtd",[],["mml-eqn-num"]),o=0;o<t.body.length;o++){for(var l=t.body[o],c=[],u=0;u<l.length;u++)c.push(new qt("mtd",[_i(l[u],n)]));t.tags&&t.tags[o]&&(c.unshift(r),c.push(r),t.leqno?c.unshift(i):c.push(i)),s.push(new qt("mtr",c))}var d=new qt("mtable",s),f=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);d.setAttribute("rowspacing",Xt(f));var m="",p="";if(t.cols&&t.cols.length>0){var g=t.cols,b="",w=!1,y=0,v=g.length;g[0].type==="separator"&&(m+="top ",y=1),g[g.length-1].type==="separator"&&(m+="bottom ",v-=1);for(var x=y;x<v;x++){var k=g[x];k.type==="align"?(p+=W8e[k.align],w&&(b+="none "),w=!0):k.type==="separator"&&w&&(b+=k.separator==="|"?"solid ":"dashed ",w=!1)}d.setAttribute("columnalign",p.trim()),/[sd]/.test(b)&&d.setAttribute("columnlines",b.trim())}if(t.colSeparationType==="align"){for(var _=t.cols||[],T="",S=1;S<_.length;S++)T+=S%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 C="",N=t.hLinesBeforeRow;m+=N[0].length>0?"left ":"",m+=N[N.length-1].length>0?"right ":"";for(var E=1;E<N.length-1;E++)C+=N[E].length===0?"none ":N[E][0]?"dashed ":"solid ";return/[sd]/.test(C)&&d.setAttribute("rowlines",C.trim()),m!==""&&(d=new qt("menclose",[d]),d.setAttribute("notation",m.trim())),t.arraystretch&&t.arraystretch<1&&(d=new qt("mstyle",[d]),d.setAttribute("scriptlevel","1")),d},Une=function(t,n){t.envName.includes("ed")||P5(t);var s=[],r=t.envName.includes("at")?"alignat":"align",i=t.envName==="split",o=u0(t.parser,{cols:s,addJot:!0,autoTag:i?void 0:XD(t.envName),emptySingleRow:!0,colSeparationType:r,maxNumCols:i?2:void 0,leqno:t.parser.settings.leqno},"display"),l=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=Hs(n[0].body[f],"textord");d+=m.text}l=Number(d),c=l*2}var p=!c;o.body.forEach(function(y){for(var v=1;v<y.length;v+=2){var x=Hs(y[v],"styling"),k=Hs(x.body[0],"ordgroup");k.body.unshift(u)}if(p)c<y.length&&(c=y.length);else{var _=y.length/2;if(l<_)throw new zt("Too many math in a row: "+("expected "+l+", but got "+_),y[0])}});for(var g=0;g<c;++g){var b="r",w=0;g%2===1?b="l":g>0&&p&&(w=1),s[g]={type:"align",align:b,pregap:w,postgap:0}}return o.colSeparationType=p?"align":"alignat",o};Mh({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=I5(t[0]),s=n?[t[0]]:Hs(t[0],"ordgroup").body,r=s.map(function(o){var l=N5(o),c=l.text;if("lcr".includes(c))return{type:"align",align:c};if(c==="|")return{type:"separator",separator:"|"};if(c===":")return{type:"separator",separator:":"};throw new zt("Unknown column alignment: "+c,o)}),i={cols:r,hskipBeforeAndAfter:!0,maxNumCols:r.length};return u0(e.parser,i,QD(e.envName))},htmlBuilder:Rh,mathmlBuilder:Dh});Mh({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 zt("Expected l or c or r",r.nextToken);r.consume(),r.consumeSpaces(),r.expect("]"),r.consume(),s.cols=[{type:"align",align:n}]}}var i=u0(e.parser,s,QD(e.envName)),o=Math.max(0,...i.body.map(l=>l.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:Rh,mathmlBuilder:Dh});Mh({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=u0(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:Rh,mathmlBuilder:Dh});Mh({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=I5(t[0]),s=n?[t[0]]:Hs(t[0],"ordgroup").body,r=s.map(function(l){var c=N5(l),u=c.text;if("lc".includes(u))return{type:"align",align:u};throw new zt("Unknown column alignment: "+u,l)});if(r.length>1)throw new zt("{subarray} can contain only one column");var i={cols:r,hskipBeforeAndAfter:!1,arraystretch:.5},o=u0(e.parser,i,"script");if(o.body.length>0&&o.body[0].length>1)throw new zt("{subarray} can contain only one column");return o},htmlBuilder:Rh,mathmlBuilder:Dh});Mh({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=u0(e.parser,t,QD(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Rh,mathmlBuilder:Dh});Mh({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Une,htmlBuilder:Rh,mathmlBuilder:Dh});Mh({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){U8e.has(e.envName)&&P5(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:XD(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return u0(e.parser,t,"display")},htmlBuilder:Rh,mathmlBuilder:Dh});Mh({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Une,htmlBuilder:Rh,mathmlBuilder:Dh});Mh({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){P5(e);var t={autoTag:XD(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return u0(e.parser,t,"display")},htmlBuilder:Rh,mathmlBuilder:Dh});Mh({type:"array",names:["CD"],props:{numArgs:0},handler(e){return P5(e),M8e(e.parser)},htmlBuilder:Rh,mathmlBuilder:Dh});oe("\\nonumber","\\gdef\\@eqnsw{0}");oe("\\notag","\\nonumber");Cn({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new zt(e.funcName+" valid only within array environment")}});var MH=qne;Cn({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 zt("Invalid environment name",r);for(var i="",o=0;o<r.body.length;++o)i+=Hs(r.body[o],"textord").text;if(s==="\\begin"){if(!MH.hasOwnProperty(i))throw new zt("No such environment: "+i,r);var l=MH[i],{args:c,optArgs:u}=n.parseArguments("\\begin{"+i+"}",l),d={mode:n.mode,envName:i,parser:n},f=l.handler(d,c,u);n.expect("\\end",!1);var m=n.nextToken,p=Hs(n.parseFunction(),"environment");if(p.name!==i)throw new zt("Mismatch: \\begin{"+i+"} matched by \\end{"+p.name+"}",m);return f}return{type:"environment",mode:n.mode,name:i,nameGroup:r}}});var Wne=(e,t)=>{var n=e.font,s=t.withFont(n);return Vr(e.body,s)},Vne=(e,t)=>{var n=e.font,s=t.withFont(n);return _i(e.body,s)},RH={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};Cn({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=DT(t[0]),i=s;return i in RH&&(i=RH[i]),{type:"font",mode:n.mode,font:i.slice(1),body:r}},htmlBuilder:Wne,mathmlBuilder:Vne});Cn({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:M5(s),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:s}],isCharacterBox:am(s)}}});Cn({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:Wne,mathmlBuilder:Vne});var V8e=(e,t)=>{var n=t.style,s=n.fracNum(),r=n.fracDen(),i;i=t.havingStyle(s);var o=Vr(e.numer,i,t);if(e.continued){var l=8.5/t.fontMetrics().ptPerEm,c=3.5/t.fontMetrics().ptPerEm;o.height=o.height<l?l:o.height,o.depth=o.depth<c?c:o.depth}i=t.havingStyle(r);var u=Vr(e.denom,i,t),d,f,m;e.hasBarLine?(e.barSize?(f=ao(e.barSize,t),d=Dy("frac-line",t,f)):d=Dy("frac-line",t),f=d.height,m=d.height):(d=null,f=0,m=t.fontMetrics().defaultRuleThickness);var p,g,b;n.size===Cs.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 w;if(d){var v=t.fontMetrics().axisHeight;p-o.depth-(v+.5*f)<g&&(p+=g-(p-o.depth-(v+.5*f))),v-.5*f-(u.height-b)<g&&(b+=g-(v-.5*f-(u.height-b)));var x=-(v-.5*f);w=Hr({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)),w=Hr({positionType:"individualShift",children:[{type:"elem",elem:u,shift:b},{type:"elem",elem:o,shift:-p}]})}i=t.havingStyle(n),w.height*=i.sizeMultiplier/t.sizeMultiplier,w.depth*=i.sizeMultiplier/t.sizeMultiplier;var k;n.size===Cs.DISPLAY.size?k=t.fontMetrics().delim1:n.size===Cs.SCRIPTSCRIPT.size?k=t.havingStyle(Cs.SCRIPT).fontMetrics().delim2:k=t.fontMetrics().delim2;var _,T;return e.leftDelim==null?_=Nk(t,["mopen"]):_=SI(e.leftDelim,k,!0,t.havingStyle(n),e.mode,["mopen"]),e.continued?T=Dt([]):e.rightDelim==null?T=Nk(t,["mclose"]):T=SI(e.rightDelim,k,!0,t.havingStyle(n),e.mode,["mclose"]),Dt(["mord"].concat(i.sizingClasses(t)),[_,Dt(["mfrac"],[w]),T],t)},G8e=(e,t)=>{var n=new qt("mfrac",[_i(e.numer,t),_i(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var s=ao(e.barSize,t);n.setAttribute("linethickness",Xt(s))}if(e.leftDelim!=null||e.rightDelim!=null){var r=[];if(e.leftDelim!=null){var i=new qt("mo",[new Ko(e.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),r.push(i)}if(r.push(n),e.rightDelim!=null){var o=new qt("mo",[new Ko(e.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),r.push(o)}return VD(r)}return n},Gne=(e,t)=>{if(!t)return e;var n={type:"styling",mode:e.mode,style:t,body:[e]};return n};Cn({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,l=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,l="(",c=")";break;case"\\\\bracefrac":o=!1,l="\\{",c="\\}";break;case"\\\\brackfrac":o=!1,l="[",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"),Gne({type:"genfrac",mode:n.mode,numer:r,denom:i,continued:u,hasBarLine:o,leftDelim:l,rightDelim:c,barSize:null},d)},htmlBuilder:V8e,mathmlBuilder:G8e});Cn({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 DH=["display","text","script","scriptscript"],LH=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};Cn({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=DT(t[0]),o=i.type==="atom"&&i.family==="open"?LH(i.text):null,l=DT(t[1]),c=l.type==="atom"&&l.family==="close"?LH(l.text):null,u=Hs(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=Hs(p.body[0],"textord");m=DH[Number(g.text)]}}else p=Hs(p,"textord"),m=DH[Number(p.text)];return Gne({type:"genfrac",mode:n.mode,numer:s,denom:r,continued:!1,hasBarLine:d,barSize:f,leftDelim:o,rightDelim:c},m)}});Cn({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:Hs(t[0],"size").value,token:r}}});Cn({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0],i=Hs(t[1],"infix").size;if(!i)throw new Error("\\\\abovefrac expected size, but got "+String(i));var o=t[2],l=i.number>0;return{type:"genfrac",mode:n.mode,numer:r,denom:o,continued:!1,hasBarLine:l,barSize:i,leftDelim:null,rightDelim:null}}});var Kne=(e,t)=>{var n=t.style,s,r;e.type==="supsub"?(s=e.sup?Vr(e.sup,t.havingStyle(n.sup()),t):Vr(e.sub,t.havingStyle(n.sub()),t),r=Hs(e.base,"horizBrace")):r=Hs(e,"horizBrace");var i=Vr(r.base,t.havingBaseStyle(Cs.DISPLAY)),o=j5(r,t),l;if(r.isOver?l=Hr({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:o,wrapperClasses:["svg-align"]}]}):l=Hr({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=Dt(["minner",r.isOver?"mover":"munder"],[l],t);r.isOver?l=Hr({positionType:"firstBaseline",children:[{type:"elem",elem:c},{type:"kern",size:.2},{type:"elem",elem:s}]}):l=Hr({positionType:"bottom",positionData:c.depth+.2+s.height+s.depth,children:[{type:"elem",elem:s},{type:"kern",size:.2},{type:"elem",elem:c}]})}return Dt(["minner",r.isOver?"mover":"munder"],[l],t)},K8e=(e,t)=>{var n=A5(e.label);return new qt(e.isOver?"mover":"munder",[_i(e.base,t),n])};Cn({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:Kne,mathmlBuilder:K8e});Cn({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=t[1],r=Hs(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:r})?{type:"href",mode:n.mode,href:r,body:Go(s)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=ma(e.body,t,!1);return a8e(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=Op(e.body,t);return n instanceof qt||(n=new qt("mrow",[n])),n.setAttribute("href",e.href),n}});Cn({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=Hs(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 l={type:"text",mode:n.mode,font:"\\texttt",body:r};return{type:"href",mode:n.mode,href:s,body:Go(l)}}});Cn({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:Go(t[0])}},htmlBuilder(e,t){var n=ma(e.body,t.withFont(""),!1);return cm(n)},mathmlBuilder(e,t){return new qt("mrow",ru(e.body,t.withFont("")))}});Cn({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=Hs(t[0],"raw").string,o=t[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var l,c={};switch(s){case"\\htmlClass":c.class=i,l={command:"\\htmlClass",class:i};break;case"\\htmlId":c.id=i,l={command:"\\htmlId",id:i};break;case"\\htmlStyle":c.style=i,l={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 zt("\\htmlData key/value '"+f+"' missing equals sign");var p=f.slice(0,m),g=f.slice(m+1);c["data-"+p.trim()]=g}l={command:"\\htmlData",attributes:c};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(l)?{type:"html",mode:n.mode,attributes:c,body:Go(o)}:n.formatUnsupportedCmd(s)},htmlBuilder:(e,t)=>{var n=ma(e.body,t,!1),s=["enclosing"];e.attributes.class&&s.push(...e.attributes.class.trim().split(/\s+/));var r=Dt(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)=>Op(e.body,t)});Cn({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:Go(t[0]),mathml:Go(t[1])}},htmlBuilder:(e,t)=>{var n=ma(e.html,t,!1);return cm(n)},mathmlBuilder:(e,t)=>Op(e.mathml,t)});var MA=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 zt("Invalid size: '"+t+"' in \\includegraphics");var s={number:+(n[1]+n[2]),unit:n[3]};if(!une(s))throw new zt("Invalid unit: '"+s.unit+"' in \\includegraphics.");return s};Cn({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"},l="";if(n[0])for(var c=Hs(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":l=m;break;case"width":r=MA(m);break;case"height":i=MA(m);break;case"totalheight":o=MA(m);break;default:throw new zt("Invalid key: '"+f[0]+"' in \\includegraphics.")}}}var p=Hs(t[0],"url").url;return l===""&&(l=p,l=l.replace(/^.*[\\/]/,""),l=l.substring(0,l.lastIndexOf("."))),s.settings.isTrusted({command:"\\includegraphics",url:p})?{type:"includegraphics",mode:s.mode,alt:l,width:r,height:i,totalheight:o,src:p}:s.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=ao(e.height,t),s=0;e.totalheight.number>0&&(s=ao(e.totalheight,t)-n);var r=0;e.width.number>0&&(r=ao(e.width,t));var i={height:Xt(n+s)};r>0&&(i.width=Xt(r)),s>0&&(i.verticalAlign=Xt(-s));var o=new XEe(e.src,e.alt,i);return o.height=n,o.depth=s,o},mathmlBuilder:(e,t)=>{var n=new qt("mglyph",[]);n.setAttribute("alt",e.alt);var s=ao(e.height,t),r=0;if(e.totalheight.number>0&&(r=ao(e.totalheight,t)-s,n.setAttribute("valign",Xt(-r))),n.setAttribute("height",Xt(s+r)),e.width.number>0){var i=ao(e.width,t);n.setAttribute("width",Xt(i))}return n.setAttribute("src",e.src),n}});Cn({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=Hs(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 bne(e.dimension,t)},mathmlBuilder(e,t){var n=ao(e.dimension,t);return new _ne(n)}});Cn({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=Dt([],[Vr(e.body,t)]),n=Dt(["inner"],[n],t)):n=Dt(["inner"],[Vr(e.body,t)]);var s=Dt(["fix"],[]),r=Dt([e.alignment],[n,s],t),i=Dt(["strut"]);return i.style.height=Xt(r.height+r.depth),r.depth&&(i.style.verticalAlign=Xt(-r.depth)),r.children.unshift(i),r=Dt(["thinbox"],[r],t),Dt(["mord","vbox"],[r],t)},mathmlBuilder:(e,t)=>{var n=new qt("mpadded",[_i(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}});Cn({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}}});Cn({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new zt("Mismatched "+e.funcName)}});var PH=(e,t)=>{switch(t.style.size){case Cs.DISPLAY.size:return e.display;case Cs.TEXT.size:return e.text;case Cs.SCRIPT.size:return e.script;case Cs.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};Cn({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:Go(t[0]),text:Go(t[1]),script:Go(t[2]),scriptscript:Go(t[3])}},htmlBuilder:(e,t)=>{var n=PH(e,t),s=ma(n,t,!1);return cm(s)},mathmlBuilder:(e,t)=>{var n=PH(e,t);return Op(n,t)}});var Yne=(e,t,n,s,r,i,o)=>{e=Dt([],[e]);var l=n&&am(n),c,u;if(t){var d=Vr(t,s.havingStyle(r.sup()),s);u={elem:d,kern:Math.max(s.fontMetrics().bigOpSpacing1,s.fontMetrics().bigOpSpacing3-d.depth)}}if(n){var f=Vr(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=Hr({positionType:"bottom",positionData:p,children:[{type:"kern",size:s.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Xt(-i)},{type:"kern",size:c.kern},{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:Xt(i)},{type:"kern",size:s.fontMetrics().bigOpSpacing5}]})}else if(c){var g=e.height-o;m=Hr({positionType:"top",positionData:g,children:[{type:"kern",size:s.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Xt(-i)},{type:"kern",size:c.kern},{type:"elem",elem:e}]})}else if(u){var b=e.depth+o;m=Hr({positionType:"bottom",positionData:b,children:[{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:Xt(i)},{type:"kern",size:s.fontMetrics().bigOpSpacing5}]})}else return e;var w=[m];if(c&&i!==0&&!l){var y=Dt(["mspace"],[],s);y.style.marginRight=Xt(i),w.unshift(y)}return Dt(["mop","op-limits"],w,s)},Xne=new Set(["\\smallint"]),Cv=(e,t)=>{var n,s,r=!1,i;e.type==="supsub"?(n=e.sup,s=e.sub,i=Hs(e.base,"op"),r=!0):i=Hs(e,"op");var o=t.style,l=!1;o.size===Cs.DISPLAY.size&&i.symbol&&!Xne.has(i.name)&&(l=!0);var c,u;if(i.symbol){var d=l?"Size2-Regular":"Size1-Regular",f="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(f=i.name.slice(1),i.name=f==="oiint"?"\\iint":"\\iiint"),c=Ll(i.name,d,"math",t,["mop","op-symbol",l?"large-op":"small-op"]),u=c.italic,f.length>0){var m=vne(f+"Size"+(l?"2":"1"),t);c=Hr({positionType:"individualShift",children:[{type:"elem",elem:c,shift:0},{type:"elem",elem:m,shift:l?.08:0}]}),i.name="\\"+f,c.classes.unshift("mop"),c.italic=u}}else if(i.body){var p=ma(i.body,t,!0);p.length===1&&p[0]instanceof tu?(c=p[0],c.classes[0]="mop"):c=Dt(["mop"],p,t)}else{for(var g=[],b=1;b<i.name.length;b++)g.push(UD(i.name[b],i.mode,t));c=Dt(["mop"],g,t)}var w=0,y=0;if((c instanceof tu||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift){var v;w=(c.height-c.depth)/2-t.fontMetrics().axisHeight,y=(v=c.italic)!=null?v:0}return r?Yne(c,n,s,t,o,y,w):(w&&(c.style.position="relative",c.style.top=Xt(w)),c)},M_=(e,t)=>{var n;if(e.symbol)n=new qt("mo",[Fu(e.name,e.mode)]),Xne.has(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new qt("mo",ru(e.body,t));else{n=new qt("mi",[new Ko(e.name.slice(1))]);var s=new qt("mo",[Fu("⁡","text")]);e.parentIsSupSub?n=new qt("mrow",[n,s]):n=kne([n,s])}return n},Y8e={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Cn({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=Y8e[r]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Cv,mathmlBuilder:M_});Cn({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:Go(s)}},htmlBuilder:Cv,mathmlBuilder:M_});var X8e={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Cn({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:Cv,mathmlBuilder:M_});Cn({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:Cv,mathmlBuilder:M_});Cn({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=X8e[s]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:Cv,mathmlBuilder:M_});var Qne=(e,t)=>{var n,s,r=!1,i;e.type==="supsub"?(n=e.sup,s=e.sub,i=Hs(e.base,"operatorname"),r=!0):i=Hs(e,"operatorname");var o;if(i.body.length>0){for(var l=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=ma(l,t.withFont("mathrm"),!0),u=0;u<c.length;u++){var d=c[u];d instanceof tu&&(d.text=d.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=Dt(["mop"],c,t)}else o=Dt(["mop"],[],t);return r?Yne(o,n,s,t,t.style,0,0):o},Q8e=(e,t)=>{for(var n=ru(e.body,t.withFont("mathrm")),s=!0,r=0;r<n.length;r++){var i=n[r];if(!(i instanceof _ne))if(i instanceof qt)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 Ko?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):s=!1;break}default:s=!1}else s=!1}if(s){var l=n.map(d=>d.toText()).join("");n=[new Ko(l)]}var c=new qt("mi",n);c.setAttribute("mathvariant","normal");var u=new qt("mo",[Fu("⁡","text")]);return e.parentIsSupSub?new qt("mrow",[c,u]):kne([c,u])};Cn({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:Go(r),alwaysHandleSupSub:s==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Qne,mathmlBuilder:Q8e});oe("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");m1({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?cm(ma(e.body,t,!1)):Dt(["mord"],ma(e.body,t,!0),t)},mathmlBuilder(e,t){return Op(e.body,t,!0)}});Cn({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=Vr(e.body,t.havingCrampedStyle()),s=Dy("overline-line",t),r=t.fontMetrics().defaultRuleThickness,i=Hr({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*r},{type:"elem",elem:s},{type:"kern",size:r}]});return Dt(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new qt("mo",[new Ko("‾")]);n.setAttribute("stretchy","true");var s=new qt("mover",[_i(e.body,t),n]);return s.setAttribute("accent","true"),s}});Cn({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:Go(s)}},htmlBuilder:(e,t)=>{var n=ma(e.body,t.withPhantom(),!1);return cm(n)},mathmlBuilder:(e,t)=>{var n=ru(e.body,t);return new qt("mphantom",n)}});oe("\\hphantom","\\smash{\\phantom{#1}}");Cn({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=Dt(["inner"],[Vr(e.body,t.withPhantom())]),s=Dt(["fix"],[]);return Dt(["mord","rlap"],[n,s],t)},mathmlBuilder:(e,t)=>{var n=ru(Go(e.body),t),s=new qt("mphantom",n),r=new qt("mpadded",[s]);return r.setAttribute("width","0px"),r}});Cn({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,s=Hs(t[0],"size").value,r=t[1];return{type:"raisebox",mode:n.mode,dy:s,body:r}},htmlBuilder(e,t){var n=Vr(e.body,t),s=ao(e.dy,t);return Hr({positionType:"shift",positionData:-s,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new qt("mpadded",[_i(e.body,t)]),s=e.dy.number+e.dy.unit;return n.setAttribute("voffset",s),n}});Cn({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});Cn({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=Hs(t[0],"size"),o=Hs(t[1],"size");return{type:"rule",mode:s.mode,shift:r&&Hs(r,"size").value,width:i.value,height:o.value}},htmlBuilder(e,t){var n=Dt(["mord","rule"],[],t),s=ao(e.width,t),r=ao(e.height,t),i=e.shift?ao(e.shift,t):0;return n.style.borderRightWidth=Xt(s),n.style.borderTopWidth=Xt(r),n.style.bottom=Xt(i),n.width=s,n.height=r+i,n.depth=-i,n.maxFontSize=r*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=ao(e.width,t),s=ao(e.height,t),r=e.shift?ao(e.shift,t):0,i=t.color&&t.getColor()||"black",o=new qt("mspace");o.setAttribute("mathbackground",i),o.setAttribute("width",Xt(n)),o.setAttribute("height",Xt(s));var l=new qt("mpadded",[o]);return r>=0?l.setAttribute("height",Xt(r)):(l.setAttribute("height",Xt(r)),l.setAttribute("depth",Xt(-r))),l.setAttribute("voffset",Xt(r)),l}});function Jne(e,t,n){for(var s=ma(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 cm(s)}var OH=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],J8e=(e,t)=>{var n=t.havingSize(e.size);return Jne(e.body,n,t)};Cn({type:"sizing",names:OH,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:OH.indexOf(s)+1,body:i}},htmlBuilder:J8e,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),s=ru(e.body,n),r=new qt("mstyle",s);return r.setAttribute("mathsize",Xt(n.sizeMultiplier)),r}});Cn({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]&&Hs(n[0],"ordgroup");if(o)for(var l,c=0;c<o.body.length;++c){var u=o.body[c];if(l=N5(u).text,l==="t")r=!0;else if(l==="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=Dt([],[Vr(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 Dt(["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=Hr({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return Dt(["mord"],[r],t)},mathmlBuilder:(e,t)=>{var n=new qt("mpadded",[_i(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});Cn({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=Vr(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=Ly(n,t);var s=t.fontMetrics(),r=s.defaultRuleThickness,i=r;t.style.id<Cs.TEXT.id&&(i=t.fontMetrics().xHeight);var o=r+i/4,l=n.height+n.depth+o+r,{span:c,ruleWidth:u,advanceWidth:d}=$8e(l,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=Xt(d);var p=Hr({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(Cs.SCRIPTSCRIPT),b=Vr(e.index,g,t),w=.6*(p.height-p.depth),y=Hr({positionType:"shift",positionData:-w,children:[{type:"elem",elem:b}]}),v=Dt(["root"],[y]);return Dt(["mord","sqrt"],[v,p],t)}else return Dt(["mord","sqrt"],[p],t)},mathmlBuilder(e,t){var{body:n,index:s}=e;return s?new qt("mroot",[_i(n,t),_i(s,t)]):new qt("msqrt",[_i(n,t)])}});var CI={display:Cs.DISPLAY,text:Cs.TEXT,script:Cs.SCRIPT,scriptscript:Cs.SCRIPTSCRIPT};function Z8e(e){return e in CI}Cn({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(!Z8e(o))throw new Error("Unknown style: "+o);return{type:"styling",mode:r.mode,style:o,body:i}},htmlBuilder(e,t){var n=CI[e.style],s=t.havingStyle(n);return e.resetFont&&(s=s.withFont("")),Jne(e.body,s,t)},mathmlBuilder(e,t){var n=CI[e.style],s=t.havingStyle(n);e.resetFont&&(s=s.withFont(""));var r=ru(e.body,s),i=new qt("mstyle",r),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},l=o[e.style];return i.setAttribute("scriptlevel",l[0]),i.setAttribute("displaystyle",l[1]),i}});var eAe=function(t,n){var s=t.base;if(s)if(s.type==="op"){var r=s.limits&&(n.style.size===Cs.DISPLAY.size||s.alwaysHandleSupSub);return r?Cv:null}else if(s.type==="operatorname"){var i=s.alwaysHandleSupSub&&(n.style.size===Cs.DISPLAY.size||s.limits);return i?Qne:null}else{if(s.type==="accent")return am(s.base)?KD:null;if(s.type==="horizBrace"){var o=!t.sub;return o===s.isOver?Kne:null}else return null}else return null};m1({type:"supsub",htmlBuilder(e,t){var n=eAe(e,t);if(n)return n(e,t);var{base:s,sup:r,sub:i}=e,o=Vr(s,t),l,c,u=t.fontMetrics(),d=0,f=0,m=s&&am(s);if(r){var p=t.havingStyle(t.style.sup());l=Vr(r,p,t),m||(d=o.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(i){var g=t.havingStyle(t.style.sub());c=Vr(i,g,t),m||(f=o.depth+g.fontMetrics().subDrop*g.sizeMultiplier/t.sizeMultiplier)}var b;t.style===Cs.DISPLAY?b=u.sup1:t.style.cramped?b=u.sup3:b=u.sup2;var w=t.sizeMultiplier,y=Xt(.5/u.ptPerEm/w),v=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 tu||x){var k;v=Xt(-((k=o.italic)!=null?k:0))}}var _;if(l&&c){d=Math.max(d,b,l.depth+.25*u.xHeight),f=Math.max(f,u.sub2);var T=u.defaultRuleThickness,S=4*T;if(d-l.depth-(c.height-f)<S){f=S-(d-l.depth)+c.height;var C=.8*u.xHeight-(d-l.depth);C>0&&(d+=C,f-=C)}var N=[{type:"elem",elem:c,shift:f,marginRight:y,marginLeft:v},{type:"elem",elem:l,shift:-d,marginRight:y}];_=Hr({positionType:"individualShift",children:N})}else if(c){f=Math.max(f,u.sub1,c.height-.8*u.xHeight);var E=[{type:"elem",elem:c,marginLeft:v,marginRight:y}];_=Hr({positionType:"shift",positionData:f,children:E})}else if(l)d=Math.max(d,b,l.depth+.25*u.xHeight),_=Hr({positionType:"shift",positionData:-d,children:[{type:"elem",elem:l,marginRight:y}]});else throw new Error("supsub must have either sup or sub.");var O=wI(o,"right")||"mord";return Dt([O],[o,Dt(["msupsub"],[_])],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=[_i(e.base,t)];e.sub&&i.push(_i(e.sub,t)),e.sup&&i.push(_i(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===Cs.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(t.style===Cs.DISPLAY||u.limits)?o="munderover":o="msubsup"}else{var c=e.base;c&&c.type==="op"&&c.limits&&(t.style===Cs.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||t.style===Cs.DISPLAY)?o="munder":o="msub"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(t.style===Cs.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||t.style===Cs.DISPLAY)?o="mover":o="msup"}return new qt(o,i)}});m1({type:"atom",htmlBuilder(e,t){return UD(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new qt("mo",[Fu(e.text,e.mode)]);if(e.family==="bin"){var s=GD(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 Zne={mi:"italic",mn:"normal",mtext:"normal"};m1({type:"mathord",htmlBuilder(e,t){return E5(e,t,"mathord")},mathmlBuilder(e,t){var n=new qt("mi",[Fu(e.text,e.mode,t)]),s=GD(e,t)||"italic";return s!==Zne[n.type]&&n.setAttribute("mathvariant",s),n}});m1({type:"textord",htmlBuilder(e,t){return E5(e,t,"textord")},mathmlBuilder(e,t){var n=Fu(e.text,e.mode,t),s=GD(e,t)||"normal",r;return e.mode==="text"?r=new qt("mtext",[n]):/[0-9]/.test(e.text)?r=new qt("mn",[n]):e.text==="\\prime"?r=new qt("mo",[n]):r=new qt("mi",[n]),s!==Zne[r.type]&&r.setAttribute("mathvariant",s),r}});var RA={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},DA={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};m1({type:"spacing",htmlBuilder(e,t){if(DA.hasOwnProperty(e.text)){var n=DA[e.text].className||"";if(e.mode==="text"){var s=E5(e,t,"textord");return s.classes.push(n),s}else return Dt(["mspace",n],[UD(e.text,e.mode,t)],t)}else{if(RA.hasOwnProperty(e.text))return Dt(["mspace",RA[e.text]],[],t);throw new zt('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(DA.hasOwnProperty(e.text))n=new qt("mtext",[new Ko(" ")]);else{if(RA.hasOwnProperty(e.text))return new qt("mspace");throw new zt('Unknown type of space "'+e.text+'"')}return n}});var $H=()=>{var e=new qt("mtd",[]);return e.setAttribute("width","50%"),e};m1({type:"tag",mathmlBuilder(e,t){var n=new qt("mtable",[new qt("mtr",[$H(),new qt("mtd",[Op(e.body,t)]),$H(),new qt("mtd",[Op(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var BH={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},zH={"\\textbf":"textbf","\\textmd":"textmd"},tAe={"\\textit":"textit","\\textup":"textup"},FH=(e,t)=>{var n=e.font;if(n){if(BH[n])return t.withTextFontFamily(BH[n]);if(zH[n])return t.withTextFontWeight(zH[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(tAe[n])};Cn({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:Go(r),font:s}},htmlBuilder(e,t){var n=FH(e,t),s=ma(e.body,n,!0);return Dt(["mord","text"],s,n)},mathmlBuilder(e,t){var n=FH(e,t);return Op(e.body,n)}});Cn({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=Vr(e.body,t),s=Dy("underline-line",t),r=t.fontMetrics().defaultRuleThickness,i=Hr({positionType:"top",positionData:n.height,children:[{type:"kern",size:r},{type:"elem",elem:s},{type:"kern",size:3*r},{type:"elem",elem:n}]});return Dt(["mord","underline"],[i],t)},mathmlBuilder(e,t){var n=new qt("mo",[new Ko("‾")]);n.setAttribute("stretchy","true");var s=new qt("munder",[_i(e.body,t),n]);return s.setAttribute("accentunder","true"),s}});Cn({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=Vr(e.body,t),s=t.fontMetrics().axisHeight,r=.5*(n.height-s-(n.depth+s));return Hr({positionType:"shift",positionData:r,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new qt("mpadded",[_i(e.body,t)],["vcenter"]);return new qt("mrow",[n])}});Cn({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new zt("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=qH(e),s=[],r=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var o=n[i];o==="~"&&(o="\\textasciitilde"),s.push(Ll(o,"Typewriter-Regular",e.mode,r,["mord","texttt"]))}return Dt(["mord","text"].concat(r.sizingClasses(t)),gne(s),r)},mathmlBuilder(e,t){var n=new Ko(qH(e)),s=new qt("mtext",[n]);return s.setAttribute("mathvariant","monospace"),s}});var qH=e=>e.body.replace(/ /g,e.star?"␣":" "),ip=wne,ese=`[ \r
	]`,nAe="\\\\[a-zA-Z@]+",sAe="\\\\[^\uD800-\uDFFF]",rAe="("+nAe+")"+ese+"*",iAe=`\\\\(
|[ \r	]+
?)[ \r	]*`,TI="[̀-ͯ]",oAe=new RegExp(TI+"+$"),aAe="("+ese+"+)|"+(iAe+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(TI+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(TI+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+rAe)+("|"+sAe+")");class HH{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(aAe,"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 Yc("EOF",new lc(this,n,n));var s=this.tokenRegex.exec(t);if(s===null||s.index!==n)throw new zt("Unexpected character: '"+t[n]+"'",new Yc(t[n],new lc(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 Yc(r,new lc(this,n,this.tokenRegex.lastIndex))}}class lAe{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 zt("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 cAe=Hne;oe("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});oe("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});oe("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});oe("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});oe("\\@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}});oe("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");oe("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var UH={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};oe("\\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 zt("\\char` missing argument");s=t.text.charCodeAt(0)}else n=10;if(n){if(s=UH[t.text],s==null||s>=n)throw new zt("Invalid base-"+n+" digit "+t.text);for(var r;(r=UH[e.future().text])!=null&&r<n;)s*=n,s+=r,e.popToken()}return"\\@char{"+s+"}"});var JD=(e,t,n,s)=>{var r=e.consumeArg().tokens;if(r.length!==1)throw new zt("\\newcommand's first argument must be a macro name");var i=r[0].text,o=e.isDefined(i);if(o&&!t)throw new zt("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!o&&!n)throw new zt("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var l=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 zt("Invalid number of arguments: "+c);l=parseInt(c),r=e.consumeArg().tokens}return o&&s||e.macros.set(i,{tokens:r,numArgs:l}),""};oe("\\newcommand",e=>JD(e,!1,!0,!1));oe("\\renewcommand",e=>JD(e,!0,!1,!1));oe("\\providecommand",e=>JD(e,!0,!0,!0));oe("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(n=>n.text).join("")),""});oe("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(n=>n.text).join("")),""});oe("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),ip[n],Ui.math[n],Ui.text[n]),""});oe("\\bgroup","{");oe("\\egroup","}");oe("~","\\nobreakspace");oe("\\lq","`");oe("\\rq","'");oe("\\aa","\\r a");oe("\\AA","\\r A");oe("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");oe("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");oe("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");oe("ℬ","\\mathscr{B}");oe("ℰ","\\mathscr{E}");oe("ℱ","\\mathscr{F}");oe("ℋ","\\mathscr{H}");oe("ℐ","\\mathscr{I}");oe("ℒ","\\mathscr{L}");oe("ℳ","\\mathscr{M}");oe("ℛ","\\mathscr{R}");oe("ℭ","\\mathfrak{C}");oe("ℌ","\\mathfrak{H}");oe("ℨ","\\mathfrak{Z}");oe("\\Bbbk","\\Bbb{k}");oe("\\llap","\\mathllap{\\textrm{#1}}");oe("\\rlap","\\mathrlap{\\textrm{#1}}");oe("\\clap","\\mathclap{\\textrm{#1}}");oe("\\mathstrut","\\vphantom{(}");oe("\\underbar","\\underline{\\text{#1}}");oe("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');oe("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");oe("\\ne","\\neq");oe("≠","\\neq");oe("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");oe("∉","\\notin");oe("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");oe("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");oe("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");oe("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");oe("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");oe("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");oe("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");oe("⟂","\\perp");oe("‼","\\mathclose{!\\mkern-0.8mu!}");oe("∌","\\notni");oe("⌜","\\ulcorner");oe("⌝","\\urcorner");oe("⌞","\\llcorner");oe("⌟","\\lrcorner");oe("©","\\copyright");oe("®","\\textregistered");oe("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');oe("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');oe("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');oe("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');oe("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");oe("⋮","\\vdots");oe("\\varGamma","\\mathit{\\Gamma}");oe("\\varDelta","\\mathit{\\Delta}");oe("\\varTheta","\\mathit{\\Theta}");oe("\\varLambda","\\mathit{\\Lambda}");oe("\\varXi","\\mathit{\\Xi}");oe("\\varPi","\\mathit{\\Pi}");oe("\\varSigma","\\mathit{\\Sigma}");oe("\\varUpsilon","\\mathit{\\Upsilon}");oe("\\varPhi","\\mathit{\\Phi}");oe("\\varPsi","\\mathit{\\Psi}");oe("\\varOmega","\\mathit{\\Omega}");oe("\\substack","\\begin{subarray}{c}#1\\end{subarray}");oe("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");oe("\\boxed","\\fbox{$\\displaystyle{#1}$}");oe("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");oe("\\implies","\\DOTSB\\;\\Longrightarrow\\;");oe("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");oe("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");oe("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var WH={",":"\\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"},uAe=new Set(["bin","rel"]);oe("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in WH?t=WH[n]:(n.slice(0,4)==="\\not"||n in Ui.math&&uAe.has(Ui.math[n].group))&&(t="\\dotsb"),t});var ZD={")":!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};oe("\\dotso",function(e){var t=e.future().text;return t in ZD?"\\ldots\\,":"\\ldots"});oe("\\dotsc",function(e){var t=e.future().text;return t in ZD&&t!==","?"\\ldots\\,":"\\ldots"});oe("\\cdots",function(e){var t=e.future().text;return t in ZD?"\\@cdots\\,":"\\@cdots"});oe("\\dotsb","\\cdots");oe("\\dotsm","\\cdots");oe("\\dotsi","\\!\\cdots");oe("\\dotsx","\\ldots\\,");oe("\\DOTSI","\\relax");oe("\\DOTSB","\\relax");oe("\\DOTSX","\\relax");oe("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");oe("\\,","\\tmspace+{3mu}{.1667em}");oe("\\thinspace","\\,");oe("\\>","\\mskip{4mu}");oe("\\:","\\tmspace+{4mu}{.2222em}");oe("\\medspace","\\:");oe("\\;","\\tmspace+{5mu}{.2777em}");oe("\\thickspace","\\;");oe("\\!","\\tmspace-{3mu}{.1667em}");oe("\\negthinspace","\\!");oe("\\negmedspace","\\tmspace-{4mu}{.2222em}");oe("\\negthickspace","\\tmspace-{5mu}{.277em}");oe("\\enspace","\\kern.5em ");oe("\\enskip","\\hskip.5em\\relax");oe("\\quad","\\hskip1em\\relax");oe("\\qquad","\\hskip2em\\relax");oe("\\tag","\\@ifstar\\tag@literal\\tag@paren");oe("\\tag@paren","\\tag@literal{({#1})}");oe("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new zt("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});oe("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");oe("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");oe("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");oe("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");oe("\\newline","\\\\\\relax");oe("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var tse=Xt(dh["Main-Regular"][84][1]-.7*dh["Main-Regular"][65][1]);oe("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+tse+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");oe("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+tse+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");oe("\\hspace","\\@ifstar\\@hspacer\\@hspace");oe("\\@hspace","\\hskip #1\\relax");oe("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");oe("\\ordinarycolon",":");oe("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");oe("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');oe("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');oe("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');oe("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');oe("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');oe("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');oe("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');oe("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');oe("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');oe("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');oe("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');oe("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');oe("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');oe("∷","\\dblcolon");oe("∹","\\eqcolon");oe("≔","\\coloneqq");oe("≕","\\eqqcolon");oe("⩴","\\Coloneqq");oe("\\ratio","\\vcentcolon");oe("\\coloncolon","\\dblcolon");oe("\\colonequals","\\coloneqq");oe("\\coloncolonequals","\\Coloneqq");oe("\\equalscolon","\\eqqcolon");oe("\\equalscoloncolon","\\Eqqcolon");oe("\\colonminus","\\coloneq");oe("\\coloncolonminus","\\Coloneq");oe("\\minuscolon","\\eqcolon");oe("\\minuscoloncolon","\\Eqcolon");oe("\\coloncolonapprox","\\Colonapprox");oe("\\coloncolonsim","\\Colonsim");oe("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");oe("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");oe("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");oe("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");oe("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");oe("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");oe("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");oe("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");oe("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");oe("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");oe("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");oe("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");oe("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");oe("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");oe("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");oe("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");oe("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");oe("\\nleqq","\\html@mathml{\\@nleqq}{≰}");oe("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");oe("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");oe("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");oe("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");oe("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");oe("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");oe("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");oe("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");oe("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");oe("\\imath","\\html@mathml{\\@imath}{ı}");oe("\\jmath","\\html@mathml{\\@jmath}{ȷ}");oe("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");oe("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");oe("⟦","\\llbracket");oe("⟧","\\rrbracket");oe("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");oe("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");oe("⦃","\\lBrace");oe("⦄","\\rBrace");oe("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");oe("⦵","\\minuso");oe("\\darr","\\downarrow");oe("\\dArr","\\Downarrow");oe("\\Darr","\\Downarrow");oe("\\lang","\\langle");oe("\\rang","\\rangle");oe("\\uarr","\\uparrow");oe("\\uArr","\\Uparrow");oe("\\Uarr","\\Uparrow");oe("\\N","\\mathbb{N}");oe("\\R","\\mathbb{R}");oe("\\Z","\\mathbb{Z}");oe("\\alef","\\aleph");oe("\\alefsym","\\aleph");oe("\\Alpha","\\mathrm{A}");oe("\\Beta","\\mathrm{B}");oe("\\bull","\\bullet");oe("\\Chi","\\mathrm{X}");oe("\\clubs","\\clubsuit");oe("\\cnums","\\mathbb{C}");oe("\\Complex","\\mathbb{C}");oe("\\Dagger","\\ddagger");oe("\\diamonds","\\diamondsuit");oe("\\empty","\\emptyset");oe("\\Epsilon","\\mathrm{E}");oe("\\Eta","\\mathrm{H}");oe("\\exist","\\exists");oe("\\harr","\\leftrightarrow");oe("\\hArr","\\Leftrightarrow");oe("\\Harr","\\Leftrightarrow");oe("\\hearts","\\heartsuit");oe("\\image","\\Im");oe("\\infin","\\infty");oe("\\Iota","\\mathrm{I}");oe("\\isin","\\in");oe("\\Kappa","\\mathrm{K}");oe("\\larr","\\leftarrow");oe("\\lArr","\\Leftarrow");oe("\\Larr","\\Leftarrow");oe("\\lrarr","\\leftrightarrow");oe("\\lrArr","\\Leftrightarrow");oe("\\Lrarr","\\Leftrightarrow");oe("\\Mu","\\mathrm{M}");oe("\\natnums","\\mathbb{N}");oe("\\Nu","\\mathrm{N}");oe("\\Omicron","\\mathrm{O}");oe("\\plusmn","\\pm");oe("\\rarr","\\rightarrow");oe("\\rArr","\\Rightarrow");oe("\\Rarr","\\Rightarrow");oe("\\real","\\Re");oe("\\reals","\\mathbb{R}");oe("\\Reals","\\mathbb{R}");oe("\\Rho","\\mathrm{P}");oe("\\sdot","\\cdot");oe("\\sect","\\S");oe("\\spades","\\spadesuit");oe("\\sub","\\subset");oe("\\sube","\\subseteq");oe("\\supe","\\supseteq");oe("\\Tau","\\mathrm{T}");oe("\\thetasym","\\vartheta");oe("\\weierp","\\wp");oe("\\Zeta","\\mathrm{Z}");oe("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");oe("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");oe("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");oe("\\bra","\\mathinner{\\langle{#1}|}");oe("\\ket","\\mathinner{|{#1}\\rangle}");oe("\\braket","\\mathinner{\\langle{#1}\\rangle}");oe("\\Bra","\\left\\langle#1\\right|");oe("\\Ket","\\left|#1\\right\\rangle");var nse=e=>t=>{var n=t.consumeArg().tokens,s=t.consumeArg().tokens,r=t.consumeArg().tokens,i=t.consumeArg().tokens,o=t.macros.get("|"),l=t.macros.get("\\|");t.macros.beginGroup();var c=f=>m=>{e&&(m.macros.set("|",o),r.length&&m.macros.set("\\|",l));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}};oe("\\bra@ket",nse(!1));oe("\\bra@set",nse(!0));oe("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");oe("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");oe("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");oe("\\angln","{\\angl n}");oe("\\blue","\\textcolor{##6495ed}{#1}");oe("\\orange","\\textcolor{##ffa500}{#1}");oe("\\pink","\\textcolor{##ff00af}{#1}");oe("\\red","\\textcolor{##df0030}{#1}");oe("\\green","\\textcolor{##28ae7b}{#1}");oe("\\gray","\\textcolor{gray}{#1}");oe("\\purple","\\textcolor{##9d38bd}{#1}");oe("\\blueA","\\textcolor{##ccfaff}{#1}");oe("\\blueB","\\textcolor{##80f6ff}{#1}");oe("\\blueC","\\textcolor{##63d9ea}{#1}");oe("\\blueD","\\textcolor{##11accd}{#1}");oe("\\blueE","\\textcolor{##0c7f99}{#1}");oe("\\tealA","\\textcolor{##94fff5}{#1}");oe("\\tealB","\\textcolor{##26edd5}{#1}");oe("\\tealC","\\textcolor{##01d1c1}{#1}");oe("\\tealD","\\textcolor{##01a995}{#1}");oe("\\tealE","\\textcolor{##208170}{#1}");oe("\\greenA","\\textcolor{##b6ffb0}{#1}");oe("\\greenB","\\textcolor{##8af281}{#1}");oe("\\greenC","\\textcolor{##74cf70}{#1}");oe("\\greenD","\\textcolor{##1fab54}{#1}");oe("\\greenE","\\textcolor{##0d923f}{#1}");oe("\\goldA","\\textcolor{##ffd0a9}{#1}");oe("\\goldB","\\textcolor{##ffbb71}{#1}");oe("\\goldC","\\textcolor{##ff9c39}{#1}");oe("\\goldD","\\textcolor{##e07d10}{#1}");oe("\\goldE","\\textcolor{##a75a05}{#1}");oe("\\redA","\\textcolor{##fca9a9}{#1}");oe("\\redB","\\textcolor{##ff8482}{#1}");oe("\\redC","\\textcolor{##f9685d}{#1}");oe("\\redD","\\textcolor{##e84d39}{#1}");oe("\\redE","\\textcolor{##bc2612}{#1}");oe("\\maroonA","\\textcolor{##ffbde0}{#1}");oe("\\maroonB","\\textcolor{##ff92c6}{#1}");oe("\\maroonC","\\textcolor{##ed5fa6}{#1}");oe("\\maroonD","\\textcolor{##ca337c}{#1}");oe("\\maroonE","\\textcolor{##9e034e}{#1}");oe("\\purpleA","\\textcolor{##ddd7ff}{#1}");oe("\\purpleB","\\textcolor{##c6b9fc}{#1}");oe("\\purpleC","\\textcolor{##aa87ff}{#1}");oe("\\purpleD","\\textcolor{##7854ab}{#1}");oe("\\purpleE","\\textcolor{##543b78}{#1}");oe("\\mintA","\\textcolor{##f5f9e8}{#1}");oe("\\mintB","\\textcolor{##edf2df}{#1}");oe("\\mintC","\\textcolor{##e0e5cc}{#1}");oe("\\grayA","\\textcolor{##f6f7f7}{#1}");oe("\\grayB","\\textcolor{##f0f1f2}{#1}");oe("\\grayC","\\textcolor{##e3e5e6}{#1}");oe("\\grayD","\\textcolor{##d6d8da}{#1}");oe("\\grayE","\\textcolor{##babec2}{#1}");oe("\\grayF","\\textcolor{##888d93}{#1}");oe("\\grayG","\\textcolor{##626569}{#1}");oe("\\grayH","\\textcolor{##3b3e40}{#1}");oe("\\grayI","\\textcolor{##21242c}{#1}");oe("\\kaBlue","\\textcolor{##314453}{#1}");oe("\\kaGreen","\\textcolor{##71B307}{#1}");var sse={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class dAe{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 lAe(cAe,n.macros),this.mode=s,this.stack=[]}feed(t){this.lexer=new HH(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 Yc("EOF",s.loc)),this.pushTokens(r),new Yc("",lc.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,l=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++o;else if(i.text==="}"){if(--o,o===-1)throw new zt("Extra }",i)}else if(i.text==="EOF")throw new zt("Unexpected end of input in a macro argument, expected '"+(t&&s?t[l]:"}")+"'",i);if(t&&s)if((o===0||o===1&&t[l]==="{")&&i.text===t[l]){if(++l,l===t.length){n.splice(-l,l);break}}else l=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 zt("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 zt("Use of the macro doesn't match its definition",i)}}for(var o=[],l=0;l<t;l++)o.push(this.consumeArg(n&&n[l+1]).tokens);return o}countExpansion(t){if(this.expansionCount+=t,this.expansionCount>this.settings.maxExpand)throw new zt("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 zt("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 l=i.length-1;l>=0;--l){var c=i[l];if(c.text==="#"){if(l===0)throw new zt("Incomplete placeholder at end of macro body",c);if(c=i[--l],c.text==="#")i.splice(l+1,1);else if(/^[1-9]$/.test(c.text))i.splice(l,2,...o[+c.text-1]);else throw new zt("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 Yc(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 l=new HH(r,this.settings),c=[],u=l.lex();u.text!=="EOF";)c.push(u),u=l.lex();c.reverse();var d={tokens:c,numArgs:i};return d}return r}isDefined(t){return this.macros.has(t)||ip.hasOwnProperty(t)||Ui.math.hasOwnProperty(t)||Ui.text.hasOwnProperty(t)||sse.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:ip.hasOwnProperty(t)&&!ip[t].primitive}}var VH=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,M2=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),LA={"́":{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"}},GH={á:"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 rse=class ise{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 dAe(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 zt("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 Yc("}")),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(ise.endOfExpression.has(r.text)||n&&r.text===n||t&&ip[r.text]&&ip[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 zt("only one infix operator per group",i.token);n=r,s=i.replaceWith}}if(n!==-1&&s){var o,l,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"?l=u[0]:l={type:"ordgroup",mode:this.mode,body:u};var d;return s==="\\\\abovefrac"?d=this.callFunction(s,[o,t[n],l],[]):d=this.callFunction(s,[o,l],[]),[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 zt("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 zt("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(s)throw new zt("Double superscript",i);s=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(r)throw new zt("Double subscript",i);r=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(s)throw new zt("Double superscript",i);var l={type:"textord",mode:this.mode,text:"\\prime"},c=[l];for(this.consume();this.fetch().text==="'";)c.push(l),this.consume();this.fetch().text==="^"&&c.push(this.handleSupSubscript("superscript")),s={type:"ordgroup",mode:this.mode,body:c}}else if(M2[i.text]){var u=VH.test(i.text),d=[];for(d.push(new Yc(M2[i.text])),this.consume();;){var f=this.fetch().text;if(!M2[f]||VH.test(f)!==u)break;d.unshift(new Yc(M2[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=ip[r];if(!i)return null;if(this.consume(),n&&n!=="atom"&&!i.allowedInArgument)throw new zt("Got function '"+r+"' with no arguments"+(n?" as "+n:""),s);if(this.mode==="text"&&!i.allowedInText)throw new zt("Can't use function '"+r+"' in text mode",s);if(this.mode==="math"&&i.allowedInMath===!1)throw new zt("Can't use function '"+r+"' in math mode",s);var{args:o,optArgs:l}=this.parseArguments(r,i);return this.callFunction(r,o,l,s,t)}callFunction(t,n,s,r,i){var o={funcName:t,parser:this,token:r,breakOnTokenText:i},l=ip[t];if(l&&l.handler)return l.handler(o,n,s);throw new zt("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 l=n.argTypes&&n.argTypes[o],c=o<n.numOptionalArgs;("primitive"in n&&n.primitive&&l==null||n.type==="sqrt"&&o===1&&i[0]==null)&&(l="primitive");var u=this.parseGroupOfType("argument to '"+t+"'",l,c);if(c)i.push(u);else if(u!=null)r.push(u);else throw new zt("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 zt("A primitive argument cannot be optional");var o=this.parseGroup(t);if(o==null)throw new zt("Expected group as "+t,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(s);default:throw new zt("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 zt("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 zt("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 zt("Invalid size: '"+n.text+"'",n);var i={number:+(r[1]+r[2]),unit:r[3]};if(!une(i))throw new zt("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 l=this.parseExpression(!1,o),c=this.fetch();this.expect(o),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:lc.range(s,c),body:l,semisimple:r==="\\begingroup"||void 0}}else if(i=this.parseFunction(n,t)||this.parseSymbol(),i==null&&r[0]==="\\"&&!sse.hasOwnProperty(r)){if(this.settings.throwOnError)throw new zt("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 l=t[s+2];s+1<n&&l&&l.type==="textord"&&l.text==="-"?(t.splice(s,3,{type:"textord",mode:"text",loc:lc.range(r,l),text:"---"}),n-=2):(t.splice(s,2,{type:"textord",mode:"text",loc:lc.range(r,o),text:"--"}),n-=1)}(i==="'"||i==="`")&&o.text===i&&(t.splice(s,2,{type:"textord",mode:"text",loc:lc.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 zt(`\\verb assertion failed --
                    please report what input caused this bug`);return s=s.slice(1,-1),{type:"verb",mode:"text",body:s,star:r}}GH.hasOwnProperty(n[0])&&!Ui[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=GH[n[0]]+n.slice(1));var i=oAe.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if(Ui[this.mode][n]){this.settings.strict&&this.mode==="math"&&hI.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var l=Ui[this.mode][n].group,c=lc.range(t),u;E8e(l)?u={type:"atom",mode:this.mode,family:l,loc:c,text:n}:u={type:l,mode:this.mode,loc:c,text:n},o=u}else if(n.charCodeAt(0)>=128)this.settings.strict&&(cne(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:lc.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(!LA[f])throw new zt("Unknown accent ' "+f+"'",t);var m=LA[f][this.mode]||LA[f].text;if(!m)throw new zt("Accent "+f+" unsupported in "+this.mode+" mode",t);o={type:"accent",mode:this.mode,loc:lc.range(t),label:m,isStretchy:!1,isShifty:!0,base:o}}return o}};rse.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var eL=function(t,n){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var s=new rse(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 zt("\\tag works only in display equations");r=[{type:"tag",mode:"text",body:r,tag:s.subparse([new Yc("\\df@tag")])}]}return r},tL=function(t,n,s){n.textContent="";var r=O5(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."),tL=function(){throw new zt("KaTeX doesn't work in quirks mode.")});var ose=function(t,n){var s=O5(t,n).toMarkup();return s},ase=function(t,n){var s=new zD(n);return eL(t,s)},lse=function(t,n,s){if(s.throwOnError||!(t instanceof zt))throw t;var r=Dt(["katex-error"],[new tu(n)]);return r.setAttribute("title",t.toString()),r.setAttribute("style","color:"+s.errorColor),r},O5=function(t,n){var s=new zD(n);try{var r=eL(t,s);return v8e(r,t,s)}catch(i){return lse(i,t,s)}},cse=function(t,n){var s=new zD(n);try{var r=eL(t,s);return w8e(r,t,s)}catch(i){return lse(i,t,s)}},use="0.16.47",dse={Span:_v,Anchor:C5,SymbolNode:tu,SvgNode:Gf,PathNode:Lp,LineNode:dI},EI={version:use,render:tL,renderToString:ose,ParseError:zt,SETTINGS_SCHEMA:jT,__parse:ase,__renderToDomTree:O5,__renderToHTMLTree:cse,__setFontMetrics:mne,__defineSymbol:P,__defineFunction:Cn,__defineMacro:oe,__domTree:dse};const jDt=Object.freeze(Object.defineProperty({__proto__:null,ParseError:zt,SETTINGS_SCHEMA:jT,__defineFunction:Cn,__defineMacro:oe,__defineSymbol:P,__domTree:dse,__parse:ase,__renderToDomTree:O5,__renderToHTMLTree:cse,__setFontMetrics:mne,default:EI,get render(){return tL},renderToString:ose,version:use},Symbol.toStringTag,{value:"Module"})),hAe={};function KH(e){const t=this,n=e||hAe,s=t.data(),r=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);r.push(wEe(n)),i.push(hEe()),o.push(fEe(n))}const YH=/[#.]/g;function fAe(e,t){const n=e||"",s={};let r=0,i,o;for(;r<n.length;){YH.lastIndex=r;const l=YH.exec(n),c=n.slice(r,l?l.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),l&&(i=l[0],r++)}return{type:"element",tagName:o||t||"div",properties:s,children:[]}}function hse(e,t,n){const s=n?bAe(n):void 0;function r(i,o,...l){let c;if(i==null){c={type:"root",children:[]};const u=o;l.unshift(u)}else{c=fAe(i,t);const u=c.tagName.toLowerCase(),d=s?s.get(u):void 0;if(c.tagName=d||u,mAe(o))l.unshift(o);else for(const[f,m]of Object.entries(o))pAe(e,c.properties,f,m)}for(const u of l)AI(c.children,u);return c.type==="element"&&c.tagName==="template"&&(c.content={type:"root",children:c.children},c.children=[]),c}return r}function mAe(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 pAe(e,t,n,s){const r=vD(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=mq(s):r.commaSeparated?i=cq(s):r.commaOrSpaceSeparated?i=mq(cq(s).join(" ")):i=XH(r,r.property,s):Array.isArray(s)?i=[...s]:i=r.property==="style"?gAe(s):String(s);if(Array.isArray(i)){const o=[];for(const l of i)o.push(XH(r,r.property,l));i=o}r.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[r.property]=i}}function AI(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)AI(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?AI(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function XH(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||Tk(n)===Tk(t)))return!0}return n}function gAe(e){const t=[];for(const[n,s]of Object.entries(e))t.push([n,s].join(": "));return t.join("; ")}function bAe(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const yAe=["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"],vAe=hse(wD,"div"),wAe=hse(wv,"g",yAe),PA={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function xAe(e,t){return fse(e,{})||{type:"root",children:[]}}function fse(e,t){const n=kAe(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function kAe(e,t){switch(e.nodeType){case 1:return TAe(e,t);case 3:return SAe(e);case 8:return CAe(e);case 9:return QH(e,t);case 10:return _Ae();case 11:return QH(e,t);default:return}}function QH(e,t){return{type:"root",children:mse(e,t)}}function _Ae(){return{type:"doctype"}}function SAe(e){return{type:"text",value:e.nodeValue||""}}function CAe(e){return{type:"comment",value:e.nodeValue||""}}function TAe(e,t){const n=e.namespaceURI,s=n===PA.svg?wAe:vAe,r=n===PA.html?e.tagName.toLowerCase():e.tagName,i=n===PA.html&&r==="template"?e.content:e,o=e.getAttributeNames(),l={};let c=-1;for(;++c<o.length;)l[o[c]]=e.getAttribute(o[c])||"";return s(r,l,mse(i,t))}function mse(e,t){const n=e.childNodes,s=[];let r=-1;for(;++r<n.length;){const i=fse(n[r],t);i!==void 0&&s.push(i)}return s}new DOMParser;function EAe(e,t){const n=AAe(e);return xAe(n)}function AAe(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const JH=function(e,t,n){const s=j_(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]},p1=function(e){if(e==null)return IAe;if(typeof e=="string")return NAe(e);if(typeof e=="object")return jAe(e);if(typeof e=="function")return nL(e);throw new Error("Expected function, string, or array as `test`")};function jAe(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=p1(e[n]);return nL(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function NAe(e){return nL(t);function t(n){return n.tagName===e}}function nL(e){return t;function t(n,s,r){return!!(MAe(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function IAe(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function MAe(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const ZH=/\n/g,eU=/[\t ]+/g,jI=p1("br"),tU=p1(zAe),RAe=p1("p"),nU=p1("tr"),DAe=p1(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",BAe,FAe]),pse=p1(["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 LAe(e,t){const n=t||{},s="children"in e?e.children:[],r=pse(e),i=yse(e,{whitespace:n.whitespace||"normal"}),o=[];(e.type==="text"||e.type==="comment")&&o.push(...bse(e,{breakBefore:!0,breakAfter:!0}));let l=-1;for(;++l<s.length;)o.push(...gse(s[l],e,{whitespace:i,breakBefore:l?void 0:r,breakAfter:l<s.length-1?jI(s[l+1]):r}));const c=[];let u;for(l=-1;++l<o.length;){const d=o[l];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 gse(e,t,n){return e.type==="element"?PAe(e,t,n):e.type==="text"?n.whitespace==="normal"?bse(e,n):OAe(e):[]}function PAe(e,t,n){const s=yse(e,n),r=e.children||[];let i=-1,o=[];if(DAe(e))return o;let l,c;for(jI(e)||nU(e)&&JH(t,e,nU)?c=`
`:RAe(e)?(l=2,c=2):pse(e)&&(l=1,c=1);++i<r.length;)o=o.concat(gse(r[i],e,{whitespace:s,breakBefore:i?void 0:l,breakAfter:i<r.length-1?jI(r[i+1]):c}));return tU(e)&&JH(t,e,tU)&&o.push("	"),l&&o.unshift(l),c&&o.push(c),o}function bse(e,t){const n=String(e.value),s=[],r=[];let i=0;for(;i<=n.length;){ZH.lastIndex=i;const c=ZH.exec(n),u=c&&"index"in c?c.index:n.length;s.push($Ae(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,l;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]),l=void 0):s[o]?(typeof l=="number"&&r.push(l),r.push(s[o]),l=0):(o===0||o===s.length-1)&&r.push(0);return r}function OAe(e){return[String(e.value)]}function $Ae(e,t,n){const s=[];let r=0,i;for(;r<e.length;){eU.lastIndex=r;const o=eU.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 yse(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 BAe(e){return!!(e.properties||{}).hidden}function zAe(e){return e.tagName==="td"||e.tagName==="th"}function FAe(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const qAe={},HAe=[];function sU(e){const t=e||qAe;return function(n,s){RD(n,"element",function(r,i){const o=Array.isArray(r.properties.className)?r.properties.className:HAe,l=o.includes("language-math"),c=o.includes("math-display"),u=o.includes("math-inline");let d=c;if(!l&&!c&&!u)return;let f=i[i.length-1],m=r;if(r.tagName==="code"&&l&&f&&f.type==="element"&&f.tagName==="pre"&&(m=f,f=i[i.length-2],d=!0),!f)return;const p=LAe(m,{whitespace:"pre"});let g;try{g=EI.renderToString(p,{...t,displayMode:d,throwOnError:!0})}catch(w){const y=w,v=y.name.toLowerCase();s.message("Could not render math with KaTeX",{ancestors:[...i,r],cause:y,place:r.position,ruleId:v,source:"rehype-katex"});try{g=EI.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(w)},children:[{type:"text",value:p}]}]}}typeof g=="string"&&(g=EAe(g).children);const b=f.children.indexOf(m);return f.children.splice(b,1,...g),Ate})}}const vse=[{id:"abap",name:"ABAP",import:()=>ye(()=>import("./abap-DsBKuouk.js"),[])},{id:"actionscript-3",name:"ActionScript",import:()=>ye(()=>import("./actionscript-3-D_z4Izcz.js"),[])},{id:"ada",name:"Ada",import:()=>ye(()=>import("./ada-727ZlQH0.js"),[])},{id:"angular-html",name:"Angular HTML",import:()=>ye(()=>import("./angular-html-LfdN0zeE.js").then(e=>e.f),__vite__mapDeps([0,1,2,3]))},{id:"angular-ts",name:"Angular TypeScript",import:()=>ye(()=>import("./angular-ts-CKsD7JZE.js"),__vite__mapDeps([4,0,1,2,3,5]))},{id:"apache",name:"Apache Conf",import:()=>ye(()=>import("./apache-Dn00JSTd.js"),[])},{id:"apex",name:"Apex",import:()=>ye(()=>import("./apex-COJ4H7py.js"),[])},{id:"apl",name:"APL",import:()=>ye(()=>import("./apl-BBq3IX1j.js"),__vite__mapDeps([6,1,2,3,7,8,9]))},{id:"applescript",name:"AppleScript",import:()=>ye(()=>import("./applescript-Bu5BbsvL.js"),[])},{id:"ara",name:"Ara",import:()=>ye(()=>import("./ara-7O62HKoU.js"),[])},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>ye(()=>import("./asciidoc-BPT9niGB.js"),[])},{id:"asm",name:"Assembly",import:()=>ye(()=>import("./asm-Dhn9LcZ4.js"),[])},{id:"astro",name:"Astro",import:()=>ye(()=>import("./astro-CqkE3fuf.js"),__vite__mapDeps([10,9,2,11,3,12]))},{id:"awk",name:"AWK",import:()=>ye(()=>import("./awk-eg146-Ew.js"),[])},{id:"ballerina",name:"Ballerina",import:()=>ye(()=>import("./ballerina-Du268qiB.js"),[])},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>ye(()=>import("./bat-fje9CFhw.js"),[])},{id:"beancount",name:"Beancount",import:()=>ye(()=>import("./beancount-BwXTMy5W.js"),[])},{id:"berry",name:"Berry",aliases:["be"],import:()=>ye(()=>import("./berry-3xVqZejG.js"),[])},{id:"bibtex",name:"BibTeX",import:()=>ye(()=>import("./bibtex-xW4inM5L.js"),[])},{id:"bicep",name:"Bicep",import:()=>ye(()=>import("./bicep-DHo0CJ0O.js"),[])},{id:"blade",name:"Blade",import:()=>ye(()=>import("./blade-a8OxSdnT.js"),__vite__mapDeps([13,1,2,3,7,8,14,9]))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>ye(()=>import("./bsl-Dgyn0ogV.js"),__vite__mapDeps([15,16]))},{id:"c",name:"C",import:()=>ye(()=>import("./c-C3t2pwGQ.js"),[])},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>ye(()=>import("./cadence-DNquZEk8.js"),[])},{id:"cairo",name:"Cairo",import:()=>ye(()=>import("./cairo--RitsXJZ.js"),__vite__mapDeps([17,18]))},{id:"clarity",name:"Clarity",import:()=>ye(()=>import("./clarity-BHOwM8T6.js"),[])},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>ye(()=>import("./clojure-DxSadP1t.js"),[])},{id:"cmake",name:"CMake",import:()=>ye(()=>import("./cmake-DbXoA79R.js"),[])},{id:"cobol",name:"COBOL",import:()=>ye(()=>import("./cobol-PTqiYgYu.js"),__vite__mapDeps([19,1,2,3,8]))},{id:"codeowners",name:"CODEOWNERS",import:()=>ye(()=>import("./codeowners-Bp6g37R7.js"),[])},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>ye(()=>import("./codeql-sacFqUAJ.js"),[])},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>ye(()=>import("./coffee-dyiR41kL.js"),__vite__mapDeps([20,2]))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>ye(()=>import("./common-lisp-C7gG9l05.js"),[])},{id:"coq",name:"Coq",import:()=>ye(()=>import("./coq-Dsg_Bt_b.js"),[])},{id:"cpp",name:"C++",aliases:["c++"],import:()=>ye(()=>import("./cpp-BksuvNSY.js"),__vite__mapDeps([21,22,23,24,14]))},{id:"crystal",name:"Crystal",import:()=>ye(()=>import("./crystal-DtDmRg-F.js"),__vite__mapDeps([25,1,2,3,14,24,26]))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>ye(()=>import("./csharp-D9R-vmeu.js"),[])},{id:"css",name:"CSS",import:()=>ye(()=>import("./css-BPhBrDlE.js"),[])},{id:"csv",name:"CSV",import:()=>ye(()=>import("./csv-B0qRVHPH.js"),[])},{id:"cue",name:"CUE",import:()=>ye(()=>import("./cue-DtFQj3wx.js"),[])},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>ye(()=>import("./cypher-m2LEI-9-.js"),[])},{id:"d",name:"D",import:()=>ye(()=>import("./d-BoXegm-a.js"),[])},{id:"dart",name:"Dart",import:()=>ye(()=>import("./dart-B9wLZaAG.js"),[])},{id:"dax",name:"DAX",import:()=>ye(()=>import("./dax-ClGRhx96.js"),[])},{id:"desktop",name:"Desktop",import:()=>ye(()=>import("./desktop-DEIpsLCJ.js"),[])},{id:"diff",name:"Diff",import:()=>ye(()=>import("./diff-BgYniUM_.js"),[])},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>ye(()=>import("./docker-COcR7UxN.js"),[])},{id:"dotenv",name:"dotEnv",import:()=>ye(()=>import("./dotenv-BjQB5zDj.js"),[])},{id:"dream-maker",name:"Dream Maker",import:()=>ye(()=>import("./dream-maker-C-nORZOA.js"),[])},{id:"edge",name:"Edge",import:()=>ye(()=>import("./edge-D5gP-w-T.js"),__vite__mapDeps([27,11,1,2,3,28]))},{id:"elixir",name:"Elixir",import:()=>ye(()=>import("./elixir-CLiX3zqd.js"),__vite__mapDeps([29,1,2,3]))},{id:"elm",name:"Elm",import:()=>ye(()=>import("./elm-CmHSxxaM.js"),__vite__mapDeps([30,23,24]))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>ye(()=>import("./emacs-lisp-BX77sIaO.js"),[])},{id:"erb",name:"ERB",import:()=>ye(()=>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:()=>ye(()=>import("./erlang-B-DoSBHF.js"),[])},{id:"fennel",name:"Fennel",import:()=>ye(()=>import("./fennel-bCA53EVm.js"),[])},{id:"fish",name:"Fish",import:()=>ye(()=>import("./fish-w-ucz2PV.js"),[])},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>ye(()=>import("./fluent-Dayu4EKP.js"),[])},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>ye(()=>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:()=>ye(()=>import("./fortran-free-form-DKXYxT9g.js"),[])},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>ye(()=>import("./fsharp-XplgxFYe.js"),__vite__mapDeps([41,42]))},{id:"gdresource",name:"GDResource",import:()=>ye(()=>import("./gdresource-BHYsBjWJ.js"),__vite__mapDeps([43,44,45]))},{id:"gdscript",name:"GDScript",import:()=>ye(()=>import("./gdscript-DfxzS6Rs.js"),[])},{id:"gdshader",name:"GDShader",import:()=>ye(()=>import("./gdshader-SKMF96pI.js"),[])},{id:"genie",name:"Genie",import:()=>ye(()=>import("./genie-ajMbGru0.js"),[])},{id:"gherkin",name:"Gherkin",import:()=>ye(()=>import("./gherkin--30QC5Em.js"),[])},{id:"git-commit",name:"Git Commit Message",import:()=>ye(()=>import("./git-commit-i4q6IMui.js"),__vite__mapDeps([46,47]))},{id:"git-rebase",name:"Git Rebase Message",import:()=>ye(()=>import("./git-rebase-B-v9cOL2.js"),__vite__mapDeps([48,26]))},{id:"gleam",name:"Gleam",import:()=>ye(()=>import("./gleam-B430Bg39.js"),[])},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>ye(()=>import("./glimmer-js-D-cwc0-E.js"),__vite__mapDeps([49,2,11,3,1]))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>ye(()=>import("./glimmer-ts-pgjy16dm.js"),__vite__mapDeps([50,11,3,2,1]))},{id:"glsl",name:"GLSL",import:()=>ye(()=>import("./glsl-DBO2IWDn.js"),__vite__mapDeps([23,24]))},{id:"gnuplot",name:"Gnuplot",import:()=>ye(()=>import("./gnuplot-CM8KxXT1.js"),[])},{id:"go",name:"Go",import:()=>ye(()=>import("./go-B1SYOhNW.js"),[])},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>ye(()=>import("./graphql-cDcHW_If.js"),__vite__mapDeps([34,2,11,35,36]))},{id:"groovy",name:"Groovy",import:()=>ye(()=>import("./groovy-DkBy-JyN.js"),[])},{id:"hack",name:"Hack",import:()=>ye(()=>import("./hack-D1yCygmZ.js"),__vite__mapDeps([51,1,2,3,14]))},{id:"haml",name:"Ruby Haml",import:()=>ye(()=>import("./haml-B2EZWmdv.js"),__vite__mapDeps([33,2,3]))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>ye(()=>import("./handlebars-BQGss363.js"),__vite__mapDeps([52,1,2,3,38]))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>ye(()=>import("./haskell-BILxekzW.js"),[])},{id:"haxe",name:"Haxe",import:()=>ye(()=>import("./haxe-C5wWYbrZ.js"),[])},{id:"hcl",name:"HashiCorp HCL",import:()=>ye(()=>import("./hcl-HzYwdGDm.js"),[])},{id:"hjson",name:"Hjson",import:()=>ye(()=>import("./hjson-T-Tgc4AT.js"),[])},{id:"hlsl",name:"HLSL",import:()=>ye(()=>import("./hlsl-ifBTmRxC.js"),[])},{id:"html",name:"HTML",import:()=>ye(()=>import("./html-C2L_23MC.js"),__vite__mapDeps([1,2,3]))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>ye(()=>import("./html-derivative-CSfWNPLT.js"),__vite__mapDeps([28,1,2,3]))},{id:"http",name:"HTTP",import:()=>ye(()=>import("./http-FRrOvY1W.js"),__vite__mapDeps([53,26,9,7,8,34,2,11,35,36]))},{id:"hxml",name:"HXML",import:()=>ye(()=>import("./hxml-TIA70rKU.js"),__vite__mapDeps([54,55]))},{id:"hy",name:"Hy",import:()=>ye(()=>import("./hy-BMj5Y0dO.js"),[])},{id:"imba",name:"Imba",import:()=>ye(()=>import("./imba-bv_oIlVt.js"),__vite__mapDeps([56,11]))},{id:"ini",name:"INI",aliases:["properties"],import:()=>ye(()=>import("./ini-BjABl1g7.js"),[])},{id:"java",name:"Java",import:()=>ye(()=>import("./java-xI-RfyKK.js"),[])},{id:"javascript",name:"JavaScript",aliases:["js"],import:()=>ye(()=>import("./javascript-ySlJ1b_l.js"),[])},{id:"jinja",name:"Jinja",import:()=>ye(()=>import("./jinja-DGy0s7-h.js"),__vite__mapDeps([57,1,2,3]))},{id:"jison",name:"Jison",import:()=>ye(()=>import("./jison-BqZprYcd.js"),__vite__mapDeps([58,2]))},{id:"json",name:"JSON",import:()=>ye(()=>import("./json-BQoSv7ci.js"),[])},{id:"json5",name:"JSON5",import:()=>ye(()=>import("./json5-w8dY5SsB.js"),[])},{id:"jsonc",name:"JSON with Comments",import:()=>ye(()=>import("./jsonc-TU54ms6u.js"),[])},{id:"jsonl",name:"JSON Lines",import:()=>ye(()=>import("./jsonl-DREVFZK8.js"),[])},{id:"jsonnet",name:"Jsonnet",import:()=>ye(()=>import("./jsonnet-BfivnA6A.js"),[])},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>ye(()=>import("./jssm-P4WzXJd0.js"),[])},{id:"jsx",name:"JSX",import:()=>ye(()=>import("./jsx-BAng5TT0.js"),[])},{id:"julia",name:"Julia",aliases:["jl"],import:()=>ye(()=>import("./julia-BBuGR-5E.js"),__vite__mapDeps([59,21,22,23,24,14,18,2,60]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>ye(()=>import("./kotlin-B5lbUyaz.js"),[])},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>ye(()=>import("./kusto-mebxcVVE.js"),[])},{id:"latex",name:"LaTeX",import:()=>ye(()=>import("./latex-C-cWTeAZ.js"),__vite__mapDeps([61,62,60]))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>ye(()=>import("./lean-XBlWyCtg.js"),[])},{id:"less",name:"Less",import:()=>ye(()=>import("./less-BfCpw3nA.js"),[])},{id:"liquid",name:"Liquid",import:()=>ye(()=>import("./liquid-D3W5UaiH.js"),__vite__mapDeps([63,1,2,3,9]))},{id:"log",name:"Log file",import:()=>ye(()=>import("./log-Cc5clBb7.js"),[])},{id:"logo",name:"Logo",import:()=>ye(()=>import("./logo-IuBKFhSY.js"),[])},{id:"lua",name:"Lua",import:()=>ye(()=>import("./lua-CvWAzNxB.js"),__vite__mapDeps([37,24]))},{id:"luau",name:"Luau",import:()=>ye(()=>import("./luau-Du5NY7AG.js"),[])},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>ye(()=>import("./make-Bvotw-X0.js"),[])},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>ye(()=>import("./markdown-UIAJJxZW.js"),[])},{id:"marko",name:"Marko",import:()=>ye(()=>import("./marko-z0MBrx5-.js"),__vite__mapDeps([64,3,65,5,2]))},{id:"matlab",name:"MATLAB",import:()=>ye(()=>import("./matlab-D9-PGadD.js"),[])},{id:"mdc",name:"MDC",import:()=>ye(()=>import("./mdc-DB_EDNY_.js"),__vite__mapDeps([66,42,38,28,1,2,3]))},{id:"mdx",name:"MDX",import:()=>ye(()=>import("./mdx-sdHcTMYB.js"),[])},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>ye(()=>import("./mermaid-Ci6OQyBP.js"),[])},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>ye(()=>import("./mipsasm-BC5c_5Pe.js"),[])},{id:"mojo",name:"Mojo",import:()=>ye(()=>import("./mojo-Tz6hzZYG.js"),[])},{id:"move",name:"Move",import:()=>ye(()=>import("./move-DB_GagMm.js"),[])},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>ye(()=>import("./narrat-DLbgOhZU.js"),[])},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>ye(()=>import("./nextflow-B0XVJmRM.js"),[])},{id:"nginx",name:"Nginx",import:()=>ye(()=>import("./nginx-D_VnBJ67.js"),__vite__mapDeps([67,37,24]))},{id:"nim",name:"Nim",import:()=>ye(()=>import("./nim-ZlGxZxc3.js"),__vite__mapDeps([68,24,1,2,3,7,8,23,42]))},{id:"nix",name:"Nix",import:()=>ye(()=>import("./nix-shcSOmrb.js"),[])},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>ye(()=>import("./nushell-D4Tzg5kh.js"),[])},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>ye(()=>import("./objective-c-Deuh7S70.js"),[])},{id:"objective-cpp",name:"Objective-C++",import:()=>ye(()=>import("./objective-cpp-BUEGK8hf.js"),[])},{id:"ocaml",name:"OCaml",import:()=>ye(()=>import("./ocaml-BNioltXt.js"),[])},{id:"pascal",name:"Pascal",import:()=>ye(()=>import("./pascal-JqZropPD.js"),[])},{id:"perl",name:"Perl",import:()=>ye(()=>import("./perl-CHQXSrWU.js"),__vite__mapDeps([69,1,2,3,7,8,14]))},{id:"php",name:"PHP",import:()=>ye(()=>import("./php-B5ebYQev.js"),__vite__mapDeps([70,1,2,3,7,8,14,9]))},{id:"plsql",name:"PL/SQL",import:()=>ye(()=>import("./plsql-LKU2TuZ1.js"),[])},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>ye(()=>import("./po-BFLt1xDp.js"),[])},{id:"polar",name:"Polar",import:()=>ye(()=>import("./polar-DKykz6zU.js"),[])},{id:"postcss",name:"PostCSS",import:()=>ye(()=>import("./postcss-B3ZDOciz.js"),[])},{id:"powerquery",name:"PowerQuery",import:()=>ye(()=>import("./powerquery-CSHBycmS.js"),[])},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>ye(()=>import("./powershell-BIEUsx6d.js"),[])},{id:"prisma",name:"Prisma",import:()=>ye(()=>import("./prisma-B48N-Iqd.js"),[])},{id:"prolog",name:"Prolog",import:()=>ye(()=>import("./prolog-BY-TUvya.js"),[])},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>ye(()=>import("./proto-zocC4JxJ.js"),[])},{id:"pug",name:"Pug",aliases:["jade"],import:()=>ye(()=>import("./pug-CM9l7STV.js"),__vite__mapDeps([71,2,3,1]))},{id:"puppet",name:"Puppet",import:()=>ye(()=>import("./puppet-Cza_XSSt.js"),[])},{id:"purescript",name:"PureScript",import:()=>ye(()=>import("./purescript-Bg-kzb6g.js"),[])},{id:"python",name:"Python",aliases:["py"],import:()=>ye(()=>import("./python-DhUJRlN_.js"),[])},{id:"qml",name:"QML",import:()=>ye(()=>import("./qml-D8XfuvdV.js"),__vite__mapDeps([72,2]))},{id:"qmldir",name:"QML Directory",import:()=>ye(()=>import("./qmldir-C8lEn-DE.js"),[])},{id:"qss",name:"Qt Style Sheets",import:()=>ye(()=>import("./qss-DhMKtDLN.js"),[])},{id:"r",name:"R",import:()=>ye(()=>import("./r-CwjWoCRV.js"),[])},{id:"racket",name:"Racket",import:()=>ye(()=>import("./racket-CzouJOBO.js"),[])},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>ye(()=>import("./raku-B1bQXN8T.js"),[])},{id:"razor",name:"ASP.NET Razor",import:()=>ye(()=>import("./razor-CNLDkMZG.js"),__vite__mapDeps([73,1,2,3,74]))},{id:"reg",name:"Windows Registry Script",import:()=>ye(()=>import("./reg-5LuOXUq_.js"),[])},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>ye(()=>import("./regexp-DWJ3fJO_.js"),[])},{id:"rel",name:"Rel",import:()=>ye(()=>import("./rel-DJlmqQ1C.js"),[])},{id:"riscv",name:"RISC-V",import:()=>ye(()=>import("./riscv-QhoSD0DR.js"),[])},{id:"rst",name:"reStructuredText",import:()=>ye(()=>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:()=>ye(()=>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:()=>ye(()=>import("./rust-Be6lgOlo.js"),[])},{id:"sas",name:"SAS",import:()=>ye(()=>import("./sas-BmTFh92c.js"),__vite__mapDeps([77,14]))},{id:"sass",name:"Sass",import:()=>ye(()=>import("./sass-BJ4Li9vH.js"),[])},{id:"scala",name:"Scala",import:()=>ye(()=>import("./scala-DQVVAn-B.js"),[])},{id:"scheme",name:"Scheme",import:()=>ye(()=>import("./scheme-BJGe-b2p.js"),[])},{id:"scss",name:"SCSS",import:()=>ye(()=>import("./scss-C31hgJw-.js"),__vite__mapDeps([5,3]))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>ye(()=>import("./sdbl-BLhTXw86.js"),[])},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>ye(()=>import("./shaderlab-B7qAK45m.js"),__vite__mapDeps([78,79]))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>ye(()=>import("./shellscript-atvbtKCR.js"),[])},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>ye(()=>import("./shellsession-C_rIy8kc.js"),__vite__mapDeps([80,26]))},{id:"smalltalk",name:"Smalltalk",import:()=>ye(()=>import("./smalltalk-DkLiglaE.js"),[])},{id:"solidity",name:"Solidity",import:()=>ye(()=>import("./solidity-C1w2a3ep.js"),[])},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>ye(()=>import("./soy-C-lX7w71.js"),__vite__mapDeps([81,1,2,3]))},{id:"sparql",name:"SPARQL",import:()=>ye(()=>import("./sparql-bYkjHRlG.js"),__vite__mapDeps([82,83]))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>ye(()=>import("./splunk-Cf8iN4DR.js"),[])},{id:"sql",name:"SQL",import:()=>ye(()=>import("./sql-COK4E0Yg.js"),[])},{id:"ssh-config",name:"SSH Config",import:()=>ye(()=>import("./ssh-config-BknIz3MU.js"),[])},{id:"stata",name:"Stata",import:()=>ye(()=>import("./stata-DorPZHa4.js"),__vite__mapDeps([84,14]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>ye(()=>import("./stylus-BeQkCIfX.js"),[])},{id:"svelte",name:"Svelte",import:()=>ye(()=>import("./svelte-MSaWC3Je.js"),__vite__mapDeps([85,2,11,3,12]))},{id:"swift",name:"Swift",import:()=>ye(()=>import("./swift-BSxZ-RaX.js"),[])},{id:"system-verilog",name:"SystemVerilog",import:()=>ye(()=>import("./system-verilog-C7L56vO4.js"),[])},{id:"systemd",name:"Systemd Units",import:()=>ye(()=>import("./systemd-CUnW07Te.js"),[])},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>ye(()=>import("./talonscript-C1XDQQGZ.js"),[])},{id:"tasl",name:"Tasl",import:()=>ye(()=>import("./tasl-CQjiPCtT.js"),[])},{id:"tcl",name:"Tcl",import:()=>ye(()=>import("./tcl-DQ1-QYvQ.js"),[])},{id:"templ",name:"Templ",import:()=>ye(()=>import("./templ-dwX3ZSMB.js"),__vite__mapDeps([86,87,2,3]))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>ye(()=>import("./terraform-BbSNqyBO.js"),[])},{id:"tex",name:"TeX",import:()=>ye(()=>import("./tex-rYs2v40G.js"),__vite__mapDeps([62,60]))},{id:"toml",name:"TOML",import:()=>ye(()=>import("./toml-CB2ApiWb.js"),[])},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>ye(()=>import("./ts-tags-CipyTH0X.js"),__vite__mapDeps([88,11,3,2,23,24,1,14,7,8]))},{id:"tsv",name:"TSV",import:()=>ye(()=>import("./tsv-B_m7g4N7.js"),[])},{id:"tsx",name:"TSX",import:()=>ye(()=>import("./tsx-B6W0miNI.js"),[])},{id:"turtle",name:"Turtle",import:()=>ye(()=>import("./turtle-BMR_PYu6.js"),[])},{id:"twig",name:"Twig",import:()=>ye(()=>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:()=>ye(()=>import("./typescript-Dj6nwHGl.js"),[])},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>ye(()=>import("./typespec-BpWG_bgh.js"),[])},{id:"typst",name:"Typst",aliases:["typ"],import:()=>ye(()=>import("./typst-BVUVsWT6.js"),[])},{id:"v",name:"V",import:()=>ye(()=>import("./v-CAQ2eGtk.js"),[])},{id:"vala",name:"Vala",import:()=>ye(()=>import("./vala-BFOHcciG.js"),[])},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>ye(()=>import("./vb-CdO5JTpU.js"),[])},{id:"verilog",name:"Verilog",import:()=>ye(()=>import("./verilog-CJaU5se_.js"),[])},{id:"vhdl",name:"VHDL",import:()=>ye(()=>import("./vhdl-DYoNaHQp.js"),[])},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>ye(()=>import("./viml-m4uW47V2.js"),[])},{id:"vue",name:"Vue",import:()=>ye(()=>import("./vue-BuYVFjOK.js"),__vite__mapDeps([90,1,2,3,11,9,28]))},{id:"vue-html",name:"Vue HTML",import:()=>ye(()=>import("./vue-html-xdeiXROB.js"),__vite__mapDeps([91,90,1,2,3,11,9,28]))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>ye(()=>import("./vyper-nyqBNV6O.js"),[])},{id:"wasm",name:"WebAssembly",import:()=>ye(()=>import("./wasm-C6j12Q_x.js"),[])},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>ye(()=>import("./wenyan-7A4Fjokl.js"),[])},{id:"wgsl",name:"WGSL",import:()=>ye(()=>import("./wgsl-CB0Krxn9.js"),[])},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>ye(()=>import("./wikitext-DCE3LsBG.js"),[])},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>ye(()=>import("./wolfram-C3FkfJm5.js"),[])},{id:"xml",name:"XML",import:()=>ye(()=>import("./xml-e3z08dGr.js"),__vite__mapDeps([7,8]))},{id:"xsl",name:"XSL",import:()=>ye(()=>import("./xsl-Dd0NUgwM.js"),__vite__mapDeps([92,7,8]))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>ye(()=>import("./yaml-CVw76BM1.js"),[])},{id:"zenscript",name:"ZenScript",import:()=>ye(()=>import("./zenscript-HnGAYVZD.js"),[])},{id:"zig",name:"Zig",import:()=>ye(()=>import("./zig-BVz_zdnA.js"),[])}],UAe=Object.fromEntries(vse.map(e=>[e.id,e.import])),WAe=Object.fromEntries(vse.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),VAe={...UAe,...WAe},GAe=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>ye(()=>import("./andromeeda-C3khCPGq.js"),[])},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>ye(()=>import("./aurora-x-D-2ljcwZ.js"),[])},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>ye(()=>import("./ayu-dark-Cv9koXgw.js"),[])},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>ye(()=>import("./catppuccin-frappe-CD_QflpE.js"),[])},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>ye(()=>import("./catppuccin-latte-DRW-0cLl.js"),[])},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>ye(()=>import("./catppuccin-macchiato-C-_shW-Y.js"),[])},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>ye(()=>import("./catppuccin-mocha-LGGdnPYs.js"),[])},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>ye(()=>import("./dark-plus-C3mMm8J8.js"),[])},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>ye(()=>import("./dracula-BzJJZx-M.js"),[])},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>ye(()=>import("./dracula-soft-BXkSAIEj.js"),[])},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>ye(()=>import("./everforest-dark-BgDCqdQA.js"),[])},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>ye(()=>import("./everforest-light-C8M2exoo.js"),[])},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>ye(()=>import("./github-dark-DHJKELXO.js"),[])},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>ye(()=>import("./github-dark-default-Cuk6v7N8.js"),[])},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>ye(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[])},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>ye(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[])},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>ye(()=>import("./github-light-DAi9KRSo.js"),[])},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>ye(()=>import("./github-light-default-D7oLnXFd.js"),[])},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>ye(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[])},{id:"houston",displayName:"Houston",type:"dark",import:()=>ye(()=>import("./houston-DnULxvSX.js"),[])},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>ye(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[])},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>ye(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[])},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>ye(()=>import("./kanagawa-wave-DWedfzmr.js"),[])},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>ye(()=>import("./laserwave-DUszq2jm.js"),[])},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>ye(()=>import("./light-plus-B7mTdjB0.js"),[])},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>ye(()=>import("./material-theme-D5KoaKCx.js"),[])},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>ye(()=>import("./material-theme-darker-BfHTSMKl.js"),[])},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>ye(()=>import("./material-theme-lighter-B0m2ddpp.js"),[])},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>ye(()=>import("./material-theme-ocean-CyktbL80.js"),[])},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>ye(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[])},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>ye(()=>import("./min-dark-CafNBF8u.js"),[])},{id:"min-light",displayName:"Min Light",type:"light",import:()=>ye(()=>import("./min-light-CTRr51gU.js"),[])},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>ye(()=>import("./monokai-D4h5O-jR.js"),[])},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>ye(()=>import("./night-owl-C39BiMTA.js"),[])},{id:"nord",displayName:"Nord",type:"dark",import:()=>ye(()=>import("./nord-Ddv68eIx.js"),[])},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>ye(()=>import("./one-dark-pro-GBQ2dnAY.js"),[])},{id:"one-light",displayName:"One Light",type:"light",import:()=>ye(()=>import("./one-light-PoHY5YXO.js"),[])},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>ye(()=>import("./plastic-3e1v2bzS.js"),[])},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>ye(()=>import("./poimandres-CS3Unz2-.js"),[])},{id:"red",displayName:"Red",type:"dark",import:()=>ye(()=>import("./red-bN70gL4F.js"),[])},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>ye(()=>import("./rose-pine-CmCqftbK.js"),[])},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>ye(()=>import("./rose-pine-dawn-Ds-gbosJ.js"),[])},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>ye(()=>import("./rose-pine-moon-CjDtw9vr.js"),[])},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>ye(()=>import("./slack-dark-BthQWCQV.js"),[])},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>ye(()=>import("./slack-ochin-DqwNpetd.js"),[])},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>ye(()=>import("./snazzy-light-Bw305WKR.js"),[])},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>ye(()=>import("./solarized-dark-DXbdFlpD.js"),[])},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>ye(()=>import("./solarized-light-L9t79GZl.js"),[])},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>ye(()=>import("./synthwave-84-CbfX1IO0.js"),[])},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>ye(()=>import("./tokyo-night-DBQeEorK.js"),[])},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>ye(()=>import("./vesper-BEBZ7ncR.js"),[])},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>ye(()=>import("./vitesse-black-Bkuqu6BP.js"),[])},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>ye(()=>import("./vitesse-dark-D0r3Knsf.js"),[])},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>ye(()=>import("./vitesse-light-CVO1_9PV.js"),[])}],KAe=Object.fromEntries(GAe.map(e=>[e.id,e.import]));let If=class extends Error{constructor(t){super(t),this.name="ShikiError"}},sL=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function YAe(){return 2147483648}function XAe(){return typeof performance<"u"?performance.now():Date.now()}const QAe=(e,t)=>e+(t-e%t)%t;async function JAe(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 l(p){const g=s.HEAPU8.length;p=p>>>0;const b=YAe();if(p>b)return!1;for(let w=1;w<=4;w*=2){let y=g*(1+.2/w);y=Math.min(y,p+100663296);const v=Math.min(b,QAe(Math.max(p,y),65536));if(o(v))return!0}return!1}const c=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function u(p,g,b=1024){const w=g+b;let y=g;for(;p[y]&&!(y>=w);)++y;if(y-g>16&&p.buffer&&c)return c.decode(p.subarray(g,y));let v="";for(;g<y;){let x=p[g++];if(!(x&128)){v+=String.fromCharCode(x);continue}const k=p[g++]&63;if((x&224)===192){v+=String.fromCharCode((x&31)<<6|k);continue}const _=p[g++]&63;if((x&240)===224?x=(x&15)<<12|k<<6|_:x=(x&7)<<18|k<<12|_<<6|p[g++]&63,x<65536)v+=String.fromCharCode(x);else{const T=x-65536;v+=String.fromCharCode(55296|T>>10,56320|T&1023)}}return v}function d(p,g){return p?u(s.HEAPU8,p,g):""}const f={emscripten_get_now:XAe,emscripten_memcpy_big:i,emscripten_resize_heap:l,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 ZAe=Object.defineProperty,eje=(e,t,n)=>t in e?ZAe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ca=(e,t,n)=>(eje(e,typeof t!="symbol"?t+"":t,n),n);let Ia=null;function tje(e){throw new sL(e.UTF8ToString(e.getLastOnigError()))}class $5{constructor(t){ca(this,"utf16Length"),ca(this,"utf8Length"),ca(this,"utf16Value"),ca(this,"utf8Value"),ca(this,"utf16OffsetToUtf8"),ca(this,"utf8OffsetToUtf16");const n=t.length,s=$5._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 l=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?l[c++]=f:f<=2047?(l[c++]=192|(f&1984)>>>6,l[c++]=128|(f&63)>>>0):f<=65535?(l[c++]=224|(f&61440)>>>12,l[c++]=128|(f&4032)>>>6,l[c++]=128|(f&63)>>>0):(l[c++]=240|(f&1835008)>>>18,l[c++]=128|(f&258048)>>>12,l[c++]=128|(f&4032)>>>6,l[c++]=128|(f&63)>>>0),m&&u++}this.utf16Length=n,this.utf8Length=s,this.utf16Value=t,this.utf8Value=l,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,l=!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,l=!0)}o<=127?n+=1:o<=2047?n+=2:o<=65535?n+=3:n+=4,l&&s++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const Vd=class{constructor(e){if(ca(this,"id",++Vd.LAST_ID),ca(this,"_onigBinding"),ca(this,"content"),ca(this,"utf16Length"),ca(this,"utf8Length"),ca(this,"utf16OffsetToUtf8"),ca(this,"utf8OffsetToUtf16"),ca(this,"ptr"),!Ia)throw new sL("Must invoke loadWasm first.");this._onigBinding=Ia,this.content=e;const t=new $5(e);this.utf16Length=t.utf16Length,this.utf8Length=t.utf8Length,this.utf16OffsetToUtf8=t.utf16OffsetToUtf8,this.utf8OffsetToUtf16=t.utf8OffsetToUtf16,this.utf8Length<1e4&&!Vd._sharedPtrInUse?(Vd._sharedPtr||(Vd._sharedPtr=Ia.omalloc(1e4)),Vd._sharedPtrInUse=!0,Ia.HEAPU8.set(t.utf8Value,Vd._sharedPtr),this.ptr=Vd._sharedPtr):this.ptr=t.createString(Ia)}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===Vd._sharedPtr?Vd._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let R_=Vd;ca(R_,"LAST_ID",0);ca(R_,"_sharedPtr",0);ca(R_,"_sharedPtrInUse",!1);class nje{constructor(t){if(ca(this,"_onigBinding"),ca(this,"_ptr"),!Ia)throw new sL("Must invoke loadWasm first.");const n=[],s=[];for(let l=0,c=t.length;l<c;l++){const u=new $5(t[l]);n[l]=u.createString(Ia),s[l]=u.utf8Length}const r=Ia.omalloc(4*t.length);Ia.HEAPU32.set(n,r/4);const i=Ia.omalloc(4*t.length);Ia.HEAPU32.set(s,i/4);const o=Ia.createOnigScanner(r,i,t.length);for(let l=0,c=t.length;l<c;l++)Ia.ofree(n[l]);Ia.ofree(i),Ia.ofree(r),o===0&&tje(Ia),this._onigBinding=Ia,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 R_(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 l=i.HEAPU32;let c=o/4;const u=l[c++],d=l[c++],f=[];for(let m=0;m<d;m++){const p=t.convertUtf8OffsetToUtf16(l[c++]),g=t.convertUtf8OffsetToUtf16(l[c++]);f[m]={start:p,end:g,length:g-p}}return{index:u,captureIndices:f}}}function sje(e){return typeof e.instantiator=="function"}function rje(e){return typeof e.default=="function"}function ije(e){return typeof e.data<"u"}function oje(e){return typeof Response<"u"&&e instanceof Response}function aje(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 R2;function lje(e){if(R2)return R2;async function t(){Ia=await JAe(async n=>{let s=e;return s=await s,typeof s=="function"&&(s=await s(n)),typeof s=="function"&&(s=await s(n)),sje(s)?s=await s.instantiator(n):rje(s)?s=await s.default(n):(ije(s)&&(s=s.data),oje(s)?typeof WebAssembly.instantiateStreaming=="function"?s=await cje(s)(n):s=await uje(s)(n):aje(s)?s=await OA(s)(n):s instanceof WebAssembly.Module?s=await OA(s)(n):"default"in s&&s.default instanceof WebAssembly.Module&&(s=await OA(s.default)(n))),"instance"in s&&(s=s.instance),"exports"in s&&(s=s.exports),s})}return R2=t(),R2}function OA(e){return t=>WebAssembly.instantiate(e,t)}function cje(e){return t=>WebAssembly.instantiateStreaming(e,t)}function uje(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let dje;function hje(){return dje}async function wse(e){return e&&await lje(e),{createScanner(t){return new nje(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new R_(t)}}}function fje(e){return rL(e)}function rL(e){return Array.isArray(e)?mje(e):e instanceof RegExp?e:typeof e=="object"?pje(e):e}function mje(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=rL(e[n]);return t}function pje(e){let t={};for(let n in e)t[n]=rL(e[n]);return t}function xse(e,...t){return t.forEach(n=>{for(let s in n)e[s]=n[s]}),e}function kse(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?kse(e.substring(0,e.length-1)):e.substr(~t+1)}var $A=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,D2=class{static hasCaptures(e){return e===null?!1:($A.lastIndex=0,$A.test(e))}static replaceCaptures(e,t,n){return e.replace($A,(s,r,i,o)=>{let l=n[parseInt(r||i,10)];if(l){let c=t.substring(l.start,l.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 _se(e,t){return e<t?-1:e>t?1:0}function Sse(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=_se(e[r],t[r]);if(i!==0)return i}return 0}return n-s}function rU(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 Cse(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Tse=class{constructor(e){He(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}},LT=class{constructor(e,t,n){He(this,"_cachedMatchRoot",new Tse(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(yje(e),t)}static createFromParsedTheme(e,t){return wje(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=>gje(e.parent,r.parentScopes));return s?new Ese(s.fontStyle,s.foreground,s.background):null}},BA=class d4{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const s of n)t=new d4(t,s);return t}static from(...t){let n=null;for(let s=0;s<t.length;s++)n=new d4(n,t[s]);return n}push(t){return new d4(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 gje(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&&!bje(e.scopeName,s);){if(r)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function bje(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Ese=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function yje(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 l;if(typeof o.scope=="string"){let f=o.scope;f=f.replace(/^[,]+/,""),f=f.replace(/[,]+$/,""),l=f.split(",")}else Array.isArray(o.scope)?l=o.scope:l=[""];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"&&rU(o.settings.foreground)&&(u=o.settings.foreground);let d=null;typeof o.settings.background=="string"&&rU(o.settings.background)&&(d=o.settings.background);for(let f=0,m=l.length;f<m;f++){let g=l[f].trim().split(" "),b=g[g.length-1],w=null;g.length>1&&(w=g.slice(0,g.length-1),w.reverse()),n[s++]=new vje(b,w,r,c,u,d)}}return n}var vje=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}},Sf=(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))(Sf||{});function wje(e,t){e.sort((c,u)=>{let d=_se(c.scope,u.scope);return d!==0||(d=Sse(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 xje(t),o=new Ese(n,i.getId(s),i.getId(r)),l=new _je(new NI(0,null,-1,0,0),[]);for(let c=0,u=e.length;c<u;c++){let d=e[c];l.insert(0,d.scope,d.parentScopes,d.fontStyle,i.getId(d.foreground),i.getId(d.background))}return new LT(i,o,l)}var xje=class{constructor(e){He(this,"_isFrozen");He(this,"_lastColorId");He(this,"_id2color");He(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)}},kje=Object.freeze([]),NI=class Ase{constructor(t,n,s,r,i){He(this,"scopeDepth");He(this,"parentScopes");He(this,"fontStyle");He(this,"foreground");He(this,"background");this.scopeDepth=t,this.parentScopes=n||kje,this.fontStyle=s,this.foreground=r,this.background=i}clone(){return new Ase(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)}},_je=class II{constructor(t,n=[],s={}){He(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(II._cmpBySpecificity),n}insert(t,n,s,r,i,o){if(n===""){this._doInsertHere(t,s,r,i,o);return}let l=n.indexOf("."),c,u;l===-1?(c=n,u=""):(c=n.substring(0,l),u=n.substring(l+1));let d;this._children.hasOwnProperty(c)?d=this._children[c]:(d=new II(this._mainRule.clone(),NI.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,l=this._rulesWithParentScopes.length;o<l;o++){let c=this._rulesWithParentScopes[o];if(Sse(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 NI(t,n,s,r,i))}},Py=class fu{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=fu.getLanguageId(t),s=fu.getTokenType(t),r=fu.getFontStyle(t),i=fu.getForeground(t),o=fu.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,l){let c=fu.getLanguageId(t),u=fu.getTokenType(t),d=fu.containsBalancedBrackets(t)?1:0,f=fu.getFontStyle(t),m=fu.getForeground(t),p=fu.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),l!==0&&(p=l),(c<<0|u<<8|d<<10|f<<11|m<<15|p<<24)>>>0}};function PT(e,t){const n=[],s=Sje(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=l();return r===")"&&(r=s.next()),c}if(iU(r)){const c=[];do c.push(r),r=s.next();while(iU(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 l(){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 iU(e){return!!e&&!!e.match(/[\w\.:]+/)}function Sje(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 jse(e){typeof e.dispose=="function"&&e.dispose()}var Ik=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Cje=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Tje=class{constructor(){He(this,"_references",[]);He(this,"_seenReferenceKeys",new Set);He(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))}},Eje=class{constructor(e,t){He(this,"seenFullScopeRequests",new Set);He(this,"seenPartialScopeRequests",new Set);He(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ik(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new Tje;for(const n of e)Aje(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof Ik){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 Aje(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 Ik?h4({baseGrammar:i,selfGrammar:r},s):MI(e.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},s);const o=n.injections(e.scopeName);if(o)for(const l of o)s.add(new Ik(l))}function MI(e,t,n){if(t.repository&&t.repository[e]){const s=t.repository[e];OT([s],t,n)}}function h4(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&OT(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&OT(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function OT(e,t,n){for(const s of e){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const r=s.repository?xse({},t.repository,s.repository):t.repository;Array.isArray(s.patterns)&&OT(s.patterns,{...t,repository:r},n);const i=s.include;if(!i)continue;const o=Nse(i);switch(o.kind){case 0:h4({...t,selfGrammar:t.baseGrammar},n);break;case 1:h4(t,n);break;case 2:MI(o.ruleName,{...t,repository:r},n);break;case 3:case 4:const l=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(l){const c={baseGrammar:t.baseGrammar,selfGrammar:l,repository:r};o.kind===4?MI(o.ruleName,c,n):h4(c,n)}else o.kind===4?n.add(new Cje(o.scopeName,o.ruleName)):n.add(new Ik(o.scopeName));break}}}var jje=class{constructor(){He(this,"kind",0)}},Nje=class{constructor(){He(this,"kind",1)}},Ije=class{constructor(e){He(this,"kind",2);this.ruleName=e}},Mje=class{constructor(e){He(this,"kind",3);this.scopeName=e}},Rje=class{constructor(e,t){He(this,"kind",4);this.scopeName=e,this.ruleName=t}};function Nse(e){if(e==="$base")return new jje;if(e==="$self")return new Nje;const t=e.indexOf("#");if(t===-1)return new Mje(e);if(t===0)return new Ije(e.substring(1));{const n=e.substring(0,t),s=e.substring(t+1);return new Rje(n,s)}}var Dje=/\\(\d+)/,oU=/\\(\d+)/g,Lje=-1,Ise=-2;var D_=class{constructor(t,n,s,r){He(this,"$location");He(this,"id");He(this,"_nameIsCapturing");He(this,"_name");He(this,"_contentNameIsCapturing");He(this,"_contentName");this.$location=t,this.id=n,this._name=s||null,this._nameIsCapturing=D2.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=D2.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${kse(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:D2.replaceCaptures(this._name,t,n)}getContentName(t,n){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:D2.replaceCaptures(this._contentName,t,n)}},Pje=class extends D_{constructor(t,n,s,r,i){super(t,n,s,r);He(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!")}},Oje=class extends D_{constructor(t,n,s,r,i){super(t,n,s,null);He(this,"_match");He(this,"captures");He(this,"_cachedCompiledPatterns");this._match=new Mk(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 Rk,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},aU=class extends D_{constructor(t,n,s,r,i){super(t,n,s,r);He(this,"hasMissingPatterns");He(this,"patterns");He(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 Rk,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},RI=class extends D_{constructor(t,n,s,r,i,o,l,c,u,d){super(t,n,s,r);He(this,"_begin");He(this,"beginCaptures");He(this,"_end");He(this,"endHasBackReferences");He(this,"endCaptures");He(this,"applyEndPatternLast");He(this,"hasMissingPatterns");He(this,"patterns");He(this,"_cachedCompiledPatterns");this._begin=new Mk(i,this.id),this.beginCaptures=o,this._end=new Mk(l||"",-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 Rk;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}},$T=class extends D_{constructor(t,n,s,r,i,o,l,c,u){super(t,n,s,r);He(this,"_begin");He(this,"beginCaptures");He(this,"whileCaptures");He(this,"_while");He(this,"whileHasBackReferences");He(this,"hasMissingPatterns");He(this,"patterns");He(this,"_cachedCompiledPatterns");He(this,"_cachedCompiledWhilePatterns");this._begin=new Mk(i,this.id),this.beginCaptures=o,this.whileCaptures=c,this._while=new Mk(l,Ise),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 Rk;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 Rk,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},Mse=class ml{static createCaptureRule(t,n,s,r,i){return t.registerRule(o=>new Pje(n,o,s,r,i))}static getCompiledRuleId(t,n,s){return t.id||n.registerRule(r=>{if(t.id=r,t.match)return new Oje(t.$vscodeTextmateLocation,t.id,t.name,t.match,ml._compileCaptures(t.captures,n,s));if(typeof t.begin>"u"){t.repository&&(s=xse({},s,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new aU(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,ml._compilePatterns(i,n,s))}return t.while?new $T(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,ml._compileCaptures(t.beginCaptures||t.captures,n,s),t.while,ml._compileCaptures(t.whileCaptures||t.captures,n,s),ml._compilePatterns(t.patterns,n,s)):new RI(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,ml._compileCaptures(t.beginCaptures||t.captures,n,s),t.end,ml._compileCaptures(t.endCaptures||t.captures,n,s),t.applyEndPatternLast,ml._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 l=parseInt(o,10);l>i&&(i=l)}for(let o=0;o<=i;o++)r[o]=null;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const l=parseInt(o,10);let c=0;t[o].patterns&&(c=ml.getCompiledRuleId(t[o],n,s)),r[l]=ml.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 l=t[i];let c=-1;if(l.include){const u=Nse(l.include);switch(u.kind){case 0:case 1:c=ml.getCompiledRuleId(s[l.include],n,s);break;case 2:let d=s[u.ruleName];d&&(c=ml.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=ml.getCompiledRuleId(g,n,p.repository))}else c=ml.getCompiledRuleId(p.repository.$self,n,p.repository);break}}else c=ml.getCompiledRuleId(l,n,s);if(c!==-1){const u=n.getRule(c);let d=!1;if((u instanceof aU||u instanceof RI||u instanceof $T)&&u.hasMissingPatterns&&u.patterns.length===0&&(d=!0),d)continue;r.push(c)}}return{patterns:r,hasMissingPatterns:(t?t.length:0)!==r.length}}},Mk=class Rse{constructor(t,n){He(this,"source");He(this,"ruleId");He(this,"hasAnchor");He(this,"hasBackReferences");He(this,"_anchorCache");if(t&&typeof t=="string"){const s=t.length;let r=0,i=[],o=!1;for(let l=0;l<s;l++)if(t.charAt(l)==="\\"&&l+1<s){const u=t.charAt(l+1);u==="z"?(i.push(t.substring(r,l)),i.push("$(?!\\n)(?<!\\n)"),r=l+2):(u==="A"||u==="G")&&(o=!0),l++}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=Dje.test(this.source):this.hasBackReferences=!1}clone(){return new Rse(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 oU.lastIndex=0,this.source.replace(oU,(r,i)=>Cse(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,l,c;for(i=0,o=this.source.length;i<o;i++)l=this.source.charAt(i),t[i]=l,n[i]=l,s[i]=l,r[i]=l,l==="\\"&&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}},Rk=class{constructor(){He(this,"_items");He(this,"_hasAnchors");He(this,"_cached");He(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 lU(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 lU(e,s,this._items.map(r=>r.ruleId))}},lU=class{constructor(e,t,n){He(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}},zA=class{constructor(e,t){this.languageId=e,this.tokenType=t}},bf,$je=(bf=class{constructor(t,n){He(this,"_defaultAttributes");He(this,"_embeddedLanguagesMatcher");He(this,"_getBasicScopeAttributes",new Tse(t=>{const n=this._scopeToLanguage(t),s=this._toStandardTokenType(t);return new zA(n,s)}));this._defaultAttributes=new zA(t,8),this._embeddedLanguagesMatcher=new Bje(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?bf._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(bf.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!")}},He(bf,"_NULL_SCOPE_METADATA",new zA(0,0)),He(bf,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),bf),Bje=class{constructor(e){He(this,"values");He(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,s])=>Cse(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])}},cU=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Dse(e,t,n,s,r,i,o,l){const c=t.content.length;let u=!1,d=-1;if(o){const p=zje(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(l!==0&&Date.now()-f>l)return new cU(r,!0);m()}return new cU(r,!1);function m(){const p=Fje(e,t,n,s,r,d);if(!p){i.produce(r,c),u=!0;return}const g=p.captureIndices,b=p.matchedRuleId,w=g&&g.length>0?g[0].end>s:!1;if(b===Lje){const y=r.getRule(e);i.produce(r,g[0].start),r=r.withContentNameScopesList(r.nameScopesList),ux(e,t,n,r,i,y.endCaptures,g),i.produce(r,g[0].end);const v=r;if(r=r.parent,d=v.getAnchorPos(),!w&&v.getEnterPos()===s){r=v,i.produce(r,c),u=!0;return}}else{const y=e.getRule(b);i.produce(r,g[0].start);const v=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 RI){const _=y;ux(e,t,n,r,i,_.beginCaptures,g),i.produce(r,g[0].end),d=g[0].end;const T=_.getContentName(t.content,g),S=k.pushAttributed(T,e);if(r=r.withContentNameScopesList(S),_.endHasBackReferences&&(r=r.withEndRule(_.getEndWithResolvedBackReferences(t.content,g))),!w&&v.hasSameRuleAs(r)){r=r.pop(),i.produce(r,c),u=!0;return}}else if(y instanceof $T){const _=y;ux(e,t,n,r,i,_.beginCaptures,g),i.produce(r,g[0].end),d=g[0].end;const T=_.getContentName(t.content,g),S=k.pushAttributed(T,e);if(r=r.withContentNameScopesList(S),_.whileHasBackReferences&&(r=r.withEndRule(_.getWhileWithResolvedBackReferences(t.content,g))),!w&&v.hasSameRuleAs(r)){r=r.pop(),i.produce(r,c),u=!0;return}}else if(ux(e,t,n,r,i,y.captures,g),i.produce(r,g[0].end),r=r.pop(),!w){r=r.safePop(),i.produce(r,c),u=!0;return}}g[0].end>s&&(s=g[0].end,n=!1)}}function zje(e,t,n,s,r,i){let o=r.beginRuleCapturedEOL?0:-1;const l=[];for(let c=r;c;c=c.pop()){const u=c.getRule(e);u instanceof $T&&l.push({rule:u,stack:c})}for(let c=l.pop();c;c=l.pop()){const{ruleScanner:u,findOptions:d}=Uje(c.rule,e,c.stack.endRule,n,s===o),f=u.findNextMatchSync(t,s,d);if(f){if(f.ruleId!==Ise){r=c.stack.pop();break}f.captureIndices&&f.captureIndices.length&&(i.produce(c.stack,f.captureIndices[0].start),ux(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 Fje(e,t,n,s,r,i){const o=qje(e,t,n,s,r,i),l=e.getInjections();if(l.length===0)return o;const c=Hje(l,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 qje(e,t,n,s,r,i){const o=r.getRule(e),{ruleScanner:l,findOptions:c}=Lse(o,e,r.endRule,n,s===i),u=l.findNextMatchSync(t,s,c);return u?{captureIndices:u.captureIndices,matchedRuleId:u.ruleId}:null}function Hje(e,t,n,s,r,i,o){let l=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:w,findOptions:y}=Lse(b,t,null,s,r===o),v=w.findNextMatchSync(n,r,y);if(!v)continue;const x=v.captureIndices[0].start;if(!(x>=l)&&(l=x,c=v.captureIndices,u=v.ruleId,d=g.priority,l===r))break}return c?{priorityMatch:d===-1,captureIndices:c,matchedRuleId:u}:null}function Lse(e,t,n,s,r){return{ruleScanner:e.compileAG(t,n,s,r),findOptions:0}}function Uje(e,t,n,s,r){return{ruleScanner:e.compileWhileAG(t,n,s,r),findOptions:0}}function ux(e,t,n,s,r,i,o){if(i.length===0)return;const l=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(l,o),w=s.contentNameScopesList.pushAttributed(b,e),y=m.getContentName(l,o),v=w.pushAttributed(y,e),x=s.push(m.retokenizeCapturedWithRuleId,p.start,-1,!1,null,w,v),k=e.createOnigString(l.substring(0,p.end));Dse(e,k,n&&p.start===0,p.start,x,r,!1,0),jse(k);continue}const g=m.getName(l,o);if(g!==null){const w=(u.length>0?u[u.length-1].scopes:s.contentNameScopesList).pushAttributed(g,e);u.push(new Wje(w,p.end))}}for(;u.length>0;)r.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var Wje=class{constructor(e,t){He(this,"scopes");He(this,"endPos");this.scopes=e,this.endPos=t}};function Vje(e,t,n,s,r,i,o,l){return new Kje(e,t,n,s,r,i,o,l)}function uU(e,t,n,s,r){const i=PT(t,BT),o=Mse.getCompiledRuleId(n,s,r.repository);for(const l of i)e.push({debugSelector:t,matcher:l.matcher,ruleId:o,grammar:r,priority:l.priority})}function BT(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(Gje(t[r],s))return n=r+1,!0;return!1})}function Gje(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 Kje=class{constructor(e,t,n,s,r,i,o,l){He(this,"_rootId");He(this,"_lastRuleId");He(this,"_ruleId2desc");He(this,"_includedGrammars");He(this,"_grammarRepository");He(this,"_grammar");He(this,"_injections");He(this,"_basicScopeAttributesProvider");He(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=l,this._basicScopeAttributesProvider=new $je(n,s),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=dU(t,null),this._injections=null,this._tokenTypeMatchers=[],r)for(const c of Object.keys(r)){const u=PT(c,BT);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)uU(t,o,r[o],this,s);const i=this._grammarRepository.injections(n);i&&i.forEach(o=>{const l=this.getExternalGrammar(o);if(l){const c=l.injectionSelector;c&&uU(t,c,l,this,l)}})}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]=dU(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=Mse.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let r;if(!t||t===DI.NULL){r=!0;const u=this._basicScopeAttributesProvider.getDefaultAttributes(),d=this.themeProvider.getDefaults(),f=Py.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=Kx.createRootAndLookUpScopeName(m,f,this):p=Kx.createRoot("unknown",f),t=new DI(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,l=new Xje(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Dse(this,i,r,0,t,l,!0,s);return jse(i),{lineLength:o,lineTokens:l,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function dU(e,t){return e=fje(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 Kx=class Gd{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=BA.push(r,i.scopeNames),s=new Gd(s,r,i.encodedTokenAttributes);return s}static createRoot(t,n){return new Gd(null,new BA(null,t),n)}static createRootAndLookUpScopeName(t,n,s){const r=s.getMetadataForScope(t),i=new BA(null,t),o=s.themeProvider.themeMatch(i),l=Gd.mergeAttributes(n,r,o);return new Gd(null,i,l)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return Gd.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),Py.set(t,n.languageId,n.tokenType,null,r,i,o)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return Gd._pushAttributed(this,t,n);const s=t.split(/ /g);let r=this;for(const i of s)r=Gd._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),l=Gd.mergeAttributes(t.tokenAttributes,r,o);return new Gd(t,i,l)}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}},_u,DI=(_u=class{constructor(t,n,s,r,i,o,l,c){He(this,"_stackElementBrand");He(this,"_enterPos");He(this,"_anchorPos");He(this,"depth");this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=l,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=s,this._anchorPos=r}equals(t){return t===null?!1:_u._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?Kx.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(){_u._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,s,r,i,o,l){return new _u(this,t,n,s,r,i,o,l)}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 _u(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=Kx.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new _u(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,Kx.fromExtension(s,n.contentNameScopesList))}},He(_u,"NULL",new _u(null,0,0,0,!1,null,null,null)),_u),Yje=class{constructor(e,t){He(this,"balancedBracketScopes");He(this,"unbalancedBracketScopes");He(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):PT(n,BT).map(s=>s.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>PT(n,BT).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}},Xje=class{constructor(e,t,n,s){He(this,"_emitBinaryTokens");He(this,"_lineText");He(this,"_tokens");He(this,"_binaryTokens");He(this,"_lastTokenEndIndex");He(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 l of this._tokenTypeOverrides)l.matcher(o)&&(r=Py.set(r,0,l.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(o))}if(i&&(r=Py.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}},Qje=class{constructor(e,t){He(this,"_grammars",new Map);He(this,"_rawGrammars",new Map);He(this,"_injectionGrammars",new Map);He(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,Vje(e,i,t,n,s,r,this,this._onigLib))}return this._grammars.get(e)}},Jje=class{constructor(t){He(this,"_options");He(this,"_syncRegistry");He(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new Qje(LT.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(LT.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 Yje(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,s,r,i){const o=new Eje(this._syncRegistry,t);for(;o.Q.length>0;)o.Q.map(l=>this._loadSingleGrammar(l.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)}},LI=DI.NULL;const Zje=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],eNe=/["&'<>`]/g,tNe=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,nNe=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,sNe=/[|\\{}()[\]^$+*?.]/g,hU=new WeakMap;function rNe(e,t){if(e=e.replace(t.subset?iNe(t.subset):eNe,s),t.subset||t.escapeOnly)return e;return e.replace(tNe,n).replace(nNe,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 iNe(e){let t=hU.get(e);return t||(t=oNe(e),hU.set(e,t)),t}function oNe(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(sNe,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const aNe=/[\dA-Fa-f]/;function lNe(e,t,n){const s="&#x"+e.toString(16).toUpperCase();return n&&t&&!aNe.test(String.fromCharCode(t))?s:s+";"}const cNe=/\d/;function uNe(e,t,n){const s="&#"+String(e);return n&&t&&!cNe.test(String.fromCharCode(t))?s:s+";"}const dNe=["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"],FA={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:"€"},hNe=["cent","copy","divide","gt","lt","not","para","times"],Pse={}.hasOwnProperty,PI={};let L2;for(L2 in FA)Pse.call(FA,L2)&&(PI[FA[L2]]=L2);const fNe=/[^\dA-Za-z]/;function mNe(e,t,n,s){const r=String.fromCharCode(e);if(Pse.call(PI,r)){const i=PI[r],o="&"+i;return n&&dNe.includes(i)&&!hNe.includes(i)&&(!s||t&&t!==61&&fNe.test(String.fromCharCode(t)))?o:o+";"}return""}function pNe(e,t,n){let s=lNe(e,t,n.omitOptionalSemicolons),r;if((n.useNamedReferences||n.useShortestReferences)&&(r=mNe(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const i=uNe(e,t,n.omitOptionalSemicolons);i.length<s.length&&(s=i)}return r&&(!n.useShortestReferences||r.length<s.length)?r:s}function ay(e,t){return rNe(e,Object.assign({format:pNe},t))}const gNe=/^>|^->|<!--|-->|--!>|<!-$/g,bNe=[">"],yNe=["<",">"];function vNe(e,t,n,s){return s.settings.bogusComments?"<?"+ay(e.value,Object.assign({},s.settings.characterReferences,{subset:bNe}))+">":"<!--"+e.value.replace(gNe,r)+"-->";function r(i){return ay(i,Object.assign({},s.settings.characterReferences,{subset:yNe}))}}function wNe(e,t,n,s){return"<!"+(s.settings.upperDoctype?"DOCTYPE":"doctype")+(s.settings.tightDoctype?"":" ")+"html>"}const pa=$se(1),Ose=$se(-1),xNe=[];function $se(e){return t;function t(n,s,r){const i=n?n.children:xNe;let o=(s||0)+e,l=i[o];if(!r)for(;l&&v5(l);)o+=e,l=i[o];return l}}const kNe={}.hasOwnProperty;function Bse(e){return t;function t(n,s,r){return kNe.call(e,n.tagName)&&e[n.tagName](n,s,r)}}const iL=Bse({body:SNe,caption:qA,colgroup:qA,dd:ANe,dt:ENe,head:qA,html:_Ne,li:TNe,optgroup:jNe,option:NNe,p:CNe,rp:fU,rt:fU,tbody:MNe,td:mU,tfoot:RNe,th:mU,thead:INe,tr:DNe});function qA(e,t,n){const s=pa(n,t,!0);return!s||s.type!=="comment"&&!(s.type==="text"&&v5(s.value.charAt(0)))}function _Ne(e,t,n){const s=pa(n,t);return!s||s.type!=="comment"}function SNe(e,t,n){const s=pa(n,t);return!s||s.type!=="comment"}function CNe(e,t,n){const s=pa(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 TNe(e,t,n){const s=pa(n,t);return!s||s.type==="element"&&s.tagName==="li"}function ENe(e,t,n){const s=pa(n,t);return!!(s&&s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd"))}function ANe(e,t,n){const s=pa(n,t);return!s||s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd")}function fU(e,t,n){const s=pa(n,t);return!s||s.type==="element"&&(s.tagName==="rp"||s.tagName==="rt")}function jNe(e,t,n){const s=pa(n,t);return!s||s.type==="element"&&s.tagName==="optgroup"}function NNe(e,t,n){const s=pa(n,t);return!s||s.type==="element"&&(s.tagName==="option"||s.tagName==="optgroup")}function INe(e,t,n){const s=pa(n,t);return!!(s&&s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot"))}function MNe(e,t,n){const s=pa(n,t);return!s||s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot")}function RNe(e,t,n){return!pa(n,t)}function DNe(e,t,n){const s=pa(n,t);return!s||s.type==="element"&&s.tagName==="tr"}function mU(e,t,n){const s=pa(n,t);return!s||s.type==="element"&&(s.tagName==="td"||s.tagName==="th")}const LNe=Bse({body:$Ne,colgroup:BNe,head:ONe,html:PNe,tbody:zNe});function PNe(e){const t=pa(e,-1);return!t||t.type!=="comment"}function ONe(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 $Ne(e){const t=pa(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&v5(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function BNe(e,t,n){const s=Ose(n,t),r=pa(e,-1,!0);return n&&s&&s.type==="element"&&s.tagName==="colgroup"&&iL(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="col")}function zNe(e,t,n){const s=Ose(n,t),r=pa(e,-1);return n&&s&&s.type==="element"&&(s.tagName==="thead"||s.tagName==="tbody")&&iL(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="tr")}const P2={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 FNe(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 l=[];let c;r.space==="html"&&e.tagName==="svg"&&(s.schema=wv);const u=qNe(s,e.properties),d=s.all(r.space==="html"&&e.tagName==="template"?e.content:e);return s.schema=r,d&&(o=!1),(u||!i||!LNe(e,t,n))&&(l.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!=="'")&&l.push(" "),l.push("/")),l.push(">")),l.push(d),!o&&(!i||!iL(e,t,n))&&l.push("</"+e.tagName+">"),l.join("")}function qNe(e,t){const n=[];let s=-1,r;if(t){for(r in t)if(t[r]!==null&&t[r]!==void 0){const i=HNe(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 HNe(e,t,n){const s=vD(e.schema,t),r=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,i=e.settings.allowDangerousCharacters?0:1;let o=e.quote,l;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=ay(s.attribute,Object.assign({},e.settings.characterReferences,{subset:P2.name[r][i]}));return n===!0||(n=Array.isArray(n)?(s.commaSeparated?Gee:tte)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(l=ay(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:P2.unquoted[r][i]}))),l!==n&&(e.settings.quoteSmart&&ET(n,o)>ET(n,e.alternative)&&(o=e.alternative),l=o+ay(n,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?P2.single:P2.double)[r][i],attribute:!0}))+o),c+(l&&"="+l))}const UNe=["<","&"];function zse(e,t,n,s){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:ay(e.value,Object.assign({},s.settings.characterReferences,{subset:UNe}))}function WNe(e,t,n,s){return s.settings.allowDangerousHtml?e.value:zse(e,t,n,s)}function VNe(e,t,n,s){return s.all(e)}const GNe=q5e("type",{invalid:KNe,unknown:YNe,handlers:{comment:vNe,doctype:wNe,element:FNe,raw:WNe,root:VNe,text:zse}});function KNe(e){throw new Error("Expected node, not `"+e+"`")}function YNe(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const XNe={},QNe={},JNe=[];function ZNe(e,t){const n=XNe,s=n.quote||'"',r=s==='"'?"'":'"';if(s!=='"'&&s!=="'")throw new Error("Invalid quote `"+s+"`, expected `'` or `\"`");return{one:e7e,all:t7e,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||Zje,characterReferences:n.characterReferences||QNe,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?wv:wD,quote:s,alternative:r}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function e7e(e,t,n){return GNe(e,t,n,this)}function t7e(e){const t=[],n=e&&e.children||JNe;let s=-1;for(;++s<n.length;)t[s]=this.one(n[s],s,e);return t.join("")}function n7e(e){return Array.isArray(e)?e:[e]}function B5(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 l=t?n[o]+(n[o+1]||""):n[o];r.push([l,s]),s+=n[o].length,s+=((i=n[o+1])==null?void 0:i.length)||0}return r}function oL(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Fse(e){return e==="ansi"||oL(e)}function aL(e){return e==="none"}function qse(e){return aL(e)}function Hse(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 s7e(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 r7e(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,l)=>o-l);return i.length?s7e(r,i):r})):e}async function Use(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function zT(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 wg(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function Wse(e){const t={};return e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle&&(e.fontStyle&Sf.Italic&&(t["font-style"]="italic"),e.fontStyle&Sf.Bold&&(t["font-weight"]="bold"),e.fontStyle&Sf.Underline&&(t["text-decoration"]="underline")),t}function i7e(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function o7e(e){const t=B5(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 l of t){if(i<l.length)break;i-=l.length,o++}return{line:o,character:i}}function s(r,i){let o=0;for(let l=0;l<r;l++)o+=t[l].length;return o+=i,o}return{lines:t,indexToPos:n,posToIndex:s}}class Ol extends Error{constructor(t){super(t),this.name="ShikiError"}}const Vse=new WeakMap;function z5(e,t){Vse.set(e,t)}function Dk(e){return Vse.get(e)}class Tv{constructor(...t){He(this,"_stacks",{});He(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 Tv(Object.fromEntries(n7e(n).map(s=>[s,LI])),t)}getInternalStack(t=this.theme){return this._stacks[t]}get scopes(){return pU(this._stacks[this.theme])}getScopes(t=this.theme){return pU(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function pU(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 a7e(e,t){if(!(e instanceof Tv))throw new Ol("Invalid grammar state");return e.getInternalStack(t)}function l7e(){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 Ol(`Invalid decoration offset: ${o}. Code length: ${n.source.length}`);return{...r.indexToPos(o),offset:o}}else{const l=r.lines[o.line];if(l===void 0)throw new Ol(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${r.lines.length}`);if(o.character<0||o.character>l.length)throw new Ol(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${l.length}`);return{...o,offset:r.posToIndex(o.line,o.character)}}};const r=o7e(n.source),i=(n.options.decorations||[]).map(o=>({...o,start:s(o.start),end:s(o.end)}));c7e(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(l=>[l.start.offset,l.end.offset]);return r7e(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 Ol(`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 w="",y=-1,v=-1;if(m===0&&(y=0),p===0&&(v=0),p===Number.POSITIVE_INFINITY&&(v=b.children.length),y===-1||v===-1)for(let k=0;k<b.children.length;k++)w+=Gse(b.children[k]),y===-1&&w.length===m&&(y=k+1),v===-1&&w.length===p&&(v=k+1);if(y===-1)throw new Ol(`Failed to find start index for decoration ${JSON.stringify(g.start)}`);if(v===-1)throw new Ol(`Failed to find end index for decoration ${JSON.stringify(g.end)}`);const x=b.children.slice(y,v);if(!g.alwaysWrap&&x.length===b.children.length)l(b,g,"line");else if(!g.alwaysWrap&&x.length===1&&x[0].type==="element")l(x[0],g,"token");else{const k={type:"element",tagName:"span",properties:{},children:x};l(k,g,"wrapper"),b.children.splice(y,x.length,k)}}function o(f,m){r[f]=l(r[f],m,"line")}function l(f,m,p){var w;const g=m.properties||{},b=m.transform||(y=>y);return f.tagName=m.tagName||"span",f.properties={...f.properties,...g,class:f.properties.class},(w=m.properties)!=null&&w.class&&Hse(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 c7e(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new Ol(`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,l=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||l||c){if(o&&o||l&&c)continue;throw new Ol(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(r.start)} intersect.`)}}}}function Gse(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(Gse).join(""):""}const u7e=[l7e()];function FT(e){return[...e.transformers||[],...u7e]}var xg=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],HA={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function d7e(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 gU(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 h7e(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)HA[r]&&t.push({type:"setDecoration",value:HA[r]});else if(r<=29){const i=HA[r-20];i&&t.push({type:"resetDecoration",value:i})}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:xg[r-30]}});else if(r===38){const[i,o]=gU(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:xg[r-40]}});else if(r===48){const[i,o]=gU(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:xg[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:xg[r-100+8]}})}return t}function f7e(){let e=null,t=null,n=new Set;return{parse(s){const r=[];let i=0;do{const o=d7e(s,i),l=o.sequence?s.substring(i,o.startPosition):s.substring(i);if(l.length>0&&r.push({value:l,foreground:e,background:t,decorations:new Set(n)}),o.sequence){const c=h7e(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 m7e={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 p7e(e=m7e){function t(l){return e[l]}function n(l){return`#${l.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<xg.length;u++)s.push(t(xg[u]));let l=[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([l[u],l[d],l[f]]));let c=8;for(let u=0;u<24;u++,c+=10)s.push(n([c,c,c]));return s}function i(l){return r()[l]}function o(l){switch(l.type){case"named":return t(l.name);case"rgb":return n(l.rgb);case"table":return i(l.index)}}return{value:o}}function g7e(e,t,n){const s=zT(e,n),r=B5(t),i=p7e(Object.fromEntries(xg.map(l=>{var c;return[l,(c=e.colors)==null?void 0:c[`terminal.ansi${l[0].toUpperCase()}${l.substring(1)}`]]}))),o=f7e();return r.map(l=>o.parse(l[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=wg(u,s),d=wg(d,s),c.decorations.has("dim")&&(u=b7e(u));let f=Sf.None;return c.decorations.has("bold")&&(f|=Sf.Bold),c.decorations.has("italic")&&(f|=Sf.Italic),c.decorations.has("underline")&&(f|=Sf.Underline),{content:c.value,offset:l[1],color:u,bgColor:d,fontStyle:f}}))}function b7e(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 lL(e,t,n={}){const{lang:s="text",theme:r=e.getLoadedThemes()[0]}=n;if(oL(s)||aL(r))return B5(t).map(c=>[{content:c[0],offset:c[1]}]);const{theme:i,colorMap:o}=e.setTheme(r);if(s==="ansi")return g7e(i,t,n);const l=e.getLanguage(s);if(n.grammarState){if(n.grammarState.lang!==l.name)throw new If(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${l.name}"`);if(!n.grammarState.themes.includes(i.name))throw new If(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return v7e(t,l,i,o,n)}function y7e(...e){if(e.length===2)return Dk(e[1]);const[t,n,s={}]=e,{lang:r="text",theme:i=t.getLoadedThemes()[0]}=s;if(oL(r)||aL(i))throw new If("Plain language does not have grammar state");if(r==="ansi")throw new If("ANSI language does not have grammar state");const{theme:o,colorMap:l}=t.setTheme(i),c=t.getLanguage(r);return new Tv(qT(n,c,o,l,s).stateStack,c.name,o.name)}function v7e(e,t,n,s,r){const i=qT(e,t,n,s,r),o=new Tv(qT(e,t,n,s,r).stateStack,t.name,n.name);return z5(i.tokens,o),i.tokens}function qT(e,t,n,s,r){const i=zT(n,r),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:l=500}=r,c=B5(e);let u=r.grammarState?a7e(r.grammarState,n.name)??LI:r.grammarContextCode!=null?qT(r.grammarContextCode,t,n,s,{...r,grammarState:void 0,grammarContextCode:void 0}).stateStack:LI,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 w,y,v;r.includeExplanation&&(w=t.tokenizeLine(g,u),y=w.tokens,v=0);const x=t.tokenizeLine2(g,u,l),k=x.tokens.length/2;for(let _=0;_<k;_++){const T=x.tokens[2*_],S=_+1<k?x.tokens[2*_+2]:g.length;if(T===S)continue;const C=x.tokens[2*_+1],N=wg(s[Py.getForeground(C)],i),E=Py.getFontStyle(C),O={content:g.substring(T,S),offset:b+T,color:N,fontStyle:E};if(r.includeExplanation){const B=[];if(r.includeExplanation!=="scopeName")for(const j of n.settings){let L;switch(typeof j.scope){case"string":L=j.scope.split(/,/).map(z=>z.trim());break;case"object":L=j.scope;break;default:continue}B.push({settings:j,selectors:L.map(z=>z.split(/ /))})}O.explanation=[];let D=0;for(;T+D<S;){const j=y[v],L=g.substring(j.startIndex,j.endIndex);D+=L.length,O.explanation.push({content:L,scopes:r.includeExplanation==="scopeName"?w7e(j.scopes):x7e(B,j.scopes)}),v+=1}}d.push(O)}f.push(d),d=[],u=x.ruleStack}return{tokens:f,stateStack:u}}function w7e(e){return e.map(t=>({scopeName:t}))}function x7e(e,t){const n=[];for(let s=0,r=t.length;s<r;s++){const i=t[s];n[s]={scopeName:i,themeMatches:_7e(e,i,t.slice(0,s))}}return n}function bU(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function k7e(e,t,n){if(!bU(e[e.length-1],t))return!1;let s=e.length-2,r=n.length-1;for(;s>=0&&r>=0;)bU(e[s],n[r])&&(s-=1),r-=1;return s===-1}function _7e(e,t,n){const s=[];for(const{selectors:r,settings:i}of e)for(const o of r)if(k7e(o,t,n)){s.push(i);break}return s}function Kse(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=lL(e,t,{...n,theme:c.theme}),d=Dk(u),f=typeof c.theme=="string"?c.theme:c.theme.name;return{tokens:u,state:d,theme:f}}),i=S7e(...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:w,offset:y,...v}=p[u][f];m.variants[s[g].color]=v}),m})),l=r[0].state?new Tv(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 l&&z5(o,l),o}function S7e(...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),l=r.map(c=>c[0]);for(;l.every(c=>c);){const c=Math.min(...l.map(u=>u.content.length));for(let u=0;u<n;u++){const d=l[u];d.content.length===c?(i[u].push(d),o[u]+=1,l[u]=r[u][o[u]]):(i[u].push({...d,content:d.content.slice(0,c)}),l[u]={...d,content:d.content.slice(c),offset:d.offset+c})}}}return t}function HT(e,t,n){let s,r,i,o,l,c;if("themes"in n){const{defaultColor:u="light",cssVariablePrefix:d="--shiki-"}=n,f=Object.entries(n.themes).filter(w=>w[1]).map(w=>({color:w[0],theme:w[1]})).sort((w,y)=>w.color===u?-1:y.color===u?1:0);if(f.length===0)throw new If("`themes` option must not be empty");const m=Kse(e,t,n);if(c=Dk(m),u&&!f.find(w=>w.color===u))throw new If(`\`themes\` option must contain the defaultColor key \`${u}\``);const p=f.map(w=>e.getTheme(w.theme)),g=f.map(w=>w.color);i=m.map(w=>w.map(y=>C7e(y,g,d,u))),c&&z5(i,c);const b=f.map(w=>zT(w.theme,n));r=f.map((w,y)=>(y===0&&u?"":`${d+w.color}:`)+(wg(p[y].fg,b[y])||"inherit")).join(";"),s=f.map((w,y)=>(y===0&&u?"":`${d+w.color}-bg:`)+(wg(p[y].bg,b[y])||"inherit")).join(";"),o=`shiki-themes ${p.map(w=>w.name).join(" ")}`,l=u?void 0:[r,s].join(";")}else if("theme"in n){const u=zT(n.theme,n);i=lL(e,t,n);const d=e.getTheme(n.theme);s=wg(d.bg,u),r=wg(d.fg,u),o=d.name,c=Dk(i)}else throw new If("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:r,bg:s,themeName:o,rootStyle:l,grammarState:c}}function C7e(e,t,n,s){const r={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(c=>Wse(e.variants[c])),o=new Set(i.flatMap(c=>Object.keys(c))),l={};return i.forEach((c,u)=>{for(const d of o){const f=c[d]||"inherit";if(u===0&&s)l[d]=f;else{const m=d==="color"?"":d==="background-color"?"-bg":`-${d}`,p=n+t[u]+(d==="color"?"":m);l[p]=f}}}),r.htmlStyle=l,r}function UT(e,t,n,s={meta:{},options:n,codeToHast:(r,i)=>UT(e,r,i),codeToTokens:(r,i)=>HT(e,r,i)}){var p,g;let r=t;for(const b of FT(n))r=((p=b.preprocess)==null?void 0:p.call(s,r,n))||r;let{tokens:i,fg:o,bg:l,themeName:c,rootStyle:u,grammarState:d}=HT(e,r,n);const{mergeWhitespaces:f=!0}=n;f===!0?i=E7e(i):f==="never"&&(i=A7e(i));const m={...s,get source(){return r}};for(const b of FT(n))i=((g=b.tokens)==null?void 0:g.call(m,i))||i;return T7e(i,{...n,fg:o,bg:l,themeName:c,rootStyle:u},m,d)}function T7e(e,t,n,s=Dk(e)){var g,b,w;const r=FT(t),i=[],o={type:"root",children:[]},{structure:l="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:l,addClassToHast:Hse,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,v)=>{var _,T;v&&(l==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):l==="classic"&&i.push({type:"text",value:`
`}));let x={type:"element",tagName:"span",properties:{class:"line"},children:[]},k=0;for(const S of y){let C={type:"element",tagName:"span",properties:{...S.htmlAttrs},children:[{type:"text",value:S.content}]};S.htmlStyle;const N=i7e(S.htmlStyle||Wse(S));N&&(C.properties.style=N);for(const E of r)C=((_=E==null?void 0:E.span)==null?void 0:_.call(m,C,v+1,k,x,S))||C;l==="inline"?o.children.push(C):l==="classic"&&x.children.push(C),k+=S.content.length}if(l==="classic"){for(const S of r)x=((T=S==null?void 0:S.line)==null?void 0:T.call(m,x,v+1))||x;f.push(x),i.push(x)}}),l==="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=((w=y==null?void 0:y.root)==null?void 0:w.call(m,p))||p;return s&&z5(p,s),p}function E7e(e){return e.map(t=>{const n=[];let s="",r=0;return t.forEach((i,o)=>{const c=!(i.fontStyle&&i.fontStyle&Sf.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 A7e(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 l=[{...n,offset:n.offset+r.length,content:i}];return r&&l.unshift({content:r,offset:n.offset}),o&&l.push({content:o,offset:n.offset+r.length+i.length}),l}))}function j7e(e,t,n){var i;const s={meta:{},options:n,codeToHast:(o,l)=>UT(e,o,l),codeToTokens:(o,l)=>HT(e,o,l)};let r=ZNe(UT(e,t,n,s));for(const o of FT(n))r=((i=o.postprocess)==null?void 0:i.call(s,r,n))||r;return r}const yU={light:"#333333",dark:"#bbbbbb"},vU={light:"#fffffe",dark:"#1e1e1e"},wU="__shiki_resolved";function cL(e){var l,c,u,d,f;if(e!=null&&e[wU])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;(l=m==null?void 0:m.settings)!=null&&l.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"?yU.light:yU.dark),n||(n=t.type==="light"?vU.light:vU.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 w,y;const p=((w=m.settings)==null?void 0:w.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 v=o(m.settings.foreground);t.colorReplacements[v]=m.settings.foreground,b.settings.foreground=v}if(g){const v=o(m.settings.background);t.colorReplacements[v]=m.settings.background,b.settings.background=v}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,wU,{enumerable:!1,writable:!1,value:!0}),t}async function Yse(e){return Array.from(new Set((await Promise.all(e.filter(t=>!Fse(t)).map(async t=>await Use(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function Xse(e){return(await Promise.all(e.map(async n=>qse(n)?null:cL(await Use(n))))).filter(n=>!!n)}class N7e extends Jje{constructor(n,s,r,i={}){super(n);He(this,"_resolvedThemes",new Map);He(this,"_resolvedGrammars",new Map);He(this,"_langMap",new Map);He(this,"_langGraph",new Map);He(this,"_textmateThemeCache",new WeakMap);He(this,"_loadedThemesCache",null);He(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=cL(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=LT.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 Ol(`Circular alias \`${Array.from(s).join(" -> ")} -> ${n}\``);s.add(n)}}return this._resolvedGrammars.get(n)}loadLanguage(n){var o,l,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,(l=(o=this._syncRegistry)==null?void 0:o._injectionGrammars)==null||l.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,l])=>{var c;return l&&((c=l.embeddedLangs)==null?void 0:c.some(u=>r.map(([d])=>d).includes(u)))}).filter(o=>!r.includes(o));throw new Ol(`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 I7e{constructor(t,n){He(this,"_langs",new Map);He(this,"_scopeToLang",new Map);He(this,"_injections",new Map);He(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 Ow=0;function M7e(e){Ow+=1,e.warnings!==!1&&Ow>=10&&Ow%10===0&&console.warn(`[Shiki] ${Ow} 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 Ol("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),s=(e.themes||[]).flat(1).map(cL),r=new I7e(e.engine,n),i=new N7e(r,s,n,e.langAlias);let o;function l(v){w();const x=i.getGrammar(typeof v=="string"?v:v.name);if(!x)throw new Ol(`Language \`${v}\` not found, you may need to load it first`);return x}function c(v){if(v==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};w();const x=i.getTheme(v);if(!x)throw new Ol(`Theme \`${v}\` not found, you may need to load it first`);return x}function u(v){w();const x=c(v);o!==v&&(i.setTheme(x),o=v);const k=i.getColorMap();return{theme:x,colorMap:k}}function d(){return w(),i.getLoadedThemes()}function f(){return w(),i.getLoadedLanguages()}function m(...v){w(),i.loadLanguages(v.flat(1))}async function p(...v){return m(await Yse(v))}function g(...v){w();for(const x of v.flat(1))i.loadTheme(x)}async function b(...v){return w(),g(await Xse(v))}function w(){if(t)throw new Ol("Shiki instance has been disposed")}function y(){t||(t=!0,i.dispose(),Ow-=1)}return{setTheme:u,getTheme:c,getLanguage:l,getLoadedThemes:d,getLoadedLanguages:f,loadLanguage:p,loadLanguageSync:m,loadTheme:b,loadThemeSync:g,dispose:y,[Symbol.dispose]:y}}async function R7e(e={}){e.loadWasm;const[t,n,s]=await Promise.all([Xse(e.themes||[]),Yse(e.langs||[]),e.engine||wse(e.loadWasm||hje())]);return M7e({...e,themes:t,langs:n,engine:s})}async function D7e(e={}){const t=await R7e(e);return{getLastGrammarState:(...n)=>y7e(t,...n),codeToTokensBase:(n,s)=>lL(t,n,s),codeToTokensWithThemes:(n,s)=>Kse(t,n,s),codeToTokens:(n,s)=>HT(t,n,s),codeToHast:(n,s)=>UT(t,n,s),codeToHtml:(n,s)=>j7e(t,n,s),...t,getInternalContext:()=>t}}function L7e(e,t,n){let s,r,i;{const l=e;s=l.langs,r=l.themes,i=l.engine}async function o(l){function c(p){if(typeof p=="string"){if(Fse(p))return[];const g=s[p];if(!g)throw new If(`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(qse(p))return"none";if(typeof p=="string"){const g=r[p];if(!g)throw new If(`Theme \`${p}\` is not included in this bundle. You may want to load it from external source.`);return g}return p}const d=(l.themes??[]).map(p=>u(p)),f=(l.langs??[]).map(p=>c(p)),m=await D7e({engine:l.engine??i(),...l,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 P7e=L7e({langs:VAe,themes:KAe,engine:()=>wse(ye(()=>import("./wasm-CG6Dc4jp.js"),[]))});/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const O7e=["github-light-default","github-dark-default"];let O2=null,OI=null;const $I=new Set,UA=new Map,xU=new Set,$7e=128,dx=new Map;function Qse(e,t,n){return`${t}\0${n}\0${e}`}function B7e(e,t){if(dx.size>=$7e){const n=dx.keys().next().value;n!==void 0&&dx.delete(n)}dx.set(e,t)}function z7e(e,t,n){return dx.get(Qse(e,t,n))??null}function F7e(){return O2||(O2=P7e({langs:[],themes:O7e}).then(e=>(OI=e,e)).catch(e=>{throw O2=null,e})),O2}async function Jse(e){const t=await F7e();if($I.has(e))return t;if(xU.has(e))throw new Error(`shiki: language "${e}" previously failed to load`);let n=UA.get(e);return n||(n=t.loadLanguage(e).then(()=>{$I.add(e)}).catch(s=>{throw xU.add(e),s}).finally(()=>{UA.delete(e)}),UA.set(e,n)),await n,t}const q7e=1e5,H7e=2e4;function BI(e){if(e.length>q7e)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>H7e)return!0;t=s+1}return!1}function kU(e,t,n,s=!0){if(OI&&$I.has(t))try{const r=OI.codeToHtml(e,{lang:t,theme:n});return s&&B7e(Qse(e,t,n),r),r}catch(r){return console.warn("[web-shell] sync highlight failed for lang=%s",t,r),null}return null}const U7e=()=>{},W7e=()=>U7e,Zse=h.createContext(W7e);function V7e(){return h.useContext(Zse)}function ere(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=ere(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function tre(){for(var e,t,n=0,s="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=ere(e))&&(s&&(s+=" "),s+=t);return s}const _U=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,SU=tre,g1=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return SU(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=_U(d)||_U(f);return r[u][m]}),l=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,w]=g;return Array.isArray(w)?w.includes({...i,...l}[b]):{...i,...l}[b]===w})?[...u,f,m]:u},[]);return SU(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)};function CU(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function G7e(...e){return t=>{let n=!1;const s=e.map(r=>{const i=CU(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():CU(e[r],null)}}}}function Rs(...e){return h.useCallback(G7e(...e),e)}function $p(e){const t=h.forwardRef((n,s)=>{let{children:r,...i}=n,o=null,l=!1;const c=[];TU(r)&&typeof $2=="function"&&(r=$2(r._payload)),h.Children.forEach(r,m=>{var p;if(J7e(m)){l=!0;const g=m;let b="child"in g.props?g.props.child:g.props.children;TU(b)&&typeof $2=="function"&&(b=$2(b._payload)),o=Y7e(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):!l&&h.Children.count(r)===1&&h.isValidElement(r)&&(o=r);const u=o?Q7e(o):void 0,d=Rs(s,u);if(!o){if(r||r===0)throw new Error(l?nIe(e):tIe(e));return r}const f=X7e(i,o.props??{});return o.type!==h.Fragment&&(f.ref=s?d:u),h.cloneElement(o,f)});return t.displayName=`${e}.Slot`,t}var uL=$p("Slot"),nre=Symbol.for("radix.slottable");function K7e(e){const t=n=>"child"in n?n.children(n.child):n.children;return t.displayName=`${e}.Slottable`,t.__radixId=nre,t}var Y7e=(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 X7e(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]=(...l)=>{const c=i(...l);return r(...l),c}:r&&(n[s]=r):s==="style"?n[s]={...r,...i}:s==="className"&&(n[s]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function Q7e(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 J7e(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===nre}var Z7e=Symbol.for("react.lazy");function TU(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Z7e&&"_payload"in e&&eIe(e._payload)}function eIe(e){return typeof e=="object"&&e!==null&&"then"in e}var tIe=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,nIe=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,$2=W3[" use ".trim().toString()],sIe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ts=sIe.reduce((e,t)=>{const n=$p(`Primitive.${t}`),s=h.forwardRef((r,i)=>{const{asChild:o,...l}=r,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function sre(e,t){e&&kd.flushSync(()=>e.dispatchEvent(t))}var rre=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"}),rIe="VisuallyHidden",ire=h.forwardRef((e,t)=>a.jsx(ts.span,{...e,ref:t,style:{...rre,...e.style}}));ire.displayName=rIe;var iIe=ire;function Cl(e,t=[]){let n=[];function s(i,o){const l=h.createContext(o);l.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])||l,w=h.useMemo(()=>g,Object.values(g));return a.jsx(b.Provider,{value:w,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])||l,w=h.useContext(b);if(w)return w;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(l){const c=(l==null?void 0:l[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return r.scopeName=e,[s,oIe(r,...t)]}function oIe(...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((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function dL(e){const t=e+"CollectionProvider",[n,s]=Cl(t),[r,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=b=>{const{scope:w,children:y}=b,v=h.useRef(null),x=h.useRef(new Map).current;return a.jsx(r,{scope:w,itemMap:x,collectionRef:v,children:y})};o.displayName=t;const l=e+"CollectionSlot",c=$p(l),u=h.forwardRef((b,w)=>{const{scope:y,children:v}=b,x=i(l,y),k=Rs(w,x.collectionRef);return a.jsx(c,{ref:k,children:v})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",m=$p(d),p=h.forwardRef((b,w)=>{const{scope:y,children:v,...x}=b,k=h.useRef(null),_=Rs(w,k),T=i(d,y);return h.useEffect(()=>(T.itemMap.set(k,{ref:k,...x}),()=>void T.itemMap.delete(k))),a.jsx(m,{[f]:"",ref:_,children:v})});p.displayName=d;function g(b){const w=i(e+"CollectionConsumer",b);return h.useCallback(()=>{const v=w.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(w.itemMap.values()).sort((T,S)=>x.indexOf(T.ref.current)-x.indexOf(S.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:u,ItemSlot:p},g,s]}function yn(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 Ba=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},aIe=W3[" useInsertionEffect ".trim().toString()]||Ba;function Kl({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[r,i,o]=lIe({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:r;{const d=h.useRef(e!==void 0);h.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${s} is changing from ${f?"controlled":"uncontrolled"} to ${l?"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=l},[l,s])}const u=h.useCallback(d=>{var f;if(l){const m=cIe(d)?d(e):d;m!==e&&((f=o.current)==null||f.call(o,m))}else i(d)},[l,e,i,o]);return[c,u]}function lIe({defaultProp:e,onChange:t}){const[n,s]=h.useState(e),r=h.useRef(n),i=h.useRef(t);return aIe(()=>{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 cIe(e){return typeof e=="function"}function uIe(e,t){return h.useReducer((n,s)=>t[n][s]??n,e)}var Tl=e=>{const{present:t,children:n}=e,s=dIe(t),r=typeof n=="function"?n({present:s.isPresent}):h.Children.only(n),i=hIe(s.ref,fIe(r));return typeof n=="function"||s.isPresent?h.cloneElement(r,{ref:i}):null};Tl.displayName="Presence";function dIe(e){const[t,n]=h.useState(),s=h.useRef(null),r=h.useRef(e),i=h.useRef("none"),o=h.useRef(void 0),l=e?"mounted":"unmounted",[c,u]=uIe(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{c==="mounted"?(i.current=o.current??$w(s.current),o.current=void 0):i.current="none"},[c]),Ba(()=>{const d=s.current,f=r.current;if(f!==e){const p=i.current,g=$w(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]),Ba(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,m=g=>{const w=$w(s.current).includes(CSS.escape(g.animationName));if(g.target===t&&w&&(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=$w(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=$w(f)}else s.current=null;n(d)},[])}}function EU(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function hIe(...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 l=EU(o,n);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let o=0;o<i.length;o++){const l=i[o];typeof l=="function"?l():EU(s[o],null)}}},[])}function $w(e){return(e==null?void 0:e.animationName)||"none"}function fIe(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 mIe=W3[" useId ".trim().toString()]||(()=>{}),pIe=0;function gc(e){const[t,n]=h.useState(mIe());return Ba(()=>{n(s=>s??String(pIe++))},[e]),t?`radix-${t}`:""}var gIe=h.createContext(void 0);function Ev(e){const t=h.useContext(gIe);return e||t||"ltr"}function nu(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 bIe="DismissableLayer",zI="dismissableLayer.update",yIe="dismissableLayer.pointerDownOutside",vIe="dismissableLayer.focusOutside",AU,hL=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Av=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:l,onDismiss:c,...u}=e,d=h.useContext(hL),[f,m]=h.useState(null),p=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=h.useState({}),b=Rs(t,m),w=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),v=y?w.indexOf(y):-1,x=f?w.indexOf(f):-1,k=d.layersWithOutsidePointerEventsDisabled.size>0,_=x>=v,T=h.useRef(!1),S=SIe(O=>{i==null||i(O),l==null||l(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 B=[...d.branches].some(D=>D.contains(O));return _&&!B},[d.branches,_])}),C=CIe(O=>{if(s&&T.current)return;const B=O.target;[...d.branches].some(j=>j.contains(B))||(o==null||o(O),l==null||l(O),O.defaultPrevented||c==null||c())},p),N=f?x===w.length-1:!1,E=nu(O=>{O.key==="Escape"&&(r==null||r(O),!O.defaultPrevented&&c&&(O.preventDefault(),c()))});return h.useEffect(()=>{if(N)return p.addEventListener("keydown",E,{capture:!0}),()=>p.removeEventListener("keydown",E,{capture:!0})},[p,N,E]),h.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(AU=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),jU(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=AU))}},[f,p,n,d]),h.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),jU())},[f,d]),h.useEffect(()=>{const O=()=>g({});return document.addEventListener(zI,O),()=>document.removeEventListener(zI,O)},[]),a.jsx(ts.div,{...u,ref:b,style:{pointerEvents:k?_?"auto":"none":void 0,...e.style},onFocusCapture:yn(e.onFocusCapture,C.onFocusCapture),onBlurCapture:yn(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:yn(e.onPointerDownCapture,S.onPointerDownCapture)})});Av.displayName=bIe;var wIe="DismissableLayerBranch",xIe=h.forwardRef((e,t)=>{const n=h.useContext(hL),s=h.useRef(null),r=Rs(t,s);return h.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),a.jsx(ts.div,{...e,ref:r})});xIe.displayName=wIe;function kIe(){const e=h.useContext(hL),[t,n]=h.useState(null);return h.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var _Ie=()=>!0;function SIe(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:s=!1,isDeferredPointerDownOutsideRef:r,dismissableSurfaces:i,shouldHandlePointerDownOutside:o=_Ie}=t,l=nu(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 w=x=>{if(x.target&&!c.current){let k=function(){n.removeEventListener("click",f.current);const T=p();m(),T||ore(yIe,l,_,{discrete:!0})};if(!o(x.target)){n.removeEventListener("click",f.current),m(),c.current=!1;return}const _={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 v=window.setTimeout(()=>{n.addEventListener("pointerdown",w)},0);return()=>{window.clearTimeout(v),n.removeEventListener("pointerdown",w),n.removeEventListener("click",f.current);for(const x of y)n.removeEventListener(x,g,!0),n.removeEventListener(x,b)}},[n,l,s,r,i,o]),{onPointerDownCapture:()=>c.current=!0}}function CIe(e,t=globalThis==null?void 0:globalThis.document){const n=nu(e),s=h.useRef(!1);return h.useEffect(()=>{const r=i=>{i.target&&!s.current&&ore(vIe,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 jU(){const e=new CustomEvent(zI);document.dispatchEvent(e)}function ore(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?sre(r,i):r.dispatchEvent(i)}var WA="focusScope.autoFocusOnMount",VA="focusScope.autoFocusOnUnmount",NU={bubbles:!1,cancelable:!0},TIe="FocusScope",L_=h.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:r,onUnmountAutoFocus:i,...o}=e,[l,c]=h.useState(null),u=nu(r),d=nu(i),f=h.useRef(null),m=Rs(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||!l)return;const k=x.target;l.contains(k)?f.current=k:Lm(f.current,{select:!0})},w=function(x){if(p.paused||!l)return;const k=x.relatedTarget;k!==null&&(l.contains(k)||Lm(f.current,{select:!0}))},y=function(x){if(document.activeElement===document.body)for(const _ of x)_.removedNodes.length>0&&Lm(l)};document.addEventListener("focusin",b),document.addEventListener("focusout",w);const v=new MutationObserver(y);return l&&v.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",w),v.disconnect()}}},[s,l,p.paused]),h.useEffect(()=>{if(l){MU.add(p);const b=document.activeElement;if(!l.contains(b)){const y=new CustomEvent(WA,NU);l.addEventListener(WA,u),l.dispatchEvent(y),y.defaultPrevented||(EIe(MIe(are(l)),{select:!0}),document.activeElement===b&&Lm(l))}return()=>{l.removeEventListener(WA,u),setTimeout(()=>{const y=new CustomEvent(VA,NU);l.addEventListener(VA,d),l.dispatchEvent(y),y.defaultPrevented||Lm(b??document.body,{select:!0}),l.removeEventListener(VA,d),MU.remove(p)},0)}}},[l,u,d,p]);const g=h.useCallback(b=>{if(!n&&!s||p.paused)return;const w=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,y=document.activeElement;if(w&&y){const v=b.currentTarget,[x,k]=AIe(v);x&&k?!b.shiftKey&&y===k?(b.preventDefault(),n&&Lm(x,{select:!0})):b.shiftKey&&y===x&&(b.preventDefault(),n&&Lm(k,{select:!0})):y===v&&b.preventDefault()}},[n,s,p.paused]);return a.jsx(ts.div,{tabIndex:-1,...o,ref:m,onKeyDown:g})});L_.displayName=TIe;function EIe(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(Lm(s,{select:t}),document.activeElement!==n)return}function AIe(e){const t=are(e),n=IU(t,e),s=IU(t.reverse(),e);return[n,s]}function are(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 IU(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const s of e)if(!(n?!s.checkVisibility({checkVisibilityCSS:!0}):jIe(s,{upTo:t})))return s}function jIe(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 NIe(e){return e instanceof HTMLInputElement&&"select"in e}function Lm(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&NIe(e)&&t&&e.select()}}var MU=IIe();function IIe(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=RU(e,t),e.unshift(t)},remove(t){var n;e=RU(e,t),(n=e[0])==null||n.resume()}}}function RU(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function MIe(e){return e.filter(t=>t.tagName!=="A")}var RIe="Portal",jv=h.forwardRef((e,t)=>{var l;const{container:n,...s}=e,[r,i]=h.useState(!1);Ba(()=>i(!0),[]);const o=n||r&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?kd.createPortal(a.jsx(ts.div,{...s,ref:t}),o):null});jv.displayName=RIe;var B2=0,Bd=null;function F5(){h.useEffect(()=>{Bd||(Bd={start:DU(),end:DU()});const{start:e,end:t}=Bd;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),B2++,()=>{B2===1&&(Bd==null||Bd.start.remove(),Bd==null||Bd.end.remove(),Bd=null),B2=Math.max(0,B2-1)}},[])}function DU(){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 rh=function(){return rh=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},rh.apply(this,arguments)};function lre(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 DIe(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 f4="right-scroll-bar-position",m4="width-before-scroll-bar",LIe="with-scroll-bars-hidden",PIe="--removed-body-scroll-bar-size";function GA(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function OIe(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 $Ie=typeof window<"u"?h.useLayoutEffect:h.useEffect,LU=new WeakMap;function BIe(e,t){var n=OIe(null,function(s){return e.forEach(function(r){return GA(r,s)})});return $Ie(function(){var s=LU.get(n);if(s){var r=new Set(s),i=new Set(e),o=n.current;r.forEach(function(l){i.has(l)||GA(l,null)}),i.forEach(function(l){r.has(l)||GA(l,o)})}LU.set(n,e)},[e]),n}function zIe(e){return e}function FIe(e,t){t===void 0&&(t=zIe);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(l){return l!==o})}},assignSyncMedium:function(i){for(s=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){s=!0;var o=[];if(n.length){var l=n;n=[],l.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 qIe(e){e===void 0&&(e={});var t=FIe(null);return t.options=rh({async:!0,ssr:!1},e),t}var cre=function(e){var t=e.sideCar,n=lre(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,rh({},n))};cre.isSideCarExport=!0;function HIe(e,t){return e.useMedium(t),cre}var ure=qIe(),KA=function(){},q5=h.forwardRef(function(e,t){var n=h.useRef(null),s=h.useState({onScrollCapture:KA,onWheelCapture:KA,onTouchMoveCapture:KA}),r=s[0],i=s[1],o=e.forwardProps,l=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,w=e.allowPinchZoom,y=e.as,v=y===void 0?"div":y,x=e.gapMode,k=lre(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=m,T=BIe([n,t]),S=rh(rh({},k),r);return h.createElement(h.Fragment,null,d&&h.createElement(_,{sideCar:ure,removeScrollBar:u,shards:f,noRelative:p,noIsolation:g,inert:b,setCallbacks:i,allowPinchZoom:!!w,lockRef:n,gapMode:x}),o?h.cloneElement(h.Children.only(l),rh(rh({},S),{ref:T})):h.createElement(v,rh({},S,{className:c,ref:T}),l))});q5.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};q5.classNames={fullWidth:m4,zeroRight:f4};var UIe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function WIe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=UIe();return t&&e.setAttribute("nonce",t),e}function VIe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function GIe(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var KIe=function(){var e=0,t=null;return{add:function(n){e==0&&(t=WIe())&&(VIe(t,n),GIe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},YIe=function(){var e=KIe();return function(t,n){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},dre=function(){var e=YIe(),t=function(n){var s=n.styles,r=n.dynamic;return e(s,r),null};return t},XIe={left:0,top:0,right:0,gap:0},YA=function(e){return parseInt(e||"",10)||0},QIe=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[YA(n),YA(s),YA(r)]},JIe=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return XIe;var t=QIe(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])}},ZIe=dre(),ly="data-scroll-locked",eMe=function(e,t,n,s){var r=e.left,i=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),`
  .`.concat(LIe,` {
   overflow: hidden `).concat(s,`;
   padding-right: `).concat(l,"px ").concat(s,`;
  }
  body[`).concat(ly,`] {
    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(l,"px ").concat(s,`;
    `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(s,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(f4,` {
    right: `).concat(l,"px ").concat(s,`;
  }
  
  .`).concat(m4,` {
    margin-right: `).concat(l,"px ").concat(s,`;
  }
  
  .`).concat(f4," .").concat(f4,` {
    right: 0 `).concat(s,`;
  }
  
  .`).concat(m4," .").concat(m4,` {
    margin-right: 0 `).concat(s,`;
  }
  
  body[`).concat(ly,`] {
    `).concat(PIe,": ").concat(l,`px;
  }
`)},PU=function(){var e=parseInt(document.body.getAttribute(ly)||"0",10);return isFinite(e)?e:0},tMe=function(){h.useEffect(function(){return document.body.setAttribute(ly,(PU()+1).toString()),function(){var e=PU()-1;e<=0?document.body.removeAttribute(ly):document.body.setAttribute(ly,e.toString())}},[])},nMe=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,r=s===void 0?"margin":s;tMe();var i=h.useMemo(function(){return JIe(r)},[r]);return h.createElement(ZIe,{styles:eMe(i,!t,r,n?"":"!important")})},FI=!1;if(typeof window<"u")try{var z2=Object.defineProperty({},"passive",{get:function(){return FI=!0,!0}});window.addEventListener("test",z2,z2),window.removeEventListener("test",z2,z2)}catch{FI=!1}var nb=FI?{passive:!1}:!1,sMe=function(e){return e.tagName==="TEXTAREA"},hre=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!sMe(e)&&n[t]==="visible")},rMe=function(e){return hre(e,"overflowY")},iMe=function(e){return hre(e,"overflowX")},OU=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var r=fre(e,s);if(r){var i=mre(e,s),o=i[1],l=i[2];if(o>l)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},oMe=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},aMe=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},fre=function(e,t){return e==="v"?rMe(t):iMe(t)},mre=function(e,t){return e==="v"?oMe(t):aMe(t)},lMe=function(e,t){return e==="h"&&t==="rtl"?-1:1},cMe=function(e,t,n,s,r){var i=lMe(e,window.getComputedStyle(t).direction),o=i*s,l=n.target,c=t.contains(l),u=!1,d=o>0,f=0,m=0;do{if(!l)break;var p=mre(e,l),g=p[0],b=p[1],w=p[2],y=b-w-i*g;(g||y)&&fre(e,l)&&(f+=y,m+=g);var v=l.parentNode;l=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(f)<1||!d&&Math.abs(m)<1)&&(u=!0),u},F2=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},$U=function(e){return[e.deltaX,e.deltaY]},BU=function(e){return e&&"current"in e?e.current:e},uMe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},dMe=function(e){return`
  .block-interactivity-`.concat(e,` {pointer-events: none;}
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},hMe=0,sb=[];function fMe(e){var t=h.useRef([]),n=h.useRef([0,0]),s=h.useRef(),r=h.useState(hMe++)[0],i=h.useState(dre)[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=DIe([e.lockRef.current],(e.shards||[]).map(BU),!0).filter(Boolean);return b.forEach(function(w){return w.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),b.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var l=h.useCallback(function(b,w){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!o.current.allowPinchZoom;var y=F2(b),v=n.current,x="deltaX"in b?b.deltaX:v[0]-y[0],k="deltaY"in b?b.deltaY:v[1]-y[1],_,T=b.target,S=Math.abs(x)>Math.abs(k)?"h":"v";if("touches"in b&&S==="h"&&T.type==="range")return!1;var C=window.getSelection(),N=C&&C.anchorNode,E=N?N===T||N.contains(T):!1;if(E)return!1;var O=OU(S,T);if(!O)return!0;if(O?_=S:(_=S==="v"?"h":"v",O=OU(S,T)),!O)return!1;if(!s.current&&"changedTouches"in b&&(x||k)&&(s.current=_),!_)return!0;var B=s.current||_;return cMe(B,w,b,B==="h"?x:k)},[]),c=h.useCallback(function(b){var w=b;if(!(!sb.length||sb[sb.length-1]!==i)){var y="deltaY"in w?$U(w):F2(w),v=t.current.filter(function(_){return _.name===w.type&&(_.target===w.target||w.target===_.shadowParent)&&uMe(_.delta,y)})[0];if(v&&v.should){w.cancelable&&w.preventDefault();return}if(!v){var x=(o.current.shards||[]).map(BU).filter(Boolean).filter(function(_){return _.contains(w.target)}),k=x.length>0?l(w,x[0]):!o.current.noIsolation;k&&w.cancelable&&w.preventDefault()}}},[]),u=h.useCallback(function(b,w,y,v){var x={name:b,delta:w,target:y,should:v,shadowParent:mMe(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=F2(b),s.current=void 0},[]),f=h.useCallback(function(b){u(b.type,$U(b),b.target,l(b,e.lockRef.current))},[]),m=h.useCallback(function(b){u(b.type,F2(b),b.target,l(b,e.lockRef.current))},[]);h.useEffect(function(){return sb.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,nb),document.addEventListener("touchmove",c,nb),document.addEventListener("touchstart",d,nb),function(){sb=sb.filter(function(b){return b!==i}),document.removeEventListener("wheel",c,nb),document.removeEventListener("touchmove",c,nb),document.removeEventListener("touchstart",d,nb)}},[]);var p=e.removeScrollBar,g=e.inert;return h.createElement(h.Fragment,null,g?h.createElement(i,{styles:dMe(r)}):null,p?h.createElement(nMe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function mMe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const pMe=HIe(ure,fMe);var P_=h.forwardRef(function(e,t){return h.createElement(q5,rh({},e,{ref:t,sideCar:pMe}))});P_.classNames=q5.classNames;var gMe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},rb=new WeakMap,q2=new WeakMap,H2={},XA=0,pre=function(e){return e&&(e.host||pre(e.parentNode))},bMe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=pre(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})},yMe=function(e,t,n,s){var r=bMe(t,Array.isArray(e)?e:[e]);H2[n]||(H2[n]=new WeakMap);var i=H2[n],o=[],l=new Set,c=new Set(r),u=function(f){!f||l.has(f)||(l.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(l.has(m))d(m);else try{var p=m.getAttribute(s),g=p!==null&&p!=="false",b=(rb.get(m)||0)+1,w=(i.get(m)||0)+1;rb.set(m,b),i.set(m,w),o.push(m),b===1&&g&&q2.set(m,!0),w===1&&m.setAttribute(n,"true"),g||m.setAttribute(s,"true")}catch(y){console.error("aria-hidden: cannot operate on ",m,y)}})};return d(t),l.clear(),XA++,function(){o.forEach(function(f){var m=rb.get(f)-1,p=i.get(f)-1;rb.set(f,m),i.set(f,p),m||(q2.has(f)||f.removeAttribute(s),q2.delete(f)),p||f.removeAttribute(n)}),XA--,XA||(rb=new WeakMap,rb=new WeakMap,q2=new WeakMap,H2={})}},H5=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=gMe(e);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),yMe(s,r,n,"aria-hidden")):function(){return null}},U5="Dialog",[gre,bre]=Cl(U5),[vMe,Cd]=gre(U5),W5=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:r,onOpenChange:i,modal:o=!0}=e,l=h.useRef(null),c=h.useRef(null),[u,d]=Kl({prop:s,defaultProp:r??!1,onChange:i,caller:U5});return a.jsx(vMe,{scope:t,triggerRef:l,contentRef:c,contentId:gc(),titleId:gc(),descriptionId:gc(),open:u,onOpenChange:d,onOpenToggle:h.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};W5.displayName=U5;var yre="DialogTrigger",vre=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Cd(yre,n),i=Rs(t,r.triggerRef);return a.jsx(ts.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":pL(r.open),...s,ref:i,onClick:yn(e.onClick,r.onOpenToggle)})});vre.displayName=yre;var fL="DialogPortal",[wMe,wre]=gre(fL,{forceMount:void 0}),V5=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:r}=e,i=Cd(fL,t);return a.jsx(wMe,{scope:t,forceMount:n,children:h.Children.map(s,o=>a.jsx(Tl,{present:n||i.open,children:a.jsx(jv,{asChild:!0,container:r,children:o})}))})};V5.displayName=fL;var WT="DialogOverlay",G5=h.forwardRef((e,t)=>{const n=wre(WT,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,i=Cd(WT,e.__scopeDialog);return i.modal?a.jsx(Tl,{present:s||i.open,children:a.jsx(kMe,{...r,ref:t})}):null});G5.displayName=WT;var xMe=$p("DialogOverlay.RemoveScroll"),kMe=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Cd(WT,n),i=kIe(),o=Rs(t,i);return a.jsx(P_,{as:xMe,allowPinchZoom:!0,shards:[r.contentRef],children:a.jsx(ts.div,{"data-state":pL(r.open),...s,ref:o,style:{pointerEvents:"auto",...s.style}})})}),Oy="DialogContent",K5=h.forwardRef((e,t)=>{const n=wre(Oy,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,i=Cd(Oy,e.__scopeDialog);return a.jsx(Tl,{present:s||i.open,children:i.modal?a.jsx(_Me,{...r,ref:t}):a.jsx(SMe,{...r,ref:t})})});K5.displayName=Oy;var _Me=h.forwardRef((e,t)=>{const n=Cd(Oy,e.__scopeDialog),s=h.useRef(null),r=Rs(t,n.contentRef,s);return h.useEffect(()=>{const i=s.current;if(i)return H5(i)},[]),a.jsx(xre,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:yn(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:yn(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:yn(e.onFocusOutside,i=>i.preventDefault())})}),SMe=h.forwardRef((e,t)=>{const n=Cd(Oy,e.__scopeDialog),s=h.useRef(!1),r=h.useRef(!1);return a.jsx(xre,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(s.current||(l=n.triggerRef.current)==null||l.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()}})}),xre=h.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:i,...o}=e,l=Cd(Oy,n);return F5(),a.jsx(a.Fragment,{children:a.jsx(L_,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:i,children:a.jsx(Av,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":pL(l.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1)})})})}),kre="DialogTitle",Y5=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Cd(kre,n);return a.jsx(ts.h2,{id:r.titleId,...s,ref:t})});Y5.displayName=kre;var _re="DialogDescription",mL=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Cd(_re,n);return a.jsx(ts.p,{id:r.descriptionId,...s,ref:t})});mL.displayName=_re;var Sre="DialogClose",Nv=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Cd(Sre,n);return a.jsx(ts.button,{type:"button",...s,ref:t,onClick:yn(e.onClick,()=>r.onOpenChange(!1))})});Nv.displayName=Sre;function pL(e){return e?"open":"closed"}var Cre="AlertDialog",[CMe,DDt]=Cl(Cre,[bre]),um=bre(),Tre=e=>{const{__scopeAlertDialog:t,...n}=e,s=um(t);return a.jsx(W5,{...s,...n,modal:!0})};Tre.displayName=Cre;var TMe="AlertDialogTrigger",EMe=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=um(n);return a.jsx(vre,{...r,...s,ref:t})});EMe.displayName=TMe;var AMe="AlertDialogPortal",Ere=e=>{const{__scopeAlertDialog:t,...n}=e,s=um(t);return a.jsx(V5,{...s,...n})};Ere.displayName=AMe;var jMe="AlertDialogOverlay",Are=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=um(n);return a.jsx(G5,{...r,...s,ref:t})});Are.displayName=jMe;var jre="AlertDialogContent",[NMe,IMe]=CMe(jre),Nre=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...r}=e,i=um(n),o=h.useRef(null),l=Rs(t,o),c=h.useRef(null);return a.jsx(NMe,{scope:n,cancelRef:c,children:a.jsx(K5,{role:"alertdialog",...i,...r,ref:l,onOpenAutoFocus:yn(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})})});Nre.displayName=jre;var MMe="AlertDialogTitle",Ire=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=um(n);return a.jsx(Y5,{...r,...s,ref:t})});Ire.displayName=MMe;var RMe="AlertDialogDescription",Mre=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=um(n);return a.jsx(mL,{...r,...s,ref:t})});Mre.displayName=RMe;var DMe="AlertDialogAction",Rre=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,r=um(n);return a.jsx(Nv,{...r,...s,ref:t})});Rre.displayName=DMe;var Dre="AlertDialogCancel",Lre=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:r}=IMe(Dre,n),i=um(n),o=Rs(t,r);return a.jsx(Nv,{...i,...s,ref:o})});Lre.displayName=Dre;var LMe=Tre,PMe=Ere,OMe=Are,$Me=Nre,BMe=Rre,zMe=Lre,FMe=Ire,qMe=Mre;function X5(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 Q5(e){const[t,n]=h.useState(void 0);return Ba(()=>{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,l;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var J5="Checkbox",[HMe,LDt]=Cl(J5),[UMe,gL]=HMe(J5);function WMe(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:r,disabled:i,form:o,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[m,p]=Kl({prop:n,defaultProp:r??!1,onChange:c,caller:J5}),[g,b]=h.useState(null),[w,y]=h.useState(null),v=h.useRef(!1),x=g?!!o||!!g.closest("form"):!0,k={checked:m,disabled:i,setChecked:p,control:g,setControl:b,name:l,form:o,value:d,hasConsumerStoppedPropagationRef:v,required:u,defaultChecked:kp(r)?!1:r,isFormControl:x,bubbleInput:w,setBubbleInput:y};return a.jsx(UMe,{scope:t,...k,children:VMe(f)?f(k):s})}var Pre="CheckboxTrigger",Ore=h.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...s},r)=>{const{control:i,value:o,disabled:l,checked:c,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:m,isFormControl:p,bubbleInput:g}=gL(Pre,e),b=Rs(r,d),w=h.useRef(c);return h.useEffect(()=>{const y=i==null?void 0:i.form;if(y){const v=()=>f(w.current);return y.addEventListener("reset",v),()=>y.removeEventListener("reset",v)}},[i,f]),a.jsx(ts.button,{type:"button",role:"checkbox","aria-checked":kp(c)?"mixed":c,"aria-required":u,"data-state":Hre(c),"data-disabled":l?"":void 0,disabled:l,value:o,...s,ref:b,onKeyDown:yn(t,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:yn(n,y=>{f(v=>kp(v)?!0:!v),g&&p&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})})});Ore.displayName=Pre;var $re=h.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:s,checked:r,defaultChecked:i,required:o,disabled:l,value:c,onCheckedChange:u,form:d,...f}=e;return a.jsx(WMe,{__scopeCheckbox:n,checked:r,defaultChecked:i,disabled:l,required:o,onCheckedChange:u,name:s,form:d,value:c,internal_do_not_use_render:({isFormControl:m})=>a.jsxs(a.Fragment,{children:[a.jsx(Ore,{...f,ref:t,__scopeCheckbox:n}),m&&a.jsx(qre,{__scopeCheckbox:n})]})})});$re.displayName=J5;var Bre="CheckboxIndicator",zre=h.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...r}=e,i=gL(Bre,n);return a.jsx(Tl,{present:s||kp(i.checked)||i.checked===!0,children:a.jsx(ts.span,{"data-state":Hre(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t,style:{pointerEvents:"none",...e.style}})})});zre.displayName=Bre;var Fre="CheckboxBubbleInput",qre=h.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:r,checked:i,defaultChecked:o,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:m,setBubbleInput:p}=gL(Fre,e),g=Rs(n,p),b=X5(i),w=Q5(s);h.useEffect(()=>{const v=m;if(!v)return;const x=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(x,"checked").set,T=!r.current;if(b!==i&&_){const S=new Event("click",{bubbles:T});v.indeterminate=kp(i),_.call(v,kp(i)?!1:i),v.dispatchEvent(S)}},[m,b,i,r]);const y=h.useRef(kp(i)?!1:i);return a.jsx(ts.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??y.current,required:l,disabled:c,name:u,value:d,form:f,...t,tabIndex:-1,ref:g,style:{...t.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});qre.displayName=Fre;function VMe(e){return typeof e=="function"}function kp(e){return e==="indeterminate"}function Hre(e){return kp(e)?"indeterminate":e?"checked":"unchecked"}const GMe=["top","right","bottom","left"],Bp=Math.min,Mf=Math.max,VT=Math.round,U2=Math.floor,Rf=e=>({x:e,y:e}),KMe={left:"right",right:"left",bottom:"top",top:"bottom"};function Ure(e,t,n){return Mf(e,Bp(t,n))}function Kf(e,t){return typeof e=="function"?e(t):e}function zp(e){return e.split("-")[0]}function Iv(e){return e.split("-")[1]}function bL(e){return e==="x"?"y":"x"}function yL(e){return e==="y"?"height":"width"}function hh(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function vL(e){return bL(hh(e))}function YMe(e,t,n){n===void 0&&(n=!1);const s=Iv(e),r=vL(e),i=yL(r);let o=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=GT(o)),[o,GT(o)]}function XMe(e){const t=GT(e);return[qI(e),t,qI(t)]}function qI(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const zU=["left","right"],FU=["right","left"],QMe=["top","bottom"],JMe=["bottom","top"];function ZMe(e,t,n){switch(e){case"top":case"bottom":return n?t?FU:zU:t?zU:FU;case"left":case"right":return t?QMe:JMe;default:return[]}}function eRe(e,t,n,s){const r=Iv(e);let i=ZMe(zp(e),n==="start",s);return r&&(i=i.map(o=>o+"-"+r),t&&(i=i.concat(i.map(qI)))),i}function GT(e){const t=zp(e);return KMe[t]+e.slice(t.length)}function tRe(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 Wre(e){return typeof e!="number"?tRe(e):{top:e,right:e,bottom:e,left:e}}function KT(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 qU(e,t,n){let{reference:s,floating:r}=e;const i=hh(t),o=vL(t),l=yL(o),c=zp(t),u=i==="y",d=s.x+s.width/2-r.width/2,f=s.y+s.height/2-r.height/2,m=s[l]/2-r[l]/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=Iv(t);return g&&(p[o]+=m*(g==="end"?1:-1)*(n&&u?-1:1)),p}async function nRe(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:i,rects:o,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:m=!1,padding:p=0}=Kf(t,e),g=Wre(p),w=l[m?f==="floating"?"reference":"floating":f],y=KT(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),v=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(l.floating)),k=await(i.isElement==null?void 0:i.isElement(x))&&await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1},_=KT(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:x,strategy:c}):v);return{top:(y.top-_.top+g.top)/k.y,bottom:(_.bottom-y.bottom+g.bottom)/k.y,left:(y.left-_.left+g.left)/k.x,right:(_.right-y.right+g.right)/k.x}}const sRe=50,rRe=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:i=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:nRe},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}=qU(u,s,c),m=s,p=0;const g={};for(let b=0;b<i.length;b++){const w=i[b];if(!w)continue;const{name:y,fn:v}=w,{x,y:k,data:_,reset:T}=await v({x:d,y:f,initialPlacement:s,placement:m,strategy:r,middlewareData:g,rects:u,platform:l,elements:{reference:e,floating:t}});d=x??d,f=k??f,g[y]={...g[y],..._},T&&p<sRe&&(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}=qU(u,m,c)),b=-1)}return{x:d,y:f,placement:m,strategy:r,middlewareData:g}},iRe=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:i,platform:o,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=Kf(e,t)||{};if(u==null)return{};const f=Wre(d),m={x:n,y:s},p=vL(r),g=yL(p),b=await o.getDimensions(u),w=p==="y",y=w?"top":"left",v=w?"bottom":"right",x=w?"clientHeight":"clientWidth",k=i.reference[g]+i.reference[p]-m[p]-i.floating[g],_=m[p]-i.reference[p],T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let S=T?T[x]:0;(!S||!await(o.isElement==null?void 0:o.isElement(T)))&&(S=l.floating[x]||i.floating[g]);const C=k/2-_/2,N=S/2-b[g]/2-1,E=Bp(f[y],N),O=Bp(f[v],N),B=S-b[g]-O,D=S/2-b[g]/2+C,j=Ure(E,D,B),L=!c.arrow&&Iv(r)!=null&&D!==j&&i.reference[g]/2-(D<E?E:O)-b[g]/2<0,z=L?D<E?D-E:D-B:0;return{[p]:m[p]+z,data:{[p]:j,centerOffset:D-j-z,...L&&{alignmentOffset:z}},reset:L}}}),oRe=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:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...w}=Kf(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=zp(r),v=hh(l),x=zp(l)===l,k=await(c.isRTL==null?void 0:c.isRTL(u.floating)),_=m||(x||!b?[GT(l)]:XMe(l)),T=g!=="none";!m&&T&&_.push(...eRe(l,b,g,k));const S=[l,..._],C=await c.detectOverflow(t,w),N=[];let E=((s=i.flip)==null?void 0:s.overflows)||[];if(d&&N.push(C[y]),f){const j=YMe(r,o,k);N.push(C[j[0]],C[j[1]])}if(E=[...E,{placement:r,overflows:N}],!N.every(j=>j<=0)){var O,B;const j=(((O=i.flip)==null?void 0:O.index)||0)+1,L=S[j];if(L&&(!(f==="alignment"?v!==hh(L):!1)||E.every($=>hh($.placement)===v?$.overflows[0]>0:!0)))return{data:{index:j,overflows:E},reset:{placement:L}};let z=(B=E.filter(I=>I.overflows[0]<=0).sort((I,$)=>I.overflows[1]-$.overflows[1])[0])==null?void 0:B.placement;if(!z)switch(p){case"bestFit":{var D;const I=(D=E.filter($=>{if(T){const K=hh($.placement);return K===v||K==="y"}return!0}).map($=>[$.placement,$.overflows.filter(K=>K>0).reduce((K,R)=>K+R,0)]).sort(($,K)=>$[1]-K[1])[0])==null?void 0:D[0];I&&(z=I);break}case"initialPlacement":z=l;break}if(r!==z)return{reset:{placement:z}}}return{}}}};function HU(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function UU(e){return GMe.some(t=>e[t]>=0)}const aRe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:r="referenceHidden",...i}=Kf(e,t);switch(r){case"referenceHidden":{const o=await s.detectOverflow(t,{...i,elementContext:"reference"}),l=HU(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:UU(l)}}}case"escaped":{const o=await s.detectOverflow(t,{...i,altBoundary:!0}),l=HU(o,n.floating);return{data:{escapedOffsets:l,escaped:UU(l)}}}default:return{}}}}},Vre=new Set(["left","top"]);async function lRe(e,t){const{placement:n,platform:s,elements:r}=e,i=await(s.isRTL==null?void 0:s.isRTL(r.floating)),o=zp(n),l=Iv(n),c=hh(n)==="y",u=Vre.has(o)?-1:1,d=i&&c?-1:1,f=Kf(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 l&&typeof g=="number"&&(p=l==="end"?g*-1:g),c?{x:p*d,y:m*u}:{x:m*u,y:p*d}}const cRe=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:l}=t,c=await lRe(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(s=l.arrow)!=null&&s.alignmentOffset?{}:{x:r+c.x,y:i+c.y,data:{...c,placement:o}}}}},uRe=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:l=!1,limiter:c={fn:v=>{let{x,y:k}=v;return{x,y:k}}},...u}=Kf(e,t),d={x:n,y:s},f=await i.detectOverflow(t,u),m=hh(r),p=bL(m);let g=d[p],b=d[m];const w=(v,x)=>Ure(x+f[v==="y"?"top":"left"],x,x-f[v==="y"?"bottom":"right"]);o&&(g=w(p,g)),l&&(b=w(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]:l}}}}}},dRe=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,s;const{x:r,y:i,placement:o,rects:l,middlewareData:c}=t,{offset:u=0,mainAxis:d=!0,crossAxis:f=!0}=Kf(e,t),m={x:r,y:i},p=hh(o),g=bL(p);let b=m[g],w=m[p];const y=Kf(u,t),v=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(s=y.crossAxis)!=null?s:0};if(d){const _=g==="y"?"height":"width",T=l.reference[g]-l.floating[_]+v.mainAxis,S=l.reference[g]+l.reference[_]-v.mainAxis;b<T?b=T:b>S&&(b=S)}if(f){var x,k;const _=g==="y"?"width":"height",T=Vre.has(zp(o)),S=l.reference[p]-l.floating[_]+(T&&((x=c.offset)==null?void 0:x[p])||0)+(T?0:v.crossAxis),C=l.reference[p]+l.reference[_]+(T?0:((k=c.offset)==null?void 0:k[p])||0)-(T?v.crossAxis:0);w<S?w=S:w>C&&(w=C)}return{[g]:b,[p]:w}}}},hRe=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=()=>{},...l}=Kf(e,t),c=await r.detectOverflow(t,l),u=zp(n),d=Iv(n),f=hh(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 w=p-c.top-c.bottom,y=m-c.left-c.right,v=Bp(p-c[g],w),x=Bp(m-c[b],y),k=t.middlewareData.shift,_=!k;let T=v,S=x;k!=null&&k.enabled.x&&(S=y),k!=null&&k.enabled.y&&(T=w),_&&!d&&(f?S=m-2*Mf(c.left,c.right):T=p-2*Mf(c.top,c.bottom)),await o({...t,availableWidth:S,availableHeight:T});const C=await r.getDimensions(i.floating);return m!==C.width||p!==C.height?{reset:{rects:!0}}:{}}}};function Z5(){return typeof window<"u"}function Mv(e){return Gre(e)?(e.nodeName||"").toLowerCase():"#document"}function bc(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function dm(e){var t;return(t=(Gre(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Gre(e){return Z5()?e instanceof Node||e instanceof bc(e).Node:!1}function _h(e){return Z5()?e instanceof Element||e instanceof bc(e).Element:!1}function d0(e){return Z5()?e instanceof HTMLElement||e instanceof bc(e).HTMLElement:!1}function WU(e){return!Z5()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof bc(e).ShadowRoot}function e6(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=Sh(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&r!=="inline"&&r!=="contents"}function fRe(e){return/^(table|td|th)$/.test(Mv(e))}function t6(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const mRe=/transform|translate|scale|rotate|perspective|filter/,pRe=/paint|layout|strict|content/,Y0=e=>!!e&&e!=="none";let QA;function wL(e){const t=_h(e)?Sh(e):e;return Y0(t.transform)||Y0(t.translate)||Y0(t.scale)||Y0(t.rotate)||Y0(t.perspective)||!xL()&&(Y0(t.backdropFilter)||Y0(t.filter))||mRe.test(t.willChange||"")||pRe.test(t.contain||"")}function gRe(e){let t=Vg(e);for(;d0(t)&&!Lk(t);){if(wL(t))return t;if(t6(t))return null;t=Vg(t)}return null}function xL(){return QA==null&&(QA=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),QA}function Lk(e){return/^(html|body|#document)$/.test(Mv(e))}function Sh(e){return bc(e).getComputedStyle(e)}function n6(e){return _h(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Vg(e){if(Mv(e)==="html")return e;const t=e.assignedSlot||e.parentNode||WU(e)&&e.host||dm(e);return WU(t)?t.host:t}function Kre(e){const t=Vg(e);return Lk(t)?(e.ownerDocument||e).body:d0(t)&&e6(t)?t:Kre(t)}function Pk(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Kre(e),i=r===((s=e.ownerDocument)==null?void 0:s.body),o=bc(r);if(i){const l=HI(o);return t.concat(o,o.visualViewport||[],e6(r)?r:[],l&&n?Pk(l):[])}else return t.concat(r,Pk(r,[],n))}function HI(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Yre(e){const t=Sh(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=d0(e),i=r?e.offsetWidth:n,o=r?e.offsetHeight:s,l=VT(n)!==i||VT(s)!==o;return l&&(n=i,s=o),{width:n,height:s,$:l}}function kL(e){return _h(e)?e:e.contextElement}function cy(e){const t=kL(e);if(!d0(t))return Rf(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:i}=Yre(t);let o=(i?VT(n.width):n.width)/s,l=(i?VT(n.height):n.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const bRe=Rf(0);function Xre(e){const t=bc(e);return!xL()||!t.visualViewport?bRe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function yRe(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===bc(e)}function Gg(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=kL(e);let o=Rf(1);t&&(s?_h(s)&&(o=cy(s)):o=cy(e));const l=yRe(i,n,s)?Xre(i):Rf(0);let c=(r.left+l.x)/o.x,u=(r.top+l.y)/o.y,d=r.width/o.x,f=r.height/o.y;if(i&&s){const m=bc(i),p=_h(s)?bc(s):s;let g=m,b=HI(g);for(;b&&p!==g;){const w=cy(b),y=b.getBoundingClientRect(),v=Sh(b),x=y.left+(b.clientLeft+parseFloat(v.paddingLeft))*w.x,k=y.top+(b.clientTop+parseFloat(v.paddingTop))*w.y;c*=w.x,u*=w.y,d*=w.x,f*=w.y,c+=x,u+=k,g=bc(b),b=HI(g)}}return KT({width:d,height:f,x:c,y:u})}function s6(e,t){const n=n6(e).scrollLeft;return t?t.left+n:Gg(dm(e)).left+n}function Qre(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-s6(e,n),r=n.top+t.scrollTop;return{x:s,y:r}}function vRe(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const i=r==="fixed",o=dm(s),l=t?t6(t.floating):!1;if(s===o||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Rf(1);const d=Rf(0),f=d0(s);if((f||!i)&&((Mv(s)!=="body"||e6(o))&&(c=n6(s)),f)){const p=Gg(s);u=cy(s),d.x=p.x+s.clientLeft,d.y=p.y+s.clientTop}const m=o&&!f&&!i?Qre(o,c):Rf(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 wRe(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function xRe(e){const t=n6(e),n=e.ownerDocument.body,s=Mf(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=Mf(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+s6(e);const o=-t.scrollTop;return Sh(n).direction==="rtl"&&(i+=Mf(e.clientWidth,n.clientWidth)-s),{width:s,height:r,x:i,y:o}}const kRe=25;function _Re(e,t,n){n===void 0&&(n="viewport");const s=n==="layoutViewport",r=bc(e),i=dm(e),o=r.visualViewport;let l=i.clientWidth,c=i.clientHeight,u=0,d=0;if(o){const m=!xL()||t==="fixed";s?m||(u=-o.offsetLeft,d=-o.offsetTop):(l=o.width,c=o.height,m&&(u=o.offsetLeft,d=o.offsetTop))}if(s6(i)<=0){const m=i.ownerDocument,p=m.body,g=getComputedStyle(p),b=m.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,w=Math.abs(i.clientWidth-p.clientWidth-b),y=getComputedStyle(i).scrollbarGutter==="stable both-edges"?w/2:w;y<=kRe&&(l-=y)}return{width:l,height:c,x:u,y:d}}function SRe(e,t){const n=Gg(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,i=cy(e),o=e.clientWidth*i.x,l=e.clientHeight*i.y,c=r*i.x,u=s*i.y;return{width:o,height:l,x:c,y:u}}function VU(e,t,n){let s;if(t==="viewport"||t==="layoutViewport")s=_Re(e,n,t);else if(t==="document")s=xRe(dm(e));else if(_h(t))s=SRe(t,n);else{const r=Xre(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return KT(s)}function CRe(e,t){const n=t.get(e);if(n)return n;let s=Pk(e,[],!1).filter(l=>_h(l)&&Mv(l)!=="body"),r=null;const i=Sh(e).position==="fixed";let o=i?Vg(e):e;for(;_h(o)&&!Lk(o);){const l=Sh(o),c=wL(o),u=r?r.position:i?"fixed":"";!c&&(u==="fixed"||u==="absolute"&&l.position==="static")?s=s.filter(f=>f!==o):r=l,o=Vg(o)}return t.set(e,s),s}function TRe(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const o=[...n==="clippingAncestors"?t6(t)?[]:CRe(t,this._c):[].concat(n),s],l=VU(t,o[0],r);let c=l.top,u=l.right,d=l.bottom,f=l.left;for(let m=1;m<o.length;m++){const p=VU(t,o[m],r);c=Mf(p.top,c),u=Bp(p.right,u),d=Bp(p.bottom,d),f=Mf(p.left,f)}return{width:u-f,height:d-c,x:f,y:c}}function ERe(e){const{width:t,height:n}=Yre(e);return{width:t,height:n}}function ARe(e,t,n){const s=d0(t),r=dm(t),i=n==="fixed",o=Gg(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=Rf(0);if((s||!i)&&((Mv(t)!=="body"||e6(r))&&(l=n6(t)),s)){const m=Gg(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}!s&&r&&(c.x=s6(r));const u=r&&!s&&!i?Qre(r,l):Rf(0),d=o.left+l.scrollLeft-c.x-u.x,f=o.top+l.scrollTop-c.y-u.y;return{x:d,y:f,width:o.width,height:o.height}}function JA(e){return Sh(e).position==="static"}function GU(e,t){if(!d0(e)||Sh(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return dm(e)===n&&(n=n.ownerDocument.body),n}function Jre(e,t){const n=bc(e);if(t6(e))return n;if(!d0(e)){let r=Vg(e);for(;r&&!Lk(r);){if(_h(r)&&!JA(r))return r;r=Vg(r)}return n}let s=GU(e,t);for(;s&&fRe(s)&&JA(s);)s=GU(s,t);return s&&Lk(s)&&JA(s)&&!wL(s)?n:s||gRe(e)||n}const jRe=async function(e){const t=this.getOffsetParent||Jre,n=this.getDimensions,s=await n(e.floating);return{reference:ARe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function NRe(e){return Sh(e).direction==="rtl"}const IRe={convertOffsetParentRelativeRectToViewportRelativeRect:vRe,getDocumentElement:dm,getClippingRect:TRe,getOffsetParent:Jre,getElementRects:jRe,getClientRects:wRe,getDimensions:ERe,getScale:cy,isElement:_h,isRTL:NRe};function Zre(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function MRe(e,t,n){let s=null,r;const i=dm(e);function o(){var d;clearTimeout(r),(d=s)==null||d.disconnect(),s=null}function l(d,f){d===void 0&&(d=!1),f===void 0&&(f=1),o();const m=e.getBoundingClientRect(),{left:p,top:g,width:b,height:w}=m;if(d||t(),!b||!w)return;const y=U2(g),v=U2(i.clientWidth-(p+b)),x=U2(i.clientHeight-(g+w)),k=U2(p),T={rootMargin:-y+"px "+-v+"px "+-x+"px "+-k+"px",threshold:Mf(0,Bp(1,f))||1};let S=!0;function C(N){const E=N[0].intersectionRatio;if(!Zre(m,e.getBoundingClientRect()))return l();if(E!==f){if(!S)return l();E?l(!1,E):r=setTimeout(()=>{l(!1,1e-7)},1e3)}S=!1}try{s=new IntersectionObserver(C,{...T,root:i.ownerDocument})}catch{s=new IntersectionObserver(C,T)}s.observe(e)}const c=bc(e),u=()=>l(n);return c.addEventListener("resize",u),l(!0),()=>{c.removeEventListener("resize",u),o()}}function RRe(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,u=kL(e),d=r||i?[...u?Pk(u):[],...t?Pk(t):[]]:[];d.forEach(y=>{r&&y.addEventListener("scroll",n),i&&y.addEventListener("resize",n)});const f=u&&l?MRe(u,n,i):null;let m=-1,p=null;o&&(p=new ResizeObserver(y=>{let[v]=y;v&&v.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?Gg(e):null;c&&w();function w(){const y=Gg(e);b&&!Zre(b,y)&&n(),b=y,g=requestAnimationFrame(w)}return n(),()=>{var y;d.forEach(v=>{r&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f==null||f(),(y=p)==null||y.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const DRe=cRe,LRe=uRe,PRe=oRe,ORe=hRe,$Re=aRe,KU=iRe,BRe=dRe,zRe=(e,t,n)=>{const s=new Map,r=n??{},i={...IRe,...r.platform,_c:s};return rRe(e,t,{...r,platform:i})};var FRe=typeof document<"u",qRe=function(){},p4=FRe?h.useLayoutEffect:qRe;function YT(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(!YT(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)&&!YT(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function eie(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function YU(e,t){const n=eie(e);return Math.round(t*n)/n}function ZA(e){const t=h.useRef(e);return p4(()=>{t.current=e}),t}function HRe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:r,elements:{reference:i,floating:o}={},transform:l=!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);YT(m,s)||p(s);const[g,b]=h.useState(null),[w,y]=h.useState(null),v=h.useCallback($=>{$!==T.current&&(T.current=$,b($))},[]),x=h.useCallback($=>{$!==S.current&&(S.current=$,y($))},[]),k=i||g,_=o||w,T=h.useRef(null),S=h.useRef(null),C=h.useRef(d),N=c!=null,E=ZA(c),O=ZA(r),B=ZA(u),D=h.useCallback(()=>{if(!T.current||!S.current)return;const $={placement:t,strategy:n,middleware:m};O.current&&($.platform=O.current),zRe(T.current,S.current,$).then(K=>{const R={...K,isPositioned:B.current!==!1};j.current&&!YT(C.current,R)&&(C.current=R,kd.flushSync(()=>{f(R)}))})},[m,t,n,O,B]);p4(()=>{u===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,f($=>({...$,isPositioned:!1})))},[u]);const j=h.useRef(!1);p4(()=>(j.current=!0,()=>{j.current=!1}),[]),p4(()=>{if(k&&(T.current=k),_&&(S.current=_),k&&_){if(E.current)return E.current(k,_,D);D()}},[k,_,D,E,N]);const L=h.useMemo(()=>({reference:T,floating:S,setReference:v,setFloating:x}),[v,x]),z=h.useMemo(()=>({reference:k,floating:_}),[k,_]),I=h.useMemo(()=>{const $={position:n,left:0,top:0};if(!z.floating)return $;const K=YU(z.floating,d.x),R=YU(z.floating,d.y);return l?{...$,transform:"translate("+K+"px, "+R+"px)",...eie(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:K,top:R}},[n,l,z.floating,d.x,d.y]);return h.useMemo(()=>({...d,update:D,refs:L,elements:z,floatingStyles:I}),[d,D,L,z,I])}const URe=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?KU({element:s.current,padding:r}).fn(n):{}:s?KU({element:s,padding:r}).fn(n):{}}}},WRe=(e,t)=>{const n=DRe(e);return{name:n.name,fn:n.fn,options:[e,t]}},VRe=(e,t)=>{const n=LRe(e);return{name:n.name,fn:n.fn,options:[e,t]}},GRe=(e,t)=>({fn:BRe(e).fn,options:[e,t]}),KRe=(e,t)=>{const n=PRe(e);return{name:n.name,fn:n.fn,options:[e,t]}},YRe=(e,t)=>{const n=ORe(e);return{name:n.name,fn:n.fn,options:[e,t]}},XRe=(e,t)=>{const n=$Re(e);return{name:n.name,fn:n.fn,options:[e,t]}},QRe=(e,t)=>{const n=URe(e);return{name:n.name,fn:n.fn,options:[e,t]}};var JRe="Arrow",tie=h.forwardRef((e,t)=>{const{children:n,width:s=10,height:r=5,...i}=e;return a.jsx(ts.svg,{...i,ref:t,width:s,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});tie.displayName=JRe;var ZRe=tie,_L="Popper",[nie,h0]=Cl(_L),[e9e,sie]=nie(_L),rie=e=>{const{__scopePopper:t,children:n}=e,[s,r]=h.useState(null),[i,o]=h.useState(void 0);return a.jsx(e9e,{scope:t,anchor:s,onAnchorChange:r,placementState:i,setPlacementState:o,children:n})};rie.displayName=_L;var iie="PopperAnchor",oie=h.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...r}=e,i=sie(iie,n),o=h.useRef(null),l=i.onAnchorChange,c=h.useCallback(g=>{o.current=g,g&&l(g)},[l]),u=Rs(t,c),d=h.useRef(null);h.useEffect(()=>{if(!s)return;const g=d.current;d.current=s.current,g!==d.current&&l(d.current)});const f=i.placementState&&CL(i.placementState),m=f==null?void 0:f[0],p=f==null?void 0:f[1];return s?null:a.jsx(ts.div,{"data-radix-popper-side":m,"data-radix-popper-align":p,...r,ref:u})});oie.displayName=iie;var SL="PopperContent",[t9e,n9e]=nie(SL),aie=h.forwardRef((e,t)=>{var le,pe,fe,Q,ne,de;const{__scopePopper:n,side:s="bottom",sideOffset:r=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:g,...b}=e,w=sie(SL,n),[y,v]=h.useState(null),x=Rs(t,v),[k,_]=h.useState(null),T=Q5(k),S=(T==null?void 0:T.width)??0,C=(T==null?void 0:T.height)??0,N=s+(i!=="center"?"-"+i:""),E=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},O=Array.isArray(u)?u:[u],B=O.length>0,D={padding:E,boundary:O.filter(r9e),altBoundary:B},{refs:j,floatingStyles:L,placement:z,isPositioned:I,middlewareData:$}=HRe({strategy:"fixed",placement:N,whileElementsMounted:(...ue)=>RRe(...ue,{animationFrame:p==="always"}),elements:{reference:w.anchor},middleware:[WRe({mainAxis:r+C,alignmentAxis:o}),c&&VRe({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?GRe():void 0,...D}),c&&KRe({...D}),YRe({...D,apply:({elements:ue,rects:me,availableWidth:te,availableHeight:ae})=>{const{width:be,height:se}=me.reference,ve=ue.floating.style;ve.setProperty("--radix-popper-available-width",`${te}px`),ve.setProperty("--radix-popper-available-height",`${ae}px`),ve.setProperty("--radix-popper-anchor-width",`${be}px`),ve.setProperty("--radix-popper-anchor-height",`${se}px`)}}),k&&QRe({element:k,padding:l}),i9e({arrowWidth:S,arrowHeight:C}),m&&XRe({strategy:"referenceHidden",...D,boundary:B?D.boundary:void 0})]}),K=w.setPlacementState;Ba(()=>(K(z),()=>{K(void 0)}),[z,K]);const[R,Y]=CL(z),W=nu(g);Ba(()=>{I&&(W==null||W())},[I,W]);const M=(le=$.arrow)==null?void 0:le.x,F=(pe=$.arrow)==null?void 0:pe.y,J=((fe=$.arrow)==null?void 0:fe.centerOffset)!==0,[V,U]=h.useState();return Ba(()=>{y&&U(window.getComputedStyle(y).zIndex)},[y]),a.jsx("div",{ref:j.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:I?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[(Q=$.transformOrigin)==null?void 0:Q.x,(ne=$.transformOrigin)==null?void 0:ne.y].join(" "),...((de=$.hide)==null?void 0:de.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(t9e,{scope:n,placedSide:R,placedAlign:Y,onArrowChange:_,arrowX:M,arrowY:F,shouldHideArrow:J,children:a.jsx(ts.div,{"data-side":R,"data-align":Y,...b,ref:x,style:{...b.style,animation:I?void 0:"none"}})})})});aie.displayName=SL;var lie="PopperArrow",s9e={top:"bottom",right:"left",bottom:"top",left:"right"},cie=h.forwardRef(function(t,n){const{__scopePopper:s,...r}=t,i=n9e(lie,s),o=s9e[i.placedSide];return a.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:a.jsx(ZRe,{...r,ref:n,style:{...r.style,display:"block"}})})});cie.displayName=lie;function r9e(e){return e!==null}var i9e=e=>({name:"transformOrigin",options:e,fn(t){var w,y,v;const{placement:n,rects:s,middlewareData:r}=t,o=((w=r.arrow)==null?void 0:w.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,d]=CL(n),f={start:"0%",center:"50%",end:"100%"}[d],m=(((y=r.arrow)==null?void 0:y.x)??0)+l/2,p=(((v=r.arrow)==null?void 0:v.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 CL(e){const[t,n="center"]=e.split("-");return[t,n]}var O_=rie,$_=oie,r6=aie,i6=cie,ej=!1;function o9e(){const[e,t]=h.useState(ej);return h.useEffect(()=>{ej||(ej=!0,t(!0))},[]),e}var uie=W3[" useSyncExternalStore ".trim().toString()];function a9e(){return()=>{}}function l9e(){return uie(a9e,()=>!0,()=>!1)}var c9e=typeof uie=="function"?l9e:o9e,tj="rovingFocusGroup.onEntryFocus",u9e={bubbles:!1,cancelable:!0},B_="RovingFocusGroup",[UI,die,d9e]=dL(B_),[h9e,f0]=Cl(B_,[d9e]),[f9e,m9e]=h9e(B_),hie=h.forwardRef((e,t)=>a.jsx(UI.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(UI.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(p9e,{...e,ref:t})})}));hie.displayName=B_;var p9e=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:r=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,m=h.useRef(null),p=Rs(t,m),g=Ev(i),[b,w]=Kl({prop:o,defaultProp:l??null,onChange:c,caller:B_}),[y,v]=h.useState(!1),x=nu(u),k=die(n),_=h.useRef(!1),[T,S]=h.useState(0);return h.useEffect(()=>{const C=m.current;if(C)return C.addEventListener(tj,x),()=>C.removeEventListener(tj,x)},[x]),a.jsx(f9e,{scope:n,orientation:s,dir:g,loop:r,currentTabStopId:b,onItemFocus:h.useCallback(C=>w(C),[w]),onItemShiftTab:h.useCallback(()=>v(!0),[]),onFocusableItemAdd:h.useCallback(()=>S(C=>C+1),[]),onFocusableItemRemove:h.useCallback(()=>S(C=>C-1),[]),children:a.jsx(ts.div,{tabIndex:y||T===0?-1:0,"data-orientation":s,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:yn(e.onMouseDown,()=>{_.current=!0}),onFocus:yn(e.onFocus,C=>{const N=!_.current;if(C.target===C.currentTarget&&N&&!y){const E=new CustomEvent(tj,u9e);if(C.currentTarget.dispatchEvent(E),!E.defaultPrevented){const O=k().filter(z=>z.focusable),B=O.find(z=>z.active),D=O.find(z=>z.id===b),L=[B,D,...O].filter(Boolean).map(z=>z.ref.current);pie(L,d)}}_.current=!1}),onBlur:yn(e.onBlur,()=>v(!1))})})}),fie="RovingFocusGroupItem",mie=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:r=!1,tabStopId:i,children:o,...l}=e,c=gc(),u=i||c,d=m9e(fie,n),f=d.currentTabStopId===u,m=die(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:b}=d,w=c9e();return Ba(()=>{if(!(!w||!s))return p(),()=>g()},[w,s,p,g]),h.useEffect(()=>{if(!(w||!s))return p(),()=>g()},[w,s,p,g]),a.jsx(UI.ItemSlot,{scope:n,id:u,focusable:s,active:r,children:a.jsx(ts.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:yn(e.onMouseDown,y=>{s?d.onItemFocus(u):y.preventDefault()}),onFocus:yn(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:yn(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){d.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const v=y9e(y,d.orientation,d.dir);if(v!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let k=m().filter(_=>_.focusable).map(_=>_.ref.current);if(v==="last")k.reverse();else if(v==="prev"||v==="next"){v==="prev"&&k.reverse();const _=k.indexOf(y.currentTarget);k=d.loop?v9e(k,_+1):k.slice(_+1)}setTimeout(()=>pie(k))}}),children:typeof o=="function"?o({isCurrentTabStop:f,hasTabStop:b!=null}):o})})});mie.displayName=fie;var g9e={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function b9e(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function y9e(e,t,n){const s=b9e(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return g9e[s]}function pie(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function v9e(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var o6=hie,a6=mie,WI=["Enter"," "],w9e=["ArrowDown","PageUp","Home"],gie=["ArrowUp","PageDown","End"],x9e=[...w9e,...gie],k9e={ltr:[...WI,"ArrowRight"],rtl:[...WI,"ArrowLeft"]},_9e={ltr:["ArrowLeft"],rtl:["ArrowRight"]},z_="Menu",[Ok,S9e,C9e]=dL(z_),[b1,bie]=Cl(z_,[C9e,h0,f0]),F_=h0(),yie=f0(),[vie,m0]=b1(z_),[T9e,q_]=b1(z_),wie=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:r,onOpenChange:i,modal:o=!0}=e,l=F_(t),[c,u]=h.useState(null),d=h.useRef(!1),f=nu(i),m=Ev(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]),a.jsx(O_,{...l,children:a.jsx(vie,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:u,children:a.jsx(T9e,{scope:t,onClose:h.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:m,modal:o,children:s})})})};wie.displayName=z_;var E9e="MenuAnchor",TL=h.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,r=F_(n);return a.jsx($_,{...r,...s,ref:t})});TL.displayName=E9e;var EL="MenuPortal",[A9e,xie]=b1(EL,{forceMount:void 0}),kie=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:r}=e,i=m0(EL,t);return a.jsx(A9e,{scope:t,forceMount:n,children:a.jsx(Tl,{present:n||i.open,children:a.jsx(jv,{asChild:!0,container:r,children:s})})})};kie.displayName=EL;var Bu="MenuContent",[j9e,AL]=b1(Bu),_ie=h.forwardRef((e,t)=>{const n=xie(Bu,e.__scopeMenu),{forceMount:s=n.forceMount,...r}=e,i=m0(Bu,e.__scopeMenu),o=q_(Bu,e.__scopeMenu);return a.jsx(Ok.Provider,{scope:e.__scopeMenu,children:a.jsx(Tl,{present:s||i.open,children:a.jsx(Ok.Slot,{scope:e.__scopeMenu,children:o.modal?a.jsx(N9e,{...r,ref:t}):a.jsx(I9e,{...r,ref:t})})})})}),N9e=h.forwardRef((e,t)=>{const n=m0(Bu,e.__scopeMenu),s=h.useRef(null),r=Rs(t,s);return h.useEffect(()=>{const i=s.current;if(i)return H5(i)},[]),a.jsx(jL,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:yn(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),I9e=h.forwardRef((e,t)=>{const n=m0(Bu,e.__scopeMenu);return a.jsx(jL,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),M9e=$p("MenuContent.ScrollLock"),jL=h.forwardRef((e,t)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:p,disableOutsideScroll:g,...b}=e,w=m0(Bu,n),y=q_(Bu,n),v=F_(n),x=yie(n),k=S9e(n),[_,T]=h.useState(null),S=h.useRef(null),C=Rs(t,S,w.onContentChange),N=h.useRef(0),E=h.useRef(""),O=h.useRef(0),B=h.useRef(null),D=h.useRef("right"),j=h.useRef(0),L=g?P_:h.Fragment,z=g?{as:M9e,allowPinchZoom:!0}:void 0,I=K=>{var U,le;const R=E.current+K,Y=k().filter(pe=>!pe.disabled),W=document.activeElement,M=(U=Y.find(pe=>pe.ref.current===W))==null?void 0:U.textValue,F=Y.map(pe=>pe.textValue),J=U9e(F,R,M),V=(le=Y.find(pe=>pe.textValue===J))==null?void 0:le.ref.current;(function pe(fe){E.current=fe,window.clearTimeout(N.current),fe!==""&&(N.current=window.setTimeout(()=>pe(""),1e3))})(R),V&&setTimeout(()=>V.focus())};h.useEffect(()=>()=>window.clearTimeout(N.current),[]),F5();const $=h.useCallback(K=>{var Y,W;return D.current===((Y=B.current)==null?void 0:Y.side)&&V9e(K,(W=B.current)==null?void 0:W.area)},[]);return a.jsx(j9e,{scope:n,searchRef:E,onItemEnter:h.useCallback(K=>{$(K)&&K.preventDefault()},[$]),onItemLeave:h.useCallback(K=>{var R;$(K)||((R=S.current)==null||R.focus(),T(null))},[$]),onTriggerLeave:h.useCallback(K=>{$(K)&&K.preventDefault()},[$]),pointerGraceTimerRef:O,onPointerGraceIntentChange:h.useCallback(K=>{B.current=K},[]),children:a.jsx(L,{...z,children:a.jsx(L_,{asChild:!0,trapped:r,onMountAutoFocus:yn(i,K=>{var R;K.preventDefault(),(R=S.current)==null||R.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:a.jsx(Av,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:p,children:a.jsx(o6,{asChild:!0,...x,dir:y.dir,orientation:"vertical",loop:s,currentTabStopId:_,onCurrentTabStopIdChange:T,onEntryFocus:yn(c,K=>{y.isUsingKeyboardRef.current||K.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(r6,{role:"menu","aria-orientation":"vertical","data-state":zie(w.open),"data-radix-menu-content":"",dir:y.dir,...v,...b,ref:C,style:{outline:"none",...b.style},onKeyDown:yn(b.onKeyDown,K=>{const Y=K.target.closest("[data-radix-menu-content]")===K.currentTarget,W=K.ctrlKey||K.altKey||K.metaKey,M=K.key.length===1;Y&&(K.key==="Tab"&&K.preventDefault(),!W&&M&&I(K.key));const F=S.current;if(K.target!==F||!x9e.includes(K.key))return;K.preventDefault();const V=k().filter(U=>!U.disabled).map(U=>U.ref.current);gie.includes(K.key)&&V.reverse(),q9e(V)}),onBlur:yn(e.onBlur,K=>{K.currentTarget.contains(K.target)||(window.clearTimeout(N.current),E.current="")}),onPointerMove:yn(e.onPointerMove,$k(K=>{const R=K.target,Y=j.current!==K.clientX;if(K.currentTarget.contains(R)&&Y){const W=K.clientX>j.current?"right":"left";D.current=W,j.current=K.clientX}}))})})})})})})});_ie.displayName=Bu;var R9e="MenuGroup",NL=h.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return a.jsx(ts.div,{role:"group",...s,ref:t})});NL.displayName=R9e;var D9e="MenuLabel",Sie=h.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return a.jsx(ts.div,{...s,ref:t})});Sie.displayName=D9e;var XT="MenuItem",XU="menu.itemSelect",l6=h.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...r}=e,i=h.useRef(null),o=q_(XT,e.__scopeMenu),l=AL(XT,e.__scopeMenu),c=Rs(t,i),u=h.useRef(!1),d=()=>{const f=i.current;if(!n&&f){const m=new CustomEvent(XU,{bubbles:!0,cancelable:!0});f.addEventListener(XU,p=>s==null?void 0:s(p),{once:!0}),sre(f,m),m.defaultPrevented?u.current=!1:o.onClose()}};return a.jsx(Cie,{...r,ref:c,disabled:n,onClick:yn(e.onClick,d),onPointerDown:f=>{var m;(m=e.onPointerDown)==null||m.call(e,f),u.current=!0},onPointerUp:yn(e.onPointerUp,f=>{var m;u.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:yn(e.onKeyDown,f=>{n||f.target!==f.currentTarget||l.searchRef.current!==""&&f.key===" "||WI.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});l6.displayName=XT;var Cie=h.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:r,...i}=e,o=AL(XT,n),l=yie(n),c=h.useRef(null),u=Rs(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]),a.jsx(Ok.ItemSlot,{scope:n,disabled:s,textValue:r??m,children:a.jsx(a6,{asChild:!0,...l,focusable:!s,children:a.jsx(ts.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...i,ref:u,onPointerMove:yn(e.onPointerMove,$k(g=>{s?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:yn(e.onPointerLeave,$k(g=>o.onItemLeave(g))),onFocus:yn(e.onFocus,()=>f(!0)),onBlur:yn(e.onBlur,()=>f(!1))})})})}),L9e="MenuCheckboxItem",Tie=h.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...r}=e;return a.jsx(Iie,{scope:e.__scopeMenu,checked:n,children:a.jsx(l6,{role:"menuitemcheckbox","aria-checked":QT(n)?"mixed":n,...r,ref:t,"data-state":RL(n),onSelect:yn(r.onSelect,()=>s==null?void 0:s(QT(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Tie.displayName=L9e;var Eie="MenuRadioGroup",[P9e,O9e]=b1(Eie,{value:void 0,onValueChange:()=>{}}),Aie=h.forwardRef((e,t)=>{const{value:n,onValueChange:s,...r}=e,i=nu(s);return a.jsx(P9e,{scope:e.__scopeMenu,value:n,onValueChange:i,children:a.jsx(NL,{...r,ref:t})})});Aie.displayName=Eie;var jie="MenuRadioItem",Nie=h.forwardRef((e,t)=>{const{value:n,...s}=e,r=O9e(jie,e.__scopeMenu),i=n===r.value;return a.jsx(Iie,{scope:e.__scopeMenu,checked:i,children:a.jsx(l6,{role:"menuitemradio","aria-checked":i,...s,ref:t,"data-state":RL(i),onSelect:yn(s.onSelect,()=>{var o;return(o=r.onValueChange)==null?void 0:o.call(r,n)},{checkForDefaultPrevented:!1})})})});Nie.displayName=jie;var IL="MenuItemIndicator",[Iie,$9e]=b1(IL,{checked:!1}),Mie=h.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...r}=e,i=$9e(IL,n);return a.jsx(Tl,{present:s||QT(i.checked)||i.checked===!0,children:a.jsx(ts.span,{...r,ref:t,"data-state":RL(i.checked)})})});Mie.displayName=IL;var B9e="MenuSeparator",Rie=h.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return a.jsx(ts.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});Rie.displayName=B9e;var z9e="MenuArrow",Die=h.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,r=F_(n);return a.jsx(i6,{...r,...s,ref:t})});Die.displayName=z9e;var ML="MenuSub",[F9e,Lie]=b1(ML),Pie=e=>{const{__scopeMenu:t,children:n,open:s=!1,onOpenChange:r}=e,i=m0(ML,t),o=F_(t),[l,c]=h.useState(null),[u,d]=h.useState(null),f=nu(r);return h.useEffect(()=>(i.open===!1&&f(!1),()=>f(!1)),[i.open,f]),a.jsx(O_,{...o,children:a.jsx(vie,{scope:t,open:s,onOpenChange:f,content:u,onContentChange:d,children:a.jsx(F9e,{scope:t,contentId:gc(),triggerId:gc(),trigger:l,onTriggerChange:c,children:n})})})};Pie.displayName=ML;var hx="MenuSubTrigger",Oie=h.forwardRef((e,t)=>{const n=m0(hx,e.__scopeMenu),s=q_(hx,e.__scopeMenu),r=Lie(hx,e.__scopeMenu),i=AL(hx,e.__scopeMenu),o=h.useRef(null),{pointerGraceTimerRef:l,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=l.current;return()=>{window.clearTimeout(m),c(null)}},[l,c]);const f=Rs(t,r.onTriggerChange);return a.jsx(TL,{asChild:!0,...u,children:a.jsx(Cie,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":n.open?r.contentId:void 0,"data-state":zie(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:yn(e.onPointerMove,$k(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:yn(e.onPointerLeave,$k(m=>{var g,b;d();const p=(g=n.content)==null?void 0:g.getBoundingClientRect();if(p){const w=(b=n.content)==null?void 0:b.dataset.side,y=w==="right",v=y?-5:5,x=p[y?"left":"right"],k=p[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:m.clientX+v,y:m.clientY},{x,y:p.top},{x:k,y:p.top},{x:k,y:p.bottom},{x,y:p.bottom}],side:w}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(m),m.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:yn(e.onKeyDown,m=>{var g;e.disabled||m.target!==m.currentTarget||i.searchRef.current!==""&&m.key===" "||k9e[s.dir].includes(m.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),m.preventDefault())})})})});Oie.displayName=hx;var $ie="MenuSubContent",Bie=h.forwardRef((e,t)=>{const n=xie(Bu,e.__scopeMenu),{forceMount:s=n.forceMount,align:r="start",...i}=e,o=m0(Bu,e.__scopeMenu),l=q_(Bu,e.__scopeMenu),c=Lie($ie,e.__scopeMenu),u=h.useRef(null),d=Rs(t,u);return a.jsx(Ok.Provider,{scope:e.__scopeMenu,children:a.jsx(Tl,{present:s||o.open,children:a.jsx(Ok.Slot,{scope:e.__scopeMenu,children:a.jsx(jL,{id:c.contentId,"aria-labelledby":c.triggerId,...i,ref:d,align:r,side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var m;l.isUsingKeyboardRef.current&&((m=u.current)==null||m.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:yn(e.onFocusOutside,f=>{f.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:yn(e.onEscapeKeyDown,f=>{l.onClose(),f.preventDefault()}),onKeyDown:yn(e.onKeyDown,f=>{var g;const m=f.currentTarget.contains(f.target),p=_9e[l.dir].includes(f.key);m&&p&&(o.onOpenChange(!1),(g=c.trigger)==null||g.focus(),f.preventDefault())})})})})})});Bie.displayName=$ie;function zie(e){return e?"open":"closed"}function QT(e){return e==="indeterminate"}function RL(e){return QT(e)?"indeterminate":e?"checked":"unchecked"}function q9e(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function H9e(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function U9e(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=H9e(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 W9e(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 l=t[i],c=t[o],u=l.x,d=l.y,f=c.x,m=c.y;d>s!=m>s&&n<(f-u)*(s-d)/(m-d)+u&&(r=!r)}return r}function V9e(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return W9e(n,t)}function $k(e){return t=>t.pointerType==="mouse"?e(t):void 0}var G9e=wie,K9e=TL,Y9e=kie,X9e=_ie,Q9e=NL,J9e=Sie,Z9e=l6,eDe=Tie,tDe=Aie,nDe=Nie,sDe=Mie,rDe=Rie,iDe=Die,oDe=Pie,aDe=Oie,lDe=Bie,c6="DropdownMenu",[cDe,PDt]=Cl(c6,[bie]),El=bie(),[uDe,Fie]=cDe(c6),qie=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:r,defaultOpen:i,onOpenChange:o,modal:l=!0}=e,c=El(t),u=h.useRef(null),[d,f]=Kl({prop:r,defaultProp:i??!1,onChange:o,caller:c6});return a.jsx(uDe,{scope:t,triggerId:gc(),triggerRef:u,contentId:gc(),open:d,onOpenChange:f,onOpenToggle:h.useCallback(()=>f(m=>!m),[f]),modal:l,children:a.jsx(G9e,{...c,open:d,onOpenChange:f,dir:s,modal:l,children:n})})};qie.displayName=c6;var Hie="DropdownMenuTrigger",Uie=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...r}=e,i=Fie(Hie,n),o=El(n),l=Rs(t,i.triggerRef);return a.jsx(K9e,{asChild:!0,...o,children:a.jsx(ts.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:l,onPointerDown:yn(e.onPointerDown,c=>{!s&&c.button===0&&c.ctrlKey===!1&&(i.onOpenToggle(),i.open||c.preventDefault())}),onKeyDown:yn(e.onKeyDown,c=>{s||(["Enter"," "].includes(c.key)&&i.onOpenToggle(),c.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});Uie.displayName=Hie;var dDe="DropdownMenuPortal",Wie=e=>{const{__scopeDropdownMenu:t,...n}=e,s=El(t);return a.jsx(Y9e,{...s,...n})};Wie.displayName=dDe;var Vie="DropdownMenuContent",Gie=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Fie(Vie,n),i=El(n),o=h.useRef(!1);return a.jsx(X9e,{id:r.contentId,"aria-labelledby":r.triggerId,...i,...s,ref:t,onCloseAutoFocus:yn(e.onCloseAutoFocus,l=>{var c;o.current||(c=r.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:yn(e.onInteractOutside,l=>{const c=l.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)"}})});Gie.displayName=Vie;var hDe="DropdownMenuGroup",Kie=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=El(n);return a.jsx(Q9e,{...r,...s,ref:t})});Kie.displayName=hDe;var fDe="DropdownMenuLabel",mDe=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=El(n);return a.jsx(J9e,{...r,...s,ref:t})});mDe.displayName=fDe;var pDe="DropdownMenuItem",Yie=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=El(n);return a.jsx(Z9e,{...r,...s,ref:t})});Yie.displayName=pDe;var gDe="DropdownMenuCheckboxItem",bDe=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=El(n);return a.jsx(eDe,{...r,...s,ref:t})});bDe.displayName=gDe;var yDe="DropdownMenuRadioGroup",Xie=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=El(n);return a.jsx(tDe,{...r,...s,ref:t})});Xie.displayName=yDe;var vDe="DropdownMenuRadioItem",Qie=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=El(n);return a.jsx(nDe,{...r,...s,ref:t})});Qie.displayName=vDe;var wDe="DropdownMenuItemIndicator",Jie=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=El(n);return a.jsx(sDe,{...r,...s,ref:t})});Jie.displayName=wDe;var xDe="DropdownMenuSeparator",Zie=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=El(n);return a.jsx(rDe,{...r,...s,ref:t})});Zie.displayName=xDe;var kDe="DropdownMenuArrow",_De=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=El(n);return a.jsx(iDe,{...r,...s,ref:t})});_De.displayName=kDe;var SDe=e=>{const{__scopeDropdownMenu:t,children:n,open:s,onOpenChange:r,defaultOpen:i}=e,o=El(t),[l,c]=Kl({prop:s,defaultProp:i??!1,onChange:r,caller:"DropdownMenuSub"});return a.jsx(oDe,{...o,open:l,onOpenChange:c,children:n})},CDe="DropdownMenuSubTrigger",eoe=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=El(n);return a.jsx(aDe,{...r,...s,ref:t})});eoe.displayName=CDe;var TDe="DropdownMenuSubContent",toe=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=El(n);return a.jsx(lDe,{...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)"}})});toe.displayName=TDe;var EDe=qie,ADe=Uie,jDe=Wie,NDe=Gie,IDe=Kie,MDe=Yie,RDe=Xie,DDe=Qie,LDe=Jie,PDe=Zie,ODe=SDe,$De=eoe,BDe=toe,zDe="Label",noe=h.forwardRef((e,t)=>a.jsx(ts.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())}}));noe.displayName=zDe;var FDe=noe;function QU(e,[t,n]){return Math.min(n,Math.max(t,e))}var u6="Popover",[soe,ODt]=Cl(u6,[h0]),H_=h0(),[qDe,p0]=soe(u6),roe=e=>{const{__scopePopover:t,children:n,open:s,defaultOpen:r,onOpenChange:i,modal:o=!1}=e,l=H_(t),c=h.useRef(null),[u,d]=h.useState(!1),[f,m]=Kl({prop:s,defaultProp:r??!1,onChange:i,caller:u6});return a.jsx(O_,{...l,children:a.jsx(qDe,{scope:t,contentId:gc(),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})})};roe.displayName=u6;var ioe="PopoverAnchor",ooe=h.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=p0(ioe,n),i=H_(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=r;return h.useEffect(()=>(o(),()=>l()),[o,l]),a.jsx($_,{...i,...s,ref:t})});ooe.displayName=ioe;var aoe="PopoverTrigger",loe=h.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=p0(aoe,n),i=H_(n),o=Rs(t,r.triggerRef),l=a.jsx(ts.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":foe(r.open),...s,ref:o,onClick:yn(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?l:a.jsx($_,{asChild:!0,...i,children:l})});loe.displayName=aoe;var DL="PopoverPortal",[HDe,UDe]=soe(DL,{forceMount:void 0}),coe=e=>{const{__scopePopover:t,forceMount:n,children:s,container:r}=e,i=p0(DL,t);return a.jsx(HDe,{scope:t,forceMount:n,children:a.jsx(Tl,{present:n||i.open,children:a.jsx(jv,{asChild:!0,container:r,children:s})})})};coe.displayName=DL;var $y="PopoverContent",uoe=h.forwardRef((e,t)=>{const n=UDe($y,e.__scopePopover),{forceMount:s=n.forceMount,...r}=e,i=p0($y,e.__scopePopover);return a.jsx(Tl,{present:s||i.open,children:i.modal?a.jsx(VDe,{...r,ref:t}):a.jsx(GDe,{...r,ref:t})})});uoe.displayName=$y;var WDe=$p("PopoverContent.RemoveScroll"),VDe=h.forwardRef((e,t)=>{const n=p0($y,e.__scopePopover),s=h.useRef(null),r=Rs(t,s),i=h.useRef(!1);return h.useEffect(()=>{const o=s.current;if(o)return H5(o)},[]),a.jsx(P_,{as:WDe,allowPinchZoom:!0,children:a.jsx(doe,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:yn(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:yn(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;i.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:yn(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),GDe=h.forwardRef((e,t)=>{const n=p0($y,e.__scopePopover),s=h.useRef(!1),r=h.useRef(!1);return a.jsx(doe,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(s.current||(l=n.triggerRef.current)==null||l.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()}})}),doe=h.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...f}=e,m=p0($y,n),p=H_(n);return F5(),a.jsx(L_,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:i,children:a.jsx(Av,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>m.onOpenChange(!1),deferPointerDownOutside:!0,children:a.jsx(r6,{"data-state":foe(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)"}})})})}),hoe="PopoverClose",KDe=h.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=p0(hoe,n);return a.jsx(ts.button,{type:"button",...s,ref:t,onClick:yn(e.onClick,()=>r.onOpenChange(!1))})});KDe.displayName=hoe;var YDe="PopoverArrow",XDe=h.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=H_(n);return a.jsx(i6,{...r,...s,ref:t})});XDe.displayName=YDe;function foe(e){return e?"open":"closed"}var QDe=roe,JDe=ooe,ZDe=loe,eLe=coe,tLe=uoe,LL="Radio",[nLe,moe]=Cl(LL),[sLe,d6]=nLe(LL);function poe(e){const{__scopeRadio:t,checked:n=!1,children:s,disabled:r,form:i,name:o,onCheck:l,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),w=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:w,bubbleInput:p,setBubbleInput:g,onCheck:()=>l==null?void 0:l()};return a.jsx(sLe,{scope:t,...y,children:iLe(d)?d(y):s})}var goe="RadioTrigger",PL=h.forwardRef(({__scopeRadio:e,onClick:t,...n},s)=>{const{checked:r,disabled:i,value:o,setControl:l,onCheck:c,hasConsumerStoppedPropagationRef:u,isFormControl:d,bubbleInput:f}=d6(goe,e),m=Rs(s,l);return a.jsx(ts.button,{type:"button",role:"radio","aria-checked":r,"data-state":woe(r),"data-disabled":i?"":void 0,disabled:i,value:o,...n,ref:m,onClick:yn(t,p=>{r||c(),f&&d&&(u.current=p.isPropagationStopped(),u.current||p.stopPropagation())})})});PL.displayName=goe;var rLe=h.forwardRef((e,t)=>{const{__scopeRadio:n,name:s,checked:r,required:i,disabled:o,value:l,onCheck:c,form:u,...d}=e;return a.jsx(poe,{__scopeRadio:n,checked:r,disabled:o,required:i,onCheck:c,name:s,form:u,value:l,internal_do_not_use_render:({isFormControl:f})=>a.jsxs(a.Fragment,{children:[a.jsx(PL,{...d,ref:t,__scopeRadio:n}),f&&a.jsx(OL,{__scopeRadio:n})]})})});rLe.displayName=LL;var boe="RadioIndicator",yoe=h.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:s,...r}=e,i=d6(boe,n);return a.jsx(Tl,{present:s||i.checked,children:a.jsx(ts.span,{"data-state":woe(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})})});yoe.displayName=boe;var voe="RadioBubbleInput",OL=h.forwardRef(({__scopeRadio:e,...t},n)=>{const{control:s,checked:r,required:i,disabled:o,name:l,value:c,form:u,bubbleInput:d,setBubbleInput:f,hasConsumerStoppedPropagationRef:m}=d6(voe,e),p=Rs(n,f),g=X5(r),b=Q5(s);h.useEffect(()=>{const y=d;if(!y)return;const v=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(v,"checked").set,_=!m.current;if(g!==r&&k){const T=new Event("click",{bubbles:_});k.call(y,r),y.dispatchEvent(T)}},[d,g,r,m]);const w=h.useRef(r);return a.jsx(ts.input,{type:"radio","aria-hidden":!0,defaultChecked:w.current,required:i,disabled:o,name:l,value:c,form:u,...t,tabIndex:-1,ref:p,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});OL.displayName=voe;function iLe(e){return typeof e=="function"}function woe(e){return e?"checked":"unchecked"}var oLe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],h6="RadioGroup",[aLe,$Dt]=Cl(h6,[f0,moe]),xoe=f0(),f6=moe(),[lLe,cLe]=aLe(h6),koe=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:s,form:r,defaultValue:i,value:o,required:l=!1,disabled:c=!1,orientation:u,dir:d,loop:f=!0,onValueChange:m,...p}=e,g=xoe(n),b=Ev(d),[w,y]=Kl({prop:o,defaultProp:i??null,onChange:m,caller:h6}),[v,x]=h.useState(null),k=Rs(t,x),_=h.useRef(w);return h.useEffect(()=>{const T=r?v==null?void 0:v.ownerDocument.getElementById(r):v==null?void 0:v.closest("form");if(T instanceof HTMLFormElement){const S=()=>y(_.current);return T.addEventListener("reset",S),()=>T.removeEventListener("reset",S)}},[v,r,y]),a.jsx(lLe,{scope:n,name:s,form:r,required:l,disabled:c,value:w,onValueChange:y,children:a.jsx(o6,{asChild:!0,...g,orientation:u,dir:b,loop:f,children:a.jsx(ts.div,{role:"radiogroup","aria-required":l,"aria-orientation":u,"data-disabled":c?"":void 0,dir:b,...p,ref:k})})})});koe.displayName=h6;var uLe="RadioGroupItem",dLe="RadioGroupItemProvider",_oe="RadioGroupItemTrigger",hLe="RadioGroupItemBubbleInput";function fLe(e){const{__scopeRadioGroup:t,value:n,disabled:s,children:r,internal_do_not_use_render:i}=e,o=cLe(dLe,t),l=f6(t),c=o.disabled||s;return a.jsx(poe,{...l,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 Soe=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,r=xoe(n),i=f6(n),{checked:o,disabled:l}=d6(_oe,i.__scopeRadio),c=h.useRef(null),u=Rs(t,c),d=h.useRef(!1);return h.useEffect(()=>{const f=p=>{oLe.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)}},[]),a.jsx(a6,{asChild:!0,...r,focusable:!l,active:o,children:a.jsx(PL,{...i,...s,ref:u,onKeyDown:yn(s.onKeyDown,f=>{f.key==="Enter"&&f.preventDefault()}),onFocus:yn(s.onFocus,()=>{var f;d.current&&((f=c.current)==null||f.click())})})})});Soe.displayName=_oe;var Coe=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,value:s,disabled:r,...i}=e;return a.jsx(fLe,{__scopeRadioGroup:n,value:s,disabled:r,internal_do_not_use_render:({isFormControl:o})=>a.jsxs(a.Fragment,{children:[a.jsx(Soe,{...i,ref:t,__scopeRadioGroup:n}),o&&a.jsx(Toe,{__scopeRadioGroup:n})]})})});Coe.displayName=uLe;var Toe=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,r=f6(n);return a.jsx(OL,{...r,...s,ref:t})});Toe.displayName=hLe;var mLe="RadioGroupIndicator",Eoe=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,r=f6(n);return a.jsx(yoe,{...r,...s,ref:t})});Eoe.displayName=mLe;var pLe=[" ","Enter","ArrowUp","ArrowDown"],gLe=[" ","Enter"],Kg="Select",[m6,p6,bLe]=dL(Kg),[y1,BDt]=Cl(Kg,[bLe,h0]),g6=h0(),[yLe,g0]=y1(Kg),[vLe,wLe]=y1(Kg),xLe="SelectProvider";function Aoe(e){const{__scopeSelect:t,children:n,open:s,defaultOpen:r,onOpenChange:i,value:o,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:m,required:p,form:g,internal_do_not_use_render:b}=e,w=g6(t),[y,v]=h.useState(null),[x,k]=h.useState(null),[_,T]=h.useState(!1),S=Ev(u),[C,N]=Kl({prop:s,defaultProp:r??!1,onChange:i,caller:Kg}),[E,O]=Kl({prop:o,defaultProp:l,onChange:c,caller:Kg}),B=h.useRef(null),D=h.useRef(E);h.useEffect(()=>{const W=g?y==null?void 0:y.ownerDocument.getElementById(g):y==null?void 0:y.form;if(W instanceof HTMLFormElement){const M=()=>O(D.current);return W.addEventListener("reset",M),()=>W.removeEventListener("reset",M)}},[g,y,O]);const j=y?!!g||!!y.closest("form"):!0,[L,z]=h.useState(new Set),I=gc(),$=Array.from(L).map(W=>W.props.value).join(";"),K=h.useCallback(W=>{z(M=>new Set(M).add(W))},[]),R=h.useCallback(W=>{z(M=>{const F=new Set(M);return F.delete(W),F})},[]),Y={required:p,trigger:y,onTriggerChange:v,valueNode:x,onValueNodeChange:k,valueNodeHasChildren:_,onValueNodeHasChildrenChange:T,contentId:I,value:E,onValueChange:O,open:C,onOpenChange:N,dir:S,triggerPointerDownPosRef:B,disabled:m,name:d,autoComplete:f,form:g,nativeOptions:L,nativeSelectKey:$,isFormControl:j};return a.jsx(O_,{...w,children:a.jsx(yLe,{scope:t,...Y,children:a.jsx(m6.Provider,{scope:t,children:a.jsx(vLe,{scope:t,onNativeOptionAdd:K,onNativeOptionRemove:R,children:OLe(b)?b(Y):n})})})})}Aoe.displayName=xLe;var joe=e=>{const{__scopeSelect:t,children:n,...s}=e;return a.jsx(Aoe,{__scopeSelect:t,...s,internal_do_not_use_render:({isFormControl:r})=>a.jsxs(a.Fragment,{children:[n,r?a.jsx(nae,{__scopeSelect:t}):null]})})};joe.displayName=Kg;var Noe="SelectTrigger",Ioe=h.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...r}=e,i=g6(n),o=g0(Noe,n),l=o.disabled||s,c=Rs(t,o.onTriggerChange),u=p6(n),d=h.useRef("touch"),[f,m,p]=sae(b=>{const w=u().filter(x=>!x.disabled),y=w.find(x=>x.value===o.value),v=rae(w,b,y);v!==void 0&&o.onValueChange(v.value)}),g=b=>{l||(o.onOpenChange(!0),p()),b&&(o.triggerPointerDownPosRef.current={x:Math.round(b.pageX),y:Math.round(b.pageY)})};return a.jsx($_,{asChild:!0,...i,children:a.jsx(ts.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:l,"data-disabled":l?"":void 0,"data-placeholder":b6(o.value)?"":void 0,...r,ref:c,onClick:yn(r.onClick,b=>{b.currentTarget.focus(),d.current!=="mouse"&&g(b)}),onPointerDown:yn(r.onPointerDown,b=>{d.current=b.pointerType;const w=b.target;w.hasPointerCapture(b.pointerId)&&w.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(g(b),b.preventDefault())}),onKeyDown:yn(r.onKeyDown,b=>{const w=f.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&m(b.key),!(w&&b.key===" ")&&pLe.includes(b.key)&&(g(),b.preventDefault())})})})});Ioe.displayName=Noe;var Moe="SelectValue",Roe=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:r,children:i,placeholder:o="",...l}=e,c=g0(Moe,n),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,f=Rs(t,c.onValueNodeChange);Ba(()=>{u(d)},[u,d]);const m=b6(c.value);return a.jsx(ts.span,{...l,asChild:m?!1:l.asChild,ref:f,style:{pointerEvents:"none"},children:a.jsx(h.Fragment,{children:m?o:i},m?"placeholder":"value")})});Roe.displayName=Moe;var kLe="SelectIcon",Doe=h.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...r}=e;return a.jsx(ts.span,{"aria-hidden":!0,...r,ref:t,children:s||"▼"})});Doe.displayName=kLe;var Loe="SelectPortal",[_Le,SLe]=y1(Loe,{forceMount:void 0}),Poe=e=>{const{__scopeSelect:t,forceMount:n,...s}=e;return a.jsx(_Le,{scope:e.__scopeSelect,forceMount:n,children:a.jsx(jv,{asChild:!0,...s})})};Poe.displayName=Loe;var Fp="SelectContent",Ooe=h.forwardRef((e,t)=>{const n=SLe(Fp,e.__scopeSelect),{forceMount:s=n.forceMount,...r}=e,i=g0(Fp,e.__scopeSelect),[o,l]=h.useState();return Ba(()=>{l(new DocumentFragment)},[]),a.jsx(Tl,{present:s||i.open,children:({present:c})=>c?a.jsx(zoe,{...r,ref:t}):a.jsx($oe,{...r,fragment:o})})});Ooe.displayName=Fp;var $oe=h.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,fragment:r}=e;return r?kd.createPortal(a.jsx(Boe,{scope:n,children:a.jsx(m6.Slot,{scope:n,children:a.jsx("div",{ref:t,children:s})})}),r):null});$oe.displayName="SelectContentFragment";var od=10,[Boe,b0]=y1(Fp),CLe="SelectContentImpl",TLe=$p("SelectContent.RemoveScroll"),zoe=h.forwardRef((e,t)=>{const{__scopeSelect:n}=e,{position:s="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:i,onPointerDownOutside:o,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:b,avoidCollisions:w,...y}=e,v=g0(Fp,n),[x,k]=h.useState(null),[_,T]=h.useState(null),S=Rs(t,k),[C,N]=h.useState(null),[E,O]=h.useState(null),B=p6(n),[D,j]=h.useState(!1),L=h.useRef(!1);h.useEffect(()=>{if(x)return H5(x)},[x]),F5();const z=h.useCallback(U=>{const[le,...pe]=B().map(ne=>ne.ref.current),[fe]=pe.slice(-1),Q=document.activeElement;for(const ne of U)if(ne===Q||(ne==null||ne.scrollIntoView({block:"nearest"}),ne===le&&_&&(_.scrollTop=0),ne===fe&&_&&(_.scrollTop=_.scrollHeight),ne==null||ne.focus(),document.activeElement!==Q))return},[B,_]),I=h.useCallback(()=>z([C,x]),[z,C,x]);h.useEffect(()=>{D&&I()},[D,I]);const{onOpenChange:$,triggerPointerDownPosRef:K}=v;h.useEffect(()=>{if(x){let U={x:0,y:0};const le=fe=>{var Q,ne;U={x:Math.abs(Math.round(fe.pageX)-(((Q=K.current)==null?void 0:Q.x)??0)),y:Math.abs(Math.round(fe.pageY)-(((ne=K.current)==null?void 0:ne.y)??0))}},pe=fe=>{U.x<=10&&U.y<=10?fe.preventDefault():fe.composedPath().includes(x)||$(!1),document.removeEventListener("pointermove",le),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",le),document.addEventListener("pointerup",pe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",le),document.removeEventListener("pointerup",pe,{capture:!0})}}},[x,$,K]),h.useEffect(()=>{const U=()=>$(!1);return window.addEventListener("blur",U),window.addEventListener("resize",U),()=>{window.removeEventListener("blur",U),window.removeEventListener("resize",U)}},[$]);const[R,Y]=sae(U=>{const le=B().filter(Q=>!Q.disabled),pe=le.find(Q=>Q.ref.current===document.activeElement),fe=rae(le,U,pe);fe&&setTimeout(()=>{var Q;return(Q=fe.ref.current)==null?void 0:Q.focus()})}),W=h.useCallback((U,le,pe)=>{const fe=!L.current&&!pe;(v.value!==void 0&&v.value===le||fe)&&(N(U),fe&&(L.current=!0))},[v.value]),M=h.useCallback(()=>x==null?void 0:x.focus(),[x]),F=h.useCallback((U,le,pe)=>{const fe=!L.current&&!pe;(v.value!==void 0&&v.value===le||fe)&&O(U)},[v.value]),J=s==="popper"?VI:Foe,V=J===VI?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:b,avoidCollisions:w}:{};return a.jsx(Boe,{scope:n,content:x,viewport:_,onViewportChange:T,itemRefCallback:W,selectedItem:C,onItemLeave:M,itemTextRefCallback:F,focusSelectedItem:I,selectedItemText:E,position:s,isPositioned:D,searchRef:R,children:a.jsx(P_,{as:TLe,allowPinchZoom:!0,children:a.jsx(L_,{asChild:!0,trapped:v.open,onMountAutoFocus:U=>{U.preventDefault()},onUnmountAutoFocus:yn(r,U=>{var le;(le=v.trigger)==null||le.focus({preventScroll:!0}),U.preventDefault()}),children:a.jsx(Av,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:U=>U.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:a.jsx(J,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:U=>U.preventDefault(),...y,...V,onPlaced:()=>j(!0),ref:S,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:yn(y.onKeyDown,U=>{const le=U.ctrlKey||U.altKey||U.metaKey;if(U.key==="Tab"&&U.preventDefault(),!le&&U.key.length===1&&Y(U.key),["ArrowUp","ArrowDown","Home","End"].includes(U.key)){let fe=B().filter(Q=>!Q.disabled).map(Q=>Q.ref.current);if(["ArrowUp","End"].includes(U.key)&&(fe=fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(U.key)){const Q=U.target,ne=fe.indexOf(Q);fe=fe.slice(ne+1)}setTimeout(()=>z(fe)),U.preventDefault()}})})})})})})});zoe.displayName=CLe;var ELe="SelectItemAlignedPosition",Foe=h.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...r}=e,i=g0(Fp,n),o=b0(Fp,n),[l,c]=h.useState(null),[u,d]=h.useState(null),f=Rs(t,d),m=p6(n),p=h.useRef(!1),g=h.useRef(!0),{viewport:b,selectedItem:w,selectedItemText:y,focusSelectedItem:v}=o,x=h.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&b&&w&&y){const S=i.trigger.getBoundingClientRect(),C=u.getBoundingClientRect(),N=i.valueNode.getBoundingClientRect(),E=y.getBoundingClientRect();if(i.dir!=="rtl"){const Q=E.left-C.left,ne=N.left-Q,de=S.left-ne,ue=S.width+de,me=Math.max(ue,C.width),te=window.innerWidth-od,ae=QU(ne,[od,Math.max(od,te-me)]);l.style.minWidth=ue+"px",l.style.left=ae+"px"}else{const Q=C.right-E.right,ne=window.innerWidth-N.right-Q,de=window.innerWidth-S.right-ne,ue=S.width+de,me=Math.max(ue,C.width),te=window.innerWidth-od,ae=QU(ne,[od,Math.max(od,te-me)]);l.style.minWidth=ue+"px",l.style.right=ae+"px"}const O=m(),B=window.innerHeight-od*2,D=b.scrollHeight,j=window.getComputedStyle(u),L=parseInt(j.borderTopWidth,10),z=parseInt(j.paddingTop,10),I=parseInt(j.borderBottomWidth,10),$=parseInt(j.paddingBottom,10),K=L+z+D+$+I,R=Math.min(w.offsetHeight*5,K),Y=window.getComputedStyle(b),W=parseInt(Y.paddingTop,10),M=parseInt(Y.paddingBottom,10),F=S.top+S.height/2-od,J=B-F,V=w.offsetHeight/2,U=w.offsetTop+V,le=L+z+U,pe=K-le;if(le<=F){const Q=O.length>0&&w===O[O.length-1].ref.current;l.style.bottom="0px";const ne=u.clientHeight-b.offsetTop-b.offsetHeight,de=Math.max(J,V+(Q?M:0)+ne+I),ue=le+de;l.style.height=ue+"px"}else{const Q=O.length>0&&w===O[0].ref.current;l.style.top="0px";const de=Math.max(F,L+b.offsetTop+(Q?W:0)+V)+pe;l.style.height=de+"px",b.scrollTop=le-F+b.offsetTop}l.style.margin=`${od}px 0`,l.style.minHeight=R+"px",l.style.maxHeight=B+"px",s==null||s(),requestAnimationFrame(()=>p.current=!0)}},[m,i.trigger,i.valueNode,l,u,b,w,y,i.dir,s]);Ba(()=>x(),[x]);const[k,_]=h.useState();Ba(()=>{u&&_(window.getComputedStyle(u).zIndex)},[u]);const T=h.useCallback(S=>{S&&g.current===!0&&(x(),v==null||v(),g.current=!1)},[x,v]);return a.jsx(jLe,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:T,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:a.jsx(ts.div,{...r,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});Foe.displayName=ELe;var ALe="SelectPopperPosition",VI=h.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:r=od,...i}=e,o=g6(n);return a.jsx(r6,{...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)"}})});VI.displayName=ALe;var[jLe,$L]=y1(Fp,{}),GI="SelectViewport",qoe=h.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...r}=e,i=b0(GI,n),o=$L(GI,n),l=Rs(t,i.onViewportChange),c=h.useRef(0);return a.jsxs(a.Fragment,{children:[a.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}),a.jsx(m6.Slot,{scope:n,children:a.jsx(ts.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:yn(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-od*2,b=parseFloat(f.style.minHeight),w=parseFloat(f.style.height),y=Math.max(b,w);if(y<g){const v=y+p,x=Math.min(g,v),k=v-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})})})]})});qoe.displayName=GI;var Hoe="SelectGroup",[NLe,ILe]=y1(Hoe),Uoe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=gc();return a.jsx(NLe,{scope:n,id:r,children:a.jsx(ts.div,{role:"group","aria-labelledby":r,...s,ref:t})})});Uoe.displayName=Hoe;var Woe="SelectLabel",MLe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=ILe(Woe,n);return a.jsx(ts.div,{id:r.id,...s,ref:t})});MLe.displayName=Woe;var JT="SelectItem",[RLe,Voe]=y1(JT),Goe=h.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:r=!1,textValue:i,...o}=e,l=g0(JT,n),c=b0(JT,n),u=l.value===s,[d,f]=h.useState(i??""),[m,p]=h.useState(!1),g=nu(x=>{var k;return(k=c.itemRefCallback)==null?void 0:k.call(c,x,s,r)}),b=Rs(t,g),w=gc(),y=h.useRef("touch"),v=()=>{r||(l.onValueChange(s),l.onOpenChange(!1))};return a.jsx(RLe,{scope:n,value:s,disabled:r,textId:w,isSelected:u,onItemTextChange:h.useCallback(x=>{f(k=>k||((x==null?void 0:x.textContent)??"").trim())},[]),children:a.jsx(m6.ItemSlot,{scope:n,value:s,disabled:r,textValue:d,children:a.jsx(ts.div,{role:"option","aria-labelledby":w,"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:yn(o.onFocus,()=>p(!0)),onBlur:yn(o.onBlur,()=>p(!1)),onClick:yn(o.onClick,()=>{y.current!=="mouse"&&v()}),onPointerUp:yn(o.onPointerUp,()=>{y.current==="mouse"&&v()}),onPointerDown:yn(o.onPointerDown,x=>{y.current=x.pointerType}),onPointerMove:yn(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:yn(o.onPointerLeave,x=>{var k;x.currentTarget===document.activeElement&&((k=c.onItemLeave)==null||k.call(c))}),onKeyDown:yn(o.onKeyDown,x=>{var _;r||x.target!==x.currentTarget||((_=c.searchRef)==null?void 0:_.current)!==""&&x.key===" "||(gLe.includes(x.key)&&v(),x.key===" "&&x.preventDefault())})})})})});Goe.displayName=JT;var fx="SelectItemText",Koe=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:r,...i}=e,o=g0(fx,n),l=b0(fx,n),c=Voe(fx,n),u=wLe(fx,n),[d,f]=h.useState(null),m=nu(v=>{var x;return(x=l.itemTextRefCallback)==null?void 0:x.call(l,v,c.value,c.disabled)}),p=Rs(t,f,c.onItemTextChange,m),g=d==null?void 0:d.textContent,b=h.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:w,onNativeOptionRemove:y}=u;return Ba(()=>(w(b),()=>y(b)),[w,y,b]),a.jsxs(a.Fragment,{children:[a.jsx(ts.span,{id:c.textId,...i,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!b6(o.value)?kd.createPortal(i.children,o.valueNode):null]})});Koe.displayName=fx;var Yoe="SelectItemIndicator",Xoe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return Voe(Yoe,n).isSelected?a.jsx(ts.span,{"aria-hidden":!0,...s,ref:t}):null});Xoe.displayName=Yoe;var KI="SelectScrollUpButton",Qoe=h.forwardRef((e,t)=>{const n=b0(KI,e.__scopeSelect),s=$L(KI,e.__scopeSelect),[r,i]=h.useState(!1),o=Rs(t,s.onScrollButtonChange);return Ba(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;i(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),r?a.jsx(Zoe,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Qoe.displayName=KI;var YI="SelectScrollDownButton",Joe=h.forwardRef((e,t)=>{const n=b0(YI,e.__scopeSelect),s=$L(YI,e.__scopeSelect),[r,i]=h.useState(!1),o=Rs(t,s.onScrollButtonChange);return Ba(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;i(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),r?a.jsx(Zoe,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Joe.displayName=YI;var Zoe=h.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...r}=e,i=b0("SelectScrollButton",n),o=h.useRef(null),l=p6(n),c=h.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return h.useEffect(()=>()=>c(),[c]),Ba(()=>{var d;const u=l().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),a.jsx(ts.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:yn(r.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(s,50))}),onPointerMove:yn(r.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),o.current===null&&(o.current=window.setInterval(s,50))}),onPointerLeave:yn(r.onPointerLeave,()=>{c()})})}),DLe="SelectSeparator",LLe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return a.jsx(ts.div,{"aria-hidden":!0,...s,ref:t})});LLe.displayName=DLe;var eae="SelectArrow",PLe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,r=g6(n);return b0(eae,n).position==="popper"?a.jsx(i6,{...r,...s,ref:t}):null});PLe.displayName=eae;var tae="SelectBubbleInput",nae=h.forwardRef(({__scopeSelect:e,...t},n)=>{const s=g0(tae,e),{value:r,onValueChange:i,required:o,disabled:l,name:c,autoComplete:u,form:d}=s,{nativeOptions:f,nativeSelectKey:m}=s,p=h.useRef(null),g=Rs(n,p),b=r??"",w=X5(b),y=Array.from(f).some(v=>(v.props.value??"")==="");return h.useEffect(()=>{const v=p.current;if(!v)return;const x=window.HTMLSelectElement.prototype,_=Object.getOwnPropertyDescriptor(x,"value").set;if(w!==b&&_){const T=new Event("change",{bubbles:!0});_.call(v,b),v.dispatchEvent(T)}},[w,b]),a.jsxs(ts.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:u,disabled:l,form:d,onChange:v=>i(v.target.value),...t,style:{...rre,...t.style},ref:g,defaultValue:b,children:[b6(r)&&!y?a.jsx("option",{value:""}):null,Array.from(f)]},m)});nae.displayName=tae;function OLe(e){return typeof e=="function"}function b6(e){return e===""||e===void 0}function sae(e){const t=nu(e),n=h.useRef(""),s=h.useRef(0),r=h.useCallback(o=>{const l=n.current+o;t(l),function c(u){n.current=u,window.clearTimeout(s.current),u!==""&&(s.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),i=h.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,r,i]}function rae(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=$Le(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 $Le(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var BLe="Separator",JU="horizontal",zLe=["horizontal","vertical"],iae=h.forwardRef((e,t)=>{const{decorative:n,orientation:s=JU,...r}=e,i=FLe(s)?s:JU,l=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return a.jsx(ts.div,{"data-orientation":i,...l,...r,ref:t})});iae.displayName=BLe;function FLe(e){return zLe.includes(e)}var qLe=iae,y6="Switch",[HLe,zDt]=Cl(y6),[ULe,BL]=HLe(y6);function WLe(e){const{__scopeSwitch:t,checked:n,children:s,defaultChecked:r,disabled:i,form:o,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[m,p]=Kl({prop:n,defaultProp:r??!1,onChange:c,caller:y6}),[g,b]=h.useState(null),[w,y]=h.useState(null),v=h.useRef(!1),x=g?!!o||!!g.closest("form"):!0,k={checked:m,setChecked:p,disabled:i,control:g,setControl:b,name:l,form:o,value:d,hasConsumerStoppedPropagationRef:v,required:u,defaultChecked:r,isFormControl:x,bubbleInput:w,setBubbleInput:y};return a.jsx(ULe,{scope:t,...k,children:VLe(f)?f(k):s})}var oae="SwitchTrigger",aae=h.forwardRef(({__scopeSwitch:e,onClick:t,...n},s)=>{const{control:r,form:i,value:o,disabled:l,checked:c,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:m,isFormControl:p,bubbleInput:g}=BL(oae,e),b=Rs(s,d),w=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 v=()=>f(w.current);return y.addEventListener("reset",v),()=>y.removeEventListener("reset",v)}},[r,i,f]),a.jsx(ts.button,{type:"button",role:"switch","aria-checked":c,"aria-required":u,"data-state":fae(c),"data-disabled":l?"":void 0,disabled:l,value:o,...n,ref:b,onClick:yn(t,y=>{f(v=>!v),g&&p&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})})});aae.displayName=oae;var lae=h.forwardRef((e,t)=>{const{__scopeSwitch:n,name:s,checked:r,defaultChecked:i,required:o,disabled:l,value:c,onCheckedChange:u,form:d,...f}=e;return a.jsx(WLe,{__scopeSwitch:n,checked:r,defaultChecked:i,disabled:l,required:o,onCheckedChange:u,name:s,form:d,value:c,internal_do_not_use_render:({isFormControl:m})=>a.jsxs(a.Fragment,{children:[a.jsx(aae,{...f,ref:t,__scopeSwitch:n}),m&&a.jsx(hae,{__scopeSwitch:n})]})})});lae.displayName=y6;var cae="SwitchThumb",uae=h.forwardRef((e,t)=>{const{__scopeSwitch:n,...s}=e,r=BL(cae,n);return a.jsx(ts.span,{"data-state":fae(r.checked),"data-disabled":r.disabled?"":void 0,...s,ref:t})});uae.displayName=cae;var dae="SwitchBubbleInput",hae=h.forwardRef(({__scopeSwitch:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:r,checked:i,defaultChecked:o,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:m,setBubbleInput:p}=BL(dae,e),g=Rs(n,p),b=X5(i),w=Q5(s);h.useEffect(()=>{const v=m;if(!v)return;const x=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(x,"checked").set,T=!r.current;if(b!==i&&_){const S=new Event("click",{bubbles:T});_.call(v,i),v.dispatchEvent(S)}},[m,b,i,r]);const y=h.useRef(i);return a.jsx(ts.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??y.current,required:l,disabled:c,name:u,value:d,form:f,...t,tabIndex:-1,ref:g,style:{...t.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});hae.displayName=dae;function VLe(e){return typeof e=="function"}function fae(e){return e?"checked":"unchecked"}var v6="Tabs",[GLe,FDt]=Cl(v6,[f0]),mae=f0(),[KLe,zL]=GLe(v6),pae=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:r,defaultValue:i,orientation:o="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=Ev(l),[f,m]=Kl({prop:s,onChange:r,defaultProp:i??"",caller:v6});return a.jsx(KLe,{scope:n,baseId:gc(),value:f,onValueChange:m,orientation:o,dir:d,activationMode:c,children:a.jsx(ts.div,{dir:d,"data-orientation":o,...u,ref:t})})});pae.displayName=v6;var gae="TabsList",bae=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...r}=e,i=zL(gae,n),o=mae(n);return a.jsx(o6,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:s,children:a.jsx(ts.div,{role:"tablist","aria-orientation":i.orientation,...r,ref:t})})});bae.displayName=gae;var yae="TabsTrigger",vae=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:r=!1,...i}=e,o=zL(yae,n),l=mae(n),c=kae(o.baseId,s),u=_ae(o.baseId,s),d=s===o.value;return a.jsx(a6,{asChild:!0,...l,focusable:!r,active:d,children:a.jsx(ts.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:yn(e.onMouseDown,f=>{!r&&f.button===0&&f.ctrlKey===!1?o.onValueChange(s):f.preventDefault()}),onKeyDown:yn(e.onKeyDown,f=>{r||f.target!==f.currentTarget||[" ","Enter"].includes(f.key)&&o.onValueChange(s)}),onFocus:yn(e.onFocus,()=>{const f=o.activationMode!=="manual";!d&&!r&&f&&o.onValueChange(s)})})})});vae.displayName=yae;var wae="TabsContent",xae=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:r,children:i,...o}=e,l=zL(wae,n),c=kae(l.baseId,s),u=_ae(l.baseId,s),d=s===l.value,f=h.useRef(d);return h.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),a.jsx(Tl,{present:r||d,children:({present:m})=>a.jsx(ts.div,{"data-state":d?"active":"inactive","data-orientation":l.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})})});xae.displayName=wae;function kae(e,t){return`${e}-trigger-${t}`}function _ae(e,t){return`${e}-content-${t}`}var YLe=pae,XLe=bae,QLe=vae,JLe=xae,Sae="Toggle",Cae=h.forwardRef((e,t)=>{const{pressed:n,defaultPressed:s,onPressedChange:r,...i}=e,[o,l]=Kl({prop:n,onChange:r,defaultProp:s??!1,caller:Sae});return a.jsx(ts.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":e.disabled?"":void 0,...i,ref:t,onClick:yn(e.onClick,()=>{e.disabled||l(!o)})})});Cae.displayName=Sae;var y0="ToggleGroup",[Tae,qDt]=Cl(y0,[f0]),Eae=f0(),FL=h.forwardRef((e,t)=>{const{type:n,...s}=e;if(n==="single"){const r=s;return a.jsx(ZLe,{role:"radiogroup",...r,ref:t})}if(n==="multiple"){const r=s;return a.jsx(ePe,{role:"toolbar",...r,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${y0}\``)});FL.displayName=y0;var[Aae,jae]=Tae(y0),ZLe=h.forwardRef((e,t)=>{const{value:n,defaultValue:s,onValueChange:r=()=>{},...i}=e,[o,l]=Kl({prop:n,defaultProp:s??"",onChange:r,caller:y0});return a.jsx(Aae,{scope:e.__scopeToggleGroup,type:"single",value:h.useMemo(()=>o?[o]:[],[o]),onItemActivate:l,onItemDeactivate:h.useCallback(()=>l(""),[l]),children:a.jsx(Nae,{...i,ref:t})})}),ePe=h.forwardRef((e,t)=>{const{value:n,defaultValue:s,onValueChange:r=()=>{},...i}=e,[o,l]=Kl({prop:n,defaultProp:s??[],onChange:r,caller:y0}),c=h.useCallback(d=>l((f=[])=>[...f,d]),[l]),u=h.useCallback(d=>l((f=[])=>f.filter(m=>m!==d)),[l]);return a.jsx(Aae,{scope:e.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:c,onItemDeactivate:u,children:a.jsx(Nae,{...i,ref:t})})});FL.displayName=y0;var[tPe,nPe]=Tae(y0),Nae=h.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:s=!1,rovingFocus:r=!0,orientation:i,dir:o,loop:l=!0,...c}=e,u=Eae(n),d=Ev(o),f={dir:d,...c};return a.jsx(tPe,{scope:n,rovingFocus:r,disabled:s,children:r?a.jsx(o6,{asChild:!0,...u,orientation:i,dir:d,loop:l,children:a.jsx(ts.div,{...f,ref:t})}):a.jsx(ts.div,{...f,ref:t})})}),ZT="ToggleGroupItem",Iae=h.forwardRef((e,t)=>{const n=jae(ZT,e.__scopeToggleGroup),s=nPe(ZT,e.__scopeToggleGroup),r=Eae(e.__scopeToggleGroup),i=n.value.includes(e.value),o=s.disabled||e.disabled,l={...e,pressed:i,disabled:o},c=h.useRef(null);return s.rovingFocus?a.jsx(a6,{asChild:!0,...r,focusable:!o,active:i,ref:c,children:a.jsx(ZU,{...l,ref:t})}):a.jsx(ZU,{...l,ref:t})});Iae.displayName=ZT;var ZU=h.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:s,...r}=e,i=jae(ZT,n),o={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},l=i.type==="single"?o:void 0;return a.jsx(Cae,{...l,...r,ref:t,onPressedChange:c=>{c?i.onItemActivate(s):i.onItemDeactivate(s)}})}),[w6,HDt]=Cl("Tooltip",[h0]),x6=h0(),Mae="TooltipProvider",sPe=700,XI="tooltip.open",[rPe,qL]=w6(Mae),Rae=e=>{const{__scopeTooltip:t,delayDuration:n=sPe,skipDelayDuration:s=300,disableHoverableContent:r=!1,children:i}=e,o=h.useRef(!0),l=h.useRef(!1),c=h.useRef(0);return h.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(rPe,{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:l,onPointerInTransitChange:h.useCallback(u=>{l.current=u},[]),disableHoverableContent:r,children:i})};Rae.displayName=Mae;var Bk="Tooltip",[iPe,U_]=w6(Bk),Dae=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:r,onOpenChange:i,disableHoverableContent:o,delayDuration:l}=e,c=qL(Bk,e.__scopeTooltip),u=x6(t),[d,f]=h.useState(null),m=gc(),p=h.useRef(0),g=o??c.disableHoverableContent,b=l??c.delayDuration,w=h.useRef(!1),[y,v]=Kl({prop:s,defaultProp:r??!1,onChange:S=>{S?(c.onOpen(),document.dispatchEvent(new CustomEvent(XI))):c.onClose(),i==null||i(S)},caller:Bk}),x=h.useMemo(()=>y?w.current?"delayed-open":"instant-open":"closed",[y]),k=h.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w.current=!1,v(!0)},[v]),_=h.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),T=h.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{w.current=!0,v(!0),p.current=0},b)},[b,v]);return h.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),a.jsx(O_,{...u,children:a.jsx(iPe,{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?_():(window.clearTimeout(p.current),p.current=0)},[_,g]),onOpen:k,onClose:_,disableHoverableContent:g,children:n})})};Dae.displayName=Bk;var QI="TooltipTrigger",Lae=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=U_(QI,n),i=qL(QI,n),o=x6(n),l=h.useRef(null),c=Rs(t,l,r.onTriggerChange),u=h.useRef(!1),d=h.useRef(!1),f=h.useCallback(()=>u.current=!1,[]);return h.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx($_,{asChild:!0,...o,children:a.jsx(ts.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...s,ref:c,onPointerMove:yn(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(r.onTriggerEnter(),d.current=!0)}),onPointerLeave:yn(e.onPointerLeave,()=>{r.onTriggerLeave(),d.current=!1}),onPointerDown:yn(e.onPointerDown,()=>{r.open&&r.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:yn(e.onFocus,()=>{u.current||r.onOpen()}),onBlur:yn(e.onBlur,r.onClose),onClick:yn(e.onClick,r.onClose)})})});Lae.displayName=QI;var HL="TooltipPortal",[oPe,aPe]=w6(HL,{forceMount:void 0}),Pae=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:r}=e,i=U_(HL,t);return a.jsx(oPe,{scope:t,forceMount:n,children:a.jsx(Tl,{present:n||i.open,children:a.jsx(jv,{asChild:!0,container:r,children:s})})})};Pae.displayName=HL;var By="TooltipContent",Oae=h.forwardRef((e,t)=>{const n=aPe(By,e.__scopeTooltip),{forceMount:s=n.forceMount,side:r="top",...i}=e,o=U_(By,e.__scopeTooltip);return a.jsx(Tl,{present:s||o.open,children:o.disableHoverableContent?a.jsx($ae,{side:r,...i,ref:t}):a.jsx(lPe,{side:r,...i,ref:t})})}),lPe=h.forwardRef((e,t)=>{const n=U_(By,e.__scopeTooltip),s=qL(By,e.__scopeTooltip),r=h.useRef(null),i=Rs(t,r),[o,l]=h.useState(null),{trigger:c,onClose:u}=n,d=r.current,{onPointerInTransitChange:f}=s,m=h.useCallback(()=>{l(null),f(!1)},[f]),p=h.useCallback((g,b)=>{const w=g.currentTarget,y={x:g.clientX,y:g.clientY},v=fPe(y,w.getBoundingClientRect()),x=mPe(y,v),k=pPe(b.getBoundingClientRect()),_=bPe([...x,...k]);l(_),f(!0)},[f]);return h.useEffect(()=>()=>m(),[m]),h.useEffect(()=>{if(c&&d){const g=w=>p(w,d),b=w=>p(w,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 w=b.target,y={x:b.clientX,y:b.clientY},v=(c==null?void 0:c.contains(w))||(d==null?void 0:d.contains(w)),x=!gPe(y,o);v?m():x&&(m(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,o,u,m]),a.jsx($ae,{...e,ref:i})}),[cPe,uPe]=w6(Bk,{isInside:!1}),dPe=K7e("TooltipContent"),$ae=h.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":r,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=e,c=U_(By,n),u=x6(n),{onClose:d}=c;return h.useEffect(()=>(document.addEventListener(XI,d),()=>document.removeEventListener(XI,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]),a.jsx(Av,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(r6,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.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:[a.jsx(dPe,{children:s}),a.jsx(cPe,{scope:n,isInside:!0,children:a.jsx(iIe,{id:c.contentId,role:"tooltip",children:r||s})})]})})});Oae.displayName=By;var Bae="TooltipArrow",hPe=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=x6(n);return uPe(Bae,n).isInside?null:a.jsx(i6,{...r,...s,ref:t})});hPe.displayName=Bae;function fPe(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 mPe(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 pPe(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 gPe(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 l=t[i],c=t[o],u=l.x,d=l.y,f=c.x,m=c.y;d>s!=m>s&&n<(f-u)*(s-d)/(m-d)+u&&(r=!r)}return r}function bPe(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),yPe(t)}function yPe(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 zae=Rae,Fae=Dae,qae=Lae,Hae=Pae,Uae=Oae;const vPe=(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},wPe=(e,t)=>({classGroupId:e,validator:t}),Wae=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),e3="-",eW=[],xPe="arbitrary..",kPe=e=>{const t=SPe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return _Pe(o);const l=o.split(e3),c=l[0]===""&&l.length>1?1:0;return Vae(l,c,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const c=s[o],u=n[o];return c?u?vPe(u,c):c:u||eW}return n[o]||eW}}},Vae=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],i=n.nextPart.get(r);if(i){const u=Vae(e,t+1,i);if(u)return u}const o=n.validators;if(o===null)return;const l=t===0?e.join(e3):e.slice(t).join(e3),c=o.length;for(let u=0;u<c;u++){const d=o[u];if(d.validator(l))return d.classGroupId}},_Pe=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?xPe+s:void 0})(),SPe=e=>{const{theme:t,classGroups:n}=e;return CPe(n,t)},CPe=(e,t)=>{const n=Wae();for(const s in e){const r=e[s];UL(r,n,s,t)}return n},UL=(e,t,n,s)=>{const r=e.length;for(let i=0;i<r;i++){const o=e[i];TPe(o,t,n,s)}},TPe=(e,t,n,s)=>{if(typeof e=="string"){EPe(e,t,n);return}if(typeof e=="function"){APe(e,t,n,s);return}jPe(e,t,n,s)},EPe=(e,t,n)=>{const s=e===""?t:Gae(t,e);s.classGroupId=n},APe=(e,t,n,s)=>{if(NPe(e)){UL(e(s),t,n,s);return}t.validators===null&&(t.validators=[]),t.validators.push(wPe(n,e))},jPe=(e,t,n,s)=>{const r=Object.entries(e),i=r.length;for(let o=0;o<i;o++){const[l,c]=r[o];UL(c,Gae(t,l),n,s)}},Gae=(e,t)=>{let n=e;const s=t.split(e3),r=s.length;for(let i=0;i<r;i++){const o=s[i];let l=n.nextPart.get(o);l||(l=Wae(),n.nextPart.set(o,l)),n=l}return n},NPe=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,IPe=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)}}},JI="!",tW=":",MPe=[],nW=(e,t,n,s,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:s,isExternal:r}),RPe=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=r=>{const i=[];let o=0,l=0,c=0,u;const d=r.length;for(let b=0;b<d;b++){const w=r[b];if(o===0&&l===0){if(w===tW){i.push(r.slice(c,b)),c=b+1;continue}if(w==="/"){u=b;continue}}w==="["?o++:w==="]"?o--:w==="("?l++:w===")"&&l--}const f=i.length===0?r:r.slice(c);let m=f,p=!1;f.endsWith(JI)?(m=f.slice(0,-1),p=!0):f.startsWith(JI)&&(m=f.slice(1),p=!0);const g=u&&u>c?u-c:void 0;return nW(i,p,m,g)};if(t){const r=t+tW,i=s;s=o=>o.startsWith(r)?i(o.slice(r.length)):nW(MPe,!1,o,void 0,!0)}if(n){const r=s;s=i=>n({className:i,parseClassName:r})}return s},DPe=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],l=o[0]==="[",c=t.has(o);l||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}},LPe=e=>({cache:IPe(e.cacheSize),parseClassName:RPe(e),sortModifiers:DPe(e),postfixLookupClassGroupIds:PPe(e),...kPe(e)}),PPe=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},OPe=/\s+/,$Pe=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:i,postfixLookupClassGroupIds:o}=t,l=[],c=e.trim().split(OPe);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:w}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let y=!!w,v;if(y){const S=b.substring(0,w);v=s(S);const C=v&&o[v]?s(b):void 0;C&&C!==v&&(v=C,y=!1)}else v=s(b);if(!v){if(!y){u=f+(u.length>0?" "+u:u);continue}if(v=s(b),!v){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+JI:x,_=k+v;if(l.indexOf(_)>-1)continue;l.push(_);const T=r(v,y);for(let S=0;S<T.length;++S){const C=T[S];l.push(k+C)}u=f+(u.length>0?" "+u:u)}return u},BPe=(...e)=>{let t=0,n,s,r="";for(;t<e.length;)(n=e[t++])&&(s=Kae(n))&&(r&&(r+=" "),r+=s);return r},Kae=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Kae(e[s]))&&(n&&(n+=" "),n+=t);return n},zPe=(e,...t)=>{let n,s,r,i;const o=c=>{const u=t.reduce((d,f)=>f(d),e());return n=LPe(u),s=n.cache.get,r=n.cache.set,i=l,l(c)},l=c=>{const u=s(c);if(u)return u;const d=$Pe(c,n);return r(c,d),d};return i=o,(...c)=>i(BPe(...c))},FPe=[],sa=e=>{const t=n=>n[e]||FPe;return t.isThemeGetter=!0,t},Yae=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Xae=/^\((?:(\w[\w-]*):)?(.+)\)$/i,qPe=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,HPe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,UPe=/\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$/,WPe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,VPe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,GPe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Im=e=>qPe.test(e),Vs=e=>!!e&&!Number.isNaN(Number(e)),zd=e=>!!e&&Number.isInteger(Number(e)),nj=e=>e.endsWith("%")&&Vs(e.slice(0,-1)),nf=e=>HPe.test(e),Qae=()=>!0,KPe=e=>UPe.test(e)&&!WPe.test(e),WL=()=>!1,YPe=e=>VPe.test(e),XPe=e=>GPe.test(e),QPe=e=>!Pn(e)&&!On(e),JPe=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)),ZPe=e=>v0(e,ele,WL),Pn=e=>Yae.test(e),X0=e=>v0(e,tle,KPe),sW=e=>v0(e,aOe,Vs),eOe=e=>v0(e,sle,Qae),tOe=e=>v0(e,nle,WL),rW=e=>v0(e,Jae,WL),nOe=e=>v0(e,Zae,XPe),W2=e=>v0(e,rle,YPe),On=e=>Xae.test(e),Bw=e=>v1(e,tle),sOe=e=>v1(e,nle),iW=e=>v1(e,Jae),rOe=e=>v1(e,ele),iOe=e=>v1(e,Zae),V2=e=>v1(e,rle,!0),oOe=e=>v1(e,sle,!0),v0=(e,t,n)=>{const s=Yae.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},v1=(e,t,n=!1)=>{const s=Xae.exec(e);return s?s[1]?t(s[1]):n:!1},Jae=e=>e==="position"||e==="percentage",Zae=e=>e==="image"||e==="url",ele=e=>e==="length"||e==="size"||e==="bg-size",tle=e=>e==="length",aOe=e=>e==="number",nle=e=>e==="family-name",sle=e=>e==="number"||e==="weight",rle=e=>e==="shadow",lOe=()=>{const e=sa("color"),t=sa("font"),n=sa("text"),s=sa("font-weight"),r=sa("tracking"),i=sa("leading"),o=sa("breakpoint"),l=sa("container"),c=sa("spacing"),u=sa("radius"),d=sa("shadow"),f=sa("inset-shadow"),m=sa("text-shadow"),p=sa("drop-shadow"),g=sa("blur"),b=sa("perspective"),w=sa("aspect"),y=sa("ease"),v=sa("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"],_=()=>[...k(),On,Pn],T=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto","contain","none"],C=()=>[On,Pn,c],N=()=>[Im,"full","auto",...C()],E=()=>[zd,"none","subgrid",On,Pn],O=()=>["auto",{span:["full",zd,On,Pn]},zd,On,Pn],B=()=>[zd,"auto",On,Pn],D=()=>["auto","min","max","fr",On,Pn],j=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],L=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...C()],I=()=>[Im,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...C()],$=()=>[Im,"screen","full","dvw","lvw","svw","min","max","fit",...C()],K=()=>[Im,"screen","full","lh","dvh","lvh","svh","min","max","fit",...C()],R=()=>[e,On,Pn],Y=()=>[...k(),iW,rW,{position:[On,Pn]}],W=()=>["no-repeat",{repeat:["","x","y","space","round"]}],M=()=>["auto","cover","contain",rOe,ZPe,{size:[On,Pn]}],F=()=>[nj,Bw,X0],J=()=>["","none","full",u,On,Pn],V=()=>["",Vs,Bw,X0],U=()=>["solid","dashed","dotted","double"],le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],pe=()=>[Vs,nj,iW,rW],fe=()=>["","none",g,On,Pn],Q=()=>["none",Vs,On,Pn],ne=()=>["none",Vs,On,Pn],de=()=>[Vs,On,Pn],ue=()=>[Im,"full",...C()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[nf],breakpoint:[nf],color:[Qae],container:[nf],"drop-shadow":[nf],ease:["in","out","in-out"],font:[QPe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[nf],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[nf],shadow:[nf],spacing:["px",Vs],text:[nf],"text-shadow":[nf],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Im,Pn,On,w]}],container:["container"],"container-type":[{"@container":["","normal","size",On,Pn]}],"container-named":[JPe],columns:[{columns:[Vs,Pn,On,l]}],"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:_()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{"inset-s":N(),start:N()}],end:[{"inset-e":N(),end:N()}],"inset-bs":[{"inset-bs":N()}],"inset-be":[{"inset-be":N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[zd,"auto",On,Pn]}],basis:[{basis:[Im,"full","auto",l,...C()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Vs,Im,"auto","initial","none",Pn]}],grow:[{grow:["",Vs,On,Pn]}],shrink:[{shrink:["",Vs,On,Pn]}],order:[{order:[zd,"first","last","none",On,Pn]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...j(),"normal"]}],"justify-items":[{"justify-items":[...L(),"normal"]}],"justify-self":[{"justify-self":["auto",...L()]}],"align-content":[{content:["normal",...j()]}],"align-items":[{items:[...L(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...L(),{baseline:["","last"]}]}],"place-content":[{"place-content":j()}],"place-items":[{"place-items":[...L(),"baseline"]}],"place-self":[{"place-self":["auto",...L()]}],p:[{p:C()}],px:[{px:C()}],py:[{py:C()}],ps:[{ps:C()}],pe:[{pe:C()}],pbs:[{pbs:C()}],pbe:[{pbe:C()}],pt:[{pt:C()}],pr:[{pr:C()}],pb:[{pb:C()}],pl:[{pl:C()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":C()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":C()}],"space-y-reverse":["space-y-reverse"],size:[{size:I()}],"inline-size":[{inline:["auto",...$()]}],"min-inline-size":[{"min-inline":["auto",...$()]}],"max-inline-size":[{"max-inline":["none",...$()]}],"block-size":[{block:["auto",...K()]}],"min-block-size":[{"min-block":["auto",...K()]}],"max-block-size":[{"max-block":["none",...K()]}],w:[{w:[l,"screen",...I()]}],"min-w":[{"min-w":[l,"screen","none",...I()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...I()]}],h:[{h:["screen","lh",...I()]}],"min-h":[{"min-h":["screen","lh","none",...I()]}],"max-h":[{"max-h":["screen","lh",...I()]}],"font-size":[{text:["base",n,Bw,X0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,oOe,eOe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",nj,Pn]}],"font-family":[{font:[sOe,tOe,t]}],"font-features":[{"font-features":[Pn]}],"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,On,Pn]}],"line-clamp":[{"line-clamp":[Vs,"none",On,sW]}],leading:[{leading:[i,...C()]}],"list-image":[{"list-image":["none",On,Pn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",On,Pn]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:[Vs,"from-font","auto",On,X0]}],"text-decoration-color":[{decoration:R()}],"underline-offset":[{"underline-offset":[Vs,"auto",On,Pn]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"tab-size":[{tab:[zd,On,Pn]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",On,Pn]}],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",On,Pn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Y()}],"bg-repeat":[{bg:W()}],"bg-size":[{bg:M()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},zd,On,Pn],radial:["",On,Pn],conic:[zd,On,Pn]},iOe,nOe]}],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:F()}],"gradient-via-pos":[{via:F()}],"gradient-to-pos":[{to:F()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:J()}],"rounded-s":[{"rounded-s":J()}],"rounded-e":[{"rounded-e":J()}],"rounded-t":[{"rounded-t":J()}],"rounded-r":[{"rounded-r":J()}],"rounded-b":[{"rounded-b":J()}],"rounded-l":[{"rounded-l":J()}],"rounded-ss":[{"rounded-ss":J()}],"rounded-se":[{"rounded-se":J()}],"rounded-ee":[{"rounded-ee":J()}],"rounded-es":[{"rounded-es":J()}],"rounded-tl":[{"rounded-tl":J()}],"rounded-tr":[{"rounded-tr":J()}],"rounded-br":[{"rounded-br":J()}],"rounded-bl":[{"rounded-bl":J()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-bs":[{"border-bs":V()}],"border-w-be":[{"border-be":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":V()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...U(),"hidden","none"]}],"divide-style":[{divide:[...U(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-bs":[{"border-bs":R()}],"border-color-be":[{"border-be":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}],"divide-color":[{divide:R()}],"outline-style":[{outline:[...U(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Vs,On,Pn]}],"outline-w":[{outline:["",Vs,Bw,X0]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",d,V2,W2]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",f,V2,W2]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[Vs,X0]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",m,V2,W2]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[Vs,On,Pn]}],"mix-blend":[{"mix-blend":[...le(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":le()}],"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":[Vs]}],"mask-image-linear-from-pos":[{"mask-linear-from":pe()}],"mask-image-linear-to-pos":[{"mask-linear-to":pe()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"mask-image-t-from-pos":[{"mask-t-from":pe()}],"mask-image-t-to-pos":[{"mask-t-to":pe()}],"mask-image-t-from-color":[{"mask-t-from":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"mask-image-r-from-pos":[{"mask-r-from":pe()}],"mask-image-r-to-pos":[{"mask-r-to":pe()}],"mask-image-r-from-color":[{"mask-r-from":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"mask-image-b-from-pos":[{"mask-b-from":pe()}],"mask-image-b-to-pos":[{"mask-b-to":pe()}],"mask-image-b-from-color":[{"mask-b-from":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"mask-image-l-from-pos":[{"mask-l-from":pe()}],"mask-image-l-to-pos":[{"mask-l-to":pe()}],"mask-image-l-from-color":[{"mask-l-from":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"mask-image-x-from-pos":[{"mask-x-from":pe()}],"mask-image-x-to-pos":[{"mask-x-to":pe()}],"mask-image-x-from-color":[{"mask-x-from":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"mask-image-y-from-pos":[{"mask-y-from":pe()}],"mask-image-y-to-pos":[{"mask-y-to":pe()}],"mask-image-y-from-color":[{"mask-y-from":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[On,Pn]}],"mask-image-radial-from-pos":[{"mask-radial-from":pe()}],"mask-image-radial-to-pos":[{"mask-radial-to":pe()}],"mask-image-radial-from-color":[{"mask-radial-from":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"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":[Vs]}],"mask-image-conic-from-pos":[{"mask-conic-from":pe()}],"mask-image-conic-to-pos":[{"mask-conic-to":pe()}],"mask-image-conic-from-color":[{"mask-conic-from":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Y()}],"mask-repeat":[{mask:W()}],"mask-size":[{mask:M()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",On,Pn]}],filter:[{filter:["","none",On,Pn]}],blur:[{blur:fe()}],brightness:[{brightness:[Vs,On,Pn]}],contrast:[{contrast:[Vs,On,Pn]}],"drop-shadow":[{"drop-shadow":["","none",p,V2,W2]}],"drop-shadow-color":[{"drop-shadow":R()}],grayscale:[{grayscale:["",Vs,On,Pn]}],"hue-rotate":[{"hue-rotate":[Vs,On,Pn]}],invert:[{invert:["",Vs,On,Pn]}],saturate:[{saturate:[Vs,On,Pn]}],sepia:[{sepia:["",Vs,On,Pn]}],"backdrop-filter":[{"backdrop-filter":["","none",On,Pn]}],"backdrop-blur":[{"backdrop-blur":fe()}],"backdrop-brightness":[{"backdrop-brightness":[Vs,On,Pn]}],"backdrop-contrast":[{"backdrop-contrast":[Vs,On,Pn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Vs,On,Pn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Vs,On,Pn]}],"backdrop-invert":[{"backdrop-invert":["",Vs,On,Pn]}],"backdrop-opacity":[{"backdrop-opacity":[Vs,On,Pn]}],"backdrop-saturate":[{"backdrop-saturate":[Vs,On,Pn]}],"backdrop-sepia":[{"backdrop-sepia":["",Vs,On,Pn]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",On,Pn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Vs,"initial",On,Pn]}],ease:[{ease:["linear","initial",y,On,Pn]}],delay:[{delay:[Vs,On,Pn]}],animate:[{animate:["none",v,On,Pn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,On,Pn]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:Q()}],"rotate-x":[{"rotate-x":Q()}],"rotate-y":[{"rotate-y":Q()}],"rotate-z":[{"rotate-z":Q()}],scale:[{scale:ne()}],"scale-x":[{"scale-x":ne()}],"scale-y":[{"scale-y":ne()}],"scale-z":[{"scale-z":ne()}],"scale-3d":["scale-3d"],skew:[{skew:de()}],"skew-x":[{"skew-x":de()}],"skew-y":[{"skew-y":de()}],transform:[{transform:[On,Pn,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ue()}],"translate-x":[{"translate-x":ue()}],"translate-y":[{"translate-y":ue()}],"translate-z":[{"translate-z":ue()}],"translate-none":["translate-none"],zoom:[{zoom:[zd,On,Pn]}],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}],"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",On,Pn]}],"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":R()}],"scrollbar-track-color":[{"scrollbar-track":R()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mbs":[{"scroll-mbs":C()}],"scroll-mbe":[{"scroll-mbe":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pbs":[{"scroll-pbs":C()}],"scroll-pbe":[{"scroll-pbe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"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",On,Pn]}],fill:[{fill:["none",...R()]}],"stroke-w":[{stroke:[Vs,Bw,X0,sW]}],stroke:[{stroke:["none",...R()]}],"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"]}},cOe=zPe(lOe);function on(...e){return cOe(tre(e))}const uOe=g1("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"}}),Kt=h.forwardRef(function({className:t,variant:n="default",size:s="default",asChild:r=!1,...i},o){const l=r?uL:"button";return a.jsx(l,{ref:o,"data-slot":"button","data-variant":n,"data-size":s,className:on(uOe({variant:n,size:s,className:t})),...i})}),op=h.forwardRef(function({className:t,...n},s){return a.jsx($re,{ref:s,"data-slot":"checkbox",className:on("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:a.jsx(zre,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:a.jsx(kh,{})})})});function qp({...e}){return a.jsx(W5,{"data-slot":"dialog",...e})}function dOe({container:e,...t}){const n=Gu();return a.jsx(V5,{"data-slot":"dialog-portal",container:e??n??void 0,...t})}function ZI({...e}){return a.jsx(Nv,{"data-slot":"dialog-close",...e})}const hOe=h.forwardRef(function({className:t,...n},s){return a.jsx(G5,{ref:s,"data-slot":"dialog-overlay",className:on("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})}),Hp=h.forwardRef(function({className:t,children:n,showCloseButton:s=!0,overlayProps:r,...i},o){return a.jsxs(dOe,{children:[a.jsx(hOe,{...r}),a.jsxs(K5,{ref:o,"data-slot":"dialog-content",className:on("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&&a.jsx(Nv,{"data-slot":"dialog-close",asChild:!0,children:a.jsxs(Kt,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm",children:[a.jsx(yv,{}),a.jsx("span",{className:"sr-only",children:"Close"})]})})]})]})});function Up({className:e,...t}){return a.jsx("div",{"data-slot":"dialog-header",className:on("flex flex-col gap-2",e),...t})}function Wp({className:e,showCloseButton:t=!1,children:n,...s}){return a.jsxs("div",{"data-slot":"dialog-footer",className:on("-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&&a.jsx(Nv,{asChild:!0,children:a.jsx(Kt,{variant:"outline",children:"Close"})})]})}function Vp({className:e,...t}){return a.jsx(Y5,{"data-slot":"dialog-title",className:on("text-base leading-none font-medium",e),...t})}function Yg({className:e,...t}){return a.jsx(mL,{"data-slot":"dialog-description",className:on("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const Ur=h.forwardRef(function({className:t,type:n,...s},r){return a.jsx("input",{ref:r,type:n,"data-slot":"input",className:on("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 Xg({className:e,...t}){return a.jsx(FDe,{"data-slot":"label",className:on("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 Yf({...e}){return a.jsx(QDe,{"data-slot":"popover",...e})}const Gp=h.forwardRef(function(t,n){return a.jsx(ZDe,{ref:n,"data-slot":"popover-trigger",...t})}),Xf=h.forwardRef(function({className:t,align:n="center",sideOffset:s=4,...r},i){const o=Gu();return a.jsx(eLe,{container:o??void 0,children:a.jsx(tLe,{ref:i,"data-slot":"popover-content",align:n,sideOffset:s,className:on("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})})}),oW=h.forwardRef(function(t,n){return a.jsx(JDe,{ref:n,"data-slot":"popover-anchor",...t})});function fOe({className:e,...t}){return a.jsx("div",{"data-slot":"popover-header",className:on("flex flex-col gap-0.5 text-sm",e),...t})}function mOe({className:e,...t}){return a.jsx("div",{"data-slot":"popover-title",className:on("font-medium",e),...t})}function vl({...e}){return a.jsx(joe,{"data-slot":"select",...e})}function ile({className:e,...t}){return a.jsx(Uoe,{"data-slot":"select-group",className:on("scroll-my-1 p-1",e),...t})}function wl({...e}){return a.jsx(Roe,{"data-slot":"select-value",...e})}const xl=h.forwardRef(function({className:t,size:n="default",children:s,...r},i){return a.jsxs(Ioe,{ref:i,"data-slot":"select-trigger","data-size":n,className:on("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,a.jsx(Doe,{asChild:!0,children:a.jsx(Pc,{className:"pointer-events-none size-4 text-muted-foreground"})})]})});function kl({className:e,children:t,position:n="item-aligned",align:s="center",...r}){const i=Gu();return a.jsx(Poe,{container:i??void 0,children:a.jsxs(Ooe,{"data-slot":"select-content","data-align-trigger":n==="item-aligned",className:on("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:[a.jsx(pOe,{}),a.jsx(qoe,{"data-position":n,className:on("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}),a.jsx(gOe,{})]})})}function Ai({className:e,children:t,...n}){return a.jsxs(Goe,{"data-slot":"select-item",className:on("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:[a.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:a.jsx(Xoe,{children:a.jsx(kh,{className:"pointer-events-none"})})}),a.jsx(Koe,{children:t})]})}function pOe({className:e,...t}){return a.jsx(Qoe,{"data-slot":"select-scroll-up-button",className:on("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:a.jsx(qxe,{})})}function gOe({className:e,...t}){return a.jsx(Joe,{"data-slot":"select-scroll-down-button",className:on("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:a.jsx(Pc,{})})}function Td({delayDuration:e=0,...t}){return a.jsx(zae,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function qu({...e}){return a.jsx(Fae,{"data-slot":"tooltip",...e})}function Hu({...e}){return a.jsx(qae,{"data-slot":"tooltip-trigger",...e})}function Uu({className:e,sideOffset:t=8,children:n,...s}){const r=Gu();return a.jsx(Hae,{container:r??void 0,children:a.jsx(Uae,{"data-slot":"tooltip-content",sideOffset:t,className:on("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})})}const bOe="_tableShell_qiqqa_1",yOe="_columnsPopover_qiqqa_13",vOe="_densityCompact_qiqqa_17",wOe="_densityStandard_qiqqa_29",xOe="_densityComfortable_qiqqa_39",kOe="_toolbar_qiqqa_49",_Oe="_summary_qiqqa_71",SOe="_toolbarSpacer_qiqqa_76",COe="_selection_qiqqa_80",TOe="_selectionStats_qiqqa_85",EOe="_selectionMetric_qiqqa_94",AOe="_selectionMetricValue_qiqqa_99",jOe="_selectionCopyButton_qiqqa_105",NOe="_toolbarControl_qiqqa_112",IOe="_densityTrigger_qiqqa_119",MOe="_densityMenu_qiqqa_141",ROe="_iconButton_qiqqa_147",DOe="_scroller_qiqqa_171",LOe="_frozenColumnShadow_qiqqa_186",POe="_table_qiqqa_1",OOe="_actionColumn_qiqqa_207",$Oe="_fillerColumn_qiqqa_213",BOe="_headerCell_qiqqa_217",zOe="_cell_qiqqa_218",FOe="_fillerHeaderCell_qiqqa_223",qOe="_fillerCell_qiqqa_224",HOe="_frozenHeaderCell_qiqqa_252",UOe="_headerControls_qiqqa_257",WOe="_headerText_qiqqa_269",VOe="_filterTrigger_qiqqa_277",GOe="_sortTrigger_qiqqa_278",KOe="_activeHeaderCell_qiqqa_305",YOe="_resizeHandle_qiqqa_309",XOe="_filterTriggerActive_qiqqa_328",QOe="_sortTriggerActive_qiqqa_333",JOe="_columnContextMenu_qiqqa_337",ZOe="_columnContextMenuAction_qiqqa_350",e$e="_cellContent_qiqqa_382",t$e="_detailValueContent_qiqqa_383",n$e="_cellText_qiqqa_389",s$e="_detailValueText_qiqqa_390",r$e="_cellContentCollapsed_qiqqa_396",i$e="_detailValueCollapsed_qiqqa_397",o$e="_dragging_qiqqa_404",a$e="_selectedCell_qiqqa_416",l$e="_actionHeaderCell_qiqqa_422",c$e="_actionCell_qiqqa_423",u$e="_stickyActionHeaderCell_qiqqa_431",d$e="_stickyActionCell_qiqqa_432",h$e="_frozenCell_qiqqa_450",f$e="_hasFrozenColumn_qiqqa_456",m$e="_rowDetailButton_qiqqa_494",p$e="_detailRow_qiqqa_520",g$e="_detailCell_qiqqa_524",b$e="_detailPanel_qiqqa_536",y$e="_detailItem_qiqqa_552",v$e="_detailLabel_qiqqa_562",w$e="_detailValue_qiqqa_383",x$e="_emptyValue_qiqqa_577",k$e="_emptyState_qiqqa_582",_$e="_selectionMetricSecondary_qiqqa_590",S$e="_compactToolbarLabel_qiqqa_596",C$e="_compactToolbarControl_qiqqa_601",rn={tableShell:bOe,columnsPopover:yOe,densityCompact:vOe,densityStandard:wOe,densityComfortable:xOe,toolbar:kOe,summary:_Oe,toolbarSpacer:SOe,selection:COe,selectionStats:TOe,selectionMetric:EOe,selectionMetricValue:AOe,selectionCopyButton:jOe,toolbarControl:NOe,densityTrigger:IOe,densityMenu:MOe,iconButton:ROe,scroller:DOe,frozenColumnShadow:LOe,table:POe,actionColumn:OOe,fillerColumn:$Oe,headerCell:BOe,cell:zOe,fillerHeaderCell:FOe,fillerCell:qOe,frozenHeaderCell:HOe,headerControls:UOe,headerText:WOe,filterTrigger:VOe,sortTrigger:GOe,activeHeaderCell:KOe,resizeHandle:YOe,filterTriggerActive:XOe,sortTriggerActive:QOe,columnContextMenu:JOe,columnContextMenuAction:ZOe,cellContent:e$e,detailValueContent:t$e,cellText:n$e,detailValueText:s$e,cellContentCollapsed:r$e,detailValueCollapsed:i$e,dragging:o$e,selectedCell:a$e,actionHeaderCell:l$e,actionCell:c$e,stickyActionHeaderCell:u$e,stickyActionCell:d$e,frozenCell:h$e,hasFrozenColumn:f$e,rowDetailButton:m$e,detailRow:p$e,detailCell:g$e,detailPanel:b$e,detailItem:y$e,detailLabel:v$e,detailValue:w$e,emptyValue:x$e,emptyState:k$e,selectionMetricSecondary:_$e,compactToolbarLabel:S$e,compactToolbarControl:C$e},T$e={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"},E$e={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"},A$e=500,j$e=50,g4=40,Fb=160,N$e=72,ole=80,ale=640,aW=16,lle="application/x-qwen-web-shell-table-column",I$e=60,M$e=3,R$e=["standard","compact","comfortable"],D$e={width:g4,minWidth:g4,maxWidth:g4};function lW(e){return Math.min(ale,Math.max(ole,e))}function sj(e){return e instanceof Element&&!!e.closest('a, button, input, textarea, select, [contenteditable="true"]')}function L$e(){const e=document.getSelection();return!!(e&&!e.isCollapsed)}function kg(e,t){return h.isValidElement(e)&&e.type===t}function P$e(e){return e.replace(/\s+/g," ").trim()}function rj(e){return e.length>I$e||e.split(/\r\n|\r|\n/).length>M$e}function O$e(e){switch(e){case"compact":return rn.densityCompact;case"comfortable":return rn.densityComfortable;case"standard":default:return rn.densityStandard}}function $$e(e){let t=e;for(;t;){const n=window.getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll"||n==="overlay")return t;t=t.parentElement}return null}function eM(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(eM).join(""):h.isValidElement(e)?e.type==="img"?e.props.alt??"":eM(e.props.children):""}function B$e(e,t){return{key:`${e}-empty-${t}`,content:"",text:"",rawText:"",isHeader:!1}}function cle(e,t){const n=h.Children.toArray(e.props.children).filter(s=>kg(s,"td")||kg(s,"th"));return{key:t,cells:n.map((s,r)=>{var o;const i=eM(s.props.children);return{key:`${t}-${r}`,content:s.props.children,text:P$e(i),rawText:i,isHeader:s.type==="th",textAlign:(o=s.props.style)==null?void 0:o.textAlign}})}}function ij(e,t){return h.Children.toArray(e.props.children).filter(n=>kg(n,"tr")).map((n,s)=>cle(n,`${t}-${s}`))}function z$e(e,t){return{...e,cells:Array.from({length:t},(n,s)=>e.cells[s]??B$e(e.key,s))}}function F$e(e,t){const n=h.Children.toArray(e),s=[],r=[],i=[];if(n.forEach((d,f)=>{kg(d,"thead")?s.push(...ij(d,`head-${f}`)):kg(d,"tbody")?r.push(...ij(d,`body-${f}`)):kg(d,"tfoot")?r.push(...ij(d,`foot-${f}`)):kg(d,"tr")&&i.push(cle(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],l=Math.max(0,...o.map(d=>d.cells.length)),c=s[0];return{headers:Array.from({length:l},(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=>z$e(d,l)),columnCount:l}}function Df(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 ule(e,t){const n=Df(e),s=Df(t);return n!==null&&s!==null&&n!==s?n-s:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function t3(e){return{minRow:Math.min(e.anchorRow,e.focusRow),maxRow:Math.max(e.anchorRow,e.focusRow)}}function VL(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 n3(e){const t=e.replace(/[\u200B-\u200D\u2060\u00AD\uFEFF]/g,"").trimStart();return/^[=+\-@]/.test(t)?`'${e}`:e}function tM(e){return((e==null?void 0:e.rawText)??(e==null?void 0:e.text)??"").replace(/[\r\n\t]+/g," ")}function oj(e){return e.rawText||e.text}function cW(e,t,n){if((e[t]??Fb)===n)return e;if(n===Fb){const r={...e};return delete r[t],r}return{...e,[t]:n}}function uW(e,t,n){if(!e)return"";const{minRow:s,maxRow:r}=t3(e),i=VL(e,n);if(i.length===0)return"";const o=[];for(let l=s;l<=r;l++){const c=t[l];c&&o.push(i.map(u=>n3(tM(c.cells[u]))).join("	"))}return o.join(`
`)}function q$e(e,t,n){return n.length===0?"":[n.map(r=>n3(tM(e[r]))).join("	"),...t.map(r=>n.map(i=>n3(tM(r.cells[i]))).join("	"))].join(`
`)}function H$e(e,t,n){if(!e)return null;const{minRow:s,maxRow:r}=t3(e),i=VL(e,n);if(i.length===0)return null;let o=0,l=0,c=0,u=0,d=1/0,f=-1/0,m=!0,p=!0,g;for(let w=s;w<=r;w++){const y=t[w];y&&i.forEach(v=>{const x=y.cells[v];if(!x)return;o+=1;const k=x.text.trim();if(!k)return;l+=1;const _=Df(k);if(_===null)return;c+=1,u+=_,d=Math.min(d,_),f=Math.max(f,_),m=m&&k.endsWith("%");const T=k.match(/[$€£¥₹]/g),S=(T==null?void 0:T.length)===1?T[0]:void 0;S?g===void 0?g=S:g!==S&&(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:l,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 G2(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 U$e(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 sf(e){return Array.from({length:e},(t,n)=>n)}function dW(e){return Array.from(e.types).includes(lle)}function Yx(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 W$e(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 V$e(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=Df(e),s=Df(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=Df(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 G$e(e,t){return t.selectedValues!==void 0&&!t.selectedValues.includes(e)?!1:W$e(e,t.textFilter)&&V$e(e,t.numberFilter)}function hW(e,t,n){const s=Object.entries(t).map(([r,i])=>[Number(r),i]).filter(([r,i])=>r!==n&&Yx(i));return s.length===0?e:e.filter(r=>s.every(([i,o])=>{var l;return G$e(((l=r.cells[i])==null?void 0:l.text)??"",o)}))}function K$e(e,t){return t?e.map((n,s)=>({row:n,index:s})).sort((n,s)=>{var o,l;const r=ule(((o=n.row.cells[t.columnIndex])==null?void 0:o.text)??"",((l=s.row.cells[t.columnIndex])==null?void 0:l.text)??""),i=t.direction==="asc"?r:-r;return i===0?n.index-s.index:i}).map(({row:n})=>n):e}function Y$e(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)=>ule(r.value,i.value))}function X$e(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,Df(i)!==null&&(s+=1))}),n>0&&s/n>=.7}function Q$e(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function J$e(e,t){var s,r,i;const n={};if(e.selectedValues!==void 0&&!Q$e(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(),l=(i=e.numberFilter.valueTo)==null?void 0:i.trim();Df(o)!==null&&(e.numberFilter.operator!=="between"||Df(l??"")!==null)&&(n.numberFilter={operator:e.numberFilter.operator,value:o,valueTo:l})}return Yx(n)?n:void 0}function Z$e({columnIndex:e,columnName:t,search:n,searchInputRef:s,filteredOptions:r,visibleOptions:i,selectedValues:o,allFilteredSelected:l,onSearchChange:c,onFilteredSelectionChange:u,onToggleValue:d}){const{t:f}=nt();return a.jsxs("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:[a.jsx(Ur,{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})}),a.jsxs(Xg,{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:[a.jsx(op,{id:`markdown-table-filter-all-${e}`,name:`markdown-table-filter-all-${e}`,"data-name":`markdown-table-filter-all-${e}`,checked:l,onCheckedChange:m=>u(m===!0)}),a.jsx("span",{children:f("markdownTable.filter.selectVisible")}),a.jsx("span",{className:"ml-auto text-muted-foreground tabular-nums",children:r.length})]}),a.jsxs("div",{className:"max-h-[170px] overflow-auto rounded-md border bg-muted/50",children:[i.map((m,p)=>a.jsxs(Xg,{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:[a.jsx(op,{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)}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:m.label}),a.jsx("span",{className:"ml-auto text-muted-foreground tabular-nums",children:m.count})]},m.value)),r.length>i.length&&a.jsx("div",{className:"p-2 text-center text-muted-foreground",children:f("markdownTable.filter.optionLimit",{count:i.length})}),r.length===0&&a.jsx("div",{className:"p-2 text-center text-muted-foreground",children:f("markdownTable.filter.noOptions")})]})]})}function eBe({overlayId:e,columnIndex:t,columnName:n,isNumeric:s,textOperator:r,textValue:i,numberOperator:o,numberValue:l,numberValueTo:c,onTextOperatorChange:u,onTextValueChange:d,onNumberOperatorChange:f,onNumberValueChange:m,onNumberValueToChange:p}){const{t:g}=nt();return a.jsxs("div",{className:"flex flex-col gap-1.5 border-b px-2.5 py-2",children:[a.jsx("div",{className:"font-semibold text-muted-foreground",children:g("markdownTable.filter.custom")}),s?a.jsxs(a.Fragment,{children:[a.jsxs(vl,{value:o,name:`markdown-table-number-operator-${t}`,onValueChange:b=>f(b),children:[a.jsx(xl,{size:"sm",className:"w-full text-xs","data-name":`markdown-table-number-operator-${t}`,"aria-label":g("markdownTable.filter.numberAria",{column:n}),children:a.jsx(wl,{})}),a.jsx(kl,{"data-markdown-table-filter-owner":e,className:"z-[calc(var(--web-shell-popover-z-index,1000)+1)]",children:Object.entries(E$e).map(([b,w])=>a.jsx(Ai,{value:b,"data-value":b,className:"text-xs",children:g(w)},b))})]}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx(Ur,{className:"h-7 text-xs",value:l,onChange:b=>m(b.currentTarget.value),placeholder:g("markdownTable.filter.numberPlaceholder"),name:`markdown-table-number-filter-${t}`}),o==="between"&&a.jsx(Ur,{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}`})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs(vl,{value:r,name:`markdown-table-text-operator-${t}`,onValueChange:b=>u(b),children:[a.jsx(xl,{size:"sm",className:"w-full text-xs","data-name":`markdown-table-text-operator-${t}`,"aria-label":g("markdownTable.filter.textAria",{column:n}),children:a.jsx(wl,{})}),a.jsx(kl,{"data-markdown-table-filter-owner":e,className:"z-[calc(var(--web-shell-popover-z-index,1000)+1)]",children:Object.entries(T$e).map(([b,w])=>a.jsx(Ai,{value:b,"data-value":b,className:"text-xs",children:g(w)},b))})]}),a.jsx(Ur,{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 tBe({onClear:e,onClose:t,onApply:n}){const{t:s}=nt();return a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-2",children:[a.jsx(Kt,{variant:"outline",size:"sm",type:"button",onClick:e,children:s("markdownTable.filter.reset")}),a.jsx("span",{className:"flex-1"}),a.jsx(Kt,{variant:"outline",size:"sm",type:"button",onClick:t,children:s("markdownTable.filter.cancel")}),a.jsx(Kt,{size:"sm",type:"button",onClick:n,children:s("markdownTable.filter.confirm")})]})}function nBe({id:e,columnName:t,columnIndex:n,filter:s,isNumeric:r,options:i,onApply:o,onClose:l}){var L,z,I,$,K;const c=h.useMemo(()=>i.map(R=>R.value),[i]),[u,d]=h.useState(""),[f,m]=h.useState(()=>new Set((s==null?void 0:s.selectedValues)??c)),[p,g]=h.useState(((L=s==null?void 0:s.textFilter)==null?void 0:L.operator)??"contains"),[b,w]=h.useState(((z=s==null?void 0:s.textFilter)==null?void 0:z.value)??""),[y,v]=h.useState(((I=s==null?void 0:s.numberFilter)==null?void 0:I.operator)??"gt"),[x,k]=h.useState((($=s==null?void 0:s.numberFilter)==null?void 0:$.value)??""),[_,T]=h.useState(((K=s==null?void 0:s.numberFilter)==null?void 0:K.valueTo)??""),S=h.useRef(null);h.useEffect(()=>{var R;(R=S.current)==null||R.focus()},[]);const C=h.useMemo(()=>{const R=u.trim().toLowerCase();return R?i.filter(Y=>Y.label.toLowerCase().includes(R)):i},[i,u]),N=C.slice(0,500),E=C.length>0&&C.every(R=>f.has(R.value)),O=R=>{m(Y=>{const W=new Set(Y);return C.forEach(M=>{R?W.add(M.value):W.delete(M.value)}),W})},B=R=>{m(Y=>{const W=new Set(Y);return W.has(R)?W.delete(R):W.add(R),W})},D=()=>{o(n,J$e({selectedValues:Array.from(f),textFilter:{operator:p,value:b},numberFilter:{operator:y,value:x,valueTo:_}},c))},j=()=>{o(n,void 0)};return a.jsxs(Xf,{id:e,"data-markdown-table-filter-owner":e,align:"end",sideOffset:2,collisionPadding:6,onCloseAutoFocus:R=>{document.activeElement&&document.activeElement!==document.body&&R.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:[a.jsx(fOe,{className:"border-b px-2.5 py-2",children:a.jsx(mOe,{id:`${e}-title`,className:"truncate text-xs font-bold",children:t})}),a.jsx(Z$e,{columnIndex:n,columnName:t,search:u,searchInputRef:S,filteredOptions:C,visibleOptions:N,selectedValues:f,allFilteredSelected:E,onSearchChange:d,onFilteredSelectionChange:O,onToggleValue:B}),a.jsx(eBe,{overlayId:e,columnIndex:n,columnName:t,isNumeric:r,textOperator:p,textValue:b,numberOperator:y,numberValue:x,numberValueTo:_,onTextOperatorChange:g,onTextValueChange:w,onNumberOperatorChange:v,onNumberValueChange:k,onNumberValueToChange:T}),a.jsx(tBe,{onClear:j,onClose:l,onApply:D})]})}function sBe({children:e,fallback:t,toolbarExtra:n}){const{t:s}=nt(),r=h.useMemo(()=>F$e(e,i=>s("markdownTable.column",{index:i+1})),[e,s]);return r.columnCount===0?a.jsx(a.Fragment,{children:t??a.jsx("table",{children:e})}):r.rows.length>A$e||r.columnCount>j$e?a.jsx(a.Fragment,{children:t??a.jsx("table",{children:e})}):a.jsx(iBe,{table:r,toolbarExtra:n})}function rBe({headers:e,columnOrder:t,hiddenColumns:n,detailColumns:s,onToggleTableColumn:r,onToggleAllTableColumns:i,onToggleDetailColumn:o,onToggleAllDetailColumns:l,onReset:c,onDragStart:u,onDragEnd:d,onDragOver:f,onDrop:m}){const{t:p}=nt(),g=h.useId(),b=e.length-n.size,w=b===e.length,y=s.size===e.length,v=b===0?!1:w?!0:"indeterminate",x=s.size===0?!1:y?!0:"indeterminate";return a.jsxs(Yf,{children:[a.jsx(Gp,{asChild:!0,children:a.jsxs(Kt,{variant:"ghost",size:"sm",className:`${rn.toolbarControl} ${rn.compactToolbarControl}`,"aria-label":p("markdownTable.customColumns"),type:"button",children:[a.jsx(Mxe,{}),a.jsx("span",{className:rn.compactToolbarLabel,children:p("markdownTable.customColumns")})]})}),a.jsxs(Xf,{align:"end",className:`${rn.columnsPopover} max-h-[min(520px,calc(100vh-16px))] w-80 max-w-[85vw] gap-0 overflow-auto p-0`,children:[a.jsxs("div",{className:"flex items-center gap-3 border-b px-3 py-3",children:[a.jsx(op,{checked:v,onCheckedChange:k=>i(k===!0),"aria-label":p("markdownTable.customColumns.toggleAllTable")}),a.jsx("span",{className:"flex-1 text-xs text-muted-foreground",children:p("markdownTable.customColumns.tableSection")}),a.jsx(Kt,{variant:"ghost",size:"sm",type:"button",onClick:c,children:p("markdownTable.customColumns.reset")})]}),a.jsx("div",{className:"p-2",children:t.map(k=>{const _=e[k];if(!_)return null;const T=_.text||p("markdownTable.column",{index:k+1});return a.jsxs("div",{className:"flex min-h-9 items-center gap-2 rounded-md px-1.5 hover:bg-muted",onDragOver:f,onDrop:S=>m(S,k),children:[a.jsx("button",{className:"flex size-7 shrink-0 cursor-grab items-center justify-center rounded-md text-muted-foreground hover:bg-muted-foreground/10 active:cursor-grabbing",type:"button",draggable:!0,onDragStart:S=>u(S,k),onDragEnd:d,"aria-label":p("markdownTable.moveColumn",{column:T}),children:a.jsx(Vke,{className:"size-3.5"})}),a.jsx(op,{id:`${g}-table-${k}`,checked:!n.has(k),onCheckedChange:()=>r(k)}),a.jsx(Xg,{htmlFor:`${g}-table-${k}`,className:"min-w-0 flex-1 cursor-pointer truncate font-normal",children:T})]},_.key)})}),a.jsxs("div",{className:"flex items-center gap-3 border-y px-3 py-3",children:[a.jsx(op,{checked:x,onCheckedChange:k=>l(k===!0),"aria-label":p("markdownTable.customColumns.toggleAllDetails")}),a.jsx("span",{className:"text-xs text-muted-foreground",children:p("markdownTable.customColumns.detailSection")})]}),a.jsx("div",{className:"p-2",children:e.map((k,_)=>{const T=k.text||p("markdownTable.column",{index:_+1});return a.jsxs("div",{className:"flex min-h-9 items-center gap-2 rounded-md px-1.5 hover:bg-muted",children:[a.jsx(op,{id:`${g}-detail-${_}`,checked:s.has(_),onCheckedChange:()=>o(_)}),a.jsx(Xg,{htmlFor:`${g}-detail-${_}`,className:"min-w-0 flex-1 cursor-pointer truncate font-normal",children:T})]},`${k.key}-detail`)})})]})]})}function iBe({table:e,toolbarExtra:t}){const{language:n,t:s}=nt(),r=V7e(),i=h.useId(),[o,l]=h.useState(null),[c,u]=h.useState({}),[d,f]=h.useState(null),[m,p]=h.useState(null),[g,b]=h.useState(null),[w,y]=h.useState(()=>new Set),[v,x]=h.useState(()=>new Set(sf(e.columnCount))),[k,_]=h.useState({}),[T,S]=h.useState(()=>sf(e.columnCount)),[C,N]=h.useState(null),[E,O]=h.useState(!1),[B,D]=h.useState(null),[j,L]=h.useState(null),[z,I]=h.useState(null),[$,K]=h.useState(!1),[R,Y]=h.useState("standard"),[W,M]=h.useState(null),[F,J]=h.useState(!1),[V,U]=h.useState(!1),[le,pe]=h.useState(!1),[fe,Q]=h.useState(!1),ne=h.useRef(!1),de=h.useRef(null),ue=h.useRef(null),me=h.useRef(null),te=h.useRef(0),ae=h.useRef(0),be=h.useRef(0),se=h.useRef(!0),ve=h.useRef(null),ze=h.useRef(null),Pe=h.useRef(null),_t=h.useRef(null),Pt=h.useRef(null),St=h.useRef(null),he=h.useRef(null),Ae=h.useRef(null),rt=h.useRef(0),dt=h.useRef(0),jt=h.useRef(null),et=h.useRef(null),Mt=h.useMemo(()=>`${e.columnCount}\0${e.headers.map(xe=>xe.text).join("\0")}`,[e.columnCount,e.headers]),sn=h.useRef(Mt),Ye=h.useCallback(()=>{p(null)},[]),$n=h.useCallback(()=>{te.current+=1,de.current&&(clearTimeout(de.current),de.current=null),U(!1)},[]),Te=h.useCallback(()=>{ae.current+=1,ue.current&&(clearTimeout(ue.current),ue.current=null),pe(!1)},[]),ie=h.useCallback(()=>{be.current+=1,me.current&&(clearTimeout(me.current),me.current=null),Q(!1)},[]),it=h.useCallback(()=>{rt.current&&(cancelAnimationFrame(rt.current),rt.current=0);const xe=Ae.current;Ae.current=null,xe&&f(Ge=>Ge&&{...Ge,focusRow:xe.rowIndex,focusCol:xe.columnIndex})},[]),we=h.useCallback(()=>{it(),ne.current=!1,J(!1)},[it]);h.useEffect(()=>{const xe=()=>{document.hidden&&we()};return window.addEventListener("mouseup",we),window.addEventListener("blur",we),document.addEventListener("visibilitychange",xe),()=>{window.removeEventListener("mouseup",we),window.removeEventListener("blur",we),document.removeEventListener("visibilitychange",xe),rt.current&&cancelAnimationFrame(rt.current)}},[we]),h.useEffect(()=>{sn.current!==Mt&&(sn.current=Mt,l(null),u({}),f(null),p(null),b(null),y(new Set),x(new Set(sf(e.columnCount))),_({}),S(sf(e.columnCount)),N(null),O(!1),D(null),L(null),I(null),K(!1),Y("standard"),$n(),Te(),ie(),ne.current=!1,et.current=null,J(!1))},[Te,ie,$n,e.columnCount,Mt]),h.useEffect(()=>{Te()},[Te,d]),h.useEffect(()=>(se.current=!0,()=>{se.current=!1,de.current&&(clearTimeout(de.current),de.current=null),ue.current&&(clearTimeout(ue.current),ue.current=null),me.current&&(clearTimeout(me.current),me.current=null)}),[]),h.useEffect(()=>{if(!m)return;const xe=`${i}-filter-${m.columnIndex}`,Ge=Zt=>{if(Zt.target instanceof Element){const Tn=Zt.target.closest("[data-markdown-table-filter-owner]");if((Tn==null?void 0:Tn.getAttribute("data-markdown-table-filter-owner"))===xe)return}p(null)},tt=()=>p(null);return document.addEventListener("scroll",Ge,!0),window.addEventListener("resize",tt),()=>{document.removeEventListener("scroll",Ge,!0),window.removeEventListener("resize",tt)}},[m,i]),h.useEffect(()=>{if(!g)return;const xe=Zt=>{var Gn;const Tn=Zt.target;(Gn=Pt.current)!=null&&Gn.contains(Tn)||b(null)},Ge=Zt=>{Zt.key==="Escape"&&(Zt.preventDefault(),b(null))},tt=()=>b(null);return document.addEventListener("mousedown",xe),document.addEventListener("keydown",Ge),document.addEventListener("scroll",tt,!0),window.addEventListener("resize",tt),()=>{document.removeEventListener("mousedown",xe),document.removeEventListener("keydown",Ge),document.removeEventListener("scroll",tt,!0),window.removeEventListener("resize",tt)}},[g]),h.useEffect(()=>{const xe=tt=>{var Tn,Gn;const Zt=tt.target;Zt instanceof Node&&!((Tn=ve.current)!=null&&Tn.contains(Zt))&&!((Gn=Pt.current)!=null&&Gn.contains(Zt))&&N(null)},Ge=tt=>{tt.defaultPrevented||m||z||g||tt.key==="Escape"&&N(null)};return document.addEventListener("mousedown",xe),document.addEventListener("keydown",Ge),()=>{document.removeEventListener("mousedown",xe),document.removeEventListener("keydown",Ge)}},[z,g,m]),h.useEffect(()=>{if(!d)return;const xe=Ge=>{var Zt;const tt=Ge.target;tt instanceof Node&&!((Zt=ve.current)!=null&&Zt.contains(tt))&&(we(),f(null))};return document.addEventListener("mousedown",xe),()=>{document.removeEventListener("mousedown",xe)}},[d,we]);const We=h.useMemo(()=>hW(e.rows,c),[c,e.rows]),ce=h.useMemo(()=>K$e(We,o),[We,o]);h.useEffect(()=>{f(xe=>xe&&(t3(xe).maxRow<ce.length?xe:null))},[ce.length]);const De=h.useMemo(()=>{if(!m)return[];const xe=m.columnIndex;return Y$e(hW(e.rows,c,xe),xe,s("markdownTable.blank"))},[c,m,s,e.rows]),ct=h.useMemo(()=>e.headers.map((xe,Ge)=>X$e(e.rows,Ge)),[e.headers,e.rows]),qe=h.useMemo(()=>T.filter(xe=>xe>=0&&xe<e.columnCount).filter(xe=>!w.has(xe)),[T,w,e.columnCount]),Ve=h.useMemo(()=>sf(e.columnCount).filter(xe=>v.has(xe)),[v,e.columnCount]),Qt=E?qe[0]:void 0,Un=qe.reduce((xe,Ge)=>xe+(k[Ge]??0),0),Ie=qe.filter(xe=>k[xe]===void 0).length,wt=Ie===0,Wt=h.useMemo(()=>{if(!z)return null;const xe=ce.find(Ge=>Ge.key===z.rowKey);return(xe==null?void 0:xe.cells[z.columnIndex])??null},[z,ce]),Me=Wt==null?void 0:Wt.text;h.useEffect(()=>{$n()},[$n,qe,ce]),h.useEffect(()=>{if(!B)return;const xe=()=>{const Tn=jt.current;jt.current=null,dt.current&&(cancelAnimationFrame(dt.current),dt.current=0),Tn!==null&&_(Gn=>cW(Gn,B.columnIndex,Tn))},Ge=Tn=>{jt.current=lW(B.startWidth+Tn.clientX-B.startX),!dt.current&&(dt.current=requestAnimationFrame(xe))},tt=()=>{xe(),D(null)},Zt=()=>{document.hidden&&tt()};return window.addEventListener("mousemove",Ge),window.addEventListener("mouseup",tt),window.addEventListener("blur",tt),document.addEventListener("visibilitychange",Zt),()=>{window.removeEventListener("mousemove",Ge),window.removeEventListener("mouseup",tt),window.removeEventListener("blur",tt),document.removeEventListener("visibilitychange",Zt),dt.current&&(cancelAnimationFrame(dt.current),dt.current=0),jt.current=null}},[B]),h.useEffect(()=>{j&&!ce.some(xe=>xe.key===j)&&L(null),z&&!ce.some(xe=>xe.key===z.rowKey&&xe.cells[z.columnIndex])&&I(null)},[z,j,ce]),h.useLayoutEffect(()=>{const xe=_t.current;if(_t.current=null,!(xe!=null&&xe.element.isConnected))return;const Ge=xe.element.getBoundingClientRect().top-xe.top;Ge!==0&&(xe.scrollContainer?xe.scrollContainer.scrollTop+=Ge:window.scrollBy(0,Ge))},[j]),h.useEffect(()=>{if(z)return r()},[z,r]),h.useEffect(()=>{z&&ie()},[z,Me,ie]),h.useEffect(()=>{if(z)return()=>{const xe=he.current;he.current=null,xe!=null&&xe.isConnected&&xe.focus()}},[z]);const Je=(xe,Ge)=>{f(null),u(tt=>{const Zt={...tt};return Ge&&Yx(Ge)?Zt[xe]=Ge:delete Zt[xe],Zt}),Ye()},pt=xe=>{f(null),N(xe),l(Ge=>(Ge==null?void 0:Ge.columnIndex)!==xe?{columnIndex:xe,direction:"asc"}:Ge.direction==="asc"?{columnIndex:xe,direction:"desc"}:null)},ln=(xe,Ge)=>{if(!Ge){p(tt=>(tt==null?void 0:tt.columnIndex)===xe?null:tt);return}f(null),N(xe),b(null),p({columnIndex:xe})},Bn=xe=>{f(null),N(Ge=>Ge===xe?null:Ge),Ye(),u(Ge=>{const tt={...Ge};return delete tt[xe],tt}),l(Ge=>(Ge==null?void 0:Ge.columnIndex)===xe?null:Ge),y(Ge=>{const tt=new Set(Ge);return tt.has(xe)?tt.delete(xe):tt.add(xe),tt})},ns=xe=>{if(f(null),N(null),Ye(),xe){y(new Set);return}y(new Set(sf(e.columnCount))),u({}),l(null)},lt=xe=>{x(Ge=>{const tt=new Set(Ge);return tt.has(xe)?tt.delete(xe):tt.add(xe),tt})},Xe=xe=>{x(xe?new Set(sf(e.columnCount)):new Set)},ot=()=>{f(null),N(null),Ye(),S(sf(e.columnCount)),y(new Set),x(new Set(sf(e.columnCount)))},Tt=()=>{O(xe=>!xe),b(null)},fn=(xe,Ge)=>{if(Ge!==qe[0])return;xe.preventDefault(),f(null),N(Ge),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))})},Qn=(xe,Ge)=>{var tt;j!==xe&&Ge&&(_t.current={element:Ge,scrollContainer:$$e(((tt=ve.current)==null?void 0:tt.parentElement)??null),top:Ge.getBoundingClientRect().top}),f(null),I(null),ie(),L(Zt=>Zt===xe?null:xe)},Os=(xe,Ge)=>{he.current=document.activeElement instanceof HTMLElement?document.activeElement:null,f(null),p(null),L(null),ie(),I({rowKey:xe,columnIndex:Ge})},rr=()=>{I(null),ie()},Es=()=>{if(Me==null||!navigator.clipboard)return;const xe=be.current;navigator.clipboard.writeText(n3(Me)).then(()=>{se.current&&be.current===xe&&(me.current&&clearTimeout(me.current),Q(!0),me.current=setTimeout(()=>Q(!1),2e3))}).catch(Ge=>console.warn("[web-shell] clipboard write failed:",Ge))},cs=h.useMemo(()=>d?t3(d):null,[d]),$t=h.useMemo(()=>new Set(VL(d,qe)),[d,qe]),xs=(xe,Ge)=>{if(!cs)return!1;const{minRow:tt,maxRow:Zt}=cs;return xe>=tt&&xe<=Zt&&$t.has(Ge)},Ce=(xe,Ge,tt)=>`max(${xe}px, calc((100cqw - ${g4}px - ${Ge}px) / ${tt}))`,mn=xe=>{const Ge=k[xe];return Ge!==void 0?{width:Ge}:{width:Ce(R==="compact"?N$e:Fb,Un,Ie)}};h.useLayoutEffect(()=>{if(!E||Qt===void 0){M(null);return}const xe=ve.current,Ge=Pe.current;if(!xe||!Ge)return;const tt=()=>{const Tn=xe.getBoundingClientRect(),Gn=Ge.getBoundingClientRect();M(Math.max(0,Gn.right-Tn.left-xe.clientLeft))};if(tt(),typeof ResizeObserver>"u")return window.addEventListener("resize",tt),()=>window.removeEventListener("resize",tt);const Zt=new ResizeObserver(tt);return Zt.observe(xe),Zt.observe(Ge),()=>Zt.disconnect()},[k,R,E,Qt,qe]);const gt=(xe,Ge)=>{xe.preventDefault(),xe.stopPropagation();const tt=xe.currentTarget.closest("th"),Zt=tt==null?void 0:tt.getBoundingClientRect().width;D({columnIndex:Ge,startX:xe.clientX,startWidth:k[Ge]??(Zt?Math.round(Zt):Fb)})},wn=(xe,Ge)=>{if(xe.ctrlKey||xe.metaKey||xe.altKey||xe.shiftKey)return;let tt=0;if(xe.key==="ArrowRight"?tt=aW:xe.key==="ArrowLeft"&&(tt=-aW),tt===0)return;xe.preventDefault(),xe.stopPropagation();const Zt=xe.currentTarget.closest("th"),Tn=Zt==null?void 0:Zt.getBoundingClientRect().width;_(Gn=>{const Jr=Gn[Ge]??(Tn?Math.round(Tn):Fb),zs=lW(Jr+tt);return cW(Gn,Ge,zs)})},Wn=(xe,Ge)=>{xe.stopPropagation(),N(Ge),et.current=Ge,xe.dataTransfer.effectAllowed="move",xe.dataTransfer.setData(lle,String(Ge))},di=()=>{et.current=null},$s=xe=>{et.current===null||!dW(xe.dataTransfer)||(xe.preventDefault(),xe.dataTransfer.dropEffect="move")},Gr=(xe,Ge)=>{const tt=et.current;di(),!(tt===null||!dW(xe.dataTransfer))&&(xe.preventDefault(),xe.stopPropagation(),f(null),N(tt),S(Zt=>U$e(Zt,tt,Ge)))},Gs=(xe,Ge)=>{m!==null&&p(null),N(null),ne.current=!0,f({anchorRow:xe,anchorCol:Ge,focusRow:xe,focusCol:Ge})},Ks=(xe,Ge,tt)=>{var Zt;xe.button!==0||sj(xe.target)||(xe.preventDefault(),(Zt=ze.current)==null||Zt.focus({preventScroll:!0}),Gs(Ge,tt))},Qr=(xe,Ge)=>{ne.current&&(J(!0),Ae.current={rowIndex:xe,columnIndex:Ge},!rt.current&&(rt.current=requestAnimationFrame(()=>{rt.current=0;const tt=Ae.current;Ae.current=null,tt&&f(Zt=>Zt&&{...Zt,focusRow:tt.rowIndex,focusCol:tt.columnIndex})})))},Rt=xe=>{var Gn;const Ge=document.elementFromPoint(xe.clientX,xe.clientY),tt=Ge==null?void 0:Ge.closest("[data-row-index][data-column-index]");if(!tt||!((Gn=ve.current)!=null&&Gn.contains(tt)))return null;const Zt=Number(tt.dataset.rowIndex),Tn=Number(tt.dataset.columnIndex);return!Number.isInteger(Zt)||!Number.isInteger(Tn)?null:{rowIndex:Zt,columnIndex:Tn}},Ii=(xe,Ge,tt)=>{xe.touches.length!==1||sj(xe.target)||Gs(Ge,tt)},uo=xe=>{if(!ne.current||xe.touches.length!==1)return;const Ge=xe.touches[0];if(!Ge)return;const tt=Rt(Ge);tt&&(xe.preventDefault(),Qr(tt.rowIndex,tt.columnIndex))},Or=()=>{const xe=uW(d,ce,qe);if(!xe||!navigator.clipboard)return;const Ge=ae.current;navigator.clipboard.writeText(xe).then(()=>{se.current&&ae.current===Ge&&(ue.current&&clearTimeout(ue.current),pe(!0),ue.current=setTimeout(()=>pe(!1),2e3))}).catch(tt=>console.warn("[web-shell] clipboard write failed:",tt))},hi=()=>{const xe=q$e(e.headers,ce,qe);if(!xe||!navigator.clipboard)return;const Ge=te.current;navigator.clipboard.writeText(xe).then(()=>{se.current&&te.current===Ge&&(de.current&&clearTimeout(de.current),U(!0),de.current=setTimeout(()=>U(!1),2e3))}).catch(tt=>console.warn("[web-shell] clipboard write failed:",tt))},us=xe=>{if(L$e())return;const Ge=uW(d,ce,qe);Ge&&(xe.preventDefault(),xe.clipboardData.setData("text/plain",Ge))},Jt=h.useMemo(()=>H$e(d,ce,qe),[qe,d,ce]),Ys=(Jt==null?void 0:Jt.selectedCount)??0,Bs=Object.values(c).filter(Yx).length,ho=h.useMemo(()=>ce.some(xe=>qe.some(Ge=>{const tt=xe.cells[Ge];return tt?rj(oj(tt)):!1})),[qe,ce]),Si=ce.length===e.rows.length?s("markdownTable.rows",{count:e.rows.length}):s("markdownTable.rowsFiltered",{visible:ce.length,total:e.rows.length}),si=(xe,Ge)=>{const tt=oj(xe),Zt=rj(tt);return a.jsx("div",{className:`${rn.cellContent} ${Zt&&!Ge?rn.cellContentCollapsed:""}`,title:Zt&&!Ge?tt:void 0,children:a.jsx("div",{className:rn.cellText,children:xe.content})})},pr=(xe,Ge)=>{const tt=xe.text.length===0,Zt=oj(xe),Tn=rj(Zt);return a.jsx("div",{className:`${rn.detailValueContent} ${Tn&&!Ge?rn.detailValueCollapsed:""} ${tt?rn.emptyValue:""}`,title:Tn&&!Ge?Zt:void 0,children:a.jsx("div",{className:rn.detailValueText,children:tt?s("markdownTable.emptyValue"):xe.content})})};return a.jsxs("div",{ref:ve,className:`${rn.tableShell} ${O$e(R)} ${E?rn.hasFrozenColumn:""} ${F?rn.dragging:""}`,children:[a.jsx(Td,{delayDuration:300,children:a.jsxs("div",{className:rn.toolbar,children:[a.jsx("span",{className:rn.summary,children:Si}),Bs>0&&a.jsx("span",{className:rn.selection,children:s("markdownTable.filtersActive",{count:Bs})}),Ys>0&&Jt&&a.jsxs("div",{className:rn.selectionStats,children:[a.jsxs("span",{className:rn.selectionMetric,children:[s("markdownTable.selection.selected")," ",a.jsx("strong",{className:rn.selectionMetricValue,children:Jt.selectedCount})]}),a.jsxs("span",{className:rn.selectionMetric,children:[s("markdownTable.selection.nonEmpty")," ",a.jsx("strong",{className:rn.selectionMetricValue,children:Jt.nonEmptyCount})]}),a.jsxs("span",{className:rn.selectionMetric,children:[s("markdownTable.selection.numeric")," ",a.jsx("strong",{className:rn.selectionMetricValue,children:Jt.numericCount})]}),a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsx(Kt,{variant:"outline",size:"xs",className:rn.selectionCopyButton,type:"button",onClick:Or,"aria-label":s("markdownTable.copyTsv"),children:s(le?"code.copied":"markdownTable.copyTsv")})}),a.jsx(Uu,{side:"top",children:s("markdownTable.copyTsvHint")})]}),Jt.numericCount>0&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:`${rn.selectionMetric} ${rn.selectionMetricSecondary}`,children:[s("markdownTable.selection.sum")," ",a.jsx("strong",{className:rn.selectionMetricValue,children:G2(Jt.sum,Jt,n)})]}),a.jsxs("span",{className:`${rn.selectionMetric} ${rn.selectionMetricSecondary}`,children:[s("markdownTable.selection.average")," ",a.jsx("strong",{className:rn.selectionMetricValue,children:G2(Jt.average,Jt,n)})]}),a.jsxs("span",{className:`${rn.selectionMetric} ${rn.selectionMetricSecondary}`,children:[s("markdownTable.selection.min")," ",a.jsx("strong",{className:rn.selectionMetricValue,children:G2(Jt.min,Jt,n)})]}),a.jsxs("span",{className:`${rn.selectionMetric} ${rn.selectionMetricSecondary}`,children:[s("markdownTable.selection.max")," ",a.jsx("strong",{className:rn.selectionMetricValue,children:G2(Jt.max,Jt,n)})]})]})]}),a.jsx("span",{className:rn.toolbarSpacer}),a.jsxs(vl,{value:R,onValueChange:xe=>Y(xe),children:[a.jsxs(xl,{size:"sm",className:rn.densityTrigger,"aria-label":s("markdownTable.densityLabel"),children:[a.jsx(R_e,{className:"size-4"}),a.jsx(wl,{children:a.jsx("span",{className:rn.compactToolbarLabel,children:s("markdownTable.densityCurrent",{density:s(`markdownTable.density.${R}`)})})})]}),a.jsx(kl,{className:rn.densityMenu,children:R$e.map(xe=>a.jsx(Ai,{value:xe,"data-value":xe,children:s(`markdownTable.density.${xe}`)},xe))})]}),a.jsx(rBe,{headers:e.headers,columnOrder:T,hiddenColumns:w,detailColumns:v,onToggleTableColumn:Bn,onToggleAllTableColumns:ns,onToggleDetailColumn:lt,onToggleAllDetailColumns:Xe,onReset:ot,onDragStart:Wn,onDragEnd:di,onDragOver:$s,onDrop:Gr}),ho&&a.jsx(Kt,{variant:"ghost",size:"sm",className:rn.toolbarControl,type:"button",onClick:()=>K(xe=>!xe),children:s($?"markdownTable.collapseLongText":"markdownTable.expandLongText")}),a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsxs("button",{className:rn.iconButton,type:"button",onClick:hi,"aria-label":s("markdownTable.copyVisible"),children:[V?a.jsxs(a.Fragment,{children:[a.jsx(kh,{"aria-hidden":"true"}),a.jsx("span",{className:"sr-only",children:"✓"})]}):a.jsx(iD,{"aria-hidden":"true"}),a.jsx("span",{className:"sr-only",children:s(V?"code.copied":"markdownTable.copyVisible")})]})}),a.jsx(Uu,{side:"top",children:s(V?"code.copied":"markdownTable.copyVisible")})]}),t]})}),a.jsxs("div",{ref:ze,className:rn.scroller,tabIndex:0,onCopy:us,children:[a.jsxs("table",{className:rn.table,children:[a.jsxs("colgroup",{children:[a.jsx("col",{className:rn.actionColumn,style:D$e}),qe.map(xe=>a.jsx("col",{style:mn(xe)},`column-${xe}`)),wt&&a.jsx("col",{className:rn.fillerColumn})]}),a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{className:`${rn.headerCell} ${rn.actionHeaderCell} ${E?rn.stickyActionHeaderCell:""}`,children:a.jsx("span",{className:"sr-only",children:s("markdownTable.actions")})}),qe.map(xe=>{const Ge=e.headers[xe];if(!Ge)return null;const tt=(o==null?void 0:o.columnIndex)===xe,Zt=Yx(c[xe]),Tn=(m==null?void 0:m.columnIndex)===xe,Gn=Ge.text||s("markdownTable.column",{index:xe+1}),Jr=tt?s(o.direction==="asc"?"markdownTable.sortByColumnAsc":"markdownTable.sortByColumnDesc",{column:Gn}):s("markdownTable.sortByColumn",{column:Gn}),zs=tt?o.direction==="asc"?"ascending":"descending":"none",vs=`${i}-filter-${xe}`,$r=Ge.textAlign?{textAlign:Ge.textAlign}:void 0,Xs=Qt===xe,fs=C===xe;return a.jsxs("th",{ref:Xs?Pe:void 0,className:`${rn.headerCell} ${Xs?rn.frozenHeaderCell:""} ${fs?rn.activeHeaderCell:""}`,"aria-sort":zs,onContextMenu:ks=>fn(ks,xe),style:$r,title:Gn,children:[a.jsxs("div",{className:rn.headerControls,children:[a.jsx("span",{className:rn.headerText,style:$r,children:Ge.content}),a.jsxs(Yf,{open:Tn,onOpenChange:ks=>ln(xe,ks),children:[a.jsx(Gp,{asChild:!0,children:a.jsx("button",{className:`${rn.filterTrigger} ${Zt?rn.filterTriggerActive:""}`,type:"button","aria-label":s("markdownTable.filterColumn",{column:Gn}),"aria-controls":Tn?vs:void 0,children:a.jsx(Pke,{"aria-hidden":"true"})})}),Tn&&a.jsx(nBe,{id:vs,columnName:Gn,columnIndex:xe,filter:c[xe],isNumeric:ct[xe]??!1,options:De,onApply:Je,onClose:Ye},xe)]}),a.jsx("button",{className:`${rn.sortTrigger} ${tt?rn.sortTriggerActive:""}`,type:"button",onClick:()=>pt(xe),"aria-label":Jr,children:tt?o.direction==="asc"?a.jsx(Axe,{"aria-hidden":"true"}):a.jsx(_xe,{"aria-hidden":"true"}):a.jsx(xxe,{"aria-hidden":"true"})})]}),a.jsx("button",{className:rn.resizeHandle,type:"button",onMouseDown:ks=>gt(ks,xe),onKeyDown:ks=>wn(ks,xe),role:"separator","aria-label":s("markdownTable.resizeColumn",{column:Gn}),"aria-orientation":"vertical","aria-valuemin":ole,"aria-valuemax":ale,"aria-valuenow":k[xe]??Fb})]},Ge.key)}),wt&&a.jsx("th",{className:rn.fillerHeaderCell,"aria-hidden":"true"})]})}),a.jsx("tbody",{children:ce.map((xe,Ge)=>{const tt=j===xe.key,Zt=`${i}-detail-${xe.key}`;return a.jsxs(h.Fragment,{children:[a.jsxs("tr",{children:[a.jsx("td",{className:`${rn.cell} ${rn.actionCell} ${E?rn.stickyActionCell:""}`,children:a.jsx("button",{className:rn.rowDetailButton,type:"button",onClick:Tn=>Qn(xe.key,Tn.currentTarget.closest("tr")),"aria-expanded":tt,"aria-controls":Zt,"aria-label":s(tt?"markdownTable.closeRowDetailsAria":"markdownTable.rowDetailsAria",{index:Ge+1}),children:tt?a.jsx(u_e,{"aria-hidden":"true"}):a.jsx(Vf,{"aria-hidden":"true"})})}),qe.map(Tn=>{const Gn=xe.cells[Tn];if(!Gn)return null;const Jr=Gn.textAlign?{textAlign:Gn.textAlign}:void 0,zs=Qt===Tn;return a.jsx("td",{className:`${rn.cell} ${xs(Ge,Tn)?rn.selectedCell:""} ${zs?rn.frozenCell:""}`,style:Jr,"data-row-index":Ge,"data-column-index":Tn,onMouseDown:vs=>Ks(vs,Ge,Tn),onMouseEnter:()=>Qr(Ge,Tn),onTouchStart:vs=>Ii(vs,Ge,Tn),onTouchMove:uo,onTouchEnd:we,onTouchCancel:we,onDoubleClick:vs=>{sj(vs.target)||Os(xe.key,Tn)},children:si(Gn,$)},Gn.key)}),wt&&a.jsx("td",{className:rn.fillerCell,"aria-hidden":"true"})]}),tt&&a.jsx("tr",{id:Zt,className:rn.detailRow,children:a.jsx("td",{className:rn.detailCell,colSpan:qe.length+1+(wt?1:0),children:a.jsxs("div",{className:rn.detailPanel,children:[a.jsx("span",{className:"sr-only",children:s("markdownTable.detailsHeader")}),Ve.map(Tn=>{const Gn=e.headers[Tn],Jr=xe.cells[Tn];return!Gn||!Jr?null:a.jsxs("div",{className:rn.detailItem,children:[a.jsx("div",{className:rn.detailLabel,title:Gn.text,children:Gn.content}),a.jsx("div",{className:rn.detailValue,children:pr(Jr,$)})]},`${xe.key}-detail-${Tn}`)}),Ve.length===0&&a.jsx("div",{className:rn.emptyValue,children:s("markdownTable.customColumns.noDetails")})]})})})]},xe.key)})})]}),ce.length===0&&a.jsx("div",{className:rn.emptyState,children:e.rows.length===0?s("markdownTable.empty"):s("markdownTable.emptyFiltered")})]}),E&&W!==null&&a.jsx("div",{className:rn.frozenColumnShadow,style:{left:W},"aria-hidden":"true"}),g&&qe.length>0&&a.jsx("div",{ref:Pt,className:rn.columnContextMenu,style:{left:g.left,top:g.top},role:"menu",children:a.jsx("button",{className:rn.columnContextMenuAction,type:"button",role:"menuitem",onClick:Tt,children:s(E?"markdownTable.unfreezeFirstColumn":"markdownTable.freezeFirstColumn")})}),a.jsx(qp,{open:z!==null&&Wt!==null,onOpenChange:xe=>{xe||rr()},children:Wt&&a.jsxs(Hp,{ref:St,className:"sm:max-w-lg",showCloseButton:!1,overlayProps:{onMouseDown:rr},onOpenAutoFocus:xe=>{var Ge;xe.preventDefault(),(Ge=St.current)==null||Ge.focus()},tabIndex:-1,children:[a.jsx(ZI,{asChild:!0,children:a.jsxs(Kt,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm","aria-label":s("markdownTable.close"),children:[a.jsx(yv,{className:"size-3.5",strokeWidth:1.5}),a.jsx("span",{className:"sr-only",children:s("markdownTable.close")})]})}),a.jsx(Up,{children:a.jsx(Vp,{children:s("markdownTable.cellDialogTitle")})}),a.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:Wt.content}),a.jsxs(Wp,{children:[a.jsx(Kt,{variant:"outline",onClick:Es,children:s(fe?"code.copied":"markdownTable.copyCell")}),a.jsx(ZI,{asChild:!0,children:a.jsx(Kt,{children:s("markdownTable.close")})})]})]})})]})}var dle={exports:{}};/* @license
Papa Parse
v5.5.4
https://github.com/mholt/PapaParse
License: MIT
*/(function(e,t){((n,s)=>{e.exports=s()})(lk,function n(){var s=typeof self<"u"?self:typeof window<"u"?window:s!==void 0?s:{},r,i=!s.document&&!!s.postMessage,o=s.IS_PAPA_WORKER||!1,l={},c=0,u={};function d(N){return N.charCodeAt(0)===65279?N.slice(1):N}function f(N){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(E){var O=T(E);O.chunkSize=parseInt(O.chunkSize),E.step||E.chunk||(O.chunkSize=null),this._handle=new w(O),(this._handle.streamer=this)._config=O}).call(this,N),this.parseChunk=function(E,O){var B=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<B){let j=this._config.newline;j||(D=this._config.quoteChar||'"',j=this._handle.guessLineEndings(E,D)),E=[...E.split(j).slice(B)].join(j)}this.isFirstChunk&&C(this._config.beforeFirstChunk)&&(D=this._config.beforeFirstChunk(E))!==void 0&&(E=D),this.isFirstChunk=!1,this._halted=!1;var B=this._partialLine+E,D=(this._partialLine="",this._handle.parse(B,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(E=D.meta.cursor,B=(this._finished||(this._partialLine=B.substring(E-this._baseIndex),this._baseIndex=E),D&&D.data&&(this._rowCount+=D.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),o)s.postMessage({results:D,workerId:u.WORKER_ID,finished:B});else if(C(this._config.chunk)&&!O){if(this._config.chunk(D,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=D=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(D.data),this._completeResults.errors=this._completeResults.errors.concat(D.errors),this._completeResults.meta=D.meta),this._completed||!B||!C(this._config.complete)||D&&D.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),B||D&&D.meta.paused||this._nextChunk(),D}this._halted=!0},this._sendError=function(E){C(this._config.error)?this._config.error(E):o&&this._config.error&&s.postMessage({workerId:u.WORKER_ID,error:E,finished:!1})}}function m(N){var E;(N=N||{}).chunkSize||(N.chunkSize=u.RemoteChunkSize),f.call(this,N),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(O){this._input=O,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(E=new XMLHttpRequest,this._config.withCredentials&&(E.withCredentials=this._config.withCredentials),i||(E.onload=S(this._chunkLoaded,this),E.onerror=S(this._chunkError,this)),E.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var O,B=this._config.downloadRequestHeaders;for(O in B)E.setRequestHeader(O,B[O])}var D;this._config.chunkSize&&(D=this._start+this._config.chunkSize-1,E.setRequestHeader("Range","bytes="+this._start+"-"+D));try{E.send(this._config.downloadRequestBody)}catch(j){this._chunkError(j.message)}i&&E.status===0&&this._chunkError()}},this._chunkLoaded=function(){E.readyState===4&&(E.status<200||400<=E.status?this._chunkError():(this._start+=this._config.chunkSize||E.responseText.length,this._finished=!this._config.chunkSize||this._start>=(O=>(O=O.getResponseHeader("Content-Range"))!==null?parseInt(O.substring(O.lastIndexOf("/")+1)):-1)(E),this.parseChunk(E.responseText)))},this._chunkError=function(O){O=E.statusText||O,this._sendError(new Error(O))}}function p(N){(N=N||{}).chunkSize||(N.chunkSize=u.LocalChunkSize),f.call(this,N);var E,O,B=typeof FileReader<"u";this.stream=function(D){this._input=D,O=D.slice||D.webkitSlice||D.mozSlice,B?((E=new FileReader).onload=S(this._chunkLoaded,this),E.onerror=S(this._chunkError,this)):E=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var D=this._input,j=(this._config.chunkSize&&(j=Math.min(this._start+this._config.chunkSize,this._input.size),D=O.call(D,this._start,j)),E.readAsText(D,this._config.encoding));B||this._chunkLoaded({target:{result:j}})},this._chunkLoaded=function(D){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(D.target.result)},this._chunkError=function(){this._sendError(E.error)}}function g(N){var E;f.call(this,N=N||{}),this.stream=function(O){return E=O,this._nextChunk()},this._nextChunk=function(){var O,B;if(!this._finished)return O=this._config.chunkSize,E=O?(B=E.substring(0,O),E.substring(O)):(B=E,""),this._finished=!E,this.parseChunk(B)}}function b(N){f.call(this,N=N||{});var E=[],O=!0,B=!1;this.pause=function(){f.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){f.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(D){this._input=D,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){B&&E.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),E.length?this.parseChunk(E.shift()):O=!0},this._streamData=S(function(D){try{E.push(typeof D=="string"?D:D.toString(this._config.encoding)),O&&(O=!1,this._checkIsFinished(),this.parseChunk(E.shift()))}catch(j){this._streamError(j)}},this),this._streamError=S(function(D){this._streamCleanUp(),this._sendError(D)},this),this._streamEnd=S(function(){this._streamCleanUp(),B=!0,this._streamData("")},this),this._streamCleanUp=S(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function w(N){var E,O,B,D,j=Math.pow(2,53),L=-j,z=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,I=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,$=this,K=0,R=0,Y=!1,W=!1,M=[],F={data:[],errors:[],meta:{}};function J(pe){return N.skipEmptyLines==="greedy"?pe.join("").trim()==="":pe.length===1&&pe[0].length===0}function V(){if(F&&B&&(le("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+u.DefaultDelimiter+"'"),B=!1),N.skipEmptyLines&&(F.data=F.data.filter(function(ne){return!J(ne)})),U()){let ne=function(de,ue){de=d(de),C(N.transformHeader)&&(de=N.transformHeader(de,ue)),M.push(de)};if(F)if(Array.isArray(F.data[0])){for(var pe=0;U()&&pe<F.data.length;pe++)F.data[pe].forEach(ne);F.data.splice(0,1)}else F.data.forEach(ne)}function fe(ne,de){for(var ue=N.header?{}:[],me=0;me<ne.length;me++){var te=me,ae=ne[me],ae=((be,se)=>(ve=>(N.dynamicTypingFunction&&N.dynamicTyping[ve]===void 0&&(N.dynamicTyping[ve]=N.dynamicTypingFunction(ve)),(N.dynamicTyping[ve]||N.dynamicTyping)===!0))(be)?se==="true"||se==="TRUE"||se!=="false"&&se!=="FALSE"&&((ve=>{if(z.test(ve)&&(ve=parseFloat(ve),L<ve&&ve<j))return 1})(se)?parseFloat(se):I.test(se)?new Date(se):se===""?null:se):se)(te=N.header?me>=M.length?"__parsed_extra":M[me]:te,ae=N.transform?N.transform(ae,te):ae);te==="__parsed_extra"?(ue[te]=ue[te]||[],ue[te].push(ae)):ue[te]=ae}return N.header&&(me>M.length?le("FieldMismatch","TooManyFields","Too many fields: expected "+M.length+" fields but parsed "+me,R+de):me<M.length&&le("FieldMismatch","TooFewFields","Too few fields: expected "+M.length+" fields but parsed "+me,R+de)),ue}var Q;F&&(N.header||N.dynamicTyping||N.transform)&&(Q=1,!F.data.length||Array.isArray(F.data[0])?(F.data=F.data.map(fe),Q=F.data.length):F.data=fe(F.data,0),N.header&&F.meta&&(F.meta.fields=M),R+=Q)}function U(){return N.header&&M.length===0}function le(pe,fe,Q,ne){pe={type:pe,code:fe,message:Q},ne!==void 0&&(pe.row=ne),F.errors.push(pe)}C(N.step)&&(D=N.step,N.step=function(pe){F=pe,U()?V():(V(),F.data.length!==0&&(K+=pe.data.length,N.preview&&K>N.preview?O.abort():(F.data=F.data[0],D(F,$))))}),this.parse=function(pe,fe,Q){var ne=N.quoteChar||'"',ne=(N.newline||(N.newline=this.guessLineEndings(pe,ne)),B=!1,N.delimiter?C(N.delimiter)&&(N.delimiter=N.delimiter(pe),F.meta.delimiter=N.delimiter):((ne=((de,ue,me,te,ae)=>{var be,se,ve,ze;ae=ae||[",","	","|",";",u.RECORD_SEP,u.UNIT_SEP];for(var Pe=0;Pe<ae.length;Pe++){for(var _t,Pt=ae[Pe],St=0,he=0,Ae=0,rt=(ve=void 0,new v({comments:te,delimiter:Pt,newline:ue,preview:10}).parse(de)),dt=0;dt<rt.data.length;dt++)me&&J(rt.data[dt])?Ae++:(_t=rt.data[dt].length,he+=_t,ve===void 0?ve=_t:0<_t&&(St+=Math.abs(_t-ve),ve=_t));0<rt.data.length&&(he/=rt.data.length-Ae),(se===void 0||St<=se)&&(ze===void 0||ze<he)&&1.99<he&&(se=St,be=Pt,ze=he)}return{successful:!!(N.delimiter=be),bestDelimiter:be}})(pe,N.newline,N.skipEmptyLines,N.comments,N.delimitersToGuess)).successful?N.delimiter=ne.bestDelimiter:(B=!0,N.delimiter=u.DefaultDelimiter),F.meta.delimiter=N.delimiter),T(N));return N.preview&&N.header&&ne.preview++,E=pe,O=new v(ne),F=O.parse(E,fe,Q),V(),Y?{meta:{paused:!0}}:F||{meta:{paused:!1}}},this.paused=function(){return Y},this.pause=function(){Y=!0,O.abort(),E=C(N.chunk)?"":E.substring(O.getCharIndex())},this.resume=function(){$.streamer._halted?(Y=!1,$.streamer.parseChunk(E,!0)):setTimeout($.resume,3)},this.aborted=function(){return W},this.abort=function(){W=!0,O.abort(),F.meta.aborted=!0,C(N.complete)&&N.complete(F),E=""},this.guessLineEndings=function(de,ne){de=de.substring(0,1048576);var ne=new RegExp(y(ne)+"([^]*?)"+y(ne),"gm"),Q=(de=de.replace(ne,"")).split("\r"),ne=de.split(`
`),de=1<ne.length&&ne[0].length<Q[0].length;if(Q.length===1||de)return`
`;for(var ue=0,me=0;me<Q.length;me++)Q[me][0]===`
`&&ue++;return ue>=Q.length/2?`\r
`:"\r"}}function y(N){return N.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function v(N){var E=(N=N||{}).delimiter,O=N.newline,B=N.comments,D=N.step,j=N.preview,L=N.fastMode,z=null,I=!1,$=N.quoteChar==null?'"':N.quoteChar,K=$;if(N.escapeChar!==void 0&&(K=N.escapeChar),(typeof E!="string"||-1<u.BAD_DELIMITERS.indexOf(E))&&(E=","),B===E)throw new Error("Comment character same as delimiter");B===!0?B="#":(typeof B!="string"||-1<u.BAD_DELIMITERS.indexOf(B))&&(B=!1),O!==`
`&&O!=="\r"&&O!==`\r
`&&(O=`
`);var R=0,Y=!1;this.parse=function(W,M,F){if(typeof W!="string")throw new Error("Input must be a string");var J=W.length,V=E.length,U=O.length,le=B.length,pe=C(D),fe=[],Q=[],ne=[],de=R=0;if(!W)return St();if(L||L!==!1&&W.indexOf($)===-1){for(var ue=W.split(O),me=0;me<ue.length;me++){if(ne=ue[me],R+=ne.length,me!==ue.length-1)R+=O.length;else if(F)return St();if(!B||ne.substring(0,le)!==B){if(pe){if(fe=[],ze(ne.split(E)),he(),Y)return St()}else ze(ne.split(E));if(j&&j<=me)return fe=fe.slice(0,j),St(!0)}}return St()}for(var te=W.indexOf(E,R),ae=W.indexOf(O,R),be=new RegExp(y(K)+y($),"g"),se=W.indexOf($,R);;)if(W[R]===$)for(se=R,R++;;){if((se=W.indexOf($,se+1))===-1)return F||Q.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:fe.length,index:R}),_t();if(se===J-1)return _t(W.substring(R,se).replace(be,$));if($===K&&W[se+1]===K)se++;else if($===K||se===0||W[se-1]!==K){te!==-1&&te<se+1&&(te=W.indexOf(E,se+1));var ve=Pe((ae=ae!==-1&&ae<se+1?W.indexOf(O,se+1):ae)===-1?te:Math.min(te,ae));if(W.substr(se+1+ve,V)===E){ne.push(W.substring(R,se).replace(be,$)),W[R=se+1+ve+V]!==$&&(se=W.indexOf($,R)),te=W.indexOf(E,R),ae=W.indexOf(O,R);break}if(ve=Pe(ae),W.substring(se+1+ve,se+1+ve+U)===O){if(ne.push(W.substring(R,se).replace(be,$)),Pt(se+1+ve+U),te=W.indexOf(E,R),se=W.indexOf($,R),pe&&(he(),Y))return St();if(j&&fe.length>=j)return St(!0);break}Q.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:fe.length,index:R}),se++}}else if(B&&ne.length===0&&W.substring(R,R+le)===B){if(ae===-1)return St();R=ae+U,ae=W.indexOf(O,R),te=W.indexOf(E,R)}else if(te!==-1&&(te<ae||ae===-1))ne.push(W.substring(R,te)),R=te+V,te=W.indexOf(E,R);else{if(ae===-1)break;if(ne.push(W.substring(R,ae)),Pt(ae+U),pe&&(he(),Y))return St();if(j&&fe.length>=j)return St(!0)}return _t();function ze(Ae){fe.push(Ae),de=R}function Pe(Ae){var rt=0;return rt=Ae!==-1&&(Ae=W.substring(se+1,Ae))&&Ae.trim()===""?Ae.length:rt}function _t(Ae){return F||(Ae===void 0&&(Ae=W.substring(R)),ne.push(Ae),R=J,ze(ne),pe&&he()),St()}function Pt(Ae){R=Ae,ze(ne),ne=[],ae=W.indexOf(O,R)}function St(Ae){if(N.header&&!M&&fe.length&&!I){var rt=fe[0],dt=Object.create(null),jt=new Set(rt);let et=!1;for(let Mt=0;Mt<rt.length;Mt++){let sn=d(rt[Mt]);if(dt[sn=C(N.transformHeader)?N.transformHeader(sn,Mt):sn]){let Ye,$n=dt[sn];for(;Ye=sn+"_"+$n,$n++,jt.has(Ye););jt.add(Ye),rt[Mt]=Ye,dt[sn]++,et=!0,(z=z===null?{}:z)[Ye]=sn}else dt[sn]=1,rt[Mt]=sn;jt.add(sn)}et&&console.warn("Duplicate headers found and renamed."),I=!0}return{data:fe,errors:Q,meta:{delimiter:E,linebreak:O,aborted:Y,truncated:!!Ae,cursor:de+(M||0),renamedHeaders:z}}}function he(){D(St()),fe=[],Q=[]}},this.abort=function(){Y=!0},this.getCharIndex=function(){return R}}function x(N){var E=N.data,O=l[E.workerId],B=!1;if(E.error)O.userError(E.error,E.file);else if(E.results&&E.results.data){var D={abort:function(){B=!0,k(E.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:_,resume:_};if(C(O.userStep)){for(var j=0;j<E.results.data.length&&(O.userStep({data:E.results.data[j],errors:E.results.errors,meta:E.results.meta},D),!B);j++);delete E.results}else C(O.userChunk)&&(O.userChunk(E.results,D,E.file),delete E.results)}E.finished&&!B&&k(E.workerId,E.results)}function k(N,E){var O=l[N];C(O.userComplete)&&O.userComplete(E),O.terminate(),delete l[N]}function _(){throw new Error("Not implemented.")}function T(N){if(typeof N!="object"||N===null)return N;var E,O=Array.isArray(N)?[]:{};for(E in N)O[E]=T(N[E]);return O}function S(N,E){return function(){N.apply(E,arguments)}}function C(N){return typeof N=="function"}return u.parse=function(N,E){var O=(E=E||{}).dynamicTyping||!1;if(C(O)&&(E.dynamicTypingFunction=O,O={}),E.dynamicTyping=O,E.transform=!!C(E.transform)&&E.transform,!E.worker||!u.WORKERS_SUPPORTED)return O=null,u.NODE_STREAM_INPUT,typeof N=="string"?(N=d(N),O=new(E.download?m:g)(E)):N.readable===!0&&C(N.read)&&C(N.on)?O=new b(E):(s.File&&N instanceof File||N instanceof Object)&&(O=new p(E)),O.stream(N);(O=(()=>{var B;return!!u.WORKERS_SUPPORTED&&(B=(()=>{var D=s.URL||s.webkitURL||null,j=n.toString();return u.BLOB_URL||(u.BLOB_URL=D.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",j,")();"],{type:"text/javascript"})))})(),(B=new s.Worker(B)).onmessage=x,B.id=c++,l[B.id]=B)})()).userStep=E.step,O.userChunk=E.chunk,O.userComplete=E.complete,O.userError=E.error,E.step=C(E.step),E.chunk=C(E.chunk),E.complete=C(E.complete),E.error=C(E.error),delete E.worker,O.postMessage({input:N,config:E,workerId:O.id})},u.unparse=function(N,E){var O=!1,B=!0,D=",",j=`\r
`,L='"',z=L+L,I=!1,$=null,K=!1,R=((()=>{if(typeof E=="object"){if(typeof E.delimiter!="string"||u.BAD_DELIMITERS.filter(function(M){return E.delimiter.indexOf(M)!==-1}).length||(D=E.delimiter),typeof E.quotes!="boolean"&&typeof E.quotes!="function"&&!Array.isArray(E.quotes)||(O=E.quotes),typeof E.skipEmptyLines!="boolean"&&typeof E.skipEmptyLines!="string"||(I=E.skipEmptyLines),typeof E.newline=="string"&&(j=E.newline),typeof E.quoteChar=="string"&&(L=E.quoteChar,z=L+L),typeof E.header=="boolean"&&(B=E.header),Array.isArray(E.columns)){if(E.columns.length===0)throw new Error("Option columns is empty");$=E.columns}E.escapeChar!==void 0&&(z=E.escapeChar+L),E.escapeFormulae instanceof RegExp?K=E.escapeFormulae:typeof E.escapeFormulae=="boolean"&&E.escapeFormulae&&(K=/^[=+\-@\t\r].*$/)}})(),new RegExp(y(L),"g"));if(typeof N=="string"&&(N=JSON.parse(N)),Array.isArray(N)){if(!N.length||Array.isArray(N[0]))return Y(null,N,I);if(typeof N[0]=="object")return Y($||Object.keys(N[0]),N,I)}else if(typeof N=="object")return typeof N.data=="string"&&(N.data=JSON.parse(N.data)),Array.isArray(N.data)&&(N.fields||(N.fields=N.meta&&N.meta.fields||$),N.fields||(N.fields=Array.isArray(N.data[0])?N.fields:typeof N.data[0]=="object"?Object.keys(N.data[0]):[]),Array.isArray(N.data[0])||typeof N.data[0]=="object"||(N.data=[N.data])),Y(N.fields||[],N.data||[],I);throw new Error("Unable to serialize unrecognized input");function Y(M,F,J){var V="",U=(typeof M=="string"&&(M=JSON.parse(M)),typeof F=="string"&&(F=JSON.parse(F)),Array.isArray(M)&&0<M.length),le=!Array.isArray(F[0]);if(U&&B){for(var pe=0;pe<M.length;pe++)0<pe&&(V+=D),V+=W(M[pe],pe);0<F.length&&(V+=j)}for(var fe=0;fe<F.length;fe++){var Q=(U?M:F[fe]).length,ne=!1,de=U?Object.keys(F[fe]).length===0:F[fe].length===0;if(J&&!U&&(ne=J==="greedy"?F[fe].join("").trim()==="":F[fe].length===1&&F[fe][0].length===0),J==="greedy"&&U){for(var ue=[],me=0;me<Q;me++){var te=le?M[me]:me;ue.push(F[fe][te])}ne=ue.join("").trim()===""}if(!ne){for(var ae=0;ae<Q;ae++){0<ae&&!de&&(V+=D);var be=U&&le?M[ae]:ae;V+=W(F[fe][be],ae)}fe<F.length-1&&(!J||0<Q&&!de)&&(V+=j)}}return V}function W(M,F){var J,V,U;return M==null?"":M.constructor===Date?JSON.stringify(M).slice(1,25):(U=!1,K&&typeof M=="string"&&K.test(M)&&(M="'"+M,U=!0),V=(J=M.toString()).replace(R,z),(U=U||O===!0||typeof O=="function"&&O(M,F)||Array.isArray(O)&&O[F]||((le,pe)=>{for(var fe=0;fe<pe.length;fe++)if(-1<le.indexOf(pe[fe]))return!0;return!1})(V,u.BAD_DELIMITERS)||-1<V.indexOf(D)||-1<J.indexOf(L)||V.charAt(0)===" "||V.charAt(V.length-1)===" ")?L+V+L:V)}},u.RECORD_SEP="",u.UNIT_SEP="",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",`
`,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!i&&!!s.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=v,u.ParserHandle=w,u.NetworkStreamer=m,u.FileStreamer=p,u.StringStreamer=g,u.ReadableStreamStreamer=b,s.jQuery&&((r=s.jQuery).fn.parse=function(N){var E=N.config||{},O=[];return this.each(function(j){if(!(r(this).prop("tagName").toUpperCase()==="INPUT"&&r(this).attr("type").toLowerCase()==="file"&&s.FileReader)||!this.files||this.files.length===0)return!0;for(var L=0;L<this.files.length;L++)O.push({file:this.files[L],inputElem:this,instanceConfig:r.extend({},E)})}),B(),this;function B(){if(O.length===0)C(N.complete)&&N.complete();else{var j,L,z,I,$=O[0];if(C(N.before)){var K=N.before($.file,$.inputElem);if(typeof K=="object"){if(K.action==="abort")return j="AbortError",L=$.file,z=$.inputElem,I=K.reason,void(C(N.error)&&N.error({name:j},L,z,I));if(K.action==="skip")return void D();typeof K.config=="object"&&($.instanceConfig=r.extend($.instanceConfig,K.config))}else if(K==="skip")return void D()}var R=$.instanceConfig.complete;$.instanceConfig.complete=function(Y){C(R)&&R(Y,$.file,$.inputElem),D()},u.parse($.file,$.instanceConfig)}}function D(){O.splice(0,1),B()}}),o&&(s.onmessage=function(N){N=N.data,u.WORKER_ID===void 0&&N&&(u.WORKER_ID=N.workerId),typeof N.input=="string"?s.postMessage({workerId:u.WORKER_ID,results:u.parse(N.input,N.config),finished:!0}):(s.File&&N.input instanceof File||N.input instanceof Object)&&(N=u.parse(N.input,N.config))&&s.postMessage({workerId:u.WORKER_ID,results:N,finished:!0})}),(m.prototype=Object.create(f.prototype)).constructor=m,(p.prototype=Object.create(f.prototype)).constructor=p,(g.prototype=Object.create(g.prototype)).constructor=g,(b.prototype=Object.create(f.prototype)).constructor=b,u})})(dle);var oBe=dle.exports;const aBe=h_(oBe);var hle=/^echarts-chatbi_query_(\d+)-(\d+)$/,fle=/^echarts-chatbi_sandbox_filepath_(\S+)$/i;function lBe(e){return hle.test(e)}function mle(e){return fle.test(e)}function cBe(e){return lBe(e)||mle(e)}function uBe(e,t){const n=hle.exec(e);if(!n)throw new bn("SCHEMA_INVALID",`Invalid temporary EChart query language: ${e}`);const s=Number(n[2]);if(!Number.isSafeInteger(s))throw new bn("SCHEMA_INVALID","Temporary EChart query index is too large");return{language:e,jobId:`chatbi_query_${n[1]}`,index:s,source:t.trim()}}function dBe(e,t){const n=fle.exec(e),s=n==null?void 0:n[1];if(!s)throw new bn("SCHEMA_INVALID",`Invalid temporary EChart sandbox file language: ${e}`);return{language:e,filePath:s,source:t.trim()}}var fW=new Set(["__proto__","prototype","constructor"]);function hBe(e){return new TextEncoder().encode(e).byteLength}function ib(e,t){throw new bn("SCHEMA_INVALID",e,{cause:t})}function fBe(e,t){if(hBe(e)>t.maxArtifactContentBytes)throw new bn("LIMIT_EXCEEDED",`ArtifactContent exceeds the ${t.maxArtifactContentBytes} UTF-8 byte limit`);let n;const s=new Set,r=new Set;let i;try{n=aBe.parse(e,{dynamicTyping:!1,header:!0,preview:t.maxRows+1,skipEmptyLines:"greedy",transformHeader(f,m){if(r.has(m))return f;if(f.length===0?i="ArtifactContent CSV column names must not be empty":fW.has(f.toLowerCase())?i=`ArtifactContent CSV column ${f} is not allowed`:s.has(f)&&(i=`ArtifactContent CSV column ${f} is duplicated; column names must be unique`),i)throw new Error(i);return r.add(m),s.add(f),f}})}catch(f){return ib(i??"ArtifactContent is not valid CSV",f)}const o=n.errors.filter(f=>f.code!=="UndetectableDelimiter");if(o.length>0){const f=o[0];return ib(`ArtifactContent is not valid CSV: ${(f==null?void 0:f.message)??"parse error"}`)}const l=n.meta.fields??[];if(l.length===0)return ib("ArtifactContent CSV must have a header row");const c=new Set;for(const f of l){if(f.length===0)return ib("ArtifactContent CSV column names must not be empty");if(fW.has(f.toLowerCase()))return ib(`ArtifactContent CSV column ${f} is not allowed`);if(c.has(f))return ib(`ArtifactContent CSV column ${f} is duplicated`);c.add(f)}if(l.length>t.maxColumns)throw new bn("LIMIT_EXCEEDED",`ArtifactContent CSV exceeds the ${t.maxColumns} column limit`);if(n.data.length>t.maxRows)throw new bn("LIMIT_EXCEEDED",`ArtifactContent CSV exceeds the ${t.maxRows} row limit`);if(n.data.length*l.length>t.maxCells)throw new bn("LIMIT_EXCEEDED",`ArtifactContent CSV exceeds the ${t.maxCells} cell limit`);const d=n.data.map(f=>{const m={};for(const p of l)m[p]=f[p]??"";return m});return{kind:"inline",dimensions:l,source:d}}var mBe="//#end",pBe=[/^\s*(?:(?:const|let|var)\s+)?[\w$]*\s*=?\s*echarts\.init\([^;]*\);?\s*$/,/^\s*[\w$]+\.setOption\([^;]*\);?\s*$/];function gBe(e){return e.split(`
`).map(t=>t.split(mBe).join("")).filter(t=>!pBe.some(n=>n.test(t.trim()))).join(`
`).trim()}var nM="@datafe-open/markdown-chart/legacy-echart-query",bBe=["default-src 'none'","script-src 'unsafe-inline' 'unsafe-eval'","worker-src blob:","connect-src 'none'","img-src 'none'","style-src 'none'","font-src 'none'","object-src 'none'","media-src 'none'","frame-src 'none'","base-uri 'none'","form-action 'none'"].join("; "),yBe=`
(function () {
  'use strict';
  var handled = false;

  function disableGlobal(name) {
    try {
      Object.defineProperty(globalThis, name, {
        value: undefined,
        writable: false,
        configurable: false
      });
    } catch (_) {
      try { globalThis[name] = undefined; } catch (_) {}
    }
  }

  globalThis.onmessage = function (event) {
    if (handled) return;
    handled = true;
    var request = event.data;
    var port = event.ports && event.ports[0];
    if (!request || request.type !== 'execute' || typeof request.source !== 'string' || !port) {
      return;
    }

    var stringify = JSON.stringify.bind(JSON);
    var parse = JSON.parse.bind(JSON);
    var send;
    try {
      send = MessagePort.prototype.postMessage.bind(port);
      Object.defineProperty(globalThis, 'inputData', {
        value: request.inputData,
        writable: false,
        configurable: false
      });
      [
        'fetch',
        'XMLHttpRequest',
        'WebSocket',
        'WebSocketStream',
        'EventSource',
        'WebTransport',
        'importScripts',
        'Worker',
        'SharedWorker',
        'postMessage',
        'close'
      ].forEach(disableGlobal);
      try {
        if (globalThis.navigator) {
          Object.defineProperty(globalThis.navigator, 'sendBeacon', {
            value: undefined,
            writable: false,
            configurable: false
          });
        }
      } catch (_) {}

      var option = (0, eval)(request.source + '\\n;typeof option === "undefined" ? undefined : option;');
      var serialized = stringify(option);
      if (serialized === undefined) throw new Error('missing option');
      send({ type: 'result', option: parse(serialized) });
    } catch (_) {
      try {
        if (send) send({ type: 'error', code: 'EXECUTION_FAILED' });
      } catch (_) {}
    } finally {
      try { port.close(); } catch (_) {}
    }
  };
})();`;function mW(e){return JSON.stringify(e).replace(/</g,"\\u003c")}var vBe=`
(function () {
  'use strict';
  var CHANNEL = ${mW(nM)};
  var WORKER_SCRIPT = ${mW(yBe)};
  var handled = false;
  var activeWorker;

  function fixedError(requestId) {
    parent.postMessage({
      channel: CHANNEL,
      type: 'error',
      requestId: requestId,
      code: 'EXECUTION_FAILED'
    }, '*');
  }

  window.addEventListener('message', function (event) {
    var request = event.data;
    if (
      handled
      || event.source !== parent
      || !request
      || request.channel !== CHANNEL
      || request.type !== 'execute'
      || typeof request.requestId !== 'string'
      || typeof request.source !== 'string'
    ) {
      return;
    }
    handled = true;

    var blobUrl;
    var port1;
    var done = false;
    function cleanup() {
      if (activeWorker) {
        activeWorker.terminate();
        activeWorker = undefined;
      }
      if (port1) {
        port1.onmessage = null;
        try { port1.close(); } catch (_) {}
      }
      if (blobUrl) {
        URL.revokeObjectURL(blobUrl);
        blobUrl = undefined;
      }
    }
    function settle(payload) {
      if (done) return;
      done = true;
      cleanup();
      parent.postMessage(payload, '*');
    }

    try {
      blobUrl = URL.createObjectURL(new Blob([WORKER_SCRIPT], { type: 'text/javascript' }));
      activeWorker = new Worker(blobUrl);
      URL.revokeObjectURL(blobUrl);
      blobUrl = undefined;
      var messageChannel = new MessageChannel();
      port1 = messageChannel.port1;
      port1.onmessage = function (workerEvent) {
        var response = workerEvent.data;
        if (response && response.type === 'result') {
          settle({
            channel: CHANNEL,
            type: 'result',
            requestId: request.requestId,
            option: response.option
          });
          return;
        }
        settle({
          channel: CHANNEL,
          type: 'error',
          requestId: request.requestId,
          code: 'EXECUTION_FAILED'
        });
      };
      activeWorker.onerror = function (workerError) {
        workerError.preventDefault();
        settle({
          channel: CHANNEL,
          type: 'error',
          requestId: request.requestId,
          code: 'EXECUTION_FAILED'
        });
      };
      activeWorker.postMessage({
        type: 'execute',
        source: request.source,
        inputData: request.inputData
      }, [messageChannel.port2]);
    } catch (_) {
      cleanup();
      fixedError(request.requestId);
    }
  });
})();`,wBe=`<!doctype html>
<html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${bBe}"></head>
<body><script>${vBe}<\/script></body></html>`;function xBe(){const e=globalThis.crypto;if(!(e!=null&&e.getRandomValues))throw new bn("LEGACY_SANDBOX_UNAVAILABLE","Secure random values are required by the temporary legacy sandbox");const t=new Uint32Array(4);return e.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(8,"0")).join("")}function pW(){return new DOMException("The temporary legacy chart operation was aborted","AbortError")}function kBe(e){if(e.signal.aborted)return Promise.reject(pW());if(!Number.isSafeInteger(e.timeoutMs)||e.timeoutMs<=0)return Promise.reject(new bn("SCHEMA_INVALID","Legacy sandbox timeout must be a positive safe integer"));if(typeof document>"u"||!document.body)return Promise.reject(new bn("LEGACY_SANDBOX_UNAVAILABLE","The temporary legacy sandbox requires a browser document body"));const t=xBe(),n=document.createElement("iframe");return n.hidden=!0,n.setAttribute("aria-hidden","true"),n.setAttribute("title","Temporary chart sandbox"),n.setAttribute("sandbox","allow-scripts"),n.srcdoc=wBe,new Promise((s,r)=>{let i=!1,o=!1,l;const c=()=>{window.removeEventListener("message",m),e.signal.removeEventListener("abort",f),n.onload=null,n.onerror=null,l!==void 0&&clearTimeout(l),n.remove()},u=(p,g)=>{i||(i=!0,c(),p(g))},d=p=>{i||(i=!0,c(),r(p))},f=()=>d(pW()),m=p=>{if(!(p.source!==n.contentWindow||!Mr(p.data))&&!(p.data.channel!==nM||p.data.requestId!==t)){if(p.data.type==="error"){d(new bn("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart source failed in the isolated worker"));return}if(p.data.type==="result")try{const g=Rte(p.data.option);if(!Mr(g))throw new bn("SCHEMA_INVALID","Temporary legacy chart source must produce a JSON object option");u(s,g)}catch(g){d(g)}}};window.addEventListener("message",m),e.signal.addEventListener("abort",f,{once:!0}),n.onerror=()=>d(new bn("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart sandbox failed to load")),n.onload=()=>{var p;if(!o){if(o=!0,n.onload=null,i||e.signal.aborted){f();return}(p=n.contentWindow)==null||p.postMessage({channel:nM,type:"execute",requestId:t,source:e.source,inputData:e.inputData},"*")}},l=setTimeout(()=>d(new bn("LEGACY_SANDBOX_TIMEOUT",`Temporary legacy chart sandbox exceeded ${e.timeoutMs}ms`)),e.timeoutMs),document.body.append(n)})}var ple=class extends Error{constructor(t,n,s){super(n,s&&"cause"in s?{cause:s.cause}:void 0);He(this,"code");He(this,"cause");this.name="LegacySandboxError",this.code=t,this.cause=s==null?void 0:s.cause}},_Be=Object.freeze({maxArtifactContentBytes:5*1024*1024,maxRows:2e3,maxColumns:200,maxCells:4e4,executionTimeoutMs:5e3});function SBe(e,t){const n={..._Be,...e,...t};for(const[s,r]of Object.entries(n))if(!Number.isSafeInteger(r)||r<=0)throw new bn("SCHEMA_INVALID",`legacyArtifactLimits.${s} must be a positive safe integer`);return n}async function gle(e){let t;try{t=await e.resolveContent()}catch(i){throw e.signal.aborted||e.preserveLegacySandboxError&&i instanceof ple?i:new bn("REF_RESOLUTION_FAILED",e.resolutionError,{cause:i})}if(typeof t!="string")throw new bn("SCHEMA_INVALID",e.returnTypeError);if(e.signal.aborted)throw new DOMException("The temporary legacy chart operation was aborted","AbortError");const n=fBe(t,e.limits),s=gBe(e.source);if(!s)throw new bn("SCHEMA_INVALID","Temporary legacy chart source is empty after sanitization");const r=await kBe({source:s,inputData:n.source,signal:e.signal,timeoutMs:e.limits.executionTimeoutMs});return{data:n,spec:r}}async function CBe(e){return gle({source:e.block.source,signal:e.signal,limits:e.limits,resolveContent:()=>e.resolveArtifactContent({language:e.block.language,jobId:e.block.jobId,index:e.block.index,signal:e.signal}),resolutionError:"The temporary ChatBI ArtifactContent could not be resolved",returnTypeError:"resolveLegacyArtifactContent must return the raw CSV ArtifactContent string",preserveLegacySandboxError:e.preserveLegacySandboxError===!0})}async function TBe(e){return gle({source:e.block.source,signal:e.signal,limits:e.limits,resolveContent:()=>e.resolveSandboxFileContent({language:e.block.language,filePath:e.block.filePath,signal:e.signal}),resolutionError:"The temporary ChatBI sandbox file could not be resolved",returnTypeError:"resolveLegacySandboxFileContent must return a raw CSV string",preserveLegacySandboxError:e.preserveLegacySandboxError===!0})}var EBe=Object.freeze({maxRows:2e3,maxCells:4e4,maxSeries:100,maxDepth:40,maxNodes:1e5}),ABe=new Set(["angleAxis","aria","animation","animationDelay","animationDelayUpdate","animationDuration","animationDurationUpdate","animationEasing","animationEasingUpdate","animationThreshold","axisPointer","backgroundColor","blendMode","brush","calendar","color","darkMode","dataset","dataZoom","geo","grid","hoverLayerThreshold","legend","parallel","parallelAxis","polar","progressive","progressiveChunkMode","progressiveThreshold","radar","radiusAxis","series","singleAxis","stateAnimation","textStyle","title","tooltip","useUTC","visualMap","xAxis","yAxis"]),jBe=new Set(["__proto__","prototype","constructor","extracsstext","renderitem","graphic","image","toolbox","dataview","transform","link","sublink","href","src","url"]),NBe=/(?:url|uri|href|src|link)$/i,IBe=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,gW=/(?:^|[\s("'=])(?:https?:|file:|ftp:|blob:|data:|javascript:|vbscript:|\/\/|image:\/\/)/i,MBe=/\burl\s*\(/i,RBe=/<\s*\/?\s*[a-z][^>]*>/i,DBe=/&(?:#\d+|#x[\da-f]+|[a-z][\da-z]+);/i,LBe=/^[A-Za-z_][A-Za-z0-9_]*$/;function zr(e){throw new bn("SCHEMA_INVALID",e)}function sM(e,t,n){for(const s of Object.keys(e))t.has(s)||zr(`${n}.${s} is not allowed`)}function bW(e,t){if(!Array.isArray(e)||e.length===0)return zr(`${t} must be a non-empty array`);const n=e.map((s,r)=>typeof s!="string"||!LBe.test(s)?zr(`${t}[${r}] must be a stable ASCII identifier`):s);return new Set(n).size!==n.length?zr(`${t} must not contain duplicate dimensions`):n}function PBe(e,t){if(!Mr(e)||typeof e.kind!="string")return zr("echarts-fulldata.data must be an inline or ref dataset object");if(e.kind==="inline"){sM(e,new Set(["kind","dimensions","source"]),"echarts-fulldata.data");const n=bW(e.dimensions,"echarts-fulldata.data.dimensions");if(!Array.isArray(e.source))return zr("echarts-fulldata.data.source must be an array");e.source.forEach((r,i)=>{Array.isArray(r)||zr(`echarts-fulldata.data.source[${i}] must be an array`),r.length!==n.length&&zr(`echarts-fulldata.data.source[${i}] must contain ${n.length} cells`)});const s=k6(e.source,t,"echarts-fulldata.data.source");return{kind:"inline",dimensions:n,source:s}}if(e.kind==="ref"){if(sM(e,new Set(["kind","ref","format","dimensions"]),"echarts-fulldata.data"),typeof e.ref!="string"||e.ref.trim().length===0)return zr("echarts-fulldata.data.ref must be a non-empty string");if(e.format!=="csv"&&e.format!=="json")return zr("echarts-fulldata.data.format must be csv or json");const n=bW(e.dimensions,"echarts-fulldata.data.dimensions");return{kind:"ref",ref:e.ref,format:e.format,dimensions:n}}return zr(`Unsupported echarts-fulldata.data.kind: ${e.kind}`)}function ble(e){const t=Array.isArray(e.title),n=t?e.title:[e.title];for(const[s,r]of n.entries()){if(!Mr(r)||typeof r.text!="string")continue;const i=r.text.trim();if(i)return{index:s,isArray:t,title:r,text:i}}}function OBe(e){var t;return(t=ble(e))==null?void 0:t.text}function $Be(e,t){const n=ble(e);if(!(!n||n.text!==t.trim())){if(Object.prototype.hasOwnProperty.call(n.title,"subtext")){delete n.title.text;return}if(n.isArray){e.title.splice(n.index,1);return}delete e.title}}function Qf(e){return Array.isArray(e)?e.map(t=>Qf(t)):Mr(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,Qf(n)])):e}function yle(e,t){if(e!==void 0)return(!Array.isArray(e)||e.some(n=>typeof n!="string"||n.length===0))&&zr(`${t} must be an array of non-empty strings`),[...e]}function k6(e,t,n){if(Array.isArray(e)||zr(`${n} must be an array`),e.length>t.maxRows)throw new bn("LIMIT_EXCEEDED",`${n} exceeds the ${t.maxRows} row limit`);let s=0;const r=e.map((i,o)=>{if(Array.isArray(i)){const l=i.map((c,u)=>(c!==null&&!["string","number","boolean"].includes(typeof c)&&zr(`${n}[${o}][${u}] must be a JSON scalar`),c));return s+=l.length,l}if(Mr(i)){const l={};for(const[c,u]of Object.entries(i))u!==null&&!["string","number","boolean"].includes(typeof u)&&zr(`${n}[${o}].${c} must be a JSON scalar`),l[c]=u,s+=1;return l}return zr(`${n}[${o}] must be an array or object`)});if(s>t.maxCells)throw new bn("LIMIT_EXCEEDED",`${n} exceeds the ${t.maxCells} cell limit`);return r}function BBe(e,t){if(!Mr(e)||typeof e.kind!="string")return zr("echarts.data must be an inline or ref dataset object");const n=yle(e.dimensions,"echarts.data.dimensions");if(e.kind==="inline"){const s=k6(e.source,t,"echarts.data.source");return n?{kind:"inline",dimensions:n,source:s}:{kind:"inline",source:s}}return e.kind==="ref"?typeof e.ref!="string"||e.ref.length===0?zr("echarts.data.ref must be a non-empty string"):e.format!==void 0&&e.format!=="csv"&&e.format!=="json"?zr("echarts.data.format must be csv or json"):{kind:"ref",ref:e.ref,...e.format?{format:e.format}:{},...n?{dimensions:n}:{}}:zr(`Unsupported echarts.data.kind: ${e.kind}`)}function yW(e,t){if(IBe.test(e))throw new bn("UNSAFE_SPEC",`${t} contains an ASCII control character`);const n=e.replace(/[\n\r\t]/g,""),s=e.trim();if(gW.test(s)||gW.test(n.trim())||MBe.test(e)||RBe.test(e)||DBe.test(e))throw new bn("UNSAFE_SPEC",`${t} contains a URL, CSS URL, or unsafe markup`)}function zBe(e,t){for(const r of Object.keys(e))if(!ABe.has(r))throw new bn("UNSAFE_SPEC",`echarts.option.${r} is not allowed`);let n=0;const s=(r,i,o)=>{if(n+=1,n>t.maxNodes)throw new bn("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxNodes} node limit`);if(o>t.maxDepth)throw new bn("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxDepth} depth limit`);if(typeof r=="string"){yW(r,i);return}if(Array.isArray(r)){r.forEach((l,c)=>s(l,`${i}[${c}]`,o+1));return}if(Mr(r))for(const[l,c]of Object.entries(r)){const u=l.toLowerCase();if(u==="formatter"){if(typeof c!="string")throw new bn("UNSAFE_SPEC",`${i}.${l} must be a string`);yW(c,`${i}.${l}`);continue}if(jBe.has(u)||NBe.test(l))throw new bn("UNSAFE_SPEC",`${i}.${l} is not allowed`);if(l==="type"&&c==="custom")throw new bn("UNSAFE_SPEC","Custom ECharts series are not allowed");s(c,`${i}.${l}`,o+1)}};if(s(e,"echarts.option",0),Array.isArray(e.series)&&e.series.length>t.maxSeries)throw new bn("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxSeries} series limit`);e.dataset!==void 0&&(Array.isArray(e.dataset)?e.dataset:[e.dataset]).forEach((i,o)=>{Mr(i)||zr(`echarts.option.dataset[${o}] must be an object`),i.source!==void 0&&k6(i.source,t,`echarts.option.dataset[${o}].source`)})}function rM(e,t,n){if(!Mr(e))return zr("ECharts specification must be an object");if(Object.prototype.hasOwnProperty.call(e,"option")||Object.prototype.hasOwnProperty.call(e,"data"))return zr("Canonical markdown-chart data must be a sibling of spec; spec must contain the ECharts option directly");const s=Qf(e),r=t===void 0?void 0:BBe(t,n);return r&&Object.prototype.hasOwnProperty.call(s,"dataset")?zr("echarts.option.dataset cannot be combined with echarts.data"):(zBe(s,n),{option:s,data:r})}function FBe(e,t){if(!Mr(e))return zr("echarts-fulldata must contain an object");if(sM(e,new Set(["version","data","option"]),"echarts-fulldata"),e.version!==1)throw new bn("UNSUPPORTED_VERSION","Only echarts-fulldata version 1 is supported");if(!Object.prototype.hasOwnProperty.call(e,"data"))return zr("echarts-fulldata.data is required");if(!Mr(e.option))return zr("echarts-fulldata.option must be an object");const n=PBe(e.data,t);return rM(e.option,n,t)}function qBe(e){const t="default"in e?e.default:e;if(!t||typeof t.init!="function")throw new bn("RUNTIME_LOAD_FAILED","The supplied ECharts runtime has no init function");return t}function vW(e,t){const n=k6(e.source,t,"resolvedDataset.source"),s=e.dimensions?yle(e.dimensions,"resolvedDataset.dimensions"):void 0;return s?{data:{kind:"inline",dimensions:s,source:n},option:{dimensions:s,source:n}}:{data:{kind:"inline",source:n},option:{source:n}}}var HBe={light:{background:"#ffffff",foreground:"#343434",legendText:"#555555",titleText:"#343434",subtext:"#aaaaaa",axisLine:"#5d666f",valueAxisLine:"#6E7079",axisLabel:"#838d95",splitLine:"#e0e6f1",splitAreaA:"rgba(250,250,250,0.2)",splitAreaB:"rgba(210,219,238,0.2)",seriesBorder:"#ffffff",pointer:"#7c8a96",tooltipBg:"#ffffff",primary:"#6250f9",palette:["#6250F9","#33AFA9","#AB7BFF","#5F99F9","#A9AFFF","#60CCC5","#C2A5FF","#8EB8FE","#E0E3FE","#98E3DD","#E8E1FA","#D7E6FF"]},dark:{background:"#0d0d0d",foreground:"#f4f7ff",legendText:"#c8cad0",titleText:"#e0e2e8",subtext:"#8a8d93",axisLine:"#555a63",valueAxisLine:"#555a63",axisLabel:"#9da1a8",splitLine:"#3a3e47",splitAreaA:"rgba(60,60,70,0.2)",splitAreaB:"rgba(80,80,90,0.2)",seriesBorder:"#2a2d35",pointer:"#6a707a",tooltipBg:"rgba(30, 32, 40, 0.95)",primary:"#8aa0ff",palette:["#8EA0FF","#61D6D1","#C8A7FF","#8EB8FE","#C7CCFF","#8DE7E2","#D8C5FF","#B8D2FF","#EEF0FF","#C2F0ED","#F0EAFE","#E8F1FF"]}};function dd(e,t){const n={...Qf(e),...t};for(const[s,r]of Object.entries(e)){const i=t[s];Mr(r)&&Mr(i)&&(n[s]=dd(r,i))}return n}function mx(e,t){return Array.isArray(e)?e.map(n=>Mr(n)?dd(t,n):n):Mr(e)?dd(t,e):e??Qf(t)}function vle(e){const t=n=>Mr(n)?{...n,appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}:n;return Array.isArray(e)?e.map(t):t(e)}function zk(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function UBe(e,t){const n=s=>{if(!zk(s,"top")&&!zk(s,"bottom"))return dd(t,s);const r=Qf(t);return delete r.top,delete r.bottom,dd(r,s)};return Array.isArray(e)?e.map(s=>Mr(s)?n(s):s):Mr(e)?n(e):e??Qf(t)}var WBe=740,wle=10,wW=WBe*wle/100,VBe=24,GBe=24,xW=16,KBe=24;function xle(e){if(typeof e=="number")return Number.isFinite(e)&&e>=0&&e<=wW?e:null;if(typeof e!="string")return null;const t=e.trim();if(t==="top")return 0;const n=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+))%$/.exec(t);if(!n)return null;const s=Number(n[1]);return Number.isFinite(s)&&s>=0&&s<=wle?wW:null}function YBe(e){return["text","subtext"].some(t=>typeof e[t]=="string"&&e[t].trim().length>0)}function XBe(e){return e.show===!1||!YBe(e)?null:zk(e,"top")?xle(e.top):zk(e,"bottom")?null:0}function QBe(e){return e.show===!1||!zk(e,"top")?null:xle(e.top)}function kW(e){return Array.isArray(e)?e.filter(Mr):Mr(e)?[e]:[]}function JBe(e,t){const n=kW(e).flatMap(r=>{const i=XBe(r);return i===null?[]:[i+VBe+xW]}),s=kW(t).flatMap(r=>{const i=QBe(r);return i===null?[]:[i+GBe+xW]});return Math.max(KBe,...n,...s)}function _W(e,t){return Array.isArray(e)?e.map((n,s)=>Mr(n)?dd(t(s),n):n):Mr(e)?dd(t(0),e):e}function SW(e,t){const n=typeof e.type=="string"?e.type:void 0;let s={emphasis:{focus:"series",itemStyle:{borderColor:t.seriesBorder,borderWidth:2}},labelLayout:{hideOverlap:!0}};n==="line"?s=dd(s,{lineStyle:{width:2},itemStyle:{borderWidth:1},symbol:"circle",symbolSize:4}):n==="bar"?s=dd(s,{barCategoryGap:"48%",barMaxWidth:42,itemStyle:{borderRadius:[3,3,0,0]}}):n==="pie"&&(s=dd(s,{itemStyle:{borderColor:t.seriesBorder,borderWidth:2}}));const r=dd(s,e);return Object.prototype.hasOwnProperty.call(e,"tooltip")&&(r.tooltip=vle(mx(e.tooltip,{appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}))),r}var kle=new Set(["pie","funnel","gauge","radar","treemap"]),ZBe=new Set([...kle,"graph","chord","themeRiver"]);function _le(e){return Array.isArray(e.series)?e.series.filter(Mr):Mr(e.series)?[e.series]:[]}function eze(e){if(Object.prototype.hasOwnProperty.call(e,"legend"))return!0;const t=_le(e);return t.some(n=>typeof n.type=="string"&&ZBe.has(n.type))?!0:t.filter(n=>typeof n.name=="string"&&n.name.trim().length>0).length>1}function tze(e){if(!Object.prototype.hasOwnProperty.call(e,"xAxis")&&!Object.prototype.hasOwnProperty.call(e,"yAxis"))return"item";const t=_le(e);return t.length>0&&t.every(n=>typeof n.type=="string"&&kle.has(n.type))?"item":"axis"}function nze(e){return e==null||e==="light"?"light":e==="dark"?"dark":void 0}function sze(e,t="light"){const n=HBe[t],s=Qf(e);return s.backgroundColor??(s.backgroundColor=n.background),s.color??(s.color=[...n.palette]),s.textStyle=mx(s.textStyle,{color:n.foreground,fontFamily:"'pingfang SC', 'helvetica neue', arial, 'hiragino sans gb', 'microsoft yahei ui', 'microsoft yahei', sans-serif"}),s.title!==void 0&&(s.title=mx(s.title,{textStyle:{color:n.titleText},subtextStyle:{color:n.subtext}})),s.tooltip=vle(mx(s.tooltip,{trigger:tze(e),appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText",backgroundColor:n.tooltipBg,borderColor:n.splitLine,borderWidth:1,padding:[8,10],textStyle:{color:n.titleText,fontSize:12},axisPointer:{lineStyle:{color:n.pointer,width:1},crossStyle:{color:n.pointer,width:1}}})),eze(e)&&(s.legend=UBe(s.legend,{type:"scroll",bottom:8,padding:[4,16],textStyle:{color:n.legendText,fontSize:12},pageIconColor:n.primary,pageIconInactiveColor:n.splitLine,pageTextStyle:{color:n.legendText}})),s.grid=mx(s.grid,{top:JBe(s.title,s.legend),right:36,bottom:48,left:24,containLabel:!0}),s.xAxis!==void 0&&(s.xAxis=_W(s.xAxis,()=>({axisLine:{show:!0,lineStyle:{color:n.axisLine}},axisTick:{show:!0,lineStyle:{color:n.axisLine}},axisLabel:{color:n.axisLabel,fontSize:12,hideOverlap:!0},splitLine:{show:!1,lineStyle:{color:n.splitLine}},splitArea:{show:!1,areaStyle:{color:[n.splitAreaA,n.splitAreaB]}},nameTextStyle:{color:n.axisLabel}}))),s.yAxis!==void 0&&(s.yAxis=_W(s.yAxis,r=>({alignTicks:!0,axisLine:{show:!1,lineStyle:{color:n.valueAxisLine}},axisTick:{show:!1,lineStyle:{color:n.valueAxisLine}},axisLabel:{color:n.axisLabel,fontSize:12,hideOverlap:!0},splitLine:{show:r===0,lineStyle:{color:n.splitLine}},splitArea:{show:!1,areaStyle:{color:[n.splitAreaA,n.splitAreaB]}},nameGap:12,nameTextStyle:{color:n.axisLabel,align:r===0?"left":"right"}}))),Array.isArray(s.series)?s.series=s.series.map(r=>Mr(r)?SW(r,n):r):Mr(s.series)&&(s.series=SW(s.series,n)),s}var aj={dispose(){}};function rze(e={}){var l,c;const t={...EBe,...e.limits},n=(l=e.legacySandbox)==null?void 0:l.resolveLegacyArtifactContent,s=(c=e.legacySandbox)==null?void 0:c.resolveLegacySandboxFileContent,r=e.legacySandbox?SBe({maxRows:t.maxRows,maxCells:t.maxCells},void 0):void 0,i=e.loadECharts??(async()=>await ye(()=>import("./index-C2GE3DAF.js"),[])),o=async(u,d)=>{if(e.validateDataRef&&!e.validateDataRef(u.ref))throw new bn("REF_REJECTED","The host rejected the chart data reference");if(!e.resolveDataRef)throw new bn("REF_RESOLVER_MISSING","A resolveDataRef callback is required");let f;try{f=await e.resolveDataRef(u.ref,{format:u.format,dimensions:u.dimensions,signal:d})}catch(p){if(d.aborted)return;throw new bn("REF_RESOLUTION_FAILED","The chart dataset could not be resolved",{cause:p})}if(d.aborted)return;const m=f.dimensions||!u.dimensions?f:{...f,dimensions:u.dimensions};return vW(m,t).data};return{id:"echarts",aliases:["echarts-fulldata"],matchLanguage:cBe,parse(u,d){return d.language==="echarts-fulldata"?FBe(u,t):rM(u,d.data,t)},parseSource(u,d){return mle(d.language)?{option:{},data:void 0,legacyEChartSandboxFile:dBe(d.rawLanguage??d.language,u)}:{option:{},data:void 0,legacyEChartQuery:uBe(d.language,u)}},getTitle(u){return OBe(u.option)},async materialize(u,d){var g,b;if(!u.legacyEChartQuery&&!u.legacyEChartSandboxFile){if(((g=u.data)==null?void 0:g.kind)==="ref"){const w=await o(u.data,d.signal);return w?{parsed:{...u,data:w},data:w}:{parsed:u,data:d.data}}return{parsed:u,data:u.data}}if(u.legacyEChartQuery&&!n)throw new bn("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI query fence");if(u.legacyEChartSandboxFile&&!s)throw new bn("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI sandbox-file fence");let f;try{u.legacyEChartSandboxFile?f=await TBe({block:u.legacyEChartSandboxFile,signal:d.signal,resolveSandboxFileContent:s,limits:r,preserveLegacySandboxError:e.legacySandbox!==void 0}):f=await CBe({block:u.legacyEChartQuery,signal:d.signal,resolveArtifactContent:n,limits:r,preserveLegacySandboxError:!0})}catch(w){if(d.signal.aborted)return{parsed:u,data:d.data};throw w instanceof bn||w instanceof ple?w:new bn("REF_RESOLUTION_FAILED","The temporary ChatBI chart could not be resolved",{cause:w})}if(d.signal.aborted)return{parsed:u,data:d.data};let m;try{m=Rte(f,{maxDepth:t.maxDepth,maxNodes:t.maxNodes})}catch(w){throw w instanceof bn?w:new bn("SCHEMA_INVALID","Temporary ChatBI resolver returned a non-JSON result",{cause:w})}if(!Mr(m))return zr("Temporary ChatBI resolver must return an object");if(!Object.prototype.hasOwnProperty.call(m,"data")||!Object.prototype.hasOwnProperty.call(m,"spec"))return zr("Temporary ChatBI resolver must return data and spec");const p=rM(m.spec,m.data,t);return((b=p.data)==null?void 0:b.kind)!=="inline"?zr("Temporary ChatBI resolver must return inline data"):{parsed:p,data:p.data}},async mount(u,d,f){if(d.legacyEChartQuery||d.legacyEChartSandboxFile)return zr("Temporary ChatBI charts must be materialized before mounting");const m=Qf(d.option);if(f.externalizedTitle&&$Be(m,f.externalizedTitle),d.data){let v;if(d.data.kind==="inline")v=d.data;else{const k=await o(d.data,f.signal);if(!k)return aj;v=k}const x=vW(v,t);m.dataset=x.option}if(f.signal.aborted)return aj;let p;try{p=qBe(await i())}catch(v){throw v instanceof bn?v:new bn("RUNTIME_LOAD_FAILED","The ECharts runtime could not be loaded",{cause:v})}if(f.signal.aborted)return aj;let g,b;try{const v=typeof f.theme=="string"||Mr(f.theme)?f.theme:void 0;g=p.init(u,v);const x=nze(f.theme),k=e.defaultStyle===!1||!x?m:sze(m,x);g.setOption(k,{notMerge:!0,lazyUpdate:!1}),e.resizeObserver!==!1&&typeof ResizeObserver<"u"&&(b=new ResizeObserver(()=>g==null?void 0:g.resize()),b.observe(u))}catch(v){try{b==null||b.disconnect()}catch{}try{g==null||g.dispose()}catch{}throw new bn("RENDER_FAILED","ECharts failed to render the chart",{cause:v})}const w=g;let y=!1;return{resize:()=>w.resize(),dispose(){y||(y=!0,b==null||b.disconnect(),w.dispose())}}}}}var GL=h.createContext(null);function ize(e){if(h.isValidElement(e))return typeof e.props.children=="string"?e.props.children:void 0}function oze(e){const t=e.source??ize(e.children),n=h.useMemo(()=>({registry:e.registry,theme:e.theme,streaming:e.streaming??!1,source:t,loadingLabel:e.loadingLabel,labels:e.labels,onError:e.onError}),[e.registry,e.theme,e.streaming,t,e.loadingLabel,e.labels,e.onError]);return h.createElement(GL.Provider,{value:n},e.children)}function aze(e){const t=h.useContext(GL);if(!t)throw new Error("MarkdownChartBlock must be rendered inside MarkdownChartProvider");const n=h.useRef(null),s=e.streaming??t.streaming,r=e.loadingLabel??t.loadingLabel,i=e.labels??t.labels,o=h.useMemo(()=>Lte(i),[i]);h.useEffect(()=>{const c=n.current;if(!c)return;const u=new s5e(t.registry);let d=!1;return u.render(c,{language:e.language,source:e.source,theme:t.theme,streaming:s,...r!==void 0?{loadingLabel:r}:{},...i!==void 0?{labels:i}:{}}).catch(f=>{var m;d||(c.classList.add("markdown-chart-error"),c.setAttribute("role","alert"),c.textContent=o.chartUnavailable,(m=t.onError)==null||m.call(t,f,{language:e.language,source:e.source}))}),()=>{d=!0,u.dispose()}},[t.registry,t.theme,t.onError,r,i,o,e.language,e.source,s]);const l=["markdown-chart-placeholder",s?"markdown-chart-streaming":void 0,e.className].filter(Boolean).join(" ");return h.createElement("div",{ref:n,className:l,style:e.style,"aria-label":o.chart,"aria-busy":s||void 0,"data-markdown-chart-complete":String(!s)})}function lze(e,t){var l,c,u,d;const n=(c=(l=t==null?void 0:t.position)==null?void 0:l.start)==null?void 0:c.offset,s=(d=(u=t==null?void 0:t.position)==null?void 0:u.end)==null?void 0:d.offset;if(e===void 0||n===void 0||s===void 0)return!1;const r=e.lastIndexOf(`
`,Math.max(0,n-1))+1,i=e.slice(r,n),o=/^(?: {0,3}>[ \t]?)+$/.test(i)?r:n;return Ote(e.slice(o,s))||e.slice(s).trim().length>0}function Sle(e,t){return e===l4||(t==null?void 0:t.has(e))===!0}function cze(e={}){return{code({node:n,...s}){return h.createElement("code",s)},pre:function({node:s,children:r,...i}){const o=h.useContext(GL);if(h.isValidElement(r)){const l=r,c=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??""),u=c==null?void 0:c[1],d=u==null?void 0:u.toLowerCase();if(u&&d&&Sle(d,o==null?void 0:o.registry)){const f=h.Children.toArray(l.props.children).map(m=>typeof m=="string"||typeof m=="number"?String(m):"").join("");return h.createElement(aze,{language:u,source:f,streaming:(o==null?void 0:o.streaming)===!0&&!lze(o.source,s),...e.chartClassName?{className:e.chartClassName}:{},...e.chartStyle?{style:e.chartStyle}:{}})}}return h.createElement("pre",i,r)}}}const uze=3e4,dze=["artifact://","session-file://"],hze=/^[a-z]:/i;function fze(e={}){const{resolveDataRef:t,validateDataRef:n=yze,...s}=e,r=e.validateDataRef===void 0,i=t?async(o,l)=>{const c=r?Cle(o):o;if(!c)throw new Error("Chart data reference is not supported.");return vze(Promise.resolve(t(c,l)),"Chart data reference resolution")}:void 0;return new F3e().register(rze({...s,resolveDataRef:i,validateDataRef:n}))}const mze={registry:fze()};function pze(e,t={}){const n=cze(t).pre;if(!n)throw new Error("markdown-chart React adapter did not provide a pre renderer");return function({children:r,...i}){var o;if(h.isValidElement(r)){const l=r,c=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??""),u=(o=c==null?void 0:c[1])==null?void 0:o.toLowerCase();if(u&&Sle(u,e))return h.createElement(n,i,r)}return h.createElement(h.Fragment,null,r)}}function gze({customization:e,source:t,streaming:n,theme:s,children:r}){const i=bze(e.labels),{t:o}=nt();return a.jsx(oze,{registry:e.registry,source:t,streaming:n,theme:s,loadingLabel:e.loadingLabel??o("echartsChart.rendering"),labels:i,onError:e.onError,children:r})}function bze(e){const{t}=nt();return h.useMemo(()=>({chartUnavailable:t("echartsChart.renderFailed"),viewMode:t("echartsChart.viewMode"),chart:t("echartsChart.chart"),data:t("echartsChart.data"),showChart:t("echartsChart.showChart"),showData:t("echartsChart.showData"),noData:t("echartsChart.noData"),tableNotice:({visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:i})=>t("echartsChart.tableNotice",{visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:i,omittedRows:s-n,omittedColumns:i-r}),...e}),[e,t])}function CW(e){return/\s/.test(e)||Array.from(e).some(t=>{const n=t.codePointAt(0);return n!==void 0&&(n<=31||n===127)})}function Cle(e){if(e.trim()!==e||!e||CW(e))return;const t=e.toLowerCase(),n=dze.find(o=>t.startsWith(o));if(!n)return;const s=e.slice(n.length);if(!s||/[?#\\]/.test(s))return;let r;try{r=decodeURIComponent(s)}catch{return}if(/[%?#\\]/.test(r)||CW(r))return;const i=r.split("/");if(!i.some(o=>o.length===0||o==="."||o===".."||hze.test(o)))return`${n}${i.join("/")}`}function yze(e){return Cle(e)!==void 0}function vze(e,t){return new Promise((n,s)=>{const r=globalThis.setTimeout(()=>s(new Error(`${t} timed out.`)),uze);e.then(n,s).finally(()=>globalThis.clearTimeout(r))})}const wze="_content_1n6wo_1",xze="_inlineCode_1n6wo_127",kze="_link_1n6wo_139",_ze="_tableWrapper_1n6wo_149",Sze="_table_1n6wo_149",Cze="_image_1n6wo_179",Tze="_codeBlock_1n6wo_187",Eze="_codeBlockHeader_1n6wo_196",Aze="_codeBlockLang_1n6wo_205",jze="_codeBlockCopy_1n6wo_213",Nze="_codeBlockContent_1n6wo_236",Ize="_codeBlockPlain_1n6wo_256",Mze="_mermaidBlock_1n6wo_274",Rze="_mermaidInline_1n6wo_286",Dze="_mermaidLoading_1n6wo_305",Lze="_mermaidActions_1n6wo_312",Pze="_mermaidZoomWrapper_1n6wo_317",Oze="_mermaidDragging_1n6wo_325",nr={content:wze,inlineCode:xze,link:kze,tableWrapper:_ze,table:Sze,image:Cze,codeBlock:Tze,codeBlockHeader:Eze,codeBlockLang:Aze,codeBlockCopy:jze,codeBlockContent:Nze,codeBlockPlain:Ize,mermaidBlock:Mze,mermaidInline:Rze,mermaidLoading:Dze,mermaidActions:Lze,mermaidZoomWrapper:Pze,mermaidDragging:Oze},$ze=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"]),TW={"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 KL(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(TW,t)?TW[t]:t,s=$ze.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const Tle=/^(https?:|mailto:)/i,Bze=/^data:image\/(png|jpeg|gif|webp);base64,/i;function Ele(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:Tle.test(t):!1}function Rv(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")||Bze.test(t)?!0:Tle.test(t):!1}let EW,zze=0;function Fze({code:e}){const{t}=nt(),n=im(),[s,r]=h.useState(null),[i,o]=h.useState(null),[l,c]=h.useState("diagram"),[u,d]=h.useState(!1),[f,m]=h.useState(1),[p,g]=h.useState({x:0,y:0}),[b,w]=h.useState(!1),y=h.useRef(null),v=n==="light"?"default":"dark",x=.5,k=3,_=.25,T=()=>{m(O=>Math.min(k,Math.round((O+_)*100)/100))},S=()=>{m(O=>Math.max(x,Math.round((O-_)*100)/100))},C=h.useCallback(()=>{y.current=null,w(!1),m(1),g({x:0,y:0})},[]),N=h.useCallback(O=>{O.preventDefault(),w(!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 j=D.clientX-y.current.startX,L=D.clientY-y.current.startY,z=1500;g({x:y.current.origX+j,y:Math.max(-z,Math.min(z,y.current.origY+L))})},B=()=>{y.current=null,w(!1)};return window.addEventListener("mousemove",O),window.addEventListener("mouseup",B),window.addEventListener("blur",B),()=>{window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",B),window.removeEventListener("blur",B)}},[b]),h.useEffect(()=>{m(1),g({x:0,y:0})},[e]),h.useEffect(()=>{let O=!1;r(null),o(null);const B=setTimeout(()=>{ye(()=>import("./mermaid.core-fLrhp_4-.js").then(D=>D.bm),[]).then(async D=>{if(O)return;const j=D.default;EW!==v&&(j.initialize({startOnLoad:!1,theme:v,securityLevel:"strict",suppressErrorRendering:!0,flowchart:{wrappingWidth:300,useMaxWidth:!1}}),EW=v);try{const L=`mermaid-${++zze}`,{svg:z}=await j.render(L,e.trim());O||r(z)}catch(L){O||o(L instanceof Error?L.message:"Mermaid render failed")}})},150);return()=>{O=!0,clearTimeout(B)}},[e,v]);const E=()=>{navigator.clipboard.writeText(e).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)},()=>{})};return i?a.jsxs("div",{className:nr.codeBlock,children:[a.jsx("div",{className:nr.codeBlockHeader,children:a.jsx("span",{className:nr.codeBlockLang,children:t("mermaid.errorLabel")})}),a.jsx("pre",{className:`${nr.codeBlockContent} ${nr.codeBlockPlain}`,children:a.jsx("code",{children:e})})]}):a.jsxs("div",{className:nr.codeBlock,children:[a.jsxs("div",{className:nr.codeBlockHeader,children:[a.jsx("span",{className:nr.codeBlockLang,children:t("mermaid.label")}),a.jsxs("span",{className:nr.mermaidActions,children:[l==="diagram"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:nr.codeBlockCopy,onClick:S,title:t("mermaid.zoomOut"),disabled:f<=x,children:t("mermaid.zoomOut")}),a.jsx("button",{className:nr.codeBlockCopy,onClick:C,title:t("mermaid.zoomReset"),disabled:f===1&&p.x===0&&p.y===0,children:t("mermaid.zoomReset")}),a.jsx("button",{className:nr.codeBlockCopy,onClick:T,title:t("mermaid.zoomIn"),disabled:f>=k,children:t("mermaid.zoomIn")})]}),a.jsx("button",{className:nr.codeBlockCopy,onClick:()=>c(l==="diagram"?"code":"diagram"),children:t(l==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),a.jsx("button",{className:nr.codeBlockCopy,onClick:E,children:t(u?"code.copied":"code.copy")})]})]}),l==="code"?a.jsx("pre",{className:`${nr.codeBlockContent} ${nr.codeBlockPlain}`,children:a.jsx("code",{children:e})}):s?a.jsx("div",{className:`${nr.mermaidZoomWrapper} ${b?nr.mermaidDragging:""}`,onMouseDown:N,onDoubleClick:C,children:a.jsx("div",{className:`${nr.mermaidBlock} ${nr.mermaidInline}`,style:{transform:`translate(${p.x}px, ${p.y}px) scale(${f})`,transformOrigin:"top center"},dangerouslySetInnerHTML:{__html:s}})}):a.jsx("div",{className:`${nr.mermaidBlock} ${nr.mermaidLoading} ${nr.mermaidInline}`,children:a.jsx("span",{children:t("mermaid.rendering")})})]})}function qze({className:e,children:t,isStreaming:n}){const{t:s}=nt(),r=im(),[i,o]=h.useState(null),[l,c]=h.useState(!1),{label:u,lang:d,resolvedLang:f}=KL(Ale(e)),m=String(t).replace(/\n$/,""),p=r==="light"?"github-light-default":"github-dark-default";h.useEffect(()=>{if(n||d==="mermaid"||f==="text"||BI(m)){o(null);return}const b=z7e(m,f,p);if(b!==null){o(b);return}const w=kU(m,f,p,!0);if(w!==null){o(w);return}o(null);let y=!1;return Jse(f).then(()=>{if(y)return;const v=kU(m,f,p,!0);v!==null&&o(v)}).catch(v=>{y||(console.warn("[web-shell] highlight failed for lang=%s",f,v),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?a.jsx(Fze,{code:m}):a.jsxs("div",{className:nr.codeBlock,children:[a.jsxs("div",{className:nr.codeBlockHeader,children:[a.jsx("span",{className:nr.codeBlockLang,children:u}),a.jsx("button",{className:nr.codeBlockCopy,onClick:g,children:s(l?"code.copied":"code.copy")})]}),!n&&i!==null?a.jsx("div",{className:nr.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):a.jsx("pre",{className:`${nr.codeBlockContent} ${nr.codeBlockPlain}`,children:a.jsx("code",{children:m})})]})}function Ale(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 Hze({children:e}){return a.jsx("code",{className:nr.inlineCode,children:e})}function AW({children:e}){return a.jsx("div",{className:nr.tableWrapper,children:a.jsx("table",{className:nr.table,children:e})})}const jle=h.createContext(!1),Nle=h.createContext(void 0),Ile=h.createContext(void 0);function Uze(e,t,n){var i,o;if(!n||e===void 0)return!1;const s=(i=t==null?void 0:t.position)==null?void 0:i.start.offset,r=(o=t==null?void 0:t.position)==null?void 0:o.end.offset;return s===void 0||r===void 0?!1:!Ote(e.slice(s,r))&&e.slice(r).trim().length===0}function Wze({className:e,children:t,node:n}){const s=h.useContext(jle),r=h.useContext(Ile);return(e==null?void 0:e.startsWith("language-"))||typeof t=="string"&&t.includes(`
`)?a.jsx(Vze,{className:e,isStreaming:s,isIncomplete:Uze(r,n,s),children:t}):a.jsx(Hze,{children:t})}function Vze({className:e,children:t,isStreaming:n,isIncomplete:s}){var p;const r=h.useContext(Nle),i=im(),{markdown:o}=Vu(),l=String(t),c=l.replace(/\n$/,""),u=a.jsx(qze,{className:e,isStreaming:n,children:l}),d=Ale(e),{resolvedLang:f}=KL(d);if(!!r&&!!e&&!!d)try{const g=(p=o==null?void 0:o.renderCodeBlock)==null?void 0:p.call(o,{language:d,resolvedLanguage:f,className:e,code:c,isStreaming:!!n,isIncomplete:!!s,source:r,theme:i});if(g!=null&&typeof g!="boolean")return a.jsx(Wf,{fallback:u,label:`custom code block component render (lang=${d})`,resetKeys:[d,r,i,n?"streaming":"settled",s?"incomplete":"complete",c],children:g})}catch(g){console.error("[web-shell] custom code block renderer call failed (lang=%s):",d,g)}return u}function Gze({children:e}){return a.jsx(a.Fragment,{children:e})}const iM=/^qwen-session:\/\//i;function Kze(e){return iM.test(e.trim())?e:Ite(e)}function Yze({href:e,children:t}){const n=bD();if(e&&iM.test(e.trim())){if(n==="readonly")return a.jsx("span",{className:nr.link,children:t});const r=e.trim().replace(iM,"");return a.jsx("a",{href:"#",role:"button",className:nr.link,onClick:i=>{i.preventDefault(),i.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:r}))},children:t})}const s=Ele(e)?e:void 0;return a.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:nr.link,children:t})}function Xze({src:e,alt:t}){const n=Rv(e)?e:void 0;return a.jsx("img",{src:n,alt:t||"",className:nr.image})}function Mle(e="basic",t=""){return{code:Wze,pre:Gze,a:Yze,img:Xze,table({children:n}){if(e==="advanced"){const s=a.jsx(AW,{children:n});return a.jsx(Wf,{fallback:s,label:"enhanced markdown table",resetKeys:[t],children:a.jsx(sBe,{fallback:s,children:n})})}return a.jsx(AW,{children:n})}}}const Qze=Mle(),Jf=h.memo(function({content:t,source:n,isStreaming:s,tableMode:r}){const{markdown:i,markdownTableMode:o}=Vu(),l=im(),c=n?i:void 0,u=t&&n&&(c!=null&&c.transformMarkdown)?c.transformMarkdown(t,{source:n}):t,d=s?"basic":r??o??"basic",f=h.useMemo(()=>d==="advanced"?Mle("advanced",u):Qze,[d,u]),m=c==null?void 0:c.components,p=h.useMemo(()=>m?{...f,...m,...d==="advanced"?{table:f.table}:{}}:f,[f,d,m]),g=n==="assistant"&&!(m!=null&&m.code)&&!(m!=null&&m.pre)?(c==null?void 0:c.chart)??(c!=null&&c.renderCodeBlock?void 0:mze):void 0,b=h.useMemo(()=>g?pze(g.registry,{chartClassName:g.chartClassName,chartStyle:{minHeight:360,...g.chartStyle}}):void 0,[g]),w=h.useMemo(()=>b?{...p,pre:b}:p,[b,p]);if(!t)return null;const y=c!=null&&c.remarkPlugins?[lH,KH,...c.remarkPlugins]:[lH,KH],v=c!=null&&c.rehypePlugins?[sU,...c.rehypePlugins]:[sU],x=a.jsx(I3e,{remarkPlugins:y,rehypePlugins:v,components:w,urlTransform:Kze,children:u}),k=g?a.jsx(gze,{customization:g,source:u,streaming:!!s,theme:l,children:x}):x;return a.jsx("div",{className:n!=="thinking"?nr.content:void 0,"data-markdown-source":n,children:a.jsx(jle.Provider,{value:!!s,children:a.jsx(Nle.Provider,{value:n,children:a.jsx(Ile.Provider,{value:u,children:k})})})})});let oM=[],Rle=[];(()=>{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?Rle:oM).push(n=n+e[t])})();function Jze(e){if(e<768)return!1;for(let t=0,n=oM.length;;){let s=t+n>>1;if(e<oM[s])n=s;else if(e>=Rle[s])t=s+1;else return!0;if(t==n)return!1}}function jW(e){return e>=127462&&e<=127487}const NW=8205;function Zze(e,t,n=!0,s=!0){return(n?Dle:eFe)(e,t,s)}function Dle(e,t,n){if(t==e.length)return t;t&&Lle(e.charCodeAt(t))&&Ple(e.charCodeAt(t-1))&&t--;let s=lj(e,t);for(t+=IW(s);t<e.length;){let r=lj(e,t);if(s==NW||r==NW||n&&Jze(r))t+=IW(r),s=r;else if(jW(r)){let i=0,o=t-2;for(;o>=0&&jW(lj(e,o));)i++,o-=2;if(i%2==0)break;t+=2}else break}return t}function eFe(e,t,n){for(;t>0;){let s=Dle(e,t-2,n);if(s<t)return s;t--}return 0}function lj(e,t){let n=e.charCodeAt(t);if(!Ple(n)||t+1==e.length)return n;let s=e.charCodeAt(t+1);return Lle(s)?(n-55296<<10)+(s-56320)+65536:n}function Lle(e){return e>=56320&&e<57344}function Ple(e){return e>=55296&&e<56320}function IW(e){return e<65536?1:2}class Ir{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]=zy(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),ih.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]=zy(this,t,n);let s=[];return this.decompose(t,n,s,0),ih.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 Xx(this),i=new Xx(t);for(let o=n,l=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(l+=r.value.length,r.done||l>=s)return!0}}iter(t=1){return new Xx(this,t)}iterRange(t,n=this.length){return new Ole(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 $le(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]?Ir.empty:t.length<=32?new No(t):ih.from(No.split(t,[]))}}class No extends Ir{constructor(t,n=tFe(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],l=r+o.length;if((n?s:l)>=t)return new nFe(r,l,s,o);r=l+1,s++}}decompose(t,n,s,r){let i=t<=0&&n>=this.length?this:new No(MW(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(r&1){let o=s.pop(),l=b4(i.text,o.text.slice(),0,i.length);if(l.length<=32)s.push(new No(l,o.length+i.length));else{let c=l.length>>1;s.push(new No(l.slice(0,c)),new No(l.slice(c)))}}else s.push(i)}replace(t,n,s){if(!(s instanceof No))return super.replace(t,n,s);[t,n]=zy(this,t,n);let r=b4(this.text,b4(s.text,MW(this.text,0,t)),n),i=this.length+s.length-(n-t);return r.length<=32?new No(r,i):ih.from(No.split(r,[]),i)}sliceString(t,n=this.length,s=`
`){[t,n]=zy(this,t,n);let r="";for(let i=0,o=0;i<=n&&o<this.text.length;o++){let l=this.text[o],c=i+l.length;i>t&&o&&(r+=s),t<c&&n>i&&(r+=l.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 No(s,r)),s=[],r=-1);return r>-1&&n.push(new No(s,r)),n}}class ih extends Ir{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],l=r+o.length,c=s+o.lines-1;if((n?c:l)>=t)return o.lineInner(t,n,s,r);r=l+1,s=c+1}}decompose(t,n,s,r){for(let i=0,o=0;o<=n&&i<this.children.length;i++){let l=this.children[i],c=o+l.length;if(t<=c&&n>=o){let u=r&((o<=t?1:0)|(c>=n?2:0));o>=t&&c<=n&&!u?s.push(l):l.decompose(t-o,n-o,s,u)}o=c+1}}replace(t,n,s){if([t,n]=zy(this,t,n),s.lines<this.lines)for(let r=0,i=0;r<this.children.length;r++){let o=this.children[r],l=i+o.length;if(t>=i&&n<=l){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 ih(d,this.length-(n-t)+s.length)}return super.replace(i,l,c)}i=l+1}return super.replace(t,n,s)}sliceString(t,n=this.length,s=`
`){[t,n]=zy(this,t,n);let r="";for(let i=0,o=0;i<this.children.length&&o<=n;i++){let l=this.children[i],c=o+l.length;o>t&&i&&(r+=s),t<c&&n>o&&(r+=l.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 ih))return 0;let s=0,[r,i,o,l]=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==l)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 No(p,n)}let r=Math.max(32,s>>5),i=r<<1,o=r>>1,l=[],c=0,u=-1,d=[];function f(p){let g;if(p.lines>i&&p instanceof ih)for(let b of p.children)f(b);else p.lines>o&&(c>o||!c)?(m(),l.push(p)):p instanceof No&&c&&(g=d[d.length-1])instanceof No&&p.lines+g.lines<=32?(c+=p.lines,u+=p.length+1,d[d.length-1]=new No(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&&(l.push(d.length==1?d[0]:ih.from(d,u)),u=-1,c=d.length=0)}for(let p of t)f(p);return m(),l.length==1?l[0]:new ih(l,n)}}Ir.empty=new No([""],0);function tFe(e){let t=-1;for(let n of e)t+=n.length+1;return t}function b4(e,t,n=0,s=1e9){for(let r=0,i=0,o=!0;i<e.length&&r<=s;i++){let l=e[i],c=r+l.length;c>=n&&(c>s&&(l=l.slice(0,s-r)),r<n&&(l=l.slice(n-r)),o?(t[t.length-1]+=l,o=!1):t.push(l)),r=c+1}return t}function MW(e,t,n){return b4(e,[""],t,n)}class Xx{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 No?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,l=r instanceof No?r.text.length:r.children.length;if(o==(n>0?l: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 No){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 No?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 Ole{constructor(t,n,s){this.value="",this.done=!1,this.cursor=new Xx(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 $le{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"&&(Ir.prototype[Symbol.iterator]=function(){return this.iter()},Xx.prototype[Symbol.iterator]=Ole.prototype[Symbol.iterator]=$le.prototype[Symbol.iterator]=function(){return this});class nFe{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 zy(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function Oa(e,t,n=!0,s=!0){return Zze(e,t,n,s)}function sFe(e){return e>=56320&&e<57344}function rFe(e){return e>=55296&&e<56320}function cc(e,t){let n=e.charCodeAt(t);if(!rFe(n)||t+1==e.length)return n;let s=e.charCodeAt(t+1);return sFe(s)?(n-55296<<10)+(s-56320)+65536:n}function YL(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function oh(e){return e<65536?1:2}const aM=/\r\n?|\n/;var Fl=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Fl||(Fl={}));class wh{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){lM(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 wh(t)}composeDesc(t){return this.empty?t:t.empty?this:Ble(this,t)}mapDesc(t,n=!1){return t.empty?this:cM(this,t,n)}mapPos(t,n=-1,s=Fl.Simple){let r=0,i=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],c=this.sections[o++],u=r+l;if(c<0){if(u>t)return i+(t-r);i+=l}else{if(s!=Fl.Simple&&u>=t&&(s==Fl.TrackDel&&r<t&&u>t||s==Fl.TrackBefore&&r<t||s==Fl.TrackAfter&&u>t))return null;if(u>t||u==t&&n<0&&!l)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++],l=r+i;if(o>=0&&r<=n&&l>=t)return r<t&&l>n?"cover":!0;r=l}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 wh(t)}static create(t){return new wh(t)}}class ua extends wh{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 lM(this,(n,s,r,i,o)=>t=t.replace(r,r+(s-n),o),!1),t}mapDesc(t,n=!1){return cM(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],l=n[r+1];if(l>=0){n[r]=l,n[r+1]=o;let c=r>>1;for(;s.length<c;)s.push(Ir.empty);s.push(o?t.slice(i,i+o):Ir.empty)}i+=o}return new ua(n,s)}compose(t){return this.empty?t:t.empty?this:Ble(this,t,!0)}map(t,n=!1){return t.empty?this:cM(this,t,n,!0)}iterChanges(t,n=!1){lM(this,t,n)}get desc(){return wh.create(this.sections)}filter(t){let n=[],s=[],r=[],i=new Fk(this);e:for(let o=0,l=0;;){let c=o==t.length?1e9:t[o++];for(;l<c||l==c&&i.len==0;){if(i.done)break e;let d=Math.min(i.len,c-l);pl(r,d,-1);let f=i.ins==-1?-1:i.off==0?i.ins:0;pl(n,d,f),f>0&&ap(s,n,i.text),i.forward(d),l+=d}let u=t[o++];for(;l<u;){if(i.done)break e;let d=Math.min(i.len,u-l);pl(n,d,-1),pl(r,d,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(d),l+=d}}return{changes:new ua(n,s),filtered:wh.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,l=null;function c(d=!1){if(!d&&!r.length)return;o<n&&pl(r,n-o,-1);let f=new ua(r,i);l=l?l.compose(f.map(l)):f,r=[],i=[],o=0}function u(d){if(Array.isArray(d))for(let f of d)u(f);else if(d instanceof ua){if(d.length!=n)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${n})`);c(),l=l?l.compose(d.map(l)):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"?Ir.of(p.split(s||aM)):p:Ir.empty,b=g.length;if(f==m&&b==0)return;f<o&&c(),f>o&&pl(r,f-o,-1),pl(r,m-f,b),ap(i,r,g),o=m}}return u(t),c(!l),l}static empty(t){return new ua(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,l)=>l&&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(Ir.empty);s[r]=Ir.of(i.slice(1)),n.push(i[0],s[r].length)}}}return new ua(n,s)}static createSet(t,n){return new ua(t,n)}}function pl(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 ap(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(Ir.empty);e.push(n)}}function lM(e,t,n){let s=e.inserted;for(let r=0,i=0,o=0;o<e.sections.length;){let l=e.sections[o++],c=e.sections[o++];if(c<0)r+=l,i+=l;else{let u=r,d=i,f=Ir.empty;for(;u+=l,d+=c,c&&s&&(f=f.append(s[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)l=e.sections[o++],c=e.sections[o++];t(r,u,i,d,f),r=u,i=d}}}function cM(e,t,n,s=!1){let r=[],i=s?[]:null,o=new Fk(e),l=new Fk(t);for(let c=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let u=Math.min(o.len,l.len);pl(r,u,-1),o.forward(u),l.forward(u)}else if(l.ins>=0&&(o.ins<0||c==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!n))){let u=l.len;for(pl(r,l.ins,-1);u;){let d=Math.min(o.len,u);o.ins>=0&&c<o.i&&o.len<=d&&(pl(r,0,o.ins),i&&ap(i,r,o.text),c=o.i),o.forward(d),u-=d}l.next()}else if(o.ins>=0){let u=0,d=o.len;for(;d;)if(l.ins==-1){let f=Math.min(d,l.len);u+=f,d-=f,l.forward(f)}else if(l.ins==0&&l.len<d)d-=l.len,l.next();else break;pl(r,u,c<o.i?o.ins:0),i&&c<o.i&&ap(i,r,o.text),c=o.i,o.forward(o.len-d)}else{if(o.done&&l.done)return i?ua.createSet(r,i):wh.create(r);throw new Error("Mismatched change set lengths")}}}function Ble(e,t,n=!1){let s=[],r=n?[]:null,i=new Fk(e),o=new Fk(t);for(let l=!1;;){if(i.done&&o.done)return r?ua.createSet(s,r):wh.create(s);if(i.ins==0)pl(s,i.len,0,l),i.next();else if(o.len==0&&!o.done)pl(s,0,o.ins,l),r&&ap(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;pl(s,c,d,l),r&&d&&ap(r,s,o.text)}else o.ins==-1?(pl(s,i.off?0:i.len,c,l),r&&ap(r,s,i.textBit(c))):(pl(s,i.off?0:i.len,o.off?0:o.ins,l),r&&!o.off&&ap(r,s,o.text));l=(i.ins>c||o.ins>=0&&o.len>c)&&(l||s.length>u),i.forward2(c),o.forward(c)}}}}class Fk{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?Ir.empty:t[n]}textBit(t){let{inserted:n}=this.set,s=this.i-2>>1;return s>=n.length&&!t?Ir.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 _g{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 _g(s,r,this.flags)}extend(t,n=t,s=0){if(t<=this.anchor&&n>=this.anchor)return ht.range(t,n,void 0,void 0,s);let r=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return ht.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 ht.range(t.anchor,t.head)}static create(t,n,s){return new _g(t,n,s)}}class ht{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:ht.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 ht([this.main],0)}addRange(t,n=!0){return ht.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let s=this.ranges.slice();return s[n]=t,ht.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 ht(t.ranges.map(n=>_g.fromJSON(n)),t.main)}static single(t,n=t){return new ht([ht.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 ht.normalized(t.slice(),n);s=i.to}return new ht(t,n)}static cursor(t,n=0,s,r){return _g.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?_g.create(n,t,48|o):_g.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 l=o.from,c=Math.max(i.to,o.to);r<=n&&n--,t.splice(--r,2,i.anchor>i.head?ht.range(c,l):ht.range(l,c))}}return new ht(t,n)}}function zle(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let XL=0;class jn{constructor(t,n,s,r,i){this.combine=t,this.compareInput=n,this.compare=s,this.isStatic=r,this.id=XL++,this.default=t([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(t={}){return new jn(t.combine||(n=>n),t.compareInput||((n,s)=>n===s),t.compare||(t.combine?(n,s)=>n===s:QL),!!t.static,t.enables)}of(t){return new y4([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new y4(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new y4(t,this,2,n)}from(t,n){return n||(n=s=>s),this.compute([t],s=>n(s.field(t)))}}function QL(e,t){return e==t||e.length==t.length&&e.every((n,s)=>n===t[s])}class y4{constructor(t,n,s,r){this.dependencies=t,this.facet=n,this.type=s,this.value=r,this.id=XL++}dynamicSlot(t){var n;let s=this.value,r=this.facet.compareInput,i=this.id,o=t[i]>>1,l=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)||uM(f,d)){let p=s(f);if(l?!RW(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=r3(m,g);if(this.dependencies.every(w=>w instanceof jn?m.facet(w)===f.facet(w):w instanceof ll?m.field(w,!1)==f.field(w,!1):!0)||(l?RW(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 RW(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 uM(e,t){let n=!1;for(let s of t)Qx(e,s)&1&&(n=!0);return n}function iFe(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 l(c){let u=[];for(let d=0;d<s.length;d++){let f=r3(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)Qx(c,u);return c.values[o]=l(c),1},update(c,u){if(!uM(c,i))return 0;let d=l(c);return t.compare(d,c.values[o])?0:(c.values[o]=d,1)},reconfigure(c,u){let d=uM(c,s),f=u.config.facets[t.id],m=u.facet(t);if(f&&!d&&QL(n,f))return c.values[o]=m,0;let p=l(c);return t.compare(p,m)?(c.values[o]=m,0):(c.values[o]=p,1)}}}const K2=jn.define({static:!0});class ll{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 ll(XL++,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(K2).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(K2),o=r.facet(K2),l;return(l=i.find(c=>c.field==this))&&l!=o.find(c=>c.field==this)?(s.values[n]=l.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,K2.of({field:this,create:t})]}get extension(){return this}}const mg={lowest:4,low:3,default:2,high:1,highest:0};function zw(e){return t=>new Fle(t,e)}const w0={highest:zw(mg.highest),high:zw(mg.high),default:zw(mg.default),low:zw(mg.low),lowest:zw(mg.lowest)};class Fle{constructor(t,n){this.inner=t,this.prec=n}}class w1{of(t){return new dM(this,t)}reconfigure(t){return w1.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class dM{constructor(t,n){this.compartment=t,this.inner=n}}class s3{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 oFe(t,n,o))m instanceof ll?r.push(m):(i[m.facet.id]||(i[m.facet.id]=[])).push(m);let l=Object.create(null),c=[],u=[];for(let m of r)l[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(w=>w.type==0))if(l[g.id]=c.length<<1|1,QL(b,p))c.push(s.facet(g));else{let w=g.combine(p.map(y=>y.value));c.push(s&&g.compare(w,s.facet(g))?s.facet(g):w)}else{for(let w of p)w.type==0?(l[w.id]=c.length<<1|1,c.push(w.value)):(l[w.id]=u.length<<1,u.push(y=>w.dynamicSlot(y)));l[g.id]=u.length<<1,u.push(w=>iFe(w,g,p))}}let f=u.map(m=>m(l));return new s3(t,o,f,l,c,i)}}function oFe(e,t,n){let s=[[],[],[],[],[]],r=new Map;function i(o,l){let c=r.get(o);if(c!=null){if(c<=l)return;let u=s[c].indexOf(o);u>-1&&s[c].splice(u,1),o instanceof dM&&n.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let u of o)i(u,l);else if(o instanceof dM){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,l)}else if(o instanceof Fle)i(o.inner,o.prec);else if(o instanceof ll)s[l].push(o),o.provides&&i(o.provides,l);else if(o instanceof y4)s[l].push(o),o.facet.extensions&&i(o.facet.extensions,mg.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,l)}}return i(e,mg.default),s.reduce((o,l)=>o.concat(l))}function Qx(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 r3(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const qle=jn.define(),hM=jn.define({combine:e=>e.some(t=>t),static:!0}),Hle=jn.define({combine:e=>e.length?e[0]:void 0,static:!0}),Ule=jn.define(),Wle=jn.define(),Vle=jn.define(),Gle=jn.define({combine:e=>e.length?e[0]:!1});class hm{constructor(t,n){this.type=t,this.value=n}static define(){return new aFe}}class aFe{of(t){return new hm(this,t)}}class lFe{constructor(t){this.map=t}of(t){return new Ts(this,t)}}class Ts{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 Ts(this.type,n)}is(t){return this.type==t}static define(t={}){return new lFe(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}}Ts.reconfigure=Ts.define();Ts.appendConfig=Ts.define();class ha{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&&zle(s,n.newLength),i.some(l=>l.type==ha.time)||(this.annotations=i.concat(ha.time.of(Date.now())))}static create(t,n,s,r,i,o){return new ha(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(ha.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}ha.time=hm.define();ha.userEvent=hm.define();ha.addToHistory=hm.define();ha.remote=hm.define();function cFe(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 Kle(e,t,n){var s;let r,i,o;return n?(r=t.changes,i=ua.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:Ts.mapEffects(e.effects,r).concat(Ts.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function fM(e,t,n){let s=t.selection,r=uy(t.annotations);return t.userEvent&&(r=r.concat(ha.userEvent.of(t.userEvent))),{changes:t.changes instanceof ua?t.changes:ua.of(t.changes||[],n,e.facet(Hle)),selection:s&&(s instanceof ht?s:ht.single(s.anchor,s.head)),effects:uy(t.effects),annotations:r,scrollIntoView:!!t.scrollIntoView}}function Yle(e,t,n){let s=fM(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=Kle(s,fM(e,t[i],o?s.changes.newLength:e.doc.length),o)}let r=ha.create(e,s.changes,s.selection,s.effects,s.annotations,s.scrollIntoView);return dFe(n?uFe(r):r)}function uFe(e){let t=e.startState,n=!0;for(let r of t.facet(Ule)){let i=r(e);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:cFe(n,i))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=ua.empty(t.doc.length);else{let o=e.changes.filter(n);r=o.changes,i=o.filtered.mapDesc(o.changes).invertedDesc}e=ha.create(t,r,e.selection&&e.selection.map(i),Ts.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let s=t.facet(Wle);for(let r=s.length-1;r>=0;r--){let i=s[r](e);i instanceof ha?e=i:Array.isArray(i)&&i.length==1&&i[0]instanceof ha?e=i[0]:e=Yle(t,uy(i),!1)}return e}function dFe(e){let t=e.startState,n=t.facet(Vle),s=e;for(let r=n.length-1;r>=0;r--){let i=n[r](e);i&&Object.keys(i).length&&(s=Kle(s,fM(t,i,e.changes.newLength),!0))}return s==e?e:ha.create(t,e.changes,e.selection,s.effects,s.annotations,s.scrollIntoView)}const hFe=[];function uy(e){return e==null?hFe:Array.isArray(e)?e:[e]}var Hi=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Hi||(Hi={}));const fFe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let mM;try{mM=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function mFe(e){if(mM)return mM.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||fFe.test(n)))return!0}return!1}function pFe(e){return t=>{if(!/\S/.test(t))return Hi.Space;if(mFe(t))return Hi.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return Hi.Word;return Hi.Other}}class wr{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 l=0;l<this.config.dynamicSlots.length;l++)Qx(this,l<<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 Qx(this,s),r3(this,s)}update(...t){return Yle(this,t,!0)}applyTransaction(t){let n=this.config,{base:s,compartments:r}=n;for(let l of t.effects)l.is(w1.reconfigure)?(n&&(r=new Map,n.compartments.forEach((c,u)=>r.set(u,c)),n=null),r.set(l.value.compartment,l.value.extension)):l.is(Ts.reconfigure)?(n=null,s=l.value):l.is(Ts.appendConfig)&&(n=null,s=uy(s).concat(l.value));let i;n?i=t.startState.values.slice():(n=s3.resolve(s,r,this),i=new wr(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,u)=>u.reconfigure(c,this),null).values);let o=t.startState.facet(hM)?t.newSelection:t.newSelection.asSingle();new wr(n,t.newDoc,o,i,(l,c)=>c.update(l,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:ht.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=uy(s.effects);for(let l=1;l<n.ranges.length;l++){let c=t(n.ranges[l]),u=this.changes(c.changes),d=u.map(r);for(let m=0;m<l;m++)i[m]=i[m].map(d);let f=r.mapDesc(u,!0);i.push(c.range.map(f)),r=r.compose(d),o=Ts.mapEffects(o,d).concat(Ts.mapEffects(uy(c.effects),f))}return{changes:r,selection:ht.create(i,n.mainIndex),effects:o}}changes(t=[]){return t instanceof ua?t:ua.of(t,this.doc.length,this.facet(wr.lineSeparator))}toText(t){return Ir.of(t.split(this.facet(wr.lineSeparator)||aM))}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:(Qx(this,n),r3(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 ll&&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],l=t[i];r.push(o.init(c=>o.spec.fromJSON(l,c)))}}return wr.create({doc:t.doc,selection:ht.fromJSON(t.selection),extensions:n.extensions?r.concat([n.extensions]):r})}static create(t={}){let n=s3.resolve(t.extensions||[],new Map),s=t.doc instanceof Ir?t.doc:Ir.of((t.doc||"").split(n.staticFacet(wr.lineSeparator)||aM)),r=t.selection?t.selection instanceof ht?t.selection:ht.single(t.selection.anchor,t.selection.head):ht.single(0);return zle(r,s.length),n.staticFacet(hM)||(r=r.asSingle()),new wr(n,s,r,n.dynamicSlots.map(()=>null),(i,o)=>o.create(i),null)}get tabSize(){return this.facet(wr.tabSize)}get lineBreak(){return this.facet(wr.lineSeparator)||`
`}get readOnly(){return this.facet(Gle)}phrase(t,...n){for(let s of this.facet(wr.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(qle))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 pFe(n.length?n[0]:"")}wordAt(t){let{text:n,from:s,length:r}=this.doc.lineAt(t),i=this.charCategorizer(t),o=t-s,l=t-s;for(;o>0;){let c=Oa(n,o,!1);if(i(n.slice(c,o))!=Hi.Word)break;o=c}for(;l<r;){let c=Oa(n,l);if(i(n.slice(l,c))!=Hi.Word)break;l=c}return o==l?null:ht.range(o+s,l+s)}}wr.allowMultipleSelections=hM;wr.tabSize=jn.define({combine:e=>e.length?e[0]:4});wr.lineSeparator=Hle;wr.readOnly=Gle;wr.phrases=jn.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])}});wr.languageData=qle;wr.changeFilter=Ule;wr.transactionFilter=Wle;wr.transactionExtender=Vle;w1.reconfigure=Ts.define();function Lh(e,t,n={}){let s={};for(let r of e)for(let i of Object.keys(r)){let o=r[i],l=s[i];if(l===void 0)s[i]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(n,i))s[i]=n[i](l,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 Kp{eq(t){return this==t}range(t,n=t){return pM.create(t,n,this)}}Kp.prototype.startSide=Kp.prototype.endSide=0;Kp.prototype.point=!1;Kp.prototype.mapMode=Fl.TrackDel;function JL(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}let pM=class Xle{constructor(t,n,s){this.from=t,this.to=n,this.value=s}static create(t,n,s){return new Xle(t,n,s)}};function gM(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class ZL{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,l=i.length;;){if(o==l)return o;let c=o+l>>1,u=i[c]-t||(s?this.value[c].endSide:this.value[c].startSide)-n;if(c==o)return u>=0?o:l;u>=0?l=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,l=-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&&(l=Math.max(l,p-m)),s.push(u),r.push(m-o),i.push(p-o))}return{mapped:s.length?new ZL(r,i,s,l):null,pos:o}}}class ur{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 ur(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(gM)),this.isEmpty)return n.length?ur.of(n):this;let l=new Qle(this,null,-1).goto(0),c=0,u=[],d=new Ch;for(;l.value||c<n.length;)if(c<n.length&&(l.from-n[c].from||l.startSide-n[c].value.startSide)>=0){let f=n[c++];d.addInner(f.from,f.to,f.value)||u.push(f)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(c==n.length||this.chunkEnd(l.chunkIndex)<n[c].from)&&(!o||r>this.chunkEnd(l.chunkIndex)||i<this.chunkPos[l.chunkIndex])&&d.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||r>l.to||i<l.from||o(l.from,l.to,l.value))&&(d.addInner(l.from,l.to,l.value)||u.push(pM.create(l.from,l.to,l.value))),l.next());return d.finishInner(this.nextLayer.isEmpty&&!u.length?ur.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 l=this.chunkPos[o],c=this.chunk[o],u=t.touchesRange(l,l+c.length);if(u===!1)r=Math.max(r,c.maxPoint),n.push(c),s.push(t.mapPos(l));else if(u===!0){let{mapped:d,pos:f}=c.map(l,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 ur(s,n,i||ur.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 qk.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return qk.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),l=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=i),c=DW(o,l,s),u=new Fw(o,c,i),d=new Fw(l,c,i);s.iterGaps((f,m,p)=>LW(u,f,d,m,p,r)),s.empty&&s.length==0&&LW(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 l=DW(i,o),c=new Fw(i,l,0).goto(s),u=new Fw(o,l,0).goto(s);for(;;){if(c.to!=u.to||!bM(c.active,u.active)||c.point&&(!u.point||!JL(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 Fw(t,null,i).goto(n),l=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(l,u,o.point,d,f,o.pointRank),c=Math.min(o.openEnd(u),d.length)}else u>l&&(r.span(l,u,o.active,c),c=o.openEnd(u));if(o.to>s)return c+(o.point&&o.to>s?1:0);l=o.to,o.next()}}static of(t,n=!1){let s=new Ch;for(let r of t instanceof pM?[t]:n?gFe(t):t)s.add(r.from,r.to,r.value);return s.finish()}static join(t){if(!t.length)return ur.empty;let n=t[t.length-1];for(let s=t.length-2;s>=0;s--)for(let r=t[s];r!=ur.empty;r=r.nextLayer)n=new ur(r.chunkPos,r.chunk,n,Math.max(r.maxPoint,n.maxPoint));return n}}ur.empty=new ur([],[],null,-1);function gFe(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let s=e[n];if(gM(t,s)>0)return e.slice().sort(gM);t=s}return e}ur.empty.nextLayer=ur.empty;class Ch{finishChunk(t){this.chunks.push(new ZL(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 Ch)).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(ur.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=ur.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function DW(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 l=s.get(i.chunk[o]);l!=null&&(n?n.mapPos(l):l)==i.chunkPos[o]&&!(n!=null&&n.touchesRange(l,l+i.chunk[o].length))&&r.add(i.chunk[o])}return r}class Qle{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 qk{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 Qle(o,n,s,i));return r.length==1?r[0]:new qk(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--)cj(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--)cj(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(),cj(this.heap,0)}}}function cj(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 Fw{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=qk.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){Y2(this.active,t),Y2(this.activeTo,t),Y2(this.activeRank,t),this.minActive=PW(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++;X2(this.active,n,s),X2(this.activeTo,n,r),X2(this.activeRank,n,i),t&&X2(t,n,this.cursor.from),this.minActive=PW(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&&Y2(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 LW(e,t,n,s,r,i){e.goto(t),n.goto(s);let o=s+r,l=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&&JL(e.point,n.point)&&bM(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(l,g,e.point,n.point),d=!1):(d&&i.boundChange(l),g>l&&!bM(e.active,n.active)&&i.compareRange(l,g,e.active,n.active),u&&g<o&&(f||e.openEnd(p)!=n.openEnd(p))&&(d=!0)),p>o)break;l=p,m<=0&&e.next(),m>=0&&n.next()}}function bM(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!JL(e[n],t[n]))return!1;return!0}function Y2(e,t){for(let n=t,s=e.length-1;n<s;n++)e[n]=e[n+1];e.pop()}function X2(e,t,n){for(let s=e.length-1;s>=t;s--)e[s+1]=e[s];e[t]=n}function PW(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 Dv(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=Oa(e,r));return s}function yM(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=Oa(e,r)}return s===!0?-1:e.length}const vM="ͼ",OW=typeof Symbol>"u"?"__"+vM:Symbol.for(vM),wM=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),$W=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Yp{constructor(t,n){this.rules=[];let{finish:s}=n||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function i(o,l,c,u){let d=[],f=/^@(\w+)\b/.exec(o[0]),m=f&&f[1]=="keyframes";if(f&&l==null)return c.push(o[0]+";");for(let p in l){let g=l[p];if(/&/.test(p))i(p.split(/,\s*/).map(b=>o.map(w=>b.replace(/&/,w))).reduce((b,w)=>b.concat(w)),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=$W[OW]||1;return $W[OW]=t+1,vM+t.toString(36)}static mount(t,n,s){let r=t[wM],i=s&&s.nonce;r?i&&r.setNonce(i):r=new bFe(t,i),r.mount(Array.isArray(n)?n:[n],t)}}let BW=new Map;class bFe{constructor(t,n){let s=t.ownerDocument||t,r=s.defaultView;if(!t.head&&t.adoptedStyleSheets&&r.CSSStyleSheet){let i=BW.get(s);if(i)return t[wM]=i;this.sheet=new r.CSSStyleSheet,BW.set(s,this)}else this.styleTag=s.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[wM]=this}mount(t,n){let s=this.sheet,r=0,i=0;for(let o=0;o<t.length;o++){let l=t[o],c=this.modules.indexOf(l);if(c<i&&c>-1&&(this.modules.splice(c,1),i--,c=-1),c==-1){if(this.modules.splice(i++,0,l),s)for(let u=0;u<l.rules.length;u++)s.insertRule(l.rules[u],r++)}else{for(;i<c;)r+=this.modules[i++].rules.length;r+=l.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 l=n.head||n;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}var Xp={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:"'"},Hk={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},yFe=typeof navigator<"u"&&/Mac/.test(navigator.platform),vFe=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var tl=0;tl<10;tl++)Xp[48+tl]=Xp[96+tl]=String(tl);for(var tl=1;tl<=24;tl++)Xp[tl+111]="F"+tl;for(var tl=65;tl<=90;tl++)Xp[tl]=String.fromCharCode(tl+32),Hk[tl]=String.fromCharCode(tl);for(var uj in Xp)Hk.hasOwnProperty(uj)||(Hk[uj]=Xp[uj]);function wFe(e){var t=yFe&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||vFe&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Hk:Xp)[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 ai(){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++)Jle(e,arguments[t]);return e}function Jle(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++)Jle(e,t[n]);else throw new RangeError("Unsupported child node: "+t)}let Pl=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},xM=typeof document<"u"?document:{documentElement:{style:{}}};const kM=/Edge\/(\d+)/.exec(Pl.userAgent),Zle=/MSIE \d/.test(Pl.userAgent),_M=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Pl.userAgent),_6=!!(Zle||_M||kM),zW=!_6&&/gecko\/(\d+)/i.test(Pl.userAgent),dj=!_6&&/Chrome\/(\d+)/.exec(Pl.userAgent),FW="webkitFontSmoothing"in xM.documentElement.style,SM=!_6&&/Apple Computer/.test(Pl.vendor),qW=SM&&(/Mobile\/\w+/.test(Pl.userAgent)||Pl.maxTouchPoints>2);var An={mac:qW||/Mac/.test(Pl.platform),windows:/Win/.test(Pl.platform),linux:/Linux|X11/.test(Pl.platform),ie:_6,ie_version:Zle?xM.documentMode||6:_M?+_M[1]:kM?+kM[1]:0,gecko:zW,gecko_version:zW?+(/Firefox\/(\d+)/.exec(Pl.userAgent)||[0,0])[1]:0,chrome:!!dj,chrome_version:dj?+dj[1]:0,ios:qW,android:/Android\b/.test(Pl.userAgent),webkit:FW,webkit_version:FW?+(/\bAppleWebKit\/(\d+)/.exec(Pl.userAgent)||[0,0])[1]:0,safari:SM,safari_version:SM?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Pl.userAgent)||[0,0])[1]:0,tabSize:xM.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function eP(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 i3=Object.create(null);function tP(e,t,n){if(e==t)return!0;e||(e=i3),t||(t=i3);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 xFe(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 HW(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 kFe(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 iu{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 al=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(al||(al={}));class Hn extends Kp{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 W_(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 Qg(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}=ece(t,n);s=(i?n?-3e8:-1:5e8)-1,r=(o?n?2e8:1:-6e8)+1}return new Qg(t,s,r,n,t.widget||null,!0)}static line(t){return new V_(t)}static set(t,n=!1){return ur.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Hn.none=ur.empty;class W_ extends Hn{constructor(t){let{start:n,end:s}=ece(t);super(n?-1:5e8,s?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?eP(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||i3}eq(t){return this==t||t instanceof W_&&this.tagName==t.tagName&&tP(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)}}W_.prototype.point=!1;class V_ extends Hn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof V_&&this.spec.class==t.spec.class&&tP(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)}}V_.prototype.mapMode=Fl.TrackBefore;V_.prototype.point=!0;class Qg extends Hn{constructor(t,n,s,r,i,o){super(n,s,i,t),this.block=r,this.isReplace=o,this.mapMode=r?n<=0?Fl.TrackBefore:Fl.TrackAfter:Fl.TrackDel}get type(){return this.startSide!=this.endSide?al.WidgetRange:this.startSide<=0?al.WidgetBefore:al.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Qg&&_Fe(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)}}Qg.prototype.point=!0;function ece(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 _Fe(e,t){return e==t||!!(e&&t&&e.compare(t))}function dy(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 Uk extends Kp{constructor(t,n,s){super(),this.tagName=t,this.attributes=n,this.rank=s}eq(t){return t==this||t instanceof Uk&&this.tagName==t.tagName&&tP(this.attributes,t.attributes)}static create(t){return new Uk(t.tagName,t.attributes||i3,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return ur.of(t,n)}}Uk.prototype.startSide=Uk.prototype.endSide=-1;function Wk(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function CM(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function Jx(e,t){if(!t.anchorNode)return!1;try{return CM(e,t.anchorNode)}catch{return!1}}function Zx(e){return e.nodeType==3?Gk(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function ek(e,t,n,s){return n?UW(e,t,n,s,-1)||UW(e,t,n,s,1):!1}function Qp(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function o3(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function UW(e,t,n,s,r){for(;;){if(e==n&&t==s)return!0;if(t==(r<0?0:Zf(e))){if(e.nodeName=="DIV")return!1;let i=e.parentNode;if(!i||i.nodeType!=1)return!1;t=Qp(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?Zf(e):0}else return!1}}function Zf(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Vk(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function SFe(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 tce(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 CFe(e,t,n,s,r,i,o,l){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=SFe(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 v=d.getBoundingClientRect();({scaleX:g,scaleY:b}=tce(d,v)),m={left:v.left,right:v.left+d.clientWidth*g,top:v.top,bottom:v.top+d.clientHeight*b}}let w=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 v=t.bottom-t.top,x=m.bottom-m.top;y=(r=="center"&&v<=x?t.top+v/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?(w=t.left-(m.left+i),n>0&&t.right>m.right+w&&(w=t.right-m.right+i)):t.right>m.right-i&&(w=t.right-m.right+i,n<0&&t.left<m.left+w&&(w=t.left-(m.left+i))):w=(s=="center"?t.left+(t.right-t.left)/2-(m.right-m.left)/2:s=="start"==l?t.left-i:t.right-(m.right-m.left)+i)-m.left,w||y)if(p)u.scrollBy(w,y);else{let v=0,x=0;if(y){let k=d.scrollTop;d.scrollTop+=y/b,x=(d.scrollTop-k)*b}if(w){let k=d.scrollLeft;d.scrollLeft+=w/g,v=(d.scrollLeft-k)*g}t={left:t.left-v,top:t.top-x,right:t.right-v,bottom:t.bottom-x},v&&Math.abs(v-w)<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 nce(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 TFe{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?Zf(n):0),s,Math.min(t.focusOffset,s?Zf(s):0))}set(t,n,s,r){this.anchorNode=t,this.anchorOffset=n,this.focusNode=s,this.focusOffset=r}}let ag=null;An.safari&&An.safari_version>=26&&(ag=!1);function sce(e){if(e.setActive)return e.setActive();if(ag)return e.focus(ag);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(ag==null?{get preventScroll(){return ag={preventScroll:!0},!0}}:void 0),!ag){ag=!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 WW;function Gk(e,t,n=t){let s=WW||(WW=document.createRange());return s.setEnd(e,n),s.setStart(e,t),s}function hy(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 EFe(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function AFe(e,t){let n=t.focusNode,s=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=s)return!1;for(s=Math.min(s,Zf(n));;)if(s){if(n.nodeType!=1)return!1;let r=n.childNodes[s-1];r.contentEditable=="false"?s--:(n=r,s=Zf(n))}else{if(n==e)return!0;s=Qp(n),n=n.parentNode}}function rce(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 ice(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=Zf(n)}else if(n.parentNode&&!o3(n))s=Qp(n),n=n.parentNode;else return null}}function oce(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&&!o3(n))s=Qp(n)+1,n=n.parentNode;else return null}}class hd{constructor(t,n,s=!0){this.node=t,this.offset=n,this.precise=s}static before(t,n){return new hd(t.parentNode,Qp(t),n)}static after(t,n){return new hd(t.parentNode,Qp(t)+1,n)}}var wi=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(wi||(wi={}));const Jg=wi.LTR,nP=wi.RTL;function ace(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const jFe=ace("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),NFe=ace("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),TM=Object.create(null),Fd=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);TM[t]=n,TM[n]=-t}function lce(e){return e<=247?jFe[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?NFe[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const IFe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class fh{get dir(){return this.level%2?nP:Jg}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 l=t[o];if(l.from<=n&&l.to>=n){if(l.level==s)return o;(i<0||(r!=0?r<0?l.from<n:l.to>n:t[i].level>l.level))&&(i=o)}}if(i<0)throw new RangeError("Index out of range");return i}}function cce(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||!cce(s.inner,r.inner))return!1}return!0}const yi=[];function MFe(e,t,n,s,r){for(let i=0;i<=s.length;i++){let o=i?s[i-1].to:t,l=i<s.length?s[i].from:n,c=i?256:r;for(let u=o,d=c,f=c;u<l;u++){let m=lce(e.charCodeAt(u));m==512?m=d:m==8&&f==4&&(m=16),yi[u]=m==4?2:m,m&7&&(f=m),d=m}for(let u=o,d=c,f=c;u<l;u++){let m=yi[u];if(m==128)u<l-1&&d==yi[u+1]&&d&24?m=yi[u]=d:yi[u]=256;else if(m==64){let p=u+1;for(;p<l&&yi[p]==64;)p++;let g=u&&d==8||p<n&&yi[p]==8?f==1?1:8:256;for(let b=u;b<p;b++)yi[b]=g;u=p-1}else m==8&&f==1&&(yi[u]=1);d=m,m&7&&(f=m)}}}function RFe(e,t,n,s,r){let i=r==1?2:1;for(let o=0,l=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=TM[m=e.charCodeAt(f)])if(p<0){for(let b=l-3;b>=0;b-=3)if(Fd[b+1]==-p){let w=Fd[b+2],y=w&2?r:w&4?w&1?i:r:0;y&&(yi[f]=yi[Fd[b]]=y),l=b;break}}else{if(Fd.length==189)break;Fd[l++]=f,Fd[l++]=m,Fd[l++]=c}else if((g=yi[f])==2||g==1){let b=g==r;c=b?0:1;for(let w=l-3;w>=0;w-=3){let y=Fd[w+2];if(y&2)break;if(b)Fd[w+2]|=2;else{if(y&4)break;Fd[w+2]|=4}}}}}function DFe(e,t,n,s){for(let r=0,i=s;r<=n.length;r++){let o=r?n[r-1].to:e,l=r<n.length?n[r].from:t;for(let c=o;c<l;){let u=yi[c];if(u==256){let d=c+1;for(;;)if(d==l){if(r==n.length)break;d=n[r++].to,l=r<n.length?n[r].from:t}else if(yi[d]==256)d++;else break;let f=i==1,m=(d<t?yi[d]:s)==1,p=f==m?f?1:2:s;for(let g=d,b=r,w=b?n[b-1].to:e;g>c;)g==w&&(g=n[--b].from,w=b?n[b-1].to:e),yi[--g]=p;c=d}else i=u,c++}}}function EM(e,t,n,s,r,i,o){let l=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=yi[c];b!=l&&(d=!1,f=b==16)}let m=!d&&l==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 w=b.to,y=u+1;;){if(w==n)break e;if(y<i.length&&i[y].from==w)w=i[y++].to;else{if(yi[w]==l)break e;break}}if(u++,m)m.push(b);else{b.from>c&&o.push(new fh(c,b.from,p));let w=b.direction==Jg!=!(p%2);AM(e,w?s+1:s,r,b.inner,b.from,b.to,o),c=b.to}g=b.to}else{if(g==n||(d?yi[g]!=l:yi[g]==l))break;g++}m?EM(e,c,g,s+1,r,m,o):c<g&&o.push(new fh(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=yi[c-1];b!=l&&(d=!1,f=b==16)}let m=!d&&l==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 w=b.from,y=u;;){if(w==t)break e;if(y&&i[y-1].to==w)w=i[--y].from;else{if(yi[w-1]==l)break e;break}}if(m)m.push(b);else{b.to<c&&o.push(new fh(b.to,c,p));let w=b.direction==Jg!=!(p%2);AM(e,w?s+1:s,r,b.inner,b.from,b.to,o),c=b.from}g=b.from}else{if(g==t||(d?yi[g-1]!=l:yi[g-1]==l))break;g--}m?EM(e,g,c,s+1,r,m,o):g<c&&o.push(new fh(g,c,p)),c=g}}function AM(e,t,n,s,r,i,o){let l=t%2?2:1;MFe(e,r,i,s,l),RFe(e,r,i,s,l),DFe(r,i,s,l),EM(e,r,i,t,n,s,o)}function LFe(e,t,n){if(!e)return[new fh(0,0,t==nP?1:0)];if(t==Jg&&!n.length&&!IFe.test(e))return uce(e.length);if(n.length)for(;e.length>yi.length;)yi[yi.length]=256;let s=[],r=t==Jg?0:1;return AM(e,r,r,n,0,e.length,s),s}function uce(e){return[new fh(0,e,0)]}let dce="";function PFe(e,t,n,s,r){var i;let o=s.head-e.from,l=fh.find(t,o,(i=s.bidiLevel)!==null&&i!==void 0?i:-1,s.assoc),c=t[l],u=c.side(r,n);if(o==u){let m=l+=r?1:-1;if(m<0||m>=t.length)return null;c=t[l=m],o=c.side(!r,n),u=c.side(r,n)}let d=Oa(e.text,o,c.forward(r,n));(d<c.from||d>c.to)&&(d=u),dce=e.text.slice(Math.min(o,d),Math.max(o,d));let f=l==(r?t.length-1:0)?null:t[l+(r?1:-1)];return f&&d==u&&f.level+(r?0:1)<c.level?ht.cursor(f.side(!r,n)+e.from,f.forward(r,n)?1:-1,f.level):ht.cursor(d+e.from,c.forward(r,n)?-1:1,c.level)}function OFe(e,t,n){for(let s=t;s<n;s++){let r=lce(e.charCodeAt(s));if(r==1)return Jg;if(r==2||r==4)return nP}return Jg}const hce=jn.define(),fce=jn.define(),mce=jn.define(),pce=jn.define(),jM=jn.define(),gce=jn.define(),bce=jn.define(),sP=jn.define(),rP=jn.define(),yce=jn.define({combine:e=>e.some(t=>t)}),vce=jn.define({combine:e=>e.some(t=>t)}),wce=jn.define();class fy{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 fy(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 fy(ht.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Q2=Ts.define({map:(e,t)=>e.map(t)}),xce=Ts.define();function hc(e,t,n){let s=e.facet(pce);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 pf=jn.define({combine:e=>e.length?e[0]:!0});let $Fe=0;const qb=jn.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 Wi{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(qb.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(qb.of({plugin:this,arg:t}))}static define(t,n){const{eventHandlers:s,eventObservers:r,provide:i,decorations:o}=n||{};return new Wi($Fe++,t,s,r,l=>{let c=[];return o&&c.push(S6.of(u=>{let d=u.plugin(l);return d?o(d):Hn.none})),i&&c.push(i(l)),c})}static fromClass(t,n){return Wi.define((s,r)=>new t(s,r),n)}}class hj{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(hc(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){hc(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){hc(t.state,s,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const kce=jn.define(),iP=jn.define(),S6=jn.define(),_ce=jn.define(),oP=jn.define(),G_=jn.define(),Sce=jn.define();function VW(e,t){let n=e.state.facet(Sce);if(!n.length)return n;let s=n.map(i=>i instanceof Function?i(e):i),r=[];return ur.spans(s,t.from,t.to,{point(){},span(i,o,l,c){let u=i-t.from,d=o-t.from,f=r;for(let m=l.length-1;m>=0;m--,c--){let p=l[m].spec.bidiIsolate,g;if(p==null&&(p=OFe(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 Cce=jn.define();function aP(e){let t=0,n=0,s=0,r=0;for(let i of e.state.facet(Cce)){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 px=jn.define();class ju{constructor(t,n,s,r){this.fromA=t,this.toA=n,this.fromB=s,this.toB=r}join(t){return new ju(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 l=r<t.length?t[r].fromB:1e9,c=i<n.length?n[i]:1e9,u=Math.min(l,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 ju(d,m,u,f))}return s}}class a3{constructor(t,n,s){this.view=t,this.state=n,this.transactions=s,this.flags=0,this.startState=t.state,this.changes=ua.empty(this.startState.doc.length);for(let i of s)this.changes=this.changes.compose(i.changes);let r=[];this.changes.iterChangedRanges((i,o,l,c)=>r.push(new ju(i,o,l,c))),this.changedRanges=r}static create(t,n,s){return new a3(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 BFe=[];class So{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 BFe}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&&xFe(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=Qp(this.dom),r=this.length?t>0:n>0;return new hd(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 T6)return t;return null}static get(t){return t.cmTile}}class C6 extends So{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 l of this.children){if(l.sync(t),o+=l.length+l.breakAfter,r=s?s.nextSibling:n.firstChild,i&&r!=l.dom&&(i.written=!0),l.dom.parentNode==n)for(;r&&r!=l.dom;)r=GW(r);else n.insertBefore(l.dom,r);s=l.dom}for(r=s?s.nextSibling:n.firstChild,i&&r&&(i.written=!0);r;)r=GW(r);this.length=o}}function GW(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class T6 extends C6{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=So.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 Lf)n.push(r),s=o,r=0;else{let l=i+o.length,c=t(o,i);if(c!==void 0)return c;i=l+o.breakAfter}}}resolveBlock(t,n){let s,r=-1,i,o=-1;if(this.blockTiles((l,c)=>{let u=c+l.length;if(t>=c&&t<=u){if(l.isWidget()&&n>=-1&&n<=1){if(l.flags&32)return!0;l.flags&16&&(s=void 0)}(c<t||t==u&&(n<-1?l.length:l.covers(1)))&&(!s||!l.isWidget()&&s.isWidget())&&(s=l,r=t-c),(u>t||t==c&&(n>1?l.length:l.covers(-1)))&&(!i||!l.isWidget()&&i.isWidget())&&(i=l,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 Lf extends C6{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 Lf(n||document.createElement(t.tagName),t);return n||(s.flags|=4),s}}class Fy extends C6{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,s){let r=new Fy(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,l=-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&&FFe(o,g)))&&(b>f||g.flags&32)?(o=g,l=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:l}:null}coordsIn(t,n){let s=this.resolveInline(t,n,!0);return s?s.tile.coordsIn(Math.max(0,s.offset),n):zFe(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 hd(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,l=!1;for(let c of o.children){if(l)return new hd(c.dom,0);c==s.tile&&(l=!0)}}return new hd(this.dom,0)}}function zFe(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Zx(t);return n[n.length-1]||null}function FFe(e,t){let n=e.coordsIn(0,1),s=t.coordsIn(0,1);return n&&s&&s.top<n.bottom}class uc extends C6{constructor(t,n){super(t),this.mark=n}get domAttrs(){return this.mark.attrs}static of(t,n){let s=new uc(n||document.createElement(t.tagName),t);return n||(s.flags|=4),s}}class Sg extends So{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?An.chrome||An.gecko||(t?(r--,o=1):i<s&&(i++,o=-1)):n<0?r--:i<s&&i++;let l=Gk(this.dom,r,i).getClientRects();if(!l.length)return null;let c=l[(o?o<0:n>=0)?0:l.length-1];return An.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(l,u=>u.width)||c),o?Vk(c,o<0):c||null}static of(t,n){let s=new Sg(n||document.createTextNode(t),t);return n||(s.flags|=2),s}}class Zg extends So{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 Vk(this.dom.getBoundingClientRect(),this.length?t==0:n<=0);{let i=this.dom.getClientRects(),o=null;if(!i.length)return null;let l=this.flags&16?!0:this.flags&32?!1:t>0;for(let c=l?i.length-1:0;o=i[c],!(t>0?c==0:c==i.length-1||o.top<o.bottom);c+=l?-1:1);return Vk(o,!l)}}get overrideDOMText(){if(!this.length)return Ir.empty;let{root:t}=this;if(!t)return Ir.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 Zg(i,s,t,r)}}class l3 extends So{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 Ir.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class qFe{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:l}=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&&!l.length)break;s&&s.leave(r),o=!!r.breakAfter,{tile:r,index:i}=l.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):(l.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}=l.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 HFe{constructor(t,n,s,r){this.from=t,this.to=n,this.wrapper=s,this.rank=r}}class UFe{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),l=o.lastChild;if(l&&l.isText()&&!(l.flags&8)&&l.length+t.length<512){this.cache.reused.set(l,2);let c=o.children[o.children.length-1]=new Sg(l.dom,l.text+t);c.parent=o}else o.append(r||Sg.of(t,(i=this.cache.find(Sg))===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)?fj(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let r=s;for(let l=n.marks.length-1;l>=0;l--){let c=n.marks[l],u=r.lastChild;if(u instanceof uc&&u.mark.eq(c.mark))u.dom!=c.dom&&u.setDOM(fj(c.dom)),r=u;else{if(this.cache.reused.get(c)){let f=So.get(c.dom);f&&f.setDOM(fj(c.dom))}let d=uc.of(c.mark,c.dom);r.append(d),r=d}this.cache.reused.set(c,2)}let i=So.get(t.text);i&&this.cache.reused.set(i,2);let o=new Sg(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=Tce);let r=Fy.start(t,n||((s=this.cache.find(Fy))===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],l;if(n>0&&(l=r.lastChild)&&l instanceof uc&&l.mark.eq(o))r=l,n--;else{let c=uc.of(o,(s=this.cache.find(uc,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||!KW(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(An.ios&&KW(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(mj,0,32)||new Zg(mj.toDOM(),0,mj,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 HFe(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 Lf&&r.wrapper.eq(s.wrapper))n=r;else{let i=Lf.of(s.wrapper,(t=this.cache.find(Lf,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(l3,void 0,1);return s&&(s.flags=n),s||new l3(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class WFe{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 l=this.textOff=Math.min(t,r.length);return i?null:r.slice(0,l)}let n=Math.min(this.text.length,this.textOff+t),s=this.text.slice(this.textOff,n);return this.textOff=n,s}}const c3=[Zg,Fy,Sg,uc,l3,Lf,T6];for(let e=0;e<c3.length;e++)c3[e].bucket=e;class VFe{constructor(t){this.view=t,this.buckets=c3.map(()=>[]),this.index=c3.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 l=i.length-1;l>=0;l--){let c=(l+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 l=r[i];if(!this.reused.has(l)&&(o==0?l.widget.compare(t):l.widget.constructor==t.constructor&&t.updateDOM(l.dom,this.view,l.widget)))return r.splice(i,1),i<this.index[0]&&this.index[0]--,l.widget==t&&l.length==n&&(l.flags&497)==s?(this.reused.set(l,1),l):(this.reused.set(l,2),new Zg(l.dom,n,t,l.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 GFe{constructor(t,n,s,r,i){this.view=t,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new VFe(t),this.text=new WFe(t.state.doc),this.builder=new UFe(this.cache,new T6(t,t.contentDOM),ur.iter(s)),this.cache.reused.set(n,2),this.old=new qFe(n),this.reuseWalker={skip:(o,l,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 l=o<t.length?t[o++]:null,c=l?l.fromA:this.old.root.length;if(c>r){let u=c-r;this.preserve(u,!o,!l),r=c,i+=u}if(!l)break;n&&l.fromA<=n.range.fromA&&l.toA>=n.range.toA?(this.forward(l.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,l.toA),this.emit(n.range.toB,l.toB)):(this.forward(l.fromA,l.toA),this.emit(i,l.toB)),i=l.toB,r=l.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(t,n,s){let r=XFe(this.old),i=this.openMarks;this.old.advance(t,s?1:-1,{skip:(o,l,c)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(c-l);else{let u=c>0||l<o.length?Zg.of(o.widget,this.view,c-l,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),!l&&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(l,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 l3)this.cache.add(o);else if(o instanceof uc)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 uc&&r.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?r.length&&(r.length=i=0):o instanceof uc&&(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=ur.spans(this.decorations,t,n,{point:(l,c,u,d,f,m)=>{if(u instanceof Qg){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(l).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-l);else{let p=u.widget||(u.block?qy.block:qy.inline),g=KFe(u),b=this.cache.findWidget(p,c-l,g)||Zg.of(p,this.view,c-l,g);u.block?(u.startSide>0&&r.addLineStartIfNotCovered(s),r.addBlockWidget(b)):(r.ensureLine(s),r.addInlineWidget(b,d,f))}s=null}else s=YFe(s,u);c>l&&this.text.skip(c-l)},span:(l,c,u,d)=>{for(let f=l;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==l?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=So.get(r);if(r==this.view.contentDOM)break;i instanceof uc?n.push(i):i!=null&&i.isLine()?s=i:i instanceof Lf||(r.nodeName=="DIV"&&!s&&r!=this.view.contentDOM?s=new Fy(r,Tce):s||n.push(uc.of(new W_({tagName:r.nodeName.toLowerCase(),attributes:kFe(r)}),r)))}return{line:s,marks:n}}}function KW(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 KFe(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 Tce={class:"cm-line"};function YFe(e,t){let n=t.spec.attributes,s=t.spec.class;return!n&&!s||(e||(e={class:"cm-line"}),n&&eP(n,e),s&&(e.class+=" "+s)),e}function XFe(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 uc&&t.push(s.mark)}return t}function fj(e){let t=So.get(e);return t&&t.setDOM(e.cloneNode()),e}class qy extends iu{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}}qy.inline=new qy("span");qy.block=new qy("div");const mj=new class extends iu{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class YW{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Hn.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 T6(t,t.contentDOM),this.updateInner([new ju(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:!iqe(t.changes,this.hasComposition)&&!t.selectionSet&&(r=t.state.selection.main.head));let i=r>-1?JFe(this.view,t.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:f}=this.hasComposition;s=new ju(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,(An.ie||An.chrome)&&!i&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let c=tqe(o,this.decorations,t.changes);c.length&&(s=ju.extendWithRanges(s,c));let u=sqe(l,this.blockWrappers,t.changes);return u.length&&(s=ju.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,l=new GFe(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&So.get(n.text)&&l.cache.reused.set(So.get(n.text),2),this.tile=l.run(t,n),NM(o,l.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=An.chrome||An.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 pj&&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(xce)&&(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(pf)||s.tabIndex>-1)&&Jx(s,this.view.observer.selectionRange)&&!(r&&s.contains(r));if(!(i||n||o))return;let l=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)),An.gecko&&c.empty&&!this.hasComposition&&QFe(u)){let m=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(m,u.node.childNodes[u.offset]||null)),u=d=new hd(m,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!ek(u.node,u.offset,f.anchorNode,f.anchorOffset)||!ek(d.node,d.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,c))&&(this.view.observer.ignore(()=>{An.android&&An.chrome&&s.contains(f.focusNode)&&rqe(f.focusNode,s)&&(s.blur(),s.focus({preventScroll:!0}));let m=Wk(this.view.root);if(m)if(c.empty){if(An.gecko){let p=ZFe(u.node,u.offset);if(p&&p!=3){let g=(p==1?ice:oce)(u.node,u.offset);g&&(u=new hd(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 hd(f.anchorNode,f.anchorOffset),this.impreciseHead=d.precise?null:new hd(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&ek(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=Wk(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 l=o.posAtStart;if(n.head==l||n.head==l+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=Zf(t)==0?0:n==0?-1:1;for(;;){let l=t.parentNode;if(l==s.dom)break;o==0&&l.firstChild!=l.lastChild&&(t==l.firstChild?o=-1:o=1),t=l}o<0?i=t:i=t.nextSibling}if(i==s.dom.firstChild)return r;for(;i&&!So.get(i);)i=i.nextSibling;if(!i)return r+s.length;for(let o=0,l=r;;o++){let c=s.children[o];if(c.dom==i)return l;l+=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,l=-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,l=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(l,n))}coordsAt(t,n){let{tile:s,offset:r}=this.tile.resolveBlock(t,n);return s.isWidget()?s.widget instanceof pj?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 l of i.children){if(l.length>=o){let c=r(l,o);if(c)return c}if(o-=l.length,o<0)break}else if(i.isText()&&o<i.length){let l=Oa(i.text,o);if(l==o)return null;let c=Gk(i.dom,o,l).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,l=-1,c=this.view.textDirection==wi.LTR,u=0,d=(f,m,p)=>{for(let g=0;g<f.children.length&&!(m>r);g++){let b=f.children[g],w=m+b.length,y=b.dom.getBoundingClientRect(),{height:v}=y;if(p&&!g&&(u+=y.top-p.top),b instanceof Lf)w>s&&d(b,m,y);else if(m>=s&&(u>0&&n.push(-u),n.push(v+u),u=0,o)){let x=b.dom.lastChild,k=x?Zx(x):[];if(k.length){let _=k[k.length-1],T=c?_.right-y.left:y.right-_.left;T>l&&(l=T,this.minWidth=i,this.minWidthFrom=m,this.minWidthTo=w)}}p&&g==f.children.length-1&&(u+=p.bottom-y.bottom),m=w+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"?wi.RTL:wi.LTR}measureTextSize(){let t=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,c;for(let u of o.children){if(!u.isText()||/[^ -~]/.test(u.text))return;let d=Zx(u.dom);if(d.length!=1)return;l+=d[0].width,c=d[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/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=Zx(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 l=(n.lineBlockAt(o).bottom-n.lineBlockAt(s).top)/this.view.scaleY;t.push(Hn.replace({widget:new pj(l),block:!0,inclusive:!0,isBlockGap:!0}).range(s,o))}if(!i)break;s=i.to+1}return Hn.set(t)}updateDeco(){let t=1,n=this.view.state.facet(S6).map(i=>(this.dynamicDecorationMap[t++]=typeof i=="function")?i(this.view):i),s=!1,r=this.view.state.facet(oP).map((i,o)=>{let l=typeof i=="function";return l&&(s=!0),l?i(this.view):i});for(r.length&&(this.dynamicDecorationMap[t++]=s,n.push(ur.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(_ce).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(wce))try{if(d(this.view,t.range,t))return!0}catch(f){hc(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=aP(this.view),l={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(CFe(this.view.scrollDOM,l,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==wi.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 QFe(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 Ece(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let s=ice(n.focusNode,n.focusOffset),r=oce(n.focusNode,n.focusOffset),i=s||r;if(r&&s&&r.node!=s.node){let l=So.get(r.node);if(!l||l.isText()&&l.text!=r.node.nodeValue)i=r;else if(e.docView.lastCompositionAfterCursor){let c=So.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 JFe(e,t,n){let s=Ece(e,n);if(!s)return null;let{node:r,from:i,to:o}=s,l=r.nodeValue;if(/[\n\r]/.test(l)||e.state.doc.sliceString(s.from,s.to)!=l)return null;let c=t.invertedDesc;return{range:new ju(c.mapPos(i),c.mapPos(o),i,o),text:r}}function ZFe(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 eqe=class{constructor(){this.changes=[]}compareRange(t,n){dy(t,n,this.changes)}comparePoint(t,n){dy(t,n,this.changes)}boundChange(t){dy(t,t,this.changes)}};function tqe(e,t,n){let s=new eqe;return ur.compare(e,t,n,s),s.changes}class nqe{constructor(){this.changes=[]}compareRange(t,n){dy(t,n,this.changes)}comparePoint(){}boundChange(t){dy(t,t,this.changes)}}function sqe(e,t,n){let s=new nqe;return ur.compare(e,t,n,s),s.changes}function rqe(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 iqe(e,t){let n=!1;return t&&e.iterChangedRanges((s,r)=>{s<t.to&&r>t.from&&(n=!0)}),n}class pj extends iu{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 oqe(e,t,n=1){let s=e.charCategorizer(t),r=e.doc.lineAt(t),i=t-r.from;if(r.length==0)return ht.cursor(t);i==0?n=1:i==r.length&&(n=-1);let o=i,l=i;n<0?o=Oa(r.text,i,!1):l=Oa(r.text,i);let c=s(r.text.slice(o,l));for(;o>0;){let u=Oa(r.text,o,!1);if(s(r.text.slice(u,o))!=c)break;o=u}for(;l<r.length;){let u=Oa(r.text,l);if(s(r.text.slice(l,u))!=c)break;l=u}return ht.range(o+r.from,l+r.from)}function aqe(e,t,n,s,r){let i=Math.round((s-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let l=e.viewState.heightOracle.textHeight,c=Math.floor((r-n.top-(e.defaultLineHeight-l)*.5)/l);i+=c*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+yM(o,i,e.state.tabSize)}function IM(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==al.Text&&(r.type!=i.type||(n<0?i.from<t:i.to>t)))&&(r=i)}}return r||s}return s}function lqe(e,t,n,s){let r=IM(e,t.head,t.assoc||-1),i=!s||r.type!=al.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(),l=e.textDirectionAt(r.from),c=e.posAtCoords({x:n==(l==wi.LTR)?o.right-1:o.left+1,y:(i.top+i.bottom)/2});if(c!=null)return ht.cursor(c,n?-1:1)}return ht.cursor(n?r.to:r.from,n?-1:1)}function XW(e,t,n,s){let r=e.state.doc.lineAt(t.head),i=e.bidiSpans(r),o=e.textDirectionAt(r.from);for(let l=t,c=null;;){let u=PFe(r,i,o,l,n),d=dce;if(!u){if(r.number==(n?e.state.doc.lines:1))return l;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 l}else{if(!s)return u;c=s(d)}l=u}}function cqe(e,t,n){let s=e.state.charCategorizer(t),r=s(n);return i=>{let o=s(i);return r==Hi.Space&&(r=o),r==o}}function uqe(e,t,n,s){let r=t.head,i=n?1:-1;if(r==(n?e.state.doc.length:0))return ht.cursor(r,t.assoc);let o=t.goalColumn,l,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),l=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))),l=(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=l+(p+g)*i,w=MM(e,{x:f,y:b},!1,i);if(n?b>c.bottom:b<c.top)return ht.cursor(w.pos,w.assoc);let y=e.coordsAtPos(w.pos,w.assoc),v=y?(y.top+y.bottom)/2:0;if(!y||(n?v>l:v<l))return ht.cursor(w.pos,w.assoc,void 0,o)}}function tk(e,t,n){for(;;){let s=0;for(let r of e)r.between(t-1,t+1,(i,o,l)=>{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 Ace(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=tk(e,r.from,0);o!=r.from&&(i=ht.cursor(o,-1))}else{let o=tk(e,r.from,-1),l=tk(e,r.to,1);(o!=r.from||l!=r.to)&&(i=ht.range(r.from==r.anchor?o:l,r.from==r.head?o:l))}i&&(n||(n=t.ranges.slice()),n[s]=i)}return n?ht.create(n,t.mainIndex):t}function gj(e,t,n){let s=tk(e.state.facet(G_).map(r=>r(e)),n.from,t.head>n.from?-1:1);return s==n.from?n:ht.cursor(s,s<n.from?1:-1)}class ah{constructor(t,n){this.pos=t,this.assoc=n}}function MM(e,t,n,s){let r=e.contentDOM.getBoundingClientRect(),i=r.top+e.viewState.paddingTop,{x:o,y:l}=t,c=l-i,u;for(;;){if(c<0)return new ah(0,1);if(c>e.viewState.docHeight)return new ah(e.state.doc.length,-1);if(u=e.elementAtHeight(c),s==null)break;if(u.type==al.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==al.Text){let f=aqe(e,r,u,o,l);return new ah(f,f==u.from?1:-1)}}if(u.type!=al.Text)return c<(u.top+u.bottom)/2?new ah(u.from,1):new ah(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 dqe(e,o,l,e.textDirectionAt(u.from)).scanTile(d,u.from)}class dqe{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[fh.find(r,t-s.from,-1,n)].level==this.baseDir}dirAt(t,n){let{line:s,spans:r}=this.bidiSpansAt(t);return r[fh.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,l=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 v=0;v<g;v++){if(!o.has(y)){b=y;break t}y++,y==i&&(y=r)}break e}o.add(b);let w=n(b);if(w)for(let y=0;y<w.length;y++){let v=w[y],x=0;if(!(v.width==0&&w.length>1)){if(v.bottom<this.y)(!c||c.bottom<v.bottom)&&(c=v),x=1;else if(v.top>this.y)(!u||u.top>v.top)&&(u=v),x=-1;else{let k=v.left>this.x?this.x-v.left:v.right<this.x?this.x-v.right:0,_=Math.abs(k);_<f&&(d=b,f=_,m=v),k&&(x=k<0==(this.baseDir==wi.LTR)?-1:1)}x==-1&&(!l||this.baseDirAt(t[b],1))?i=b:x==1&&(!l||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=(l?this.dirAt(t[d],1):this.baseDir)==wi.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=Oa(t.text,i))s.push(n+i);s.push(n+t.length);let r=this.scan(s,i=>{let o=s[i]-n,l=s[i+1]-n;return Gk(t.dom,o,l).getClientRects()});return r.after?new ah(s[r.i+1],-1):new ah(s[r.i],1)}scanTile(t,n){if(!t.length)return new ah(n,1);if(t.children.length==1){let l=t.children[0];if(l.isText())return this.scanText(l,n);if(l.isComposite())return this.scanTile(l,n)}let s=[n];for(let l=0,c=n;l<t.children.length;l++)s.push(c+=t.children[l].length);let r=this.scan(s,l=>{let c=t.children[l];return c.flags&48?null:(c.dom.nodeType==1?c.dom:Gk(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 ah(s[r.i+1],-1):new ah(o,1)}}const Sb="";class hqe{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(wr.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Sb}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=So.get(r),l=r.nextSibling;if(l==n){o!=null&&o.breakAfter&&!l&&s!=this.view.contentDOM&&this.lineBreak();break}let c=So.get(l);(o&&c?o.breakAfter:(o?o.breakAfter:o3(r))||o3(l)&&(r.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>i)&&!mqe(l,n)&&this.lineBreak(),r=l}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,l;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,s),o=this.lineSeparator.length):(l=r.exec(n))&&(i=l.index,o=l[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=So.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+(fqe(t,s.node,s.offset)?n:0))}}function fqe(e,t,n){for(;;){if(!t||n<Zf(t))return!1;if(t==e)return!0;n=Qp(t)+1,t=t.parentNode}}function mqe(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let s=So.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 QW{constructor(t,n){this.node=t,this.offset=n,this.pos=-1}}class pqe{constructor(t,n,s,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:i,impreciseAnchor:o}=t.docView,l=t.state.selection;if(t.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=jce(t.docView.tile,n,s,0))){let c=i||o?[]:bqe(t),u=new hqe(c,t);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=yqe(c,this.bounds.from)}else{let c=t.observer.selectionRange,u=i&&i.node==c.focusNode&&i.offset==c.focusOffset||!CM(t.contentDOM,c.focusNode)?l.main.head:t.docView.posFromDOM(c.focusNode,c.focusOffset),d=o&&o.node==c.anchorNode&&o.offset==c.anchorOffset||!CM(t.contentDOM,c.anchorNode)?l.main.anchor:t.docView.posFromDOM(c.anchorNode,c.anchorOffset),f=t.viewport;if((An.ios||An.chrome)&&l.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&&l.ranges.length>1)this.newSel=l.replaceRange(ht.range(d,u));else if(t.lineWrapping&&d==u&&!(l.main.empty&&l.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=ht.create([ht.cursor(u,p)])}else this.newSel=ht.single(d,u)}}}function jce(e,t,n,s){if(e.isComposite()){let r=-1,i=-1,o=-1,l=-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 jce(f,t,n,u);if(m>=t&&r==-1&&(r=c,i=u),u>n&&f.dom.parentNode==e.dom){o=c,l=d;break}d=m,u=m+f.breakAfter}return{from:i,to:l<0?s+e.length:l,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 Nce(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:l,to:c}=t.bounds,u=i.from,d=null;(o===8||An.android&&t.text.length<c-l)&&(u=i.to,d="end");let f=r.doc.sliceString(l,c,Sb),m,p;!i.empty&&i.from>=l&&i.to<=c&&(t.typeOver||f!=t.text)&&f.slice(0,i.from-l)==t.text.slice(0,i.from-l)&&f.slice(i.to-l)==t.text.slice(m=t.text.length-(f.length-(i.to-l)))?n={from:i.from,to:i.to,insert:Ir.of(t.text.slice(i.from-l,m).split(Sb))}:(p=Ice(f,t.text,u-l,d))&&(An.chrome&&o==13&&p.toB==p.from+2&&t.text.slice(p.from,p.toB)==Sb+Sb&&p.toB--,n={from:l+p.from,to:l+p.toA,insert:Ir.of(t.text.slice(p.from,p.toB).split(Sb))})}else s&&(!e.hasFocus&&r.facet(pf)||u3(s,i))&&(s=null);if(!n&&!s)return!1;if((An.mac||An.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=ht.single(s.main.anchor-1,s.main.head-1)),n={from:n.from,to:n.to,insert:Ir.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)}:An.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
 `&&e.lineWrapping&&(s&&(s=ht.single(s.main.anchor-1,s.main.head-1)),n={from:i.from,to:i.to,insert:Ir.of([" "])}),n)return lP(e,n,s,o);if(s&&!u3(s,i)){let l=!1,c="select";return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin=="select"&&(l=!0),c=e.inputState.lastSelectionOrigin,c=="select.pointer"&&(s=Ace(r.facet(G_).map(u=>u(e)),s))),e.dispatch({selection:s,scrollIntoView:l,userEvent:c}),!0}else return!1}function lP(e,t,n,s=-1){if(An.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(An.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&&hy(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)&&hy(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&t.insert.length==0&&hy(e.contentDOM,"Delete",46)))return!0;let i=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,l=()=>o||(o=gqe(e,t,n));return e.state.facet(gce).some(c=>c(e,t.from,t.to,i,l))||e.dispatch(l()),!0}function gqe(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=tk(r.facet(G_).map(f=>f(e)),u,c);t.from==d&&(o=d)}if(o>-1)s={changes:t,selection:ht.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&&Ece(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,w=b-d.length;if(e.state.sliceDoc(w,b)!=d||b>=f.from&&w<=f.to)return{range:g};let y=r.changes({from:w,to:b,insert:t.insert}),v=g.to-i.to;return{changes:y,range:u?ht.range(Math.max(0,u.anchor+v),Math.max(0,u.head+v)):g.map(y)}})}else s={changes:c,selection:u&&r.selection.replaceRange(u)}}let l="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,l+=".compose",e.inputState.compositionFirstChange&&(l+=".start",e.inputState.compositionFirstChange=!1)),r.update(s,{userEvent:l,scrollIntoView:!0})}function Ice(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,l=t.length;for(;o>0&&l>0&&e.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;if(s=="end"){let c=Math.max(0,i-Math.min(o,l));n-=o+c-i}if(o<i&&e.length<t.length){let c=n<=i&&n>=o?i-n:0;i-=c,l=i+(l-o),o=i}else if(l<i){let c=n<=i&&n>=l?i-n:0;i-=c,o=i+(o-l),l=i}return{from:i,toA:o,toB:l}}function bqe(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 QW(n,s)),(r!=n||i!=s)&&t.push(new QW(r,i))),t}function yqe(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?ht.single(n+t,s+t):null}function u3(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class vqe{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,An.safari&&t.contentDOM.addEventListener("input",()=>null),An.gecko&&Dqe(t.contentDOM.ownerDocument)}handleEvent(t){!Eqe(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=wqe(t),s=this.handlers,r=this.view.contentDOM;for(let i in n)if(i!="scroll"){let o=!n[i].handlers.length,l=s[i];l&&o!=!l.handlers.length&&(r.removeEventListener(i,this.handleEvent),l=null),l||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&&Rce.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),An.android&&An.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let n;return An.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&!t.shiftKey&&((n=Mce.find(s=>s.keyCode==t.keyCode))&&!t.ctrlKey||xqe.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,hy(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:An.safari&&!An.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 JW(e,t){return(n,s)=>{try{return t.call(e,s,n)}catch(r){hc(n.state,r)}}}function wqe(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 l in i){let c=i[l];c&&n(l).handlers.push(JW(s.value,c))}if(o)for(let l in o){let c=o[l];c&&n(l).observers.push(JW(s.value,c))}}for(let s in vd)n(s).handlers.push(vd[s]);for(let s in vc)n(s).observers.push(vc[s]);return t}const Mce=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xqe="dthko",Rce=[16,17,18,20,91,92,224,225],J2=6;function Z2(e){return Math.max(0,e)*.7+8}function kqe(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class _qe{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=nce(t.contentDOM),this.atoms=t.state.facet(G_).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(wr.allowMultipleSelections)&&Sqe(t,n),this.dragging=Tqe(t,n)&&Pce(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&&kqe(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let n=0,s=0,r=0,i=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=aP(this.view);t.clientX-c.left<=r+J2?n=-Z2(r-t.clientX):t.clientX+c.right>=o-J2&&(n=Z2(t.clientX-o)),t.clientY-c.top<=i+J2?s=-Z2(i-t.clientY):t.clientY+c.bottom>=l-J2&&(s=Z2(t.clientY-l)),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=Ace(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 Sqe(e,t){let n=e.state.facet(hce);return n.length?n[0](t):An.mac?t.metaKey:t.ctrlKey}function Cqe(e,t){let n=e.state.facet(fce);return n.length?n[0](t):An.mac?!t.altKey:!t.ctrlKey}function Tqe(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let s=Wk(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 Eqe(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=So.get(n))&&s.isWidget()&&!s.isHidden&&s.widget.ignoreEvent(t))return!1;return!0}const vd=Object.create(null),vc=Object.create(null),Dce=An.ie&&An.ie_version<15||An.ios&&An.webkit_version<604;function Aqe(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(),Lce(e,n.value)},50)}function E6(e,t,n){for(let s of e.facet(t))n=s(n,e);return n}function Lce(e,t){t=E6(e.state,sP,t);let{state:n}=e,s,r=1,i=n.toText(t),o=i.lines==n.selection.ranges.length;if(RM!=null&&n.selection.ranges.every(c=>c.empty)&&RM==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:ht.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:ht.cursor(c.from+u.length)}}):s=n.replaceSelection(i);e.dispatch(s,{userEvent:"input.paste",scrollIntoView:!0})}vc.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft};vc.wheel=vc.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};vd.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);vc.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")};vc.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};vd.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(mce))if(n=s(e,t),n)break;if(!n&&t.button==0&&(n=Nqe(e,t)),n){let s=!e.hasFocus;e.inputState.startMouseSelection(new _qe(e,t,n,s)),s&&e.observer.ignore(()=>{sce(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 ZW(e,t,n,s){if(s==1)return ht.cursor(t,n);if(s==2)return oqe(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,l=r?r.posAtEnd:i.to;return l<e.state.doc.length&&l==i.to&&l++,ht.range(o,l)}}const jqe=An.ie&&An.ie_version<=11;let eV=null,tV=0,nV=0;function Pce(e){if(!jqe)return e.detail;let t=eV,n=nV;return eV=e,nV=Date.now(),tV=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(tV+1)%3:1}function Nqe(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),s=Pce(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,l){let c=e.posAndSideAtCoords({x:i.clientX,y:i.clientY},!1),u,d=ZW(e,c.pos,c.assoc,s);if(n.pos!=c.pos&&!o){let f=ZW(e,n.pos,n.assoc,s),m=Math.min(f.from,d.from),p=Math.max(f.to,d.to);d=m<d.from?ht.range(m,p,d.assoc):ht.range(p,m,d.assoc)}return o?r.replaceRange(r.main.extend(d.from,d.to,d.assoc)):l&&s==1&&r.ranges.length>1&&(u=Iqe(r,c.pos))?u:l?r.addRange(d):ht.create([d])}}}function Iqe(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 ht.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}vd.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=ht.range(i,o))}}let{inputState:s}=e;return s.mouseSelection&&(s.mouseSelection.dragging=!0),s.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",E6(e.state,rP,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};vd.dragend=e=>(e.inputState.draggedContent=null,!1);function sV(e,t,n,s){if(n=E6(e.state,sP,n),!n)return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:i}=e.inputState,o=s&&i&&Cqe(e,t)?{from:i.from,to:i.to}:null,l={from:r,insert:n},c=e.state.changes(o?[o,l]:l);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}vd.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&&sV(e,t,s.filter(o=>o!=null).join(e.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let l=new FileReader;l.onerror=i,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(s[o]=l.result),i()},l.readAsText(n[o])}return!0}else{let s=t.dataTransfer.getData("Text");if(s)return sV(e,t,s,!0),!0}return!1};vd.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=Dce?null:t.clipboardData;return n?(Lce(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(Aqe(e),!1)};function Mqe(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 Rqe(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:E6(e,rP,t.join(e.lineBreak)),ranges:n,linewise:s}}let RM=null;vd.copy=vd.cut=(e,t)=>{if(!Jx(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:s,linewise:r}=Rqe(e.state);if(!n&&!r)return!1;RM=r?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"});let i=Dce?null:t.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(Mqe(e,n),!1)};const Oce=hm.define();function $ce(e,t){let n=[];for(let s of e.facet(bce)){let r=s(e,t);r&&n.push(r)}return n.length?e.update({effects:n,annotations:Oce.of(!0)}):null}function Bce(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=$ce(e.state,t);n?e.dispatch(n):e.update([])}},10)}vc.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),Bce(e)};vc.blur=e=>{e.observer.clearSelectionRange(),Bce(e)};vc.compositionstart=vc.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};vc.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,An.chrome&&An.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};vc.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};vd.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 l=o[0],c=e.posAtDOM(l.startContainer,l.startOffset),u=e.posAtDOM(l.endContainer,l.endOffset);return lP(e,{from:c,to:u,insert:e.state.toText(i)},null),!0}}let r;if(An.chrome&&An.android&&(r=Mce.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 An.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),An.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>vc.compositionend(e,t),20),!1};const rV=new Set;function Dqe(e){rV.has(e)||(rV.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const iV=["pre-wrap","normal","pre-line","break-spaces"];let Hy=!1;function oV(){Hy=!1}class Lqe{constructor(t){this.lineWrapping=t,this.doc=Ir.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 iV.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 l=iV.indexOf(t)>-1,c=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=l;if(this.lineWrapping=l,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 Pqe{constructor(t,n){this.from=t,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class ud{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"?al.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 Qg?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 ud(this.from,this.length+t.length,this.top,this.height+t.height,n)}}var Ei=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(Ei||(Ei={}));const v4=.001;class Gl{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)>v4&&(Hy=!0),this.height=t)}replace(t,n,s){return Gl.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 l=r.length-1;l>=0;l--){let{fromA:c,toA:u,fromB:d,toB:f}=r[l],m=i.lineAt(c,Ei.ByPosNoHeight,s.setDoc(n),0,0),p=m.to>=u?m:i.lineAt(u,Ei.ByPosNoHeight,s,0,0);for(f+=p.to-u,u=p.to;l>0&&m.from<=r[l-1].toA;)c=r[l-1].fromA,d=r[l-1].fromB,l--,c<m.from&&(m=i.lineAt(c,Ei.ByPosNoHeight,s,0,0));d+=m.from-c,c=m.from;let g=cP.build(s.setDoc(o),t,d,f);i=d3(i,i.replace(c,u,g))}return i.updateHeight(s,0)}static empty(){return new Oc(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 l=t[n-1];l.break?t.splice(--n,1,l.left,null,l.right):t.splice(--n,1,l.left,l.right),s+=1+l.break,r-=l.size}else if(i>r*2){let l=t[s];l.break?t.splice(s,1,l.left,null,l.right):t.splice(s,1,l.left,l.right),s+=2+l.break,i-=l.size}else break;else if(r<i){let l=t[n++];l&&(r+=l.size)}else{let l=t[--s];l&&(i+=l.size)}let o=0;return t[n-1]==null?(o=1,n--):t[n]==null&&(o=1,s++),new $qe(Gl.of(t.slice(0,n)),o,Gl.of(t.slice(s)))}}function d3(e,t){return e==t?e:(e.constructor!=t.constructor&&(Hy=!0),t)}Gl.prototype.size=1;const Oqe=Hn.replace({});class zce extends Gl{constructor(t,n,s){super(t,n),this.deco=s,this.spaceAbove=0}mainBlock(t,n){return new ud(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 ud(r,0,s,this.spaceAbove,Oqe):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,Ei.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 Oc extends zce{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 ud(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 Oc||r instanceof Ja&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof Ja?r=new Oc(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):Gl.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 Ja extends Gl{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,l=0;if(t.lineWrapping){let c=Math.min(this.height,t.lineHeight*i);o=c/i,this.length>i+1&&(l=(this.height-c)/(this.length-i-1))}else o=this.height/i;return{firstLine:s,lastLine:r,perLine:o,perChar:l}}blockAt(t,n,s,r){let{firstLine:i,lastLine:o,perLine:l,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=l+d.length*c,m=Math.max(s,t-f/2);return new ud(d.from,d.length,m,f,0)}else{let u=Math.max(0,Math.min(o-i,Math.floor((t-s)/l))),{from:d,length:f}=n.doc.line(i+u);return new ud(d,f,s+l*u,l,0)}}lineAt(t,n,s,r,i){if(n==Ei.ByHeight)return this.blockAt(t,s,r,i);if(n==Ei.ByPosNoHeight){let{from:p,to:g}=s.doc.lineAt(t);return new ud(p,g-p,0,0,0)}let{firstLine:o,perLine:l,perChar:c}=this.heightMetrics(s,i),u=s.doc.lineAt(t),d=l+u.length*c,f=u.number-o,m=r+l*f+c*(u.from-i-f);return new ud(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:l,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-l;f+=c*g+u*(t-i-g)}let p=c+u*m.length;o(new ud(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 Ja?s[s.length-1]=new Ja(i.length+r):s.push(null,new Ja(r-1))}if(t>0){let i=s[0];i instanceof Ja?s[0]=new Ja(t+i.length):s.unshift(new Ja(t-1),null)}return Gl.of(s)}decomposeLeft(t,n){n.push(new Ja(t-1),null)}decomposeRight(t,n){n.push(null,new Ja(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=[],l=Math.max(n,r.from),c=-1;for(r.from>n&&o.push(new Ja(r.from-n-1).updateHeight(t,n));l<=i&&r.more;){let d=t.doc.lineAt(l).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)>=v4&&(c=-2);let p=new Oc(d,f,m);p.outdated=!1,o.push(p),l+=d+1}l<=i&&o.push(null,new Ja(i-l).updateHeight(t,l));let u=Gl.of(o);return(c<0||Math.abs(u.height-this.height)>=v4||Math.abs(c-this.heightMetrics(t,n).perLine)>=v4)&&(Hy=!0),d3(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 $qe extends Gl{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,l=i+this.left.length+this.break,c=n==Ei.ByHeight?t<o:t<l,u=c?this.left.lineAt(t,n,s,r,i):this.right.lineAt(t,n,s,o,l);if(this.break||(c?u.to<l:u.from>l))return u;let d=n==Ei.ByPosNoHeight?Ei.ByPosNoHeight:Ei.ByPos;return c?u.join(this.right.lineAt(l,d,s,o,l)):this.left.lineAt(l,d,s,r,i).join(u)}forEachLine(t,n,s,r,i,o){let l=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,l,c,o);else{let u=this.lineAt(c,Ei.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,l,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 l of s)i.push(l);if(t>0&&aV(i,o-1),n<this.length){let l=i.length;this.decomposeRight(n,i),aV(i,l)}return Gl.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?Gl.of(this.break?[t,null,n]:[t,n]):(this.left=d3(this.left,t),this.right=d3(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,l=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<=l+o.length&&r.more?c=o=o.updateHeight(t,l,s,r):o.updateHeight(t,l,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 aV(e,t){let n,s;e[t]==null&&(n=e[t-1])instanceof Ja&&(s=e[t+1])instanceof Ja&&e.splice(t-1,3,new Ja(n.length+1+s.length))}const Bqe=5;class cP{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 Oc?r.length+=s-this.pos:(s>this.pos||!this.isCovered)&&this.nodes.push(new Oc(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 zce(o,r,s)):(o||i||r>=Bqe)&&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 Oc(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let s=new Ja(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 Oc)return t;let n=new Oc(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 Oc)&&!this.isCovered?this.nodes.push(new Oc(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 Oc&&r.updateHeight(this.oracle,s),s+=r?r.length:1;return this.nodes}static build(t,n,s,r){let i=new cP(s,t);return ur.spans(n,s,r,i,0),i.finish(s)}}function zqe(e,t,n){let s=new Fqe;return ur.compare(e,t,n,s,0),s.changes}class Fqe{constructor(){this.changes=[]}compareRange(){}comparePoint(t,n,s,r){(t<n||s&&s.heightRelevant||r&&r.heightRelevant)&&dy(t,n,this.changes,5)}}function qqe(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),l=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),l=Math.max(l,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:l-(n.top+t),bottom:Math.max(l,c)-(n.top+t)}}function Hqe(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 Uqe(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class bj{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 Hn.replace({widget:new Wqe(this.displaySize*(n?t.scaleY:t.scaleX),n)}).range(this.from,this.to)}}class Wqe extends iu{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 lV{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=cV,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=wi.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let s=n.facet(iP).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new Lqe(s),this.stateDeco=uV(n),this.heightMap=Gl.empty().applyChanges(this.stateDeco,Ir.empty,this.heightOracle.setDoc(n.doc),[new ju(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=Hn.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 eC(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?cV:new uP(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(gx(t,this.scaler))})}update(t,n=null){this.state=t.state;let s=this.stateDeco;this.stateDeco=uV(this.state);let r=t.changedRanges,i=ju.extendWithRanges(r,zqe(s,this.stateDeco,t?t.changes:ua.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);oV(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||Hy)&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.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(vce)&&(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"?wi.RTL:wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent==="refresh",l=n.getBoundingClientRect(),c=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let u=0,d=0;if(l.width&&l.height){let{scaleX:_,scaleY:T}=tce(n,l);(_>.005&&Math.abs(this.scaleX-_)>.005||T>.005&&Math.abs(this.scaleY-T)>.005)&&(this.scaleX=_,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=nce(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=rce(this.scrollParent||t.win);let b=(this.printing?Uqe:qqe)(n,this.paddingTop),w=b.top-this.pixelViewport.top,y=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(c=!0)),!this.inView&&!this.scrollTarget&&!Hqe(t.dom))return 0;let x=l.width;if((this.contentDOMWidth!=x||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,u|=16),c){let _=t.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(_)&&(o=!0),o||r.lineWrapping&&Math.abs(x-this.contentDOMWidth)>r.charWidth){let{lineHeight:T,charWidth:S,textHeight:C}=t.docView.measureTextSize();o=T>0&&r.refresh(i,T,S,C,Math.max(5,x/S),_),o&&(t.docView.minWidth=0,u|=16)}w>0&&y>0?d=Math.max(w,y):w<0&&y<0&&(d=Math.min(w,y)),oV();for(let T of this.viewports){let S=T.from==this.viewport.from?_:t.docView.measureVisibleLineHeights(T);this.heightMap=(o?Gl.empty().applyChanges(this.stateDeco,Ir.empty,this.heightOracle,[new ju(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new Pqe(T.from,S))}Hy&&(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:l}=this,c=new eC(r.lineAt(o-s*1e3,Ei.ByHeight,i,0,0).from,r.lineAt(l+(1-s)*1e3,Ei.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,Ei.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 eC(r.lineAt(m-1e3/2,Ei.ByHeight,i,0,0).from,r.lineAt(m+d+1e3/2,Ei.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 eC(this.heightMap.lineAt(s,Ei.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Ei.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,Ei.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,Ei.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(t==0||r<=o-Math.max(10,Math.min(-s,250)))&&(n==this.state.doc.length||i>=l+Math.max(10,Math.min(s,250)))&&r>o-2*1e3&&i<l+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 bj(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!=wi.LTR&&!s)return[];let l=[],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 w=Gqe(t,y=>y.from>=m.from&&y.to<=m.to&&Math.abs(y.from-d)<i&&Math.abs(y.to-f)<i&&!b.some(v=>y.from<v&&y.to>v));if(!w){if(f<m.to&&n&&s&&n.visibleRanges.some(x=>x.from<=f&&x.to>=f)){let x=n.moveToLineBoundary(ht.cursor(f),!1,!0).head;x>d&&(f=x)}let y=this.gapSize(m,d,f,p),v=s||y<2e6?y:2e6;w=new bj(d,f,y,v)}l.push(w)},u=d=>{if(d.length<o||d.type!=al.Text)return;let f=Vqe(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,w,y;if(m!=null){let v=nC(f,m),x=((this.visibleBottom-this.visibleTop)/2+b)/d.height;w=v-x,y=v+x}else w=(this.visibleTop-d.top-b)/d.height,y=(this.visibleBottom-d.top+b)/d.height;p=tC(f,w),g=tC(f,y)}else{let b=f.total*this.heightOracle.charWidth,w=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 v=this.pixelViewport.left+y,x=this.pixelViewport.right+y,k,_;if(m!=null){let T=nC(f,m),S=((x-v)/2+w)/b;k=T-S,_=T+S}else k=(v-w)/b,_=(x+w)/b;p=tC(f,k),g=tC(f,_)}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 l}gapSize(t,n,s,r){let i=nC(r,s)-nC(r,n);return this.heightOracle.lineWrapping?t.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(t){bj.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=Hn.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=[];ur.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],l=s[i];(o.from!=l.from||o.to!=l.to)&&(r|=4,t&&t.mapPos(o.from,-1)==l.from&&t.mapPos(o.to,1)==l.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)||gx(this.heightMap.lineAt(t,Ei.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)||gx(this.heightMap.lineAt(this.scaler.fromDOM(t),Ei.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 gx(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 eC{constructor(t,n){this.from=t,this.to=n}}function Vqe(e,t,n){let s=[],r=e,i=0;return ur.spans(n,e,t,{span(){},point(o,l){o>r&&(s.push({from:r,to:o}),i+=o-r),r=l}},20),r<t&&(s.push({from:r,to:t}),i+=t-r),{total:i,ranges:s}}function tC({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],l=o-i;if(s<=l)return i+s;s-=l}}function nC(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 Gqe(e,t){for(let n of e)if(t(n))return n}const cV={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function uV(e){let t=e.facet(S6).filter(s=>typeof s!="function"),n=e.facet(oP).filter(s=>typeof s!="function");return n.length&&t.push(ur.join(n)),t}class uP{constructor(t,n,s){let r=0,i=0,o=0;this.viewports=s.map(({from:l,to:c})=>{let u=n.lineAt(l,Ei.ByPos,t,0,0).top,d=n.lineAt(c,Ei.ByPos,t,0,0).bottom;return r+=d-u,{from:l,to:c,top:u,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(n.height-r);for(let l of this.viewports)l.domTop=o+(l.top-i)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),i=l.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 uP?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 gx(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),s=t.toDOM(e.bottom);return new ud(e.from,e.length,n,s-n,Array.isArray(e._content)?e._content.map(r=>gx(r,t)):e._content)}const sC=jn.define({combine:e=>e.join(" ")}),DM=jn.define({combine:e=>e.indexOf(!0)>-1}),LM=Yp.newName(),Fce=Yp.newName(),qce=Yp.newName(),Hce={"&light":"."+Fce,"&dark":"."+qce};function PM(e,t,n){return new Yp(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 Kqe=PM("."+LM,{"&":{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"}},Hce),Yqe={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},yj=An.ie&&An.ie_version<=11;class Xqe{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new TFe,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);(An.ie&&An.ie_version<=11||An.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&&An.android&&t.constructor.EDIT_CONTEXT!==!1&&!(An.chrome&&An.chrome_version<126)&&(this.editContext=new Jqe(t),t.state.facet(pf)&&(t.contentDOM.editContext=this.editContext.editContext)),yj&&(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(pf)?s.root.activeElement!=this.dom:!Jx(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}(An.ie&&An.ie_version<=11||An.android&&An.chrome)&&!s.state.selection.main.empty&&r.focusNode&&ek(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=Wk(t.root);if(!n)return!1;let s=An.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&Qqe(this.view,n)||n;if(!s||this.selectionRange.eq(s))return!1;let r=Jx(this.dom,s);return r&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&AFe(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,Yqe),yj&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),yj&&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&&hy(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&&Jx(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 pqe(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=Nce(this.view,n);return this.view.state==s&&(n.domChanged||n.newSel&&!u3(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=dV(n,t.previousSibling||t.target.previousSibling,-1),r=dV(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(pf)!=t.state.facet(pf)&&(t.view.contentDOM.editContext=t.state.facet(pf)?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 dV(e,t,n){for(;t;){let s=So.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 hV(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 ek(o.node,o.offset,r,i)&&([n,s,r,i]=[r,i,n,s]),{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:i}}function Qqe(e,t){if(t.getComposedRanges){let r=t.getComposedRanges(e.root)[0];if(r)return hV(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?hV(e,n):null}class Jqe{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,l=this.toEditorPos(s.updateRangeStart),c=this.toEditorPos(s.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:s.updateRangeStart,editorBase:l,drifted:!1});let u=c-l>s.text.length;l==this.from&&i<this.from?l=i:c==this.to&&i>this.to&&(c=i);let d=Ice(t.state.sliceDoc(l,c),s.text,(u?r.from:r.to)-l,u?"end":null);if(!d){let m=ht.single(this.toEditorPos(s.selectionStart),this.toEditorPos(s.selectionEnd));u3(m,r)||t.dispatch({selection:m,userEvent:"select"});return}let f={from:d.from+l,to:d.toA+l,insert:Ir.of(s.text.slice(d.from,d.toB).split(`
`))};if((An.mac||An.android)&&f.from==o-1&&/^\. ?$/.test(s.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:c,insert:Ir.of([s.text.replace("."," ")])}),this.pendingContextChange=f,!t.state.readOnly){let m=this.to-this.from+(f.to-f.from+f.insert.length);lP(t,f,ht.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),l=this.toEditorPos(s.rangeEnd);o<l;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,l=i.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){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(l)?1:2}px`;r.push(Hn.mark({attributes:{style:d}}).range(c,u))}}}t.dispatch({effects:xce.of(Hn.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=Wk(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,l,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 Yt{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch: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||EFe(t.parent)||document,this.viewState=new lV(this,t.state||wr.create(t)),t.scrollTo&&t.scrollTo.is(Q2)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(qb).map(r=>new hj(r));for(let r of this.plugins)r.update(this);this.observer=new Xqe(this),this.inputState=new vqe(this),this.inputState.ensureHandlers(this.plugins),this.docView=new YW(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 ha?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,l=0,c=null;t.some(m=>m.annotation(Oce))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=$ce(i,o),c||(l=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(wr.phrases)!=this.state.facet(wr.phrases))return this.setState(i);r=a3.create(this,i,t),r.flags|=l;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(Yt.cursorScrollMargin);f=new fy(p.empty?p:ht.cursor(p.head,p.head>p.anchor?-1:1),"nearest","nearest",b,g)}for(let p of m.effects)p.is(Q2)&&(f=p.value.clip(this.state))}this.viewState.update(r,f),this.bidiCache=h3.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),n=this.docView.update(r),this.state.facet(px)!=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(sC)!=r.state.facet(sC)&&(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(jM))try{m(r)}catch(p){hc(this.state,p,"update listener")}(c||d)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),d&&!Nce(this,d)&&u.force&&hy(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 lV(this,t),this.plugins=t.facet(qb).map(s=>new hj(s)),this.pluginMap.clear();for(let s of this.plugins)s.update(this);this.docView.destroy(),this.docView=new YW(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(qb),s=t.state.facet(qb);if(n!=s){let r=[];for(let i of s){let o=n.indexOf(i);if(o<0)r.push(new hj(i));else{let l=this.plugins[o];l.mustUpdate=t,r.push(l)}}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){hc(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 l=0;;l++){if(o<0)if(rce(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(l>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 hc(this.state,g),fV}}),f=a3.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]!=fV)try{let g=u[p];g.write&&g.write(d[p],this)}catch(g){hc(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 l of this.state.facet(jM))l(n)}get themeClasses(){return LM+" "+(this.state.facet(DM)?qce:Fce)+" "+this.state.facet(sC)}updateAttrs(){let t=mV(this,kce,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(pf)?"true":"false",class:"cm-content",style:`${An.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),mV(this,iP,n);let s=this.observer.ignore(()=>{let r=HW(this.contentDOM,this.contentAttrs,n),i=HW(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(Yt.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(px);let t=this.state.facet(Yt.cspNonce);Yp.mount(this.root,this.styleModules.concat(Kqe).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 gj(this,t,XW(this,t,n,s))}moveByGroup(t,n){return gj(this,t,XW(this,t,n,s=>cqe(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 ht.cursor(i.side(n,r)+t.from,i.forward(!n,r)?1:-1)}moveToLineBoundary(t,n,s=!0){return lqe(this,t,n,s)}moveVertically(t,n,s){return gj(this,t,uqe(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=MM(this,t,n);return s&&s.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),MM(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[fh.find(i,t-r.from,-1,n)];return Vk(s,o.dir==wi.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(yce)||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>Zqe)return uce(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||cce(i.isolates,s=VW(this,t))))return i.order;s||(s=VW(this,t));let r=LFe(t.text,n,s);return this.bidiCache.push(new h3(t.from,t.to,n,s,!0,r)),r}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||An.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{sce(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 Q2.of(new fy(typeof t=="number"?ht.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 Q2.of(new fy(ht.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 Wi.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return Wi.define(()=>({}),{eventObservers:t})}static theme(t,n){let s=Yp.newName(),r=[sC.of(s),px.of(PM(`.${s}`,t))];return n&&n.dark&&r.push(DM.of(!0)),r}static baseTheme(t){return w0.lowest(px.of(PM("."+LM,t,Hce)))}static findFromDOM(t){var n;let s=t.querySelector(".cm-content"),r=s&&So.get(s)||So.get(t);return((n=r==null?void 0:r.root)===null||n===void 0?void 0:n.view)||null}}Yt.styleModule=px;Yt.inputHandler=gce;Yt.clipboardInputFilter=sP;Yt.clipboardOutputFilter=rP;Yt.scrollHandler=wce;Yt.focusChangeEffect=bce;Yt.perLineTextDirection=yce;Yt.exceptionSink=pce;Yt.updateListener=jM;Yt.editable=pf;Yt.mouseSelectionStyle=mce;Yt.dragMovesSelection=fce;Yt.clickAddsSelectionRange=hce;Yt.decorations=S6;Yt.blockWrappers=_ce;Yt.outerDecorations=oP;Yt.atomicRanges=G_;Yt.bidiIsolatedRanges=Sce;Yt.cursorScrollMargin=jn.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}}});Yt.scrollMargins=Cce;Yt.darkTheme=DM;Yt.cspNonce=jn.define({combine:e=>e.length?e[0]:""});Yt.contentAttributes=iP;Yt.editorAttributes=kce;Yt.lineWrapping=Yt.contentAttributes.of({class:"cm-lineWrapping"});Yt.announce=Ts.define();const Zqe=4096,fV={};class h3{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:wi.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 h3(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return s}}function mV(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&&eP(o,n)}return n}const eHe=An.mac?"mac":An.windows?"win":An.linux?"linux":"key";function tHe(e,t){const n=e.split(/-(?!$)/);let s=n[n.length-1];s=="Space"&&(s=" ");let r,i,o,l;for(let c=0;c<n.length-1;++c){const u=n[c];if(/^(cmd|meta|m)$/i.test(u))l=!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"?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(s="Alt-"+s),i&&(s="Ctrl-"+s),l&&(s="Meta-"+s),o&&(s="Shift-"+s),s}function rC(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 nHe=w0.default(Yt.domEventHandlers({keydown(e,t){return Wce(Uce(t.state),e,t,"editor")}})),Uy=jn.define({enables:nHe}),pV=new WeakMap;function Uce(e){let t=e.facet(Uy),n=pV.get(t);return n||pV.set(t,n=iHe(t.reduce((s,r)=>s.concat(r),[]))),n}function sHe(e,t,n){return Wce(Uce(e.state),t,e,n)}let Ym=null;const rHe=4e3;function iHe(e,t=eHe){let n=Object.create(null),s=Object.create(null),r=(o,l)=>{let c=s[o];if(c==null)s[o]=l;else if(c!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},i=(o,l,c,u,d)=>{var f,m;let p=n[o]||(n[o]=Object.create(null)),g=l.split(/ (?!$)/).map(y=>tHe(y,t));for(let y=1;y<g.length;y++){let v=g.slice(0,y).join(" ");r(v,!0),p[v]||(p[v]={preventDefault:!0,stopPropagation:!1,run:[x=>{let k=Ym={view:x,prefix:v,scope:o};return setTimeout(()=>{Ym==k&&(Ym=null)},rHe),!0}]})}let b=g.join(" ");r(b,!1);let w=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&&w.run.push(c),u&&(w.preventDefault=!0),d&&(w.stopPropagation=!0)};for(let o of e){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of l){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,OM))}let c=o[t]||o.key;if(c)for(let u of l)i(u,c,o.run,o.preventDefault,o.stopPropagation),o.shift&&i(u,"Shift-"+c,o.shift,o.preventDefault,o.stopPropagation)}return n}let OM=null;function Wce(e,t,n,s){OM=t;let r=wFe(t),i=cc(r,0),o=oh(i)==r.length&&r!=" ",l="",c=!1,u=!1,d=!1;Ym&&Ym.view==n&&Ym.scope==s&&(l=Ym.prefix+" ",Rce.indexOf(t.keyCode)<0&&(u=!0,Ym=null));let f=new Set,m=w=>{if(w){for(let y of w.run)if(!f.has(y)&&(f.add(y),y(n)))return w.stopPropagation&&(d=!0),!0;w.preventDefault&&(w.stopPropagation&&(d=!0),u=!0)}return!1},p=e[s],g,b;return p&&(m(p[l+rC(r,t,!o)])?c=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(An.windows&&t.ctrlKey&&t.altKey)&&!(An.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(g=Xp[t.keyCode])&&g!=r?(m(p[l+rC(g,t,!0)])||t.shiftKey&&(b=Hk[t.keyCode])!=r&&b!=g&&m(p[l+rC(b,t,!1)]))&&(c=!0):o&&t.shiftKey&&m(p[l+rC(r,t,!0)])&&(c=!0),!c&&m(p._any)&&(c=!0)),u&&(c=!0),c&&d&&t.stopPropagation(),OM=null,c}class Lg{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=Vce(t);return[new Lg(n,r.left-i.left,r.top-i.top,null,r.bottom-r.top)]}else return oHe(t,n,s)}}function Vce(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==wi.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function gV(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,l=e.posAtCoords({x:i.left+1,y:o}),c=e.posAtCoords({x:i.right-1,y:o});return l==null||c==null?s:{from:Math.max(s.from,Math.min(l,c)),to:Math.min(s.to,Math.max(l,c))}}function oHe(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==wi.LTR,o=e.contentDOM,l=o.getBoundingClientRect(),c=Vce(e),u=o.querySelector(".cm-line"),d=u&&window.getComputedStyle(u),f=l.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),m=l.right-(d?parseInt(d.paddingRight):0),p=IM(e,s,1),g=IM(e,r,-1),b=p.type==al.Text?p:null,w=g.type==al.Text?g:null;if(b&&(e.lineWrapping||p.widgetLineBreaks)&&(b=gV(e,s,1,b)),w&&(e.lineWrapping||g.widgetLineBreaks)&&(w=gV(e,r,-1,w)),b&&w&&b.from==w.from&&b.to==w.to)return v(x(n.from,n.to,b));{let _=b?x(n.from,null,b):k(p,!1),T=w?x(null,n.to,w):k(g,!0),S=[];return(b||p).to<(w||g).from-(b&&w?1:0)||p.widgetLineBreaks>1&&_.bottom+e.defaultLineHeight/2<T.top?S.push(y(f,_.bottom,m,T.top)):_.bottom<T.top&&e.elementAtHeight((_.bottom+T.top)/2).type==al.Text&&(_.bottom=T.top=(_.bottom+T.top)/2),v(_).concat(S).concat(v(T))}function y(_,T,S,C){return new Lg(t,_-c.left,T-c.top,Math.max(0,S-_),C-T)}function v({top:_,bottom:T,horizontal:S}){let C=[];for(let N=0;N<S.length;N+=2)C.push(y(S[N],_,S[N+1],T));return C}function x(_,T,S){let C=1e9,N=-1e9,E=[];function O(j,L,z,I,$){let K=e.coordsAtPos(j,j==S.to?-2:2),R=e.coordsAtPos(z,z==S.from?2:-2);!K||!R||(C=Math.min(K.top,R.top,C),N=Math.max(K.bottom,R.bottom,N),$==wi.LTR?E.push(i&&L?f:K.left,i&&I?m:R.right):E.push(!i&&I?f:R.left,!i&&L?m:K.right))}let B=_??S.from,D=T??S.to;for(let j of e.visibleRanges)if(j.to>B&&j.from<D)for(let L=Math.max(j.from,B),z=Math.min(j.to,D);;){let I=e.state.doc.lineAt(L);for(let $ of e.bidiSpans(I)){let K=$.from+I.from,R=$.to+I.from;if(K>=z)break;R>L&&O(Math.max(K,L),_==null&&K<=B,Math.min(R,z),T==null&&R>=D,$.dir)}if(L=I.to+1,L>=z)break}return E.length==0&&O(B,_==null,D,T==null,e.textDirection),{top:C,bottom:N,horizontal:E}}function k(_,T){let S=l.top+(T?_.top:_.bottom);return{top:S,bottom:S,horizontal:[]}}}function aHe(e,t){return e.constructor==t.constructor&&e.eq(t)}class lHe{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(w4)!=t.state.facet(w4)&&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(w4);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)=>!aHe(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,An.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const w4=jn.define();function Gce(e){return[Wi.define(t=>new lHe(t,e)),w4.of(e)]}const Wy=jn.define({combine(e){return Lh(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function Kce(e={}){return[Wy.of(e),cHe,uHe,dHe,vce.of(!0)]}function Yce(e){return e.startState.facet(Wy)!=e.state.facet(Wy)}const cHe=Gce({above:!0,markers(e){let{state:t}=e,n=t.facet(Wy),s=[];for(let r of t.selection.ranges){let i=r==t.selection.main;if(r.empty||n.drawRangeCursor&&!(i&&An.ios&&n.iosSelectionHandles)){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=r.empty?r:ht.cursor(r.head,r.assoc);for(let c of Lg.forRange(e,o,l))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=Yce(e);return n&&bV(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){bV(t.state,e)},class:"cm-cursorLayer"});function bV(e,t){t.style.animationDuration=e.facet(Wy).cursorBlinkRate+"ms"}const uHe=Gce({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 Lg.forRange(e,"cm-selectionBackground",r))t.push(i);if(An.ios&&!n.empty&&e.state.facet(Wy).iosSelectionHandles){for(let r of Lg.forRange(e,"cm-selectionHandle cm-selectionHandle-start",ht.cursor(n.from,1)))t.push(r);for(let r of Lg.forRange(e,"cm-selectionHandle cm-selectionHandle-end",ht.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||Yce(e)},class:"cm-selectionLayer"}),dHe=w0.highest(Yt.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Xce=Ts.define({map(e,t){return e==null?null:t.mapPos(e)}}),bx=ll.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((n,s)=>s.is(Xce)?s.value:n,e)}}),hHe=Wi.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(bx);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(bx)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(bx),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(bx)!=e&&this.view.dispatch({effects:Xce.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 fHe(){return[bx,hHe]}function yV(e,t,n,s,r){t.lastIndex=0;for(let i=e.iterRange(n,s),o=n,l;!i.next().done;o+=i.value.length)if(!i.lineBreak)for(;l=t.exec(i.value);)r(o+l.index,l)}function mHe(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 pHe{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=(l,c,u,d)=>r(d,u,u+l[0].length,l,c);else if(typeof s=="function")this.addMatch=(l,c,u,d)=>{let f=s(l,c,u);f&&d(u,u+l[0].length,f)};else if(s)this.addMatch=(l,c,u,d)=>d(u,u+l[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 Ch,s=n.add.bind(n);for(let{from:r,to:i}of mHe(t,this.maxLength))yV(t.state.doc,this.regexp,r,i,(o,l)=>this.addMatch(l,t,o,s));return n.finish()}updateDeco(t,n){let s=1e9,r=-1;return t.docChanged&&t.changes.iterChanges((i,o,l,c)=>{c>=t.view.viewport.from&&l<=t.view.viewport.to&&(s=Math.min(l,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),l=Math.min(i.to,r);if(l>=o){let c=t.state.doc.lineAt(o),u=c.to<l?t.state.doc.lineAt(l):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(;l<u.to;l++)if(this.boundary.test(u.text[l-u.from])){f=l;break}}let m=[],p,g=(b,w,y)=>m.push(y.range(b,w));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 yV(t.state.doc,this.regexp,d,f,(b,w)=>this.addMatch(w,t,b,g));n=n.update({filterFrom:d,filterTo:f,filter:(b,w)=>b<d||w>f,add:m})}}return n}}const $M=/x/.unicode!=null?"gu":"g",gHe=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,$M),bHe={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 vj=null;function yHe(){var e;if(vj==null&&typeof document<"u"&&document.body){let t=document.body.style;vj=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return vj||!1}const x4=jn.define({combine(e){let t=Lh(e,{render:null,specialChars:gHe,addSpecialChars:null});return(t.replaceTabs=!yHe())&&(t.specialChars=new RegExp("	|"+t.specialChars.source,$M)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,$M)),t}});function Qce(e={}){return[x4.of(e),vHe()]}let vV=null;function vHe(){return vV||(vV=Wi.fromClass(class{constructor(e){this.view=e,this.decorations=Hn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(x4)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new pHe({regexp:e.specialChars,decoration:(t,n,s)=>{let{doc:r}=n.state,i=cc(t[0],0);if(i==9){let o=r.lineAt(s),l=n.state.tabSize,c=Dv(o.text,l,s-o.from);return Hn.replace({widget:new _He((l-c%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=Hn.replace({widget:new kHe(e,i)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(x4);e.startState.facet(x4)!=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 wHe="•";function xHe(e){return e>=32?wHe:e==10?"␤":String.fromCharCode(9216+e)}class kHe extends iu{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=xHe(this.code),s=t.state.phrase("Control character")+" "+(bHe[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 _He extends iu{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 SHe(){return THe}const CHe=Hn.line({class:"cm-activeLine"}),THe=Wi.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(CHe.range(r.from)),t=r.from)}return Hn.set(n)}},{decorations:e=>e.decorations});class EHe extends iu{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?Zx(t.firstChild):[];if(!n.length)return null;let s=window.getComputedStyle(t.parentNode),r=Vk(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 wV(e){let t=Wi.fromClass(class{constructor(n){this.view=n,this.placeholder=e?Hn.set([Hn.widget({widget:new EHe(e),side:1}).range(0)]):Hn.none}get decorations(){return this.view.state.doc.length?Hn.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,Yt.contentAttributes.of({"aria-placeholder":e})]:t}const BM=2e3;function AHe(e,t,n){let s=Math.min(t.line,n.line),r=Math.max(t.line,n.line),i=[];if(t.off>BM||n.off>BM||t.col<0||n.col<0){let o=Math.min(t.off,n.off),l=Math.max(t.off,n.off);for(let c=s;c<=r;c++){let u=e.doc.line(c);u.length<=l&&i.push(ht.range(u.from+o,u.to+l))}}else{let o=Math.min(t.col,n.col),l=Math.max(t.col,n.col);for(let c=s;c<=r;c++){let u=e.doc.line(c),d=yM(u.text,o,e.tabSize,!0);if(d<0)i.push(ht.cursor(u.to));else{let f=yM(u.text,l,e.tabSize);i.push(ht.range(u.from+d,u.from+f))}}}return i}function jHe(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function xV(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>BM?-1:r==s.length?jHe(e,t.clientX):Dv(s.text,e.state.tabSize,n-s.from);return{line:s.number,col:i,off:r}}function NHe(e,t){let n=xV(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 l=xV(e,r);if(!l)return s;let c=AHe(e.state,n,l);return c.length?o?ht.create(c.concat(s.ranges)):ht.create(c):s}}:null}function IHe(e){let t=n=>n.altKey&&n.button==0;return Yt.mouseSelectionStyle.of((n,s)=>t(s)?NHe(n,s):null)}const MHe={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},RHe={style:"cursor: crosshair"};function DHe(e={}){let[t,n]=MHe[e.key||"Alt"],s=Wi.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,Yt.contentAttributes.of(r=>{var i;return!((i=r.plugin(s))===null||i===void 0)&&i.isDown?RHe:null})]}const iC="-10000px";class Jce{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=[],l=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),l&&(l[c]=!!u.above);else{let f=o[c]=this.tooltipViews[d];l&&(l[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&&(l.forEach((c,u)=>n[u]=c),n.length=l.length),this.input=r,this.tooltips=i,this.tooltipViews=o,!0}}function LHe(e={}){return k4.of(e)}function PHe(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const k4=jn.define({combine:e=>{var t,n,s;return{position:An.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)||PHe}}}),kV=new WeakMap,dP=Wi.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(k4);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 Jce(e,hP,(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(k4);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=iC,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(An.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=aP(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 l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(k4).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:s,scaleX:r,scaleY:i}=e,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let c=this.manager.tooltips[l],u=this.manager.tooltipViews[l],{dom:d}=u,f=e.pos[l],m=e.size[l];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=iC;continue}let p=c.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,g=p?7:0,b=m.right-m.left,w=(t=kV.get(u))!==null&&t!==void 0?t:m.bottom-m.top,y=u.offset||$He,v=this.view.textDirection==wi.LTR,x=m.width>s.right-s.left?v?s.left:s.right-m.width:v?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[l];!c.strictSide&&(k?f.top-w-g-y.y<s.top:f.bottom+w+g+y.y>s.bottom)&&k==s.bottom-f.bottom>f.top-s.top&&(k=this.above[l]=!k);let _=(k?f.top-s.top:s.bottom-f.bottom)-g;if(_<w&&u.resize!==!1){if(_<this.view.defaultLineHeight){d.style.top=iC;continue}kV.set(u,w),d.style.height=(w=_)/i+"px"}else d.style.height&&(d.style.height="");let T=k?f.top-w-g-y.y:f.bottom+g+y.y,S=x+b;if(u.overlap!==!0)for(let C of o)C.left<S&&C.right>x&&C.top<T+w&&C.bottom>T&&(T=k?C.top-w-2-g:C.bottom+g+2);if(this.position=="absolute"?(d.style.top=(T-e.parent.top)/i+"px",_V(d,(x-e.parent.left)/r)):(d.style.top=T/i+"px",_V(d,x/r)),p){let C=f.left+(v?y.x:-y.x)-(x+14-7);p.style.left=C/r+"px"}u.overlap!==!0&&o.push({left:x,top:T,right:S,bottom:T+w}),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=iC}},{eventObservers:{scroll(){this.maybeMeasure()}}});function _V(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const OHe=Yt.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),$He={x:0,y:0},hP=jn.define({enables:[dP,OHe]}),f3=jn.define({combine:e=>e.reduce((t,n)=>t.concat(n),[])});class A6{static create(t){return new A6(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Jce(t,f3,(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 BHe=hP.compute([f3],e=>{let t=e.facet(f3);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:A6.create,above:t[0].above,arrow:t.some(n=>n.arrow)}}),Zce=jn.define();class zHe{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 l=t.bidiSpans(t.state.doc.lineAt(r)).find(u=>u.from<=r&&u.to>=r),c=l&&l.dir==wi.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=l=>{if(l&&!(Array.isArray(l)&&!l.length)){let c=Array.isArray(l)?l:[l];r&&this.locked.set(c,r),t.dispatch({effects:this.setHover.of(c)})}};if(i&&"then"in i){let l=this.pending={pos:n};i.then(c=>{this.pending==l&&(this.pending=null,o(c))},c=>hc(t.state,c,"hover tooltip"))}else o(i)}get tooltip(){let t=this.view.plugin(dP),n=t?t.manager.tooltips.findIndex(s=>s.create==A6.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&&!FHe(i.dom,t)||this.pending){let{pos:o}=r[0]||this.pending,l=(s=(n=r[0])===null||n===void 0?void 0:n.end)!==null&&s!==void 0?s:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!qHe(this.view,o,l,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 oC=4;function FHe(e,t){let{left:n,right:s,top:r,bottom:i}=e.getBoundingClientRect(),o;if(o=e.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();r=Math.min(l.top,r),i=Math.max(l.bottom,i)}return t.clientX>=n-oC&&t.clientX<=s+oC&&t.clientY>=r-oC&&t.clientY<=i+oC}function qHe(e,t,n,s,r,i){let o=e.scrollDOM.getBoundingClientRect(),l=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>s||o.right<s||o.top>r||Math.min(o.bottom,l)<r)return!1;let c=e.posAtCoords({x:s,y:r},!1);return c>=t&&c<=n}function HHe(e,t={}){let n=Ts.define(),s=new WeakMap,r=ll.define({create(){return[]},update(o,l){let c=s.get(o);if(o.length&&(t.hideOnChange&&(l.docChanged||l.selection)?o=[]:c&&c(l)?o=[]:t.hideOn&&(o=o.filter(u=>!t.hideOn(l,u)))),l.docChanged&&o.length){let u=[];for(let d of o){let f=l.changes.mapPos(d.pos,-1,Fl.TrackDel);if(f!=null){let m=Object.assign(Object.create(null),d);m.pos=f,m.end!=null&&(m.end=l.changes.mapPos(m.end)),u.push(m)}}o=u}for(let u of l.effects)u.is(n)&&(o=u.value,c=void 0),(u.is(WHe)&&!u.value||u.value==r)&&(o=[]);return o.length&&c&&s.set(o,c),o},provide:o=>f3.from(o)});const i=Wi.define(o=>new zHe(o,e,r,s,n,t.hoverTime||300));return{active:r,extension:[r,i,Zce.of(i),BHe]}}function UHe(e,t,n,s={}){var r;let i=e.state.facet(Zce).map(o=>e.plugin(o)).filter(o=>!!o);if(s.tooltip&&s.tooltip.active){let o=i.find(l=>l.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 eue(e,t){let n=e.plugin(dP);if(!n)return null;let s=n.manager.tooltips.indexOf(t);return s<0?null:n.manager.tooltipViews[s]}const WHe=Ts.define(),SV=jn.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 fP(e,t){let n=e.plugin(tue),s=n?n.specs.indexOf(t):-1;return s>-1?n.panels[s]:null}const tue=Wi.fromClass(class{constructor(e){this.input=e.state.facet(Kk),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(e));let t=e.state.facet(SV);this.top=new aC(e,!0,t.topContainer),this.bottom=new aC(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(SV);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new aC(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new aC(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Kk);if(n!=this.input){let s=n.filter(c=>c),r=[],i=[],o=[],l=[];for(let c of s){let u=this.specs.indexOf(c),d;u<0?(d=c(e.view),l.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 l)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=>Yt.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class aC{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=CV(t);t=t.nextSibling}else this.dom.insertBefore(n.dom,t);for(;t;)t=CV(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 CV(e){let t=e.nextSibling;return e.remove(),t}const Kk=jn.define({enables:tue});function VHe(e,t){let n,s=new Promise(o=>n=o),r=o=>GHe(o,t,n);e.state.field(wj,!1)?e.dispatch({effects:nue.of(r)}):e.dispatch({effects:Ts.appendConfig.of(wj.init(()=>[r]))});let i=sue.of(r);return{close:i,result:s.then(o=>((e.win.queueMicrotask||(c=>e.win.setTimeout(c,10)))(()=>{e.state.field(wj).indexOf(r)>-1&&e.dispatch({effects:i})}),o))}}const wj=ll.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(nue)?e=[n.value].concat(e):n.is(sue)&&(e=e.filter(s=>s!=n.value));return e},provide:e=>Kk.computeN([e],t=>t.field(e))}),nue=Ts.define(),sue=Ts.define();function GHe(e,t,n){let s=t.content?t.content(e,()=>o(null)):null;if(!s){if(s=ai("form"),t.input){let l=ai("input",t.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),s.appendChild(ai("label",(t.label||"")+": ",l))}else s.appendChild(document.createTextNode(t.label||""));s.appendChild(document.createTextNode(" ")),s.appendChild(ai("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let r=s.nodeName=="FORM"?[s]:s.querySelectorAll("form");for(let l=0;l<r.length;l++){let c=r[l];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=ai("div",s,ai("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(l){i.contains(i.ownerDocument.activeElement)&&e.focus(),n(l)}return{dom:i,top:t.top,mount:()=>{if(t.focus){let l;typeof t.focus=="string"?l=s.querySelector(t.focus):l=s.querySelector("input")||s.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}class em extends Kp{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}em.prototype.elementClass="";em.prototype.toDOM=void 0;em.prototype.mapMode=Fl.TrackBefore;em.prototype.startSide=em.prototype.endSide=-1;em.prototype.point=!0;const _4=jn.define(),KHe=jn.define(),YHe={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>ur.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},nk=jn.define();function XHe(e){return[rue(),nk.of({...YHe,...e})]}const TV=jn.define({combine:e=>e.some(t=>t)});function rue(e){return[QHe]}const QHe=Wi.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(nk).map(t=>new AV(e,t)),this.fixed=!e.state.facet(TV);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(TV)!=!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=ur.iter(this.view.state.facet(_4),this.view.viewport.from),s=[],r=this.gutters.map(i=>new JHe(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 l of i.type)if(l.type==al.Text&&o){zM(n,s,l.from);for(let c of r)c.line(this.view,l,s);o=!1}else if(l.widget)for(let c of r)c.widget(this.view,l)}else if(i.type==al.Text){zM(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(nk),n=e.state.facet(nk),s=e.docChanged||e.heightChanged||e.viewportChanged||!ur.eq(e.startState.facet(_4),e.state.facet(_4),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 AV(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=>Yt.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==wi.LTR?{left:s,right:r}:{right:s,left:r}})});function EV(e){return Array.isArray(e)?e:[e]}function zM(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class JHe{constructor(t,n,s){this.gutter=t,this.height=s,this.i=0,this.cursor=ur.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 l=new iue(t,o,i,s);r.elements.push(l),r.dom.appendChild(l.dom)}else r.elements[this.i].update(t,o,i,s);this.height=n.bottom,this.i++}line(t,n,s){let r=[];zM(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(KHe)){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 AV{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 l=t.lineBlockAtHeight(o-t.documentTop);n.domEventHandlers[s](t,l,r)&&r.preventDefault()});this.markers=EV(n.markers(t)),n.initialSpacer&&(this.spacer=new iue(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=EV(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!ur.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 iue{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":""),ZHe(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 l=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)){l=f,u=!0;break}}else l=this.markers.length;for(;o<l;){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 ZHe(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 eUe=jn.define(),tUe=jn.define(),Hb=jn.define({combine(e){return Lh(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?(l,c,u)=>i(l,c,u)||o(l,c,u):o}return s}})}});class xj extends em{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function kj(e,t){return e.state.facet(Hb).formatNumber(t,e.state)}const nUe=nk.compute([Hb],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(eUe)},lineMarker(t,n,s){return s.some(r=>r.toDOM)?null:new xj(kj(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,s)=>{for(let r of t.state.facet(tUe)){let i=r(t,n,s);if(i)return i}return null},lineMarkerChange:t=>t.startState.facet(Hb)!=t.state.facet(Hb),initialSpacer(t){return new xj(kj(t,jV(t.state.doc.lines)))},updateSpacer(t,n){let s=kj(n.view,jV(n.view.state.doc.lines));return s==t.number?t:new xj(s)},domEventHandlers:e.facet(Hb).domEventHandlers,side:"before"}));function sUe(e={}){return[Hb.of(e),rue(),nUe]}function jV(e){let t=9;for(;t<e;)t=t*10+9;return t}const rUe=new class extends em{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},iUe=_4.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(rUe.range(r)))}return ur.of(t)});function oUe(){return iUe}const aUe=1024;let lUe=0;class _j{constructor(t,n){this.from=t,this.to=n}}class kr{constructor(t={}){this.id=lUe++,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=Wu.match(t)),n=>{let s=t(n);return s===void 0?null:[this,s]}}}kr.closedBy=new kr({deserialize:e=>e.split(" ")});kr.openedBy=new kr({deserialize:e=>e.split(" ")});kr.group=new kr({deserialize:e=>e.split(" ")});kr.isolate=new kr({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});kr.contextHash=new kr({perNode:!0});kr.lookAhead=new kr({perNode:!0});kr.mounted=new kr({perNode:!0});class sk{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[kr.mounted.id]}}const cUe=Object.create(null);class Wu{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):cUe,s=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),r=new Wu(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(kr.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(kr.group),i=-1;i<(r?r.length:0);i++){let o=n[i<0?s.name:r[i]];if(o)return o}}}}Wu.none=new Wu("",Object.create(null),0,8);const lC=new WeakMap,NV=new WeakMap;var Io;(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"})(Io||(Io={}));class il{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,l]of i)this.props[typeof o=="number"?o:o.id]=l}}toString(){let t=sk.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 qM(this.topNode,t)}cursorAt(t,n=0,s=0){let r=lC.get(this)||this.topNode,i=new qM(r);return i.moveTo(t,n),lC.set(this,i._tree),i}get topNode(){return new Zp(this,0,0,null)}resolve(t,n=0){let s=Yk(lC.get(this)||this.topNode,t,n,!1);return lC.set(this,s),s}resolveInner(t,n=0){let s=Yk(NV.get(this)||this.topNode,t,n,!0);return NV.set(this,s),s}resolveStack(t,n=0){return hUe(this,t,n)}iterate(t){let{enter:n,leave:s,from:r=0,to:i=this.length}=t,o=t.mode||0,l=(o&Io.IncludeAnonymous)>0;for(let c=this.cursor(o|Io.IncludeAnonymous);;){let u=!1;if(c.from<=i&&c.to>=r&&(!l&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;u=!0}for(;u&&s&&(l||!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:gP(Wu.none,this.children,this.positions,0,this.children.length,0,this.length,(n,s,r)=>new il(this.type,n,s,r,this.propValues),t.makeTree||((n,s,r)=>new il(Wu.none,n,s,r)))}static build(t){return fUe(t)}}il.empty=new il(Wu.none,[],[],0);class mP{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 mP(this.buffer,this.index)}}class Jp{constructor(t,n,s){this.buffer=t,this.length=n,this.set=s}get type(){return Wu.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,l=-1;for(let c=t;c!=n&&!(oue(i,r,o[c+1],o[c+2])&&(l=c,s>0));c=o[c+3]);return l}slice(t,n,s){let r=this.buffer,i=new Uint16Array(n-t),o=0;for(let l=t,c=0;l<n;){i[c++]=r[l++],i[c++]=r[l++]-s;let u=i[c++]=r[l++]-s;i[c++]=r[l++]-t,o=Math.max(o,u)}return new Jp(i,o,this.set)}}function oue(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 Yk(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 Zp&&e.index<0?null:e.parent;if(!o)return e;e=o}let i=s?0:Io.IgnoreOverlays;if(s)for(let o=e,l=o.parent;l;o=l,l=o.parent)o instanceof Zp&&o.index<0&&((r=l.enter(t,n,i))===null||r===void 0?void 0:r.from)!=o.from&&(e=l);for(;;){let o=e.enter(t,n,i);if(!o)return e;e=o}}class aue{cursor(t=0){return new qM(this,t)}getChild(t,n=null,s=null){let r=IV(this,t,n,s);return r.length?r[0]:null}getChildren(t,n=null,s=null){return IV(this,t,n,s)}resolve(t,n=0){return Yk(this,t,n,!1)}resolveInner(t,n=0){return Yk(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 Zp=class S4 extends aue{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:l,positions:c}=o._tree,u=n>0?l.length:-1;t!=u;t+=n){let d=l[t],f=c[t]+o.from,m;if(!(!(i&Io.EnterBracketed&&d instanceof il&&(m=sk.get(d))&&!m.overlay&&m.bracketed&&s>=f&&s<=f+d.length)&&!oue(r,s,f,f+d.length))){if(d instanceof Jp){if(i&Io.ExcludeBuffers)continue;let p=d.findChild(0,d.buffer.length,n,s-f,r);if(p>-1)return new lp(new uUe(o,d,t,f),null,p)}else if(i&Io.IncludeAnonymous||!d.type.isAnonymous||pP(d)){let p;if(!(i&Io.IgnoreMounts)&&(p=sk.get(d))&&!p.overlay)return new S4(p.tree,f,t,o);let g=new S4(d,f,t,o);return i&Io.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?d.children.length-1:0,n,s,r,i)}}}if(i&Io.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&Io.IgnoreOverlays)&&(r=sk.get(this._tree))&&r.overlay){let i=t-this.from,o=s&Io.EnterBracketed&&r.bracketed;for(let{from:l,to:c}of r.overlay)if((n>0||o?l<=i:l<i)&&(n<0||o?c>=i:c>i))return new S4(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 IV(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 uUe{constructor(t,n,s,r){this.parent=t,this.buffer=n,this.index=s,this.start=r}}class lp extends aue{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 lp(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&Io.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 lp(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 lp(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 lp(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 il(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function lue(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 Zp&&n.index<0?null:n.parent,r=e.slice();return s?r[t]=s:r.splice(t,1),new dUe(r,n)}class dUe{constructor(t,n){this.heads=t,this.node=n}get next(){return lue(this.heads)}}function hUe(e,t,n){let s=e.resolveInner(t,n),r=null;for(let i=s instanceof Zp?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=sk.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let l=new Zp(o.tree,o.overlay[0].from+i.from,-1,i);(r||(r=[s])).push(Yk(l,t,n,!1))}}return r?lue(r):s}class qM{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&~Io.EnterBracketed,t instanceof Zp)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 Zp?(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&Io.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,s))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Io.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Io.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 l=s._tree.children[i];if(this.mode&Io.IncludeAnonymous||l instanceof Jp||!l.type.isAnonymous||pP(l))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 lp(this.buffer,n,this.stack[r]);return this.bufferNode=new lp(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 pP(e){return e.children.some(t=>t instanceof Jp||!t.type.isAnonymous||pP(t))}function fUe(e){var t;let{buffer:n,nodeSet:s,maxBufferLength:r=aUe,reused:i=[],minRepeatType:o=s.types.length}=e,l=Array.isArray(n)?new mP(n,n.length):n,c=s.types,u=0,d=0;function f(_,T,S,C,N,E){let{id:O,start:B,end:D,size:j}=l,L=d,z=u;if(j<0)if(l.next(),j==-1){let Y=i[O];S.push(Y),C.push(B-_);return}else if(j==-3){u=O;return}else if(j==-4){d=O;return}else throw new RangeError(`Unrecognized record size: ${j}`);let I=c[O],$,K,R=B-_;if(D-B<=r&&(K=w(l.pos-T,N))){let Y=new Uint16Array(K.size-K.skip),W=l.pos-K.size,M=Y.length;for(;l.pos>W;)M=y(K.start,Y,M);$=new Jp(Y,D-K.start,s),R=K.start-_}else{let Y=l.pos-j;l.next();let W=[],M=[],F=O>=o?O:-1,J=0,V=D;for(;l.pos>Y;)F>=0&&l.id==F&&l.size>=0?(l.end<=V-r&&(g(W,M,B,J,l.end,V,F,L,z),J=W.length,V=l.end),l.next()):E>2500?m(B,Y,W,M):f(B,Y,W,M,F,E+1);if(F>=0&&J>0&&J<W.length&&g(W,M,B,J,B,V,F,L,z),W.reverse(),M.reverse(),F>-1&&J>0){let U=p(I,z);$=gP(I,W,M,0,W.length,0,D-B,U,U)}else $=b(I,W,M,D-B,L-D,z)}S.push($),C.push(R)}function m(_,T,S,C){let N=[],E=0,O=-1;for(;l.pos>T;){let{id:B,start:D,end:j,size:L}=l;if(L>4)l.next();else{if(O>-1&&D<O)break;O<0&&(O=j-r),N.push(B,D,j),E++,l.next()}}if(E){let B=new Uint16Array(E*4),D=N[N.length-2];for(let j=N.length-3,L=0;j>=0;j-=3)B[L++]=N[j],B[L++]=N[j+1]-D,B[L++]=N[j+2]-D,B[L++]=L;S.push(new Jp(B,N[2]-D,s)),C.push(D-_)}}function p(_,T){return(S,C,N)=>{let E=0,O=S.length-1,B,D;if(O>=0&&(B=S[O])instanceof il){if(!O&&B.type==_&&B.length==N)return B;(D=B.prop(kr.lookAhead))&&(E=C[O]+B.length+D)}return b(_,S,C,N,E,T)}}function g(_,T,S,C,N,E,O,B,D){let j=[],L=[];for(;_.length>C;)j.push(_.pop()),L.push(T.pop()+S-N);_.push(b(s.types[O],j,L,E-N,B-E,D)),T.push(N-S)}function b(_,T,S,C,N,E,O){if(E){let B=[kr.contextHash,E];O=O?[B].concat(O):[B]}if(N>25){let B=[kr.lookAhead,N];O=O?[B].concat(O):[B]}return new il(_,T,S,C,O)}function w(_,T){let S=l.fork(),C=0,N=0,E=0,O=S.end-r,B={size:0,start:0,skip:0};e:for(let D=S.pos-_;S.pos>D;){let j=S.size;if(S.id==T&&j>=0){B.size=C,B.start=N,B.skip=E,E+=4,C+=4,S.next();continue}let L=S.pos-j;if(j<0||L<D||S.start<O)break;let z=S.id>=o?4:0,I=S.start;for(S.next();S.pos>L;){if(S.size<0)if(S.size==-3||S.size==-4)z+=4;else break e;else S.id>=o&&(z+=4);S.next()}N=I,C+=j,E+=z}return(T<0||C==_)&&(B.size=C,B.start=N,B.skip=E),B.size>4?B:void 0}function y(_,T,S){let{id:C,start:N,end:E,size:O}=l;if(l.next(),O>=0&&C<o){let B=S;if(O>4){let D=l.pos-(O-4);for(;l.pos>D;)S=y(_,T,S)}T[--S]=B,T[--S]=E-_,T[--S]=N-_,T[--S]=C}else O==-3?u=C:O==-4&&(d=C);return S}let v=[],x=[];for(;l.pos>0;)f(e.start||0,e.bufferStart||0,v,x,-1,0);let k=(t=e.length)!==null&&t!==void 0?t:v.length?x[0]+v[0].length:0;return new il(c[e.topID],v.reverse(),x.reverse(),k)}const MV=new WeakMap;function C4(e,t){if(!e.isAnonymous||t instanceof Jp||t.type!=e)return 1;let n=MV.get(t);if(n==null){n=1;for(let s of t.children){if(s.type!=e||!(s instanceof il)){n=1;break}n+=C4(e,s)}MV.set(t,n)}return n}function gP(e,t,n,s,r,i,o,l,c){let u=0;for(let g=s;g<r;g++)u+=C4(e,t[g]);let d=Math.ceil(u*1.5/8),f=[],m=[];function p(g,b,w,y,v){for(let x=w;x<y;){let k=x,_=b[x],T=C4(e,g[x]);for(x++;x<y;x++){let S=C4(e,g[x]);if(T+S>=d)break;T+=S}if(x==k+1){if(T>d){let S=g[k];p(S.children,S.positions,0,S.children.length,b[k]+v);continue}f.push(g[k])}else{let S=b[x-1]+g[x-1].length-_;f.push(gP(e,g,b,k,x,_,S,null,c))}m.push(_+v-i)}}return p(t,n,s,r,0),(l||c)(f,m,o)}class Pg{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 Pg(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 l=0,c=0,u=0;;l++){let d=l<n.length?n[l]: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 Pg(p,g,m.tree,m.offset+u,l>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 mUe{startParse(t,n,s){return typeof t=="string"&&(t=new pUe(t)),s=s?s.length?s.map(r=>new _j(r.from,r.to)):[new _j(0,0)]:[new _j(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 pUe{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 kr({perNode:!0});let gUe=0;class ku{constructor(t,n,s,r){this.name=t,this.set=n,this.base=s,this.modified=r,this.id=gUe++}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 ku&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let r=new ku(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 m3(t);return s=>s.modified.indexOf(n)>-1?s:m3.get(s.base||s,s.modified.concat(n).sort((r,i)=>r.id-i.id))}}let bUe=0;class m3{constructor(t){this.name=t,this.instances=[],this.id=bUe++}static get(t,n){if(!n.length)return t;let s=n[0].instances.find(l=>l.base==t&&yUe(n,l.modified));if(s)return s;let r=[],i=new ku(t.name,r,t,n);for(let l of n)l.instances.push(i);let o=vUe(n);for(let l of t.set)if(!l.modified.length)for(let c of o)r.push(m3.get(l,c));return i}}function yUe(e,t){return e.length==t.length&&e.every((n,s)=>n==t[s])}function vUe(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 wUe(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,l=r;for(let f=0;;){if(l=="..."&&f>0&&f+3==r.length){o=1;break}let m=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);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);l=r.slice(f)}let c=i.length-1,u=i[c];if(!u)throw new RangeError("Invalid path: "+r);let d=new Xk(s,o,c>0?i.slice(0,c):null);t[u]=d.sort(t[u])}}return cue.add(t)}const cue=new kr({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 Xk(r.tags,r.mode,r.context);n?n.next=i:s=i,n=i}return s}});class Xk{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}}Xk.empty=new Xk([],2,null);function uue(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 l of i)for(let c of l.set){let u=n[c.id];if(u){o=o?o+" "+u:u;break}}return o},scope:s}}function xUe(e,t){let n=null;for(let s of e){let r=s.style(t);r&&(n=n?n+" "+r:r)}return n}function kUe(e,t,n,s=0,r=e.length){let i=new _Ue(s,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),s,r,"",i.highlighters),i.flush(r)}class _Ue{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:l,to:c}=t;if(l>=s||c<=n)return;o.isTop&&(i=this.highlighters.filter(p=>!p.scope||p.scope(o)));let u=r,d=SUe(t)||Xk.empty,f=xUe(i,d.tags);if(f&&(u&&(u+=" "),u+=f,d.mode==1&&(r+=(r?" ":"")+f)),this.startSpan(Math.max(n,l),u),d.opaque)return;let m=t.tree&&t.tree.prop(kr.mounted);if(m&&m.overlay){let p=t.node.enter(m.overlay[0].from+l,1),g=this.highlighters.filter(w=>!w.scope||w.scope(m.tree.type)),b=t.firstChild();for(let w=0,y=l;;w++){let v=w<m.overlay.length?m.overlay[w]:null,x=v?v.from+l:c,k=Math.max(n,y),_=Math.min(s,x);if(k<_&&b)for(;t.from<_&&(this.highlightRange(t,k,_,r,i),this.startSpan(Math.min(_,t.to),u),!(t.to>=x||!t.nextSibling())););if(!v||x>s)break;y=v.to+l,y>n&&(this.highlightRange(p.cursor(),Math.max(n,v.from+l),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 SUe(e){let t=e.type.prop(cue);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const gn=ku.define,cC=gn(),qm=gn(),RV=gn(qm),DV=gn(qm),Hm=gn(),uC=gn(Hm),Sj=gn(Hm),Kd=gn(),Q0=gn(Kd),qd=gn(),Hd=gn(),HM=gn(),qw=gn(HM),dC=gn(),kn={comment:cC,lineComment:gn(cC),blockComment:gn(cC),docComment:gn(cC),name:qm,variableName:gn(qm),typeName:RV,tagName:gn(RV),propertyName:DV,attributeName:gn(DV),className:gn(qm),labelName:gn(qm),namespace:gn(qm),macroName:gn(qm),literal:Hm,string:uC,docString:gn(uC),character:gn(uC),attributeValue:gn(uC),number:Sj,integer:gn(Sj),float:gn(Sj),bool:gn(Hm),regexp:gn(Hm),escape:gn(Hm),color:gn(Hm),url:gn(Hm),keyword:qd,self:gn(qd),null:gn(qd),atom:gn(qd),unit:gn(qd),modifier:gn(qd),operatorKeyword:gn(qd),controlKeyword:gn(qd),definitionKeyword:gn(qd),moduleKeyword:gn(qd),operator:Hd,derefOperator:gn(Hd),arithmeticOperator:gn(Hd),logicOperator:gn(Hd),bitwiseOperator:gn(Hd),compareOperator:gn(Hd),updateOperator:gn(Hd),definitionOperator:gn(Hd),typeOperator:gn(Hd),controlOperator:gn(Hd),punctuation:HM,separator:gn(HM),bracket:qw,angleBracket:gn(qw),squareBracket:gn(qw),paren:gn(qw),brace:gn(qw),content:Kd,heading:Q0,heading1:gn(Q0),heading2:gn(Q0),heading3:gn(Q0),heading4:gn(Q0),heading5:gn(Q0),heading6:gn(Q0),contentSeparator:gn(Kd),list:gn(Kd),quote:gn(Kd),emphasis:gn(Kd),strong:gn(Kd),link:gn(Kd),monospace:gn(Kd),strikethrough:gn(Kd),inserted:gn(),deleted:gn(),changed:gn(),invalid:gn(),meta:dC,documentMeta:gn(dC),annotation:gn(dC),processingInstruction:gn(dC),definition:ku.defineModifier("definition"),constant:ku.defineModifier("constant"),function:ku.defineModifier("function"),standard:ku.defineModifier("standard"),local:ku.defineModifier("local"),special:ku.defineModifier("special")};for(let e in kn){let t=kn[e];t instanceof ku&&(t.name=e)}uue([{tag:kn.link,class:"tok-link"},{tag:kn.heading,class:"tok-heading"},{tag:kn.emphasis,class:"tok-emphasis"},{tag:kn.strong,class:"tok-strong"},{tag:kn.keyword,class:"tok-keyword"},{tag:kn.atom,class:"tok-atom"},{tag:kn.bool,class:"tok-bool"},{tag:kn.url,class:"tok-url"},{tag:kn.labelName,class:"tok-labelName"},{tag:kn.inserted,class:"tok-inserted"},{tag:kn.deleted,class:"tok-deleted"},{tag:kn.literal,class:"tok-literal"},{tag:kn.string,class:"tok-string"},{tag:kn.number,class:"tok-number"},{tag:[kn.regexp,kn.escape,kn.special(kn.string)],class:"tok-string2"},{tag:kn.variableName,class:"tok-variableName"},{tag:kn.local(kn.variableName),class:"tok-variableName tok-local"},{tag:kn.definition(kn.variableName),class:"tok-variableName tok-definition"},{tag:kn.special(kn.variableName),class:"tok-variableName2"},{tag:kn.definition(kn.propertyName),class:"tok-propertyName tok-definition"},{tag:kn.typeName,class:"tok-typeName"},{tag:kn.namespace,class:"tok-namespace"},{tag:kn.className,class:"tok-className"},{tag:kn.macroName,class:"tok-macroName"},{tag:kn.propertyName,class:"tok-propertyName"},{tag:kn.operator,class:"tok-operator"},{tag:kn.comment,class:"tok-comment"},{tag:kn.meta,class:"tok-meta"},{tag:kn.invalid,class:"tok-invalid"},{tag:kn.punctuation,class:"tok-punctuation"}]);var Cj;const yx=new kr,CUe=new kr;class mh{constructor(t,n,s=[],r=""){this.data=t,this.name=r,wr.prototype.hasOwnProperty("tree")||Object.defineProperty(wr.prototype,"tree",{get(){return _l(this)}}),this.parser=n,this.extension=[e0.of(this),wr.languageData.of((i,o,l)=>{let c=LV(i,o,l),u=c.type.prop(yx);if(!u)return[];let d=i.facet(u),f=c.type.prop(CUe);if(f){let m=c.resolve(o-c.from,l);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 LV(t,n,s).type.prop(yx)==this.data}findRegions(t){let n=t.facet(e0);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(yx)==this.data){s.push({from:o,to:o+i.length});return}let l=i.prop(kr.mounted);if(l){if(l.tree.prop(yx)==this.data){if(l.overlay)for(let c of l.overlay)s.push({from:c.from+o,to:c.to+o});else s.push({from:o,to:o+i.length});return}else if(l.overlay){let c=s.length;if(r(l.tree,l.overlay[0].from+o),s.length>c)return}}for(let c=0;c<i.children.length;c++){let u=i.children[c];u instanceof il&&r(u,i.positions[c]+o)}};return r(_l(t),0),s}get allowsNesting(){return!0}}mh.setState=Ts.define();function LV(e,t,n){let s=e.facet(e0),r=_l(e).topNode;if(!s||s.allowsNesting)for(let i=r;i;i=i.enter(t,n,Io.ExcludeBuffers|Io.EnterBracketed))i.type.isTop&&(r=i);return r}function _l(e){let t=e.field(mh.state,!1);return t?t.tree:il.empty}class TUe{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 Hw=null;class p3{constructor(t,n,s=[],r,i,o,l,c){this.parser=t,this.state=n,this.fragments=s,this.tree=r,this.treeLen=i,this.viewport=o,this.skipped=l,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(t,n,s){return new p3(t,n,[],il.empty,0,s,[],null)}startParse(){return this.parser.startParse(new TUe(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=il.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(Pg.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(Pg.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=Hw;Hw=this;try{return t()}finally{Hw=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=PV(t,n.from,n.to);return t}changes(t,n){let{fragments:s,tree:r,treeLen:i,viewport:o,skipped:l}=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=Pg.applyChanges(s,c),r=il.empty,i=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){l=[];for(let u of this.skipped){let d=t.mapPos(u.from,1),f=t.mapPos(u.to,-1);d<f&&l.push({from:d,to:f})}}}return new p3(this.parser,n,s,r,i,o,l,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=PV(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 mUe{createParse(n,s,r){let i=r[0].from,o=r[r.length-1].to;return{parsedPos:i,advance(){let c=Hw;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 il(Wu.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 Hw}}function PV(e,t,n){return Pg.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Vy{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 Vy(n)}static init(t){let n=Math.min(3e3,t.doc.length),s=p3.create(t.facet(e0).parser,t,{from:0,to:n});return s.work(20,n)||s.takeTree(),new Vy(s)}}mh.state=ll.define({create:Vy.init,update(e,t){for(let n of t.effects)if(n.is(mh.setState))return n.value;return t.startState.facet(e0)!=t.state.facet(e0)?Vy.init(t.state):e.apply(t)}});let due=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(due=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const Tj=typeof navigator<"u"&&(!((Cj=navigator.scheduling)===null||Cj===void 0)&&Cj.isInputPending)?()=>navigator.scheduling.isInputPending():null,EUe=Wi.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(mh.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(mh.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=due(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(mh.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!Tj?Math.max(25,t.timeRemaining()-5):1e9),l=i.context.treeLen<r&&s.doc.length>r+1e3,c=i.context.work(()=>Tj&&Tj()||Date.now()>o,r+(l?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:mh.setState.of(new Vy(i.context))})),this.chunkBudget>0&&!(c&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(n=>hc(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()}}}),e0=jn.define({combine(e){return e.length?e[0]:null},enables:e=>[mh.state,EUe,Yt.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),AUe=jn.define(),bP=jn.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 g3(e){let t=e.facet(bP);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function Qk(e,t){let n="",s=e.tabSize,r=e.facet(bP)[0];if(r=="	"){for(;t>=s;)n+="	",t-=s;r=" "}for(let i=0;i<t;i++)n+=r;return n}function yP(e,t){e instanceof wr&&(e=new j6(e));for(let s of e.state.facet(AUe)){let r=s(e,t);if(r!==void 0)return r}let n=_l(e.state);return n.length>=t?NUe(e,n,t):null}class j6{constructor(t,n={}){this.state=t,this.options=n,this.unit=g3(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 Dv(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 jUe=new kr;function NUe(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 hue(s,e,n)}function hue(e,t,n){for(let s=e;s;s=s.next){let r=MUe(s.node);if(r)return r(vP.create(t,n,s))}return 0}function IUe(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function MUe(e){let t=e.type.prop(jUe);if(t)return t;let n=e.firstChild,s;if(n&&(s=n.type.prop(kr.closedBy))){let r=e.lastChild,i=r&&s.indexOf(r.name)>-1;return o=>PUe(o,!0,1,void 0,i&&!IUe(o)?r.from:void 0)}return e.parent==null?RUe:null}function RUe(){return 0}class vP extends j6{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 vP(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(DUe(s,t))break;n=this.state.doc.lineAt(s.from)}return this.lineIndent(n.from)}continue(){return hue(this.context.next,this.base,this.pos)}}function DUe(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function LUe(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 l=n.to;;){let c=t.childAfter(l);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}}l=c.to}}function PUe(e,t,n,s,r){let i=e.textAfter,o=i.match(/^\s*/)[0].length,l=s&&i.slice(o,o+s.length)==s||r==e.pos+o,c=LUe(e);return c?l?e.column(c.from):e.column(c.to):e.baseIndent+(l?0:e.unit*n)}const OUe=200;function $Ue(){return wr.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+OUe)return e;let i=n.sliceString(r.from,s);if(!t.some(u=>u.test(i)))return e;let{state:o}=e,l=-1,c=[];for(let{head:u}of o.selection.ranges){let d=o.doc.lineAt(u);if(d.from==l)continue;l=d.from;let f=yP(o,d.from);if(f==null)continue;let m=/^\s*/.exec(d.text)[0],p=Qk(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 BUe=jn.define(),zUe=new kr;function FUe(e,t,n){let s=_l(e);if(s.length<n)return null;let r=s.resolveStack(n,1),i=null;for(let o=r;o;o=o.next){let l=o.node;if(l.to<=n||l.from>n)continue;if(i&&l.from<t)break;let c=l.type.prop(zUe);if(c&&(l.to<s.length-50||s.length==e.doc.length||!qUe(l))){let u=c(l,e);u&&u.from<=n&&u.from>=t&&u.to>n&&(i=u)}}return i}function qUe(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function b3(e,t,n){for(let s of e.facet(BUe)){let r=s(e,t,n);if(r)return r}return FUe(e,t,n)}function fue(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 N6=Ts.define({map:fue}),K_=Ts.define({map:fue});function mue(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 e1=ll.define({create(){return Hn.none},update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((n,s)=>e=OV(e,n,s)),e=e.map(t.changes);for(let n of t.effects)if(n.is(N6)&&!HUe(e,n.value.from,n.value.to)){let{preparePlaceholder:s}=t.state.facet(bue),r=s?Hn.replace({widget:new XUe(s(t.state,n.value))}):$V;e=e.update({add:[r.range(n.value.from,n.value.to)]})}else n.is(K_)&&(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=OV(e,t.selection.main.head)),e},provide:e=>Yt.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($V.range(s,r))}return Hn.set(t,!0)}});function OV(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 y3(e,t,n){var s;let r=null;return(s=e.field(e1,!1))===null||s===void 0||s.between(t,n,(i,o)=>{(!r||r.from>i)&&(r={from:i,to:o})}),r}function HUe(e,t,n){let s=!1;return e.between(t,t,(r,i)=>{r==t&&i==n&&(s=!0)}),s}function pue(e,t){return e.field(e1,!1)?t:t.concat(Ts.appendConfig.of(yue()))}const UUe=e=>{for(let t of mue(e)){let n=b3(e.state,t.from,t.to);if(n)return e.dispatch({effects:pue(e.state,[N6.of(n),gue(e,n)])}),!0}return!1},WUe=e=>{if(!e.state.field(e1,!1))return!1;let t=[];for(let n of mue(e)){let s=y3(e.state,n.from,n.to);s&&t.push(K_.of(s),gue(e,s,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function gue(e,t,n=!0){let s=e.state.doc.lineAt(t.from).number,r=e.state.doc.lineAt(t.to).number;return Yt.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${s} ${e.state.phrase("to")} ${r}.`)}const VUe=e=>{let{state:t}=e,n=[];for(let s=0;s<t.doc.length;){let r=e.lineBlockAt(s),i=b3(t,r.from,r.to);i&&n.push(N6.of(i)),s=(i?e.lineBlockAt(i.to):r).to+1}return n.length&&e.dispatch({effects:pue(e.state,n)}),!!n.length},GUe=e=>{let t=e.state.field(e1,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(s,r)=>{n.push(K_.of({from:s,to:r}))}),e.dispatch({effects:n}),!0},KUe=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:UUe},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:WUe},{key:"Ctrl-Alt-[",run:VUe},{key:"Ctrl-Alt-]",run:GUe}],YUe={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},bue=jn.define({combine(e){return Lh(e,YUe)}});function yue(e){return[e1,ZUe]}function vue(e,t){let{state:n}=e,s=n.facet(bue),r=o=>{let l=e.lineBlockAt(e.posAtDOM(o.target)),c=y3(e.state,l.from,l.to);c&&e.dispatch({effects:K_.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 $V=Hn.replace({widget:new class extends iu{toDOM(e){return vue(e,null)}}});class XUe extends iu{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return vue(t,this.value)}}const QUe={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Ej extends em{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 JUe(e={}){let t={...QUe,...e},n=new Ej(t,!0),s=new Ej(t,!1),r=Wi.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(e0)!=o.state.facet(e0)||o.startState.field(e1,!1)!=o.state.field(e1,!1)||_l(o.startState)!=_l(o.state)||t.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new Ch;for(let c of o.viewportLineBlocks){let u=y3(o.state,c.from,c.to)?s:b3(o.state,c.from,c.to)?n:null;u&&l.add(c.from,c.from,u)}return l.finish()}}),{domEventHandlers:i}=t;return[r,XHe({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(r))===null||l===void 0?void 0:l.markers)||ur.empty},initialSpacer(){return new Ej(t,!1)},domEventHandlers:{...i,click:(o,l,c)=>{if(i.click&&i.click(o,l,c))return!0;let u=y3(o.state,l.from,l.to);if(u)return o.dispatch({effects:K_.of(u)}),!0;let d=b3(o.state,l.from,l.to);return d?(o.dispatch({effects:N6.of(d)}),!0):!1}}}),yue()]}const ZUe=Yt.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 I6{constructor(t,n){this.specs=t;let s;function r(l){let c=Yp.newName();return(s||(s=Object.create(null)))["."+c]=l,c}const i=typeof n.all=="string"?n.all:n.all?r(n.all):void 0,o=n.scope;this.scope=o instanceof mh?l=>l.prop(yx)==o.data:o?l=>l==o:void 0,this.style=uue(t.map(l=>({tag:l.tag,class:l.class||r(Object.assign({},l,{tag:null}))})),{all:i}).style,this.module=s?new Yp(s):null,this.themeType=n.themeType}static define(t,n){return new I6(t,n||{})}}const UM=jn.define(),wue=jn.define({combine(e){return e.length?[e[0]]:null}});function T4(e){let t=e.facet(UM);return t.length?t:e.facet(wue)}function xue(e,t){let n=[tWe],s;return e instanceof I6&&(e.module&&n.push(Yt.styleModule.of(e.module)),s=e.themeType),t!=null&&t.fallback?n.push(wue.of(e)):s?n.push(UM.computeN([Yt.darkTheme],r=>r.facet(Yt.darkTheme)==(s=="dark")?[e]:[])):n.push(UM.of(e)),n}function VDt(e,t,n){let s=T4(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 eWe{constructor(t){this.markCache=Object.create(null),this.tree=_l(t.state),this.decorations=this.buildDeco(t,T4(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=_l(t.state),s=T4(t.state),r=s!=T4(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 Hn.none;let s=new Ch;for(let{from:r,to:i}of t.visibleRanges)kUe(this.tree,n,(o,l,c)=>{s.add(o,l,this.markCache[c]||(this.markCache[c]=Hn.mark({class:c})))},r,i);return s.finish()}}const tWe=w0.high(Wi.fromClass(eWe,{decorations:e=>e.decorations})),kue=I6.define([{tag:kn.meta,color:"#404740"},{tag:kn.link,textDecoration:"underline"},{tag:kn.heading,textDecoration:"underline",fontWeight:"bold"},{tag:kn.emphasis,fontStyle:"italic"},{tag:kn.strong,fontWeight:"bold"},{tag:kn.strikethrough,textDecoration:"line-through"},{tag:kn.keyword,color:"#708"},{tag:[kn.atom,kn.bool,kn.url,kn.contentSeparator,kn.labelName],color:"#219"},{tag:[kn.literal,kn.inserted],color:"#164"},{tag:[kn.string,kn.deleted],color:"#a11"},{tag:[kn.regexp,kn.escape,kn.special(kn.string)],color:"#e40"},{tag:kn.definition(kn.variableName),color:"#00f"},{tag:kn.local(kn.variableName),color:"#30a"},{tag:[kn.typeName,kn.namespace],color:"#085"},{tag:kn.className,color:"#167"},{tag:[kn.special(kn.variableName),kn.macroName],color:"#256"},{tag:kn.definition(kn.propertyName),color:"#00c"},{tag:kn.comment,color:"#940"},{tag:kn.invalid,color:"#f00"}]),nWe=Yt.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),_ue=1e4,Sue="()[]{}",Cue=jn.define({combine(e){return Lh(e,{afterCursor:!0,brackets:Sue,maxScanDistance:_ue,renderMatch:iWe})}}),sWe=Hn.mark({class:"cm-matchingBracket"}),rWe=Hn.mark({class:"cm-nonmatchingBracket"});function iWe(e){let t=[],n=e.matched?sWe:rWe;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 BV(e){let t=[],n=e.facet(Cue);for(let s of e.selection.ranges){if(!s.empty)continue;let r=ph(e,s.head,-1,n)||s.head>0&&ph(e,s.head-1,1,n)||n.afterCursor&&(ph(e,s.head,1,n)||s.head<e.doc.length&&ph(e,s.head+1,-1,n));r&&(t=t.concat(n.renderMatch(r,e)))}return Hn.set(t,!0)}const oWe=Wi.fromClass(class{constructor(e){this.paused=!1,this.decorations=BV(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=BV(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),aWe=[oWe,nWe];function lWe(e={}){return[Cue.of(e),aWe]}const cWe=new kr;function WM(e,t,n){let s=e.prop(t<0?kr.openedBy:kr.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 VM(e){let t=e.type.prop(cWe);return t?t(e.node):e}function ph(e,t,n,s={}){let r=s.maxScanDistance||_ue,i=s.brackets||Sue,o=_l(e),l=o.resolveInner(t,n);for(let c=l;c;c=c.parent){let u=WM(c.type,n,i);if(u&&c.from<c.to){let d=VM(c);if(d&&(n>0?t>=d.from&&t<d.to:t>d.from&&t<=d.to))return uWe(e,t,n,c,d,u,i)}}return dWe(e,t,n,o,l.type,r,i)}function uWe(e,t,n,s,r,i,o){let l=s.parent,c={from:r.from,to:r.to},u=0,d=l==null?void 0:l.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=VM(d);return{start:c,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(WM(d.type,n,o))u++;else if(WM(d.type,-n,o)){if(u==0){let f=VM(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 dWe(e,t,n,s,r,i,o){if(n<0?!t:t==e.doc.length)return null;let l=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),c=o.indexOf(l);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,w=n>0?p.length:-1;b!=w;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 hWe=Object.create(null),zV=[Wu.none],FV=[],qV=Object.create(null),fWe=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"]])fWe[e]=mWe(hWe,t);function Aj(e,t){FV.indexOf(e)>-1||(FV.push(e),console.warn(t))}function mWe(e,t){let n=[];for(let l of t.split(" ")){let c=[];for(let u of l.split(".")){let d=e[u]||kn[u];d?typeof d=="function"?c.length?c=c.map(d):Aj(u,`Modifier ${u} used at start of tag`):c.length?Aj(u,`Tag ${u} used as modifier`):c=Array.isArray(d)?d:[d]:Aj(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(l=>l.id),i=qV[r];if(i)return i.id;let o=qV[r]=Wu.define({id:zV.length,name:s,props:[wUe({[s]:n})]});return zV.push(o),o.id}wi.RTL,wi.LTR;const pWe=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),s=xP(e.state,n.from);return s.line?gWe(e):s.block?yWe(e):!1};function wP(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 gWe=wP(xWe,0),bWe=wP(Tue,0),yWe=wP((e,t)=>Tue(e,t,wWe(t)),0);function xP(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const Uw=50;function vWe(e,{open:t,close:n},s,r){let i=e.sliceDoc(s-Uw,s),o=e.sliceDoc(r,r+Uw),l=/\s*$/.exec(i)[0].length,c=/^\s*/.exec(o)[0].length,u=i.length-l;if(i.slice(u-t.length,u)==t&&o.slice(c,c+n.length)==n)return{open:{pos:s-l,margin:l&&1},close:{pos:r+c,margin:c&&1}};let d,f;r-s<=2*Uw?d=f=e.sliceDoc(s,r):(d=e.sliceDoc(s,s+Uw),f=e.sliceDoc(r-Uw,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 wWe(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 Tue(e,t,n=t.selection.ranges){let s=n.map(i=>xP(t,i.from).block);if(!s.every(i=>i))return null;let r=n.map((i,o)=>vWe(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,l;o<r.length;o++)if(l=r[o]){let c=s[o],{open:u,close:d}=l;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 xWe(e,t,n=t.selection.ranges){let s=[],r=-1;e:for(let{from:i,to:o}of n){let l=s.length,c=1e9,u;for(let d=i;d<=o;){let f=t.doc.lineAt(d);if(u==null&&(u=xP(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=l;d<s.length;d++)s[d].indent<s[d].line.text.length&&(s[d].indent=c);s.length==l+1&&(s[l].single=!0)}if(e!=2&&s.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:l,token:c,indent:u,empty:d,single:f}of s)(f||!d)&&i.push({from:l.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:l,token:c}of s)if(l>=0){let u=o.from+l,d=u+c.length;o.text[d-o.from]==" "&&d++,i.push({from:u,to:d})}return{changes:i}}return null}const GM=hm.define(),kWe=hm.define(),_We=jn.define(),Eue=jn.define({combine(e){return Lh(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)})}}),Aue=ll.define({create(){return gh.empty},update(e,t){let n=t.state.facet(Eue),s=t.annotation(GM);if(s){let c=fc.fromTransaction(t,s.selection),u=s.side,d=u==0?e.undone:e.done;return c?d=v3(d,d.length,n.minDepth,c):d=Iue(d,t.startState.selection),new gh(u==0?s.rest:d,u==0?d:s.rest)}let r=t.annotation(kWe);if((r=="full"||r=="before")&&(e=e.isolate()),t.annotation(ha.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let i=fc.fromTransaction(t),o=t.annotation(ha.time),l=t.annotation(ha.userEvent);return i?e=e.addChanges(i,o,l,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,l,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 gh(e.done.map(fc.fromJSON),e.undone.map(fc.fromJSON))}});function kP(e={}){return[Aue,Eue.of(e),Yt.domEventHandlers({beforeinput(t,n){let s=t.inputType=="historyUndo"?jue:t.inputType=="historyRedo"?KM:null;return s?(t.preventDefault(),s(n)):!1}})]}function M6(e,t){return function({state:n,dispatch:s}){if(!t&&n.readOnly)return!1;let r=n.field(Aue,!1);if(!r)return!1;let i=r.pop(e,n,t);return i?(s(i),!0):!1}}const jue=M6(0,!1),KM=M6(1,!1),SWe=M6(0,!0),CWe=M6(1,!0);class fc{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 fc(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 fc(t.changes&&ua.fromJSON(t.changes),[],t.mapped&&wh.fromJSON(t.mapped),t.startSelection&&ht.fromJSON(t.startSelection),t.selectionsAfter.map(ht.fromJSON))}static fromTransaction(t,n){let s=Nu;for(let r of t.startState.facet(_We)){let i=r(t);i.length&&(s=s.concat(i))}return!s.length&&t.changes.empty?null:new fc(t.changes.invert(t.startState.doc),s,void 0,n||t.startState.selection,Nu)}static selection(t){return new fc(void 0,Nu,void 0,void 0,t)}}function v3(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 TWe(e,t){let n=[],s=!1;return e.iterChangedRanges((r,i)=>n.push(r,i)),t.iterChangedRanges((r,i,o,l)=>{for(let c=0;c<n.length;){let u=n[c++],d=n[c++];l>=u&&o<=d&&(s=!0)}}),s}function EWe(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,s)=>n.empty!=t.ranges[s].empty).length===0}function Nue(e,t){return e.length?t.length?e.concat(t):e:t}const Nu=[],AWe=200;function Iue(e,t){if(e.length){let n=e[e.length-1],s=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-AWe));return s.length&&s[s.length-1].eq(t)?e:(s.push(t),v3(e,e.length-1,1e9,n.setSelAfter(s)))}else return[fc.selection([t])]}function jWe(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 jj(e,t){if(!e.length)return e;let n=e.length,s=Nu;for(;n;){let r=NWe(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?[fc.selection(s)]:Nu}function NWe(e,t,n){let s=Nue(e.selectionsAfter.length?e.selectionsAfter.map(l=>l.map(t)):Nu,n);if(!e.changes)return fc.selection(s);let r=e.changes.map(t),i=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(i):i;return new fc(r,Ts.mapEffects(e.effects,t),o,e.startSelection.map(i),s)}const IWe=/^(input\.type|delete)($|\.)/;class gh{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 gh(this.done,this.undone):this}addChanges(t,n,s,r,i){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!s||IWe.test(s))&&(!l.selectionsAfter.length&&n-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,TWe(l.changes,t.changes))||s=="input.type.compose")?o=v3(o,o.length-1,r.minDepth,new fc(t.changes.compose(l.changes),Nue(Ts.mapEffects(t.effects,l.changes),l.effects),l.mapped,l.startSelection,Nu)):o=v3(o,o.length,r.minDepth,t),new gh(o,Nu,n,s)}addSelection(t,n,s,r){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:Nu;return i.length>0&&n-this.prevTime<r&&s==this.prevUserEvent&&s&&/^select($|\.)/.test(s)&&EWe(i[i.length-1],t)?this:new gh(Iue(this.done,t),this.undone,n,s)}addMapping(t){return new gh(jj(this.done,t),jj(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:GM.of({side:t,rest:jWe(r),selection:o}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let l=r.length==1?Nu:r.slice(0,r.length-1);return i.mapped&&(l=jj(l,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:GM.of({side:t,rest:l,selection:o}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}gh.empty=new gh(Nu,Nu);const _P=[{key:"Mod-z",run:jue,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:KM,preventDefault:!0},{linux:"Ctrl-Shift-z",run:KM,preventDefault:!0},{key:"Mod-u",run:SWe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:CWe,preventDefault:!0}];function Lv(e,t){return ht.create(e.ranges.map(t),e.mainIndex)}function Ed(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Ad({state:e,dispatch:t},n){let s=Lv(e.selection,n);return s.eq(e.selection,!0)?!1:(t(Ed(e,s)),!0)}function R6(e,t){return ht.cursor(t?e.to:e.from)}function Mue(e,t){return Ad(e,n=>n.empty?e.moveByChar(n,t):R6(n,t))}function Al(e){return e.textDirectionAt(e.state.selection.main.head)==wi.LTR}const Rue=e=>Mue(e,!Al(e)),Due=e=>Mue(e,Al(e));function Lue(e,t){return Ad(e,n=>n.empty?e.moveByGroup(n,t):R6(n,t))}const MWe=e=>Lue(e,!Al(e)),RWe=e=>Lue(e,Al(e));function DWe(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 D6(e,t,n){let s=_l(e).resolveInner(t.head),r=n?kr.closedBy:kr.openedBy;for(let c=t.head;;){let u=n?s.childAfter(c):s.childBefore(c);if(!u)break;DWe(e,u,r)?s=u:c=n?u.to:u.from}let i=s.type.prop(r),o,l;return i&&(o=n?ph(e,s.from,1):ph(e,s.to,-1))&&o.matched?l=n?o.end.to:o.end.from:l=n?s.to:s.from,ht.cursor(l,n?-1:1)}const LWe=e=>Ad(e,t=>D6(e.state,t,!Al(e))),PWe=e=>Ad(e,t=>D6(e.state,t,Al(e)));function Pue(e,t){return Ad(e,n=>{if(!n.empty)return R6(n,t);let s=e.moveVertically(n,t);return s.head!=n.head?s:e.moveToLineBoundary(n,t)})}const Oue=e=>Pue(e,!1),$ue=e=>Pue(e,!0);function Bue(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,s=0,r;if(t){for(let i of e.state.facet(Yt.scrollMargins)){let o=i(e);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(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 zue(e,t){let n=Bue(e),{state:s}=e,r=Lv(s.selection,o=>o.empty?e.moveVertically(o,t,n.height):R6(o,t));if(r.eq(s.selection))return!1;let i;if(n.selfScroll){let o=e.coordsAtPos(s.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),c=l.top+n.marginTop,u=l.bottom-n.marginBottom;o&&o.top>c&&o.bottom<u&&(i=Yt.scrollIntoView(r.main.head,{y:"start",yMargin:o.top-c}))}return e.dispatch(Ed(s,r),{effects:i}),!0}const HV=e=>zue(e,!1),YM=e=>zue(e,!0);function x0(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=ht.cursor(s.from+i))}return r}const OWe=e=>Ad(e,t=>x0(e,t,!0)),$We=e=>Ad(e,t=>x0(e,t,!1)),BWe=e=>Ad(e,t=>x0(e,t,!Al(e))),zWe=e=>Ad(e,t=>x0(e,t,Al(e))),FWe=e=>Ad(e,t=>ht.cursor(e.lineBlockAt(t.head).from,1)),qWe=e=>Ad(e,t=>ht.cursor(e.lineBlockAt(t.head).to,-1));function HWe(e,t,n){let s=!1,r=Lv(e.selection,i=>{let o=ph(e,i.head,-1)||ph(e,i.head,1)||i.head>0&&ph(e,i.head-1,1)||i.head<e.doc.length&&ph(e,i.head+1,-1);if(!o||!o.end)return i;s=!0;let l=o.start.from==i.head?o.end.to:o.end.from;return ht.cursor(l)});return s?(t(Ed(e,r)),!0):!1}const UWe=({state:e,dispatch:t})=>HWe(e,t);function Ku(e,t){let n=Lv(e.state.selection,s=>{let r=t(s);return ht.range(s.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(Ed(e.state,n)),!0)}function Fue(e,t){return Ku(e,n=>e.moveByChar(n,t))}const que=e=>Fue(e,!Al(e)),Hue=e=>Fue(e,Al(e));function Uue(e,t){return Ku(e,n=>e.moveByGroup(n,t))}const WWe=e=>Uue(e,!Al(e)),VWe=e=>Uue(e,Al(e)),GWe=e=>Ku(e,t=>D6(e.state,t,!Al(e))),KWe=e=>Ku(e,t=>D6(e.state,t,Al(e)));function Wue(e,t){return Ku(e,n=>e.moveVertically(n,t))}const Vue=e=>Wue(e,!1),Gue=e=>Wue(e,!0);function Kue(e,t){return Ku(e,n=>e.moveVertically(n,t,Bue(e).height))}const UV=e=>Kue(e,!1),WV=e=>Kue(e,!0),YWe=e=>Ku(e,t=>x0(e,t,!0)),XWe=e=>Ku(e,t=>x0(e,t,!1)),QWe=e=>Ku(e,t=>x0(e,t,!Al(e))),JWe=e=>Ku(e,t=>x0(e,t,Al(e))),ZWe=e=>Ku(e,t=>ht.cursor(e.lineBlockAt(t.head).from)),eVe=e=>Ku(e,t=>ht.cursor(e.lineBlockAt(t.head).to)),VV=({state:e,dispatch:t})=>(t(Ed(e,{anchor:0})),!0),GV=({state:e,dispatch:t})=>(t(Ed(e,{anchor:e.doc.length})),!0),KV=({state:e,dispatch:t})=>(t(Ed(e,{anchor:e.selection.main.anchor,head:0})),!0),YV=({state:e,dispatch:t})=>(t(Ed(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),tVe=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),nVe=({state:e,dispatch:t})=>{let n=L6(e).map(({from:s,to:r})=>ht.range(s,Math.min(r+1,e.doc.length)));return t(e.update({selection:ht.create(n),userEvent:"select"})),!0},sVe=({state:e,dispatch:t})=>{let n=Lv(e.selection,s=>{let r=_l(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:l}=o;if((l.from<s.from&&l.to>=s.to||l.to>s.to&&l.from<=s.from)&&o.next)return ht.range(l.to,l.from)}return s});return n.eq(e.selection)?!1:(t(Ed(e,n)),!0)};function Yue(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 l=i;;){let c=e.moveVertically(l,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==l.head)break;l=c}}}return r.length==s.ranges.length?!1:(e.dispatch(Ed(n,ht.create(r,r.length-1))),!0)}const rVe=e=>Yue(e,!1),iVe=e=>Yue(e,!0),oVe=({state:e,dispatch:t})=>{let n=e.selection,s=null;return n.ranges.length>1?s=ht.create([n.main]):n.main.empty||(s=ht.create([ht.cursor(n.main.head)])),s?(t(Ed(e,s)),!0):!1};function Y_(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:s}=e,r=s.changeByRange(i=>{let{from:o,to:l}=i;if(o==l){let c=t(i);c<o?(n="delete.backward",c=hC(e,c,!1)):c>o&&(n="delete.forward",c=hC(e,c,!0)),o=Math.min(o,c),l=Math.max(l,c)}else o=hC(e,o,!1),l=hC(e,l,!0);return o==l?{range:i}:{changes:{from:o,to:l},range:ht.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"?Yt.announce.of(s.phrase("Selection deleted")):void 0})),!0)}function hC(e,t,n){if(e instanceof Yt)for(let s of e.state.facet(Yt.atomicRanges).map(r=>r(e)))s.between(t,t,(r,i)=>{r<t&&i>t&&(t=n?i:r)});return t}const Xue=(e,t,n)=>Y_(e,s=>{let r=s.from,{state:i}=e,o=i.doc.lineAt(r),l,c;if(n&&!t&&r>o.from&&r<o.from+200&&!/[^ \t]/.test(l=o.text.slice(0,r-o.from))){if(l[l.length-1]=="	")return r-1;let u=Dv(l,i.tabSize),d=u%g3(i)||g3(i);for(let f=0;f<d&&l[l.length-1-f]==" ";f++)r--;c=r}else c=Oa(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=Oa(o.text,c-o.from,!1,!1)+o.from);return c}),XM=e=>Xue(e,!1,!0),Que=e=>Xue(e,!0,!1),Jue=(e,t)=>Y_(e,n=>{let s=n.head,{state:r}=e,i=r.doc.lineAt(s),o=r.charCategorizer(s);for(let l=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=Oa(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(l!=null&&d!=l)break;(u!=" "||s!=n.head)&&(l=d),s=c}return s}),Zue=e=>Jue(e,!1),aVe=e=>Jue(e,!0),lVe=e=>Y_(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),cVe=e=>Y_(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),uVe=e=>Y_(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),dVe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(s=>({changes:{from:s.from,to:s.to,insert:Ir.of(["",""])},range:ht.cursor(s.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},hVe=({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:Oa(i.text,r-i.from,!1)+i.from,l=r==i.to?r+1:Oa(i.text,r-i.from,!0)+i.from;return{changes:{from:o,to:l,insert:e.doc.slice(r,l).append(e.doc.slice(o,r))},range:ht.cursor(l)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function L6(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 ede(e,t,n){if(e.readOnly)return!1;let s=[],r=[];for(let i of L6(e)){if(n?i.to==e.doc.length:i.from==0)continue;let o=e.doc.lineAt(n?i.to+1:i.from-1),l=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(ht.range(Math.min(e.doc.length,c.anchor+l),Math.min(e.doc.length,c.head+l)))}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(ht.range(c.anchor-l,c.head-l))}}return s.length?(t(e.update({changes:s,scrollIntoView:!0,selection:ht.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const fVe=({state:e,dispatch:t})=>ede(e,t,!1),mVe=({state:e,dispatch:t})=>ede(e,t,!0);function tde(e,t,n){if(e.readOnly)return!1;let s=[];for(let i of L6(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 pVe=({state:e,dispatch:t})=>tde(e,t,!1),gVe=({state:e,dispatch:t})=>tde(e,t,!0),bVe=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(L6(t).map(({from:r,to:i})=>(r>0?r--:i<t.doc.length&&i++,{from:r,to:i}))),s=Lv(t.selection,r=>{let i;if(e.lineWrapping){let o=e.lineBlockAt(r.head),l=e.coordsAtPos(r.head,r.assoc||1);l&&(i=o.bottom+e.documentTop-l.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 yVe(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=_l(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(kr.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 XV=nde(!1),vVe=nde(!0);function nde(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let s=t.changeByRange(r=>{let{from:i,to:o}=r,l=t.doc.lineAt(i),c=!e&&i==o&&yVe(t,i);e&&(i=o=(o<=l.to?l:t.doc.lineAt(o)).to);let u=new j6(t,{simulateBreak:i,simulateDoubleBreak:!!c}),d=yP(u,i);for(d==null&&(d=Dv(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.tabSize));o<l.to&&/\s/.test(l.text[o-l.from]);)o++;c?{from:i,to:o}=c:i>l.from&&i<l.from+100&&!/\S/.test(l.text.slice(0,i))&&(i=l.from);let f=["",Qk(t,d)];return c&&f.push(Qk(t,u.lineIndent(l.from,-1))),{changes:{from:i,to:o,insert:Ir.of(f)},range:ht.cursor(i+1+f[1].length)}});return n(t.update(s,{scrollIntoView:!0,userEvent:"input"})),!0}}function SP(e,t){let n=-1;return e.changeByRange(s=>{let r=[];for(let o=s.from;o<=s.to;){let l=e.doc.lineAt(o);l.number>n&&(s.empty||s.to>l.from)&&(t(l,r,s),n=l.number),o=l.to+1}let i=e.changes(r);return{changes:r,range:ht.range(i.mapPos(s.anchor,1),i.mapPos(s.head,1))}})}const wVe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),s=new j6(e,{overrideIndentation:i=>{let o=n[i];return o??-1}}),r=SP(e,(i,o,l)=>{let c=yP(s,i.from);if(c==null)return;/\S/.test(i.text)||(c=0);let u=/^\s*/.exec(i.text)[0],d=Qk(e,c);(u!=d||l.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},xVe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(SP(e,(n,s)=>{s.push({from:n.from,insert:e.facet(bP)})}),{userEvent:"input.indent"})),!0),kVe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(SP(e,(n,s)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let i=Dv(r,e.tabSize),o=0,l=Qk(e,Math.max(0,i-g3(e)));for(;o<r.length&&o<l.length&&r.charCodeAt(o)==l.charCodeAt(o);)o++;s.push({from:n.from+o,to:n.from+r.length,insert:l.slice(o)})}),{userEvent:"delete.dedent"})),!0),_Ve=e=>(e.setTabFocusMode(),!0),SVe=[{key:"Ctrl-b",run:Rue,shift:que,preventDefault:!0},{key:"Ctrl-f",run:Due,shift:Hue},{key:"Ctrl-p",run:Oue,shift:Vue},{key:"Ctrl-n",run:$ue,shift:Gue},{key:"Ctrl-a",run:FWe,shift:ZWe},{key:"Ctrl-e",run:qWe,shift:eVe},{key:"Ctrl-d",run:Que},{key:"Ctrl-h",run:XM},{key:"Ctrl-k",run:lVe},{key:"Ctrl-Alt-h",run:Zue},{key:"Ctrl-o",run:dVe},{key:"Ctrl-t",run:hVe},{key:"Ctrl-v",run:YM}],CVe=[{key:"ArrowLeft",run:Rue,shift:que,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:MWe,shift:WWe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:BWe,shift:QWe,preventDefault:!0},{key:"ArrowRight",run:Due,shift:Hue,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:RWe,shift:VWe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:zWe,shift:JWe,preventDefault:!0},{key:"ArrowUp",run:Oue,shift:Vue,preventDefault:!0},{mac:"Cmd-ArrowUp",run:VV,shift:KV},{mac:"Ctrl-ArrowUp",run:HV,shift:UV},{key:"ArrowDown",run:$ue,shift:Gue,preventDefault:!0},{mac:"Cmd-ArrowDown",run:GV,shift:YV},{mac:"Ctrl-ArrowDown",run:YM,shift:WV},{key:"PageUp",run:HV,shift:UV},{key:"PageDown",run:YM,shift:WV},{key:"Home",run:$We,shift:XWe,preventDefault:!0},{key:"Mod-Home",run:VV,shift:KV},{key:"End",run:OWe,shift:YWe,preventDefault:!0},{key:"Mod-End",run:GV,shift:YV},{key:"Enter",run:XV,shift:XV},{key:"Mod-a",run:tVe},{key:"Backspace",run:XM,shift:XM,preventDefault:!0},{key:"Delete",run:Que,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Zue,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:aVe,preventDefault:!0},{mac:"Mod-Backspace",run:cVe,preventDefault:!0},{mac:"Mod-Delete",run:uVe,preventDefault:!0}].concat(SVe.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),CP=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:LWe,shift:GWe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:PWe,shift:KWe},{key:"Alt-ArrowUp",run:fVe},{key:"Shift-Alt-ArrowUp",run:pVe},{key:"Alt-ArrowDown",run:mVe},{key:"Shift-Alt-ArrowDown",run:gVe},{key:"Mod-Alt-ArrowUp",run:rVe},{key:"Mod-Alt-ArrowDown",run:iVe},{key:"Escape",run:oVe},{key:"Mod-Enter",run:vVe},{key:"Alt-l",mac:"Ctrl-l",run:nVe},{key:"Mod-i",run:sVe,preventDefault:!0},{key:"Mod-[",run:kVe},{key:"Mod-]",run:xVe},{key:"Mod-Alt-\\",run:wVe},{key:"Shift-Mod-k",run:bVe},{key:"Shift-Mod-\\",run:UWe},{key:"Mod-/",run:pWe},{key:"Alt-A",run:bWe},{key:"Ctrl-m",mac:"Shift-Alt-m",run:_Ve}].concat(CVe);class sde{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=_l(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(rde(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 QV(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 TVe(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=QV(t)+QV(n)+"*$";return[new RegExp("^"+s),new RegExp(s)]}function EVe(e){let t=e.map(r=>typeof r=="string"?{label:r}:r),[n,s]=t.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:TVe(t);return r=>{let i=r.matchBefore(s);return i||r.explicit?{from:i?i.from:r.pos,options:t,validFor:n}:null}}class JV{constructor(t,n,s,r){this.completion=t,this.source=n,this.match=s,this.score=r}}function Og(e){return e.selection.main.from}function rde(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 ide=hm.define();function AVe(e,t,n,s){let{main:r}=e.selection,i=n-r.from,o=s-r.from;return{...e.changeByRange(l=>{if(l!=r&&n!=s&&e.sliceDoc(l.from+i,l.from+o)!=e.sliceDoc(n,s))return{range:l};let c=e.toText(t);return{changes:{from:l.from+i,to:s==r.from?l.to:l.from+o,insert:c},range:ht.cursor(l.from+i+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const ZV=new WeakMap;function jVe(e){if(!Array.isArray(e))return e;let t=ZV.get(e);return t||ZV.set(e,t=EVe(e)),t}const w3=Ts.define(),Jk=Ts.define();class NVe{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=cc(t,n),r=oh(s);this.chars.push(s);let i=t.slice(n,n+r),o=i.toUpperCase();this.folded.push(cc(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 v=cc(t,0),x=oh(v),k=x==t.length?0:-100;if(v!=n[0])if(v==s[0])k+=-200;else return null;return this.ret(k,[0,x])}let l=t.indexOf(this.pattern);if(l==0)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let c=n.length,u=0;if(l<0){for(let v=0,x=Math.min(t.length,200);v<x&&u<c;){let k=cc(t,v);(k==n[u]||k==s[u])&&(r[u++]=v),v+=oh(k)}if(u<c)return null}let d=0,f=0,m=!1,p=0,g=-1,b=-1,w=/[a-z]/.test(t),y=!0;for(let v=0,x=Math.min(t.length,200),k=0;v<x&&f<c;){let _=cc(t,v);l<0&&(d<c&&_==n[d]&&(i[d++]=v),p<c&&(_==n[p]||_==s[p]?(p==0&&(g=v),b=v+1,p++):p=0));let T,S=_<255?_>=48&&_<=57||_>=97&&_<=122?2:_>=65&&_<=90?1:0:(T=YL(_))!=T.toLowerCase()?1:T!=T.toUpperCase()?2:0;(!v||S==1&&w||k==0&&S!=0)&&(n[f]==_||s[f]==_&&(m=!0)?o[f++]=v:o.length&&(y=!1)),k=S,v+=oh(_)}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]):l>-1?this.ret(-700-t.length,[l,l+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 l=o+(this.astral?oh(cc(s,o)):1);i&&r[i-1]==o?r[i-1]=l:(r[i++]=o,r[i++]=l)}return this.ret(t-s.length,r)}}class IVe{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 Pa=jn.define({combine(e){return Lh(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:MVe,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=>eG(t(s),n(s)),optionClass:(t,n)=>s=>eG(t(s),n(s)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function eG(e,t){return e?t?e+" "+t:e:t}function MVe(e,t,n,s,r,i){let o=e.textDirection==wi.RTL,l=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(l&&m<Math.min(g,p)?l=!1:!l&&p<Math.min(g,m)&&(l=!0),g<=(l?m:p))d=Math.max(r.top,Math.min(n.top,r.bottom-b))-t.top,f=Math.min(400,l?m:p);else{c=!0,f=Math.min(400,(o?t.right:r.right-t.left)-30);let v=r.bottom-t.bottom;v>=b||v>t.top?d=n.bottom-t.top:(u="bottom",d=t.bottom-n.top)}let w=(t.bottom-t.top)/i.offsetHeight,y=(t.right-t.left)/i.offsetWidth;return{style:`${u}: ${d/w}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(c?o?"left-narrow":"right-narrow":l?"left":"right")}}const TP=Ts.define();function RVe(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 l=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(l.slice(c,d)));let m=o.appendChild(document.createElement("span"));m.appendChild(document.createTextNode(l.slice(d,f))),m.className="cm-completionMatchedText",c=f}return c<l.length&&o.appendChild(document.createTextNode(l.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 Nj(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 DVe{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,l=t.state.facet(Pa);this.optionContent=RVe(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=Nj(i.length,o,l.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:TP.of(d)}),c.preventDefault())}}),this.dom.addEventListener("focusout",c=>{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet(Pa).closeOnBlur&&c.relatedTarget!=t.contentDOM&&t.dispatch({effects:Jk.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:l}=s.open;(!r.open||r.open.options!=i)&&(this.range=Nj(i.length,o,t.state.facet(Pa).maxRenderedOptions),this.showOptions(i,s.id)),this.updateSel(),l!=((n=r.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}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=Nj(n.options.length,n.selected,this.view.state.facet(Pa).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(l=>{l&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(l,r)}).catch(l=>hc(this.view.state,l,"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&&PVe(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(Pa).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:l,match:c}=t[o],{section:u}=l;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(l);f&&(d.className=f);for(let m of this.optionContent){let p=m(l,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 LVe(e,t){return n=>new DVe(n,e,t)}function PVe(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 tG(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function OVe(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(Pa);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 JV(m,d.source,f?f(m):[],1e9-n.length));else{let m=t.sliceDoc(d.from,d.to),p,g=o.filterStrict?new IVe(m):new NVe(m);for(let b of d.result.options)if(p=g.match(b.label)){let w=b.displayLabel?f?f(b,p.matched):[]:p.matched,y=p.score+(b.boost||0);if(i(new JV(b,d.source,w,y)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:v}=b.section;r||(r=Object.create(null)),r[v]=Math.max(y,r[v]||-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 l=[],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?l.push(d):tG(d.completion)>tG(c)&&(l[l.length-1]=d),c=d.completion}return l}class Ub{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 Ub(this.options,nG(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 l=OVe(t,n);if(!l.length)return r&&t.some(u=>u.isPending)?r.setDisabled():null;let c=n.facet(Pa).selectOnOpen?0:-1;if(r&&r.selected!=c&&r.selected!=-1){let u=r.options[r.selected].completion;for(let d=0;d<l.length;d++)if(l[d].completion==u){c=d;break}}return new Ub(l,nG(s,c),{pos:t.reduce((u,d)=>d.hasResult()?Math.min(u,d.from):u,1e8),create:HVe,above:i.aboveCursor},r?r.timestamp:Date.now(),c,!1)}map(t){return new Ub(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Ub(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class x3{constructor(t,n,s){this.active=t,this.id=n,this.open=s}static start(){return new x3(FVe,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,s=n.facet(Pa),i=(s.override||n.languageDataAt("autocomplete",Og(n)).map(jVe)).map(c=>(this.active.find(d=>d.source==c)||new Iu(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,l=t.effects.some(c=>c.is(EP));o&&t.docChanged&&(o=o.map(t.changes)),t.selection||i.some(c=>c.hasResult()&&t.changes.touchesRange(c.from,c.to))||!$Ve(i,this.active)||l?o=Ub.build(i,n,this.id,o,s,l):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 Iu(c.source,0):c));for(let c of t.effects)c.is(TP)&&(o=o&&o.setSelected(c.value,this.id));return i==this.active&&o==this.open?this:new x3(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?BVe:zVe}}function $Ve(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 BVe={"aria-autocomplete":"list"},zVe={};function nG(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const FVe=[];function ode(e,t){if(e.isUserEvent("input.complete")){let s=e.annotation(ide);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 Iu{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=ode(t,n),r=this;(s&8||s&16&&this.touches(t))&&(r=new Iu(r.source,0)),s&4&&r.state==0&&(r=new Iu(this.source,1)),r=r.updateFor(t,s);for(let i of t.effects)if(i.is(w3))r=new Iu(r.source,1,i.value);else if(i.is(Jk))r=new Iu(r.source,0);else if(i.is(EP))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(Og(t.state))}}class my extends Iu{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),l=Og(t.state);if(l>o||!r||n&2&&(Og(t.startState)==this.from||l<this.limit))return new Iu(this.source,n&4?1:0);let c=t.changes.mapPos(this.limit);return qVe(r.validFor,t.state,i,o)?new my(this.source,this.explicit,c,r,i,o):r.update&&(r=r.update(r,i,o,new sde(t.state,l,!1)))?new my(this.source,this.explicit,c,r,r.from,(s=r.to)!==null&&s!==void 0?s:Og(t.state)):new Iu(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 my(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new Iu(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function qVe(e,t,n,s){if(!e)return!1;let r=t.sliceDoc(n,s);return typeof e=="function"?e(r,n,s,t):rde(e,!0).test(r)}const EP=Ts.define({map(e,t){return e.map(n=>n.map(t))}}),$l=ll.define({create(){return x3.start()},update(e,t){return e.update(t)},provide:e=>[hP.from(e,t=>t.tooltip),Yt.contentAttributes.from(e,t=>t.attrs)]});function AP(e,t){const n=t.completion.apply||t.completion.label;let s=e.state.field($l).active.find(r=>r.source==t.source);return s instanceof my?(typeof n=="string"?e.dispatch({...AVe(e.state,n,s.from,s.to),annotations:ide.of(t.completion)}):n(e,t.completion,s.from,s.to),!0):!1}const HVe=LVe($l,AP);function cp(e,t="option"){return n=>{let s=n.state.field($l,!1);if(!s||!s.open||s.open.disabled||Date.now()-s.open.timestamp<n.state.facet(Pa).interactionDelay)return!1;let r=1,i;t=="page"&&(i=eue(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,l=s.open.selected>-1?s.open.selected+r*(e?1:-1):e?0:o-1;return l<0?l=t=="page"?0:o-1:l>=o&&(l=t=="page"?o-1:0),n.dispatch({effects:TP.of(l)}),!0}}const ade=e=>{let t=e.state.field($l,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(Pa).interactionDelay?!1:AP(e,t.open.options[t.open.selected])},E4=e=>e.state.field($l,!1)?(e.dispatch({effects:w3.of(!0)}),!0):!1,A4=e=>{let t=e.state.field($l,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:Jk.of(null)}),!0)};class UVe{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const WVe=50,VVe=1e3,GVe=Wi.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($l).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field($l),n=e.state.facet(Pa);if(!e.selectionSet&&!e.docChanged&&e.startState.field($l)==t)return;let s=e.transactions.some(i=>{let o=ode(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>WVe&&Date.now()-o.time>VVe){for(let l of o.context.abortListeners)try{l()}catch(c){hc(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(w3)))&&(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($l);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(Pa).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=Og(t),s=new sde(t,n,e.explicit,this.view),r=new UVe(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:Jk.of(null)}),hc(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(Pa).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Pa),s=this.view.state.field($l);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 l=Og(i.updates.length?i.updates[0].startState:this.view.state),c=Math.min(l,i.done.from+(i.active.explicit?0:1)),u=new my(i.active.source,i.active.explicit,c,i.done,i.done.from,(e=i.done.to)!==null&&e!==void 0?e:l);for(let d of i.updates)u=u.update(d,n);if(u.hasResult()){t.push(u);continue}}let o=s.active.find(l=>l.source==i.active.source);if(o&&o.isPending)if(i.done==null){let l=new Iu(i.active.source,0);for(let c of i.updates)l=l.update(c,n);l.isPending||t.push(l)}else this.startQuery(o)}(t.length||s.open&&s.open.disabled)&&this.view.dispatch({effects:EP.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field($l,!1);if(t&&t.tooltip&&this.view.state.facet(Pa).closeOnBlur){let n=t.open&&eue(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Jk.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:w3.of(!1)}),20),this.composing=0}}}),KVe=typeof navigator=="object"&&/Win/.test(navigator.platform),YVe=w0.highest(Yt.domEventHandlers({keydown(e,t){let n=t.state.field($l,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(KVe&&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&&AP(t,s),!1}})),XVe=Yt.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Zk={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Cg=Ts.define({map(e,t){let n=t.mapPos(e,-1,Fl.TrackAfter);return n??void 0}}),jP=new class extends Kp{};jP.startSide=1;jP.endSide=-1;const lde=ll.define({create(){return ur.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(Cg)&&(e=e.update({add:[jP.range(n.value,n.value+1)]}));return e}});function QVe(){return[ZVe,lde]}const Ij="()[]{}<>«»»«［］｛｝";function cde(e){for(let t=0;t<Ij.length;t+=2)if(Ij.charCodeAt(t)==e)return Ij.charAt(t+1);return YL(e<128?e:e+1)}function ude(e,t){return e.languageDataAt("closeBrackets",t)[0]||Zk}const JVe=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),ZVe=Yt.inputHandler.of((e,t,n,s)=>{if((JVe?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let r=e.state.selection.main;if(s.length>2||s.length==2&&oh(cc(s,0))==1||t!=r.from||n!=r.to)return!1;let i=nGe(e.state,s);return i?(e.dispatch(i),!0):!1}),eGe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let s=ude(e,e.selection.main.head).brackets||Zk.brackets,r=null,i=e.changeByRange(o=>{if(o.empty){let l=sGe(e.doc,o.head);for(let c of s)if(c==l&&P6(e.doc,o.head)==cde(cc(c,0)))return{changes:{from:o.head-c.length,to:o.head+c.length},range:ht.cursor(o.head-c.length)}}return{range:r=o}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},tGe=[{key:"Backspace",run:eGe}];function nGe(e,t){let n=ude(e,e.selection.main.head),s=n.brackets||Zk.brackets;for(let r of s){let i=cde(cc(r,0));if(t==r)return i==r?oGe(e,r,s.indexOf(r+r+r)>-1,n):rGe(e,r,i,n.before||Zk.before);if(t==i&&dde(e,e.selection.main.from))return iGe(e,r,i)}return null}function dde(e,t){let n=!1;return e.field(lde).between(0,e.doc.length,s=>{s==t&&(n=!0)}),n}function P6(e,t){let n=e.sliceString(t,t+2);return n.slice(0,oh(cc(n,0)))}function sGe(e,t){let n=e.sliceString(t-2,t);return oh(cc(n,0))==n.length?n:n.slice(1)}function rGe(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:Cg.of(o.to+t.length),range:ht.range(o.anchor+t.length,o.head+t.length)};let l=P6(e.doc,o.head);return!l||/\s/.test(l)||s.indexOf(l)>-1?{changes:{insert:t+n,from:o.head},effects:Cg.of(o.head+t.length),range:ht.cursor(o.head+t.length)}:{range:r=o}});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function iGe(e,t,n){let s=null,r=e.changeByRange(i=>i.empty&&P6(e.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:ht.cursor(i.head+n.length)}:s={range:i});return s?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function oGe(e,t,n,s){let r=s.stringPrefixes||Zk.stringPrefixes,i=null,o=e.changeByRange(l=>{if(!l.empty)return{changes:[{insert:t,from:l.from},{insert:t,from:l.to}],effects:Cg.of(l.to+t.length),range:ht.range(l.anchor+t.length,l.head+t.length)};let c=l.head,u=P6(e.doc,c),d;if(u==t){if(sG(e,c))return{changes:{insert:t+t,from:c},effects:Cg.of(c+t.length),range:ht.cursor(c+t.length)};if(dde(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:ht.cursor(c+m.length)}}}else{if(n&&e.sliceDoc(c-2*t.length,c)==t+t&&(d=rG(e,c-2*t.length,r))>-1&&sG(e,d))return{changes:{insert:t+t+t+t,from:c},effects:Cg.of(c+t.length),range:ht.cursor(c+t.length)};if(e.charCategorizer(c)(u)!=Hi.Word&&rG(e,c,r)>-1&&!aGe(e,c,t,r))return{changes:{insert:t+t,from:c},effects:Cg.of(c+t.length),range:ht.cursor(c+t.length)}}return{range:i=l}});return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function sG(e,t){let n=_l(e).resolveInner(t+1);return n.parent&&n.from==t}function aGe(e,t,n,s){let r=_l(e).resolveInner(t,-1),i=s.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=e.sliceDoc(r.from,Math.min(r.to,r.from+n.length+i)),c=l.indexOf(n);if(!c||c>-1&&s.indexOf(l.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 rG(e,t,n){let s=e.charCategorizer(t);if(s(e.sliceDoc(t-1,t))!=Hi.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))!=Hi.Word)return i}return-1}function hde(e={}){return[YVe,$l,Pa.of(e),GVe,lGe,XVe]}const fde=[{key:"Ctrl-Space",run:E4},{mac:"Alt-`",run:E4},{mac:"Alt-i",run:E4},{key:"Escape",run:A4},{key:"ArrowDown",run:cp(!0)},{key:"ArrowUp",run:cp(!1)},{key:"PageDown",run:cp(!0,"page")},{key:"PageUp",run:cp(!1,"page")},{key:"Enter",run:ade}],lGe=w0.highest(Uy.computeN([Pa],e=>e.facet(Pa).defaultKeymap?[fde]:[]));function Ac(e){let t=e.field($l,!1);return t&&t.active.some(n=>n.isPending)?"pending":t&&t.active.some(n=>n.state!=0)?"active":null}const iG=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class Gy{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?l=>i(iG(l)):iG,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 cc(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=YL(t),s=this.bufferStart+this.bufferPos;this.bufferPos+=oh(t);let r=this.normalize(n);if(r.length)for(let i=0,o=s,l=!0;;i++){let c=r.charCodeAt(i),u=this.match(c,o,l,this.bufferPos+this.bufferStart,i==r.length-1);if(u)return this.value=u,this;if(i==r.length-1)break;l&&i<n.length&&n.charCodeAt(i)==c?o++:l=!1}}}match(t,n,s,r,i){let o=null;for(let l=0;l<this.matches.length;){let c=this.matches[l],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?l++:this.matches.splice(l,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"&&(Gy.prototype[Symbol.iterator]=function(){return this});const mde={from:-1,to:-1,match:/.*/.exec(""),precise:!0},NP="gm"+(/x/.unicode==null?"":"u");class pde{constructor(t,n,s,r=0,i=t.length){if(this.text=t,this.to=i,this.curLine="",this.done=!1,this.value=mde,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new gde(t,n,s,r,i);this.re=new RegExp(n,NP+(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=k3(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=k3(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 Mj=new WeakMap;class py{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,s){let r=Mj.get(t);if(!r||r.from>=s||r.to<=n){let l=new py(n,t.sliceString(n,s));return Mj.set(t,l),l}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)),Mj.set(t,new py(o,i)),new py(n,i.slice(n-o,s-o))}}class gde{constructor(t,n,s,r,i){this.text=t,this.to=i,this.done=!1,this.value=mde,this.matchPos=k3(t,r),this.re=new RegExp(n,NP+(s!=null&&s.ignoreCase?"i":"")),this.test=s==null?void 0:s.test,this.flat=py.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=k3(this.text,r+(s==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=py.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(pde.prototype[Symbol.iterator]=gde.prototype[Symbol.iterator]=function(){return this});function cGe(e){try{return new RegExp(e,NP),!0}catch{return!1}}function k3(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 uGe=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:s,result:r}=VHe(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 l=t.doc.lineAt(t.selection.main.head),[,c,u,d,f]=o,m=d?+d.slice(1):0,p=u?+u:l.number;if(u&&f){let w=p/100;c&&(w=w*(c=="-"?-1:1)+l.number/t.doc.lines),p=Math.round(t.doc.lines*w)}else u&&c&&(p=p*(c=="-"?-1:1)+l.number);let g=t.doc.line(Math.max(1,Math.min(t.doc.lines,p))),b=ht.cursor(g.from+Math.max(0,Math.min(m,g.length)));e.dispatch({effects:[s,Yt.scrollIntoView(b.from,{y:"center"})],selection:b})}),!0},dGe={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},hGe=jn.define({combine(e){return Lh(e,dGe,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function fGe(e){return[yGe,bGe]}const mGe=Hn.mark({class:"cm-selectionMatch"}),pGe=Hn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function oG(e,t,n,s){return(n==0||e(t.sliceDoc(n-1,n))!=Hi.Word)&&(s==t.doc.length||e(t.sliceDoc(s,s+1))!=Hi.Word)}function gGe(e,t,n,s){return e(t.sliceDoc(n,n+1))==Hi.Word&&e(t.sliceDoc(s-1,s))==Hi.Word}const bGe=Wi.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(hGe),{state:n}=e,s=n.selection;if(s.ranges.length>1)return Hn.none;let r=s.main,i,o=null;if(r.empty){if(!t.highlightWordAroundCursor)return Hn.none;let c=n.wordAt(r.head);if(!c)return Hn.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 Hn.none;if(t.wholeWords){if(i=n.sliceDoc(r.from,r.to),o=n.charCategorizer(r.head),!(oG(o,n,r.from,r.to)&&gGe(o,n,r.from,r.to)))return Hn.none}else if(i=n.sliceDoc(r.from,r.to),!i)return Hn.none}let l=[];for(let c of e.visibleRanges){let u=new Gy(n.doc,i,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!o||oG(o,n,d,f))&&(r.empty&&d<=r.from&&f>=r.to?l.push(pGe.range(d,f)):(d>=r.to||f<=r.from)&&l.push(mGe.range(d,f)),l.length>t.maxMatches))return Hn.none}}return Hn.set(l)}},{decorations:e=>e.decorations}),yGe=Yt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),vGe=({state:e,dispatch:t})=>{let{selection:n}=e,s=ht.create(n.ranges.map(r=>e.wordAt(r.head)||ht.cursor(r.head)),n.mainIndex);return s.eq(n)?!1:(t(e.update({selection:s})),!0)};function wGe(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,l=new Gy(e.doc,t,s[s.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new Gy(e.doc,t,0,Math.max(0,s[s.length-1].from-1)),o=!0}else{if(o&&s.some(c=>c.from==l.value.from))continue;if(i){let c=e.wordAt(l.value.from);if(!c||c.from!=l.value.from||c.to!=l.value.to)continue}return l.value}}const xGe=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(i=>i.from===i.to))return vGe({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=wGe(e,s);return r?(t(e.update({selection:e.selection.addRange(ht.range(r.from,r.to),!1),effects:Yt.scrollIntoView(r.to)})),!0):!1},Pv=jn.define({combine(e){return Lh(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new LGe(t),scrollToMatch:t=>Yt.scrollIntoView(t)})}});class bde{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||cGe(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 EGe(this):new SGe(this)}getCursor(t,n=0,s){let r=t.doc?t:wr.create({doc:t});return s==null&&(s=r.doc.length),this.regexp?Tb(this,r,n,s):Cb(this,r,n,s)}}class yde{constructor(t){this.spec=t}}function kGe(e,t,n){return(s,r,i,o)=>{if(n&&!n(s,r,i,o))return!1;let l=s>=o&&r<=o+i.length?i.slice(s-o,r-o):t.doc.sliceString(s,r);return e(l,t,s,r)}}function Cb(e,t,n,s){let r;return e.wholeWord&&(r=_Ge(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(r=kGe(e.test,t,r)),new Gy(t.doc,e.unquoted,n,s,e.caseSensitive?void 0:i=>i.toLowerCase(),r)}function _Ge(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(_3(r,n-i))!=Hi.Word||t(S3(r,n-i))!=Hi.Word)&&(t(S3(r,s-i))!=Hi.Word||t(_3(r,s-i))!=Hi.Word))}class SGe extends yde{constructor(t){super(t)}nextMatch(t,n,s){let r=Cb(this.spec,t,s,t.doc.length).nextOverlapping();if(r.done){let i=Math.min(t.doc.length,n+this.spec.unquoted.length);r=Cb(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=Cb(this.spec,t,i,r),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;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=Cb(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=Cb(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 CGe(e,t,n){return(s,r,i)=>(!n||n(s,r,i))&&e(i[0],t,s,r)}function Tb(e,t,n,s){let r;return e.wholeWord&&(r=TGe(t.charCategorizer(t.selection.main.head))),e.test&&(r=CGe(e.test,t,r)),new pde(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:r},n,s)}function _3(e,t){return e.slice(Oa(e,t,!1),t)}function S3(e,t){return e.slice(t,Oa(e,t))}function TGe(e){return(t,n,s)=>!s[0].length||(e(_3(s.input,s.index))!=Hi.Word||e(S3(s.input,s.index))!=Hi.Word)&&(e(S3(s.input,s.index+s[0].length))!=Hi.Word||e(_3(s.input,s.index+s[0].length))!=Hi.Word)}class EGe extends yde{nextMatch(t,n,s){let r=Tb(this.spec,t,s,t.doc.length).next();return r.done&&(r=Tb(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=Tb(this.spec,t,i,s),l=null;for(;!o.next().done;)l=o.value;if(l&&(i==n||l.from>i+10))return l;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=Tb(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=Tb(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 e_=Ts.define(),IP=Ts.define(),_p=ll.define({create(e){return new Rj(QM(e).create(),null)},update(e,t){for(let n of t.effects)n.is(e_)?e=new Rj(n.value.create(),e.panel):n.is(IP)&&(e=new Rj(e.query,n.value?MP:null));return e},provide:e=>Kk.from(e,t=>t.panel)});class Rj{constructor(t,n){this.query=t,this.panel=n}}const AGe=Hn.mark({class:"cm-searchMatch"}),jGe=Hn.mark({class:"cm-searchMatch cm-searchMatch-selected"}),NGe=Wi.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(_p))}update(e){let t=e.state.field(_p);(t!=e.startState.field(_p)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return Hn.none;let{view:n}=this,s=new Ch;for(let r=0,i=n.visibleRanges,o=i.length;r<o;r++){let{from:l,to:c}=i[r];for(;r<o-1&&c>i[r+1].from-2*250;)c=i[++r].to;e.highlight(n.state,l,c,(u,d)=>{let f=n.state.selection.ranges.some(m=>m.from==u&&m.to==d);s.add(u,d,f?jGe:AGe)})}return s.finish()}},{decorations:e=>e.decorations});function X_(e){return t=>{let n=t.state.field(_p,!1);return n&&n.query.spec.valid?e(t,n):xde(t)}}const C3=X_((e,{query:t})=>{let{to:n}=e.state.selection.main,s=t.nextMatch(e.state,n,n);if(!s)return!1;let r=ht.single(s.from,s.to),i=e.state.facet(Pv);return e.dispatch({selection:r,effects:[RP(e,s),i.scrollToMatch(r.main,e)],userEvent:"select.search"}),wde(e),!0}),T3=X_((e,{query:t})=>{let{state:n}=e,{from:s}=n.selection.main,r=t.prevMatch(n,s,s);if(!r)return!1;let i=ht.single(r.from,r.to),o=e.state.facet(Pv);return e.dispatch({selection:i,effects:[RP(e,r),o.scrollToMatch(i.main,e)],userEvent:"select.search"}),wde(e),!0}),IGe=X_((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:ht.create(n.map(s=>ht.range(s.from,s.to))),userEvent:"select.search.matches"}),!0)}),MGe=({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 l=new Gy(e.doc,e.sliceDoc(s,r));!l.next().done;){if(i.length>1e3)return!1;l.value.from==s&&(o=i.length),i.push(ht.range(l.value.from,l.value.to))}return t(e.update({selection:ht.create(i,o),userEvent:"select.search.matches"})),!0},aG=X_((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,l=[],c,u,d=[];o.precise?o.from==s&&o.to==r&&(u=n.toText(t.getReplacement(o)),l.push({from:o.from,to:o.to,insert:u}),d.push(Yt.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(l);return o&&(c=ht.single(o.from,o.to).map(f),d.push(RP(e,o)),d.push(n.facet(Pv).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:"input.replace"}),!0}),RGe=X_((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:l}=r;l&&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:Yt.announce.of(s),userEvent:"input.replace.all"}),!0});function MP(e){return e.state.facet(Pv).createPanel(e)}function QM(e,t){var n,s,r,i,o;let l=e.selection.main,c=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!c)return t;let u=e.facet(Pv);return new bde({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 vde(e){let t=fP(e,MP);return t&&t.dom.querySelector("[main-field]")}function wde(e){let t=vde(e);t&&t==e.root.activeElement&&t.select()}const xde=e=>{let t=e.state.field(_p,!1);if(t&&t.panel){let n=vde(e);if(n&&n!=e.root.activeElement){let s=QM(e.state,t.query.spec);s.valid&&e.dispatch({effects:e_.of(s)}),n.focus(),n.select()}}else e.dispatch({effects:[IP.of(!0),t?e_.of(QM(e.state,t.query.spec)):Ts.appendConfig.of(OGe)]});return!0},kde=e=>{let t=e.state.field(_p,!1);if(!t||!t.panel)return!1;let n=fP(e,MP);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:IP.of(!1)}),!0},DGe=[{key:"Mod-f",run:xde,scope:"editor search-panel"},{key:"F3",run:C3,shift:T3,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:C3,shift:T3,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:kde,scope:"editor search-panel"},{key:"Mod-Shift-l",run:MGe},{key:"Mod-Alt-g",run:uGe},{key:"Mod-d",run:xGe,preventDefault:!0}];class LGe{constructor(t){this.view=t;let n=this.query=t.state.field(_p).query.spec;this.commit=this.commit.bind(this),this.searchField=ai("input",{value:n.search,placeholder:jc(t,"Find"),"aria-label":jc(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ai("input",{value:n.replace,placeholder:jc(t,"Replace"),"aria-label":jc(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ai("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=ai("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=ai("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function s(r,i,o){return ai("button",{class:"cm-button",name:r,onclick:i,type:"button"},o)}this.dom=ai("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,s("next",()=>C3(t),[jc(t,"next")]),s("prev",()=>T3(t),[jc(t,"previous")]),s("select",()=>IGe(t),[jc(t,"all")]),ai("label",null,[this.caseField,jc(t,"match case")]),ai("label",null,[this.reField,jc(t,"regexp")]),ai("label",null,[this.wordField,jc(t,"by word")]),...t.state.readOnly?[]:[ai("br"),this.replaceField,s("replace",()=>aG(t),[jc(t,"replace")]),s("replaceAll",()=>RGe(t),[jc(t,"replace all")])],ai("button",{name:"close",onclick:()=>kde(t),"aria-label":jc(t,"close"),type:"button"},["×"])])}commit(){let t=new bde({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:e_.of(t)}))}keydown(t){sHe(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?T3:C3)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),aG(this.view))}update(t){for(let n of t.transactions)for(let s of n.effects)s.is(e_)&&!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(Pv).top}}function jc(e,t){return e.state.phrase(t)}const fC=30,mC=/[\s\.,:;?!]/;function RP(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-fC),o=Math.min(r,n+fC),l=e.state.sliceDoc(i,o);if(i!=s.from){for(let c=0;c<fC;c++)if(!mC.test(l[c+1])&&mC.test(l[c])){l=l.slice(c);break}}if(o!=r){for(let c=l.length-1;c>l.length-fC;c--)if(!mC.test(l[c-1])&&mC.test(l[c])){l=l.slice(0,c);break}}return Yt.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${s.number}.`)}const PGe=Yt.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"}}),OGe=[_p,w0.low(NGe),PGe];class lG{constructor(t,n,s){this.from=t,this.to=n,this.diagnostic=s}}class pg{constructor(t,n,s){this.diagnostics=t,this.panel=n,this.selected=s}static init(t,n,s){let r=s.facet(t_).markerFilter;r&&(t=r(t,s));let i=t.slice().sort((p,g)=>p.from-g.from||p.to-g.to),o=new Ch,l=[],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&&!l.length)break;let b,w;if(l.length)b=c,w=l.reduce((x,k)=>Math.min(x,k.to),g&&g.from>b?g.from:1e8);else{if(b=g.from,b>f)break;w=g.to,l.push(g),p++}for(;p<i.length;){let x=i[p];if(x.from==b&&(x.to>x.from||x.to==b))l.push(x),p++,w=Math.min(x.to,w);else{w=Math.min(x.from,w);break}}w=Math.min(w,f);let y=!1;if(l.some(x=>x.from==b&&(x.to==w||w==f))&&(y=b==w,!y&&w-b<10)){let x=b-(d+u.value.length);x>0&&(u.next(x),d=b);for(let k=b;;){if(k>=w){y=!0;break}if(!u.lineBreak&&d+u.value.length>k)break;k=d+u.value.length,d+=u.value.length,u.next()}}let v=XGe(l);if(y)o.add(b,b,Hn.widget({widget:new VGe(v),diagnostics:l.slice()}));else{let x=l.reduce((k,_)=>_.markClass?k+" "+_.markClass:k,"");o.add(b,w,Hn.mark({class:"cm-lintRange cm-lintRange-"+v+x,diagnostics:l.slice(),inclusiveEnd:l.some(k=>k.to>w)}))}if(c=w,c==f)break;for(let x=0;x<l.length;x++)l[x].to<=c&&l.splice(x--,1)}let m=o.finish();return new pg(m,n,t0(m))}}function t0(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 lG(r,i,t||o.diagnostics[0]);else{if(o.diagnostics.indexOf(s.diagnostic)<0)return!1;s=new lG(s.from,i,s.diagnostic)}}),s}function $Ge(e,t){let n=t.pos,s=t.end||n,r=e.state.facet(t_).hideOn(e,n,s);if(r!=null)return r;let i=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(o=>o.is(_de))||e.changes.touchesRange(i.from,Math.max(i.to,s)))}function BGe(e,t){return e.field(qc,!1)?t:t.concat(Ts.appendConfig.of(QGe))}const _de=Ts.define(),DP=Ts.define(),Sde=Ts.define(),qc=ll.define({create(){return new pg(Hn.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=t0(n,e.selected.diagnostic,i)||t0(n,null,i)}!n.size&&r&&t.state.facet(t_).autoPanel&&(r=null),e=new pg(n,r,s)}for(let n of t.effects)if(n.is(_de)){let s=t.state.facet(t_).autoPanel?n.value.length?n_.open:null:e.panel;e=pg.init(n.value,s,t.state)}else n.is(DP)?e=new pg(e.diagnostics,n.value?n_.open:null,e.selected):n.is(Sde)&&(e=new pg(e.diagnostics,e.panel,n.value));return e},provide:e=>[Kk.from(e,t=>t.panel),Yt.decorations.from(e,t=>t.diagnostics)]}),zGe=Hn.mark({class:"cm-lintRange cm-lintRange-active"});function FGe(e,t,n){let{diagnostics:s}=e.state.field(qc),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 l=e.state.facet(t_).tooltipFilter;return r&&l&&(r=l(r,e.state)),r?{pos:i,end:o,above:!0,create(){return{dom:qGe(e,r)}}}:null}function qGe(e,t){return ai("ul",{class:"cm-tooltip-lint"},t.map(n=>Tde(e,n,!1)))}const HGe=e=>{let t=e.state.field(qc,!1);(!t||!t.panel)&&e.dispatch({effects:BGe(e.state,[DP.of(!0)])});let n=fP(e,n_.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},cG=e=>{let t=e.state.field(qc,!1);return!t||!t.panel?!1:(e.dispatch({effects:DP.of(!1)}),!0)},UGe=e=>{let t=e.state.field(qc,!1);if(!t)return!1;let n=e.state.selection.main,s=t0(t.diagnostics,null,n.to+1);return!s&&(s=t0(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}),UHe(e,s.from,1,{tooltip:Ede,until:r=>r.docChanged||r.newSelection.main.head<s.from||r.newSelection.main.head>s.to}),!0)},WGe=[{key:"Mod-Shift-m",run:HGe,preventDefault:!0},{key:"F8",run:UGe}],t_=jn.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...Lh(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:uG,tooltipFilter:uG,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 uG(e,t){return e?t?(n,s)=>t(e(n,s),s):e:t}function Cde(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 Tde(e,t,n){var s;let r=n?Cde(t.actions):[];return ai("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},ai("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 l=!1,c=p=>{if(p.preventDefault(),l)return;l=!0;let g=t0(e.state.field(qc).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),ai("u",u.slice(d,d+1)),u.slice(d+1)],m=i.markClass?" "+i.markClass:"";return ai("button",{type:"button",class:"cm-diagnosticAction"+m,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${r[o]})"`}.`},f)}),t.source&&ai("div",{class:"cm-diagnosticSource"},t.source))}class VGe extends iu{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return ai("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class dG{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Tde(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class n_{constructor(t){this.view=t,this.items=[];let n=r=>{if(!(r.ctrlKey||r.altKey||r.metaKey)){if(r.keyCode==27)cG(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=Cde(i.actions);for(let l=0;l<o.length;l++)if(o[l].toUpperCase().charCodeAt(0)==r.keyCode){let c=t0(this.view.state.field(qc).diagnostics,i);c&&i.actions[l].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=ai("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:s}),this.dom=ai("div",{class:"cm-panel-lint"},this.list,ai("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>cG(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(qc).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(qc),s=0,r=!1,i=null,o=new Set;for(t.between(0,this.view.state.doc.length,(l,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 dG(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 dG(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:l,panel:c})=>{let u=c.height/this.list.offsetHeight;l.top<c.top?this.list.scrollTop-=(c.top-l.top)/u:l.bottom>c.bottom&&(this.list.scrollTop+=(l.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(qc),s=t0(n.diagnostics,this.items[t].diagnostic);s&&this.view.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0,effects:Sde.of(s)})}static open(t){return new n_(t)}}function GGe(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 pC(e){return GGe(`<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 KGe=Yt.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:pC("#f11")},".cm-lintRange-warning":{backgroundImage:pC("orange")},".cm-lintRange-info":{backgroundImage:pC("#999")},".cm-lintRange-hint":{backgroundImage:pC("#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 YGe(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function XGe(e){let t="hint",n=1;for(let s of e){let r=YGe(s.severity);r>n&&(n=r,t=s.severity)}return t}const Ede=HHe(FGe,{hideOn:$Ge}),QGe=[qc,Yt.decorations.compute([qc],e=>{let{selected:t,panel:n}=e.field(qc);return!t||!n||t.from==t.to?Hn.none:Hn.set([zGe.range(t.from,t.to)])}),Ede,KGe],Ade=[sUe(),oUe(),Qce(),kP(),JUe(),Kce(),fHe(),wr.allowMultipleSelections.of(!0),$Ue(),xue(kue,{fallback:!0}),lWe(),QVe(),hde(),IHe(),DHe(),SHe(),fGe(),Uy.of([...tGe,...CP,...DGe,..._P,...KUe,...fde,...WGe])],JGe=[Qce(),kP(),Kce(),xue(kue,{fallback:!0}),Uy.of([...CP,..._P])];/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const ZGe="(hover: none) and (pointer: coarse)";function vx(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(ZGe).matches}function eKe(){if(typeof window<"u"){const e=new URLSearchParams(window.location.search).get("composer");if(e==="textarea")return!0;if(e==="codemirror")return!1}return vx()}function tKe(){const[e]=h.useState(eKe);return e}/** @license
 * fzf v0.5.2
 * Copyright (c) 2021 Ajit
 * Licensed under BSD 3-Clause
 */const LP={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&&(LP[r]=n)}}const Dj={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(const e of Object.keys(Dj)){const t=e.toUpperCase();for(let n=Dj[e][0];n<=Dj[e][1];++n)LP[n]=n%2===0?t:e}function Q_(e){if(e<192||e>8580)return e;const t=LP[e];return t!==void 0?t.codePointAt(0):e}function Um(e,t){return e>t?e:t}const jde=e=>e.split("").map(t=>t.codePointAt(0)),nKe=new Set(` \f
\r	\v  \u2028\u2029  　\uFEFF`.split("").map(e=>e.codePointAt(0)));for(let e=" ".codePointAt(0);e<=" ".codePointAt(0);e++)nKe.add(e);const Ky="".codePointAt(0),s_="A".codePointAt(0),r_="Z".codePointAt(0),Nde="a".codePointAt(0),Ide="z".codePointAt(0),sKe="0".codePointAt(0),rKe="9".codePointAt(0);function Wb(e,t,n){return n?e:t-e-1}const i_=16,JM=-3,E3=-1,t1=i_/2,iKe=i_/2,oKe=t1+E3,Mde=4,Rde=2;function ZM(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 hG(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 Dde(e){return e>=Nde&&e<=Ide?1:e>=s_&&e<=r_?2:e>=sKe&&e<=rKe?4:0}function Lde(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 A3(e){return e<=Ky?Dde(e):Lde(e)}function PP(e,t){return e===0&&t!==0?t1:e===1&&t===2||e!==4&&t===4?oKe:t===0?iKe:0}function aKe(e,t){return t===0?t1:PP(A3(e[t-1]),A3(e[t]))}function lKe(e,t,n,s){let r=e.slice(s),i=r.indexOf(n);if(i===0)return s;if(!t&&n>=Nde&&n<=Ide){i>0&&(r=r.slice(0,i));const o=r.indexOf(n-32);o>=0&&(i=o)}return i<0?-1:s+i}function fG(e){for(const t of e)if(t>=128)return!1;return!0}function OP(e,t,n){if(!fG(e))return 0;if(!fG(t))return-1;let s=0,r=0;for(let i=0;i<t.length;i++){if(r=lKe(e,n,t[i],r),r<0)return-1;i===0&&r>0&&(s=r-1),r++}return s}const cKe=(e,t,n,s,r,i,o)=>{const l=r.length;if(l===0)return[{start:0,end:0,score:0},ZM(i)];const c=s.length;if(o!==null&&c*l>o.i16.length)return Ode(e,t,n,s,r,i);const u=OP(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]=hG(f,o,l);const[,w]=hG(f,o,c);for(let W=0;W<w.length;W++)w[W]=s[W];let y=0,v=0,x=0,k=0;const _=r[0];let T=r[0],S=0,C=0,N=!1,E=w.subarray(u),O=m.subarray(u).subarray(0,E.length),B=p.subarray(u).subarray(0,E.length),D=g.subarray(u).subarray(0,E.length);for(let[W,M]of E.entries()){let F=null;M<=Ky?(F=Dde(M),!e&&F===2&&(M+=32)):(F=Lde(M),!e&&F===2&&(M=String.fromCodePoint(M).toLowerCase().codePointAt(0)),t&&(M=Q_(M))),E[W]=M;const J=PP(C,F);if(D[W]=J,C=F,M===T&&(x<l&&(b[x]=u+W,x++,T=r[Math.min(x,l-1)]),k=u+W),M===_){const V=i_+J*Rde;if(O[W]=V,B[W]=1,l===1&&(n&&V>y||!n&&V>=y)&&(y=V,v=u+W,n&&J===t1))break;N=!1}else N?O[W]=Um(S+E3,0):O[W]=Um(S+JM,0),B[W]=0,N=!0;S=O[W]}if(x!==l)return[{start:-1,end:-1,score:0},null];if(l===1){const W={start:v,end:v+1,score:y};if(!i)return[W,null];const M=new Set;return M.add(v),[W,M]}const j=b[0],L=k-j+1;let z=null;[d,z]=Ww(d,o,L*l);{const W=m.subarray(j,k+1);for(const[M,F]of W.entries())z[M]=F}let[,I]=Ww(d,o,L*l);{const W=p.subarray(j,k+1);for(const[M,F]of W.entries())I[M]=F}const $=b.subarray(1),K=r.slice(1).slice(0,$.length);for(const[W,M]of $.entries()){let F=!1;const J=K[W],V=W+1,U=V*L,le=w.subarray(M,k+1),pe=g.subarray(M).subarray(0,le.length),fe=I.subarray(U+M-j).subarray(0,le.length),Q=I.subarray(U+M-j-1-L).subarray(0,le.length),ne=z.subarray(U+M-j).subarray(0,le.length),de=z.subarray(U+M-j-1-L).subarray(0,le.length),ue=z.subarray(U+M-j-1).subarray(0,le.length);ue[0]=0;for(const[me,te]of le.entries()){const ae=me+M;let be=0,se=0,ve=0;if(F?se=ue[me]+E3:se=ue[me]+JM,J===te){be=de[me]+i_;let Pe=pe[me];ve=Q[me]+1,Pe===t1?ve=1:ve>1&&(Pe=Um(Pe,Um(Mde,g[ae-ve+1]))),be+Pe<se?(be+=pe[me],ve=0):be+=Pe}fe[me]=ve,F=be<se;const ze=Um(Um(be,se),0);V===l-1&&(n&&ze>y||!n&&ze>=y)&&(y=ze,v=ae),ne[me]=ze}}const R=ZM(i);let Y=j;if(i&&R!==null){let W=l-1;Y=v;let M=!0;for(;;){const F=W*L,J=Y-j,V=z[F+J];let U=0,le=0;if(W>0&&Y>=b[W]&&(U=z[F-L+J-1]),Y>b[W]&&(le=z[F+J-1]),V>U&&(V>le||V===le&&M)){if(R.add(Y),W===0)break;W--}M=I[F+J]>1||F+L+J+1<I.length&&I[F+L+J+1]>0,Y--}}return[{start:Y,end:v+1,score:y},R]};function Pde(e,t,n,s,r,i,o){let l=0,c=0,u=!1,d=0,f=0;const m=ZM(o);let p=0;r>0&&(p=A3(n[r-1]));for(let g=r;g<i;g++){let b=n[g];const w=A3(b);if(e||(b>=s_&&b<=r_?b+=32:b>Ky&&(b=String.fromCodePoint(b).toLowerCase().codePointAt(0))),t&&(b=Q_(b)),b===s[l]){o&&m!==null&&m.add(g),c+=i_;let y=PP(p,w);d===0?f=y:(y===t1&&(f=y),y=Um(Um(y,f),Mde)),l===0?c+=y*Rde:c+=y,u=!1,d++,l++}else u?c+=E3:c+=JM,u=!0,d=0,f=0;p=w}return[c,m]}const Ode=(e,t,n,s,r,i,o)=>{if(r.length===0)return[{start:0,end:0,score:0},null];if(OP(s,r,e)<0)return[{start:-1,end:-1,score:0},null];let l=0,c=-1,u=-1;const d=s.length,f=r.length;for(let m=0;m<d;m++){let p=s[Wb(m,d,n)];e||(p>=s_&&p<=r_?p+=32:p>Ky&&(p=String.fromCodePoint(p).toLowerCase().codePointAt(0))),t&&(p=Q_(p));const g=r[Wb(l,f,n)];if(p===g&&(c<0&&(c=m),l++,l===f)){u=m+1;break}}if(c>=0&&u>=0){l--;for(let g=u-1;g>=c;g--){const b=Wb(g,d,n);let w=s[b];e||(w>=s_&&w<=r_?w+=32:w>Ky&&(w=String.fromCodePoint(w).toLowerCase().codePointAt(0)));const y=Wb(l,f,n),v=r[y];if(w===v&&(l--,l<0)){c=g;break}}if(!n){const g=c;c=d-u,u=d-g}const[m,p]=Pde(e,t,s,r,c,u,i);return[{start:c,end:u,score:m},p]}return[{start:-1,end:-1,score:0},null]},uKe=(e,t,n,s,r,i,o)=>{if(r.length===0)return[{start:0,end:0,score:0},null];const l=s.length,c=r.length;if(l<c)return[{start:-1,end:-1,score:0},null];if(OP(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<l;p++){const g=Wb(p,l,n);let b=s[g];e||(b>=s_&&b<=r_?b+=32:b>Ky&&(b=String.fromCodePoint(b).toLowerCase().codePointAt(0))),t&&(b=Q_(b));const w=Wb(u,c,n);if(r[w]===b){if(w===0&&(f=aKe(s,g)),u++,u===c){if(f>m&&(d=p,m=f),f===t1)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=l-(d+1),g=l-(d-c+1));const[b]=Pde(e,t,s,r,p,g,!1);return[{start:p,end:g,score:b},null]}return[{start:-1,end:-1,score:0},null]},dKe=100*1024,hKe=2048;function fKe(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}const mKe=fKe(dKe,hKe),pKe=(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=jde(e);return n&&(r=r.map(Q_)),{queryRunes:r,caseSensitive:s}};function gKe(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 bKe(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,mKe);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 l=this.opts.sort?i.score:0;e[l]===void 0&&(e[l]=[]),e[l].push({item:this.items[s],...i,positions:o??new Set})}}function yKe(e){const{queryRunes:t,caseSensitive:n}=pKe(e,this.opts.casing,this.opts.normalize),s={},r=bKe.bind(this)(s,t,n);for(let i=0,o=this.runesList.length;i<o;++i)r(i);return gKe(s,this.opts.limit)}const $de={limit:1/0,selector:e=>e,casing:"smart-case",normalize:!0,fuzzy:"v2",tiebreakers:[],sort:!0,forward:!0};class vKe{constructor(t,...n){switch(this.opts={...$de,...n[0]},this.items=t,this.runesList=t.map(s=>jde(this.opts.selector(s).normalize())),this.algoFn=uKe,this.opts.fuzzy){case"v2":this.algoFn=cKe;break;case"v1":this.algoFn=Ode;break}}}const wKe={...$de,match:yKe};class xKe extends vKe{constructor(t,...n){super(t,...n),this.opts={...wKe,...n[0]}}find(t){if(t.length===0||this.items.length===0)return this.items.slice(0,this.opts.limit).map(kKe);t=t.normalize();let n=this.opts.match.bind(this)(t);return _Ke(n,this.opts)}}const kKe=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function _Ke(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 SKe{constructor(t,...n){this.finder=new xKe(t,...n),this.find=this.finder.find.bind(this.finder)}}const o_=["custom","skill","system"];function eR(e){return e.displayCategory?e.displayCategory:e.source==="builtin-command"?"system":e.source==="bundled-skill"||e.source==="skill"?"skill":"custom"}function CKe(e,t,n=o_){return mG(eR(e),n)-mG(eR(t),n)}function mG(e,t=o_){const n=t.indexOf(e);return n>=0?n:t.length+o_.indexOf(e)}const $P=String.raw`([^\s/]+)`,O6={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:"安装扩展"}]},$6={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"}]},B6={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 文件列表"}]},z6={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 TKe(e,t,n,s,r){if(e==="skills"&&t.length===0)return!n||n.length===0?null:n.map(l=>({name:l.name,description:l.description}));let o=(s==="zh-CN"?O6:$6)[e];if(o||(o=(s==="zh-CN"?B6:z6)[e]),!o&&t.length===0&&(r!=null&&r.length)&&(o=r.map(l=>({name:l,description:""}))),!o)return null;for(const l of t){const c=o.find(u=>u.name===l);if(!(c!=null&&c.children))return null;o=c.children}return o}function EKe(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 AKe(e,t,n,s){const r=CKe(e,t,s);return r!==0?r:0}const jKe={custom:"slash.category.custom",skill:"slash.category.skill",system:"slash.category.system"},pG=50;function NKe(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 IKe(e,t,n){var u;const s=e.match(new RegExp(`^/${$P}\\s+$`));if(!s)return null;const r=s[1],i=t.find(d=>d.name===r),o=n==="zh-CN"?O6:$6;if((u=i==null?void 0:i.subcommands)!=null&&u.length||o[r]||r==="skills")return null;const c=(n==="zh-CN"?B6:z6)[r];return!c||c.length===0?null:`/${r} ${c[0].name} `}function MKe(e,t,n){var d,f;const s=e.match(new RegExp(`^/${$P}(\\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 l=n==="zh-CN"?O6:$6;if((f=i.subcommands)!=null&&f.length||l[r]||r==="skills")return null;const u=(n==="zh-CN"?B6:z6)[r];return!u||u.length===0?null:`[${u.map(m=>m.name).join("|")}]`}function RKe(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 gG=new WeakMap;function DKe(e){let t=gG.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 SKe(n,{fuzzy:"v2",casing:"case-insensitive"}),byName:s},gG.set(e,t)}return t}function LKe(e,t){try{const{fzf:n,byName:s}=DKe(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 PKe(e,t,n,s=[],r="en",i=l=>l,o=o_){var v,x;const{lineStart:l,lineEnd:c,lineText:u,textBefore:d,cursor:f}=RKe(e,t),m=d.match(new RegExp(`^/${$P}\\s+(.*)$`));if(m){const[,k,_]=m,T=n.find(R=>R.name===k),S=r==="zh-CN"?O6:$6,C=r==="zh-CN"?B6:z6,N=!!S[k]||k==="skills",E=!!C[k];if(!((v=T==null?void 0:T.subcommands)!=null&&v.length)&&!N&&!E)return null;const O=_.split(/\s+/),B=O.pop()||"",D=O;if(!((x=T==null?void 0:T.subcommands)!=null&&x.length)&&!N&&E&&!B)return null;const j=TKe(k,D,s,r,T==null?void 0:T.subcommands);if(!j)return null;const L=B.toLowerCase(),z=`/${k} ${D.length>0?D.join(" ")+" ":""}`,I=j.filter(R=>!B||R.name.toLowerCase().includes(L)).sort((R,Y)=>B?EKe(R.name,Y.name,L):0),$=k==="skills"&&D.length===0,K=I.slice(0,pG).map(R=>{const Y=`${z}${R.name}`;return{id:Y,label:R.name,detail:R.description||void 0,apply:`${Y} `,...$?{type:"skill"}:{}}});return K.length===0?null:{kind:"subcommand",from:l,to:f,query:B,items:K}}const p=u.match(/^\/([^\s/]*)$/);if(!p)return null;const g=p[1],b=g.length===0,y=(b?[...n].sort((k,_)=>AKe(k,_,"",o)):LKe(n,g)).slice(0,pG).map(k=>{const _=`/${k.name} `,T=eR(k),S=T==="custom"||T==="skill";return{id:k.name,label:`/${k.name}`,detail:k.description||void 0,apply:_,category:T,...b?{section:i(jKe[T])}:{},...S&&k.description?{type:"command-info"}:{}}});return y.length===0?null:{kind:"command",from:l,to:c,query:g,items:y}}const tR="qwen-web-shell-history",BP=100;function bG(e){return e?`${tR}:${encodeURIComponent(e)}`:tR}function j3(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 nR(e,t){const n=j3(e);return n.length===0&&t?j3(t):n}function N3(e,t){try{localStorage.setItem(e,JSON.stringify(t.slice(-BP)))}catch{}}function OKe(e,t,n){const s=nR(e,n);if(s[s.length-1]===t){n&&j3(e).length===0&&N3(e,s);return}s.push(t),s.length>BP&&s.shift(),N3(e,s)}function yG(e=tR,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([]),l=h.useRef(!1);l.current||(o.current=nR(e,t),l.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 S=o.current,C=c.current;m({canUp:S.length>0&&(C===-1||C>0),canDown:C!==-1})},[]);h.useEffect(()=>{r.current===e&&i.current===t||(r.current=e,i.current=t,o.current=nR(e,t),c.current=-1,u.current="",d.current=-1,p())},[t,e,p]);const g=h.useCallback(S=>{const C=o.current;if(C[C.length-1]===S){s.current&&j3(n.current).length===0&&N3(n.current,C);return}C.push(S),C.length>BP&&C.shift(),N3(n.current,C),c.current=-1,p()},[p]),b=h.useCallback(S=>{const C=o.current;if(C.length===0)return null;if(c.current===-1)u.current=S,c.current=C.length-1;else if(c.current>0)c.current--;else return null;return p(),C[c.current]},[p]),w=h.useCallback(()=>{const S=o.current;return c.current===-1?null:c.current<S.length-1?(c.current++,p(),S[c.current]):(c.current=-1,p(),u.current)},[p]),y=h.useCallback(()=>c.current!==-1,[]),v=h.useCallback(()=>{c.current=-1,d.current=-1,p()},[p]),x=h.useCallback(S=>{const C=o.current;if(C.length===0||!S)return null;const N=d.current===-1?C.length-1:d.current-1;if(N<0)return d.current=-1,null;const E=S.toLowerCase();for(let O=N;O>=0;O--)if(C[O].toLowerCase().includes(E))return d.current=O,C[O];return d.current=-1,null},[]),k=h.useCallback(S=>{const C=S.trim().toLowerCase();return o.current.slice().reverse().filter(N=>!C||N.toLowerCase().includes(C))},[]),_=h.useCallback(S=>{const C=o.current;if(!S)return C.length>0?C[C.length-1]:null;for(let N=C.length-1;N>=0;N--)if(S(C[N]))return C[N];return null},[]),T=h.useCallback(()=>{d.current=-1},[]);return{push:g,navigateUp:b,navigateDown:w,isNavigating:y,reset:v,searchReverse:x,getReverseMatches:k,getLastEntry:_,resetSearch:T,nav:f}}function gC(){return{directories:new Map,globResults:new Map,mcpResources:new Map}}function sR(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 $Ke=/@((?:[\p{L}\p{N}_./:-]|\\.)*)$/u,BKe=[],vG=150,Sp=50,Bde=Sp+1,Xa="files",Ov="extensions",Za="mcp-resources",zde=[Xa,Ov,Za],zKe="\x1B",Fde=new RegExp(`${zKe}(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])`,"g"),qde=/[\u200B\u200E\u200F\u061C\u2066-\u2069\u202A-\u202E]/g,a_="[invalid]",FKe=/[^\p{L}\p{N}_./-]/gu;function qKe(e,t){if(e===t)return!0;if(!e||!t)return!1;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(s=>{const r=e[s],i=t[s];return Object.is(r,i)?!0:Array.isArray(r)&&Array.isArray(i)&&r.length===i.length&&r.every((o,l)=>Object.is(o,i[l]))})}function HKe(e,t){return e.length===t.length&&e.every((n,s)=>{const r=t[s];return r!==void 0&&n.id===r.id&&n.textValue===r.textValue&&Object.is(n.label,r.label)&&n.description===r.description&&n.tabs===r.tabs&&n.selectedTabId===r.selectedTabId&&n.renderItem===r.renderItem})}function j4(e){return zde.includes(e)}function UKe(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 WKe(e){const t=new Set(zde),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 wG(e){return(e.textValue===void 0?void 0:ui(e.textValue))??(typeof e.label=="string"?ui(e.label)??void 0:void 0)??tm(e.id)??a_}function Hde(e,t){return e==="."||e===""?t:`${e.replace(/\/+$/,"")}/${t}`}function Pf(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 VKe(e){return Array.from(e,t=>/[a-z]/i.test(t)?`[${t.toLowerCase()}${t.toUpperCase()}]`:/[\\*?[{\]}()!@+|]/.test(t)?`\\${t}`:t).join("")}function rR(e){const t=F6(e).replace(/^\.\//,"");return t?`**/*${VKe(t)}*`:"**/*"}function I3(e,...t){const n=e.toLowerCase();return t.some(s=>s==null?void 0:s.toLowerCase().includes(n))}function xG(e){const t=Pf(e),n=Th(t);return t==="."?"@./ ":`@${n1(n)}/ `}function GKe(e,t){return`${e}:${t}`}function n1(e){return e.replace(FKe,"\\$&")}function F6(e){return e.replace(/\\(.)/g,"$1")}function Ude(e){const t=e.charCodeAt(0);return t>31&&t!==127&&(t<128||t>159)}function KKe(e,t){return`@${n1(GKe(Th(e),Th(t)))} `}function YKe(e,t,n){const s=F6(e);return t===Za&&n&&s.startsWith(`${n}:`)?{providerId:Za,serverName:n,itemQuery:s.slice(n.length+1),validateServer:!0}:e.startsWith("ext:")?{providerId:Ov,itemQuery:e.slice(4)}:e.startsWith("mcp:")?{providerId:Za,itemQuery:e.slice(4)}:null}function XKe(e,t,n){if(e===Ov&&t.startsWith("ext:")||e===Za&&t.startsWith("mcp:"))return t.slice(4);const s=F6(t);return e===Za&&n&&s.startsWith(`${n}:`)?s.slice(n.length+1):!j4(e)&&t.startsWith(`${e}:`)?t.slice(e.length+1):t}async function QKe(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 JKe(e){const t=Pf(e);if(t===".")return".";const n=t.lastIndexOf("/");return n<0?".":t.slice(0,n)}function Wde(e,t){const n=F6(e).replace(/^\.\/+/,"").replace(/\/+/g,"/"),s=n.lastIndexOf("/");if(s<0)return{dirPath:Pf(t),entryQuery:n};const r=n.slice(0,s),i=Pf(t),o=i==="."?r:Hde(i,r);return{dirPath:Pf(o),entryQuery:n.slice(s+1)}}function ZKe(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($Ke);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 ui(e){const t=e.replace(Fde,"").replace(qde,"").split("").filter(Ude).join("").replace(/\s+/g," ").trim();return t.length>0?t:void 0}function Th(e){const t=e.replace(Fde,"").replace(qde,"").split("").filter(Ude).join("");return t.length>0?t:a_}function tm(e){return e===void 0?a_:ui(e)??a_}function eYe(e){if(e!==void 0)return Th(e).trim()}function tYe(e){if(!e)return;const t=e.kind===void 0?void 0:ui(e.kind);return{id:ui(e.id)??a_,label:e.label===void 0?void 0:ui(e.label),value:e.value===void 0?void 0:ui(e.value),removable:e.removable,kind:t,icon:e.icon,metadata:e.metadata,serialized:eYe(e.serialized)}}function nYe(e,t){const n={...e,label:ui(e.label)??tm(e.id),description:e.description===void 0?void 0:ui(e.description),subtitle:e.subtitle===void 0?void 0:ui(e.subtitle),detail:e.detail===void 0?void 0:ui(e.detail),icon:e.icon,iconTooltip:e.iconTooltip===void 0?void 0:ui(e.iconTooltip),insertText:e.insertText===void 0?void 0:Th(e.insertText),composerTag:tYe(e.composerTag)};if(!(t!=null&&t.customProvider))return n;const s={...n};return delete s.targetPath,delete s.serverName,{...s,kind:"insert"}}function sYe(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===Ov?{id:`extension:${s}`,kind:"extension",value:t.label,serialized:s}:e===Za?{id:`mcp:${s}`,kind:"mcp",value:t.label,serialized:s}:e===Xa?{id:`file:${s}`,kind:"file",value:t.description??t.label,serialized:s}:null:null}function rYe(e,t,n,s,r){return{id:Xa,label:s,description:r,order:1,async search({query:i,signal:o}){const l=e(),c=Pf(t()),u=l==null?void 0:l.listDirectory;if(u&&(!i||!(l!=null&&l.globWorkspace)))try{const{dirPath:f,entryQuery:m}=Wde(i,c),p=m.toLowerCase(),g=await sR(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,v)=>y.kind==="directory"&&v.kind!=="directory"?-1:y.kind!=="directory"&&v.kind==="directory"?1:y.name.localeCompare(v.name)),w={id:`current:${f}`,label:xG(f).trim(),description:ui(f),insertText:xG(f),kind:"insert"};return[...m?[]:[w],...b.map(y=>{const v=Hde(f,y.name),x=tm(y.name),k=ui(v),_=Th(v);return y.kind==="directory"?{id:`dir:${v}`,label:`${x}/`,description:k,kind:"directory",targetPath:v}:{id:`file:${v}`,label:x,description:k,insertText:`@${n1(_)} `,kind:"insert"}})].slice(0,m?Sp:Bde)}catch(f){return o.aborted||console.warn("Failed to load @ file suggestions",f),[]}const d=l==null?void 0:l.globWorkspace;if(!d)return console.warn("[@mention] file provider unavailable: workspace actions are not configured"),[];try{const f=rR(i),m=await sR(n().globResults,f,()=>d(f,{maxResults:Sp,signal:o}));return o.aborted?[]:m.matches.filter(p=>p!==".").map(p=>({id:p,label:tm(p),insertText:`@${n1(Th(p))} `,kind:"insert"}))}catch(f){return o.aborted||console.warn("Failed to load @ file suggestions",f),[]}}}}function iYe(e,t,n,s){return{id:Ov,label:n,description:s,order:2,async search({query:r,signal:i}){var l;const o=(l=e())==null?void 0:l.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=tm(f.name),g=`@ext:${n1(Th(f.name))}`,b=ui(f.displayName??""),w=ui(f.description??"");return{id:f.name,label:m,description:b&&b!==m?b:w,detail:b&&w?`${b} - ${w}`:b??w,composerTag:{id:`extension:${g}`,kind:"extension",value:b||m,serialized:g},insertText:`${g} `}}).filter(f=>I3(d,f.label,f.description)).sort((f,m)=>{const p=f.label.toLowerCase(),g=m.label.toLowerCase(),b=p.startsWith(d)?0:1,w=g.startsWith(d)?0:1;return b!==w?b-w:p.localeCompare(g)}).slice(0,Sp)}catch(c){return i.aborted||console.warn("Failed to load @ extension suggestions",c),[]}}}}function oYe(e,t,n,s,r){return{id:Za,label:n,description:s,order:3,async search({query:i,signal:o}){var c;const l=(c=e())==null?void 0:c.loadMcpStatus;if(!l)return[];try{const u=t();u.mcpStatus??(u.mcpStatus=l().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=Th(m.name),g=m.resourceCount===void 0?void 0:r(m.resourceCount);return m.resourceCount===0?{id:`mcp-server-ref:${m.name}`,label:tm(m.name),description:ui(m.description??""),detail:ui(m.description??""),insertText:`@mcp:${n1(p)} `,kind:"insert"}:{id:`mcp-server:${m.name}`,label:tm(m.name),description:g===void 0?ui(m.description??""):g,detail:ui(m.description??""),kind:"mcp-server",serverName:m.name}}).filter(m=>I3(f,m.label,m.description)).sort((m,p)=>m.label.localeCompare(p.label)).slice(0,Sp)}catch(u){return o.aborted||console.warn("Failed to load @ MCP resource suggestions",u),[]}}}}function aYe(e,t,n){return t<=0?null:n==="up"?e<=0?null:e-1:e>=t-1?null:e+1}function lYe({viewRef:e,disabledRef:t,shellModeRef:n,workspaceActionsRef:s,workspaceKey:r,builtinProviders:i,providers:o=BKe,createInlineTagEffect:l}){const{t:c}=nt(),[u,d]=h.useState(null),f=h.useRef(null),m=h.useRef(0),p=h.useRef(null),g=h.useRef(null),b=h.useRef("."),w=h.useRef(gC()),y=h.useRef(null),v=h.useRef(null),x=h.useRef(!1),k=h.useMemo(()=>[...[rYe(()=>s.current,()=>b.current,()=>w.current,c("at.category.files"),c("at.category.files.description")),iYe(()=>s.current,()=>w.current,c("at.category.extensions"),c("at.category.extensions.description")),oYe(()=>s.current,()=>w.current,c("at.category.mcpResources"),c("at.category.mcpResources.description"),U=>c("mcp.resourceCount",{count:U}))].filter(U=>UKe(U.id,i)),...WKe(o)].sort((U,le)=>(U.order??0)-(le.order??0)),[i,o,c,s]),_=h.useRef(k);_.current=k;const T=h.useMemo(()=>k.map(V=>({id:V.id,provider:V,textValue:wG(V),label:typeof V.label=="string"?wG(V):V.label,description:V.description===void 0?void 0:ui(V.description),tabs:V.tabs,renderItem:V.renderItem})),[k]),S=h.useRef(T);S.current=T;const C=h.useCallback(V=>{const U=typeof V=="function"?V(f.current):V;qKe(f.current,U)||(f.current=U,d(U))},[]);h.useEffect(()=>{var V;(V=p.current)==null||V.abort(),p.current=null,g.current&&(clearTimeout(g.current),g.current=null),b.current=".",w.current=gC(),f.current=null,d(null)},[r]);const N=h.useCallback(()=>{var V;(V=p.current)==null||V.abort(),p.current=null,g.current&&(clearTimeout(g.current),g.current=null)},[]),E=h.useCallback((V={})=>{if(f.current===null&&p.current===null&&g.current===null&&y.current===null&&v.current===null&&!x.current)return;N(),w.current=gC();const U=V.preserveProviderSelection||x.current;x.current=!1,U||(y.current=null,v.current=null),C(null)},[N,C]),O=h.useCallback(()=>{const V=f.current;return V?V.level==="items"?(N(),C({...V,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"):(E(),"closed"):!1},[N,E,C]);h.useEffect(()=>()=>{var V;g.current&&clearTimeout(g.current),(V=p.current)==null||V.abort(),p.current=null,b.current=".",w.current=gC()},[]);const B=h.useCallback((V,U,le)=>{const pe=f.current;return(pe==null?void 0:pe.level)!=="items"||pe.selectedProviderId!==V||pe.selectedTabId!==le.selectedTabId||pe.itemMode!==le.itemMode||pe.mcpServerName!==le.mcpServerName||pe.fileDirectory!==le.fileDirectory?[]:pe.query!==U&&!j4(V)?[]:V===Xa&&U===""&&b.current==="."?[]:pe.items},[]),D=h.useCallback((V,U)=>{const le=s.current,pe=w.current;if(V===Xa){if(U&&(le!=null&&le.globWorkspace))return pe.globResults.has(rR(U));if(le!=null&&le.listDirectory){const{dirPath:Q}=Wde(U,Pf(b.current));return pe.directories.has(Q)}const fe=rR(U);return!!(le!=null&&le.globWorkspace)&&pe.globResults.has(fe)}return V===Ov?pe.extensionsStatus!==void 0:V===Za?pe.mcpStatus!==void 0:!1},[s]),j=h.useCallback((V,U,le,pe={})=>{var ue;const fe=_.current.find(me=>me.id===V);if(!fe){console.warn(`[@mention] provider="${V}" not found (may have been removed)`),C(null);return}(ue=p.current)==null||ue.abort();const Q=new AbortController;p.current=Q;const ne=m.current+1;m.current=ne;const de=B(V,U,le);pe.loadingAlreadySet||C({...le,items:de,loading:!0}),Promise.resolve().then(()=>fe.search({query:U,signal:Q.signal,tabId:le.selectedTabId})).then(me=>{Q.signal.aborted||m.current!==ne||C(te=>{if(!te||te.level!=="items")return te;const ae=V===Xa&&U.length===0?Bde:Sp;return{...te,items:me.slice(0,ae).map(be=>nYe(be,{customProvider:!j4(V)})),selectedIndex:0,loading:!1}})}).catch(me=>{Q.signal.aborted||m.current!==ne||(console.warn(`[@mention] provider="${V}" query=<redacted> failed`,me),C(te=>!te||te.level!=="items"?te:{...te,items:[],selectedIndex:0,loading:!1}))})},[B,C]),L=h.useCallback((V,U,le)=>{var fe;g.current&&clearTimeout(g.current),(fe=p.current)==null||fe.abort(),p.current=null;const pe=B(V,U,le);if(C({...le,items:pe,loading:!0}),D(V,U)){j(V,U,le,{loadingAlreadySet:!0});return}g.current=setTimeout(()=>{g.current=null,j(V,U,le,{loadingAlreadySet:!0})},vG)},[B,D,j,C]),z=h.useCallback((V,U,le,pe={})=>{var ae,be;const fe=s.current,Q=fe==null?void 0:fe.loadMcpResources;if(!Q){console.warn(`[@mention] loadMcpResources not available for server="${V}"`),C({...le,items:[],loading:!1});return}(ae=p.current)==null||ae.abort();const ne=new AbortController;p.current=ne;const de=m.current+1;m.current=de;const ue=((be=f.current)==null?void 0:be.level)==="items"&&f.current.itemMode==="mcpResources"&&f.current.mcpServerName===V?f.current.items:[];pe.loadingAlreadySet||C({...le,items:ue,loading:!0});const me=fe==null?void 0:fe.loadMcpStatus;(pe.validateServer?QKe(fe,V,ne.signal,me?()=>{const se=w.current;return se.mcpStatus??(se.mcpStatus=me().catch(ve=>{throw se.mcpStatus=void 0,ve})),se.mcpStatus}:void 0):Promise.resolve(!0)).then(se=>ne.signal.aborted?{resources:[]}:se?sR(w.current.mcpResources,V,()=>Q(V,{signal:ne.signal})):(console.warn("[@mention] MCP server disabled or not found",{serverName:V}),{resources:[]})).then(se=>{if(ne.signal.aborted||m.current!==de)return;const ve=se.resources.map(ze=>{const Pe=ui(ze.title??"")??ui(ze.name??"")??tm(ze.uri);return{id:`mcp-resource:${V}:${ze.uri}`,label:Pe,description:ui(ze.description??"")??ui(ze.mimeType??""),detail:tm(ze.uri),insertText:KKe(V,ze.uri),kind:"insert"}}).filter(ze=>I3(U,ze.label,ze.description,ze.detail)).sort((ze,Pe)=>ze.label.localeCompare(Pe.label)).slice(0,Sp);C(ze=>!ze||ze.level!=="items"?ze:{...ze,items:ve,selectedIndex:0,loading:!1})}).catch(se=>{ne.signal.aborted||m.current!==de||(console.warn("Failed to load @ MCP resources",se),C(ve=>!ve||ve.level!=="items"?ve:{...ve,items:[],selectedIndex:0,loading:!1}))})},[C,s]),I=h.useCallback((V,U,le,pe={})=>{var Q,ne;g.current&&clearTimeout(g.current),(Q=p.current)==null||Q.abort(),p.current=null;const fe=((ne=f.current)==null?void 0:ne.level)==="items"&&f.current.itemMode==="mcpResources"&&f.current.mcpServerName===V&&le.itemMode==="mcpResources"?f.current.items:[];if(C({...le,items:fe,loading:!0}),w.current.mcpResources.has(V)){z(V,U,le,{...pe,loadingAlreadySet:!0});return}g.current=setTimeout(()=>{g.current=null,z(V,U,le,{...pe,loadingAlreadySet:!0})},vG)},[z,C]),$=h.useCallback(V=>{if(t.current||n.current)return E(),!1;const U=ZKe(V);if(!U)return E(),!1;const le=f.current;if((le==null?void 0:le.level)==="items"&&le.from===U.from&&(le.to===U.to||le.inputMode==="search"&&U.to>=le.to||le.inputMode==="context"&&U.to>=le.to)&&le.selectedProviderId!==void 0&&S.current.some(Q=>Q.id===le.selectedProviderId)){if(!le.selectedProviderId)return!0;const Q=le.selectedProviderId,ne=le.inputMode==="context"?XKe(Q,U.query,le.mcpServerName):le.query;if(ne!==le.query){const de={...le,from:U.from,to:U.to,query:ne,selectedIndex:0,providers:S.current};return Q===Za&&le.itemMode==="mcpResources"&&le.mcpServerName?(I(le.mcpServerName,ne,de,{validateServer:le.validateMcpServer}),!0):(L(Q,ne,de),!0)}return C({...le,from:U.from,to:U.to,query:ne,providers:S.current}),!0}const fe=S.current.filter(Q=>I3(U.query,Q.textValue,Q.description)).slice(0,Sp);if((le==null?void 0:le.level)==="categories"&&le.from===U.from&&le.to===U.to&&le.query===U.query&&HKe(le.providers,fe))return!0;if(fe.length===0&&U.query){const Q=YKe(U.query,y.current,v.current);if(Q&&S.current.some(de=>de.id===Q.providerId))return Q.providerId===Za&&Q.serverName?(v.current=Q.serverName,I(Q.serverName,Q.itemQuery,{from:U.from,to:U.to,query:Q.itemQuery,level:"items",selectedProviderId:Za,selectedIndex:0,providers:S.current,itemMode:"mcpResources",mcpServerName:Q.serverName,fileDirectory:void 0,inputMode:"context",validateMcpServer:Q.validateServer},{validateServer:Q.validateServer}),!0):(L(Q.providerId,Q.itemQuery,{from:U.from,to:U.to,query:Q.itemQuery,level:"items",selectedProviderId:Q.providerId,selectedIndex:0,providers:S.current,itemMode:"default",mcpServerName:void 0,fileDirectory:Q.providerId===Xa?b.current:void 0,inputMode:"context"}),!0);const ne=S.current.find(de=>!j4(de.id)&&U.query.startsWith(`${de.id}:`));if(ne){const de=U.query.slice(ne.id.length+1);return L(ne.id,de,{from:U.from,to:U.to,query:de,level:"items",selectedProviderId:ne.id,selectedIndex:0,providers:S.current,itemMode:"default",mcpServerName:void 0,fileDirectory:void 0,inputMode:"context"}),!0}if(S.current.some(de=>de.id===Xa))return b.current=".",L(Xa,U.query,{from:U.from,to:U.to,query:U.query,level:"items",selectedProviderId:Xa,selectedIndex:0,providers:S.current,itemMode:"default",mcpServerName:void 0,fileDirectory:b.current,inputMode:"context"}),!0}return C({from:U.from,to:U.to,query:U.query,level:"categories",selectedIndex:0,providers:fe,items:[],loading:!1,inputMode:void 0}),!0},[E,t,L,I,C,n]),K=h.useCallback(V=>{const U=f.current;if(!U)return!1;const le=U.level==="categories"?U.providers.length:U.items.length;if(le<=0)return!0;const pe=aYe(U.selectedIndex,le,V);return pe===null||C({...U,selectedIndex:pe}),!0},[C]),R=h.useCallback(V=>{const U=f.current;if(!U)return!1;const le=U.level==="categories"?U.providers.length:U.items.length;return V<0||V>=le?!1:(C({...U,selectedIndex:V}),!0)},[C]),Y=h.useCallback(V=>{var fe,Q;const U=f.current;if(!U||U.level!=="categories")return!1;const le=U.providers[V??U.selectedIndex];if(!le)return!1;y.current=le.id,le.id===Xa&&(b.current=".");const pe=(Q=(fe=le.tabs)==null?void 0:fe.find(ne=>!ne.disabled))==null?void 0:Q.id;return L(le.id,U.query,{...U,level:"items",selectedProviderId:le.id,selectedIndex:0,tabs:le.tabs,selectedTabId:pe,itemMode:le.id===Za?"mcpServers":"default",mcpServerName:void 0,fileDirectory:le.id===Xa?b.current:void 0,inputMode:"search"}),!0},[L]),W=h.useCallback(V=>{const U=f.current;if(!U||U.level!=="items"||!U.selectedProviderId)return!1;const le={...U,query:V,selectedIndex:0,inputMode:"search"};return U.selectedProviderId===Za&&U.itemMode==="mcpResources"&&U.mcpServerName?(I(U.mcpServerName,V,le,{validateServer:U.validateMcpServer}),!0):(L(U.selectedProviderId,V,le),!0)},[L,I]),M=h.useCallback(V=>{var pe;const U=f.current;if(!U||U.level!=="items"||!U.selectedProviderId||!((pe=U.tabs)!=null&&pe.some(fe=>fe.id===V&&!fe.disabled)))return!1;if(U.selectedTabId===V)return!0;const le={...U,selectedTabId:V,selectedIndex:0,inputMode:"search"};return L(U.selectedProviderId,U.query,le),!0},[L]),F=h.useCallback(()=>{const V=f.current;if(!V||V.level!=="items")return!1;if(V.selectedProviderId===Za&&V.itemMode==="mcpResources")return L(Za,"",{...V,query:"",selectedIndex:0,itemMode:"mcpServers",mcpServerName:void 0,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),"items";if(V.selectedProviderId===Xa){const U=Pf(V.fileDirectory??b.current);if(U!==".")return b.current=JKe(U),L(Xa,"",{...V,query:"",selectedIndex:0,fileDirectory:b.current,inputMode:"search"}),"items"}return C({...V,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}),N(),"categories"},[N,L,C]),J=h.useCallback(V=>{const U=f.current;if(!U)return!1;if(U.level==="categories")return Y(V);const le=e.current;if(!le)return!1;if(U.loading)return!0;const pe=U.items[V??U.selectedIndex];if(!pe)return!1;if(U.selectedProviderId&&(y.current=U.selectedProviderId),U.selectedProviderId===Xa&&pe.kind==="directory"&&pe.targetPath)return b.current=Pf(pe.targetPath),L(Xa,"",{...U,query:"",selectedIndex:0,fileDirectory:b.current,inputMode:"search"}),!0;if(U.selectedProviderId===Za&&pe.kind==="mcp-server"&&pe.serverName)return v.current=pe.serverName,I(pe.serverName,"",{...U,query:"",selectedIndex:0,itemMode:"mcpResources",mcpServerName:pe.serverName,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),!0;const fe=pe.insertText??`@${n1(Th(pe.label))} `,Q=pe.composerTag&&!/\s$/.test(fe)?`${fe} `:fe,ne=le.state.doc.length;if(U.from<0||U.to<U.from||U.to>ne)return console.warn("[@mention] stale insertion range",{from:U.from,to:U.to,docLength:ne}),E(),!0;if(!le.state.doc.sliceString(U.from,U.to).startsWith("@"))return console.warn("[@mention] stale insertion text",{from:U.from,to:U.to}),E(),!0;x.current=!0;const ue=sYe(U.selectedProviderId,pe,Q),me=Q.trimEnd(),te=ue&&l?[l({from:U.from,to:U.from+me.length,tag:ue})]:void 0;return le.dispatch({changes:{from:U.from,to:U.to,insert:Q},...te?{effects:te}:{},selection:{anchor:U.from+Q.length},scrollIntoView:!0}),le.focus(),E({preserveProviderSelection:!0}),!0},[E,Y,l,L,I,e]);return{state:u,close:E,closeIfOpen:O,refreshForView:$,moveSelection:K,select:R,accept:J,enterCategory:Y,selectTab:M,backToCategories:F,updateSearch:W}}const cYe=Hn.mark({class:"cm-input-slash"}),uYe=Hn.mark({class:"cm-input-at"}),dYe=Hn.mark({class:"cm-input-code"});class hYe extends iu{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 kG(e,t,n){const s=new Ch,r=e.state.doc,i=[];let o=0,l=null,c=null;for(const u of e.visibleRanges){const d=r.lineAt(u.from).number,f=r.lineAt(u.to).number;for(let m=d;m<=f;m++){if(m<=o)continue;o=m;const p=r.line(m),g=p.text,b=p.from;if(g.startsWith("/")){const x=g.indexOf(" "),k=x===-1?g.length:x;i.push({from:b,to:b+k,deco:cYe}),l??(l=t()),c??(c=n());const _=MKe(g,l,c);if(_){const T=g.endsWith(" ")?"":" ";i.push({from:b+g.length,to:b+g.length,deco:Hn.widget({widget:new hYe(`${T}${_}`),side:1})})}}const w=/@[^\s]+/g;let y;for(;(y=w.exec(g))!==null;)i.push({from:b+y.index,to:b+y.index+y[0].length,deco:uYe});const v=/`[^`]+`/g;for(;(y=v.exec(g))!==null;)i.push({from:b+y.index,to:b+y.index+y[0].length,deco:dYe})}}i.sort((u,d)=>u.from-d.from||u.to-d.to);for(const{from:u,to:d,deco:f}of i)s.add(u,d,f);return s.finish()}function fYe(e=()=>[],t=()=>"en"){return Wi.fromClass(class{constructor(n){He(this,"decorations");this.decorations=kG(n,e,t)}update(n){(n.docChanged||n.viewportChanged)&&(this.decorations=kG(n.view,e,t))}},{decorations:n=>n.decorations})}const mYe=Yt.baseTheme({".cm-input-slash":{color:"var(--agent-blue-500, #4a9eff)",fontWeight:"bold"},".cm-input-at":{color:"var(--success-color, #48bb78)"},".cm-input-code":{background:"rgba(255, 255, 255, 0.06)",borderRadius:"3px",color:"var(--muted-foreground, #a0aec0)"},".cm-input-slash-argument-hint":{color:"color-mix(in srgb, var(--muted-foreground) 70%, transparent)",pointerEvents:"none"}});function s1(e){return e instanceof HTMLElement?e.isContentEditable?!0:!!e.closest('input, textarea, select, [contenteditable="true"], .cm-editor, [data-keyboard-scope]'):!1}function q6(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 $g(e,t){return{[e]:q6(t)}}const _G="web-shell-tooltip-styles",pYe=`
[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 SG(e){if(e.getElementById(_G))return;const n=(e instanceof Document?e:e.ownerDocument).createElement("style");n.id=_G,n.textContent=pYe,e instanceof Document?e.head.appendChild(n):e.appendChild(n)}function CG(e){const t=e.getRootNode();return t instanceof ShadowRoot?t:e.ownerDocument}function gYe(e,t,n){return t<=0?null:((e+(n==="up"?-1:1))%t+t)%t}function bYe(e){return typeof e.apply=="string"&&e.apply.trim().startsWith("/")}function zP(e){return bYe(e)}function yYe(e){var t;return typeof e.apply=="string"?e.apply.trim():((t=e.displayLabel)==null?void 0:t.trim())||e.label}function vYe(e){e.querySelectorAll(".cm-completionInfo-hover").forEach(t=>{t.remove()})}function wYe(e,t,n){if(!t.detail||!zP(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=`${yYe(t)}

${t.detail}`;const i=r.dataset.hideTimerId;i&&(window.clearTimeout(Number(i)),delete r.dataset.hideTimerId);const o=r.getBoundingClientRect(),l=18,c=12,u=12,d=window.innerWidth,f=window.innerHeight,m=n.clientX+l,p=m+o.width+u>d?Math.max(u,n.clientX-o.width-l):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 xYe(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 kYe(e){if(!e.detail||!zP(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=>{wYe(t,e,s)}),n.addEventListener("mouseleave",()=>{const s=t.closest("[data-web-shell-tooltip-portal]");s&&xYe(s)}))}),t}function rk(e){return y5(e)}function _Ye(e){return e.map(rk).join(`
`)}function H6(e){var t;return((t=e.label)==null?void 0:t.trim())??""}function U6(e){var t;return((t=e.value)==null?void 0:t.trim())??""}function FP(e){return U6(e)||H6(e)||e.id}function SYe(e,t){const n=_Ye(t);return n?e?`${n}

${e}`:n:e}function CYe(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(rk(i.tag)),s=i.end);return r.push(e.slice(s)),r.join("")}function W6(e){const t={...e};return delete t.iconUrl,delete t.renderContent,delete t.tooltip,delete t.tooltipText,delete t.onClick,t}const lg=Ts.define({map:e=>e}),M3=Ts.define(),Rc=Ts.define();let TYe=0;class EYe extends iu{constructor(n){super();He(this,"contentRoot",null);He(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=W6(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 w,y;b.stopPropagation(),(y=(w=this.tag).onClick)==null||y.call(w,{tag:r,placement:"composer",readonly:!1,anchorRect:s.getBoundingClientRect()})}),s.addEventListener("keydown",b=>{var w,y;b.key!=="Enter"&&b.key!==" "||(b.preventDefault(),(y=(w=this.tag).onClick)==null||y.call(w,{tag:r,placement:"composer",readonly:!1,anchorRect:s.getBoundingClientRect()}))}));const i=H6(this.tag),o=U6(this.tag),l=this.tag.kind?"":i,c=this.tag.iconUrl??h1(this.tag.kind),u=c&&(pD(c)||Rv(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=N7.createRoot(b),this.contentRoot.render(d),s.appendChild(b),f=!0}catch(w){(g=this.contentRoot)==null||g.unmount(),this.contentRoot=null,console.warn("[WebShell] inline tag renderContent failed",w)}}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",q6(u)),s.appendChild(b)}return f||this.appendDefaultContent(s,l,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 l;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=N7.createRoot(r),this.tooltipRoot.render(s),n.appendChild(r),r.id=`composer-tag-tooltip-${++TYe}`,n.setAttribute("aria-describedby",r.id)}catch(c){(l=this.tooltipRoot)==null||l.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 ${FP(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(gf).between(0,s.state.doc.length,(l,c,u)=>{const d=u.spec.tag;(d==null?void 0:d.id)===this.tag.id&&d.removable!==!1&&o.push({from:l,to:c,insert:""})}),o.length!==0&&(s.dispatch({changes:o,effects:M3.of({predicate:l=>l.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 AYe(e){const t={widget:new EYe(e.tag),inclusive:!1,tag:e.tag};return Hn.replace(t).range(e.from,e.to)}const gf=ll.define({create(){return Hn.none},update(e,t){let n=e.map(t.changes);for(const s of t.effects)s.is(lg)?n=n.update({add:[AYe(s.value)]}):s.is(M3)?n=n.update({filter:(r,i,o)=>{const l=o.spec.tag;return l&&s.value.predicate?!s.value.predicate(l):!0}}):s.is(Rc)&&(n=Hn.none);return n},provide:e=>[Yt.decorations.from(e),Yt.atomicRanges.of(t=>t.state.field(e))]});function TG(e){const t=[],n=e.state.field(gf,!1);return n==null||n.between(0,e.state.doc.length,(s,r,i)=>{const o=i.spec.tag;o&&t.push(W6(o))}),t}function EG(e){const t=e.state.field(gf,!1);if(!t)return!1;let n=!1;return t.between(0,e.state.doc.length,()=>(n=!0,!1)),n}function jYe(e){const t=[];return e.state.field(gf).between(0,e.state.doc.length,(n,s,r)=>{const i=r.spec.tag;i&&t.push({start:n,end:s,tag:W6(i)})}),t}const AG=new w1,jG=new w1,NG=new w1;function cg(e,t){return t&&(e.length===0||t.startsWith(e))?t:null}function NYe(e,t){const n=cg(e,t);if(!n||e.length===0)return null;const s=n.slice(e.length);return s.length>0?s:null}class IYe extends iu{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 IG(e){return Wi.fromClass(class{constructor(t){He(this,"decorations");this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){if(!e)return Hn.none;const n=t.state.selection.main,s=t.state.doc.toString(),r=NYe(s,e);return!r||!n.empty||n.head!==s.length?Hn.none:Hn.set([Hn.widget({widget:new IYe(r),side:1}).range(s.length)])}},{decorations:t=>t.decorations})}const MYe="qwen-web-shell-session-draft:",RYe="qwen-web-shell-pending-task-draft:",MG=2e3;function DYe(e,t){if(e)return`${MYe}${encodeURIComponent(e)}`;if(t)return`${RYe}${encodeURIComponent(t)}`}function N4(e){if(!e)return null;try{return localStorage.getItem(e)}catch{return null}}function wx(e,t){if(e)try{t?localStorage.setItem(e,t):localStorage.removeItem(e)}catch{}}function LYe(e,t){e&&N4(e)===t&&wx(e,"")}function PYe(e,t){if(e===t)return!0;if(!e||!t)return!1;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(s=>s!=="items"?Object.is(e[s],t[s]):e.items.length===t.items.length&&e.items.every((r,i)=>{const o=t.items[i];if(!o)return!1;const l=Object.keys(r);return l.length===Object.keys(o).length&&l.every(c=>Object.is(r[c],o[c]))}))}function RG(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 DG(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 l=o.result.split(",")[1];t({data:l,media_type:i})},o.readAsDataURL(r)}return n}function OYe(e){const{onSubmit:t,onInputTextChange:n,onCycleMode:s,onToggleShortcuts:r,disabled:i=!1,placeholderText:o="Type a message...",commands:l,skills:c=[],slashCommandCategoryOrder:u,queuedMessages:d=[],onPopQueuedMessages:f,currentMode:m="default",onFocusFooter:p,dialogOpen:g=!1,followupState:b,onAcceptFollowup:w,onDismissFollowup:y,sessionId:v,sessionName:x,composerInput:k,composerInputVersion:_,builtinAtProviders:T,atProviders:S,atWorkspaceCwd:C,composerTagIcons:N,parseUserMessageContent:E,renderComposerTag:O,renderComposerTagTooltip:B,onComposerTagClick:D,editorTheme:j}=e,L=see(),{language:z,t:I}=nt(),$=Gu(),K=bG(C),R=bG(),Y=K===R?void 0:R,W=DYe(v,C),M=h.useRef(null),F=h.useRef(null),J=tKe(),V=h.useRef(null),U=h.useRef(null),[le,pe]=h.useState(()=>J?N4(W)??"":""),fe=h.useRef(le),Q=h.useRef(0),ne=h.useRef({sessionId:v,workspaceCwd:C,storageKey:W}),de=h.useRef(!1),ue=h.useRef(()=>{}),me=h.useRef(()=>{}),te=h.useRef({sessionId:v,promptHistoryStorageKey:K,promptHistoryFallbackStorageKey:Y,draftStorageKey:W});te.current={sessionId:v,promptHistoryStorageKey:K,promptHistoryFallbackStorageKey:Y,draftStorageKey:W};const ae=h.useRef(null),be=h.useRef(t);be.current=t;const se=h.useRef(n);se.current=n;const ve=h.useCallback(X=>{var ge;Q.current+=1,fe.current=X,pe(X),ne.current.storageKey===void 0&&(de.current=!0),!us.current&&!lt.current&&me.current(),(ge=se.current)==null||ge.call(se,X)},[]);h.useEffect(()=>{var X;J&&fe.current&&((X=se.current)==null||X.call(se,fe.current))},[]);const ze=h.useRef(s);ze.current=s;const Pe=h.useRef(r);Pe.current=r;const _t=h.useRef(i);_t.current=i;const Pt=h.useRef(l);Pt.current=l;const St=h.useRef(c);St.current=c;const he=h.useRef(u);he.current=u;const Ae=h.useRef(I);Ae.current=I;const rt=h.useRef(d);rt.current=d;const dt=h.useRef(f);dt.current=f;const jt=h.useRef(b);jt.current=b;const et=h.useRef(w);et.current=w;const Mt=h.useRef(y);Mt.current=y;const sn=h.useRef(p);sn.current=p;const Ye=h.useRef(z);Ye.current=z;const $n=h.useRef(void 0);if(L&&C){const X=L.client.workspaceByCwd(C);$n.current={...L.actions,async globWorkspace(ge,Le){var Et,In;(Et=Le==null?void 0:Le.signal)==null||Et.throwIfAborted();const Ze=await X.glob(ge,{maxResults:Le==null?void 0:Le.maxResults,signal:Le==null?void 0:Le.signal});return(In=Le==null?void 0:Le.signal)==null||In.throwIfAborted(),{matches:Array.isArray(Ze.matches)?Ze.matches.filter(ms=>typeof ms=="string"):[]}},async listDirectory(ge,Le){var Bt,Et;if((Bt=Le==null?void 0:Le.signal)!=null&&Bt.aborted)return{kind:"list",path:ge,entries:[],truncated:!1};const Ze=await X.dirList(ge);return(Et=Le==null?void 0:Le.signal)!=null&&Et.aborted?{kind:"list",path:ge,entries:[],truncated:!1}:Ze}}}else $n.current=L==null?void 0:L.actions;const Te=h.useRef(N);Te.current=N;const ie=h.useRef(E);ie.current=E;const it=h.useRef(O);it.current=O;const we=h.useRef(B);we.current=B;const We=h.useRef(D);We.current=D;const ce=h.useCallback(X=>{var Et;const ge=X.icon??h1(X.kind,Te.current),Le={tag:X,placement:"composer",readonly:!1};let Ze;try{Ze=(Et=we.current)==null?void 0:Et.call(we,Le)}catch(In){console.warn("[WebShell] inline tag tooltip render failed",In)}const Bt=typeof Ze=="string"||typeof Ze=="number"?String(Ze):void 0;return{...X,...ge?{iconUrl:ge}:{},...it.current?{renderContent:it.current}:{},...Ze!=null?{tooltip:Ze}:{},...Bt?{tooltipText:Bt}:{},...We.current?{onClick:We.current}:{}}},[]),[De,ct]=h.useState(!1),qe=h.useRef(De);qe.current=De;const Ve=lYe({viewRef:F,disabledRef:_t,shellModeRef:qe,workspaceActionsRef:$n,workspaceKey:C,builtinProviders:T,providers:S,createInlineTagEffect:X=>lg.of({...X,tag:ce(X.tag)})}),Qt=Ve.close,Un=Ve.refreshForView;h.useEffect(()=>{const X=F.current;if(!X)return;const ge=[Rc.of()];X.state.field(gf).between(0,X.state.doc.length,(Le,Ze,Bt)=>{const Et=Bt.spec.tag;Et&&ge.push(lg.of({from:Le,to:Ze,tag:ce(W6(Et))}))}),ge.length!==1&&X.dispatch({effects:ge})},[N,D,O,B,ce]);const Ie=h.useCallback(()=>{var X,ge,Le;(X=jt.current)!=null&&X.isVisible&&((ge=Mt.current)==null||ge.call(Mt)),ct(Ze=>!Ze),(Le=F.current)==null||Le.focus()},[]),[wt,Wt]=h.useState(!1),[Me,Je]=h.useState(""),[pt,ln]=h.useState([]),[Bn,ns]=h.useState(0),lt=h.useRef(wt);lt.current=wt;const Xe=h.useRef(null),ot=h.useRef(null),Tt=h.useRef(""),[fn,Qn]=h.useState([]),Os=h.useRef([]),[rr,Es]=h.useState([]),cs=h.useRef([]);cs.current=rr;const[$t,xs]=h.useState(!1),Ce=h.useRef(!1),mn=h.useRef(null),gt=h.useCallback(()=>{mn.current===null&&(mn.current=[...cs.current])},[]),wn=h.useCallback(()=>{const X=mn.current;if(X===null)return;mn.current=null;const ge=[...X];cs.current=ge,Es(ge)},[]),Wn=h.useCallback(()=>{mn.current=null},[]),di=h.useCallback(()=>{cs.current=[],Es([])},[]),$s=h.useCallback((X,ge)=>{di(),X.dispatch({changes:{from:0,to:X.state.doc.length,insert:ge},effects:Rc.of(),selection:{anchor:ge.length}})},[di]),Gr=h.useCallback((X,ge)=>{const Le=fD(ge,ie.current,"[WebShell] failed to parse composer history content",{requireSourcePreservation:!0}),Ze=(Le==null?void 0:Le.some(In=>In.type==="tag"))??!1;if(!Le||!Ze){$s(X,ge);return}const Bt=[Rc.of()];let Et="";for(const In of Le){if(In.type==="text"){Et+=In.text;continue}const ms=y5(In.tag),as=Et.length;Et+=ms,Bt.push(lg.of({from:as,to:Et.length,tag:ce(In.tag)}))}di(),X.dispatch({changes:{from:0,to:X.state.doc.length,insert:Et},effects:Bt,selection:{anchor:Et.length}})},[di,ce,$s]),Gs=h.useCallback((X,ge)=>{if(qe.current){$s(X,ge);return}Gr(X,ge)},[Gr,$s]),Ks=h.useCallback(X=>{const ge=F.current;if(!ge){J&&ve(X);return}Gs(ge,X)},[J,Gs,ve]),Qr=h.useRef(k);Qr.current=k;const Rt=h.useRef(()=>!0),Ii=h.useRef(null),[uo,Or]=h.useState(null),hi=h.useRef(null),us=h.useRef(!1);h.useEffect(()=>{let X,ge=0,Le=!1;const Ze=()=>{X!==void 0&&(window.clearTimeout(X),X=void 0)},Bt=()=>{if(us.current||lt.current)return!1;const En=F.current,Ln=En?En.state.doc.toString():fe.current;return wx(ne.current.storageKey,Ln),!0},Et=()=>{Ze(),ge=0,Le&&Bt()&&(Le=!1)},In=()=>{const En=ge-Date.now();if(En>0){X=window.setTimeout(In,En);return}X=void 0,Et()},ms=()=>{Le=!0,ge=Date.now()+MG,X===void 0&&(X=window.setTimeout(In,MG))};ue.current=Et,me.current=ms;const as=()=>{document.visibilityState==="hidden"&&Et()},ps=()=>Et();return document.addEventListener("visibilitychange",as),window.addEventListener("pagehide",ps),()=>{window.removeEventListener("pagehide",ps),document.removeEventListener("visibilitychange",as),Et(),ue.current=()=>{},me.current=()=>{}}},[]);const Jt=h.useCallback(X=>{PYe(hi.current,X)||(hi.current=X,Or(X))},[]),Ys=h.useCallback(()=>{const X=Ii.current,ge=F.current;if(!X||!ge)return;const Le=ge.state.doc,Ze=X.from+X.text.length;Le.length===Ze&&Le.sliceString(X.from,Ze)===X.text&&ge.dispatch({changes:{from:X.from,to:Ze,insert:""}}),Ii.current=null},[]),Bs=h.useCallback(()=>{Ys(),Qt()},[Ys,Qt]),ho=Ve.closeIfOpen,Si=h.useCallback(()=>{const X=ho();return X?(X==="closed"&&Ys(),!0):!1},[Ys,ho]),si=h.useCallback((X,ge)=>{var as;if(!X||_t.current||qe.current){Jt(null);return}if(us.current){Jt(null);return}const Le=X.state.selection.main;if(!Le.empty){Jt(null);return}const Ze=X.state.doc.lineAt(Le.head);if(!Ze.text.startsWith("/")){Jt(null);return}const Bt=PKe(Ze.text,Le.head-Ze.from,Pt.current,St.current,Ye.current,ps=>Ae.current(ps),he.current??o_);if(!Bt){Jt(null);return}const Et={...Bt,from:Ze.from+Bt.from,to:Ze.from+Bt.to};Bs();const In=ge??((as=hi.current)==null?void 0:as.selectedIndex)??0,ms=Math.max(0,Math.min(In,Et.items.length-1));Jt({...Et,selectedIndex:ms})},[Bs,Jt]),pr=h.useCallback(()=>{Jt(null)},[Jt]),xe=h.useCallback(X=>{const ge=hi.current;return!ge||X<0||X>=ge.items.length?!1:(ge.selectedIndex===X||Jt({...ge,selectedIndex:X}),!0)},[Jt]),Ge=h.useCallback(X=>{const ge=hi.current;if(!ge)return!1;const Le=gYe(ge.selectedIndex,ge.items.length,X);return Le===null?!1:(Jt({...ge,selectedIndex:Le}),!0)},[Jt]),tt=h.useCallback(X=>{const ge=F.current,Le=hi.current;if(!ge||!Le)return!1;const Ze=Le.items[X??Le.selectedIndex];return Ze?(ge.dispatch({changes:{from:Le.from,to:Le.to,insert:Ze.apply},selection:{anchor:Le.from+Ze.apply.length},scrollIntoView:!0}),ge.focus(),!0):!1},[]),[Zt,Tn]=h.useState(!1),Gn=h.useRef(!1),Jr=h.useCallback(X=>{Gn.current!==X&&(Gn.current=X,Tn(X))},[]);h.useEffect(()=>{const X=F.current,ge=X?X.state.doc.toString():le,Le=cg(ge,b!=null&&b.isVisible?b.suggestion:null);Jr(ge.trim().length>0||!!Le||rr.length>0||fn.length>0)},[rr,fn,le,b==null?void 0:b.isVisible,b==null?void 0:b.suggestion,Jr]);const zs=yG(K,Y),vs=yG("qwen-web-shell-command-history"),{push:$r,navigateUp:Xs,navigateDown:fs,isNavigating:ks,reset:gr,getReverseMatches:Vt,getLastEntry:Sr,resetSearch:ir}=zs,Ot=h.useRef({push:$r,navigateUp:Xs,navigateDown:fs,isNavigating:ks,reset:gr,getReverseMatches:Vt,getLastEntry:Sr,resetSearch:ir});Ot.current={push:$r,navigateUp:Xs,navigateDown:fs,isNavigating:ks,reset:gr,getReverseMatches:Vt,getLastEntry:Sr,resetSearch:ir};const Ns=h.useRef(vs);Ns.current=vs,Os.current=fn;const Qs=h.useCallback(X=>{const ge=qe.current,Ze=(ge?Ns.current:Ot.current).getReverseMatches(X);return ge?Ze:Ze.filter(Bt=>!Bt.trimStart().startsWith("/"))},[]),Cr=h.useCallback(()=>{if(_t.current)return;const X=F.current;if(!X&&!J)return;ue.current(),pr(),Bs();const ge=X?X.state.doc.toString():fe.current;Tt.current=ge,Wt(!0),Je("");const Le=qe.current?Ns.current:Ot.current;ln(Qs("")),ns(0),Le.resetSearch(),setTimeout(()=>{var Ze;return(Ze=Xe.current)==null?void 0:Ze.focus()},0)},[Bs,pr,Qs,J]),$e=h.useRef(Cr);$e.current=Cr;const ut=h.useCallback(()=>{if(_t.current)return;const X=F.current;if(!X)return;if(Ac(X.state)==="active"){cp(!1)(X),X.focus();return}if(X.state.doc.lines>1){X.focus();return}const ge=qe.current?Ns.current:Ot.current,Le=X.state.doc.toString();ge.isNavigating()||ue.current();const Ze=ge.navigateUp(Le);Ze!==null&&(us.current=!0,qe.current||gt(),Gs(X,Ze)),X.focus()},[gt,Gs]),Ht=h.useCallback(()=>{if(_t.current)return;const X=F.current;if(!X)return;if(Ac(X.state)==="active"){cp(!0)(X),X.focus();return}if(X.state.doc.lines>1){X.focus();return}const ge=qe.current?Ns.current:Ot.current,Le=ge.navigateDown();if(Le!==null){const Ze=!qe.current&&!ge.isNavigating();us.current=ge.isNavigating(),Gs(X,Le),Ze&&wn()}X.focus()},[Gs,wn]),pn=h.useCallback(X=>{ve(X.target.value)},[ve]);h.useLayoutEffect(()=>{if(!J)return;const X=V.current;if(!X)return;const ge=parseFloat(getComputedStyle(X).maxHeight);U.current=Number.isFinite(ge)&&ge>0?ge:Number.POSITIVE_INFINITY},[J]),h.useEffect(()=>{var ge;if(!J)return;const X=V.current;if(X){if(typeof CSS<"u"&&((ge=CSS.supports)!=null&&ge.call(CSS,"field-sizing","content"))){X.style.height="";return}if(X.style.height="auto",X.scrollHeight>0){const Le=U.current??Number.POSITIVE_INFINITY,Ze=Math.min(X.scrollHeight,Le);X.style.height=`${Ze}px`}}},[J,le]);const an=h.useCallback(X=>{var Ze;const ge=(Ze=X.clipboardData)==null?void 0:Ze.items;if(!ge)return;DG(ge,Bt=>Qn(Et=>[...Et,Bt]))&&X.preventDefault()},[]),Be=(X,ge,Le,Ze=!1)=>{const Bt=Le===void 0&&X?jYe(X):[],Et=X?X.state.doc.toString():fe.current,In=jt.current,ms=ge===void 0&&!Ze&&Bt.length===0&&(In!=null&&In.isVisible)?cg(Et,In.suggestion):null,as=ge??ms??Et,ps=as.length-as.trimStart().length,En=as.trim(),Ln=ge===void 0&&ms===null?Bt.map(Is=>({...Is,start:Is.start-ps,end:Is.end-ps})).filter(Is=>Is.end>0).map(Is=>({...Is,start:Math.max(0,Is.start)})):[],gs=Le??cs.current;if(!En&&gs.length===0&&Bt.length===0)return!0;const Zs=Le===void 0?CYe(En,Ln):En,mo=SYe(Zs,gs),ba=Os.current,po=qe.current,er=po?`!${mo}`:mo,Gi=t2e(er,[...gs,...Ln.map(Is=>Is.tag)]),Ar={...te.current},fi=Et,ou=X==null?void 0:X.state.doc,Ci=Q.current,xt=cs.current,vn=Os.current,Xn=qe.current;let xn=!1;const Zn=()=>{var ya,qa,au;if(xn)return;xn=!0;const Is=te.current;if(F.current!==X||Is.sessionId!==Ar.sessionId||Is.promptHistoryStorageKey!==Ar.promptHistoryStorageKey){po?Ns.current.push(Zs):Is.promptHistoryStorageKey===Ar.promptHistoryStorageKey?Ot.current.push(Zs):OKe(Ar.promptHistoryStorageKey,Zs,Ar.promptHistoryFallbackStorageKey),LYe(Ar.draftStorageKey,fi);return}(ya=Mt.current)==null||ya.call(Mt),po?(Ns.current.push(Zs),Ns.current.reset()):(Ot.current.push(Zs),Ot.current.reset());const Nl=(X?X.state.doc===ou:Q.current===Ci)&&cs.current===xt&&Os.current===vn&&qe.current===Xn;us.current=!1,Nl&&(wx(Ar.draftStorageKey,""),Jt(null),ms&&((qa=et.current)==null||qa.call(et,"enter",{skipOnAccept:!0})),(au=Mt.current)==null||au.call(Mt),Wn(),Es([]),Qn([]),X?X.dispatch({changes:{from:0,to:X.state.doc.length,insert:""},effects:Rc.of()}):ve(""))};return be.current(er,ba.length>0?[...ba]:void 0,Zn,Gi.length>0?{inputAnnotations:Gi}:void 0)===!1||Zn(),!0};Rt.current=Be,h.useEffect(()=>{var fi,ou,Ci;if(!M.current)return;const X=$??document.body;SG(CG(X));const ge=document.createElement("div");ae.current=ge,ge.setAttribute("data-web-shell-tooltip-portal",""),ge.style.position="fixed",ge.style.inset="0",ge.style.zIndex="var(--web-shell-tooltip-z-index)",ge.style.pointerEvents="none";const Le=/\b\S*theme(?:Dark|Light)\S*/gi,Ze=()=>{var Xn,xn;let xt=M.current,vn=null;if(M.current){const Zn=getComputedStyle(M.current);for(let bs=0;bs<Zn.length;bs+=1){const Is=Zn[bs];Is.startsWith("--")&&ge.style.setProperty(Is,Zn.getPropertyValue(Is))}Zn.getPropertyValue("--web-shell-tooltip-z-index").trim()||ge.style.setProperty("--web-shell-tooltip-z-index","1000")}for(;xt;){const Zn=(xn=(Xn=xt.className)==null?void 0:Xn.match)==null?void 0:xn.call(Xn,Le);if(Zn){vn=Zn[0];break}xt=xt.parentElement}vn&&(ge.className=vn)};Ze(),X.appendChild(ge);const Bt=new MutationObserver(Ze);let Et=M.current;for(;Et&&(Bt.observe(Et,{attributes:!0,attributeFilter:["class","style"]}),!((ou=(fi=Et.className)==null?void 0:fi.match)!=null&&ou.call(fi,Le)));)Et=Et.parentElement;const In=(xt,vn,Xn,xn=!1)=>Rt.current(xt,vn,Xn,xn),ms=xt=>(xt.dispatch(xt.state.replaceSelection(`
`)),!0),as=(xt,vn)=>{var bs;const Xn=jt.current,xn=Xn==null?void 0:Xn.suggestion,Zn=cg(xt.state.doc.toString(),xn);return!(Xn!=null&&Xn.isVisible)||!Zn?!1:(xt.dispatch({changes:{from:0,to:xt.state.doc.length,insert:Zn},selection:{anchor:Zn.length},scrollIntoView:!0}),xt.focus(),(bs=et.current)==null||bs.call(et,vn,{skipOnAccept:!0}),!0)},ps=Uy.of([{key:"Backspace",run:xt=>{var Zn;const vn=xt.state.selection.main;if(!vn.empty||vn.from!==0)return!1;let Xn=!1;if(xt.state.field(gf).between(0,1,bs=>{bs===0&&(Xn=!0)}),Xn)return!1;let xn=-1;for(let bs=cs.current.length-1;bs>=0;bs-=1)if(((Zn=cs.current[bs])==null?void 0:Zn.removable)!==!1){xn=bs;break}return xn<0?!1:(Es(bs=>bs.filter((Is,go)=>go!==xn)),!0)}},{key:"Delete",run:xt=>{const vn=xt.state.selection.main;if(!vn.empty||vn.from!==0)return!1;let Xn=!1;if(xt.state.field(gf).between(0,1,Zn=>{Zn===0&&(Xn=!0)}),Xn)return!1;const xn=cs.current.findIndex(Zn=>Zn.removable!==!1);return xn<0?!1:(Es(Zn=>Zn.filter((bs,Is)=>Is!==xn)),!0)}},{key:"Enter",run:xt=>{var Zn;if(Ve.accept())return!0;if(hi.current)return tt();if(Ac(xt.state)==="active")return!1;const vn=jt.current,xn=EG(xt)?null:cg(xt.state.doc.toString(),vn==null?void 0:vn.suggestion);return vn!=null&&vn.isVisible&&xn?((Zn=et.current)==null||Zn.call(et,"enter",{skipOnAccept:!0}),In(xt,xn)):In(xt)}},{key:"Shift-Enter",run:ms},{key:"Ctrl-j",run:ms},{key:"Mod-Enter",run:ms},{key:"Alt-Enter",run:ms},{key:"Escape",run:()=>Si()?!0:hi.current?(pr(),!0):qe.current?(ct(!1),!0):!1},{key:"Ctrl-o",run:()=>!0},{key:"Ctrl-l",run:()=>!0},{key:"Ctrl-y",run:()=>!0},{key:"ArrowUp",run:xt=>{var Is;const vn=qe.current?Ns.current:Ot.current,Xn=us.current;if(Xn)A4(xt),pr(),Bs();else{if(Ve.moveSelection("up")||Ge("up"))return!0;if(Ac(xt.state)==="active")return cp(!1)(xt)}const xn=RG(xt,"up");if(xn==="handled")return!0;if(xn==="editor")return!1;if(qe.current){const go=xt.state.doc.toString();Xn||ue.current();const Nl=vn.navigateUp(go);return Nl===null||(us.current=!0,Gs(xt,Nl)),!0}if(rt.current.length>0&&(Is=dt.current)!=null&&Is.call(dt))return!0;const Zn=xt.state.doc.toString();Xn||ue.current();const bs=vn.navigateUp(Zn);return bs===null?!1:(gt(),us.current=!0,Gs(xt,bs),!0)}},{key:"ArrowDown",run:xt=>{var Is;const vn=qe.current?Ns.current:Ot.current;if(us.current)A4(xt),pr(),Bs();else{if(Ve.moveSelection("down")||Ge("down"))return!0;if(Ac(xt.state)==="active")return cp(!0)(xt)}const xn=RG(xt,"down");if(xn==="handled")return!0;if(xn==="editor")return!1;if(qe.current){const go=vn.navigateDown();return go===null||(us.current=vn.isNavigating(),Gs(xt,go)),!0}const Zn=vn.navigateDown();if(Zn===null)return((Is=sn.current)==null?void 0:Is.call(sn))??!1;const bs=!vn.isNavigating();return us.current=!bs,Gs(xt,Zn),bs&&wn(),!0}},{key:"Ctrl-r",run:()=>($e.current(),!0)},{key:"Tab",run:xt=>{if(Ve.accept()||as(xt,"tab"))return!0;if(hi.current)return tt();if(Ac(xt.state)==="active")return ade(xt);const vn=xt.state.doc.toString(),Xn=IKe(vn,Pt.current,Ye.current);if(Xn)return xt.dispatch({changes:{from:0,to:xt.state.doc.length,insert:Xn},selection:{anchor:Xn.length}}),!0;const xn=NKe(vn,Pt.current);return xn&&xt.dispatch({changes:{from:0,to:xt.state.doc.length,insert:xn},selection:{anchor:xn.length}}),!0}},{key:"ArrowRight",run:xt=>!!(Ac(xt.state)!=="active"&&as(xt,"right"))},{key:"Shift-Tab",run:()=>{var xt;return(xt=ze.current)==null||xt.call(ze),!0}}]);let En=null,Ln="";const gs=xt=>(En!==xt.doc&&(En=xt.doc,Ln=xt.doc.toString()),Ln),jl=Yt.updateListener.of(xt=>{xt.transactions.some(Xn=>Xn.isUserEvent("input")||Xn.isUserEvent("delete"))&&(us.current=!1),(xt.docChanged||xt.selectionSet)&&(si(xt.view),us.current?Bs():Un(xt.view)&&pr())});let Zs=!1;const mo=Yt.updateListener.of(xt=>{const vn=Ii.current,Xn=Ac(xt.state)==="active";if(vn){const xn=xt.state.doc;if(!(xn.length===vn.from+vn.text.length&&xn.sliceString(vn.from)===vn.text))Ii.current=null;else if(Zs&&!Xn){Ii.current=null;const{view:bs}=xt,{from:Is}=vn;window.setTimeout(()=>{if(F.current!==bs)return;const go=bs.state.doc;go.length===Is+vn.text.length&&go.sliceString(Is)===vn.text&&bs.dispatch({changes:{from:Is,to:Is+vn.text.length,insert:""}})},0)}}Zs=Xn,Xn||vYe(ge)}),ba=wr.create({doc:N4(ne.current.storageKey)??"",extensions:[w0.highest(ps),JGe,kP(),Uy.of([...CP,..._P]),hde({override:[],activateOnTyping:!0,icons:!1,optionClass:xt=>{const vn=[];return xt.type==="file"&&vn.push("cm-file-completion"),zP(xt)&&vn.push("cm-command-info-completion"),vn.join(" ")},addToOptions:[{render:kYe,position:90}],maxRenderedOptions:300,aboveCursor:!0,positionInfo:(xt,vn,Xn,xn,Zn)=>{const bs=xn.bottom-xn.top,Is=Zn.bottom-vn.bottom,go=Is>=bs||Is>vn.top,Nl=go?"top":"bottom",ya=go?Xn.bottom-vn.top:vn.bottom-Xn.top;return{style:`${Nl}: ${ya}px`,class:"cm-completionInfo-right-narrow"}},activateOnCompletion:xt=>typeof xt.apply=="string"&&xt.apply.endsWith(" ")}),LHe({parent:ge}),jG.of(wV("")),NG.of(IG(null)),Yt.lineWrapping,AG.of(Yt.editable.of(!0)),fYe(()=>Pt.current,()=>Ye.current),mYe,gf,jl,mo,Yt.updateListener.of(xt=>{var Xn;if(xt.docChanged||xt.transactions.some(xn=>xn.effects.some(Zn=>Zn.is(lg)||Zn.is(M3)||Zn.is(Rc)))){const xn=EG(xt.view);Ce.current!==xn&&(Ce.current=xn,xs(xn))}if(xt.docChanged){const xn=gs(xt.state);ne.current.storageKey===void 0&&(de.current=!0),!us.current&&!lt.current&&me.current(),(Xn=se.current)==null||Xn.call(se,xn);const Zn=jt.current,bs=cg(xn,Zn!=null&&Zn.isVisible?Zn.suggestion:null);Jr(xn.trim().length>0||!!bs||cs.current.length>0||Os.current.length>0)}}),Yt.inputHandler.of((xt,vn,Xn,xn)=>{var Zn;return xn==="!"&&xt.state.doc.toString()===""&&Ac(xt.state)!=="active"?(Ie(),!0):xn==="?"&&xt.state.doc.toString()===""&&Ac(xt.state)!=="active"?((Zn=Pe.current)==null||Zn.call(Pe),!0):!1}),Yt.domEventHandlers({blur(xt){return pr(),xt.relatedTarget instanceof Element&&xt.relatedTarget.closest('[data-at-mention-panel="true"]')||window.setTimeout(()=>{const vn=F.current;vn!=null&&vn.hasFocus||document.activeElement instanceof Element&&document.activeElement.closest('[data-at-mention-panel="true"]')||Bs()},0),!1},paste(xt){var xn;const vn=(xn=xt.clipboardData)==null?void 0:xn.items;return vn&&DG(vn,Zn=>Qn(bs=>[...bs,Zn]))?(xt.preventDefault(),!0):!1}}),Yt.theme(j)]}),po=new Yt({state:ba,parent:M.current});F.current=po;const er=()=>ue.current();po.dom.addEventListener("blur",er,!0),vx()||po.focus();const Gi=po.state.doc.toString(),Ar=Gi.trim();return Gi&&((Ci=se.current)==null||Ci.call(se,Gi)),Jr(Ar.length>0||cs.current.length>0||Os.current.length>0),()=>{po.dom.removeEventListener("blur",er,!0),ue.current(),po.dispatch({effects:Rc.of()}),po.destroy(),F.current=null,Bt.disconnect(),ge.remove(),ae.current=null}},[]),h.useEffect(()=>{const X=ne.current,ge=F.current,Le=X.sessionId!==v,Ze=X.workspaceCwd!==C,Bt=X.storageKey!==W,Et=us.current,In=lt.current;if(!Le&&!Ze)return;Ot.current.reset(),Ns.current.reset(),us.current=!1,Wn(),Tt.current="",Wt(!1),Je(""),ln([]),ns(0);const ms=ge?ge.state.doc.toString():fe.current;if(Bt&&!Et&&!In&&wx(X.storageKey,ms),ne.current={sessionId:v,workspaceCwd:C,storageKey:W},!Bt||!ge&&!J)return;const as=N4(W),ps=!Et&&!In&&X.sessionId===void 0&&v===void 0&&X.workspaceCwd===void 0&&X.storageKey===void 0&&C!==void 0&&(de.current||as===null);de.current=!1;const En=ps?ms:as??"";ps&&wx(W,ms),Es([]),Qn([]),ge?ge.dispatch({changes:{from:0,to:ge.state.doc.length,insert:En},effects:Rc.of(),selection:{anchor:En.length}}):ve(En),W===void 0&&(de.current=!1)},[C,Wn,W,J,v,ve]),h.useEffect(()=>{const X=ae.current;if(!X)return;const ge=$??document.body;SG(CG(ge)),ge.appendChild(X)},[$]),h.useEffect(()=>{const X=F.current;X&&(X.dispatch({effects:AG.reconfigure(Yt.editable.of(!i))}),!i&&!vx()&&X.focus())},[i]);const cn=!i&&(b!=null&&b.isVisible)&&b.suggestion?b.suggestion:null,Jn=cn??(De?I("editor.shellPlaceholder"):o);h.useEffect(()=>{const X=F.current;X&&X.dispatch({effects:[jG.reconfigure(wV(Jn)),NG.reconfigure(IG(cn))]})},[Jn,cn]),h.useEffect(()=>{const X=F.current;!X||Ac(X.state)!=="active"||(A4(X),window.setTimeout(()=>{F.current===X&&E4(X)},0))},[z]);const Us=[l.map(X=>{var ge;return[X.name,X.description??"",X.source??"",X.displayCategory??"",X.argumentHint??"",((ge=X.subcommands)==null?void 0:ge.join(","))??""].join("\0")}).join(""),c.map(X=>[X.name,X.description].join("\0")).join(""),(u==null?void 0:u.join("|"))??""].join("");h.useEffect(()=>{hi.current&&si(F.current)},[Us,z,si]),h.useEffect(()=>{const X=F.current;X&&(g?(pr(),Bs(),X.contentDOM.blur()):vx()||X.focus())},[Bs,g,pr]),h.useEffect(()=>{const X=ge=>{var ps,En,Ln;if(_t.current||wt||g||ge.defaultPrevented)return;const Le=ge.target,Ze=(ps=M.current)==null?void 0:ps.contains(Le),Bt=document.activeElement===document.body;if(!Ze&&!Bt)return;const Et=F.current,In=jt.current,ms=cg((Et==null?void 0:Et.state.doc.toString())??"",In==null?void 0:In.suggestion);if(Et&&!Et.hasFocus&&(In!=null&&In.isVisible)&&ms&&!s1(ge.target)){if(ge.key==="Tab"&&!ge.shiftKey&&!ge.metaKey&&!ge.ctrlKey&&!ge.altKey&&Ac(Et.state)!=="active"){ge.preventDefault(),Et.dispatch({changes:{from:0,to:Et.state.doc.length,insert:ms},selection:{anchor:ms.length},scrollIntoView:!0}),Et.focus(),(En=et.current)==null||En.call(et,"tab",{skipOnAccept:!0});return}if(ge.key==="ArrowRight"&&!ge.shiftKey&&!ge.metaKey&&!ge.ctrlKey&&!ge.altKey&&Ac(Et.state)!=="active"){ge.preventDefault(),Et.dispatch({changes:{from:0,to:Et.state.doc.length,insert:ms},selection:{anchor:ms.length},scrollIntoView:!0}),Et.focus(),(Ln=et.current)==null||Ln.call(et,"right",{skipOnAccept:!0});return}}if(ge.metaKey||ge.ctrlKey||ge.altKey||ge.key.length!==1||s1(ge.target)||!Et||Et.hasFocus)return;if(ge.preventDefault(),ge.key==="!"&&Et.state.doc.toString()===""){Ie();return}const as=Et.state.selection.main;Et.dispatch({changes:{from:as.from,to:as.to,insert:ge.key},selection:{anchor:as.from+ge.key.length},scrollIntoView:!0}),Et.focus(),ge.key==="/"?window.setTimeout(()=>{si(F.current)},0):ge.key==="@"&&window.setTimeout(()=>{const gs=F.current;gs&&gs.hasFocus&&(pr(),Un(gs))},0)};return window.addEventListener("keydown",X),()=>window.removeEventListener("keydown",X)},[Un,pr,wt,g,si,Ie]);const dn=h.useCallback(()=>{var X,ge;if(J){(X=V.current)==null||X.focus();return}(ge=F.current)==null||ge.focus()},[J]),hn=h.useCallback((X,ge)=>{var ps;if(J){if(X)if((ge==null?void 0:ge.mode)==="replace")ve(X);else{const En=V.current,Ln=fe.current,gs=En?En.selectionStart:Ln.length,jl=En?En.selectionEnd:Ln.length,Zs=gs+X.length;ve(Ln.slice(0,gs)+X+Ln.slice(jl));const mo=()=>{var ba;(ba=V.current)==null||ba.setSelectionRange(Zs,Zs)};typeof requestAnimationFrame=="function"?requestAnimationFrame(mo):window.setTimeout(mo,0)}(ps=V.current)==null||ps.focus();return}const Le=F.current;if(!Le||!X){Le==null||Le.focus();return}if((ge==null?void 0:ge.mode)==="replace"){Le.dispatch({changes:{from:0,to:Le.state.doc.length,insert:X},effects:Rc.of(),selection:{anchor:X.length},scrollIntoView:!0}),Le.focus();return}const Ze=Le.state.selection.main;let Bt=X,Et=!1,In=null;const ms=X==="@";let as=X==="/";if(X==="/")Le.state.doc.lineAt(Ze.head).text.startsWith("/")?Et=!0:Le.state.doc.length>0&&(Et=!0,as=!1);else if(X==="@"){const En=Ze.from>0?Le.state.doc.sliceString(Ze.from-1,Ze.from):"";Le.state.doc.sliceString(Ze.from,Ze.from+1)==="@"?(Et=!0,In=Ze.from+1):En==="@"?Et=!0:En&&!/\s/.test(En)&&(Bt=" @")}Et?In!==null&&Le.dispatch({selection:{anchor:In},scrollIntoView:!0}):(Le.dispatch({changes:{from:Ze.from,to:Ze.to,insert:Bt},selection:{anchor:Ze.from+Bt.length},scrollIntoView:!0}),ms&&(Ii.current={text:Bt,from:Ze.from})),Le.focus(),as?window.setTimeout(()=>{si(F.current)},0):ms&&window.setTimeout(()=>{const En=F.current;En&&En.hasFocus&&(pr(),Un(En))},0)},[pr,J,Un,si,ve]),Tr=h.useCallback(()=>{var X;return J?fe.current:((X=F.current)==null?void 0:X.state.doc.toString())??""},[J]),br=h.useCallback(X=>{if(J){ve(X);return}const ge=F.current;ge&&(ge.dispatch({changes:{from:0,to:ge.state.doc.length,insert:X},effects:Rc.of(),selection:{anchor:X.length},scrollIntoView:!0}),ge.focus())},[J,ve]),Lo=h.useCallback(X=>{const ge=F.current;if(!ge)return;const Le=[];ge.state.field(gf).between(0,ge.state.doc.length,(Ze,Bt,Et)=>{const In=Et.spec.tag;In&&(!X||X(In))&&Le.push({from:Ze,to:Bt,insert:""})}),Le.length!==0&&ge.dispatch({changes:Le,effects:M3.of({predicate:X}),scrollIntoView:!0})},[]),Js=h.useCallback(X=>{const ge=(X==null?void 0:X.text)??!0,Le=(X==null?void 0:X.tags)??!0,Ze=F.current;ge&&Ze&&Ze.state.doc.length>0&&Ze.dispatch({changes:{from:0,to:Ze.state.doc.length,insert:""},effects:Rc.of()}),ge&&J&&ve(""),ge&&Qn([]),Le&&(Es([]),ge||Lo())},[J,Lo,ve]),Er=h.useCallback(()=>{Js({text:!0,tags:!1})},[Js]),To=h.useCallback((X,ge)=>{if(X.length!==0){if((ge==null?void 0:ge.placement)==="inline"&&!J){const Le=F.current;if(!Le)return;const Ze=Le.state.selection.main;let Bt=Ze.from;const Et=[],In=X.map(as=>{const ps=rk(as);return Et.push({from:Bt,to:Bt+ps.length,tag:as}),Bt+=ps.length+1,ps}).join(" "),ms=In?`${In} `:"";Le.dispatch({changes:{from:Ze.from,to:Ze.to,insert:ms},effects:Et.length>0?Et.map(as=>lg.of({...as,tag:ce(as.tag)})):void 0,selection:{anchor:Ze.from+ms.length},scrollIntoView:!0}),Le.focus();return}Es(Le=>{const Ze=[...Le];for(const Bt of X){const Et=Ze.findIndex(In=>In.id===Bt.id);Et>=0?Ze[Et]=Bt:Ze.push(Bt)}return Ze})}},[J,ce]),Kr=h.useCallback(X=>{Es(ge=>{const Le=ge.filter(Ze=>Ze.id!==X||Ze.removable===!1);return Le.length===ge.length?ge:Le}),Lo(ge=>ge.id===X&&ge.removable!==!1)},[Lo]),ga=h.useCallback(()=>{var ge;return(J?fe.current:((ge=F.current)==null?void 0:ge.state.doc.toString())??"").trim().length>0||cs.current.length>0||Os.current.length>0},[J]),ri=h.useCallback(()=>(F.current?TG(F.current):[]).length>0||cs.current.length>0||Os.current.length>0,[]),Zr=h.useCallback(X=>{const ge=F.current;if(!ge&&!J)return;const Le=ge?TG(ge):[];if((X==null?void 0:X.tagPlacement)==="inline"){Rt.current(ge,X.text??"",X.tags??Le);return}if((X==null?void 0:X.text)!==void 0&&X.tags===void 0&&Le.length>0){Rt.current(ge,X.text,Le);return}Rt.current(ge,X==null?void 0:X.text,X?X.tags??[]:void 0)},[J]),_s=h.useCallback(()=>{const X=Ot.current.getLastEntry(Le=>!Le.startsWith("/")&&!Le.startsWith("!"));!X||be.current(X)===!1||Qn([])},[]),Po=h.useCallback(X=>{if(J){ve(X);return}const ge=F.current;ge&&ge.dispatch({changes:{from:0,to:ge.state.doc.length,insert:X},selection:{anchor:X.length},scrollIntoView:!0})},[J,ve]);h.useEffect(()=>{const X=Qr.current;if(!X)return;const ge=F.current;if(!ge&&!J)return;const Le=X.tagPlacement??"top";if(X.tags!==void 0&&Le==="top"&&Es([...X.tags]),!ge){X.tags!==void 0&&Le==="inline"&&Es([...X.tags]),X.text!==void 0&&ve(X.text);let Bt=null;return X.submit&&(Bt=window.setTimeout(()=>{Zr(X)},0)),()=>{Bt!==null&&window.clearTimeout(Bt)}}if(X.text!==void 0||Le==="inline"){const Bt=Le==="inline"?[...X.tags??[]]:[],Et=Bt.map(rk).join(" "),In=Le==="inline"?Et&&X.text?`${Et} ${X.text}`:Et||(X.text??""):X.text??"",ms=[Rc.of()];if(Bt.length>0){let as=0;for(const ps of Bt){const En=rk(ps);ms.push(lg.of({from:as,to:as+En.length,tag:ce(ps)})),as+=En.length+1}}ge.dispatch({changes:{from:0,to:ge.state.doc.length,insert:In},effects:ms,selection:{anchor:In.length},scrollIntoView:!0})}else ge.dispatch({effects:Rc.of()});(X.text!==void 0||X.submit)&&!vx()&&ge.focus();let Ze=null;return X.submit&&(Ze=window.setTimeout(()=>{F.current&&Zr(X)},0)),()=>{Ze!==null&&window.clearTimeout(Ze)}},[_,J,ce,ve,Zr]);const Mi=h.useCallback((X,ge=!0)=>{var Ze;X&&Po(Tt.current),Wt(!1),Je(""),ln([]),ns(0),(qe.current?Ns.current:Ot.current).resetSearch(),ge&&((Ze=F.current)==null||Ze.focus())},[Po]);h.useEffect(()=>{if(!wt)return;const X=ge=>{if(ge instanceof MouseEvent&&ge.button!==0||ge.defaultPrevented)return;const Le=ot.current,Ze=ge.target;Le&&Ze instanceof Node&&!Le.contains(Ze)&&Mi(!0,!1)};return window.addEventListener("mousedown",X),window.addEventListener("touchstart",X),()=>{window.removeEventListener("mousedown",X),window.removeEventListener("touchstart",X)}},[wt,Mi]);const Ri=h.useCallback(X=>{var Et;const ge=F.current;if(!ge&&!J)return;if(Mi(!1),!qe.current){Ks(X),Rt.current(ge,void 0,void 0,!0);return}const Le=X.trim();if(!Le)return;const Ze=Os.current;if(be.current(`!${Le}`,Ze.length>0?[...Ze]:void 0)===!1){Ks(X);return}(Et=Mt.current)==null||Et.call(Mt),Ns.current.push(Le),Ns.current.reset(),Qn([]),Po("")},[Mi,J,Po,Ks]),Ql=X=>{if(!X.nativeEvent.isComposing)if(X.key==="Escape")X.preventDefault(),Mi(!0);else if(X.key==="Tab"){X.preventDefault();const ge=pt[Bn];ge&&Ks(ge),Mi(!1)}else if(X.key==="Enter"){X.preventDefault();const ge=pt[Bn];ge?Ri(ge):Mi(!1)}else X.key==="r"&&X.ctrlKey&&(X.preventDefault(),pt.length>0&&ns(ge=>(ge+1)%pt.length))},kc=X=>{const ge=qe.current?Ns.current:Ot.current;ln(Qs(X)),ns(0),ge.resetSearch()},Fa=X=>{const ge=X.target.value;Je(ge),!X.nativeEvent.isComposing&&kc(ge)},Rr=X=>{const ge=X.currentTarget.value;Je(ge),kc(ge)},fo=h.useCallback(X=>{Qn(ge=>ge.filter((Le,Ze)=>Ze!==X))},[]),Zo=!De&&!wt&&!(b!=null&&b.isVisible)&&!i&&!g,Jl=h.useCallback(X=>{Qn(ge=>[...ge,...X])},[]),cl=h.useMemo(()=>({clearText:Er,clear:Js,focus:dn,getText:Tr,hasAttachments:ri,hasInput:ga,setText:br,addTags:To,removeTag:Kr,insertText:hn,retryLast:_s,restoreImages:Jl,submit:Zr}),[To,Js,Er,dn,Tr,ri,ga,hn,Kr,Jl,_s,br,Zr]);return{containerRef:M,viewRef:F,mobileComposer:J?{textareaRef:V,value:le,onChange:pn,onBlur:()=>ue.current(),onPaste:an,placeholder:Jn}:null,focus:dn,submitText:h.useCallback(()=>{const X=F.current;!X&&!J||Rt.current(X)},[J]),clearText:Er,getText:Tr,hasInput:ga,hasAttachments:$t||rr.length>0||fn.length>0,hasContent:Zt,handle:cl,pastedImages:fn,removeImage:fo,composerTags:rr,removeTopTag:Kr,addTags:To,removeInlineTags:Lo,insertText:hn,setText:br,submit:Zr,clear:Js,retryLast:_s,replaceEditorText:Po,shellMode:De,setShellMode:ct,toggleShellMode:Ie,currentMode:m,sessionName:x,searchState:{searchMode:wt,searchQuery:Me,searchMatches:pt,searchActiveIndex:Bn,searchInputRef:Xe,searchUiRef:ot,openHistorySearch:Cr,closeSearch:Mi,submitSearchMatch:Ri,restoreSearchMatch:Ks,handleSearchKeyDown:Ql,handleSearchInput:Fa,handleSearchCompositionEnd:Rr},navigatePrevHistory:ut,navigateNextHistory:Ht,showShortcutHints:Zo,followupState:b,disabled:i,onAcceptFollowup:w,onDismissFollowup:y,slashMenu:uo,closeSlashMenu:pr,selectSlashCompletion:xe,acceptSlashCompletion:tt,atMenu:Ve.state,closeAtMenu:Bs,selectAtCompletion:Ve.select,acceptAtCompletion:Ve.accept,enterAtCategory:Ve.enterCategory,backAtCategories:Ve.backToCategories,updateAtSearch:Ve.updateSearch,selectAtTab:Ve.selectTab}}const $Ye="_flash_96ig5_1",n0={flash:$Ye},BYe="_chatMessageRow_1ngib_41",zYe="_chatMessageColumn_1ngib_48",FYe="_chatBubble_1ngib_55",qYe="_sendFailure_1ngib_68",HYe="_retryButton_1ngib_78",UYe="_chatContent_1ngib_106",WYe="_messageTag_1ngib_111",VYe="_messageTagTooltip_1ngib_128",GYe="_messageTagClickable_1ngib_162",KYe="_messageTagIcon_1ngib_172",YYe="_messageTagLabel_1ngib_183",XYe="_messageTagValue_1ngib_184",QYe="_chatContentCollapsed_1ngib_207",JYe="_toggleButton_1ngib_212",ZYe="_toggleIcon_1ngib_233",eXe="_toggleIconExpanded_1ngib_240",tXe="_chatImages_1ngib_244",nXe="_chatImageThumb_1ngib_251",ia={chatMessageRow:BYe,chatMessageColumn:zYe,chatBubble:FYe,sendFailure:qYe,retryButton:HYe,chatContent:UYe,messageTag:WYe,messageTagTooltip:VYe,messageTagClickable:GYe,messageTagIcon:KYe,messageTagLabel:YYe,messageTagValue:XYe,chatContentCollapsed:QYe,toggleButton:JYe,toggleIcon:ZYe,toggleIconExpanded:eXe,chatImages:tXe,chatImageThumb:nXe};function sXe({composerTagIcons:e,content:t,inputAnnotations:n,onComposerTagClick:s,renderComposerTag:r,renderComposerTagTooltip:i}){const o=h.useMemo(()=>qee(t,n),[t,n]);return a.jsx(a.Fragment,{children:o.map((l,c)=>l.type==="text"?a.jsx(h.Fragment,{children:l.text},c):a.jsx(qP,{composerTagIcons:e,onComposerTagClick:s,renderComposerTag:r,renderComposerTagTooltip:i,tag:l.tag,title:l.tag.serialized,preserveCustomKindLabel:!0},`${l.tag.id}:${c}`))})}const rXe=h.memo(function({content:t,images:n,inputAnnotations:s,isLocateFlashing:r=!1,sendFailed:i=!1,onRetrySend:o}){const{t:l}=nt(),{parseUserMessageContent:c,renderUserMessageContent:u,composerTagIcons:d,renderComposerTag:f,renderComposerTagTooltip:m,onComposerTagClick:p}=Vu(),g=h.useRef(null),[b,w]=h.useState(!1),[y,v]=h.useState(!1),x=h.useMemo(()=>{const _=u==null?void 0:u({content:t,images:n,inputAnnotations:s});if(_!=null)return _;if(s&&s.length>0)return a.jsx(sXe,{composerTagIcons:d,content:t,inputAnnotations:s,onComposerTagClick:p,renderComposerTag:f,renderComposerTagTooltip:m});const T=fD(t,c,"[WebShell] failed to parse user message content");return T?T.map((S,C)=>S.type==="text"?S.text:a.jsx(qP,{tag:S.tag,composerTagIcons:d,renderComposerTag:f,renderComposerTagTooltip:m,onComposerTagClick:p},`${S.tag.id}-${C}`)):t},[t,n,s,p,c,d,f,m,u]),k=h.useCallback(()=>{const _=g.current;_&&v(_.scrollHeight>400)},[]);return h.useLayoutEffect(()=>{w(!1),k()},[t,n==null?void 0:n.length,k]),h.useEffect(()=>{const _=g.current;if(!_||typeof ResizeObserver>"u")return;const T=new ResizeObserver(k);return T.observe(_),()=>T.disconnect()},[k]),a.jsx("div",{className:ia.chatMessageRow,children:a.jsxs("div",{className:ia.chatMessageColumn,children:[a.jsxs("div",{className:`${ia.chatBubble}${r?` ${n0.flash}`:""}`,children:[a.jsxs("div",{ref:g,className:`${ia.chatContent} ${y&&!b?ia.chatContentCollapsed:""}`,children:[n&&n.length>0&&a.jsx("div",{className:ia.chatImages,children:n.map((_,T)=>{const S=_.data.startsWith("data:")?_.data:`data:${_.mimeType};base64,${_.data}`;return Rv(S)?a.jsx("img",{src:S,alt:l("user.uploadedImage",{index:T+1}),className:ia.chatImageThumb,onLoad:k},T):null})}),x]}),y&&a.jsxs("button",{type:"button",className:ia.toggleButton,onClick:()=>w(_=>!_),children:[a.jsx("span",{children:l(b?"userMessage.showLess":"userMessage.showMore")}),a.jsx("svg",{className:`${ia.toggleIcon} ${b?ia.toggleIconExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]})]}),i&&o&&a.jsxs("div",{className:ia.sendFailure,children:[a.jsx("span",{children:l("userMessage.sendFailed")}),a.jsxs("button",{type:"button",className:ia.retryButton,onClick:o,"aria-label":l("userMessage.retrySend"),title:l("userMessage.retrySend"),children:[a.jsx(Ug,{"aria-hidden":"true"}),a.jsx("span",{children:l("common.retry")})]})]})]})})});function iXe(e){return FP(e)}function qP({tag:e,composerTagIcons:t,renderComposerTag:n,renderComposerTagTooltip:s,onComposerTagClick:r,title:i,preserveCustomKindLabel:o=!1}){const l={tag:e,placement:"user-message",readonly:!0};let c,u;try{c=n==null?void 0:n(l)}catch(v){console.warn("[WebShell] user message tag render failed",v)}try{u=s==null?void 0:s(l)}catch(v){console.warn("[WebShell] user message tag tooltip render failed",v)}const d=!!r,f=o?n2e(e,t):null,m=H6(e),p=(f==null?void 0:f.tagValue)??U6(e),g=(f==null?void 0:f.tagLabel)??(e.kind?"":m),b=(f==null?void 0:f.fallback)??e.id,w=e.icon??(f==null?void 0:f.iconUrl)??h1(e.kind,t),y=w&&(pD(w)||Rv(w))?w:void 0;return a.jsxs("span",{className:`${ia.messageTag}${d?` ${ia.messageTagClickable}`:""}`,role:d?"button":void 0,tabIndex:d?0:void 0,title:i??iXe(e),onClick:v=>{d&&(v.stopPropagation(),r==null||r({...l,anchorRect:v.currentTarget.getBoundingClientRect()}))},onKeyDown:v=>{d&&(v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),r==null||r({...l,anchorRect:v.currentTarget.getBoundingClientRect()})))},children:[c??a.jsxs(a.Fragment,{children:[y&&a.jsx("span",{className:ia.messageTagIcon,style:$g("--user-message-tag-icon-url",y),"aria-hidden":"true"}),g&&a.jsx("span",{className:ia.messageTagLabel,children:g}),p?a.jsx("span",{className:ia.messageTagValue,children:p}):g?null:a.jsx("span",{className:ia.messageTagLabel,children:b})]}),u!=null&&a.jsx("span",{className:ia.messageTagTooltip,role:"tooltip",children:u})]})}const oXe="_message_nn1j4_1",aXe="_customFooter_nn1j4_7",lXe="_messageFooter_nn1j4_11",cXe="_copyButton_nn1j4_27",uXe="_footerTime_nn1j4_53",dXe="_thinking_nn1j4_65",hXe="_thinkingBody_nn1j4_77",fXe="_thinkingHeader_nn1j4_108",mXe="_thinkingSummary_nn1j4_120",pXe="_translateButton_nn1j4_136",gXe="_thinkingHeaderExpanded_nn1j4_147",bXe="_translationPopover_nn1j4_154",yXe="_translationTitle_nn1j4_159",vXe="_translationContent_nn1j4_164",wXe="_translationPending_nn1j4_171",xXe="_translationError_nn1j4_175",kXe="_translationFooter_nn1j4_179",_Xe="_translationUsage_nn1j4_189",SXe="_translationActions_nn1j4_196",CXe="_thinkingSummaryTextActive_nn1j4_211",TXe="_thinkingSummaryIcon_nn1j4_218",EXe="_thinkingSummaryText_nn1j4_211",AXe="_thinkingChevronRight_nn1j4_275",jXe="_thinkingChevronDown_nn1j4_276",NXe="_thinkingExpandedWrap_nn1j4_339",IXe="_thinkingExpandedClip_nn1j4_343",MXe="_thinkingExpandedInner_nn1j4_350",RXe="_content_nn1j4_398",DXe="_contentBody_nn1j4_403",Nr={message:oXe,customFooter:aXe,messageFooter:lXe,copyButton:cXe,footerTime:uXe,thinking:dXe,thinkingBody:hXe,thinkingHeader:fXe,thinkingSummary:mXe,translateButton:pXe,thinkingHeaderExpanded:gXe,translationPopover:bXe,translationTitle:yXe,translationContent:vXe,translationPending:wXe,translationError:xXe,translationFooter:kXe,translationUsage:_Xe,translationActions:SXe,thinkingSummaryTextActive:CXe,thinkingSummaryIcon:TXe,thinkingSummaryText:EXe,thinkingChevronRight:AXe,thinkingChevronDown:jXe,thinkingExpandedWrap:NXe,thinkingExpandedClip:IXe,thinkingExpandedInner:MXe,content:RXe,contentBody:DXe},LXe=80;function PXe(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)},LXe))},[e,t,n]),h.useEffect(()=>()=>{i.current!==void 0&&clearTimeout(i.current)},[]),t&&e.startsWith(n)?n:e}const OXe=h.memo(function({content:t,isStreaming:n,timestamp:s,onBranchSession:r,showFooterActions:i=!1,showBranchAction:o=!1,isLocateFlashing:l=!1,customFooterInfo:c}){const{t:u}=nt(),{renderAssistantTurnFooter:d}=Vu(),f=PXe(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]),w=h.useCallback(()=>{var v;const y=(v=navigator.clipboard)==null?void 0:v.writeText(t);y&&y.then(()=>{p(!0),window.setTimeout(()=>p(!1),2e3)}).catch(()=>{})},[t]);return a.jsxs("div",{className:Nr.message,children:[t&&a.jsx("div",{className:`${Nr.content}${l?` ${n0.flash}`:""}`,children:a.jsx("div",{className:Nr.contentBody,children:a.jsx(Jf,{content:f,source:"assistant",isStreaming:n})})}),b&&a.jsx("div",{className:Nr.customFooter,children:b}),g&&a.jsxs("div",{className:Nr.messageFooter,children:[a.jsx("button",{type:"button",className:Nr.copyButton,title:u("assistant.copy"),"aria-label":u("assistant.copy"),onClick:w,children:m?a.jsx(BXe,{}):a.jsx($Xe,{})}),o&&r&&a.jsx("button",{type:"button",className:Nr.copyButton,title:u("assistant.branch"),"aria-label":u("assistant.branch"),onClick:r,children:a.jsx(zXe,{})}),s!==void 0&&a.jsx("span",{className:Nr.footerTime,"aria-hidden":"true",children:Iy(s)})]})]})});function $Xe(){return a.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[a.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"}),a.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function BXe(){return a.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function zXe(){return a.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[a.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"}),a.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"}),a.jsx("circle",{cx:"5",cy:"3.5",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"11",cy:"4",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"11",cy:"12.5",r:"1.5",fill:"currentColor"})]})}const gg=new Map,FXe=200;function LG(e,t){if(gg.delete(e),gg.set(e,t),gg.size<=FXe)return;const n=gg.keys().next().value;n!==void 0&&gg.delete(n)}const qXe=h.memo(function({messageId:t,content:n,isStreaming:s,timestamp:r,isLocateFlashing:i=!1,generateContent:o}){const{language:l,t:c}=nt(),u=h.useContext(i1),[d,f]=h.useState(!1),m=s===!0,p=h.useRef(r??Date.now()),g=h.useRef(m),[b,w]=h.useState(()=>Date.now()),[y,v]=h.useState(null),[x,k]=h.useState(!1),[_,T]=h.useState(),[S,C]=h.useState(!1),[N,E]=h.useState(!1),[O,B]=h.useState(!1),D=h.useRef(void 0);h.useEffect(()=>{if(!n||!m)return;w(Date.now());const Y=setInterval(()=>w(Date.now()),1e3);return()=>clearInterval(Y)},[n,m]),h.useEffect(()=>{if(n){if(m){g.current=!0,v(null);return}g.current&&y===null&&v(Date.now())}},[n,y,m]);const j=m||y!==null?(m?b:y)-p.current:void 0,L=HXe({isStreaming:s,durationMs:j}),z=j!==void 0?UXe(j):"",I=h.useCallback(()=>{f(Y=>!Y)},[]);h.useEffect(()=>()=>{var Y;(Y=D.current)==null||Y.abort()},[]);const $=h.useCallback(async(Y=!1)=>{var U;if(s||!o||S&&!Y)return;const W=`${l}:${t}:${n}`,M=gg.get(W);if(M&&!Y){LG(W,M),T(M);return}Y&&gg.delete(W),(U=D.current)==null||U.abort();const F=new AbortController;D.current=F,T({text:""}),E(!1),B(!1),C(!0);let J="",V=!1;try{const pe=`Translate the following model reasoning into ${l==="zh-CN"?"Simplified Chinese":"English"}. Preserve its meaning and Markdown formatting. Output only the translation.

${n}`;for await(const fe of o(pe,{signal:F.signal})){if(D.current!==F)return;if(fe.type==="thinking")E(!0);else if(fe.type==="delta")E(!1),J+=fe.text,T({text:J});else if(fe.type==="done"){if(!J.trim())throw new Error("Translation was empty");V=!0;const Q={text:J,inputTokens:fe.inputTokens,outputTokens:fe.outputTokens};LG(W,Q),T(Q)}else if(fe.type==="error")throw new Error(fe.message)}if(!V)throw new Error("Translation stream ended early")}catch{F.signal.aborted||B(!0)}finally{D.current===F&&(D.current=void 0,E(!1),C(!1))}},[n,o,s,l,t,S]),K=h.useCallback(Y=>{k(Y),Y&&$()},[$]),R=h.useCallback(()=>{const Y=D.current;D.current=void 0,Y==null||Y.abort(),E(!1),C(!1),k(!1)},[]);return a.jsx("div",{className:`${Nr.message}${i?` ${n0.flash}`:""}`,children:n&&!u&&a.jsx("div",{className:Nr.thinking,children:a.jsxs("div",{className:Nr.thinkingBody,children:[a.jsxs("div",{className:`${Nr.thinkingHeader}${d?` ${Nr.thinkingHeaderExpanded}`:""}`,onClick:Y=>{Y.currentTarget.contains(Y.target)&&I()},children:[a.jsxs("button",{type:"button",className:Nr.thinkingSummary,"aria-expanded":d,title:c(d?"thinking.collapse":"thinking.expand"),children:[a.jsx("span",{className:Nr.thinkingSummaryIcon,"aria-hidden":"true",children:a.jsx(WXe,{})}),a.jsx("span",{className:m?`${Nr.thinkingSummaryText} ${Nr.thinkingSummaryTextActive}`:Nr.thinkingSummaryText,children:c(L,z?{duration:z}:{})})]}),l==="zh-CN"&&!m&&o&&a.jsxs(Yf,{open:x,onOpenChange:K,children:[a.jsx(Gp,{asChild:!0,children:a.jsx(Kt,{type:"button",variant:"secondary",size:"xs",className:Nr.translateButton,title:c("thinking.translate"),onClick:Y=>Y.stopPropagation(),children:c("thinking.translate")})}),a.jsxs(Xf,{align:"start",className:Nr.translationPopover,children:[a.jsx("div",{className:Nr.translationTitle,children:c("thinking.translation")}),O?a.jsx("div",{className:Nr.translationError,children:c("thinking.translationFailed")}):_!=null&&_.text?a.jsx("div",{className:`${Nr.thinkingExpandedWrap} ${Nr.translationContent}`,children:a.jsx(Jf,{content:_.text,source:"thinking",isStreaming:S})}):a.jsx("div",{className:Nr.translationPending,children:c(N?"thinking.translationThinking":"thinking.translating")}),a.jsxs("div",{className:Nr.translationFooter,children:[a.jsx("div",{className:Nr.translationUsage,children:!S&&(_==null?void 0:_.text)&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:c("thinking.inputTokens",{count:_.inputTokens??"--"})}),a.jsx("span",{children:c("thinking.outputTokens",{count:_.outputTokens??"--"})})]})}),a.jsxs("div",{className:Nr.translationActions,children:[a.jsx(Kt,{type:"button",variant:"outline",size:"xs",onClick:()=>void $(!0),children:c("thinking.retranslate")}),a.jsx(Kt,{type:"button",variant:"outline",size:"xs",disabled:!S&&!(_!=null&&_.text)&&!O,onClick:R,children:c(S?"thinking.cancelTranslation":"thinking.closeTranslation")})]})]})]})]}),a.jsx("span",{className:d?Nr.thinkingChevronDown:Nr.thinkingChevronRight,"aria-hidden":"true"})]}),d&&a.jsx("div",{className:Nr.thinkingExpandedClip,children:a.jsx("div",{className:Nr.thinkingExpandedInner,children:a.jsx("div",{className:Nr.thinkingExpandedWrap,children:a.jsx(Jf,{content:n,source:"thinking",isStreaming:s})})})})]})})})});function HXe({isStreaming:e,durationMs:t}){return e?"thinking.running":t!==void 0&&t<1e3?"thinking.doneBriefly":"thinking.done"}function UXe(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 WXe(){return a.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[a.jsx("path",{d:"M7.2 15.2h4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),a.jsx("path",{d:"M6.5 13.1h5.4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),a.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"}),a.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 VXe="_panel_8ng9u_1",GXe="_title_8ng9u_16",KXe="_metaLine_8ng9u_22",YXe="_progress_8ng9u_32",XXe="_spacer_8ng9u_38",QXe="_row_8ng9u_42",JXe="_detailRow_8ng9u_43",ZXe="_subDetailRow_8ng9u_44",eQe="_symbol_8ng9u_65",tQe="_label_8ng9u_69",nQe="_value_8ng9u_73",sQe="_detailName_8ng9u_80",rQe="_sectionTitle_8ng9u_88",iQe="_detailSection_8ng9u_94",oQe="_skillBlock_8ng9u_100",aQe="_hint_8ng9u_105",lQe="_detailCommand_8ng9u_111",cQe="_bodyLoaded_8ng9u_132",uQe="_accent_8ng9u_137",dQe="_secondary_8ng9u_141",hQe="_warning_8ng9u_145",fQe="_error_8ng9u_149",mQe="_success_8ng9u_153",ls={panel:VXe,title:GXe,metaLine:KXe,progress:YXe,spacer:XXe,row:QXe,detailRow:JXe,subDetailRow:ZXe,symbol:eQe,label:tQe,value:nQe,detailName:sQe,sectionTitle:rQe,detailSection:iQe,skillBlock:oQe,hint:aQe,detailCommand:lQe,bodyLoaded:cQe,accent:uQe,secondary:dQe,warning:hQe,error:fQe,success:mQe},iR="web-shell:context-usage:v1:",Pm="█",Vde="▒",Gde="░",Kde=30;function pQe(e){return`${iR}${JSON.stringify(e)}`}function gQe(e){if(!e.startsWith(iR))return null;try{const t=JSON.parse(e.slice(iR.length));return!(t!=null&&t.usage)||typeof t.usage.totalTokens!="number"?null:t}catch{return null}}function Yde(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function Yy(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function bQe(e,t){if(t<=0)return"0.0";const n=e/t*100;return n>100?">100":n.toFixed(1)}function yQe(e){return[...e].sort((t,n)=>n.tokens-t.tokens)}function vQe({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 a.jsxs("div",{className:ls.progress,"aria-hidden":"true",children:[a.jsx("span",{className:o,children:Pm.repeat(Math.max(0,s))}),a.jsx("span",{className:ls.secondary,children:Gde.repeat(Math.max(0,i))}),a.jsx("span",{className:ls.warning,children:Vde.repeat(Math.max(0,r))})]})}function rf({symbol:e,label:t,tokens:n,tokenLabel:s,contextWindowSize:r,symbolClassName:i=ls.secondary,isOverLimit:o}){return a.jsxs("div",{className:ls.row,children:[a.jsx("span",{className:`${ls.symbol} ${i}`,children:e}),a.jsx("span",{className:ls.label,children:t}),a.jsxs("span",{className:o?ls.error:ls.value,children:[Yy(n)," ",s," (",bQe(n,r),"%)"]})]})}const Lj="/context detail";function wQe({hint:e,onShowDetail:t}){const n=t?e.indexOf(Lj):-1;return n<0?a.jsx("div",{className:ls.hint,children:e}):a.jsxs("div",{className:ls.hint,children:[e.slice(0,n),a.jsx("button",{type:"button",className:ls.detailCommand,onClick:t,children:Lj}),e.slice(n+Lj.length)]})}function xQe({name:e,tokens:t,tokenLabel:n}){return a.jsxs("div",{className:ls.detailRow,children:[a.jsxs("span",{className:ls.secondary,children:["└"," "]}),a.jsx("span",{className:ls.detailName,title:e,children:Yde(e,Kde)}),a.jsxs("span",{className:ls.value,children:[Yy(t)," ",n]})]})}function Pj({title:e,items:t,getName:n,tokenLabel:s}){const r=yQe(t);return r.length===0?null:a.jsxs("section",{className:ls.detailSection,children:[a.jsx("div",{className:ls.sectionTitle,children:e}),r.map(i=>a.jsx(xQe,{name:n(i),tokens:i.tokens,tokenLabel:s},n(i)))]})}function kQe({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:a.jsxs("section",{className:ls.detailSection,children:[a.jsx("div",{className:ls.sectionTitle,children:t.skills}),n.map(s=>a.jsxs("div",{className:ls.skillBlock,children:[a.jsxs("div",{className:ls.detailRow,children:[a.jsxs("span",{className:ls.secondary,children:["└"," "]}),a.jsxs("span",{className:ls.detailName,title:s.name,children:[Yde(s.name,Kde),s.loaded&&a.jsxs("span",{className:ls.success,children:[" ",t.active]})]}),a.jsxs("span",{className:ls.value,children:[Yy(s.tokens)," ",t.tokens]})]}),s.loaded&&s.bodyTokens!=null&&s.bodyTokens>0&&a.jsxs("div",{className:ls.subDetailRow,children:[a.jsxs("span",{className:ls.secondary,children:["  └"," "]}),a.jsx("span",{className:ls.bodyLoaded,children:t.bodyLoaded}),a.jsxs("span",{className:ls.success,children:["+",Yy(s.bodyTokens)," ",t.tokens]})]})]},s.name))]})}function _Qe({status:e,onShowDetail:t}){const{t:n}=nt(),{usage:s}=e,{breakdown:r,contextWindowSize:i}=s,o=i>0?s.totalTokens/i*100:0,l=o>100,c=i>0?r.autocompactBuffer/i*100:0;return a.jsxs("div",{className:ls.panel,children:[a.jsx("div",{className:ls.title,children:n("contextUsage.title")}),s.isEstimated?a.jsx(a.Fragment,{children:a.jsxs("div",{className:ls.metaLine,children:[a.jsxs("span",{children:[n("contextUsage.model"),": ",s.modelName]}),a.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",Yy(i)," ",n("contextUsage.tokens")]})]})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:ls.metaLine,children:[a.jsxs("span",{children:[n("contextUsage.model"),": ",s.modelName]}),a.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",Yy(i)," ",n("contextUsage.tokens")]})]}),l&&a.jsx("div",{className:ls.error,children:n("contextUsage.overLimit")})]}),a.jsx(vQe,{usedPercentage:Math.min(o,100),bufferPercentage:c}),a.jsx("div",{className:ls.spacer}),a.jsx(rf,{symbol:Pm,label:n("contextUsage.used"),tokens:s.totalTokens,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:l?ls.error:ls.accent,isOverLimit:l}),a.jsx(rf,{symbol:Gde,label:n("contextUsage.free"),tokens:r.freeSpace,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i}),a.jsx(rf,{symbol:Vde,label:n("contextUsage.autocompactBuffer"),tokens:r.autocompactBuffer,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ls.warning}),a.jsx("div",{className:ls.spacer}),a.jsx("div",{className:ls.sectionTitle,children:n("contextUsage.usageByCategory")}),a.jsx(rf,{symbol:Pm,label:n("contextUsage.systemPrompt"),tokens:r.systemPrompt,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ls.accent}),a.jsx(rf,{symbol:Pm,label:n("contextUsage.builtinTools"),tokens:r.builtinTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ls.accent}),r.mcpTools>0&&a.jsx(rf,{symbol:Pm,label:n("contextUsage.mcpTools"),tokens:r.mcpTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ls.accent}),a.jsx(rf,{symbol:Pm,label:n("contextUsage.memoryFiles"),tokens:r.memoryFiles,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ls.accent}),a.jsx(rf,{symbol:Pm,label:n("contextUsage.skills"),tokens:r.skills,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ls.accent}),!s.isEstimated&&a.jsx(rf,{symbol:Pm,label:n("contextUsage.messages"),tokens:r.messages,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:ls.accent}),s.showDetails?a.jsxs(a.Fragment,{children:[a.jsx(Pj,{title:n("contextUsage.builtinTools"),items:s.builtinTools,getName:u=>"name"in u?u.name:u.path,tokenLabel:n("contextUsage.tokens")}),a.jsx(Pj,{title:n("contextUsage.mcpTools"),items:s.mcpTools,getName:u=>"name"in u?u.name:u.path,tokenLabel:n("contextUsage.tokens")}),a.jsx(Pj,{title:n("contextUsage.memoryFiles"),items:s.memoryFiles,getName:u=>"path"in u?u.path:u.name,tokenLabel:n("contextUsage.tokens")}),a.jsx(kQe,{skills:s.skills,labels:{active:n("contextUsage.active"),bodyLoaded:n("contextUsage.bodyLoaded"),skills:n("contextUsage.skills"),tokens:n("contextUsage.tokens")}})]}):a.jsx(wQe,{hint:n("contextUsage.detailHint"),onShowDetail:t})]})}const SQe={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",display_image:"DisplayImage",bash:"Shell",shell:"Shell Command",read:"ReadFile",write:"WriteFile",search:"Grep"},CQe=/[\x00-\x08\x0b-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/g;function I4(e){return e.replace(CQe,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 Xde(e){if(!e.trim())return"Tool";const t=SQe[e];if(t)return t;const n=e.toLowerCase();return n==="web_fetch"||n==="webfetch"||n==="fetch"?"WebFetch":e}function wd(e,t){const n=Xde(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 jd(e){const t=e.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function Yo(e,t){return e.length<=t?e:e.slice(0,t)+"..."}const gy=2e3;function HP(e,t){if(G6(e.toolName)){const r=V6(e.args,"skill");if(r)return Yo(r,gy)}const n=AQe(e,t);if(n)return Yo(n,gy);const s=Jde(e,t);return s?Yo(s,gy):""}function Qde(e,t){if(!Hc(e.toolName))return HP(e,t);const n=V6(e.args,"description");if(n)return Yo(n,gy);const s=Jde(e,t,{includeTimeout:!1});return s?Yo(s,gy):""}function TQe(e){return Hc(e.toolName)?V6(e.args,"description"):""}function xh(e){var t;if(!e.content)return aR(e.rawOutput);for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text;return aR(e.rawOutput)}function EQe(e){if(e.status!=="completed"&&e.status!=="failed")return"";const t=e.toolName.toLowerCase();if(t==="grep_search"||t==="grep"||t==="search"){const o=PG((aR(e.rawOutput)??"").trim());if(o)return o}const n=xh(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(l=>l.trim()).length} matching file(s)`;if(t==="list_directory"||t==="listfiles")return`${s.filter(l=>l.trim()).length} item(s)`;if(Hc(t)){if(r>3)return`${r} lines of output`;const o=s[0]||"";return Yo(o,80)}if(t==="grep_search"||t==="grep"||t==="search"){const o=PG(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 Yo(o,80)}if(t==="websearch"||t==="web_search"){const o=s.filter(l=>l.trim()).length;return o>1?`${o} result(s)`:s[0]||""}if(jd(t))return"";const i=s[0]||"";return Yo(i,80)}function AQe(e,t){if(!e.title)return null;const n=Xde(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 OG(o.replace(/^:\s*|\s+/,""),t)}return OG(s,t)}function PG(e){return e==="No matches found"||/^Found \d+ match(?:es)?(?: \(truncated\))?$/.test(e)?e:null}function Jde(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 ${Vb(String(s.directory),t)}]`),s.is_background?o+=" [background]":i&&s.timeout&&(o+=` [timeout: ${String(s.timeout)}ms]`);const l=V6(s,"description");return l&&(o+=` (${l})`),Yo(o,gy)}if(r==="grep_search"||r==="grep"||r==="search"){const o=s.pattern??s.query;if(o){let l=`'${String(o)}'`;return s.path?l+=` in path '${String(s.path)}'`:(r==="grep_search"||r==="grep")&&(l+=" in path './'"),s.glob&&(l+=` (filter: '${String(s.glob)}')`),l}}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):Vb(String(s.file_path),t);if(s.url){const o=String(s.url),l=typeof s.prompt=="string"?s.prompt:void 0,c=l?`${o} — "${Yo(l,40)}"`:o;return Yo(c,80)}if(s.path)return Vb(String(s.path),t);if(s.query)return Yo(String(s.query),60);if(r==="list_directory"||r==="listfiles"){const o=s.path||s.directory||"";return Vb(String(o),t)}return s.description?String(s.description):""}function V6(e,t){const n=e==null?void 0:e[t];return typeof n=="string"?n.trim().replace(/\n/g," "):""}function Hc(e){const t=e.toLowerCase();return t==="run_shell_command"||t==="bash"||t==="shell"||t==="execute_command"}function G6(e){return e.toLowerCase()==="skill"}function xd(e,t){var n;return e.callId===t?!0:((n=e.subTools)==null?void 0:n.some(s=>xd(s,t)))??!1}function OG(e,t){const n=e.trim();return Zde(oR(n))?Vb(n,t):n.replace(/(?:[A-Za-z]:)?\/[^\s'")]+/g,s=>Vb(s,t))}function Vb(e,t){const n=oR(e),s=t?oR(t).replace(/\/+$/,""):"";return s&&(n===s||n.startsWith(`${s}/`))?n.slice(s.length+1)||".":Zde(n)?jQe(n):n}function oR(e){return e.replace(/\\/g,"/")}function Zde(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function jQe(e){return e.replace(/\/+$/,"").split("/").pop()||e}function J_(e){if(!e||typeof e!="object")return;const t=e;return t.type==="task_execution"?t:void 0}function UP(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 ehe(e){if(!e.rawOutput||typeof e.rawOutput!="object")return!1;const t=e.rawOutput,n=typeof t.status=="string"?t.status.toLowerCase():"",s=UP(e);return n==="cancelled"||n==="canceled"||s.toLowerCase().includes("cancel")}function Xy(e){return e.status==="failed"||ehe(e)?"failed":e.status}function WP(e){return e>=1e6?`${(e/1e6).toFixed(1)}M tokens`:e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k tokens":`${e} tokens`}const NQe="general-purpose";function VP(e){var s;const t=J_(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":NQe}function Z_(e,t){const n=[`agentType.${e}`,`agentType.${e.toLowerCase()}`];for(const s of n){const r=t(s);if(r!==s)return r}return e}function K6(e){var i,o;if(e.title){const l=e.title.indexOf(": ");if(l>0)return e.title.slice(l+2)}const t=(i=e.args)==null?void 0:i.description;if(typeof t=="string"&&t.trim())return t.trim();const n=J_(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 IQe(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=wd(s.toolName??"",t);if(s.title){const l=s.title.indexOf(": ");r+=" "+(l>0?s.title.slice(l+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 Yo(r,50)}function aR(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 MQe="_panel_qchwm_1",RQe="_title_qchwm_17",DQe="_sectionTitle_qchwm_23",LQe="_spacer_qchwm_29",PQe="_pivotRow_qchwm_35",OQe="_metricCell_qchwm_41",$Qe="_metricCellSection_qchwm_48",BQe="_metricCellSub_qchwm_56",zQe="_modelCell_qchwm_64",FQe="_modelCellHeader_qchwm_71",qQe="_divider_qchwm_79",HQe="_kvRow_qchwm_87",UQe="_kvSubRow_qchwm_94",WQe="_kvLabel_qchwm_102",VQe="_kvValue_qchwm_106",GQe="_tableRow_qchwm_115",KQe="_modelUsageRow_qchwm_121",YQe="_tableNameCol_qchwm_129",XQe="_tableToolCol_qchwm_137",QQe="_tableNumCol_qchwm_145",JQe="_tableValueCol_qchwm_153",ZQe="_success_qchwm_162",eJe="_error_qchwm_166",tJe="_secondary_qchwm_170",nJe="_warning_qchwm_174",Ut={panel:MQe,title:RQe,sectionTitle:DQe,spacer:LQe,pivotRow:PQe,metricCell:OQe,metricCellSection:$Qe,metricCellSub:BQe,modelCell:zQe,modelCellHeader:FQe,divider:qQe,kvRow:HQe,kvSubRow:UQe,kvLabel:WQe,kvValue:VQe,tableRow:GQe,modelUsageRow:KQe,tableNameCol:YQe,tableToolCol:XQe,tableNumCol:QQe,tableValueCol:JQe,success:ZQe,error:eJe,secondary:tJe,warning:nJe},lR="web-shell:session-stats:v1:";function sJe(e,t="overview"){return`${lR}${JSON.stringify({_view:t,...e})}`}function rJe(e){if(!e.startsWith(lR))return null;try{const t=JSON.parse(e.slice(lR.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 Cp(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 bg({label:e,children:t}){return a.jsxs("div",{className:Ut.kvRow,children:[a.jsx("span",{className:Ut.kvLabel,children:e}),a.jsx("span",{className:Ut.kvValue,children:t})]})}function ik({label:e,children:t}){return a.jsxs("div",{className:Ut.kvSubRow,children:[a.jsxs("span",{className:Ut.secondary,children:["»"," ",e]}),a.jsx("span",{className:Ut.kvValue,children:t})]})}function the(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 iJe(e){return e.api.totalRequests===0?0:e.api.totalErrors/e.api.totalRequests*100}function oJe(e){return e.api.totalRequests===0?0:e.api.totalLatencyMs/e.api.totalRequests}function aJe(e){return e.tokens.prompt===0?0:e.tokens.cached/e.tokens.prompt*100}function Ud({metric:e,values:t,variant:n="normal"}){const s=n==="section"?Ut.metricCellSection:n==="sub"?Ut.metricCellSub:Ut.metricCell;return a.jsxs("div",{className:Ut.pivotRow,children:[a.jsx("span",{className:s,children:n==="sub"?`↳ ${e}`:e}),t.map((r,i)=>a.jsx("span",{className:Ut.modelCell,children:r},i))]})}function lJe({status:e}){const{t}=nt(),{models:n,tools:s,files:r}=e,i=Object.values(n).reduce((b,w)=>b+w.api.totalLatencyMs,0),o=s.totalDurationMs,l=i+o,c=l>0?i/l*100:0,u=l>0?o/l*100:0,d=s.totalCalls>0?s.totalSuccess/s.totalCalls*100:0,f=the(n),m=f.reduce((b,w)=>b+w.metrics.tokens.cached,0),p=f.reduce((b,w)=>b+w.metrics.tokens.prompt,0),g=p>0?m/p*100:0;return a.jsxs("div",{className:Ut.panel,children:[a.jsx("div",{className:Ut.title,children:t("stats.title")}),a.jsx("div",{className:Ut.sectionTitle,children:t("stats.overview")}),a.jsx(bg,{label:t("stats.duration"),children:Cp(e.durationMs)}),a.jsx(bg,{label:t("stats.prompts"),children:e.promptCount}),a.jsx(bg,{label:t("stats.toolCalls"),children:a.jsxs("span",{children:[s.totalCalls," ",a.jsx("span",{className:Ut.secondary,children:"("}),a.jsxs("span",{className:Ut.success,children:["✓",s.totalSuccess]})," ",a.jsxs("span",{className:Ut.error,children:["✗",s.totalFail]}),a.jsx("span",{className:Ut.secondary,children:")"})]})}),a.jsx(bg,{label:t("stats.successRate"),children:a.jsxs("span",{className:d>=90?Ut.success:d>=70?Ut.warning:Ut.error,children:[d.toFixed(1),"%"]})}),(r.totalLinesAdded>0||r.totalLinesRemoved>0)&&a.jsx(bg,{label:t("stats.codeChanges"),children:a.jsxs("span",{children:[a.jsxs("span",{className:Ut.success,children:["+",r.totalLinesAdded]})," ",a.jsxs("span",{className:Ut.error,children:["-",r.totalLinesRemoved]})]})}),a.jsx("div",{className:Ut.spacer}),a.jsx("div",{className:Ut.sectionTitle,children:t("stats.performance")}),a.jsxs(ik,{label:t("stats.apiTime"),children:[Cp(i)," ",a.jsxs("span",{className:Ut.secondary,children:["(",c.toFixed(1),"%)"]})]}),a.jsxs(ik,{label:t("stats.toolTime"),children:[Cp(o)," ",a.jsxs("span",{className:Ut.secondary,children:["(",u.toFixed(1),"%)"]})]}),f.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Ut.spacer}),a.jsx("div",{className:Ut.sectionTitle,children:t("stats.modelUsage")}),a.jsx("div",{className:Ut.spacer}),a.jsxs("div",{className:`${Ut.tableRow} ${Ut.modelUsageRow}`,children:[a.jsx("span",{className:Ut.tableNameCol,children:t("stats.modelUsage")}),a.jsx("span",{className:Ut.tableValueCol,children:t("stats.reqs")}),a.jsx("span",{className:Ut.tableValueCol,children:t("stats.inputTokens")}),a.jsx("span",{className:Ut.tableValueCol,children:t("stats.outputTokens")})]}),a.jsx("div",{className:Ut.divider}),f.map(b=>a.jsxs("div",{className:`${Ut.tableRow} ${Ut.modelUsageRow}`,children:[a.jsx("span",{className:Ut.tableNameCol,children:b.label}),a.jsx("span",{className:Ut.tableValueCol,children:b.metrics.api.totalRequests}),a.jsx("span",{className:`${Ut.tableValueCol} ${Ut.warning}`,children:b.metrics.tokens.prompt.toLocaleString()}),a.jsx("span",{className:`${Ut.tableValueCol} ${Ut.warning}`,children:b.metrics.tokens.candidates.toLocaleString()})]},b.key)),g>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Ut.spacer}),a.jsxs("div",{children:[a.jsx("span",{className:Ut.success,children:t("stats.savingsHighlight")})," ",m.toLocaleString()," (",g.toFixed(1),"%)"," ",t("stats.cacheDesc")]}),a.jsxs("div",{className:Ut.secondary,children:["»"," ",t("stats.modelTip")]})]})]})]})}function cJe({status:e}){const{t}=nt(),n=the(e.models);if(n.length===0)return a.jsxs("div",{className:Ut.panel,children:[a.jsx("div",{className:Ut.title,children:t("stats.modelStats")}),a.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(l=>o(l.metrics));return a.jsxs("div",{className:Ut.panel,children:[a.jsx("div",{className:Ut.title,children:t("stats.modelStats")}),a.jsx("div",{className:Ut.spacer}),a.jsxs("div",{className:Ut.pivotRow,children:[a.jsx("span",{className:Ut.metricCellSection,children:t("stats.metric")}),n.map(o=>a.jsx("span",{className:Ut.modelCellHeader,children:o.label},o.key))]}),a.jsx("div",{className:Ut.divider}),a.jsx(Ud,{metric:t("stats.api"),values:[],variant:"section"}),a.jsx(Ud,{metric:t("stats.requests"),values:i(o=>o.api.totalRequests.toLocaleString())}),a.jsx(Ud,{metric:t("stats.errors"),values:i(o=>{const l=iJe(o);return a.jsxs("span",{className:o.api.totalErrors>0?Ut.error:void 0,children:[o.api.totalErrors.toLocaleString()," (",l.toFixed(1),"%)"]})})}),a.jsx(Ud,{metric:t("stats.avgLatency"),values:i(o=>Cp(oJe(o)))}),a.jsx("div",{className:Ut.spacer}),a.jsx(Ud,{metric:t("stats.tokens"),values:[],variant:"section"}),a.jsx(Ud,{metric:t("stats.total"),values:i(o=>a.jsx("span",{className:Ut.warning,children:o.tokens.total.toLocaleString()}))}),a.jsx(Ud,{metric:t("stats.inputTokens"),values:i(o=>o.tokens.prompt.toLocaleString()),variant:"sub"}),s&&a.jsx(Ud,{metric:t("stats.cached"),values:i(o=>a.jsxs("span",{className:Ut.success,children:[o.tokens.cached.toLocaleString()," (",aJe(o).toFixed(1),"%)"]})),variant:"sub"}),a.jsx(Ud,{metric:t("stats.outputTokens"),values:i(o=>o.tokens.candidates.toLocaleString()),variant:"sub"}),r&&a.jsx(Ud,{metric:t("stats.thoughts"),values:i(o=>o.tokens.thoughts.toLocaleString()),variant:"sub"})]})}function uJe(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 dJe({status:e}){const{t}=nt(),n=uJe(e.tools.byName);if(n.length===0)return a.jsxs("div",{className:Ut.panel,children:[a.jsx("div",{className:Ut.title,children:t("stats.toolStats")}),a.jsx("div",{children:t("stats.noToolCalls")})]});const s=Object.values(e.tools.byName).reduce((o,l)=>{var c,u,d;return o.accept+=((c=l.decisions)==null?void 0:c.accept)??0,o.reject+=((u=l.decisions)==null?void 0:u.reject)??0,o.modify+=((d=l.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 a.jsxs("div",{className:Ut.panel,children:[a.jsx("div",{className:Ut.title,children:t("stats.toolStats")}),a.jsx("div",{className:Ut.spacer}),a.jsxs("div",{className:Ut.tableRow,children:[a.jsx("span",{className:Ut.tableToolCol,children:t("stats.toolName")}),a.jsx("span",{className:Ut.tableNumCol,children:t("stats.calls")}),a.jsx("span",{className:Ut.tableNumCol,children:t("stats.successRate")}),a.jsx("span",{className:Ut.tableNumCol,children:t("stats.avgDuration")})]}),a.jsx("div",{className:Ut.divider}),n.map(o=>{const l=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 a.jsxs("div",{className:Ut.tableRow,children:[a.jsx("span",{className:`${Ut.tableToolCol} ${Ut.metricCell}`,children:wd(o.name,t)}),a.jsx("span",{className:Ut.tableNumCol,children:o.stats.count}),a.jsxs("span",{className:`${Ut.tableNumCol} ${l>=90?Ut.success:l>=70?Ut.warning:Ut.error}`,children:[l.toFixed(1),"%"]}),a.jsx("span",{className:Ut.tableNumCol,children:Cp(c)})]},o.name)}),a.jsx("div",{className:Ut.spacer}),a.jsx("div",{className:Ut.sectionTitle,children:t("stats.decisionSummary")}),a.jsx(bg,{label:t("stats.totalReviewed"),children:r}),a.jsx(ik,{label:t("stats.accepted"),children:a.jsx("span",{className:Ut.success,children:s.accept})}),a.jsx(ik,{label:t("stats.rejected"),children:a.jsx("span",{className:Ut.error,children:s.reject})}),a.jsx(ik,{label:t("stats.modified"),children:a.jsx("span",{className:Ut.warning,children:s.modify})}),a.jsx("div",{className:Ut.divider}),a.jsx(bg,{label:t("stats.agreementRate"),children:a.jsx("span",{className:r>0?i>=90?Ut.success:i>=70?Ut.warning:Ut.error:void 0,children:r>0?`${i.toFixed(1)}%`:"--"})})]})}function hJe({view:e,status:t}){switch(e){case"model":return a.jsx(cJe,{status:t});case"tools":return a.jsx(dJe,{status:t});default:return a.jsx(lJe,{status:t})}}function Y6(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 fJe="_panel_13hcg_1",mJe="_title_13hcg_17",pJe="_row_13hcg_23",gJe="_rowGap_13hcg_31",bJe="_label_13hcg_35",yJe="_value_13hcg_41",vJe="_accent_13hcg_46",Tg={panel:fJe,title:mJe,row:pJe,rowGap:gJe,label:bJe,value:yJe,accent:vJe},{serialize:wJe,parse:xJe}=Y6("web-shell:status:v1:");function sd({label:e,children:t,gap:n}){return a.jsxs("div",{className:`${Tg.row}${n?` ${Tg.rowGap}`:""}`,children:[a.jsx("span",{className:Tg.label,children:e}),a.jsx("span",{className:Tg.value,children:t})]})}function kJe({info:e}){const{t}=nt();return a.jsxs("div",{className:Tg.panel,children:[a.jsx("div",{className:Tg.title,children:t("about.title")}),e.cliVersion&&a.jsx(sd,{label:t("about.qwenCode"),children:a.jsx("span",{className:Tg.accent,children:e.cliVersion})}),e.runtime&&a.jsx(sd,{label:t("about.runtime"),children:e.runtime}),e.platform&&a.jsx(sd,{label:t("about.platform"),children:e.platform}),e.auth&&a.jsx(sd,{label:t("about.auth"),gap:!0,children:e.auth}),e.baseUrl&&a.jsx(sd,{label:t("about.baseUrl"),children:e.baseUrl}),e.model&&a.jsx(sd,{label:t("about.model"),children:e.model}),e.fastModel&&e.fastModel!==e.model&&a.jsx(sd,{label:t("about.fastModel"),children:e.fastModel}),e.sessionId&&a.jsx(sd,{label:t("about.sessionId"),children:e.sessionId}),a.jsx(sd,{label:t("about.sandbox"),children:e.sandbox||t("about.noSandbox")}),a.jsx(sd,{label:t("about.proxy"),children:e.proxy||t("about.noProxy")}),e.memoryUsage&&a.jsx(sd,{label:t("about.memoryUsage"),children:e.memoryUsage})]})}function _Je(e){return e instanceof HTMLElement?!!e.closest("[data-keyboard-scope]"):!1}function nhe(e,t,n=50){const s=h.useRef(e);h.useEffect(()=>{s.current=e},[e]),h.useEffect(()=>{const r=o=>{o.defaultPrevented||s1(o.target)&&!_Je(o.target)||s.current(o)},i=setTimeout(()=>{window.addEventListener("keydown",r)},n);return()=>{clearTimeout(i),window.removeEventListener("keydown",r)}},t)}function no(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 SJe="_panel_1jx2a_1",CJe="_title_1jx2a_13",TJe="_header_1jx2a_18",EJe="_startup_1jx2a_24",AJe="_note_1jx2a_28",jJe="_secondary_1jx2a_29",NJe="_row_1jx2a_39",IJe="_selected_1jx2a_48",MJe="_disabled_1jx2a_52",RJe="_pointer_1jx2a_56",DJe="_nameCell_1jx2a_62",LJe="_truncate_1jx2a_69",PJe="_separator_1jx2a_75",OJe="_sectionTitle_1jx2a_79",$Je="_groupTitle_1jx2a_80",BJe="_success_1jx2a_84",zJe="_warning_1jx2a_88",FJe="_error_1jx2a_92",qJe="_group_1jx2a_80",HJe="_list_1jx2a_102",UJe="_description_1jx2a_108",WJe="_schema_1jx2a_113",VJe="_shortcuts_1jx2a_131",GJe="_detail_1jx2a_137",KJe="_serverFields_1jx2a_143",YJe="_serverField_1jx2a_143",XJe="_serverFieldLabel_1jx2a_156",QJe="_detailBlock_1jx2a_160",JJe="_parameters_1jx2a_161",ZJe="_invalidBlock_1jx2a_162",eZe="_parameterRow_1jx2a_172",tZe="_actionMessage_1jx2a_177",nZe="_oauthPage_1jx2a_183",sZe="_scrollHint_1jx2a_189",_n={panel:SJe,title:CJe,header:TJe,startup:EJe,note:AJe,secondary:jJe,row:NJe,selected:IJe,disabled:MJe,pointer:RJe,nameCell:DJe,truncate:LJe,separator:PJe,sectionTitle:OJe,groupTitle:$Je,success:BJe,warning:zJe,error:FJe,group:qJe,list:HJe,description:UJe,schema:WJe,shortcuts:VJe,detail:GJe,serverFields:KJe,serverField:YJe,serverFieldLabel:XJe,detailBlock:QJe,parameters:JJe,invalidBlock:ZJe,parameterRow:eZe,actionMessage:tZe,oauthPage:nZe,scrollHint:sZe},cR="web-shell:mcp-panel-active",J0=10,{parse:rZe}=Y6("web-shell:mcp-status:v1:");function iZe(e){const t=rZe(e);return!t||!t.status?null:t}function bC(e,t){if(e.disabled)return{icon:"✗",text:t("mcp.status.disabled"),className:_n.error};if(e.approvalState==="pending")return{icon:"!",text:t("mcp.status.needsApproval"),className:_n.warning};if(e.approvalState==="rejected")return{icon:"✗",text:t("mcp.status.rejected"),className:_n.warning};switch(e.mcpStatus){case"connected":return{icon:"✓",text:t("mcp.status.connected"),className:_n.success};case"connecting":return{icon:"🔄",text:t("mcp.status.starting"),className:_n.warning};case"disconnected":default:return{icon:"🔴",text:t("mcp.status.disconnectedTitle"),className:_n.error}}}function she(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 oZe(e){const t=she(e);return t?JSON.stringify(t,null,2):""}function aZe(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function lZe(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 cZe(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 Oj(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 $G(e,t){window.dispatchEvent(new CustomEvent(cR,{detail:{id:e,active:t}}))}function yC(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function uZe(e,t){return e?t("mcp.required"):""}function dZe(e,t){const n=she(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=oZe(e);return o?a.jsx("pre",{className:_n.schema,children:o}):null}const i=Object.entries(s);return i.length===0?null:a.jsxs("div",{className:_n.parameters,children:[a.jsx("div",{className:_n.sectionTitle,children:t("mcp.parameters")}),i.map(([o,l])=>{const c=l&&typeof l=="object"?l:{},u=typeof c.type=="string"?c.type:"any",d=typeof c.description=="string"?c.description:"";return a.jsx("div",{className:_n.parameterRow,children:`• ${o}${uZe(r.has(o),t)}: ${u}${d?` - ${d}`:""}`},o)})]})}function hZe({message:e}){var Y;const{t}=nt(),n=sD({autoLoad:!1}),[s,r]=h.useState(e.status),[i,o]=h.useState(e.toolsByServer),[l,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"),[w,y]=h.useState(0),[v,x]=h.useState(0),[k,_]=h.useState(0),T=h.useMemo(()=>s.servers??[],[s.servers]),S=T[w]??null,C=h.useMemo(()=>{var W;return S?((W=i[S.name])==null?void 0:W.tools)??[]:[]},[S,i]),N=C[k]??null,E=h.useMemo(()=>C.length<=J0||k<J0-1?0:Math.min(k-J0+1,C.length-J0),[k,C.length]),O=h.useMemo(()=>C.slice(E,E+J0),[C,E]),B=T.filter(W=>!W.disabled&&W.mcpStatus==="connecting").length,D=h.useMemo(()=>{const W=[];for(const M of T){const F=aZe(M,t),J=W.find(V=>V.label===F);J?J.servers.push(M):W.push({label:F,servers:[M]})}return W},[T,t]),j=h.useMemo(()=>T.length===0?20:Math.min(Math.max(...T.map(W=>W.name.length))+2,35),[T]),L=h.useMemo(()=>C.length===0?30:Math.min(Math.max(...C.map(W=>W.name.length))+2,50),[C]),z=h.useMemo(()=>{if(!S)return[];const W=[],M=!!S.approvalState;return!S.disabled&&!M&&C.length>0&&W.push({id:"view-tools",label:t("mcp.action.tools")}),!S.disabled&&!M&&S.mcpStatus==="disconnected"&&W.push({id:"reconnect",label:t("mcp.action.reconnect")}),!S.disabled&&M&&W.push({id:"approve",label:t("mcp.action.approve")}),(!(S.configOrigin==="extension"||S.source==="extension"||!!S.extensionName)||S.disabled)&&W.push({id:S.disabled?"enable":"disable",label:S.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),!S.disabled&&!M&&(W.push({id:"authenticate",label:S.hasOAuthTokens?t("mcp.action.reauth"):t("mcp.action.auth")}),S.hasOAuthTokens&&W.push({id:"clear-auth",label:t("mcp.action.clearAuth")})),W},[S,C.length,t]),I=h.useCallback(async()=>{var M;const W=await n.reload();if(W){r(W);const F=((M=W.servers)==null?void 0:M.find(J=>J.name===(S==null?void 0:S.name)))??null;if(F){if(F.approvalState)return;const J=await n.loadTools(F.name);o(V=>({...V,[F.name]:J}))}}},[n,S==null?void 0:S.name]),$=h.useCallback(async W=>{if(!(!S||W.disabled||u)){if(W.id==="view-tools"){b("tools"),_(0),c(null);return}d(!0),W.id==="authenticate"&&b("oauth"),c(W.id==="authenticate"?yC(S.name,t):t("mcp.action.running",{action:W.label}));try{let M=null;if(W.id==="reconnect"){const F=await n.restartServer(S.name);if("restarted"in F&&!F.restarted)throw new Error(t("mcp.reconnect.skipped",{reason:F.reason}));if("entries"in F&&(F.entries.length===0||F.entries.every(J=>!J.restarted)))throw new Error(t("mcp.reconnect.skipped",{reason:F.entries.map(J=>J.reason).filter(Boolean).join(", ")||"not connected"}))}else{const F=await n.manageServer(S.name,W.id),J=[...F.messages??[],...F.authUrl?[F.authUrl]:[]].join(`
`);J&&(M=W.id==="authenticate"?yC(S.name,t,J):J)}await I(),c(M??t("mcp.action.done",{action:W.label}))}catch(M){c(W.id==="authenticate"?yC(S.name,t,no(M)):t("mcp.action.failed",{error:no(M)}))}finally{d(!1)}}},[u,n,I,S,t]);if(h.useEffect(()=>{const W=f.current;return $G(W,m),()=>$G(W,!1)},[m]),h.useEffect(()=>{const W=M=>{const F=M.detail;F!=null&&F.active&&F.id&&F.id!==f.current&&p(!1)};return window.addEventListener(cR,W),()=>window.removeEventListener(cR,W)},[]),nhe(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"),_(0)):b("tools");return}if(W.key==="ArrowUp"||W.key==="ArrowDown"){W.preventDefault(),W.stopPropagation();const M=W.key==="ArrowUp"?-1:1;g==="servers"?(y(F=>Math.min(Math.max(F+M,0),T.length-1)),x(0)):g==="server"?x(F=>Math.min(Math.max(F+M,0),z.length-1)):g==="tools"&&_(F=>Math.min(Math.max(F+M,0),C.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"&&z.length>0){const M=z[v];M&&$(M)}else g==="tools"&&C.length>0&&b("tool")}},[m,v,C.length,z,$,T.length,g]),!m)return null;if(T.length===0)return a.jsxs("div",{className:_n.panel,"data-keyboard-scope":!0,children:[a.jsxs("div",{className:_n.header,children:[a.jsx("div",{className:_n.title,children:t("mcp.manageServers")}),a.jsx("div",{className:_n.secondary,children:t("mcp.servers",{count:0})})]}),a.jsx("div",{className:_n.secondary,children:t("mcp.empty")}),a.jsx("div",{className:_n.shortcuts,children:t("mcp.shortcut.close")})]});const K=g==="servers"?t("mcp.manageServers"):g==="server"?(S==null?void 0:S.name)??t("mcp.manageServers"):g==="oauth"?t("mcp.oauth.title"):g==="tools"?t("mcp.toolsForServer",{name:(S==null?void 0:S.name)??t("common.server")}):(N==null?void 0:N.name)??t("mcp.toolDetail"),R=g==="servers"?t("mcp.servers",{count:T.length}):g==="server"||g==="oauth"?"":g==="tools"?t(C.length===1?"mcp.toolCount":"mcp.toolsCount",{count:C.length}):(N==null?void 0:N.serverToolName)??(S==null?void 0:S.name)??"";return a.jsxs("div",{className:_n.panel,"data-keyboard-scope":!0,children:[B>0&&a.jsxs("div",{children:[a.jsx("div",{className:_n.startup,children:t("mcp.starting",{count:B})}),a.jsx("div",{className:_n.note,children:t("mcp.startingNote")})]}),a.jsxs("div",{className:_n.header,children:[a.jsx("div",{className:_n.title,children:K}),R&&a.jsx("div",{className:_n.secondary,children:R})]}),g==="servers"&&a.jsx("div",{className:_n.list,children:D.map(W=>{let M=0;for(const F of D){if(F===W)break;M+=F.servers.length}return a.jsxs("div",{className:_n.group,children:[a.jsx("div",{className:_n.groupTitle,children:W.label}),W.servers.map((F,J)=>{const V=M+J,U=V===w,le=bC(F,t);return a.jsxs("div",{className:U?`${_n.row} ${_n.selected}`:_n.row,onClick:()=>{y(V),b("server"),x(0)},onMouseEnter:()=>y(V),children:[a.jsx("span",{className:_n.pointer,children:U?"❯":""}),a.jsx("span",{className:_n.nameCell,style:{width:`${j}ch`},children:F.name}),a.jsx("span",{className:_n.separator,children:"·"}),a.jsxs("span",{className:le.className,children:[le.icon," ",le.text]})]},F.name)})]},W.label)})}),g==="server"&&S&&a.jsxs("div",{className:_n.detail,children:[a.jsxs("div",{className:_n.serverFields,children:[a.jsxs("div",{className:_n.serverField,children:[a.jsxs("span",{className:_n.serverFieldLabel,children:[t("mcp.status"),":"]}),a.jsxs("span",{className:bC(S,t).className,children:[bC(S,t).icon," ",bC(S,t).text]})]}),a.jsxs("div",{className:_n.serverField,children:[a.jsxs("span",{className:_n.serverFieldLabel,children:[t("mcp.source"),":"]}),a.jsx("span",{children:lZe(S,t)})]}),a.jsxs("div",{className:_n.serverField,children:[a.jsxs("span",{className:_n.serverFieldLabel,children:[t("mcp.command"),":"]}),a.jsx("span",{className:_n.truncate,children:cZe(S,t)})]}),((Y=S.config)==null?void 0:Y.cwd)&&a.jsxs("div",{className:_n.serverField,children:[a.jsxs("span",{className:_n.serverFieldLabel,children:[t("mcp.workingDirectory"),":"]}),a.jsx("span",{className:_n.truncate,children:S.config.cwd})]}),!S.disabled&&a.jsxs("div",{className:_n.serverField,children:[a.jsxs("span",{className:_n.serverFieldLabel,children:[t("mcp.tools"),":"]}),a.jsx("span",{children:t(C.length===1?"mcp.toolCount":"mcp.toolsCount",{count:C.length})})]})]}),a.jsx("div",{className:_n.list,children:z.map((W,M)=>{const F=M===v,J=[_n.row,F?_n.selected:"",W.disabled?_n.disabled:""].filter(Boolean).join(" ");return a.jsxs("div",{className:J,onClick:()=>{x(M),$(W)},children:[a.jsx("span",{className:_n.pointer,children:F?"❯":""}),a.jsx("span",{children:W.label})]},W.id)})}),l&&a.jsx("pre",{className:_n.actionMessage,children:l})]}),g==="oauth"&&a.jsx("div",{className:_n.oauthPage,children:a.jsx("pre",{className:_n.actionMessage,children:l??(S?yC(S.name,t):t("mcp.status.unknown"))})}),g==="tools"&&a.jsx("div",{className:_n.list,children:C.length===0?a.jsx("div",{className:_n.secondary,children:t("mcp.emptyTools")}):O.map((W,M)=>{const F=E+M,J=F===k,V=Oj(W,t);return a.jsxs("div",{className:J?`${_n.row} ${_n.selected}`:_n.row,onClick:()=>{_(F),b("tool")},onMouseEnter:()=>_(F),children:[a.jsx("span",{className:_n.pointer,children:J?"❯":""}),a.jsx("span",{className:_n.nameCell,style:{width:`${L}ch`},children:W.name}),W.isValid?V?a.jsx("span",{className:_n.secondary,children:V}):null:a.jsx("span",{className:_n.warning,children:t("mcp.invalidReason",{reason:W.invalidReason||t("mcp.status.unknown")})})]},W.name)})}),g==="tools"&&C.length>J0&&a.jsxs("div",{className:_n.scrollHint,children:[E>0?"↑ ":"  ",t("mcp.scrollPosition",{current:k+1,total:C.length}),E+J0<C.length?" ↓":""]}),g==="tool"&&N&&a.jsxs("div",{className:_n.detail,children:[!N.isValid&&a.jsxs("div",{className:_n.invalidBlock,children:[a.jsx("div",{className:_n.sectionTitle,children:t("mcp.invalidToolWarning")}),a.jsxs("div",{children:[t("mcp.invalidReasonLabel")," ",N.invalidReason||t("mcp.status.unknown")]}),a.jsx("div",{className:_n.secondary,children:t("mcp.invalidToolHelp")})]}),N.description&&a.jsxs("div",{className:_n.detailBlock,children:[a.jsx("div",{className:_n.sectionTitle,children:t("mcp.description")}),a.jsx("div",{className:_n.description,children:N.description.trim()})]}),Oj(N,t)&&a.jsxs("div",{className:_n.detailBlock,children:[a.jsx("span",{className:_n.sectionTitle,children:t("mcp.annotations")})," ",a.jsx("span",{children:Oj(N,t)})]}),dZe(N,t)]}),a.jsx("div",{className:_n.shortcuts,children:t(g==="servers"?"mcp.shortcut.selectClose":g==="server"||g==="tools"?"mcp.shortcut.selectBack":"mcp.shortcut.back")})]})}function GP(e){return e instanceof Error&&e.message.endsWith("Daemon session is not connected")}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const fZe=3;function R3(e){return e.kind==="agent"&&typeof e.id=="string"}function mZe(e){const t=e.filter(R3),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,l=u=>{if(!o.has(u.id)){o.add(u.id),i.push(u);for(const d of s.get(u.id)??[])l(d)}};for(const u of r)l(u);for(const u of t)o.has(u.id)||(o.add(u.id),i.push(u));let c=0;return e.map(u=>R3(u)?i[c++]:u)}function rhe(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 pZe(e){const t=new Map;for(const s of e)R3(s)&&t.set(s.id,s);const n=new Map;for(const s of t.values()){const{chain:r,terminatedBy:i}=rhe(s,o=>t.get(o));n.set(s.id,{visibleDepth:i==="cycle"?0:r.length,orphaned:r.length===0&&i==="missing"})}return n}function gZe(e){const t=new Map;for(const s of e)R3(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}=rhe(s,o=>t.get(o));i==="root"&&r.every(o=>o.isBackgrounded===!1)&&n.add(s.id)}return n}function Qy(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 bZe="_section_psgo7_1",yZe="_heading_psgo7_9",vZe="_unassignedTitle_psgo7_10",wZe="_count_psgo7_15",xZe="_dependencies_psgo7_16",kZe="_executionStatus_psgo7_17",_Ze="_dagViewport_psgo7_22",SZe="_dagCanvas_psgo7_28",CZe="_dagEdges_psgo7_38",TZe="_dagEdge_psgo7_38",EZe="_edgeArrow_psgo7_55",AZe="_flatList_psgo7_60",jZe="_flatCanvas_psgo7_61",NZe="_layer_psgo7_62",IZe="_node_psgo7_88",MZe="_nodeSummary_psgo7_140",RZe="_nodeTop_psgo7_160",DZe="_nodeId_psgo7_166",LZe="_nodeStatus_psgo7_172",PZe="_attention_psgo7_173",OZe="_running_psgo7_180",$Ze="_completed_psgo7_181",BZe="_paused_psgo7_185",zZe="_blocked_psgo7_186",FZe="_in_progress_psgo7_191",qZe="_ready_psgo7_195",HZe="_nodeContent_psgo7_199",UZe="_executions_psgo7_209",WZe="_executionGroup_psgo7_215",VZe="_execution_psgo7_17",GZe="_executionLabel_psgo7_252",KZe="_nestedExecution_psgo7_264",YZe="_unassigned_psgo7_10",XZe="_stepDetails_psgo7_301",QZe="_stepDetailsHeading_psgo7_311",JZe="_stepExecutions_psgo7_318",ZZe="_stepExecutionsTitle_psgo7_325",ws={section:bZe,heading:yZe,unassignedTitle:vZe,count:wZe,dependencies:xZe,executionStatus:kZe,dagViewport:_Ze,dagCanvas:SZe,dagEdges:CZe,dagEdge:TZe,edgeArrow:EZe,flatList:AZe,flatCanvas:jZe,layer:NZe,node:IZe,nodeSummary:MZe,nodeTop:RZe,nodeId:DZe,nodeStatus:LZe,attention:PZe,running:OZe,completed:$Ze,paused:BZe,blocked:zZe,in_progress:FZe,ready:qZe,nodeContent:HZe,executions:UZe,executionGroup:WZe,execution:VZe,executionLabel:GZe,nestedExecution:KZe,unassigned:YZe,stepDetails:XZe,stepDetailsHeading:QZe,stepExecutions:JZe,stepExecutionsTitle:ZZe},eet={width:1,height:1,edges:[]},tet=500;function net(e){const t=new Map(e.map(c=>[c.id,c])),n=new Map,s=new Map,r=new Map;for(const c of t.values()){const u=new Set((c.blockedBy??[]).filter(d=>d!==c.id&&t.has(d)));n.set(c.id,u.size),r.set(c.id,0);for(const d of u){const f=s.get(d)??[];f.push(c.id),s.set(d,f)}}const i=[...t.keys()].filter(c=>n.get(c)===0);for(let c=0;c<i.length;c++){const u=i[c],d=(r.get(u)??0)+1;for(const f of s.get(u)??[]){r.set(f,Math.max(r.get(f)??0,d));const m=(n.get(f)??1)-1;n.set(f,m),m===0&&i.push(f)}}let o=0;for(const c of r.values())o=Math.max(o,c);for(const[c,u]of n)u>0&&r.set(c,o+1);const l=[];for(const c of e){const u=r.get(c.id)??0;(l[u]??(l[u]=[])).push(c)}return l}function set(e){const t=new Map,n=new Map;for(const s of e){if(s.kind!=="agent")continue;if(s.parentAgentId==null){if(!s.toolUseId||t.has(s.toolUseId))continue;t.set(s.toolUseId,s);continue}const r=n.get(s.parentAgentId)??[];r.push(s),n.set(s.parentAgentId,r)}return{rootByToolCallId:t,childrenByParentId:n,nestedByRootId:new Map}}function ihe(e,t){return t.rootByToolCallId.get(e.callId)}function D3(e,t){var r;const n=(r=ihe(e,t))==null?void 0:r.status;if(n)return n;const s=e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput.status:void 0;return s==="paused"?s:ehe(e)?"cancelled":Xy(e)}function ohe(e,t){const n=ihe(e,t);if(!n)return[];const s=t.nestedByRootId.get(n.id);if(s)return s;const r=[],i=new Set([n.id]),o=(t.childrenByParentId.get(n.id)??[]).slice().reverse().map(l=>({task:l,depth:1}));for(;o.length>0;){const l=o.pop();if(i.has(l.task.id))continue;i.add(l.task.id),r.push(l);const c=t.childrenByParentId.get(l.task.id)??[];for(let u=c.length-1;u>=0;u--)o.push({task:c[u],depth:l.depth+1})}return t.nestedByRootId.set(n.id,r),r}function ahe(e){const t=[],n=(s,r)=>{for(const i of s.subTools??[])l0(i)&&(t.push({tool:i,depth:r}),n(i,r+1))};return n(e,1),t}function BG(e,t,n,s){const r=n.map(c=>D3(c,s)),i=n.flatMap(c=>[...ohe(c,s).map(({task:u})=>u.status),...ahe(c).map(({tool:u})=>D3(u,s))]),o=[...r,...i].some(c=>c==="failed"||c==="cancelled");return r.includes("running")||r.includes("in_progress")?{status:"running",attention:o}:r.includes("paused")?{status:"paused",attention:o}:e.status==="completed"?{status:"completed",attention:o}:(e.blockedBy??[]).some(c=>{var u;return((u=t.get(c))==null?void 0:u.status)!=="completed"})?{status:"blocked",attention:o}:e.status==="in_progress"?{status:"in_progress",attention:o}:{status:"ready",attention:o}}function ret(e){var n;const t=(n=e.args)==null?void 0:n.todo_id;return typeof t=="string"&&t.length>0?t:void 0}function zG(e){return`planExecution.status.${e}`}function $j(e){switch(e){case"running":case"in_progress":return"tasks.running";case"paused":return"tasks.paused";case"completed":return"tasks.completed";case"failed":return"tasks.failed";case"cancelled":return"tasks.cancelled";default:return"planExecution.status.ready"}}function iet(e){if(!e.toolUseId)return;const t=e.status==="failed"?"failed":e.status==="running"||e.status==="paused"?"in_progress":"completed";return{callId:e.toolUseId,toolName:"Agent",title:e.label,args:{description:e.description},status:t,rawOutput:{type:"task_execution",status:e.status}}}function uR({todos:e,tools:t,tasks:n,onOpenSubagent:s}){var I;const{t:r}=nt(),i=h.useMemo(()=>set(n),[n]),o=new Set(e.map($=>$.id)),l=new Map(e.map($=>[$.id,$])),c=new Map,u=[];for(const $ of t){const K=ret($);if(!K||!o.has(K)){u.push($);continue}const R=c.get(K)??[];R.push($),c.set(K,R)}const d=e.map($=>[$.id,[...new Set($.blockedBy??[])].filter(K=>K!==$.id&&o.has(K))]),f=JSON.stringify(d),m=d.reduce(($,K)=>$+K[1].length,0),p=m>0,g=p&&m<=tet,b=p?net(e):[e.slice()],w=new Map;b.forEach(($,K)=>{for(const R of $)w.set(R.id,K)});const y=h.useId().replaceAll(":",""),v=`plan-arrow-${y}`,x=h.useRef(null),k=h.useRef(new Map),_=h.useRef(d);_.current=d;const T=h.useRef(w);T.current=w;const S=h.useRef(""),[C,N]=h.useState(eet),[E,O]=h.useState();if(h.useEffect(()=>{E&&!e.some($=>$.id===E)&&O(void 0)},[E,e]),h.useLayoutEffect(()=>{if(!g)return;const $=x.current;if(!$)return;const K=()=>{const Y=$.getBoundingClientRect(),W=$.offsetWidth>0?Y.width/$.offsetWidth:1,M=$.offsetHeight>0?Y.height/$.offsetHeight:1,F=new Map;let J=0;for(const[pe,fe]of k.current){const Q=fe.getBoundingClientRect(),ne={...Q,left:(Q.left-Y.left)/W,right:(Q.right-Y.left)/W,top:(Q.top-Y.top)/M,bottom:(Q.bottom-Y.top)/M,width:Q.width/W,height:Q.height/M};F.set(pe,ne),J=Math.max(J,ne.bottom)}const V=[];for(const[pe,fe]of _.current){const Q=F.get(pe);if(Q)for(const ne of fe){const de=F.get(ne);if(!de)continue;const ue=de.right,me=de.top+de.height/2,te=Q.left,ae=Q.top+Q.height/2,be=(T.current.get(pe)??0)-(T.current.get(ne)??0)>1,se=ue+Math.max(24,(te-ue)/2),ve=J+16,ze=be?`M ${ue} ${me} H ${ue+28} V ${ve} H ${te-28} V ${ae} H ${te}`:`M ${ue} ${me} C ${se} ${me}, ${se} ${ae}, ${te} ${ae}`;V.push({from:ne,to:pe,d:ze})}}const U={width:Math.max(1,$.scrollWidth,Y.width/W),height:Math.max(1,$.scrollHeight,Y.height/M),edges:V},le=`${U.width}:${U.height}:${V.map(pe=>pe.d).join("|")}`;le!==S.current&&(S.current=le,N(U))};K(),window.addEventListener("resize",K);const R=typeof ResizeObserver>"u"?void 0:new ResizeObserver(K);R==null||R.observe($);for(const Y of k.current.values())R==null||R.observe(Y);return()=>{window.removeEventListener("resize",K),R==null||R.disconnect()}},[g,f]),e.length===0)return null;const B=l.get(E??""),D=B?c.get(B.id)??[]:[],j=B?BG(B,l,D,i):void 0,L=`plan-step-details-${y}`,z=$=>{var V;const K=D3($,i),R=$.title||String(((V=$.args)==null?void 0:V.description)??$.toolName),Y=ohe($,i),W=ahe($),M=new Map(W.map(({tool:U})=>[U.callId,U])),F=new Set(Y.flatMap(({task:U})=>U.toolUseId?[U.toolUseId]:[])),J=W.filter(({tool:U})=>!F.has(U.callId));return a.jsxs("div",{className:ws.executionGroup,children:[a.jsxs("button",{type:"button",className:ws.execution,"data-plan-interactive":!0,onClick:()=>s==null?void 0:s($),disabled:!s,title:r("planExecution.openDetails"),children:[a.jsx("span",{className:ws.executionLabel,children:R}),a.jsx("span",{className:ws.executionStatus,children:r($j(K))})]}),Y.map(({task:U,depth:le})=>{const pe=U.toolUseId?M.get(U.toolUseId)??iet(U):void 0,fe=a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:ws.executionLabel,children:["↳ ",U.label]}),a.jsx("span",{className:ws.executionStatus,children:r($j(U.status))})]});return pe?a.jsx("button",{type:"button",className:ws.nestedExecution,"data-plan-interactive":!0,style:{paddingLeft:`${Math.min(le,3)*12}px`},onClick:()=>s==null?void 0:s(pe),disabled:!s,title:r("planExecution.openDetails"),children:fe},U.id):a.jsx("div",{className:ws.nestedExecution,style:{paddingLeft:`${Math.min(le,3)*12}px`},children:fe},U.id)}),J.map(({tool:U,depth:le})=>{var pe;return a.jsxs("button",{type:"button",className:ws.nestedExecution,"data-plan-interactive":!0,style:{paddingLeft:`${Math.min(le,3)*12}px`},onClick:()=>s==null?void 0:s(U),disabled:!s,title:r("planExecution.openDetails"),children:[a.jsxs("span",{className:ws.executionLabel,children:["↳"," ",U.title||String(((pe=U.args)==null?void 0:pe.description)??U.toolName)]}),a.jsx("span",{className:ws.executionStatus,children:r($j(D3(U,i)))})]},U.callId)})]},$.callId)};return a.jsxs("section",{className:ws.section,"aria-label":r("planExecution.title"),children:[a.jsxs("div",{className:ws.heading,children:[r("planExecution.title")," ",a.jsxs("span",{className:ws.count,children:["(",e.length,")"]})]}),a.jsx("div",{className:p?ws.dagViewport:ws.flatList,...p?{"data-plan-workflow":!0}:{},children:a.jsxs("div",{className:p?ws.dagCanvas:ws.flatCanvas,ref:p?x:void 0,children:[g&&C.edges.length>0&&a.jsxs("svg",{className:ws.dagEdges,width:C.width,height:C.height,viewBox:`0 0 ${C.width} ${C.height}`,"aria-hidden":"true",children:[a.jsx("defs",{children:a.jsx("marker",{id:v,markerWidth:"7",markerHeight:"7",refX:"6",refY:"3.5",orient:"auto",children:a.jsx("path",{className:ws.edgeArrow,d:"M 0 0 L 7 3.5 L 0 7 z"})})}),C.edges.map($=>a.jsx("path",{className:ws.dagEdge,"data-plan-edge":!0,"data-from":$.from,"data-to":$.to,d:$.d,markerEnd:`url(#${v})`},JSON.stringify([$.from,$.to])))]}),b.map(($,K)=>a.jsx("div",{className:ws.layer,children:$.map(R=>{var M;const Y=c.get(R.id)??[],W=BG(R,l,Y,i);return a.jsxs("article",{className:ws.node,"data-status":W.status,"data-selected":E===R.id||void 0,ref:F=>{F?k.current.set(R.id,F):k.current.delete(R.id)},children:[a.jsxs("button",{type:"button",className:ws.nodeSummary,"data-plan-interactive":!0,"data-plan-node-id":R.id,"aria-expanded":E===R.id,"aria-controls":E===R.id?L:void 0,title:`${r(E===R.id?"todo.detail.hide":"todo.detail.show")}: ${R.content}`,onClick:()=>O(F=>F===R.id?void 0:R.id),children:[a.jsxs("div",{className:ws.nodeTop,children:[a.jsx("span",{className:ws.nodeId,children:R.id}),a.jsx("span",{className:`${ws.nodeStatus} ${ws[W.status]}`,children:r(zG(W.status))}),W.attention&&a.jsx("span",{className:ws.attention,children:r("planExecution.attention")})]}),a.jsx("div",{className:ws.nodeContent,children:R.content}),(((M=R.blockedBy)==null?void 0:M.length)??0)>0&&a.jsxs("div",{className:ws.dependencies,children:[r("planExecution.dependsOn")," ",R.blockedBy.join(", ")]})]}),Y.length>0&&a.jsx("div",{className:ws.executions,children:Y.map(z)})]},R.id)})},K))]})}),B&&j&&a.jsxs("section",{className:ws.stepDetails,"data-plan-step-details":!0,id:L,"aria-label":`${r("planExecution.stepDetails")}: ${B.id}`,children:[a.jsxs("div",{className:ws.stepDetailsHeading,children:[a.jsx("span",{children:r("planExecution.stepDetails")}),a.jsx("span",{className:ws.nodeId,children:B.id}),a.jsx("span",{className:`${ws.nodeStatus} ${ws[j.status]}`,children:r(zG(j.status))}),j.attention&&a.jsx("span",{className:ws.attention,children:r("planExecution.attention")})]}),a.jsx("div",{className:ws.nodeContent,children:B.content}),(((I=B.blockedBy)==null?void 0:I.length)??0)>0&&a.jsxs("div",{className:ws.dependencies,children:[r("planExecution.dependsOn")," ",B.blockedBy.join(", ")]}),D.length>0&&a.jsxs("div",{className:ws.stepExecutions,children:[a.jsx("div",{className:ws.stepExecutionsTitle,children:r("planExecution.subagents")}),a.jsx("div",{className:ws.executions,children:D.map(z)})]})]}),u.length>0&&a.jsxs("div",{className:ws.unassigned,children:[a.jsx("div",{className:ws.unassignedTitle,children:r("planExecution.unassigned")}),a.jsx("div",{className:ws.executions,children:u.map(z)})]})]})}const oet=g1("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 Ni({className:e,variant:t="default",asChild:n=!1,...s}){const r=n?uL:"span";return a.jsx(r,{"data-slot":"badge","data-variant":t,className:on(oet({variant:t}),e),...s})}const aet="_panel_hlsct_1",cet="_embeddedPanel_hlsct_12",uet="_title_hlsct_19",det="_sectionTitle_hlsct_24",het="_overflowHint_hlsct_28",fet="_header_hlsct_33",met="_secondary_hlsct_39",pet="_row_hlsct_43",get="_selected_hlsct_51",bet="_pointer_hlsct_55",yet="_nameCell_hlsct_61",vet="_treeMarker_hlsct_70",wet="_orphanNote_hlsct_74",xet="_status_hlsct_78",ket="_chevronCell_hlsct_84",_et="_chevron_hlsct_84",Cet="_chevronExpanded_hlsct_101",Tet="_separator_hlsct_111",Eet="_list_hlsct_115",Aet="_task_hlsct_121",jet="_taskExpanded_hlsct_127",Net="_success_hlsct_132",Iet="_warning_hlsct_136",Met="_error_hlsct_140",Ret="_detail_hlsct_144",Det="_detailTop_hlsct_153",Let="_monitorDetail_hlsct_160",Pet="_monitorOverview_hlsct_166",Oet="_monitorHeadingRow_hlsct_174",$et="_monitorDescription_hlsct_182",Bet="_monitorStatusActions_hlsct_192",zet="_monitorStatusTag_hlsct_199",Fet="_monitorStopButton_hlsct_231",qet="_monitorActionError_hlsct_253",Het="_monitorMetrics_hlsct_259",Uet="_monitorMetric_hlsct_259",Wet="_monitorMetricValue_hlsct_275",Vet="_monitorMetricLabel_hlsct_284",Get="_monitorSectionLabel_hlsct_285",Ket="_monitorCommandSection_hlsct_290",Yet="_monitorError_hlsct_291",Xet="_shellFields_hlsct_296",Qet="_shellFieldValue_hlsct_301",Jet="_shellError_hlsct_312",Zet="_monitorCommand_hlsct_290",ett="_detailTopMain_hlsct_339",ttt="_inlineDetail_hlsct_379",ntt="_taskIcon_hlsct_401",stt="_detailField_hlsct_430",rtt="_detailFieldLabel_hlsct_437",itt="_detailContent_hlsct_443",ott="_compactSummary_hlsct_450",att="_actionBar_hlsct_459",ltt="_actionHint_hlsct_468",ctt="_actionButton_hlsct_473",utt="_dangerButton_hlsct_493",dtt="_shortcuts_hlsct_497",htt="_confirmHint_hlsct_503",ftt="_statusBadge_hlsct_507",mtt="_activityCurrent_hlsct_513",ptt="_activityPast_hlsct_520",gtt="_promptContent_hlsct_527",mt={panel:aet,embeddedPanel:cet,title:uet,sectionTitle:det,overflowHint:het,header:fet,secondary:met,row:pet,selected:get,pointer:bet,nameCell:yet,treeMarker:vet,orphanNote:wet,status:xet,chevronCell:ket,chevron:_et,chevronExpanded:Cet,separator:Tet,list:Eet,task:Aet,taskExpanded:jet,success:Net,warning:Iet,error:Met,detail:Ret,detailTop:Det,monitorDetail:Let,monitorOverview:Pet,monitorHeadingRow:Oet,monitorDescription:$et,monitorStatusActions:Bet,monitorStatusTag:zet,monitorStopButton:Fet,monitorActionError:qet,monitorMetrics:Het,monitorMetric:Uet,monitorMetricValue:Wet,monitorMetricLabel:Vet,monitorSectionLabel:Get,monitorCommandSection:Ket,monitorError:Yet,shellFields:Xet,shellFieldValue:Qet,shellError:Jet,monitorCommand:Zet,detailTopMain:ett,inlineDetail:ttt,taskIcon:ntt,detailField:stt,detailFieldLabel:rtt,detailContent:itt,compactSummary:ott,actionBar:att,actionHint:ltt,actionButton:ctt,dangerButton:utt,shortcuts:dtt,confirmHint:htt,statusBadge:ftt,activityCurrent:mtt,activityPast:ptt,promptContent:gtt},l_="web-shell:tasks-panel-active",btt=3e3,FG=8,{parse:ytt}=Y6("web-shell:tasks-status:v1:");function vtt(e){const t=ytt(e);return!t||!t.snapshot?null:t}function qG(e,t){window.dispatchEvent(new CustomEvent(l_,{detail:{id:e,active:t}}))}function HG(e){return e.status==="running"||e.status==="paused"}function wtt(e){return[...e].sort((t,n)=>{const s=HG(t),r=HG(n);return s!==r?s?-1:1:s?n.startTime-t.startTime:(n.endTime??n.startTime)-(t.endTime??t.startTime)})}function Bj(e){return mZe(wtt(e))}function UG(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function lhe(e){switch(e){case"running":return mt.success;case"paused":return mt.warning;case"completed":return mt.success;case"failed":return mt.error;case"cancelled":return mt.warning;default:return""}}function KP(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 xtt(e){switch(e){case"paused":return"⏸";case"completed":return"✓";case"failed":case"cancelled":return"✗";case"running":return null;default:return null}}function ktt({expanded:e}){return a.jsx("svg",{className:`${mt.chevron} ${e?mt.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function _tt(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 Stt(e,t){if(e.length<=FG)return{visible:e,windowStart:0,hiddenAbove:0,hiddenBelow:0};const n=Math.max(1,FG-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 Ctt(e,t,n){const s=wd(e,n),r=t?t.replace(/\s*\n\s*/g," ").trim():"",i=r?`${s}(${r})`:s;return I4(i)}function che({message:e,embedded:t=!1,manageActiveEvent:n=!0,onClose:s,planTodos:r=[],agentTools:i=[],onOpenSubagent:o,onOpenMonitor:l}){const{t:c}=nt(),u=rm(),[d,f]=h.useState(()=>Bj(e.snapshot.tasks)),[m,p]=h.useState(!0),[g,b]=h.useState("list"),[w,y]=h.useState(0),[v,x]=h.useState(null),[k,_]=h.useState(!1),[T,S]=h.useState(!1),[C,N]=h.useState(null),E=h.useRef(`tasks-${Math.random().toString(36).slice(2)}`),O=h.useRef(!1),B=h.useRef(null),D=d.length===0?0:Math.min(w,d.length-1),j=d[D]??null,L=h.useMemo(()=>pZe(d),[d]),z=h.useMemo(()=>gZe(d),[d]);h.useEffect(()=>{if(!m)return;const le=setInterval(()=>{O.current||(O.current=!0,u.getTasks().then(pe=>{f(Bj(pe.tasks)),S(!1)}).catch(pe=>{if(GP(pe)){S(!1);return}console.warn("[web-shell] failed to refresh tasks:",pe),S(!0)}).finally(()=>{O.current=!1}))},btt);return()=>clearInterval(le)},[m,u]),h.useEffect(()=>{d.length===0&&w!==0&&y(0),w>=d.length&&d.length>0&&y(d.length-1)},[d.length,w]),h.useEffect(()=>{if(!m||g!=="detail"){B.current=null;return}if(!j){B.current=null,b("list");return}const U=B.current;if(!U||U.taskId!==j.id){B.current={taskId:j.id,status:j.status};return}U.status==="running"&&j.status!=="running"&&(x(null),b("list"))},[m,g,j]),h.useEffect(()=>{if(!n)return;const U=E.current;return qG(U,m),()=>qG(U,!1)},[m,n]),h.useEffect(()=>{if(!n)return;const U=le=>{const pe=le.detail;pe!=null&&pe.active&&pe.id&&pe.id!==E.current&&p(!1)};return window.addEventListener(l_,U),()=>window.removeEventListener(l_,U)},[n]),h.useEffect(()=>{m||s==null||s()},[m,s]);const I=h.useCallback(async U=>{if(k)return;const le=U.status==="running",pe=U.kind==="agent"&&U.status==="paused";if(!le&&!pe)return;if(U.kind==="agent"&&z.has(U.id)&&v!==U.id){x(U.id);return}x(null),_(!0);try{if(!(await u.cancelTask(U.id,U.kind)).cancelled){N(c("tasks.alreadyStopped"));return}const ne=await u.getTasks();f(Bj(ne.tasks)),N(null)}catch(Q){console.warn("[web-shell] failed to cancel task:",Q),N(c("tasks.cancelFailed"))}finally{_(!1)}},[u,k,z,v,c]);if(nhe(U=>{if(m&&!(U.key!=="Escape"&&U.target instanceof Element&&U.target.closest("[data-plan-interactive]"))){if(U.key==="Escape"){if(U.preventDefault(),U.stopPropagation(),v){x(null);return}g==="detail"?b("list"):p(!1);return}if(U.key==="ArrowLeft"){U.preventDefault(),U.stopPropagation(),g==="detail"?(x(null),b("list")):p(!1);return}if((U.key==="ArrowUp"||U.key==="ArrowDown")&&g==="list"){if(U.preventDefault(),U.stopPropagation(),d.length===0)return;const le=U.key==="ArrowUp"?-1:1;y(pe=>Math.min(Math.max(pe+le,0),d.length-1)),x(null);return}if(U.key==="Enter"){U.preventDefault(),U.stopPropagation(),g==="list"&&j?t&&j.kind==="monitor"&&l?l(j):b("detail"):g==="detail"&&p(!1);return}if(U.key===" "&&g==="detail"){U.preventDefault(),U.stopPropagation(),p(!1);return}if(U.key==="x"&&!U.ctrlKey&&!U.metaKey){U.preventDefault(),U.stopPropagation(),j&&I(j);return}}},[t,m,g,d.length,j,I,l,v]),!m)return null;const $=v!==null&&j!==null&&v===j.id,K=[];$?(K.push(c("tasks.confirmStop")),K.push(c("tasks.shortcut.cancelConfirm"))):(K.push(c("tasks.shortcut.select")),K.push(c("tasks.shortcut.view")),(j==null?void 0:j.status)==="running"?K.push(c("tasks.shortcut.stop")):(j==null?void 0:j.kind)==="agent"&&(j==null?void 0:j.status)==="paused"&&K.push(c("tasks.shortcut.abandon")),K.push(c("tasks.shortcut.listClose")));const R=[];if($?(R.push(c("tasks.confirmStop")),R.push(c("tasks.shortcut.cancelConfirm"))):(R.push(c("tasks.shortcut.detailBack")),R.push(c("tasks.shortcut.detailClose")),(j==null?void 0:j.status)==="running"?R.push(c("tasks.shortcut.stop")):(j==null?void 0:j.kind)==="agent"&&(j==null?void 0:j.status)==="paused"&&R.push(c("tasks.shortcut.abandon"))),d.length===0)return a.jsxs("div",{className:t?`${mt.panel} ${mt.embeddedPanel}`:mt.panel,"data-keyboard-scope":!0,children:[(T||C||!t)&&a.jsxs("div",{className:mt.header,children:[!t&&a.jsx("div",{className:mt.title,children:c("tasks.title")}),T&&a.jsx("div",{className:mt.warning,children:c("tasks.refreshStale")}),C&&a.jsx("div",{className:mt.error,children:C})]}),a.jsx(uR,{todos:r,tools:i,tasks:d,onOpenSubagent:o}),a.jsx("div",{children:a.jsx("div",{className:mt.secondary,children:c("tasks.empty")})}),!t&&a.jsx("div",{className:mt.shortcuts,children:c("tasks.shortcut.close")})]});const{visible:Y,windowStart:W,hiddenAbove:M,hiddenBelow:F}=Stt(d,D),J=t?d:Y,V=t?0:W;return a.jsxs("div",{className:t?`${mt.panel} ${mt.embeddedPanel}`:mt.panel,"data-keyboard-scope":!0,children:[(t||g==="list")&&(T||C||!t)&&a.jsxs("div",{className:mt.header,children:[!t&&a.jsx("div",{className:mt.title,children:c("tasks.title")}),T&&a.jsx("div",{className:mt.warning,children:c("tasks.refreshStale")}),C&&a.jsx("div",{className:mt.error,children:C})]}),(t||g==="list")&&a.jsx(uR,{todos:r,tools:i,tasks:d,onOpenSubagent:o}),(t||g==="list")&&a.jsxs("div",{className:mt.list,children:[!t&&a.jsxs("div",{className:mt.sectionTitle,children:[c("tasks.title")," ",a.jsxs("span",{className:mt.secondary,children:["(",d.length,")"]})]}),!t&&M>0&&a.jsx("div",{className:mt.overflowHint,children:c("tasks.moreAbove",{count:M})}),J.map((U,le)=>{const pe=V+le,fe=pe===D,Q=lhe(U.status),ne=KP(U.status,c),de=t&&fe&&g==="detail",ue=t?de:fe,me=U.kind==="agent"?L.get(U.id):void 0,te=Math.min((me==null?void 0:me.visibleDepth)??0,fZe),ae=U.kind==="agent"&&U.parentAgentId!=null,be=me!=null&&me.orphaned?U.kind==="agent"&&U.parentName?c("tasks.row.from",{parent:U.parentName}):c("tasks.row.nested"):null;return a.jsxs("div",{className:`${mt.task} ${de?mt.taskExpanded:""}`,children:[a.jsxs("div",{className:ue?`${mt.row} ${mt.selected}`:mt.row,onClick:()=>{y(pe),t&&U.kind==="monitor"&&l?l(U):b(t&&de?"list":"detail")},onMouseEnter:()=>{t||y(pe)},children:[a.jsx("span",{className:mt.pointer,children:ue?"❯":""}),t&&a.jsx("span",{className:mt.taskIcon,"aria-hidden":"true"}),a.jsxs("span",{className:mt.nameCell,style:te>0?{paddingLeft:`${te*16}px`}:void 0,children:[ae&&a.jsx("span",{className:mt.treeMarker,"aria-hidden":"true",children:"↳ "}),_tt(U,z.has(U.id)),be&&a.jsxs("span",{className:mt.orphanNote,children:[" · ",be]})]}),a.jsx("span",{className:`${mt.status} ${Q}`,children:ne}),a.jsx("span",{className:mt.chevronCell,children:a.jsx(ktt,{expanded:de})})]}),de&&a.jsx("div",{className:mt.inlineDetail,children:a.jsx(WG,{task:U,t:c,hideHeader:!0,busy:k,showCancelConfirm:v===U.id,onCancel:()=>void I(U),onCancelConfirmDismiss:()=>x(null)})})]},U.id)}),!t&&F>0&&a.jsx("div",{className:mt.overflowHint,children:c("tasks.moreBelow",{count:F})})]}),!t&&g==="detail"&&j&&a.jsxs(a.Fragment,{children:[C&&a.jsx("div",{className:mt.error,children:C}),a.jsx(WG,{task:j,t:c,busy:k,showCancelConfirm:v===j.id,onCancel:()=>void I(j),onCancelConfirmDismiss:()=>x(null)})]}),!t&&a.jsx("div",{className:$?`${mt.shortcuts} ${mt.confirmHint}`:mt.shortcuts,children:(g==="list"?K:R).join(" · ")})]})}function Ttt(e,t){switch(e.kind){case"agent":return`${e.subagentType?Z_(e.subagentType,t):t("common.agent")} › ${e.label}`;case"shell":return`${t("tasks.kind.shell")} › ${e.command}`;case"monitor":return`${t("tasks.kind.monitor")} › ${e.description}`}}function Ett({task:e,actions:t}){const{t:n}=nt(),s=rm(),r=t??s,[i,o]=h.useState(e),[l,c]=h.useState(!1),[u,d]=h.useState(null);h.useEffect(()=>{o(m=>m.id===e.id&&m.status!=="running"&&e.status==="running"?m:e)},[e]),h.useEffect(()=>{d(null)},[e.id,e.status]);const f=h.useCallback(async()=>{if(!(l||i.status!=="running")){d(null),c(!0);try{if(!(await r.cancelTask(i.id,"monitor")).cancelled){d(n("tasks.alreadyStopped"));return}o({...i,status:"cancelled",endTime:Date.now()}),d(null);try{const g=(await r.getTasks()).tasks.find(b=>b.kind==="monitor"&&b.id===i.id);g&&g.status!=="running"&&o(g)}catch(p){console.warn("[web-shell] failed to refresh stopped monitor:",p)}}catch(m){console.warn("[web-shell] failed to cancel monitor:",m),d(n("tasks.cancelFailed"))}finally{c(!1)}}},[r,l,i,n]);return a.jsxs("div",{className:mt.monitorDetail,children:[a.jsxs("div",{className:mt.monitorOverview,children:[a.jsxs("div",{className:mt.monitorHeadingRow,children:[a.jsx("div",{className:mt.monitorDescription,children:i.description}),a.jsxs("div",{className:mt.monitorStatusActions,children:[a.jsx(Ni,{variant:"outline",className:mt.monitorStatusTag,"data-status":i.status,children:KP(i.status,n)}),i.status==="running"&&a.jsx("button",{type:"button",className:mt.monitorStopButton,disabled:l,onClick:()=>void f(),children:n(l?"common.loading":"tasks.action.stop")})]})]}),u&&a.jsx("div",{className:mt.monitorActionError,children:u}),a.jsxs("div",{className:mt.monitorMetrics,children:[a.jsx(df,{label:n("tasks.detail.runtime"),value:Qy(i.runtimeMs)}),a.jsx(df,{label:n("tasks.detail.eventCount"),value:String(i.eventCount)}),i.pid!==void 0&&a.jsx(df,{label:n("tasks.detail.pid"),value:String(i.pid)}),i.eventCount>0&&a.jsx(df,{label:n("tasks.detail.lastEvent"),value:new Date(i.lastEventTime).toLocaleTimeString()}),i.droppedLines>0&&a.jsx(df,{label:n("tasks.detail.droppedCount"),value:String(i.droppedLines)}),i.exitCode!==void 0&&a.jsx(df,{label:n("tasks.detail.exitCode"),value:String(i.exitCode)})]})]}),a.jsxs("div",{className:mt.monitorCommandSection,children:[a.jsx("div",{className:mt.monitorSectionLabel,children:n("tasks.detail.command")}),a.jsx("pre",{className:mt.monitorCommand,children:i.command})]}),i.error&&a.jsxs("div",{className:mt.monitorError,children:[a.jsx("div",{className:mt.monitorSectionLabel,children:n("tasks.detail.error")}),a.jsx("div",{children:i.error})]})]})}function Att({task:e,actions:t}){const{t:n}=nt(),s=rm(),r=t??s,[i,o]=h.useState(e),[l,c]=h.useState(!1),[u,d]=h.useState(null);h.useEffect(()=>{o(m=>m.id===e.id&&m.status!=="running"&&e.status==="running"?m:e)},[e]),h.useEffect(()=>{d(null)},[e.id,e.status]);const f=h.useCallback(async()=>{if(!(l||i.status!=="running")){d(null),c(!0);try{if(!(await r.cancelTask(i.id,"shell")).cancelled){d(n("tasks.alreadyStopped"));return}o({...i,status:"cancelled",endTime:Date.now()});try{const g=(await r.getTasks()).tasks.find(b=>b.kind==="shell"&&b.id===i.id);g&&g.status!=="running"&&o(g)}catch(p){console.warn("[web-shell] failed to refresh stopped shell task:",p)}}catch(m){console.warn("[web-shell] failed to cancel shell task:",m),d(n("tasks.cancelFailed"))}finally{c(!1)}}},[r,l,i,n]);return a.jsxs("div",{className:mt.monitorDetail,children:[a.jsxs("div",{className:mt.monitorOverview,children:[a.jsxs("div",{className:mt.monitorHeadingRow,children:[a.jsx("div",{className:mt.monitorDescription,children:n("tasks.kind.shell")}),a.jsxs("div",{className:mt.monitorStatusActions,children:[a.jsx(Ni,{variant:"outline",className:mt.monitorStatusTag,"data-status":i.status,children:KP(i.status,n)}),i.status==="running"&&a.jsx("button",{type:"button",className:mt.monitorStopButton,disabled:l,onClick:()=>void f(),children:n(l?"common.loading":"tasks.action.stop")})]})]}),a.jsx("pre",{className:mt.monitorCommand,children:i.command}),u&&a.jsx("div",{className:mt.monitorActionError,children:u}),a.jsxs("div",{className:mt.monitorMetrics,children:[a.jsx(df,{label:n("tasks.detail.runtime"),value:Qy(i.runtimeMs)}),i.pid!==void 0&&a.jsx(df,{label:n("tasks.detail.pid"),value:String(i.pid)}),i.exitCode!==void 0&&a.jsx(df,{label:n("tasks.detail.exitCode"),value:String(i.exitCode)})]})]}),a.jsxs("div",{className:mt.shellFields,children:[a.jsxs("div",{className:mt.monitorCommandSection,children:[a.jsx("div",{className:mt.monitorSectionLabel,children:n("tasks.detail.workingDir")}),a.jsx("div",{className:mt.shellFieldValue,children:i.cwd})]}),i.outputFile&&a.jsxs("div",{className:mt.monitorCommandSection,children:[a.jsx("div",{className:mt.monitorSectionLabel,children:n("tasks.detail.outputFile")}),a.jsx("div",{className:mt.shellFieldValue,children:i.outputFile})]})]}),i.error&&a.jsxs("div",{className:`${mt.monitorError} ${mt.shellError}`,children:[a.jsx("div",{className:mt.monitorSectionLabel,children:n("tasks.detail.error")}),a.jsx("div",{children:i.error})]})]})}function df({label:e,value:t}){return a.jsxs("div",{className:mt.monitorMetric,children:[a.jsx("div",{className:mt.monitorMetricValue,children:t}),a.jsx("div",{className:mt.monitorMetricLabel,children:e})]})}function WG({task:e,t,hideHeader:n=!1,busy:s=!1,showCancelConfirm:r=!1,onCancel:i,onCancelConfirmDismiss:o}){var x,k,_;const l=xtt(e.status),c=lhe(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=[Qy(e.runtimeMs)],g=[{label:t("tasks.detail.runtime"),value:Qy(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:UG(b)})),g.push({label:t("tasks.detail.tokenCount"),value:UG(b)})),e.kind==="agent"&&((_=e.stats)==null?void 0:_.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 w=e.kind==="agent"&&e.prompt?e.prompt.split(`
`):[],y=d&&i?a.jsx("div",{className:mt.actionBar,children:r?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:mt.actionHint,children:t("tasks.action.confirmHint")}),a.jsx("button",{type:"button",className:`${mt.actionButton} ${mt.dangerButton}`,disabled:s,onClick:i,children:m}),a.jsx("button",{type:"button",className:mt.actionButton,onClick:o,children:t("common.cancel")})]}):a.jsx("button",{type:"button",className:`${mt.actionButton} ${mt.dangerButton}`,disabled:s,onClick:i,children:f})}):null,v=n?g.length>0?a.jsx("div",{className:mt.compactSummary,children:g.map(T=>`${T.label} ${T.value}`).join(" · ")}):null:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:mt.title,children:Ttt(e,t)}),a.jsxs("div",{className:mt.statusBadge,children:[l&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:c,children:[l," ",t(`tasks.${e.status}`)]}),a.jsx("span",{className:mt.separator,children:"·"})]}),a.jsx("span",{className:mt.secondary,children:p.join(" · ")})]})]});return a.jsxs("div",{className:mt.detail,children:[(v||y)&&a.jsxs("div",{className:mt.detailTop,children:[v&&a.jsx("div",{className:mt.detailTopMain,children:v}),y]}),e.kind==="shell"&&a.jsxs(a.Fragment,{children:[a.jsx(ob,{label:t("tasks.detail.workingDir"),value:e.cwd}),e.outputFile&&a.jsx(ob,{label:t("tasks.detail.outputFile"),value:e.outputFile})]}),e.kind==="monitor"&&a.jsx(ob,{label:t("tasks.detail.command"),value:e.command}),e.kind==="agent"&&e.subagentType&&a.jsx(ob,{label:t("tasks.detail.type"),value:Z_(e.subagentType,t)}),e.kind==="agent"&&(e.depth??0)>0&&a.jsx(ob,{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&&a.jsxs("div",{className:mt.detailField,children:[a.jsx("div",{className:mt.detailFieldLabel,children:t("tasks.detail.progress")}),a.jsx("div",{className:mt.detailContent,children:e.recentActivities.slice(-5).map((T,S,C)=>{const N=S===C.length-1,E=Ctt(T.name,T.description,t);return a.jsxs("div",{className:N?mt.activityCurrent:mt.activityPast,children:[N?"> ":"  ",E]},`${T.at}-${S}`)})})]}),e.kind==="agent"&&e.prompt&&a.jsxs("div",{className:mt.detailField,children:[a.jsx("div",{className:mt.detailFieldLabel,children:t("tasks.detail.prompt")}),a.jsx("div",{className:mt.promptContent,children:w.slice(0,5).map((T,S,C)=>a.jsx("div",{children:S===C.length-1&&w.length>5?`${T}…`:T||" "},S))})]}),e.kind==="agent"&&e.outputFile&&a.jsx(ob,{label:t("tasks.detail.outputFile"),value:e.outputFile}),e.kind==="agent"&&e.status==="paused"&&e.resumeBlockedReason&&a.jsxs("div",{className:mt.detailField,children:[a.jsx("div",{className:`${mt.detailFieldLabel} ${mt.error}`,children:t("tasks.detail.resumeBlocked")}),a.jsx("div",{className:mt.error,children:e.resumeBlockedReason})]}),e.error&&a.jsxs("div",{className:mt.detailField,children:[a.jsx("div",{className:`${mt.detailFieldLabel} ${e.kind==="monitor"&&e.status!=="failed"?mt.warning:mt.error}`,children:e.kind==="monitor"&&e.status!=="failed"?t("tasks.detail.stoppedBecause"):t("tasks.detail.error")}),a.jsx("div",{className:e.kind==="monitor"&&e.status!=="failed"?mt.warning:mt.error,children:e.error})]})]})}function ob({label:e,value:t}){return a.jsxs("div",{className:mt.detailField,children:[a.jsx("div",{className:mt.detailFieldLabel,children:e}),a.jsx("div",{className:mt.detailContent,children:t})]})}const jtt="_message_fm8gc_1",Ntt="_body_fm8gc_15",Itt="_title_fm8gc_20",Mtt="_muted_fm8gc_24",Rtt="_accent_fm8gc_28",Dtt="_success_fm8gc_32",Ltt="_error_fm8gc_36",Ptt="_warning_fm8gc_40",Ott="_row_fm8gc_44",$tt="_label_fm8gc_50",Btt="_value_fm8gc_55",ac={message:jtt,body:Ntt,title:Itt,muted:Mtt,accent:Rtt,success:Dtt,error:Ltt,warning:Ptt,row:Ott,label:$tt,value:Btt},dR="web-shell-goal-status-active",{serialize:VG,parse:ztt}=Y6(Pve),Ftt=new Set(["set","achieved","cleared","failed","aborted","checking"]);function L3(e){const t=typeof e=="string"?ztt(e):e;return qtt(t)}function qtt(e){if(!e||typeof e!="object")return null;const t=e,n=t.kind,s=t.condition;if(typeof n!="string"||!Ftt.has(n)||typeof s!="string")return null;const r=zj(t.iterations),i=zj(t.durationMs),o=zj(t.setAt),l=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}:{},...l!==void 0?{lastReason:l}:{}}}function zj(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function Htt(e,t){return t(e===1?"goal.turn":"goal.turns",{count:e})}function Utt(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:ac.muted};case"set":return{title:t("goal.set"),colorClass:ac.accent};case"achieved":return{title:t("goal.achieved"),colorClass:ac.success};case"cleared":return{title:t("goal.cleared"),colorClass:ac.muted};case"failed":return{title:t("goal.failed"),colorClass:ac.error};case"aborted":return{title:t("goal.aborted"),colorClass:ac.warning}}}function Wtt({status:e,activateFooter:t=!1}){var u;const{t:n}=nt(),s=bD();h.useEffect(()=>{if(!t||s==="readonly")return;const d=e.kind==="set"||e.kind==="checking";window.dispatchEvent(new CustomEvent(dR,{detail:{active:d,condition:e.condition,setAt:e.setAt}}))},[t,s,e.condition,e.kind,e.setAt]);const r=Utt(e,n),i=[];e.kind!=="checking"&&(e.iterations&&e.iterations>0&&i.push(Htt(e.iterations,n)),typeof e.durationMs=="number"&&i.push(Qy(e.durationMs)));const o=i.length>0?` · ${i.join(" · ")}`:"",l=(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 a.jsx("div",{className:ac.message,children:a.jsxs("div",{className:ac.body,children:[a.jsxs("div",{className:`${ac.title} ${r.colorClass}`,children:[r.title,o&&a.jsx("span",{className:ac.muted,children:o})]}),a.jsxs("div",{className:ac.row,children:[a.jsxs("span",{className:ac.label,children:[n("goal.label"),":"]}),a.jsx("span",{className:ac.value,children:e.condition})]}),l&&a.jsxs("div",{className:ac.muted,children:[c,": ",l]})]})})}const Vtt="_message_14xa5_1",Gtt="_flushMessage_14xa5_12",Ktt="_noMarker_14xa5_26",Ytt="_content_14xa5_30",Xtt="_notificationContent_14xa5_34",Qtt="_notificationIcon_14xa5_40",Jtt="_notificationText_14xa5_61",Ztt="_info_14xa5_80",ent="_recap_14xa5_85",tnt="_modelSwitch_14xa5_98",nnt="_error_14xa5_102",snt="_warning_14xa5_108",rnt="_retryHint_14xa5_114",int="_retryButton_14xa5_121",ont="_cancelled_14xa5_139",Ta={message:Vtt,flushMessage:Gtt,noMarker:Ktt,content:Ytt,notificationContent:Xtt,notificationIcon:Qtt,notificationText:Jtt,info:Ztt,recap:ent,modelSwitch:tnt,error:nnt,warning:snt,retryHint:rnt,retryButton:int,cancelled:ont},ant=h.memo(function({content:t,variant:n,source:s,data:r,onShowContextDetail:i,isLatest:o=!1,showRetryHint:l=!1,onRetryClick:c}){const{t:u}=nt();if(s==="prompt_cancelled")return a.jsx("div",{className:Ta.cancelled,role:"status",children:a.jsx("span",{children:u("turn.stopped")})});const d=n==="info"?gQe(t):null;if(d)return a.jsx("div",{className:Ta.flushMessage,children:a.jsx(_Qe,{status:d,onShowDetail:i})});const f=n==="info"?rJe(t):null;if(f)return a.jsx("div",{className:Ta.flushMessage,children:a.jsx(hJe,{view:f.view,status:f.status})});const m=n==="info"?xJe(t):null;if(m)return a.jsx("div",{className:Ta.flushMessage,children:a.jsx(kJe,{info:m})});const p=n==="info"?iZe(t):null;if(p)return a.jsx("div",{className:Ta.flushMessage,children:a.jsx(hZe,{message:p})});const g=n==="info"?vtt(t):null;if(g)return a.jsx("div",{className:Ta.flushMessage,children:a.jsx(che,{message:g})});const b=n==="info"?L3(s==="goal"?r:t):null;if(b)return a.jsx("div",{className:Ta.flushMessage,children:a.jsx(Wtt,{status:b,activateFooter:o})});const w=n==="info"&&s==="model_switch_summary",y=n==="info"&&s==="recap",v=n==="info"&&s==="background_notification",x=v&&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"),_=x==="completed"?"success":x==="failed"?"error":"neutral",T=x==="completed"?g5:x==="failed"?See:x==="cancelled"?Gxe:b5,S=w?a.jsx("pre",{children:t}):n==="info"?a.jsx(Jf,{content:t}):a.jsx("pre",{children:t});return a.jsx("div",{className:`${Ta.message} ${Ta[n]} ${w?Ta.modelSwitch:""} ${y?Ta.recap:""} ${v?Ta.noMarker:""}`,children:a.jsxs("div",{className:Ta.content,children:[v?a.jsxs("div",{className:Ta.notificationContent,children:[a.jsx("span",{className:Ta.notificationIcon,"data-tone":_,role:"img","aria-label":k,title:k,children:a.jsx(T,{"aria-hidden":"true"})}),a.jsx("div",{className:Ta.notificationText,children:S})]}):S,l&&c&&a.jsx("div",{className:Ta.retryHint,children:a.jsx("button",{type:"button",className:Ta.retryButton,onClick:c,children:u("retry.hint")})})]})})}),lnt="_group_117nk_1",cnt="_chatSummaryGroup_117nk_14",unt="_line_117nk_22",dnt="_chatSummary_117nk_14",hnt="_chatSummaryTextActive_117nk_49",fnt="_chatSummaryIcon_117nk_55",mnt="_chatSummaryToolIcon_117nk_69",pnt="_chatSummaryText_117nk_49",gnt="_chatSummaryInline_117nk_85",bnt="_chatChevronRight_117nk_122",ynt="_chatChevronDown_117nk_123",vnt="_chatSummaryContentClip_117nk_184",wnt="_chatSummaryContentCollapsed_117nk_192",xnt="_chatSummaryContentInner_117nk_196",knt="_lineMain_117nk_201",_nt="_icon_117nk_211",Snt="_iconError_117nk_216",Cnt="_lineName_117nk_221",Tnt="_lineArg_117nk_225",Ent="_lineElapsed_117nk_233",Ant="_lineExpandable_117nk_239",jnt="_lineButton_117nk_246",Nnt="_lineChevronRight_117nk_267",Int="_lineChevronDown_117nk_268",Mnt="_lineOutput_117nk_305",Rnt="_expandedCard_117nk_314",Dnt="_expandedCardHeader_117nk_324",Lnt="_expandedCardTitle_117nk_333",Pnt="_expandedCardDetail_117nk_340",Ont="_expandedCardBody_117nk_350",$nt="_expandedAgentCard_117nk_355",Bnt="_expandedLineOutput_117nk_365",znt="_lineDetail_117nk_369",Fnt="_markdownLineDetail_117nk_375",qnt="_expandedBash_117nk_383",Hnt="_expandedRead_117nk_384",Unt="_expandedOutput_117nk_388",Wnt="_expandedEdit_117nk_402",Vnt="_todoProgress_117nk_416",Gnt="_todoBody_117nk_423",Knt="_compactGroup_117nk_431",Ynt="_compactHeader_117nk_438",Xnt="_compactCount_117nk_448",Qnt="_compactHint_117nk_454",un={group:lnt,chatSummaryGroup:cnt,line:unt,chatSummary:dnt,chatSummaryTextActive:hnt,chatSummaryIcon:fnt,chatSummaryToolIcon:mnt,chatSummaryText:pnt,chatSummaryInline:gnt,chatChevronRight:bnt,chatChevronDown:ynt,chatSummaryContentClip:vnt,chatSummaryContentCollapsed:wnt,chatSummaryContentInner:xnt,lineMain:knt,icon:_nt,iconError:Snt,lineName:Cnt,lineArg:Tnt,lineElapsed:Ent,lineExpandable:Ant,lineButton:jnt,lineChevronRight:Nnt,lineChevronDown:Int,lineOutput:Mnt,expandedCard:Rnt,expandedCardHeader:Dnt,expandedCardTitle:Lnt,expandedCardDetail:Pnt,expandedCardBody:Ont,expandedAgentCard:$nt,expandedLineOutput:Bnt,lineDetail:znt,markdownLineDetail:Fnt,expandedBash:qnt,expandedRead:Hnt,expandedOutput:Unt,expandedEdit:Wnt,todoProgress:Vnt,todoBody:Gnt,compactGroup:Knt,compactHeader:Ynt,compactCount:Xnt,compactHint:Qnt};function Of({status:e}){const{t}=nt();switch(e){case"completed":case"success":return null;case"failed":case"error":case"cancelled":case"canceled":return a.jsx("span",{className:`${un.icon} ${un.iconError}`,children:t("tool.status.failed")});case"in_progress":case"running":return null;default:return null}}function eS(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 uhe(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 dhe(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 Jnt="_panel_rcjxd_1",Znt="_header_rcjxd_11",est="_desc_rcjxd_23",tst="_toggle_rcjxd_32",nst="_meta_rcjxd_38",sst="_body_rcjxd_44",rst="_content_rcjxd_55",ist="_stream_rcjxd_70",ost="_streamCollapsed_rcjxd_80",ast="_scrollWindow_rcjxd_88",lst="_expandToggle_rcjxd_93",cst="_sectionCap_rcjxd_110",ust="_tools_rcjxd_128",dst="_step_rcjxd_142",hst="_toolTimeRow_rcjxd_188",fst="_toolTimeTip_rcjxd_192",to={panel:Jnt,header:Znt,desc:est,toggle:tst,meta:nst,body:sst,content:rst,stream:ist,streamCollapsed:ost,scrollWindow:ast,expandToggle:lst,sectionCap:cst,tools:ust,step:dst,toolTimeRow:hst,toolTimeTip:fst};function hhe(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function mst({timestamp:e,children:t}){return e===void 0?a.jsx(a.Fragment,{children:t}):a.jsxs("div",{className:to.toolTimeRow,children:[t,a.jsx("span",{className:to.toolTimeTip,"aria-hidden":"true",children:Iy(e)})]})}const pst=h.memo(function({tool:t}){const n=t.subTools||t.subContent?a.jsx(YP,{tool:t}):a.jsx(bR,{tool:t,forceExpandable:!0,hideCollapsedOutput:!0});return a.jsx(mst,{timestamp:t.startTime,children:n})});function gst({tc:e}){const{t}=nt();return a.jsx("div",{className:un.line,children:a.jsxs("div",{className:un.lineMain,children:[a.jsx(Of,{status:e.status}),a.jsx("span",{className:un.lineName,children:wd(e.name,t)})]})})}function bst(e){var t;if(e.rawOutput&&hhe(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 yst({text:e}){const{compactThinking:t}=Vu(),{t:n}=nt(),[s,r]=h.useState(!1),[i,o]=h.useState(!1),l=h.useRef(null),c=t&&!s;return h.useEffect(()=>{const u=l.current;!u||!c||(o(u.scrollHeight>u.clientHeight),u.scrollTop=u.scrollHeight)},[c,e]),h.useEffect(()=>{const u=l.current;if(!u||!c)return;const d=()=>o(u.scrollHeight>u.clientHeight),f=new ResizeObserver(d);return f.observe(u),()=>f.disconnect()},[c]),a.jsxs("div",{children:[a.jsx("pre",{ref:l,className:c?`${to.stream} ${to.streamCollapsed}`:to.stream,children:e}),t&&(i||s)&&a.jsx("button",{className:to.expandToggle,onClick:()=>r(u=>!u),"aria-expanded":s,"aria-label":n("subagent.toggleStream"),children:s?"▲":"▼"})]})}function vst({content:e}){const{compactThinking:t}=Vu();return a.jsx("div",{className:t?to.scrollWindow:void 0,children:a.jsx(Jf,{content:e,source:"assistant"})})}function GG({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]),a.jsx("div",{ref:s,className:`${to.tools} ${to.scrollWindow}`,children:n})}function YP({tool:e,defaultExpanded:t,hideHeader:n,inline:s}){var _,T,S,C;const{t:r}=nt(),i=e.status==="completed"||e.status==="failed",o=Xy(e),[l,c]=h.useState(t??!1),u=hhe(e.rawOutput)?e.rawOutput:null,d=((_=e.subTools)==null?void 0:_.length)||((T=u==null?void 0:u.toolCalls)==null?void 0:T.length)||0,f=K6(e),m=VP(e),p=eS(e.startTime,e.endTime)||uhe((S=u==null?void 0:u.executionSummary)==null?void 0:S.totalDurationMs),g=u!=null&&u.tokenCount&&u.tokenCount>0?u.tokenCount:(C=u==null?void 0:u.executionSummary)==null?void 0:C.outputTokens,b=g?WP(g):"",w=i?bst(e):"",y=h.useMemo(()=>e.subTools&&e.subTools.length>0?null:(u==null?void 0:u.toolCalls)||null,[e.subTools,u]),v=!!(e.subContent||w),x=!!(e.subTools&&e.subTools.length>0||y&&y.length>0),k=i&&v&&x;return a.jsxs("div",{className:s?void 0:to.panel,children:[!n&&a.jsxs("div",{className:to.header,onClick:()=>c(!l),children:[a.jsx(Of,{status:o}),a.jsxs("span",{className:un.lineName,children:[Z_(m,r),":"]}),f&&a.jsx("span",{className:to.desc,children:Yo(f,50)}),i&&d>0&&a.jsxs("span",{className:to.meta,children:["· ",r("subagent.toolsCount",{count:d})]}),p&&a.jsxs("span",{className:to.meta,children:["· ",p]}),b&&a.jsxs("span",{className:to.meta,children:["· ",b]}),!i&&a.jsx("span",{className:to.toggle,children:l?"▼":"▶"})]}),(l||n)&&a.jsxs("div",{className:to.body,children:[i&&v&&a.jsxs("div",{className:to.content,children:[k&&a.jsx("div",{className:to.sectionCap,children:r("subagent.result")}),a.jsx(vst,{content:e.subContent||w})]}),k&&a.jsx("div",{className:to.sectionCap,children:r("subagent.tools",{count:d})}),e.subTools&&e.subTools.length>0&&a.jsx(GG,{pinTail:!i,itemCount:e.subTools.length,children:e.subTools.map(N=>a.jsx("div",{className:to.step,"data-status":N.status,children:a.jsx(pst,{tool:N})},N.callId))}),y&&y.length>0&&a.jsx(GG,{pinTail:!i,itemCount:y.length,children:y.map(N=>a.jsx("div",{className:to.step,"data-status":N.status,children:a.jsx(gst,{tc:N})},N.callId))}),!i&&e.subContent&&a.jsx("div",{className:to.content,children:a.jsx(yst,{text:e.subContent})})]})]})}const wst="_view_1ycry_1",xst="_stats_1ycry_7",kst="_statAdd_1ycry_16",_st="_statDel_1ycry_20",Sst="_lines_1ycry_24",Cst="_line_1ycry_24",Tst="_lineAdd_1ycry_36",Est="_lineDel_1ycry_40",Ast="_lineHeader_1ycry_44",jst="_lineContext_1ycry_50",Nst="_lineNo_1ycry_54",Ist="_marker_1ycry_64",Mst="_content_1ycry_79",Wd={view:wst,stats:xst,statAdd:kst,statDel:_st,lines:Sst,line:Cst,lineAdd:Tst,lineDel:Est,lineHeader:Ast,lineContext:jst,lineNo:Nst,marker:Ist,content:Mst};function Rst(e){let t=0,n=0;const s=[];let r=0,i=0;for(const o of e.split(`
`))if(o.startsWith("@@")){const l=o.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);l&&(r=parseInt(l[1],10),i=parseInt(l[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 Dst=h.memo(function({diff:t}){if(!t)return null;const{lines:n,additions:s,deletions:r}=Rst(t);return a.jsxs("div",{className:Wd.view,children:[a.jsxs("div",{className:Wd.stats,children:[s>0&&a.jsxs("span",{className:Wd.statAdd,children:["+",s]}),r>0&&a.jsxs("span",{className:Wd.statDel,children:["-",r]})]}),a.jsx("div",{className:Wd.lines,children:n.map((i,o)=>a.jsxs("div",{className:`${Wd.line} ${Wd[`line${i.type[0].toUpperCase()}${i.type.slice(1)}`]}`,children:[a.jsx("span",{className:Wd.lineNo,children:i.type==="header"?"":i.oldLine??i.newLine}),a.jsx("span",{className:Wd.marker,children:i.type==="add"?"+":i.type==="del"?"-":i.type==="header"?"":" "}),a.jsx("span",{className:Wd.content,children:i.content})]},o))})]})}),P3={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"},Fj=[0,95,135,175,215,255];function hR(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 Lst(e){if(e===void 0||!Number.isInteger(e)||e<0||e>255)return;if(e<8)return P3[30+e];if(e<16)return P3[90+(e-8)];if(e<232){const n=e-16;return hR(Fj[Math.floor(n/36)],Fj[Math.floor(n/6)%6],Fj[n%6])}const t=8+(e-232)*10;return hR(t,t,t)}function Pst(e){const t=[];let n,s=!1,r=!1,i=0;const o=new RegExp(String.raw`\x1b\[([0-9;]*)m`,"g");let l;for(;(l=o.exec(e))!==null;){l.index>i&&t.push({text:e.slice(i,l.index),color:n,bold:s,dim:r}),i=l.index+l[0].length;const c=l[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=Lst(c[u+2]),u+=2;else if(f===2)m=hR(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=P3[d]:d===39&&(n=void 0)}}return i<e.length&&t.push({text:e.slice(i),color:n,bold:s,dim:r}),t}function Ost(e){return new RegExp(String.raw`\x1b\[`).test(e)}function fm(e){const t=e.toLowerCase();return t==="todo_write"||t==="todowrite"}function qj(e){return e.flatMap((n,s)=>{const r=$f(n),i=yg(r,"content");if(!i)return[];const o=$f(r==null?void 0:r._meta),l=$f(o==null?void 0:o.qwenTodo),c=Qst(l,"blockedBy");return[{id:yg(l,"id")??yg(r,"id")??`plan-${s}`,content:i,status:Yst(yg(r,"status")),priority:Xst(yg(r,"priority")),...c?{blockedBy:c}:{}}]})}function Jy(e){const t=fm(e.toolName);if(!t&&e.kind!=="other")return;const n=$f(e.rawOutput),s=yg($f(n==null?void 0:n.plan),"id")!==void 0,r=YG(e.args);if(r){const c=qj(r);return c.length>0||t?c:void 0}const i=YG(n);if(i){const c=qj(i);return c.length>0||t||s?c:void 0}const o=Array.isArray(n==null?void 0:n.entries)?n.entries:void 0;if(!o)return;const l=qj(o);return l.length>0||t||s?l:void 0}function O3(e){return e.some(t=>t.status==="pending"||t.status==="in_progress")}function $3(e){switch(e){case"completed":return"●";case"in_progress":return"◐";case"pending":return"○"}}const KG={todos:[],planId:null,allCompleted:!1,sourceMessageId:null};function $st(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=null,s=o.id,r=!1;continue}if(o.role==="tool_group")for(const l of o.tools){const c=Jy(l);c&&(t=c,n=fR(l),s=o.id,r=!1)}}if(t.length===0)return KG;const i=!O3(t);return r?KG:{todos:t,planId:n,allCompleted:i,sourceMessageId:s}}function fhe(e){let t=[];for(const n of e){if(n.role==="plan"){t=n.todos;continue}if(n.role==="tool_group")for(const s of n.tools){const r=Jy(s);r!==void 0&&(t=r)}}return O3(t)?t:[]}function Bst(e,t){if(t.sourceMessageId===null)return[];const n=[],s=e.findIndex(i=>t.planId===null?i.id===t.sourceMessageId:i.role!=="tool_group"?!1:i.tools.some(o=>Jy(o)!==void 0&&fR(o)===t.planId));if(s<0)return[];let r=!1;for(let i=s;i<e.length;i++){const o=e[i];if(i>s&&r&&(o.role==="user"||o.role==="user_shell"))return n;if(o.role==="plan"){if(i>s)break;r=!O3(o.todos);continue}if(o.role==="tool_group")for(const l of o.tools){const c=Jy(l);if(c!==void 0){if(i>s&&(t.planId===null||fR(l)!==t.planId))return n;r=!O3(c);continue}if(!l.parentToolCallId&&l0(l)){if(r)return n;n.push(l)}}}return n}function XP(e){return JSON.stringify([e.id,e.content])}function X6(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=Jy(n);s&&t.push({key:n.callId,todos:s,stats:Hst(n)})}return t}return[]}function zst(e){const t=new Map,n=new Map;for(const s of e)for(const{key:r,todos:i}of X6(s)){const o=[];for(const l of i){const c=XP(l),u=n.get(c);l.status==="in_progress"&&u!=="in_progress"?o.push({kind:"started",id:l.id,content:l.content}):l.status==="completed"&&u!=="completed"&&u!==void 0&&o.push({kind:"completed",id:l.id,content:l.content}),n.set(c,l.status)}t.set(r,{events:o})}return t}function Fst(e){const t=[];for(const n of e)for(const{key:s,todos:r}of X6(n))t.push(JSON.stringify([s,r.map(i=>[i.id,i.status,i.content])]));return t.join(`
`)}function qst(e){const t=[];for(const n of e){if(n.role==="tool_group")for(const s of n.tools)!fm(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 X6(n))t.push(JSON.stringify([s,n.timestamp,r.map(o=>[o.id,o.status,o.content]),i]))}return t.join(`
`)}function Hst(e){var o;const t=$f((o=$f(e.rawOutput))==null?void 0:o.stats);if(!t)return;const n=l=>{const c=t[l];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 Ust(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const s of n.tools){if(fm(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 Wst(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 Vst(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 Gst(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 Kst(e){var l;const t=new Map,n=new Map,s=new Map,r=new Set,i=Ust(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 X6(c))for(const m of d){const p=XP(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),w=b&&f?Vst(b,f):void 0,y=(l=t.get(p))==null?void 0:l.startTs,v=y!==void 0&&u!==void 0?Wst(i,y,u):void 0,x=Gst(w,v);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 YG(e){const t=e==null?void 0:e.todos;return Array.isArray(t)?t:void 0}function Yst(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function Xst(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function $f(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function yg(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function Qst(e,t){const n=e==null?void 0:e[t];return Array.isArray(n)&&n.every(s=>typeof s=="string")?n:void 0}function fR(e){const t=$f(e.rawOutput),n=$f(t==null?void 0:t.plan);return yg(n,"id")??null}const M4=new Set;let Vw=null,mhe=Date.now();function Jst(){mhe=Date.now();for(const e of M4)e()}function Zst(e){return M4.add(e),Vw||(Vw=setInterval(Jst,1e3)),()=>{M4.delete(e),M4.size===0&&Vw&&(clearInterval(Vw),Vw=null)}}function QP(e){const[t,n]=h.useState(()=>Date.now());return h.useEffect(()=>{if(e)return n(Date.now()),Zst(()=>n(mhe))},[e]),t}const phe=h.createContext(void 0);function ghe({onOpen:e,children:t}){return a.jsx(phe.Provider,{value:{onOpen:e},children:t})}function JP(){return h.useContext(phe)}const bhe=h.createContext(void 0);function yhe({onOpen:e,children:t}){return a.jsx(bhe.Provider,{value:{onOpen:e},children:t})}function vhe(){return h.useContext(bhe)}const ert="_list_1bo8s_1",trt="_summary_1bo8s_2",nrt="_row_1bo8s_8",srt="_num_1bo8s_16",rrt="_icon_1bo8s_23",irt="_text_1bo8s_29",ort="_inProgress_1bo8s_43",art="_completed_1bo8s_48",lrt="_item_1bo8s_62",crt="_rowButton_1bo8s_69",urt="_detailChevron_1bo8s_82",drt="_detail_1bo8s_82",hrt="_detailSection_1bo8s_100",frt="_detailSectionTitle_1bo8s_106",mrt="_detailRows_1bo8s_114",prt="_detailLabel_1bo8s_122",grt="_detailValue_1bo8s_126",brt="_detailDuration_1bo8s_132",yrt="_detailHint_1bo8s_136",_r={list:ert,summary:trt,row:nrt,num:srt,icon:rrt,text:irt,inProgress:ort,completed:art,item:lrt,rowButton:crt,detailChevron:urt,detail:drt,detailSection:hrt,detailSectionTitle:frt,detailRows:mrt,detailLabel:prt,detailValue:grt,detailDuration:brt,detailHint:yrt};function mR(e){switch(e){case"completed":return _r.completed;case"in_progress":return _r.inProgress;case"pending":return""}}function whe({todos:e,events:t}){const{t:n}=nt();if(t.length===0){if(e.length>0&&e.every(i=>i.status==="completed"))return a.jsx("div",{className:_r.summary,children:a.jsxs("div",{className:`${_r.row} ${_r.completed}`,children:[a.jsx("span",{className:_r.icon,"aria-hidden":"true",children:"✓"}),a.jsx("span",{className:_r.text,children:n("todo.allDone")})]})});const r=e.find(i=>i.status==="in_progress")??e.find(i=>i.status==="pending");return r?a.jsx("div",{className:_r.summary,children:a.jsxs("div",{className:`${_r.row} ${mR(r.status)}`,children:[a.jsx("span",{className:_r.icon,"aria-hidden":"true",children:$3(r.status)}),a.jsx("span",{className:_r.text,children:r.content})]})}):null}return a.jsx("div",{className:_r.summary,children:t.map(s=>a.jsxs("div",{className:`${_r.row} ${s.kind==="completed"?_r.completed:_r.inProgress}`,children:[a.jsx("span",{className:_r.icon,"aria-hidden":"true",children:$3(s.kind==="completed"?"completed":"in_progress")}),a.jsx("span",{className:_r.text,children:s.content})]},`${s.kind}-${s.id}`))})}function Z0({label:e,value:t,suffix:n}){return a.jsxs(a.Fragment,{children:[a.jsx("span",{className:_r.detailLabel,children:e}),a.jsxs("span",{className:_r.detailValue,children:[t,n]})]})}function Hj({title:e,children:t}){return a.jsxs("div",{className:_r.detailSection,children:[a.jsx("div",{className:_r.detailSectionTitle,children:e}),a.jsx("div",{className:_r.detailRows,children:t})]})}function vrt({detail:e}){const{t}=nt(),{startTs:n,endTs:s,resources:r}=e,i=n!==void 0||s!==void 0,o=(r==null?void 0:r.inputTokens)!==void 0,l=(r==null?void 0:r.apiTimeMs)!==void 0||(r==null?void 0:r.toolTimeMs)!==void 0;return a.jsxs("div",{className:_r.detail,children:[i&&a.jsxs(Hj,{title:t("todo.detail.sectionTime"),children:[n!==void 0&&a.jsx(Z0,{label:t("todo.detail.start"),value:Iy(n)}),s!==void 0&&a.jsx(Z0,{label:t("todo.detail.end"),value:Iy(s),suffix:n!==void 0?a.jsxs("span",{className:_r.detailDuration,children:[" ","(",Cp(s-n),")"]}):void 0})]}),o&&a.jsxs(Hj,{title:t("todo.detail.sectionTokens"),children:[a.jsx(Z0,{label:t("todo.detail.input"),value:((r==null?void 0:r.inputTokens)??0).toLocaleString()}),a.jsx(Z0,{label:t("todo.detail.output"),value:((r==null?void 0:r.outputTokens)??0).toLocaleString()}),a.jsx(Z0,{label:t("todo.detail.cached"),value:((r==null?void 0:r.cachedTokens)??0).toLocaleString()})]}),l&&a.jsxs(Hj,{title:t("todo.detail.sectionSpent"),children:[(r==null?void 0:r.apiTimeMs)!==void 0&&a.jsx(Z0,{label:t("todo.detail.api"),value:Cp(r.apiTimeMs)}),(r==null?void 0:r.toolTimeMs)!==void 0&&a.jsx(Z0,{label:t("todo.detail.tool"),value:Cp(r.toolTimeMs)})]}),!r&&a.jsx("div",{className:_r.detailHint,children:t("todo.detail.noResources")})]})}function wrt(e){return!!e&&(e.endTs!==void 0||e.resources!==void 0)}function xhe({todos:e,numbered:t=!1}){const{t:n}=nt(),s=h.useContext(Ume),[r,i]=h.useState(()=>new Set),o=`${String(e.length).length+1}ch`,l=c=>i(u=>{const d=new Set(u);return d.has(c)?d.delete(c):d.add(c),d});return a.jsx("div",{className:_r.list,children:e.map((c,u)=>{const d=c.id||String(u),f=s.get(XP(c)),m=wrt(f),p=m&&r.has(d),g=a.jsxs(a.Fragment,{children:[t&&a.jsxs("span",{className:_r.num,style:{minWidth:o},children:[u+1,"."]}),a.jsx("span",{className:_r.icon,"aria-hidden":"true",children:$3(c.status)}),a.jsx("span",{className:_r.text,children:c.content}),m&&a.jsx("span",{className:_r.detailChevron,"aria-hidden":"true",children:p?"▾":"▸"})]});return a.jsxs("div",{className:_r.item,children:[m?a.jsx("button",{type:"button",className:`${_r.row} ${_r.rowButton} ${mR(c.status)}`,onClick:b=>{b.stopPropagation(),l(d)},"aria-expanded":p,title:n(p?"todo.detail.hide":"todo.detail.show"),children:g}):a.jsx("div",{className:`${_r.row} ${mR(c.status)}`,children:g}),p&&f&&a.jsx(vrt,{detail:f})]},d)})})}function khe(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 xrt(e){const t=e.toolName.toLowerCase();if(jd(e.toolName))return!!xh(e);if(t==="write_file"||t==="writefile")return!!Ort(e)||XG(e);if(e.status!=="completed"&&e.status!=="failed")return!1;if(Hc(t)){const n=xh(e);return!!n&&n.trim().length>0&&n.split(`
`).length>1}if(G6(t))return!!Che(e);if(t==="edit"||t==="write"||t==="editfile")return XG(e);if(t==="read"||t==="read_file"||t==="readfile"){const n=xh(e);return!!n&&n.split(`
`).length>3}return!1}function krt(e){const t=e.toolName.toLowerCase();return Hc(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||G6(t)||jd(e.toolName)}function _rt(e){var t;return(t=e.content)!=null&&t.some(n=>n.type==="diff")?!0:!!_he(e)}function XG(e){return _rt(e)||!!xh(e)}function Srt(e){const t=_he(e);if(t)return t;if(e.content){const n=e.content.find(s=>s.type==="diff");if(n&&n.type==="diff")return Ert(n.oldText||"",n.newText||"")}return""}function _he(e){if(e.rawOutput&&typeof e.rawOutput=="object"){const t=e.rawOutput;if(Crt(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function Crt(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}const Trt=25e4;function Ert(e,t){const n=e.split(`
`),s=t.split(`
`),r=n.length,i=s.length;if(r*i>Trt){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 l=[];let c=r,u=i;for(;c>0||u>0;)c>0&&u>0&&n[c-1]===s[u-1]?(l.push(` ${n[c-1]}`),c--,u--):u>0&&(c===0||o[c][u-1]>=o[c-1][u])?(l.push(`+${s[u-1]}`),u--):(l.push(`-${n[c-1]}`),c--);return l.reverse().join(`
`)}const Art=60,jrt=2e5,Nrt=1e3,Irt={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 Mrt({tool:e}){const t=h.useMemo(()=>xh(e)||"",[e]),n=h.useMemo(()=>Ost(t)?Pst(t):null,[t]);return a.jsx("div",{className:un.expandedBash,children:a.jsx("pre",{className:un.expandedOutput,children:n?n.map((s,r)=>a.jsx("span",{style:{color:s.color,fontWeight:s.bold?"bold":void 0,opacity:s.dim?.6:void 0},children:s.text},r)):t})})}function Rrt({tool:e}){const t=h.useMemo(()=>xh(e)||"",[e]),n=She(Drt(e)),s=n==="text"||t.length>jrt||Lrt(t,Nrt);return a.jsx("div",{className:un.expandedRead,children:s?a.jsx("pre",{className:un.expandedOutput,children:t}):a.jsx(Jf,{content:Prt(n,t)})})}function Drt(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 Lrt(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 She(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=Irt[t]??t;return/^[\w+.#-]+$/.test(n)?n:"text"}function Prt(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 QG({tool:e}){const t=h.useMemo(()=>Srt(e),[e]),n=h.useMemo(()=>xh(e)||"",[e]);return!t&&!n?null:a.jsx("div",{className:un.expandedEdit,children:t?a.jsx(Dst,{diff:t}):a.jsx("pre",{className:un.expandedOutput,children:n})})}function pR({title:e,detail:t,children:n}){return a.jsxs("div",{className:un.expandedCard,children:[a.jsxs("div",{className:un.expandedCardHeader,children:[a.jsx("span",{className:un.expandedCardTitle,children:e}),t&&a.jsx("span",{className:un.expandedCardDetail,children:t})]}),n&&a.jsx("div",{className:un.expandedCardBody,children:n})]})}function Ort(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=xh(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 $rt({tool:e,todos:t,expanded:n,title:s}){var o;const i=((o=h.useContext(jO).get(e.callId))==null?void 0:o.events)??[];return n?a.jsx(pR,{title:s,children:a.jsx("div",{className:un.todoBody,children:a.jsx(xhe,{todos:t})})}):a.jsx("div",{className:un.todoBody,children:a.jsx(whe,{todos:t,events:i})})}function Brt(e,t){var p,g;const n=J_(e.rawOutput),s=UP(e),r=Xy(e),i=VP(e),o=zrt(e),l=K6(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"?uhe(u.totalDurationMs):eS(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?WP(f):"";return{agentType:i,explicitAgentType:o,description:l,subToolCount:c,elapsed:d,tokens:m,status:r,reason:s}}function zrt(e){var r;const t=J_(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 JG(e){if(e.status==="completed")return!1;const t=e.toolName.toLowerCase();return!!(jd(e.toolName)||t==="write_file"||t==="writefile"||t==="edit"||t==="editfile"||Hc(t))}function Frt({tool:e}){const t=xh(e)||"";return a.jsx("pre",{className:un.expandedOutput,children:t})}function qrt({tool:e}){var n;const t=Che(e)||(typeof((n=e.args)==null?void 0:n.args)=="string"&&e.args.args.trim()?e.args.args.trim():e.title??"");return a.jsx("pre",{className:un.expandedOutput,children:t})}function Che(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 Q6(e){const t=e.toolName.toLowerCase();return l0(e)?"agent":jd(e.toolName)?"ask":Hc(t)?"shell":eO(t)?"fetch":fm(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 Hrt({description:e,elapsed:t}){return a.jsxs(a.Fragment,{children:[e&&a.jsx("span",{className:un.lineArg,children:e}),t&&a.jsx("span",{className:un.lineElapsed,children:t})]})}function ok({info:e}){const{renderToolHeaderExtra:t}=Vu(),n=t==null?void 0:t(e);return n?a.jsx(a.Fragment,{children:n}):a.jsx(Hrt,{description:e.description,elapsed:e.elapsed})}function Urt(e){return e.length>Art||e.includes(`
`)}function x1(e){return e==="in_progress"||e==="pending"||e==="running"}function ZP(e){return e.find(t=>x1(t.status))??e[e.length-1]}function Wrt(e,t,n){if(Ahe(e)){const r=e.find(o=>x1(o.status)&&!yd(o)),i=r??ZP(e);return jd(i.toolName)?t("toolGroup.summary.provideInformation"):!r&&yd(i)?t("subagent.background"):t("toolGroup.running",{name:wd(i.toolName,t),count:e.length,duration:n??""})}const s=Krt(e,t);return s||t("toolGroup.summary",{count:e.length})}function Vrt(e,t,n){if(fm(e.toolName))return t("toolGroup.summary.updatedTodos",{count:1});if(jd(e.toolName))return x1(e.status)?t("toolGroup.summary.provideInformation"):t("toolGroup.summary.askedQuestions",{count:Ehe(e)});const{displayName:s,description:r,hideDisplayName:i}=The(e,t,n);return[i?"":s,r].filter(Boolean).join(" ")}function The(e,t,n){const s=wd(e.toolName,t),r=Yo(Qde(e,n),120);return{kind:Q6(e),tool:e,displayName:s,description:r,elapsed:"",workspaceCwd:n,hideDisplayName:!!TQe(e)}}function Grt({tool:e,runningDuration:t,workspaceCwd:n}){const{t:s}=nt(),r=jd(e.toolName),i=x1(e.status),o=!r&&i?yd(e)?s("subagent.background"):s("toolGroup.runningPrefix").trim():"";if(fm(e.toolName)||r)return a.jsxs(a.Fragment,{children:[o&&a.jsxs("span",{children:[o," "]}),Vrt(e,s,n),t&&a.jsxs("span",{children:[" ",t]})]});const l=The(e,s,n);return a.jsxs(a.Fragment,{children:[o&&a.jsxs("span",{children:[o," "]}),a.jsxs("span",{className:un.chatSummaryInline,children:[!l.hideDisplayName&&a.jsx("span",{className:un.lineName,children:l.displayName}),a.jsx(ok,{info:l})]}),t&&a.jsxs("span",{children:[" ",t]})]})}function Krt(e,t){let n=0,s=0,r=0,i=0,o=0,l=0,c=0;for(const d of e){const f=d.toolName.toLowerCase();Hc(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++:fm(f)?o++:jd(f)?l+=Ehe(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}):"",l?t("toolGroup.summary.askedQuestions",{count:l}):"",c?t("toolGroup.summary.otherTools",{count:c}):""].filter(Boolean).join(" ")}function Ehe(e){var n;const t=(n=e.args)==null?void 0:n.questions;return Array.isArray(t)&&t.length>0?t.length:1}function Ahe(e){return e.some(t=>x1(t.status))}function Yrt(){return a.jsxs("svg",{className:un.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:[a.jsx("path",{d:"M12 20h9"}),a.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function jhe(){return a.jsxs("svg",{className:un.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","data-testid":"chat-summary-tool-icon","aria-hidden":"true",children:[a.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.4",stroke:"currentColor",strokeWidth:"1.2"}),a.jsx("path",{d:"M4.6 5.2 6 6.6 4.6 8",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M7.3 8.1h2.1",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function Xrt(){return a.jsxs("svg",{className:un.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[a.jsx("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.25"}),a.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 Qrt(){return a.jsxs("svg",{className:un.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[a.jsx("rect",{x:"2",y:"1.6",width:"10",height:"10.8",rx:"2.2",stroke:"currentColor",strokeWidth:"1.25"}),a.jsx("path",{d:"M4.5 5.2h5M4.5 7h5M4.5 8.8h5",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function Jrt(){return a.jsx("svg",{className:un.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:a.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 Zrt(){return a.jsx("svg",{className:un.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:a.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 gR(){return a.jsx("svg",{className:un.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:a.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 eit({tool:e}){const t=Q6(e);return t==="agent"?a.jsx(gR,{}):t==="ask"?a.jsx(Zrt,{}):t==="edit"||t==="write"?a.jsx(Yrt,{}):t==="fetch"?a.jsx(Xrt,{}):t==="read"?a.jsx(Qrt,{}):t==="todo"?a.jsx(Jrt,{}):a.jsx(jhe,{})}function eO(e){const t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}const tit=Xy;function nit({tools:e,workspaceCwd:t,isLocateFlashing:n=!1}){const{t:s}=nt(),r=ZP(e),i=wd(r.toolName,s),o=tit(r),l=HP(r,t),c=x1(r.status)&&yd(r)||Hc(r.toolName)||eO(r.toolName)?"":eS(r.startTime,r.endTime);return a.jsxs("div",{className:`${un.compactGroup}${n?` ${n0.flash}`:""}`,children:[a.jsxs("div",{className:un.compactHeader,children:[a.jsx(Of,{status:o}),a.jsx("span",{className:un.lineName,children:i}),e.length>1&&a.jsxs("span",{className:un.compactCount,children:["× ",e.length]}),a.jsx(ok,{info:{kind:Q6(r),tool:r,displayName:i,description:l,elapsed:c,workspaceCwd:t}})]}),a.jsx("div",{className:un.compactHint,children:s("compact.hint")})]})}function sit(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&&rit(n.subTools,s.subTools)}function rit(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 ZG=/\[([^\]]+)\]\(qwen-session:\/\/([^)]+)\)/g;function Uj(e,t){if(!e||!e.includes("qwen-session://"))return e;const n=[];let s=0,r;for(ZG.lastIndex=0;(r=ZG.exec(e))!==null;){r.index>s&&n.push(e.slice(s,r.index));const i=r[2];n.push(t==="readonly"?a.jsx("span",{style:{textDecoration:"underline"},children:r[1]},r.index):a.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]:a.jsx(a.Fragment,{children:n})}const bR=h.memo(function({tool:t,approval:n,workspaceCwd:s,summaryOnly:r=!1,forceExpanded:i=!1,forceExpandable:o=!1,hideHeader:l=!1,hideCollapsedOutput:c=!1}){const{t:u}=nt(),d=bD(),f=h.useContext(i1),m=JP(),p=vhe(),g=p!==void 0,[b,w]=h.useState(!1),[y,v]=h.useState(()=>i||!f&&JG(t)),x=h.useRef(null),k=h.useRef(!1);h.useEffect(()=>{v(i||(f?!1:JG(t))),w(!1),x.current=null,k.current=!1},[f,i,g,t.callId,t.toolName]);const _=l0(t),T=n&&n.toolCallId===t.callId,S=!T&&(n==null?void 0:n.toolCallId)&&_&&xd(t,n.toolCallId),C=_&&t.status==="in_progress",N=QP(C);if(h.useEffect(()=>{!i&&!_&&t.status==="completed"&&!k.current&&v(!1)},[i,_,t.status]),_){const te=Brt(t,N),ae=te.explicitAgentType?`${u("agent.label")} (${Z_(te.explicitAgentType,u)})`:u("agent.label"),be=t.status==="completed"||t.status==="failed",se=yd(t),ze=[se&&!be?u("subagent.background"):t.status==="pending"?u("subagent.pending"):u("subagent.running"),se&&!be?"":te.elapsed].filter(Boolean).join(" · "),Pe=[te.subToolCount>0?u("subagent.toolsCount",{count:te.subToolCount}):"",te.elapsed,te.tokens,te.reason?Yo(te.reason,80):""].filter(Boolean).join(" · "),_t=i||y||!!T||!!S,Pt=a.jsx(YP,{tool:t,hideHeader:!0,defaultExpanded:!0,inline:!0});return m&&!l?a.jsx("div",{className:un.line,children:a.jsxs("button",{type:"button",className:`${un.lineMain} ${un.lineExpandable} ${un.lineButton}`,onClick:()=>m.onOpen(t),children:[a.jsx(gR,{}),a.jsx(Of,{status:be?te.status:t.status}),a.jsx("span",{className:un.lineName,children:ae}),a.jsx(ok,{info:{kind:"agent",tool:t,displayName:ae,description:te.description?Yo(te.description,60):"",elapsed:be?Pe:ze,workspaceCwd:s}}),a.jsx("span",{className:un.lineChevronRight,"aria-hidden":"true"})]})}):a.jsxs("div",{className:un.line,children:[!l&&a.jsxs("div",{className:`${un.lineMain} ${un.lineExpandable}`,onClick:()=>v(!y),children:[a.jsx(gR,{}),a.jsx(Of,{status:be?te.status:t.status}),a.jsx("span",{className:un.lineName,children:ae}),a.jsx(ok,{info:{kind:"agent",tool:t,displayName:ae,description:te.description?Yo(te.description,60):"",elapsed:be?Pe:ze,workspaceCwd:s}}),a.jsx("span",{className:y?un.lineChevronDown:un.lineChevronRight,"aria-hidden":"true"})]}),_t&&a.jsx("div",{className:un.lineDetail,children:l?a.jsx("div",{className:un.expandedAgentCard,children:Pt}):Pt})]})}const E=HP(t,s),O=EQe(t),D=r&&Hc(t.toolName)?Qde(t,s):E,j=wd(t.toolName,u),L=Hc(t.toolName)||eO(t.toolName)?"":eS(t.startTime,t.endTime),z=t.toolName.toLowerCase(),I=z==="monitor"&&g&&!b&&!l,$=fm(z),K=$?Jy(t):void 0,R=!!K&&K.length>0,Y=K?K.filter(te=>te.status==="completed").length:0,W=Hc(z),M=z==="grep"||z==="grep_search"||z==="search"||z==="glob",F=z==="read"||z==="read_file"||z==="readfile",J=!$&&Urt(D),V=!i&&(o||($?R:xrt(t)||J)),U=I||V,le=()=>{w(!0),V&&(k.current=!0,v(te=>!te))},pe=()=>{p&&khe(x,()=>p.onOpen(t),le)},fe=krt(t),Q=y&&J,ne=F,de=Q&&!W&&!M&&!F,ue=E,me=!$&&y&&!fe&&(Q||O);return a.jsxs("div",{className:un.line,children:[!l&&a.jsxs("div",{className:`${un.lineMain} ${U?un.lineExpandable:""}`,title:I?void 0:V?u(y?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":I?void 0:V?y:void 0,role:U?"button":void 0,tabIndex:U?0:void 0,onClick:U?()=>{if(I){pe();return}k.current=!0,v(te=>!te)}:void 0,onKeyDown:U?te=>{if(!(te.key!=="Enter"&&te.key!==" ")){if(te.preventDefault(),I){pe();return}k.current=!0,v(ae=>!ae)}}:void 0,children:[a.jsx(Of,{status:t.status}),a.jsx("span",{className:un.lineName,children:j}),$&&R&&a.jsxs("span",{className:un.todoProgress,children:[Y,"/",K.length]}),a.jsx(ok,{info:{kind:Q6(t),tool:t,displayName:j,description:$||de?"":D,elapsed:$?"":L,workspaceCwd:s}}),U&&a.jsx("span",{className:!I&&y?un.lineChevronDown:un.lineChevronRight,"aria-hidden":"true"})]}),(!r||y)&&$&&R&&a.jsx($rt,{tool:t,todos:K,expanded:y,title:j}),(!r||y)&&$&&!R&&O&&a.jsx("div",{className:un.lineOutput,children:Uj(O,d)}),me&&a.jsx(pR,{title:j,detail:ue,children:O&&a.jsx("div",{className:`${un.lineOutput} ${un.expandedLineOutput}`,children:Uj(O,d)})}),!$&&!c&&O&&!me&&(!y||!fe)&&(!r||y)&&a.jsx("div",{className:y?`${un.lineOutput} ${un.expandedLineOutput}`:un.lineOutput,children:Uj(O,d)}),!$&&y&&fe&&a.jsx("div",{className:ne?`${un.lineDetail} ${un.markdownLineDetail}`:un.lineDetail,children:F?a.jsx(Rrt,{tool:t}):a.jsxs(pR,{title:j,detail:ue,children:[Hc(z)&&a.jsx(Mrt,{tool:t}),(z==="write_file"||z==="writefile")&&a.jsx(QG,{tool:t}),(z==="edit"||z==="write"||z==="editfile")&&a.jsx(QG,{tool:t}),jd(t.toolName)&&a.jsx(Frt,{tool:t}),G6(z)&&a.jsx(qrt,{tool:t})]})})]})},sit),iit=h.memo(function({tools:t,pendingApproval:n,workspaceCwd:s,isLocateFlashing:r=!1}){const{t:i}=nt(),o=h.useContext(i1),l=JP(),c=vhe(),u=c!==void 0,[d,f]=h.useState(!1),[m,p]=h.useState(!1),g=h.useRef(null),b=Ahe(t),w=t.some(I=>I.status==="failed"),y=t.length>0?ZP(t):void 0,v=t.length===1?t[0]:void 0,x=v&&l0(v)?v:void 0,k=v&&v.toolName.toLowerCase()==="monitor"?v:void 0,_=t.some(I=>x1(I.status)&&!yd(I)),T=b&&_,S=!!(x&&l),C=!!(k&&u&&!d),N=S||C,E=t[0]??y,O=h.useRef(Date.now()),B=QP(T),D=(n==null?void 0:n.toolCallId)&&t.some(I=>xd(I,n.toolCallId)),j=o&&!D,L=T?dhe(B-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 z=()=>{!k||!c||khe(g,()=>c.onOpen(k),()=>{f(!0),p(I=>!I)})};return j?a.jsx(nit,{tools:t,workspaceCwd:s,isLocateFlashing:r}):D?a.jsx("div",{className:`${un.group}${r?` ${n0.flash}`:""}`,children:t.map(I=>a.jsx(bR,{tool:I,approval:n,workspaceCwd:s},I.callId))}):a.jsxs("div",{className:r?n0.flash:void 0,children:[a.jsxs("button",{type:"button",className:un.chatSummary,onClick:()=>{if(x&&l){l.onOpen(x);return}if(C&&k&&c){z();return}p(I=>!I)},"aria-expanded":N?void 0:m,title:N?void 0:i(m?"tool.collapseHint":"tool.expand"),children:[a.jsx("span",{className:un.chatSummaryIcon,"aria-hidden":"true",children:E?a.jsx(eit,{tool:E}):a.jsx(jhe,{})}),w&&a.jsx(Of,{status:"failed"}),a.jsx("span",{className:T?`${un.chatSummaryText} ${un.chatSummaryTextActive}`:un.chatSummaryText,children:v?a.jsx(Grt,{tool:v,runningDuration:L,workspaceCwd:s}):Wrt(t,i,L)}),a.jsx("span",{className:m?un.chatChevronDown:un.chatChevronRight,"aria-hidden":"true"})]}),a.jsx("div",{className:m?un.chatSummaryContentClip:`${un.chatSummaryContentClip} ${un.chatSummaryContentCollapsed}`,children:a.jsx("div",{className:un.chatSummaryContentInner,children:a.jsx("div",{className:`${un.group} ${un.chatSummaryGroup}`,children:t.map(I=>a.jsx(bR,{tool:I,approval:n,workspaceCwd:s,summaryOnly:!v,forceExpanded:!!v,hideHeader:!!v},I.callId))})})})]})}),oit="_message_kwepu_1",ait="_header_kwepu_6",lit="_chevron_kwepu_20",cit="_title_kwepu_26",uit="_progress_kwepu_35",Gw={message:oit,header:ait,chevron:lit,title:cit,progress:uit};function dit({id:e,todos:t}){var r;const s=((r=h.useContext(jO).get(e))==null?void 0:r.events)??[];return a.jsx(whe,{todos:t,events:s})}const hit=h.memo(function({id:t,todos:n,isLocateFlashing:s=!1}){const{t:r}=nt(),[i,o]=h.useState(!1);if(n.length===0)return null;const l=n.length,c=n.filter(u=>u.status==="completed").length;return a.jsxs("div",{className:`${Gw.message}${s?` ${n0.flash}`:""}`,children:[a.jsxs("button",{type:"button",className:Gw.header,onClick:()=>o(u=>!u),"aria-expanded":i,title:r(i?"todo.collapse":"todo.expand"),children:[a.jsx("span",{className:Gw.chevron,"aria-hidden":"true",children:i?"▾":"▸"}),a.jsx("span",{className:Gw.title,children:r("plan.title")}),a.jsxs("span",{className:Gw.progress,children:[c,"/",l]})]}),i?a.jsx(xhe,{todos:n,numbered:!0}):a.jsx(dit,{id:t,todos:n})]})}),fit="_message_1abcu_1",mit="_content_1abcu_11",pit="_question_1abcu_17",git="_prefix_1abcu_24",bit="_answer_1abcu_28",yit="_pending_1abcu_32",vit="_shortcuts_1abcu_36",eg={message:fit,content:mit,question:pit,prefix:git,answer:bit,pending:yit,shortcuts:vit},Nhe=h.memo(function({question:t,answer:n,isPending:s}){const{t:r}=nt();return a.jsxs("div",{className:eg.message,children:[a.jsxs("div",{className:eg.content,children:[a.jsxs("div",{className:eg.question,children:[a.jsx("span",{className:eg.prefix,children:"/btw "}),a.jsx("span",{children:t})]}),a.jsx("div",{className:eg.answer,children:s?a.jsx("span",{className:eg.pending,children:r("btw.answering")}):a.jsx(Jf,{content:n})})]}),a.jsx("div",{className:eg.shortcuts,children:r(s?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),wit="_message_1q4dw_1",xit="_compact_1q4dw_16",kit="_header_1q4dw_21",_it="_status_1q4dw_30",Sit="_name_1q4dw_35",Cit="_command_1q4dw_42",Tit="_output_1q4dw_51",Eit="_compactHint_1q4dw_62",of={message:wit,compact:xit,header:kit,status:_it,name:Sit,command:Cit,output:Tit,compactHint:Eit},Ait=h.memo(function({command:t,output:n}){const s=h.useContext(i1),{t:r}=nt();return a.jsxs("div",{className:s?`${of.message} ${of.compact}`:of.message,children:[a.jsxs("div",{className:of.header,children:[a.jsx("span",{className:of.status,children:"✓"}),a.jsx("span",{className:of.name,children:r("shell.command")}),t&&a.jsx("span",{className:of.command,children:t})]}),s?a.jsx("div",{className:of.compactHint,children:r("compact.hint")}):n&&a.jsx("pre",{className:of.output,children:n})]})}),jit="_progress_1j3ys_1",Nit="_spinner_1j3ys_12",Iit="_bar_1j3ys_19",Mit="_stage_1j3ys_25",Rit="_icon_1j3ys_29",Dit="_done_1j3ys_35",Lit="_error_1j3ys_43",Pit="_detail_1j3ys_51",Oit="_path_1j3ys_56",Na={progress:jit,spinner:Nit,bar:Iit,stage:Mit,icon:Rit,done:Dit,error:Lit,detail:Pit,path:Oit},eK=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"];function $it({progress:e}){const{stage:t,progress:n,detail:s,isComplete:r,error:i}=e,[o,l]=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(()=>{l(p=>(p+1)%eK.length)},120);return()=>clearInterval(m)},[r,i]),i?a.jsxs("div",{className:`${Na.progress} ${Na.error}`,children:[a.jsx("span",{className:Na.icon,children:"✕"}),a.jsx("span",{className:Na.stage,children:t}),a.jsx("div",{className:Na.detail,children:i})]}):r?a.jsxs("div",{className:`${Na.progress} ${Na.done}`,children:[a.jsx("span",{className:Na.icon,children:"✓"}),a.jsx("span",{className:Na.stage,children:t})]}):a.jsxs("div",{className:Na.progress,children:[a.jsx("span",{className:Na.spinner,children:eK[o]}),a.jsx("span",{className:Na.bar,children:f}),a.jsxs("span",{className:Na.stage,children:[t,s?` (${s})`:""]})]})}function Bit({path:e}){const{t}=nt();return a.jsxs("div",{className:`${Na.progress} ${Na.done}`,children:[a.jsx("span",{className:Na.icon,children:"✓"}),a.jsx("span",{className:Na.stage,children:t("insight.ready")}),a.jsx("span",{className:Na.path,children:e})]})}const zit=h.memo(function({message:t,pendingApproval:n,onShowContextDetail:s,workspaceCwd:r,isLatest:i=!1,showRetryHint:o=!1,onRetryClick:l,sendFailed:c=!1,onRetrySend:u,onBranchSession:d,showAssistantActions:f=!1,showAssistantBranch:m=!1,isLocateFlashing:p=!1,assistantTurnFooterInfo:g,generateContent:b}){const{t:w}=nt(),y=(()=>{switch(t.role){case"user":return a.jsx(rXe,{content:t.content,images:t.images,inputAnnotations:t.inputAnnotations,isLocateFlashing:p,sendFailed:c,onRetrySend:u});case"assistant":return a.jsx(OXe,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,onBranchSession:d,showFooterActions:f,showBranchAction:m,isLocateFlashing:p,customFooterInfo:g});case"thinking":return a.jsx(qXe,{messageId:t.id,content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,isLocateFlashing:p,generateContent:b});case"tool_group":return a.jsx(iit,{tools:t.tools,pendingApproval:n,workspaceCwd:r,isLocateFlashing:p});case"plan":return a.jsx(hit,{id:t.id,todos:t.todos,isLocateFlashing:p});case"system":return a.jsx(ant,{content:t.content,variant:t.variant,source:t.source,data:t.data,onShowContextDetail:s,isLatest:i,showRetryHint:o&&t.retryable===!0,onRetryClick:l});case"user_shell":return a.jsx(Ait,{command:t.command,output:t.output});case"btw":return a.jsx(Nhe,{question:t.question,answer:t.answer,isPending:t.isPending});case"insight_progress":return a.jsx($it,{progress:{stage:t.stage,progress:t.progress,detail:t.detail}});case"insight_ready":return a.jsx(Bit,{path:t.path});case"insight_error":return a.jsx("div",{style:{color:"var(--error-color, #e06c75)"},children:t.error});default:return null}})();if(y===null)return null;const v=a.jsx(Wf,{label:`message:${t.role}`,resetKeys:[t],fallback:a.jsx(Fit,{align:t.role==="user"?"end":"start"}),children:y}),x=a.jsx("div",{"data-user-selectable":"true",style:{display:"contents"},children:v});return t.role==="assistant"?f?x:a.jsx(Y7,{timestamp:t.timestamp,children:x}):t.role==="system"&&t.source==="prompt_cancelled"?x:a.jsx(Y7,{timestamp:t.timestamp,chatMode:t.role==="user",copyText:t.role==="user"?t.content:void 0,copyTitle:w("common.copy"),children:x})},qit);function Fit({align:e}){const{t}=nt();return a.jsx("div",{role:"alert",style:{display:"flex",justifyContent:e==="end"?"flex-end":"flex-start"},children:a.jsx("span",{style:{color:"var(--error-color, #e06c75)",fontSize:"0.85em",opacity:.85},children:t("message.renderError")})})}function qit(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.sendFailed!==t.sendFailed||e.onRetrySend!==t.onRetrySend||e.onBranchSession!==t.onBranchSession||e.showAssistantActions!==t.showAssistantActions||e.showAssistantBranch!==t.showAssistantBranch||e.isLocateFlashing!==t.isLocateFlashing||e.generateContent!==t.generateContent||!Hit(e.assistantTurnFooterInfo,t.assistantTurnFooterInfo)?!1:Uit(e.message,t.message)}function Hit(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 Uit(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&&Git(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"&&Wit(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&e.tools.length===t.tools.length&&e.tools.every((n,s)=>Ihe(n,t.tools[s]));default:return!1}}function Wit(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 Ihe(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&&Mm(e.args)===Mm(t.args)&&Mm(e.rawOutput)===Mm(t.rawOutput)&&Mm(e.locations)===Mm(t.locations)&&Mm(e.content)===Mm(t.content)&&Vit(e.subTools,t.subTools):!1}function Vit(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((n,s)=>Ihe(n,t[s]))}const tK=new WeakMap;function Git(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 Mm(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=tK.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return tK.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 Kit(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 B3(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=Kit(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 c_(e,t){const n=e.trim().split(/\s+/);if(n.length!==5)return e;const[s,r,i,o,l]=n,c=d=>/^\d+$/.test(d),u=d=>d.padStart(2,"0");if(/^\*\/\d+$/.test(s)&&r==="*"&&i==="*"&&o==="*"&&l==="*"){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==="*"&&l==="*")return t("scheduledTasks.human.hourly",{min:u(s)});if(c(s)&&c(r)&&i==="*"&&o==="*"&&l==="*")return t("scheduledTasks.human.daily",{time:`${u(r)}:${u(s)}`});if(c(s)&&c(r)&&i==="*"&&o==="*"&&l==="1-5")return t("scheduledTasks.human.weekdays",{time:`${u(r)}:${u(s)}`});if(c(s)&&c(r)&&i==="*"&&o==="*"&&c(l)&&Number(l)>=0&&Number(l)<=7){const d=t("scheduledTasks.weekdayNames").split(","),f=Number(l)===7?0:Number(l),m=d[f]??l;return t("scheduledTasks.human.weekly",{day:m,time:`${u(r)}:${u(s)}`})}return e}const Jd={frequency:"daily",time:"09:00",weekday:1,minuteInterval:30,customCron:"0 9 * * *"};function Om(e){const t=e.trim(),n={...Jd,frequency:"custom",customCron:t.length>0?t:Jd.customCron},s=t.split(/\s+/);if(s.length!==5)return n;const[r,i,o,l,c]=s,u=b=>/^\d+$/.test(b),d=b=>String(b).padStart(2,"0"),f=o==="*"&&l==="*";if(/^\*\/\d+$/.test(r)&&i==="*"&&f&&c==="*"){const b=Number(r.slice(2));return Number.isInteger(b)&&b>=1&&b<=30&&60%b===0?{...Jd,frequency:"minutes",minuteInterval:b}:n}if(!u(r))return n;const m=Number(r);if(m>59)return n;if(i==="*"&&f&&c==="*")return{...Jd,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{...Jd,frequency:"daily",time:g};if(f&&c==="1-5")return{...Jd,frequency:"weekdays",time:g};if(f&&u(c)){const b=Number(c);if(b>=0&&b<=7)return{...Jd,frequency:"weekly",time:g,weekday:b===7?0:b}}return n}function Yit(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,l=(u,d)=>`${d}${t(`scheduledTasks.dur.${u}`)}`;let c;return s>0?c=r>0?[l("d",s),l("h",r)]:[l("d",s)]:r>0?c=i>0?[l("h",r),l("m",i)]:[l("h",r)]:i>0?c=o>0?[l("m",i),l("s",o)]:[l("m",i)]:c=[l("s",o)],c.join(" ")}function Xit(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 Mhe(e){switch(e){case"html":return"HTML";case"pdf":return"PDF";case"notebook":return"Notebook";default:return e||"artifact"}}function Qit(e){var n;const t=(n=e.metadata)==null?void 0:n.artifactType;return typeof t=="string"&&t?t:Mhe(e.kind)}function Rhe(e){return e===void 0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}const Dhe={avif:"image/avif",bmp:"image/bmp",gif:"image/gif",ico:"image/x-icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",webp:"image/webp"},Jit=100*1024*1024,Zit=100*1024;function eot(e){var n,s;const t=(s=(n=e.mimeType)==null?void 0:n.split(";",1)[0])==null?void 0:s.trim().toLowerCase();return t!=null&&t.startsWith("image/")?t==="image/jpg"?"image/jpeg":Object.values(Dhe).includes(t)?t:void 0:tO(e.workspacePath??"")}function tO(e){const t=e.toLowerCase(),n=t.includes(".")?t.split(".").pop():void 0;return n?Dhe[n]:void 0}function tot(e){return/\.html?$/i.test(e)?"text/html":"text/markdown"}async function Lhe(e,t,n,s){var c,u,d,f;const r=[],i=s.maxBytes??Jit,o=await s.statFile(t);if((c=s.isCancelled)!=null&&c.call(s))throw new Error("File loading was cancelled.");if(o.sizeBytes>i)throw new Error("File is too large to preview or download.");let l=0;for(;;){if((u=s.isCancelled)!=null&&u.call(s))throw new Error("File loading was cancelled.");const m=await e(t,{offset:l,maxBytes:Zit});if((d=s.isCancelled)!=null&&d.call(s))throw new Error("File loading was cancelled.");if(m.sizeBytes!==o.sizeBytes)throw new Error("File changed while loading. Please retry.");if(m.returnedBytes<=0&&l<o.sizeBytes)throw new Error("File loading made no progress.");const p=atob(m.contentBase64),g=new Uint8Array(p.length);for(let b=0;b<p.length;b++)g[b]=p.charCodeAt(b);if(r.push(g),l=m.offset+m.returnedBytes,l>=o.sizeBytes){const b=await s.statFile(t);if((f=s.isCancelled)!=null&&f.call(s))throw new Error("File loading was cancelled.");if(b.sizeBytes!==o.sizeBytes||b.modifiedMs!==o.modifiedMs)throw new Error("File changed while loading. Please retry.");return new Blob(r,{type:n})}}}async function Phe(e,t,n="application/octet-stream",s){const r=await Lhe((o,l)=>e.readFileBytes(o,l),t,n,{statFile:o=>e.stat(o),isCancelled:s}),i=URL.createObjectURL(r);try{const o=document.createElement("a");o.href=i,o.download=nm(t).split("/").at(-1)??t,document.body.appendChild(o),o.click(),o.remove()}finally{URL.revokeObjectURL(i)}}function not(e){return e.workspacePath??e.url??e.managedId??""}function nm(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 yR(e,t){const n=nm(e),s=nm(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 Ohe(e,t,n){const s=yR(e??"",n),r=yR(t??"",n);return!!s&&s===r}const nK="default-src 'none'; base-uri 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:;";function sot(e){if(typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${nK}"></head><body>${rot(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=nK,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function rot(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 z3({additions:e,deletions:t,className:n,additionsClassName:s,deletionsClassName:r}){return e===void 0||t===void 0?null:a.jsxs("span",{className:n,children:[a.jsxs("span",{className:s,children:["+",e]}),a.jsxs("span",{className:r,children:["-",t]})]})}function $he(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 iot="_root_1aysb_1",oot="_card_1aysb_7",aot="_summary_1aysb_14",lot="_icon_1aysb_22",cot="_iconSvg_1aysb_33",uot="_title_1aysb_39",dot="_reviewSummary_1aysb_46",hot="_reviewSummaryWithStats_1aysb_53",fot="_reviewMeta_1aysb_58",mot="_linkButton_1aysb_65",pot="_reviewButton_1aysb_66",got="_showMoreButton_1aysb_67",bot="_actions_1aysb_96",yot="_list_1aysb_122",vot="_fileRow_1aysb_129",wot="_path_1aysb_149",xot="_lineStats_1aysb_158",kot="_additions_1aysb_167",_ot="_deletions_1aysb_171",Sot="_chevronIcon_1aysb_185",Cot="_chevronIconOpen_1aysb_193",Tot="_artifactInfo_1aysb_197",Eot="_artifactMeta_1aysb_202",js={root:iot,card:oot,summary:aot,icon:lot,iconSvg:cot,title:uot,reviewSummary:dot,reviewSummaryWithStats:hot,reviewMeta:fot,linkButton:mot,reviewButton:pot,showMoreButton:got,actions:bot,list:yot,fileRow:vot,path:wot,lineStats:xot,additions:kot,deletions:_ot,chevronIcon:Sot,chevronIconOpen:Cot,artifactInfo:Tot,artifactMeta:Eot},Bhe=["file","artifact","scheduled_task"];function Aot({turnId:e,changes:t,artifacts:n,scheduledTasks:s,workspaceCwd:r,onOpenRequest:i,onReviewChanges:o,onOpenArtifact:l,onOpenScheduledTask:c,onError:u}){const{t:d}=nt(),f=Qo(),[m,p]=h.useState(!1);if(t.length===0&&n.length===0&&s.length===0)return null;const g=m?t:t.slice(0,3),b=t.length-3,w=$he(t),y=k=>{if(i){i({id:"review",kind:"review",title:d("turnOutputs.review"),turnId:e,changes:t,...r?{workspaceCwd:r}:{},...k?{selectedPath:k}:{}});return}o(t,k)},v=k=>{const _=Oot(k,t,r);if(i){i({id:`artifact:${k.id}`,kind:"artifact",title:k.title??"Artifact",turnId:e,artifactId:k.id,...k.managedId?{managedId:k.managedId}:{},artifact:k,..._!==void 0?{previewContent:_}:{}});return}l(k.id,_)},x=k=>{if(i){i({id:`scheduled-task:${k.toolCallId}`,kind:"scheduled_task",title:d("scheduledTasks.title"),turnId:e,task:k});return}c(k)};return a.jsxs("div",{className:js.root,children:[t.length>0&&a.jsxs("div",{className:js.card,children:[a.jsxs("div",{className:js.summary,children:[a.jsx("span",{className:js.icon,"aria-hidden":"true",children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",focusable:"false",className:js.iconSvg,children:[a.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),a.jsx("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),a.jsx("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),a.jsxs("div",{className:[js.reviewSummary,w?js.reviewSummaryWithStats:""].filter(Boolean).join(" "),children:[a.jsx("div",{className:js.title,children:d("turnOutputs.filesEdited",{count:t.length})}),a.jsxs("div",{className:js.reviewMeta,children:[a.jsx(z3,{additions:w==null?void 0:w.additions,deletions:w==null?void 0:w.deletions,className:js.lineStats,additionsClassName:js.additions,deletionsClassName:js.deletions}),a.jsxs("button",{type:"button",className:js.linkButton,onClick:()=>y(),children:[d("turnOutputs.viewChanges")," ↗"]})]})]}),a.jsx("div",{className:js.actions,children:a.jsx("button",{type:"button",className:js.reviewButton,onClick:()=>y(),children:d("turnOutputs.review")})})]}),a.jsxs("div",{className:js.list,children:[g.map(k=>a.jsxs("button",{type:"button",className:js.fileRow,onClick:()=>y(k.path),title:k.path,children:[a.jsx("span",{className:js.path,children:J6(k.path,r)}),a.jsx(z3,{additions:k.additions,deletions:k.deletions,className:js.lineStats,additionsClassName:js.additions,deletionsClassName:js.deletions})]},`${k.toolCallId}:${k.path}`)),b>0&&a.jsxs("button",{type:"button",className:js.showMoreButton,onClick:()=>p(k=>!k),children:[a.jsx("span",{children:m?d("turnOutputs.collapseFiles"):d("turnOutputs.showMoreFiles",{count:b})}),a.jsx(Lot,{open:m})]})]})]}),n.map(k=>a.jsx(jot,{artifact:k,onOpen:()=>v(k),onError:u,onDownload:zot(k)?_=>Phe(f,k.workspacePath,k.mimeType,_):void 0},k.id)),s.map(k=>a.jsx(Mot,{task:k,scheduleLabel:c_(k.cron,d),onOpen:()=>x(k)},k.toolCallId))]})}function jot({artifact:e,onOpen:t,onDownload:n,onError:s}){const{t:r}=nt(),[i,o]=h.useState(!1),l=h.useRef(!0);h.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const c=Rhe(e.sizeBytes),u=Iot(e.kind),d=e.workspacePath&&nm(e.workspacePath).split("/").at(-1)||e.title,f=async()=>{if(!(!n||i)){o(!0);try{await n(()=>!l.current)}catch(m){if(!l.current)return;const p=r("common.downloadFailed",{message:no(m)});s?s(new Error(p,{cause:m}),p):console.error(p,m)}finally{o(!1)}}};return a.jsx("div",{className:js.card,children:a.jsxs("div",{className:js.summary,children:[a.jsx("span",{className:js.icon,"aria-hidden":"true",children:u?a.jsx(u,{className:js.iconSvg,strokeWidth:1.8}):a.jsx(Rot,{})}),a.jsxs("div",{className:js.artifactInfo,children:[a.jsx("div",{className:js.title,children:e.title}),a.jsx("div",{className:js.artifactMeta,children:[Qit(e),c].filter(Boolean).join(" · ")})]}),a.jsxs("div",{className:js.actions,children:[n&&a.jsxs("button",{type:"button",className:js.reviewButton,onClick:()=>void f(),title:`${r("common.download")} ${d}`,disabled:i,children:[a.jsx(Hx,{size:16,strokeWidth:1.8,"aria-hidden":"true"}),r(i?"common.downloading":"common.download")]}),a.jsx("button",{type:"button",className:js.reviewButton,onClick:t,title:e.title,children:r("common.open")})]})]})})}const Not={file:Ske,link:n_e,html:mke,image:vke,video:xke,audio:bke,pdf:Tee,notebook:m_e};function Iot(e){return Not[e]}function Mot({task:e,scheduleLabel:t,onOpen:n}){const{t:s}=nt();return a.jsx("div",{className:js.card,children:a.jsxs("div",{className:js.summary,children:[a.jsx("span",{className:js.icon,"aria-hidden":"true",children:a.jsx(Dot,{})}),a.jsxs("div",{className:js.artifactInfo,children:[a.jsx("div",{className:js.title,children:e.title}),a.jsx("div",{className:js.artifactMeta,children:[t,e.recurring?s("scheduledTasks.repeats"):s("scheduledTasks.runsOnce")].filter(Boolean).join(" · ")})]}),a.jsx("div",{className:js.actions,children:a.jsx("button",{type:"button",className:js.reviewButton,onClick:n,title:e.title,children:s("common.open")})})]})})}function Rot(){return a.jsxs("svg",{className:js.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("rect",{x:"6",y:"4",width:"12",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"1.8"}),a.jsx("path",{d:"M9 10h6M9 14h4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function Dot(){return a.jsxs("svg",{className:js.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),a.jsx("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Lot({open:e}){return a.jsx("svg",{className:[js.chevronIcon,e?js.chevronIconOpen:""].filter(Boolean).join(" "),viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}const Pot=h.memo(Aot);function Oot(e,t,n){if(!$ot(e)||!e.workspacePath)return;const s=t.find(r=>Ohe(r.path,e.workspacePath,n));if(s)return zhe(s)}function zhe(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 $ot(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"||Fhe(t)||n==="text/html"||n==="text/markdown"}function Fhe(e){const t=e.toLowerCase();return t.endsWith(".html")||t.endsWith(".htm")||t.endsWith(".md")||t.endsWith(".markdown")||tO(t)!==void 0}function Bot(e){return/\.(?:html?|md|markdown)$/i.test(e)}function zot(e){return e.storage==="workspace"&&e.status==="available"&&!!e.workspacePath}function J6(e,t){return yR(e,t)}const Fot="_wrap_16iog_1",qot="_summary_16iog_5",Hot="_summaryTextActive_16iog_27",Uot="_summaryIcon_16iog_33",Wot="_summaryStatus_16iog_47",Vot="_summaryToolIcon_16iog_54",Got="_summaryText_16iog_27",Kot="_summaryDot_16iog_96",Yot="_chevronRight_16iog_100",Xot="_chevronDown_16iog_101",Qot="_group_16iog_161",Jot="_list_16iog_193",Zot="_row_16iog_199",eat="_rowStats_16iog_221",tat="_rowDesc_16iog_229",nat="_rowTool_16iog_239",sat="_detail_16iog_243",rat="_track_16iog_249",iat="_bar_16iog_257",oat="_barRunning_16iog_265",aat="_ruler_16iog_304",lat="_tick_16iog_311",$i={wrap:Fot,summary:qot,summaryTextActive:Hot,summaryIcon:Uot,summaryStatus:Wot,summaryToolIcon:Vot,summaryText:Got,summaryDot:Kot,chevronRight:Yot,chevronDown:Xot,group:Qot,list:Jot,row:Zot,rowStats:eat,rowDesc:tat,rowTool:nat,detail:sat,track:rat,bar:iat,barRunning:oat,ruler:aat,tick:lat};function qhe(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 cat(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 l=Math.max(i/1e3/2.2,1),c=Math.pow(10,Math.floor(Math.log10(l))),u=[5,2,1].map(f=>f*c).find(f=>f<=l)??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:qhe(m)})}return{rows:o,ticks:d}}function uat(e,t){const n=[],s=J_(e.rawOutput),r=s==null?void 0:s.executionSummary,i=r&&typeof r.totalDurationMs=="number"?qhe(r.totalDurationMs):eS(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(WP(o));const l=UP(e);return l&&n.push(Yo(l,80)),n.join(" · ")}function dat(){return a.jsx("svg",{className:$i.summaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:a.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 hat({agents:e,pendingApproval:t}){const{t:n}=nt(),s=JP(),[r,i]=h.useState(!1),[o,l]=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?dhe(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=>xd(x,t.toolCallId)):void 0,w=r||!!b,y=w?cat(e,c):null,v=e.some(x=>Xy(x)==="failed")?"failed":f?"in_progress":"completed";return a.jsxs("div",{className:$i.wrap,children:[a.jsxs("button",{type:"button",className:$i.summary,onClick:()=>i(x=>!x),"aria-expanded":w,title:n(w?"tool.collapseHint":"tool.expand"),children:[v==="failed"?a.jsx("span",{className:$i.summaryStatus,children:a.jsx(Of,{status:v})}):a.jsx("span",{className:$i.summaryIcon,"aria-hidden":"true",children:a.jsx(dat,{})}),a.jsxs("span",{className:f?`${$i.summaryText} ${$i.summaryTextActive}`:$i.summaryText,children:[n("parallelAgents.title"),m&&a.jsxs(a.Fragment,{children:[" ",m]}),a.jsx("span",{className:$i.summaryDot,children:"·"}),n("parallelAgents.done",{done:p,total:g})]}),a.jsx("span",{className:w?$i.chevronDown:$i.chevronRight,"aria-hidden":"true"})]}),w&&a.jsxs("div",{className:$i.group,children:[a.jsx("div",{className:$i.list,children:e.map(x=>{const k=VP(x),_=K6(x),T=IQe(x,n),S=uat(x,c),C=Xy(x),N=o===x.callId,E=y==null?void 0:y.rows.get(x.callId);return a.jsxs("div",{children:[a.jsxs("button",{type:"button",className:$i.row,"aria-expanded":s?void 0:N,onClick:()=>{s?s.onOpen(x):l(N?null:x.callId)},children:[a.jsx(Of,{status:C}),a.jsxs("span",{className:$i.rowDesc,children:[Yo(_||Z_(k,n),50),T&&a.jsx("span",{className:$i.rowTool,children:` (${T})`})]}),S&&a.jsx("span",{className:$i.rowStats,children:S})]}),E&&a.jsx("div",{className:$i.track,"aria-hidden":"true",children:a.jsx("span",{className:E.running?`${$i.bar} ${$i.barRunning}`:$i.bar,style:{left:`${E.leftPct}%`,width:`${E.widthPct}%`}})}),!s&&N&&a.jsx("div",{className:$i.detail,children:a.jsx(YP,{tool:x,hideHeader:!0})})]},x.callId)})}),y&&y.ticks.length>=2&&a.jsx("div",{className:$i.ruler,"aria-hidden":"true",children:y.ticks.map(x=>a.jsx("span",{className:$i.tick,style:{left:`${x.leftPct}%`},children:x.label},x.label))})]})]})}const fat="_collapseRow_d7f01_1",mat="_collapseRowClickable_d7f01_14",pat="_collapseLabel_d7f01_19",gat="_processedLabel_d7f01_36",bat="_processedMeta_d7f01_43",yat="_hiddenMetrics_d7f01_47",vat="_summaryMetrics_d7f01_51",wat="_collapseIcon_d7f01_59",xat="_chevronRight_d7f01_72",kat="_chevronDown_d7f01_73",rd={collapseRow:fat,collapseRowClickable:mat,collapseLabel:pat,processedLabel:gat,processedMeta:bat,hiddenMetrics:yat,summaryMetrics:vat,collapseIcon:wat,chevronRight:xat,chevronDown:kat},_at="_list_p1edz_1",Sat="_listWithWelcomeHeader_p1edz_12",Cat="_historyStatus_p1edz_32",Tat="_virtualSizer_p1edz_48",Eat="_virtualRow_p1edz_57",Aat="_loadingSkeleton_p1edz_67",jat="_srOnly_p1edz_75",Nat="_loadingSkeletonUserRow_p1edz_87",Iat="_loadingSkeletonAssistantRow_p1edz_93",Mat="_loadingSkeletonUserBubble_p1edz_99",Rat="_loadingSkeletonUserBubbleCompact_p1edz_100",Dat="_loadingSkeletonAssistantBlock_p1edz_114",Lat="_loadingSkeletonLineWide_p1edz_122",Pat="_loadingSkeletonLineMedium_p1edz_123",Oat="_loadingSkeletonLineShort_p1edz_124",$at="_loadingSkeletonLineNarrow_p1edz_125",Bat="_turnStatusRow_p1edz_165",zat="_turnAnswerRow_p1edz_166",Fat="_turnContentRow_p1edz_177",qat="_sessionTimelineLayer_p1edz_181",Hat="_sessionTimelinePanel_p1edz_194",Uat="_sessionTimelineViewport_p1edz_205",Wat="_sessionTimelineList_p1edz_246",Vat="_sessionTimelineItem_p1edz_256",Gat="_sessionTimelineButton_p1edz_261",Kat="_sessionTimelineTick_p1edz_280",Yat="_sessionTimelineButtonInRange_p1edz_367",Xat="_sessionTimelineButtonCurrent_p1edz_371",Qat="_sessionTimelineDetails_p1edz_382",Jat="_sessionTimelineDetailsTitle_p1edz_416",Zat="_sessionTimelineDetailsIcon_p1edz_423",elt="_sessionTimelineDetailsTitleText_p1edz_435",tlt="_sessionTimelineDetailsDetail_p1edz_445",Ls={list:_at,listWithWelcomeHeader:Sat,historyStatus:Cat,virtualSizer:Tat,virtualRow:Eat,loadingSkeleton:Aat,srOnly:jat,loadingSkeletonUserRow:Nat,loadingSkeletonAssistantRow:Iat,loadingSkeletonUserBubble:Mat,loadingSkeletonUserBubbleCompact:Rat,loadingSkeletonAssistantBlock:Dat,loadingSkeletonLineWide:Lat,loadingSkeletonLineMedium:Pat,loadingSkeletonLineShort:Oat,loadingSkeletonLineNarrow:$at,turnStatusRow:Bat,turnAnswerRow:zat,turnContentRow:Fat,sessionTimelineLayer:qat,sessionTimelinePanel:Hat,sessionTimelineViewport:Uat,sessionTimelineList:Wat,sessionTimelineItem:Vat,sessionTimelineButton:Gat,sessionTimelineTick:Kat,sessionTimelineButtonInRange:Yat,sessionTimelineButtonCurrent:Xat,sessionTimelineDetails:Qat,sessionTimelineDetailsTitle:Jat,sessionTimelineDetailsIcon:Zat,sessionTimelineDetailsTitleText:elt,sessionTimelineDetailsDetail:tlt},Wj=()=>{},nlt=12e4,Vj=180;function slt(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 rlt(e){return e[e.length-1]}function ilt(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&k1(n))return n.id}return null}function sK(e){return e.role==="tool_group"&&e.tools.length===1&&l0(e.tools[0])}function Gj(e){return e.role==="tool_group"&&e.tools.length===1&&yd(e.tools[0])}function rK(e){return e.role==="thinking"}function iK(e,t){return e.role!=="tool_group"?!1:!!(t!=null&&t.toolCallId&&e.tools.some(n=>xd(n,t.toolCallId)))}function oK(e){return e.role==="thinking"}function olt(e,t){const n=[];let s=0;for(;s<e.length;){const r=e[s];if(r.role!=="tool_group"||iK(r,t)){oK(r)||n.push(r),s++;continue}const i=[r];let o=s,l=s+1;for(;l<e.length;){const u=e[l];if(oK(u)){l++;continue}if(u.role==="tool_group"&&!iK(u,t)){i.push(u),o=l,l++;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 Hhe(e){const t=[];let n=0;for(;n<e.length;){if(Gj(e[n])){const s=[];let r=n;for(;r<e.length;){const i=e[r];if(Gj(i)){s.push(i),r++;continue}if(rK(i)){let o=r+1;for(;o<e.length&&rK(e[o]);)o++;if(o<e.length&&Gj(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(sK(e[n])){const s=n;for(;n<e.length&&sK(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 alt(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 llt(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 l=(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"&&k1(c.message)?(l(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 l(o,!0),i}function clt(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 nO(e,t,n,s=!0){let r=t;for(let i=n;i>t;i--)if(_lt(e[i])){r=i;break}for(let i=n;i>r;i--)if(clt(e[i],s))return i;return-1}function ult(e,t){const n=[];for(let r=0;r<e.length;r++){const i=e[r];i.type==="message"&&k1(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,l=e[i],c=nO(e,i,o,!1);if(c<0)continue;const u=e[c];(l==null?void 0:l.type)==="message"&&u.type==="message"&&u.message.role==="assistant"&&s.set(u.message.id,l.message.id)}return s}function aK(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:sO(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 sO(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 dlt(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}:r1(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 sO(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 r1(e,t,n={}){const r=(n.stripMarkdown===!0?hlt(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 hlt(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=Kj(s,"~~"),s=Kj(s,"**"),s=Kj(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 Kj(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 l=e.slice(i,o);n+=l.trim().length===0?e.slice(s,o+t.length):e.slice(s,r)+l,s=o+t.length}return n}function flt(e,t){const n=e.role==="user"?e.content:e.role==="user_shell"?e.command:"",s=r1(n,32);return s||(t?t("timeline.userTurn"):"User turn")}function mlt(e){return e.role==="user"&&(e.source==="cron"||e.source==="loop")}function k1(e){return e.role==="user"||e.role==="user_shell"}function plt(e,t){switch(e.role){case"thinking":return t?t("timeline.kind.thought"):"thinking";case"assistant":return r1(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 sO(e)?r1(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 glt(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"?"":plt(e.message,t)}function blt(e,t){return t?t(`timeline.kind.${e}`):Glt[e]}function ylt(e,t,n,s){if(t!==null)for(const o of e){if(o.type!=="message")continue;const{message:l}=o;if(l.id!==t||l.role!=="assistant")continue;const c=r1(l.content,180,{stripMarkdown:!0});if(c)return c}const r=[];for(let o=0;o<e.length;o+=1){const l=e[o];if(l.type==="message"&&t!==null&&l.message.id===t)continue;const c=glt(l,s);c&&r.push(c)}const i=r1(r.join(" · "),180);return i||(n.length>0?n.map(o=>blt(o,s)).join(" · "):s?s("timeline.noActivity"):"No activity")}function vlt(e,t){const n=[];let s=null,r=[];const i=()=>{if(!s)return;const o=Hhe(r),l=nO(o,-1,o.length-1,!1),c=l>=0?o[l]:null,u=(c==null?void 0:c.type)==="message"&&c.message.role==="assistant"&&!c.message.isStreaming&&r1(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=dlt(f,t);m.kind!=="none"&&!d.includes(m.kind)&&d.push(m.kind)}n.push({id:s.id,label:flt(s,t),detail:ylt(o,u,d,t),timestamp:s.timestamp,nodeKinds:d,...mlt(s)?{isScheduledTask:!0}:{}})};for(const o of e){if(k1(o)){i(),s=o,r=[];continue}s&&r.push(o)}return i(),n}function wlt(){return a.jsxs("svg",{className:Ls.sessionTimelineDetailsIcon,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6.25"}),a.jsx("path",{d:"M8 4.5v4l-2.5 2"})]})}function xlt(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 klt(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(xlt).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 _lt(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 lK(e){return e==="pending"||e==="running"||e==="in_progress"}function Slt(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=>lK(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=>lK(n.status));return t.length===0?null:`tools:${e.message.id}:${t.map(n=>n.callId).join(",")}`}function Clt(e){for(let t=e.length-1;t>=0;t--){const n=Slt(e[t]);if(n)return n}return null}function Tlt(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 Elt(e){return e.type==="message"&&e.message.role==="system"&&e.message.source==="turn_error"}function Alt(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 jlt(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function Yj(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0}function cK(e){if(e.parentToolCallId||!l0(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=Yj(n==null?void 0:n.inputTokens),r=Yj(n==null?void 0:n.outputTokens);if(s===void 0&&r===void 0)return;const i=Yj(n==null?void 0:n.cachedTokens);return{callId:e.callId,usage:{inputTokens:s??0,outputTokens:r??0,...i!==void 0?{cachedTokens:i}:{}}}}function Nlt(e){return e.type==="parallel_agents"?e.agents.flatMap(t=>cK(t)??[]):e.type!=="message"||e.message.role!=="tool_group"?[]:e.message.tools.flatMap(t=>cK(t)??[])}function Ilt(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 Uhe(e,t){for(let n=Math.min(t,e.length-1);n>=0;n--){const s=e[n];if(s.type==="message"&&k1(s.message))return s.message.id}return null}function Whe(e){const t=[];let n=null;for(const s of e)s.type==="message"&&k1(s.message)&&(n=s.message.id),t.push(n);return t}function uK(e,t,n,s){const r=s===void 0?Uhe(e,t):s[t]??null;return r?n.get(r)??null:null}function Mlt(e,t,n,s,r=Whe(e)){let i=Number.POSITIVE_INFINITY,o=-1;for(const c of t){if(c<0||c>=e.length)continue;const u=uK(e,c,n,r);u!==null&&(i=Math.min(i,u),o=Math.max(o,u))}if(o<0)return null;const l=s==null?null:uK(e,s,n,r);return{startIndex:i,endIndex:o,currentIndex:l!==null&&l>=i&&l<=o?l:o}}function Rlt(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=>xd(o,s)))return!0}else if(i.type==="message"&&i.message.role==="tool_group"&&i.message.tools.some(o=>xd(o,s)))return!0}return!1}function Dlt(e,{overrides:t,isResponding:n,activeTurnStartedAt:s,pendingApprovalCallId:r,includeSubagentToolUsageInMetrics:i=!0,enabled:o}){if(!o||e.length===0)return e;const l=[];for(let u=0;u<e.length;u++){const d=e[u];d.type==="message"&&k1(d.message)&&l.push(u)}if(l.length===0)return e;const c=[];for(let u=0;u<l[0];u++)c.push(e[u]);for(let u=0;u<l.length;u++){const d=l[u],f=(u+1<l.length?l[u+1]:e.length)-1,m=e[d],p=m.message.id,g=m.message.timestamp,b=u===l.length-1&&n,w=Rlt(e,d,f,r),y=nO(e,d,f);let v=0,x,k,_=0,T=0,S=0,C=0,N=0,E=!1;const O=new Set;let B=!1;for(let Y=d+1;Y<=f;Y++){const W=e[Y];aK(W,Y===y)&&v++,Elt(W)&&(B=!0),C+=Ilt(W),W.type==="message"&&W.message.role==="thinking"&&N++;const F=Tlt(W);F!==void 0&&(x=x===void 0?F:Math.max(x,F));const J=Alt(W);J!==void 0&&(k=k===void 0?J:Math.max(k,J));const V=jlt(W);if(V&&(_+=V.inputTokens,T+=V.outputTokens,S+=V.cachedTokens??0,E=!0),i)for(const U of Nlt(W))O.has(U.callId)||(O.add(U.callId),_+=U.usage.inputTokens,T+=U.usage.outputTokens,S+=U.usage.cachedTokens??0,E=!0)}const D=b?s??g??Date.now():void 0,j=x??k,L=g!==void 0&&j!==void 0&&j>=g?j-g:void 0;if(w||v===0&&!(E||L!==void 0||D!==void 0)){for(let Y=d;Y<=f;Y++)c.push(e[Y]);continue}const I=b||B||y<0,K=!(v===0?!0:t.has(p)?t.get(p):I);c.push({type:"message",key:m.key,message:m.message});const R={turnId:p,collapsed:K,hiddenCount:v,...L!==void 0?{elapsedMs:L}:{},...E?{inputTokens:_,outputTokens:T}:{},...S>0?{cachedTokens:S}:{},...C>0?{toolCallCount:C}:{},...N>0?{thinkingCount:N}:{},...D!==void 0?{liveStartedAt:D}:{}};if(c.push({type:"turn_collapse",key:`tc-${p}`,turnCollapse:R}),!K){for(let Y=d+1;Y<=f;Y++){const W=e[Y];Y===y&&W.type==="message"&&W.message.role==="assistant"?c.push({...W,turnCollapse:R}):c.push(W)}continue}for(let Y=d+1;Y<=f;Y++){const W=e[Y];if(!(Y===y&&b)){if(Y===y&&W.type==="message"&&W.message.role==="assistant"){c.push({...W,turnCollapse:R});continue}aK(W,Y===y)||c.push(W)}}}return c}function Xj(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=>xd(i,n)))return s}else{if(r.type==="parallel_agents"&&n&&r.agents.some(i=>xd(i,n)))return s;if(r.type==="turn_outputs")continue}}return-1}function dK(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=>xd(s,n)):e.type==="parallel_agents"?!!n&&e.agents.some(s=>xd(s,n)):(e.type==="turn_outputs",!1)}const Qj=0,Llt=120,Plt=80,Olt=32,$lt=240,vC=30,hK=48,Vhe=200,Blt=4;function zlt(e,t=Vhe){return e>t}function Flt(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 Jj(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function qlt(e){return e!==void 0&&e>0?Flt(e):""}function Hlt(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";const n=e.cachedTokens??0,s=n>0&&e.inputTokens>0?` (${Jj(n)} ${t("turn.cached")}, ${Math.round(n/e.inputTokens*100)}%)`:"";return`↑${Jj(e.inputTokens)}${s} ↓${Jj(e.outputTokens)}`}function fK(e,t){const n=[],s=Hlt(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 Ult(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}const Wlt=h.memo(function({turnCollapse:t,onToggleCollapse:n}){const{t:s}=nt(),r=t.hiddenCount>0,i=t.liveStartedAt,o=r||i!==void 0||Ult(t),l=QP(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,l-i)),d=c.current):o&&t.elapsedMs!==void 0?(c.current=0,d=t.elapsedMs):(c.current=0,d=void 0);const f=qlt(d),m=fK(t,s),p=fK(t,s),g=s(i!==void 0?"turn.processing":"turn.processed"),b=!!f&&o,w=!!m&&o,y=!!p&&o;if(!o)return null;const v=()=>{if(!r)return;const x=t.collapsed;n(t.turnId,x)};return a.jsxs("div",{className:r?`${rd.collapseRow} ${rd.collapseRowClickable}`:rd.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?v:void 0,onKeyDown:r?x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),v())}:void 0,children:[a.jsxs("span",{className:rd.collapseLabel,children:[a.jsxs("span",{className:rd.processedLabel,children:[g,b&&a.jsxs("span",{className:rd.processedMeta,children:[" ",f]})]}),y&&a.jsx("span",{className:rd.summaryMetrics,children:p}),w&&a.jsx("span",{className:rd.hiddenMetrics,children:m})]}),r&&a.jsx("span",{"data-testid":`toggle-${t.turnId}`,className:rd.collapseIcon,onClick:x=>{x.stopPropagation(),v()},children:a.jsx("span",{className:t.collapsed?rd.chevronRight:rd.chevronDown,"aria-hidden":"true"})})]})});function Vlt(e){if(e.type==="turn_collapse")return Ls.turnStatusRow;if(e.type==="turn_outputs")return Ls.turnContentRow;if(e.type==="message"&&e.turnCollapse)return Ls.turnAnswerRow}const Glt={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},Klt=["--background","--foreground","--muted-foreground","--border","--font-sans"],mK="session-timeline-detail-tooltip",Ylt=h.memo(function({entries:t,currentTurnId:n,currentRange:s,hidden:r,onSelect:i}){const o=Gu(),{t:l}=nt(),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,w]=h.useState(null),y=s!==null?s.currentIndex:t.findIndex(E=>E.id===n),v=h.useCallback(()=>w(null),[]),x=h.useCallback(()=>{f.current||m.current||v()},[v]),k=h.useCallback((E,O)=>{const B=c.current;if(!B)return null;const D=getComputedStyle(B),j=O.getBoundingClientRect();return{entry:E,top:j.top+j.height/2,left:j.right+8,clamped:!1,themeVars:Object.fromEntries(Klt.map(L=>[L,D.getPropertyValue(L)]))}},[]),_=h.useCallback(E=>{const O=u.current;if(!O)return null;const B=Array.from(O.querySelectorAll('[data-testid="session-timeline-entry"]')).find(D=>D.getAttribute("data-turn-id")===E.id);return(B==null?void 0:B.querySelector("button"))??null},[]),T=h.useCallback(E=>{const O=u.current;if(!O)return!1;const B=O.getBoundingClientRect(),D=E.getBoundingClientRect();return D.bottom>=B.top&&D.top<=B.bottom},[]),S=h.useCallback(()=>{w(E=>{if(!E)return null;const O=_(E.entry);return!O||!T(O)?null:k(E.entry,O)})},[k,_,T]),C=h.useCallback((E,O)=>{w(k(E,O))},[k]),N=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,S()}),g.current=window.setTimeout(()=>{g.current=null,m.current=!1},100))},[S]);return h.useLayoutEffect(()=>{if(r)return;const E=u.current;if(!E||y<0)return;const O=E.querySelector(`[data-timeline-index="${y}"]`);if(!O)return;const B=O.offsetTop+O.offsetHeight/2,D=E.scrollHeight-E.clientHeight,j=Math.max(0,Math.min(B-E.clientHeight/2,D));if(E.scrollTop===j)return;f.current=!0,E.scrollTop=j;const L=window.requestAnimationFrame(()=>{f.current=!1,S()}),z=window.setTimeout(()=>{f.current=!1},100);return()=>{window.cancelAnimationFrame(L),window.clearTimeout(z),f.current=!1}},[y,r,S]),h.useLayoutEffect(()=>{if(!(!b||typeof window>"u"))return window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)}},[S,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 E=c.current,O=d.current;if(!E||!O||typeof window>"u")return;const B=O.getBoundingClientRect(),D=12;let j=b.top;B.top<D?j+=D-B.top:B.bottom>window.innerHeight-D&&(j-=B.bottom-(window.innerHeight-D)),j!==b.top&&w(L=>(L==null?void 0:L.entry.id)===b.entry.id?{...L,top:j,clamped:!0}:L)},[b]),r||t.length===0?null:a.jsx("div",{className:Ls.sessionTimelineLayer,"aria-hidden":"false",children:a.jsxs("nav",{ref:c,className:Ls.sessionTimelinePanel,"aria-label":l("timeline.sessionTimeline"),"data-testid":"session-timeline",onMouseLeave:v,children:[a.jsx("div",{ref:u,className:Ls.sessionTimelineViewport,"data-testid":"session-timeline-viewport",onScroll:x,children:a.jsx("ol",{className:Ls.sessionTimelineList,children:t.map((E,O)=>{const B=s!==null&&O>=s.startIndex&&O<=s.endIndex,D=s!==null?O===s.currentIndex:E.id===n,j=E.nodeKinds.join(","),L=[`${l("timeline.turnPrefix",{index:O+1})}: ${E.label}`,D?l("timeline.currentTurn"):null].filter(Boolean).join(". "),z=K=>C(E,K.currentTarget),I=K=>{N(),C(E,K.currentTarget)},$=(b==null?void 0:b.entry.id)===E.id;return a.jsx("li",{className:Ls.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":E.id,"data-timeline-index":O,"data-node-kinds":j,"data-in-current-range":B?"true":void 0,children:a.jsx("button",{type:"button",className:vR(Ls.sessionTimelineButton,B?Ls.sessionTimelineButtonInRange:void 0,D?Ls.sessionTimelineButtonCurrent:void 0),"aria-current":D?"step":void 0,"aria-describedby":$?mK:void 0,"aria-label":L,onClick:()=>i(E.id),onFocus:I,onBlur:v,onMouseEnter:z,onMouseLeave:v,children:a.jsx("span",{className:Ls.sessionTimelineTick})})},E.id)})})}),b&&typeof document<"u"&&kd.createPortal(a.jsxs("div",{ref:d,className:Ls.sessionTimelineDetails,id:mK,"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:[a.jsxs("span",{className:Ls.sessionTimelineDetailsTitle,children:[b.entry.isScheduledTask&&a.jsx(wlt,{}),a.jsx("span",{className:Ls.sessionTimelineDetailsTitleText,children:b.entry.label})]}),a.jsx("span",{className:Ls.sessionTimelineDetailsDetail,children:b.entry.detail})]}),o??document.body)]})})});function vR(...e){return e.filter(Boolean).join(" ")||void 0}const Xlt=[];function Qlt({label:e}){return a.jsxs(a.Fragment,{children:[a.jsx("div",{role:"status","aria-live":"polite",className:Ls.srOnly,children:e}),a.jsxs("div",{className:Ls.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[a.jsx("div",{className:Ls.loadingSkeletonUserRow,children:a.jsxs("div",{className:Ls.loadingSkeletonUserBubble,children:[a.jsx("span",{className:Ls.loadingSkeletonLineWide}),a.jsx("span",{className:Ls.loadingSkeletonLineShort})]})}),a.jsx("div",{className:Ls.loadingSkeletonAssistantRow,children:a.jsxs("div",{className:Ls.loadingSkeletonAssistantBlock,children:[a.jsx("span",{className:Ls.loadingSkeletonLineMedium}),a.jsx("span",{className:Ls.loadingSkeletonLineWide}),a.jsx("span",{className:Ls.loadingSkeletonLineNarrow})]})}),a.jsx("div",{className:Ls.loadingSkeletonUserRow,children:a.jsx("div",{className:Ls.loadingSkeletonUserBubbleCompact,children:a.jsx("span",{className:Ls.loadingSkeletonLineMedium})})}),a.jsx("div",{className:Ls.loadingSkeletonAssistantRow,children:a.jsxs("div",{className:Ls.loadingSkeletonAssistantBlock,children:[a.jsx("span",{className:Ls.loadingSkeletonLineWide}),a.jsx("span",{className:Ls.loadingSkeletonLineMedium})]})})]})]})}const rO=h.memo(h.forwardRef(function({messages:t,pendingApproval:n,onShowContextDetail:s,loadingTranscript:r,catchingUp:i,hasOlderHistory:o=!1,loadingOlderHistory:l=!1,historyCapacityReached:c=!1,historyPaginationError:u=!1,onLoadOlderHistory:d,transcriptBlockCount:f=0,transcriptActivity:m,onReloadTranscript:p,isResponding:g=!1,activeTurnStartedAt:b,welcomeHeader:w,centerWelcomeHeader:y=!1,workspaceCwd:v,tailContent:x,tailKey:k="tail",virtualScrollThreshold:_=Vhe,autoScrollTailIntoView:T=!1,bottomOverlayInset:S=0,hideSessionTimeline:C=!1,hideFirstUserMessage:N=!1,firstTurnMetrics:E,includeSubagentToolUsageInMetrics:O=!0,showRetryHint:B=!1,onRetryClick:D,failedPromptMessageId:j,onRetryFailedPrompt:L,onBranchSession:z,onCanScrollToBottomChange:I,turnFileChanges:$,turnArtifacts:K,turnScheduledTasks:R,onReviewChanges:Y,onOpenArtifact:W,onOpenScheduledTask:M,onTurnOutputOpen:F,onError:J,generateContent:V},U){var Cr;const{t:le}=nt(),pe=h.useContext(i1),fe=h.useMemo(()=>pe?olt(t,n):t,[pe,t,n]),Q=h.useMemo(()=>llt(Hhe(fe),g,$,K,R),[fe,g,$,K,R]),[ne,de]=h.useState(!1),ue=h.useRef(null),me=h.useMemo(()=>{var ut,Ht;if(!ne)return Xlt;const $e=klt(fe);return(((ut=ue.current)==null?void 0:ut.signature)!==$e||((Ht=ue.current)==null?void 0:Ht.t)!==le)&&(ue.current={signature:$e,t:le,entries:vlt(fe,le)}),ue.current.entries},[ne,fe,le]),te=h.useMemo(()=>new Map(me.map(($e,ut)=>[$e.id,ut])),[me]),ae=h.useMemo(()=>ilt(fe),[fe]),[be,se]=h.useState(null),ve=be!==null?((Cr=me[be.currentIndex])==null?void 0:Cr.id)??ae:ae,ze=h.useMemo(()=>{var $e;if(g)return null;for(let ut=fe.length-1;ut>=0;ut-=1){const Ht=fe[ut];if(Ht&&(Ht.role==="tool_group"||Ht.role==="plan"))return null;if((Ht==null?void 0:Ht.role)==="assistant"&&!Ht.isStreaming&&(($e=Ht.content)!=null&&$e.trim()))return Ht.id}return null},[g,fe]),Pe=h.useMemo(()=>ult(Q,g),[Q,g]),{collapseCompletedTurns:_t}=Vu(),Pt=_t??!0,[St,he]=h.useState(()=>new Map),[Ae,rt]=h.useTransition(),dt=h.useRef(!1),jt=h.useRef(new Map),et=h.useRef(void 0),Mt=h.useRef([]),sn=h.useRef(!0),Ye=h.useRef(!1),$n=h.useRef(0),Te=h.useRef(0),ie=h.useRef(!1),it=h.useRef(!1),we=h.useRef(0),We=h.useRef(null),ce=h.useRef(null),De=h.useRef(!1),ct=h.useRef(null),qe=h.useRef(!1),Ve=h.useRef(r),Qt=h.useRef(!!r),Un=h.useRef(void 0),Ie=h.useRef(void 0),wt=h.useRef(S),Wt=h.useRef(null),Me=h.useRef(i),Je=h.useRef(i),pt=h.useRef(!1),ln=h.useRef(!1),Bn=h.useRef(void 0),ns=h.useRef(void 0);Je.current=i;const lt=h.useRef(null),Xe=h.useRef(!1),ot=h.useRef(void 0),Tt=h.useRef(void 0),fn=h.useRef(void 0),Qn=h.useRef(f),Os=h.useRef(g);Qn.current=f,Os.current=g;const rr=h.useRef(null),[Es,cs]=h.useState(null),[$t,xs]=h.useState(!1);h.useLayoutEffect(()=>{if(!Es)return;const $e=lt.current;$e&&($e.scrollTop=Es.scrollTop+Math.max(0,$e.scrollHeight-Es.scrollHeight)),ie.current=!1,cs(null)},[Es]),h.useEffect(()=>{o||(Xe.current=!1,rr.current=null)},[o]);const Ce=h.useCallback(()=>{const $e=lt.current,ut=$e?$e.scrollHeight-$e.scrollTop-$e.clientHeight:0,Ht=!sn.current&&ut>1;ce.current!==Ht&&(ce.current=Ht,I==null||I(Ht))},[I]),mn=h.useCallback(()=>{ns.current!==void 0&&window.cancelAnimationFrame(ns.current),ns.current=window.requestAnimationFrame(Ce)},[Ce]),gt=h.useCallback($e=>{sn.current!==$e&&(sn.current=$e,mn())},[mn]),wn=h.useMemo(()=>{var an;const $e=Dlt(Q,{overrides:St,isResponding:g,activeTurnStartedAt:b,pendingApprovalCallId:(n==null?void 0:n.toolCallId)??null,includeSubagentToolUsageInMetrics:O,enabled:Pt});let ut=!1;const Ht=E?$e.map(Be=>ut||Be.type!=="turn_collapse"?Be:(ut=!0,{...Be,turnCollapse:{...Be.turnCollapse,...E.durationMs!==void 0&&E.durationMs>0?{elapsedMs:E.durationMs}:{},...E.inputTokens!==void 0?{inputTokens:E.inputTokens}:{},...E.outputTokens!==void 0?{outputTokens:E.outputTokens}:{},...E.cachedTokens!==void 0?{cachedTokens:E.cachedTokens}:{}}})):$e;if(!N)return Ht;const pn=(an=fe.find(Be=>Be.role==="user"))==null?void 0:an.id;return pn?Ht.filter(Be=>Be.type!=="message"||Be.message.id!==pn):Ht},[Q,St,g,b,n==null?void 0:n.toolCallId,Pt,N,E,O,fe]),Wn=h.useMemo(()=>Whe(wn),[wn]),di=me.length>=Blt;h.useLayoutEffect(()=>{if(C){de(pn=>pn&&!1);return}const $e=lt.current;if(!$e)return;const ut=()=>{const an=$e.getBoundingClientRect().width>=1160;de(Be=>Be===an?Be:an)};if(ut(),typeof ResizeObserver>"u")return;const Ht=new ResizeObserver(ut);return Ht.observe($e),()=>Ht.disconnect()},[C]);const $s=x!=null,Gr=!!r,Gs=!!w,Ks=Gs?1:0,Qr=Ks+wn.length,Rt=Qr+($s?1:0),Ii=Ks+Q.length+($s?1:0),uo=zlt(Ii,_),Or=h.useCallback(()=>lt.current,[]),hi=h.useCallback(()=>{const $e=lt.current;if(!$e)return;const Ht=$e.scrollHeight-$e.scrollTop-$e.clientHeight<vC;Ye.current=!Ht,gt(Ht),mn()},[mn,gt]),us=h.useCallback(()=>{$n.current=Date.now()+1e3},[]),Jt=h.useCallback(()=>{ot.current!==void 0&&(window.clearTimeout(ot.current),ot.current=void 0)},[]),Ys=h.useCallback(()=>{var $e;Jt(),($e=Tt.current)==null||$e.abort(),Tt.current=void 0},[Jt]),Bs=h.useCallback(()=>{Jt();const $e=fn.current;if($e){if((m==null?void 0:m.getSnapshot().lastEventId)===$e.lastEventId&&Qn.current<=$e.blockCount)return;fn.current=void 0}!p||Tt.current!==void 0||Ye.current||Os.current||Qn.current<=fSe||(ot.current=window.setTimeout(()=>{ot.current=void 0;const ut=lt.current;if(!ut||ut.scrollHeight-ut.scrollTop-ut.clientHeight>=vC)return;const pn=new AbortController;Tt.current=pn,p(pn.signal).then(()=>{var Be;if(pn.signal.aborted)return;const an=m==null?void 0:m.getSnapshot();fn.current={...(an==null?void 0:an.lastEventId)!==void 0?{lastEventId:an.lastEventId}:{},blockCount:((Be=an==null?void 0:an.blocks)==null?void 0:Be.length)??Qn.current}}).catch(an=>{an instanceof Error&&an.name==="AbortError"||console.warn("[MessageList] transcript reload failed:",an)}).finally(()=>{Tt.current===pn&&(Tt.current=void 0)})},nlt))},[Jt,p,m]);h.useEffect(()=>{fn.current=void 0},[m]),h.useEffect(()=>{if(!m)return Ys;let $e=m.getSnapshot().lastEventId;const ut=m.subscribe(()=>{const Ht=m.getSnapshot().lastEventId;Ht!==$e&&($e=Ht,Bs())});return()=>{ut(),Ys()}},[m,Bs,Ys]),h.useEffect(()=>{Bs()},[g,Bs,f]);const ho=h.useCallback(()=>{ln.current=!0,Bn.current!==void 0&&window.cancelAnimationFrame(Bn.current),Bn.current=window.requestAnimationFrame(()=>{ln.current=!1,Bn.current=void 0,hi()})},[hi]);h.useEffect(()=>()=>{Bn.current!==void 0&&window.cancelAnimationFrame(Bn.current),ns.current!==void 0&&window.cancelAnimationFrame(ns.current),Ys(),Un.current!==void 0&&window.cancelAnimationFrame(Un.current),Ie.current!==void 0&&window.cancelAnimationFrame(Ie.current)},[Ys]);const Si=h.useCallback(($e,ut)=>{var pn;const Ht=lt.current;(!Ht||Ht.scrollHeight>Ht.clientHeight+1)&&(Ye.current=!0,gt(!1)),ho(),et.current!==void 0&&window.clearTimeout(et.current),jt.current.clear(),(pn=lt.current)==null||pn.querySelectorAll("[data-message-row-key]").forEach(an=>{const Be=an.dataset.messageRowKey;Be&&jt.current.set(Be,an.getBoundingClientRect().top)}),dt.current=!0,rt(()=>{he(an=>{const Be=new Map(an);return Be.set($e,ut),Be})})},[ho,gt]);h.useLayoutEffect(()=>{var ut;if(Ae||!dt.current)return;dt.current=!1;for(const Ht of Mt.current)Ht.cancel();Mt.current=[];const $e=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;$e||(ut=lt.current)==null||ut.querySelectorAll("[data-message-row-key]").forEach(Ht=>{if(typeof Ht.animate!="function")return;const pn=Ht.dataset.messageRowKey,an=pn?jt.current.get(pn):void 0;if(an===void 0){Mt.current.push(Ht.animate([{opacity:0},{opacity:1}],{duration:Vj,easing:"ease-out"}));return}const Be=an-Ht.getBoundingClientRect().top;Math.abs(Be)<1||Mt.current.push(Ht.animate([{translate:`0 ${Be}px`},{translate:"0 0"}],{duration:Vj,easing:"ease-out"}))}),jt.current.clear(),et.current=window.setTimeout(()=>{et.current=void 0,ho()},$e?0:Vj)},[ho,Ae]),h.useEffect(()=>()=>{et.current!==void 0&&window.clearTimeout(et.current);for(const $e of Mt.current)$e.cancel();Mt.current=[]},[]);const si=h.useCallback($e=>{const ut=$e.target;ut instanceof HTMLElement&&ut.closest("[aria-expanded]")&&(Ye.current=!0,gt(!1),ho())},[ho,gt]),pr=h.useCallback($e=>{if(Gs&&$e===Qj)return"slot:header";if($s&&$e===Qr)return`slot:tail:${k}`;const ut=wn[$e-Ks];return ut?alt(ut):`slot:row:${$e}`},[Gs,$s,Qr,k,wn,Ks]),xe=h.useCallback(($e="auto")=>{const ut=Or();if(!ut||ut.scrollHeight<=ut.clientHeight)return;we.current+=1;const Ht=we.current;it.current=!0,$e==="smooth"?ut.scrollTo({top:ut.scrollHeight,behavior:$e}):ut.scrollTop=ut.scrollHeight,mn(),Te.current=Math.max(0,ut.scrollHeight-ut.clientHeight),Ce();const pn=()=>{we.current===Ht&&(it.current=!1)};$e==="smooth"?setTimeout(pn,350):requestAnimationFrame(pn)},[Or,Ce,mn]),Ge=h.useCallback(($e="smooth")=>{Ye.current=!1,gt(!0),xe($e)},[xe,gt]),tt=RSe({count:Rt,enabled:uo,getScrollElement:Or,getItemKey:pr,estimateSize:$e=>{if(Gs&&$e===Qj)return Llt;if($s&&$e===Qr)return $lt;const ut=wn[$e-Ks];return(ut==null?void 0:ut.type)==="turn_collapse"?Olt:Plt},overscan:20,useFlushSync:!1,useAnimationFrameWithResizeObserver:!0}),Zt=tt.getVirtualItems(),Tn=tt.getTotalSize(),Gn=h.useRef({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});Gn.current={entryIndexById:te,headerOffset:Ks,isVisible:ne,turnIdByDisplayIndex:Wn,visibleItems:wn};const Jr=h.useCallback(()=>{const $e=Or(),ut=Gn.current;if(!$e||!ut.isVisible||ut.entryIndexById.size===0){se(hn=>hn===null?hn:null);return}const Ht=$e.getBoundingClientRect(),pn=Ht.top,an=Ht.bottom,Be=pn+(an-pn)/2,cn=[];let Jn=null,Us=Number.POSITIVE_INFINITY;$e.querySelectorAll("[data-index]").forEach(hn=>{const Tr=hn.dataset.index;if(Tr===void 0)return;const br=Number(Tr);if(!Number.isFinite(br))return;const Lo=br-ut.headerOffset;if(Lo<0||Lo>=ut.visibleItems.length)return;const Js=hn.getBoundingClientRect();if(Js.bottom<pn||Js.top>an)return;cn.push(Lo);const Er=Js.top+(Js.bottom-Js.top)/2,To=Math.abs(Er-Be);To<Us&&(Us=To,Jn=Lo)});const dn=Mlt(ut.visibleItems,cn,ut.entryIndexById,Jn,ut.turnIdByDisplayIndex);se(hn=>(hn==null?void 0:hn.startIndex)===(dn==null?void 0:dn.startIndex)&&(hn==null?void 0:hn.endIndex)===(dn==null?void 0:dn.endIndex)&&(hn==null?void 0:hn.currentIndex)===(dn==null?void 0:dn.currentIndex)?hn:dn)},[Or]),zs=h.useCallback(()=>{We.current!==null&&cancelAnimationFrame(We.current),We.current=requestAnimationFrame(()=>{We.current=null,Jr()})},[Jr]);h.useEffect(()=>()=>{We.current!==null&&(cancelAnimationFrame(We.current),We.current=null)},[]),h.useEffect(()=>{zs()},[zs,Rt,Tn,uo,Zt.length,ne]);const[vs,$r]=h.useState(null);h.useEffect(()=>{if(!vs)return;const $e=setTimeout(()=>$r(null),1600);return()=>clearTimeout($e)},[vs]);const Xs=h.useCallback(($e,ut)=>{var pn,an;Ye.current=!0,gt(!1),we.current+=1;const Ht=we.current;it.current=!0,uo?tt.scrollToIndex($e,{align:"center"}):(an=(pn=lt.current)==null?void 0:pn.querySelector(`[data-index="${$e}"]`))==null||an.scrollIntoView({block:"center"}),setTimeout(()=>{we.current===Ht&&(it.current=!1,zs(),mn())},150),$r(null),requestAnimationFrame(()=>$r(ut))},[uo,tt,gt,zs,mn]),fs=h.useRef({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});fs.current={visibleItems:wn,displayItems:Q,headerOffset:Ks,performScrollToRow:Xs};const ks=h.useRef(null),gr=h.useCallback(($e,ut)=>{const{visibleItems:Ht,displayItems:pn,headerOffset:an,performScrollToRow:Be}=fs.current,cn=Xj(Ht,$e,ut);if(cn>=0)return ks.current=null,Be(cn+an,{messageId:$e,callId:ut}),!0;const Jn=Xj(pn,$e,ut);if(Jn<0)return!1;const Us=Uhe(pn,Jn);return Us?(ks.current={messageId:$e,callId:ut},he(dn=>{if(dn.get(Us)===!0)return dn;const hn=new Map(dn);return hn.set(Us,!0),hn}),!0):!1},[]);h.useImperativeHandle(U,()=>({scrollToMessage:gr,scrollToBottom:Ge}),[gr,Ge]),h.useEffect(()=>{const $e=ks.current;if(!$e)return;const ut=Xj(wn,$e.messageId,$e.callId);ut<0||(ks.current=null,Xs(ut+Ks,$e))},[wn,Ks,Xs]);const Vt=h.useCallback(async($e=!1)=>{const ut=lt.current;if(!ut||!d||l||ie.current||u||Xe.current&&!$e)return;Xe.current=!1,ie.current=!0,xs(!$e);const Ht=ut.scrollHeight,pn=ut.scrollTop;Ye.current=!0;try{await d(),cs({scrollHeight:Ht,scrollTop:pn})}catch{Xe.current=!0,ie.current=!1}finally{xs(!1)}},[l,d,u]),Sr=h.useCallback(()=>{const $e=Or();if(!$e)return;const ut=$e.scrollTop;if(o&&ut<=hK&&Vt(!0),it.current){Te.current=ut;return}zs();const Ht=Te.current;Te.current=ut;const pn=$e.scrollHeight-ut-$e.clientHeight;if(mn(),ut<Ht-1){const an=pn<vC,Be=Date.now()<=$n.current;an?(Ye.current=!1,gt(!0)):Be?(Ys(),Ye.current=!0,gt(!1)):Ye.current||(Ys(),gt(!1));return}pn<vC?(Ye.current=!1,gt(!0),Bs()):Ys()},[Or,o,Vt,mn,zs,Bs,Ys,gt]);h.useEffect(()=>{const $e=Or();if($e)return $e.addEventListener("scroll",Sr,{passive:!0}),()=>$e.removeEventListener("scroll",Sr)},[Or,Sr]);const ir=h.useCallback(()=>{if(!o||l||i||Gr)return;const $e=Or();if(!$e||$e.scrollHeight>$e.clientHeight+1)return;const ut=rr.current;if(ut!==null&&ut.loader===d&&ut.totalVirtualSize===Tn){Xe.current=!0;return}rr.current={loader:d,totalVirtualSize:Tn},Vt()},[i,Or,o,Vt,l,d,Gr,Tn]);h.useEffect(()=>{ir()},[ir,Tn]),h.useEffect(()=>{const $e=Or();if(!$e)return;const ut=()=>{Xe.current&&$e.scrollTop<=hK&&Vt(!0)},Ht=cn=>{us(),cn.deltaY<0&&ut()},pn=()=>{us(),ut()},an=cn=>{const Jn=$e.getBoundingClientRect(),Us=20;(cn.clientX>=Jn.right-Us||cn.clientY>=Jn.bottom-Us)&&us()},Be=cn=>{(cn.key==="ArrowUp"||cn.key==="ArrowDown"||cn.key==="PageUp"||cn.key==="PageDown"||cn.key==="Home"||cn.key==="End"||cn.key===" ")&&(us(),(cn.key==="ArrowUp"||cn.key==="PageUp"||cn.key==="Home")&&ut())};return $e.addEventListener("wheel",Ht,{passive:!0}),$e.addEventListener("touchstart",pn,{passive:!0}),$e.addEventListener("pointerdown",an,{passive:!0}),$e.addEventListener("keydown",Be,{passive:!0}),()=>{$e.removeEventListener("wheel",Ht),$e.removeEventListener("touchstart",pn),$e.removeEventListener("pointerdown",an),$e.removeEventListener("keydown",Be)}},[Or,Vt,us]),h.useEffect(()=>{const $e=Or();if(!$e||typeof ResizeObserver>"u")return;const ut=new ResizeObserver(()=>{mn(),ir()});ut.observe($e);for(const pn of Array.from($e.children))ut.observe(pn);const Ht=new MutationObserver(pn=>{for(const an of pn){for(const Be of Array.from(an.addedNodes))Be instanceof HTMLElement&&ut.observe(Be);for(const Be of Array.from(an.removedNodes))Be instanceof HTMLElement&&ut.unobserve(Be)}mn()});return Ht.observe($e,{childList:!0}),mn(),()=>{ut.disconnect(),Ht.disconnect()}},[Or,ir,mn]),h.useEffect(()=>{t.length===0&&(Ye.current=!1,gt(!0),ks.current=null,he($e=>$e.size?new Map:$e))},[t.length,gt]),h.useEffect(()=>{const $e=lt.current;if(!$e)return;const ut=new ResizeObserver(()=>{zs(),!Je.current&&(Ye.current||(gt(!0),requestAnimationFrame(()=>{!Je.current&&!Ye.current&&xe()})))});return ut.observe($e),()=>ut.disconnect()},[xe,zs,gt]),h.useLayoutEffect(()=>{const $e=slt(t);if(i||r||Ve.current){ct.current=$e,De.current=!0,qe.current=!1,Ve.current=r;return}if(Ve.current=r,!De.current){ct.current=$e,De.current=!0,qe.current=!1;return}const ut=rlt(t);$e&&(ut==null?void 0:ut.role)==="user"&&$e!==ct.current?(Ye.current=!1,gt(!0),ks.current=null,qe.current=!0):qe.current=!1,ct.current=$e},[t,i,r,gt]),h.useLayoutEffect(()=>{Me.current&&!i&&(Ye.current=!1,gt(!0),xe("auto")),Me.current=i},[i,xe,gt]),h.useLayoutEffect(()=>{if(r){Qt.current=!0;return}if(!Qt.current||i||t.length===0)return;Qt.current=!1,Ye.current=!1,gt(!0),ks.current=null,Un.current!==void 0&&window.cancelAnimationFrame(Un.current),Ie.current!==void 0&&window.cancelAnimationFrame(Ie.current);const $e=()=>{Je.current||Ye.current||(gt(!0),xe("auto"))};Un.current=window.requestAnimationFrame(()=>{Un.current=void 0,$e(),Ie.current=window.requestAnimationFrame(()=>{Ie.current=void 0,$e()})})},[i,r,t.length,xe,gt]),h.useLayoutEffect(()=>{const $e=wt.current!==S;wt.current=S,$e&&(i||Ye.current||(gt(!0),requestAnimationFrame(()=>{!Je.current&&!Ye.current&&xe("auto")})))},[S,i,xe,gt]);const Ot=h.useMemo(()=>Clt(wn),[wn]);h.useLayoutEffect(()=>{if(!i){if(!Ot){Wt.current=null;return}Ot!==Wt.current&&(Wt.current=Ot,(sn.current||!Ye.current)&&requestAnimationFrame(()=>{Ye.current||(gt(!0),xe())}))}},[i,Ot,xe,gt]),h.useEffect(()=>{T&&$s&&!pt.current&&(Ye.current=!1,gt(!0),requestAnimationFrame(()=>{Ye.current||xe()})),pt.current=$s},[T,$s,xe,gt]);const Ns=h.useCallback($e=>{const ut=(an,Be)=>{if(an.type==="parallel_agents")return a.jsx(Y7,{timestamp:an.timestamp,children:a.jsx("div",{className:dK(an,vs)?n0.flash:void 0,children:a.jsx(hat,{agents:an.agents,pendingApproval:n})})});if(an.type==="turn_outputs")return a.jsx(Pot,{changes:an.changes,turnId:an.turnId,artifacts:an.artifacts,scheduledTasks:an.scheduledTasks,workspaceCwd:v,onOpenRequest:F,onReviewChanges:Y??Wj,onOpenArtifact:W??Wj,onOpenScheduledTask:M??Wj,onError:J});if(an.type==="turn_collapse")return a.jsx(Wlt,{turnCollapse:an.turnCollapse,onToggleCollapse:Si});const cn=an.message.role==="assistant"?Pe.get(an.message.id):void 0;let Jn;return an.message.role==="assistant"&&cn&&(Jn={turnId:cn,message:{id:an.message.id,content:an.message.content,isStreaming:an.message.isStreaming,timestamp:an.message.timestamp}}),a.jsx(zit,{message:an.message,pendingApproval:n,onShowContextDetail:s,workspaceCwd:v,isLatest:Be,showRetryHint:B,onRetryClick:D,sendFailed:an.message.role==="user"&&an.message.id===j,onRetrySend:L,onBranchSession:z,showAssistantActions:an.message.role==="assistant"&&Pe.has(an.message.id),showAssistantBranch:an.message.role==="assistant"&&an.message.id===ze,isLocateFlashing:dK(an,vs),assistantTurnFooterInfo:Jn,generateContent:V})};if(Gs&&$e===Qj)return w;if($s&&$e===Qr)return x;const Ht=$e-Ks,pn=wn[Ht];return pn?ut(pn,Ht===wn.length-1):null},[Gs,w,$s,x,Qr,n,s,V,Ks,wn,vs,Pe,ze,v,B,D,j,L,z,Si,W,M,Y,F,J]),Qs=h.useCallback($e=>$e?Vlt($e):void 0,[]);return h.useLayoutEffect(()=>{if(i)return;const $e=qe.current;it.current&&!$e||ln.current&&!$e||(sn.current||$e||!Ye.current)&&(Ye.current||gt(!0),xe($e?"smooth":"auto"),qe.current=!1)},[Tn,t,Rt,i,xe,gt]),h.useLayoutEffect(()=>{mn()},[t,mn,Rt,Tn]),a.jsxs("div",{ref:lt,className:vR(Ls.list,Gs&&y?Ls.listWithWelcomeHeader:void 0),"data-web-shell-message-list":!0,onClickCapture:si,children:[Gr&&a.jsx(Qlt,{label:le("editor.sessionLoading")}),l&&!Gr&&!$t&&a.jsx("div",{className:Ls.historyStatus,role:"status",children:le("history.loadingEarlier")}),c&&!Gr&&a.jsx("div",{className:Ls.historyStatus,role:"status",children:le("history.capacityReached")}),u&&!Gr&&!c&&a.jsx("div",{className:Ls.historyStatus,role:"status",children:le("history.paginationError")}),a.jsx(Ylt,{entries:me,currentTurnId:ve,currentRange:be,hidden:!ne||!di,onSelect:gr}),uo?a.jsx("div",{className:Ls.virtualSizer,style:{height:Tn},children:Zt.map($e=>a.jsx("div",{"data-index":$e.index,ref:tt.measureElement,className:vR(Ls.virtualRow,Qs(wn[$e.index-Ks])),"data-message-row-key":String(pr($e.index)),"data-web-shell-message-row":!0,style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${$e.start}px)`},children:Ns($e.index)},$e.key))}):Array.from({length:Rt},($e,ut)=>{const Ht=pr(ut),pn=wn[ut-Ks];return a.jsx("div",{"data-index":ut,className:Qs(pn),"data-message-row-key":String(Ht),"data-web-shell-message-row":!0,children:Ns(ut)},Ht)})]})}));function Jlt(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 Ghe(e,t){const n=e.filter(i=>i.kind==="monitor"),s=n.find(i=>i.toolUseId===t.callId);if(s)return s;const r=Jlt(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 Zlt(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 ect(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||!Zlt(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 tct="voice_transcribe",Khe="workspace_qualified_voice",nct="workspace_qualified_rest_core",sct="workspace_settings",rct=new Set(["dynamic_workspace_registration","persistent_workspace_registration","scratch_workspace_registration","workspace_display_name","workspace_runtime_removal"]);function iO(e){return JSON.stringify(e)}function ict(e){return e.some(t=>rct.has(t)||t.startsWith("multi_workspace_")||t.startsWith("workspace_qualified_"))}function Yhe(e,t){return{...e,...t?{sessionId:t}:{},ownerKey:iO([e.workspaceKey,t?["session",t]:["draft"]])}}function Zj(e,t){return Yhe({route:"legacy-primary",...e?{cwd:e}:{},workspaceKey:iO(["legacy-primary",e??null]),streamPath:"voice/stream"},t)}function Xhe({capabilities:e,intendedCwd:t,sessionId:n,workspaces:s}){var l;if(!e)return;const r=s??e.workspaces,i=((l=r==null?void 0:r.find(c=>c.primary))==null?void 0:l.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 Zj(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=iO(["workspace-qualified",m.kind,m.value,u.cwd]);return Yhe({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:Zj(e.workspaceCwd,n);if(!t&&!ict(e.features))return Zj(void 0,n)}function oct(e,t){return e?t.includes(e.route==="legacy-primary"?tct:Khe):!1}function wC(e,t){return e?e.route==="legacy-primary"?!0:[Khe,nct,sct].every(n=>t.includes(n)):!1}function Z6(e,t){if(t.route==="workspace-qualified")return t.selector.kind==="id"?e.workspaceById(t.selector.value):e.workspaceByCwd(t.selector.value)}async function act(e,t){const n=t.route==="legacy-primary"?await e.workspaceVoice():await Z6(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 lct(e,t){const n=t.route==="legacy-primary"?await e.workspaceProviders():await Z6(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 cct(e,t){return t.route==="legacy-primary"?await e.workspaceSettings():await Z6(e,t).workspaceSettings()}async function uct(e,t,n,s){return t.route==="workspace-qualified"&&n==="workspace"?await Z6(e,t).setWorkspaceSetting("workspace","voiceModel",s):await e.setWorkspaceSetting(n,"voiceModel",s)}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */function dct(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,l=h.useRef(o);l.current=o;const[c,u]=h.useState({ownerKey:i,status:void 0}),d=h.useCallback(async()=>{const g=o;if(l.current!==g)return;const b=++r.current;if(!g||!i||!t||t.route!=="workspace-qualified"){u({ownerKey:i,status:void 0});return}u(w=>w.ownerKey===i?w:{ownerKey:i,status:void 0});try{const w=await cct(e,t);return b===r.current&&l.current===g&&u({ownerKey:i,status:w}),w}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 Qhe="(prefers-reduced-motion: reduce)";function hct(){return typeof window<"u"&&window.matchMedia(Qhe).matches}function oO(){const[e,t]=h.useState(hct);return h.useEffect(()=>{const n=window.matchMedia(Qhe),s=()=>t(n.matches);return s(),n.addEventListener("change",s),()=>n.removeEventListener("change",s)},[]),e}const fct="_editorShell_9yj6l_1",mct="_editorShellDropdownOpen_9yj6l_7",pct="_container_9yj6l_11",gct="_content_9yj6l_26",bct="_specularEffect_9yj6l_42",yct="_atPortalLayer_9yj6l_83",vct="_slashPanel_9yj6l_111",wct="_slashPanelBody_9yj6l_120",xct="_slashList_9yj6l_125",kct="_slashEntry_9yj6l_152",_ct="_slashSection_9yj6l_158",Sct="_slashSectionHeader_9yj6l_164",Cct="_slashSectionCount_9yj6l_177",Tct="_slashItem_9yj6l_185",Ect="_slashItemActive_9yj6l_211",Act="_slashCommand_9yj6l_215",jct="_slashDetail_9yj6l_220",Nct="_slashDetailCommand_9yj6l_230",Ict="_slashDetailText_9yj6l_240",Mct="_slashDescription_9yj6l_260",Rct="_atPanel_9yj6l_272",Dct="_atPanelHeaderWrap_9yj6l_296",Lct="_atPanelHeader_9yj6l_296",Pct="_atBackButton_9yj6l_311",Oct="_atPanelTitle_9yj6l_333",$ct="_atTabsWrap_9yj6l_342",Bct="_atTabs_9yj6l_342",zct="_atTab_9yj6l_342",Fct="_atTabScrollButton_9yj6l_366",qct="_atTabActive_9yj6l_398",Hct="_atSearchInput_9yj6l_409",Uct="_atList_9yj6l_428",Wct="_atItem_9yj6l_456",Vct="_atItemActive_9yj6l_478",Gct="_atItemSingleLine_9yj6l_482",Kct="_atItemMain_9yj6l_488",Yct="_atItemLeading_9yj6l_499",Xct="_atItemIcon_9yj6l_509",Qct="_atItemImageIcon_9yj6l_520",Jct="_atItemIconSpin_9yj6l_528",Zct="_atItemLabel_9yj6l_532",eut="_atItemSubtitle_9yj6l_533",tut="_atItemDescription_9yj6l_560",nut="_atItemTrailing_9yj6l_571",sut="_atEmpty_9yj6l_578",rut="_attachments_9yj6l_584",iut="_tags_9yj6l_594",out="_tag_9yj6l_594",aut="_tagContent_9yj6l_617",lut="_tagTooltip_9yj6l_625",cut="_tagLabel_9yj6l_649",uut="_tagValue_9yj6l_650",dut="_tagIcon_9yj6l_654",hut="_tagRemove_9yj6l_689",fut="_editorArea_9yj6l_709",mut="_typewriterPlaceholder_9yj6l_720",put="_typewriterCaret_9yj6l_733",gut="_typewriterCaretFinished_9yj6l_743",but="_mobileTextarea_9yj6l_751",yut="_shellPrefix_9yj6l_801",vut="_toolbar_9yj6l_871",wut="_toolbarLeading_9yj6l_881",xut="_toolbarStart_9yj6l_882",kut="_toolbarEnd_9yj6l_883",_ut="_toolbarLeft_9yj6l_884",Sut="_toolbarRight_9yj6l_885",Cut="_gitBranchChip_9yj6l_918",Tut="_gitBranchChipButton_9yj6l_935",Eut="_gitBranchIcon_9yj6l_953",Aut="_gitBranchText_9yj6l_965",jut="_gitBranchIconWrap_9yj6l_980",Nut="_gitBranchBadgeDot_9yj6l_988",Iut="_gitBranchIndicators_9yj6l_1007",Mut="_gitBranchDirtyDot_9yj6l_1014",Rut="_gitBranchAheadBehind_9yj6l_1022",Dut="_gitBranchStash_9yj6l_1027",Lut="_gitBranchConflicted_9yj6l_1040",Put="_gitBranchOperation_9yj6l_1054",Out="_gitBranchTooltip_9yj6l_1062",$ut="_gitBranchTooltipTitle_9yj6l_1068",But="_gitBranchTooltipRow_9yj6l_1072",zut="_workspaceChip_9yj6l_1078",Fut="_workspaceChipAccented_9yj6l_1097",qut="_workspaceChipIcon_9yj6l_1101",Hut="_workspaceChipText_9yj6l_1117",Uut="_toolbarRightCustom_9yj6l_1129",Wut="_toolbarMeasurements_9yj6l_1135",Vut="_dropdownWrapper_9yj6l_1146",Gut="_dropdownWrapperCompact_9yj6l_1150",Kut="_dropdownList_9yj6l_1155",Yut="_dropdownListConstrained_9yj6l_1165",Xut="_dropdownEmpty_9yj6l_1169",Qut="_dropdownItem_9yj6l_1176",Jut="_dropdownRich_9yj6l_1193",Zut="_dropdownCheck_9yj6l_1202",edt="_dropdownItemActive_9yj6l_1214",tdt="_dropdownItemIcon_9yj6l_1219",ndt="_dropdownItemCheck_9yj6l_1220",sdt="_dropdownItemContent_9yj6l_1237",rdt="_dropdownItemLabel_9yj6l_1244",idt="_dropdownItemDesc_9yj6l_1254",odt="_toolBtn_9yj6l_1268",adt="_modeToolBtn_9yj6l_1286",ldt="_modelToolBtn_9yj6l_1287",cdt="_workspaceSelectTrigger_9yj6l_1296",udt="_gitBranchChipCompact_9yj6l_1331",ddt="_workspaceChipCompact_9yj6l_1332",hdt="_workspaceSelectTriggerCompact_9yj6l_1333",fdt="_toolBtnCompact_9yj6l_1334",mdt="_toolBtnText_9yj6l_1354",pdt="_toolBtnArrow_9yj6l_1355",gdt="_toolBtnIcon_9yj6l_1382",bdt="_widthModeBtn_9yj6l_1398",ydt="_quickActionsBtn_9yj6l_1407",vdt="_toolBtnModeIcon_9yj6l_1416",wdt="_toolBtnModelIcon_9yj6l_1417",xdt="_quickActionsPanel_9yj6l_1463",kdt="_quickActionsHeader_9yj6l_1476",_dt="_quickActionsLayout_9yj6l_1483",Sdt="_quickActionsGrid_9yj6l_1490",Cdt="_quickAction_9yj6l_1407",Tdt="_quickActionLabel_9yj6l_1521",Edt="_quickKeysGrid_9yj6l_1536",Adt="_quickKey_9yj6l_1536",jdt="_quickKeyLabel_9yj6l_1565",Ndt="_sendBtn_9yj6l_1578",Idt="_sendBtnRunning_9yj6l_1616",Mdt="_sendIcon_9yj6l_1629",Rdt="_stopIcon_9yj6l_1635",Ddt="_loadingIcon_9yj6l_1642",Ldt="_sendBtnArmed_9yj6l_1654",Pdt="_escLabel_9yj6l_1722",Odt="_srOnly_9yj6l_1730",$dt="_images_9yj6l_1752",Bdt="_imageThumb_9yj6l_1760",zdt="_imageRemove_9yj6l_1775",Fdt="_searchPanel_9yj6l_1796",qdt="_searchBar_9yj6l_1813",Hdt="_searchLabel_9yj6l_1821",Udt="_searchInput_9yj6l_1826",Wdt="_searchResults_9yj6l_1840",Vdt="_searchResult_9yj6l_1840",Gdt="_searchResultActive_9yj6l_1873",Kdt="_searchResultMarker_9yj6l_1878",Ydt="_searchResultText_9yj6l_1883",Xdt="_searchEmpty_9yj6l_1890",Ee={editorShell:fct,editorShellDropdownOpen:mct,container:pct,content:gct,specularEffect:bct,atPortalLayer:yct,slashPanel:vct,slashPanelBody:wct,slashList:xct,slashEntry:kct,slashSection:_ct,slashSectionHeader:Sct,slashSectionCount:Cct,slashItem:Tct,slashItemActive:Ect,slashCommand:Act,slashDetail:jct,slashDetailCommand:Nct,slashDetailText:Ict,slashDescription:Mct,atPanel:Rct,atPanelHeaderWrap:Dct,atPanelHeader:Lct,atBackButton:Pct,atPanelTitle:Oct,atTabsWrap:$ct,atTabs:Bct,atTab:zct,atTabScrollButton:Fct,atTabActive:qct,atSearchInput:Hct,atList:Uct,atItem:Wct,atItemActive:Vct,atItemSingleLine:Gct,atItemMain:Kct,atItemLeading:Yct,atItemIcon:Xct,atItemImageIcon:Qct,atItemIconSpin:Jct,atItemLabel:Zct,atItemSubtitle:eut,atItemDescription:tut,atItemTrailing:nut,atEmpty:sut,attachments:rut,tags:iut,tag:out,tagContent:aut,tagTooltip:lut,tagLabel:cut,tagValue:uut,tagIcon:dut,tagRemove:hut,editorArea:fut,typewriterPlaceholder:mut,typewriterCaret:put,typewriterCaretFinished:gut,mobileTextarea:but,shellPrefix:yut,toolbar:vut,toolbarLeading:wut,toolbarStart:xut,toolbarEnd:kut,toolbarLeft:_ut,toolbarRight:Sut,gitBranchChip:Cut,gitBranchChipButton:Tut,gitBranchIcon:Eut,gitBranchText:Aut,gitBranchIconWrap:jut,gitBranchBadgeDot:Nut,gitBranchIndicators:Iut,gitBranchDirtyDot:Mut,gitBranchAheadBehind:Rut,gitBranchStash:Dut,gitBranchConflicted:Lut,gitBranchOperation:Put,gitBranchTooltip:Out,gitBranchTooltipTitle:$ut,gitBranchTooltipRow:But,workspaceChip:zut,workspaceChipAccented:Fut,workspaceChipIcon:qut,workspaceChipText:Hut,toolbarRightCustom:Uut,toolbarMeasurements:Wut,dropdownWrapper:Vut,dropdownWrapperCompact:Gut,dropdownList:Kut,dropdownListConstrained:Yut,dropdownEmpty:Xut,dropdownItem:Qut,dropdownRich:Jut,dropdownCheck:Zut,dropdownItemActive:edt,dropdownItemIcon:tdt,dropdownItemCheck:ndt,dropdownItemContent:sdt,dropdownItemLabel:rdt,dropdownItemDesc:idt,toolBtn:odt,modeToolBtn:adt,modelToolBtn:ldt,workspaceSelectTrigger:cdt,gitBranchChipCompact:udt,workspaceChipCompact:ddt,workspaceSelectTriggerCompact:hdt,toolBtnCompact:fdt,toolBtnText:mdt,toolBtnArrow:pdt,toolBtnIcon:gdt,widthModeBtn:bdt,quickActionsBtn:ydt,toolBtnModeIcon:vdt,toolBtnModelIcon:wdt,quickActionsPanel:xdt,quickActionsHeader:kdt,quickActionsLayout:_dt,quickActionsGrid:Sdt,quickAction:Cdt,quickActionLabel:Tdt,quickKeysGrid:Edt,quickKey:Adt,quickKeyLabel:jdt,sendBtn:Ndt,sendBtnRunning:Idt,sendIcon:Mdt,stopIcon:Rdt,loadingIcon:Ddt,sendBtnArmed:Ldt,escLabel:Pdt,srOnly:Odt,images:$dt,imageThumb:Bdt,imageRemove:zdt,searchPanel:Fdt,searchBar:qdt,searchLabel:Hdt,searchInput:Udt,searchResults:Wdt,searchResult:Vdt,searchResultActive:Gdt,searchResultMarker:Kdt,searchResultText:Ydt,searchEmpty:Xdt},Qdt=`#version 300 es
  in vec2 position;
  void main() {
    gl_Position = vec4(position, 0.0, 1.0);
  }
`,Jdt=`#version 300 es
  precision highp float;
  uniform vec2 center;
  uniform vec2 halfSize;
  uniform vec3 lineColor;
  uniform float radius;
  uniform float angle;
  uniform float intensity;
  uniform float px;
  uniform float shineSize;
  uniform float shineFade;
  uniform float thickness;
  out vec4 fragColor;

  float roundedRect(vec2 point) {
    vec2 edge = abs(point) - halfSize + radius;
    return length(max(edge, 0.0)) + min(max(edge.x, edge.y), 0.0) - radius;
  }

  float gaussianLine(float distanceToEdge, float sigma) {
    float normalized = distanceToEdge / (sigma + 0.000001);
    float falloff = mix(1.0, 1.6, smoothstep(0.0, 1.5, normalized));
    return exp(-falloff * normalized * normalized);
  }

  void main() {
    vec2 point = gl_FragCoord.xy - center;
    float distanceToEdge = roundedRect(point);
    vec2 light = vec2(cos(angle), sin(angle));
    vec2 normal = normalize(point / halfSize + 0.000001);
    float phi = acos(clamp(abs(dot(normal, light)), 0.0, 1.0));
    float rim = 1.0 - smoothstep(
      shineSize - shineFade,
      shineSize + shineFade + 0.0001,
      phi
    );
    float line = gaussianLine(distanceToEdge, thickness);
    float edgeClamp = 1.0 - smoothstep(
      0.5 * px,
      3.0 * px,
      abs(distanceToEdge)
    );
    float shine = line * rim * edgeClamp * intensity;
    fragColor = vec4(lineColor * shine, shine);
  }
`;function pK(e,t,n){const s=e.createShader(t);return s?(e.shaderSource(s,n),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS)?s:(e.deleteShader(s),null)):null}function Zdt({targetRef:e}){const t=h.useRef(null),n=im(),s=oO();return h.useEffect(()=>{var de,ue,me,te;const r=e.current,i=t.current;if(!r||!i||s)return;const o=document.createElement("canvas"),l=o.getContext("webgl2",{alpha:!0,antialias:!0,premultipliedAlpha:!0});if(!l)return;const c=pK(l,l.VERTEX_SHADER,Qdt),u=pK(l,l.FRAGMENT_SHADER,Jdt),d=l.createProgram();if(!c||!u||!d){c&&l.deleteShader(c),u&&l.deleteShader(u),d&&l.deleteProgram(d),(de=l.getExtension("WEBGL_lose_context"))==null||de.loseContext();return}if(l.attachShader(d,c),l.attachShader(d,u),l.linkProgram(d),!l.getProgramParameter(d,l.LINK_STATUS)){l.deleteProgram(d),l.deleteShader(c),l.deleteShader(u),(ue=l.getExtension("WEBGL_lose_context"))==null||ue.loseContext();return}const f=l.createBuffer();if(!f){l.deleteProgram(d),l.deleteShader(c),l.deleteShader(u),(me=l.getExtension("WEBGL_lose_context"))==null||me.loseContext();return}i.appendChild(o),l.bindBuffer(l.ARRAY_BUFFER,f),l.bufferData(l.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),l.STATIC_DRAW);const m=l.getAttribLocation(d,"position");l.enableVertexAttribArray(m),l.vertexAttribPointer(m,2,l.FLOAT,!1,0,0),l.useProgram(d),l.enable(l.BLEND),l.blendFunc(l.ONE,l.ONE_MINUS_SRC_ALPHA);const p=l.getUniformLocation(d,"center"),g=l.getUniformLocation(d,"halfSize"),b=l.getUniformLocation(d,"lineColor"),w=l.getUniformLocation(d,"radius"),y=l.getUniformLocation(d,"angle"),v=l.getUniformLocation(d,"intensity"),x=l.getUniformLocation(d,"px"),k=l.getUniformLocation(d,"shineSize"),_=l.getUniformLocation(d,"shineFade"),T=l.getUniformLocation(d,"thickness");let S=window.devicePixelRatio||1,C=1,N=1,E=12,O=null,B=2.4,D=2.4,j=0,L=0,z=!1,I=performance.now(),$=0,K=!1;const R=()=>{S=window.devicePixelRatio||1;const ae=r.getBoundingClientRect();C=ae.width,N=ae.height,E=Number.parseFloat(getComputedStyle(r).borderRadius)||12,o.width=Math.ceil((C+40)*S),o.height=Math.ceil((N+40)*S),l.viewport(0,0,o.width,o.height)},Y=ae=>{const be=r.querySelector("[data-web-shell-composer-editor]");return ae instanceof Node&&!!(be!=null&&be.contains(ae))},W=()=>{!K&&!pe&&(K=!0,I=performance.now(),$=window.requestAnimationFrame(U))},M=ae=>{const be=r.getBoundingClientRect(),se=be.left+be.width/2,ve=be.top+be.height/2,ze=Math.max(be.left-ae.clientX,0,ae.clientX-be.right),Pe=Math.max(be.top-ae.clientY,0,ae.clientY-be.bottom),_t=Math.hypot(ze,Pe);if(_t===0){const St=(ae.clientX-se)/Math.max(be.width/2,1),he=(ve-ae.clientY)/Math.max(be.height/2,1);O=Math.atan2(2/be.height,-2/be.width)+St*.3+he*.15}else O=Math.atan2(ve-ae.clientY,ae.clientX-se);const Pt=Math.max(0,1-_t/250);j=Pt*Pt*(3-2*Pt),W()},F=()=>{j=0,O=null},J=ae=>{Y(ae.target)&&(O=B,D=B,z=!0,W())},V=ae=>{Y(ae.target)&&!Y(ae.relatedTarget)&&(O=B,z=!1)},U=ae=>{const be=Math.min((ae-I)/1e3,.05);I=ae,z?D-=.85*be:D=B;const ve=(((z?D:O===null?B:O)-B+Math.PI)%(Math.PI*2)+Math.PI*2)%(Math.PI*2)-Math.PI;if(B+=ve*(1-Math.exp(-be*7)),L+=((z?1.4:j)-L)*(1-Math.exp(-be*8)),L<.002&&!z&&j<.002){K=!1,$=0,l.clear(l.COLOR_BUFFER_BIT);return}l.uniform2f(p,(20+C/2)*S,(20+N/2)*S),l.uniform2f(g,C/2*S,N/2*S),l.uniform3f(b,n===Fr.Light?.2:.403922,n===Fr.Light?.360784:.521569,1),l.uniform1f(w,Math.min(E,N/2)*S),l.uniform1f(y,B),l.uniform1f(v,L),l.uniform1f(x,S),l.uniform1f(k,32*Math.PI/180),l.uniform1f(_,68*Math.PI/180),l.uniform1f(T,.5*S),l.clear(l.COLOR_BUFFER_BIT),l.drawArrays(l.TRIANGLES,0,3),$=window.requestAnimationFrame(U)},le=new ResizeObserver(R);let pe=!1;const fe=()=>{pe||(pe=!0,K=!1,window.cancelAnimationFrame($),$=0,le.disconnect(),window.removeEventListener("pointermove",M),document.documentElement.removeEventListener("pointerleave",F),r.removeEventListener("focusin",J),r.removeEventListener("focusout",V),o.removeEventListener("webglcontextlost",Q),o.remove())},Q=()=>{fe()};o.addEventListener("webglcontextlost",Q),le.observe(r),R(),window.addEventListener("pointermove",M,{passive:!0}),document.documentElement.addEventListener("pointerleave",F),r.addEventListener("focusin",J),r.addEventListener("focusout",V);const ne=document.activeElement;return z=ne!==null&&((te=r.querySelector("[data-web-shell-composer-editor]"))==null?void 0:te.contains(ne))===!0,W(),()=>{var ae;fe(),l.deleteBuffer(f),l.deleteProgram(d),l.deleteShader(c),l.deleteShader(u),(ae=l.getExtension("WEBGL_lose_context"))==null||ae.loseContext()}},[s,e,n]),a.jsx("span",{ref:t,className:Ee.specularEffect,"data-web-shell-composer-specular":!0,"data-theme":n,"aria-hidden":"true"})}const eht=["--chat-editor-accent-color","--chat-editor-text-primary","--accent","--background","--foreground","--muted-foreground","--chat-editor-border-color","--font-sans"];function tht({menu:e,anchorRef:t,panelRef:n,onSelect:s,onAccept:r,onBack:i,onSearch:o,onSelectTab:l}){const c=Gu(),{t:u}=nt(),d=h.useRef([]),f=h.useRef(null),m=h.useRef(null),[p,g]=h.useState(null),[b,w]=h.useState({});h.useEffect(()=>{var C;(C=d.current[e.selectedIndex])==null||C.scrollIntoView({block:"nearest"})},[e.level,e.selectedIndex]),h.useEffect(()=>{if(e.level!=="items"||e.inputMode!=="search"||document.activeElement===f.current)return;const C=()=>{var O;return(O=f.current)==null?void 0:O.focus()},N=window.requestAnimationFrame(C),E=window.setTimeout(C,0);return()=>{window.cancelAnimationFrame(N),window.clearTimeout(E)}},[e.inputMode,e.level,e.selectedProviderId]),h.useLayoutEffect(()=>{const C=t.current;if(!C)return;const N=getComputedStyle(C);w(Object.fromEntries(eht.map(E=>[E,N.getPropertyValue(E)])))},[t]),h.useLayoutEffect(()=>{const C=t.current;if(!C)return;let N=null;const E=()=>{var K;const D=C.getBoundingClientRect(),j=((K=n.current)==null?void 0:K.offsetWidth)??360,L=getComputedStyle(C),z=Number.parseFloat(L.getPropertyValue("--web-shell-popover-safe-top"))||48,I=Math.max(96,Math.min(300,D.top-z-8)),$={left:Math.max(12,Math.min(D.left+16,window.innerWidth-j-12)),bottom:window.innerHeight-D.top+8,width:D.width,maxHeight:I};g(R=>R&&R.left===$.left&&R.bottom===$.bottom&&R.width===$.width&&R.maxHeight===$.maxHeight?R:$)},O=()=>{N===null&&(N=window.requestAnimationFrame(()=>{N=null,E()}))};E();const B=new ResizeObserver(O);return B.observe(C),window.addEventListener("resize",O),window.addEventListener("scroll",O,!0),()=>{N!==null&&window.cancelAnimationFrame(N),B.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("scroll",O,!0)}},[t,n]);const y=e.level==="categories"?e.providers.map(C=>({id:C.id,label:C.label,labelTitle:C.textValue,description:C.description,trailing:"›",provider:C})):e.items.map(C=>({id:C.id,label:C.label,labelTitle:C.label,subtitle:C.subtitle,description:e.selectedProviderId===Xa?void 0:C.description??C.detail,icon:C.icon,iconMode:C.iconMode,iconColor:C.iconColor,iconSpin:C.iconSpin,iconTooltip:C.iconTooltip,trailing:C.kind==="directory"||C.kind==="mcp-server"?"›":"",item:C}));if(h.useEffect(()=>{d.current.length=y.length},[y.length]),!p)return null;const v=e.providers.find(C=>C.id===e.selectedProviderId),x=e.itemMode==="mcpResources"&&e.mcpServerName?ui(e.mcpServerName)??"[invalid]":(v==null?void 0:v.label)??"",k=e.itemMode==="mcpResources"&&e.mcpServerName?ui(e.mcpServerName)??"[invalid]":(v==null?void 0:v.textValue)??"",_=e.level==="items"?(v==null?void 0:v.textValue)??u("at.menu"):u("at.menu"),T="at-mention-listbox",S=e.selectedIndex>=0&&e.selectedIndex<y.length?`at-mention-option-${e.selectedIndex}`:void 0;return kd.createPortal(a.jsx("div",{className:Ee.atPortalLayer,style:b,children:a.jsxs("div",{ref:n,className:Ee.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":_,onMouseDown:C=>{C.target instanceof HTMLInputElement||C.preventDefault()},children:[e.level==="items"&&a.jsxs("div",{className:Ee.atPanelHeaderWrap,children:[a.jsxs("div",{className:Ee.atPanelHeader,children:[a.jsx("button",{type:"button",className:Ee.atBackButton,"aria-label":u("common.back"),onMouseDown:C=>{C.preventDefault(),C.stopPropagation()},onClick:C=>{C.preventDefault(),C.stopPropagation(),i()},children:"‹"}),a.jsx("span",{className:Ee.atPanelTitle,title:k,children:x})]}),a.jsx("input",{ref:f,className:Ee.atSearchInput,value:e.query,placeholder:u("common.search"),"aria-label":u("common.search"),"aria-controls":T,"aria-activedescendant":S,onMouseDown:C=>C.stopPropagation(),onClick:C=>C.stopPropagation(),onChange:C=>o(C.currentTarget.value),onKeyDown:C=>{if(!(C.nativeEvent.isComposing||C.nativeEvent.keyCode===229)){if(C.key==="Escape")C.preventDefault(),C.stopPropagation(),i();else if(C.key==="Enter")C.preventDefault(),C.stopPropagation(),r();else if(C.key==="Tab"&&!C.shiftKey&&!C.altKey&&!C.ctrlKey&&!C.metaKey)C.preventDefault(),C.stopPropagation(),r();else if(C.key==="ArrowUp"){if(C.preventDefault(),C.stopPropagation(),y.length===0)return;s(Math.max(0,e.selectedIndex-1))}else if(C.key==="ArrowDown"){if(C.preventDefault(),C.stopPropagation(),y.length===0)return;s(Math.min(y.length-1,e.selectedIndex+1))}}}}),e.tabs&&e.tabs.length>0&&a.jsxs("div",{className:Ee.atTabsWrap,children:[a.jsx("button",{type:"button",className:Ee.atTabScrollButton,"aria-label":"Previous tab",onClick:C=>{C.preventDefault(),C.stopPropagation(),gK(m.current,"previous")},children:"‹"}),a.jsx("div",{ref:m,className:Ee.atTabs,role:"tablist",children:e.tabs.map(C=>{const N=C.id===e.selectedTabId,E=C.textValue??(typeof C.label=="string"?C.label:C.id);return a.jsx("button",{type:"button",role:"tab","aria-selected":N,disabled:C.disabled,className:`${Ee.atTab} ${N?Ee.atTabActive:""}`,title:E,onClick:O=>{O.preventDefault(),O.stopPropagation(),l(C.id)},children:C.label},C.id)})}),a.jsx("button",{type:"button",className:Ee.atTabScrollButton,"aria-label":"Next tab",onClick:C=>{C.preventDefault(),C.stopPropagation(),gK(m.current,"next")},children:"›"})]})]}),a.jsx("div",{id:T,className:Ee.atList,role:y.length>0?"listbox":void 0,"aria-label":y.length>0?_:void 0,children:e.loading&&y.length===0?a.jsx("div",{className:Ee.atEmpty,role:"status","aria-live":"polite",children:u("common.loading")}):y.length===0?a.jsx("div",{className:Ee.atEmpty,role:"status","aria-live":"polite",children:u("common.noResults")}):y.map((C,N)=>{const E=N===e.selectedIndex,O="item"in C?v==null?void 0:v.provider:C.provider.provider;let B;if("item"in C&&(O!=null&&O.renderItem))try{B=O.renderItem({item:C.item,provider:O,selected:E})}catch(j){console.warn("[WebShell] at mention item render failed",j)}const D="icon"in C&&C.icon&&Rv(C.icon)?C.icon:void 0;return a.jsxs("button",{ref:j=>{d.current[N]=j},type:"button",id:`at-mention-option-${N}`,role:"option","aria-selected":E,className:`${Ee.atItem} ${E?Ee.atItemActive:""} ${C.description?"":Ee.atItemSingleLine}`,style:{"--at-item-main-template":nht(sht(C.label,C.labelTitle),"subtitle"in C?C.subtitle:void 0)},onMouseEnter:()=>s(N),onMouseDown:j=>{j.preventDefault(),j.stopPropagation()},onClick:j=>{j.preventDefault(),j.stopPropagation(),r(N)},children:[B??a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:Ee.atItemMain,children:[a.jsxs("span",{className:Ee.atItemLeading,children:["icon"in C&&D&&(C.iconMode==="image"?a.jsx("img",{className:Ee.atItemImageIcon,src:D,title:C.iconTooltip,alt:"","aria-hidden":"true"}):a.jsx("span",{className:`${Ee.atItemIcon} ${C.iconSpin?Ee.atItemIconSpin:""}`,style:{...$g("--at-item-icon-url",D),color:C.iconColor},title:C.iconTooltip,"aria-hidden":"true"})),a.jsx("span",{className:Ee.atItemLabel,title:C.labelTitle,children:C.label})]}),"subtitle"in C&&C.subtitle&&a.jsx("span",{className:Ee.atItemSubtitle,title:C.subtitle,children:C.subtitle})]}),C.description&&a.jsx("span",{className:Ee.atItemDescription,title:C.description,children:C.description})]}),C.trailing&&a.jsx("span",{className:Ee.atItemTrailing,"aria-hidden":"true",children:C.trailing})]},C.id)})})]})}),c??document.body)}function gK(e,t){if(!e)return;const n=Math.max(96,e.clientWidth*.75);e.scrollBy({left:t==="previous"?-n:n,behavior:"smooth"})}function nht(e,t){if(!t)return"minmax(0, 1fr)";const n=bK(e);return bK(t)<=12?"minmax(0, 1fr) max-content":n<=18?"max-content minmax(0, 1fr)":"minmax(0, 3fr) minmax(0, 2fr)"}function sht(e,t){return typeof e=="string"?e:typeof e=="number"?String(e):t||""}function bK(e){return Array.from(e).reduce((t,n)=>t+(n.charCodeAt(0)>255?2:1),0)}const rht="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",iht="/assets/default-aEtf0G7-.svg",Jhe="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",oht="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",aht="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",lht="_icon_i7y0u_1",cht={icon:lht},uht={auto:rht,"auto-edit":Jhe,default:iht,plan:oht,yolo:aht};function xx({mode:e}){const t=uht[e];return t?a.jsx("span",{className:cht.icon,style:$g("--mode-icon-url",t),"aria-hidden":"true"}):a.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:a.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 dht(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,l=t==="command"&&o!==void 0&&o!==s,c=l&&i>0;return s=o??s,{showHeader:l,showDivider:c,count:l&&o?n.get(o)??0:0}})}function up(e){return e.replace(/\([^()]+\)$/,"")}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const R4=16e3,hht=4096,Zhe=6e4,yK=6e4,fht=R4*Int16Array.BYTES_PER_ELEMENT*(Zhe/1e3);function mht(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 pht="qwen-bearer.",ght="qwen-ws";function bht(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`${pht}${s}`}function yht(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 vht(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 wht({baseUrl:e,token:t,target:n,onFinal:s,onError:r,onUnexpectedClose:i}){const[o,l]=h.useState("idle"),[c,u]=h.useState(""),[d,f]=h.useState(0),[m,p]=h.useState(),g=h.useRef({}),b=h.useRef(!0),w=h.useRef(0),y=h.useRef(!1),v=h.useRef("idle"),x=h.useRef(void 0),k=h.useCallback(I=>{v.current=I,l(I)},[]),_=h.useCallback(()=>{const I=g.current;I.transcribeTimeout&&(clearTimeout(I.transcribeTimeout),I.transcribeTimeout=void 0)},[]),T=h.useCallback(()=>{var $;const I=g.current;I.processor&&(I.processor.onaudioprocess=null);for(const K of[I.processor,I.source,I.sink])try{K==null||K.disconnect()}catch{}($=I.stream)==null||$.getTracks().forEach(K=>K.stop()),I.context&&I.context.state!=="closed"&&I.context.close().catch(()=>{}),I.processor=void 0,I.source=void 0,I.sink=void 0,I.stream=void 0,I.context=void 0},[]),S=h.useCallback(()=>{w.current++,x.current=void 0,y.current=!1,T(),_();const I=g.current;if(I.ws){try{I.ws.onopen=null,I.ws.onmessage=null,I.ws.onerror=null,I.ws.onclose=null,I.ws.close()}catch{}I.ws=void 0}},[_,T]),C=h.useCallback(I=>b.current&&w.current===I.generation&&x.current===I,[]),N=h.useCallback((I,$)=>{var K;C($)&&(S(),b.current&&(k("error"),u(""),f(0),p(I),(K=$.onError)==null||K.call($,I)))},[k,S,C]),E=h.useCallback((I,$)=>{C($)&&(S(),b.current&&(k("idle"),u(""),f(0),$.onFinal(I)))},[k,S,C]),O=h.useCallback(()=>{var $;const I=g.current;if((($=I.ws)==null?void 0:$.readyState)===WebSocket.OPEN)try{I.ws.send(JSON.stringify({type:"abort"}))}catch{}S(),b.current&&(k("idle"),u(""),f(0),p(void 0))},[k,S]),B=h.useCallback((I,$)=>{T(),f(0),k("transcribing");try{I.send(JSON.stringify({type:"stop"})),_(),g.current.transcribeTimeout=setTimeout(()=>{C($)&&v.current==="transcribing"&&N("Transcription timed out.",$)},yK)}catch{N("Failed to finalize voice transcription.",$)}},[k,_,N,C,T]),D=n?JSON.stringify([n.ownerKey,n.streamPath]):void 0,j=h.useRef(D);h.useLayoutEffect(()=>{j.current!==D&&(j.current=D,x.current?O():(k("idle"),u(""),f(0),p(void 0)))},[O,k,D]);const L=h.useCallback(()=>{var R;if(!n||v.current!=="idle"&&v.current!=="error")return;p(void 0),u(""),k("connecting");const I={generation:++w.current,ownerKey:n.ownerKey,streamPath:n.streamPath,onFinal:s,...r?{onError:r}:{},...i?{onUnexpectedClose:i}:{}};if(x.current=I,!((R=navigator.mediaDevices)!=null&&R.getUserMedia)){N(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.",I);return}let $,K;try{if($=new AudioContext({sampleRate:R4}),g.current.context=$,$.sampleRate!==R4)throw new Error(`Browser audio rate ${$.sampleRate} Hz is not the required ${R4} Hz.`);K=$.state==="suspended"?$.resume():Promise.resolve()}catch(Y){N(Y instanceof Error?Y.message:String(Y),I);return}_(),g.current.transcribeTimeout=setTimeout(()=>{C(I)&&v.current==="connecting"&&N("Voice capture timed out while starting.",I)},Zhe),(async()=>{try{const Y=navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}}).then(fe=>(C(I)?g.current.stream=fe:fe.getTracks().forEach(Q=>Q.stop()),fe),fe=>{throw new Error(yht(fe))}),[W]=await Promise.all([Y,K]);if(!C(I))return;const M=$.createMediaStreamSource(W),F=$.createScriptProcessor(hht,1,1),J=$.createGain();J.gain.value=0,g.current.source=M,g.current.processor=F,g.current.sink=J;const V=new WebSocket(mht(e,I.streamPath),t?[ght,bht(t)]:void 0);V.binaryType="arraybuffer",g.current.ws=V;const U=[];let le=0,pe=!1;F.onaudioprocess=fe=>{if(!C(I))return;const{pcm:Q,level:ne}=vht(fe.inputBuffer.getChannelData(0));if(f(ne),pe)V.readyState===WebSocket.OPEN&&V.send(Q);else{if(le+Q.byteLength>fht){N("Voice capture buffer limit reached while starting.",I);return}U.push(Q),le+=Q.byteLength}},y.current||(M.connect(F),F.connect(J),J.connect($.destination)),V.onopen=()=>{if(!C(I)){try{V.close()}catch{}return}V.send(JSON.stringify({type:"start"})),pe=!0;for(const fe of U)V.send(fe);if(U.length=0,le=0,_(),y.current){y.current=!1,B(V,I);return}g.current.transcribeTimeout=setTimeout(()=>{C(I)&&v.current==="recording"&&N("No response from server. Check that the voice model is running.",I)},yK),k("recording")},V.onmessage=fe=>{if(!C(I))return;(v.current==="connecting"||v.current==="recording")&&_();let Q;try{Q=JSON.parse(String(fe.data))}catch{return}Q.type==="interim"?u(Q.text??""):Q.type==="final"?E(Q.text??"",I):Q.type==="error"&&N(Q.message??Q.text??"Voice transcription failed.",I)},V.onerror=()=>{},V.onclose=fe=>{var de;if(!C(I)||!(v.current==="recording"||v.current==="connecting"||v.current==="transcribing"))return;const Q=fe.code||1006,ne=fe.reason||"none";try{(de=I.onUnexpectedClose)==null||de.call(I,{code:Q,reason:ne})}catch{}N(Q===1013?ne==="none"?"Voice capacity is temporarily unavailable. Retry shortly.":ne:`Voice connection closed (code=${Q}, reason=${ne}).`,I)}}catch(Y){N(Y instanceof Error?Y.message:String(Y),I)}})()},[k,e,_,N,B,E,r,s,i,C,n,t]),z=h.useCallback(()=>{const I=x.current,$=g.current.ws;if(!I||!$||$.readyState!==WebSocket.OPEN){if(I&&v.current==="connecting"){g.current.processor&&T(),y.current=!0,_();return}O();return}v.current!=="transcribing"&&B($,I)},[O,_,B,T]);return h.useEffect(()=>(b.current=!0,()=>{b.current=!1,S()}),[S]),{status:o,interimText:c,audioLevel:d,errorMessage:m,start:L,stop:z,abort:O}}const xht="_root_9hwm9_7",kht="_iconBtn_9hwm9_14",_ht="_error_9hwm9_47",Sht="_connecting_9hwm9_51",Cht="_pill_9hwm9_56",Tht="_transcribing_9hwm9_75",Eht="_recDot_9hwm9_79",Aht="_wave_9hwm9_88",jht="_bar_9hwm9_95",Nht="_time_9hwm9_103",Iht="_stop_9hwm9_111",Mht="_spinner_9hwm9_118",Rht="_interim_9hwm9_128",fl={root:xht,iconBtn:kht,error:_ht,connecting:Sht,pill:Cht,transcribing:Tht,recDot:Eht,wave:Aht,bar:jht,time:Nht,stop:Iht,spinner:Mht,interim:Rht},vK=16,Dht=2e3,Lht=()=>a.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:[a.jsx("path",{d:"M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3Z"}),a.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"})]}),Pht=()=>a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})});function Oht(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),s=String(t%60).padStart(2,"0");return`${n}:${s}`}function $ht({onInsert:e,onActiveChange:t,disabled:n,target:s,statusRevision:r={user:0,workspace:0}}){var ae;const i=Co(),o=za(),l=Nh(),{t:c}=nt(),u=((ae=i.capabilities)==null?void 0:ae.features)??[],d=oct(s,u),f=s!=null&&s.sessionId&&s.sessionId===o.sessionId&&(!s.cwd||s.cwd===o.workspaceCwd)?l==null?void 0:l.settingsVersion:void 0,[m,p]=h.useState(0),[g,b]=h.useState(!1),w=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,v]=h.useState(()=>({queryKey:w,enabled:!1,mode:"hold"})),x=h.useRef(null),k=h.useRef(s);k.current=s;const _=h.useRef(0),T=h.useRef(0),S=h.useRef(!1);h.useEffect(()=>(S.current=!0,()=>{S.current=!1,T.current+=1}),[]),h.useEffect(()=>{const be=++_.current,se=k.current;let ve=!0;if(v({queryKey:w,enabled:!1,mode:"hold"}),!(!se||!w||!d||g))return act(i.client,se).then(ze=>{ve&&_.current===be&&v({queryKey:w,enabled:ze.enabled===!0,mode:ze.mode})}).catch(ze=>{console.warn("[web-shell] Voice status probe failed:",ze)}),()=>{ve=!1}},[g,d,w,i.client]);const C=d&&!g&&y.queryKey===w&&y.enabled,[N,E]=h.useState(void 0);h.useEffect(()=>{if(!N)return;const be=window.setTimeout(()=>E(void 0),Dht);return()=>window.clearTimeout(be)},[N]);const{status:O,interimText:B,audioLevel:D,errorMessage:j,start:L,stop:z,abort:I}=wht({baseUrl:i.baseUrl,token:i.token,target:s?{ownerKey:s.ownerKey,streamPath:s.streamPath}:void 0,onFinal:be=>{const se=be.trim();se?(E(void 0),e(se)):E(c("voice.noSpeech"))},onUnexpectedClose:({code:be})=>{var Pe,_t;if(be===1013||(p(Pt=>Pt+1),be!==1012))return;const se=(Pe=k.current)==null?void 0:Pe.ownerKey,ve=++T.current;b(!0);const ze=()=>{var Pt;!S.current||T.current!==ve||((Pt=k.current)==null?void 0:Pt.ownerKey)!==se||(b(!1),p(St=>St+1))};try{const Pt=(_t=i.refreshCapabilities)==null?void 0:_t.call(i);Pt?Pt.then(ze,ze):ze()}catch{ze()}}}),$=O==="connecting"||O==="recording"||O==="transcribing",K=O==="recording";h.useEffect(()=>{t==null||t($)},[$,t]),h.useEffect(()=>()=>{t==null||t(!1)},[t]);const[R,Y]=h.useState(()=>new Array(vK).fill(0));h.useEffect(()=>{if(!K){Y(new Array(vK).fill(0));return}Y(be=>[...be.slice(1),Math.min(1,D*8)])},[D,K]);const[W,M]=h.useState(0);h.useEffect(()=>{if(!K){M(0);return}const be=performance.now(),se=setInterval(()=>M(performance.now()-be),200);return()=>clearInterval(se)},[K]),h.useLayoutEffect(()=>{!C&&(O==="recording"||O==="connecting"||O==="transcribing")&&I()},[I,O,C]);const F=h.useRef(s==null?void 0:s.ownerKey);if(h.useLayoutEffect(()=>{F.current!==(s==null?void 0:s.ownerKey)&&(F.current=s==null?void 0:s.ownerKey,T.current+=1,E(void 0),b(!1))},[s==null?void 0:s.ownerKey]),!C)return null;const J=O==="connecting",V=O==="transcribing",U=O==="error",le=!!N&&!U,pe=K||J,fe=be=>{y.mode==="hold"&&be.detail!==0||(K?z():J?I():n||(E(void 0),L()))},Q=be=>{if(!(y.mode!=="hold"||be.button!==0||n||J||K)){be.preventDefault(),x.current=be.pointerId;try{be.currentTarget.setPointerCapture(be.pointerId)}catch{}E(void 0),L()}},ne=be=>{y.mode!=="hold"||x.current!==be.pointerId||(x.current=null,(J||K)&&z())},de=be=>{y.mode!=="hold"||x.current!==be.pointerId||(x.current=null,(J||K)&&I())},ue=K?c("voice.stopDictation"):V?c("voice.transcribing"):J?c("voice.starting"):U?c("voice.errorRetry",{message:j??""}):c(le?"voice.noSpeechRetry":"voice.startDictation");let me;if(K)me=a.jsxs("button",{type:"button",className:fl.pill,onClick:fe,onPointerDown:Q,onPointerUp:ne,onPointerCancel:de,"aria-label":ue,title:ue,children:[a.jsx("span",{className:fl.recDot,"aria-hidden":"true"}),a.jsx("span",{className:fl.wave,"aria-hidden":"true",children:R.map((be,se)=>a.jsx("span",{className:fl.bar,style:{height:`${2+Math.round(be*14)}px`}},se))}),a.jsx("span",{className:fl.time,children:Oht(W)}),a.jsx("span",{className:fl.stop,"aria-hidden":"true",children:a.jsx(Pht,{})})]});else if(V)me=a.jsxs("span",{className:`${fl.pill} ${fl.transcribing}`,role:"status","aria-label":ue,children:[a.jsx("span",{className:fl.spinner,"aria-hidden":"true"}),a.jsx("span",{className:fl.time,children:"…"})]});else{const be=[fl.iconBtn,U?fl.error:"",J?fl.connecting:""].filter(Boolean).join(" ");me=a.jsx("button",{type:"button",className:be,onClick:fe,onPointerDown:Q,onPointerUp:ne,onPointerCancel:de,disabled:!!n&&!pe,"aria-label":ue,title:j??N??ue,children:a.jsx(Lht,{})})}const te=K&&B||U||le;return a.jsxs("span",{className:fl.root,children:[me,te&&a.jsx("span",{role:"status","aria-live":"polite",className:`${fl.interim}${U?` ${fl.error}`:""}`,children:U?j||c("voice.error"):le?N:B})]})}function Bht(){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[a.jsx("circle",{cx:"6",cy:"5",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),a.jsx("circle",{cx:"18",cy:"6",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),a.jsx("circle",{cx:"6",cy:"19",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),a.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 aO(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 zht(e){return e.conflicted>0?"error":e.operation||e.detached?"warning":e.dirty?"accent":null}function efe(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 tfe(e,t,n){const s=efe(aO(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 wR({branch:e,status:t,compact:n,worktree:s=!1}){const{t:r}=nt(),i=aO(t),o=zht(i);return a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:Ee.gitBranchIconWrap,children:[a.jsx("span",{className:Ee.gitBranchIcon,children:s?a.jsx(wT,{size:14,strokeWidth:1.5}):i.detached?a.jsx(_ee,{}):a.jsx(Bht,{})}),n&&o&&a.jsx("span",{className:Ee.gitBranchBadgeDot,"data-tone":o,"aria-hidden":"true"})]}),a.jsx("span",{className:Ee.gitBranchText,children:e}),!n&&a.jsxs("span",{className:Ee.gitBranchIndicators,"aria-hidden":"true",children:[i.operation&&a.jsx("span",{className:Ee.gitBranchOperation,children:r(`git.operation.${i.operation}`)}),i.conflicted>0&&a.jsxs("span",{className:Ee.gitBranchConflicted,children:[a.jsx(sSe,{}),i.conflicted]}),i.dirty&&a.jsx("span",{className:Ee.gitBranchDirtyDot}),i.ahead>0&&a.jsxs("span",{className:Ee.gitBranchAheadBehind,children:["↑",i.ahead]}),i.behind>0&&a.jsxs("span",{className:Ee.gitBranchAheadBehind,children:["↓",i.behind]}),i.stashCount>0&&a.jsxs("span",{className:Ee.gitBranchStash,children:[a.jsx(Xke,{}),i.stashCount]})]})]})}function nfe({branch:e,status:t,compact:n=!1,onOpenDiff:s,worktree:r=!1}){const{t:i}=nt(),o=aO(t),l=efe(o,i),c=tfe(e,t,i),u=`${Ee.gitBranchChip} ${n?Ee.gitBranchChipCompact:""} ${s?Ee.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=a.jsx(wR,{branch:e,status:t,compact:n,worktree:r});return a.jsx(Td,{delayDuration:300,children:a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:s?a.jsx("button",{type:"button",className:u,"aria-label":c,onClick:s,...d,children:f}):a.jsx("output",{className:u,"aria-label":c,...d,children:f})}),a.jsx(Uu,{side:"top",children:a.jsxs("div",{className:Ee.gitBranchTooltip,children:[a.jsx("div",{className:Ee.gitBranchTooltipTitle,children:o.detached?`${i("git.detached")} (${e})`:e}),l.length>0?l.map(m=>a.jsx("div",{className:Ee.gitBranchTooltipRow,children:m},m)):(t==null?void 0:t.computedAt)!==void 0?a.jsx("div",{className:Ee.gitBranchTooltipRow,children:i("git.clean")}):null]})})]})})}const Fht="_wrap_11orh_1",qht="_chip_11orh_8",Hht="_chipBranch_11orh_34",Uht="_chipWorktree_11orh_44",Wht="_chipCompact_11orh_54",Vht="_chipIcon_11orh_57",Ght="_chipText_11orh_66",Kht="_chevron_11orh_71",Yht="_chevronOpen_11orh_78",Xht="_clearBtn_11orh_82",Qht="_popover_11orh_104",Jht="_header_11orh_110",Zht="_option_11orh_120",eft="_optionSelected_11orh_140",tft="_optionIcon_11orh_144",nft="_iconCurrent_11orh_159",sft="_iconBranch_11orh_164",rft="_iconWorktree_11orh_169",ift="_optionText_11orh_175",oft="_optionName_11orh_183",aft="_optionDesc_11orh_187",lft="_checkCurrent_11orh_193",cft="_checkBranch_11orh_194",uft="_checkWorktree_11orh_195",dft="_branchBox_11orh_213",hft="_branchRow_11orh_220",fft="_branchLabel_11orh_225",mft="_branchInputWrap_11orh_231",pft="_branchInput_11orh_231",gft="_branchInputInvalid_11orh_257",bft="_branchInputValid_11orh_261",yft="_branchStatus_11orh_266",vft="_branchHint_11orh_274",wft="_branchHintError_11orh_280",xft="_footer_11orh_285",kft="_cmd_11orh_294",_ft="_confirmBranch_11orh_304",Sft="_confirmWorktree_11orh_305",os={wrap:Fht,chip:qht,chipBranch:Hht,chipWorktree:Uht,chipCompact:Wht,chipIcon:Vht,chipText:Ght,chevron:Kht,chevronOpen:Yht,clearBtn:Xht,popover:Qht,header:Jht,option:Zht,optionSelected:eft,optionIcon:tft,iconCurrent:nft,iconBranch:sft,iconWorktree:rft,optionText:ift,optionName:oft,optionDesc:aft,checkCurrent:lft,checkBranch:cft,checkWorktree:uft,branchBox:dft,branchRow:hft,branchLabel:fft,branchInputWrap:mft,branchInput:pft,branchInputInvalid:gft,branchInputValid:bft,branchStatus:yft,branchHint:vft,branchHintError:wft,footer:xft,cmd:kft,confirmBranch:_ft,confirmWorktree:Sft},Cft=1e3,Tft=200,wK=new TextEncoder;function xR(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"||wK.encode(e).length>Cft||e.split("/").some(t=>wK.encode(t).length>Tft)):!1}function Eft({branch:e,compact:t=!1,intent:n,onIntentChange:s}){const{t:r}=nt(),[i,o]=h.useState(!1),[l,c]=h.useState(n.mode),[u,d]=h.useState(n.mode==="branch"?n.name:""),f=h.useRef(null),m=h.useMemo(()=>xR(u),[u]),p=h.useCallback(_=>{o(_),_&&(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]),w=h.useCallback(()=>{s({mode:"worktree"}),o(!1)},[s]),y=h.useCallback(_=>{_.stopPropagation(),s({mode:"current"}),o(!1)},[s]),v=n.mode==="branch",x=n.mode==="worktree",k=v?`→ ${n.name}`:x?r("gitMode.worktree"):e;return a.jsxs("span",{className:os.wrap,children:[a.jsxs(Yf,{open:i,onOpenChange:p,children:[a.jsx(Gp,{asChild:!0,children:a.jsxs("button",{type:"button",className:`${os.chip} ${v?os.chipBranch:""} ${x?os.chipWorktree:""} ${t?os.chipCompact:""}`,"data-web-shell-git-branch":!0,"data-testid":"git-mode-chip","aria-label":`${r("gitMode.title")}: ${k}`,children:[a.jsx("span",{className:os.chipIcon,children:x?a.jsx(wT,{size:14,strokeWidth:1.5}):a.jsx(jy,{size:15,strokeWidth:1.5})}),!t&&a.jsx("span",{className:os.chipText,children:k}),a.jsx("svg",{className:`${os.chevron} ${i?os.chevronOpen:""}`,viewBox:"0 0 16 16",fill:"currentColor",width:9,height:9,"aria-hidden":"true",children:a.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"})})]})}),a.jsxs(Xf,{ref:f,side:"top",align:"end",sideOffset:8,className:os.popover,onClick:_=>_.stopPropagation(),onOpenAutoFocus:_=>_.preventDefault(),onInteractOutside:_=>{var T;(T=f.current)!=null&&T.contains(_.target)&&_.preventDefault()},children:[a.jsx("div",{className:os.header,children:r("gitMode.title")}),a.jsxs("button",{type:"button",role:"radio","aria-checked":l==="current",className:`${os.option} ${l==="current"?os.optionSelected:""}`,onClick:g,children:[a.jsx("span",{className:`${os.optionIcon} ${os.iconCurrent}`,children:a.jsx(_ee,{size:15,strokeWidth:1.5})}),a.jsxs("span",{className:os.optionText,children:[a.jsx("span",{className:os.optionName,children:r("gitMode.current")}),a.jsx("span",{className:os.optionDesc,children:r("gitMode.currentDesc",{branch:e})})]}),l==="current"&&a.jsx("span",{className:os.checkCurrent,"aria-hidden":"true",children:"✓"})]}),a.jsxs("button",{type:"button",role:"radio","aria-checked":l==="branch",className:`${os.option} ${l==="branch"?os.optionSelected:""}`,onClick:()=>c("branch"),children:[a.jsx("span",{className:`${os.optionIcon} ${os.iconBranch}`,children:a.jsx(jy,{size:15,strokeWidth:1.5})}),a.jsxs("span",{className:os.optionText,children:[a.jsx("span",{className:os.optionName,children:r("gitMode.branch")}),a.jsx("span",{className:os.optionDesc,children:r("gitMode.branchDesc",{branch:e})})]}),l==="branch"&&a.jsx("span",{className:os.checkBranch,"aria-hidden":"true",children:"✓"})]}),l==="branch"&&a.jsxs("div",{className:os.branchBox,children:[a.jsxs("div",{className:os.branchRow,children:[a.jsx("label",{className:os.branchLabel,htmlFor:"git-mode-branch-input",children:r("gitMode.branchLabel")}),a.jsxs("span",{className:os.branchInputWrap,children:[a.jsx("input",{className:`${os.branchInput} ${u&&!m?os.branchInputInvalid:""} ${u&&m?os.branchInputValid:""}`,value:u,onChange:_=>d(_.target.value),onKeyDown:_=>{_.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&&a.jsx("span",{className:os.branchStatus,"aria-hidden":"true",style:{color:m?"var(--git-mode-valid)":"var(--git-mode-invalid)"},children:m?"✓":"✗"})]})]}),a.jsx("div",{className:`${os.branchHint} ${u&&!m?os.branchHintError:""}`,children:r(u&&!m?"gitMode.branchInvalidName":"gitMode.branchHint")}),u&&m&&a.jsx("div",{className:os.branchHint,children:r("gitMode.branchConflictWarning")})]}),a.jsxs("button",{type:"button",role:"radio","aria-checked":l==="worktree",className:`${os.option} ${l==="worktree"?os.optionSelected:""}`,onClick:()=>c("worktree"),children:[a.jsx("span",{className:`${os.optionIcon} ${os.iconWorktree}`,children:a.jsx(wT,{size:15,strokeWidth:1.5})}),a.jsxs("span",{className:os.optionText,children:[a.jsx("span",{className:os.optionName,children:r("gitMode.worktree")}),a.jsx("span",{className:os.optionDesc,children:r("gitMode.worktreeDesc")})]}),l==="worktree"&&a.jsx("span",{className:os.checkWorktree,"aria-hidden":"true",children:"✓"})]}),a.jsxs("div",{className:os.footer,children:[a.jsx("span",{className:os.cmd,children:l==="branch"?`$ git checkout -b ${u||"…"} ← ${e}`:l==="worktree"?"$ git worktree add .qwen/worktrees/<slug>":`$ git checkout ${e}`}),l==="branch"&&a.jsx("button",{type:"button",className:os.confirmBranch,disabled:!u||!m,onClick:b,"data-testid":"git-mode-confirm-branch",children:r("gitMode.confirmBranch")}),l==="worktree"&&a.jsx("button",{type:"button",className:os.confirmWorktree,onClick:w,"data-testid":"git-mode-confirm-worktree",children:r("gitMode.confirmWorktree")})]})]})]}),(v||x)&&a.jsx("button",{type:"button",className:os.clearBtn,onClick:y,"aria-label":r("gitMode.resetToCurrent"),title:r("gitMode.resetToCurrent"),"data-testid":"git-mode-clear",children:"✕"})]})}const Aft="_picker_11vtj_1",jft="_searchWrap_11vtj_10",Nft="_searchIcon_11vtj_18",Ift="_searchInput_11vtj_23",Mft="_list_11vtj_41",Rft="_section_11vtj_47",Dft="_sectionHeader_11vtj_51",Lft="_sectionChevron_11vtj_69",Pft="_sectionChevronCollapsed_11vtj_74",Oft="_item_11vtj_78",$ft="_itemActive_11vtj_101",Bft="_itemIcon_11vtj_105",zft="_itemStar_11vtj_112",Fft="_itemName_11vtj_116",qft="_itemMeta_11vtj_122",Hft="_itemAheadBehind_11vtj_131",Uft="_itemUpstream_11vtj_137",Wft="_separator_11vtj_145",Vft="_actionItem_11vtj_151",Gft="_actionIcon_11vtj_176",Kft="_actionLabel_11vtj_183",Yft="_inlineInput_11vtj_187",Xft="_inlineInputField_11vtj_194",Qft="_inlineInputFieldInvalid_11vtj_209",Jft="_statusBar_11vtj_213",Zft="_statusBarError_11vtj_224",emt="_statusBarSuccess_11vtj_229",tmt="_spin_11vtj_238",nmt="_empty_11vtj_247",smt="_remoteGroupLabel_11vtj_254",rmt="_loading_11vtj_262",Kn={picker:Aft,searchWrap:jft,searchIcon:Nft,searchInput:Ift,list:Mft,section:Rft,sectionHeader:Dft,sectionChevron:Lft,sectionChevronCollapsed:Pft,item:Oft,itemActive:$ft,itemIcon:Bft,itemStar:zft,itemName:Fft,itemMeta:qft,itemAheadBehind:Hft,itemUpstream:Uft,separator:Wft,actionItem:Vft,actionIcon:Gft,actionLabel:Kft,inlineInput:Yft,inlineInputField:Xft,inlineInputFieldInvalid:Qft,statusBar:Jft,statusBarError:Zft,statusBarSuccess:emt,spin:tmt,empty:nmt,remoteGroupLabel:smt,loading:rmt};function lO({open:e,onOpenChange:t,workspaceCwd:n,gitCwd:s,side:r="bottom",onBranchChanged:i,onOpenDiff:o,onOpenCommit:l,children:c}){const{t:u}=nt(),{client:d}=Co(),f=h.useMemo(()=>d.workspaceByCwd(n),[d,n]),[m,p]=h.useState(null),[g,b]=h.useState(!1),[w,y]=h.useState(null),[v,x]=h.useState(null),[k,_]=h.useState("info"),[T,S]=h.useState(""),[C,N]=h.useState(!1),[E,O]=h.useState(""),[B,D]=h.useState(!1),[j,L]=h.useState(""),[z,I]=h.useState(null),[$,K]=h.useState({recent:!1,local:!1,remote:!0,tags:!0}),R=h.useRef(null),Y=h.useRef(null),W=h.useRef(0),M=h.useCallback(async()=>{const se=++W.current;b(!0),y(null);try{const ve=await f.workspaceGitBranches(s);if(se!==W.current)return;p(ve)}catch(ve){if(se!==W.current)return;y(ve instanceof Error?ve.message:String(ve))}finally{se===W.current&&b(!1)}},[f,s]);h.useEffect(()=>{e&&(M(),S(""),N(!1),D(!1),O(""),L(""),x(null),setTimeout(()=>{var se;return(se=R.current)==null?void 0:se.focus()},50))},[e,M]);const F=h.useCallback((se,ve="info")=>{x(se),_(ve)},[]),J=h.useCallback(async se=>{if(!z){I("checkout");try{await f.workspaceGitCheckout(se,s),F(u("branchPicker.checkedOut",{branch:se}),"success"),i==null||i(),t(!1)}catch(ve){F(ve instanceof Error?ve.message:String(ve),"error")}finally{I(null)}}},[f,z,s,i,t,F,u]),V=h.useCallback(async()=>{if(!z){if(!xR(E)){E&&F(u("branchPicker.invalidBranchName"),"error");return}I("newBranch");try{await f.workspaceGitCreateBranch(E,void 0,s),F(u("branchPicker.createdBranch",{branch:E}),"success"),i==null||i(),t(!1)}catch(se){F(se instanceof Error?se.message:String(se),"error")}finally{I(null)}}},[f,z,s,E,i,t,F,u]),U=h.useCallback(async()=>{j.trim()&&await J(j.trim())},[j,J]),le=h.useCallback(async()=>{if(!z){I("push");try{const se=await f.workspaceGitPush({setUpstream:!0},s);F(se.output||u("branchPicker.pushSuccess"),"success"),await M(),i==null||i()}catch(se){F(se instanceof Error?se.message:String(se),"error")}finally{I(null)}}},[f,z,s,M,i,F,u]),pe=h.useCallback(async()=>{if(!z){I("pull");try{const se=await f.workspaceGitPull(void 0,s);F(se.output||u("branchPicker.pullSuccess"),"success"),await M(),i==null||i()}catch(se){F(se instanceof Error?se.message:String(se),"error")}finally{I(null)}}},[f,z,s,M,i,F,u]),fe=T.toLowerCase().trim(),Q=h.useCallback(se=>fe?se.filter(ve=>ve.name.toLowerCase().includes(fe)):se,[fe]),ne=h.useMemo(()=>m?Q(m.local):[],[m,Q]),de=h.useMemo(()=>m?Q(m.remote):[],[m,Q]),ue=h.useMemo(()=>m?fe?m.tags.filter(se=>se.name.toLowerCase().includes(fe)):m.tags:[],[m,fe]),me=h.useMemo(()=>m?fe?m.recent.filter(se=>se.toLowerCase().includes(fe)):m.recent:[],[m,fe]),te=h.useMemo(()=>{const se=new Map;for(const ve of de){const ze=ve.name.indexOf("/"),Pe=ze>0?ve.name.slice(0,ze):"other";let _t=se.get(Pe);_t||(_t=[],se.set(Pe,_t)),_t.push(ve)}return se},[de]),ae=!fe||u("branchPicker.action.pull").toLowerCase().includes(fe)||u("branchPicker.action.push").toLowerCase().includes(fe)||u("branchPicker.action.commit").toLowerCase().includes(fe)||u("branchPicker.action.newBranch").toLowerCase().includes(fe)||u("branchPicker.action.checkoutRef").toLowerCase().includes(fe)||u("branchPicker.action.viewChanges").toLowerCase().includes(fe);h.useEffect(()=>{ae||(N(!1),D(!1))},[ae]);const be=h.useCallback(se=>K(ve=>({...ve,[se]:!ve[se]})),[]);return a.jsxs(Yf,{open:e,onOpenChange:t,children:[a.jsx(Gp,{asChild:!0,children:c}),a.jsxs(Xf,{ref:Y,className:Kn.picker,side:r,align:"start",sideOffset:4,onClick:se=>se.stopPropagation(),onPointerDownOutside:se=>{var ve;(ve=Y.current)!=null&&ve.contains(se.target)&&se.preventDefault()},children:[a.jsxs("div",{className:Kn.searchWrap,children:[a.jsx(eu,{size:14,className:Kn.searchIcon}),a.jsx("input",{ref:R,className:Kn.searchInput,placeholder:u("branchPicker.search"),value:T,onChange:se=>S(se.target.value)})]}),a.jsxs("div",{className:Kn.list,children:[g&&a.jsx("div",{className:Kn.loading,children:u("branchPicker.loading")}),w&&a.jsx("div",{className:Kn.empty,children:w}),!g&&!w&&m&&a.jsxs(a.Fragment,{children:[ae&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:Kn.actionItem,disabled:!!z,onClick:()=>void pe(),children:[z==="pull"?a.jsx(Rg,{size:14,className:`${Kn.actionIcon} ${Kn.spin}`}):a.jsx(vxe,{size:14,className:Kn.actionIcon}),a.jsx("span",{className:Kn.actionLabel,children:u("branchPicker.action.pull")})]}),l&&a.jsxs("button",{type:"button",className:Kn.actionItem,disabled:!!z,onClick:()=>{l(),t(!1)},children:[a.jsx(Bke,{size:14,className:Kn.actionIcon}),a.jsx("span",{className:Kn.actionLabel,children:u("branchPicker.action.commit")})]}),a.jsxs("button",{type:"button",className:Kn.actionItem,disabled:!!z,onClick:()=>void le(),children:[z==="push"?a.jsx(Rg,{size:14,className:`${Kn.actionIcon} ${Kn.spin}`}):a.jsx(Txe,{size:14,className:Kn.actionIcon}),a.jsx("span",{className:Kn.actionLabel,children:u("branchPicker.action.push")})]}),o&&a.jsxs("button",{type:"button",className:Kn.actionItem,onClick:()=>{o(),t(!1)},children:[a.jsx(Cee,{size:14,className:Kn.actionIcon}),a.jsx("span",{className:Kn.actionLabel,children:u("branchPicker.action.viewChanges")})]}),a.jsx("div",{className:Kn.separator}),a.jsxs("button",{type:"button",className:Kn.actionItem,onClick:()=>{N(!C),D(!1)},children:[a.jsx(Vf,{size:14,className:Kn.actionIcon}),a.jsx("span",{className:Kn.actionLabel,children:u("branchPicker.action.newBranch")})]}),C&&a.jsx("div",{className:Kn.inlineInput,children:a.jsx("input",{className:`${Kn.inlineInputField} ${E&&!xR(E)?Kn.inlineInputFieldInvalid:""}`,placeholder:u("branchPicker.newBranchPlaceholder"),value:E,onChange:se=>O(se.target.value),onKeyDown:se=>{se.key==="Enter"&&V(),se.key==="Escape"&&N(!1)},autoFocus:!0})}),a.jsxs("button",{type:"button",className:Kn.actionItem,onClick:()=>{D(!B),N(!1)},children:[a.jsx(sq,{size:14,className:Kn.actionIcon}),a.jsx("span",{className:Kn.actionLabel,children:u("branchPicker.action.checkoutRef")})]}),B&&a.jsx("div",{className:Kn.inlineInput,children:a.jsx("input",{className:Kn.inlineInputField,placeholder:u("branchPicker.checkoutRefPlaceholder"),value:j,onChange:se=>L(se.target.value),onKeyDown:se=>{se.key==="Enter"&&U(),se.key==="Escape"&&D(!1)},autoFocus:!0})}),a.jsx("div",{className:Kn.separator})]}),me.length>0&&a.jsx(xC,{label:u("branchPicker.section.recent"),sectionKey:"recent",collapsed:$.recent,onToggle:be,children:me.map(se=>a.jsx(eN,{name:se,isHead:se===m.head&&!m.detached,onClick:()=>void J(se)},se))}),a.jsx(xC,{label:u("branchPicker.section.local"),sectionKey:"local",collapsed:$.local,onToggle:be,children:ne.length===0?a.jsx("div",{className:Kn.empty,children:u("branchPicker.noBranches")}):ne.map(se=>a.jsx(eN,{name:se.name,isHead:se.isHead,ahead:se.ahead,behind:se.behind,upstream:se.upstream,onClick:()=>void J(se.name)},se.name))}),a.jsx(xC,{label:u("branchPicker.section.remote"),sectionKey:"remote",collapsed:$.remote,onToggle:be,children:de.length===0?a.jsx("div",{className:Kn.empty,children:u("branchPicker.noBranches")}):Array.from(te.entries()).map(([se,ve])=>a.jsxs("div",{children:[a.jsx("div",{className:Kn.remoteGroupLabel,children:se}),ve.map(ze=>{const Pe=ze.name.indexOf("/"),_t=Pe>0?ze.name.slice(Pe+1):ze.name;return a.jsx(eN,{name:_t,isHead:!1,onClick:()=>void J(ze.name)},ze.name)})]},se))}),a.jsx(xC,{label:u("branchPicker.section.tags"),sectionKey:"tags",collapsed:$.tags,onToggle:be,children:ue.length===0?a.jsx("div",{className:Kn.empty,children:u("branchPicker.noTags")}):ue.map(se=>a.jsxs("button",{type:"button",className:Kn.item,onClick:()=>void J(`refs/tags/${se.name}`),children:[a.jsx(sq,{size:13,className:Kn.itemIcon}),a.jsx("span",{className:Kn.itemName,children:se.name})]},se.name))})]})]}),v&&a.jsx("div",{className:`${Kn.statusBar} ${k==="error"?Kn.statusBarError:k==="success"?Kn.statusBarSuccess:""}`,children:v})]})]})}function xC({label:e,sectionKey:t,collapsed:n,onToggle:s,children:r}){return a.jsxs("div",{className:Kn.section,children:[a.jsxs("button",{type:"button",className:Kn.sectionHeader,"aria-expanded":!n,onClick:()=>s(t),children:[a.jsx(Eu,{size:12,className:`${Kn.sectionChevron} ${n?Kn.sectionChevronCollapsed:""}`}),e]}),!n&&r]})}function eN({name:e,isHead:t,ahead:n,behind:s,upstream:r,onClick:i}){return a.jsxs("button",{type:"button",className:`${Kn.item} ${t?Kn.itemActive:""}`,onClick:i,children:[t?a.jsx(Y_e,{size:13,className:`${Kn.itemIcon} ${Kn.itemStar}`}):a.jsx(jy,{size:13,className:Kn.itemIcon}),a.jsx("span",{className:Kn.itemName,children:e}),a.jsxs("span",{className:Kn.itemMeta,children:[(n??0)>0||(s??0)>0?a.jsxs("span",{className:Kn.itemAheadBehind,children:[(n??0)>0&&a.jsxs("span",{children:["↑",n]}),(s??0)>0&&a.jsxs("span",{children:["↓",s]})]}):null,r&&a.jsx("span",{className:Kn.itemUpstream,children:r}),t&&a.jsx(kh,{size:12})]})]})}const imt="_red_179c6_21",omt="_orange_179c6_24",amt="_yellow_179c6_27",lmt="_green_179c6_30",cmt="_blue_179c6_33",umt="_purple_179c6_36",cO={red:imt,orange:omt,yellow:amt,green:lmt,blue:cmt,purple:umt};function dmt(){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:a.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 hmt({name:e,title:t,ariaLabel:n,color:s,compact:r=!1}){const i=[Ee.workspaceChip,r?Ee.workspaceChipCompact:"",s?cO[s]:"",s?Ee.workspaceChipAccented:""].filter(Boolean).join(" ");return a.jsx(Td,{delayDuration:300,children:a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsxs("output",{className:i,"aria-label":n,"data-web-shell-workspace":!0,"data-web-shell-workspace-title":t,children:[a.jsx("span",{className:Ee.workspaceChipIcon,children:a.jsx(dmt,{})}),a.jsx("span",{className:Ee.workspaceChipText,children:e})]})}),a.jsx(Uu,{side:"top",children:t})]})})}function Mu({...e}){return a.jsx(EDe,{"data-slot":"dropdown-menu",...e})}function fmt({container:e,...t}){const n=Gu();return a.jsx(jDe,{"data-slot":"dropdown-menu-portal",container:e??n??void 0,...t})}const Ru=h.forwardRef(function(t,n){return a.jsx(ADe,{ref:n,"data-slot":"dropdown-menu-trigger",...t})});function Du({className:e,align:t="start",sideOffset:n=4,...s}){return a.jsx(fmt,{children:a.jsx(NDe,{"data-slot":"dropdown-menu-content",sideOffset:n,align:t,className:on("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 Tp({...e}){return a.jsx(IDe,{"data-slot":"dropdown-menu-group",...e})}function bi({className:e,inset:t,variant:n="default",...s}){return a.jsx(MDe,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:on("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 mmt({...e}){return a.jsx(RDe,{"data-slot":"dropdown-menu-radio-group",...e})}function pmt({className:e,children:t,inset:n,...s}){return a.jsxs(DDe,{"data-slot":"dropdown-menu-radio-item","data-inset":n,className:on("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:[a.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:a.jsx(LDe,{children:a.jsx(kh,{})})}),t]})}function F3({className:e,...t}){return a.jsx(PDe,{"data-slot":"dropdown-menu-separator",className:on("-mx-1 my-1 h-px bg-border",e),...t})}function sfe({...e}){return a.jsx(ODe,{"data-slot":"dropdown-menu-sub",...e})}const rfe=h.forwardRef(function({className:t,inset:n,children:s,...r},i){return a.jsxs($De,{ref:i,"data-slot":"dropdown-menu-sub-trigger","data-inset":n,className:on("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,a.jsx(Eu,{className:"ml-auto"})]})});function ife({className:e,...t}){return a.jsx(BDe,{"data-slot":"dropdown-menu-sub-content",className:on("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 gmt({workspaces:e,selectedWorkspaceCwd:t,disabled:n,busy:s,scratchSupported:r,existingFolderSupported:i,className:o,onSelectWorkspace:l,onCreateScratch:c,onOpenExistingFolder:u}){const{t:d}=nt(),[f,m]=h.useState(!1),[p,g]=h.useState(!1),b=h.useRef(!1),w=h.useRef(!1),y=e.find(x=>t?x.cwd===t:x.primary),v=r||i;return e.length<=1&&!v?null:a.jsx(Td,{delayDuration:300,children:a.jsxs(Mu,{open:f,onOpenChange:x=>{b.current=x,m(x),x&&(w.current=!0,g(!1))},children:[a.jsxs(qu,{open:p,onOpenChange:x=>{x&&(f||w.current)||g(x)},children:[a.jsx(Hu,{asChild:!0,children:a.jsx(Ru,{asChild:!0,disabled:n||s,children:a.jsxs("button",{type:"button",className:o,"aria-label":d("sidebar.workspaceSelectLabel"),onPointerEnter:()=>{b.current||(w.current=!1)},onPointerLeave:()=>{w.current=!1,g(!1)},onBlur:()=>{b.current||(w.current=!1,g(!1))},children:[a.jsx(Ck,{size:16,strokeWidth:1.2}),a.jsx("span",{"data-slot":"select-value",children:(y==null?void 0:y.label)??""})]})})}),a.jsx(Uu,{side:"top",children:y==null?void 0:y.label})]}),a.jsxs(Du,{align:"start",className:"min-w-56",children:[a.jsx(mmt,{value:y==null?void 0:y.id,onValueChange:x=>{const k=e.find(_=>_.id===x);k!=null&&k.trusted&&l(k.primary?void 0:k.cwd)},children:e.map(x=>a.jsxs(pmt,{value:x.id,disabled:!x.trusted,title:x.cwd,children:[a.jsx("span",{className:"min-w-0 flex-1 truncate",children:x.label}),!x.trusted&&a.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(i_e,{}),d("sidebar.workspaceUntrusted")]})]},x.id))}),v&&a.jsxs(a.Fragment,{children:[a.jsx(F3,{}),a.jsxs(sfe,{children:[a.jsxs(rfe,{disabled:s,children:[a.jsx(Mke,{}),d("sidebar.newWorkspace")]}),a.jsxs(ife,{children:[r&&a.jsx(bi,{onSelect:c,children:d("sidebar.startFromScratch")}),i&&a.jsx(bi,{onSelect:u,children:d("sidebar.useExistingFolder")})]})]})]})]})]})})}function bmt(e,t){const n=t.trim().toLocaleLowerCase();return n?e.filter(s=>`${s.label}
${s.searchText??""}`.toLocaleLowerCase().includes(n)):[...e]}function xK({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 ymt({availableWidth:e,items:t,currentVisibility:n,expansionMargin:s}){const r=xK({availableWidth:e,items:t}),i=xK({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 vmt({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 wmt({currentModelLabel:e,lastConfirmedModelLabel:t}){const n=e||t;return{modelLabel:n,modelLabelReady:!!n,nextConfirmedModelLabel:n}}const xmt=["approvalMode","gitBranch","model","widthMode","voice","workspace"],kmt=new Set(xmt),_mt={"&":{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 kK(){return typeof window>"u"?!1:typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches}function Smt({tag:e,content:t,tooltip:n,onActivate:s,onRemove:r}){const i=h.useRef(null),o=Gu(),l=n!=null,c=a.jsx("span",{className:Ee.tagContent,"data-web-shell-composer-tag-trigger":!0,role:s?"button":void 0,tabIndex:s||l?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=a.jsxs("span",{ref:i,className:Ee.tag,"data-web-shell-composer-tag":!0,children:[l?a.jsx(qae,{asChild:!0,children:c}):c,r&&a.jsx("button",{type:"button",className:Ee.tagRemove,"aria-label":`Remove ${FP(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 l?a.jsxs(Fae,{disableHoverableContent:!1,children:[u,a.jsx(Hae,{container:o??void 0,children:a.jsx(Uae,{className:Ee.tagTooltip,"data-web-shell-composer-tag-tooltip":!0,sideOffset:6,collisionPadding:8,avoidCollisions:!0,children:n})})]}):u}function Cmt(){return a.jsx("svg",{className:Ee.sendIcon,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:a.jsx("path",{d:"M10 15.5v-11M5.5 9 10 4.5 14.5 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Tmt(){return a.jsx("span",{className:Ee.stopIcon,"aria-hidden":"true"})}function Emt(){return a.jsx("span",{className:Ee.loadingIcon,"aria-hidden":"true"})}function Amt(){return a.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[7,12,17].flatMap(e=>[7,12,17].map(t=>a.jsx("circle",{cx:t,cy:e,r:"1.35",fill:"currentColor"},`${t}-${e}`)))})}function jmt({text:e}){const s=oO(),[r,i]=h.useState(s?e:""),[o,l]=h.useState(!1);return h.useEffect(()=>{if(s){i(e),l(!1);return}let c=0,u=0;const d=()=>{let f=0;i(""),l(!1);const m=()=>{if(f+=1,i(e.slice(0,f)),f===e.length){c+=1,l(!0),c<2&&(u=window.setTimeout(d,3e3));return}u=window.setTimeout(m,45)};u=window.setTimeout(m,45)};return d(),()=>window.clearTimeout(u)},[s,e]),a.jsxs("span",{className:Ee.typewriterPlaceholder,"data-web-shell-composer-typewriter":!0,"aria-hidden":"true",children:[r,!s&&a.jsx("span",{className:`${Ee.typewriterCaret} ${o?Ee.typewriterCaretFinished:""}`,children:"_"})]})}function Nmt({mode:e}){return e==="wide"?a.jsxs("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:[a.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)"}),a.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)"})]}):a.jsx("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:a.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 tN(){return a.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[a.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"}),a.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 Imt(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 Mmt=[{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 Rmt(){return a.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"m3 8.3 3.1 3.1L13 4.6",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function ofe(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 Dmt(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]??ofe(e,t)}function _K({open:e,items:t,activeId:n,onOpenChange:s,onSelect:r,trigger:i,tooltip:o,showCheck:l=!1,searchable:c=!1,searchLabel:u,noResultsLabel:d}){const[f,m]=h.useState(""),[p,g]=h.useState(null),b=h.useRef(!1),w=h.useRef(!1),y=h.useRef(null),v=t.some(_=>_.description||_.icon),x=c?bmt(t,f):t;h.useEffect(()=>{e||m("")},[e]);const k=v||l;return a.jsxs(Yf,{open:e,onOpenChange:_=>{var T;_&&(b.current=!1,w.current=!1,g(((T=y.current)==null?void 0:T.closest("[data-web-shell-root]"))??null)),s(_)},children:[o?a.jsx(Td,{delayDuration:300,children:a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsx(Gp,{ref:y,asChild:!0,children:i})}),a.jsx(Uu,{side:"top",children:o})]})}):a.jsx(Gp,{ref:y,asChild:!0,children:i}),a.jsxs(Xf,{side:"top",align:"start",collisionPadding:8,collisionBoundary:p??void 0,"data-web-shell-toolbar-popover":!0,onClick:_=>_.stopPropagation(),onPointerDownOutside:_=>{const T=_.target;T instanceof Element&&T.closest("[data-web-shell-toolbar-popover-trigger]")&&(w.current=!0)},onCloseAutoFocus:_=>{if(w.current){_.preventDefault(),w.current=!1;return}if(document.activeElement instanceof HTMLElement&&document.activeElement.closest("[data-web-shell-toolbar-popover]")){_.preventDefault();return}b.current&&(_.preventDefault(),b.current=!1)},children:[c&&a.jsx(Ur,{type:"search",value:f,"aria-label":u,placeholder:u,autoComplete:"off",onChange:_=>m(_.target.value)}),a.jsxs("div",{className:`${Ee.dropdownList} ${v?Ee.dropdownRich:l?Ee.dropdownCheck:""} ${c?Ee.dropdownListConstrained:""}`,children:[x.map(_=>a.jsx("button",{type:"button",className:`${Ee.dropdownItem} ${_.id===n?Ee.dropdownItemActive:""}`,title:_.label,onClick:()=>{b.current=!0,r(_.id)},children:k?a.jsxs(a.Fragment,{children:[v&&a.jsx("span",{className:Ee.dropdownItemIcon,children:_.icon}),a.jsxs("span",{className:Ee.dropdownItemContent,children:[a.jsx("span",{className:Ee.dropdownItemLabel,children:_.label}),_.description&&a.jsx("span",{className:Ee.dropdownItemDesc,children:_.description})]}),a.jsx("span",{className:Ee.dropdownItemCheck,children:_.id===n?a.jsx(Rmt,{}):null})]}):_.label},_.id)),x.length===0&&d&&a.jsx("div",{className:Ee.dropdownEmpty,role:"status",children:d(f)})]})]})]})}function Lmt({menu:e,anchorRef:t,panelRef:n,detailRef:s,onClose:r,onSelect:i,onAccept:o}){const l=h.useRef([]),c=h.useRef(null),[u,d]=h.useState(null),[f,m]=h.useState(null);h.useEffect(()=>{var g;(g=l.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",w=>{w===b&&Reflect.deleteProperty(b,"key")},{once:!0}))};return window.addEventListener("keydown",g,{capture:!0}),()=>{window.removeEventListener("keydown",g,{capture:!0})}},[]);const p=dht(e.items,e.kind);return a.jsxs(a.Fragment,{children:[a.jsxs(Yf,{open:!0,onOpenChange:g=>{g||r()},children:[a.jsx(oW,{virtualRef:t}),a.jsx(Xf,{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 w,y;const b=g.target;b instanceof Node&&((w=t.current)!=null&&w.contains(b)||(y=s.current)!=null&&y.contains(b))&&g.preventDefault()},onMouseDown:g=>g.preventDefault(),onMouseLeave:g=>{var w;const b=g.relatedTarget;b instanceof Node&&((w=s.current)!=null&&w.contains(b))||m(null)},children:a.jsx("div",{className:Ee.slashPanel,children:a.jsx("div",{className:Ee.slashPanelBody,children:a.jsx("div",{className:Ee.slashList,onScroll:()=>m(null),children:e.items.map((g,b)=>{const w=p[b];return a.jsxs("div",{className:Ee.slashEntry,children:[w.showHeader&&a.jsxs(a.Fragment,{children:[w.showDivider&&a.jsx("div",{className:Ee.slashSection}),a.jsxs("div",{className:Ee.slashSectionHeader,children:[a.jsx("span",{children:g.section}),w.count>0?a.jsx("span",{className:Ee.slashSectionCount,children:w.count}):null]})]}),a.jsxs("button",{ref:y=>{l.current[b]=y},type:"button",role:"option","aria-selected":b===e.selectedIndex,"data-has-description":g.detail?"":void 0,className:`${Ee.slashItem} ${b===e.selectedIndex?Ee.slashItemActive:""}`,onMouseEnter:y=>{if(i(b),!g.detail){m(null);return}c.current=y.currentTarget;const v=y.currentTarget.getBoundingClientRect(),x=u==null?void 0:u.getBoundingClientRect(),k=(x==null?void 0:x.left)??0,_=(x==null?void 0:x.right)??window.innerWidth,T=(x==null?void 0:x.top)??0,S=(x==null?void 0:x.bottom)??window.innerHeight,C=Math.min(320,_-k-24),N=_-v.right>=C+8?"right":v.left-k>=C+8?"left":v.top-T>=S-v.bottom?"top":"bottom";m({label:g.label,detail:g.detail,side:N})},onMouseDown:y=>{y.preventDefault(),y.stopPropagation(),o(b)},children:[a.jsx("span",{className:Ee.slashCommand,children:g.label}),g.detail&&a.jsx("span",{className:Ee.slashDescription,children:g.detail})]})]},`${g.id}:${b}`)})})})})})]}),a.jsxs(Yf,{open:!!f,onOpenChange:g=>{g||m(null)},children:[a.jsx(oW,{virtualRef:c}),f&&a.jsx(Xf,{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 w;const b=g.relatedTarget;b instanceof Node&&((w=n.current)!=null&&w.contains(b))||m(null)},children:a.jsxs("div",{className:Ee.slashDetail,children:[a.jsx("div",{className:Ee.slashDetailCommand,children:f.label}),a.jsx("div",{className:Ee.slashDetailText,children:f.detail})]})})]})]})}function Pmt({actions:e,onRun:t,onPressKey:n,showKeyHints:s=!0}){const{t:r}=nt();return a.jsxs("div",{className:Ee.quickActionsPanel,onMouseDown:i=>i.stopPropagation(),onClick:i=>i.stopPropagation(),children:[a.jsx("div",{className:Ee.quickActionsHeader,children:r("quickActions.title")}),a.jsxs("div",{className:Ee.quickActionsLayout,children:[a.jsx("div",{className:Ee.quickActionsGrid,children:e.map(i=>a.jsx("button",{type:"button",className:Ee.quickAction,onClick:()=>t(i),children:a.jsx("span",{className:Ee.quickActionLabel,children:i.label})},i.id))}),s&&a.jsx("div",{className:Ee.quickKeysGrid,children:Mmt.map(i=>a.jsx("button",{type:"button",className:Ee.quickKey,title:r(i.descriptionKey),onMouseDown:o=>o.preventDefault(),onClick:()=>n(i),children:a.jsx("span",{className:Ee.quickKeyLabel,children:i.label})},i.id))})]})]})}const afe=h.memo(h.forwardRef(function(t,n){var an;const{onSubmit:s,onInputTextChange:r,onAttachmentsChange:i,onCycleMode:o,onToggleShortcuts:l,onCancel:c,isRunning:u=!1,isPreparing:d=!1,cancelArmed:f=!1,disabled:m=!1,placeholderText:p="Type a message...",animatePlaceholder:g=!0,commands:b,skills:w=[],slashCommandCategoryOrder:y,queuedMessages:v=[],onPopQueuedMessages:x,currentMode:k="default",currentModel:_="",gitBranch:T,gitWorktree:S,gitCwd:C,gitModeIntent:N,onGitModeIntentChange:E,gitStatus:O,onOpenGitDiff:B,onOpenCommit:D,workspaceName:j,workspaceTitle:L,workspaceColor:z,chatWidthMode:I="1000",showChatWidthToggle:$=!0,chatWidthToggleMin:K,visibleToolbarActions:R,availableModels:Y=[],onSelectMode:W,onSelectModel:M,workspaces:F,selectedWorkspaceCwd:J,workspaceSelectionDisabled:V=!1,onSelectWorkspace:U,scratchWorkspaceSupported:le=!1,existingFolderWorkspaceSupported:pe=!1,workspaceMutationBusy:fe=!1,onCreateScratchWorkspace:Q,onOpenExistingWorkspace:ne,atWorkspaceCwd:de,onChatWidthModeChange:ue,onFocusFooter:me,dialogOpen:te=!1,followupState:ae,onAcceptFollowup:be,onDismissFollowup:se,sessionId:ve,sessionName:ze,composerInput:Pe,composerInputVersion:_t,builtinAtProviders:Pt,atProviders:St,composerTagIcons:he,voiceTarget:Ae,voiceStatusRevision:rt}=t,{renderComposerToolbarStart:dt,renderComposerToolbarEnd:jt,renderComposerToolbarRight:et,renderComposerTag:Mt,renderComposerTagTooltip:sn,onComposerTagClick:Ye,parseUserMessageContent:$n}=Vu(),Te=OYe({onSubmit:s,onInputTextChange:r,onCycleMode:o,onToggleShortcuts:l,disabled:m,placeholderText:p,commands:b,skills:w,slashCommandCategoryOrder:y,queuedMessages:v,onPopQueuedMessages:x,currentMode:k,onFocusFooter:me,dialogOpen:te,followupState:ae,onAcceptFollowup:be,onDismissFollowup:se,sessionId:ve,sessionName:ze,composerInput:Pe,composerInputVersion:_t,builtinAtProviders:Pt,atProviders:St,atWorkspaceCwd:de,composerTagIcons:he,parseUserMessageContent:$n,renderComposerTag:Mt,renderComposerTagTooltip:sn,onComposerTagClick:Ye,editorTheme:_mt}),{t:ie}=nt();h.useImperativeHandle(n,()=>Te.handle,[Te.handle]),h.useEffect(()=>{i==null||i(Te.hasAttachments)},[Te.hasAttachments,i]);const[it,we]=h.useState(!1),[We,ce]=h.useState(!1),[De,ct]=h.useState(!1),[qe,Ve]=h.useState(!1),[Qt,Un]=h.useState(kK),[Ie,wt]=h.useState(!1),Wt=h.useRef(null),Me=h.useRef(null),Je=h.useRef(null),pt=h.useRef(null),ln=h.useRef(null),Bn=h.useRef(null),ns=h.useRef(null),lt=h.useRef(null),Xe=h.useRef(null),ot=h.useRef(null),Tt=h.useRef(null),[fn,Qn]=h.useState(!1),[Os,rr]=h.useState(!1),[Es,cs]=h.useState({workspaceSelect:!1,workspace:!1,gitBranch:!1,mode:!1,model:!1}),[$t,xs]=h.useState(""),Ce=Te.slashMenu,mn=Te.closeSlashMenu,gt=Te.atMenu,wn=Te.closeAtMenu,Wn=!!Ce,di=!!gt,$s=g&&!m&&!!p&&!Te.hasInput()&&!Ie&&!Te.shellMode&&!(ae!=null&&ae.isVisible);h.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const Be=window.matchMedia("(hover: none), (pointer: coarse)"),cn=()=>Un(kK());return cn(),Be.addEventListener("change",cn),()=>Be.removeEventListener("change",cn)},[]),h.useEffect(()=>{Qt||ct(!1)},[Qt]),h.useEffect(()=>{if(!Wn&&!di)return;const Be=cn=>{var dn,hn,Tr;const Jn=cn.target,Us=Wt.current;Jn instanceof Node&&Us&&!Us.contains(Jn)&&!((dn=Me.current)!=null&&dn.contains(Jn))&&!((hn=Je.current)!=null&&hn.contains(Jn))&&!((Tr=pt.current)!=null&&Tr.contains(Jn))&&(mn(),wn())};return window.addEventListener("mousedown",Be),window.addEventListener("touchstart",Be),()=>{window.removeEventListener("mousedown",Be),window.removeEventListener("touchstart",Be)}},[di,Wn,wn,mn]),h.useEffect(()=>{const Be=Wt.current,cn=K;if(!Be||cn===void 0){Qn(!1);return}const Jn=()=>{Qn(Be.getBoundingClientRect().width>=cn-50)};Jn();const Us=new ResizeObserver(Jn);return Us.observe(Be),()=>Us.disconnect()},[K]);const Gr=h.useMemo(()=>pv.map(Be=>({id:Be,label:Dmt(Be,ie),description:ie(`mode.desc.${Be}`),icon:a.jsx(xx,{mode:Be})})),[ie]),Gs=h.useMemo(()=>{if(!R)return null;const Be=R.filter(cn=>kmt.has(cn));return new Set(Be)},[R]),Ks=Be=>Gs?Gs.has(Be):!0,Qr=Ks("approvalMode"),Rt=Ks("model"),Ii=h.useMemo(()=>new Set(b.map(Be=>Be.name.replace(/^\/+/,""))),[b]),uo=h.useCallback(Be=>Ii.has(Be),[Ii]),Or=h.useMemo(()=>[{id:"new",label:ie("quickActions.new"),action:{type:"run",command:"/new"}},{id:"resume",label:ie("quickActions.resume"),action:{type:"run",command:"/resume"}},{id:"delete",label:ie("quickActions.delete"),action:{type:"run",command:"/delete"}},{id:"branch",label:ie("quickActions.branch"),action:{type:"run",command:"/branch"}},{id:"rewind",label:ie("quickActions.rewind"),action:{type:"run",command:"/rewind"}},{id:"history-search",label:ie("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:ie("quickActions.recap"),action:{type:"run",command:"/recap"}},{id:"stats",label:ie("quickActions.stats"),action:{type:"run",command:"/stats"}},{id:"context",label:ie("quickActions.context"),action:{type:"run",command:"/context"}},{id:"status",label:ie("quickActions.status"),action:{type:"run",command:"/status"}},{id:"skills",label:ie("quickActions.skills"),action:{type:"run",command:"/skills detail"}},{id:"tools",label:ie("quickActions.tools"),action:{type:"run",command:"/tools desc"}},{id:"agents",label:ie("quickActions.agents"),action:{type:"run",command:"/agents"}},{id:"mcp",label:ie("quickActions.mcp"),action:{type:"run",command:"/mcp"}},{id:"memory",label:ie("quickActions.memory"),action:{type:"run",command:"/memory"}},{id:"theme",label:ie("quickActions.theme"),action:{type:"run",command:"/theme"}},{id:"shell",label:Te.shellMode?ie("quickActions.exitShellMode"):ie("quickActions.shellMode"),action:{type:"shell"}},{id:"goal",label:ie("quickActions.setGoal"),action:{type:"insert",text:"/goal "}}].filter(Be=>{const cn=Imt(Be);return!cn||uo(cn)}),[Te.shellMode,uo,ie]),hi=h.useMemo(()=>Y.map(Be=>({id:Be.id,label:up(Be.label||Be.id),searchText:`${Be.label??""}
${Be.id}`})),[Y]),us=h.useCallback(Be=>{W==null||W(Be),we(!1),Te.focus()},[W,Te]),Jt=h.useCallback(Be=>{M==null||M(Be),ce(!1),Te.focus()},[M,Te]),Ys=h.useCallback(Be=>{if(Te.mobileComposer){Be.ctrlKey&&Be.key==="r"&&Te.searchState.openHistorySearch();return}const cn=Te.viewRef.current;cn&&(cn.focus(),cn.contentDOM.dispatchEvent(new KeyboardEvent("keydown",{...Be,bubbles:!0,cancelable:!0})))},[Te]),Bs=h.useCallback(Be=>{if(ct(!1),we(!1),ce(!1),Te.closeSlashMenu(),Te.closeAtMenu(),Be.action.type==="insert"){Te.insertText(Be.action.text,{mode:"replace"});return}if(Be.action.type==="shell"){Te.toggleShellMode();return}if(Be.action.type==="key"){Ys(Be.action.item.event);return}s(Be.action.command)},[Te,Ys,s]),ho=h.useCallback(Be=>{Ys(Be.event),Be.id==="ctrl-r"&&ct(!1)},[Ys]),{searchMode:Si,searchQuery:si,searchMatches:pr,searchActiveIndex:xe,searchInputRef:Ge,searchUiRef:tt,closeSearch:Zt,restoreSearchMatch:Tn,handleSearchKeyDown:Gn,handleSearchInput:Jr,handleSearchCompositionEnd:zs}=Te.searchState,vs=Be=>{const cn=Mt==null?void 0:Mt({tag:Be,placement:"composer",readonly:!1});if(cn!=null)return cn;const Jn=H6(Be),Us=U6(Be),dn=Be.kind?"":Jn,hn=Be.icon??h1(Be.kind,he),Tr=hn&&(pD(hn)||Rv(hn))?hn:void 0;return!dn&&!Us?a.jsx("span",{className:Ee.tagLabel,children:Be.id}):a.jsxs(a.Fragment,{children:[Tr&&a.jsx("span",{className:Ee.tagIcon,style:$g("--composer-tag-icon-url",Tr),"aria-hidden":"true"}),dn&&a.jsx("span",{className:Ee.tagLabel,children:dn}),Us&&a.jsx("span",{className:Ee.tagValue,children:Us})]})},$r=ofe(k,ie),Xs=_?((an=Y.find(Be=>Be.id===_))==null?void 0:an.label)??(_.startsWith("qwen-route:")?"":up(_)):"",{modelLabel:fs,modelLabelReady:ks}=wmt({currentModelLabel:Xs,lastConfirmedModelLabel:$t}),gr=F==null?void 0:F.find(Be=>J?Be.cwd===J:Be.primary),Vt=(gr==null?void 0:gr.label)??"",Sr=!!(F&&U&&(F.length>1||le||pe)),ir=!!(j&&Ks("workspace")),Ot=!!(T&&Ks("gitBranch"));h.useLayoutEffect(()=>{Xs&&Xs!==$t&&xs(Xs)},[Xs,$t]);const Ns=Es.workspaceSelect,Qs=Es.workspace,Cr=Es.gitBranch,$e=Es.mode,ut=Es.model,Ht=u&&!Te.hasContent,pn=Qt&&Os;return h.useEffect(()=>{pn&&ct(!1)},[pn]),h.useLayoutEffect(()=>{const Be=ln.current,cn=Bn.current,Jn=ns.current,Us=Tt.current;if(!Be||!cn||!Jn||!Us)return;const dn=()=>{const Js=Po=>{const Mi=Us.querySelector(`[data-toolbar-measure="${Po}:collapsed"]`),Ri=Us.querySelector(`[data-toolbar-measure="${Po}:expanded"]`);return Math.max(0,Math.ceil((Ri==null?void 0:Ri.getBoundingClientRect().width)??0)-Math.ceil((Mi==null?void 0:Mi.getBoundingClientRect().width)??0))},Er=[...Sr?[{id:"workspaceSelect",expansionWidth:Js("workspaceSelect")}]:[],...ir?[{id:"workspace",expansionWidth:Js("workspace")}]:[],...Ot?[{id:"gitBranch",expansionWidth:Js("gitBranch")}]:[],...Qr?[{id:"mode",expansionWidth:Js("mode")}]:[],...Rt?[{id:"model",expansionWidth:Js("model"),ready:ks}]:[]],To=Er.reduce((Po,Mi)=>Po+(Es[Mi.id]?Mi.expansionWidth:0),0),Kr=cn.scrollWidth,ga=Math.ceil(Number.parseFloat(getComputedStyle(Be).columnGap)||0),ri=vmt({toolbarWidth:Math.floor(Be.getBoundingClientRect().width),leadingWidth:Kr,rightWidth:Math.ceil(Jn.getBoundingClientRect().width),currentExpansionWidth:To,gap:ga}),Zr=ymt({availableWidth:ri,items:Er,currentVisibility:Es,expansionMargin:Er.length}),_s={workspaceSelect:Zr.workspaceSelect??!1,workspace:Zr.workspace??!1,gitBranch:Zr.gitBranch??!1,mode:Zr.mode??!1,model:Zr.model??!1};cs(Po=>Object.keys(_s).every(Ri=>Po[Ri]===_s[Ri])?Po:_s)};dn();const hn=new ResizeObserver(dn);hn.observe(Be),hn.observe(cn),hn.observe(Jn);for(const Js of Us.children)hn.observe(Js);const Tr=[lt.current,Xe.current,ot.current].filter(Js=>Js!==null),br=()=>{for(const Js of Tr){hn.observe(Js);for(const Er of Js.children)hn.observe(Er)}};br();const Lo=new MutationObserver(()=>{br(),dn()});for(const Js of Tr)Lo.observe(Js,{attributes:!0,characterData:!0,childList:!0,subtree:!0});return()=>{Lo.disconnect(),hn.disconnect()}},[jt,et,dt,m,T,Ot,u,fs,ks,$r,ze,Rt,Qr,Es,ir,j,Sr,Vt]),a.jsxs("div",{className:`${Ee.editorShell} ${it||We?Ee.editorShellDropdownOpen:""}`,"data-composer":!0,"data-web-shell-composer":!0,children:[a.jsxs("div",{ref:Wt,className:Ee.container,"data-web-shell-composer-surface":!0,"data-typewriter-visible":$s||void 0,onClick:()=>{we(!1),ce(!1),ct(!1),Te.focus()},children:[a.jsx(Zdt,{targetRef:Wt}),Si&&a.jsxs("div",{ref:tt,className:Ee.searchPanel,onMouseDown:Be=>Be.stopPropagation(),onClick:Be=>Be.stopPropagation(),children:[a.jsxs("div",{className:Ee.searchBar,children:[a.jsx("span",{className:Ee.searchLabel,children:ie("editor.searchLabel")}),a.jsx("input",{ref:Ge,className:Ee.searchInput,value:si,onChange:Jr,onCompositionEnd:zs,onKeyDown:Gn,placeholder:ie("editor.searchPlaceholder")})]}),pr.length>0&&a.jsx("div",{className:Ee.searchResults,children:pr.map((Be,cn)=>a.jsxs("button",{type:"button",className:`${Ee.searchResult} ${cn===xe?Ee.searchResultActive:""}`,onMouseDown:Jn=>{Jn.preventDefault(),Tn?Tn(Be):Te.replaceEditorText(Be),Zt(!1)},children:[a.jsx("span",{className:Ee.searchResultMarker,children:cn===xe?"›":""}),a.jsx("span",{className:Ee.searchResultText,children:Be})]},`${Be}-${cn}`))}),pr.length===0&&a.jsx("div",{className:Ee.searchEmpty,children:ie("editor.noHistory")})]}),a.jsxs("div",{className:Ee.content,children:[(Te.composerTags.length>0||Te.pastedImages.length>0)&&a.jsxs("div",{className:Ee.attachments,"data-web-shell-composer-attachments":!0,children:[Te.composerTags.length>0&&a.jsx(zae,{delayDuration:0,disableHoverableContent:!1,children:a.jsx("div",{className:Ee.tags,children:Te.composerTags.map(Be=>{const cn={tag:Be,placement:"composer",readonly:!1};let Jn;try{Jn=sn==null?void 0:sn(cn)}catch(Us){console.warn("[WebShell] composer tag tooltip render failed",Us)}return a.jsx(Smt,{tag:Be,content:vs(Be),tooltip:Jn,onActivate:Ye?Us=>Ye({...cn,anchorRect:Us}):void 0,onRemove:Be.removable!==!1?()=>{var Us;Te.removeTopTag(Be.id),(Us=Te.viewRef.current)==null||Us.focus()}:void 0},Be.id)})})}),Te.pastedImages.length>0&&a.jsx("div",{className:Ee.images,children:Te.pastedImages.map((Be,cn)=>a.jsxs("div",{className:Ee.imageThumb,children:[a.jsx("img",{src:`data:${Be.media_type};base64,${Be.data}`,alt:""}),a.jsx("button",{className:Ee.imageRemove,onClick:Jn=>{Jn.stopPropagation(),Te.removeImage(cn)},children:"×"})]},cn))})]}),Te.slashMenu&&a.jsx(Lmt,{menu:Te.slashMenu,anchorRef:Wt,panelRef:Me,detailRef:Je,onClose:Te.closeSlashMenu,onSelect:Te.selectSlashCompletion,onAccept:Te.acceptSlashCompletion}),Te.atMenu&&a.jsx(tht,{menu:Te.atMenu,anchorRef:Wt,panelRef:pt,onSelect:Te.selectAtCompletion,onAccept:Te.acceptAtCompletion,onBack:()=>{const Be=Te.backAtCategories();return Be==="categories"&&window.setTimeout(()=>Te.focus(),0),!!Be},onSearch:Te.updateAtSearch,onSelectTab:Te.selectAtTab}),a.jsxs("div",{className:Ee.editorArea,onPointerDownCapture:()=>wt(!0),onKeyDownCapture:()=>wt(!0),onBlurCapture:Be=>{Be.currentTarget.contains(Be.relatedTarget)||wt(!1)},children:[$s&&a.jsx(jmt,{text:p}),Te.shellMode&&a.jsx("span",{className:Ee.shellPrefix,"aria-hidden":"true",children:"!"}),Te.mobileComposer?a.jsx("textarea",{ref:Te.mobileComposer.textareaRef,className:Ee.mobileTextarea,value:Te.mobileComposer.value,onChange:Te.mobileComposer.onChange,onBlur:Te.mobileComposer.onBlur,onPaste:Te.mobileComposer.onPaste,placeholder:Te.mobileComposer.placeholder,disabled:Te.disabled,rows:1,enterKeyHint:"enter",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,"data-web-shell-composer-editor":!0}):a.jsx("div",{ref:Te.containerRef,"data-web-shell-composer-editor":!0})]}),a.jsxs("div",{ref:ln,className:Ee.toolbar,"data-mobile-voice-active":pn||void 0,children:[a.jsxs("div",{ref:Bn,className:Ee.toolbarLeading,"data-web-shell-toolbar-leading":!0,children:[dt&&a.jsx("div",{ref:lt,className:Ee.toolbarStart,children:a.jsx(dt,{disabled:m,isRunning:u,currentMode:k,currentModel:_,sessionName:ze})}),a.jsxs("div",{className:Ee.toolbarLeft,children:[Sr&&F&&U&&a.jsx(gmt,{workspaces:F,selectedWorkspaceCwd:J,disabled:V,busy:fe,scratchSupported:le,existingFolderSupported:pe,className:`${Ee.toolBtn} ${Ee.workspaceSelectTrigger} ${Ns?"":Ee.workspaceSelectTriggerCompact}`,onSelectWorkspace:U,onCreateScratch:Q??(()=>{}),onOpenExistingFolder:ne??(()=>{})}),ir&&j&&a.jsx(hmt,{name:j,title:L??j,color:z,compact:!Qs,ariaLabel:ie("workspace.paneLabel",{name:j})}),Ot&&T&&(N&&E?a.jsx(Eft,{branch:T,compact:!Cr,intent:N,onIntentChange:E}):a.jsx(lO,{open:qe,onOpenChange:Ve,workspaceCwd:(gr==null?void 0:gr.cwd)??"",gitCwd:C,onOpenDiff:B,onOpenCommit:D,children:a.jsx("button",{type:"button",className:Ee.gitBranchChipButton,"aria-label":tfe(T,O,ie),children:a.jsx(nfe,{branch:T,status:O,compact:!Cr,worktree:S})})})),Qr&&a.jsx("div",{className:`${Ee.dropdownWrapper} ${$e?"":Ee.dropdownWrapperCompact}`,children:a.jsx(_K,{open:it,items:Gr,activeId:k,onOpenChange:Be=>{we(Be),Be&&ce(!1)},onSelect:us,tooltip:$r,trigger:a.jsxs("button",{className:`${Ee.toolBtn} ${Ee.modeToolBtn} ${$e?"":Ee.toolBtnCompact}`,"data-web-shell-mode-button":!0,"data-web-shell-toolbar-popover-trigger":!0,onClick:Be=>{Be.stopPropagation(),Te.closeSlashMenu(),Te.closeAtMenu(),ct(!1)},"aria-label":ie("status.mode"),children:[a.jsx("span",{className:Ee.toolBtnModeIcon,children:a.jsx(xx,{mode:k})}),$e&&a.jsx("span",{className:Ee.toolBtnText,children:$r}),a.jsx("span",{className:Ee.toolBtnArrow,children:a.jsx(Pc,{})})]})})}),Rt&&a.jsx("div",{className:`${Ee.dropdownWrapper} ${ut?"":Ee.dropdownWrapperCompact}`,children:a.jsx(_K,{open:We,items:hi,activeId:_,onOpenChange:Be=>{ce(Be),Be&&we(!1)},onSelect:Jt,tooltip:fs,showCheck:!0,searchable:!0,searchLabel:ie("common.search"),noResultsLabel:Be=>ie("model.noMatch",{query:Be}),trigger:a.jsxs("button",{className:`${Ee.toolBtn} ${Ee.modelToolBtn} ${ut?"":Ee.toolBtnCompact}`,"data-web-shell-model-button":!0,"data-web-shell-toolbar-popover-trigger":!0,onClick:Be=>{Be.stopPropagation(),Te.closeSlashMenu(),Te.closeAtMenu(),ct(!1)},"aria-label":`${ie("model.select")}: ${fs}`,title:fs,children:[a.jsx("span",{className:Ee.toolBtnModelIcon,children:a.jsx(tN,{})}),ut&&a.jsx("span",{className:Ee.toolBtnText,children:fs}),a.jsx("span",{className:Ee.toolBtnArrow,children:a.jsx(Pc,{})})]})})}),jt&&a.jsx("div",{ref:Xe,className:Ee.toolbarEnd,children:a.jsx(jt,{disabled:m,isRunning:u,currentMode:k,currentModel:_,sessionName:ze})})]})]}),a.jsxs("div",{ref:ns,className:Ee.toolbarRight,children:[Qt&&Or.length>0&&a.jsx("button",{className:`${Ee.toolBtn} ${Ee.quickActionsBtn}`,"data-hide-during-mobile-voice":!0,onClick:Be=>{Be.stopPropagation(),Te.closeSlashMenu(),Te.closeAtMenu(),we(!1),ce(!1),ct(cn=>!cn)},"aria-expanded":De,"aria-label":ie("quickActions.open"),title:ie("quickActions.open"),"data-tooltip":ie("quickActions.open"),children:a.jsx("span",{className:Ee.toolBtnIcon,children:a.jsx(Amt,{})})}),et&&a.jsx("div",{ref:ot,className:Ee.toolbarRightCustom,"data-hide-during-mobile-voice":!0,children:a.jsx(et,{disabled:m,isRunning:u,currentMode:k,currentModel:_,sessionName:ze})}),$&&fn&&Ks("widthMode")&&a.jsx("button",{className:`${Ee.toolBtn} ${Ee.widthModeBtn}`,"data-hide-during-mobile-voice":!0,onClick:Be=>{Be.stopPropagation(),ue==null||ue(I==="wide"?"1000":"wide")},disabled:!ue,"aria-label":ie(I==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),title:ie(I==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),"data-tooltip":ie(I==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),children:a.jsx("span",{className:Ee.toolBtnIcon,children:a.jsx(Nmt,{mode:I})})}),Ks("voice")&&a.jsx($ht,{disabled:m,onActiveChange:rr,target:Ae,statusRevision:rt,onInsert:Be=>{const cn=Te.getText(),Jn=cn&&!/\s$/.test(cn)?" ":"";Te.insertText(`${Jn}${Be} `),Te.focus()}}),a.jsx("button",{className:d||Ht?`${Ee.sendBtn} ${Ee.sendBtnRunning}${f?` ${Ee.sendBtnArmed}`:""}`:Ee.sendBtn,disabled:d?!0:Ht?!c:Te.disabled||!Te.hasContent,"data-web-shell-composer-submit":!0,onClick:Be=>{if(Be.stopPropagation(),!d){if(Ht){c==null||c();return}Te.submitText()}},"aria-label":ie(d?"common.loading":Ht?f?"stream.cancelArmed":"stream.cancel":"editor.send"),title:u&&f?ie("stream.cancelArmed"):void 0,children:d?a.jsx(Emt,{}):Ht?f?a.jsx("span",{className:Ee.escLabel,"aria-hidden":"true",children:"Esc"}):a.jsx(Tmt,{}):a.jsx(Cmt,{})}),a.jsx("span",{role:"status","aria-live":"polite",className:Ee.srOnly,children:u&&f?ie("stream.cancelArmed"):""})]})]}),a.jsxs("div",{ref:Tt,className:Ee.toolbarMeasurements,"aria-hidden":"true",children:[Sr&&gr&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{"data-toolbar-measure":"workspaceSelect:collapsed",className:`${Ee.toolBtn} ${Ee.workspaceSelectTrigger} ${Ee.workspaceSelectTriggerCompact}`,children:[a.jsx(Ck,{size:16,strokeWidth:1.2}),a.jsx("span",{className:Ee.toolBtnText,children:Vt}),a.jsx("span",{className:Ee.toolBtnArrow,children:a.jsx(Pc,{})})]}),a.jsxs("span",{"data-toolbar-measure":"workspaceSelect:expanded",className:`${Ee.toolBtn} ${Ee.workspaceSelectTrigger}`,children:[a.jsx(Ck,{size:16,strokeWidth:1.2}),a.jsx("span",{className:Ee.toolBtnText,children:Vt}),a.jsx("span",{className:Ee.toolBtnArrow,children:a.jsx(Pc,{})})]})]}),ir&&j&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{"data-toolbar-measure":"workspace:collapsed",className:`${Ee.workspaceChip} ${Ee.workspaceChipCompact}`,children:[a.jsx("span",{className:Ee.workspaceChipIcon}),a.jsx("span",{className:Ee.workspaceChipText,children:j})]}),a.jsxs("span",{"data-toolbar-measure":"workspace:expanded",className:Ee.workspaceChip,children:[a.jsx("span",{className:Ee.workspaceChipIcon}),a.jsx("span",{className:Ee.workspaceChipText,children:j})]})]}),Ot&&T&&a.jsxs(a.Fragment,{children:[a.jsx("span",{"data-toolbar-measure":"gitBranch:collapsed",className:`${Ee.gitBranchChip} ${Ee.gitBranchChipCompact}`,children:a.jsx(wR,{branch:T,status:O,compact:!0,worktree:S})}),a.jsx("span",{"data-toolbar-measure":"gitBranch:expanded",className:Ee.gitBranchChip,children:a.jsx(wR,{branch:T,status:O,compact:!1,worktree:S})})]}),a.jsxs("span",{"data-toolbar-measure":"mode:collapsed",className:`${Ee.toolBtn} ${Ee.modeToolBtn} ${Ee.toolBtnCompact}`,children:[a.jsx("span",{className:Ee.toolBtnModeIcon,children:a.jsx(xx,{mode:k})}),a.jsx("span",{className:Ee.toolBtnText,children:$r}),a.jsx("span",{className:Ee.toolBtnArrow,children:a.jsx(Pc,{})})]}),a.jsxs("span",{"data-toolbar-measure":"mode:expanded",className:`${Ee.toolBtn} ${Ee.modeToolBtn}`,children:[a.jsx("span",{className:Ee.toolBtnModeIcon,children:a.jsx(xx,{mode:k})}),a.jsx("span",{className:Ee.toolBtnText,children:$r}),a.jsx("span",{className:Ee.toolBtnArrow,children:a.jsx(Pc,{})})]}),a.jsxs("span",{"data-toolbar-measure":"model:collapsed",className:`${Ee.toolBtn} ${Ee.modelToolBtn} ${Ee.toolBtnCompact}`,children:[a.jsx("span",{className:Ee.toolBtnModelIcon,children:a.jsx(tN,{})}),a.jsx("span",{className:Ee.toolBtnText,children:fs}),a.jsx("span",{className:Ee.toolBtnArrow,children:a.jsx(Pc,{})})]}),a.jsxs("span",{"data-toolbar-measure":"model:expanded",className:`${Ee.toolBtn} ${Ee.modelToolBtn}`,children:[a.jsx("span",{className:Ee.toolBtnModelIcon,children:a.jsx(tN,{})}),a.jsx("span",{className:Ee.toolBtnText,children:fs}),a.jsx("span",{className:Ee.toolBtnArrow,children:a.jsx(Pc,{})})]})]})]})]}),Qt&&De&&Or.length>0&&a.jsx(Pmt,{actions:Or,onRun:Bs,onPressKey:ho,showKeyHints:!Te.mobileComposer})]})}));function Omt(e){return e.kind!=="agent"}const $mt="_bar_17p6f_1",Bmt="_left_17p6f_12",zmt="_right_17p6f_13",Fmt="_settingsButton_17p6f_23",qmt="_modeButton_17p6f_49",Hmt="_modeHint_17p6f_62",Umt="_modeLabel_17p6f_67",Wmt="_modeDefault_17p6f_71",Vmt="_modePlan_17p6f_75",Gmt="_modeAutoEdit_17p6f_79",Kmt="_modeAuto_17p6f_79",Ymt="_modeYolo_17p6f_87",Xmt="_shortcutsButton_17p6f_96",Qmt="_modelButton_17p6f_114",Jmt="_model_17p6f_114",Zmt="_contextButton_17p6f_138",ept="_context_17p6f_138",tpt="_goal_17p6f_161",npt="_goalButton_17p6f_167",spt="_separator_17p6f_184",rpt="_taskPill_17p6f_188",vo={bar:$mt,left:Bmt,right:zmt,settingsButton:Fmt,modeButton:qmt,modeHint:Hmt,modeLabel:Umt,modeDefault:Wmt,modePlan:Vmt,modeAutoEdit:Gmt,modeAuto:Kmt,modeYolo:Ymt,shortcutsButton:Xmt,modelButton:Qmt,model:Jmt,contextButton:Zmt,context:ept,goal:tpt,goalButton:npt,separator:spt,taskPill:rpt},ipt=1e3;function opt(e,t){switch(e){case"default":return{label:t("mode.default"),className:vo.modeDefault};case"plan":return{label:t("mode.plan"),className:vo.modePlan};case"auto-edit":return{label:t("mode.auto-edit"),className:vo.modeAutoEdit};case"auto":return{label:t("mode.auto"),className:vo.modeAuto};case"yolo":return{label:t("mode.yolo"),className:vo.modeYolo};default:return null}}function apt(){return a.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:[a.jsx("circle",{cx:"12",cy:"12",r:"3"}),a.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 SK(e,t,n,s){return s(e===1?t:n,{count:e})}function lpt(e,t){const n=e.filter(Omt);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(SK(r.shell,"tasks.pill.shell","tasks.pill.shells",t)),r.monitor>0&&i.push(SK(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 cpt(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 upt=h.forwardRef(function({onSelectMode:t,onSelectModel:n,onShowContext:s,onOpenSettings:r,onOpenTasks:i,onReturnToInput:o,tasks:l,activeGoal:c,onOpenGoals:u,hideSettings:d,onToggleShortcuts:f,compact:m=!1},p){const g=za(),b=g.status==="connected",w=g.currentModel??"",y=g.currentMode??"",v=g.tokenCount??0,x=g.contextWindow??0,{t:k}=nt(),T=(x>0?v/x*100:0).toFixed(1),S=opt(y,k),[,C]=h.useState(0),N=h.useRef(null);h.useEffect(()=>{if(!c)return;const I=setInterval(()=>C($=>($+1)%1e6),ipt);return()=>clearInterval(I)},[c]);const E=h.useMemo(()=>lpt(l,k),[l,k]),O=!m&&(b||!!S),B=c?cpt(Date.now()-c.setAt):"",D=c?`◎ ${k("goal.statusActive")}${B?` (${B})`:""}`:"",j=!!E||!m,L=!m&&!!w||!m&&x>0&&v>0||!!D;if(h.useImperativeHandle(p,()=>({focusTaskPill(){var I;return E?((I=N.current)==null||I.focus({preventScroll:!0}),!0):!1}}),[E]),!j&&!L)return null;const z=I=>{if(I.key==="Enter"||I.key==="ArrowDown"||I.key==="n"&&I.ctrlKey){I.preventDefault(),I.stopPropagation(),i==null||i();return}if(I.key==="ArrowUp"||I.key==="Escape"||I.key==="p"&&I.ctrlKey){I.preventDefault(),I.stopPropagation(),o==null||o();return}I.key.length===1&&!I.metaKey&&!I.ctrlKey&&!I.altKey&&(I.preventDefault(),I.stopPropagation(),o==null||o(I.key))};return a.jsxs("div",{className:vo.bar,children:[a.jsxs("div",{className:vo.left,children:[b&&!d&&!m&&a.jsx("button",{type:"button",className:vo.settingsButton,onClick:r,onMouseDown:I=>I.stopPropagation(),onTouchStart:I=>I.stopPropagation(),title:k("settings.title"),"aria-label":k("settings.title"),"aria-haspopup":"dialog",children:a.jsx(apt,{})}),S&&!m&&a.jsxs("button",{type:"button",className:vo.modeButton,onClick:t,onMouseDown:I=>I.stopPropagation(),onTouchStart:I=>I.stopPropagation(),title:k("mode.select"),"aria-haspopup":"listbox",children:[a.jsx("span",{className:`${vo.modeLabel} ${S.className}`,children:S.label}),!m&&a.jsx("span",{className:vo.modeHint,children:k("status.modeHint")})]}),!m&&a.jsx(a.Fragment,{children:f?a.jsx("button",{type:"button",className:vo.shortcutsButton,onClick:f,onMouseDown:I=>I.stopPropagation(),onTouchStart:I=>I.stopPropagation(),"aria-haspopup":"dialog","aria-label":k("status.shortcuts"),children:k("status.shortcuts")}):a.jsx("span",{children:k("status.shortcuts")})}),E&&a.jsxs(a.Fragment,{children:[O&&a.jsx("span",{className:vo.separator,children:"·"}),a.jsx("button",{ref:N,type:"button",className:vo.taskPill,onClick:i,onKeyDown:z,disabled:!i,children:E})]})]}),a.jsxs("div",{className:vo.right,children:[!m&&w&&a.jsx("button",{type:"button",className:vo.modelButton,onClick:n,onMouseDown:I=>I.stopPropagation(),onTouchStart:I=>I.stopPropagation(),title:k("model.select"),"aria-haspopup":"listbox",children:a.jsx("span",{className:vo.model,children:w})}),!m&&x>0&&v>0&&a.jsx("button",{type:"button",className:vo.contextButton,onClick:s,title:k("contextUsage.title"),children:a.jsx("span",{className:vo.context,children:k("status.contextUsed",{pct:T})})}),D&&(u?a.jsx("button",{type:"button",className:vo.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:a.jsx("span",{className:vo.goal,children:D})}):a.jsx("span",{className:vo.goal,title:c==null?void 0:c.condition,children:D}))]})]})}),dpt=15e3,hpt=["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."],fpt=["正在努力搬砖，请稍候...","老板在身后，快加载啊！","头发掉光前，一定能加载完...","服务器正在深呼吸，准备放大招...","正在向服务器投喂咖啡...","正在赋能全链路，寻找关键抓手...","正在降本增效，优化加载路径...","正在打破部门壁垒，沉淀方法论...","正在拥抱变化，迭代核心价值...","正在对齐颗粒度，打磨底层逻辑...","大力出奇迹，正在强行加载...","只要我不写代码，代码就没有 Bug...","正在把 Bug 转化为 Feature...","只要我不尴尬，Bug 就追不上我...","正在试图理解去年的自己写了什么...","正在猿力觉醒中，请耐心等待...","正在询问产品经理：这需求是真的吗？","正在给产品经理画饼，请稍等...","每一行代码，都在努力让世界变得更好一点点...","每一个伟大的想法，都值得这份耐心的等待...","别急，美好的事物总是需要一点时间去酝酿...","愿你的代码永无 Bug，愿你的梦想终将成真...","哪怕只有 0.1% 的进度，也是在向目标靠近...","加载的是字节，承载的是对技术的热爱..."];function CK(e){return(e??(typeof navigator<"u"?navigator.language.toLowerCase():"")).toLowerCase().startsWith("zh")?fpt:hpt}function mpt(){const e=p5(),t=nD(),n=e!=="idle",s=h.useRef(0),r=h.useRef(0),[i,o]=h.useState({estimatedOutputTokens:0,isReceivingContent:!1}),l=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 w=ppt(b.rawOutput);w!==void 0&&!m.has(b.toolCallId)&&(d+=w,m.add(b.toolCallId))}}return{chars:u,agentTokens:d,isReceiving:f}},[t]),c=h.useRef(l);return c.current=l,l.chars<r.current&&(s.current=l.chars),r.current=l.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(w=>{const y={estimatedOutputTokens:f+Math.round(s.current/4),isReceivingContent:m};return w.estimatedOutputTokens===y.estimatedOutputTokens&&w.isReceivingContent===y.isReceivingContent?w: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 ppt(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 gpt(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.floor(e/1e3)}k`}function Gb(e){const t=Math.round(e);return Math.abs(t)<1e6?t.toLocaleString():`${(t/1e6).toFixed(1)}M`}const bpt="_status_zld2v_1",ypt="_spinner_zld2v_11",vpt="_label_zld2v_15",wpt="_meta_zld2v_19",kC={status:bpt,spinner:ypt,label:vpt,meta:wpt},nN=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function lfe({startedAt:e,showPhrase:t=!0}){const n=p5(),{estimatedOutputTokens:s,isReceivingContent:r}=mpt(),{language:i,t:o}=nt(),{loadingPhrases:l}=Vu(),c=h.useRef(l);c.current=l;const u=h.useCallback(T=>{var S;try{return((S=c.current)==null?void 0:S.call(c,T))??CK(T)}catch(C){return console.warn("[web-shell] loadingPhrases resolver threw; using defaults",C),CK(T)}},[]),[d,f]=h.useState(0),m=h.useRef(Date.now()),[p,g]=h.useState(0),[b,w]=h.useState(()=>u(i)[0]??""),y=n!=="idle";if(h.useEffect(()=>{if(!y){f(0);return}m.current=e??Date.now(),f(TK(m.current));const T=setInterval(()=>{f(TK(m.current))},1e3);return()=>clearInterval(T)},[y,e]),h.useEffect(()=>{if(!t)return;if(n==="idle"){w(u(i)[0]??"");return}const T=()=>{const C=u(i),N=Math.floor(Math.random()*C.length);w(C[N]??"")};T();const S=setInterval(T,dpt);return()=>clearInterval(S)},[i,n,u,t]),h.useEffect(()=>{if(n==="idle")return;const T=setInterval(()=>{g(S=>(S+1)%nN.length)},250);return()=>clearInterval(T)},[n]),n==="idle")return null;const v=nN[p%nN.length],x=r?"↓":"↑",k=d<60?`${d}s`:xpt(d*1e3),_=s>0?` · ${x} ${o("stream.tokens",{count:gpt(s)})}`:"";return a.jsxs("div",{className:kC.status,children:[a.jsx("span",{className:kC.spinner,children:v}),t&&b&&a.jsx("span",{className:kC.label,children:b}),a.jsxs("span",{className:kC.meta,children:["(",k,_," · ",o("stream.cancel"),")"]})]})}function xpt(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 TK(e){return Math.max(0,Math.ceil((Date.now()-e)/1e3))}const kpt="_host_1scjy_1",_pt="_toast_1scjy_13",Spt="_message_1scjy_31",Cpt="_close_1scjy_39",Tpt="_info_1scjy_58",Ept="_success_1scjy_62",Apt="_warning_1scjy_66",jpt="_error_1scjy_70",kx={host:kpt,toast:_pt,message:Spt,close:Cpt,info:Tpt,success:Ept,warning:Apt,error:jpt};function Npt({toasts:e,onDismiss:t,autoDismissMs:n=5e3}){return e.length===0?null:a.jsx("div",{className:kx.host,role:"status","aria-live":"polite","data-web-shell-toast-host":!0,children:e.map(s=>a.jsx(Ipt,{toast:s,onDismiss:t,autoDismissMs:n},s.id))})}function Ipt({toast:e,onDismiss:t,autoDismissMs:n}){const{t:s}=nt();return h.useEffect(()=>{const r=window.setTimeout(()=>t(e.id),n);return()=>window.clearTimeout(r)},[n,t,e.id]),a.jsxs("div",{className:`${kx.toast} ${kx[e.tone]}`,"data-web-shell-toast":!0,"data-tone":e.tone,children:[a.jsx("div",{className:kx.message,children:e.message}),a.jsx("button",{type:"button",className:kx.close,onClick:()=>t(e.id),"aria-label":s("toast.dismiss"),title:s("toast.dismissShort"),children:"x"})]})}const Mpt="_panel_t0z44_1",Rpt="_summary_t0z44_10",Dpt="_progressRing_t0z44_27",Lpt="_progressButton_t0z44_41",Ppt="_stepText_t0z44_54",Opt="_statusSegmentWrap_t0z44_72",$pt="_separator_t0z44_79",Bpt="_statusSegment_t0z44_72",zpt="_statusSegmentButton_t0z44_85",Fpt="_fullText_t0z44_107",qpt="_compactText_t0z44_111",Hpt="_detail_t0z44_130",Upt="_item_t0z44_162",Wpt="_icon_t0z44_172",Vpt="_loadingIcon_t0z44_180",Gpt="_content_t0z44_189",Kpt="_completed_t0z44_197",Ypt="_inProgress_t0z44_211",Xpt="_pending_t0z44_216",Ji={panel:Mpt,summary:Rpt,progressRing:Dpt,progressButton:Lpt,stepText:Ppt,statusSegmentWrap:Opt,separator:$pt,statusSegment:Bpt,statusSegmentButton:zpt,fullText:Fpt,compactText:qpt,detail:Hpt,item:Upt,icon:Wpt,loadingIcon:Vpt,content:Gpt,completed:Kpt,inProgress:Ypt,pending:Xpt};function Qpt(e){switch(e){case"completed":return Ji.completed;case"in_progress":return Ji.inProgress;case"pending":return Ji.pending}}const Jpt=h.memo(function({todos:t,title:n,statusItems:s=[],onOpen:r}){const{t:i}=nt();if(t.length===0&&s.length===0)return null;const o=t.length,l=o>0,c=t.findIndex(g=>g.status==="in_progress"),u=c>=0?c:t.findIndex(g=>g.status==="pending"),d=l?u>=0?u+1:o:0,f=l?d/o:0,m=s.map(g=>g.ariaLabel??g.title??(typeof g.label=="string"?g.label:void 0)).filter(Boolean).join(", ")||void 0,p=l?i("todo.stepProgress",{current:d,total:o}):m;return a.jsxs("section",{className:Ji.panel,"aria-label":n??(l?i("todo.title"):m),tabIndex:0,children:[a.jsxs("div",{className:Ji.summary,"aria-label":p,children:[l&&r?a.jsxs("button",{type:"button",className:Ji.progressButton,"aria-label":p,onClick:r,children:[a.jsx("span",{className:Ji.progressRing,style:{"--todo-progress":String(f)},"aria-hidden":"true"}),a.jsxs("span",{className:Ji.stepText,children:[a.jsx("span",{className:Ji.fullText,children:i("todo.stepProgress",{current:d,total:o})}),a.jsx("span",{className:Ji.compactText,children:i("todo.stepFraction",{current:d,total:o})})]})]}):l?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Ji.progressRing,style:{"--todo-progress":String(f)},"aria-hidden":"true"}),a.jsxs("span",{className:Ji.stepText,children:[a.jsx("span",{className:Ji.fullText,children:i("todo.stepProgress",{current:d,total:o})}),a.jsx("span",{className:Ji.compactText,children:i("todo.stepFraction",{current:d,total:o})})]})]}):null,s.map((g,b)=>a.jsxs("span",{className:Ji.statusSegmentWrap,children:[(o>0||b>0)&&a.jsx("span",{className:Ji.separator,"aria-hidden":"true",children:"·"}),g.onClick?a.jsx("button",{type:"button",className:Ji.statusSegmentButton,title:g.title,"aria-label":g.ariaLabel,onClick:g.onClick,children:g.label}):a.jsx("span",{className:Ji.statusSegment,title:g.title,children:g.label})]},g.id))]}),o>0&&a.jsx("div",{className:Ji.detail,role:"tooltip",children:t.map((g,b)=>a.jsxs("div",{className:`${Ji.item} ${Qpt(g.status)}`,children:[a.jsx("span",{className:Ji.icon,"aria-hidden":"true",children:g.status==="in_progress"?a.jsx("span",{className:Ji.loadingIcon}):$3(g.status)}),a.jsx("span",{className:Ji.content,title:g.content,children:g.content})]},`${g.id||b}:${g.content}`))})]})}),Zpt="_panel_180sr_1",e0t="_floating_180sr_16",t0t="_section_180sr_26",n0t="_sectionHeader_180sr_40",s0t="_sectionContent_180sr_72",r0t="_row_180sr_76",i0t="_workspaceIcon_180sr_119",o0t="_rowActionIcon_180sr_123",a0t="_branchName_180sr_129",l0t="_value_180sr_137",c0t="_tasks_180sr_147",u0t="_task_180sr_147",d0t="_taskIcon_180sr_185",h0t="_taskLabel_180sr_196",f0t="_agentName_180sr_204",m0t="_taskName_180sr_205",p0t="_agentColor_180sr_216",g0t="_agentTag_180sr_225",b0t="_taskStatus_180sr_236",y0t="_statusRunning_180sr_257",jr={panel:Zpt,floating:e0t,section:t0t,sectionHeader:n0t,sectionContent:s0t,row:r0t,workspaceIcon:i0t,rowActionIcon:o0t,branchName:a0t,value:l0t,tasks:c0t,task:u0t,taskIcon:d0t,taskLabel:h0t,agentName:f0t,taskName:m0t,agentColor:p0t,agentTag:g0t,taskStatus:b0t,statusRunning:y0t},v0t=["environment","subagents","backgroundTasks"],w0t={red:"#e5484d",blue:"var(--agent-blue-500)",green:"var(--success-color)",yellow:"#d6a900",purple:"var(--agent-purple-600)",orange:"var(--accent-orange)",pink:"#d6409f",cyan:"#0e9888"};function EK(e){switch(e.kind){case"agent":return e.label;case"shell":return e.command;case"monitor":return e.description}}function x0t(e){switch(e.kind){case"agent":return a.jsx(sy,{});case"shell":return a.jsx(Dee,{});case"monitor":return a.jsx(Ree,{})}}function AK(e){return`tasks.${e}`}function jK(e){return e==="completed"?a.jsx(g5,{}):e==="running"?a.jsx(Rg,{className:jr.statusRunning}):e==="failed"?a.jsx(See,{}):e==="cancelled"?a.jsx(Qxe,{}):null}function kR(e){var t;return((t=e.subagentType)==null?void 0:t.toLowerCase())==="fork"}function k0t(e){return kR(e)?e.label.replace(/^fork:\s*/i,"").trim():e.label}function _0t(e){return e&&w0t[e]||"var(--muted-foreground)"}function S0t({floating:e=!1,hidden:t=!1,workspaceCwd:n,gitWorkspaceCwd:s,gitCwd:r,branch:i,gitStatus:o,tasks:l,agentTasks:c,items:u=v0t,onOpenGitDiff:d,onOpenGitCommit:f,onOpenAgent:m,onOpenTask:p,onDismiss:g}){const{t:b}=nt(),w=h.useRef(null),y=c??l.filter(D=>D.kind==="agent"),v=l.filter(D=>D.kind!=="agent"),[x,k]=h.useState(!0),[_,T]=h.useState(!1),[S,C]=h.useState(!1),[N,E]=h.useState(!1),O=i??(o==null?void 0:o.branch);h.useEffect(()=>{(t||!x||!s||!O)&&E(!1)},[O,x,s,t]),h.useEffect(()=>{if(!e||t||!g||N)return;const D=j=>{var L;j.composedPath().some(z=>z instanceof Element&&z.hasAttribute("data-web-shell-environment-toggle"))||j.target instanceof Node&&!((L=w.current)!=null&&L.contains(j.target))&&g()};return document.addEventListener("pointerdown",D),()=>document.removeEventListener("pointerdown",D)},[N,e,t,g]);const B=[o!=null&&o.operation?b(`git.operation.${o.operation}`):void 0,o!=null&&o.detached?b("git.detached"):void 0,o!=null&&o.staged?b("git.staged",{count:o.staged}):void 0,o!=null&&o.unstaged?b("git.unstaged",{count:o.unstaged}):void 0,o!=null&&o.untracked?b("git.untracked",{count:o.untracked}):void 0,o!=null&&o.conflicted?b("git.conflicted",{count:o.conflicted}):void 0,o!=null&&o.ahead?b("git.ahead",{count:o.ahead}):void 0,o!=null&&o.behind?b("git.behind",{count:o.behind}):void 0,o!=null&&o.stashCount?b("git.stash",{count:o.stashCount}):void 0].filter(D=>!!D);return a.jsxs("aside",{ref:w,className:`${jr.panel} ${e?jr.floating:""}`,"aria-label":b("environment.title"),"data-testid":"environment-panel","data-floating":e,hidden:t,children:[u.includes("environment")&&a.jsxs("section",{className:jr.section,children:[a.jsxs("button",{type:"button",className:jr.sectionHeader,"aria-expanded":x,onClick:()=>k(D=>!D),children:[a.jsx("span",{children:b("environment.title")}),!x&&a.jsx(Eu,{})]}),x&&a.jsxs("div",{className:jr.sectionContent,children:[a.jsxs("button",{type:"button",className:jr.row,disabled:!d,onClick:d,children:[a.jsx(Cee,{}),a.jsx("span",{children:b("environment.changes")}),a.jsx("span",{className:jr.value,children:o===void 0?b("environment.unavailable"):B.length>0?B.join(" · "):b("environment.clean")})]}),a.jsxs("div",{className:jr.row,title:n,children:[a.jsx(Ck,{className:jr.workspaceIcon}),a.jsx("span",{children:b("environment.workspace")}),a.jsx("span",{className:jr.value,children:(n==null?void 0:n.split(/[/\\]/).filter(Boolean).at(-1))??b("environment.unavailable")})]}),s&&O?a.jsx(lO,{open:N,onOpenChange:E,workspaceCwd:s,gitCwd:r,side:"left",onOpenDiff:d,onOpenCommit:f,children:a.jsxs("button",{type:"button",className:jr.row,title:O,children:[a.jsx(jy,{}),a.jsx("span",{className:jr.branchName,children:O}),a.jsx(Eu,{className:jr.rowActionIcon})]})}):a.jsxs("div",{className:jr.row,title:O??void 0,children:[a.jsx(jy,{}),a.jsx("span",{className:jr.branchName,children:O??b("environment.unavailable")})]})]})]}),u.includes("subagents")&&y.length>0&&a.jsxs("section",{className:jr.section,children:[a.jsxs("button",{type:"button",className:jr.sectionHeader,"aria-expanded":_,onClick:()=>T(D=>!D),children:[a.jsx("span",{children:b("environment.agents")}),!_&&a.jsx(Eu,{})]}),_&&a.jsx("ul",{className:jr.tasks,children:y.map((D,j)=>a.jsx("li",{children:a.jsxs("button",{type:"button",className:jr.task,disabled:!m,onClick:()=>m==null?void 0:m(D),children:[a.jsxs("span",{className:jr.taskLabel,children:[!kR(D)&&a.jsx("span",{className:jr.agentColor,"data-agent-color":D.color??"default",style:{backgroundColor:_0t(D.color)},"aria-hidden":"true"}),kR(D)&&a.jsx("span",{className:jr.agentTag,children:"fork"}),a.jsx("span",{className:jr.agentName,children:(()=>{const L=k0t(D).trim();return L&&L.toLowerCase()!=="agent"?L:b("environment.unnamedAgent",{index:j+1})})()})]}),a.jsxs("span",{className:jr.taskStatus,"data-status":D.status,children:[jK(D.status),b(AK(D.status))]})]})},D.id))})]}),u.includes("backgroundTasks")&&v.length>0&&a.jsxs("section",{className:jr.section,children:[a.jsxs("button",{type:"button",className:jr.sectionHeader,"aria-expanded":S,onClick:()=>C(D=>!D),children:[a.jsx("span",{children:b("tasks.title")}),!S&&a.jsx(Eu,{})]}),S&&a.jsx("ul",{className:jr.tasks,children:v.map(D=>a.jsx("li",{children:a.jsxs("button",{type:"button",className:jr.task,onClick:()=>p(D),children:[a.jsx("span",{className:jr.taskIcon,children:x0t(D)}),a.jsx("span",{className:jr.taskLabel,children:a.jsx("span",{className:jr.taskName,title:EK(D),children:EK(D)})}),a.jsxs("span",{className:jr.taskStatus,"data-status":D.status,children:[jK(D.status),b(AK(D.status))]})]})},`${D.kind}:${D.id}`))})]})]})}const C0t="_header_kkzqp_1",T0t="_content_kkzqp_11",E0t="_actions_kkzqp_22",A0t="_action_kkzqp_22",Kw={header:C0t,content:T0t,actions:E0t,action:A0t};function j0t({content:e,environmentOpen:t,environmentAvailable:n,rightPanelOpen:s,rightPanelAvailable:r,onToggleEnvironment:i,onToggleRightPanel:o}){const{t:l}=nt();return a.jsxs("header",{className:Kw.header,"data-testid":"chat-context-header",children:[a.jsx("div",{className:Kw.content,children:e}),a.jsxs("div",{className:Kw.actions,children:[n&&a.jsx("button",{type:"button",className:Kw.action,"data-web-shell-environment-toggle":!0,"aria-label":l("chatHeader.toggleEnvironment"),"aria-pressed":t,title:l("chatHeader.toggleEnvironment"),onClick:i,children:a.jsx(e_e,{})}),r&&a.jsx("button",{type:"button",className:Kw.action,"aria-label":l("chatHeader.toggleRightPanel"),"aria-pressed":s,title:l("chatHeader.toggleRightPanel"),onClick:o,children:a.jsx(Nee,{})})]})]})}const N0t="_header_leiy3_1",I0t="_titleRow_leiy3_11",M0t="_title_leiy3_11",R0t="_subtitle_leiy3_31",_C={header:N0t,titleRow:I0t,title:M0t,subtitle:R0t};function D0t(e){const{t}=nt();return a.jsxs("div",{className:_C.header,children:[a.jsxs("div",{className:_C.titleRow,children:[a.jsx("span",{children:t("welcome.titlePrefix")}),a.jsx("span",{className:_C.title,children:"Qwen Code"})]}),a.jsx("div",{className:_C.subtitle,children:t("welcome.prompt")})]})}const L0t="_root_kd322_1",P0t={root:L0t};function O0t(){const e=h.useRef(null),t=h.useRef(null),n=im(),s=oO();return h.useEffect(()=>{const r=e.current,i=t.current,o=i==null?void 0:i.getContext("2d",{alpha:!0});if(!r||!i||!o)return;const l=[],c={x:-9999,y:-9999,previousX:-9999,previousY:-9999,speed:0};let u=0,d=0,f=0,m=0,p=0,g=!1,b=!0,w;const y=()=>{l.length=0;const S=15,C=Math.floor(u/S),N=Math.floor(d/S),E=u%S/2,O=d%S/2;for(let B=0;B<N;B+=1)for(let D=0;D<C;D+=1){const j=E+D*S+S/2,L=O+B*S+S/2;l.push({anchorX:j,anchorY:L,x:j,y:L})}},v=()=>{const S=Math.min(c.speed/5,1);f+=(S-f)*.06,f<.001&&(f=0),m+=(f-m)*.08;let C=f===0&&m<.001;if(C){for(const E of l)if(Math.abs(E.x-E.anchorX)>.01||Math.abs(E.y-E.anchorY)>.01){C=!1;break}}if(C&&!b){g=!1,p=0;return}o.clearRect(0,0,u,d),o.fillStyle=n===Fr.Light?"rgba(172, 191, 255, 0.85)":"rgba(172, 191, 255, 0.42)",o.beginPath();const N=500*500;for(const E of l){const O=c.x-E.anchorX,B=c.y-E.anchorY,D=O*O+B*B;if(!s&&D<N&&f>.01){const L=1-Math.sqrt(D)/500,z=L*L*67*f,I=Math.atan2(B,O);E.x+=(E.anchorX-Math.cos(I)*z-E.x)*.15,E.y+=(E.anchorY-Math.sin(I)*z-E.y)*.15}else E.x+=(E.anchorX-E.x)*.1,E.y+=(E.anchorY-E.y)*.1;o.moveTo(E.x+.5,E.y),o.arc(E.x,E.y,.5,0,Math.PI*2)}if(o.fill(),!s&&m>.001){const E=o.createRadialGradient(c.x,c.y,0,c.x,c.y,160);E.addColorStop(0,"rgba(0, 0, 0, 1)"),E.addColorStop(1,"rgba(0, 0, 0, 0)"),o.globalAlpha=m,o.globalCompositeOperation="destination-out",o.fillStyle=E,o.fillRect(c.x-160,c.y-160,320,320),o.globalCompositeOperation="source-over",o.globalAlpha=1}b=!1,s||(p=window.requestAnimationFrame(v))},x=()=>{!s&&!g&&(g=!0,p=window.requestAnimationFrame(v))},k=()=>{const S=Math.min(window.devicePixelRatio||1,2),C=r.getBoundingClientRect();u=C.width,d=C.height,i.width=Math.ceil(u*S),i.height=Math.ceil(d*S),o.setTransform(S,0,0,S,0,0),y(),b=!0,s?v():x()},_=S=>{const C=r.getBoundingClientRect(),N=S.clientX-C.left,E=S.clientY-C.top;c.previousX===-9999&&(c.previousX=N,c.previousY=E),c.x=N,c.y=E,x()},T=new ResizeObserver(k);return T.observe(r),k(),s||(window.addEventListener("pointermove",_,{passive:!0}),w=window.setInterval(()=>{const S=c.previousX-c.x,C=c.previousY-c.y,N=Math.hypot(S,C);c.speed+=(N-c.speed)*.5,c.speed<.001&&(c.speed=0),c.previousX=c.x,c.previousY=c.y,c.speed>0&&x()},20)),()=>{window.cancelAnimationFrame(p),w!==void 0&&window.clearInterval(w),T.disconnect(),window.removeEventListener("pointermove",_)}},[s,n]),a.jsx("div",{ref:e,className:P0t.root,"data-web-shell-new-session-dot-field":!0,"aria-hidden":"true",children:a.jsx("canvas",{ref:t})})}const $0t="_themeDark_1tp31_1",B0t="_themeLight_1tp31_25",NK={themeDark:$0t,themeLight:B0t},z0t={sm:"sm:max-w-[420px]",md:"sm:max-w-[560px]",lg:"sm:max-w-[720px]",xl:"sm:max-w-[900px]"},F0t=["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 IK(e){return e?Array.from(e.querySelectorAll(F0t)):[]}const Kb=[],cfe=h.createContext(null);function _R(e){return e===null?!0:Kb[Kb.length-1]===e}function Fi({title:e,subtitle:t,size:n="md",allowFullscreen:s=!1,dismissible:r=!0,onClose:i,children:o}){const{t:l}=nt(),c=im(),[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),w=h.useRef(null);w.current===null&&(w.current={}),h.useEffect(()=>{const _=w.current;Kb.push(_);const T=S=>{S.key!=="Escape"||!S.isComposing&&S.keyCode!==229||!_R(_)||(Object.defineProperty(S,"key",{configurable:!0,value:"Process"}),document.addEventListener("keydown",C=>{C===S&&Reflect.deleteProperty(S,"key")},{capture:!0,once:!0}))};return window.addEventListener("keydown",T,{capture:!0}),()=>{var O,B;window.removeEventListener("keydown",T,{capture:!0});const S=Kb.indexOf(_);if(S>=0&&Kb.splice(S,1),Kb.length===0){(O=p==null?void 0:p.focus)==null||O.call(p);return}const C=Array.from(document.querySelectorAll("[data-keyboard-scope]")),N=C[C.length-1];(B=IK(N).find(D=>!D.hasAttribute("data-dialog-close"))??N)==null||B.focus()}},[p]);const y=_=>{g.current=_.target===_.currentTarget,b.current=!1},v=_=>{b.current=_.target===_.currentTarget},x=_=>{const T=g.current&&b.current&&_.target===_.currentTarget;g.current=!1,b.current=!1,T&&r&&i()},k=c===Fr.Light?NK.themeLight:NK.themeDark;return a.jsx(qp,{open:!0,onOpenChange:_=>{!_&&r&&i()},children:a.jsx(cfe.Provider,{value:w.current,children:a.jsxs(Hp,{ref:f,showCloseButton:!1,overlayProps:{onMouseDown:y,onMouseUp:v,onClick:x},className:`${k} ${c===Fr.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)]":z0t[n]}`,"aria-label":e,"data-keyboard-scope":!0,"data-web-shell-dialog":!0,"data-web-shell-dialog-title":e,onPointerDownOutside:_=>_.preventDefault(),onEscapeKeyDown:_=>{_.defaultPrevented||_.isComposing||_.keyCode===229||_R(w.current)&&(_.preventDefault(),r&&m.current())},onOpenAutoFocus:_=>{var S;_.preventDefault(),(S=IK(f.current).find(C=>!C.hasAttribute("data-dialog-close"))??f.current)==null||S.focus()},onCloseAutoFocus:_=>_.preventDefault(),children:[a.jsxs(Up,{className:"flex-row items-center gap-2 border-b px-4 py-2.5 text-left",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx(Vp,{children:e}),t&&a.jsx(Yg,{className:"mt-0.5 text-xs",children:t})]}),s&&a.jsx(Kt,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>d(_=>!_),"aria-label":l(u?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":u,title:l(u?"common.exitFullscreen":"common.fullscreen"),children:u?a.jsx(jee,{}):a.jsx(Aee,{})}),r&&a.jsx(ZI,{asChild:!0,children:a.jsx(Kt,{type:"button",variant:"ghost",size:"icon-sm","aria-label":l("common.close"),title:l("common.close"),"data-dialog-close":!0,children:a.jsx(yv,{})})})]}),a.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 SC(e,t){return t<=0||e<0?0:e>t-1?t-1:e}const q0t=new Set(["button","submit","reset"]),H0t=new Set(["checkbox","radio","button","submit","reset","range","color","file"]);function MK(){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 q0t.has(e.type);const n=e.getAttribute("role");return n==="button"||n==="link"||n==="menuitem"}function sN(){const e=typeof document<"u"?document.activeElement:null;if(!e)return!1;const t=e.tagName;return t==="TEXTAREA"?!0:t==="INPUT"?!H0t.has(e.type):e.isContentEditable===!0}function k0({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s,enabled:r=!0}){const i=h.useContext(cfe),o=h.useRef({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s});o.current={itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s};const[l,c]=h.useState(!1);return h.useEffect(()=>{if(!r)return;const u=()=>c(!0),d=()=>c(!1),f=m=>{if(!_R(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(SC(g+1,p));break;case"ArrowUp":m.preventDefault(),u(),o.current.onActiveIndexChange(SC(g-1,p));break;case"Home":if(sN())return;m.preventDefault(),u(),o.current.onActiveIndexChange(0);break;case"End":if(sN())return;m.preventDefault(),u(),o.current.onActiveIndexChange(p-1);break;case"Enter":{if(MK()||g<0)return;m.preventDefault(),o.current.onConfirm(SC(g,p));break}case" ":{if(MK()||sN()||g<0)return;m.preventDefault(),o.current.onConfirm(SC(g,p));break}}};return window.addEventListener("keydown",f),window.addEventListener("mousemove",d),()=>{window.removeEventListener("keydown",f),window.removeEventListener("mousemove",d)}},[i,r]),{keyboardMode:l}}const U0t="_picker_5cmbf_4",W0t="_selected_5cmbf_98",V0t="_disabled_5cmbf_114",G0t={picker:U0t,"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:W0t,"picker-keyboard-only":"_picker-keyboard-only_5cmbf_106",disabled:V0t,"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 Sn(...e){return e.filter(t=>!!t).map(t=>G0t[t]).filter(Boolean).join(" ")}const K0t="_list_jbgdx_1",Y0t="_row_jbgdx_16",X0t="_selected_jbgdx_32",Q0t="_keyboardOnly_jbgdx_39",J0t="_modeName_jbgdx_47",Z0t="_modeIcon_jbgdx_51",egt="_modeText_jbgdx_67",tgt="_modeDesc_jbgdx_83",Rm={list:K0t,row:Y0t,selected:X0t,keyboardOnly:Q0t,modeName:J0t,modeIcon:Z0t,modeText:egt,modeDesc:tgt};function ngt({currentMode:e,onSelect:t}){const{t:n}=nt(),s=h.useRef(null),r=pv.map(m=>({id:m,name:n(`mode.listLabel.${m}`),description:n(`mode.desc.${m}`)})),i=r.findIndex(m=>m.id===e),[o,l]=h.useState(i>=0?i:0),c=h.useRef(!1);h.useEffect(()=>{c.current||i<0||l(i)},[i]);const u=m=>{c.current=!0,l(m)},d=m=>{const p=r[m];p&&t(p.id)},{keyboardMode:f}=k0({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]),a.jsx("div",{className:`${Rm.list} ${f?Rm.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 a.jsxs("div",{id:`mode-opt-${p}`,role:"option","aria-selected":b,className:`${Rm.row} ${g?Rm.selected:""} ${b?Sn("dialog-current"):""}`,"data-web-shell-approval-mode-option":!0,"data-mode-id":m.id,onClick:()=>d(p),onMouseMove:()=>u(p),children:[a.jsx("span",{className:Rm.modeIcon,children:a.jsx(xx,{mode:m.id})}),a.jsxs("span",{className:Rm.modeText,children:[a.jsx("span",{className:Rm.modeName,children:m.name}),a.jsx("span",{className:Rm.modeDesc,children:m.description})]})]},m.id)})})}function eE(e){const[t,n]=h.useState(""),[s,r]=h.useState(""),i=h.useRef(!1),o=h.useRef(""),l=h.useRef(e);l.current=e;const c=h.useCallback(m=>{var p;m!==o.current&&(o.current=m,r(m),(p=l.current)==null||p.call(l,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 Zy(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 uO({session:e,active:t,current:n,confirmed:s,disabled:r,currentLabel:i,optionId:o,ariaSelected:l,leading:c,trailing:u,resumeSelector:d,onClick:f,onActivate:m}){const{t:p}=nt(),g=e.updatedAt||e.createdAt;return a.jsxs("div",{id:o,role:"option","aria-selected":l??n,"aria-current":n?"true":void 0,"aria-disabled":r||void 0,className:Sn("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:[a.jsxs("div",{className:Sn("picker-item-row"),children:[c,a.jsx("span",{className:Sn("picker-item-title"),children:e.displayName||e.sessionId.slice(0,8)}),u]}),a.jsxs("div",{className:Sn("picker-item-meta"),children:[a.jsx("span",{children:g&&Zy(g,p)}),a.jsx("span",{className:Sn("picker-item-detail"),children:p("common.clients",{count:e.clientCount??0})}),e.hasActivePrompt&&a.jsx("span",{className:Sn("picker-item-detail"),children:p("resume.activePrompt")})]})]})}function tS(e,t={}){const{autoLoad:n=!1,enabled:s=!0,pageSize:r,archiveState:i,view:o,group:l}=t,c=i4({autoLoad:n,enabled:s&&!e,pageSize:r,archiveState:i,view:o,group:l,sourceType:sh}),{reload:u,deleteSession:d,deleteSessions:f}=c,m=Co(),p=h.useRef(0),[g,b]=h.useState({sessions:[],loading:!1}),w=h.useCallback(async()=>{if(!e||!s)return[];const _=++p.current;b(T=>({cwd:e,sessions:T.cwd===e?T.sessions:[],loading:!0}));try{const S=(await m.client.workspaceByCwd(e).listWorkspaceSessions({pageSize:r,archiveState:i,view:o,group:l,sourceType:sh})).map(C=>({...C,workspaceCwd:e}));return p.current===_&&b({cwd:e,sessions:S,loading:!1}),S}catch(T){const S=T instanceof Error?T:new Error(String(T));throw p.current===_&&b({cwd:e,sessions:[],loading:!1,error:S}),S}},[i,s,l,r,o,m.client,e]);h.useEffect(()=>{if(e)return p.current+=1,b({cwd:e,sessions:[],loading:n&&s}),n&&s&&w().catch(()=>{}),()=>{p.current+=1}},[n,s,w,e]);const y=h.useCallback(()=>e?w():u(),[u,w,e]),v=h.useCallback(async _=>{if(!e)return f(_);const T=await m.client.workspaceByCwd(e).deleteSessionsData(_);return await w(),T},[f,w,m.client,e]),x=h.useCallback(async _=>{if(!e)return d(_);const T=await v([_]);if(T.errors.length>0)throw new Error(T.errors[0].error);return T.removed.length>0||T.notFound.length>0},[d,v,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:v,releaseSession:c.releaseSession}}const SR="resume-session-list",RK=e=>`${SR}-opt-${e}`;function sgt({onSelect:e,onClose:t,workspaceCwd:n}){const{t:s}=nt(),r=za(),{sessions:i,loading:o,error:l}=tS(n,{autoLoad:!0}),c=r.sessionId,[u,d]=h.useState(-1),{filterValue:f,inputProps:m}=eE(()=>d(-1)),p=h.useRef(null),g=h.useRef(null),b=f?i.filter(v=>{const x=f.toLowerCase();return(v.displayName||"").toLowerCase().includes(x)||v.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 v=(x=p.current)==null?void 0:x.children[u];v==null||v.scrollIntoView({block:"nearest"})},[u]);const w=v=>{const x=b[v];x&&(e(x.sessionId),t())},{keyboardMode:y}=k0({itemCount:b.length,activeIndex:u,onActiveIndexChange:d,onConfirm:w});return h.useEffect(()=>{var v;(v=g.current)==null||v.focus()},[]),a.jsxs("div",{className:Sn("picker","picker-in-shell"),"data-web-shell-resume-dialog":!0,children:[a.jsxs("div",{className:Sn("picker-search"),children:[a.jsxs("span",{className:Sn("picker-search-label"),children:[s("resume.search"),":"," "]}),a.jsx("input",{ref:g,className:Sn("picker-search-input"),"aria-label":s("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":SR,"aria-activedescendant":u>=0&&u<b.length?RK(u):void 0,...m,placeholder:""})]}),a.jsx("div",{className:Sn("picker-sep")}),a.jsxs("div",{id:SR,role:"listbox",className:Sn("picker-list",y?"picker-keyboard-only":void 0),ref:p,children:[o&&a.jsx("div",{className:Sn("picker-empty"),children:s("common.loading")}),!o&&l&&a.jsx("div",{className:Sn("picker-empty"),children:l.message||s("resume.failedToLoad")}),!o&&!l&&b.length===0&&a.jsx("div",{className:Sn("picker-empty"),children:f?s("resume.noMatch",{query:f}):s("resume.none")}),!o&&b.map((v,x)=>a.jsx(uO,{session:v,optionId:RK(x),active:x===u,current:v.sessionId===c,currentLabel:s("resume.current"),resumeSelector:!0,onClick:()=>w(x),onActivate:()=>d(x)},v.sessionId))]})]})}const rgt="_layout_1sigx_1",igt="_list_1sigx_9",ogt="_row_1sigx_23",agt="_selected_1sigx_39",lgt="_keyboardOnly_1sigx_46",cgt="_label_1sigx_54",ugt="_divider_1sigx_58",dgt="_number_1sigx_65",hgt="_provider_1sigx_71",fgt="_badge_1sigx_86",mgt="_detail_1sigx_92",pgt="_detailRow_1sigx_104",ggt="_detailLabel_1sigx_111",bgt="_detailValue_1sigx_117",ygt="_empty_1sigx_122",Rl={layout:rgt,list:igt,row:ogt,selected:agt,keyboardOnly:lgt,label:cgt,divider:ugt,number:dgt,provider:hgt,badge:fgt,detail:mgt,detailRow:pgt,detailLabel:ggt,detailValue:bgt,empty:ygt};function vgt(e,t){return e?`${e.toLocaleString()} ${t("contextUsage.tokens")}`:t("model.contextWindow.unknown")}function wgt(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 DK(e){if(e.authType)return e.authType;const t=e.id.match(/\(([^()]+)\)$/);return t==null?void 0:t[1]}function xgt(e){return e.label?e.label:e.baseModelId?e.baseModelId:e.id.replace(/\([^()]+\)$/,"")}function kgt(e){return[e.authType??"",e.id,e.baseUrl??"",e.envKey??""].join("\0")}function _gt(e,t){return t?e.baseModelId??e.id.replace(/\([^()]+\)$/,""):e.id}function CC({label:e,value:t}){return a.jsxs("div",{className:Rl.detailRow,children:[a.jsx("span",{className:Rl.detailLabel,children:e}),a.jsx("span",{className:Rl.detailValue,children:t})]})}function Sgt({mode:e="main",onSelect:t,models:n,currentModelId:s}){const r=za(),i=s??r.currentModel??"",o=h.useMemo(()=>n??r.models??[],[n,r.models]),{t:l}=nt(),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 w=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],v=k=>{const _=o[k];_&&t(_gt(_,u))},{keyboardMode:x}=k0({itemCount:o.length,activeIndex:p,onActiveIndexChange:w,onConfirm:v});return h.useEffect(()=>{var _;const k=(_=c.current)==null?void 0:_.children[p];k==null||k.scrollIntoView({block:"nearest"})},[p]),a.jsxs("div",{className:Rl.layout,children:[a.jsxs("div",{className:`${Rl.list} ${x?Rl.keyboardOnly:""}`,ref:c,role:"listbox",tabIndex:0,"aria-activedescendant":o.length>0?`model-opt-${p}`:void 0,"aria-label":l(u?"model.setFast":d?"model.setVoice":f?"model.setVision":"model.select"),"data-web-shell-model-dialog":!0,children:[o.length===0?a.jsx("div",{className:Rl.empty,children:l("model.none")}):null,o.map((k,_)=>{const T=_===p,S=_===m,C=DK(k);return a.jsxs("div",{id:`model-opt-${_}`,role:"option","aria-selected":S,className:`${Rl.row} ${T?Rl.selected:""} ${S?Sn("dialog-current"):""}`,"data-web-shell-model-option":!0,"data-model-id":k.id,onClick:()=>v(_),onMouseMove:()=>w(_),children:[a.jsxs("span",{className:Rl.number,children:[_+1,"."]}),C?a.jsxs("span",{className:Rl.provider,children:["[",C,"]"]}):null,a.jsx("span",{className:Rl.label,children:xgt(k)}),k.isRuntime?a.jsx("span",{className:Rl.badge,children:l("common.runtime")}):null]},kgt(k))})]}),y?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Rl.divider}),a.jsxs("div",{className:Rl.detail,children:[a.jsx(CC,{label:l("model.modality"),value:wgt(y.modalities,l)}),a.jsx(CC,{label:l("model.contextWindow"),value:vgt(y.contextWindow,l)}),DK(y)!=="qwen-oauth"?a.jsxs(a.Fragment,{children:[a.jsx(CC,{label:l("model.baseUrl"),value:y.baseUrl??l("model.default")}),a.jsx(CC,{label:l("model.apiKey"),value:y.envKey??l("model.notSet")})]}):null]})]}):null]})}const Cgt="_body_2kfet_1",Tgt="_hint_2kfet_8",Egt="_list_2kfet_13",Agt="_empty_2kfet_21",jgt="_row_2kfet_27",Ngt="_rowSelected_2kfet_51",Igt="_badge_2kfet_56",Mgt="_label_2kfet_74",Rgt="_footer_2kfet_78",Dgt="_count_2kfet_86",Lgt="_actions_2kfet_91",Pgt="_cancel_2kfet_96",Ogt="_confirm_2kfet_97",Nc={body:Cgt,hint:Tgt,list:Egt,empty:Agt,row:jgt,rowSelected:Ngt,badge:Igt,label:Mgt,footer:Rgt,count:Dgt,actions:Lgt,cancel:Pgt,confirm:Ogt};function $gt({models:e,current:t,max:n,onConfirm:s,onClose:r}){const{t:i}=nt(),[o,l]=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=>{l(f=>f.includes(d)?f.filter(m=>m!==d):f.length>=n?f:[...f,d])};return a.jsxs("div",{className:Nc.body,children:[a.jsx("div",{className:Nc.hint,children:i("settings.models.fallbacks.hint",{max:n})}),a.jsxs("div",{className:Nc.list,role:"group","aria-label":i("settings.models.fallbacks.title"),children:[c.length===0&&a.jsx("div",{className:Nc.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 a.jsxs("button",{type:"button","aria-pressed":m,className:`${Nc.row} ${m?Nc.rowSelected:""}`,"aria-disabled":p||void 0,title:p?i("settings.models.fallbacks.limitReached",{max:n}):void 0,onClick:()=>u(d.baseId),children:[a.jsx("span",{className:Nc.badge,children:m?f+1:""}),a.jsx("span",{className:Nc.label,children:d.label})]},d.baseId)})]}),a.jsxs("div",{className:Nc.footer,children:[a.jsxs("span",{className:Nc.count,children:[o.length,"/",n]}),a.jsxs("div",{className:Nc.actions,children:[a.jsx("button",{type:"button",className:Nc.cancel,onClick:r,children:i("settings.models.cancel")}),a.jsx("button",{type:"button",className:Nc.confirm,onClick:()=>s(o),children:i("settings.models.fallbacks.confirm")})]})]})]})}function Bgt(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 LK(e,t){return e?t.find(n=>n.name===e.name&&n.level===e.level)??null:null}function PK(e,t){return e.level!=="user"?!1:t.some(n=>n.level==="project"&&n.name===e.name)}function zgt(e){return(e.level==="project"||e.level==="user")&&!e.isBuiltin}function OK(e){if(e==="project")return"workspace";if(e==="user")return"global"}function dO({className:e,orientation:t="horizontal",decorative:n=!0,...s}){return a.jsx(qLe,{"data-slot":"separator",decorative:n,orientation:t,className:on("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",e),...s})}function by({className:e,...t}){return a.jsx("div",{"data-slot":"field-group",className:on("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 Fgt=g1("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 wo({className:e,orientation:t="vertical",...n}){return a.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:on(Fgt({orientation:t}),e),...n})}function ufe({className:e,...t}){return a.jsx("div",{"data-slot":"field-content",className:on("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...t})}function oa({className:e,...t}){return a.jsx(Xg,{"data-slot":"field-label",className:on("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 qgt({className:e,...t}){return a.jsx("div",{"data-slot":"field-label",className:on("flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50",e),...t})}function cd({className:e,...t}){return a.jsx("p",{"data-slot":"field-description",className:on("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 Hgt({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(l=>[l==null?void 0:l.message,l])).values()];return(i==null?void 0:i.length)==1?(o=i[0])==null?void 0:o.message:a.jsx("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:i.map((l,c)=>(l==null?void 0:l.message)&&a.jsx("li",{children:l.message},c))})},[t,n]);return r?a.jsx("div",{role:"alert","data-slot":"field-error",className:on("text-sm font-normal text-destructive",e),...s,children:r}):null}const Ugt=g1("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 lo({className:e,variant:t,...n}){return a.jsx("div",{"data-slot":"alert",role:"alert",className:on(Ugt({variant:t}),e),...n})}function ql({className:e,...t}){return a.jsx("div",{"data-slot":"alert-title",className:on("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",e),...t})}function co({className:e,...t}){return a.jsx("div",{"data-slot":"alert-description",className:on("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 Wgt({className:e,...t}){return a.jsx("div",{"data-slot":"alert-action",className:on("absolute top-2 right-2",e),...t})}function Ws({className:e,...t}){return a.jsx(Rg,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:on("size-4 animate-spin",e),...t})}function mc({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 l=window.setTimeout(()=>o.current(),3e3);return()=>window.clearTimeout(l)},[n,r]),a.jsxs(lo,{variant:r==="error"?"destructive":r==="success"?"success":"default",children:[r==="error"?a.jsx(La,{}):r==="success"?a.jsx(g5,{}):r==="progress"?a.jsx(Ws,{}):a.jsx(b5,{}),a.jsx(co,{className:i,children:e}),r!=="progress"?a.jsx(Wgt,{children:a.jsx(Kt,{type:"button",variant:"ghost",size:"icon-xs","aria-label":t,title:t,onClick:s,children:a.jsx(yv,{})})}):null]})}function _1({className:e,orientation:t="horizontal",...n}){return a.jsx(YLe,{orientation:t,"data-slot":"tabs","data-orientation":t,className:on("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}const Vgt=g1("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 S1({className:e,variant:t="default",...n}){return a.jsx(XLe,{"data-slot":"tabs-list","data-variant":t,className:on(Vgt({variant:t}),e),...n})}function ci({className:e,...t}){return a.jsx(QLe,{"data-slot":"tabs-trigger",className:on("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 qi({className:e,...t}){return a.jsx(JLe,{"data-slot":"tabs-content",className:on("flex-1 text-sm outline-none",e),...t})}function ug({className:e,...t}){return a.jsx("textarea",{"data-slot":"textarea",className:on("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 Ggt(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 Kgt(e){return e.filter(t=>!t.disabled&&(t.mcpStatus==="connected"||t.mcpStatus===void 0&&t.status==="ok")).map(t=>t.name)}function Ygt(e,t){if(!e.trim())return;const n=JSON.parse(e);if(!$m(n))throw new Error(`${t} must be a JSON object`);return n}function $m(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Xgt(e){return(e instanceof Error?e.message:String(e)).replace(/^[A-Z]+ \/\S+:\s*/,"")}function CR(e,t,n){const s=new Set(e);return n?s.add(t):s.delete(t),s}const $K=["inherit",...pv],Qgt=1500,Jgt=40;function BK({initialScope:e="global",agent:t,onCancel:n,onCreated:s}){var wt,Wt;const{t:r}=nt(),{createAgent:i,updateAgent:o,generateContent:l}=vee({autoLoad:!1}),c=wee({autoLoad:!1}),u=sD({autoLoad:!1}),d=rD({autoLoad:!0}),f=u.loadTools,m=u.initialize,p=u.reloadConfig,g=u.reload,b=c.preheat,w=c.reload,y=(t==null?void 0:t.level)==="user"?"global":"workspace",[v,x]=h.useState(t?y:e),[k,_]=h.useState((t==null?void 0:t.name)??""),[T,S]=h.useState((t==null?void 0:t.description)??""),[C,N]=h.useState((t==null?void 0:t.systemPrompt)??""),[E,O]=h.useState(()=>{var Me;return new Set((Me=t==null?void 0:t.tools)!=null&&Me.includes("*")?[]:(t==null?void 0:t.tools)??[])}),[B,D]=h.useState(()=>new Set((t==null?void 0:t.disallowedTools)??[])),[j,L]=h.useState((t==null?void 0:t.model)??""),[z,I]=h.useState((t==null?void 0:t.approvalMode)??"inherit"),$=z==="bubble"?[...$K,"bubble"]:$K,[K,R]=h.useState(((wt=t==null?void 0:t.maxTurns)==null?void 0:wt.toString())??""),[Y,W]=h.useState((t==null?void 0:t.color)??"inherit"),[M,F]=h.useState(()=>new Set(Object.keys((t==null?void 0:t.mcpServers)??{}))),[J,V]=h.useState(t!=null&&t.hooks?JSON.stringify(t.hooks,null,2):""),[U,le]=h.useState(!1),[pe,fe]=h.useState(""),[Q,ne]=h.useState(""),[de,ue]=h.useState(""),[me,te]=h.useState({}),[ae,be]=h.useState(!1),[se,ve]=h.useState(null),[ze,Pe]=h.useState(!0),[_t,Pt]=h.useState(null),[St,he]=h.useState(!1),[Ae,rt]=h.useState(()=>new Set),[dt,jt]=h.useState(null),[et,Mt]=h.useState(null),sn=h.useRef({description:0,systemPrompt:0}),Ye=h.useRef({}),$n=h.useMemo(()=>Ggt(c.tools,me),[me,c.tools]),Te=h.useMemo(()=>{var Me;return((Me=u.status)==null?void 0:Me.servers)??[]},[(Wt=u.status)==null?void 0:Wt.servers]),ie=h.useMemo(()=>{var pt;const Me=(pt=d.settings.find(ln=>ln.key==="mcpServers"))==null?void 0:pt.values,Je=v==="global"?Me==null?void 0:Me.user:Me==null?void 0:Me.effective;return $m(Je)?Je:{}},[v,d.settings]),it=h.useMemo(()=>Te.filter(Me=>{var Je;return $m(ie[Me.name])||$m((Je=t==null?void 0:t.mcpServers)==null?void 0:Je[Me.name])?!0:v==="workspace"&&$m(Me.config)}),[t==null?void 0:t.mcpServers,ie,Te,v]),we=h.useMemo(()=>Kgt(it),[it]),We=we.join("\0"),ce=!!(k.trim()&&T.trim()&&C.trim());h.useEffect(()=>()=>{for(const Me of Object.values(Ye.current))Me==null||Me.abort()},[]),h.useEffect(()=>{let Me=!0;return(async()=>{var pt,ln;Pe(!0),Pt(null);try{if(!(await b(5e3)).ready)throw new Error(r("agent.create.tools.preheatFailed"));if(!Me)return;const ns=await w();if(!ns)throw new Error(r("agent.create.tools.loadFailed"));if((pt=ns.errors)!=null&&pt.length)throw new Error(ns.errors.map(ot=>ot.error||ot.hint||ot.kind).join(`
`));(await m()).accepted||await p();let Xe=!1;for(let ot=0;ot<Jgt;ot+=1){if(await new Promise(fn=>window.setTimeout(fn,Qgt)),!Me)return;const Tt=await g();if(Tt){if((ln=Tt.errors)!=null&&ln.length)throw new Error(Tt.errors.map(fn=>fn.error||fn.hint||fn.kind).join(`
`));if(Tt.discoveryState==="completed"||Tt.initialized&&Tt.discoveryState==="not_started"&&Tt.servers.length===0){Xe=!0;break}}}if(!Xe)throw new Error(r("mcp.discovery.timeout"))}catch(Bn){Me&&Pt(Bn instanceof Error?Bn.message:String(Bn))}finally{Me&&Pe(!1)}})(),()=>{Me=!1}},[m,b,g,p,w,r]),h.useEffect(()=>{if(ze)return;if(!We){te({});return}let Me=!0;return be(!0),ve(null),Promise.all(we.map(async Je=>{var ln;const pt=await f(Je);return{serverName:Je,tools:pt.tools.filter(Bn=>Bn.isValid),error:(ln=pt.errors)!=null&&ln.length?`${Je}: ${pt.errors.map(Bn=>Bn.error||Bn.hint||Bn.kind).join(", ")}`:void 0}})).then(Je=>{if(!Me)return;te(Object.fromEntries(Je.map(({serverName:ln,tools:Bn})=>[ln,Bn])));const pt=Je.flatMap(({error:ln})=>ln?[ln]:[]);ve(pt.length>0?pt.join(`
`):null)}).catch(Je=>{Me&&ve(Je instanceof Error?Je.message:String(Je))}).finally(()=>{Me&&be(!1)}),()=>{Me=!1}},[We,we,ze,f]);function De(Me){var Je;if(!Me){for(const pt of["description","systemPrompt"])sn.current[pt]+=1,(Je=Ye.current[pt])==null||Je.abort(),delete Ye.current[pt];rt(new Set)}le(Me)}function ct(){ne(T),ue(C),Mt(null),le(!0)}function qe(Me){var Je;sn.current[Me]+=1,(Je=Ye.current[Me])==null||Je.abort(),delete Ye.current[Me],rt(pt=>{const ln=new Set(pt);return ln.delete(Me),ln})}async function Ve(Me){const Je=pe.trim();if(!Je||Ye.current[Me])return;const pt=sn.current[Me]+1;sn.current[Me]=pt;const ln=new AbortController;Ye.current[Me]=ln,rt(ns=>new Set(ns).add(Me)),Mt(null);const Bn=Me==="description"?ne:ue;Bn("");try{const ns=Me==="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 lt="";for await(const Xe of l(`${Je}

${ns}`,{signal:ln.signal})){if(sn.current[Me]!==pt)return;if(Xe.type==="delta")lt+=Xe.text,Bn(lt);else if(Xe.type==="error")throw new Error(Xe.message)}if(sn.current[Me]!==pt)return;Bn(lt.trim())}catch(ns){if(sn.current[Me]!==pt||ln.signal.aborted)return;Mt(r("agent.create.generateFailed",{error:ns instanceof Error?ns.message:String(ns)}))}finally{sn.current[Me]===pt&&(rt(ns=>{const lt=new Set(ns);return lt.delete(Me),lt}),Ye.current[Me]===ln&&delete Ye.current[Me])}}function Qt(){S(Q.trim()),N(de.trim()),De(!1)}function Un(Me){var Bn,ns;const Je=(Bn=t==null?void 0:t.mcpServers)==null?void 0:Bn[Me];if($m(Je))return Je;const pt=ie[Me];if($m(pt))return pt;const ln=v==="workspace"?(ns=Te.find(lt=>lt.name===Me))==null?void 0:ns.config:void 0;return $m(ln)?ln:void 0}async function Ie(){if(!ce){jt(r("agent.create.required"));return}he(!0),jt(null);try{const Me=K.trim()?Number(K.trim()):void 0;if(Me!==void 0&&(!Number.isSafeInteger(Me)||Me<=0))throw new Error(r("agent.create.maxTurnsInvalid"));const Je=[...E],pt=[...B],ln=Ygt(J,"hooks"),Bn=Object.fromEntries([...M].flatMap(Xe=>{const ot=Un(Xe);return ot?[[Xe,ot]]:[]})),ns={description:T.trim(),systemPrompt:C.trim(),tools:t||Je.length>0?Je:void 0,disallowedTools:t||pt.length>0?pt:void 0,mcpServers:t||Object.keys(Bn).length>0?Bn:void 0,hooks:t?ln??{}:ln},lt=t?await o(t.name,{...ns,model:j.trim()||null,approvalMode:z==="inherit"?null:z,maxTurns:Me??null,color:Y==="inherit"?null:Y},v):await i({name:k.trim(),scope:v,...ns,model:j.trim()||void 0,approvalMode:z==="inherit"?void 0:z,maxTurns:Me,color:Y==="inherit"?void 0:Y});s(lt.agent.name)}catch(Me){jt(Xgt(Me))}finally{he(!1)}}return a.jsxs("div",{className:"flex w-full max-w-5xl flex-col gap-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsx("h1",{className:"text-xl font-semibold text-balance",children:r(t?"agent.edit":"agent.create")}),a.jsxs(Kt,{type:"button",variant:"outline",onClick:ct,children:[a.jsx(iy,{"data-icon":"inline-start"}),r("agent.create.modelGenerate")]})]}),dt?a.jsx(mc,{tone:"error",noticeKey:dt,closeLabel:r("common.close"),onDismiss:()=>jt(null),children:dt}):null,a.jsxs(_1,{defaultValue:"overview",children:[a.jsxs(S1,{className:"max-w-full overflow-x-auto",children:[a.jsx(ci,{value:"overview",children:r("agent.detail.overview")}),a.jsx(ci,{value:"prompt",children:r("agent.detail.systemPrompt")}),a.jsx(ci,{value:"tools",children:r("agent.detail.tools")}),a.jsx(ci,{value:"mcp",children:r("agent.detail.mcp")}),a.jsx(ci,{value:"hooks",children:r("agent.detail.hooks")})]}),a.jsx(qi,{value:"overview",className:"pt-4",children:a.jsxs(by,{className:"grid grid-cols-1 gap-5 lg:grid-cols-2",children:[a.jsxs(wo,{children:[a.jsx(oa,{htmlFor:"agent-scope",children:r("agent.create.scope")}),a.jsxs(vl,{value:v,disabled:!!t,onValueChange:Me=>x(Me),children:[a.jsx(xl,{id:"agent-scope",className:"w-full",children:a.jsx(wl,{})}),a.jsxs(kl,{children:[a.jsx(Ai,{value:"workspace",children:r("agent.create.project.cli")}),a.jsx(Ai,{value:"global",children:r("agent.create.user.cli")})]})]})]}),a.jsxs(wo,{children:[a.jsx(oa,{htmlFor:"agent-name",children:r("agent.create.name")}),a.jsx(Ur,{id:"agent-name",value:k,onChange:Me=>_(Me.target.value),placeholder:r("agent.create.namePlaceholder"),disabled:!!t}),a.jsx(cd,{children:r("agent.create.nameHelp")})]}),a.jsxs(wo,{className:"lg:col-span-2",children:[a.jsx(oa,{htmlFor:"agent-description",children:r("agent.create.description")}),a.jsx(ug,{id:"agent-description",value:T,onChange:Me=>S(Me.target.value),placeholder:r("agent.create.manualDescPlaceholder"),rows:3})]}),a.jsxs(wo,{children:[a.jsx(oa,{htmlFor:"agent-model",children:r("agent.create.model")}),a.jsx(Ur,{id:"agent-model",value:j,onChange:Me=>L(Me.target.value),placeholder:"inherit / fast / provider:model"})]}),a.jsxs(wo,{children:[a.jsx(oa,{htmlFor:"agent-approval",children:r("agent.create.approvalMode")}),a.jsxs(vl,{value:z,onValueChange:I,children:[a.jsx(xl,{id:"agent-approval",className:"w-full",children:a.jsx(wl,{children:qK(z,r)})}),a.jsx(kl,{children:$.map(Me=>a.jsx(Ai,{value:Me,disabled:Me==="bubble",children:qK(Me,r)},Me))})]}),a.jsx(cd,{children:e1t(z,r)})]}),a.jsxs(wo,{children:[a.jsx(oa,{htmlFor:"agent-max-turns",children:r("agent.create.maxTurns")}),a.jsx(Ur,{id:"agent-max-turns",type:"number",min:"1",step:"1",value:K,onChange:Me=>R(Me.target.value)}),a.jsx(cd,{children:r("agent.create.maxTurnsHelp")})]}),a.jsxs(wo,{children:[a.jsx(oa,{htmlFor:"agent-color",children:r("agent.create.color")}),a.jsxs(vl,{value:Y,onValueChange:W,children:[a.jsx(xl,{id:"agent-color",className:"w-full",children:a.jsx(wl,{})}),a.jsx(kl,{children:["inherit","auto","red","blue","green","yellow","purple","orange","pink","cyan"].map(Me=>a.jsx(Ai,{value:Me,children:Me},Me))})]})]})]})}),a.jsx(qi,{value:"prompt",className:"pt-4",children:a.jsxs(wo,{children:[a.jsx(ug,{id:"agent-prompt","aria-label":r("agent.create.prompt"),value:C,onChange:Me=>N(Me.target.value),placeholder:r("agent.create.promptPlaceholder.cli"),rows:16,className:"min-h-80 max-h-[60vh] overflow-y-auto"}),a.jsx(cd,{children:r("agent.create.promptHelp")})]})}),a.jsx(qi,{value:"tools",className:"pt-4",children:a.jsxs(by,{children:[a.jsxs(wo,{children:[a.jsx(oa,{children:r("agent.create.tools")}),a.jsx(cd,{children:r("agent.create.toolsSelectHelp")}),a.jsx(FK,{idPrefix:"agent-allowed-tool",selection:E,onSelectionChange:O,builtInTools:$n,mcpServers:it,mcpTools:me,t:r}),ze||ae?a.jsx(HK,{label:r("agent.create.tools.initializing")}):null,_t||se?a.jsx("div",{className:"whitespace-pre-wrap text-sm text-destructive",children:_t||se}):null]}),a.jsxs(wo,{children:[a.jsx(oa,{children:r("agent.create.disallowedTools")}),a.jsx(FK,{idPrefix:"agent-disallowed-tool",selection:B,onSelectionChange:D,builtInTools:$n,mcpServers:it,mcpTools:me,t:r})]})]})}),a.jsx(qi,{value:"mcp",className:"pt-4",children:a.jsxs(wo,{children:[a.jsx(oa,{children:r("agent.create.mcpServers")}),a.jsx(Zgt,{selection:M,onSelectionChange:F,servers:it,t:r}),d.loading?a.jsx(HK,{label:r("common.loading")}):d.error?a.jsx(t1t,{error:d.error}):null]})}),a.jsx(qi,{value:"hooks",className:"pt-4",children:a.jsxs(wo,{children:[a.jsx(oa,{htmlFor:"agent-hooks",children:"Hooks"}),a.jsx(ug,{id:"agent-hooks",value:J,onChange:Me=>V(Me.target.value),placeholder:'{"PreToolUse":[...] }',rows:10,className:"min-h-64 max-h-[60vh] overflow-y-auto font-mono text-xs"}),a.jsx(cd,{children:r("agent.create.jsonObjectHelp")})]})})]}),a.jsxs("div",{className:"flex justify-end gap-2 border-t pt-4",children:[a.jsx(Kt,{variant:"outline",onClick:n,disabled:St,children:r("common.cancel")}),a.jsxs(Kt,{onClick:()=>void Ie(),disabled:!ce||St,children:[St?a.jsx(Ws,{"data-icon":"inline-start"}):null,r(t?"agent.edit.save":"agent.create.save")]})]}),a.jsx(qp,{open:U,onOpenChange:De,children:a.jsxs(Hp,{className:"max-h-[calc(100vh-2rem)] overflow-y-auto sm:max-w-2xl",children:[a.jsxs(Up,{children:[a.jsx(Vp,{children:r("agent.create.modelGenerate")}),a.jsx(Yg,{children:r("agent.create.modelGenerate.description")})]}),et?a.jsx(mc,{tone:"error",noticeKey:et,closeLabel:r("common.close"),onDismiss:()=>Mt(null),children:et}):null,a.jsxs(by,{children:[a.jsxs(wo,{children:[a.jsx(oa,{htmlFor:"agent-generation-requirements",children:r("agent.create.describeAgent")}),a.jsx(ug,{id:"agent-generation-requirements",value:pe,onChange:Me=>fe(Me.target.value),placeholder:r("agent.create.qwenPlaceholder"),rows:4}),a.jsx(cd,{children:r("agent.create.qwenHint")})]}),a.jsxs(wo,{children:[a.jsx(zK,{htmlFor:"agent-generated-description",label:r("agent.create.generatedDescription"),active:Ae.has("description"),disabled:!pe.trim(),onGenerate:()=>void Ve("description"),onCancel:()=>qe("description"),t:r}),a.jsx(ug,{id:"agent-generated-description",value:Q,onChange:Me=>ne(Me.target.value),rows:3,readOnly:Ae.has("description")})]}),a.jsxs(wo,{children:[a.jsx(zK,{htmlFor:"agent-generated-prompt",label:r("agent.create.generatedSystemPrompt"),active:Ae.has("systemPrompt"),disabled:!pe.trim(),onGenerate:()=>void Ve("systemPrompt"),onCancel:()=>qe("systemPrompt"),t:r}),a.jsx(ug,{id:"agent-generated-prompt",value:de,onChange:Me=>ue(Me.target.value),rows:10,readOnly:Ae.has("systemPrompt"),className:"min-h-64 max-h-64 overflow-y-auto"})]})]}),a.jsxs(Wp,{children:[a.jsx(Kt,{type:"button",variant:"outline",onClick:()=>De(!1),children:r("common.cancel")}),a.jsx(Kt,{type:"button",onClick:Qt,disabled:Ae.size>0||!Q.trim()||!de.trim(),children:r("agent.create.useGenerated")})]})]})})]})}function zK({htmlFor:e,label:t,active:n,disabled:s,onGenerate:r,onCancel:i,t:o}){return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(oa,{htmlFor:e,children:t}),n?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(Ws,{className:"size-3"}),o("agent.create.generatingPrompt")]}),a.jsx(Kt,{type:"button",variant:"outline",size:"sm",className:"ml-auto",onClick:i,children:o("common.cancel")})]}):a.jsxs(Kt,{type:"button",variant:"outline",size:"sm",className:"ml-auto",disabled:s,onClick:r,children:[a.jsx(iy,{"data-icon":"inline-start"}),o("agent.create.generate")]})]})}function FK({idPrefix:e,selection:t,onSelectionChange:n,builtInTools:s,mcpServers:r,mcpTools:i,t:o}){const[l,c]=h.useState("builtin"),[u,d]=h.useState(""),f=r.filter(g=>!g.disabled),m=l==="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 w of b)p.set(w.name,`${g} / ${w.serverToolName||w.name}`);return a.jsxs("div",{className:"grid gap-3 rounded-lg border p-4",children:[a.jsxs("div",{className:`grid gap-3 ${l==="mcp"?"sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]":"sm:grid-cols-[minmax(0,1fr)]"}`,children:[a.jsxs(vl,{value:l,onValueChange:g=>{c(g),d("")},children:[a.jsx(xl,{id:`${e}-kind`,className:"w-full","aria-label":o("agent.create.tools.type"),children:a.jsx(wl,{})}),a.jsxs(kl,{children:[a.jsx(Ai,{value:"builtin",children:o("agent.create.tools.builtin")}),a.jsx(Ai,{value:"mcp",children:o("agent.create.tools.mcp")})]})]}),l==="mcp"?a.jsxs(vl,{value:u||void 0,onValueChange:d,children:[a.jsx(xl,{id:`${e}-server`,className:"w-full","aria-label":o("agent.create.tools.selectServer"),children:a.jsx(wl,{placeholder:o("agent.create.tools.selectServer")})}),a.jsx(kl,{children:f.map(g=>{var b;return a.jsxs(Ai,{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]}),a.jsx("div",{className:"max-h-64 overflow-y-auto rounded-md border",children:m.length>0?a.jsx(Td,{delayDuration:300,children:a.jsx("div",{className:"divide-y",children:m.map(g=>{const b=l==="builtin"?g.displayName||g.name:g.serverToolName||g.name;return a.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-3 py-2.5 hover:bg-accent/30",children:[a.jsx(op,{id:`${e}-${g.name}`,checked:t.has(g.name),onCheckedChange:w=>n(CR(t,g.name,w===!0))}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-sm font-medium",children:b}),g.description?a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsx("span",{className:"mt-0.5 block truncate text-xs text-muted-foreground",children:g.description})}),a.jsx(Uu,{className:"max-w-sm whitespace-normal",children:g.description})]}):null]})]},g.name)})})}):a.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:o("agent.create.tools.empty")})}),t.size>0?a.jsx("div",{className:"flex flex-wrap gap-2",children:[...t].map(g=>a.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:[a.jsx("span",{className:"truncate",children:p.get(g)||g}),a.jsx("button",{type:"button",className:"rounded-sm text-muted-foreground hover:text-foreground","aria-label":o("agent.create.removeSelection",{name:g}),onClick:()=>n(CR(t,g,!1)),children:a.jsx(yv,{className:"size-3.5"})})]},g))}):a.jsx("div",{className:"text-sm text-muted-foreground",children:o("agent.create.tools.noneSelected")})]})}function Zgt({selection:e,onSelectionChange:t,servers:n,t:s}){return a.jsx("div",{className:"max-h-64 overflow-y-auto rounded-lg border",children:n.length>0?a.jsx("div",{className:"divide-y",children:n.map(r=>a.jsxs("label",{className:"flex cursor-pointer items-center gap-3 px-3 py-2.5 hover:bg-accent/30",children:[a.jsx(op,{id:`agent-mcp-server-${r.name}`,checked:e.has(r.name),onCheckedChange:i=>t(CR(e,r.name,i===!0))}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:r.name}),r.mcpStatus?a.jsx(Ni,{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))}):a.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:s("agent.create.mcpServers.empty")})})}function qK(e,t){return t(e==="inherit"||e==="bubble"?`agent.approval.${e}`:`mode.listLabel.${e}`)}function e1t(e,t){return t(e==="inherit"||e==="bubble"?`agent.approval.desc.${e}`:`mode.desc.${e}`)}function HK({label:e}){return a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(Ws,{}),e]})}function t1t({error:e}){return a.jsx("div",{className:"text-sm text-destructive",children:e==null?void 0:e.message})}function ev({...e}){return a.jsx(LMe,{"data-slot":"alert-dialog",...e})}function n1t({container:e,...t}){const n=Gu();return a.jsx(PMe,{"data-slot":"alert-dialog-portal",container:e??n??void 0,...t})}const s1t=h.forwardRef(function({className:t,...n},s){return a.jsx(OMe,{ref:s,"data-slot":"alert-dialog-overlay",className:on("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})}),tv=h.forwardRef(function({className:t,size:n="default",...s},r){return a.jsxs(n1t,{children:[a.jsx(s1t,{}),a.jsx($Me,{ref:r,"data-slot":"alert-dialog-content","data-size":n,className:on("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 nv({className:e,...t}){return a.jsx("div",{"data-slot":"alert-dialog-header",className:on("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 sv({className:e,...t}){return a.jsx("div",{"data-slot":"alert-dialog-footer",className:on("-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 rv({className:e,...t}){return a.jsx(FMe,{"data-slot":"alert-dialog-title",className:on("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 iv({className:e,...t}){return a.jsx(qMe,{"data-slot":"alert-dialog-description",className:on("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function tE({className:e,variant:t="default",size:n="default",...s}){return a.jsx(Kt,{variant:t,size:n,asChild:!0,children:a.jsx(BMe,{"data-slot":"alert-dialog-action",className:on(e),...s})})}function ov({className:e,variant:t="outline",size:n="default",...s}){return a.jsx(Kt,{variant:t,size:n,asChild:!0,children:a.jsx(zMe,{"data-slot":"alert-dialog-cancel",className:on(e),...s})})}function s0({className:e,...t}){return a.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:on(e),...t})}function r0({className:e,...t}){return a.jsx("ol",{"data-slot":"breadcrumb-list",className:on("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground",e),...t})}function oo({className:e,...t}){return a.jsx("li",{"data-slot":"breadcrumb-item",className:on("inline-flex items-center gap-1",e),...t})}function bh({asChild:e,className:t,...n}){const s=e?uL:"a";return a.jsx(s,{"data-slot":"breadcrumb-link",className:on("transition-colors hover:text-foreground",t),...n})}function Bl({className:e,...t}){return a.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:on("font-normal text-foreground",e),...t})}function yh({children:e,className:t,...n}){return a.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:on("[&>svg]:size-3.5",t),...n,children:e??a.jsx(Eu,{})})}function Wo({className:e,size:t="default",...n}){return a.jsx("div",{"data-slot":"card","data-size":t,className:on("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 Hl({className:e,...t}){return a.jsx("div",{"data-slot":"card-header",className:on("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 Ul({className:e,...t}){return a.jsx("div",{"data-slot":"card-title",className:on("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",e),...t})}function Lu({className:e,...t}){return a.jsx("div",{"data-slot":"card-description",className:on("text-sm text-muted-foreground",e),...t})}function dfe({className:e,...t}){return a.jsx("div",{"data-slot":"card-action",className:on("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),...t})}function dc({className:e,...t}){return a.jsx("div",{"data-slot":"card-content",className:on("px-(--card-spacing)",e),...t})}function r1t({className:e,...t}){return a.jsx("div",{"data-slot":"card-footer",className:on("flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)",e),...t})}function md({className:e,...t}){return a.jsx("div",{"data-slot":"empty",className:on("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 pd({className:e,...t}){return a.jsx("div",{"data-slot":"empty-header",className:on("flex max-w-sm flex-col items-center gap-2",e),...t})}const i1t=g1("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 gd({className:e,variant:t="default",...n}){return a.jsx("div",{"data-slot":"empty-icon","data-variant":t,className:on(i1t({variant:t,className:e})),...n})}function bd({className:e,...t}){return a.jsx("div",{"data-slot":"empty-title",className:on("text-sm font-medium tracking-tight",e),...t})}function $v({className:e,...t}){return a.jsx("div",{"data-slot":"empty-description",className:on("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function o1t({className:e,...t}){return a.jsx("div",{"data-slot":"empty-content",className:on("flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance",e),...t})}const a1t=g1("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"}}),hfe=h.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function hO({className:e,variant:t,size:n,spacing:s=2,orientation:r="horizontal",children:i,...o}){return a.jsx(FL,{orientation:r,"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":s,"data-orientation":r,style:{"--gap":s},className:on("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:a.jsx(hfe.Provider,{value:{variant:t,size:n,spacing:s,orientation:r},children:i})})}function fO({className:e,children:t,variant:n="default",size:s="default",...r}){const i=h.useContext(hfe);return a.jsx(Iae,{"data-slot":"toggle-group-item","data-variant":i.variant||n,"data-size":i.size||s,"data-spacing":i.spacing,className:on("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",a1t({variant:i.variant||n,size:i.size||s}),e),...r,children:t})}const l1t="_agentGrid_bui90_1",c1t={agentGrid:l1t};function rN(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 u1t(e,t){return e?e==="inherit"||e==="bubble"?t(`agent.approval.${e}`):pv.some(n=>n===e)?t(`mode.listLabel.${e}`):e:"—"}function tg({label:e,value:t}){return a.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[a.jsx("div",{className:"text-sm font-medium",children:e}),a.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function UK(e){return e?JSON.stringify(e,null,2):"—"}function d1t(e){return e.replace(/\r\n?/g,`
`).replace(new RegExp("(?<!\\n)\\n(?!\\n|[ \\t]*(?:#{1,6}\\s|[-*+]\\s|\\d+\\.\\s|```|>\\s|\\*\\*[^*\\n]+\\*\\*:))","g")," ")}function ffe({onClose:e,embedded:t,initialCreateScope:n}){var pe,fe;const{t:s}=nt(),{agents:r,loading:i,error:o,reload:l,getAgent:c,deleteAgent:u}=vee({autoLoad:!0}),[d,f]=h.useState(""),[m,p]=h.useState("all"),[g,b]=h.useState(null),[w,y]=h.useState(null),[v,x]=h.useState(!1),[k,_]=h.useState(!1),[T,S]=h.useState(!1),[C,N]=h.useState(()=>!!n),[E,O]=h.useState(!1),[B,D]=h.useState(null),[j,L]=h.useState(null),[z,I]=h.useState(null),[$,K]=h.useState(!1),R=h.useMemo(()=>Bgt(r,d,m),[r,d,m]),Y=h.useMemo(()=>LK(g,r),[r,g]),W=(g==null?void 0:g.name)??null;h.useEffect(()=>{b(Q=>LK(Q,r))},[r]),h.useEffect(()=>{t==null||t.onDetailChange(!!(W||C||E))},[C,E,t,W]),h.useEffect(()=>{if(!g){y(null),I(null);return}let Q=!0;return y(null),I(null),x(!0),c(g.name,OK(g.level)).then(ne=>{Q&&y(ne)}).catch(ne=>{Q&&I(ne instanceof Error?ne.message:String(ne))}).finally(()=>{Q&&x(!1)}),()=>{Q=!1}},[g,c]),h.useEffect(()=>{K(!1)},[o]),h.useEffect(()=>{n&&N(!0)},[n]);function M(){N(!1),O(!1),b(null),y(null),L(null),l()}async function F(){if(!w||!Y)return;const Q=OK(Y.level);if(Q){_(!0);try{await u(Y.name,Q),S(!1),b(null),y(null),D(s("agent.deleted",{name:w.name})),await l()}catch(ne){S(!1),L(ne instanceof Error?ne.message:String(ne))}finally{_(!1)}}}const J=[{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")}],V=E?s("agent.edit"):W??(C?s("agent.create.button"):null),U=a.jsx(s0,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(r0,{className:"text-base",children:[a.jsx(oo,{children:a.jsx(Kt,{variant:"ghost",size:"icon",onClick:e,"aria-label":s("common.back"),children:a.jsx(T_,{})})}),a.jsx(oo,{children:V?a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",onClick:M,children:s("agents.title")})}):a.jsx(Bl,{children:s("agents.title")})}),V?a.jsx(yh,{}):null,V?a.jsx(oo,{children:a.jsx(Bl,{children:V})}):null]})}),le=t?V?a.jsx(s0,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(r0,{className:"h-8 text-sm",children:[a.jsx(oo,{children:a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>{M(),t.onDetailChange(!1)},children:s("agents.title")})})}),a.jsx(yh,{}),a.jsx(oo,{children:a.jsx(Bl,{children:V})})]})}):null:U;if(C)return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[le,a.jsx(BK,{initialScope:n??"global",onCancel:M,onCreated:Q=>{N(!1),D(s("agent.created",{name:Q})),l()}})]});if(E&&w)return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[le,a.jsx(BK,{agent:w,onCancel:()=>O(!1),onCreated:Q=>{O(!1),b(null),y(null),D(s("agent.updated",{name:Q})),l()}})]});if(W&&w){const Q=zgt(w),ne=!w.tools||w.tools.length===0||w.tools.includes("*")?s("agent.create.tools.all"):w.tools.join(", "),de=((pe=w.disallowedTools)==null?void 0:pe.join(", "))||"—";return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[le,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:a.jsx(sy,{})}),a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("h1",{className:"break-words text-xl font-semibold text-balance",children:w.name}),a.jsx(Ni,{variant:"outline",children:rN(w.level,s)}),PK(w,r)?a.jsx(Ni,{variant:"secondary",children:s("agent.overriddenBadge")}):null]})}),Q?a.jsxs(Mu,{children:[a.jsx(Ru,{asChild:!0,children:a.jsx(Kt,{variant:"ghost",size:"icon",disabled:k,"aria-label":s("agent.chooseAction",{name:w.name}),children:k?a.jsx(Ws,{}):a.jsx(sp,{})})}),a.jsx(Du,{align:"end",onCloseAutoFocus:ue=>ue.preventDefault(),children:a.jsxs(Tp,{children:[a.jsxs(bi,{onSelect:()=>O(!0),children:[a.jsx(Ny,{"data-icon":"inline-start"}),s("agent.edit")]}),a.jsxs(bi,{variant:"destructive",disabled:k,onSelect:()=>S(!0),children:[a.jsx(kf,{"data-icon":"inline-start"}),s("agent.delete")]})]})})]}):null]}),j?a.jsx(mc,{tone:"error",noticeKey:j,closeLabel:s("common.close"),onDismiss:()=>L(null),children:j}):null,a.jsxs(_1,{defaultValue:"overview",children:[a.jsxs(S1,{className:"max-w-full overflow-x-auto",children:[a.jsx(ci,{value:"overview",children:s("agent.detail.overview")}),a.jsx(ci,{value:"prompt",children:s("agent.detail.systemPrompt")}),a.jsx(ci,{value:"tools",children:s("agent.detail.tools")}),a.jsx(ci,{value:"mcp",children:s("agent.detail.mcp")}),a.jsx(ci,{value:"hooks",children:s("agent.detail.hooks")})]}),a.jsx(qi,{value:"overview",className:"pt-4",children:a.jsxs(Wo,{children:[a.jsxs(Hl,{children:[a.jsx(Ul,{className:"text-sm",children:s("agent.descriptionLabel")}),a.jsx(Lu,{children:w.description||"—"})]}),a.jsxs(dc,{className:"grid gap-6 sm:grid-cols-2",children:[a.jsx(tg,{label:s("agent.filePathLabel"),value:w.filePath||"—"}),a.jsx(tg,{label:s("agent.modelLabel"),value:w.model||"—"}),a.jsx(tg,{label:s("agent.level.label"),value:rN(w.level,s)}),a.jsx(tg,{label:s("agent.create.approvalMode"),value:u1t(w.approvalMode||w.permissionMode,s)}),a.jsx(tg,{label:s("agent.create.maxTurns"),value:((fe=w.maxTurns)==null?void 0:fe.toString())||"—"}),a.jsx(tg,{label:s("agent.create.color"),value:w.color||"—"})]})]})}),a.jsx(qi,{value:"prompt",className:"pt-4",children:a.jsx(Wo,{children:a.jsx(dc,{children:a.jsx("div",{className:"max-h-[60vh] w-full overflow-auto break-words whitespace-pre-line text-sm leading-6 text-muted-foreground",children:w.systemPrompt?d1t(w.systemPrompt):"—"})})})}),a.jsx(qi,{value:"tools",className:"pt-4",children:a.jsxs(Wo,{children:[a.jsxs(Hl,{children:[a.jsx(Ul,{className:"text-sm",children:s("agent.toolsLabel")}),a.jsx(Lu,{children:ne})]}),a.jsx(dc,{className:"flex flex-col gap-6",children:a.jsx(tg,{label:s("agent.create.disallowedTools"),value:de})})]})}),a.jsx(qi,{value:"mcp",className:"pt-4",children:a.jsxs(Wo,{children:[a.jsx(Hl,{children:a.jsx(Ul,{className:"text-sm",children:s("agent.create.mcpServers")})}),a.jsx(dc,{children:a.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs text-muted-foreground",children:UK(w.mcpServers)})})]})}),a.jsx(qi,{value:"hooks",className:"pt-4",children:a.jsxs(Wo,{children:[a.jsx(Hl,{children:a.jsx(Ul,{className:"text-sm",children:s("agent.detail.hooks")})}),a.jsx(dc,{children:a.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs text-muted-foreground",children:UK(w.hooks)})})]})})]}),a.jsx(ev,{open:T,onOpenChange:ue=>{!ue&&k||S(ue)},children:a.jsxs(tv,{children:[a.jsxs(nv,{children:[a.jsx(rv,{children:s("agent.delete.title",{name:w.name})}),a.jsx(iv,{children:s("agent.delete.confirm",{name:w.name})})]}),a.jsxs(sv,{children:[a.jsx(ov,{disabled:k,children:s("common.cancel")}),a.jsxs(tE,{variant:"destructive",disabled:k,onClick:ue=>{ue.preventDefault(),F()},children:[k?a.jsx(Ws,{"data-icon":"inline-start"}):null,s("agent.delete.yes")]})]})]})})]})]})}return W&&v?a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[le,a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx(Ws,{className:"size-6"})})]}):W&&z?a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[le,a.jsx(mc,{tone:"error",noticeKey:z,closeLabel:s("common.close"),onDismiss:M,children:z})]}):a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[le,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-semibold text-balance",children:s("agents.title")}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground tabular-nums",children:s("agent.count",{count:r.length})})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Kt,{variant:"outline",disabled:i,onClick:()=>void l(),children:[i?a.jsx(Ws,{"data-icon":"inline-start"}):a.jsx(Ug,{"data-icon":"inline-start"}),s("common.refresh")]}),a.jsxs(Kt,{onClick:()=>N(!0),children:[a.jsx(Vf,{"data-icon":"inline-start"}),s("agent.create.button")]})]})]}),o&&!$?a.jsx(mc,{tone:"error",noticeKey:o.message,closeLabel:s("common.close"),onDismiss:()=>K(!0),children:o.message}):null,B?a.jsx(mc,{tone:"success",noticeKey:B,closeLabel:s("common.close"),onDismiss:()=>D(null),children:B}):null,a.jsxs("div",{className:"relative",children:[a.jsx(eu,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Ur,{name:"agent-search","aria-label":s("common.search"),autoComplete:"off",value:d,onChange:Q=>f(Q.target.value),placeholder:s("common.search"),className:"pl-9"})]}),a.jsx(hO,{type:"single",value:m,onValueChange:Q=>{Q&&p(Q)},variant:"outline",size:"sm","aria-label":s("agent.level.filter"),children:J.map(Q=>a.jsx(fO,{value:Q.value,children:Q.label},Q.value))}),R.length?a.jsx("div",{className:c1t.agentGrid,"data-column-count":Math.min(R.length,4),children:R.map(Q=>a.jsx(Wo,{size:"sm",role:"button",tabIndex:0,"aria-label":Q.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),L(null),b({name:Q.name,level:Q.level})},onKeyDown:ne=>{(ne.key==="Enter"||ne.key===" ")&&(ne.preventDefault(),D(null),L(null),b({name:Q.name,level:Q.level}))},children:a.jsx(Hl,{className:"block",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:a.jsx(sy,{className:"size-5"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[a.jsx(Ul,{className:"min-w-0 flex-1 truncate",children:Q.name}),a.jsxs("div",{className:"flex shrink-0 gap-1",children:[a.jsx(Ni,{variant:"outline",className:"text-[10px]",children:rN(Q.level,s)}),PK(Q,r)?a.jsx(Ni,{variant:"secondary",className:"text-[10px]",children:s("agent.overriddenBadge")}):null]})]}),a.jsx(Lu,{className:"mt-1 min-w-0 text-xs",children:a.jsx(Td,{delayDuration:300,children:a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsx("span",{className:"block truncate",children:Q.description||"—"})}),a.jsx(Uu,{children:Q.description||"—"})]})})})]})]})})},`${Q.level}:${Q.name}`))}):a.jsx(md,{className:"border",children:a.jsxs(pd,{children:[a.jsx(gd,{variant:"icon",children:d||m!=="all"?a.jsx(eu,{}):a.jsx(sy,{})}),a.jsx(bd,{children:s(d||m!=="all"?"agent.noMatches":"agent.empty")})]})})]})]})}const h1t="_page_1np31_1",f1t="_tabs_1np31_11",m1t="_memoryCard_1np31_19",p1t="_memoryCardActive_1np31_35",g1t="_memoryTitle_1np31_44",b1t="_detailPath_1np31_48",y1t="_status_1np31_49",v1t="_actionButton_1np31_54",w1t="_primaryButton_1np31_55",x1t="_secondaryButton_1np31_56",k1t="_detail_1np31_48",_1t="_detailHeader_1np31_79",S1t="_detailTitleWrap_1np31_87",C1t="_actions_1np31_91",T1t="_content_1np31_105",E1t="_editor_1np31_106",A1t="_editorFooter_1np31_127",Ya={page:h1t,tabs:f1t,memoryCard:m1t,memoryCardActive:p1t,memoryTitle:g1t,detailPath:b1t,status:y1t,actionButton:v1t,primaryButton:w1t,secondaryButton:x1t,detail:k1t,detailHeader:_1t,detailTitleWrap:S1t,actions:C1t,content:T1t,editor:E1t,editorFooter:A1t};function WK(e,t){return e.find(n=>n.scope===t)}function VK(e,t){return t(e==="global"?"memory.global":"memory.project")}function j1t({refreshSignal:e=0,addSignal:t=0,addScope:n="workspace",onMessage:s}){var R,Y;const{t:r}=nt(),{files:i,loading:o,error:l,readFile:c,reload:u,writeMemory:d}=Gwe({autoLoad:!0}),f=h.useRef(null),m=h.useRef(0),[p,g]=h.useState("workspace"),[b,w]=h.useState("view"),[y,v]=h.useState(""),[x,k]=h.useState(""),[_,T]=h.useState(!1),[S,C]=h.useState(!1),[N,E]=h.useState(null),O=h.useRef(0),B=h.useMemo(()=>{const W=WK(i,"global"),M=WK(i,"workspace");return[{scope:"workspace",title:r("memory.project"),description:r("memory.project.desc"),fallbackPath:"QWEN.md",file:M},{scope:"global",title:r("memory.global"),description:r("memory.global.desc"),fallbackPath:"~/.qwen/QWEN.md",file:W}]},[i,r]),D=B.find(W=>W.scope===p)??B[0],j=h.useCallback((W,M)=>{const F=++m.current;if(w(M),E(null),v(""),k(""),!(W!=null&&W.file)){M==="edit"&&requestAnimationFrame(()=>{var J;return(J=f.current)==null?void 0:J.focus()});return}T(!0),c(W.file.path).then(J=>{F===m.current&&(v(J.content),k(J.content),J.truncated&&E(r("memory.fileTruncated")),requestAnimationFrame(()=>{var V;return(V=f.current)==null?void 0:V.focus()}))}).catch(J=>{if(F!==m.current)return;const V=J instanceof Error?J.message:String(J);E(V),W.scope!=="global"&&(s==null||s(V,"error"))}).finally(()=>{F===m.current&&T(!1)})},[s,c,r]);h.useEffect(()=>{D&&j(D,b)},[(R=D==null?void 0:D.file)==null?void 0:R.path,D==null?void 0:D.scope]),h.useEffect(()=>{l&&E(l.message)},[l]),h.useEffect(()=>{e<=0||u().then(()=>E(r("memory.refreshed"))).catch(W=>{const M=W instanceof Error?W.message:String(W);E(M),s==null||s(M,"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 M=B.find(F=>F.scope===W);j(M,"edit")},[n,t,B,j]);const L=W=>{g(W.scope),j(W,"view")},z=()=>{D&&j(D,"edit")},I=()=>{if(D){if(!x.trim()){E(r("memory.contentEmpty"));return}C(!0),E(null),d({scope:D.scope,mode:"replace",content:x}).then(W=>{const M=r("memory.saved",{scope:VK(D.scope,r),bytes:W.bytesWritten,path:W.filePath});v(x),w("view"),E(M),s==null||s(M,"status"),u().catch(()=>{})}).catch(W=>{const M=W instanceof Error?W.message:String(W);E(M),s==null||s(M,"error")}).finally(()=>C(!1))}},$=((Y=D==null?void 0:D.file)==null?void 0:Y.path)??(D==null?void 0:D.fallbackPath)??"",K=N??(o?r("memory.loading"):null);return a.jsxs("div",{className:Ya.page,children:[a.jsx("nav",{className:Ya.tabs,"aria-label":r("memory.menu"),children:B.map(W=>{const M=W.scope===p;return a.jsx("button",{type:"button",className:`${Ya.memoryCard} ${M?Ya.memoryCardActive:""}`,onClick:()=>L(W),children:a.jsx("span",{className:Ya.memoryTitle,children:W.title})},W.scope)})}),a.jsxs("section",{className:Ya.detail,children:[a.jsxs("header",{className:Ya.detailHeader,children:[a.jsx("div",{className:Ya.detailTitleWrap,children:a.jsx("div",{className:Ya.detailPath,children:$})}),a.jsx("div",{className:Ya.actions,children:a.jsx("button",{type:"button",className:Ya.actionButton,onClick:z,children:r("settings.action.edit")})})]}),K&&a.jsx("div",{className:Ya.status,children:K}),b==="edit"?a.jsxs(a.Fragment,{children:[a.jsx("textarea",{ref:f,className:Ya.editor,value:x,disabled:S||_,onChange:W=>k(W.target.value),placeholder:r("memory.placeholder",{scope:D?VK(D.scope,r):""})}),a.jsxs("div",{className:Ya.editorFooter,children:[a.jsx("button",{type:"button",className:Ya.secondaryButton,disabled:S,onClick:()=>{k(y),w("view")},children:r("common.cancel")}),a.jsx("button",{type:"button",className:Ya.primaryButton,disabled:S||_,onClick:I,children:r(S?"memory.saving":"memory.save")})]})]}):a.jsx("pre",{className:Ya.content,children:_?r("memory.loadingFile"):y||r("memory.noFiles")})]})]})}const N1t="_panel_cxp6w_1",I1t="_steps_cxp6w_10",M1t="_stepPill_cxp6w_18",R1t="_stepPillActive_cxp6w_29",D1t="_stepPillDone_cxp6w_34",L1t="_stepNumber_cxp6w_38",P1t="_stepLabel_cxp6w_49",O1t="_body_cxp6w_55",$1t="_text_cxp6w_59",B1t="_muted_cxp6w_64",z1t="_options_cxp6w_68",F1t="_option_cxp6w_68",q1t="_optionActive_cxp6w_90",H1t="_label_cxp6w_94",U1t="_optionText_cxp6w_98",W1t="_description_cxp6w_112",V1t="_input_cxp6w_119",G1t="_preview_cxp6w_135",K1t="_error_cxp6w_146",Y1t="_link_cxp6w_150",X1t="_terms_cxp6w_161",Q1t="_actions_cxp6w_169",J1t="_actionButton_cxp6w_177",Dr={panel:N1t,steps:I1t,stepPill:M1t,stepPillActive:R1t,stepPillDone:D1t,stepNumber:L1t,stepLabel:P1t,body:O1t,text:$1t,muted:B1t,options:z1t,option:F1t,optionActive:q1t,label:H1t,optionText:U1t,description:W1t,input:V1t,preview:G1t,error:K1t,link:Y1t,terms:X1t,actions:Q1t,actionButton:J1t};function Z1t(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 Yw(e){return e==="anthropic"?"https://api.anthropic.com/v1":e==="gemini"?"https://generativelanguage.googleapis.com":"https://api.openai.com/v1"}function GK(e){var t;return((t=e==null?void 0:e.models)==null?void 0:t.map(n=>n.id).join(", "))??""}function ebt(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 tbt(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 iN(e){return[...new Set(e.split(",").map(t=>t.trim()).filter(t=>t.length>0))]}function nbt({onMessage:e,onClose:t}){const{t:n}=nt(),s=Qo(),[r,i]=h.useState("groups"),[o,l]=h.useState(0),[c,u]=h.useState(0),[d,f]=h.useState("providers"),[m,p]=h.useState(0),[g,b]=h.useState(),[w,y]=h.useState("alibaba"),[v,x]=h.useState(null),[k,_]=h.useState("openai"),[T,S]=h.useState(""),[C,N]=h.useState(""),[E,O]=h.useState(""),[B,D]=h.useState(!1),[j,L]=h.useState(!1),[z,I]=h.useState(!0),[$,K]=h.useState(!0),[R,Y]=h.useState(!1),[W,M]=h.useState(!1),[F,J]=h.useState(""),[V,U]=h.useState(!0),[le,pe]=h.useState(!1),[fe,Q]=h.useState(null);h.useEffect(()=>{s.getAuthProviders().then(Te=>{b(Te),U(!1)}).catch(Te=>{Q(Te instanceof Error?Te.message:String(Te)),U(!1)})},[s]);const ne=h.useMemo(()=>(g==null?void 0:g.groups)??[],[g]),de=h.useMemo(()=>{var ie;return(((ie=ne.find(it=>it.id===w))==null?void 0:ie.providerIds)??[]).map(it=>g==null?void 0:g.providers.find(we=>we.id===it)).filter(it=>!!it)},[g,w,ne]),ue=h.useMemo(()=>(v==null?void 0:v.steps)??[],[v==null?void 0:v.steps]),me=ue[m],te=(v==null?void 0:v.showAdvancedConfig)===!0,ae=h.useMemo(()=>j?["thinking","modality","image","video","audio","pdf","context"]:["thinking","modality","context"],[j]),be=ae.indexOf("context"),se=me==="apiKey"||me==="models"||me==="baseUrl"&&!Array.isArray(v==null?void 0:v.baseUrl),[ve,ze]=h.useState(0),Pe=h.useCallback((Te,ie="providers")=>{var we,We;x(Te),f(ie);const it=((we=Te.protocolOptions)==null?void 0:we[0])??Te.protocol;_(it),typeof Te.baseUrl=="string"?S(Te.baseUrl):Array.isArray(Te.baseUrl)?S(((We=Te.baseUrl[0])==null?void 0:We.url)??""):S(Yw(it)),N(""),O(GK(Te)),D(!1),L(!1),I(!0),K(!0),Y(!1),M(!1),J(""),p(0),ze(0),Q(null),i(Te.steps.length>0?"step":"review")},[]),_t=h.useCallback(()=>{if(Q(null),r==="groups"){t();return}if(r==="providers"){i("groups");return}if(r==="review"){if(ue.length===0){i(d);return}i("step"),p(Math.max(0,ue.length-1));return}if(m>0){p(Te=>Te-1),ze(0);return}i(d)},[t,d,m,ue.length,r]),Pt=h.useCallback(()=>{if(!v||le)return;pe(!0),Q(null);const Te=Number(F);s.installAuthProvider({providerId:v.id,protocol:k,baseUrl:T,apiKey:C,modelIds:iN(E),advancedConfig:B||j||Number.isFinite(Te)&&Te>0?{...B?{enableThinking:!0}:{},...j?{multimodal:{...z?{image:!0}:{},...$?{video:!0}:{},...R?{audio:!0}:{},...W?{pdf:!0}:{}}}:{},...Number.isFinite(Te)&&Te>0?{contextWindowSize:Te}:{}}:void 0}).then(ie=>{e(ie.message),t()}).catch(ie=>{const it=ie instanceof Error?ie.message:String(ie);Q(it),e(it,"error")}).finally(()=>pe(!1))},[C,T,F,j,R,z,W,$,E,t,e,k,v,le,B,s]),St=h.useCallback(()=>{if(v){if(me==="baseUrl"){const Te=T.trim()||Yw(k);if(!Te){Q(n("auth.baseUrlRequired"));return}if(!/^https?:\/\//i.test(Te)){Q(n("auth.baseUrlInvalid"));return}T.trim()||S(Te)}if(me==="apiKey"&&C.trim().length===0){Q(n("auth.apiKeyRequired"));return}if(me==="models"&&iN(E).length===0){Q(n("auth.modelsRequired"));return}Q(null),m>=ue.length-1?te?i("review"):Pt():(p(Te=>Te+1),ze(0))}},[C,T,me,E,k,v,Pt,te,m,ue.length,n]),he=h.useCallback(Te=>{switch(Te){case"thinking":D(ie=>!ie);return;case"modality":L(ie=>!ie);return;case"image":I(ie=>!ie);return;case"video":K(ie=>!ie);return;case"audio":Y(ie=>!ie);return;case"pdf":M(ie=>!ie);return;case"context":St();return;default:return}},[St]),Ae=h.useCallback(()=>{if(r==="groups"){const Te=ne[o];if(!Te)return;if(Te.id==="custom"){const ie=Te.providerIds.map(it=>g==null?void 0:g.providers.find(we=>we.id===it)).find(it=>!!it);ie&&Pe(ie,"groups");return}y(Te.id),u(0),i("providers");return}if(r==="providers"){const Te=de[c];Te&&Pe(Te,"providers");return}if(r==="review"){Pt();return}if(!(!v||!me)){if(me==="protocol"){const Te=(v.protocolOptions??[v.protocol])[ve];Te&&(_(Te),v.baseUrl||S(Yw(Te))),St();return}if(me==="baseUrl"&&Array.isArray(v.baseUrl)){const Te=v.baseUrl[ve];Te&&S(Te.url),St();return}if(me==="advancedConfig"){he(ae[ve]);return}St()}},[me,g,St,o,ne,ve,v,c,de,Pt,Pe,r,he,ae]),rt=h.useCallback(Te=>{if(r==="groups"){const ie=ne[Te];if(!ie)return;if(ie.id==="custom"){const it=ie.providerIds.map(we=>g==null?void 0:g.providers.find(We=>We.id===we)).find(we=>!!we);it&&Pe(it,"groups");return}y(ie.id),u(0),i("providers");return}if(r==="providers"){const ie=de[Te];ie&&Pe(ie,"providers");return}if(!v||!me){r==="review"&&Pt();return}if(me==="protocol"){const ie=(v.protocolOptions??[v.protocol])[Te];ie&&(_(ie),v.baseUrl||S(Yw(ie))),St();return}if(me==="baseUrl"&&Array.isArray(v.baseUrl)){const ie=v.baseUrl[Te];ie&&S(ie.url),St();return}me==="advancedConfig"&&he(ae[Te])},[me,g,St,ne,he,ae,v,de,Pt,Pe,r]),dt=(Te,ie,it)=>a.jsx("div",{className:Dr.options,children:Te.map((we,We)=>a.jsx("button",{type:"button",className:`${Dr.option} ${ie===We?Dr.optionActive:""}`,onClick:()=>{it(We),rt(We)},children:a.jsxs("div",{className:Dr.optionText,children:[a.jsx("div",{className:Dr.label,children:we.label}),we.description&&a.jsx("div",{className:Dr.description,children:we.description})]})},we.value))}),jt=()=>{if(!v||!me)return null;if(me==="protocol"){const it=v.protocolOptions??[v.protocol];return dt(Z1t(n).filter(we=>it.includes(we.value)),ve,ze)}if(me==="baseUrl")return Array.isArray(v.baseUrl)?dt(v.baseUrl.map(it=>({value:it.url,label:it.label,description:it.url})),ve,ze):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Dr.text,children:n("auth.baseUrlPrompt")}),a.jsx("input",{className:Dr.input,value:T,placeholder:Yw(k),onChange:it=>{S(it.target.value),Q(null)},onKeyDown:it=>{it.key==="Enter"&&(it.preventDefault(),it.stopPropagation(),St())},autoFocus:!0}),v.documentationUrl&&a.jsx("a",{className:Dr.link,href:v.documentationUrl,target:"_blank",rel:"noreferrer",children:n("auth.documentation")})]});if(me==="apiKey")return a.jsxs(a.Fragment,{children:[v.documentationUrl&&a.jsxs("a",{className:Dr.link,href:v.documentationUrl,target:"_blank",rel:"noreferrer",children:[n("auth.documentation"),": ",v.documentationUrl]}),a.jsx("input",{className:Dr.input,type:"password",value:C,placeholder:v.apiKeyPlaceholder??n("auth.apiKeyPlaceholder"),onChange:it=>{N(it.target.value),Q(null)},onKeyDown:it=>{it.key==="Enter"&&(it.preventDefault(),it.stopPropagation(),St())},autoFocus:!0})]});if(me==="models"){const it=GK(v);return a.jsxs(a.Fragment,{children:[it&&a.jsx("div",{className:Dr.muted,children:n("auth.modelsPrompt",{modelIds:it})}),a.jsx("input",{className:Dr.input,value:E,placeholder:it||n("auth.modelsPlaceholder"),onChange:we=>{O(we.target.value),Q(null)},onKeyDown:we=>{we.key==="Enter"&&(we.preventDefault(),we.stopPropagation(),St())},autoFocus:!0})]})}const Te=it=>it?"◉":"○",ie=[{value:"thinking",label:`${Te(B)} ${n("auth.advanced.thinking")}`,description:n("auth.advanced.thinkingDesc")},{value:"modality",label:`${Te(j)} ${n("auth.advanced.modality")}`,description:n("auth.advanced.modalityDesc")}];return j&&ie.push({value:"image",label:`${Te(z)} ${n("auth.advanced.modalityImage")}`},{value:"video",label:`${Te($)} ${n("auth.advanced.modalityVideo")}`},{value:"audio",label:`${Te(R)} ${n("auth.advanced.modalityAudio")}`},{value:"pdf",label:`${Te(W)} ${n("auth.advanced.modalityPdf")}`}),ie.push({value:"context",label:`${n("auth.advanced.contextWindow")}: ${F||"auto"}`,description:n("auth.advanced.contextDesc")}),a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Dr.text,children:n("auth.advanced.prompt")}),dt(ie,ve,ze),a.jsx("input",{className:Dr.input,value:F,placeholder:n("common.auto"),onChange:it=>J(it.target.value.replace(/[^0-9]/g,"")),onFocus:()=>ze(be),onKeyDown:it=>{it.key==="Enter"&&(it.preventDefault(),it.stopPropagation(),St())}})]})},et=h.useMemo(()=>{if(!v)return"";const Te=v.envKey??`${k.toUpperCase()}_API_KEY`,ie=iN(E),it={};if(B&&(it.extra_body={enable_thinking:!0}),j){const ce={};z&&(ce.image=!0),$&&(ce.video=!0),R&&(ce.audio=!0),W&&(ce.pdf=!0),Object.keys(ce).length>0&&(it.modalities=ce)}const we=Number(F);Number.isFinite(we)&&we>0&&(it.contextWindowSize=we);const We=Object.keys(it).length>0;return JSON.stringify({env:{[Te]:tbt(C,n)},modelProviders:{[k]:ie.map(ce=>({id:ce,name:ce,baseUrl:T.trim(),envKey:Te,...We?{generationConfig:it}:{}}))},security:{auth:{selectedType:k}},model:{name:ie[0]}},null,2)},[C,T,F,j,R,z,W,$,E,k,v,n,B]),Mt=h.useMemo(()=>{const Te=[n("auth.step.group"),n("auth.step.provider")];return v&&(Te.push(...ue.map(ie=>ebt(ie,v,n))),te&&Te.push(n("auth.review"))),Te},[v,te,ue,n]),sn=h.useMemo(()=>r==="groups"?1:r==="providers"?2:r==="step"?Math.min(3+m,Mt.length):Mt.length,[m,Mt.length,r]),Ye=V?a.jsx("div",{className:Dr.muted,children:n("common.loading")}):r==="groups"?a.jsxs(a.Fragment,{children:[dt(ne.map(Te=>({value:Te.id,label:n(Te.label),description:n(Te.description)})),o,l),a.jsxs("div",{className:Dr.terms,children:[a.jsxs("div",{children:[n("auth.termsTitle"),":"]}),a.jsx("a",{className:Dr.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"?dt(de.map(Te=>({value:Te.id,label:n(Te.label),description:n(Te.description)})),c,u):r==="step"?jt():a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Dr.text,children:n("auth.reviewText")}),a.jsx("div",{className:Dr.preview,children:et})]}),$n=()=>{if(r==="review"){Pt();return}if(se||me==="advancedConfig"){St();return}Ae()};return a.jsxs("div",{className:Dr.panel,children:[a.jsx("div",{className:Dr.steps,children:Mt.map((Te,ie)=>{const it=ie+1;return a.jsxs("div",{className:`${Dr.stepPill} ${it===sn?Dr.stepPillActive:""} ${it<sn?Dr.stepPillDone:""}`,children:[a.jsx("span",{className:Dr.stepNumber,children:it}),a.jsx("span",{className:Dr.stepLabel,children:Te})]},`${it}:${Te}`)})}),a.jsx("div",{className:Dr.body,children:Ye}),fe&&a.jsx("div",{className:Dr.error,children:fe}),a.jsxs("div",{className:Dr.actions,children:[a.jsx("button",{type:"button",className:Dr.actionButton,onClick:_t,disabled:r==="groups"||V||le,children:n("common.previous")}),a.jsx("button",{type:"button",className:Dr.actionButton,onClick:$n,disabled:V||le,children:n(r==="review"?le?"auth.saving":"auth.save":"common.next")})]})]})}function sbt(e){return e.displayName||e.name}const mfe="tools-list",KK=e=>`${mfe}-opt-${e}`;function rbt(){const{t:e}=nt(),{status:t,tools:n,loading:s,error:r}=wee({autoLoad:!0}),[i,o]=h.useState(0),[l,c]=h.useState(null),[u,d]=h.useState(()=>new Set),f=h.useRef(null);h.useEffect(()=>{var b,w;r?c(r.message):(w=(b=t==null?void 0:t.errors)==null?void 0:b[0])!=null&&w.error?c(t.errors[0].error):t&&c(null)},[t,r]);const m=h.useCallback(b=>{d(w=>w.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 w;const b=(w=f.current)==null?void 0:w.children[i];b==null||b.scrollIntoView({block:"nearest"})},[i]);const{keyboardMode:p}=k0({itemCount:n.length,activeIndex:i,onActiveIndexChange:o,onConfirm:b=>{const w=n[b];w!=null&&w.description&&m(w)}}),g=h.useMemo(()=>{if(!t)return"";const b=n.filter(w=>w.enabled).length;return e("tools.summary",{enabled:b,total:n.length})},[t,n,e]);return a.jsxs("div",{className:Sn("picker","picker-in-shell"),children:[g&&a.jsx("div",{className:Sn("picker-search"),children:a.jsx("span",{className:Sn("picker-search-hint"),children:g})}),(l||s)&&a.jsx("div",{className:Sn("picker-search"),children:a.jsx("span",{className:Sn("picker-search-hint"),children:l||e("tools.loading")})}),a.jsx("div",{className:Sn("picker-sep")}),a.jsxs("div",{id:mfe,role:"listbox","aria-label":e("tools.title"),tabIndex:0,"aria-activedescendant":n.length>0?KK(i):void 0,className:Sn("picker-list",p?"picker-keyboard-only":void 0),ref:f,children:[!s&&n.length===0&&a.jsx("div",{className:Sn("picker-empty"),children:e("tools.empty")}),n.map((b,w)=>{const y=u.has(b.name),v=b.description??"";return a.jsxs("div",{id:KK(w),role:"option","aria-selected":!1,"aria-expanded":v?y:void 0,className:Sn("picker-item","picker-session-item","tools-picker-item",w===i?"selected":void 0,y?"tools-picker-item-expanded":void 0),onClick:()=>{o(w),b.description&&m(b)},onMouseMove:()=>o(w),children:[a.jsxs("div",{className:Sn("picker-item-row"),children:[a.jsx("span",{className:Sn("tools-item-icon"),"aria-hidden":"true"}),a.jsx("span",{className:Sn("picker-item-title"),children:sbt(b)}),a.jsx("span",{className:Sn("tools-status-badge",b.enabled?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:b.enabled?e("tools.status.enabled"):e("tools.status.disabled")}),v?a.jsx("svg",{className:Sn("tools-item-chevron",y?"tools-item-chevron-expanded":void 0),viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}):null]}),y&&v&&a.jsx("div",{className:Sn("tools-desc-expanded"),children:a.jsx("div",{className:Sn("tools-desc-body"),children:v})})]},b.name)})]})]})}const ibt="_content_xihrz_1",obt="_placeholder_xihrz_7",abt="_fileList_xihrz_13",lbt="_file_xihrz_13",cbt="_fileHeader_xihrz_25",ubt="_fileStats_xihrz_43",dbt="_statAdd_xihrz_51",hbt="_statDel_xihrz_55",fbt="_fileBinary_xihrz_59",mbt="_filePath_xihrz_63",pbt="_fileOldPath_xihrz_71",gbt="_fileTag_xihrz_75",bbt="_fileBody_xihrz_85",ybt="_filePlaceholder_xihrz_89",vbt="_hiddenNote_xihrz_95",wbt="_diffLines_xihrz_101",xbt="_diffLine_xihrz_101",kbt="_diffLineAdd_xihrz_113",_bt="_diffLineDel_xihrz_117",Sbt="_diffLineContext_xihrz_121",Cbt="_diffLineMeta_xihrz_125",Tbt="_diffOldNo_xihrz_131",Ebt="_diffNewNo_xihrz_132",Abt="_diffMarker_xihrz_143",jbt="_diffContent_xihrz_159",vr={content:ibt,placeholder:obt,fileList:abt,file:lbt,fileHeader:cbt,fileStats:ubt,statAdd:dbt,statDel:hbt,fileBinary:fbt,filePath:mbt,fileOldPath:pbt,fileTag:gbt,fileBody:bbt,filePlaceholder:ybt,hiddenNote:vbt,diffLines:wbt,diffLine:xbt,diffLineAdd:kbt,diffLineDel:_bt,diffLineContext:Sbt,diffLineMeta:Cbt,diffOldNo:Tbt,diffNewNo:Ebt,diffMarker:Abt,diffContent:jbt},Nbt={add:vr.diffLineAdd,del:vr.diffLineDel,context:vr.diffLineContext,meta:vr.diffLineMeta};function Ibt(e){return e===Fr.Light?"github-light-default":"github-dark-default"}async function Mbt(e,t,n){const{resolvedLang:s}=KL(She(t));let r=null;if(s!=="text")try{r=await Jse(s)}catch{r=null}const i=[];for(const o of e){const l=[],c=[];for(const y of o.lines){const v=y[0],x=y.slice(1);v==="+"?l.push(x):v==="-"?c.push(x):v===" "&&(l.push(x),c.push(x))}const u=l.join(`
`),d=c.join(`
`);let f=null,m=null;if(r){const y=s;if(!BI(u))try{f=r.codeToTokens(u,{lang:y,theme:n}).tokens}catch{f=null}if(!BI(d))try{m=r.codeToTokens(d,{lang:y,theme:n}).tokens}catch{m=null}}let p=0,g=0,b=o.oldStart,w=o.newStart;for(const y of o.lines){const v=y[0],x=y.slice(1);v==="+"?(i.push({type:"add",oldNo:null,newNo:w,text:x,tokens:(f==null?void 0:f[p])??null}),p++,w++):v==="-"?(i.push({type:"del",oldNo:b,newNo:null,text:x,tokens:(m==null?void 0:m[g])??null}),g++,b++):v===" "?(i.push({type:"context",oldNo:b,newNo:w,text:x,tokens:(f==null?void 0:f[p])??null}),p++,g++,b++,w++):i.push({type:"meta",oldNo:null,newNo:null,text:y,tokens:null})}}return i}function Rbt(e){return!e.tokens||e.tokens.length===0?e.text:e.tokens.map((t,n)=>a.jsx("span",{style:t.color?{color:t.color}:void 0,children:t.content},n))}function Dbt({hunks:e,path:t}){const{t:n}=nt(),s=im(),r=Ibt(s),[i,o]=h.useState(null),[l,c]=h.useState(!1);return h.useEffect(()=>{let u=!1;return o(null),c(!1),Mbt(e,t,r).then(d=>{u||o(d)}).catch(()=>{u||c(!0)}),()=>{u=!0}},[e,t,r]),l?a.jsx("div",{className:vr.filePlaceholder,children:n("gitDiff.fileError")}):i===null?a.jsx("div",{className:vr.filePlaceholder,children:n("gitDiff.loading")}):a.jsx("div",{className:vr.diffLines,children:(i??[]).map((u,d)=>a.jsxs("div",{className:`${vr.diffLine} ${Nbt[u.type]}`,children:[a.jsx("span",{className:vr.diffOldNo,children:u.oldNo??""}),a.jsx("span",{className:vr.diffNewNo,children:u.newNo??""}),a.jsx("span",{className:vr.diffMarker,children:u.type==="add"?"+":u.type==="del"?"-":u.type==="meta"?"":" "}),a.jsx("code",{className:vr.diffContent,children:Rbt(u)})]},d))})}function Lbt({workspaceCwd:e,gitCwd:t,file:n}){const{t:s}=nt(),{client:r}=Co(),[i,o]=h.useState(!1),[l,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 w=()=>{const v=!i;o(v),v&&l===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=I4(n.path);return a.jsxs("div",{className:vr.file,children:[a.jsxs("button",{type:"button",className:vr.fileHeader,onClick:w,"aria-expanded":i,"aria-label":s(i?"gitDiff.collapse":"gitDiff.expand",{path:n.oldPath?`${I4(n.oldPath)} → ${y}`:y}),children:[a.jsx("span",{className:vr.fileStats,children:n.isBinary?a.jsx("span",{className:vr.fileBinary,children:s("gitDiff.binary")}):a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:vr.statAdd,children:["+",n.added??0]}),a.jsxs("span",{className:vr.statDel,children:["-",n.removed??0]})]})}),a.jsxs("span",{className:vr.filePath,title:y,children:[n.oldPath?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:vr.fileOldPath,children:I4(n.oldPath)})," → "]}):null,y]}),n.isUntracked&&a.jsx("span",{className:vr.fileTag,children:s("gitDiff.untracked")}),n.isDeleted&&a.jsx("span",{className:vr.fileTag,children:s("gitDiff.deleted")})]}),i&&a.jsx("div",{className:vr.fileBody,children:n.isBinary?a.jsx("div",{className:vr.filePlaceholder,children:s("gitDiff.binary")}):f?a.jsx("div",{className:vr.filePlaceholder,children:s("gitDiff.loading")}):p?a.jsx("div",{className:vr.filePlaceholder,children:s("gitDiff.fileError")}):l&&l.length>0?a.jsxs(a.Fragment,{children:[a.jsx(Dbt,{hunks:l,path:n.path}),u&&a.jsx("div",{className:vr.filePlaceholder,role:"note",children:s("gitDiff.truncated")})]}):a.jsx("div",{className:vr.filePlaceholder,children:s("gitDiff.noDiff")})})]})}function Pbt({workspaceCwd:e,gitCwd:t,onSubtitleChange:n}){const{t:s}=nt(),{client:r}=Co(),[i,o]=h.useState(null),[l,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 l?m=a.jsx("div",{className:vr.placeholder,children:s("gitDiff.loading")}):u?m=a.jsx("div",{className:vr.placeholder,children:s("gitDiff.error")}):!i||!i.available?m=a.jsx("div",{className:vr.placeholder,children:s("gitDiff.unavailable")}):i.files.length===0?m=a.jsx("div",{className:vr.placeholder,children:s("gitDiff.empty")}):m=a.jsxs("div",{className:vr.fileList,children:[i.files.map(p=>a.jsx(Lbt,{workspaceCwd:e,gitCwd:t,file:p},`${e}:${t??""}:${p.path}`)),i.hiddenCount>0&&a.jsx("div",{className:vr.hiddenNote,children:s("gitDiff.hidden",{count:i.hiddenCount})})]}),a.jsx("div",{className:vr.content,children:m})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function pfe(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 l=Math.floor(o/24);if(l<7)return r.format(-l,"day");const c=Math.floor(l/7);if(c<5)return r.format(-c,"week");const u=Math.floor(l/30);return u<12?r.format(-u,"month"):r.format(-Math.max(1,Math.floor(l/365)),"year")}const Obt="_content_18nyy_1",$bt="_placeholder_18nyy_7",Bbt="_commitList_18nyy_13",zbt="_commitRow_18nyy_18",Fbt="_commitHeader_18nyy_22",qbt="_commitToggle_18nyy_32",Hbt="_commitSha_18nyy_47",Ubt="_copyBtn_18nyy_54",Wbt="_commitSubject_18nyy_78",Vbt="_commitMeta_18nyy_86",Gbt="_commitRefs_18nyy_93",Kbt="_refTag_18nyy_99",Ybt="_refHead_18nyy_109",Xbt="_mergeIcon_18nyy_114",Qbt="_commitDetail_18nyy_120",Jbt="_commitBody_18nyy_126",Zbt="_fileStats_18nyy_134",eyt="_fileStatHeader_18nyy_140",tyt="_fileStatRow_18nyy_146",nyt="_statNums_18nyy_154",syt="_statAdd_18nyy_162",ryt="_statDel_18nyy_166",iyt="_fileStatPath_18nyy_170",oyt="_fileBinary_18nyy_178",ayt="_hiddenNote_18nyy_182",lyt="_detailError_18nyy_188",cyt="_loadMore_18nyy_194",hr={content:Obt,placeholder:$bt,commitList:Bbt,commitRow:zbt,commitHeader:Fbt,commitToggle:qbt,commitSha:Hbt,copyBtn:Ubt,commitSubject:Wbt,commitMeta:Vbt,commitRefs:Gbt,refTag:Kbt,refHead:Ybt,mergeIcon:Xbt,commitDetail:Qbt,commitBody:Jbt,fileStats:Zbt,fileStatHeader:eyt,fileStatRow:tyt,statNums:nyt,statAdd:syt,statDel:ryt,fileStatPath:iyt,fileBinary:oyt,hiddenNote:ayt,detailError:lyt,loadMore:cyt},YK=50;function uyt(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 dyt({entry:e,workspaceCwd:t,gitCwd:n,now:s}){const{client:r}=Co(),{language:i,t:o}=nt(),[l,c]=h.useState(!1),[u,d]=h.useState(null),[f,m]=h.useState(!1),[p,g]=h.useState(!1),[b,w]=h.useState(!1),y=h.useRef(!1),v=()=>{navigator.clipboard.writeText(e.sha).then(()=>{w(!0),setTimeout(()=>w(!1),1500)}).catch(()=>{})};h.useEffect(()=>(y.current=!1,()=>{y.current=!0}),[]);const x=()=>{const S=!l;c(S),S&&u===null&&!f&&(m(!0),g(!1),r.workspaceByCwd(t).workspaceGitCommitDetail(e.sha,n).then(C=>{y.current||d(C)}).catch(()=>{y.current||g(!0)}).finally(()=>{y.current||m(!1)}))},k=uyt(e.refs??""),_=e.parents.length>1;let T;return l&&(f?T=a.jsx("div",{className:hr.commitDetail,children:a.jsx("span",{className:hr.fileBinary,children:o("gitLog.loading")})}):p?T=a.jsx("div",{className:hr.commitDetail,children:a.jsx("span",{className:hr.detailError,children:o("gitLog.detailError")})}):u&&u.available?T=a.jsxs("div",{className:hr.commitDetail,children:[u.body&&a.jsx("pre",{className:hr.commitBody,children:u.body}),u.files&&a.jsxs("div",{className:hr.fileStats,children:[a.jsx("div",{className:hr.fileStatHeader,children:o("gitLog.files",{count:u.filesCount??0,added:u.linesAdded??0,removed:u.linesRemoved??0})}),u.files.map(S=>a.jsxs("div",{className:hr.fileStatRow,children:[S.isBinary?a.jsx("span",{className:hr.fileBinary,children:"~"}):a.jsxs("span",{className:hr.statNums,children:[a.jsxs("span",{className:hr.statAdd,children:["+",S.added]}),a.jsxs("span",{className:hr.statDel,children:["−",S.removed]})]}),a.jsx("span",{className:hr.fileStatPath,children:S.path})]},S.path)),(u.hiddenCount??0)>0&&a.jsx("div",{className:hr.hiddenNote,children:o("gitLog.hidden",{count:u.hiddenCount??0})})]})]}):u&&!u.available&&(T=a.jsx("div",{className:hr.commitDetail,children:a.jsx("span",{className:hr.detailError,children:o("gitLog.detailError")})}))),a.jsxs("div",{className:hr.commitRow,children:[a.jsxs("div",{className:hr.commitHeader,children:[a.jsxs("button",{type:"button",className:hr.commitToggle,onClick:x,"aria-expanded":l,children:[_&&a.jsx("span",{className:hr.mergeIcon,children:"⎇"}),a.jsx("span",{className:hr.commitSha,title:e.sha,children:e.shortSha}),a.jsx("span",{className:hr.commitSubject,children:e.subject}),k.length>0&&a.jsx("span",{className:hr.commitRefs,children:k.map(S=>a.jsx("span",{className:`${hr.refTag}${S.isHead?` ${hr.refHead}`:""}`,children:S.label},S.label))}),a.jsxs("span",{className:hr.commitMeta,children:[e.authorName," · ",pfe(e.authorDate,s,i)]})]}),a.jsx("button",{type:"button",className:hr.copyBtn,onClick:v,"aria-label":o("gitLog.copySha",{sha:e.shortSha}),children:b?a.jsx(kh,{size:12}):a.jsx(iD,{size:12})})]}),T]})}function hyt({workspaceCwd:e,gitCwd:t,onSubtitleChange:n}){const{client:s}=Co(),{t:r}=nt(),[i,o]=h.useState(null),[l,c]=h.useState(!0),[u,d]=h.useState(!1),[f,m]=h.useState(!1),[p,g]=h.useState(!1),[b,w]=h.useState(Date.now()/1e3),y=h.useRef(0);h.useEffect(()=>{const _=setInterval(()=>w(Date.now()/1e3),6e4);return()=>clearInterval(_)},[]),h.useEffect(()=>{let _=!1;return c(!0),d(!1),g(!1),y.current=0,s.workspaceByCwd(e).workspaceGitLog(YK,0,t).then(T=>{_||(y.current=T.entries.length,o(T))}).catch(()=>{_||d(!0)}).finally(()=>{_||c(!1)}),()=>{_=!0}},[s,e,t]);const v=h.useCallback(()=>{!i||f||(m(!0),s.workspaceByCwd(e).workspaceGitLog(YK,y.current,t).then(_=>{y.current+=_.entries.length,o(T=>{if(!T)return _;const S=new Set(T.entries.map(C=>C.sha));return{...T,entries:[...T.entries,..._.entries.filter(C=>!S.has(C.sha))],hasMore:_.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 l?k=a.jsx("div",{className:hr.placeholder,children:r("gitLog.loading")}):u?k=a.jsx("div",{className:hr.placeholder,children:r("gitLog.error")}):!i||!i.available?k=a.jsx("div",{className:hr.placeholder,children:r("gitLog.unavailable")}):i.entries.length===0?k=a.jsx("div",{className:hr.placeholder,children:r("gitLog.empty")}):k=a.jsxs(a.Fragment,{children:[a.jsx("div",{className:hr.commitList,children:i.entries.map(_=>a.jsx(dyt,{entry:_,workspaceCwd:e,gitCwd:t,now:b},_.sha))}),p&&a.jsx("div",{className:hr.placeholder,children:r("gitLog.error")}),i.hasMore&&a.jsx("button",{type:"button",className:hr.loadMore,onClick:()=>{g(!1),v()},disabled:f,children:r(f?"gitLog.loadingMore":"gitLog.loadMore")})]}),a.jsx("div",{className:hr.content,children:k})}const fyt="_content_fozmc_1",myt="_placeholder_fozmc_7",pyt="_prList_fozmc_14",gyt="_prRow_fozmc_19",byt="_prLine_fozmc_43",yyt="_stateOpen_fozmc_50",vyt="_stateDraft_fozmc_55",wyt="_prTitle_fozmc_60",xyt="_badge_fozmc_68",kyt="_badgeApproved_fozmc_77",_yt="_badgeChanges_fozmc_82",Syt="_badgeReviewRequired_fozmc_87",Cyt="_checksPassing_fozmc_92",Tyt="_checksFailing_fozmc_98",Eyt="_checksPending_fozmc_104",Ayt="_prMeta_fozmc_110",ko={content:fyt,placeholder:myt,prList:pyt,prRow:gyt,prLine:byt,stateOpen:yyt,stateDraft:vyt,prTitle:wyt,badge:xyt,badgeApproved:kyt,badgeChanges:_yt,badgeReviewRequired:Syt,checksPassing:Cyt,checksFailing:Tyt,checksPending:Eyt,prMeta:Ayt};function jyt(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 Nyt({checks:e}){const{t}=nt();switch(e){case"passing":return a.jsx("span",{className:ko.checksPassing,title:t("githubPrs.checksPassing"),children:a.jsx(kh,{size:12})});case"failing":return a.jsx("span",{className:ko.checksFailing,title:t("githubPrs.checksFailing"),children:a.jsx(yv,{size:12})});case"pending":return a.jsx("span",{className:ko.checksPending,title:t("githubPrs.checksPending"),children:a.jsx(eke,{size:12})});default:return null}}function Iyt({pr:e,now:t}){const{t:n,language:s}=nt(),r=e.state==="draft"?qke:Uke,i=e.reviewDecision==="approved"?a.jsx("span",{className:`${ko.badge} ${ko.badgeApproved}`,children:n("githubPrs.reviewApproved")}):e.reviewDecision==="changes_requested"?a.jsx("span",{className:`${ko.badge} ${ko.badgeChanges}`,children:n("githubPrs.reviewChanges")}):e.reviewDecision==="review_required"?a.jsx("span",{className:`${ko.badge} ${ko.badgeReviewRequired}`,children:n("githubPrs.reviewRequired")}):null;return a.jsxs("button",{type:"button",className:ko.prRow,"aria-label":n("githubPrs.open",{number:e.number}),onClick:()=>{e.url&&window.open(e.url,"_blank","noopener,noreferrer")},children:[a.jsxs("span",{className:ko.prLine,children:[a.jsx(r,{size:12,className:e.state==="draft"?ko.stateDraft:ko.stateOpen}),a.jsx("span",{className:ko.prTitle,children:e.title}),i,a.jsx(Nyt,{checks:e.checks})]}),a.jsxs("span",{className:ko.prMeta,children:["#",e.number," · ",e.headRefName,e.author?` · ${e.author}`:""," ·"," ",pfe(e.updatedAt,t,s)]})]})}function Myt({workspaceCwd:e,onSubtitleChange:t}){const{client:n}=Co(),{t:s}=nt(),[r,i]=h.useState(null),[o,l]=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 l(!0),u(null),n.workspaceByCwd(e).workspaceGitHubPullRequests().then(b=>{g||i(b)}).catch(b=>{g||u(jyt(b)??"unknown")}).finally(()=>{g||l(!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=a.jsx("div",{className:ko.placeholder,children:s("githubPrs.loading")}):c==="github_cli_unavailable"?p=a.jsx("div",{className:ko.placeholder,children:s("githubPrs.cliUnavailable")}):c!==null?p=a.jsx("div",{className:ko.placeholder,children:s("githubPrs.error")}):!r||!r.available?p=a.jsx("div",{className:ko.placeholder,children:s("githubPrs.unavailable")}):r.pullRequests.length===0?p=a.jsx("div",{className:ko.placeholder,children:s("githubPrs.empty")}):p=a.jsx("div",{className:ko.prList,children:r.pullRequests.map(g=>a.jsx(Iyt,{pr:g,now:d},g.number))}),a.jsx("div",{className:ko.content,children:p})}const Ryt="_content_a537a_1",Dyt="_tabBar_a537a_7",Lyt="_tab_a537a_7",Pyt="_tabActive_a537a_27",Oyt="_tabPanel_a537a_36",$yt="_commitPanel_a537a_44",Byt="_commitMessage_a537a_53",zyt="_commitStatus_a537a_79",Fyt="_commitStatusError_a537a_84",qyt="_commitStatusSuccess_a537a_88",Hyt="_commitActions_a537a_92",Uyt="_commitBtn_a537a_98",Wyt="_commitBtnPrimary_a537a_116",Vyt="_commitBtnSecondary_a537a_125",Gyt="_spin_a537a_135",Kyt="_prForm_a537a_149",Yyt="_prInput_a537a_158",Xyt="_prBody_a537a_177",Qyt="_prBodyWrap_a537a_202",Jyt="_prBodyToolbar_a537a_207",Zyt="_prBodyTab_a537a_216",evt="_prBodyTabActive_a537a_232",tvt="_prBodyPreview_a537a_242",nvt="_prBodyEmpty_a537a_254",svt="_prFormRow_a537a_259",rvt="_branchSelectTrigger_a537a_271",ivt="_branchSelectValue_a537a_290",ovt="_branchSelectPopover_a537a_298",avt="_branchSelectSearch_a537a_307",lvt="_branchSelectInput_a537a_316",cvt="_branchSelectList_a537a_329",uvt="_branchSelectGroup_a537a_335",dvt="_branchSelectItem_a537a_344",hvt="_branchSelectItemActive_a537a_363",fvt="_branchSelectEmpty_a537a_368",mvt="_branchSelectRetry_a537a_375",ss={content:Ryt,tabBar:Dyt,tab:Lyt,tabActive:Pyt,tabPanel:Oyt,commitPanel:$yt,commitMessage:Byt,commitStatus:zyt,commitStatusError:Fyt,commitStatusSuccess:qyt,commitActions:Hyt,commitBtn:Uyt,commitBtnPrimary:Wyt,commitBtnSecondary:Vyt,spin:Gyt,prForm:Kyt,prInput:Yyt,prBody:Xyt,prBodyWrap:Qyt,prBodyToolbar:Jyt,prBodyTab:Zyt,prBodyTabActive:evt,prBodyPreview:tvt,prBodyEmpty:nvt,prFormRow:svt,branchSelectTrigger:rvt,branchSelectValue:ivt,branchSelectPopover:ovt,branchSelectSearch:avt,branchSelectInput:lvt,branchSelectList:cvt,branchSelectGroup:uvt,branchSelectItem:dvt,branchSelectItemActive:hvt,branchSelectEmpty:fvt,branchSelectRetry:mvt},pvt="workspace_github_prs",XK={diff:"gitDiff.title",log:"gitLog.title",prs:"githubPrs.title",commit:"gitCommit.title"},QK=["diff","log","prs"],TC=3500;function gvt({workspaceCwd:e,gitCwd:t,initialView:n,sessionId:s,resolveSessionForWorkspace:r,onClose:i}){var St;const{t:o}=nt(),{client:l,capabilities:c}=Co(),u=((St=c==null?void 0:c.features)==null?void 0:St.includes(pvt))===!0,d=u?QK:QK.filter(he=>he!=="prs"),[f,m]=h.useState(n),[p,g]=h.useState(),[b,w]=h.useState(""),[y,v]=h.useState(null),[x,k]=h.useState(!1),[_,T]=h.useState(!1),[S,C]=h.useState(!1),[N,E]=h.useState(""),[O,B]=h.useState(""),[D,j]=h.useState(""),[L,z]=h.useState(!1),[I,$]=h.useState(!1),[K,R]=h.useState(!1),[Y,W]=h.useState(null),[M,F]=h.useState(!1),J=h.useRef(null),[V,U]=h.useState(null),[le,pe]=h.useState(null),fe=h.useRef(null),Q=h.useRef(r);Q.current=r;const ne=h.useRef(s);ne.current=s;const de=h.useCallback(async(he,Ae,rt)=>{try{return await l.btwSession(he,Ae,{signal:rt})}catch(dt){const jt=dt instanceof Error?dt.message:String(dt);if(/no session/i.test(jt)&&Q.current){const et=await Q.current(t??e,!0);if(et&&et!==he&&!rt.aborted)return ne.current=et,l.btwSession(et,Ae,{signal:rt})}throw dt}},[l,e,t]),ue=h.useRef(de);ue.current=de;const me=h.useRef(n==="commit").current,te=f==="commit",ae=te?"diff":f;h.useEffect(()=>{if(!te)return;const he=new AbortController;return k(!0),T(!1),w(""),(Q.current?Q.current(t??e):ne.current?Promise.resolve(ne.current):Promise.resolve(void 0)).then(rt=>{if(he.signal.aborted)return;if(!rt){T(!0),k(!1);return}return l.workspaceByCwd(e).workspaceGitDiff(t).then(jt=>{if(he.signal.aborted)return;if(jt.files.length===0){k(!1);return}const et=jt.files.map(Ye=>{const $n=Ye.isUntracked?"new":Ye.isDeleted?"deleted":"modified",Te=Ye.isBinary?" (binary)":` (+${Ye.added??0} -${Ye.removed??0})`,ie=Ye.oldPath?` (renamed from ${Ye.oldPath})`:"";return`${$n}: ${Ye.path}${Te}${ie}`});let Mt=et.join(`
`);if(Mt.length>TC){let Ye="",$n=0;for(const Te of et){if(Ye.length+Te.length+1>TC)break;Ye+=(Ye?`
`:"")+Te,$n++}Mt=Ye+`
(…and ${et.length-$n} more files)`}const sn=`Generate a concise git commit message for these changes. Reply with ONLY the commit message text, no quotes, no explanation.

${Mt}`;return ue.current(rt,sn,he.signal).then(Ye=>{he.signal.aborted||Ye.answer&&w(Ye.answer.trim())})})}).catch(()=>{he.signal.aborted||T(!0)}).finally(()=>{he.signal.aborted||k(!1)}),()=>{he.abort()}},[te,l,e,t]);const be=d.includes(ae)?ae:"diff",se=h.useCallback(he=>{g(void 0),m(he)},[]),ve=he=>{var Ae;se(he),(Ae=document.getElementById(`git-dialog-tab-${he}`))==null||Ae.focus()},ze=he=>{if(te){he.key==="ArrowLeft"?(he.preventDefault(),ve(d[d.length-1])):he.key==="ArrowRight"||he.key==="Home"?(he.preventDefault(),ve(d[0])):he.key==="End"&&he.preventDefault();return}const Ae=d.indexOf(be);if(he.key==="ArrowLeft"||he.key==="ArrowRight"){he.preventDefault();const rt=he.key==="ArrowRight"?1:-1;ve(d[(Ae+rt+d.length)%d.length]);return}if(he.key==="Home"){he.preventDefault(),ve(d[0]);return}he.key==="End"&&(he.preventDefault(),ve(d[d.length-1]))},Pe=h.useCallback(async he=>{if(!(y||L||!b.trim())){v(he?"push":"commit"),pe(null);try{const Ae=l.workspaceByCwd(e),rt=await Ae.workspaceGitCommit(b.trim(),{all:!0},t);if(he)try{await Ae.workspaceGitPush({setUpstream:!0},t),w(""),pe({msg:o("gitCommit.commitPushSuccess",{sha:rt.sha}),type:"success"})}catch(dt){pe({msg:o("gitCommit.commitSuccessPushFailed",{sha:rt.sha,error:dt instanceof Error?dt.message:String(dt)}),type:"error"})}else w(""),pe({msg:o("gitCommit.commitSuccess",{sha:rt.sha}),type:"success"})}catch(Ae){pe({msg:Ae instanceof Error?Ae.message:String(Ae),type:"error"})}finally{v(null)}}},[l,e,t,b,y,L,o]),_t=h.useCallback(()=>{const he=l.workspaceByCwd(e);F(!1),he.workspaceGitBranches(t).then(Ae=>{const rt=Ae.local.map(et=>et.name),dt=new Map;for(const et of Ae.remote){const Mt=et.name.indexOf("/"),sn=Mt>0?et.name.slice(0,Mt):"other";let Ye=dt.get(sn);Ye||(Ye=[],dt.set(sn,Ye)),Ye.push(et.name)}W({local:rt,remotes:Array.from(dt.entries())});const jt=Ae.local.find(et=>et.isHead);J.current=jt?{hasUpstream:!!jt.upstream}:null}).catch(()=>{W(null),F(!0),J.current=null})},[l,e,t]);h.useEffect(()=>{if(!S||!te)return;const he=l.workspaceByCwd(e);_t(),U(null),$(!0);const Ae=new AbortController,rt=he.workspaceGitHubDefaultBranch().then(jt=>jt.branch).catch(()=>"origin/main"),dt=Q.current?Q.current(t??e):ne.current?Promise.resolve(ne.current):Promise.resolve(void 0);return Promise.all([rt,dt]).then(([jt,et])=>{if(!Ae.signal.aborted){if(j(jt),!et){he.workspaceGit().then(Mt=>{!Ae.signal.aborted&&Mt.branch&&!Mt.detached&&E(Mt.branch)}).catch(()=>{}).finally(()=>{Ae.signal.aborted||$(!1)});return}return Promise.all([he.workspaceGitLog(50,0,t,`${jt}..HEAD`),he.workspaceGitDiff(t)]).then(([Mt,sn])=>{if(Ae.signal.aborted)return;if(!Mt.available){U({msg:o("gitCommit.prLogUnavailable"),type:"error"});return}const Ye=Mt.entries.length>0?Mt.entries.map(it=>`- ${it.shortSha} ${it.subject}`).join(`
`):"(no commits ahead of base)",$n=sn.files.map(it=>`${it.isUntracked?"new":it.isDeleted?"deleted":"modified"}: ${it.path}`);let Te=$n.join(`
`);if(Te.length>TC){let it="",we=0;for(const We of $n){if(it.length+We.length+1>TC)break;it+=(it?`
`:"")+We,we++}Te=it+`
(…and ${$n.length-we} more files)`}const ie=`Generate a GitHub pull request title and body for the changes on this branch compared to ${jt}. Use the commit history and conversation context to understand what was done and why.

Commits on this branch (not in ${jt}):
${Ye}

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

`:""}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 ue.current(et,ie,Ae.signal).then(it=>{if(!Ae.signal.aborted)if(it.answer){const we=it.answer.trim().split(`
`);E(we[0]??""),B(we.slice(1).join(`
`).trim())}else console.warn("[GitDialog] btwSession returned null answer")})})}}).catch(jt=>{Ae.signal.aborted||(console.error("[GitDialog] PR generation failed:",jt),U({msg:jt instanceof Error?jt.message:String(jt),type:"error"}),he.workspaceGit().then(et=>{!Ae.signal.aborted&&et.branch&&!et.detached&&E(et.branch)}).catch(()=>{}))}).finally(()=>{Ae.signal.aborted||$(!1)}),()=>Ae.abort()},[S,te,l,e,t,o,_t]);const Pt=h.useCallback(async()=>{if(!(!N.trim()||I||L)){if(z(!0),U(null),J.current&&!J.current.hasUpstream){U({msg:o("gitCommit.prPushFirst"),type:"error"}),z(!1);return}try{const he=l.workspaceByCwd(e),Ae=D.trim(),rt=((Y==null?void 0:Y.remotes)??[]).map(([et])=>et).sort((et,Mt)=>Mt.length-et.length).find(et=>Ae.startsWith(`${et}/`)),dt=rt?Ae.slice(rt.length+1):Ae,jt=await he.workspaceGitHubCreatePullRequest({title:N.trim(),body:O.trim()||void 0,base:dt||void 0},t);U({msg:o("gitCommit.prCreated",{number:jt.number??""}),type:"success",url:jt.url}),C(!1)}catch(he){U({msg:he instanceof Error?he.message:String(he),type:"error"})}finally{z(!1)}}},[l,e,t,N,O,D,Y,I,L,o]);return a.jsx(Fi,{title:o(XK[te?"commit":be]),subtitle:p,size:"xl",allowFullscreen:!0,onClose:i,children:a.jsxs("div",{className:ss.content,children:[a.jsxs("div",{className:ss.tabBar,role:"tablist",children:[d.map(he=>a.jsx("button",{id:`git-dialog-tab-${he}`,type:"button",role:"tab","aria-selected":be===he&&!te,"aria-controls":"git-dialog-panel",tabIndex:be===he&&!te?0:-1,className:`${ss.tab}${be===he&&!te?` ${ss.tabActive}`:""}`,onClick:()=>se(he),onKeyDown:ze,children:o(XK[he])},he)),me&&a.jsx("button",{id:"git-dialog-tab-commit",type:"button",role:"tab","aria-selected":te,"aria-controls":"git-dialog-panel",tabIndex:te?0:-1,className:`${ss.tab}${te?` ${ss.tabActive}`:""}`,onKeyDown:ze,onClick:()=>se("commit"),children:o("gitCommit.title")})]}),a.jsx("div",{id:"git-dialog-panel",className:ss.tabPanel,role:"tabpanel","aria-labelledby":`git-dialog-tab-${te?"commit":be}`,children:be==="diff"||te?a.jsx(Pbt,{workspaceCwd:e,gitCwd:t,onSubtitleChange:g}):be==="log"?a.jsx(hyt,{workspaceCwd:e,gitCwd:t,onSubtitleChange:g}):a.jsx(Myt,{workspaceCwd:e,onSubtitleChange:g})}),te&&a.jsxs("div",{className:ss.commitPanel,children:[a.jsx("textarea",{ref:fe,className:ss.commitMessage,placeholder:o(x?"gitCommit.generating":_?"gitCommit.genFailed":"gitCommit.messagePlaceholder"),value:b,disabled:x,onChange:he=>w(he.target.value),onKeyDown:he=>{he.key==="Enter"&&(he.metaKey||he.ctrlKey)&&(he.preventDefault(),Pe(!1))}}),le&&a.jsx("div",{className:`${ss.commitStatus} ${le.type==="error"?ss.commitStatusError:ss.commitStatusSuccess}`,children:le.msg}),a.jsxs("div",{className:ss.commitActions,children:[a.jsxs("button",{type:"button",className:`${ss.commitBtn} ${ss.commitBtnPrimary}`,disabled:!b.trim()||!!y||L,onClick:()=>void Pe(!1),children:[y==="commit"&&a.jsx(Rg,{size:14,className:ss.spin}),o("gitCommit.commit")]}),a.jsxs("button",{type:"button",className:`${ss.commitBtn} ${ss.commitBtnSecondary}`,disabled:!b.trim()||!!y||L,onClick:()=>void Pe(!0),children:[y==="push"&&a.jsx(Rg,{size:14,className:ss.spin}),o("gitCommit.commitAndPush")]}),u&&a.jsx("button",{type:"button",className:`${ss.commitBtn} ${ss.commitBtnSecondary}`,disabled:!!y||L,onClick:()=>C(!S),children:o("gitCommit.createPr")})]}),S&&a.jsxs("div",{className:ss.prForm,children:[a.jsx("input",{className:ss.prInput,placeholder:o(I?"gitCommit.generating":"gitCommit.prTitlePlaceholder"),value:N,disabled:I,onChange:he=>E(he.target.value)}),a.jsxs("div",{className:ss.prBodyWrap,children:[a.jsxs("div",{className:ss.prBodyToolbar,children:[a.jsxs("button",{type:"button",className:`${ss.prBodyTab} ${K?"":ss.prBodyTabActive}`,onClick:()=>R(!1),children:[a.jsx(Ny,{size:12}),o("gitCommit.prEdit")]}),a.jsxs("button",{type:"button",className:`${ss.prBodyTab} ${K?ss.prBodyTabActive:""}`,onClick:()=>R(!0),children:[a.jsx(hke,{size:12}),o("gitCommit.prPreview")]})]}),K?a.jsx("div",{className:ss.prBodyPreview,children:O?a.jsx(Jf,{content:O}):a.jsx("span",{className:ss.prBodyEmpty,children:o("gitCommit.prBodyPlaceholder")})}):a.jsx("textarea",{className:ss.prBody,placeholder:o(I?"gitCommit.generating":"gitCommit.prBodyPlaceholder"),value:O,disabled:I,onChange:he=>B(he.target.value)})]}),a.jsxs("div",{className:ss.prFormRow,children:[a.jsx(bvt,{value:D,onChange:j,branches:Y,error:M,onRetry:_t}),a.jsxs("button",{type:"button",className:`${ss.commitBtn} ${ss.commitBtnPrimary}`,disabled:!N.trim()||L||I||!!y,onClick:()=>void Pt(),children:[L&&a.jsx(Rg,{size:14,className:ss.spin}),o("gitCommit.prSubmit")]})]})]}),V&&a.jsx("div",{className:`${ss.commitStatus} ${V.type==="error"?ss.commitStatusError:ss.commitStatusSuccess}`,children:V.url?a.jsx("a",{href:V.url,target:"_blank",rel:"noopener noreferrer",children:V.msg}):V.msg})]})]})})}function bvt({value:e,onChange:t,branches:n,error:s=!1,onRetry:r}){const{t:i}=nt(),[o,l]=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(w=>!f||w.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 a.jsxs(Yf,{open:o,onOpenChange:g=>{l(g),g?setTimeout(()=>{var b;return(b=d.current)==null?void 0:b.focus()},50):u("")},children:[a.jsx(Gp,{asChild:!0,children:a.jsxs("button",{type:"button",className:ss.branchSelectTrigger,"aria-label":i("branchSelect.baseBranch"),children:[a.jsx("span",{className:ss.branchSelectValue,children:e?e.includes("/")?e.slice(e.indexOf("/")+1):e:"main"}),a.jsx(Pc,{size:12})]})}),a.jsxs(Xf,{className:ss.branchSelectPopover,side:"bottom",align:"start",sideOffset:4,children:[a.jsxs("div",{className:ss.branchSelectSearch,children:[a.jsx(eu,{size:13}),a.jsx("input",{ref:d,className:ss.branchSelectInput,placeholder:i("branchSelect.search"),"aria-label":i("branchSelect.search"),value:c,onChange:g=>u(g.target.value)})]}),a.jsxs("div",{className:ss.branchSelectList,children:[m.map(([g,b])=>a.jsxs("div",{children:[a.jsx("div",{className:ss.branchSelectGroup,children:g}),b.map(w=>a.jsx("button",{type:"button",className:`${ss.branchSelectItem} ${w===e?ss.branchSelectItemActive:""}`,onClick:()=>{t(w),l(!1)},children:w.includes("/")?w.slice(w.indexOf("/")+1):w},w))]},g)),p.length>0&&a.jsxs("div",{children:[a.jsx("div",{className:ss.branchSelectGroup,children:i("branchSelect.local")}),p.map(g=>a.jsx("button",{type:"button",className:`${ss.branchSelectItem} ${g===e?ss.branchSelectItemActive:""}`,onClick:()=>{t(g),l(!1)},children:g},g))]}),!n&&(s?a.jsxs("div",{className:ss.branchSelectEmpty,children:[i("branchSelect.error"),r&&a.jsx("button",{type:"button",className:ss.branchSelectRetry,onClick:r,children:i("branchSelect.retry")})]}):a.jsx("div",{className:ss.branchSelectEmpty,children:i("branchSelect.loading")})),n&&m.length===0&&p.length===0&&a.jsx("div",{className:ss.branchSelectEmpty,children:i("branchSelect.noMatches")})]})]})]})}function yvt(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 vvt(e,t){return e&&t.some(n=>n.name===e)?e:null}const wvt=6*1024*1024;function xvt(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"):no(e)||t("skills.install.failed")}async function kvt(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 _vt({open:e,onOpenChange:t,onInstall:n}){const{t:s}=nt(),[r,i]=h.useState(""),[o,l]=h.useState("workspace"),[c,u]=h.useState("github"),[d,f]=h.useState(""),[m,p]=h.useState(""),[g,b]=h.useState(null),[w,y]=h.useState(!1),[v,x]=h.useState(null);function k(){i(""),l("workspace"),u("github"),f(""),p(""),b(null),x(null)}async function _(){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>wvt)throw new Error(s("skills.install.error.zipTooLarge"));T={type:"zip",contentBase64:await kvt(g)}}await n({name:r.trim(),scope:o,source:T}),t(!1),k()}catch(T){x(xvt(T,s))}finally{y(!1)}}return a.jsx(qp,{open:e,onOpenChange:T=>{w||(t(T),T||k())},children:a.jsxs(Hp,{className:"sm:max-w-lg",showCloseButton:!1,onPointerDownOutside:T=>T.preventDefault(),children:[a.jsxs(Up,{children:[a.jsx(Vp,{children:s("skills.install.title")}),a.jsx(Yg,{children:s("skills.install.description")})]}),a.jsxs("div",{className:"grid gap-4",children:[v?a.jsxs(lo,{variant:"destructive",children:[a.jsx(La,{}),a.jsx(co,{children:v})]}):null,a.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.name"),a.jsx(Ur,{value:r,onChange:T=>i(T.target.value),placeholder:"my-skill",disabled:w})]}),a.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.scope"),a.jsxs(vl,{value:o,onValueChange:T=>l(T),disabled:w,children:[a.jsx(xl,{className:"w-full",children:a.jsx(wl,{})}),a.jsxs(kl,{children:[a.jsx(Ai,{value:"workspace",children:s("skills.install.scope.workspace")}),a.jsx(Ai,{value:"global",children:s("skills.install.scope.global")})]})]})]}),a.jsxs(_1,{value:c,onValueChange:T=>u(T),children:[a.jsxs(S1,{className:"grid w-full grid-cols-3",children:[a.jsx(ci,{value:"github",disabled:w,children:"GitHub"}),a.jsx(ci,{value:"folder",disabled:w,children:s("skills.install.folder")}),a.jsx(ci,{value:"zip",disabled:w,children:"ZIP"})]}),a.jsx(qi,{value:"github",className:"pt-3",children:a.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.githubUrl"),a.jsx(Ur,{type:"url",value:d,onChange:T=>f(T.target.value),placeholder:"https://github.com/owner/repo/blob/main/skill/SKILL.md",disabled:w})]})}),a.jsx(qi,{value:"folder",className:"pt-3",children:a.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("skills.install.folderPath"),a.jsx(Ur,{value:m,onChange:T=>p(T.target.value),placeholder:"/absolute/path/to/my-skill",disabled:w})]})}),a.jsx(qi,{value:"zip",className:"pt-3",children:a.jsxs("div",{className:"grid gap-2",children:[a.jsx(Ur,{type:"file",accept:".zip,application/zip",onChange:T=>{var C;const S=((C=T.target.files)==null?void 0:C[0])??null;b(S),S&&i(N=>N||S.name.replace(/\.zip$/i,""))},disabled:w}),g?a.jsx("div",{className:"text-xs text-muted-foreground",children:s("skills.install.zipSelected",{name:g.name})}):null]})})]})]}),a.jsxs(Wp,{children:[a.jsx(Kt,{variant:"outline",onClick:()=>{t(!1),k()},disabled:w,children:s("common.cancel")}),a.jsxs(Kt,{onClick:()=>void _(),disabled:w,children:[w?a.jsx(Ws,{"data-icon":"inline-start"}):a.jsx(iSe,{"data-icon":"inline-start"}),s("skills.install.action")]})]})]})})}const Svt="_skillGrid_1hucr_1",Cvt={skillGrid:Svt};function JK(e,t){return t(`skills.level.${e.level}`)}function ZK(e,t){return t(e.status==="disabled"?"skills.status.disabled":"skills.status.enabled")}function eY(e){return e.status==="disabled"?"":"bg-[var(--success-bg)] text-[var(--success-color)]"}function Tvt(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 ab({label:e,value:t}){return a.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[a.jsx("div",{className:"text-sm font-medium",children:e}),a.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function tY({compact:e=!1}){const{t}=nt();return a.jsx(Td,{delayDuration:300,children:a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsx(Ni,{variant:"secondary",className:e?"text-[10px]":void 0,children:t("skills.manualReference")})}),a.jsx(Uu,{children:t("skills.manualReferenceHint")})]})})}function gfe({onClose:e,onUseSkill:t,embedded:n}){var Q,ne,de,ue;const{t:s}=nt(),r=Co(),{status:i,skills:o,loading:l,error:c,reload:u,setEnabled:d,install:f,remove:m}=Kwe({autoLoad:!0}),p=((Q=r.capabilities)==null?void 0:Q.features.includes("workspace_skill_toggle"))===!0,g=((ne=r.capabilities)==null?void 0:ne.features.includes("workspace_skill_manage"))===!0,[b,w]=h.useState(""),[y,v]=h.useState("all"),[x,k]=h.useState("enabled"),[_,T]=h.useState({}),[S,C]=h.useState(null),[N,E]=h.useState(null),[O,B]=h.useState(!1),[D,j]=h.useState(!1),[L,z]=h.useState(null),[I,$]=h.useState(null),K=h.useMemo(()=>o.map(me=>({...me,status:_[me.name]??me.status})),[o,_]),R=h.useMemo(()=>K.find(me=>me.name===S),[K,S]),Y=h.useMemo(()=>yvt(K,b,y,x),[K,y,b,x]),W=K.filter(me=>me.status==="disabled").length,M=(c==null?void 0:c.message)??((ue=(de=i==null?void 0:i.errors)==null?void 0:de[0])==null?void 0:ue.error),F=[{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(()=>{C(me=>vvt(me,K))},[K]),h.useEffect(()=>{T(me=>{const te={...me};let ae=!1;for(const be of o)te[be.name]===be.status&&(delete te[be.name],ae=!0);return ae?te:me})},[o]),h.useEffect(()=>{n==null||n.onDetailChange(!!R)},[n,R]);async function J(me){const te=me.status==="disabled";E(me.name),$(null);try{await d(me.name,te),T(ae=>({...ae,[me.name]:te?"ok":"disabled"})),await u(),$({skillName:me.name,text:s(te?"skills.enabled":"skills.disabled"),error:!1})}catch(ae){$({skillName:me.name,text:Tvt(ae,s),error:!0})}finally{E(null)}}async function V(me){z(null),await f(me),z(s("skills.install.succeeded",{name:me.name.trim()})),await u().catch(()=>{})}async function U(){if(!R)return;const me=R.level==="project"?"workspace":"global";E(R.name);try{await m(R.name,me),j(!1),C(null),z(s("skills.delete.succeeded",{name:R.name})),await u().catch(()=>{})}catch(te){j(!1),$({skillName:R.name,text:te instanceof Error?te.message:s("skills.delete.failed"),error:!0})}finally{E(null)}}function le(){C(null),u()}const pe=a.jsx(s0,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(r0,{className:"text-base",children:[a.jsx(oo,{children:a.jsx(Kt,{variant:"ghost",size:"icon",onClick:e,"aria-label":s("common.back"),children:a.jsx(T_,{})})}),a.jsx(oo,{children:R?a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",onClick:le,children:s("skills.title")})}):a.jsx(Bl,{children:s("skills.title")})}),R?a.jsx(yh,{}):null,R?a.jsx(oo,{children:a.jsx(Bl,{children:R.name})}):null]})}),fe=n?R?a.jsx(s0,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(r0,{className:"h-8 text-sm",children:[a.jsx(oo,{children:a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>{le(),n.onDetailChange(!1)},children:s("skills.title")})})}),a.jsx(yh,{}),a.jsx(oo,{children:a.jsx(Bl,{children:R.name})})]})}):null:pe;if(R){const me=`/${R.name}${R.argumentHint?` ${R.argumentHint}`:""}`;return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[fe,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:a.jsx(iy,{})}),a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("h1",{className:"break-words text-xl font-semibold text-balance",children:R.name}),a.jsx(Ni,{variant:"outline",children:JK(R,s)}),a.jsx(Ni,{variant:"secondary",className:eY(R),children:ZK(R,s)}),R.modelInvocable?null:a.jsx(tY,{})]})}),a.jsxs(Kt,{disabled:R.status==="disabled",onClick:()=>t(R.name),children:[a.jsx(T_e,{"data-icon":"inline-start"}),s("skills.run")]}),a.jsxs(Mu,{children:[a.jsx(Ru,{asChild:!0,children:a.jsx(Kt,{variant:"ghost",size:"icon",disabled:N!==null,"aria-label":s("skills.actions"),"data-testid":"skill-actions",children:N===R.name?a.jsx(Ws,{}):a.jsx(sp,{})})}),a.jsx(Du,{align:"end",onCloseAutoFocus:te=>te.preventDefault(),children:a.jsxs(Tp,{children:[a.jsx(bi,{disabled:N!==null||!p||R.userInvocable===!1,title:p?R.userInvocable===!1?s("skills.notToggleable"):void 0:s("skills.toggleUnsupported"),onSelect:()=>void J(R),children:s(R.status==="disabled"?"skills.enable":"skills.disable")}),g&&(R.level==="project"||R.level==="user")?a.jsx(bi,{variant:"destructive",disabled:N!==null,onSelect:()=>j(!0),children:s("skills.delete.action")}):null]})})]})]}),(I==null?void 0:I.skillName)===R.name?a.jsx(mc,{tone:I.error?"error":"success",noticeKey:I.text,closeLabel:s("common.close"),onDismiss:()=>$(null),children:I.text}):null,M||R.error?a.jsxs(lo,{variant:"destructive",children:[a.jsx(La,{}),a.jsx(co,{children:R.error||M})]}):null,a.jsxs(Wo,{children:[a.jsxs(Hl,{children:[a.jsx(Ul,{className:"text-sm",children:s("skills.details")}),a.jsx(Lu,{children:R.description||s("skills.noDescription")})]}),a.jsxs(dc,{className:"grid gap-6 sm:grid-cols-2",children:[a.jsx(ab,{label:s("skills.invocation"),value:me}),a.jsx(ab,{label:s("skills.level"),value:JK(R,s)}),a.jsx(ab,{label:s("skills.modelAccess"),value:R.modelInvocable?s("skills.modelAccess.enabled"):s("skills.modelAccess.disabled")}),a.jsx(ab,{label:s("skills.model"),value:R.model||"-"}),a.jsx(ab,{label:s("skills.extension"),value:R.extensionName||"-"}),R.hint?a.jsx("div",{className:"sm:col-span-2",children:a.jsx(ab,{label:s("skills.hint"),value:R.hint})}):null]})]}),a.jsx(ev,{open:D,onOpenChange:te=>{!te&&N!==null||j(te)},children:a.jsxs(tv,{children:[a.jsxs(nv,{children:[a.jsx(rv,{children:s("skills.delete.title")}),a.jsx(iv,{children:s("skills.delete.description",{name:R.name})})]}),a.jsxs(sv,{children:[a.jsx(ov,{disabled:N!==null,children:s("common.cancel")}),a.jsxs(tE,{variant:"destructive",disabled:N!==null,onClick:te=>{te.preventDefault(),U()},children:[N?a.jsx(Ws,{"data-icon":"inline-start"}):null,s("skills.delete.action")]})]})]})})]})]})}return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[fe,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-semibold text-balance",children:s("skills.title")}),a.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})})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Kt,{variant:"outline",disabled:l,onClick:()=>void u(),children:[l?a.jsx(Ws,{"data-icon":"inline-start"}):a.jsx(Ug,{"data-icon":"inline-start"}),s("common.refresh")]}),g?a.jsxs(Kt,{onClick:()=>B(!0),children:[a.jsx(Vf,{"data-icon":"inline-start"}),s("skills.install.action")]}):null]})]}),M?a.jsxs(lo,{variant:"destructive",children:[a.jsx(La,{}),a.jsx(co,{children:M})]}):null,L?a.jsx(mc,{tone:"success",noticeKey:L,closeLabel:s("common.close"),onDismiss:()=>z(null),children:L}):null,a.jsxs("div",{className:"relative",children:[a.jsx(eu,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Ur,{name:"skill-search","aria-label":s("skills.search"),autoComplete:"off",value:b,onChange:me=>w(me.target.value),placeholder:s("skills.search"),className:"pl-9"})]}),a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsx(hO,{type:"single",value:y,onValueChange:me=>{me&&v(me)},variant:"outline",size:"sm","aria-label":s("skills.filter.label"),children:F.map(me=>a.jsx(fO,{value:me.value,children:me.label},me.value))}),a.jsxs(vl,{value:x,onValueChange:me=>k(me),children:[a.jsx(xl,{className:"w-32","aria-label":s("skills.filter.status.label"),children:a.jsx(wl,{})}),a.jsxs(kl,{children:[a.jsx(Ai,{value:"all",children:s("skills.filter.status.all")}),a.jsx(Ai,{value:"enabled",children:s("skills.filter.status.enabled")}),a.jsx(Ai,{value:"disabled",children:s("skills.filter.status.disabled")})]})]})]}),Y.length?a.jsx("div",{className:Cvt.skillGrid,"data-column-count":Math.min(Y.length,4),children:Y.map(me=>a.jsx(Wo,{size:"sm",role:"button",tabIndex:0,"aria-label":me.name,className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>C(me.name),onKeyDown:te=>{(te.key==="Enter"||te.key===" ")&&(te.preventDefault(),C(me.name))},children:a.jsx(Hl,{className:"block",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:a.jsx(iy,{className:"size-5"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[a.jsx(Ul,{className:"min-w-0 flex-1 truncate",children:me.name}),a.jsxs("div",{className:"flex shrink-0 gap-1",children:[a.jsx(Ni,{variant:"secondary",className:`${eY(me)} text-[10px]`,children:ZK(me,s)}),me.modelInvocable?null:a.jsx(tY,{compact:!0})]})]}),a.jsx(Lu,{className:"mt-1 min-w-0 text-xs",children:a.jsx(Td,{delayDuration:300,children:a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsx("span",{className:"block truncate",children:me.description||s("skills.noDescription")})}),a.jsx(Uu,{children:me.description||s("skills.noDescription")})]})})})]})]})})},me.name))}):a.jsx(md,{className:"border",children:a.jsxs(pd,{children:[a.jsx(gd,{variant:"icon",children:b||y!=="all"||x!=="all"?a.jsx(eu,{}):a.jsx(iy,{})}),a.jsx(bd,{children:s(b||y!=="all"||x!=="all"?"skills.noMatches":"skills.empty")})]})})]}),a.jsx(_vt,{open:O,onOpenChange:B,onInstall:V})]})}const Evt="_chart_1xbk4_1",Avt="_plot_1xbk4_8",jvt="_svg_1xbk4_13",Nvt="_cursor_1xbk4_30",Ivt="_tooltip_1xbk4_40",Mvt="_tooltipBelow_1xbk4_62",Rvt="_tooltipTime_1xbk4_67",Dvt="_tooltipRow_1xbk4_73",Lvt="_tooltipLabel_1xbk4_79",Pvt="_tooltipValue_1xbk4_83",Ovt="_axis_1xbk4_91",$vt="_legend_1xbk4_96",Bvt="_legendItem_1xbk4_105",zvt="_swatch_1xbk4_112",Fvt="_legendLabel_1xbk4_118",qvt="_legendValue_1xbk4_123",Hvt="_peak_1xbk4_131",Ea={chart:Evt,plot:Avt,svg:jvt,cursor:Nvt,tooltip:Ivt,tooltipBelow:Mvt,tooltipTime:Rvt,tooltipRow:Dvt,tooltipLabel:Lvt,tooltipValue:Pvt,axis:Ovt,legend:$vt,legendItem:Bvt,swatch:zvt,legendLabel:Fvt,legendValue:qvt,peak:Hvt},TR=320,_x=64,rc=3,EC=TR-rc*2,AC=_x-rc*2;function nY(e,t){return Number.isFinite(e)?e:t}const Uvt=84;function Wvt(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 Vvt(e){return new Date(e).toLocaleTimeString()}function bfe({series:e,timestamps:t,format:n=l=>String(Math.round(l)),formatTime:s=Vvt,zeroBased:r=!0,ariaLabel:i,peakLabel:o="peak"}){const l=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:w,span:y}=h.useMemo(()=>{const E=e.reduce((I,$)=>Math.max(I,$.values.length),0);let O=0,B=r?0:Number.POSITIVE_INFINITY;for(const I of e)for(const $ of I.values)Number.isFinite($)&&($>O&&(O=$),$<B&&(B=$));Number.isFinite(B)||(B=0);const D=O-B||1,j=I=>E<=1?rc+EC/2:rc+I/(E-1)*EC,L=I=>rc+AC-(nY(I,B)-B)/D*AC;return{paths:e.map(I=>{const $=I.values.map((Y,W)=>`${W===0?"M":"L"}${j(W).toFixed(1)},${L(Y).toFixed(1)}`).join(" "),K=I.values.length-1,R=K>=0?{cx:j(K),cy:L(I.values[K]),color:I.color}:void 0;return{key:I.label,d:$,color:I.color,dot:R}}),maxV:O,maxLen:E,min:B,span:D}},[e,r]),v=b>0,x=E=>b<=1?rc+EC/2:rc+E/(b-1)*EC,k=E=>rc+AC-(nY(E,w)-w)/y*AC,_=E=>{const O=l.current;if(!O||b===0)return;const B=O.getBoundingClientRect();if(B.width===0)return;const D=(E.clientX-B.left)/B.width,j=Math.max(0,Math.min(b-1,Math.round(D*(b-1))));u(j),m.current===void 0&&(m.current=Wvt(O));const L=m.current,z=L?L.getBoundingClientRect().top:0;f(B.top-z<Uvt)},T=()=>u(null),S=c!=null&&c>=0&&c<b?c:null,C=S!=null?x(S):0,N=S!=null&&b>1?S/(b-1)*100:50;return a.jsxs("div",{className:Ea.chart,children:[a.jsxs("div",{className:Ea.plot,children:[a.jsxs("svg",{ref:l,viewBox:`0 0 ${TR} ${_x}`,preserveAspectRatio:"none",role:"img","aria-label":i,className:Ea.svg,onPointerMove:_,onPointerLeave:T,children:[a.jsx("line",{x1:rc,y1:_x-rc,x2:TR-rc,y2:_x-rc,className:Ea.axis,vectorEffect:"non-scaling-stroke"}),p.map(E=>a.jsx("path",{d:E.d,fill:"none",stroke:E.color,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"},E.key)),S!=null&&a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:C,y1:rc,x2:C,y2:_x-rc,className:Ea.cursor,vectorEffect:"non-scaling-stroke"}),e.map(E=>S<E.values.length?a.jsx("circle",{cx:C,cy:k(E.values[S]),r:2.5,fill:E.color,vectorEffect:"non-scaling-stroke"},`${E.label}-hover`):null)]}),S==null&&p.map(E=>E.dot?a.jsx("circle",{cx:E.dot.cx,cy:E.dot.cy,r:2,fill:E.dot.color,vectorEffect:"non-scaling-stroke"},`${E.key}-dot`):null)]}),S!=null&&a.jsxs("div",{className:`${Ea.tooltip} ${d?Ea.tooltipBelow:""}`,style:{left:`${N}%`},role:"tooltip",children:[t&&t[S]!=null&&a.jsx("div",{className:Ea.tooltipTime,children:s(t[S])}),e.map(E=>S<E.values.length?a.jsxs("div",{className:Ea.tooltipRow,children:[a.jsx("svg",{className:Ea.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:a.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:E.color})}),a.jsx("span",{className:Ea.tooltipLabel,children:E.label}),a.jsx("span",{className:Ea.tooltipValue,children:n(E.values[S])})]},E.label):null)]})]}),a.jsxs("div",{className:Ea.legend,children:[e.map(E=>{const O=E.values.length?E.values[E.values.length-1]:void 0;return a.jsxs("span",{className:Ea.legendItem,children:[a.jsx("svg",{className:Ea.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:a.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:E.color})}),a.jsx("span",{className:Ea.legendLabel,children:E.label}),O!==void 0&&a.jsx("span",{className:Ea.legendValue,children:n(O)})]},E.label)}),v&&a.jsx("span",{className:Ea.peak,children:`${o} ${n(g)}`})]})]})}const Gvt="_wrap_1icv6_1",Kvt="_tooltip_1icv6_11",Yvt="_legend_1icv6_27",Xvt="_legendLabel_1icv6_35",Qvt="_scroll_1icv6_39",Jvt="_grid_1icv6_44",Zvt="_month_1icv6_51",ewt="_weekday_1icv6_59",twt="_cell_1icv6_69",nwt="_legendCell_1icv6_75",swt="_lvl0_1icv6_82",rwt="_lvl1_1icv6_85",iwt="_lvl2_1icv6_88",owt="_lvl3_1icv6_91",awt="_lvl4_1icv6_94",lwt="_today_1icv6_98",Ml={wrap:Gvt,tooltip:Kvt,legend:Yvt,legendLabel:Xvt,scroll:Qvt,grid:Jvt,month:Zvt,weekday:ewt,cell:twt,legendCell:nwt,lvl0:swt,lvl1:rwt,lvl2:iwt,lvl3:owt,lvl4:awt,today:lwt},oN=864e5,cwt=4;function aN(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function sY(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 uwt(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 dwt(e,[t,n,s]){return e<=0?0:e<=t?1:e<=n?2:e<=s?3:cwt}function hwt(e,t,n){const s=Math.max(1,Math.floor(t)),r=aN(Date.now()),i=aN(r.getTime()-(s-1)*oN),o=(i.getDay()+6)%7,l=aN(i.getTime()-o*oN),c=Math.round((r.getTime()-l.getTime())/oN)+1,u=[],d=[],f=sY(r),m=new Date(l.getTime());for(let x=0;x<c;x++){const k=sY(m),_=e[k],T=(_==null?void 0:_.tokens)??0;d.push(T),u.push({dateKey:k,tokens:T,cacheReadRate:(_==null?void 0:_.cacheReadRate)??0,isToday:k===f,weekday:x%7,week:Math.floor(x/7)}),m.setDate(m.getDate()+1)}const p=uwt(d),g=u.map(x=>({...x,level:dwt(x.tokens,p)})),b=Math.ceil(c/7),w=[];let y=-1;const v=new Date(l.getTime());for(let x=0;x<b;x++){const k=v.getMonth();k!==y&&(w.push({week:x,text:v.toLocaleDateString(n,{month:"short"})}),y=k),v.setDate(v.getDate()+7)}return{cells:g,months:w,weeks:b}}function fwt({heatmap:e,days:t}){const{t:n,language:s}=nt(),r=h.useMemo(()=>hwt(e,t,s),[e,t,s]),i=h.useRef(null),[o,l]=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"),w=f.getBoundingClientRect(),y=m.getBoundingClientRect();l({left:w.left-y.left+w.width/2,top:w.top-y.top,text:n("daemon.usage.cellTokens",{date:p,tokens:Gb(g),cache:Math.round(b*100)})})};return a.jsxs("div",{className:Ml.wrap,ref:i,children:[a.jsxs("div",{className:Ml.legend,children:[a.jsx("span",{className:Ml.legendLabel,children:n("daemon.usage.low")}),[0,1,2,3,4].map(d=>a.jsx("span",{className:`${Ml.cell} ${Ml.legendCell} ${Ml[`lvl${d}`]}`},d)),a.jsx("span",{className:Ml.legendLabel,children:n("daemon.usage.high")})]}),a.jsx("div",{className:Ml.scroll,onMouseOver:u,onMouseLeave:()=>l(null),children:a.jsxs("div",{className:Ml.grid,role:"img","aria-label":n("daemon.usage.heatmapTitle"),style:{gridTemplateColumns:`auto repeat(${r.weeks}, var(--hm-cell))`},children:[r.months.map(d=>a.jsx("div",{className:Ml.month,style:{gridColumn:d.week+2,gridRow:1},children:d.text},`m-${d.week}`)),[0,2,4].map(d=>a.jsx("div",{className:Ml.weekday,style:{gridColumn:1,gridRow:d+2},children:c[d]},`wd-${d}`)),r.cells.map(d=>a.jsx("div",{className:`${Ml.cell} ${Ml[`lvl${d.level}`]} ${d.isToday?Ml.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&&a.jsx("div",{className:Ml.tooltip,style:{left:o.left,top:o.top},role:"status",children:o.text})]})}const mwt="_usage_1kfmt_1",pwt="_toolbar_1kfmt_9",gwt="_segmented_1kfmt_14",bwt="_segment_1kfmt_14",ywt="_segmentActive_1kfmt_41",vwt="_hero_1kfmt_48",wwt="_heroMain_1kfmt_59",xwt="_heroLabel_1kfmt_63",kwt="_heroNumber_1kfmt_71",_wt="_heroSub_1kfmt_82",Swt="_refresh_1kfmt_87",Cwt="_stats_1kfmt_109",Twt="_stat_1kfmt_109",Ewt="_statValue_1kfmt_121",Awt="_statLabel_1kfmt_130",jwt="_section_1kfmt_139",Nwt="_sectionTitle_1kfmt_145",Iwt="_sectionSub_1kfmt_154",Mwt="_breakdown_1kfmt_161",Rwt="_metric_1kfmt_167",Dwt="_metricHead_1kfmt_173",Lwt="_tick_1kfmt_179",Pwt="_tick_input_1kfmt_186",Owt="_tick_output_1kfmt_190",$wt="_tick_cache_1kfmt_198",Bwt="_metricLabel_1kfmt_202",zwt="_metricValue_1kfmt_209",Fwt="_metricHint_1kfmt_219",qwt="_state_1kfmt_225",Hwt="_modelList_1kfmt_233",Uwt="_modelRow_1kfmt_239",Wwt="_modelHead_1kfmt_245",Vwt="_modelRank_1kfmt_251",Gwt="_modelMeta_1kfmt_262",Kwt="_modelName_1kfmt_267",Ywt="_modelSub_1kfmt_277",Xwt="_modelShare_1kfmt_282",Qwt="_modelTrack_1kfmt_289",Jwt="_modelFill_1kfmt_296",Zwt="_modelFillCache_1kfmt_303",ext="_skillTable_1kfmt_310",txt="_right_1kfmt_334",nxt="_bars_1kfmt_339",sxt="_barsBody_1kfmt_345",rxt="_barCol_1kfmt_352",ixt="_bar_1kfmt_339",oxt="_barsCaption_1kfmt_371",Fn={usage:mwt,toolbar:pwt,segmented:gwt,segment:bwt,segmentActive:ywt,hero:vwt,heroMain:wwt,heroLabel:xwt,heroNumber:kwt,heroSub:_wt,refresh:Swt,stats:Cwt,stat:Twt,statValue:Ewt,statLabel:Awt,section:jwt,sectionTitle:Nwt,sectionSub:Iwt,breakdown:Mwt,metric:Rwt,metricHead:Dwt,tick:Lwt,tick_input:Pwt,tick_output:Owt,tick_cache:$wt,metricLabel:Bwt,metricValue:zwt,metricHint:Fwt,state:qwt,modelList:Hwt,modelRow:Uwt,modelHead:Wwt,modelRank:Vwt,modelMeta:Gwt,modelName:Kwt,modelSub:Ywt,modelShare:Xwt,modelTrack:Qwt,modelFill:Jwt,modelFillCache:Zwt,skillTable:ext,right:txt,bars:nxt,barsBody:sxt,barCol:rxt,bar:ixt,barsCaption:oxt},yfe=12,axt=Math.round(yfe*30.44),lxt=["today","week","month"],cxt={today:"daemon.usage.today",week:"daemon.usage.period7d",month:"daemon.usage.period30d"},uxt={today:"daemon.usage.today",week:"daemon.usage.rangeWeek",month:"daemon.usage.rangeMonth"},dxt={today:"daemon.usage.rangeWordToday",week:"daemon.usage.rangeWordWeek",month:"daemon.usage.rangeWordMonth"},rY=["#3b82f6","#14b8a6","#f59e0b","#ef4444","#8b5cf6","#22c55e","#06b6d4","#ec4899"];function hxt(e){return new Date(`${e}T00:00:00`).getTime()}function lN(e,t){return new Date(`${e}T00:00:00`).toLocaleDateString(t,{month:"short",day:"numeric"})}function fxt(e,t){return new Date(e).toLocaleDateString(t,{month:"short",day:"numeric"})}function jC({label:e,value:t}){return a.jsxs("div",{className:Fn.stat,children:[a.jsx("div",{className:Fn.statValue,children:t.toLocaleString()}),a.jsx("div",{className:Fn.statLabel,children:e})]})}function cN({accent:e,value:t,label:n,hint:s}){return a.jsxs("div",{className:Fn.metric,children:[a.jsxs("div",{className:Fn.metricHead,children:[a.jsx("span",{className:`${Fn.tick} ${Fn[`tick_${e}`]}`}),a.jsx("span",{className:Fn.metricLabel,children:n})]}),a.jsx("div",{className:Fn.metricValue,children:t}),a.jsx("div",{className:Fn.metricHint,children:s})]})}function mxt({rank:e,model:t,color:n}){const{t:s}=nt(),r=Math.max(0,Math.min(100,t.share*100)),i=Math.max(0,Math.min(100,t.cacheReadRate*100));return a.jsxs("div",{className:Fn.modelRow,children:[a.jsxs("div",{className:Fn.modelHead,children:[a.jsx("span",{className:Fn.modelRank,style:{color:n},children:String(e).padStart(2,"0")}),a.jsxs("div",{className:Fn.modelMeta,children:[a.jsx("div",{className:Fn.modelName,children:t.model}),a.jsx("div",{className:Fn.modelSub,children:s("daemon.usage.modelMeta",{tokens:Gb(t.totalTokens),cache:Math.round(i)})})]}),a.jsxs("span",{className:Fn.modelShare,style:{color:n},children:[Math.round(r),"%"]})]}),a.jsx("div",{className:Fn.modelTrack,children:a.jsx("div",{className:Fn.modelFill,style:{width:`${r}%`,background:n},children:a.jsx("div",{className:Fn.modelFillCache,style:{width:`${i}%`}})})})]})}function pxt({points:e,format:t,locale:n}){const s=Math.max(1,...e.map(r=>r.value));return a.jsxs("div",{className:Fn.bars,children:[a.jsx("div",{className:Fn.barsBody,children:e.map((r,i)=>a.jsx("div",{className:Fn.barCol,title:`${lN(r.label,n)} · ${t(r.value)}`,children:a.jsx("div",{className:Fn.bar,style:{height:`${r.value/s*100}%`}})},`${r.label}-${i}`))}),e.length>1&&a.jsxs("div",{className:Fn.barsCaption,children:[a.jsx("span",{children:lN(e[0].label,n)}),a.jsx("span",{children:lN(e[e.length-1].label,n)})]})]})}function gxt(){const{t:e,language:t}=nt(),[n,s]=h.useState("today"),{dashboard:r,loading:i,error:o,reload:l}=Ywe({range:n,heatmapDays:axt,autoLoad:!0}),c=a.jsx("div",{className:Fn.segmented,role:"group","aria-label":e("daemon.usage.rangeGroup"),children:lxt.map(v=>a.jsx("button",{type:"button",className:`${Fn.segment} ${v===n?Fn.segmentActive:""}`,"aria-pressed":v===n,onClick:()=>s(v),children:e(cxt[v])},v))});if(!r)return a.jsxs("div",{className:Fn.usage,children:[a.jsx("div",{className:Fn.toolbar,children:c}),i?a.jsx("div",{className:Fn.state,children:e("daemon.usage.loading")}):o?a.jsxs("div",{className:Fn.state,children:[e("daemon.usage.failed"),": ",o.message]}):a.jsx("div",{className:Fn.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,w=u.totalTokens>0||Object.keys(p).length>0,y=e(dxt[r.range]);return a.jsxs("div",{className:Fn.usage,"aria-busy":i,children:[a.jsx("div",{className:Fn.toolbar,children:c}),a.jsxs("header",{className:Fn.hero,children:[a.jsxs("div",{className:Fn.heroMain,children:[a.jsx("div",{className:Fn.heroLabel,children:e(uxt[r.range])}),a.jsx("div",{className:Fn.heroNumber,children:Gb(u.totalTokens)}),a.jsx("div",{className:Fn.heroSub,children:e("daemon.usage.tokensConsumed")})]}),a.jsx("button",{type:"button",className:Fn.refresh,onClick:()=>void l(),disabled:i,children:e("daemon.refresh")})]}),a.jsxs("div",{className:Fn.stats,children:[a.jsx(jC,{label:e("daemon.usage.sessions"),value:u.sessions}),a.jsx(jC,{label:e("daemon.usage.requests"),value:u.requests}),a.jsx(jC,{label:e("daemon.usage.tools"),value:u.toolCalls}),a.jsx(jC,{label:e("daemon.usage.changes"),value:b})]}),a.jsxs("section",{className:Fn.section,children:[a.jsx("h4",{className:Fn.sectionTitle,children:e("daemon.usage.breakdownTitle")}),a.jsxs("div",{className:Fn.breakdown,children:[a.jsx(cN,{accent:"input",value:Gb(u.inputTokens),label:e("daemon.usage.inputTokens"),hint:e("daemon.usage.inputHint")}),a.jsx(cN,{accent:"output",value:Gb(u.outputTokens+u.thoughtsTokens),label:e("daemon.usage.outputTokens"),hint:e("daemon.usage.outputHint")}),a.jsx(cN,{accent:"cache",value:`${Math.round(u.cacheReadRate*100)}%`,label:e("daemon.usage.cacheRead"),hint:e("daemon.usage.cacheHint")})]})]}),a.jsxs("section",{className:Fn.section,children:[a.jsx("h4",{className:Fn.sectionTitle,children:e("daemon.usage.heatmapTitle")}),a.jsx("div",{className:Fn.sectionSub,children:e("daemon.usage.heatmapSub",{months:yfe})}),w?a.jsx(fwt,{heatmap:p,days:g}):a.jsx("div",{className:Fn.state,children:e("daemon.usage.empty")})]}),d.length>0&&a.jsxs("section",{className:Fn.section,children:[a.jsxs("h4",{className:Fn.sectionTitle,children:[y," ",e("daemon.usage.modelShareTitle")]}),a.jsx("div",{className:Fn.sectionSub,children:e("daemon.usage.modelShareSub")}),a.jsx("div",{className:Fn.modelList,children:d.map((v,x)=>a.jsx(mxt,{rank:x+1,model:v,color:rY[x%rY.length]},v.model))})]}),f.length>0&&a.jsxs("section",{className:Fn.section,children:[a.jsxs("h4",{className:Fn.sectionTitle,children:[y," ",e("daemon.usage.skillTitle")]}),a.jsx("div",{className:Fn.sectionSub,children:e("daemon.usage.skillSub")}),a.jsxs("table",{className:Fn.skillTable,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:e("daemon.usage.skillName")}),a.jsx("th",{className:Fn.right,children:e("daemon.usage.skillCount")})]})}),a.jsx("tbody",{children:f.map(v=>a.jsxs("tr",{children:[a.jsx("td",{children:v.name}),a.jsx("td",{className:Fn.right,children:v.count.toLocaleString()})]},v.name))})]})]}),m.length>1&&a.jsxs("section",{className:Fn.section,children:[a.jsxs("h4",{className:Fn.sectionTitle,children:[y," ",e("daemon.usage.dailyTokensTitle")]}),a.jsx("div",{className:Fn.sectionSub,children:e("daemon.usage.dailyTokensSub")}),a.jsx(bfe,{series:[{label:e("daemon.usage.tokensConsumed"),values:m.map(v=>v.tokens),color:"var(--agent-blue-400)"}],timestamps:m.map(v=>hxt(v.date)),format:Gb,formatTime:v=>fxt(v,t),ariaLabel:e("daemon.usage.dailyTokensTitle"),peakLabel:e("daemon.charts.peak")})]}),m.length>1&&a.jsxs("section",{className:Fn.section,children:[a.jsxs("h4",{className:Fn.sectionTitle,children:[y," ",e("daemon.usage.dailySessionsTitle")]}),a.jsx("div",{className:Fn.sectionSub,children:e("daemon.usage.dailySessionsSub")}),a.jsx(pxt,{points:m.map(v=>({label:v.date,value:v.sessions})),format:v=>v.toLocaleString(),locale:t})]})]})}const bxt="_dialog_lw868_4",yxt="_toolbar_lw868_12",vxt="_toolbarActions_lw868_19",wxt="_updatedAt_lw868_26",xxt="_refreshError_lw868_31",kxt="_refreshButton_lw868_36",_xt="_badge_lw868_51",Sxt="_levelOk_lw868_61",Cxt="_levelWarning_lw868_66",Txt="_levelError_lw868_71",Ext="_levelUnavailable_lw868_76",Axt="_tabs_lw868_81",jxt="_tab_lw868_81",Nxt="_tabActive_lw868_106",Ixt="_grid_lw868_114",Mxt="_chartsGrid_lw868_113",Rxt="_card_lw868_128",Dxt="_cardTitle_lw868_135",Lxt="_cardHeader_lw868_147",Pxt="_infoHint_lw868_162",Oxt="_infoHintButton_lw868_168",$xt="_infoHintTip_lw868_197",Bxt="_row_lw868_231",zxt="_rowLabel_lw868_240",Fxt="_rowValue_lw868_244",qxt="_pathRow_lw868_253",Hxt="_pathValue_lw868_247",Uxt="_empty_lw868_274",Wxt="_issueRow_lw868_279",Vxt="_issueMessage_lw868_286",Gxt="_featureChips_lw868_290",Kxt="_featureChip_lw868_290",Yxt="_summaryChip_lw868_311",Xxt="_sessionRow_lw868_320",Qxt="_sessionName_lw868_329",Jxt="_sessionMeta_lw868_335",Zxt="_activePrompt_lw868_344",ekt="_workspaceRow_lw868_348",tkt="_workspaceRowHead_lw868_357",nkt="_workspaceName_lw868_363",skt="_workspaceDuration_lw868_367",rkt="_workspaceError_lw868_374",ikt="_workspaceSummary_lw868_381",okt="_workspaceCell_lw868_388",akt="_workspaceCellLabel_lw868_397",lkt="_workspaceCellMessage_lw868_402",Nn={dialog:bxt,toolbar:yxt,toolbarActions:vxt,updatedAt:wxt,refreshError:xxt,refreshButton:kxt,badge:_xt,levelOk:Sxt,levelWarning:Cxt,levelError:Txt,levelUnavailable:Ext,tabs:Axt,tab:jxt,tabActive:Nxt,grid:Ixt,chartsGrid:Mxt,card:Rxt,cardTitle:Dxt,cardHeader:Lxt,infoHint:Pxt,infoHintButton:Oxt,infoHintTip:$xt,row:Bxt,rowLabel:zxt,rowValue:Fxt,pathRow:qxt,pathValue:Hxt,empty:Uxt,issueRow:Wxt,issueMessage:Vxt,featureChips:Gxt,featureChip:Kxt,summaryChip:Yxt,sessionRow:Xxt,sessionName:Qxt,sessionMeta:Jxt,activePrompt:Zxt,workspaceRow:ekt,workspaceRowHead:tkt,workspaceName:nkt,workspaceDuration:skt,workspaceError:rkt,workspaceSummary:ikt,workspaceCell:okt,workspaceCellLabel:akt,workspaceCellMessage:lkt},ckt=5e3,lb=[{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 vfe(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 dp(e){return e=Math.max(0,e),e>=6e4?vfe(e):e>=1e3?`${(e/1e3).toFixed(e%1e3===0?0:1)}s`:`${e}ms`}function q3(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 Xw(e){const t=Math.round(e);return t>=1e4?`${(t/1e3).toFixed(t%1e3===0?0:1)}k`:t.toLocaleString()}function ukt(e){return`${e.toFixed(e>=100||e===0?0:1)}%`}function dkt(e){return e.exitCode!=null?`${e.state} (exit ${e.exitCode})`:e.signal?`${e.state} (${e.signal})`:e.state}function iY(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const hkt=["cells","servers","errors","skills","tools","providers","hooks","extensions","budgets"];function fkt(e){if(!iY(e))return[];const t=[];for(const n of hkt){const s=e[n];if(Array.isArray(s))for(const r of s){if(!iY(r))continue;const i=r.status;if(i!=="warning"&&i!=="error")continue;const o=String(r.kind??r.name??r.serverName??n),l=typeof r.error=="string"?r.error:typeof r.hint=="string"?r.hint:void 0;t.push({label:o,status:i,message:l})}}return t}function ER(e){switch(e){case"ok":return Nn.levelOk;case"warning":return Nn.levelWarning;case"error":return Nn.levelError;default:return Nn.levelUnavailable}}function Lr({label:e,value:t}){return a.jsxs("div",{className:Nn.row,children:[a.jsx("span",{className:Nn.rowLabel,children:e}),a.jsx("span",{className:Nn.rowValue,children:t})]})}function mkt({text:e}){return a.jsxs("span",{className:Nn.infoHint,children:[a.jsx("button",{type:"button",className:Nn.infoHintButton,"aria-label":e,children:a.jsx("span",{"aria-hidden":"true",children:"ⓘ"})}),a.jsx("span",{"aria-hidden":"true",className:Nn.infoHintTip,children:e})]})}function bu({title:e,help:t,children:n}){return a.jsxs("section",{className:Nn.card,children:[t?a.jsxs("div",{className:Nn.cardHeader,children:[a.jsx("h3",{className:Nn.cardTitle,children:e}),a.jsx(mkt,{text:t})]}):a.jsx("h3",{className:Nn.cardTitle,children:e}),n]})}function pkt({name:e,section:t}){const{t:n}=nt(),s=Object.entries(t.summary??{}),r=fkt(t.data);return a.jsxs("div",{className:Nn.workspaceRow,children:[a.jsxs("div",{className:Nn.workspaceRowHead,children:[a.jsx("span",{className:`${Nn.badge} ${ER(t.status)}`,children:n(`daemon.level.${t.status}`)}),a.jsx("span",{className:Nn.workspaceName,children:e}),a.jsx("span",{className:Nn.workspaceDuration,children:dp(t.durationMs)})]}),t.error&&a.jsx("div",{className:Nn.workspaceError,children:t.error.message}),r.map((i,o)=>a.jsxs("div",{className:Nn.workspaceCell,children:[a.jsx("span",{className:`${Nn.badge} ${ER(i.status)}`,children:n(`daemon.level.${i.status}`)}),a.jsx("span",{className:Nn.workspaceCellLabel,children:i.label}),i.message&&a.jsx("span",{className:Nn.workspaceCellMessage,children:i.message})]},`${i.label}-${o}`)),s.length>0&&a.jsx("div",{className:Nn.workspaceSummary,children:s.map(([i,o])=>a.jsxs("span",{className:Nn.summaryChip,children:[i,": ",o===null?n("common.na"):String(o)]},i))})]})}function gkt({report:e}){const{t}=nt(),n=e.full;if(!n)return null;const s=Object.entries(n.workspace).sort(([r],[i])=>r.localeCompare(i));return a.jsxs(a.Fragment,{children:[a.jsx(bu,{title:t("daemon.full.sessions.title"),children:n.sessions.length===0?a.jsx("div",{className:Nn.empty,children:t("daemon.full.sessions.empty")}):n.sessions.map(r=>a.jsxs("div",{className:Nn.sessionRow,children:[a.jsx("div",{className:Nn.sessionName,children:r.displayName||r.sessionId}),a.jsxs("div",{className:Nn.sessionMeta,children:[a.jsx("span",{children:t("common.clients",{count:r.clientCount})}),a.jsx("span",{children:t("daemon.full.session.pendingPrompts",{count:r.pendingPromptCount})}),a.jsx("span",{children:t("daemon.full.session.pendingPermissions",{count:r.pendingPermissionCount})}),r.hasActivePrompt&&a.jsx("span",{className:Nn.activePrompt,children:t("daemon.full.session.prompting")})]})]},r.sessionId))}),a.jsx(bu,{title:t("daemon.full.workspace.title"),children:s.length===0?a.jsx("div",{className:Nn.empty,children:t("daemon.full.workspace.empty")}):s.map(([r,i])=>a.jsx(pkt,{name:r,section:i},r))}),a.jsxs(bu,{title:t("daemon.full.auth.title"),children:[a.jsx(Lr,{label:t("daemon.full.auth.providers"),value:n.auth.supportedDeviceFlowProviders.join(", ")||t("daemon.none")}),a.jsx(Lr,{label:t("daemon.full.auth.pending"),value:n.auth.pendingDeviceFlowCount}),a.jsx(Lr,{label:t("daemon.full.acp.title"),value:n.acpConnections.length})]})]})}function bkt({series:e}){const{t}=nt();if(e.length===0)return a.jsx(bu,{title:t("daemon.charts.title"),children:a.jsx("div",{className:Nn.empty,children:t("daemon.charts.empty")})});const n=i=>e.map(i),s=e.map(i=>i.t),r=(i,o,l,c)=>a.jsx(bu,{title:t(i),help:t(c),children:a.jsx(bfe,{series:l,timestamps:s,format:o,ariaLabel:t(i),peakLabel:t("daemon.charts.peak")})});return a.jsxs("div",{className:`${Nn.grid} ${Nn.chartsGrid}`,children:[r("daemon.charts.concurrency",Xw,[{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",Xw,[{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",dp,[{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",dp,[{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",Xw,[{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",dp,[{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",dp,[{label:t("daemon.charts.eventLoopLag"),values:n(i=>i.eventLoopLagP99Ms),color:"var(--error-color)"}],"daemon.charts.eventLoop.help"),r("daemon.charts.cpu",ukt,[{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",q3,[{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",q3,[{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",Xw,[{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",Xw,[{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 ykt(){var C;const{t:e}=nt(),[t,n]=h.useState("overview"),s=h.useRef([]),r=(N,E)=>{var B;let O;if(N.key==="ArrowRight"||N.key==="ArrowDown")O=(E+1)%lb.length;else if(N.key==="ArrowLeft"||N.key==="ArrowUp")O=(E-1+lb.length)%lb.length;else if(N.key==="Home")O=0;else if(N.key==="End")O=lb.length-1;else return;N.preventDefault(),n(lb[O].id),(B=s.current[O])==null||B.focus()},i=W7({autoLoad:!0,detail:"summary"}),o=W7({autoLoad:!0,detail:"full"}),l=i.reload,c=o.reload,u=h.useRef(!1);h.useEffect(()=>{const N=window.setInterval(()=>{document.hidden||u.current||(u.current=!0,l().finally(()=>{u.current=!1}))},ckt);return()=>window.clearInterval(N)},[l]);const d=h.useCallback(()=>{l(),c()},[l,c]),f=i.report??o.report,m=o.report,p=i.loading||o.loading,g=i.error??o.error;if(!f)return a.jsx("div",{className:Nn.dialog,children:a.jsx("div",{className:Nn.empty,children:g?`${e("daemon.loadFailed")}: ${g.message}`:e("daemon.loading")})});const b=m??f,{daemon:w,runtime:y,security:v,limits:x,capabilities:k}=f,_=y.transport.acp,T=Object.values(y.rateLimit.rejectedSinceStart).reduce((N,E)=>N+E,0),S=N=>N===null?e("daemon.limits.unlimited"):N;return a.jsxs("div",{className:Nn.dialog,children:[a.jsxs("div",{className:Nn.toolbar,children:[a.jsx("span",{role:"status","aria-label":`${e("daemon.title")}: ${e(`daemon.level.${b.status}`)}`,className:`${Nn.badge} ${ER(b.status)}`,children:e(`daemon.level.${b.status}`)}),a.jsx("span",{className:Nn.updatedAt,children:e("daemon.updatedAt",{time:new Date(f.generatedAt).toLocaleTimeString()})}),i.error&&i.report&&a.jsx("span",{className:Nn.refreshError,children:e("daemon.loadFailed")}),a.jsx("div",{className:Nn.toolbarActions,children:a.jsx("button",{type:"button",className:Nn.refreshButton,onClick:d,disabled:p,children:e("daemon.refresh")})})]}),b.issues.length>0&&a.jsx(bu,{title:e("daemon.issues.title"),children:b.issues.map((N,E)=>a.jsxs("div",{className:Nn.issueRow,children:[a.jsx("span",{className:`${Nn.badge} ${N.severity==="error"?Nn.levelError:Nn.levelWarning}`,children:N.severity==="error"?e("daemon.level.error"):e("daemon.level.warning")}),a.jsx("span",{className:Nn.issueMessage,children:N.message})]},`${N.code}-${E}`))}),a.jsx("div",{className:Nn.tabs,role:"tablist","aria-label":e("daemon.title"),children:lb.map((N,E)=>a.jsx("button",{ref:O=>{s.current[E]=O},type:"button",role:"tab",id:`daemon-tab-${N.id}`,"aria-selected":N.id===t,"aria-controls":`daemon-tabpanel-${N.id}`,tabIndex:N.id===t?0:-1,className:`${Nn.tab} ${N.id===t?Nn.tabActive:""}`,onClick:()=>n(N.id),onKeyDown:O=>r(O,E),children:e(N.labelKey)},N.id))}),t==="overview"&&a.jsxs("div",{role:"tabpanel",id:"daemon-tabpanel-overview","aria-labelledby":"daemon-tab-overview",tabIndex:0,className:Nn.grid,children:[a.jsxs(bu,{title:e("daemon.overview.title"),children:[w.qwenCodeVersion&&a.jsx(Lr,{label:e("daemon.overview.version"),value:w.qwenCodeVersion}),a.jsx(Lr,{label:e("daemon.overview.pid"),value:w.pid}),a.jsx(Lr,{label:e("daemon.overview.mode"),value:w.mode}),a.jsx(Lr,{label:e("daemon.overview.uptime"),value:vfe(w.uptimeMs)}),a.jsxs("div",{className:Nn.pathRow,children:[a.jsx("span",{className:Nn.rowLabel,children:e("daemon.overview.workspace")}),a.jsx("span",{className:Nn.pathValue,title:w.workspaceCwd,children:a.jsx("bdi",{children:w.workspaceCwd})})]})]}),a.jsxs(bu,{title:e("daemon.runtime.title"),children:[y.error?a.jsxs("div",{className:Nn.workspaceError,children:[e("daemon.runtime.startFailed"),": ",y.error]}):y.loading?a.jsx("div",{className:Nn.empty,children:e("daemon.runtime.startingUp")}):null,a.jsx(Lr,{label:e("daemon.runtime.activeSessions"),value:y.sessions.active}),y.activity&&a.jsxs(a.Fragment,{children:[a.jsx(Lr,{label:e("daemon.runtime.activePrompts"),value:y.activity.activePrompts}),a.jsx(Lr,{label:e("daemon.runtime.idle"),value:y.activity.idleSinceMs===null?e("daemon.runtime.noActivity"):dp(y.activity.idleSinceMs)})]}),a.jsx(Lr,{label:e("daemon.runtime.pendingPermissions"),value:y.permissions.pending}),a.jsx(Lr,{label:e("daemon.runtime.permissionPolicy"),value:y.permissions.policy}),a.jsx(Lr,{label:e("daemon.runtime.channel"),value:y.channel.live?e("daemon.runtime.channelLive"):e("daemon.runtime.channelDown")}),y.channelWorker.enabled&&a.jsxs(a.Fragment,{children:[a.jsx(Lr,{label:e("daemon.runtime.channelWorker"),value:dkt(y.channelWorker)}),y.channelWorker.error&&a.jsx("div",{className:Nn.workspaceError,children:y.channelWorker.error}),(y.channelWorker.restartCount??0)>0&&a.jsx(Lr,{label:e("daemon.runtime.channelWorkerRestarts"),value:y.channelWorker.restartCount})]}),a.jsx(Lr,{label:e("daemon.runtime.memory"),value:`${q3(y.process.rss)} / ${q3(y.process.heapUsed)}`})]}),a.jsxs(bu,{title:e("daemon.transport.title"),children:[a.jsx(Lr,{label:e("daemon.transport.restSse"),value:y.transport.restSseActive}),_.enabled?a.jsxs(a.Fragment,{children:[a.jsx(Lr,{label:e("daemon.transport.acpConnections"),value:_.connections}),a.jsx(Lr,{label:e("daemon.transport.acpStreams"),value:`${_.sessionStreams} / ${_.sseStreams} / ${_.wsStreams}`}),a.jsx(Lr,{label:e("daemon.transport.pendingRequests"),value:_.pendingClientRequests})]}):a.jsx("div",{className:Nn.empty,children:e("daemon.transport.acpDisabled")}),a.jsx(Lr,{label:e("daemon.transport.rateLimitRejected"),value:y.rateLimit.enabled?T:e("common.disabled")})]}),a.jsxs(bu,{title:e("daemon.security.title"),children:[a.jsx(Lr,{label:e("daemon.security.token"),value:v.tokenConfigured?e("daemon.security.configured"):e("daemon.security.notConfigured")}),a.jsx(Lr,{label:e("daemon.security.requireAuth"),value:v.requireAuth?e("common.enabled"):e("common.disabled")}),a.jsx(Lr,{label:e("daemon.security.loopback"),value:v.loopbackBind?e("common.enabled"):e("common.disabled")}),a.jsx(Lr,{label:e("daemon.security.allowOrigin"),value:v.allowOriginMode}),a.jsx(Lr,{label:e("daemon.security.shell"),value:v.sessionShellCommandEnabled?e("common.enabled"):e("common.disabled")})]}),a.jsxs(bu,{title:e("daemon.limits.title"),children:[a.jsx(Lr,{label:e("daemon.limits.maxSessions"),value:S(x.maxSessions)}),a.jsx(Lr,{label:e("daemon.limits.maxPendingPrompts"),value:S(x.maxPendingPromptsPerSession)}),a.jsx(Lr,{label:e("daemon.limits.maxConnections"),value:S(x.listenerMaxConnections)}),a.jsx(Lr,{label:e("daemon.limits.eventRing"),value:x.eventRingSize}),a.jsx(Lr,{label:e("daemon.limits.promptDeadline"),value:x.promptDeadlineMs===null?e("daemon.limits.unlimited"):dp(x.promptDeadlineMs)}),a.jsx(Lr,{label:e("daemon.limits.sessionIdle"),value:dp(x.sessionIdleTimeoutMs)})]}),a.jsx(bu,{title:k.features.length?e("daemon.capabilities.titleCount",{count:k.features.length}):e("daemon.capabilities.title"),children:k.features.length===0?a.jsx("span",{className:Nn.empty,children:e("daemon.none")}):a.jsx("div",{className:Nn.featureChips,children:[...k.features].sort().map(N=>a.jsx("span",{className:Nn.featureChip,children:N},N))})})]}),t==="usage"&&a.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-usage","aria-labelledby":"daemon-tab-usage",tabIndex:0,children:a.jsx(Wf,{label:"daemon-usage",fallback:a.jsx("div",{className:Nn.empty,children:e("daemon.usage.failed")}),children:a.jsx(gxt,{})})}),t==="metrics"&&a.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-metrics","aria-labelledby":"daemon-tab-metrics",tabIndex:0,children:a.jsx(bkt,{series:((C=f.runtime.metrics)==null?void 0:C.series)??[]})}),t==="diagnostics"&&a.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-diagnostics","aria-labelledby":"daemon-tab-diagnostics",tabIndex:0,children:a.jsx(Wf,{label:"daemon-status-detail",fallback:a.jsx("div",{className:Nn.empty,children:e("daemon.details.failed")}),children:m!=null&&m.full?a.jsx(gkt,{report:m}):o.loading?a.jsx("div",{className:Nn.empty,children:e("daemon.details.loading")}):o.error?a.jsxs("div",{className:Nn.empty,children:[e("daemon.details.failed"),": ",o.error.message]}):a.jsx("div",{className:Nn.empty,children:e("daemon.details.failed")})})})]})}function vkt(){const{t:e}=nt();return a.jsx(Wf,{label:"daemon-status",fallback:t=>a.jsx("div",{className:Nn.dialog,children:a.jsxs("div",{className:Nn.empty,children:[e("daemon.loadFailed"),": ",t.message]})}),children:a.jsx(ykt,{})})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function wfe(e,t){const n=e.match(/^(.*)\/session\/[^/]+\/?$/),s=(n==null?void 0:n[1])??e.replace(/\/$/,"");return t?`${s}/session/${encodeURIComponent(t)}`:s||"/"}function wkt(e){const t=e.match(/\/session\/([^/]+)\/?$/);if(t)try{return decodeURIComponent(t[1])}catch{return}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const xfe="split",Ep=6;function xkt(e,t,n){const s=new URL(t);return s.pathname=wfe(s.pathname,void 0),s.searchParams.set(xfe,e.join(",")),n&&(s.hash=new URLSearchParams({token:n}).toString()),s.toString()}function kkt(e){const t=new URLSearchParams(e).get(xfe);return t?t.split(",").map(n=>n.trim()).filter(Boolean):[]}const mO="qwen-webshell-split-sessions";function _kt(e){const t=Array.from(new Set(e.filter(Boolean))).slice(0,Ep);try{sessionStorage.setItem(mO,JSON.stringify(t))}catch{}}function Skt(){try{const e=sessionStorage.getItem(mO);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,Ep):[]}catch{return[]}}function Ckt(){try{sessionStorage.removeItem(mO)}catch{}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function kfe(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function nE(e){var t;return((t=e.displayName)==null?void 0:t.trim())||kfe(e.cwd)}function sE(e,t){const n=t==null?void 0:t.find(s=>s.cwd===e);return n?nE(n):kfe(e)}function pO(e){var t;return(((t=e==null?void 0:e.workspaces)==null?void 0:t.length)??0)>1}function Tkt(e,t){return!!e&&!!t&&e!==t}function _fe(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 NC=[];function Sfe(e=!0){var c;const t=Co(),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(NC),o=h.useCallback(async()=>{const u=s?s.split(`
`):[];if(u.length===0)return NC;const d=await Promise.allSettled(u.map(m=>n.listWorkspaceSessions(m,{pageSize:nh,archiveState:"active",sourceType:sh}))),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?NC:f},[n,s]),l=h.useCallback(async()=>{s&&i(await o())},[s,o]);return h.useEffect(()=>{if(!s){i(d=>d.length===0?d:NC);return}let u=!1;return o().then(d=>{u||i(d)}),()=>{u=!0}},[s,o]),{sessions:r,reload:l}}function Ekt(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search).get("daemon")||"";return e?Dkt(e):""}let dg;const Akt="qwen-daemon-auth",jkt=2500,Cfe="qwen-daemon-token";function Nkt(){try{return window.sessionStorage.getItem(Cfe)||void 0}catch{return}}function Ikt(e){try{window.sessionStorage.setItem(Cfe,e)}catch{}}function Tfe(){if(dg)return dg;if(typeof window>"u")return;const t=new URLSearchParams(window.location.hash.replace(/^#/,"")).get("token")||new URLSearchParams(window.location.search).get("token")||"";return t?(Ikt(t),dg=t,dg):(dg=Nkt(),dg)}function Mkt(e=jkt){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),dg=o,t(o))},r=o=>{if(o.source!==window.parent||!o.origin.startsWith("chrome-extension://")&&!o.origin.startsWith("moz-extension://"))return;const l=o.data;if((l==null?void 0:l.type)!==Akt)return;const c=typeof l.token=="string"?l.token:"";s(c.trim()||void 0)},i=setTimeout(()=>s(void 0),e);window.addEventListener("message",r)})}function Rkt(){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 Dkt(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 Lkt="_panel_1s6rs_1",Pkt="_toolbar_1s6rs_9",Okt="_count_1s6rs_16",$kt="_selectAll_1s6rs_21",Bkt="_actionButton_1s6rs_30",zkt="_refreshButton_1s6rs_50",Fkt="_notice_1s6rs_61",qkt="_grid_1s6rs_71",Hkt="_card_1s6rs_80",Ukt="_cardCurrent_1s6rs_91",Wkt="_cardTop_1s6rs_96",Vkt="_cardCheckbox_1s6rs_103",Gkt="_colorDot_1s6rs_108",Kkt="_cardLabel_1s6rs_115",Ykt="_currentBadge_1s6rs_135",Xkt="_cardMeta_1s6rs_145",Qkt="_metaItem_1s6rs_153",Jkt="_statusBadge_1s6rs_162",Zkt="_statusApproval_1s6rs_172",e_t="_statusRunning_1s6rs_181",t_t="_statusIdle_1s6rs_190",n_t="_workspaceBadge_1s6rs_202",s_t="_workspaceBadgeOther_1s6rs_218",r_t="_empty_1s6rs_223",i_t="_colorRed_1s6rs_231",o_t="_colorOrange_1s6rs_234",a_t="_colorYellow_1s6rs_237",l_t="_colorGreen_1s6rs_240",c_t="_colorBlue_1s6rs_243",u_t="_colorPurple_1s6rs_246",tr={panel:Lkt,toolbar:Pkt,count:Okt,selectAll:$kt,actionButton:Bkt,refreshButton:zkt,notice:Fkt,grid:qkt,card:Hkt,cardCurrent:Ukt,cardTop:Wkt,cardCheckbox:Vkt,colorDot:Gkt,cardLabel:Kkt,currentBadge:Ykt,cardMeta:Xkt,metaItem:Qkt,statusBadge:Jkt,statusApproval:Zkt,statusRunning:e_t,statusIdle:t_t,workspaceBadge:n_t,workspaceBadgeOther:s_t,empty:r_t,colorRed:i_t,colorOrange:o_t,colorYellow:a_t,colorGreen:l_t,colorBlue:c_t,colorPurple:u_t},d_t=3e3,h_t=1e4,oY={needsApproval:0,running:1,idle:2};function f_t(e,t,n,s){const r=new Map(t.map(o=>[o.sessionId,o])),i=e.map(o=>{var d,f;const l=r.get(o.sessionId),c=o.hasActivePrompt??(l==null?void 0:l.hasActivePrompt)??!1,u=((l==null?void 0:l.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??(l==null?void 0:l.clientCount)??0,model:(f=l==null?void 0:l.currentModelId)!=null&&f.startsWith("qwen-route:")?void 0:l!=null&&l.currentModelId?up(l.currentModelId):void 0,updatedAt:o.updatedAt||o.createdAt,color:o.color,isCurrent:o.sessionId===n,workspaceCwd:o.workspaceCwd,isNonPrimary:Tkt(o.workspaceCwd,s)}});return i.sort((o,l)=>{const c=oY[o.status]-oY[l.status];return c!==0?c:(l.updatedAt??"").localeCompare(o.updatedAt??"")}),i}function IC(...e){return e.filter(Boolean).join(" ")}function m_t(e){switch(e){case"red":return tr.colorRed;case"orange":return tr.colorOrange;case"yellow":return tr.colorYellow;case"green":return tr.colorGreen;case"blue":return tr.colorBlue;case"purple":return tr.colorPurple;default:return}}function aY(e){switch(e){case"needsApproval":return tr.statusApproval;case"running":return tr.statusRunning;default:return tr.statusIdle}}function p_t({onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n,workspaceCwd:s}){var R,Y,W;const{t:r}=nt(),i=za(),o=i.sessionId,l=((Y=(R=i.capabilities)==null?void 0:R.features)==null?void 0:Y.includes(oD))??!1,{sessions:c,loading:u,error:d,reload:f}=tS(s,{autoLoad:!0,pageSize:nh,archiveState:"active",...l?{view:"organized",group:"all"}:{}}),{sessions:m,reload:p}=Sfe(n&&!s),g=h.useMemo(()=>_fe(c,m),[c,m]),b=!s&&n&&pO(i.capabilities),w=W7({autoLoad:!0,detail:"full"}),y=w.reload,v=w.report,[x,k]=h.useState(()=>new Set),[_,T]=h.useState(!1),S=h.useRef(!1);h.useEffect(()=>{const M=window.setInterval(()=>{document.hidden||S.current||(S.current=!0,Promise.all([f(),p()]).finally(()=>{S.current=!1}))},d_t);return()=>window.clearInterval(M)},[f,p]);const C=h.useRef(!1);h.useEffect(()=>{const M=window.setInterval(()=>{document.hidden||C.current||(C.current=!0,y().finally(()=>{C.current=!1}))},h_t);return()=>window.clearInterval(M)},[y]);const N=(W=i.capabilities)==null?void 0:W.workspaceCwd,E=h.useMemo(()=>{var M;return f_t(g,((M=v==null?void 0:v.full)==null?void 0:M.sessions)??[],o,N)},[g,v,o,N]),O=h.useCallback(M=>{k(F=>{const J=new Set(F);return J.has(M)?J.delete(M):J.add(M),J})},[]),B=E.map(M=>M.sessionId).filter(M=>x.has(M)),D=B.length,j=E.length>0&&D===E.length,L=B.slice(0,Ep),z=D>Ep,I=h.useCallback(()=>{k(M=>{const F=E.map(V=>V.sessionId);return F.length>0&&F.every(V=>M.has(V))?new Set:new Set(F)})},[E]);h.useEffect(()=>{k(M=>{if(M.size===0)return M;const F=new Set(E.map(U=>U.sessionId));let J=!1;const V=new Set;for(const U of M)F.has(U)?V.add(U):J=!0;return J?V:M})},[E]);const $=h.useCallback(()=>{if(L.length===0)return;const M=xkt(L,window.location.href,Tfe()),F=window.open(M,"_blank");F&&(F.opener=null,F.focus()),T(!F)},[L]),K=h.useCallback(()=>{f(),p(),y()},[f,p,y]);return E.length===0?a.jsx("div",{className:tr.panel,children:a.jsx("div",{className:tr.empty,children:u?r("sessionsOverview.loading"):d?`${r("sessionsOverview.loadFailed")}: ${d.message}`:r("sessionsOverview.empty")})}):a.jsxs("div",{className:tr.panel,children:[a.jsxs("div",{className:tr.toolbar,children:[a.jsx("span",{className:tr.count,children:r("sessionsOverview.count",{count:E.length})}),a.jsxs("label",{className:tr.selectAll,children:[a.jsx("input",{type:"checkbox",checked:j,onChange:I}),r("sessionsOverview.selectAll")]}),a.jsx("button",{type:"button",className:tr.actionButton,disabled:D===0,onClick:$,title:r("sessionsOverview.openInTabHint"),children:r("sessionsOverview.openInTab")}),t&&a.jsx("button",{type:"button",className:tr.actionButton,disabled:D===0,onClick:()=>t(L),title:r("sessionsOverview.openInSplitHint"),children:r("sessionsOverview.openInSplit")}),a.jsx("button",{type:"button",className:tr.refreshButton,onClick:K,children:r("sessionsOverview.refresh")})]}),z&&a.jsx("div",{className:tr.notice,role:"status",children:r("sessionsOverview.splitCap",{max:Ep})}),_&&a.jsx("div",{className:tr.notice,role:"alert",children:r("sessionsOverview.popupBlocked")}),d&&a.jsxs("div",{className:tr.notice,role:"alert",children:[r("sessionsOverview.loadFailed"),": ",d.message]}),a.jsx("ul",{className:tr.grid,children:E.map(M=>{var F;return a.jsxs("li",{className:IC(tr.card,aY(M.status),M.isCurrent&&tr.cardCurrent),children:[a.jsxs("div",{className:tr.cardTop,children:[a.jsx("input",{type:"checkbox",className:tr.cardCheckbox,checked:x.has(M.sessionId),onChange:()=>O(M.sessionId),"aria-label":r("sessionsOverview.selectSession",{name:M.label})}),M.color&&a.jsx("span",{className:IC(tr.colorDot,m_t(M.color)),"aria-hidden":"true"}),a.jsx("button",{type:"button",className:tr.cardLabel,onClick:()=>e(M.sessionId),title:M.label,children:M.label}),M.isCurrent&&a.jsx("span",{className:tr.currentBadge,children:r("sessionsOverview.current")})]}),a.jsxs("div",{className:tr.cardMeta,children:[a.jsx("span",{className:IC(tr.statusBadge,aY(M.status)),children:r(`sessionsOverview.status.${M.status}`)}),b&&a.jsx("span",{className:IC(tr.workspaceBadge,M.isNonPrimary&&tr.workspaceBadgeOther),title:M.workspaceCwd,children:sE(M.workspaceCwd,(F=i.capabilities)==null?void 0:F.workspaces)}),M.model&&a.jsx("span",{className:tr.metaItem,title:M.model,children:M.model}),M.clientCount>0&&a.jsx("span",{className:tr.metaItem,title:r("sessionsOverview.openElsewhere"),children:r("common.clients",{count:M.clientCount})}),M.updatedAt&&a.jsx("span",{className:tr.metaItem,children:Zy(M.updatedAt,r)})]})]},M.sessionId)})})]})}function g_t({onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n=!0,workspaceCwd:s}){const{t:r}=nt();return a.jsx(Wf,{label:"session-overview",fallback:i=>a.jsx("div",{className:tr.panel,children:a.jsxs("div",{className:tr.empty,children:[r("sessionsOverview.loadFailed"),": ",i.message]})}),children:a.jsx(p_t,{onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n,workspaceCwd:s})})}function Efe(){const e=gv(),t=h.useCallback(s=>{let r=null;const i=e.subscribe(()=>{r===null&&(r=window.requestAnimationFrame(()=>{r=null,s()}))});return()=>{i(),r!==null&&window.cancelAnimationFrame(r)}},[e]),n=h.useCallback(()=>e.getSnapshot().blocks,[e]);return h.useSyncExternalStore(t,n,n)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function b_t(e){const t=new Map;for(const n of e){if(n.kind!=="assistant")continue;const s=Xo(n.meta);if((s==null?void 0:s.source)!=="background_notification"||s.qwenDiscreteMessage!==!0)continue;const r=Xo(s.backgroundTask),i=el(r,"toolUseId"),o=el(r,"status");(r==null?void 0:r.kind)!=="agent"||!i||!o||t.set(i,{status:o,endTime:n.serverTimestamp??n.clientReceivedAt})}return t}function y_t(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={...Xo(e.rawOutput)??{},status:"cancelled"};break}}function v_t(e){return e.startsWith("language_changed (unrecognized daemon event):")||e.startsWith("session_cwd_changed (unrecognized daemon event):")||e.startsWith("Model switched: ")}function w_t(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 x_t(e,t){return e===void 0?{}:t?{data:{...Xo(e)??{value:e},errorKind:t}}:{data:e}}function k_t(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 __t(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 lY(e){var n;return((n=e.meta)==null?void 0:n.source)==="background_notification"}function cY(e){var n;return Xo((n=e.meta)==null?void 0:n.backgroundTask)??void 0}function uY(e){return e.text.length===0}function S_t(e){const t=e.flatMap((n,s)=>{const r=Xo(n),i=el(r,"content");return i?[{id:el(r,"id")??`plan-${s}`,content:i,status:I_t(el(r,"status")),...(()=>{const l=M_t(el(r,"priority"));return l?{priority:l}:{}})()}]:[]});return t.length>0?t:void 0}function dY(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 C_t(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=b_t(e);let l=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 w=g;if(lY(w)){l=null,c=null,u=!0,n.push({id:g.id,role:"system",content:w.text,variant:"info",source:"background_notification",data:cY(w),timestamp:b});break}l=null,c=null,u=!1;const y=Xo(w.meta),v=el(y,"source"),x=Array.isArray(y==null?void 0:y.inputAnnotations)?y.inputAnnotations:void 0,k={id:g.id,role:"user",content:w.text,timestamp:b,...v?{source:v}:{},...x?{inputAnnotations:x}:{}};w.images&&w.images.length>0&&(k.images=w.images.map(_=>({data:_.data,mimeType:_.mimeType||"image/*"}))),n.push(k);break}case"assistant":{const w=g;if(lY(w)){l=null,c=null,u=!0,n.push({id:g.id,role:"system",content:w.text,variant:"info",source:"background_notification",data:cY(w),timestamp:b});break}if(!w.text&&!w.usage)break;const y=w.parentToolCallId?r.get(w.parentToolCallId):void 0;if(y){hY(y,w.text);break}const v=W_t(w.text);if(v){let k=null,_=!1,T=0,S=0;for(const C of v)C.kind==="insight"?C.data.type==="insight_progress"?k=C.data:C.data.type==="insight_ready"?(_=!0,n.push({id:`${g.id}-ir-${T++}`,role:"insight_ready",path:C.data.path,timestamp:b})):C.data.type==="insight_error"&&(_=!0,n.push({id:`${g.id}-ie-${S++}`,role:"insight_error",error:C.data.error,timestamp:b})):(n.push({id:`${g.id}-t-${n.length}`,role:"assistant",content:C.text,timestamp:b}),l=n.length-1,c=null);k&&!_&&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=l!==null?n[l]:void 0;if(x&&x.role==="assistant"&&!u&&!uY(w)){const k=dY(x.usage,w.usage);n[l]={...x,content:x.content+w.text,isStreaming:w.streaming,...k?{usage:k}:{}},u=!1,c=null}else if(!uY(w))n.push({id:g.id,role:"assistant",content:w.text,isStreaming:w.streaming,timestamp:b,...w.usage?{usage:w.usage}:{}}),l=n.length-1,c=null,u=!1;else if(w.usage&&x&&x.role==="assistant"){const k=dY(x.usage,w.usage);n[l]={...x,...k?{usage:k}:{}}}break}case"thought":{const w=g,y=w.parentToolCallId?r.get(w.parentToolCallId):void 0;if(y){hY(y,w.text);break}const v=c!==null?n[c]:void 0;v&&v.role==="thinking"&&!u?(n[c]={...v,content:v.content+w.text,isStreaming:w.streaming},u=!1):(n.push({id:g.id,role:"thinking",content:w.text,isStreaming:w.streaming,timestamp:b}),c=n.length-1,u=!1),l=null;break}case"tool":{const y=R_t(g);y_t(y,o.get(y.callId));const v=i.get(y.callId);v!=null&&v.title&&(y.title=v.title),!y.args&&(v!=null&&v.args)&&(y.args=v.args);const x=y.parentToolCallId?r.get(y.parentToolCallId):void 0,k=r.get(y.callId);if(k){fY(k,y);break}if(x){T_t(x,y),r.set(y.callId,y);break}uN(n,g.id,y,b),r.set(y.callId,y),l=null,c=null,u=!0;break}case"shell":{const w=g,y=n[n.length-1];if(y&&y.role==="tool_group"){const v=E_t(y.tools),x=y.tools[v];if(x){const k=typeof x.rawOutput=="string"?x.rawOutput:"",_={...x,rawOutput:k+w.text};n[n.length-1]={...y,tools:[...y.tools.slice(0,v),_,...y.tools.slice(v+1)]},r.get(x.callId)===x&&r.set(x.callId,_)}}else n.push({id:g.id,role:"tool_group",tools:[{callId:g.id,toolName:"shell",status:"completed",kind:"execute",rawOutput:w.text}],timestamp:b}),u=!0;break}case"user_shell":{const w=g;n.push({id:g.id,role:"user_shell",command:w.command,output:w.text,...w.cwd?{cwd:w.cwd}:{},timestamp:b}),u=!0;break}case"permission":{const w=g;L_t(w,i);const y=D_t(w);if(!y)break;const v=Afe(y);if(!w.resolved)break;const x=r.get(y.callId);if(x){const k=x.status,_=x.endTime;y.toolName=x.toolName,w.resolved&&(dN(w.resolved)?y.status=v?y.status:"in_progress":(y.status="failed",y.endTime=w.updatedAt)),fY(x,y),(A_t(k)||w.resolved&&v&&dN(w.resolved))&&(x.status=k,x.endTime=_);break}if(w.resolved){dN(w.resolved)?(v||(y.status="in_progress"),uN(n,g.id,y,b),r.set(y.callId,y),u=!0):(y.status="failed",y.endTime=w.updatedAt,uN(n,g.id,y,b),r.set(y.callId,y),u=!0);break}break}case"status":case"debug":{const w=g,y=w.source==="session_branched"?k_t(w.data):null,v=w.source==="mid_turn_message_injected"?__t(w.data):null,x=y&&((f=t.labels)!=null&&f.branchSuccess)?t.labels.branchSuccess(y):v&&((m=t.labels)!=null&&m.midTurnInserted)?t.labels.midTurnInserted(v):w.text;if(v_t(x))break;const k=N_t(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,...w.source?{source:w.source}:{},...w.data!==void 0?{data:w.data}:{}}),u=!0;break}case"error":{const w=g,y=w.errorKind;n.push({id:g.id,role:"system",content:w_t(w,t.labels),variant:"error",retryable:w.source==="turn_error",timestamp:b,...w.source?{source:w.source}:{},...x_t(w.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 T_t(e,t){e.subTools||(e.subTools=[]),e.subTools.push(t)}function hY(e,t){e.subContent=(e.subContent||"")+t}function uN(e,t,n,s){const r=o=>Afe(o)||fm(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 E_t(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 fY(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 A_t(e){return e==="completed"||e==="failed"}function Afe(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||j_t(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function j_t(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function N_t(e){const t=e.startsWith("plan: ")?e.slice(6):void 0;if(t)try{const n=JSON.parse(t),s=Xo(n);return(s==null?void 0:s.sessionUpdate)!=="plan"||!Array.isArray(s.entries)?void 0:S_t(s.entries)}catch{return}}function Xo(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function el(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function I_t(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function M_t(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function R_t(e){const t=O_t(e),n=P_t(e,t),s=$_t(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:Nfe(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 D_t(e){const t=Xo(e.toolCall);if(!t)return;const n=jfe(t);if(Array.isArray(n==null?void 0:n.questions))return;const s=Xo(t._meta),r=el(t,"kind"),i=el(s,"toolName")??el(t,"toolName")??el(t,"name")??(n!=null&&n.subagent_type?"agent":void 0)??(r==="fetch"?"web_fetch":r),o=el(t,"toolCallId")??el(t,"id");return!o||!i?void 0:{callId:o,toolName:i,title:el(t,"title")??e.title,status:"pending",kind:Nfe(i,r),args:n,startTime:e.createdAt}}function L_t(e,t){const n=Xo(e.toolCall),s=el(n,"toolCallId")??el(n,"id");if(!s)return;const r=el(n,"title")??e.title,i=n?jfe(n):void 0;Array.isArray(i==null?void 0:i.questions)&&t.set(s,{...r?{title:r}:{},...i?{args:i}:{}})}function dN(e){const[t="",n=""]=e.toLowerCase().split(":",2);return mY(t)?!0:t!=="selected"?!1:mY(n.trim())}function mY(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_once_and_switch_to_default"||e==="proceed_always_project"||e==="proceed_always_user"||e==="allow_once"||e==="allow_always"||e==="success"||e==="succeeded"}function jfe(e){return Xo(e.rawInput)??Xo(e.input)??Xo(e.args)}function P_t(e,t){var r;const n=(r=e.toolName)==null?void 0:r.toLowerCase();if(n!=="agent"&&n!=="task")return!1;const s=Xo(t);return(s==null?void 0:s.status)==="background"}function O_t(e){return B_t(e)&&e.status==="failed"?z_t(e)??e.details??e.rawOutput:!F_t(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 $_t(e){if(!Array.isArray(e))return;const t=e.flatMap(n=>{const s=Xo(n);if(!s)return[];const r=s.type;if(r==="content"){const i=Xo(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,l=s.oldText;return[{type:"diff",...typeof o=="string"?{path:o}:{},...typeof l=="string"?{oldText:l}:{},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 B_t(e){if(!e.toolName)return!1;const t=e.toolName.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function z_t(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 F_t(e){return e==="cancelled"||e==="canceled"}const q_t=['"insight_progress":','"insight_ready":','"insight_error":'];function H_t(e){try{const t=JSON.parse(e),n=Xo(t.insight_progress);if(n&&typeof n.stage=="string"&&typeof n.progress=="number")return{type:"insight_progress",stage:n.stage,progress:n.progress,detail:typeof n.detail=="string"?n.detail:void 0};const s=Xo(t.insight_ready);if(s&&typeof s.path=="string")return{type:"insight_ready",path:s.path};const r=Xo(t.insight_error);if(r&&typeof r.error=="string")return{type:"insight_error",error:r.error}}catch{}return null}function U_t(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 W_t(e){const t=[];let n=0,s=0,r=!1;for(;s<e.length;){const o=e.indexOf("{",s);if(o===-1)break;const l=e.slice(o+1).trimStart();if(!q_t.some(m=>l.startsWith(m))){s=o+1;continue}const u=U_t(e,o);if(!u){s=o+1;continue}const d=H_t(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 Nfe(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 V_t(e,t){return C_t(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 Ife(e){return e==="pending"||e==="in_progress"||e==="running"}function gO(e){return e==="completed"||e==="failed"||e==="cancelled"||e==="canceled"}function pY(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}function G_t(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t];if(n.kind!=="assistant")continue;const s=pY(n.meta),r=pY(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"&&gO(i))return`${n.id}:${i}`}return""}function K_t(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const s of n.tools)Ife(s.status)&&yd(s)&&t.push(s.callId);return t.join("|")}function Y_t(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(l=>{const c=t.get(l.callId);if(!c||!gO(c.status)||!Ife(l.status)||!yd(l))return l;i=!0;const u=c.status==="cancelled"||c.status==="canceled",d=c.status==="failed"?"failed":"completed";return{...l,status:d,...l.startTime!==void 0?{endTime:l.startTime+(c.durationMs??0)}:{},...u?{rawOutput:{...typeof l.rawOutput=="object"&&l.rawOutput!==null&&!Array.isArray(l.rawOutput)?l.rawOutput:{},status:"cancelled"}}:{}}});return i?(n=!0,{...r,tools:o}):r});return n?s:e}function bO(e,t){const n=Co(),s=za(),r=h.useMemo(()=>V_t(t,e),[t,e]),i=h.useMemo(()=>K_t(r),[r]),o=h.useMemo(()=>G_t(t),[t]),[l,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 w=>{const y=await n.client.resolveSubagentSession(d,w);return[w,y]})).then(w=>{const y=new Map;return w.forEach(v=>{v.status==="fulfilled"&&gO(v.value[1].status)&&y.set(...v.value)}),y});u.current={key:f,request:g};let b=!0;return g.then(w=>{b&&c(y=>({sessionId:d,resolutions:new Map([...(y==null?void 0:y.sessionId)===d?y.resolutions:[],...w])}))}).catch(()=>{var w;((w=u.current)==null?void 0:w.request)===g&&(u.current=void 0)}),()=>{b=!1}},[o,s.catchingUp,s.loadingTranscript,s.sessionId,s.status,i,n.client]),h.useMemo(()=>!l||l.sessionId!==s.sessionId?r:Y_t(r,l.resolutions),[s.sessionId,r,l])}function Mfe(e){const t=nD();return bO(e,t)}const X_t="session_artifacts";function yO(){var _,T;const e=rm(),t=za(),n=yee(),s=Nh(),r=s==null?void 0:s.artifactsVersion,i=t.status==="connected",o=((T=(_=t.capabilities)==null?void 0:_.features)==null?void 0:T.includes(X_t))??!1,l=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),w=h.useRef(n),y=h.useRef(r),v=h.useCallback(async()=>{const S=g.current+1;if(g.current=S,!l){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!==l&&u([]),f(!0);try{const C=await e.loadArtifacts();if(g.current!==S)return;b.current=l,u(C.artifacts),p(null)}catch{if(g.current!==S)return;p(null)}finally{g.current===S&&f(!1)}},[e,i,l,o]),x=h.useRef(v);x.current=v,h.useEffect(()=>{v()},[v]),h.useEffect(()=>{const S=w.current;w.current=n,S!=="idle"&&n==="idle"&&x.current()},[n]),h.useEffect(()=>{const S=y.current;y.current=r,S!==void 0&&r!==void 0&&r!==S&&x.current()},[r]);const k=h.useMemo(()=>new Map(c.map(S=>[S.id,S])),[c]);return{artifacts:c,artifactById:k,loading:d,error:m,refresh:v}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Q_t(e,t,n,s){var l;const r=[...e],i=c=>!c.images||c.images.length===0;let o=!1;for(const c of t)if(c.sessionId===n&&!(c.originatorClientId!==void 0&&c.originatorClientId!==s))for(const[u,d]of c.messages.entries()){const f=(l=c.messageIds)==null?void 0:l[u];let m=f!==void 0?r.findIndex(p=>p.midTurnState!==void 0&&p.midTurnMessageId===f&&i(p)):-1;m<0&&(m=r.findIndex(p=>p.midTurnState!==void 0&&(f===void 0||p.midTurnState==="submitting"&&p.midTurnMessageId===void 0)&&p.text===d&&i(p))),m>=0&&(r.splice(m,1),o=!0)}return o?r:null}function J_t(e,t,n,s){return e?!0:(s.append(t),!1)}function Z_t(e){const t=e.trimStart();return t.startsWith("/")||t.startsWith("!")}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const eSt=100;function tSt(e,t){return e.trim()?e===t||e.startsWith(`${t}
`)?e:`${t}
${e}`:t}function gY(e,t){return e.length!==t.length?!1:e.every((n,s)=>{var i,o,l,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.midTurnState===r.midTurnState&&n.midTurnMessageId===r.midTurnMessageId&&n.midTurnFailedAction===r.midTurnFailedAction&&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)&&(((l=n.inputAnnotations)==null?void 0:l.length)??0)===(((c=r.inputAnnotations)==null?void 0:c.length)??0)})}function bY(e){if(!(!e||e.length===0))return e.map(t=>({data:t.data,mimeType:t.media_type||"image/*"}))}function Rfe({connected:e,sessionId:t,clientId:n,canMutateMidTurn:s,streamingState:r,sessionActions:i,store:o,editorRef:l,reportError:c,t:u}){const[d,f]=h.useState([]),m=h.useRef([]),p=h.useRef(1),g=h.useRef(t),b=h.useRef(null),w=h.useRef(new Set),y=h.useRef(new Set),v=h.useRef(new Set),x=h.useRef(new Map),k=h.useRef(new Set),_=h.useRef([]),T=h.useRef(r),S=h.useRef(0);g.current=t,T.current=r;const C=h.useMemo(()=>d.map(Q=>Q.text),[d]);h.useEffect(()=>{m.current=d},[d]),h.useEffect(()=>{var Q;m.current=[],f([]),x.current.clear(),k.current.clear(),_.current=[];for(const ne of w.current)ne.abort();w.current.clear(),y.current.clear(),v.current.clear(),L.current=void 0,(Q=b.current)==null||Q.abort(),b.current=null},[t]);const N=h.useCallback((Q,ne)=>{const de=m.current.filter(ue=>ue.serverPromptId?Q.some(me=>me.promptId===ue.serverPromptId):!0);for(const ue of Q){if(y.current.has(ue.promptId))continue;const me=de.findIndex(be=>be.serverPromptId===ue.promptId),te=v.current.has(ue.promptId);if(me!==-1){if(te){de.splice(me,1);continue}de[me]={...de[me],text:ue.text,serverState:ue.state};continue}const ae=de.filter(be=>!be.serverPromptId&&be.serverState==="submitting"&&be.text===ue.text);if(ae.length===1){const be=de.indexOf(ae[0]);if(te){de.splice(be,1);continue}de[be]={...ae[0],serverPromptId:ue.promptId,serverState:ue.state};continue}ue.state==="running"||te||de.push({id:p.current++,sessionId:ne,text:ue.text,serverPromptId:ue.promptId,serverState:ue.state})}gY(m.current,de)||(m.current=de,f(de))},[]),E=h.useCallback(async(Q=t)=>{if(!e||!Q||g.current!==Q)return"skipped";const ne=++S.current;try{const de=await i.getPendingPrompts({sessionId:Q});return ne!==S.current?"superseded":g.current!==Q?"skipped":(N(de.pendingPrompts.filter(ue=>ue.state==="queued"||ue.state==="running"),Q),"refreshed")}catch(de){return console.warn("Failed to refresh pending prompts",de),"failed"}},[e,i,t,N]),O=h.useCallback(Q=>{const ne=g.current,de=Q.filter(ae=>ae.sessionId===void 0||ae.sessionId===ne);if(de.length===0)return;const ue=new Set(m.current.map(ae=>ae.id)),me=de.filter(ae=>!ue.has(ae.id));if(me.length===0)return;const te=[...m.current,...me].sort((ae,be)=>ae.id-be.id);m.current=te,f(te)},[]),B=h.useCallback((Q,ne,de)=>{var te,ae,be,se;if(de!==void 0&&g.current!==de)return;const ue=((te=l.current)==null?void 0:te.getText())??"",me=tSt(ue,Q);me!==ue&&((ae=l.current)==null||ae.setText(me),ne&&ne.length>0&&((be=l.current)==null||be.restoreImages(ne))),(se=l.current)==null||se.focus()},[l]),D=h.useSyncExternalStore(vwe,ywe),j=h.useRef(D),L=h.useRef(void 0);h.useEffect(()=>{if(!e||!t)return;const Q=j.current!==D;if(j.current=D,!Q){if(m.current.length>0||r==="idle"||L.current===t)return;L.current=t}E()},[D,e,t,r,E]);const z=h.useSyncExternalStore(wwe,UF,UF);h.useEffect(()=>{var ne;if(!t||z.length===0)return;const Q=[];for(const de of z){if(de.data.sessionId!==t)continue;Q.push(de);const ue=de.data.promptId;if(ue){if(de.type==="pending_prompt_started"){if(y.current.has(ue))continue;if((de.originatorClientId===void 0||de.originatorClientId===n)&&!v.current.has(ue)){const te=typeof de.data.text=="string"?de.data.text:"",ae=m.current.find(se=>se.serverPromptId===ue)??m.current.find(se=>!se.serverPromptId&&se.serverState==="submitting"&&se.text===te),be=(ae==null?void 0:ae.text)??"";be&&(v.current.add(ue),o.appendLocalUserMessage(be,bY(ae==null?void 0:ae.images),(ne=ae==null?void 0:ae.inputAnnotations)!=null&&ne.length?{inputAnnotations:ae.inputAnnotations}:void 0))}E()}else if(de.type==="turn_complete"){v.current.delete(ue);const me=x.current.get(ue);if(x.current.delete(ue),me)me();else if(!k.current.has(ue))for(k.current.add(ue),_.current.push(ue);_.current.length>eSt;){const te=_.current.shift();te&&k.current.delete(te)}}else if(de.type==="turn_error"||de.type==="pending_prompt_completed"&&de.data.state==="removed"){v.current.delete(ue);const me=x.current.get(ue);x.current.delete(ue),me==null||me(),k.current.delete(ue),_.current=_.current.filter(te=>te!==ue)}}}kwe(Q)},[z,t,n,o,E]);const I=h.useCallback((Q,ne)=>{if(k.current.delete(Q)){_.current=_.current.filter(de=>de!==Q),ne();return}x.current.set(Q,ne)},[]),$=h.useCallback(Q=>{const{id:ne,sessionId:de}=Q,ue=new AbortController;w.current.add(ue),i.submitPrompt(Q.text,{images:Q.images,inputAnnotations:Q.inputAnnotations,optimisticUserMessage:!1,sessionId:de,signal:ue.signal}).then(me=>{var se;if(w.current.delete(ue),g.current!==de){i.removePendingPrompt(me.promptId,{sessionId:de}).catch(ve=>{console.warn("[useQueuedPrompts] cleanup removePendingPrompt failed after session change",{targetSessionId:de,promptId:me.promptId,error:ve})});return}if(T.current==="idle"){v.current.has(me.promptId)||(v.current.add(me.promptId),o.appendLocalUserMessage(Q.text,bY(Q.images),(se=Q.inputAnnotations)!=null&&se.length?{inputAnnotations:Q.inputAnnotations}:void 0));const ve=m.current.filter(ze=>ze.id!==ne);m.current=ve,f(ve),Q.onComplete&&I(me.promptId,Q.onComplete);return}const te=m.current,ae=te.findIndex(ve=>ve.id===ne);if(ae===-1){i.removePendingPrompt(me.promptId,{sessionId:de}).then(ve=>{ve.removed||E(de)},()=>{E(de)});return}const be=[...te];be[ae]={...be[ae],serverPromptId:me.promptId,serverState:"queued"},m.current=be,f(be),Q.onComplete&&I(me.promptId,Q.onComplete)}).catch(me=>{if(w.current.delete(ue),g.current!==de||!m.current.some(ae=>ae.id===ne))return;const te=m.current.filter(ae=>ae.id!==ne);m.current=te,f(te),B(Q.text,Q.images,de),c(me,u("queue.queueFailed"))})},[E,c,B,i,I,o,u]),K=h.useCallback(Q=>{const ne=m.current,de=ne.findIndex(te=>te.id===Q&&te.midTurnState!==void 0);if(de===-1)return;const ue={...ne[de],midTurnState:void 0,midTurnMessageId:void 0,midTurnFailedAction:void 0,serverState:"submitting",isEditing:!1,isRemoving:!1},me=[...ne];me[de]=ue,m.current=me,f(me),$(ue)},[$]),R=h.useCallback((Q,ne,de,ue)=>{const me=Q.trim();if(!me)return!0;const te=g.current,ae=T.current!=="idle"&&((ne==null?void 0:ne.length)??0)===0&&((ue==null?void 0:ue.length)??0)===0&&!Z_t(me),be={id:p.current++,sessionId:te,text:me,images:ne?[...ne]:void 0,inputAnnotations:ue?[...ue]:void 0,onComplete:de,...ae?{midTurnState:"submitting"}:{serverState:"submitting"}};if(m.current=[...m.current,be],f(m.current),!ae)return $(be),!0;let se=b.current;return se||(se=new AbortController,b.current=se),i.enqueueMidTurnMessage(me,{signal:se.signal}).then(ve=>{var Pt;const ze=m.current,Pe=ze.findIndex(St=>St.id===be.id);if(Pe===-1||((Pt=ze[Pe])==null?void 0:Pt.midTurnState)===void 0||g.current!==te)return;if(!ve.accepted||T.current==="idle"){K(be.id);return}const _t=[...ze];_t[Pe]={...ze[Pe],midTurnState:"queued",midTurnMessageId:ve.messageId},m.current=_t,f(_t)}),!0},[K,i,$]),{batches:Y,consume:W}=exe();h.useEffect(()=>{var de;if(!t||Y.length===0)return;const Q=m.current,ne=Q_t(Q,Y,t,n);if(ne){const ue=new Set(ne.map(me=>me.id));for(const me of Q)ue.has(me.id)||(de=me.onComplete)==null||de.call(me);m.current=ne,f(ne)}W(Y.filter(ue=>ue.sessionId===t))},[Y,t,n,W]),h.useEffect(()=>{if(r!=="idle")return;const Q=b.current;Q&&(Q.abort(),b.current=null);for(const ne of m.current)if(ne.midTurnFailedAction){const de=m.current.filter(ue=>ue.id!==ne.id);m.current=de,f(de),ne.midTurnFailedAction==="edit"&&B(ne.text,ne.images,ne.sessionId)}else ne.midTurnState&&!ne.isEditing&&!ne.isRemoving&&K(ne.id)},[r,K,B]);const M=h.useCallback(Q=>{const ne=m.current;if(ne.length===0)return null;const de=Q===void 0?ne.length-1:ne.findIndex(te=>te.id===Q);if(de<0)return null;const ue=ne[de],me=ne.filter((te,ae)=>ae!==de);return m.current=me,f(me),(ue==null?void 0:ue.text)??null},[]),F=h.useCallback((Q,ne)=>{const de=m.current.map(ue=>ue.id===Q?{...ue,...ne}:ue);gY(de,m.current)||(m.current=de,f(de))},[]),J=h.useCallback(async(Q,ne,de)=>{if(!Q.serverPromptId)return!0;if(Q.serverState!=="queued"||y.current.has(Q.serverPromptId))return!1;const ue=Q.sessionId;y.current.add(Q.serverPromptId),F(Q.id,ne);try{const me=await i.removePendingPrompt(Q.serverPromptId,{sessionId:ue});return y.current.delete(Q.serverPromptId),me.removed?(x.current.delete(Q.serverPromptId),await E(ue)==="failed"&&(F(Q.id,{isEditing:!1,isRemoving:!1}),c(new Error("Queue changed but pending prompts could not refresh"),de)),!0):(F(Q.id,{isEditing:!1,isRemoving:!1}),await E(ue),c(new Error("Prompt could not be removed from queue"),de),!1)}catch(me){return y.current.delete(Q.serverPromptId),F(Q.id,{isEditing:!1,isRemoving:!1}),await E(ue)!=="refreshed"&&O([Q]),c(me,de),!1}},[E,c,O,i,F]),V=h.useCallback(async(Q,ne,de)=>{if(Q.midTurnState!=="queued"||!Q.midTurnMessageId||!s||Q.isEditing||Q.isRemoving)return!1;const ue=ne.isEditing?"edit":"delete";F(Q.id,{...ne,midTurnFailedAction:void 0});try{const me=await i.removeMidTurnMessage(Q.midTurnMessageId,{sessionId:Q.sessionId}),te=m.current,ae=te.find(se=>se.id===Q.id);if(!ae)return me.removed;if(ae.midTurnState!=="queued"||ae.midTurnMessageId!==Q.midTurnMessageId)return!1;if(!me.removed){const se=T.current==="idle";if(se){const ve=te.filter(ze=>ze.id!==Q.id);m.current=ve,f(ve)}else F(Q.id,{isEditing:!1,isRemoving:!1,midTurnFailedAction:ue});return c(new Error("Message is no longer in the mid-turn queue"),de),se}const be=te.filter(se=>se.id!==Q.id);return m.current=be,f(be),!0}catch(me){const te=m.current.find(ae=>ae.id===Q.id);if((te==null?void 0:te.midTurnMessageId)===Q.midTurnMessageId){const ae=T.current==="idle";if(ae){const be=m.current.filter(se=>se.id!==Q.id);m.current=be,f(be)}else F(Q.id,{isEditing:!1,isRemoving:!1,midTurnFailedAction:ue});return c(me,de),ae}return!1}},[s,c,i,F]),U=h.useCallback(Q=>{const ne=m.current.find(de=>de.id===Q);if(!((ne==null?void 0:ne.serverState)==="submitting"||(ne==null?void 0:ne.midTurnState)==="submitting")&&ne){if(ne.midTurnState){V(ne,{isRemoving:!0},u("queue.deleteFailed"));return}if(!ne.serverPromptId){const de=m.current.filter(ue=>ue.id!==Q);m.current=de,f(de);return}J(ne,{isRemoving:!0},u("queue.deleteFailed"))}},[V,J,u]),le=h.useCallback(async Q=>{const ne=m.current.find(ue=>ue.id===Q);if(!ne||ne.serverState==="submitting"||ne.isEditing||ne.isRemoving)return;if(ne.midTurnState){await V(ne,{isEditing:!0},u("queue.editFailed"))&&B(ne.text,ne.images,ne.sessionId);return}if(ne.serverPromptId){if(!await J(ne,{isEditing:!0},u("queue.editFailed")))return;B(ne.text,ne.images,ne.sessionId);return}const de=M(Q);de&&B(de,ne.images,ne.sessionId)},[M,V,J,B,u]),pe=h.useCallback(()=>{const Q=m.current;if(Q.length===0)return!1;const ne=Q[Q.length-1];if(!ne)return!1;if(ne.serverState==="submitting"||ne.midTurnState==="submitting"||ne.midTurnState==="queued"&&!ne.midTurnMessageId||ne.isEditing||ne.isRemoving)return!0;if(ne.midTurnState==="queued")return le(ne.id),!0;if(!ne.serverPromptId){const de=M(ne.id);return de?(B(de,ne.images,ne.sessionId),!0):!1}return ne.serverState!=="queued"?!1:((async()=>{await J(ne,{isEditing:!0},u("queue.editFailed"))&&B(ne.text,ne.images,ne.sessionId)})().catch(de=>{c(de,u("queue.editFailed"))}),!0)},[M,le,J,c,B,u]),fe=h.useCallback(()=>{if(m.current.length===0)return!1;const Q=g.current,ne=m.current.filter(se=>se.midTurnState!==void 0),de=m.current.filter(se=>se.midTurnState===void 0&&se.serverState==="submitting"),ue=m.current.filter(se=>se.midTurnState===void 0&&se.serverState!=="submitting");for(const se of[...de].reverse())B(se.text,se.images,se.sessionId);for(const se of w.current)se.abort();const me=ue.filter(se=>se.serverPromptId);if(me.length===0){m.current=ne,f(ne);const se=de.length>0||ue.length>0;return se&&o.dispatch([{type:"status",text:u("queue.cleared")}]),se}const te=new Set(m.current.filter(se=>se.midTurnState===void 0).map(se=>se.id)),ae=new Set(me.map(se=>se.serverPromptId).filter(se=>!!se));for(const se of ae)y.current.add(se);const be=m.current.filter(se=>!te.has(se.id)).concat(me.map(se=>({...se,isRemoving:!0})));return m.current=be,f(be),(async()=>{var Pe;const se=[];if(await Promise.all(me.map(async _t=>{const Pt=_t.serverPromptId;try{if((await i.removePendingPrompt(Pt,{sessionId:_t.sessionId})).removed){x.current.delete(Pt);return}se.push(_t)}catch{se.push(_t)}finally{y.current.delete(Pt)}})),g.current!==Q)return;const ve=se.map(_t=>({..._t,isRemoving:!1})),ze=m.current.filter(_t=>_t.serverPromptId?!ae.has(_t.serverPromptId):!te.has(_t.id)).concat(ve);if(m.current=ze,f(ze),se.length>0){c(new Error("Some prompts could not be removed from queue"),u("queue.deleteFailed")),E((Pe=se[0])==null?void 0:Pe.sessionId);return}o.dispatch([{type:"status",text:u("queue.cleared")}])})(),!0},[E,c,B,o,u,i]);return{queuedPrompts:d,queuedTexts:C,enqueuePrompt:R,removeQueuedPrompt:U,editQueuedPrompt:le,editLastQueuedPrompt:pe,clearQueuedPrompts:fe}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function AR(e){var t;return!((t=e==null?void 0:e.rawInput)!=null&&t.questions)||!Array.isArray(e.rawInput.questions)?!1:e.toolName?jd(e.toolName):!0}const nSt=3e4;function H3(e){return pv.includes(e)}async function sSt({sessionActions:e,modelId:t,modeId:n,workspaceCwd:s,worktree:r,branch:i,onSessionCreated:o,onSessionAllocated:l,getCurrentSessionId:c,warn:u=console.warn}){const d=n&&H3(n)?n:void 0,{sessionId:f,worktree:m,branch:p}=await e.createSession({workspaceCwd:s,sourceType:sh,...d?{approvalMode:d}:{},...r?{worktree:r}:{},...i?{branch:i}:{}});l==null||l(f);let g="prepare new session";try{if(o){g="run onSessionCreated";let y;try{await Promise.race([o(f),new Promise((v,x)=>{y=setTimeout(()=>x(new Error("onSessionCreated timed out")),nSt)})])}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 w=c();if(w!==void 0&&w!==f)throw new Error(`Session changed while attaching: expected ${f}, found ${w}`)}catch(b){u(`[WebShell] failed to ${g}:`,b),await e.releaseSession(f).catch(y=>{u("[WebShell] failed to release unattached session:",y)});const w=c();throw w===void 0||w===f?await e.clearSession().catch(y=>{u("[WebShell] failed to clear unattached session:",y)}):u(`[WebShell] skipping clearSession: expected ${f}, found ${w}`),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 rSt=new Set(["coder-model(qwen-oauth)"]);function Sx(e){return!rSt.has(e.id)}function iSt({catchingUp:e,pendingApproval:t,isPreparingPrompt:n}){return!!(e||t||n)}function Dfe({catchingUp:e,isPreparingPrompt:t,isStreaming:n}){return e?"loading":t||n?"processing":"idle"}function oSt(e){switch(Dfe(e)){case"loading":return"common.loading";case"processing":return"editor.processing";case"idle":return"editor.placeholder"}}function Lfe({connectionStatus:e,hasSession:t,restartSseOnPrompt:n}){return e==="error"?!0:e==="disconnected"&&(!n||!t)}const Pfe=/^\/([\w-]+)(?=\s|$)/;function Ofe(e,t,n){if(!t)return!1;const s=e.match(Pfe);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 jR=["blue","green","purple","orange","yellow","red"];for(const e of jR){if(cO[e])continue;const t=`WorkspaceAccent.module.css is missing a class for the "${e}" accent`;console.error(t)}function aSt(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)}function lSt(e,t){if(!e)return;const s=((t==null?void 0:t.workspaces)??[]).findIndex(i=>i.cwd===e),r=s>=0?s:aSt(e);return jR[r%jR.length]}function $fe(e,t={}){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:t.sideTaskAvailable?"[side] <your question>":"<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(s=>({...s,source:"builtin-command"}))}const cSt={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"},uSt={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 Bfe(e){return uSt[e]}function zfe(e,t){return e.map(n=>{const s=cSt[n.name];return!s||n.source&&n.source!=="builtin-command"?n:{...n,description:t(s)}})}function Ffe(...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 dSt="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",hSt="/assets/queue-DWpnpFgW.svg",fSt="_app_1eg5b_1",mSt="_appChat_1eg5b_43",pSt="_appChatEmpty_1eg5b_49",gSt="_appShell_1eg5b_54",bSt="_contextShell_1eg5b_62",ySt="_chatHeaderRow_1eg5b_71",vSt="_customChatHeader_1eg5b_80",wSt="_contextBody_1eg5b_85",xSt="_contextBodyWithEnvironmentPanel_1eg5b_94",kSt="_chatPane_1eg5b_94",_St="_content_1eg5b_95",SSt="_artifactResizeHandle_1eg5b_114",CSt="_artifactPanelDock_1eg5b_131",TSt="_artifactPanelClip_1eg5b_139",ESt="_chatPaneShowingPage_1eg5b_167",ASt="_fullPage_1eg5b_173",jSt="_fullPageHeader_1eg5b_182",NSt="_splitApprovalNotice_1eg5b_192",ISt="_fullPageBack_1eg5b_218",MSt="_fullPageTitle_1eg5b_235",RSt="_fullPageBody_1eg5b_240",DSt="_mobileDrawer_1eg5b_247",LSt="_mobileBackdrop_1eg5b_251",PSt="_mobileDrawerForced_1eg5b_258",OSt="_hamburgerButton_1eg5b_286",$St="_mobileDrawerOpen_1eg5b_331",BSt="_hamburgerButtonFloating_1eg5b_366",zSt="_appWithSidebar_1eg5b_374",FSt="_themeDark_1eg5b_384",qSt="_themeLight_1eg5b_458",HSt="_contentHasMessages_1eg5b_540",USt="_missingSessionState_1eg5b_549",WSt="_missingSessionMessage_1eg5b_562",VSt="_missingSessionButton_1eg5b_569",GSt="_panelHost_1eg5b_604",KSt="_panelHeader_1eg5b_612",YSt="_panelBack_1eg5b_622",XSt="_panelTitle_1eg5b_648",QSt="_panelBody_1eg5b_657",JSt="_chatViewWrap_1eg5b_669",ZSt="_chatViewHidden_1eg5b_677",e2t="_chatSubtree_1eg5b_681",t2t="_chatSubtreeHidden_1eg5b_685",n2t="_footer_1eg5b_704",s2t="_bottomPanels_1eg5b_714",r2t="_approvalOverlay_1eg5b_729",i2t="_scrollToBottomLayer_1eg5b_743",o2t="_scrollToBottomLayerWithTodos_1eg5b_754",a2t="_scrollToBottomButton_1eg5b_761",l2t="_scrollToBottomIcon_1eg5b_790",c2t="_btwPanel_1eg5b_796",u2t="_composer_1eg5b_803",d2t="_composerHeader_1eg5b_808",h2t="_customFooter_1eg5b_812",f2t="_escClearStatus_1eg5b_818",m2t="_composerActionTip_1eg5b_825",p2t="_composerActionTipIcon_1eg5b_835",g2t="_composerActionTipText_1eg5b_842",b2t="_composerActionTipActions_1eg5b_849",y2t="_composerActionTipButton_1eg5b_855",v2t="_composerActionTipButtonPrimary_1eg5b_872",w2t="_emptyWelcomeFooter_1eg5b_891",x2t="_mobileWelcomeFooterMiddle_1eg5b_895",k2t="_mobileWelcomeGroup_1eg5b_899",_2t="_chatPaneWithMobileComposerBottom_1eg5b_904",S2t="_chatViewWithMobileComposerBottom_1eg5b_909",C2t="_chatViewWithWelcomeMiddle_1eg5b_922",T2t="_footerWithCustomFooter_1eg5b_922",E2t="_desktopWelcomeFooter_1eg5b_956",A2t="_queuedPrompts_1eg5b_965",j2t="_queuedPrompt_1eg5b_965",N2t="_queuedPromptIcon_1eg5b_996",I2t="_queuedPromptMaskIcon_1eg5b_1006",M2t="_queuedPromptActionIcon_1eg5b_1007",R2t="_queuedPromptText_1eg5b_1020",D2t="_queuedPromptState_1eg5b_1028",L2t="_queuedPromptSpinner_1eg5b_1038",P2t="_queuedPromptActions_1eg5b_1053",O2t="_queuedPromptAction_1eg5b_1007",$2t="_queuedPromptStateLabel_1eg5b_1085",B2t="_queuedPromptStateLoading_1eg5b_1089",z2t="_queuedHint_1eg5b_1108",Lt={app:fSt,appChat:mSt,appChatEmpty:pSt,appShell:gSt,contextShell:bSt,chatHeaderRow:ySt,customChatHeader:vSt,contextBody:wSt,contextBodyWithEnvironmentPanel:xSt,chatPane:kSt,content:_St,artifactResizeHandle:SSt,artifactPanelDock:CSt,artifactPanelClip:TSt,chatPaneShowingPage:ESt,fullPage:ASt,fullPageHeader:jSt,splitApprovalNotice:NSt,fullPageBack:ISt,fullPageTitle:MSt,fullPageBody:RSt,mobileDrawer:DSt,mobileBackdrop:LSt,mobileDrawerForced:PSt,hamburgerButton:OSt,mobileDrawerOpen:$St,hamburgerButtonFloating:BSt,appWithSidebar:zSt,themeDark:FSt,themeLight:qSt,contentHasMessages:HSt,missingSessionState:USt,missingSessionMessage:WSt,missingSessionButton:VSt,panelHost:GSt,panelHeader:KSt,panelBack:YSt,panelTitle:XSt,panelBody:QSt,chatViewWrap:JSt,chatViewHidden:ZSt,chatSubtree:e2t,chatSubtreeHidden:t2t,footer:n2t,bottomPanels:s2t,approvalOverlay:r2t,scrollToBottomLayer:i2t,scrollToBottomLayerWithTodos:o2t,scrollToBottomButton:a2t,scrollToBottomIcon:l2t,btwPanel:c2t,composer:u2t,composerHeader:d2t,customFooter:h2t,escClearStatus:f2t,composerActionTip:m2t,composerActionTipIcon:p2t,composerActionTipText:g2t,composerActionTipActions:b2t,composerActionTipButton:y2t,composerActionTipButtonPrimary:v2t,emptyWelcomeFooter:w2t,mobileWelcomeFooterMiddle:x2t,mobileWelcomeGroup:k2t,chatPaneWithMobileComposerBottom:_2t,chatViewWithMobileComposerBottom:S2t,chatViewWithWelcomeMiddle:C2t,footerWithCustomFooter:T2t,desktopWelcomeFooter:E2t,queuedPrompts:A2t,queuedPrompt:j2t,queuedPromptIcon:N2t,queuedPromptMaskIcon:I2t,queuedPromptActionIcon:M2t,queuedPromptText:R2t,queuedPromptState:D2t,queuedPromptSpinner:L2t,queuedPromptActions:P2t,queuedPromptAction:O2t,queuedPromptStateLabel:$2t,queuedPromptStateLoading:B2t,queuedHint:z2t},F2t=240;function q2t(e){var t,n;return((t=e.value)==null?void 0:t.trim())||((n=e.label)==null?void 0:n.trim())||e.id}function H2t(e,t){if(e.inputAnnotations&&e.inputAnnotations.length>0)return qee(e.text,e.inputAnnotations).map(s=>s.type==="text"?s:{type:"tag",tag:s.tag,preserveCustomKindLabel:!0});const n=fD(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 U2t(e){const t=[];let n=F2t,s=!1;for(const i of e){if(i.type==="tag"){if(n<=0){s=!0;break}const l=q2t(i.tag).length;if(l>n){s=!0;break}t.push(i),n-=l;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 qfe({prompts:e,t,canMutateMidTurn:n=!1,onDelete:s,onEdit:r}){const{parseUserMessageContent:i,composerTagIcons:o,renderComposerTag:l,renderComposerTagTooltip:c,onComposerTagClick:u}=Vu();if(e.length===0)return null;const d=e[e.length-1],f=d!==void 0&&d.midTurnState===void 0&&d.serverState!=="submitting"&&d.serverState!=="running"&&!d.isEditing&&!d.isRemoving;return a.jsxs("div",{className:Lt.queuedPrompts,children:[e.map(m=>{var E;const p=U2t(H2t(m,i)),g=((E=m.images)==null?void 0:E.length)??0,b=m.serverState==="submitting",w=m.serverState==="queued",y=m.serverState==="running",v=m.midTurnState!==void 0,x=m.midTurnState==="submitting"||m.midTurnState==="queued"&&!m.midTurnMessageId,k=!v||n,_=m.isRemoving===!0,T=b||m.midTurnState==="submitting"||m.isEditing===!0||_,S=b||y||x||m.isEditing===!0||_;let C=t("queue.editTip");S&&(C=t("queue.submittingDisabled"));const N=t(S?"queue.submittingDisabled":"queue.deleteTip");return a.jsxs("div",{className:Lt.queuedPrompt,children:[a.jsx("span",{className:Lt.queuedPromptIcon,"aria-hidden":"true",children:a.jsx("span",{className:Lt.queuedPromptMaskIcon,style:$g("--queued-icon-url",hSt)})}),a.jsxs("span",{className:Lt.queuedPromptText,children:[p.parts.map((O,B)=>O.type==="text"?a.jsx(h.Fragment,{children:O.text},B):a.jsx(qP,{tag:O.tag,composerTagIcons:o,renderComposerTag:l,renderComposerTagTooltip:c,onComposerTagClick:u,preserveCustomKindLabel:O.preserveCustomKindLabel},`${O.tag.id}:${B}`)),p.truncated?"...":null,g>0?` ${t("queue.imageCount",{count:g})}`:""]}),b||w||v||m.isEditing||_?a.jsxs("span",{className:`${Lt.queuedPromptState}${T?` ${Lt.queuedPromptStateLoading}`:""}`,role:"status",children:[T&&a.jsx("span",{className:Lt.queuedPromptSpinner}),a.jsx("span",{className:Lt.queuedPromptStateLabel,children:_?t("queue.removing"):m.isEditing?t("queue.editing"):t(v?"queue.midTurnQueued":w?"queue.serverQueued":"queue.submitting")})]}):null,a.jsx("span",{className:Lt.queuedPromptActions,children:k?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:Lt.queuedPromptAction,onClick:()=>s(m.id),disabled:S,"aria-label":t("queue.delete"),title:N,children:a.jsx("span",{className:Lt.queuedPromptActionIcon,style:$g("--queued-icon-url",dSt),"aria-hidden":"true"})}),a.jsx("button",{type:"button",className:Lt.queuedPromptAction,onClick:()=>r(m.id),disabled:S,"aria-label":t("queue.edit"),title:C,children:a.jsx("span",{className:Lt.queuedPromptActionIcon,style:$g("--queued-icon-url",Jhe),"aria-hidden":"true"})})]}):null})]},m.id)}),f?a.jsx("div",{className:Lt.queuedHint,children:t("queue.footer")}):null]})}const W2t="_approval_1ylzr_1",V2t="_floating_1ylzr_18",G2t="_floatingWorkflow_1ylzr_31",K2t="_workflow_1ylzr_38",Y2t="_header_1ylzr_45",X2t="_icon_1ylzr_55",Q2t="_name_1ylzr_70",J2t="_desc_1ylzr_81",Z2t="_content_1ylzr_101",eCt="_planContent_1ylzr_119",tCt="_code_1ylzr_125",nCt="_codeBlock_1ylzr_133",sCt="_question_1ylzr_156",rCt="_options_1ylzr_168",iCt="_option_1ylzr_168",oCt="_optionPlain_1ylzr_203",aCt="_optionSecondary_1ylzr_213",lCt="_optionPrimary_1ylzr_220",cCt="_optionActive_1ylzr_231",uCt="_pointer_1ylzr_235",dCt="_num_1ylzr_239",hCt="_label_1ylzr_243",Bi={approval:W2t,floating:V2t,floatingWorkflow:G2t,workflow:K2t,header:Y2t,icon:X2t,name:Q2t,desc:J2t,content:Z2t,planContent:eCt,code:tCt,codeBlock:nCt,question:sCt,options:rCt,option:iCt,optionPlain:oCt,optionSecondary:aCt,optionPrimary:lCt,optionActive:cCt,pointer:uCt,num:dCt,label:hCt};function fCt(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 mCt(e){const t=[];for(const n of e.content)n.type==="text"&&n.text&&t.push(n.text);return t.join(`
`)}function pCt(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 gCt(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 bCt(e){var n;const t=(n=e.rawInput)==null?void 0:n.description;return typeof t=="string"&&t.trim()?t.trim():e.title}function yCt(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 yY(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 vCt(e){return e.map((t,n)=>({option:t,index:n})).sort((t,n)=>{const s=yY(t.option)-yY(n.option);return s===0?t.index-n.index:s}).map(({option:t})=>t)}function vY(e){if(e.id==="proceed_once_and_switch_to_default")return"approval.option.allowOnceAndSwitchToDefault";if(e.id==="restore_previous")return"approval.option.restorePrevious";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 wCt(e){const t=new Set;return e.filter(n=>t.has(n.id)?!1:(t.add(n.id),!0))}function xCt(e){return wCt(vCt(e))}function kCt(e){return e.kind==="allow_once"?Bi.optionPrimary:e.kind==="allow_always"?Bi.optionSecondary:e.kind==="reject_once"||e.kind==="reject_always"?Bi.optionPlain:Bi.optionSecondary}function Hfe({request:e,onConfirm:t,variant:n="inline",keyboardActive:s=!0,planTodos:r=[]}){var W;const{t:i}=nt(),o=h.useMemo(()=>xCt(e.options),[e.options]),l=h.useMemo(()=>yCt(o),[o]),c=h.useMemo(()=>{const M=new Map;for(const F of o){const J=vY(F);J&&M.set(J,(M.get(J)??0)+1)}return F=>{const J=vY(F);return J&&M.get(J)===1?i(J):F.label||(J?i(J):"")}},[o,i]),[u,d]=h.useState(l),f=h.useRef(e);f.current=e;const m=h.useRef(u);m.current=u;const p=h.useRef(!1),g=h.useRef(l);g.current=l;const b=h.useRef([]),w=h.useId(),y=h.useId(),v=h.useId(),x=h.useId();h.useEffect(()=>{p.current=!1,m.current=g.current,d(g.current)},[e.id]);const k=fCt(e.title),_=e.toolName||k.toolName||e.kind||"Tool",T=wd(_,i),S=bCt(e),C=mCt(e),N=h.useCallback(M=>{p.current||(p.current=!0,t(f.current.id,M))},[t]),E=h.useCallback(M=>{const F=b.current[M];F&&(document.activeElement===F&&F.blur(),F.focus())},[]),O=h.useRef(!1),B=h.useRef(e.id);h.useEffect(()=>{const M=O.current,F=B.current;if(O.current=s,B.current=e.id,!s)return;const J=e.id!==F;M&&!J||E(J?l:m.current)},[s,e.id,E,l]);const D=h.useCallback(M=>{const F=o.length,J=(m.current+M+F)%F;m.current=J,d(J),E(J)},[o.length,E]),j=h.useCallback(M=>{if(M.key!=="Escape"&&M.target instanceof Element&&M.target.closest("[data-plan-interactive]"))return;const F=o.length;if(M.key==="ArrowDown"||M.key==="j")M.preventDefault(),D(1);else if(M.key==="ArrowUp"||M.key==="k")M.preventDefault(),D(-1);else if(M.key==="Home")M.preventDefault(),m.current=0,d(0),E(0);else if(M.key==="End"){M.preventDefault();const J=F-1;m.current=J,d(J),E(J)}else if(M.key==="Escape"){M.preventDefault();const J=f.current.options.find(V=>V.kind==="reject_once"||V.kind==="reject_always");J&&N(J.id)}else if(M.key>="1"&&M.key<="9"){const J=parseInt(M.key,10)-1;J<F&&(M.preventDefault(),N(o[J].id))}},[o,D,N,E]),L=pCt(e),z=Nbe(e.toolName),I=gCt(e),$=!!(L&&I||C&&C!==e.title),K=e.toolKind==="switch_mode"&&((W=e.toolName)==null?void 0:W.toLowerCase())==="exit_plan_mode",R=r.length>0&&K,Y=z?i("approval.launchAgentQuestion"):L?i("approval.execQuestion",{tool:T}):i("approval.changeQuestion");return a.jsxs("div",{className:n==="floating"?`${Bi.approval} ${Bi.floating}${R?` ${Bi.floatingWorkflow}`:""}`:Bi.approval,"data-web-shell-permission-panel":!0,role:"alertdialog","aria-labelledby":w,"aria-describedby":[y,S?v:null,$?x:null].filter(Boolean).join(" "),onKeyDown:j,children:[a.jsxs("div",{className:Bi.header,children:[a.jsx("span",{className:Bi.icon,"aria-hidden":"true",children:"?"}),a.jsx("span",{className:Bi.name,id:w,children:T})]}),S&&a.jsx("div",{className:Bi.desc,id:v,title:S,children:S}),L&&I?a.jsx("div",{className:Bi.code,children:a.jsx("pre",{className:Bi.codeBlock,id:x,title:I,children:I})}):C&&C!==e.title?a.jsx("pre",{className:`${Bi.content}${K?` ${Bi.planContent}`:""}`,id:x,title:C,children:C}):null,R&&a.jsx("div",{className:Bi.workflow,children:a.jsx(uR,{todos:r,tools:[],tasks:[]})}),a.jsx("div",{className:Bi.question,id:y,children:Y}),a.jsx("div",{className:Bi.options,role:"radiogroup",children:o.map((M,F)=>{const J=F===u,V=c(M);return a.jsxs("button",{type:"button",ref:U=>{b.current[F]=U},className:`${Bi.option} ${kCt(M)} ${J?Bi.optionActive:""}`,"data-web-shell-permission-option":!0,"data-option-id":M.id,tabIndex:J?0:-1,role:"radio","aria-checked":J,"aria-keyshortcuts":F<9?String(F+1):void 0,onClick:()=>N(M.id),onFocus:()=>{m.current=F,d(F)},children:[a.jsx("span",{className:Bi.pointer,"aria-hidden":"true",children:J?"›":" "}),a.jsxs("span",{className:Bi.num,"aria-hidden":"true",children:[F+1,"."]}),a.jsx("span",{className:Bi.label,"data-web-shell-option-label":!0,children:V})]},M.id)})})]})}const _Ct="_question_171kf_1",SCt="_floating_171kf_18",CCt="_titleLine_171kf_30",TCt="_icon_171kf_38",ECt="_toolName_171kf_42",ACt="_toolDesc_171kf_46",jCt="_tabs_171kf_53",NCt="_topRight_171kf_63",ICt="_collapseButton_171kf_70",MCt="_collapseIcon_171kf_89",RCt="_collapseIconCollapsed_171kf_95",DCt="_collapsed_171kf_99",LCt="_tab_171kf_53",PCt="_tabActive_171kf_118",OCt="_text_171kf_135",$Ct="_description_171kf_143",BCt="_multiHint_171kf_151",zCt="_options_171kf_157",FCt="_option_171kf_157",qCt="_customTrigger_171kf_190",HCt="_optionActive_171kf_199",UCt="_optionSelected_171kf_200",WCt="_optionLabel_171kf_205",VCt="_pointer_171kf_210",GCt="_optionNum_171kf_214",KCt="_editIcon_171kf_231",YCt="_optionContent_171kf_263",XCt="_optionPlaceholder_171kf_279",QCt="_optionDesc_171kf_284",JCt="_customInput_171kf_291",ZCt="_actions_171kf_332",e4t="_button_171kf_340",t4t="_submitButton_171kf_366",n4t="_submitSpinner_171kf_375",s4t="_ignoreButton_171kf_380",qs={question:_Ct,floating:SCt,titleLine:CCt,icon:TCt,toolName:ECt,toolDesc:ACt,tabs:jCt,topRight:NCt,collapseButton:ICt,collapseIcon:MCt,collapseIconCollapsed:RCt,collapsed:DCt,tab:LCt,tabActive:PCt,text:OCt,description:$Ct,multiHint:BCt,options:zCt,option:FCt,customTrigger:qCt,optionActive:HCt,optionSelected:UCt,optionLabel:WCt,pointer:VCt,optionNum:GCt,editIcon:KCt,optionContent:YCt,optionPlaceholder:XCt,optionDesc:QCt,customInput:JCt,actions:ZCt,button:e4t,submitButton:t4t,submitSpinner:n4t,ignoreButton:s4t};function Ufe({request:e,onConfirm:t,onError:n,variant:s="inline",keyboardActive:r=!0}){const{t:i}=nt(),o=h.useMemo(()=>{var te;return Array.isArray((te=e.rawInput)==null?void 0:te.questions)?e.rawInput.questions:[]},[e.rawInput]),[l,c]=h.useState(0),[u,d]=h.useState(null),[f,m]=h.useState({}),[p,g]=h.useState({}),[b,w]=h.useState({}),[y,v]=h.useState(!1),[x,k]=h.useState(!1),[_,T]=h.useState(!1),S=h.useRef(!1),C=h.useRef(0),N=h.useRef([]),E=h.useRef(null),O=h.useRef(u);O.current=u;const B=h.useId(),D=h.useId();h.useEffect(()=>{const te=o[0];S.current=!1,C.current++,T(!1),k(!1),c(0),O.current=te!=null&&te.options.length?0:null,d(te!=null&&te.options.length?0:null),m(te&&!te.multiSelect&&te.options[0]?{0:te.options[0].label}:{}),g({}),w(te!=null&&te.multiSelect&&te.options[0]?{0:[te.options[0].label]}:{}),v(!1)},[o,e.id]);const j=o[l],L=(j==null?void 0:j.multiSelect)??!1,z=h.useCallback(()=>{const te={};for(let ae=0;ae<o.length;ae++){const be=o[ae];if(be)if(be.multiSelect){const se=b[ae]||[],ve=p[ae],ze=ve?[...se,ve]:se;te[String(ae)]=ze.join(", ")}else te[String(ae)]=f[ae]||p[ae]||""}return te},[o,b,p,f]),I=h.useCallback(async(te,ae)=>{if(S.current)return;S.current=!0;const be=++C.current;T(!0);try{if(!await t(e.id,te,ae))throw new Error(i("askUser.submitFailed"))}catch(se){if(C.current!==be)return;S.current=!1,T(!1),n(se,i("askUser.submitFailed"))}},[t,n,e.id,i]),$=h.useCallback(()=>{if(S.current)return;const te=e.options.find(ae=>ae.kind==="allow_once");if(!te){const ae=i("askUser.submitOptionUnavailable");n(new Error(ae),ae);return}I(te.id,z())},[z,n,e.options,I,i]),K=h.useCallback(()=>{if(S.current)return;const te=e.options.find(ae=>ae.kind==="reject_once"||ae.kind==="reject_always");te&&I(te.id)},[e.options,I]),R=h.useCallback(te=>{te!==void 0&&g(ae=>({...ae,[l]:te})),L||m(ae=>{if(!(l in ae))return ae;const be={...ae};return delete be[l],be}),v(!0)},[l,L]),Y=h.useCallback(te=>{if(!j)return;if(te===j.options.length){R();return}const be=j.options[te].label;if(L){const se=b[l]||[],ve=se.includes(be)?se.filter(ze=>ze!==be):[...se,be];w({...b,[l]:ve})}else{const se={...f,[l]:be};m(se),g(ve=>{if(!(l in ve))return ve;const ze={...ve};return delete ze[l],ze})}},[j,l,L,b,f,R]),W=h.useCallback(te=>{if(!j||!L)return;if(te===j.options.length){R();return}const ae=j.options[te].label,be=b[l]||[],se=be.includes(ae)?be.filter(ve=>ve!==ae):[...be,ae];w({...b,[l]:se})},[j,L,b,l,R]),M=h.useCallback(te=>{if(j){if(O.current=te,d(te),te===j.options.length){R();return}L?W(te):Y(te)}},[j,L,R,W,Y]),F=h.useCallback(te=>{var ae,be;j&&(O.current=te,d(te),te===j.options.length?((ae=E.current)==null||ae.focus(),L||m(se=>{if(!(l in se))return se;const ve={...se};return delete ve[l],ve})):((be=N.current[te])==null||be.focus(),L||Y(te)))},[j,l,L,Y]),J=h.useCallback(te=>{if(!j)return;const ae=j.options.length+1,be=O.current??0;F((be+te+ae)%ae)},[j,F]),V=h.useCallback(te=>{if(s1(te.target)||!te.target.closest("[data-web-shell-ask-option]")||!j)return;const ae=j.options.length+1;if(te.key==="ArrowDown"||te.key==="j")te.preventDefault(),J(1);else if(te.key==="ArrowUp"||te.key==="k")te.preventDefault(),J(-1);else if(te.key==="Home")te.preventDefault(),F(0);else if(te.key==="End")te.preventDefault(),F(ae-1);else if(te.key==="Escape")te.preventDefault(),K();else if(te.key>="1"&&te.key<="9"){const be=parseInt(te.key,10)-1;be<ae&&(te.preventDefault(),M(be))}},[j,J,F,K,M]),U=h.useRef(!1),le=h.useRef(e.id),pe=h.useRef((j==null?void 0:j.options.length)??0);if(pe.current=(j==null?void 0:j.options.length)??0,h.useEffect(()=>{var se,ve;const te=U.current,ae=le.current;if(U.current=r,le.current=e.id,!r||te&&e.id===ae)return;const be=O.current??0;be===pe.current?(se=E.current)==null||se.focus():(ve=N.current[be])==null||ve.focus()},[r,e.id]),o.length===0)return null;const fe=te=>{const ae=o[te];return ae?ae.multiSelect?(b[te]||[]).length>0||!!p[te]:!!f[te]||!!p[te]:!1},Q=o.every((te,ae)=>fe(ae)),ne=Math.min(l,o.length-1),de=te=>{const ae=o[te];if(c(te),v(!1),!(ae!=null&&ae.options.length)){d(null);return}if(d(0),ae.multiSelect){w(be=>(be[te]||[]).length>0||p[te]?be:{...be,[te]:[ae.options[0].label]});return}m(be=>be[te]||p[te]?be:{...be,[te]:ae.options[0].label})},ue=()=>{l<=0||de(l-1)},me=()=>{l>=o.length-1||de(l+1)};return a.jsxs("div",{className:`${qs.question} ${s==="floating"?qs.floating:""} ${x?qs.collapsed:""}`,"data-web-shell-ask-panel":!0,role:"alertdialog","aria-label":wd("ask_user_question",i),"aria-labelledby":x?void 0:`${D} ${B}`,onKeyDown:V,children:[a.jsxs("div",{className:qs.titleLine,children:[a.jsx("span",{className:qs.icon,"aria-hidden":"true",children:"?"}),a.jsx("span",{className:qs.toolName,id:D,children:wd("ask_user_question",i)}),a.jsx("span",{className:qs.toolDesc,children:i("askUser.progress",{current:ne+1,total:o.length})}),a.jsxs("div",{className:qs.topRight,children:[a.jsx("div",{className:qs.tabs,children:o.map((te,ae)=>a.jsx("span",{className:`${qs.tab} ${ae===l?qs.tabActive:""}`,"aria-hidden":"true"},ae))}),a.jsx("button",{type:"button",className:qs.collapseButton,onClick:()=>k(te=>!te),"aria-expanded":!x,"aria-label":i(x?"common.expand":"common.collapse"),title:i(x?"common.expand":"common.collapse"),children:a.jsx("svg",{viewBox:"0 0 16 16",className:`${qs.collapseIcon} ${x?qs.collapseIconCollapsed:""}`,children:a.jsx("path",{d:"M4 6l4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})})]})]}),!x&&a.jsxs(a.Fragment,{children:[j?a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:qs.text,id:B,children:[j.question,L&&a.jsxs("span",{className:qs.multiHint,children:[" ","(",i("askUser.multiHint"),")"]})]}),a.jsx("p",{className:qs.description,children:i("askUser.selectAnswer")}),a.jsxs("div",{className:qs.options,role:L?"group":"radiogroup","aria-labelledby":B,children:[j.options.map((te,ae)=>{const be=ae===u,se=L?(b[l]||[]).includes(te.label):f[l]===te.label;return a.jsxs("button",{type:"button",ref:ve=>{N.current[ae]=ve},className:`${qs.option} ${be?qs.optionActive:""} ${se?qs.optionSelected:""}`,"data-web-shell-ask-option":!0,tabIndex:be?0:-1,role:L?void 0:"radio","aria-checked":L?void 0:se,"aria-pressed":L?se:void 0,"aria-keyshortcuts":ae<9?String(ae+1):void 0,disabled:_,onClick:()=>M(ae),onFocus:()=>d(ae),children:[a.jsx("span",{className:qs.pointer,"aria-hidden":"true",children:be?"›":" "}),a.jsx("span",{className:qs.optionNum,"aria-hidden":"true",children:ae+1}),a.jsxs("span",{className:qs.optionContent,children:[a.jsx("span",{className:qs.optionLabel,children:te.label}),te.description&&a.jsx("span",{className:qs.optionDesc,children:te.description})]})]},te.label)}),(()=>{const te=u===j.options.length,ae=!!p[l];return a.jsxs("div",{className:`${qs.option} ${te?qs.optionActive:""} ${ae?qs.optionSelected:""}`,onClick:()=>{_||M(j.options.length)},children:[a.jsx("span",{className:qs.pointer,"aria-hidden":"true",children:te?"›":" "}),a.jsx("span",{className:qs.editIcon,"aria-hidden":"true",children:a.jsx("svg",{viewBox:"0 0 16 16",children:a.jsx("path",{d:"M3.2 10.9 4 7.8 10.8 1l3.2 3.2-6.8 6.8-3 .8zM10 1.8l3.2 3.2M3 14h10",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}),y?a.jsx("input",{type:"text",className:qs.customInput,placeholder:i("askUser.typePlaceholder"),value:p[l]||"","aria-label":i("askUser.typePlaceholder"),disabled:_,onChange:be=>g({...p,[l]:be.target.value}),onClick:be=>be.stopPropagation(),onFocus:()=>d(j.options.length),onBlur:()=>v(!1),autoFocus:!0}):a.jsx("button",{type:"button",ref:E,className:`${qs.customTrigger} ${p[l]?"":qs.optionPlaceholder}`,"data-web-shell-ask-option":!0,tabIndex:te?0:-1,role:L?void 0:"radio","aria-checked":L?void 0:ae,"aria-pressed":L?ae:void 0,"aria-keyshortcuts":j.options.length<9?String(j.options.length+1):void 0,disabled:_,onFocus:()=>d(j.options.length),children:p[l]||i("askUser.typePlaceholder")})]})})()]})]}):null,a.jsxs("div",{className:qs.actions,children:[a.jsx("button",{type:"button",className:qs.ignoreButton,disabled:_,onClick:K,children:i("askUser.ignore")}),o.length>1&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:qs.button,disabled:_||l<=0,onClick:ue,children:i("common.previous")}),a.jsx("button",{type:"button",className:qs.button,disabled:_||l>=o.length-1,onClick:me,children:i("common.next")})]}),a.jsx("button",{type:"button",className:`${qs.button} ${qs.submitButton}`,disabled:_||!Q,"aria-busy":_,onClick:$,children:_?a.jsxs(a.Fragment,{children:[a.jsx(Ws,{className:qs.submitSpinner,"aria-hidden":"true"}),i("askUser.submitting")]}):i("askUser.submit")})]})]})]})}const r4t=1e6;function Wfe(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 Wfe(n))t.add(s);return Array.from(t)}function vO(e,t,n){const s=new Map,r=[];let i=null;for(const l of e){if(l.role==="user"||l.role==="user_shell"){i=l.id;continue}if(i||(i=l.id),l.role==="tool_group")for(const c of l.tools){for(const u of Wfe(c))s.set(u,i);Vfe(c,i,r)}}const o=new Map;for(const l of t){const c=i4t(r,l,n);if(c.size===0&&l.toolCallId){const u=s.get(l.toolCallId);u&&c.add(u)}for(const u of c){const d=o.get(u);d?d.some(f=>f.id===l.id)||d.push(l):o.set(u,[l])}}return o}function Vfe(e,t,n){e.toolName.toLowerCase()==="record_artifact"&&n.push({turnId:t,workspacePath:Cf(e.args,"workspacePath"),managedId:Cf(e.args,"managedId"),url:Cf(e.args,"url")});for(const s of e.subTools??[])Vfe(s,t,n)}function i4t(e,t,n){const s=new Set;for(const r of e){if(r.workspacePath&&t.workspacePath&&Zfe(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 wO(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(l=>nm(l.workspacePath)).filter(l=>!!l));for(const l of i.tools)Yfe(l,r,o,s,n)}return s}function Gfe(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)Kfe(r,n,t)}return t}function Kfe(e,t,n){const s=o4t(e);if(s){const r=n.get(t);r?r.push(s):n.set(t,[s])}for(const r of e.subTools??[])Kfe(r,t,n)}function o4t(e){if(e.status!=="completed"||e.toolName.toLowerCase()!=="cron_create")return null;const t=xO(e);if(t!=null&&t.error)return null;const n=Cf(e.args,"cron"),s=Cf(e.args,"prompt");if(!n||!s)return null;const r=Cf(t,"returnDisplay")??Cf(t,"llmContent")??(typeof e.rawOutput=="string"?e.rawOutput:void 0),i=r?Xfe(r):void 0;return{id:r?h4t(r)??e.callId:e.callId,toolCallId:e.callId,title:f4t(s),cron:n,prompt:s,recurring:wY(e.args,"recurring")??!0,durable:wY(e.args,"durable")??!1,...i?{display:i}:{}}}function Yfe(e,t,n,s,r){const i=a4t(e,n,r);if(i){const o=s.get(t);o?m4t(o,i):s.set(t,[i])}for(const o of e.subTools??[])Yfe(o,t,n,s,r)}function a4t(e,t,n){if(e.status!=="completed")return null;const s=e.toolName.toLowerCase();if(s!=="write_file"&&s!=="edit")return null;const r=l4t(e);if(!r)return null;const i=nm(r),o=c4t(e),l=d4t(e),c=u4t(l);return{path:r,status:o,toolCallId:e.callId,isArtifact:Array.from(t).some(u=>Zfe(i,u,n)),...c?{additions:c.additions,deletions:c.deletions}:{},diffs:l}}function l4t(e){var n,s;const t=D4(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 Cf(e,...t){if(e)for(const n of t){const s=e[n];if(typeof s=="string"&&s.trim())return s}}function D4(e,...t){if(e)for(const n of t){const s=e[n];if(typeof s=="string")return s}}function c4t(e){if(e.toolName.toLowerCase()==="write_file")return"created";const t=xO(e),n=(Cf(t,"returnDisplay")??"").toLowerCase();return n.includes("created new file")||n.includes("successfully created")||n.includes("created and wrote")?"created":"modified"}function u4t(e){const t=Qfe(e);return t?Jfe(t.oldText,t.newText):void 0}function d4t(e){const t=xO(e),n=D4(t,"originalContent"),s=D4(t,"newContent");if(n!==void 0||s!==void 0)return[{oldText:n??"",newText:s??"",fileDiff:Cf(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=D4(e.args,"content");return i!==void 0?[{oldText:"",newText:i,fullContent:!0}]:[]}return[]}function xO(e){return e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0}function wY(e,t){const n=e==null?void 0:e[t];return typeof n=="boolean"?n:void 0}function Xfe(e){return e.split(/\r\n|\r|\n/).map(t=>t.trim()).find(Boolean)}function h4t(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 f4t(e){const t=Xfe(e)??e.trim();return t.length>36?`${t.slice(0,36)}...`:t}function m4t(e,t){const n=nm(t.path),s=e.findIndex(f=>nm(f.path)===n);if(s<0){e.push(t);return}const r=e[s],{additions:i,deletions:o,...l}=r,c=p4t(r.diffs,t.diffs),u=Qfe(c),d=u?Jfe(u.oldText,u.newText):void 0;e[s]={...l,status:r.status==="created"||t.status==="created"?"created":"modified",isArtifact:r.isArtifact||t.isArtifact,...d?{additions:d.additions,deletions:d.deletions}:{},diffs:c}}function p4t(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 Qfe(e){const t=e.at(-1);return t!=null&&t.fullContent?t:void 0}function Jfe(e,t){const n=xY(e),s=xY(t);if(n.length*s.length>r4t)return;const r=g4t(n,s);return{additions:s.length-r,deletions:n.length-r}}function xY(e){return e?e.replace(/\r?\n$/,"").split(/\r\n|\r|\n/):[]}function g4t(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 Zfe(e,t,n){return Ohe(e,t,n)}const b4t="_pane_j8hlg_1",y4t="_paneEmbedded_j8hlg_13",v4t="_footer_j8hlg_18",w4t="_header_j8hlg_22",x4t="_workspaceTag_j8hlg_45",k4t="_workspaceTagDot_j8hlg_61",_4t="_workspaceTagText_j8hlg_69",S4t="_connectionError_j8hlg_78",C4t="_connectionErrorText_j8hlg_86",T4t="_title_j8hlg_93",E4t="_headerActions_j8hlg_104",A4t="_headerActionsInline_j8hlg_113",j4t="_headerActionSlot_j8hlg_120",N4t="_headerActionsHostHidden_j8hlg_127",I4t="_headerTrailing_j8hlg_139",M4t="_headerOverflowPanel_j8hlg_146",R4t="_headerActionButton_j8hlg_154",D4t="_closeButton_j8hlg_155",L4t="_maximizeButton_j8hlg_156",P4t="_body_j8hlg_185",O4t="_approval_j8hlg_199",xo={pane:b4t,paneEmbedded:y4t,footer:v4t,header:w4t,workspaceTag:x4t,workspaceTagDot:k4t,workspaceTagText:_4t,connectionError:S4t,connectionErrorText:C4t,title:T4t,headerActions:E4t,headerActionsInline:A4t,headerActionSlot:j4t,headerActionsHostHidden:N4t,headerTrailing:I4t,headerOverflowPanel:M4t,headerActionButton:R4t,closeButton:D4t,maximizeButton:L4t,body:P4t,approval:O4t},$4t=64,eme='button, a[href], [role="button"], input[type="button"], input[type="submit"], summary';function tme(e){const t=[];for(const n of h.Children.toArray(e))if(h.isValidElement(n)){if(n.type===h.Fragment){const s=n.props.children;t.push(...tme(s));continue}t.push(n)}return t}function B4t(e,t){const n=e.props;return n["aria-label"]?n["aria-label"]:n.title?n.title:n.children!=null&&n.children!==!1&&(typeof n.children=="string"||typeof n.children=="number")?n.children:t}function kO(e,t){const n=e==null?void 0:e.querySelector(`[data-pane-header-action-index="${t}"]`);return n instanceof HTMLElement?n:null}function nme(e){return e.querySelector(eme)??e}function z4t(e){let t="";const n=s=>{if(s.nodeType===Node.ELEMENT_NODE){const r=s;if(r.getAttribute("aria-hidden")==="true")return;for(const i of Array.from(r.childNodes))n(i);return}s.nodeType===Node.TEXT_NODE&&(t+=s.nodeValue??"")};for(const s of Array.from(e.childNodes))n(s);return t.trim()}function F4t(e,t,n,s){const r=kO(e,t);if(r){const i=nme(r),o=i.getAttribute("aria-label");if(o)return o;const l=i.getAttribute("title");if(l)return l;const c=z4t(i);if(c)return c}return B4t(n,s)}function q4t(e,t){const n=kO(e,t);n&&nme(n).click()}function H4t(e,t){const n=kO(e,t);return n?n.querySelector(eme)!==null:!0}function U4t({children:e,trailing:t}){const{t:n}=nt(),s=h.useRef(null),r=h.useRef(null),i=h.useRef(null),o=h.useRef(0),[l,c]=h.useState(!1),u=e!=null&&e!==!1,d=u?tme(e):[],f=n("splitView.defaultActionLabel");return h.useLayoutEffect(()=>{var b;if(!u){o.current=0,c(!1);return}const m=(b=s.current)==null?void 0:b.parentElement;if(!m)return;const p=()=>{var O;r.current&&(o.current=r.current.scrollWidth);const w=o.current;if(w===0){c(!1);return}const y=((O=i.current)==null?void 0:O.offsetWidth)??0,v=getComputedStyle(m),x=parseFloat(v.gap)||0,k=s.current?getComputedStyle(s.current):null,_=y>0&&parseFloat((k==null?void 0:k.gap)??"")||0,T=(parseFloat(v.paddingLeft)||0)+(parseFloat(v.paddingRight)||0),S=m.querySelector("[data-web-shell-pane-workspace]"),C=(S==null?void 0:S.offsetWidth)??0,N=C>0?x:0,E=m.clientWidth-T-C-N-$4t-y-x-_;c(w>E)};p();const g=new ResizeObserver(p);return g.observe(m),r.current&&g.observe(r.current),i.current&&g.observe(i.current),()=>g.disconnect()},[u]),a.jsxs("div",{ref:s,className:xo.headerActions,"data-testid":"pane-header-actions",children:[u&&a.jsx("div",{ref:r,className:l?xo.headerActionsHostHidden:xo.headerActionsInline,"data-testid":l?"pane-header-actions-host":"pane-header-actions-inline","aria-hidden":l||void 0,children:d.map((m,p)=>a.jsx("span",{className:xo.headerActionSlot,"data-pane-header-action-index":String(p),children:m},m.key??`pane-header-action-${p}`))}),u&&l&&a.jsxs(Mu,{children:[a.jsx(Ru,{asChild:!0,children:a.jsx("button",{type:"button",className:xo.headerActionButton,"aria-label":n("splitView.morePaneActions"),title:n("splitView.morePaneActions"),"data-testid":"pane-header-overflow",children:a.jsx(uke,{size:16,"aria-hidden":"true"})})}),a.jsx(Du,{align:"end",className:"w-auto min-w-40","data-testid":"pane-header-overflow-menu",children:a.jsx("div",{className:xo.headerOverflowPanel,children:d.map((m,p)=>H4t(r.current,p)?a.jsx(bi,{onSelect:()=>{q4t(r.current,p)},children:F4t(r.current,p,m,f)},m.key??`pane-header-menu-${p}`):null)})})]}),t!=null&&a.jsx("div",{ref:i,className:xo.headerTrailing,children:t})]})}const kY=["approvalMode","model","voice"],W4t={};function V4t({enabled:e,onOpen:t,children:n}){return e?a.jsx(yhe,{onOpen:t,children:n}):n}function sme({title:e,workspaceCwd:t,renderHeaderActions:n,onClose:s,onToggleMaximize:r,isMaximized:i=!1,onError:o,onSlashCommand:l,onRightPanelOpen:c,onOpenMonitor:u,onPaneArtifactsChange:d,messageTurnOutputs:f,restartSseOnPrompt:m=!1,embedded:p=!1,onFirstPromptAdmitted:g,hidden:b=!1,voiceUserRevision:w=0,voiceWorkspaceRevisions:y=W4t,voiceWorkspaces:v}){var Je,pt,ln,Bn,ns,lt,Xe;const{t:x}=nt(),{renderComposerFooter:k}=Vu(),_=za(),T=rm(),S=Qo(),C=Co(),N=Efe(),E=bO(x,N),O=tD(),B=gv(),D=p5(),{artifacts:j}=yO(),L=h.useCallback(ot=>{var Qn;if(!_.sessionId||!c)return;const Tt=ot.rawOutput&&typeof ot.rawOutput=="object"?ot.rawOutput:void 0,fn=(typeof((Qn=ot.args)==null?void 0:Qn.subagent_type)=="string"?ot.args.subagent_type:void 0)??(typeof(Tt==null?void 0:Tt.subagentName)=="string"?Tt.subagentName:void 0);c({id:`subagent:${_.sessionId}:${ot.callId}`,kind:"subagent",title:ot.title||fn||x("agent.label"),turnId:ot.callId,tool:ot,sessionId:_.sessionId,workspaceCwd:_.workspaceCwd??t})},[_.sessionId,_.workspaceCwd,c,x,t]),z=h.useRef(_.sessionId);z.current=_.sessionId;const I=((Je=_.capabilities)==null?void 0:Je.features.includes(Pee))===!0&&u!==void 0,$=h.useCallback(async ot=>{const Tt=z.current;if(!Tt||!u)return!1;try{const fn=await T.getTasks();if(z.current!==Tt||fn.sessionId!==Tt)return!1;const Qn=Ghe(fn.tasks,ot);return Qn?(u(Qn,Tt,T),!0):!1}catch{return!1}},[T,u]);h.useEffect(()=>{const ot=_.sessionId;if(ot)return d==null||d(ot,j,S),()=>{d==null||d(ot,[],S)}},[j,_.sessionId,d,S]);const K=h.useRef(D);K.current=D;const R=h.useRef(!1),Y=h.useCallback(async ot=>{_.sessionId&&await T.reloadSession(ot)},[T,_.sessionId]),W=((pt=_.capabilities)==null?void 0:pt.features.includes(Lee))===!0,M=h.useRef(null),{followupState:F,onAcceptFollowup:J,onDismissFollowup:V,clear:U}=xee({onAccept:ot=>{var Tt;(Tt=M.current)==null||Tt.insertText(ot)}}),le=h.useCallback((ot,Tt)=>{o?o(ot,Tt):console.error(Tt,ot)},[o]),pe=h.useRef(l);pe.current=l;const fe=h.useMemo(()=>K7(N),[N]),Q=AR(fe),ne=fe&&!Q?fe:null,de=fe&&Q?fe:null,ue=(ne==null?void 0:ne.toolKind)==="switch_mode"&&((ln=ne==null?void 0:ne.toolName)==null?void 0:ln.toLowerCase())==="exit_plan_mode",me=h.useMemo(()=>ue?fhe(E):[],[ue,E]),te=h.useRef(ne);te.current=ne;const ae=ne!==null||de!==null,be=_.sessionId&&_.workspaceCwd&&(!t||t===_.workspaceCwd)?_.workspaceCwd:void 0,se=h.useMemo(()=>Xhe({capabilities:C.capabilities,intendedCwd:be,sessionId:_.sessionId,workspaces:v}),[_.sessionId,be,v,C.capabilities]),ve=h.useMemo(()=>({user:w,workspace:se?y[se.workspaceKey]??0:0}),[se,w,y]),ze=D!=="idle",Pe=h.useMemo(()=>vO(E,j,_.workspaceCwd||""),[E,j,_.workspaceCwd]),_t=h.useMemo(()=>wO(E,Pe,_.workspaceCwd||""),[E,Pe,_.workspaceCwd]),Pt=h.useMemo(()=>Gfe(E),[E]),St=h.useMemo(()=>new Set(f??Bhe),[f]),he=((Bn=_.capabilities)==null?void 0:Bn.features.includes("session_mid_turn_message_mutation"))===!0,{queuedPrompts:Ae,queuedTexts:rt,enqueuePrompt:dt,removeQueuedPrompt:jt,editQueuedPrompt:et,editLastQueuedPrompt:Mt,clearQueuedPrompts:sn}=Rfe({connected:_.status==="connected",sessionId:_.sessionId,clientId:_.clientId,canMutateMidTurn:he,streamingState:D,sessionActions:T,store:B,editorRef:M,reportError:le,t:x}),Ye=h.useMemo(()=>{if(ze)for(let ot=E.length-1;ot>=0;ot--){const Tt=E[ot];if((Tt==null?void 0:Tt.role)==="user")return Tt.timestamp}},[E,ze]),$n=h.useCallback((ot,Tt,fn,Qn)=>{const Os=ot.trim();if(!Os)return!1;if(Ofe(ot,pe.current,le))return!0;if(Lfe({connectionStatus:_.status,hasSession:!!_.sessionId,restartSseOnPrompt:m}))return!1;const rr=Qn==null?void 0:Qn.inputAnnotations;return K.current==="idle"?(T.sendPrompt(Os,{...Tt&&Tt.length?{images:Tt}:{},...rr?{inputAnnotations:rr}:{},onAdmitted:()=>{!R.current&&g&&(R.current=!0,g(Os)),U(),fn==null||fn()}}).catch(Es=>le(Es,"Failed to send prompt")),!1):rr?dt(Os,Tt,void 0,rr):dt(Os,Tt)},[T,U,_.sessionId,_.status,dt,g,le,m]),Te=h.useCallback((ot,Tt,fn)=>{T.submitPermission(ot,Tt,fn).catch(Qn=>le(Qn,"Failed to submit permission choice"))},[T,le]),ie=h.useCallback((ot,Tt,fn)=>T.submitPermission(ot,Tt,fn),[T]),it=h.useCallback(()=>{T.cancel().catch(ot=>le(ot,"Failed to cancel request"))},[T,le]),we=h.useCallback(ot=>{if(c){if(ot.kind==="subagent"){c({...ot,sourceSessionId:_.sessionId});return}c({...ot,workspaceActions:S,sourceSessionId:_.sessionId})}},[_.sessionId,c,S]),We=h.useMemo(()=>zfe(Ffe(_.commands??[],$fe(x)),x).map(ot=>{const Tt=Bfe(ot.name);return Tt?{...ot,displayCategory:"skill",description:x(Tt)}:ot}),[_.commands,x]),ce=h.useMemo(()=>(_.models??[]).filter(Sx).map(ot=>({id:ot.id,label:up(ot.label||ot.id)})),[_.models]),De=h.useCallback(ot=>{if(!H3(ot)){le(new Error(`Unsupported approval mode: ${ot}`),"Failed to set approval mode");return}T.setApprovalMode(ot).then(()=>{const Tt=te.current;if(!Tt||!(ot==="yolo"||ot==="auto-edit"&&Tt.toolKind==="edit"))return;const Qn=Tt.options.find(Os=>Os.kind==="allow_once");Qn&&T.submitPermission(Tt.id,Qn.id).catch(Os=>le(Os,"Failed to auto-approve tool call"))}).catch(Tt=>le(Tt,"Failed to set approval mode"))},[T,le]),ct=h.useCallback(ot=>{T.setModel(ot).catch(Tt=>le(Tt,"Failed to switch model"))},[T,le]),qe=e||_.displayName||((ns=_.sessionId)==null?void 0:ns.slice(0,8))||"",Ve=t??_.workspaceCwd,Qt=pO(C.capabilities)&&!!Ve,Un=h.useMemo(()=>Qt?[...kY,"workspace"]:kY,[Qt]),Ie=_.sessionId&&n?n({sessionId:_.sessionId,workspaceCwd:Ve||void 0}):null,wt=Qt&&Ve?sE(Ve,(lt=C.capabilities)==null?void 0:lt.workspaces):void 0,Wt=Qt?lSt(Ve,C.capabilities):void 0,Me=Wt?cO[Wt]:void 0;return a.jsxs("section",{className:`${xo.pane} ${p?xo.paneEmbedded:""}`.trim(),"data-testid":"chat-pane","aria-label":qe,children:[!p&&a.jsxs("header",{className:`${xo.header} ${Me??""}`.trim(),children:[wt&&a.jsxs("span",{role:"img",className:xo.workspaceTag,title:Ve,"aria-label":x("workspace.paneLabel",{name:wt}),"data-web-shell-pane-workspace":!0,children:[a.jsx("span",{className:xo.workspaceTagDot,"aria-hidden":"true"}),a.jsx("span",{className:xo.workspaceTagText,children:wt})]}),a.jsx("span",{className:xo.title,title:qe,children:qe}),a.jsx(U4t,{trailing:r||s?a.jsxs(a.Fragment,{children:[r&&a.jsx("button",{type:"button",className:xo.maximizeButton,onClick:r,"aria-pressed":i,"aria-label":x(i?"splitView.restorePane":"splitView.maximizePane"),title:x(i?"splitView.restorePane":"splitView.maximizePane"),children:i?a.jsx(jee,{size:16,"aria-hidden":!0}):a.jsx(Aee,{size:16,"aria-hidden":!0})}),s&&a.jsx("button",{type:"button",className:xo.closeButton,onClick:s,"aria-label":x("splitView.closePane"),title:x("splitView.closePane"),"data-testid":"pane-close",children:a.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:a.jsx("path",{d:"M6 6l12 12M18 6L6 18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}):null,children:Ie})]}),_.error&&a.jsx("div",{className:xo.connectionError,role:"alert",children:a.jsxs("span",{className:xo.connectionErrorText,children:[x("splitView.paneConnectionError"),": ",_.error]})}),a.jsx("div",{className:xo.body,children:a.jsx(V4t,{enabled:I,onOpen:$,children:a.jsx(ghe,{onOpen:L,children:a.jsx(rO,{messages:E,pendingApproval:ne,loadingTranscript:_.loadingTranscript,catchingUp:_.catchingUp,hasOlderHistory:O.hasMore,loadingOlderHistory:O.loading,historyCapacityReached:O.capacityReached,historyPaginationError:O.paginationError,onLoadOlderHistory:O.loadMore,transcriptBlockCount:N.length,transcriptActivity:B,onReloadTranscript:W?Y:void 0,isResponding:ze,workspaceCwd:_.workspaceCwd||"",hideSessionTimeline:!0,turnFileChanges:St.has("file")?_t:void 0,turnArtifacts:St.has("artifact")?Pe:void 0,turnScheduledTasks:St.has("scheduled_task")?Pt:void 0,onTurnOutputOpen:we,onError:le,generateContent:(Xe=_.capabilities)!=null&&Xe.features.includes("session_generation")?T.generateSessionContent:void 0})})})}),a.jsxs("div",{className:xo.footer,children:[ne&&a.jsx("div",{className:xo.approval,"data-testid":"pane-approval",children:a.jsx(Hfe,{request:ne,onConfirm:Te,variant:"floating",planTodos:me,keyboardActive:!1})}),de&&a.jsx("div",{className:xo.approval,"data-testid":"pane-approval",children:a.jsx(Ufe,{request:de,onConfirm:ie,onError:le,variant:"floating",keyboardActive:!1})}),a.jsx(lfe,{startedAt:Ye,showPhrase:!1}),a.jsx(qfe,{prompts:Ae,t:x,canMutateMidTurn:he,onDelete:jt,onEdit:et}),a.jsx(afe,{ref:M,onSubmit:$n,onCancel:it,isRunning:ze,commands:We,queuedMessages:rt,onPopQueuedMessages:Mt,onClearQueuedMessages:sn,visibleToolbarActions:Un,workspaceName:Qt?wt:void 0,workspaceTitle:Ve,workspaceColor:Wt,currentMode:_.currentMode??"default",currentModel:_.currentModel??"",availableModels:ce,onSelectMode:De,onSelectModel:ct,dialogOpen:ae,disabled:ae,voiceTarget:b?void 0:se,voiceStatusRevision:ve,followupState:F,onAcceptFollowup:J,onDismissFollowup:V,sessionId:_.sessionId,atWorkspaceCwd:Ve,placeholderText:x("splitView.composerPlaceholder"),animatePlaceholder:!1}),k&&a.jsx(k,{disabled:ae,isRunning:ze,currentMode:_.currentMode??"default",currentModel:_.currentModel??"",sessionName:_.displayName})]})]})}const G4t="_split_99j2q_1",K4t="_toolbar_99j2q_9",Y4t="_backButton_99j2q_18",X4t="_title_99j2q_35",Q4t="_count_99j2q_40",J4t="_addWrap_99j2q_45",Z4t="_addButton_99j2q_50",eTt="_picker_99j2q_70",tTt="_pickerItem_99j2q_87",nTt="_pickerItemLabel_99j2q_102",sTt="_pickerItemWorkspace_99j2q_112",rTt="_panes_99j2q_131",iTt="_paneSlot_99j2q_140",oTt="_empty_99j2q_153",aTt="_paneError_99j2q_162",lTt="_paneErrorTitle_99j2q_175",cTt="_paneErrorMessage_99j2q_180",uTt="_paneErrorClose_99j2q_185",Aa={split:G4t,toolbar:K4t,backButton:Y4t,title:X4t,count:Q4t,addWrap:J4t,addButton:Z4t,picker:eTt,pickerItem:tTt,pickerItemLabel:nTt,pickerItemWorkspace:sTt,panes:rTt,paneSlot:iTt,empty:oTt,paneError:aTt,paneErrorTitle:lTt,paneErrorMessage:cTt,paneErrorClose:uTt},hN=Ep;function dTt({sessionIds:e,onPanesChange:t,onExit:n,onError:s,onSlashCommand:r,onRightPanelOpen:i,onOpenMonitor:o,onPaneArtifactsChange:l,messageTurnOutputs:c,renderPaneHeaderActions:u,sessionListReloadToken:d,includeOtherWorkspaces:f=!0,workspaceCwd:m,restartSseOnPrompt:p,historyPageSize:g=aD,voiceUserRevision:b=0,voiceWorkspaceRevisions:w={},voiceWorkspaces:y}){var ue,me;const{t:v}=nt(),x=za(),k=x.sessionId,_=((me=(ue=x.capabilities)==null?void 0:ue.features)==null?void 0:me.includes(oD))??!1,{sessions:T,reload:S}=tS(m,{autoLoad:!0,pageSize:nh,archiveState:"active",..._?{view:"organized",group:"all"}:{}}),{sessions:C,reload:N}=Sfe(f&&!m),E=h.useMemo(()=>_fe(T,C),[T,C]),O=!m&&f&&pO(x.capabilities),B=!!m||O,D=e!==void 0,j=h.useMemo(()=>Array.from(new Set((e??[]).filter(Boolean))).slice(0,hN),[e]),[L,z]=h.useState(()=>j.length>0?j:k?[k]:[]),[I,$]=h.useState(!1),[K,R]=h.useState(null),Y=h.useRef(null),[W]=h.useState(()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2));h.useEffect(()=>{D&&z(te=>te.length===j.length&&te.every((ae,be)=>ae===j[be])?te:j)},[j,D]);const M=h.useRef(L);M.current=L,h.useEffect(()=>{if(!I)return;const te=be=>{var se;(se=Y.current)!=null&&se.contains(be.target)||$(!1)},ae=be=>{be.key==="Escape"&&$(!1)};return document.addEventListener("mousedown",te),document.addEventListener("keydown",ae),()=>{document.removeEventListener("mousedown",te),document.removeEventListener("keydown",ae)}},[I]),h.useEffect(()=>{I&&(S(),N())},[I,S,N]);const F=h.useRef(d);h.useEffect(()=>{d!==void 0&&d!==F.current&&(F.current=d,S(),N())},[d,S,N]);const J=h.useMemo(()=>{var ae;const te=new Map;for(const be of E)te.set(be.sessionId,((ae=be.displayName)==null?void 0:ae.trim())||be.sessionId.slice(0,8));return te},[E]),V=h.useMemo(()=>{const te=new Map;for(const ae of E)te.set(ae.sessionId,ae.workspaceCwd);return k&&x.workspaceCwd&&!te.has(k)&&te.set(k,x.workspaceCwd),te},[E,k,x.workspaceCwd]),U=h.useCallback(te=>{const ae=M.current;if(ae.includes(te)||ae.length>=hN){$(!1);return}const be=[...ae,te];R(null),D?t==null||t(be):z(be),$(!1)},[t,D]),le=h.useRef(!1);h.useEffect(()=>{L.length>0?le.current=!0:le.current&&n()},[L,n]),h.useEffect(()=>{D||t==null||t(L)},[L,t,D]);const pe=h.useCallback(te=>{const ae=M.current;if(!ae.includes(te))return;const be=ae.filter(se=>se!==te);D?t==null||t(be):z(be)},[t,D]),fe=h.useCallback(te=>{R(ae=>ae===te?null:te)},[]);h.useEffect(()=>{K&&(L.length<2||!L.includes(K))&&R(null)},[L,K]),h.useEffect(()=>{if(!K)return;const te=ae=>{ae.key!=="Escape"||ae.defaultPrevented||I||s1(ae.target)||R(null)};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[K,I]);const Q=h.useMemo(()=>E.filter(te=>!L.includes(te.sessionId)),[E,L]),ne=L.length<hN&&Q.length>0,de=L.length>1;return a.jsxs("div",{className:Aa.split,"data-testid":"split-view",children:[a.jsxs("header",{className:Aa.toolbar,children:[a.jsx("button",{type:"button",className:Aa.backButton,onClick:n,"aria-label":v("common.back"),title:v("common.back"),children:a.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",children:a.jsx("path",{d:"M15 18l-6-6 6-6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),a.jsx("span",{className:Aa.title,children:v("splitView.title")}),a.jsx("span",{className:Aa.count,children:v("splitView.count",{count:L.length})}),a.jsxs("div",{className:Aa.addWrap,ref:Y,children:[a.jsxs("button",{type:"button",className:Aa.addButton,disabled:!ne,"aria-haspopup":"listbox","aria-expanded":I,onClick:()=>$(te=>!te),children:["+ ",v("splitView.addPane")]}),I&&Q.length>0&&a.jsx("ul",{className:Aa.picker,role:"listbox",children:Q.map(te=>{var ae;return a.jsx("li",{role:"option","aria-selected":"false",children:a.jsxs("button",{type:"button",className:Aa.pickerItem,onClick:()=>U(te.sessionId),children:[a.jsx("span",{className:Aa.pickerItemLabel,children:J.get(te.sessionId)??te.sessionId.slice(0,8)}),O&&a.jsx("span",{className:Aa.pickerItemWorkspace,title:te.workspaceCwd,children:sE(te.workspaceCwd,(ae=x.capabilities)==null?void 0:ae.workspaces)})]})},te.sessionId)})})]})]}),a.jsx("div",{className:Aa.panes,children:L.length===0?a.jsx("div",{className:Aa.empty,children:v("splitView.empty")}):L.map(te=>{const ae=V.get(te),be=K===te,se=K!==null&&!be;return a.jsx("div",{className:Aa.paneSlot,"data-pane-hidden":se?"":void 0,children:a.jsx(Wf,{label:`split-pane:${te}`,resetKeys:[te],fallback:ve=>a.jsxs("div",{className:Aa.paneError,role:"alert",children:[a.jsx("div",{className:Aa.paneErrorTitle,children:J.get(te)??te.slice(0,8)}),a.jsxs("div",{className:Aa.paneErrorMessage,children:[v("splitView.paneError"),": ",ve.message]}),a.jsx("button",{type:"button",className:Aa.paneErrorClose,onClick:()=>pe(te),children:v("splitView.closePane")})]}),children:a.jsx(m5,{sessionId:te,workspaceCwd:B?ae??m:void 0,clientId:`split-pane:${W}:${te}`,historyPageSize:g,subagentTranscriptMode:"summary",maxBlocks:lD,suppressOwnUserEcho:!0,restartEventStreamOnPrompt:p,children:a.jsx(sme,{title:J.get(te),workspaceCwd:ae,renderHeaderActions:u,hidden:se,voiceUserRevision:b,voiceWorkspaceRevisions:w,voiceWorkspaces:y,onClose:()=>pe(te),onToggleMaximize:de?()=>fe(te):void 0,isMaximized:be,onError:s,onSlashCommand:r,onRightPanelOpen:i,onOpenMonitor:o,onPaneArtifactsChange:l,messageTurnOutputs:c,restartSseOnPrompt:p})})})},B?`${te}:${ae??""}`:te)})})]})}const hTt="_root_1l1wz_1",fTt="_intro_1l1wz_8",mTt="_toolbar_1l1wz_14",pTt="_count_1l1wz_22",gTt="_toolbarActions_1l1wz_28",bTt="_primaryButton_1l1wz_34",yTt="_secondaryButton_1l1wz_35",vTt="_formFields_1l1wz_73",wTt="_field_1l1wz_79",xTt="_fieldGrow_1l1wz_86",kTt="_fieldLabel_1l1wz_90",_Tt="_required_1l1wz_96",STt="_input_1l1wz_107",CTt="_textarea_1l1wz_108",TTt="_select_1l1wz_109",ETt="_promptEditorWrap_1l1wz_127",ATt="_promptEditor_1l1wz_127",jTt="_promptPlaceholder_1l1wz_160",NTt="_promptTag_1l1wz_174",ITt="_promptTagIcon_1l1wz_190",MTt="_promptTagValue_1l1wz_201",RTt="_promptTagRemove_1l1wz_211",DTt="_referencePopover_1l1wz_239",LTt="_referenceBar_1l1wz_243",PTt="_referenceButton_1l1wz_250",OTt="_referenceButtonActive_1l1wz_267",$Tt="_referenceButtonIcon_1l1wz_272",BTt="_referencePicker_1l1wz_282",zTt="_referenceItem_1l1wz_295",FTt="_referenceItemLabel_1l1wz_318",qTt="_referenceItemDescription_1l1wz_319",HTt="_referenceEmpty_1l1wz_336",UTt="_referenceError_1l1wz_337",WTt="_scheduleRow_1l1wz_347",VTt="_preview_1l1wz_359",GTt="_previewLabel_1l1wz_367",KTt="_previewCron_1l1wz_372",YTt="_previewInvalid_1l1wz_382",XTt="_formError_1l1wz_387",QTt="_loadError_1l1wz_388",JTt="_formActions_1l1wz_394",ZTt="_empty_1l1wz_402",e3t="_list_1l1wz_409",t3t="_card_1l1wz_417",n3t="_cardDisabled_1l1wz_428",s3t="_cardHeader_1l1wz_432",r3t="_cardTitle_1l1wz_438",i3t="_cardMenu_1l1wz_449",o3t="_iconAction_1l1wz_456",a3t="_toggle_1l1wz_482",l3t="_toggleOn_1l1wz_501",c3t="_toggleKnob_1l1wz_505",u3t="_cardPrompt_1l1wz_520",d3t="_cardFooter_1l1wz_533",h3t="_schedulePill_1l1wz_542",f3t="_clockIcon_1l1wz_554",m3t="_recurringTag_1l1wz_559",p3t="_workspacePill_1l1wz_567",g3t="_workspaceIcon_1l1wz_584",b3t="_countdown_1l1wz_589",y3t="_hourglassIcon_1l1wz_600",v3t="_lastFired_1l1wz_605",w3t="_runsToggle_1l1wz_613",x3t="_runsList_1l1wz_630",k3t="_runsItem_1l1wz_644",st={root:hTt,intro:fTt,toolbar:mTt,count:pTt,toolbarActions:gTt,primaryButton:bTt,secondaryButton:yTt,formFields:vTt,field:wTt,fieldGrow:xTt,fieldLabel:kTt,required:_Tt,input:STt,textarea:CTt,select:TTt,promptEditorWrap:ETt,promptEditor:ATt,promptPlaceholder:jTt,promptTag:NTt,promptTagIcon:ITt,promptTagValue:MTt,promptTagRemove:RTt,referencePopover:DTt,referenceBar:LTt,referenceButton:PTt,referenceButtonActive:OTt,referenceButtonIcon:$Tt,referencePicker:BTt,referenceItem:zTt,referenceItemLabel:FTt,referenceItemDescription:qTt,referenceEmpty:HTt,referenceError:UTt,scheduleRow:WTt,preview:VTt,previewLabel:GTt,previewCron:KTt,previewInvalid:YTt,formError:XTt,loadError:QTt,formActions:JTt,empty:ZTt,list:e3t,card:t3t,cardDisabled:n3t,cardHeader:s3t,cardTitle:r3t,cardMenu:i3t,iconAction:o3t,toggle:a3t,toggleOn:l3t,toggleKnob:c3t,cardPrompt:u3t,cardFooter:d3t,schedulePill:h3t,clockIcon:f3t,recurringTag:m3t,workspacePill:p3t,workspaceIcon:g3t,countdown:b3t,hourglassIcon:y3t,lastFired:v3t,runsToggle:w3t,runsList:x3t,runsItem:k3t},_3t="_panel_1h9ad_1",S3t="_panelDrawer_1h9ad_11",C3t="_header_1h9ad_18",T3t="_tabs_1h9ad_38",E3t="_tabItem_1h9ad_47",A3t="_tab_1h9ad_38",j3t="_tabTitle_1h9ad_75",N3t="_tabIcon_1h9ad_82",I3t="_tabIconSvg_1h9ad_92",M3t="_tabActive_1h9ad_99",R3t="_tabCloseButton_1h9ad_114",D3t="_tabCloseIcon_1h9ad_144",L3t="_iconButton_1h9ad_150",P3t="_iconButtonActive_1h9ad_169",O3t="_headerActions_1h9ad_173",$3t="_addButton_1h9ad_184",B3t="_panelToggleButton_1h9ad_188",z3t="_panelToggleIcon_1h9ad_200",F3t="_toolbarIcon_1h9ad_206",q3t="_body_1h9ad_212",H3t="_bodySideTask_1h9ad_219",U3t="_empty_1h9ad_224",W3t="_emptyActions_1h9ad_230",V3t="_emptyAction_1h9ad_230",G3t="_emptyActionIcon_1h9ad_264",K3t="_emptyActionTitle_1h9ad_278",Y3t="_emptyActionHint_1h9ad_282",X3t="_emptyActionChevron_1h9ad_292",Q3t="_sideTaskListTitle_1h9ad_299",J3t="_sideTaskListTime_1h9ad_307",Z3t="_sideTaskNewIcon_1h9ad_315",e5t="_meta_1h9ad_352",t5t="_detail_1h9ad_357",n5t="_section_1h9ad_362",s5t="_sectionTitle_1h9ad_367",r5t="_description_1h9ad_374",i5t="_actionsRow_1h9ad_378",o5t="_fieldGrid_1h9ad_385",a5t="_fieldLabel_1h9ad_392",l5t="_fieldValue_1h9ad_401",c5t="_link_1h9ad_406",u5t="_review_1h9ad_415",d5t="_reviewToolbar_1h9ad_422",h5t="_reviewToolbarTitle_1h9ad_431",f5t="_reviewToolbarActions_1h9ad_438",m5t="_reviewTotalsButton_1h9ad_444",p5t="_reviewContent_1h9ad_462",g5t="_reviewContentListOnly_1h9ad_472",b5t="_reviewContentStacked_1h9ad_476",y5t="_reviewList_1h9ad_481",v5t="_reviewListWithExpanded_1h9ad_489",w5t="_reviewSplitHandle_1h9ad_502",x5t="_reviewItem_1h9ad_517",k5t="_reviewItemExpanded_1h9ad_522",_5t="_reviewRow_1h9ad_529",S5t="_reviewRowToggle_1h9ad_551",C5t="_reviewFileName_1h9ad_572",T5t="_reviewOpenButton_1h9ad_579",E5t="_fileIcon_1h9ad_602",A5t="_reviewPath_1h9ad_616",j5t="_treeName_1h9ad_617",N5t="_pathPrefix_1h9ad_633",I5t="_pathFileName_1h9ad_639",M5t="_lineStats_1h9ad_647",R5t="_additions_1h9ad_656",D5t="_deletions_1h9ad_660",L5t="_chevron_1h9ad_664",P5t="_chevronOpen_1h9ad_670",O5t="_chevronIcon_1h9ad_674",$5t="_diffPreview_1h9ad_680",B5t="_codeMirrorDiff_1h9ad_690",z5t="_codeMirrorDiffWrap_1h9ad_698",F5t="_diffError_1h9ad_706",q5t="_codeMirrorFile_1h9ad_731",H5t="_diffEmpty_1h9ad_797",U5t="_tree_1h9ad_617",W5t="_treeNode_1h9ad_810",V5t="_treeChildren_1h9ad_814",G5t="_treeRow_1h9ad_828",K5t="_treeFolder_1h9ad_861",Y5t="_treeFile_1h9ad_865",X5t="_treeTwisty_1h9ad_874",Q5t="_treeChevronIcon_1h9ad_883",J5t="_treeChevron_1h9ad_883",Z5t="_treeChevronClosed_1h9ad_894",e6t="_treeContent_1h9ad_898",t6t="_reviewBadge_1h9ad_921",n6t="_htmlPreviewWrap_1h9ad_934",s6t="_markdownPreviewWrap_1h9ad_940",r6t="_imagePreviewWrap_1h9ad_946",i6t="_imagePreview_1h9ad_946",o6t="_imageDownloadButton_1h9ad_962",a6t="_htmlPreview_1h9ad_934",l6t="_previewError_1h9ad_1004",c6t="_filePreviewWrap_1h9ad_1010",Fe={panel:_3t,panelDrawer:S3t,header:C3t,tabs:T3t,tabItem:E3t,tab:A3t,tabTitle:j3t,tabIcon:N3t,tabIconSvg:I3t,tabActive:M3t,tabCloseButton:R3t,tabCloseIcon:D3t,iconButton:L3t,iconButtonActive:P3t,headerActions:O3t,addButton:$3t,panelToggleButton:B3t,panelToggleIcon:z3t,toolbarIcon:F3t,body:q3t,bodySideTask:H3t,empty:U3t,emptyActions:W3t,emptyAction:V3t,emptyActionIcon:G3t,emptyActionTitle:K3t,emptyActionHint:Y3t,emptyActionChevron:X3t,sideTaskListTitle:Q3t,sideTaskListTime:J3t,sideTaskNewIcon:Z3t,meta:e5t,detail:t5t,section:n5t,sectionTitle:s5t,description:r5t,actionsRow:i5t,fieldGrid:o5t,fieldLabel:a5t,fieldValue:l5t,link:c5t,review:u5t,reviewToolbar:d5t,reviewToolbarTitle:h5t,reviewToolbarActions:f5t,reviewTotalsButton:m5t,reviewContent:p5t,reviewContentListOnly:g5t,reviewContentStacked:b5t,reviewList:y5t,reviewListWithExpanded:v5t,reviewSplitHandle:w5t,reviewItem:x5t,reviewItemExpanded:k5t,reviewRow:_5t,reviewRowToggle:S5t,reviewFileName:C5t,reviewOpenButton:T5t,fileIcon:E5t,reviewPath:A5t,treeName:j5t,pathPrefix:N5t,pathFileName:I5t,lineStats:M5t,additions:R5t,deletions:D5t,chevron:L5t,chevronOpen:P5t,chevronIcon:O5t,diffPreview:$5t,codeMirrorDiff:B5t,codeMirrorDiffWrap:z5t,diffError:F5t,codeMirrorFile:q5t,diffEmpty:H5t,tree:U5t,treeNode:W5t,treeChildren:V5t,treeRow:G5t,treeFolder:K5t,treeFile:Y5t,treeTwisty:X5t,treeChevronIcon:Q5t,treeChevron:J5t,treeChevronClosed:Z5t,treeContent:e6t,reviewBadge:t6t,htmlPreviewWrap:n6t,markdownPreviewWrap:s6t,imagePreviewWrap:r6t,imagePreview:i6t,imageDownloadButton:o6t,htmlPreview:a6t,previewError:l6t,filePreviewWrap:c6t},u6t="_detail_56y5v_1",d6t="_state_56y5v_7",h6t="_overview_56y5v_15",f6t="_descriptionRow_56y5v_23",m6t="_statusTag_56y5v_31",p6t="_statusActions_56y5v_36",g6t="_stopButton_56y5v_43",b6t="_stopError_56y5v_65",y6t="_description_56y5v_23",v6t="_prompt_56y5v_112",w6t="_transcript_56y5v_124",x6t="_retry_56y5v_133",Dc={detail:u6t,state:d6t,overview:h6t,descriptionRow:f6t,statusTag:m6t,statusActions:p6t,stopButton:g6t,stopError:b6t,description:y6t,prompt:v6t,transcript:w6t,retry:x6t};function k6t(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,l=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 l=="number"?l:t.cachedTokens}}function _Y(){return`subagent-detail:${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2)}`}function _6t(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 S6t(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 C6t(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 T6t({rootTool:e,resolution:t,onStop:n,onRightPanelOpen:s,onArtifactsChange:r,onError:i}){const{t:o}=nt(),l=za(),c=Qo(),u=Mfe(o),{artifacts:d}=yO(),f=h.useMemo(()=>vO(u,d,l.workspaceCwd||""),[d,l.workspaceCwd,u]),m=h.useMemo(()=>wO(u,f,l.workspaceCwd||""),[f,l.workspaceCwd,u]),p=K6(e),g=S6t(u,e),b=h.useMemo(()=>k6t(e,t),[t,e]),w=b.status==="running"||b.status==="in_progress",[y,v]=h.useState(!1),[x,k]=h.useState("");h.useEffect(()=>{const S=l.sessionId;if(S)return r==null||r(S,d,c),()=>{r==null||r(S,[],c)}},[d,l.sessionId,r,c]);const _=S=>{if(S.kind==="subagent"){s==null||s({...S,sourceSessionId:l.sessionId});return}s==null||s({...S,workspaceActions:c,sourceSessionId:l.sessionId})};h.useEffect(()=>{w||(v(!1),k(""))},[w]);const T=async()=>{if(!y){v(!0),k("");try{(await n()).cancelled||v(!1)}catch{v(!1),k(o("tasks.cancelFailed"))}}};return a.jsxs("div",{className:Dc.detail,children:[a.jsxs("div",{className:Dc.overview,children:[a.jsxs("div",{className:Dc.descriptionRow,children:[p&&a.jsx("div",{className:Dc.description,children:p}),a.jsxs("div",{className:Dc.statusActions,children:[a.jsx(Ni,{variant:"outline",className:Dc.statusTag,"data-status":b.status,children:C6t(b.status,o)}),w&&a.jsx("button",{type:"button",className:Dc.stopButton,disabled:y,onClick:()=>void T(),children:o(y?"common.loading":"tasks.action.stop")})]})]}),x&&a.jsx("div",{className:Dc.stopError,children:x}),g&&a.jsx("pre",{className:Dc.prompt,children:g})]}),a.jsx("div",{className:Dc.transcript,children:a.jsx(rO,{messages:u,pendingApproval:null,loadingTranscript:l.loadingTranscript,isResponding:w,workspaceCwd:l.workspaceCwd||"",hideSessionTimeline:!0,hideFirstUserMessage:!0,firstTurnMetrics:b,includeSubagentToolUsageInMetrics:!1,turnFileChanges:m,turnArtifacts:f,onTurnOutputOpen:_,onError:i})})]})}function E6t({sessionId:e,rootToolCallId:t,initialRootTool:n,workspaceCwd:s,onRightPanelOpen:r,onArtifactsChange:i,onError:o}){const{t:l}=nt(),c=Co(),u=za(),d=Mfe(l),f=(u.sessionId===e?_6t(d,t):void 0)??n,[m,p]=h.useState(()=>({key:0,clientId:_Y()})),[g,b]=h.useState(),[w,y]=h.useState(!1);return h.useEffect(()=>{let v=!1,x=!1,k=0,_;b(void 0),y(!1);const T=async()=>{try{const S=await c.client.resolveSubagentSession(e,t);if(v)return;x=!0,b(S),S.status==="running"&&(_=setTimeout(()=>void T(),3e3))}catch{if(v)return;!x&&k<3?(k+=1,_=setTimeout(()=>void T(),3e3)):x?_=setTimeout(()=>void T(),3e3):y(!0)}};return T(),()=>{v=!0,_&&clearTimeout(_)}},[m.key,t,e,c.client]),w?a.jsxs("div",{className:Dc.state,children:[a.jsx("div",{children:l("subagent.detailsLoadFailed")}),a.jsx("button",{type:"button",className:Dc.retry,onClick:()=>p(v=>({key:v.key+1,clientId:_Y()})),children:l("common.retry")})]}):g?a.jsx(m5,{sessionId:g.sessionId,workspaceCwd:s,clientId:m.clientId,maxQueued:256,subagentTranscriptMode:"full",suppressOwnUserEcho:!0,children:a.jsx(T6t,{rootTool:f,resolution:g,onRightPanelOpen:r,onArtifactsChange:i,onError:o,onStop:()=>c.client.cancelSubagentSession(e,t)})},`${m.key}:${g.sessionId}`):a.jsx("div",{className:Dc.state,children:l("subagent.detailsLoading")})}const A6t=3;function j6t({tabId:e,sessionId:t,parentSessionId:n,workspaceCwd:s,title:r,shouldNameFromFirstPrompt:i,initialPrompt:o,createSession:l,onCreated:c,onTitleChange:u,onRightPanelOpen:d,onArtifactsChange:f,onError:m}){return t?a.jsx(m5,{sessionId:t,workspaceCwd:s,clientId:`side-task:${n}:${e}`,autoConnect:!0,historyPageSize:aD,subagentTranscriptMode:"summary",maxBlocks:lD,suppressOwnUserEcho:!0,children:a.jsx(I6t,{tabId:e,title:r,shouldNameFromFirstPrompt:i,initialPrompt:o,workspaceCwd:s,onTitleChange:u,onRightPanelOpen:d,onArtifactsChange:f,onError:m})}):a.jsx(N6t,{tabId:e,parentSessionId:n,title:r,createSession:l,onCreated:c,onTitleChange:u,onError:m})}function N6t({tabId:e,parentSessionId:t,title:n,createSession:s,onCreated:r,onTitleChange:i,onError:o}){const{t:l}=nt(),c=h.useRef(!1),u=h.useRef(!1),[d,f]=h.useState(),m=h.useCallback(async()=>{if(!c.current){c.current=!0,f(void 0);try{const p=await s(e,t,n);r(e,p.sessionId),p.displayName&&i(e,p.displayName)}catch(p){f(p),o==null||o(p,l("sideTask.createFailed"))}finally{c.current=!1}}},[s,r,o,i,t,l,e,n]);return h.useEffect(()=>{u.current||(u.current=!0,m())},[m]),d?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 text-sm text-muted-foreground",children:[a.jsx("span",{children:l("sideTask.createFailed")}),a.jsx(Kt,{type:"button",variant:"outline",onClick:()=>void m(),children:l("common.retry")})]}):a.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-sm text-muted-foreground",role:"status",children:[a.jsx(Ws,{}),a.jsx("span",{children:l("sideTask.creating")})]})}function I6t({tabId:e,title:t,shouldNameFromFirstPrompt:n,initialPrompt:s,workspaceCwd:r,onTitleChange:i,onRightPanelOpen:o,onArtifactsChange:l,onError:c}){var x;const{t:u}=nt(),d=za(),f=rm(),m=nD(),p=tD(),g=m.some(k=>k.kind==="user"),b=d.status==="connected"&&!d.loadingTranscript&&!d.catchingUp&&!p.loading&&!p.hasMore&&!p.capacityReached&&!p.paginationError&&!g,w=!g&&(n||b);h.useEffect(()=>{var _;const k=(_=d.displayName)==null?void 0:_.trim();k&&i(e,k)},[d.displayName,i,e]);const y=h.useCallback(k=>{const _=Array.from(k.trim()).slice(0,200).join("");_&&(i(e,_),(async()=>{let T;for(let S=0;S<A6t;S++)try{await f.renameSession(_),i(e,_,!0);return}catch(C){T=C}c==null||c(T,u("sideTask.renameFailed"))})())},[f,c,i,u,e]),v=h.useRef(!1);return h.useEffect(()=>{const k=s==null?void 0:s.trim();!k||!b||v.current||(v.current=!0,f.sendPrompt(k,{onAdmitted:()=>y(k)}).catch(_=>{v.current=!1,c==null||c(_,u("sideTask.promptFailed"))}))},[f,s,y,c,b,u]),d.sessionId?a.jsx(sme,{title:((x=d.displayName)==null?void 0:x.trim())||t,workspaceCwd:r,onError:c,embedded:!0,onFirstPromptAdmitted:w?y:void 0,onRightPanelOpen:o,onPaneArtifactsChange:l}):a.jsx("div",{className:"flex h-full items-center justify-center",children:a.jsx(Ws,{})})}const M6t=700,R6t=["daily","weekdays","weekly","hourly","minutes","custom"],D6t=[1,2,3,4,5,6,10,12,15,20,30],L6t=(e,t)=>{},P6t=(e,t,n)=>{},O6t=()=>Promise.reject(new Error("Side-task session creation is unavailable")),$6t=["review","sideTask"];function SY({artifacts:e,tabs:t,activeTabId:n,reviewChanges:s,selectedReviewPath:r,panelWidth:i,workspaceCwd:o,loading:l,error:c,onSelectTab:u,onCloseTab:d,onOpenFilePreview:f,latestReviewAvailable:m=!1,onOpenLatestReview:p,items:g=$6t,sideTaskAvailable:b=!1,sideTasks:w=[],sideTasksLoading:y=!1,onCreateSideTask:v,onOpenSideTask:x,onCreateSideTaskSession:k,onSideTaskCreated:_,onSideTaskTitleChange:T,onNestedRightPanelOpen:S,onNestedArtifactsChange:C,onError:N,onClose:E,variant:O="docked"}){const{t:B}=nt(),[D,j]=h.useState(!1),L=h.useRef(null),z=h.useCallback(()=>{L.current&&(clearTimeout(L.current),L.current=null),j(!0)},[]),I=h.useCallback(()=>{L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{j(!1),L.current=null},120)},[]);h.useEffect(()=>()=>{L.current&&clearTimeout(L.current)},[]);const $=t.find(F=>F.id===n)??t[0],K=g.includes("review")&&!t.some(F=>F.kind==="review"),R=g.includes("sideTask")&&b&&!!v,Y=!!$&&(K||R),W=Qo(),M=$&&"workspaceActions"in $?$.workspaceActions??W:W;return a.jsxs("aside",{className:`${Fe.panel} ${O==="drawer"?Fe.panelDrawer:""}`,style:O==="docked"&&i?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[a.jsxs("div",{className:Fe.header,children:[t.length>0&&a.jsx("div",{className:Fe.tabs,role:"tablist","aria-label":"Right panel",children:t.map(F=>a.jsxs("div",{className:[Fe.tabItem,F.id===($==null?void 0:$.id)?Fe.tabActive:""].filter(Boolean).join(" "),children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":F.id===($==null?void 0:$.id),className:Fe.tab,onClick:()=>u(F.id),title:F.title,children:[a.jsx("span",{className:Fe.tabIcon,"aria-hidden":"true",children:F.kind==="review"?a.jsx(fN,{}):F.kind==="artifact"||F.kind==="file"?a.jsx(F6t,{}):F.kind==="subagent"?a.jsx(B6t,{}):F.kind==="monitor"?a.jsx(Ree,{className:Fe.tabIconSvg,strokeWidth:1.6}):F.kind==="shell"?a.jsx(Dee,{className:Fe.tabIconSvg,strokeWidth:1.6}):F.kind==="side_task"?a.jsx(w2,{className:Fe.tabIconSvg,strokeWidth:1.6}):a.jsx(q6t,{})}),a.jsx("span",{className:Fe.tabTitle,children:F.title})]}),a.jsx("button",{type:"button",className:Fe.tabCloseButton,onClick:()=>d(F.id),"aria-label":`Close ${F.title}`,title:"Close",children:a.jsx(z6t,{})})]},F.id))}),a.jsxs("div",{className:Fe.headerActions,children:[Y&&a.jsxs(Mu,{modal:!1,children:[a.jsx(Ru,{asChild:!0,children:a.jsx("button",{type:"button",className:`${Fe.iconButton} ${Fe.addButton}`,"aria-label":B("rightPanel.add"),title:B("rightPanel.add"),children:a.jsx(Vf,{className:Fe.toolbarIcon})})}),a.jsxs(Du,{align:"end",className:"w-64",children:[K&&a.jsxs(bi,{disabled:!m||!p,onSelect:p,children:[a.jsx(fN,{}),a.jsx("span",{className:Fe.sideTaskListTitle,children:B("turnOutputs.review")})]}),K&&R&&a.jsx(F3,{}),R&&a.jsxs(bi,{disabled:y,onSelect:v,children:[a.jsx(w2,{className:Fe.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:Fe.sideTaskListTitle,children:B("sideTask.create")})]})]})]}),a.jsx("button",{type:"button",className:`${Fe.iconButton} ${Fe.panelToggleButton}`,onClick:E,"aria-label":B("chatHeader.toggleRightPanel"),"aria-pressed":"true",title:B("chatHeader.toggleRightPanel"),children:a.jsx(Nee,{className:Fe.panelToggleIcon})})]})]}),a.jsx("div",{className:`${Fe.body} ${($==null?void 0:$.kind)==="side_task"?Fe.bodySideTask:""}`.trim(),children:$?$.kind==="review"?a.jsx(W6t,{changes:$.changes??s,selectedPath:$.selectedPath??r,workspaceCwd:$.workspaceCwd??o,onOpenFilePreview:F=>f(F,M,$.workspaceCwd??o),onDownloadFile:(F,J)=>Phe(M,F.path,tot(F.path),J),onDownloadError:F=>{const J=B("common.downloadFailed",{message:no(F)});N?N(new Error(J,{cause:F}),J):console.error(J,F)}}):$.kind==="file"?a.jsx(lme,{workspacePath:$.workspacePath,workspaceActions:M,previewContent:$.previewContent},$.id):$.kind==="artifact"?a.jsx(H6t,{artifacts:e,artifactId:$.artifactId,workspaceActions:M,previewContent:$.previewContent,loading:l,error:c},$.id):$.kind==="subagent"?a.jsx(E6t,{sessionId:$.sessionId,rootToolCallId:$.rootToolCallId,initialRootTool:$.rootTool,workspaceCwd:$.workspaceCwd??o,onRightPanelOpen:S,onArtifactsChange:C,onError:N}):$.kind==="monitor"?a.jsx(Ett,{task:$.task,actions:$.sessionActions},$.id):$.kind==="shell"?a.jsx(Att,{task:$.task,actions:$.sessionActions},$.id):$.kind==="side_task"?a.jsx(j6t,{tabId:$.id,sessionId:$.sessionId,parentSessionId:$.parentSessionId,workspaceCwd:$.workspaceCwd??o,title:$.title,shouldNameFromFirstPrompt:$.nameFromFirstPrompt,initialPrompt:$.initialPrompt,createSession:k??O6t,onCreated:_??L6t,onTitleChange:T??P6t,onRightPanelOpen:S,onArtifactsChange:C,onError:N},$.id):a.jsx(U6t,{task:$.task,actions:M},$.id):a.jsxs("div",{className:Fe.emptyActions,"data-testid":"right-panel-empty-actions",children:[g.includes("review")&&a.jsxs("button",{type:"button",className:Fe.emptyAction,disabled:!m||!p,onClick:p,children:[a.jsx("span",{className:Fe.emptyActionIcon,"aria-hidden":"true",children:a.jsx(fN,{})}),a.jsx("span",{className:Fe.emptyActionTitle,children:B("turnOutputs.review")}),a.jsx("span",{className:Fe.emptyActionHint,children:B("turnOutputs.reviewLatest")}),a.jsx(Eu,{className:Fe.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),g.includes("sideTask")&&b&&v&&(w.length===0?a.jsxs("button",{type:"button",className:Fe.emptyAction,disabled:y,"aria-busy":y,onClick:v,children:[a.jsx("span",{className:Fe.emptyActionIcon,"aria-hidden":"true",children:a.jsx(w2,{strokeWidth:1.6})}),a.jsx("span",{className:Fe.emptyActionTitle,children:B("sideTask.title")}),a.jsx("span",{className:Fe.emptyActionHint,children:B("sideTask.description")}),a.jsx(Eu,{className:Fe.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}):a.jsxs(Mu,{open:D,onOpenChange:j,modal:!1,children:[a.jsx(Ru,{asChild:!0,children:a.jsxs("button",{type:"button",className:Fe.emptyAction,"aria-expanded":D,onMouseEnter:z,onMouseLeave:I,children:[a.jsx("span",{className:Fe.emptyActionIcon,"aria-hidden":"true",children:a.jsx(w2,{strokeWidth:1.6})}),a.jsx("span",{className:Fe.emptyActionTitle,children:B("sideTask.title")}),a.jsx("span",{className:Fe.emptyActionHint,children:B("sideTask.description")}),a.jsx(Eu,{className:Fe.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})}),a.jsxs(Du,{align:"end",className:"w-80",onMouseEnter:z,onMouseLeave:I,children:[w.map(F=>a.jsxs(bi,{onSelect:()=>x==null?void 0:x(F),children:[a.jsx("span",{className:Fe.sideTaskListTitle,children:F.title}),F.updatedAt&&a.jsx("span",{className:Fe.sideTaskListTime,children:Zy(F.updatedAt,B)})]},F.sessionId)),a.jsx(F3,{}),a.jsxs(bi,{onSelect:v,children:[a.jsx(Yxe,{className:Fe.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:Fe.sideTaskListTitle,children:B("sideTask.new")})]})]})]}))]})})]})}function B6t(){return a.jsxs("svg",{className:Fe.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("circle",{cx:"12",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.6"}),a.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 z6t(){return a.jsx("svg",{className:Fe.tabCloseIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m4.5 4.5 7 7M11.5 4.5l-7 7",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function fN(){return a.jsxs("svg",{className:Fe.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[a.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),a.jsx("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),a.jsx("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function F6t(){return a.jsxs("svg",{className:Fe.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[a.jsx("rect",{x:"6",y:"4",width:"12",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"1.8"}),a.jsx("path",{d:"M9 10h6M9 14h4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function q6t(){return a.jsxs("svg",{className:Fe.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[a.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),a.jsx("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function H6t({artifacts:e,artifactId:t,workspaceActions:n,previewContent:s,loading:r,error:i}){const o=e.find(l=>l.id===t);return o?a.jsx(nEt,{artifact:o,workspaceActions:n,previewContent:s}):r?a.jsx("div",{className:Fe.empty,children:"Loading artifact..."}):i?a.jsx("div",{className:Fe.empty,children:i}):a.jsx("div",{className:Fe.empty,children:"Artifact not found."})}function U6t({task:e,actions:t}){const{t:n}=nt(),[s,r]=h.useState(null),[i,o]=h.useState(!0),[l,c]=h.useState(null),[u,d]=h.useState(""),[f,m]=h.useState(e.prompt),[p,g]=h.useState(()=>Om(e.cron)),[b,w]=h.useState(!1),[y,v]=h.useState(!1),[x,k]=h.useState(!1),[_,T]=h.useState(!1),[S,C]=h.useState(null),N=h.useCallback(async()=>{if(!e.durable){r(null),d(""),m(e.prompt),g(Om(e.cron)),c(null),o(!1);return}o(!0),c(null);try{const V=(await t.listScheduledTasks()).find(U=>U.id===e.id)??null;r(V),V?(d(V.name??""),m(V.prompt),g(Om(V.cron))):(d(""),m(e.prompt),g(Om(e.cron)))}catch(J){c(J instanceof Error?J.message:String(J))}finally{o(!1)}},[t,e.cron,e.durable,e.id,e.prompt]);h.useEffect(()=>{N()},[N]);const E=!e.durable,O=e.durable&&!i&&!l&&!s,B=!!s,D=(s==null?void 0:s.name)||(s==null?void 0:s.prompt)||e.title,j=(s==null?void 0:s.prompt)??e.prompt,L=(s==null?void 0:s.cron)??e.cron,z=(s==null?void 0:s.recurring)??e.recurring,I=s==null?void 0:s.enabled,$=h.useCallback(()=>{s&&(d(s.name??""),m(s.prompt),g(Om(s.cron)),C(null),w(!0))},[s]),K=h.useCallback(()=>{w(!1),C(null),s&&(d(s.name??""),m(s.prompt),g(Om(s.cron)))},[s]),R=h.useCallback(async()=>{if(!s)return;const J=B3(p);if(!J){C(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){C(n("scheduledTasks.error.emptyPrompt"));return}T(!0),C(null);try{const V=await t.updateScheduledTask(s.id,{cron:J,prompt:f.trim(),name:u.trim()||null});r(V),d(V.name??""),m(V.prompt),g(Om(V.cron)),w(!1)}catch(V){C(V instanceof Error?V.message:String(V))}finally{T(!1)}},[t,p,s,u,f,n]),Y=h.useCallback(async()=>{if(s){k(!0),C(null);try{const J=await t.updateScheduledTask(s.id,{enabled:!s.enabled});r(J)}catch(J){C(J instanceof Error?J.message:String(J))}finally{k(!1)}}},[t,s]),W=h.useCallback(async()=>{if(s){k(!0),C(null);try{await t.deleteScheduledTask(s.id),r(null),v(!1)}catch(J){C(J instanceof Error?J.message:String(J))}finally{k(!1)}}},[t,s]),M=B3(p),F=M?c_(M,n):null;return a.jsxs("div",{className:Fe.detail,children:[i&&a.jsx("div",{className:Fe.empty,children:n("scheduledTasks.loading")}),l&&a.jsx("div",{className:st.loadError,children:l}),O&&a.jsx("div",{className:Fe.empty,children:n("scheduledTasks.deletedSnapshot")}),E&&a.jsx("div",{className:Fe.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!O&&a.jsx("div",{className:Fe.section,children:a.jsxs("div",{className:Fe.fieldGrid,children:[a.jsx("span",{className:Fe.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("span",{className:Fe.fieldValue,children:D}),a.jsx("span",{className:Fe.fieldLabel,children:n("scheduledTasks.taskId")}),a.jsx("span",{className:Fe.fieldValue,children:e.id}),a.jsx("span",{className:Fe.fieldLabel,children:n("scheduledTasks.schedule")}),a.jsx("span",{className:Fe.fieldValue,children:c_(L,n)}),a.jsx("span",{className:Fe.fieldLabel,children:"Cron"}),a.jsx("span",{className:Fe.fieldValue,children:L}),a.jsx("span",{className:Fe.fieldLabel,children:n("scheduledTasks.type")}),a.jsx("span",{className:Fe.fieldValue,children:n(z?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),I!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Fe.fieldLabel,children:n("scheduledTasks.status")}),a.jsx("span",{className:Fe.fieldValue,children:n(I?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!O&&a.jsxs("div",{className:Fe.section,children:[a.jsx("div",{className:Fe.sectionTitle,children:"Prompt"}),a.jsx("div",{className:Fe.description,children:j})]}),S&&a.jsx("div",{className:st.formError,children:S}),a.jsxs("div",{className:Fe.actionsRow,children:[a.jsx("button",{type:"button",className:st.primaryButton,disabled:!B||x,onClick:$,children:n("scheduledTasks.edit")}),a.jsx("button",{type:"button",className:st.secondaryButton,disabled:!B||x,onClick:()=>void Y(),children:s!=null&&s.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),a.jsx("button",{type:"button",className:st.secondaryButton,disabled:!B||x,onClick:()=>v(!0),children:n("scheduledTasks.delete")})]}),y&&s&&a.jsx(Fi,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>v(!1),children:a.jsxs("div",{className:st.formFields,children:[a.jsx("div",{className:Fe.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),S&&a.jsx("div",{className:st.formError,children:S}),a.jsxs("div",{className:st.formActions,children:[a.jsx("button",{type:"button",className:st.secondaryButton,onClick:()=>v(!1),disabled:x,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:st.primaryButton,onClick:()=>void W(),disabled:x,children:n("scheduledTasks.delete")})]})]})}),b&&a.jsx(Fi,{title:n("scheduledTasks.editTitle"),size:"md",onClose:K,children:a.jsxs("div",{className:st.formFields,children:[a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("input",{className:st.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:J=>d(J.target.value)})]}),a.jsxs("label",{className:st.field,children:[a.jsxs("span",{className:st.fieldLabel,children:[n("scheduledTasks.prompt"),a.jsx("span",{className:st.required,children:"*"})]}),a.jsx("textarea",{className:st.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:J=>m(J.target.value)})]}),a.jsxs("div",{className:st.scheduleRow,children:[a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:n("scheduledTasks.frequency")}),a.jsx("select",{className:st.select,value:p.frequency,onChange:J=>{const V=J.target.value;g(U=>({...U,frequency:V,...V==="hourly"?{time:"00:00"}:{}}))},children:R6t.map(J=>a.jsx("option",{value:J,children:n(`scheduledTasks.freq.${J}`)},J))})]}),(p.frequency==="daily"||p.frequency==="weekdays"||p.frequency==="weekly")&&a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:n("scheduledTasks.time")}),a.jsx("input",{className:st.input,type:"time",value:p.time,onChange:J=>g(V=>({...V,time:J.target.value}))})]}),p.frequency==="weekly"&&a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:n("scheduledTasks.weekday")}),a.jsx("select",{className:st.select,value:p.weekday,onChange:J=>g(V=>({...V,weekday:Number(J.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((J,V)=>a.jsx("option",{value:V,children:J},V))})]}),p.frequency==="minutes"&&a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:n("scheduledTasks.interval")}),a.jsx("select",{className:st.select,value:p.minuteInterval,onChange:J=>g(V=>({...V,minuteInterval:Number(J.target.value)})),children:D6t.map(J=>a.jsx("option",{value:J,children:J},J))})]}),p.frequency==="custom"&&a.jsxs("label",{className:`${st.field} ${st.fieldGrow}`,children:[a.jsx("span",{className:st.fieldLabel,children:n("scheduledTasks.cron")}),a.jsx("input",{className:st.input,type:"text",value:p.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:J=>g(V=>({...V,customCron:J.target.value}))})]})]}),a.jsx("div",{className:st.preview,children:F?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:st.previewLabel,children:F}),a.jsx("code",{className:st.previewCron,children:M})]}):a.jsx("span",{className:st.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),S&&a.jsx("div",{className:st.formError,children:S}),a.jsxs("div",{className:st.formActions,children:[a.jsx("button",{type:"button",className:st.secondaryButton,onClick:K,disabled:_,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:st.primaryButton,onClick:()=>void R(),disabled:_,children:n(_?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function W6t({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s,onDownloadFile:r,onDownloadError:i}){const{t:o}=nt(),[l,c]=h.useState(!1),[u,d]=h.useState(!0),[f,m]=h.useState(!1),[p,g]=h.useState(520),b=h.useRef(p),w=h.useRef(null),y=h.useRef(null),[v,x]=h.useState(null),[k,_]=h.useState(()=>new Set),T=h.useRef(!0);h.useEffect(()=>(T.current=!0,()=>{T.current=!1}),[]);const S=l,C=h.useMemo(()=>tEt(e,n),[e,n]);h.useEffect(()=>{x(t)},[t]),h.useEffect(()=>{b.current=p},[p]),h.useEffect(()=>{const D=w.current;if(!D)return;const j=()=>{m(D.clientWidth<M6t)};j();const L=new ResizeObserver(j);return L.observe(D),()=>L.disconnect()},[u]),h.useEffect(()=>()=>{var D;return(D=y.current)==null?void 0:D.call(y)},[]);const N=h.useCallback(D=>{const j=w.current;if(!j)return;D.preventDefault();const L=D.currentTarget;L.setPointerCapture(D.pointerId);const z=D.clientX,I=b.current,$=j.getBoundingClientRect().width,K=Math.max(180,$-180),R=document.body.style.cursor,Y=document.body.style.userSelect;let W=I,M=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const F=()=>{M=null,g(W)},J=le=>{W=Math.min(K,Math.max(180,I+(le.clientX-z))),M===null&&(M=window.requestAnimationFrame(F))};let V=()=>{};const U=le=>{y.current=null,M!==null&&(window.cancelAnimationFrame(M),M=null),le&&g(W),L.hasPointerCapture(D.pointerId)&&L.releasePointerCapture(D.pointerId),document.body.style.cursor=R,document.body.style.userSelect=Y,window.removeEventListener("pointermove",J),window.removeEventListener("pointerup",V),window.removeEventListener("pointercancel",V)};V=()=>U(!0),y.current=()=>U(!1),window.addEventListener("pointermove",J),window.addEventListener("pointerup",V),window.addEventListener("pointercancel",V)},[]);if(e.length===0)return a.jsx("div",{className:Fe.empty,children:"No file changes to review."});const E=$he(e),O=D=>{x(j=>j===D?null:D)},B=async D=>{if(!k.has(D.path)){_(j=>new Set(j).add(D.path));try{await r(D,()=>!T.current)}catch(j){T.current&&i(j)}finally{_(j=>{const L=new Set(j);return L.delete(D.path),L})}}};return a.jsxs("div",{className:Fe.review,children:[a.jsxs("div",{className:Fe.reviewToolbar,children:[a.jsxs("div",{className:Fe.reviewToolbarTitle,children:[a.jsx("span",{children:o("turnOutputs.previousTurn")}),a.jsx(z3,{additions:E==null?void 0:E.additions,deletions:E==null?void 0:E.deletions,className:Fe.lineStats,additionsClassName:Fe.additions,deletionsClassName:Fe.deletions})]}),a.jsxs("div",{className:Fe.reviewToolbarActions,children:[a.jsxs("button",{type:"button",className:Fe.reviewTotalsButton,onClick:()=>d(D=>!D),"aria-expanded":u,children:[a.jsx("span",{children:o("turnOutputs.fileCount",{count:e.length})}),a.jsx("span",{className:[Fe.chevron,u?Fe.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(TY,{})})]}),a.jsx("button",{type:"button",className:[Fe.iconButton,l?Fe.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>c(D=>!D),"aria-label":o(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:o(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:l?a.jsx(Z6t,{}):a.jsx(J6t,{})})]})]}),u&&a.jsxs("div",{ref:w,className:[Fe.reviewContent,S?"":Fe.reviewContentListOnly,S&&f?Fe.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${p}px`},children:[a.jsx("div",{className:[Fe.reviewList,v?Fe.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(D=>{const j=v===D.path,L=Fhe(D.path),z=Bot(D.path);return a.jsxs("div",{className:[Fe.reviewItem,j?Fe.reviewItemExpanded:""].filter(Boolean).join(" "),children:[a.jsxs("div",{className:Fe.reviewRow,"data-selected":D.path===t||void 0,children:[a.jsx("button",{type:"button",className:Fe.reviewRowToggle,onClick:()=>O(D.path),"aria-label":D.path,"aria-expanded":j}),a.jsx("span",{className:Fe.fileIcon,children:ame(D.path)}),a.jsxs("span",{className:Fe.reviewFileName,children:[a.jsx(Y6t,{path:J6(D.path,n),title:D.path}),L&&a.jsx("button",{type:"button",className:Fe.reviewOpenButton,onClick:()=>s(D),title:`${o("turnOutputs.preview")} ${D.path}`,children:o("turnOutputs.preview")}),z&&a.jsx("button",{type:"button",className:Fe.reviewOpenButton,onClick:()=>void B(D),title:`${o("common.download")} ${D.path}`,disabled:k.has(D.path),children:o(k.has(D.path)?"common.downloading":"common.download")})]}),a.jsx(z3,{additions:D.additions,deletions:D.deletions,className:Fe.lineStats,additionsClassName:Fe.additions,deletionsClassName:Fe.deletions}),a.jsx("span",{className:[Fe.chevron,j?Fe.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(TY,{})})]}),j&&a.jsx(V6t,{change:D})]},`${D.toolCallId}:${D.path}`)})}),S&&!f&&a.jsx("div",{className:Fe.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:N}),S&&a.jsx("div",{className:Fe.tree,children:C.children.map(D=>a.jsx(rme,{node:D,depth:0,selectedPath:t},D.path))})]})]})}function V6t({change:e}){if(e.diffs.length===0)return a.jsx("div",{className:Fe.diffEmpty,children:"No diff available."});const t=G6t(e.diffs);return a.jsx("div",{className:Fe.diffPreview,children:t.map((n,s)=>a.jsx(K6t,{oldText:n.oldText,newText:n.newText},s))})}function G6t(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 K6t({oldText:e,newText:t}){const n=h.useRef(null),[s,r]=h.useState(null),[i,o]=h.useState(null);return h.useEffect(()=>{const l=n.current;if(!l)return;const c=()=>r(l.clientWidth>=720);c();const u=new ResizeObserver(c);return u.observe(l),()=>u.disconnect()},[]),h.useEffect(()=>{const l=n.current;if(!l||s===null)return;l.replaceChildren(),o(null);let c=!1,u=null;const d=[Ade,Yt.editable.of(!1),wr.readOnly.of(!0),Yt.lineWrapping],f={scanLimit:1e3,timeout:500},m={margin:3,minSize:8};return ye(async()=>{const{MergeView:p,unifiedMergeView:g}=await import("./index-B_1Z0Mgr.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:l,highlightChanges:!0,gutter:!0,revertControls:void 0,collapseUnchanged:m,diffConfig:f});return}u=new Yt({doc:t,extensions:[...d,g({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:m,diffConfig:f})],parent:l})}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]),a.jsxs("div",{className:Fe.codeMirrorDiffWrap,children:[a.jsx("div",{ref:n,className:Fe.codeMirrorDiff}),i&&a.jsxs("div",{className:Fe.diffError,children:["Diff unavailable: ",i]})]})}function rme({node:e,depth:t,selectedPath:n}){var d,f;const s=!!e.file,[r,i]=h.useState(!0),o=[Fe.treeRow,s?Fe.treeFile:Fe.treeFolder].filter(Boolean).join(" "),l={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=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Fe.treeTwisty,children:!s&&a.jsx("span",{className:[Fe.treeChevron,r?"":Fe.treeChevronClosed].filter(Boolean).join(" "),children:a.jsx(eEt,{})})}),a.jsxs("span",{className:Fe.treeContent,children:[s&&a.jsx("span",{className:Fe.fileIcon,children:ame(e.path)}),a.jsx("span",{className:Fe.treeName,children:e.name})]}),((d=e.file)==null?void 0:d.isArtifact)&&a.jsx("span",{className:Fe.reviewBadge,children:"artifact"})]});return a.jsxs("div",{className:Fe.treeNode,children:[s?a.jsx("div",{className:o,"data-selected":((f=e.file)==null?void 0:f.path)===n||void 0,"data-depth":t,style:l,title:e.path,children:u}):a.jsx("button",{type:"button",className:o,"data-depth":t,style:l,title:e.path,"aria-expanded":r,onClick:()=>i(m=>!m),children:u}),!s&&r&&e.children.length>0&&a.jsx("div",{className:Fe.treeChildren,style:c,children:e.children.map(m=>a.jsx(rme,{node:m,depth:t+1,selectedPath:n},m.path))})]})}function Y6t({path:e,title:t}){const n=h.useRef(null),[s,r]=h.useState(()=>ime(e));return h.useLayoutEffect(()=>{const i=n.current;if(!i)return;const o=()=>r(X6t(e,i));o();const l=new ResizeObserver(o);return l.observe(i),()=>l.disconnect()},[e]),a.jsxs("span",{ref:n,className:Fe.reviewPath,title:t??e,children:[s.prefix&&a.jsx("span",{className:Fe.pathPrefix,children:s.prefix}),a.jsx("span",{className:Fe.pathFileName,children:s.leaf})]})}function ime(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let CY=null;function X6t(e,t){const n=ime(e),s=t.clientWidth;if(s<=0)return n;const r=Q6t(t);if(r(e)<=s)return n;const i=e.split("/").filter(Boolean),o=i.at(-1)??e,l=r(o);if(i.length<=1||l+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)+l>s)break;c=f}return{prefix:c,leaf:o}}function Q6t(e){CY??(CY=document.createElement("canvas"));const t=CY.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 J6t(){return a.jsxs("svg",{className:Fe.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.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"}),a.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 Z6t(){return a.jsxs("svg",{className:Fe.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.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"}),a.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 TY(){return a.jsx("svg",{className:Fe.chevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m6 4 4 4-4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function eEt(){return a.jsx("svg",{className:Fe.treeChevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function tEt(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=J6(s.path,t).split("/").filter(Boolean);let i=n;for(let o=0;o<r.length;o++){const l=r[o],c=r.slice(0,o+1).join("/");let u=i.children.find(d=>d.name===l);u||(u={name:l,path:c,children:[]},i.children.push(u)),o===r.length-1&&(u.file=s),i=u}}return ome(n),n}function ome(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)ome(t)}function L4(e){return nm(e).split("/").filter(Boolean).at(-1)??e}function ame(e){var r;const t=L4(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 nEt({artifact:e,workspaceActions:t,previewContent:n}){var c;const s=not(e),r=Ele(e.url)?e.url:void 0,i=((c=e.metadata)==null?void 0:c.artifactType)==="automation_snapshot",o=e.storage==="workspace"&&!!e.workspacePath,l=eot(e);return o&&e.workspacePath?a.jsx(lme,{workspacePath:e.workspacePath,artifactVersion:e.updatedAt,workspaceActions:t,previewContent:n,imageMimeType:l,previewKind:sEt(e)?"html":rEt(e)?"markdown":l?"image":"source"}):a.jsxs("div",{className:Fe.detail,children:[a.jsxs("div",{className:Fe.section,children:[a.jsx("div",{className:Fe.sectionTitle,children:i?"Automation Snapshot":"Artifact"}),a.jsxs("div",{className:Fe.fieldGrid,children:[a.jsx(Yd,{label:"Type",value:Mhe(e.kind)}),a.jsx(Yd,{label:"Storage",value:e.storage}),a.jsx(Yd,{label:"Status",value:e.status}),a.jsx(Yd,{label:"Source",value:e.source}),a.jsx(Yd,{label:"Size",value:Rhe(e.sizeBytes)}),a.jsx(Yd,{label:"Created",value:e.createdAt}),a.jsx(Yd,{label:"Updated",value:e.updatedAt}),e.toolName&&a.jsx(Yd,{label:"Tool",value:e.toolName}),e.toolCallId&&a.jsx(Yd,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&a.jsxs("div",{className:Fe.section,children:[a.jsx("div",{className:Fe.sectionTitle,children:"Description"}),a.jsx("div",{className:Fe.description,children:e.description})]}),i&&e.metadata&&a.jsxs("div",{className:Fe.section,children:[a.jsx("div",{className:Fe.sectionTitle,children:"Details"}),a.jsxs("div",{className:Fe.fieldGrid,children:[cb(e.metadata,"automationId","Automation ID"),cb(e.metadata,"schedule","Schedule"),cb(e.metadata,"timezone","Timezone"),cb(e.metadata,"status","Status"),cb(e.metadata,"nextRunAt","Next run"),cb(e.metadata,"prompt","Prompt")]})]}),(s||r)&&a.jsxs("div",{className:Fe.section,children:[a.jsx("div",{className:Fe.sectionTitle,children:"Location"}),r?a.jsx("a",{className:Fe.link,href:r,target:"_blank",rel:"noreferrer",children:r}):a.jsx("div",{className:Fe.meta,children:s})]})]})}function sEt(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 rEt(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 lme({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,imageMimeType:r,previewKind:i}){const o=e.toLowerCase(),l=r??tO(e),c=i??(o.endsWith(".html")||o.endsWith(".htm")?"html":o.endsWith(".md")||o.endsWith(".markdown")?"markdown":l?"image":"source");return c==="html"?a.jsx(oEt,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s}):c==="markdown"?a.jsx(lEt,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s}):c==="image"&&l?a.jsx(iEt,{workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:l}):a.jsx(aEt,{workspacePath:e,artifactVersion:t,workspaceActions:n})}function iEt({workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:s}){const[r,i]=h.useState(null),[o,l]=h.useState(null);return h.useEffect(()=>{let c=!1,u;return i(null),l(null),Lhe((d,f)=>n.readFileBytes(d,f),e,s,{statFile:d=>n.stat(d),isCancelled:()=>c}).then(d=>{c||(u=URL.createObjectURL(d),i(u))}).catch(d=>{c||l(d instanceof Error?d.message:String(d))}),()=>{c=!0,u&&URL.revokeObjectURL(u)}},[t,s,n,e]),a.jsxs("div",{className:Fe.imagePreviewWrap,children:[r?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:Fe.imagePreview,src:r,alt:L4(e)}),a.jsx("a",{className:Fe.imageDownloadButton,href:r,download:L4(e),"aria-label":`Download ${L4(e)}`,title:"Download",children:a.jsx(Hx,{size:16,strokeWidth:1.8})})]}):o?null:a.jsx("div",{className:Fe.empty,children:"Loading image..."}),o&&a.jsx("div",{className:Fe.previewError,children:o})]})}function _O({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,truncatedMessage:r}){const[i,o]=h.useState(s??null),[l,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:l}}function oEt({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s}){const{content:r,error:i}=_O({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,truncatedMessage:"Preview is truncated because the file is too large."});return a.jsxs("div",{className:Fe.htmlPreviewWrap,children:[r===null?a.jsx("div",{className:Fe.empty,children:"Loading preview..."}):a.jsx("iframe",{className:Fe.htmlPreview,referrerPolicy:"no-referrer",sandbox:"allow-scripts",srcDoc:sot(r),title:`Preview ${e}`}),i&&a.jsx("div",{className:Fe.previewError,children:i})]})}function aEt({workspacePath:e,artifactVersion:t,workspaceActions:n}){const s=h.useRef(null),[r,i]=h.useState(null),{content:o,error:l}=_O({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 Yt({doc:o,extensions:[Ade,Yt.editable.of(!1),wr.readOnly.of(!0),Yt.lineWrapping],parent:c})}catch(d){i(d instanceof Error?d.message:String(d));return}return()=>u.destroy()},[o]),a.jsxs("div",{className:Fe.filePreviewWrap,children:[o===null?a.jsx("div",{className:Fe.empty,children:"Loading file..."}):a.jsx("div",{ref:s,className:Fe.codeMirrorFile}),(l||r)&&a.jsx("div",{className:Fe.previewError,children:l||r})]})}function lEt({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s}){const{content:r,error:i}=_O({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,truncatedMessage:"Preview is truncated because the file is too large."});return a.jsxs("div",{className:Fe.markdownPreviewWrap,children:[r===null?a.jsx("div",{className:Fe.empty,children:"Loading preview..."}):a.jsx(Jf,{content:r}),i&&a.jsx("div",{className:Fe.previewError,children:i})]})}function Yd({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Fe.fieldLabel,children:e}),a.jsx("span",{className:Fe.fieldValue,children:t})]}):null}function cb(e,t,n){const s=e[t];return s==null||s===""?null:a.jsx(Yd,{label:n,value:String(s)},t)}function cEt(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 cme=Rn.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}),nS=()=>{const e=Rn.useContext(cme);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};cEt(`[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 uEt(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function dEt(){return SO(/^Mac/)}function hEt(){return SO(/^iPhone/)}function EY(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function fEt(){return SO(/^iPad/)||dEt()&&navigator.maxTouchPoints>1}function ume(){return hEt()||fEt()}function SO(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const mEt=24,pEt=typeof window<"u"?h.useLayoutEffect:h.useEffect;function AY(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}const mN=typeof document<"u"&&window.visualViewport;function jY(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function dme(e){for(jY(e)&&(e=e.parentElement);e&&!jY(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const gEt=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let MC=0,pN;function bEt(e={}){let{isDisabled:t}=e;pEt(()=>{if(!t)return MC++,MC===1&&ume()&&(pN=yEt()),()=>{MC--,MC===0&&(pN==null||pN())}},[t])}function yEt(){let e,t=0,n=f=>{e=dme(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;NR(m)&&m!==document.activeElement&&(f.preventDefault(),m.style.transform="translateY(-2000px)",m.focus(),requestAnimationFrame(()=>{m.style.transform=""}))},i=f=>{let m=f.target;NR(m)&&(m.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{m.style.transform="",mN&&(mN.height<window.innerHeight?requestAnimationFrame(()=>{NY(m)}):mN.addEventListener("resize",()=>NY(m),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},l=window.pageXOffset,c=window.pageYOffset,u=AY(vEt(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let d=AY(Qw(document,"touchstart",n,{passive:!1,capture:!0}),Qw(document,"touchmove",s,{passive:!1,capture:!0}),Qw(document,"touchend",r,{passive:!1,capture:!0}),Qw(document,"focus",i,!0),Qw(window,"scroll",o));return()=>{u(),d(),window.scrollTo(l,c)}}function vEt(e,t,n){let s=e.style[t];return e.style[t]=n,()=>{e.style[t]=s}}function Qw(e,t,n,s){return e.addEventListener(t,n,s),()=>{e.removeEventListener(t,n,s)}}function NY(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=dme(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+mEt;i>o&&(n.scrollTop+=r-s)}e=n.parentElement}}function NR(e){return e instanceof HTMLInputElement&&!gEt.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function wEt(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function xEt(...e){return t=>e.forEach(n=>wEt(n,t))}function hme(...e){return h.useCallback(xEt(...e),e)}const fme=new WeakMap;function ra(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&&fme.set(e,s)}function kEt(e,t){if(!e||!(e instanceof HTMLElement))return;let n=fme.get(e);n&&(e.style[t]=n[t])}const zo=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function RC(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(", ")[zo(t)?13:12]):(r=s.match(/^matrix\((.+)\)$/),r?parseFloat(r[1].split(", ")[zo(t)?5:4]):null)}function _Et(e){return 8*(Math.log(e+1)-2)}function gN(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}function SEt(...e){return(...t)=>{for(const n of e)typeof n=="function"&&n(...t)}}const so={DURATION:.5,EASE:[.32,.72,0,1]},mme=.4,CEt=.25,TEt=100,pme=8,ng=16,IR=26,bN="vaul-dragging";function gme(e){const t=Rn.useRef(e);return Rn.useEffect(()=>{t.current=e}),Rn.useMemo(()=>(...n)=>t.current==null?void 0:t.current.call(t,...n),[])}function EEt({defaultProp:e,onChange:t}){const n=Rn.useState(e),[s]=n,r=Rn.useRef(s),i=gme(t);return Rn.useEffect(()=>{r.current!==s&&(i(s),r.current=s)},[s,r,i]),n}function bme({prop:e,defaultProp:t,onChange:n=()=>{}}){const[s,r]=EEt({defaultProp:t,onChange:n}),i=e!==void 0,o=i?e:s,l=gme(n),c=Rn.useCallback(u=>{if(i){const f=typeof u=="function"?u(e):u;f!==e&&l(f)}else r(u)},[i,e,r,l]);return[o,c]}function AEt({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:s,overlayRef:r,fadeFromIndex:i,onSnapPointChange:o,direction:l="bottom",container:c,snapToSequentialPoint:u}){const[d,f]=bme({prop:e,defaultProp:n==null?void 0:n[0],onChange:t}),[m,p]=Rn.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);Rn.useEffect(()=>{function S(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const g=Rn.useMemo(()=>d===(n==null?void 0:n[n.length-1])||null,[n,d]),b=Rn.useMemo(()=>{var S;return(S=n==null?void 0:n.findIndex(C=>C===d))!=null?S:null},[n,d]),w=n&&n.length>0&&(i||i===0)&&!Number.isNaN(i)&&n[i]===d||!n,y=Rn.useMemo(()=>{const S=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var C;return(C=n==null?void 0:n.map(N=>{const E=typeof N=="string";let O=0;if(E&&(O=parseInt(N,10)),zo(l)){const D=E?O:m?N*S.height:0;return m?l==="bottom"?S.height-D:-S.height+D:D}const B=E?O:m?N*S.width:0;return m?l==="right"?S.width-B:-S.width+B:B}))!=null?C:[]},[n,m,c]),v=Rn.useMemo(()=>b!==null?y==null?void 0:y[b]:null,[y,b]),x=Rn.useCallback(S=>{var C;const N=(C=y==null?void 0:y.findIndex(E=>E===S))!=null?C:null;o(N),ra(s.current,{transition:`transform ${so.DURATION}s cubic-bezier(${so.EASE.join(",")})`,transform:zo(l)?`translate3d(0, ${S}px, 0)`:`translate3d(${S}px, 0, 0)`}),y&&N!==y.length-1&&i!==void 0&&N!==i&&N<i?ra(r.current,{transition:`opacity ${so.DURATION}s cubic-bezier(${so.EASE.join(",")})`,opacity:"0"}):ra(r.current,{transition:`opacity ${so.DURATION}s cubic-bezier(${so.EASE.join(",")})`,opacity:"1"}),f(n==null?void 0:n[Math.max(N,0)])},[s.current,n,y,i,r,f]);Rn.useEffect(()=>{if(d||e){var S;const C=(S=n==null?void 0:n.findIndex(N=>N===e||N===d))!=null?S:-1;y&&C!==-1&&typeof y[C]=="number"&&x(y[C])}},[d,e,n,y,x]);function k({draggedDistance:S,closeDrawer:C,velocity:N,dismissible:E}){if(i===void 0)return;const O=l==="bottom"||l==="right"?(v??0)-S:(v??0)+S,B=b===i-1,D=b===0,j=S>0;if(B&&ra(r.current,{transition:`opacity ${so.DURATION}s cubic-bezier(${so.EASE.join(",")})`}),!u&&N>2&&!j){E?C():x(y[0]);return}if(!u&&N>2&&j&&y&&n){x(y[n.length-1]);return}const L=y==null?void 0:y.reduce((I,$)=>typeof I!="number"||typeof $!="number"?I:Math.abs($-O)<Math.abs(I-O)?$:I),z=zo(l)?window.innerHeight:window.innerWidth;if(N>mme&&Math.abs(S)<z*.4){const I=j?1:-1;if(I>0&&g&&n){x(y[n.length-1]);return}if(D&&I<0&&E&&C(),b===null)return;x(y[b+I]);return}x(L)}function _({draggedDistance:S}){if(v===null)return;const C=l==="bottom"||l==="right"?v-S:v+S;(l==="bottom"||l==="right")&&C<y[y.length-1]||(l==="top"||l==="left")&&C>y[y.length-1]||ra(s.current,{transform:zo(l)?`translate3d(0, ${C}px, 0)`:`translate3d(${C}px, 0, 0)`})}function T(S,C){if(!n||typeof b!="number"||!y||i===void 0)return null;const N=b===i-1;if(b>=i&&C)return 0;if(N&&!C)return 1;if(!w&&!N)return null;const O=N?b+1:b-1,B=N?y[O]-y[O-1]:y[O+1]-y[O],D=S/Math.abs(B);return N?1-D:D}return{isLastSnapPoint:g,activeSnapPoint:d,shouldFade:w,getPercentageDragged:T,setActiveSnapPoint:f,activeSnapPointIndex:b,onRelease:k,onDrag:_,snapPointsOffset:y}}const jEt=()=>()=>{};function NEt(){const{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:s,noBodyStyles:r}=nS(),i=Rn.useRef(null),o=h.useMemo(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-IR)/window.innerWidth}Rn.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;SEt(s&&!r?gN(document.body,{background:"black"}):jEt,gN(c,{transformOrigin:zo(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${so.DURATION}s`,transitionTimingFunction:`cubic-bezier(${so.EASE.join(",")})`}));const u=gN(c,{borderRadius:`${pme}px`,overflow:"hidden",...zo(e)?{transform:`scale(${l()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${l()}) 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")},so.DURATION*1e3)}}},[t,n,o])}let Jw=null;function IEt({isOpen:e,modal:t,nested:n,hasBeenOpened:s,preventScrollRestoration:r,noBodyStyles:i}){const[o,l]=Rn.useState(()=>typeof window<"u"?window.location.href:""),c=Rn.useRef(0),u=Rn.useCallback(()=>{if(EY()&&Jw===null&&e&&!i){Jw={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=Rn.useCallback(()=>{if(EY()&&Jw!==null&&!i){const f=-parseInt(document.body.style.top,10),m=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Jw),window.requestAnimationFrame(()=>{if(r&&o!==window.location.href){l(window.location.href);return}window.scrollTo(m,f)}),Jw=null}},[o]);return Rn.useEffect(()=>{function f(){c.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),Rn.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||d()}},[t,d]),Rn.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 MEt({open:e,onOpenChange:t,children:n,onDrag:s,onRelease:r,snapPoints:i,shouldScaleBackground:o=!1,setBackgroundColorOnScale:l=!0,closeThreshold:c=CEt,scrollLockTimeout:u=TEt,dismissible:d=!0,handleOnly:f=!1,fadeFromIndex:m=i&&i.length-1,activeSnapPoint:p,setActiveSnapPoint:g,fixed:b,modal:w=!0,onClose:y,nested:v,noBodyStyles:x=!1,direction:k="bottom",defaultOpen:_=!1,disablePreventScroll:T=!0,snapToSequentialPoint:S=!1,preventScrollRestoration:C=!1,repositionInputs:N=!0,onAnimationEnd:E,container:O,autoFocus:B=!1}){var D,j;const[L=!1,z]=bme({defaultProp:_,prop:e,onChange:we=>{t==null||t(we),!we&&!v&&Ae(),setTimeout(()=>{E==null||E(we)},so.DURATION*1e3),we&&!w&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),we||(document.body.style.pointerEvents="auto")}}),[I,$]=Rn.useState(!1),[K,R]=Rn.useState(!1),[Y,W]=Rn.useState(!1),M=Rn.useRef(null),F=Rn.useRef(null),J=Rn.useRef(null),V=Rn.useRef(null),U=Rn.useRef(null),le=Rn.useRef(!1),pe=Rn.useRef(null),fe=Rn.useRef(0),Q=Rn.useRef(!1),ne=Rn.useRef(!_),de=Rn.useRef(0),ue=Rn.useRef(null),me=Rn.useRef(((D=ue.current)==null?void 0:D.getBoundingClientRect().height)||0),te=Rn.useRef(((j=ue.current)==null?void 0:j.getBoundingClientRect().width)||0),ae=Rn.useRef(0),be=Rn.useCallback(we=>{i&&we===_t.length-1&&(F.current=new Date)},[]),{activeSnapPoint:se,activeSnapPointIndex:ve,setActiveSnapPoint:ze,onRelease:Pe,snapPointsOffset:_t,onDrag:Pt,shouldFade:St,getPercentageDragged:he}=AEt({snapPoints:i,activeSnapPointProp:p,setActiveSnapPointProp:g,drawerRef:ue,fadeFromIndex:m,overlayRef:M,onSnapPointChange:be,direction:k,container:O,snapToSequentialPoint:S});bEt({isDisabled:!L||K||!w||Y||!I||!N||!T});const{restorePositionSetting:Ae}=IEt({isOpen:L,modal:w,nested:v??!1,hasBeenOpened:I,preventScrollRestoration:C,noBodyStyles:x});function rt(){return(window.innerWidth-IR)/window.innerWidth}function dt(we){var We,ce;!d&&!i||ue.current&&!ue.current.contains(we.target)||(me.current=((We=ue.current)==null?void 0:We.getBoundingClientRect().height)||0,te.current=((ce=ue.current)==null?void 0:ce.getBoundingClientRect().width)||0,R(!0),J.current=new Date,ume()&&window.addEventListener("touchend",()=>le.current=!1,{once:!0}),we.target.setPointerCapture(we.pointerId),fe.current=zo(k)?we.pageY:we.pageX)}function jt(we,We){var ce;let De=we;const ct=(ce=window.getSelection())==null?void 0:ce.toString(),qe=ue.current?RC(ue.current,k):null,Ve=new Date;if(De.tagName==="SELECT"||De.hasAttribute("data-vaul-no-drag")||De.closest("[data-vaul-no-drag]"))return!1;if(k==="right"||k==="left")return!0;if(F.current&&Ve.getTime()-F.current.getTime()<500)return!1;if(qe!==null&&(k==="bottom"?qe>0:qe<0))return!0;if(ct&&ct.length>0)return!1;if(U.current&&Ve.getTime()-U.current.getTime()<u&&qe===0||We)return U.current=Ve,!1;for(;De;){if(De.scrollHeight>De.clientHeight){if(De.scrollTop!==0)return U.current=new Date,!1;if(De.getAttribute("role")==="dialog")return!0}De=De.parentNode}return!0}function et(we){if(ue.current&&K){const We=k==="bottom"||k==="right"?1:-1,ce=(fe.current-(zo(k)?we.pageY:we.pageX))*We,De=ce>0,ct=i&&!d&&!De;if(ct&&ve===0)return;const qe=Math.abs(ce),Ve=document.querySelector("[data-vaul-drawer-wrapper]"),Qt=k==="bottom"||k==="top"?me.current:te.current;let Un=qe/Qt;const Ie=he(qe,De);if(Ie!==null&&(Un=Ie),ct&&Un>=1||!le.current&&!jt(we.target,De))return;if(ue.current.classList.add(bN),le.current=!0,ra(ue.current,{transition:"none"}),ra(M.current,{transition:"none"}),i&&Pt({draggedDistance:ce}),De&&!i){const Wt=_Et(ce),Me=Math.min(Wt*-1,0)*We;ra(ue.current,{transform:zo(k)?`translate3d(0, ${Me}px, 0)`:`translate3d(${Me}px, 0, 0)`});return}const wt=1-Un;if((St||m&&ve===m-1)&&(s==null||s(we,Un),ra(M.current,{opacity:`${wt}`,transition:"none"},!0)),Ve&&M.current&&o){const Wt=Math.min(rt()+Un*(1-rt()),1),Me=8-Un*8,Je=Math.max(0,14-Un*14);ra(Ve,{borderRadius:`${Me}px`,transform:zo(k)?`scale(${Wt}) translate3d(0, ${Je}px, 0)`:`scale(${Wt}) translate3d(${Je}px, 0, 0)`,transition:"none"},!0)}if(!i){const Wt=qe*We;ra(ue.current,{transform:zo(k)?`translate3d(0, ${Wt}px, 0)`:`translate3d(${Wt}px, 0, 0)`})}}}Rn.useEffect(()=>{window.requestAnimationFrame(()=>{ne.current=!0})},[]),Rn.useEffect(()=>{var we;function We(){if(!ue.current||!N)return;const ce=document.activeElement;if(NR(ce)||Q.current){var De;const ct=((De=window.visualViewport)==null?void 0:De.height)||0,qe=window.innerHeight;let Ve=qe-ct;const Qt=ue.current.getBoundingClientRect().height||0,Un=Qt>qe*.8;ae.current||(ae.current=Qt);const Ie=ue.current.getBoundingClientRect().top;if(Math.abs(de.current-Ve)>60&&(Q.current=!Q.current),i&&i.length>0&&_t&&ve){const wt=_t[ve]||0;Ve+=wt}if(de.current=Ve,Qt>ct||Q.current){const wt=ue.current.getBoundingClientRect().height;let Wt=wt;wt>ct&&(Wt=ct-(Un?Ie:IR)),b?ue.current.style.height=`${wt-Math.max(Ve,0)}px`:ue.current.style.height=`${Math.max(Wt,ct-Ie)}px`}else uEt()||(ue.current.style.height=`${ae.current}px`);i&&i.length>0&&!Q.current?ue.current.style.bottom="0px":ue.current.style.bottom=`${Math.max(Ve,0)}px`}}return(we=window.visualViewport)==null||we.addEventListener("resize",We),()=>{var ce;return(ce=window.visualViewport)==null?void 0:ce.removeEventListener("resize",We)}},[ve,i,_t]);function Mt(we){Ye(),y==null||y(),we||z(!1),setTimeout(()=>{i&&ze(i[0])},so.DURATION*1e3)}function sn(){if(!ue.current)return;const we=document.querySelector("[data-vaul-drawer-wrapper]"),We=RC(ue.current,k);ra(ue.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${so.DURATION}s cubic-bezier(${so.EASE.join(",")})`}),ra(M.current,{transition:`opacity ${so.DURATION}s cubic-bezier(${so.EASE.join(",")})`,opacity:"1"}),o&&We&&We>0&&L&&ra(we,{borderRadius:`${pme}px`,overflow:"hidden",...zo(k)?{transform:`scale(${rt()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${rt()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${so.DURATION}s`,transitionTimingFunction:`cubic-bezier(${so.EASE.join(",")})`},!0)}function Ye(){!K||!ue.current||(ue.current.classList.remove(bN),le.current=!1,R(!1),V.current=new Date)}function $n(we){if(!K||!ue.current)return;ue.current.classList.remove(bN),le.current=!1,R(!1),V.current=new Date;const We=RC(ue.current,k);if(!we||!jt(we.target,!1)||!We||Number.isNaN(We)||J.current===null)return;const ce=V.current.getTime()-J.current.getTime(),De=fe.current-(zo(k)?we.pageY:we.pageX),ct=Math.abs(De)/ce;if(ct>.05&&(W(!0),setTimeout(()=>{W(!1)},200)),i){Pe({draggedDistance:De*(k==="bottom"||k==="right"?1:-1),closeDrawer:Mt,velocity:ct,dismissible:d}),r==null||r(we,!0);return}if(k==="bottom"||k==="right"?De>0:De<0){sn(),r==null||r(we,!0);return}if(ct>mme){Mt(),r==null||r(we,!1);return}var qe;const Ve=Math.min((qe=ue.current.getBoundingClientRect().height)!=null?qe:0,window.innerHeight);var Qt;const Un=Math.min((Qt=ue.current.getBoundingClientRect().width)!=null?Qt:0,window.innerWidth),Ie=k==="left"||k==="right";if(Math.abs(We)>=(Ie?Un:Ve)*c){Mt(),r==null||r(we,!1);return}r==null||r(we,!0),sn()}Rn.useEffect(()=>(L&&(ra(document.documentElement,{scrollBehavior:"auto"}),F.current=new Date),()=>{kEt(document.documentElement,"scrollBehavior")}),[L]);function Te(we){const We=we?(window.innerWidth-ng)/window.innerWidth:1,ce=we?-ng:0;pe.current&&window.clearTimeout(pe.current),ra(ue.current,{transition:`transform ${so.DURATION}s cubic-bezier(${so.EASE.join(",")})`,transform:zo(k)?`scale(${We}) translate3d(0, ${ce}px, 0)`:`scale(${We}) translate3d(${ce}px, 0, 0)`}),!we&&ue.current&&(pe.current=setTimeout(()=>{const De=RC(ue.current,k);ra(ue.current,{transition:"none",transform:zo(k)?`translate3d(0, ${De}px, 0)`:`translate3d(${De}px, 0, 0)`})},500))}function ie(we,We){if(We<0)return;const ce=(window.innerWidth-ng)/window.innerWidth,De=ce+We*(1-ce),ct=-ng+We*ng;ra(ue.current,{transform:zo(k)?`scale(${De}) translate3d(0, ${ct}px, 0)`:`scale(${De}) translate3d(${ct}px, 0, 0)`,transition:"none"})}function it(we,We){const ce=zo(k)?window.innerHeight:window.innerWidth,De=We?(ce-ng)/ce:1,ct=We?-ng:0;We&&ra(ue.current,{transition:`transform ${so.DURATION}s cubic-bezier(${so.EASE.join(",")})`,transform:zo(k)?`scale(${De}) translate3d(0, ${ct}px, 0)`:`scale(${De}) translate3d(${ct}px, 0, 0)`})}return Rn.useEffect(()=>{w||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[w]),Rn.createElement(W5,{defaultOpen:_,onOpenChange:we=>{!d&&!we||(we?$(!0):Mt(!0),z(we))},open:L},Rn.createElement(cme.Provider,{value:{activeSnapPoint:se,snapPoints:i,setActiveSnapPoint:ze,drawerRef:ue,overlayRef:M,onOpenChange:t,onPress:dt,onRelease:$n,onDrag:et,dismissible:d,shouldAnimate:ne,handleOnly:f,isOpen:L,isDragging:K,shouldFade:St,closeDrawer:Mt,onNestedDrag:ie,onNestedOpenChange:Te,onNestedRelease:it,keyboardIsOpen:Q,modal:w,snapPointsOffset:_t,activeSnapPointIndex:ve,direction:k,shouldScaleBackground:o,setBackgroundColorOnScale:l,noBodyStyles:x,container:O,autoFocus:B}},n))}const yme=Rn.forwardRef(function({...e},t){const{overlayRef:n,snapPoints:s,onRelease:r,shouldFade:i,isOpen:o,modal:l,shouldAnimate:c}=nS(),u=hme(t,n),d=s&&s.length>0;if(!l)return null;const f=Rn.useCallback(m=>r(m),[r]);return Rn.createElement(G5,{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})});yme.displayName="Drawer.Overlay";const vme=Rn.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...s},r){const{drawerRef:i,onPress:o,onRelease:l,onDrag:c,keyboardIsOpen:u,snapPointsOffset:d,activeSnapPointIndex:f,modal:m,isOpen:p,direction:g,snapPoints:b,container:w,handleOnly:y,shouldAnimate:v,autoFocus:x}=nS(),[k,_]=Rn.useState(!1),T=hme(r,i),S=Rn.useRef(null),C=Rn.useRef(null),N=Rn.useRef(!1),E=b&&b.length>0;NEt();const O=(D,j,L=0)=>{if(N.current)return!0;const z=Math.abs(D.y),I=Math.abs(D.x),$=I>z,K=["bottom","right"].includes(j)?1:-1;if(j==="left"||j==="right"){if(!(D.x*K<0)&&I>=0&&I<=L)return $}else if(!(D.y*K<0)&&z>=0&&z<=L)return!$;return N.current=!0,!0};Rn.useEffect(()=>{E&&window.requestAnimationFrame(()=>{_(!0)})},[]);function B(D){S.current=null,N.current=!1,l(D)}return Rn.createElement(K5,{"data-vaul-drawer-direction":g,"data-vaul-drawer":"","data-vaul-delayed-snap-points":k?"true":"false","data-vaul-snap-points":p&&E?"true":"false","data-vaul-custom-container":w?"true":"false","data-vaul-animate":v!=null&&v.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),S.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(C.current=D,y||(s.onPointerMove==null||s.onPointerMove.call(s,D),!S.current))return;const j=D.pageY-S.current.y,L=D.pageX-S.current.x,z=D.pointerType==="touch"?10:2;O({x:L,y:j},g,z)?c(D):(Math.abs(L)>z||Math.abs(j)>z)&&(S.current=null)},onPointerUp:D=>{s.onPointerUp==null||s.onPointerUp.call(s,D),S.current=null,N.current=!1,l(D)},onPointerOut:D=>{s.onPointerOut==null||s.onPointerOut.call(s,D),B(C.current)},onContextMenu:D=>{s.onContextMenu==null||s.onContextMenu.call(s,D),C.current&&B(C.current)}})});vme.displayName="Drawer.Content";const REt=250,DEt=120,LEt=Rn.forwardRef(function({preventCycle:e=!1,children:t,...n},s){const{closeDrawer:r,isDragging:i,snapPoints:o,activeSnapPoint:l,setActiveSnapPoint:c,dismissible:u,handleOnly:d,isOpen:f,onPress:m,onDrag:p}=nS(),g=Rn.useRef(null),b=Rn.useRef(!1);function w(){if(b.current){x();return}window.setTimeout(()=>{y()},DEt)}function y(){if(i||e||b.current){x();return}if(x(),!o||o.length===0){u||r();return}if(l===o[o.length-1]&&u){r();return}const _=o.findIndex(S=>S===l);if(_===-1)return;const T=o[_+1];c(T)}function v(){g.current=window.setTimeout(()=>{b.current=!0},REt)}function x(){g.current&&window.clearTimeout(g.current),b.current=!1}return Rn.createElement("div",{onClick:w,onPointerCancel:x,onPointerDown:k=>{d&&m(k),v()},onPointerMove:k=>{d&&p(k)},ref:s,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},Rn.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});LEt.displayName="Drawer.Handle";function PEt(e){const t=nS(),{container:n=t.container,...s}=e;return Rn.createElement(V5,{container:n,...s})}const sS={Root:MEt,Content:vme,Overlay:yme,Portal:PEt,Title:Y5};function OEt({...e}){return a.jsx(sS.Root,{"data-slot":"drawer",...e})}function $Et({container:e,...t}){const n=Gu();return a.jsx(sS.Portal,{"data-slot":"drawer-portal",container:e??n??void 0,...t})}const BEt=h.forwardRef(function({className:t,...n},s){return a.jsx(sS.Overlay,{ref:s,"data-slot":"drawer-overlay",className:on("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})}),zEt=h.forwardRef(function({className:t,children:n,overlayProps:s,...r},i){return a.jsxs($Et,{children:[a.jsx(BEt,{...s}),a.jsx(sS.Content,{ref:i,"data-slot":"drawer-content",className:on("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 FEt({className:e,...t}){return a.jsx(sS.Title,{"data-slot":"drawer-title",className:on("text-base font-medium text-foreground",e),...t})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const qEt="(min-width: 1024px)";function yN(e=qEt){const[t,n]=h.useState(()=>HEt(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 HEt(e){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches}function wme(e){try{return new Date(e).toLocaleString()}catch{return String(e)}}function UEt(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`${wme(e.at)}${n}${s}`}function Dm(e){return`${e.workspaceId??""}:${e.id}`}const WEt=["daily","weekdays","weekly","hourly","minutes","custom"],VEt=[1,2,3,4,5,6,10,12,15,20,30],GEt=2147483647,KEt=3,YEt=3e4,u_=1e5,XEt=/[^\p{L}\p{N}_.-]/gu,IY=/(^|[\s])(@(?:ext|mcp):(?:\\.[^\s\\]*|[^\s\\])+|\/(?:\\.[^\s\\/]*|[^\s\\/])+)(?=$|\s)/gu,QEt=["--background","--foreground","--muted","--muted-foreground","--border","--error-color","--font-mono"];function vN(e){return e.replace(XEt,"\\$&")}function wN(e){return e.replace(/\\(.)/g,"$1")}function JEt(e){if(e.startsWith("@ext:")){const t=wN(e.slice(5));return{id:`extension:${t}`,kind:"extension",label:t,insertText:e}}if(e.startsWith("@mcp:")){const t=wN(e.slice(5));return{id:`mcp:${t}`,kind:"mcp",label:t,insertText:e}}if(e.startsWith("/")){const t=wN(e.slice(1));return t?{id:`skill:${t}`,kind:"skill",label:t,insertText:e}:null}return null}function ZEt(e){return e.displayName&&e.displayName!==e.name?e.displayName:e.description}function e8t(e){return e.description||e.argumentHint||e.level}function t8t(e){return e.description||e.mcpStatus}function xme(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+=xme(s)}),e.tagName==="DIV"||e.tagName==="P"?`${n}
`:n}function kme(e){let t="";return e.childNodes.forEach(n=>{t+=xme(n)}),t}function _me(e){return e.replace(/\u00a0/g," ").replace(/\n$/,"")}function rE(e){return _me(kme(e))}function n8t(e){return _me(kme(e))}function CO(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function xN(e,t){t&&e.appendChild(document.createTextNode(t))}function Sme(e,t,n){if(CO(e),!t)return;t.split(`
`).forEach((r,i)=>{i>0&&e.appendChild(document.createElement("br")),s8t(e,r,n)})}function kN(e,t){let n=rE(e);return n.length>u_?(n=n.slice(0,u_),Sme(e,n,t)):n.trim().length===0&&(CO(e),n=""),n}function MY(e,t){const n=u_-rE(e).length;n<=0||document.execCommand("insertText",!1,t.slice(0,n))}function RY(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:n8t(n.cloneContents())}:null}function Cme(e,t){const n=document.createElement("span");n.className=st.promptTag,n.contentEditable="false",n.dataset.promptTagSerialized=e.insertText.trim();const s=h1(e.kind);if(s){const o=document.createElement("span");o.className=st.promptTagIcon,o.style.setProperty("--composer-tag-icon-url",q6(s)),o.setAttribute("aria-hidden","true"),n.appendChild(o)}const r=document.createElement("span");r.className=st.promptTagValue,r.textContent=e.tagLabel??e.label,n.appendChild(r);const i=document.createElement("span");return i.className=st.promptTagRemove,i.setAttribute("role","button"),i.tabIndex=-1,i.dataset.promptTagRemove="",i.setAttribute("aria-label",`${t} ${e.label}`),n.appendChild(i),n}function s8t(e,t,n){let s=0;IY.lastIndex=0;for(const r of t.matchAll(IY)){const[i,o,l]=r,c=r.index??0,u=JEt(l);u&&(xN(e,t.slice(s,c)),xN(e,o),e.appendChild(Cme(u,n)),s=c+i.length)}xN(e,t.slice(s))}function r8t(e,t,n){var c;const s=window.getSelection(),r=Cme(t,n),i=document.createTextNode(" ");rE(e).trim().length===0&&CO(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 l=document.createRange();l.setStartAfter(i),l.collapse(!0),s==null||s.removeAllRanges(),s==null||s.addRange(l)}function i8t(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 o8t({value:e,label:t,placeholder:n,onChange:s,insertItem:r,onInserted:i}){const{t:o}=nt(),l=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&&l===d.current||(Sme(f,e,l),u.current=e,d.current=l))},[l,e]),h.useEffect(()=>{const f=c.current;if(!f||!r)return;r8t(f,r,l);const m=rE(f);u.current=m,s(m),f.focus(),i()},[r,s,i,l]),a.jsxs("div",{className:st.promptEditorWrap,children:[a.jsx("div",{ref:c,className:st.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;i8t(p);const g=kN(f.currentTarget,l);u.current=g,s(g),f.currentTarget.focus()},onInput:f=>{const m=kN(f.currentTarget,l);u.current=m,s(m)},onPaste:f=>{f.preventDefault(),MY(f.currentTarget,f.clipboardData.getData("text/plain"))},onDrop:f=>{f.preventDefault(),MY(f.currentTarget,f.dataTransfer.getData("text/plain"))},onCopy:f=>{const m=RY(f.currentTarget);m&&(f.preventDefault(),f.clipboardData.setData("text/plain",m.text))},onCut:f=>{const m=RY(f.currentTarget);if(!m)return;f.preventDefault(),f.clipboardData.setData("text/plain",m.text),m.selection.deleteFromDocument();const p=kN(f.currentTarget,l);u.current=p,s(p)}}),e.trim().length===0&&a.jsx("div",{className:st.promptPlaceholder,children:n})]})}function a8t({onRunPrompt:e,onCreateViaChat:t,onOpenSession:n,workspaces:s,lockedWorkspace:r,onError:i}){const{t:o}=nt(),l=Qo(),c=Gu(),u=h.useMemo(()=>s??[],[s]),d=!r&&u.length>1,f=h.useMemo(()=>u.filter(ce=>ce.primary||ce.trusted),[u]),m=h.useCallback(ce=>ce.primary?void 0:ce.id,[]),p=r?m(r):void 0,[g,b]=h.useState(null),[w,y]=h.useState(null),[v,x]=h.useState(null),[k,_]=h.useState(null),[T,S]=h.useState(!1),[C,N]=h.useState(null),[E,O]=h.useState(p),[B,D]=h.useState(""),[j,L]=h.useState(""),[z,I]=h.useState(Jd),[$,K]=h.useState(!1),[R,Y]=h.useState(null),[W,M]=h.useState(null),[F,J]=h.useState([]),[V,U]=h.useState(!1),[le,pe]=h.useState(null),[fe,Q]=h.useState(null),ne=h.useRef(null),de=h.useRef(null),[ue,me]=h.useState(null),[te,ae]=h.useState({}),[be,se]=h.useState(null),[ve,ze]=h.useState(()=>Date.now()),Pe=h.useRef(!0),_t=h.useRef(0),Pt=h.useRef(0);h.useEffect(()=>(Pe.current=!0,()=>{Pe.current=!1}),[]);const St=h.useCallback(async()=>{const ce=++_t.current;try{let De,ct=null;if(r?De=(await l.listScheduledTasks(p)).map(Ve=>({...Ve,workspaceId:p,workspaceCwd:r.cwd})):d?De=(await Promise.all(f.map(async Qt=>{try{return(await l.listScheduledTasks(m(Qt))).map(Ie=>({...Ie,workspaceId:m(Qt),workspaceCwd:Qt.cwd}))}catch(Un){return ct||(ct=Un instanceof Error?Un.message:String(Un)),[]}}))).flat():De=await l.listScheduledTasks(),!Pe.current||ce!==_t.current)return;const qe=[...De].sort((Ve,Qt)=>Qt.createdAt-Ve.createdAt);b(qe),y(ct)}catch(De){if(!Pe.current||ce!==_t.current)return;y(De instanceof Error?De.message:String(De)),b(ct=>ct??[])}},[l,d,r,p,f,m]);h.useEffect(()=>{St()},[St]);const he=!!(g!=null&&g.some(ce=>ce.nextRunAt!=null));h.useEffect(()=>{if(!he)return;const ce=window.setInterval(()=>ze(Date.now()),1e3);return()=>window.clearInterval(ce)},[he]);const Ae=h.useRef(0);h.useEffect(()=>{if(!g)return;let ce=1/0;for(const Ve of g)Ve.nextRunAt!=null&&Ve.nextRunAt<ce&&(ce=Ve.nextRunAt);if(!Number.isFinite(ce))return;const De=ce-Date.now();let ct;De>0?(Ae.current=0,ct=Math.min(De+2e3,GEt)):ct=Ae.current++<KEt?1e3:YEt;const qe=window.setTimeout(()=>void St(),ct);return()=>window.clearTimeout(qe)},[g,St]);const rt=B3(z),dt=rt?c_(rt,o):null,jt=h.useCallback(()=>{const ce=ne.current;if(!ce){me(null);return}const De=getComputedStyle(ce);ae(Object.fromEntries(QEt.map(Ie=>[Ie,De.getPropertyValue(Ie)])));const ct=ce.getBoundingClientRect(),qe=Math.min(420,window.innerWidth-24),Ve=Math.max(12,Math.min(ct.left,window.innerWidth-qe-12)),Qt=ct.bottom+6,Un=Math.max(140,Math.min(320,window.innerHeight-Qt-12));me(Ie=>{const wt={left:Ve,top:Qt,width:qe,maxHeight:Un};return Ie&&Ie.left===wt.left&&Ie.top===wt.top&&Ie.width===wt.width&&Ie.maxHeight===wt.maxHeight?Ie:wt})},[]),et=h.useCallback(()=>{Pt.current+=1,M(null),J([]),U(!1),pe(null),Q(null),me(null),ae({})},[]),Mt=h.useCallback(async ce=>{const De=++Pt.current;if(W===ce){et();return}jt(),M(ce),U(!0),pe(null),J([]);try{let ct;if(ce==="extension"?ct=((await l.loadExtensionsStatus()).extensions??[]).filter(Ve=>Ve.isActive).map(Ve=>({id:Ve.id||Ve.name,kind:ce,label:Ve.name,tagLabel:ui(Ve.displayName??"")||Ve.name,description:ZEt(Ve),insertText:`@ext:${vN(Ve.name)} `})):ce==="skill"?ct=((await l.loadSkillsStatus()).skills??[]).filter(Ve=>Ve.modelInvocable).map(Ve=>({id:Ve.name,kind:ce,label:Ve.name,description:e8t(Ve),insertText:`/${vN(Ve.name)} `})):ct=((await l.loadMcpStatus()).servers??[]).filter(Ve=>!Ve.disabled).map(Ve=>({id:Ve.name,kind:ce,label:Ve.name,description:t8t(Ve),insertText:`@mcp:${vN(Ve.name)} `})),!Pe.current||De!==Pt.current)return;J(ct)}catch(ct){if(!Pe.current||De!==Pt.current)return;pe(ct instanceof Error?ct.message:String(ct))}finally{Pe.current&&De===Pt.current&&U(!1)}},[l,W,et,jt]);h.useEffect(()=>{if(!W)return;jt();const ce=qe=>{const Ve=ne.current,Qt=de.current;Ve!=null&&Ve.contains(qe.target)||Qt!=null&&Qt.contains(qe.target)||et()},De=qe=>{qe.key==="Escape"&&(qe.preventDefault(),qe.stopPropagation(),et())},ct=()=>jt();return document.addEventListener("pointerdown",ce),document.addEventListener("keydown",De,!0),window.addEventListener("resize",ct),window.addEventListener("scroll",ct,!0),()=>{document.removeEventListener("pointerdown",ce),document.removeEventListener("keydown",De,!0),window.removeEventListener("resize",ct),window.removeEventListener("scroll",ct,!0)}},[W,et,jt]);const sn=h.useCallback(()=>{D(""),L(""),I(Jd),Y(null),S(!1),N(null),O(p),et()},[p,et]),Ye=h.useCallback(()=>{N(null),O(p),D(""),L(""),I(Jd),Y(null),et(),S(!0)},[p,et]),$n=h.useCallback(ce=>{N(ce.id),O(ce.workspaceId),D(ce.name??""),L(ce.prompt),I(Om(ce.cron)),Y(null),et(),S(!0)},[et]),Te=h.useCallback(async()=>{const ce=B3(z);if(!ce){Y(o("scheduledTasks.error.invalidSchedule"));return}if(j.trim().length===0){Y(o("scheduledTasks.error.emptyPrompt"));return}if(j.length>u_){Y(o("scheduledTasks.error.promptTooLong",{max:u_}));return}K(!0),Y(null);try{if(C?await l.updateScheduledTask(C,{cron:ce,prompt:j.trim(),name:B.trim()||null},E):await l.createScheduledTask({cron:ce,prompt:j.trim(),name:B.trim()||null,recurring:!0,enabled:!0},E),!Pe.current)return;sn(),await St()}catch(De){if(!Pe.current)return;Y(De instanceof Error?De.message:String(De))}finally{Pe.current&&K(!1)}},[l,z,C,E,B,j,St,sn,o]),ie=h.useCallback(async ce=>{x(Dm(ce));try{await l.updateScheduledTask(ce.id,{enabled:!ce.enabled},ce.workspaceId),await St()}catch(De){i(De,o("scheduledTasks.error.toggleFailed"))}finally{Pe.current&&x(null)}},[l,i,St,o]),it=h.useCallback(async ce=>{if(!(!ce.enabled||k!==null)){_(ce.id);try{const De=(await l.listScheduledTasks(ce.workspaceId)).find(ct=>ct.id===ce.id);if(!De||!De.enabled){await St().catch(()=>{}),i(new Error("This task is no longer runnable."),o("scheduledTasks.error.runFailed"));return}if(De.recurring){await e(De.prompt,De.sessionId);try{await l.runScheduledTask(De.id,ce.workspaceId),await St()}catch(ct){i(ct,o("scheduledTasks.error.runFailed"))}}else{await l.runScheduledTask(De.id,ce.workspaceId),await St();try{await e(De.prompt,De.sessionId)}catch(ct){i(ct,o("scheduledTasks.error.oneShotConsumedButFailed"));return}}}catch(De){i(De,o("scheduledTasks.error.runFailed"))}finally{_(null)}}},[l,i,e,St,k,o]),we=h.useCallback(async ce=>{const De=ce.name||ce.prompt,ct=De.length>60?`${De.slice(0,57)}…`:De;if(window.confirm(o("scheduledTasks.deleteConfirm",{name:ct}))){x(Dm(ce));try{await l.deleteScheduledTask(ce.id,ce.workspaceId),await St()}catch(qe){i(qe,o("scheduledTasks.error.deleteFailed"))}finally{Pe.current&&x(null)}}},[l,i,St,o]),We=W&&ue?kd.createPortal(a.jsx("div",{ref:de,className:st.referencePicker,role:"listbox","aria-label":o("scheduledTasks.referencePicker"),style:{...te,left:ue.left,top:ue.top,width:ue.width,maxHeight:ue.maxHeight},onWheel:ce=>{ce.stopPropagation()},onTouchMove:ce=>ce.stopPropagation(),children:V?a.jsx("div",{className:st.referenceEmpty,children:o("scheduledTasks.reference.loading")}):le?a.jsx("div",{className:st.referenceError,children:le}):F.length===0?a.jsx("div",{className:st.referenceEmpty,children:o("scheduledTasks.reference.empty")}):F.map(ce=>a.jsxs("button",{type:"button",className:st.referenceItem,role:"option","aria-selected":"false",onMouseDown:De=>De.preventDefault(),onClick:()=>{Q(ce),M(null)},children:[a.jsx("span",{className:st.referenceItemLabel,children:ce.label}),ce.description&&a.jsx("span",{className:st.referenceItemDescription,children:ce.description})]},`${ce.kind}:${ce.id}`))}),c??document.body):null;return a.jsxs("div",{className:st.root,children:[a.jsx("div",{className:st.intro,children:o("scheduledTasks.subtitle")}),a.jsxs("div",{className:st.toolbar,children:[a.jsx("div",{className:st.count,children:g===null?o("scheduledTasks.loading"):o("scheduledTasks.count",{count:g.length})}),a.jsxs("div",{className:st.toolbarActions,children:[a.jsx("button",{type:"button",className:st.secondaryButton,onClick:()=>void St(),children:o("scheduledTasks.refresh")}),a.jsx("button",{type:"button",className:st.secondaryButton,onClick:t,children:o("scheduledTasks.createViaChat")}),a.jsx("button",{type:"button",className:st.primaryButton,onClick:Ye,children:o("scheduledTasks.new")})]})]}),T&&a.jsx(Fi,{title:o(C?"scheduledTasks.editTitle":"scheduledTasks.new"),size:"md",onClose:sn,children:a.jsxs("div",{className:st.formFields,children:[d&&a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:o("scheduledTasks.workspace")}),a.jsx("select",{className:st.select,value:E??"",disabled:!!C||f.length<=1,onChange:ce=>O(ce.target.value||void 0),children:f.map(ce=>a.jsx("option",{value:m(ce)??"",children:nE(ce)},ce.id))})]}),a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:o("scheduledTasks.name")}),a.jsx("input",{className:st.input,type:"text",value:B,maxLength:200,placeholder:o("scheduledTasks.namePlaceholder"),onChange:ce=>D(ce.target.value)})]}),a.jsxs("label",{className:st.field,children:[a.jsxs("span",{className:st.fieldLabel,children:[o("scheduledTasks.prompt"),a.jsx("span",{className:st.required,children:"*"})]}),a.jsx(o8t,{value:j,label:o("scheduledTasks.prompt"),placeholder:o("scheduledTasks.promptPlaceholder"),onChange:L,insertItem:fe,onInserted:()=>Q(null)})]}),a.jsx("div",{ref:ne,className:st.referencePopover,children:a.jsx("div",{className:st.referenceBar,children:["extension","skill","mcp"].map(ce=>{const De=h1(ce);return a.jsxs("button",{type:"button",className:`${st.referenceButton} ${W===ce?st.referenceButtonActive:""}`,"aria-expanded":W===ce,onClick:()=>void Mt(ce),children:[De&&a.jsx("span",{className:st.referenceButtonIcon,style:{"--composer-tag-icon-url":q6(De)},"aria-hidden":!0}),o(`scheduledTasks.reference.${ce}`)]},ce)})})}),a.jsxs("div",{className:st.scheduleRow,children:[a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:o("scheduledTasks.frequency")}),a.jsx("select",{className:st.select,value:z.frequency,onChange:ce=>{const De=ce.target.value;I(ct=>({...ct,frequency:De,...De==="hourly"?{time:"00:00"}:{}}))},children:WEt.map(ce=>a.jsx("option",{value:ce,children:o(`scheduledTasks.freq.${ce}`)},ce))})]}),(z.frequency==="daily"||z.frequency==="weekdays"||z.frequency==="weekly")&&a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:o("scheduledTasks.time")}),a.jsx("input",{className:st.input,type:"time",value:z.time,onChange:ce=>I(De=>({...De,time:ce.target.value}))})]}),z.frequency==="weekly"&&a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:o("scheduledTasks.weekday")}),a.jsx("select",{className:st.select,value:z.weekday,onChange:ce=>I(De=>({...De,weekday:Number(ce.target.value)})),children:o("scheduledTasks.weekdayNames").split(",").map((ce,De)=>a.jsx("option",{value:De,children:ce},De))})]}),z.frequency==="minutes"&&a.jsxs("label",{className:st.field,children:[a.jsx("span",{className:st.fieldLabel,children:o("scheduledTasks.interval")}),a.jsx("select",{className:st.select,value:z.minuteInterval,onChange:ce=>I(De=>({...De,minuteInterval:Number(ce.target.value)})),children:VEt.map(ce=>a.jsx("option",{value:ce,children:ce},ce))})]}),z.frequency==="custom"&&a.jsxs("label",{className:`${st.field} ${st.fieldGrow}`,children:[a.jsx("span",{className:st.fieldLabel,children:o("scheduledTasks.cron")}),a.jsx("input",{className:st.input,type:"text",value:z.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:ce=>I(De=>({...De,customCron:ce.target.value}))})]})]}),a.jsx("div",{className:st.preview,children:dt?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:st.previewLabel,children:dt}),a.jsx("code",{className:st.previewCron,children:rt})]}):a.jsx("span",{className:st.previewInvalid,children:o("scheduledTasks.error.invalidSchedule")})}),R&&a.jsx("div",{className:st.formError,children:R}),a.jsxs("div",{className:st.formActions,children:[a.jsx("button",{type:"button",className:st.secondaryButton,onClick:sn,disabled:$,children:o("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:st.primaryButton,onClick:()=>void Te(),disabled:$,children:o($?C?"scheduledTasks.saving":"scheduledTasks.creating":C?"scheduledTasks.save":"scheduledTasks.create")})]})]})}),We,w&&a.jsx("div",{className:st.loadError,children:w}),g!==null&&g.length===0&&!w&&a.jsx("div",{className:st.empty,children:o("scheduledTasks.empty")}),a.jsx("div",{className:st.list,children:(g??[]).map(ce=>{const De=ce.name||ce.prompt,ct=v===Dm(ce);return a.jsxs("div",{className:`${st.card} ${ce.enabled?"":st.cardDisabled}`,children:[a.jsxs("div",{className:st.cardHeader,children:[a.jsx("button",{type:"button",role:"switch","aria-checked":ce.enabled,"aria-label":ce.enabled?o("scheduledTasks.disable"):o("scheduledTasks.enable"),className:`${st.toggle} ${ce.enabled?st.toggleOn:""}`,onClick:()=>void ie(ce),disabled:ct,children:a.jsx("span",{className:st.toggleKnob})}),a.jsx("div",{className:st.cardTitle,title:De,children:De}),a.jsxs("div",{className:st.cardMenu,children:[a.jsx("button",{type:"button",className:st.iconAction,onClick:()=>void it(ce),disabled:!ce.enabled||k!==null,title:o("scheduledTasks.runNow"),"aria-label":o("scheduledTasks.runNow"),children:"▶"}),a.jsx("button",{type:"button",className:st.iconAction,onClick:()=>$n(ce),disabled:ct,title:o("scheduledTasks.edit"),"aria-label":o("scheduledTasks.edit"),children:"✎"}),a.jsx("button",{type:"button",className:st.iconAction,onClick:()=>void we(ce),disabled:ct,title:o("scheduledTasks.delete"),"aria-label":o("scheduledTasks.delete"),children:"✕"})]})]}),ce.name&&a.jsx("div",{className:st.cardPrompt,title:ce.prompt,children:ce.prompt}),a.jsxs("div",{className:st.cardFooter,children:[d&&ce.workspaceCwd&&a.jsxs("span",{className:st.workspacePill,title:ce.workspaceCwd,children:[a.jsx("span",{className:st.workspaceIcon,"aria-hidden":"true",children:"⌂"}),sE(ce.workspaceCwd,u)]}),a.jsxs("span",{className:st.schedulePill,children:[a.jsx("span",{className:st.clockIcon,"aria-hidden":"true",children:"◷"}),c_(ce.cron,o)]}),a.jsx("span",{className:st.recurringTag,children:o(ce.recurring?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),ce.nextRunAt!=null&&a.jsxs("span",{className:st.countdown,"data-testid":"scheduled-task-next-run",title:o("scheduledTasks.nextRunTooltip",{when:wme(ce.nextRunAt)}),children:[a.jsx("span",{className:st.hourglassIcon,"aria-hidden":"true",children:"⏳"}),Yit(ce.nextRunAt-ve,o)]}),a.jsx("span",{className:st.lastFired,children:Xit(ce,o)}),ce.sessionId&&n?a.jsx("button",{type:"button",className:st.runsToggle,onClick:()=>n(ce.sessionId),title:o("scheduledTasks.viewHistoryHint"),children:ce.runs.length>0?o("scheduledTasks.viewHistory",{count:ce.runs.length}):o("scheduledTasks.viewHistoryEmpty")}):ce.runs.length>0&&a.jsx("button",{type:"button",className:st.runsToggle,"aria-expanded":be===Dm(ce),onClick:()=>se(qe=>qe===Dm(ce)?null:Dm(ce)),children:o("scheduledTasks.runHistory",{count:ce.runs.length})})]}),be===Dm(ce)&&ce.runs.length>0&&a.jsx("ul",{className:st.runsList,children:[...ce.runs].reverse().map((qe,Ve)=>a.jsx("li",{className:st.runsItem,children:UEt(qe,o)},`${qe.at}-${Ve}`))})]},Dm(ce))})})]})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const l8t=new Set(["clear","stop","off","reset","none","cancel"]);function MR(e){return e.replace(/^\/goal\b/i,"").trim()}function c8t(e){return/^\/goal\b/i.test(e.trim())?TO(MR(e.trim())):!1}function TO(e){return l8t.has(e.trim().toLowerCase())}const u8t="_root_v50oc_1",d8t="_intro_v50oc_8",h8t="_toolbar_v50oc_14",f8t="_count_v50oc_22",m8t="_toolbarActions_v50oc_28",p8t="_primaryButton_v50oc_34",g8t="_secondaryButton_v50oc_35",b8t="_formFields_v50oc_80",y8t="_field_v50oc_86",v8t="_fieldLabel_v50oc_93",w8t="_required_v50oc_102",x8t="_textarea_v50oc_59",k8t="_formHint_v50oc_126",_8t="_formError_v50oc_132",S8t="_loadError_v50oc_133",C8t="_degraded_v50oc_140",T8t="_formActions_v50oc_148",E8t="_empty_v50oc_156",A8t="_list_v50oc_163",j8t="_card_v50oc_169",N8t="_cardHeader_v50oc_180",I8t="_statusDot_v50oc_188",M8t="_statusDotRunning_v50oc_196",R8t="_cardTitle_v50oc_200",D8t="_cardMenu_v50oc_211",L8t="_iconAction_v50oc_218",P8t="_cardReason_v50oc_250",O8t="_reasonLabel_v50oc_262",$8t="_cardFooter_v50oc_266",B8t="_statusPill_v50oc_274",z8t="_meta_v50oc_285",F8t="_sessionLink_v50oc_290",yr={root:u8t,intro:d8t,toolbar:h8t,count:f8t,toolbarActions:m8t,primaryButton:p8t,secondaryButton:g8t,formFields:b8t,field:y8t,fieldLabel:v8t,required:w8t,textarea:x8t,formHint:k8t,formError:_8t,loadError:S8t,degraded:C8t,formActions:T8t,empty:E8t,list:A8t,card:j8t,cardHeader:N8t,statusDot:I8t,statusDotRunning:M8t,cardTitle:R8t,cardMenu:D8t,iconAction:L8t,cardReason:P8t,reasonLabel:O8t,cardFooter:$8t,statusPill:B8t,meta:z8t,sessionLink:F8t},q8t=1e4,H8t=1e3;function U8t({onCreateGoal:e,onOpenSession:t,onError:n}){const{t:s}=nt(),r=Qo(),[i,o]=h.useState(null),[l,c]=h.useState(0),[u,d]=h.useState(null),[f,m]=h.useState(null),[p,g]=h.useState(!1),[b,w]=h.useState(""),[y,v]=h.useState(!1),[x,k]=h.useState(null),[_,T]=h.useState(()=>Date.now()),S=h.useRef(!0),C=h.useRef(0);h.useEffect(()=>(S.current=!0,()=>{S.current=!1}),[]);const N=h.useCallback(async()=>{const j=++C.current;try{const L=await r.listGoals();if(!S.current||j!==C.current)return;o(L.goals),c(L.droppedCount),d(null)}catch(L){if(!S.current||j!==C.current)return;d(L instanceof Error?L.message:String(L)),o(z=>z??[]),c(0)}},[r]);h.useEffect(()=>{let j=!1,L=0;const z=async()=>{await N(),!j&&(L=window.setTimeout(()=>void z(),q8t))};return z(),()=>{j=!0,window.clearTimeout(L)}},[N]);const E=!!(i!=null&&i.length);h.useEffect(()=>{if(!E)return;const j=window.setInterval(()=>T(Date.now()),H8t);return()=>window.clearInterval(j)},[E]);const O=h.useCallback(()=>{w(""),k(null),g(!1)},[]),B=h.useCallback(async()=>{const j=b.trim();if(j.length===0){k(s("goals.error.emptyCondition"));return}if(TO(j)){k(s("goals.error.clearKeyword",{word:j}));return}v(!0),k(null);try{const L=await e(j);if(!S.current||L===!1)return;O()}catch(L){if(!S.current){n(L,s("goals.error.createFailed"));return}k(L instanceof Error?L.message:String(L))}finally{S.current&&v(!1)}},[b,e,n,O,s]),D=h.useCallback(async j=>{const L=j.condition.length>60?`${j.condition.slice(0,57)}…`:j.condition;if(window.confirm(s("goals.clearConfirm",{condition:L}))){m(j.sessionId);try{await r.clearGoal(j.sessionId),await N()}catch(z){n(z,s("goals.error.clearFailed"))}finally{S.current&&m(null)}}},[r,n,N,s]);return a.jsxs("div",{className:yr.root,children:[a.jsx("div",{className:yr.intro,children:s("goals.subtitle")}),a.jsxs("div",{className:yr.toolbar,children:[a.jsx("div",{className:yr.count,children:i===null?s("goals.loading"):s("goals.count",{count:i.length})}),a.jsxs("div",{className:yr.toolbarActions,children:[a.jsx("button",{type:"button",className:yr.secondaryButton,onClick:()=>void N(),children:s("goals.refresh")}),a.jsx("button",{type:"button",className:yr.primaryButton,onClick:()=>{w(""),k(null),g(!0)},children:s("goals.new")})]})]}),p&&a.jsx(Fi,{title:s("goals.new"),size:"md",onClose:O,children:a.jsxs("div",{className:yr.formFields,children:[a.jsxs("label",{className:yr.field,children:[a.jsxs("span",{className:yr.fieldLabel,children:[s("goals.condition"),a.jsx("span",{className:yr.required,children:"*"})]}),a.jsx("textarea",{className:yr.textarea,value:b,rows:4,placeholder:s("goals.conditionPlaceholder"),onChange:j=>w(j.target.value)})]}),a.jsx("div",{className:yr.formHint,children:s("goals.newHint")}),x&&a.jsx("div",{className:yr.formError,role:"alert",children:x}),a.jsxs("div",{className:yr.formActions,children:[a.jsx("button",{type:"button",className:yr.secondaryButton,onClick:O,disabled:y,children:s("goals.cancel")}),a.jsx("button",{type:"button",className:yr.primaryButton,onClick:()=>void B(),disabled:y,children:s(y?"goals.creating":"goals.create")})]})]})}),u&&a.jsx("div",{className:yr.loadError,role:"alert",children:u}),l>0&&a.jsx("div",{className:yr.degraded,"data-testid":"goals-dropped",children:s("goals.dropped",{count:l})}),i!==null&&i.length===0&&!u&&a.jsx("div",{className:yr.empty,children:s("goals.empty")}),a.jsx("div",{className:yr.list,role:"list",children:(i??[]).map(j=>{const L=f===j.sessionId;return a.jsxs("div",{className:yr.card,role:"listitem",children:[a.jsxs("div",{className:yr.cardHeader,children:[a.jsx("span",{className:`${yr.statusDot} ${j.hasActivePrompt?yr.statusDotRunning:""}`,"aria-hidden":"true"}),a.jsx("div",{className:yr.cardTitle,title:j.condition,children:j.condition}),a.jsx("div",{className:yr.cardMenu,children:a.jsx("button",{type:"button",className:yr.iconAction,onClick:()=>void D(j),disabled:L,title:s("goals.clear"),"aria-label":s("goals.clear"),children:"✕"})})]}),j.lastReason&&a.jsxs("div",{className:yr.cardReason,children:[a.jsxs("span",{className:yr.reasonLabel,children:[s("goal.lastCheck"),":"]})," ",j.lastReason]}),a.jsxs("div",{className:yr.cardFooter,children:[a.jsx("span",{className:yr.statusPill,children:s(j.hasActivePrompt?"goals.running":"goals.idle")}),a.jsx("span",{className:yr.meta,children:j.iterations>0?s(j.iterations===1?"goal.turn":"goal.turns",{count:j.iterations}):s("goals.notYetEvaluated")}),a.jsx("span",{className:yr.meta,"data-testid":"goal-elapsed",children:Qy(Math.max(0,_-j.setAt))}),a.jsx("button",{type:"button",className:yr.sessionLink,onClick:()=>t(j.sessionId),title:s("goals.openSessionHint"),"aria-label":`${s("goals.openSessionHint")}: ${j.displayName||j.sessionId}`,children:j.displayName||j.sessionId})]})]},j.sessionId)})})]})}function Eb(e){return e.replace(/[：:\s]+$/u,"")}const W8t="_extensionGrid_1aki4_1",V8t={extensionGrid:W8t};function G8t(e,t){return e&&t.some(n=>n.name===e)?e:null}function K8t(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 Tme({className:e,...t}){return a.jsx(koe,{"data-slot":"radio-group",className:on("grid w-full gap-2",e),...t})}function Eme({className:e,...t}){return a.jsx(Coe,{"data-slot":"radio-group-item",className:on("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:a.jsx(Eoe,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:a.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 DY="update available";function Zw(e){return e.displayName||e.name}function RR(e){return e.workspaceActivation&&e.workspaceActivation!=="inherit"?e.workspaceActivation==="enabled":e.defaultActivation?e.defaultActivation==="enabled":e.isActive}function _N(e,t){return RR(e)?t("extensions.manage.status.enabled"):t("extensions.manage.status.disabled")}function SN(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 DC(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 LY(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 af({label:e,value:t}){return a.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[a.jsx("div",{className:"text-sm font-medium",children:Eb(e)}),a.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function ex({items:e,empty:t,icon:n}){return e.length?a.jsx(Wo,{children:a.jsx(dc,{className:"flex flex-col",children:e.map((s,r)=>a.jsxs("div",{children:[r>0?a.jsx(dO,{}):null,a.jsxs("div",{className:"flex min-w-0 items-center gap-3 py-3 [contain-intrinsic-size:auto_44px] [content-visibility:auto]",children:[a.jsx(n,{className:"size-4 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"min-w-0 break-words",children:s})]})]},s))})}):a.jsx(md,{className:"border",children:a.jsxs(pd,{children:[a.jsx(gd,{variant:"icon",children:a.jsx(n,{})}),a.jsx(bd,{children:t})]})})}function PY({pendingInteraction:e,submitting:t,selectedPlugin:n,interactionValue:s,setSelectedPlugin:r,setInteractionValue:i,submit:o,t:l}){return a.jsx(qp,{open:!!e,onOpenChange:c=>{!c&&e&&!t&&o({cancelled:!0})},children:a.jsxs(Hp,{showCloseButton:!1,className:"max-h-[calc(100vh-2rem)] overflow-y-auto sm:max-w-3xl",children:[a.jsxs(Up,{className:"items-start px-3 text-left",children:[a.jsx(Vp,{children:(e==null?void 0:e.interaction.kind)==="setting"?e.interaction.setting.name:l("extensions.manage.selectExtension")}),a.jsx(Yg,{children:(e==null?void 0:e.interaction.kind)==="marketplace_plugin"?l("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"?a.jsx(Tme,{"aria-label":l("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 a.jsxs("div",{className:"flex items-start gap-3 rounded-md border border-border p-3 has-data-[state=checked]:bg-accent/50",children:[a.jsx(Eme,{id:u,value:c.name,disabled:t,className:"mt-0.5"}),a.jsxs("label",{htmlFor:u,className:"flex min-w-0 flex-1 cursor-pointer flex-col gap-1",children:[a.jsx("span",{className:"font-medium",children:c.name}),a.jsx("span",{className:"text-sm text-muted-foreground",children:c.description??c.category??(c.source==="."||c.source==="./"?l("extensions.manage.marketplaceRoot"):c.source)??l("extensions.manage.noDescription")}),(d=c.tags)!=null&&d.length?a.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"?a.jsxs(Wp,{children:[a.jsx(Kt,{variant:"outline",disabled:t,onClick:()=>o({cancelled:!0}),children:l("common.cancel")}),a.jsxs(Kt,{disabled:t||!n,onClick:()=>o({pluginName:n}),children:[t?a.jsx(Ws,{}):null,e.owner==="mutation"?l("extensions.manage.update"):l("extensions.manage.install")]})]}):(e==null?void 0:e.interaction.kind)==="setting"?a.jsxs(a.Fragment,{children:[a.jsx(Ur,{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}))}}),a.jsxs(Wp,{children:[a.jsx(Kt,{variant:"outline",disabled:t,onClick:()=>o({cancelled:!0}),children:l("common.cancel")}),a.jsxs(Kt,{disabled:t,onClick:()=>o({value:s}),children:[t?a.jsx(Ws,{}):null,e.owner==="mutation"?l("extensions.manage.update"):l("extensions.manage.install")]})]})]}):null]})})}function Ame({onClose:e,initialFocusRef:t,embedded:n}){const{t:s}=nt(),r=za(),i=Co(),o=Qo(),l=Nh(),[c,u]=h.useState([]),[d,f]=h.useState(null),[m,p]=h.useState(""),[g,b]=h.useState({}),[w,y]=h.useState(!1),[v,x]=h.useState(null),[k,_]=h.useState(null),[T,S]=h.useState(null),[C,N]=h.useState("info"),[E,O]=h.useState(null),[B,D]=h.useState(null),[j,L]=h.useState(!1),[z,I]=h.useState(null),[$,K]=h.useState(!1),[R,Y]=h.useState(""),[W,M]=h.useState(!1),[F,J]=h.useState(null),[V,U]=h.useState(null),le=h.useRef(null),[pe,fe]=h.useState(""),[Q,ne]=h.useState(""),[de,ue]=h.useState(!1),[me,te]=h.useState(!1),ae=h.useRef(!1),be=h.useRef(null),se=h.useRef(null),ve=h.useRef(new Map),ze=h.useRef(null),[Pe,_t]=h.useState(null),Pt=h.useCallback(we=>{we&&se.current!==we||(se.current=null,le.current=null,U(null),fe(""),ne(""))},[]),St=h.useCallback((we,We,ce)=>{le.current!==We.id&&(fe(""),ne(""),le.current=We.id),se.current=we,U({operationId:we,interaction:We,owner:ce})},[]),he=h.useCallback((we=!1)=>{y(!0);const We=i.workspaceCwd?i.client.workspaceByCwd(i.workspaceCwd).workspaceExtensions().catch(()=>null):Promise.resolve(null);return Promise.all([o.loadExtensionsStatus(),We]).then(([ce,De])=>{var Ve,Qt,Un;const ct=new Map(((De==null?void 0:De.extensions)??[]).map(Ie=>[Ie.extensionId,Ie])),qe=(ce.extensions??[]).map(Ie=>{const wt=ct.get(Ie.id);return wt?{...Ie,defaultActivation:wt.defaultActivation,workspaceActivation:wt.workspaceActivation??"inherit"}:Ie});u(Ie=>{const wt=be.current;if(!wt||qe.some(Me=>Me.name===wt))return qe;const Wt=Ie.find(Me=>Me.name===wt);return Wt?[...qe,Wt]:qe}),we||(O(null),N((Ve=ce.errors)!=null&&Ve[0]?"error":"info"),S(((Un=(Qt=ce.errors)==null?void 0:Qt[0])==null?void 0:Un.error)??null)),f(Ie=>Ie&&be.current===Ie?Ie:G8t(Ie,qe))}).catch(ce=>{we||(O(null),N("error"),S(ce instanceof Error?ce.message:String(ce)))}).finally(()=>y(!1))},[o,i.client,i.workspaceCwd]);h.useEffect(()=>{he()},[he]),h.useEffect(()=>{let we=!1,We,ce=2e3;const De=async()=>{try{const{operations:ct}=await o.activeExtensionOperations();if(we)return;const qe=ct.filter(Qt=>Qt.operation==="install").sort((Qt,Un)=>Un.createdAt-Qt.createdAt)[0];qe&&J(Qt=>Qt??{operationId:qe.operationId,source:qe.source??qe.name??"extension"});const Ve=ct.find(Qt=>Qt.operation!=="install");Ve&&(ae.current=!0,Ve.operation==="uninstall"&&(be.current=Ve.name??"extension"),_t(Qt=>Qt??{operationId:Ve.operationId,name:Ve.name??"extension",operation:Ve.operation}),_(Qt=>Qt??Ve.name??null)),D(null),te(!0)}catch(ct){we||(D(ct instanceof Error?ct.message:String(ct)),We=setTimeout(()=>void De(),ce),ce=Math.min(ce*2,3e4))}};return De(),()=>{we=!0,We&&clearTimeout(We)}},[o]);const Ae=h.useRef((l==null?void 0:l.extensionsVersion)??0);h.useEffect(()=>{const we=(l==null?void 0:l.extensionsVersion)??0;we!==Ae.current&&(Ae.current=we,b({}),he(!0))},[he,l==null?void 0:l.extensionsVersion]),h.useEffect(()=>{if(!F)return;let we=!1,We,ce=1e3;const De=async()=>{var ct,qe;try{const Ve=await o.extensionOperationStatus(F.operationId);if(we)return;if(ce=1e3,Ve.status==="waiting_for_input"){Ve.interaction?(St(Ve.operationId,Ve.interaction,"install"),We=setTimeout(()=>void De(),5e3)):(N("error"),S(s("extensions.manage.operationFailed")),Pt(F.operationId),J(null));return}if(Ve.status==="failed"){N("error"),S(s("extensions.install.failed",{source:F.source,error:Ve.error??""})),Pt(F.operationId),J(null);return}if(Ve.status==="succeeded"||Ve.status==="succeeded_with_refresh_error"){N(Ve.status==="succeeded_with_refresh_error"?"error":"success"),S(Ve.status==="succeeded_with_refresh_error"?s("extensions.manage.refreshFailed",{error:((ct=Ve.result)==null?void 0:ct.error)??""}):s("extensions.install.installed",{name:((qe=Ve.result)==null?void 0:qe.name)??F.source})),Pt(F.operationId),J(null),he(!0);return}N("progress"),S(s("extensions.install.started",{source:F.source})),We=setTimeout(()=>void De(),1e3)}catch(Ve){if(we)return;if(N("error"),S(Ve instanceof Error?Ve.message:String(Ve)),Ve instanceof Jc&&Ve.status===404){Pt(F.operationId),J(null);return}We=setTimeout(()=>void De(),ce),ce=Math.min(ce*2,3e4)}};return De(),()=>{we=!0,We&&clearTimeout(We)}},[o,Pt,he,F,St,s]);const rt=h.useCallback(we=>{if(!V)return;const We=V.owner,ce=()=>{We==="install"?J(De=>De&&{...De}):_t(De=>De&&{...De})};ue(!0),o.respondToExtensionInteraction(V.operationId,V.interaction.id,we,r.clientId).then(()=>{Pt(V.operationId),ce()}).catch(De=>{N("error"),S(De instanceof Error?De.message:String(De)),Pt(V.operationId),ce()}).finally(()=>ue(!1))},[o,Pt,r.clientId,V]);h.useEffect(()=>{if(!Pe)return;let we=!1,We,ce=1e3;const De=async()=>{var ct;try{const qe=await o.extensionOperationStatus(Pe.operationId);if(we)return;if(ce=1e3,qe.status==="waiting_for_input"){qe.interaction?(St(qe.operationId,qe.interaction,"mutation"),We=setTimeout(()=>void De(),5e3)):(N("error"),S(s("extensions.manage.operationFailed")),Pt(Pe.operationId),_t(null),_(null),ae.current=!1,Pe.operation==="uninstall"&&(be.current=null,he(!0)));return}if(qe.status==="failed"){N("error"),S(qe.error??s("extensions.manage.operationFailed")),Pt(Pe.operationId),_t(null),_(null),ae.current=!1,qe.operation==="uninstall"&&(be.current=null,he(!0));return}if(qe.status==="succeeded"||qe.status==="succeeded_with_refresh_error"){qe.status==="succeeded_with_refresh_error"?(N("error"),S(s("extensions.manage.refreshFailed",{error:((ct=qe.result)==null?void 0:ct.error)??""}))):qe.operation==="uninstall"?S(null):(N("success"),S(LY(qe.operation,Pe.name,s))),Pt(Pe.operationId),_t(null),_(null),ae.current=!1,qe.operation==="uninstall"&&(be.current=null,O(null),f(null)),qe.operation==="update"&&b(Ve=>{const Qt={...Ve};return delete Qt[Pe.name],Qt}),he(!0);return}N("progress"),S(DC(qe.operation,Pe.name,s)),We=setTimeout(()=>void De(),1e3)}catch(qe){if(we)return;if(N("error"),S(qe instanceof Error?qe.message:String(qe)),qe instanceof Jc&&qe.status===404){Pt(Pe.operationId),_t(null),_(null),ae.current=!1,Pe.operation==="uninstall"&&(be.current=null,he(!0));return}We=setTimeout(()=>void De(),ce),ce=Math.min(ce*2,3e4)}};return De(),()=>{we=!0,We&&clearTimeout(We)}},[o,Pt,he,Pe,St,s]);const dt=h.useCallback(()=>{O(null),N("info"),S(null),he()},[he]),jt=h.useCallback(we=>{x(we),O(d===we?we:null),N("info"),S(null),b(We=>({...We,[we]:"checking for updates"})),o.checkExtensionUpdates(r.clientId).then(We=>{b(We.states),S(SN(We.states[we],s))}).catch(We=>{b(ce=>({...ce,[we]:"error"})),N("error"),S(We instanceof Error?We.message:String(We))}).finally(()=>x(null))},[o,r.clientId,d,s]),et=h.useCallback(()=>{const we=R.trim(),We=r.clientId;!we||!me||F||Pe||ae.current||(M(!0),O(null),N("progress"),S(null),o.installExtension({source:we,consent:!0},We).then(ce=>{J({operationId:ce.operationId,source:we}),Y(""),K(!1)}).catch(ce=>{N("error"),S(ce instanceof Error?ce.message:String(ce))}).finally(()=>M(!1)))},[o,r.clientId,R,me,F,Pe]),Mt=h.useCallback((we,We,ce={})=>{const De=r.clientId;if(!me||F||Pe||v||ae.current)return!1;ae.current=!0,ce.operation==="uninstall"&&(be.current=we),_(we),O(d===we?we:null),N("progress"),S(ce.startMessage??null);let ct=!1;return We(De).then(qe=>{const Ve=qe&&typeof qe=="object"&&"operationId"in qe&&typeof qe.operationId=="string"?qe.operationId:void 0;if(Ve){ct=!0,_t({operationId:Ve,name:we,operation:ce.operation});return}S(s("extensions.manage.queued",{name:we}))}).catch(qe=>{N("error"),S(qe instanceof Error?qe.message:String(qe))}).finally(()=>{ct||(ae.current=!1,_(null),ce.operation==="uninstall"&&(be.current=null),he(!0))}),!0},[r.clientId,v,he,me,F,Pe,d,s]),sn=h.useCallback(async(we,We,ce)=>{if(k||F||Pe||v||!i.workspaceCwd)return;const De=ce==="enabled"?"enable":ce==="disabled"?"disable":"inherit";_(we.name),O(we.name),N("progress"),S(De==="inherit"?s("extensions.manage.inheriting",{name:we.name}):DC(De,we.name,s));try{const ct=We==="user"?await i.client.setExtensionDefaultActivation(we.id,ce):ce==="inherit"?await i.client.workspaceByCwd(i.workspaceCwd).clearExtensionActivation(we.id):await i.client.workspaceByCwd(i.workspaceCwd).setExtensionActivation(we.id,ce),qe=await i.client.waitForExtensionOperation(ct);if(qe.status==="failed")throw new Error(qe.error??s("extensions.manage.operationFailed"));await he(!0),N("success"),S(De==="inherit"?s("extensions.manage.inherited",{name:we.name}):LY(De,we.name,s))}catch(ct){N("error"),S(ct instanceof Error?ct.message:String(ct))}finally{_(null)}},[k,v,he,F,Pe,s,i.client,i.workspaceCwd]),Ye=h.useMemo(()=>c.find(we=>we.name===d),[c,d]);h.useEffect(()=>{n==null||n.onDetailChange(!!Ye)},[n,Ye]);const $n=h.useMemo(()=>K8t(c,m),[c,m]),Te=h.useCallback(()=>{ze.current=d,f(null)},[d]);h.useEffect(()=>{var we;d||!ze.current||((we=ve.current.get(ze.current))==null||we.focus(),ze.current=null)},[d]);const ie=a.jsx(s0,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(r0,{className:"text-base",children:[a.jsx(oo,{children:a.jsx(Kt,{variant:"ghost",size:"icon",onClick:e,"aria-label":s("common.back"),children:a.jsx(T_,{})})}),a.jsx(oo,{children:Ye?a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",onClick:Te,children:s("extensions.manage.title")})}):a.jsx(Bl,{children:s("extensions.manage.title")})}),Ye?a.jsx(yh,{}):null,Ye?a.jsx(oo,{children:a.jsx(Bl,{children:Zw(Ye)})}):null]})}),it=n?Ye?a.jsx(s0,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(r0,{className:"h-8 text-sm",children:[a.jsx(oo,{children:a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",onClick:n.onRoot,children:s("extensions.manage.title")})})}),a.jsx(yh,{}),a.jsx(oo,{children:a.jsx(Bl,{children:Zw(Ye)})})]})}):null:ie;if(Ye){const we=Ye.details,We=g[Ye.name]??Ye.updateState,ce=!me||F!==null||k!==null||Pe!==null,De=v===Ye.name,ct=Ye.defaultActivation,qe=Ye.workspaceActivation,Ve=ct===void 0||qe===void 0,Qt=(we==null?void 0:we.commands)??[],Un=(we==null?void 0:we.skills)??[],Ie=(we==null?void 0:we.agents)??[],wt=(we==null?void 0:we.mcpServers)??[],Wt=(we==null?void 0:we.contextFiles)??[];return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[it,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:a.jsx(ZF,{})}),a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("h1",{className:"break-words text-xl font-semibold",children:Zw(Ye)}),a.jsxs(Ni,{variant:"outline",children:["v",Ye.version]}),a.jsx(Ni,{variant:"secondary",className:RR(Ye)?"bg-[var(--success-bg)] text-[var(--success-color)]":void 0,children:_N(Ye,s)})]})}),a.jsxs(Mu,{open:j,onOpenChange:L,children:[a.jsx(Ru,{asChild:!0,children:a.jsx(Kt,{variant:"ghost",size:"icon",disabled:ce||De,"aria-label":s("extensions.manage.actions"),children:ce||De?a.jsx(Ws,{}):a.jsx(sp,{})})}),a.jsxs(Du,{align:"end",children:[a.jsxs(Tp,{children:[a.jsx(bi,{disabled:ce||v!==null,onSelect:()=>jt(Ye.name),children:s("extensions.manage.checkUpdates")}),a.jsx(bi,{disabled:ce||De||We!==DY,onSelect:()=>Mt(Ye.name,Me=>o.updateExtension(Ye.name,Me),{operation:"update",startMessage:DC("update",Ye.name,s)}),children:s("extensions.manage.update")})]}),a.jsx(F3,{}),a.jsx(Tp,{children:a.jsx(bi,{variant:"destructive",disabled:ce||De,onSelect:Me=>{Me.preventDefault(),L(!1),I(Ye.name)},children:s("extensions.manage.uninstallAction")})})]})]})]}),E===Ye.name&&T?a.jsx(mc,{tone:C,noticeKey:T,closeLabel:s("common.close"),onDismiss:()=>S(null),className:"break-words",children:T}):null,Ve?a.jsxs(lo,{variant:"destructive",children:[a.jsx(La,{}),a.jsx(co,{children:s("extensions.manage.setting.unavailableDescription")})]}):null,a.jsx(Wo,{className:"gap-0 py-1",children:a.jsxs(dc,{className:"flex flex-col p-0",children:[a.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"font-medium",children:s("extensions.manage.userSetting")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:s("extensions.manage.userSettingDescription")})]}),a.jsxs(vl,{value:ct,disabled:ce||De||Ve,onValueChange:Me=>void sn(Ye,"user",Me),children:[a.jsx(xl,{className:"w-28 shrink-0",children:a.jsx(wl,{placeholder:s("extensions.manage.setting.unknown")})}),a.jsxs(kl,{children:[a.jsx(Ai,{value:"enabled",children:s("extensions.manage.setting.enabled")}),a.jsx(Ai,{value:"disabled",children:s("extensions.manage.setting.disabled")})]})]})]}),a.jsx(dO,{}),a.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"font-medium",children:s("extensions.manage.workspaceSetting")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:s("extensions.manage.workspaceSettingDescription")})]}),a.jsxs(vl,{value:qe,disabled:ce||De||Ve,onValueChange:Me=>void sn(Ye,"workspace",Me),children:[a.jsx(xl,{className:"w-28 shrink-0",children:a.jsx(wl,{placeholder:s("extensions.manage.setting.unknown")})}),a.jsxs(kl,{children:[a.jsx(Ai,{value:"inherit",children:s("extensions.manage.setting.default")}),a.jsx(Ai,{value:"enabled",children:s("extensions.manage.setting.enabled")}),a.jsx(Ai,{value:"disabled",children:s("extensions.manage.setting.disabled")})]})]})]})]})}),a.jsxs(_1,{defaultValue:"overview",children:[a.jsxs(S1,{className:"max-w-full overflow-x-auto",children:[a.jsx(ci,{value:"overview",children:s("extensions.manage.overview")}),a.jsxs(ci,{value:"commands",children:[Eb(s("extensions.manage.commands"))," ",Qt.length]}),a.jsxs(ci,{value:"skills",children:[Eb(s("extensions.manage.skills"))," ",Un.length]}),a.jsxs(ci,{value:"agents",children:[Eb(s("extensions.manage.agents"))," ",Ie.length]}),a.jsxs(ci,{value:"mcp",children:[Eb(s("extensions.manage.mcpServers"))," ",wt.length]}),a.jsxs(ci,{value:"context",children:[Eb(s("extensions.manage.contextFiles"))," ",Wt.length]})]}),a.jsx(qi,{value:"overview",className:"pt-4",children:a.jsxs(Wo,{children:[a.jsxs(Hl,{children:[a.jsx(Ul,{children:s("extensions.manage.overview")}),Ye.description?a.jsx(Lu,{children:Ye.description}):null]}),a.jsxs(dc,{className:"grid gap-6 sm:grid-cols-2",children:[a.jsx(af,{label:s("extensions.manage.name"),value:Ye.name}),a.jsx(af,{label:s("extensions.manage.version"),value:Ye.version}),a.jsx(af,{label:s("extensions.manage.status"),value:_N(Ye,s)}),a.jsx(af,{label:s("extensions.manage.source"),value:Ye.source??"-"}),a.jsx(af,{label:s("extensions.manage.path"),value:Ye.path}),a.jsx(af,{label:s("extensions.manage.updateStatus"),value:SN(We,s)}),a.jsx(af,{label:s("extensions.manage.installType"),value:Ye.installType??"-"}),a.jsx(af,{label:s("extensions.manage.origin"),value:Ye.originSource??"-"}),a.jsx(af,{label:s("extensions.manage.settings"),value:((we==null?void 0:we.settings)??[]).join(", ")||"-"})]})]})}),a.jsx(qi,{value:"commands",className:"pt-4",children:a.jsx(ex,{items:Qt,empty:s("extensions.manage.emptyCommands"),icon:rke})}),a.jsx(qi,{value:"skills",className:"pt-4",children:a.jsx(ex,{items:Un,empty:s("extensions.manage.emptySkills"),icon:iy})}),a.jsx(qi,{value:"agents",className:"pt-4",children:a.jsx(ex,{items:Ie,empty:s("extensions.manage.emptyAgents"),icon:sy})}),a.jsx(qi,{value:"mcp",className:"pt-4",children:a.jsx(ex,{items:wt,empty:s("extensions.manage.emptyMcpServers"),icon:ry})}),a.jsx(qi,{value:"context",className:"pt-4",children:a.jsx(ex,{items:Wt,empty:s("extensions.manage.emptyContextFiles"),icon:Tee})})]})]}),a.jsx(ev,{open:z===Ye.name,onOpenChange:Me=>{Me||I(null)},children:a.jsxs(tv,{children:[a.jsxs(nv,{className:"place-items-start text-left",children:[a.jsx(rv,{children:s("extensions.manage.uninstallAction")}),a.jsx(iv,{children:s("extensions.manage.uninstallConfirm",{name:Ye.name})})]}),a.jsxs(sv,{children:[a.jsx(ov,{children:s("common.cancel")}),a.jsx(tE,{variant:"destructive",onClick:()=>{z&&Mt(z,Me=>o.uninstallExtension(z,Me),{operation:"uninstall",startMessage:DC("uninstall",z,s)})&&I(null)},children:s("extensions.manage.uninstallAction")})]})]})}),a.jsx(PY,{pendingInteraction:V,submitting:de,selectedPlugin:Q,interactionValue:pe,setSelectedPlugin:ne,setInteractionValue:fe,submit:rt,t:s})]})}return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[it,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{ref:t,tabIndex:-1,className:"text-xl font-semibold outline-none",children:s("extensions.manage.title")}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:s("extensions.manage.count",{count:c.length})})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a.jsxs(Kt,{variant:"outline",disabled:w,onClick:dt,children:[w?a.jsx(Ws,{}):a.jsx(Ug,{"data-icon":"inline-start"}),s("common.refresh")]}),a.jsxs(Kt,{disabled:!me||!!(F||Pe||k),onClick:()=>K(!0),children:[a.jsx(Vf,{"data-icon":"inline-start"}),s("extensions.manage.add")]})]})]}),E===null&&T||B?a.jsx(mc,{tone:B?"error":C,noticeKey:(E===null?T:null)??B??"",closeLabel:s("common.close"),onDismiss:()=>{S(null),D(null)},className:"break-words",children:(E===null?T:null)??B}):null,a.jsxs("div",{className:"relative",children:[a.jsx(eu,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Ur,{name:"extension-search","aria-label":s("extensions.manage.search"),autoComplete:"off",value:m,onChange:we=>p(we.target.value),placeholder:s("extensions.manage.search"),className:"pl-9"})]}),$n.length?a.jsx("div",{className:V8t.extensionGrid,"data-column-count":Math.min($n.length,4),children:$n.map(we=>{const We=g[we.name]??we.updateState;return a.jsx(Wo,{ref:ce=>{ce?ve.current.set(we.name,ce):ve.current.delete(we.name)},size:"sm",role:"button",tabIndex:0,"aria-label":Zw(we),className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>f(we.name),onKeyDown:ce=>{(ce.key==="Enter"||ce.key===" ")&&(ce.preventDefault(),f(we.name))},children:a.jsx(Hl,{className:"block",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:a.jsx(ZF,{className:"size-5"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[a.jsx(Ul,{className:"min-w-0 truncate",children:Zw(we)}),a.jsx("div",{className:"flex shrink-0 justify-end",children:a.jsx(Ni,{variant:"secondary",className:RR(we)?"bg-[var(--success-bg)] text-[10px] text-[var(--success-color)]":"text-[10px]",children:_N(we,s)})})]}),We===DY?a.jsx("div",{className:"mt-1",children:a.jsx(Ni,{className:"text-[10px]",children:SN(We,s)})}):null,a.jsx(Lu,{className:"mt-1 min-w-0 text-xs",children:a.jsx(Td,{delayDuration:300,children:a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsx("span",{className:"block truncate",children:we.description||s("extensions.manage.noDescription")})}),a.jsx(Uu,{children:we.description||s("extensions.manage.noDescription")})]})})})]})]})})},we.id||we.name)})}):a.jsx(md,{className:"border",children:a.jsxs(pd,{children:[a.jsx(gd,{variant:"icon",children:m?a.jsx(eu,{}):a.jsx(Lxe,{})}),a.jsx(bd,{children:s(m?"extensions.manage.noMatches":"extensions.manage.empty")}),m?null:a.jsx($v,{children:s("extensions.manage.emptyDescription")})]})})]}),a.jsx(ev,{open:$,onOpenChange:we=>{(we||!W)&&K(we)},children:a.jsxs(tv,{size:"middle",children:[a.jsxs(nv,{className:"place-items-start text-left",children:[a.jsx(rv,{children:s("extensions.manage.installTitle")}),a.jsx(iv,{children:s("extensions.manage.installDescription")})]}),a.jsx(Ur,{id:"extension-source",name:"extension-source","aria-label":s("extensions.manage.installDescription"),autoComplete:"off",value:R,onChange:we=>Y(we.target.value),placeholder:s("extensions.manage.sourcePlaceholder")}),a.jsxs(sv,{children:[a.jsx(ov,{disabled:W,children:s("common.cancel")}),a.jsxs(Kt,{disabled:W||!me||!!(F||Pe||k)||!R.trim(),onClick:et,children:[W?a.jsx(Ws,{}):null,s("extensions.manage.install")]})]})]})}),a.jsx(PY,{pendingInteraction:V,submitting:de,selectedPlugin:Q,interactionValue:pe,setSelectedPlugin:ne,setInteractionValue:fe,submit:rt,t:s})]})}const Y8t="_connectedBadge_1erz5_1",X8t="_serverGrid_1erz5_6",jme={connectedBadge:Y8t,serverGrid:X8t},LC=`{
  "command": "",
  "args": []
}`;function iE(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 P4(e){const t=iE(e);return t==="workspace_settings"?"workspace":t==="extension"?"extension":"user"}function Q8t(e){const t=iE(e);return t==="extension"||t==="workspace_settings"||t==="user_settings"}function OY(e,t){const n=P4(e);return t(n==="workspace"?"mcp.source.workspace":n==="extension"?"mcp.source.extension":"mcp.source.user")}function $Y(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 BY(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 zY(e){return!e.disabled&&!e.approvalState&&e.mcpStatus==="connected"?jme.connectedBadge:""}function J8t(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 Z8t(e,t){const n=[],s=!!e.approvalState,r=iE(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 CN(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,t("mcp.oauth.starting",{name:e}),n].filter(Boolean).join(`
`)}function eAt(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function tAt(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 Bc({label:e,value:t}){return a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx("div",{className:"text-sm font-medium",children:e}),a.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function nAt({tool:e,t}){var i;const n=tAt(e,t),s=e.schema,r=(s==null?void 0:s.parametersJsonSchema)??(s==null?void 0:s.parameters)??s;return a.jsxs("div",{className:"flex flex-col gap-5",children:[e.isValid?null:a.jsxs(lo,{variant:"destructive",children:[a.jsx(La,{}),a.jsx(ql,{children:t("mcp.invalidToolWarning")}),a.jsxs(co,{children:[e.invalidReason||t("mcp.status.unknown"),a.jsx("span",{className:"mt-1 block",children:t("mcp.invalidToolHelp")})]})]}),a.jsx(Bc,{label:t("mcp.description"),value:((i=e.description)==null?void 0:i.trim())||t("mcp.noDescription")}),n?a.jsx(Bc,{label:t("mcp.annotations"),value:n}):null,a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx("div",{className:"text-sm font-medium",children:t("mcp.inputSchema")}),r?a.jsx("pre",{className:"max-h-96 overflow-auto rounded-lg bg-muted p-4 text-xs leading-relaxed",children:JSON.stringify(r,null,2)}):a.jsx("div",{className:"text-sm text-muted-foreground",children:t("mcp.noSchema")})]})]})}function sAt({resource:e,t}){const n=e.title||e.name||"";return a.jsxs("div",{className:"flex flex-col gap-5",children:[a.jsx(Bc,{label:t("mcp.resource.uriLabel"),value:e.uri}),n&&n!==e.uri?a.jsx(Bc,{label:t("mcp.resource.nameLabel"),value:n}):null,e.mimeType?a.jsx(Bc,{label:t("mcp.resource.mimeTypeLabel"),value:e.mimeType}):null,typeof e.size=="number"?a.jsx(Bc,{label:t("mcp.resource.sizeLabel"),value:t("mcp.resource.bytes",{count:e.size})}):null,e.description?a.jsx(Bc,{label:t("mcp.description"),value:e.description.trim()}):null]})}function Nme({message:e,onClose:t,embedded:n}){var qe,Ve,Qt,Un;const{t:s}=nt(),r=sD({autoLoad:!1}),i=rD({autoLoad:!1}),[o,l]=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),[w,y]=h.useState(null),[v,x]=h.useState("overview"),[k,_]=h.useState(""),[T,S]=h.useState("all"),[C,N]=h.useState(null),[E,O]=h.useState(!1),[B,D]=h.useState(!1),[j,L]=h.useState(!1),[z,I]=h.useState(null),[$,K]=h.useState(""),[R,Y]=h.useState(""),[W,M]=h.useState("workspace"),[F,J]=h.useState(LC),[V,U]=h.useState(!1),[le,pe]=h.useState(null),[fe,Q]=h.useState(null),[ne,de]=h.useState(null),ue=ne!=null&&ne.error?"error":ne!=null&&ne.success?"success":ne!=null&&ne.progress?"progress":"info",[me,te]=h.useState({}),ae=h.useRef(e.status.discoveryState==="completed"),be=h.useRef(!0);h.useEffect(()=>(be.current=!0,()=>{be.current=!1}),[]);const se=h.useCallback(async()=>(await new Promise(Ie=>window.setTimeout(Ie,1500)),be.current),[]),ve=h.useCallback(async(Ie,wt=!0,Wt=!1)=>{var Me;if(await(Ie==="initialize"?r.initialize():r.reloadConfig()),!be.current)return!1;for(let Je=0;Je<40;Je+=1){if(!await se())return!1;const pt=await r.reload();if(!be.current)return!1;if(pt){if((!Wt||pt.discoveryState==="completed")&&l(ln=>wt&&pt.servers.length===0&&ln.servers.length>0?{...pt,servers:ln.servers}:pt),(Me=pt.errors)!=null&&Me.length)return wt&&de({text:pt.errors.map(ln=>ln.error||ln.hint||ln.kind).join(`
`),error:!0}),!1;if(pt.discoveryState==="completed")return wt&&de(null),!0;if(pt.initialized&&pt.discoveryState==="not_started"&&pt.servers.length===0)return Wt&&l(pt),wt&&de({text:s("mcp.discovery.empty")}),!0}}return wt&&de({text:s("mcp.discovery.timeout"),error:!0}),!1},[r,s,se]);h.useEffect(()=>{ae.current||(ae.current=!0,O(!0),ve("initialize").catch(Ie=>{be.current&&de({text:no(Ie),error:!0})}).finally(()=>{be.current&&O(!1)}))},[ve]);const ze=h.useMemo(()=>(o.servers??[]).filter(Q8t),[o.servers]),Pe=ze.find(Ie=>Ie.name===m)??null,_t=Pe?((qe=c[Pe.name])==null?void 0:qe.tools)??[]:[],Pt=Pe?((Ve=d[Pe.name])==null?void 0:Ve.resources)??[]:[],St=_t.find(Ie=>Ie.name===g)??null,he=Pt.find(Ie=>Ie.uri===w)??null;h.useEffect(()=>{n==null||n.onDetailChange(!!Pe)},[n,Pe]);const Ae=h.useMemo(()=>{const Ie=k.trim().toLowerCase();return ze.filter(wt=>{var Je,pt;const Wt=T==="all"||P4(wt)===T,Me=!Ie||wt.name.toLowerCase().includes(Ie)||((Je=wt.description)==null?void 0:Je.toLowerCase().includes(Ie))||((pt=wt.extensionName)==null?void 0:pt.toLowerCase().includes(Ie));return Wt&&!!Me})},[k,ze,T]),rt=h.useCallback(async Ie=>{const wt=[],[Wt,Me]=await Promise.allSettled([r.loadTools(Ie.name),Ie.resourceCount?r.loadResources(Ie.name):Promise.resolve(null)]);if(Wt.status==="fulfilled")u(Je=>({...Je,[Ie.name]:Wt.value})),te(Je=>({...Je,[Ie.name]:{...Je[Ie.name],tools:void 0}}));else{wt.push(Wt.reason);const Je=no(Wt.reason);te(pt=>({...pt,[Ie.name]:{...pt[Ie.name],tools:Je}}))}if(Me.status==="fulfilled"&&Me.value!==null){const Je=Me.value;f(pt=>({...pt,[Ie.name]:Je})),te(pt=>({...pt,[Ie.name]:{...pt[Ie.name],resources:void 0}}))}else if(Me.status==="rejected"){wt.push(Me.reason);const Je=no(Me.reason);te(pt=>({...pt,[Ie.name]:{...pt[Ie.name],resources:Je}}))}else f(Je=>{if(!(Ie.name in Je))return Je;const pt={...Je};return delete pt[Ie.name],pt}),te(Je=>({...Je,[Ie.name]:{...Je[Ie.name],resources:void 0}}));if(wt.length>0)throw new AggregateError(wt,`${Ie.name}: ${wt.map(no).join("; ")}`)},[r]),dt=h.useCallback(async()=>{if(!B){D(!0),de(null);try{const Ie=await r.reload();if(!Ie)return;l(Ie)}catch(Ie){de({text:no(Ie),error:!0})}finally{D(!1)}}},[r,B]),jt=h.useCallback(async()=>{const Ie=$.trim(),wt=z!==null;if(!Ie){pe(s("mcp.add.nameRequired"));return}let Wt;try{const Je=JSON.parse(F);if(!Je||typeof Je!="object"||Array.isArray(Je))throw new Error(s("mcp.add.configInvalid"));const pt=R.trim();Wt={...Je,...pt?{description:pt}:{}}}catch(Je){pe(no(Je));return}pe(null),U(!0);let Me=!1;try{await i.setValue(W,"mcpServers",Wt,{mcpServerMutation:{operation:"set",name:Ie}}),Me=!0,de(null);const Je=await ve("reload",!1).catch(()=>!1);de({...wt?{serverName:Ie}:{},text:Je?s(wt?"mcp.edit.done":"mcp.add.done",{name:Ie}):s("mcp.runtime.notUpdated"),error:!Je,success:Je}),L(!1),I(null),K(""),Y(""),J(LC)}catch(Je){Me?(de({...wt?{serverName:Ie}:{},text:s("mcp.runtime.notUpdated"),error:!0}),L(!1),I(null),K(""),Y(""),J(LC)):pe(no(Je))}finally{U(!1)}},[r,z,F,R,$,W,i,ve,s]),et=h.useCallback(async()=>{if(!fe)return;N(fe.name);let Ie=!1;try{const wt=await i.reload();if(!wt){de({serverName:fe.name,text:s("mcp.add.settingsUnavailable"),error:!0});return}const Wt=P4(fe)==="workspace"?"workspace":"user",Me=$Y(wt,Wt);if(!(fe.name in Me)){de({serverName:fe.name,text:s("mcp.remove.notWorkspace"),error:!0});return}await i.setValue(Wt,"mcpServers",{},{mcpServerMutation:{operation:"remove",name:fe.name}}),Ie=!0,Q(null),de({serverName:fe.name,text:s("mcp.action.running",{action:s("mcp.action.remove")}),progress:!0}),await ve("reload",!1,!0).catch(()=>!1)?(p(null),b(null),y(null),de(null)):de({serverName:fe.name,text:s("mcp.runtime.removeNotUpdated"),error:!0})}catch(wt){de({serverName:fe.name,text:Ie?s("mcp.runtime.removeNotUpdated"):s("mcp.action.failed",{error:no(wt)}),error:!0})}finally{N(null)}},[fe,i,ve,s]),Mt=h.useCallback(async Ie=>{if(C)return;const wt=iE(Ie);if(wt!=="user_settings"&&wt!=="workspace_settings")return;const Wt=wt==="workspace_settings"?"workspace":"user";N(Ie.name),de(null);try{const Me=await i.reload();if(!Me)throw new Error(s("mcp.add.settingsUnavailable"));const Je=$Y(Me,Wt)[Ie.name];if(!Je||typeof Je!="object"||Array.isArray(Je))throw new Error(s("mcp.edit.notFound"));const pt={...Je},ln=pt.description;delete pt.description,I(Ie),K(Ie.name),M(Wt),Y(typeof ln=="string"?ln:""),J(JSON.stringify(pt,null,2)),pe(null),L(!0)}catch(Me){de({serverName:Ie.name,text:s("mcp.action.failed",{error:no(Me)}),error:!0})}finally{N(null)}},[C,i,s]),sn=h.useCallback(async(Ie,wt)=>{var Wt,Me,Je,pt;if(!C){if(wt.id==="remove"){Q(Ie);return}if(wt.id==="edit"){await Mt(Ie);return}N(Ie.name),de({serverName:Ie.name,text:wt.id==="authenticate"?CN(Ie.name,s):s("mcp.action.running",{action:wt.label}),progress:!0});try{let ln="",Bn,ns=!1;if(wt.id==="reconnect"){const Xe=await r.restartServer(Ie.name);if(!be.current)return;if("restarted"in Xe&&!Xe.restarted)throw Xe.reason==="authentication_required"?new Error(s("mcp.reconnect.authenticationRequired")):new Error(s("mcp.reconnect.skipped",{reason:Xe.reason}));if("entries"in Xe&&(Xe.entries.length===0||Xe.entries.every(ot=>!ot.restarted)))throw new Error(s("mcp.reconnect.skipped",{reason:Xe.entries.map(ot=>ot.reason).filter(Boolean).join(", ")||"not connected"}))}else{const Xe=await r.manageServer(Ie.name,wt.id);if(!be.current)return;Bn=Xe.authUrl,ln=[...Xe.messages??[]].join(`
`),ns=wt.id==="authenticate"&&Xe.pending===!0,ns&&de({serverName:Ie.name,text:CN(Ie.name,s,ln),progress:!0,...Bn?{authUrl:Bn}:{}})}let lt;if(ns){for(let Xe=0;Xe<400;Xe+=1){if(!await se())return;const ot=await r.reload();if(!be.current)return;if(!ot)continue;l(ot);const Tt=(Wt=ot.errors)==null?void 0:Wt[0];if(Tt)throw new Error(Tt.error||Tt.hint||s("mcp.oauth.statusFailed"));const fn=(Me=ot.servers)==null?void 0:Me.find(Qn=>Qn.name===Ie.name);if(!fn)throw new Error(s("mcp.oauth.serverRemoved"));if(fn.authenticationState==="failed")throw new Error(fn.authenticationError||s("mcp.oauth.authenticationFailed"));if(fn.authenticationState==="succeeded"||fn.authenticationState===void 0&&fn.mcpStatus==="connected"){lt=ot;break}}if(!lt)throw new Error(s("mcp.oauth.timeout"))}else{if(lt=await r.reload(),!be.current)return;for(let Xe=0;(lt==null?void 0:lt.discoveryState)!==void 0&&lt.discoveryState!=="completed"&&!((Je=lt.errors)!=null&&Je.length)&&Xe<40;Xe+=1){if(!await se())return;const ot=await r.reload();if(!be.current)return;ot&&(lt=ot,l(ot))}}if(lt){l(lt);const Xe=(pt=lt.servers)==null?void 0:pt.find(ot=>ot.name===Ie.name);if(Xe&&(lt.discoveryState===void 0||lt.discoveryState==="completed")){try{await rt(Xe)}catch{}if(!be.current)return}}de({serverName:Ie.name,text:ns?s("mcp.action.done",{action:wt.label}):wt.id==="authenticate"&&ln?CN(Ie.name,s,ln):ln||s("mcp.action.done",{action:wt.label}),success:!0,...!ns&&Bn?{authUrl:Bn}:{}})}catch(ln){be.current&&de({serverName:Ie.name,text:s("mcp.action.failed",{error:no(ln)}),error:!0})}finally{be.current&&N(null)}}},[C,rt,r,Mt,s,se]),Ye=Ie=>{p(Ie.name),x("overview"),b(null),y(null),de(null),!Ie.approvalState&&rt(Ie).catch(wt=>{de({serverName:Ie.name,text:s("mcp.action.failed",{error:no(wt)}),error:!0})})},$n=()=>{C===null&&(p(null),b(null),y(null),D(!0),r.reload().then(Ie=>{Ie&&l(Ie)}).catch(Ie=>{de({text:no(Ie),error:!0})}).finally(()=>D(!1)))},Te=()=>{b(null),y(null)},ie=a.jsx(s0,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(r0,{className:"text-base",children:[a.jsx(oo,{children:a.jsx(Kt,{variant:"ghost",size:"icon",disabled:C!==null,onClick:t,"aria-label":s("common.back"),children:a.jsx(T_,{})})}),a.jsx(oo,{children:Pe?a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",disabled:C!==null,onClick:$n,children:s("mcp.title")})}):a.jsx(Bl,{children:s("mcp.title")})}),Pe?a.jsx(yh,{}):null,Pe?a.jsx(oo,{children:St||he?a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",onClick:Te,children:Pe.name})}):a.jsx(Bl,{children:Pe.name})}):null,St||he?a.jsx(yh,{}):null,St?a.jsx(oo,{children:a.jsx(Bl,{children:St.name})}):null,he?a.jsx(oo,{children:a.jsx(Bl,{children:he.title||he.name||he.uri})}):null]})}),it=St?St.name:he?he.title||he.name||he.uri:Pe==null?void 0:Pe.name,we=n?Pe?a.jsx(s0,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(r0,{className:"h-8 text-sm",children:[a.jsx(oo,{children:a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",disabled:C!==null,onClick:$n,children:s("mcp.title")})})}),a.jsx(yh,{}),a.jsx(oo,{children:St||he?a.jsx(bh,{asChild:!0,children:a.jsx("button",{type:"button",onClick:Te,children:Pe.name})}):a.jsx(Bl,{children:Pe.name})}),St||he?a.jsx(yh,{}):null,St||he?a.jsx(oo,{children:a.jsx(Bl,{children:it})}):null]})}):null:ie,We=a.jsx(qp,{open:fe!==null,onOpenChange:Ie=>!Ie&&Q(null),children:a.jsxs(Hp,{showCloseButton:!1,children:[a.jsxs(Up,{children:[a.jsx(Vp,{children:s("mcp.remove.title")}),a.jsx(Yg,{children:s(fe&&P4(fe)==="workspace"?"mcp.remove.description":"mcp.remove.description.global",{name:(fe==null?void 0:fe.name)??""})})]}),a.jsxs(Wp,{children:[a.jsx(Kt,{variant:"outline",onClick:()=>Q(null),disabled:C!==null,children:s("common.cancel")}),a.jsxs(Kt,{variant:"destructive",onClick:()=>void et(),disabled:C!==null,children:[C?a.jsx(Ws,{"data-icon":"inline-start"}):a.jsx(kf,{"data-icon":"inline-start"}),s("mcp.action.remove")]})]})]})}),ce=a.jsx(qp,{open:j,onOpenChange:Ie=>{V||(L(Ie),Ie||I(null))},children:a.jsxs(Hp,{className:"sm:max-w-lg",showCloseButton:!1,children:[a.jsxs(Up,{children:[a.jsx(Vp,{children:s(z?"mcp.edit.title":"mcp.add.title")}),a.jsx(Yg,{children:s(z?"mcp.edit.description":"mcp.add.description")})]}),a.jsxs("div",{className:"grid gap-4",children:[le?a.jsxs(lo,{variant:"destructive",children:[a.jsx(La,{}),a.jsx(co,{children:le})]}):null,a.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.name"),a.jsx(Ur,{value:$,onChange:Ie=>K(Ie.target.value),placeholder:"my-mcp-server",disabled:V||z!==null})]}),a.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.serverDescription"),a.jsx(Ur,{value:R,onChange:Ie=>Y(Ie.target.value),placeholder:s("mcp.add.serverDescriptionPlaceholder"),disabled:V})]}),a.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.scope"),a.jsxs(vl,{value:W,onValueChange:Ie=>M(Ie),disabled:V||z!==null,children:[a.jsx(xl,{className:"w-full",children:a.jsx(wl,{})}),a.jsxs(kl,{children:[a.jsx(Ai,{value:"workspace",children:s("settings.scope.workspace")}),a.jsx(Ai,{value:"user",children:s("mcp.add.scope.global")})]})]})]}),a.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[s("mcp.add.config"),a.jsx(ug,{className:"min-h-44 font-mono text-xs",value:F,onChange:Ie=>J(Ie.target.value),disabled:V})]})]}),a.jsxs(Wp,{children:[a.jsx(Kt,{variant:"outline",onClick:()=>{L(!1),I(null)},disabled:V,children:s("common.cancel")}),a.jsxs(Kt,{onClick:()=>void jt(),disabled:V,children:[V?a.jsx(Ws,{"data-icon":"inline-start"}):null,s(V?z?"mcp.edit.saving":"mcp.add.adding":z?"mcp.edit.save":"mcp.add.button")]})]})]})});if(St&&Pe)return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[we,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-xl bg-muted",children:a.jsx(G7,{})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h1",{className:"break-words text-xl font-semibold",children:St.name}),a.jsx("p",{className:"text-sm text-muted-foreground",children:St.serverToolName||Pe.name})]})]}),a.jsx(Wo,{children:a.jsx(dc,{children:a.jsx(nAt,{tool:St,t:s})})})]})]}),ce]});if(he&&Pe)return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[we,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-xl bg-muted",children:a.jsx(V7,{})}),a.jsx("h1",{className:"min-w-0 break-words text-xl font-semibold",children:he.title||he.name||he.uri})]}),a.jsx(Wo,{children:a.jsx(dc,{children:a.jsx(sAt,{resource:he,t:s})})})]})]}),ce]});if(Pe){const Ie=_t,wt=Pt,Wt=me[Pe.name],Me=Z8t(Pe,s);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[we,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:a.jsx(ry,{})}),a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("h1",{className:"break-words text-xl font-semibold",children:Pe.name}),a.jsx(Ni,{variant:"secondary",className:zY(Pe),children:BY(Pe,s)}),a.jsx(Ni,{variant:"outline",children:OY(Pe,s)})]})}),a.jsxs(Mu,{children:[a.jsx(Ru,{asChild:!0,children:a.jsx(Kt,{variant:"ghost",size:"icon",disabled:C!==null,"aria-label":s("mcp.actions"),"data-testid":"mcp-server-actions",children:C===Pe.name?a.jsx(Ws,{}):a.jsx(sp,{})})}),a.jsx(Du,{align:"end",onCloseAutoFocus:Je=>Je.preventDefault(),children:a.jsx(Tp,{children:Me.map(Je=>a.jsx(bi,{"data-testid":`mcp-server-action-${Je.id}`,variant:Je.id==="remove"?"destructive":"default",disabled:C!==null,onSelect:()=>void sn(Pe,Je),children:Je.label},Je.id))})})]})]}),(ne==null?void 0:ne.serverName)===Pe.name?a.jsxs(mc,{tone:ue,noticeKey:ne.text,closeLabel:s("common.close"),onDismiss:()=>de(null),className:"whitespace-pre-wrap break-words",children:[a.jsx("p",{children:ne.text}),ne.authUrl&&eAt(ne.authUrl)?a.jsx("a",{className:"mt-2 inline-block underline underline-offset-3",href:ne.authUrl,target:"_blank",rel:"noreferrer",children:s("mcp.oauth.open")}):null]}):null,a.jsxs(_1,{value:v,onValueChange:x,children:[a.jsxs(S1,{children:[a.jsx(ci,{value:"overview",children:s("mcp.basicInfo")}),a.jsxs(ci,{value:"tools",children:[s("mcp.tools")," ",Ie.length]}),a.jsxs(ci,{value:"resources",children:[s("mcp.resources")," ",Pe.resourceCount??wt.length]})]}),a.jsx(qi,{value:"overview",className:"pt-4",children:a.jsxs(Wo,{children:[a.jsxs(Hl,{children:[a.jsx(Ul,{className:"text-sm",children:s("mcp.descriptionTitle")}),a.jsx(Lu,{children:((Qt=Pe.description)==null?void 0:Qt.trim())||"-"})]}),a.jsxs(dc,{className:"grid gap-6 sm:grid-cols-2",children:[a.jsx(Bc,{label:s("mcp.source"),value:OY(Pe,s)}),a.jsx(Bc,{label:s("mcp.transport"),value:Pe.transport}),a.jsx(Bc,{label:s("mcp.command"),value:J8t(Pe,s)}),a.jsx(Bc,{label:s("mcp.workingDirectory"),value:((Un=Pe.config)==null?void 0:Un.cwd)||o.workspaceCwd}),Pe.error?a.jsx(Bc,{label:s("mcp.invalidReasonLabel"),value:Pe.error}):null,Pe.hint?a.jsx(Bc,{label:s("mcp.description"),value:Pe.hint}):null]})]})}),a.jsx(qi,{value:"tools",className:"pt-4",children:Wt!=null&&Wt.tools?a.jsxs(lo,{variant:"destructive",children:[a.jsx(La,{}),a.jsx(ql,{children:s("mcp.loadingTools")}),a.jsx(co,{children:Wt.tools})]}):Ie.length?a.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:Ie.map(Je=>a.jsx(Wo,{size:"sm",role:"button",tabIndex:0,className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>b(Je.name),onKeyDown:pt=>{(pt.key==="Enter"||pt.key===" ")&&(pt.preventDefault(),b(Je.name))},children:a.jsxs(Hl,{children:[a.jsx(Ul,{className:"break-words",children:Je.name}),a.jsx(Lu,{className:"line-clamp-2 text-xs",children:Je.description||s("mcp.noDescription")}),Je.isValid?null:a.jsx(dfe,{children:a.jsx(Ni,{variant:"destructive",children:s("mcp.status.blocked")})})]})},Je.name))}):a.jsx(md,{className:"rounded-xl border border-dashed",children:a.jsxs(pd,{children:[a.jsx(gd,{variant:"icon",children:a.jsx(G7,{})}),a.jsx(bd,{children:s("mcp.emptyTools")})]})})}),a.jsx(qi,{value:"resources",className:"pt-4",children:Wt!=null&&Wt.resources?a.jsxs(lo,{variant:"destructive",children:[a.jsx(La,{}),a.jsx(ql,{children:s("mcp.resourcesUnavailable")}),a.jsx(co,{children:Wt.resources})]}):wt.length?a.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:wt.map(Je=>a.jsx(Wo,{size:"sm",role:"button",tabIndex:0,className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>y(Je.uri),onKeyDown:pt=>{(pt.key==="Enter"||pt.key===" ")&&(pt.preventDefault(),y(Je.uri))},children:a.jsxs(Hl,{children:[a.jsx(Ul,{className:"break-words",children:Je.title||Je.name||Je.uri}),a.jsx(Lu,{className:"break-all",children:Je.uri})]})},Je.uri))}):a.jsx(md,{className:"rounded-xl border border-dashed",children:a.jsxs(pd,{children:[a.jsx(gd,{variant:"icon",children:a.jsx(V7,{})}),a.jsx(bd,{children:s("mcp.noResources")})]})})})]})]})]}),We,ce]})}const De=ze.filter(Ie=>!Ie.disabled&&Ie.mcpStatus==="connecting").length,ct=[{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 a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[we,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-semibold text-balance",children:s("mcp.title")}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground tabular-nums",children:s("mcp.servers",{count:ze.length})})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Kt,{variant:"outline",onClick:()=>void dt(),disabled:B,children:[B?a.jsx(Ws,{"data-icon":"inline-start"}):a.jsx(Ug,{"data-icon":"inline-start"}),s("common.refresh")]}),a.jsxs(Kt,{onClick:()=>{I(null),K(""),Y(""),M("workspace"),J(LC),pe(null),L(!0)},disabled:V,children:[a.jsx(Vf,{"data-icon":"inline-start"}),s("mcp.add.button")]})]})]}),E&&De===0?a.jsx(mc,{tone:"progress",noticeKey:"mcp-initializing",closeLabel:s("common.close"),onDismiss:()=>{},children:a.jsxs("span",{className:"grid gap-1",children:[a.jsx("span",{className:"font-medium",children:s("mcp.discovery.initializing")}),a.jsx("span",{children:s("mcp.startingNote")})]})}):De>0?a.jsx(mc,{tone:"progress",noticeKey:`mcp-connecting-${De}`,closeLabel:s("common.close"),onDismiss:()=>{},children:a.jsxs("span",{className:"grid gap-1",children:[a.jsx("span",{className:"font-medium",children:s("mcp.starting",{count:De})}),a.jsx("span",{children:s("mcp.startingNote")})]})}):null,ne&&!ne.serverName?a.jsx(mc,{tone:ue,noticeKey:ne.text,closeLabel:s("common.close"),onDismiss:()=>de(null),children:ne.text}):null,(o.errors??[]).map((Ie,wt)=>a.jsxs(lo,{variant:"destructive",children:[a.jsx(La,{}),a.jsx(ql,{children:Ie.kind}),a.jsx(co,{children:Ie.error||Ie.hint||s("mcp.status.unknown")})]},`${Ie.kind}-${wt}`)),o.budgetMode&&o.budgetMode!=="off"?a.jsxs(lo,{children:[a.jsx(La,{}),a.jsx(co,{children:s("mcp.clientBudget",{count:o.clientCount??0,budget:o.clientBudget??"∞"})})]}):null,a.jsxs("div",{className:"relative",children:[a.jsx(eu,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Ur,{className:"pl-9",value:k,onChange:Ie=>_(Ie.target.value),placeholder:`${s("common.search")} MCP…`})]}),a.jsx(hO,{type:"single",value:T,onValueChange:Ie=>{Ie&&S(Ie)},variant:"outline",size:"sm","aria-label":s("mcp.source"),children:ct.map(Ie=>a.jsx(fO,{value:Ie.value,children:Ie.label},Ie.value))}),Ae.length?a.jsx("div",{className:jme.serverGrid,"data-column-count":Math.min(Ae.length,4),children:Ae.map(Ie=>{var wt,Wt;return a.jsx(Wo,{size:"sm",role:"button",tabIndex:0,"aria-label":Ie.name,className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>Ye(Ie),onKeyDown:Me=>{(Me.key==="Enter"||Me.key===" ")&&(Me.preventDefault(),Ye(Ie))},children:a.jsx(Hl,{className:"block",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:a.jsx(ry,{className:"size-5"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[a.jsx(Ul,{className:"min-w-0 flex-1 truncate",children:Ie.name}),a.jsx(Ni,{variant:"secondary",className:`${zY(Ie)} shrink-0 text-[10px]`,children:BY(Ie,s)})]}),a.jsx(Lu,{className:"mt-1 min-w-0 text-xs",children:a.jsx(Td,{delayDuration:300,children:a.jsxs(qu,{children:[a.jsx(Hu,{asChild:!0,children:a.jsx("span",{className:"block truncate",children:((wt=Ie.description)==null?void 0:wt.trim())||"-"})}),a.jsx(Uu,{children:((Wt=Ie.description)==null?void 0:Wt.trim())||"-"})]})})})]})]})})},Ie.name)})}):a.jsx(md,{className:"border",children:a.jsxs(pd,{children:[a.jsx(gd,{variant:"icon",children:k||T!=="all"?a.jsx(eu,{}):a.jsx(ry,{})}),a.jsx(bd,{children:s(k||T!=="all"?"mcp.noMatches":"mcp.empty")}),!k&&T==="all"?a.jsx($v,{children:s("mcp.emptyDescription")}):null]})})]}),ce]})}function rAt({mcpMessage:e,loadMcpMessage:t,onClose:n,onUseSkill:s,initialFocusRef:r}){const{t:i}=nt(),[o,l]=h.useState("extensions"),[c,u]=h.useState(!1),[d,f]=h.useState(0),[m,p]=h.useState(!1),[g,b]=h.useState(null),w=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)},[]),v=h.useMemo(()=>({onRoot:y,onDetailChange:u}),[y]),x=k=>{const _=k;l(_),u(!1),f(T=>T+1),_==="mcp"&&w()};return a.jsxs(_1,{value:o,onValueChange:x,className:"w-full",children:[c?null:a.jsx("div",{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(S1,{className:"h-8","aria-label":i("plugins.sections"),children:[a.jsx(ci,{ref:r,value:"extensions",children:i("plugins.extensions")}),a.jsx(ci,{value:"mcp",children:i("plugins.mcp")}),a.jsx(ci,{value:"skills",children:i("plugins.skills")}),a.jsx(ci,{value:"agents",children:i("plugins.agents")})]})}),a.jsx(qi,{value:o,className:"mt-0",children:o==="extensions"?a.jsx(Ame,{onClose:n,embedded:v},`extensions-${d}`):o==="skills"?a.jsx(gfe,{onClose:n,onUseSkill:s,embedded:v},`skills-${d}`):o==="agents"?a.jsx(ffe,{onClose:n,embedded:v},`agents-${d}`):g?a.jsxs(lo,{variant:"destructive",className:"mt-4",children:[a.jsx(ql,{children:i("plugins.mcpLoadFailed")}),a.jsxs(co,{className:"space-y-3",children:[a.jsx("p",{children:g}),a.jsx(Kt,{variant:"outline",size:"sm",onClick:w,children:i("common.retry")})]})]}):e&&m?a.jsx(Nme,{message:e,onClose:n,embedded:v},`mcp-${d}`):a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8 pt-4",children:[a.jsxs("div",{className:"relative",children:[a.jsx(eu,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Ur,{"aria-label":i("common.search"),readOnly:!0,className:"pl-9",placeholder:`${i("common.search")} MCP…`})]}),a.jsx(md,{className:"border",children:a.jsxs(pd,{children:[a.jsx(gd,{variant:"icon",children:a.jsx(ry,{})}),a.jsx(bd,{children:i("mcp.empty")}),a.jsx($v,{children:i("mcp.emptyDescription")})]})})]})})]})}function oE({className:e,size:t="default",...n}){return a.jsx(lae,{"data-slot":"switch","data-size":t,className:on("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:a.jsx(uae,{"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 iAt="_platformHeader_1yzta_1",oAt="_platformMark_1yzta_7",aAt="_form_1yzta_21",lAt="_body_1yzta_28",cAt="_section_1yzta_38",uAt="_sectionHeading_1yzta_44",dAt="_field_1yzta_62",hAt="_fieldHeader_1yzta_68",fAt="_required_1yzta_76",mAt="_hint_1yzta_80",pAt="_secretState_1yzta_85",gAt="_secretStatus_1yzta_97",bAt="_secretActions_1yzta_105",yAt="_policyGrid_1yzta_111",vAt="_policyCard_1yzta_117",wAt="_policyCopy_1yzta_137",xAt="_policyTitle_1yzta_143",kAt="_policyDescription_1yzta_148",Zi={platformHeader:iAt,platformMark:oAt,form:aAt,body:lAt,section:cAt,sectionHeading:uAt,field:dAt,fieldHeader:hAt,required:fAt,hint:mAt,secretState:pAt,secretStatus:gAt,secretActions:bAt,policyGrid:yAt,policyCard:vAt,policyCopy:wAt,policyTitle:xAt,policyDescription:kAt},_At="_panel_u207s_1",SAt="_header_u207s_11",CAt="_title_u207s_18",TAt="_description_u207s_23",EAt="_emptyDescription_u207s_24",AAt="_headerActions_u207s_31",jAt="_divider_u207s_38",NAt="_success_u207s_44",IAt="_empty_u207s_24",MAt="_emptyTitle_u207s_78",RAt="_list_u207s_83",DAt="_request_u207s_89",LAt="_approval_u207s_100",PAt="_approvalIdentity_u207s_111",OAt="_approvalSenderId_u207s_125",$At="_allowlist_u207s_126",BAt="_requestIdentity_u207s_138",zAt="_senderName_u207s_144",FAt="_senderId_u207s_152",qAt="_requestTime_u207s_153",HAt="_code_u207s_161",Yr={panel:_At,header:SAt,title:CAt,description:TAt,emptyDescription:EAt,headerActions:AAt,divider:jAt,success:NAt,empty:IAt,emptyTitle:MAt,list:RAt,request:DAt,approval:LAt,approvalIdentity:PAt,approvalSenderId:OAt,allowlist:$At,requestIdentity:BAt,senderName:zAt,senderId:FAt,requestTime:qAt,code:HAt};function FY(e){return e.senderName.trim()||e.senderId}function qY(e){if(!e||typeof e!="object")return;const t=e.body;if(!t||typeof t!="object")return;const n=t.code;return typeof n=="string"?n:void 0}function ub(e,t){if(!e||typeof e!="object"||!("status"in e))return t;const n=e.body,s=n&&typeof n=="object"?n.error:void 0;return typeof s=="string"&&s?s:t}function UAt({channelName:e,listRequests:t,approveRequest:n,listApprovals:s,revokeApproval:r,staticAllowedUsers:i=[]}){const{t:o}=nt(),l=h.useId(),c=h.useId(),u=h.useRef(!1),d=h.useRef(e);d.current=e;const[f,m]=h.useState([]),[p,g]=h.useState(!0),[b,w]=h.useState(0),[y,v]=h.useState(),[x,k]=h.useState(),[_,T]=h.useState(),[S,C]=h.useState([]),[N,E]=h.useState(!0),[O,B]=h.useState(0),[D,j]=h.useState(),[L,z]=h.useState(),[I,$]=h.useState(),[K,R]=h.useState();h.useEffect(()=>(u.current=!0,()=>{u.current=!1}),[]),h.useEffect(()=>{let M=!0;return g(!0),m([]),k(void 0),T(void 0),v(void 0),t(e).then(F=>{M&&(m(F.requests),g(!1))},F=>{M&&(k(ub(F,o("channels.editor.pairing.unavailable"))),g(!1))}),()=>{M=!1}},[e,t,b,o]),h.useEffect(()=>{let M=!0;return E(!0),C([]),j(void 0),z(void 0),$(void 0),R(void 0),s(e).then(F=>{M&&(C(F.senderIds),E(!1))},F=>{M&&(j(ub(F,o("channels.editor.pairing.approvals.unavailable"))),E(!1))}),()=>{M=!1}},[O,e,s,o]);const Y=async M=>{if(y)return;const F=e;v(M.code),k(void 0),T(void 0),z(void 0);try{const J=await n(e,M.code);if(!u.current||d.current!==F)return;m(J.requests),T(o("channels.editor.pairing.approved",{sender:FY(J.approved)})),B(V=>V+1)}catch(J){if(!u.current||d.current!==F)return;if(qY(J)==="channel_pairing_request_not_found")try{const V=await t(F);u.current&&d.current===F&&m(V.requests)}catch(V){u.current&&d.current===F&&k(ub(V,o("channels.editor.pairing.unavailable")));return}if(!u.current||d.current!==F)return;k(ub(J,o("channels.editor.pairing.unavailable")))}finally{u.current&&d.current===F&&v(void 0)}},W=async M=>{if(K)return;const F=e;$(void 0),R(M),j(void 0),z(void 0),T(void 0);try{const J=await r(e,M);if(!u.current||d.current!==F)return;C(J.senderIds),z(o("channels.editor.pairing.approvals.revoked",{senderId:M}))}catch(J){if(!u.current||d.current!==F)return;if(qY(J)==="channel_pairing_approval_not_found")try{const V=await s(F);u.current&&d.current===F&&C(V.senderIds);return}catch(V){u.current&&d.current===F&&j(ub(V,o("channels.editor.pairing.approvals.unavailable")));return}if(!u.current||d.current!==F)return;j(ub(J,o("channels.editor.pairing.approvals.unavailable")))}finally{u.current&&d.current===F&&R(void 0)}};return a.jsxs("section",{className:Yr.panel,"aria-labelledby":l,children:[a.jsxs("div",{className:Yr.header,children:[a.jsxs("div",{children:[a.jsx("h4",{id:l,className:Yr.title,children:o("channels.editor.pairing.title")}),a.jsx("p",{className:Yr.description,children:o("channels.editor.pairing.description")})]}),a.jsxs("div",{className:Yr.headerActions,children:[a.jsx(Ni,{variant:"outline",children:f.length}),a.jsx(Kt,{type:"button",size:"icon-sm",variant:"ghost",disabled:p||!!y,"aria-label":o("channels.editor.pairing.refresh"),onClick:()=>{T(void 0),w(M=>M+1)},children:p?a.jsx(Ws,{}):a.jsx(Ug,{})})]})]}),x?a.jsxs(lo,{variant:"destructive",children:[a.jsx(La,{}),a.jsx(ql,{children:o("channels.editor.pairing.error")}),a.jsx(co,{children:x}),a.jsx(Kt,{className:"mt-2 w-fit",type:"button",size:"sm",variant:"outline",disabled:p,onClick:()=>w(M=>M+1),children:o("channels.editor.pairing.retry")})]}):null,_?a.jsxs("div",{role:"status",className:Yr.success,children:[a.jsx(kh,{}),_]}):null,!p&&!x&&f.length===0?a.jsxs("div",{className:Yr.empty,children:[a.jsx(aSe,{"aria-hidden":"true"}),a.jsxs("div",{children:[a.jsx("p",{className:Yr.emptyTitle,children:o("channels.editor.pairing.empty.title")}),a.jsx("p",{className:Yr.emptyDescription,children:o("channels.editor.pairing.empty.description")})]})]}):null,f.length>0?a.jsx("ul",{className:Yr.list,children:f.map(M=>{const F=FY(M);return a.jsxs("li",{className:Yr.request,children:[a.jsxs("div",{className:Yr.requestIdentity,children:[a.jsx("span",{className:Yr.senderName,children:F}),F!==M.senderId?a.jsx("span",{className:Yr.senderId,children:M.senderId}):null,a.jsx("span",{className:Yr.requestTime,children:Zy(new Date(M.createdAt).toISOString(),o)})]}),a.jsx("code",{className:Yr.code,children:M.code}),a.jsxs(Kt,{type:"button",size:"sm",disabled:!!y||!!K,"aria-label":o("channels.editor.pairing.approveFor",{sender:F,code:M.code}),onClick:()=>void Y(M),children:[y===M.code?a.jsx(Ws,{}):null,o("channels.editor.pairing.approve")]})]},M.code)})}):null,a.jsxs("section",{"aria-labelledby":c,children:[a.jsx("div",{className:Yr.divider}),a.jsxs("div",{className:Yr.header,children:[a.jsxs("div",{children:[a.jsx("h4",{id:c,className:Yr.title,children:o("channels.editor.pairing.approvals.title")}),a.jsx("p",{className:Yr.description,children:o("channels.editor.pairing.approvals.description")})]}),a.jsxs("div",{className:Yr.headerActions,children:[a.jsx(Ni,{variant:"outline",children:S.length}),a.jsx(Kt,{type:"button",size:"icon-sm",variant:"ghost",disabled:N||!!K,"aria-label":o("channels.editor.pairing.approvals.refresh"),onClick:()=>{z(void 0),B(M=>M+1)},children:N?a.jsx(Ws,{}):a.jsx(Ug,{})})]})]}),D?a.jsxs(lo,{variant:"destructive",children:[a.jsx(La,{}),a.jsx(ql,{children:o("channels.editor.pairing.approvals.error")}),a.jsx(co,{children:D}),a.jsx(Kt,{className:"mt-2 w-fit",type:"button",size:"sm",variant:"outline",disabled:N,onClick:()=>B(M=>M+1),children:o("channels.editor.pairing.retry")})]}):null,L?a.jsxs("div",{role:"status",className:Yr.success,children:[a.jsx(kh,{}),L]}):null,!N&&!D&&S.length===0?a.jsxs("div",{className:Yr.empty,children:[a.jsx(tq,{"aria-hidden":"true"}),a.jsxs("div",{children:[a.jsx("p",{className:Yr.emptyTitle,children:o("channels.editor.pairing.approvals.empty.title")}),a.jsx("p",{className:Yr.emptyDescription,children:o("channels.editor.pairing.approvals.empty.description")})]})]}):null,S.length>0?a.jsx("ul",{className:Yr.list,children:S.map(M=>a.jsxs("li",{className:Yr.approval,children:[a.jsxs("div",{className:Yr.approvalIdentity,children:[a.jsx(tq,{"aria-hidden":"true"}),a.jsx("code",{className:Yr.approvalSenderId,children:M})]}),a.jsxs(Kt,{type:"button",size:"sm",variant:"destructive",disabled:!!K||!!y,"aria-label":o("channels.editor.pairing.approvals.revokeFor",{senderId:M}),onClick:()=>$(M),children:[K===M?a.jsx(Ws,{}):a.jsx(kf,{}),o("channels.editor.pairing.approvals.revoke")]})]},M))}):null,i.length>0?a.jsxs(lo,{children:[a.jsx(b5,{}),a.jsx(ql,{children:o("channels.editor.pairing.allowlist.title")}),a.jsxs(co,{children:[a.jsx("p",{children:o("channels.editor.pairing.allowlist.description")}),a.jsx("code",{className:Yr.allowlist,children:i.join(", ")})]})]}):null]}),a.jsx(ev,{open:!!I,onOpenChange:M=>{M||$(void 0)},children:a.jsxs(tv,{children:[a.jsxs(nv,{children:[a.jsx(rv,{children:o("channels.editor.pairing.approvals.confirm.title",{senderId:I??""})}),a.jsx(iv,{children:o("channels.editor.pairing.approvals.confirm.description")})]}),a.jsxs(sv,{children:[a.jsx(ov,{type:"button",children:o("channels.editor.cancel")}),a.jsx(tE,{type:"button",variant:"destructive",onClick:()=>{I&&W(I)},children:o("channels.editor.pairing.approvals.confirm.action")})]})]})})]})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function WAt(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 HY(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]=WAt(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 VAt(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 GAt(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&&VAt(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 KAt(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 YAt(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 l=t.secrets[o.key]??{operation:"preserve"};i[o.key]=l.operation==="replace"?{operation:"replace",value:l.value??""}:{operation:l.operation};continue}KAt(r,o,t.values[o.key])}return r.senderPolicy=t.senderPolicy,{expectedRevision:n,config:r,secrets:i}}const XAt={dingtalk:"D",wecom:"W",feishu:"F"},QAt={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 JAt(e){const t=e==null?void 0:e.config.allowedUsers;return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}function tx({id:e,label:t,required:n,hint:s,error:r,children:i}){return a.jsxs("div",{className:Zi.field,children:[a.jsxs("div",{className:Zi.fieldHeader,children:[a.jsxs(Xg,{htmlFor:e,children:[t,n?a.jsx("span",{className:Zi.required,"aria-hidden":"true",children:"*"}):null]}),s?a.jsx("span",{className:Zi.hint,children:s}):null]}),i,r?a.jsx("p",{role:"alert",className:"text-xs text-destructive",children:r}):null]})}function ZAt({open:e,descriptor:t,instance:n,expectedRevision:s,existingNames:r,onOpenChange:i,onSave:o,onReload:l,listPairingRequests:c,approvePairingRequest:u,listPairingApprovals:d,revokePairingApproval:f}){const{t:m}=nt(),p=h.useId(),[g,b]=h.useState(()=>HY(t,n)),[w,y]=h.useState({}),[v,x]=h.useState(),[k,_]=h.useState(!1),[T,S]=h.useState(!1);h.useEffect(()=>{e&&(b(HY(t,n)),y({}),x(void 0))},[t,n,e]);const C=j=>{var z;const L=(z=QAt[t.type])==null?void 0:z[j.key];return L?m(L):j.label},N=(j,L)=>L==="duplicate"?m("channels.editor.validation.duplicate"):L==="invalid"?m("channels.editor.validation.invalidName"):L==="number"?m("channels.editor.validation.number"):L==="policy"?m("channels.editor.validation.policy"):m("channels.editor.validation.required",{label:j?C(j):m("channels.editor.instanceName")}),E=async j=>{j.preventDefault();const L=GAt(t,g,r);if(Object.keys(L).length>0){y(Object.fromEntries(Object.entries(L).map(([z,I])=>[z,N(t.fields.find($=>$.key===z),I)])));return}_(!0),x(void 0);try{await o(g.name.trim(),YAt(t,g,s,n)),i(!1)}catch(z){x(no(z))}finally{_(!1)}},O=async()=>{S(!0);try{await l(),i(!1)}catch(j){x(no(j))}finally{S(!1)}},B=j=>{const L=`${p}-${j.key}`,z=n==null?void 0:n.secrets[j.key],I=g.secrets[j.key]??{operation:"replace",value:""},$=w[j.key],K=I.operation==="replace",R=j.required?["preserve","replace"]:["preserve","replace","clear"];return a.jsxs(tx,{id:L,label:C(j),required:j.required,hint:j.envResolvable?m("channels.editor.environmentReference"):void 0,error:$,children:[z!=null&&z.present?a.jsxs("div",{className:Zi.secretState,children:[a.jsxs("span",{className:Zi.secretStatus,children:[a.jsx(g5,{size:15}),z.source==="environment"?m("channels.editor.secret.environment"):m("channels.editor.secret.stored")]}),a.jsx("div",{className:Zi.secretActions,children:R.map(Y=>a.jsx(Kt,{type:"button",size:"xs",variant:I.operation===Y?"secondary":"ghost","aria-pressed":I.operation===Y,onClick:()=>b(W=>({...W,secrets:{...W.secrets,[j.key]:Y==="replace"?{operation:Y,value:""}:{operation:Y}}})),children:m(`channels.editor.secret.${Y}`)},Y))})]}):null,K?a.jsx(Ur,{id:L,type:"password",autoComplete:"new-password",value:I.value??"","aria-invalid":!!$,"aria-required":j.required,placeholder:m("channels.editor.secret.placeholder",{label:C(j)}),onChange:Y=>b(W=>({...W,secrets:{...W.secrets,[j.key]:{operation:"replace",value:Y.target.value}}}))}):null,I.operation==="clear"?a.jsx("p",{className:Zi.hint,children:m("channels.editor.secret.clearHint")}):null]},j.key)},D=j=>{var K;if(j.kind==="secret")return B(j);const L=`${p}-${j.key}`,z=g.values[j.key],I=w[j.key],$=R=>b(Y=>({...Y,values:{...Y.values,[j.key]:R}}));return j.kind==="boolean"?a.jsx(tx,{id:L,label:C(j),required:j.required,error:I,children:a.jsx(oE,{id:L,checked:z===!0,"aria-required":j.required,onCheckedChange:R=>$(R)})},j.key):j.kind==="enum"?a.jsx(tx,{id:L,label:C(j),required:j.required,error:I,children:a.jsxs(vl,{value:String(z??""),onValueChange:$,children:[a.jsx(xl,{id:L,className:"w-full","aria-required":j.required,children:a.jsx(wl,{})}),a.jsx(kl,{children:(K=j.options)==null?void 0:K.map(R=>a.jsx(Ai,{value:R.value,children:R.label},R.value))})]})},j.key):a.jsx(tx,{id:L,label:C(j),required:j.required,hint:j.envResolvable?m("channels.editor.environmentReference"):void 0,error:I,children:a.jsx(Ur,{id:L,type:j.kind==="number"?"number":"text",value:String(z??""),"aria-invalid":!!I,"aria-required":j.required,onChange:R=>$(R.target.value)})},j.key)};return a.jsx(qp,{open:e,onOpenChange:i,children:a.jsxs(Hp,{className:"max-w-[calc(100%-2rem)] p-5 sm:max-w-xl",children:[a.jsx(Up,{children:a.jsxs("div",{className:Zi.platformHeader,children:[a.jsx("span",{className:Zi.platformMark,"aria-hidden":"true",children:XAt[t.type]??t.displayName[0]}),a.jsxs("div",{children:[a.jsx(Vp,{children:m(n?"channels.editor.editTitle":"channels.editor.addTitle",{platform:t.displayName})}),a.jsx(Yg,{className:"mt-1",children:m(n?"channels.editor.editDescription":"channels.editor.addDescription")})]})]})}),a.jsxs("form",{className:Zi.form,onSubmit:E,children:[a.jsxs("div",{className:Zi.body,children:[v?a.jsxs(lo,{variant:"destructive",children:[a.jsx(JF,{}),a.jsx(ql,{children:m("channels.editor.saveError")}),a.jsx(co,{children:v}),a.jsxs(Kt,{className:"mt-2 w-fit",type:"button",size:"sm",variant:"outline",disabled:T,onClick:()=>void O(),children:[T?a.jsx(Ws,{}):null,m("channels.editor.reloadLatest")]})]}):null,a.jsxs("section",{className:Zi.section,children:[a.jsx("h3",{className:Zi.sectionHeading,children:m("channels.editor.section.identity")}),a.jsx(tx,{id:`${p}-name`,label:m("channels.editor.instanceName"),required:!0,error:w.name,children:a.jsx(Ur,{id:`${p}-name`,value:g.name,disabled:!!n,"aria-invalid":!!w.name,"aria-required":!0,placeholder:m("channels.editor.instanceNamePlaceholder"),onChange:j=>b(L=>({...L,name:j.target.value}))})})]}),a.jsxs("section",{className:Zi.section,children:[a.jsx("h3",{className:Zi.sectionHeading,children:m("channels.editor.section.credentials")}),t.fields.map(D)]}),a.jsxs("section",{className:Zi.section,children:[a.jsx("h3",{className:Zi.sectionHeading,children:m("channels.editor.section.access")}),a.jsx(Tme,{className:Zi.policyGrid,value:g.senderPolicy,"aria-invalid":!!w.senderPolicy,onValueChange:j=>b(L=>({...L,senderPolicy:j==="pairing"||j==="open"?j:""})),children:["pairing","open"].map(j=>a.jsxs(Xg,{className:Zi.policyCard,"data-selected":g.senderPolicy===j,children:[a.jsx(Eme,{value:j}),a.jsxs("span",{className:Zi.policyCopy,children:[a.jsx("span",{className:Zi.policyTitle,children:m(`channels.editor.policy.${j}.title`)}),a.jsx("span",{className:Zi.policyDescription,children:m(`channels.editor.policy.${j}.description`)})]})]},j))}),w.senderPolicy?a.jsx("p",{role:"alert",className:"text-xs text-destructive",children:w.senderPolicy}):null,g.senderPolicy==="pairing"?(n==null?void 0:n.config.senderPolicy)==="pairing"?a.jsx(UAt,{channelName:n.name,listRequests:c,approveRequest:u,listApprovals:d,revokeApproval:f,staticAllowedUsers:JAt(n)}):a.jsxs(lo,{children:[a.jsx(JF,{}),a.jsx(ql,{children:m("channels.editor.pairing.saveFirst.title")}),a.jsx(co,{children:m("channels.editor.pairing.saveFirst.description")})]}):null]})]}),a.jsxs(Wp,{className:"mt-4",children:[a.jsx(Kt,{type:"button",variant:"outline",onClick:()=>i(!1),children:m("channels.editor.cancel")}),a.jsxs(Kt,{type:"submit",disabled:k||T,children:[k?a.jsx(Ws,{}):null,m("channels.editor.save")]})]})]})]})})}const ejt="_page_1flo8_1",tjt="_pageHeader_1flo8_9",njt="_titleGroup_1flo8_18",sjt="_titleCopy_1flo8_25",rjt="_title_1flo8_18",ijt="_summary_1flo8_37",ojt="_section_1flo8_46",ajt="_sectionHeader_1flo8_53",ljt="_sectionTitle_1flo8_60",cjt="_channelGrid_1flo8_65",ujt="_channelCard_1flo8_71",djt="_channelActions_1flo8_98",hjt="_lifecycleActions_1flo8_106",fjt="_startupControl_1flo8_112",mjt="_errorAlert_1flo8_120",pjt="_platformGrid_1flo8_128",gjt="_platformCard_1flo8_134",bjt="_platformMark_1flo8_167",yjt="_platformCopy_1flo8_182",vjt="_platformName_1flo8_186",wjt="_platformHint_1flo8_194",Qi={page:ejt,pageHeader:tjt,titleGroup:njt,titleCopy:sjt,title:rjt,summary:ijt,section:ojt,sectionHeader:ajt,sectionTitle:ljt,channelGrid:cjt,channelCard:ujt,channelActions:djt,lifecycleActions:hjt,startupControl:fjt,errorAlert:mjt,platformGrid:pjt,platformCard:gjt,platformMark:bjt,platformCopy:yjt,platformName:vjt,platformHint:wjt};/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const xjt=new Set(["dingtalk","wecom","feishu"]);function Ime(e){return typeof e=="string"&&xjt.has(e)}function kjt(e){return e.manageable&&Ime(e.type)}const _jt={stopped:"channels.status.stopped",starting:"channels.status.starting",connected:"channels.status.connected",partial:"channels.status.partial",error:"channels.status.error"},Sjt={dingtalk:"D",wecom:"W",feishu:"F"};function Cjt(e){return e==="error"?"destructive":e==="connected"?"secondary":"outline"}function Tjt({onClose:e,initialFocusRef:t}){var F,J;const{t:n}=nt(),s=Co(),r=((F=s.capabilities)==null?void 0:F.features.includes("channel_management"))===!0,{catalog:i,snapshot:o,channels:l,loading:c,error:u,reload:d,createOrUpdate:f,remove:m,setStartup:p,start:g,stop:b,restart:w,pairing:y}=Vwe({autoLoad:r,enabled:r}),v=r&&!!s.token,[x,k]=h.useState(null),[_,T]=h.useState({}),[S,C]=h.useState(),[N,E]=h.useState(),[O,B]=h.useState(),[D,j]=h.useState(!1);h.useEffect(()=>{k(null),T({}),C(void 0),E(void 0),B(void 0),j(!1)},[s.workspaceCwd]);const L=h.useMemo(()=>i.filter(kjt),[i]),z=h.useMemo(()=>Object.values(l).filter(V=>Ime(V.config.type)).sort((V,U)=>V.name.localeCompare(U.name)),[l]),I=((J=s.workspaceCwd)==null?void 0:J.split(/[\\/]+/).filter(Boolean).at(-1))??n("channels.workspace.current"),$=h.useCallback(V=>{var le;const U=String(V.config.type);return((le=i.find(pe=>pe.type===U))==null?void 0:le.displayName)??U},[i]),K=h.useCallback(V=>L.find(U=>U.type===V.config.type),[L]),R=h.useCallback((V,U)=>f(V,U),[f]),Y=h.useCallback(async()=>{if(!(!N||N.workspaceCwd!==s.workspaceCwd||!o||D)){j(!0),B(void 0);try{await m(N.instance.name,{expectedRevision:o.revision}),E(void 0)}catch(V){B(no(V))}finally{j(!1)}}},[N,D,m,o,s.workspaceCwd]),W=h.useCallback(async(V,U,le)=>{if(!(!v||x)){k({name:V.name,action:U}),T(pe=>{const fe={...pe};return delete fe[V.name],fe});try{await le()}catch(pe){T(fe=>({...fe,[V.name]:no(pe)}))}finally{k(null)}}},[x,v]),M=V=>{const U=!v||x!==null;return V.runtime.state==="stopped"?a.jsxs(Kt,{size:"sm",disabled:U,onClick:()=>void W(V,"start",()=>g(V.name)),children:[(x==null?void 0:x.name)===V.name&&x.action==="start"?a.jsx(Ws,{}):null,n("channels.action.start")]}):V.runtime.state==="error"?a.jsxs(Kt,{size:"sm",disabled:U,onClick:()=>void W(V,"restart",()=>w(V.name)),children:[(x==null?void 0:x.name)===V.name&&x.action==="restart"?a.jsx(Ws,{}):null,n("channels.action.retry")]}):a.jsxs(Kt,{size:"sm",variant:"outline",disabled:U,onClick:()=>void W(V,"stop",()=>b(V.name)),children:[(x==null?void 0:x.name)===V.name&&x.action==="stop"?a.jsx(Ws,{}):null,n("channels.action.stop")]})};return a.jsxs("div",{className:Qi.page,children:[a.jsx("header",{className:Qi.pageHeader,children:a.jsxs("div",{className:Qi.titleGroup,children:[a.jsx(Kt,{variant:"ghost",size:"icon",onClick:e,"aria-label":n("channels.action.back"),children:a.jsx(T_,{})}),a.jsxs("div",{className:Qi.titleCopy,children:[a.jsx("h1",{ref:t,tabIndex:-1,className:Qi.title,children:n("channels.title")}),a.jsx("p",{className:Qi.summary,children:n("channels.summary",{workspace:I,count:z.length})})]})]})}),r?null:a.jsxs(lo,{children:[a.jsx(La,{}),a.jsx(ql,{children:n("channels.unsupported.title")}),a.jsx(co,{children:n("channels.unsupported.description")})]}),r&&!s.token?a.jsxs(lo,{children:[a.jsx(La,{}),a.jsx(ql,{children:n("channels.readOnly.title")}),a.jsx(co,{children:n("channels.readOnly.description")})]}):null,c&&z.length===0?a.jsxs("div",{className:"flex min-h-32 items-center justify-center gap-2 text-sm text-muted-foreground",children:[a.jsx(Ws,{}),n("channels.loading")]}):null,u?a.jsxs(lo,{variant:"destructive",children:[a.jsx(La,{}),a.jsx(ql,{children:n("channels.loadError.title")}),a.jsx(co,{children:no(u)}),a.jsx(Kt,{className:"mt-2 w-fit",size:"sm",variant:"outline",onClick:()=>void d(),children:n("channels.action.retry")})]}):null,a.jsxs("section",{className:Qi.section,"aria-labelledby":"configured-channels",children:[a.jsxs("div",{className:Qi.sectionHeader,children:[a.jsx("h2",{id:"configured-channels",className:Qi.sectionTitle,children:n("channels.configured")}),a.jsx(Ni,{variant:"outline",children:z.length})]}),!c&&!u&&z.length===0?a.jsx(md,{className:"border",children:a.jsxs(pd,{children:[a.jsx(gd,{variant:"icon",children:a.jsx(Iee,{})}),a.jsx(bd,{children:n("channels.empty.title")}),a.jsx($v,{children:n("channels.empty.description")})]})}):null,z.length>0?a.jsx("div",{className:Qi.channelGrid,children:z.map(V=>{const U=K(V),le=_[V.name]??V.runtime.lastError;return a.jsxs(Wo,{size:"sm",className:Qi.channelCard,"data-runtime-state":V.runtime.state,children:[a.jsxs(Hl,{children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs(Ul,{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx("span",{className:"truncate",children:V.name}),a.jsx(Ni,{variant:Cjt(V.runtime.state),children:n(_jt[V.runtime.state])})]}),a.jsx(Lu,{children:$(V)})]}),a.jsx(dfe,{children:M(V)})]}),le?a.jsx(dc,{children:a.jsxs(lo,{variant:"destructive",className:Qi.errorAlert,children:[a.jsx(La,{}),a.jsx(ql,{children:n("channels.runtimeError")}),a.jsx(co,{children:le})]})}):null,a.jsxs(r1t,{className:Qi.channelActions,children:[a.jsxs("label",{className:Qi.startupControl,children:[a.jsx(oE,{size:"sm",checked:V.startsWithServe,disabled:!v||x!==null||!o,"aria-label":n("channels.action.startWithServeNamed",{name:V.name}),onCheckedChange:pe=>void W(V,"startup",()=>p(V.name,{expectedRevision:(o==null?void 0:o.revision)??"",enabled:pe}))}),n("channels.startsWithServe")]}),a.jsxs("div",{className:Qi.lifecycleActions,children:[V.runtime.state!=="stopped"&&V.runtime.state!=="error"?a.jsxs(Kt,{size:"sm",variant:"ghost",disabled:!v||x!==null,onClick:()=>void W(V,"restart",()=>w(V.name)),children:[(x==null?void 0:x.name)===V.name&&x.action==="restart"?a.jsx(Ws,{}):a.jsx(I_e,{}),n("channels.action.restart")]}):null,U?a.jsxs(Kt,{size:"sm",variant:"ghost",disabled:!v||x!==null||!o,"aria-label":n("channels.action.editNamed",{name:V.name}),onClick:()=>C({workspaceCwd:s.workspaceCwd,descriptor:U,instance:V}),children:[a.jsx(Ny,{}),n("channels.action.edit")]}):null,a.jsxs(Kt,{size:"sm",variant:"ghost",className:"text-destructive hover:text-destructive",disabled:!v||x!==null||!o,"aria-label":n("channels.action.deleteNamed",{name:V.name}),onClick:()=>{B(void 0),E({workspaceCwd:s.workspaceCwd,instance:V})},children:[a.jsx(kf,{}),n("channels.action.delete")]})]})]})]},V.name)})}):null]}),L.length>0?a.jsxs("section",{className:Qi.section,"aria-labelledby":"channel-platforms",children:[a.jsxs("div",{children:[a.jsx("h2",{id:"channel-platforms",className:Qi.sectionTitle,children:n("channels.availablePlatforms")}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:n("channels.availablePlatforms.description")})]}),a.jsx("div",{className:Qi.platformGrid,children:L.map(V=>a.jsxs("button",{type:"button",className:Qi.platformCard,"data-testid":`channel-platform-${V.type}`,disabled:!v||!o,"aria-label":n("channels.platform.configureNamed",{platform:V.displayName}),onClick:()=>C({workspaceCwd:s.workspaceCwd,descriptor:V}),children:[a.jsx("span",{className:Qi.platformMark,"aria-hidden":"true",children:Sjt[V.type]}),a.jsxs("div",{className:Qi.platformCopy,children:[a.jsx("p",{className:Qi.platformName,children:V.displayName}),a.jsx("p",{className:Qi.platformHint,children:n("channels.platform.configure")})]})]},V.type))})]}):null,S&&S.workspaceCwd===s.workspaceCwd&&o?a.jsx(ZAt,{open:!0,descriptor:S.descriptor,instance:S.instance,expectedRevision:o.revision,existingNames:z.filter(V=>{var U;return V.name!==((U=S.instance)==null?void 0:U.name)}).map(V=>V.name),onOpenChange:V=>{V||C(void 0)},onSave:R,onReload:d,listPairingRequests:y.list,approvePairingRequest:y.approve,listPairingApprovals:y.approvals,revokePairingApproval:y.revoke}):null,a.jsx(ev,{open:!!(N&&N.workspaceCwd===s.workspaceCwd),onOpenChange:V=>{!V&&!D&&(E(void 0),B(void 0))},children:a.jsxs(tv,{children:[a.jsxs(nv,{children:[a.jsx(rv,{children:n("channels.delete.title",{name:(N==null?void 0:N.instance.name)??""})}),a.jsx(iv,{children:n("channels.delete.description")})]}),O?a.jsxs(lo,{variant:"destructive",children:[a.jsx(La,{}),a.jsx(ql,{children:n("channels.delete.error")}),a.jsx(co,{children:O}),a.jsx(Kt,{className:"mt-2 w-fit",size:"sm",variant:"outline",onClick:()=>{d().then(()=>{E(void 0),B(void 0)},V=>{B(no(V))})},children:n("channels.editor.reloadLatest")})]}):null,a.jsxs(sv,{children:[a.jsx(ov,{disabled:D,children:n("channels.editor.cancel")}),a.jsxs(Kt,{variant:"destructive",disabled:D,onClick:()=>void Y(),children:[D?a.jsx(Ws,{}):null,n("channels.action.delete")]})]})]})})]})}const Ejt=new Set(["plugins","extensions","mcp","skills","agents","channels"]);function Ajt(e){return e!==null&&Ejt.has(e)}function jjt(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 UY=new WeakMap;function Njt(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 Mme(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 Ijt(e,t){const n=UY.get(e);if((n==null?void 0:n.css)===t)return n.sheet;const s=Mme(e,t);return s&&UY.set(e,{css:t,sheet:s}),s}function Rme(e,t){const n=Njt(e.ownerDocument),s=[n,t].filter(i=>!!i);try{const i=n?Ijt(e.ownerDocument,n):null,o=t?Mme(e.ownerDocument,t):null,l=[i,o].filter(c=>!!c);if(l.length===s.length&&l.length>0)return e.adoptedStyleSheets=[...e.adoptedStyleSheets,...l],()=>{e.adoptedStyleSheets=e.adoptedStyleSheets.filter(c=>!l.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 Mjt({children:e,enabled:t,language:n,themeClassName:s,styles:r,initialFocusRef:i}){const o=h.useRef(null),[l,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=Rme(u,r);return u.appendChild(d),c(d),()=>{d.remove(),f(),c(null)}},[t,r]),h.useLayoutEffect(()=>{l&&(l.className=s,l.lang=n)},[n,l,s]),h.useLayoutEffect(()=>{var u;l&&((u=i==null?void 0:i.current)==null||u.focus())},[i,l]),t?a.jsx("div",{ref:o,"data-web-shell-shadow-host":"plugins",children:l?kd.createPortal(e,l):null}):e}const Rjt="_section_1ghly_1",Djt="_header_1ghly_12",Ljt="_title_1ghly_19",Pjt="_addButton_1ghly_24",Ojt="_hint_1ghly_38",$jt="_empty_1ghly_39",Bjt="_provider_1ghly_45",zjt="_providerName_1ghly_51",Fjt="_modelRow_1ghly_59",qjt="_modelInfo_1ghly_70",Hjt="_modelName_1ghly_78",Ujt="_modelBaseUrl_1ghly_84",Wjt="_currentBadge_1ghly_91",Vjt="_runtimeBadge_1ghly_99",Gjt="_modelActions_1ghly_107",Kjt="_actionButton_1ghly_114",Yjt="_deleteButton_1ghly_115",Xjt="_confirmButton_1ghly_116",$o={section:Rjt,header:Djt,title:Ljt,addButton:Pjt,hint:Ojt,empty:$jt,provider:Bjt,providerName:zjt,modelRow:Fjt,modelInfo:qjt,modelName:Hjt,modelBaseUrl:Ujt,currentBadge:Wjt,runtimeBadge:Vjt,modelActions:Gjt,actionButton:Kjt,deleteButton:Yjt,confirmButton:Xjt};function O4(e,t){return`${e.authType}:${t.modelId}:${t.baseUrl??""}`}function Qjt(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 O4(r.provider,r.model);const i=n.filter(({model:o})=>o.baseModelId===t);if(i.length===1)return O4(i[0].provider,i[0].model)}const s=n.find(({model:r})=>r.isCurrent);return s?O4(s.provider,s.model):void 0}function Jjt({providers:e,currentModelId:t,loading:n,error:s,busy:r,onSelectModel:i,onDeleteModel:o,onAddModel:l}){const{t:c}=nt(),[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=Qjt(e,t);return a.jsxs("div",{className:$o.section,"data-testid":"model-management",children:[a.jsxs("div",{className:$o.header,children:[a.jsx("span",{className:$o.title,children:c("settings.models.title")}),a.jsx("button",{type:"button",className:$o.addButton,disabled:r,onClick:l,children:c("settings.models.add")})]}),s&&a.jsx("div",{className:$o.hint,children:s.message}),n&&!f&&a.jsx("div",{className:$o.hint,children:c("settings.models.loading")}),!n&&!f&&!s&&a.jsx("div",{className:$o.empty,children:c("settings.models.empty")}),e.map((p,g)=>p.models.length===0?null:a.jsxs("div",{className:$o.provider,children:[a.jsx("div",{className:$o.providerName,children:p.authType}),p.models.map(b=>{const w=O4(p,b),y=w===m,v=u===w,x=b.name||b.baseModelId;return a.jsxs("div",{className:$o.modelRow,children:[a.jsxs("div",{className:$o.modelInfo,children:[a.jsx("span",{className:$o.modelName,children:b.name||b.baseModelId}),y&&a.jsx("span",{className:$o.currentBadge,children:c("settings.models.current")}),b.isRuntime&&a.jsx("span",{className:$o.runtimeBadge,children:c("settings.models.runtime")}),b.baseUrl&&a.jsx("span",{className:$o.modelBaseUrl,children:b.baseUrl})]}),a.jsxs("div",{className:$o.modelActions,children:[!y&&a.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&&(v?a.jsxs(a.Fragment,{children:[a.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")}),a.jsx("button",{type:"button",className:$o.actionButton,disabled:r,"aria-label":`${c("settings.models.cancel")} ${x}`,onClick:()=>d(null),children:c("settings.models.cancel")})]}):a.jsx("button",{type:"button",className:$o.deleteButton,disabled:r,"aria-label":`${c("settings.models.delete")} ${x}`,onClick:()=>d(w),children:c("settings.models.delete")}))]})]},w)})]},`${p.authType}:${g}`))]})}const Zjt=new Set(["fastModel","visionModel","voiceModel","modelFallbacks"]),eNt=new Set(["ui.hideTips","ui.enableUserFeedback","ui.compactMode","ui.compactInline","mcpServers"]);function aE(e,t,n){const s=e(t);return s===t?n:s}function WY(e,t){return aE(t,`settings.category.${e}`,e)}function db(e,t){return aE(t,`settings.label.${e.key}`,e.label)}function tNt(e,t){if(e.description)return aE(t,`settings.description.${e.key}`,e.description)}function Dme(e,t,n,s){return aE(s,`settings.option.${e.key}.${String(t)}`,n)}function nNt(e,t,n){const s=Pme(e,t);if(s==null)return"";if(e.key===vg){const i=gD(s,Fr.Dark);return n(`theme.${i}`)}if(e.key===kT){const i=uD(s);return i?dD(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?Dme(e,i.value,i.label,n):String(s)}const r=String(s);return r.length>24?`${r.slice(0,21)}…`:r}function Lme(e,t){return(t==="user"?e.values.user:e.values.workspace)!==void 0}function sNt(e,t){if(t==="workspace"?e.values.user!==void 0:e.values.workspace!==void 0)return Lme(e,t)?"settings.alsoModifiedIn":"settings.modifiedIn"}function Pme(e,t){const n=t==="user"?e.values.user:e.values.workspace;return n!==void 0?n:e.values.effective}function rNt(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 VY({category:e}){const t=e.toLowerCase(),n=t.includes("ui")?b_e:t.includes("tool")?G7:t.includes("context")?V7:t.includes("privacy")?F_e:t.includes("model")?sy:t.includes("daemon")?ry:t.includes("advanced")?H_e:t.includes("experimental")?Tke:Mee;return a.jsx(n,{"data-icon":"inline-start","aria-hidden":"true"})}function GY({title:e,description:t,metadata:n,control:s}){return a.jsxs(wo,{orientation:"responsive",className:"min-h-20 gap-6 px-5 py-4 max-md:px-4",children:[a.jsxs(ufe,{className:"min-w-0",children:[a.jsxs(qgt,{children:[e,n]}),t&&a.jsx(cd,{className:"max-w-3xl",children:t})]}),a.jsx("div",{className:"flex min-w-0 justify-end max-md:justify-start",children:s})]})}function iNt({name:e,label:t,type:n,value:s,disabled:r,onCommit:i,onInvalid:o}){const l=String(s??""),[c,u]=h.useState(l);h.useEffect(()=>u(l),[l]);const d=()=>{if(n==="number"){const f=c.trim(),m=Number(f);if(!f||!Number.isFinite(m)){u(l),o();return}m!==s&&i(m);return}c!==l&&i(c)};return a.jsx(Ur,{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(l),f.currentTarget.blur())}})}function oNt({settingsState:e,onLanguageChange:t,onSubDialog:n,onThemeChange:s,chatWidthMode:r,onChatWidthModeChange:i,modelManagement:o,embedded:l=!1}){const{language:c,t:u}=nt(),d=im(),{status:f,settings:m,loading:p,error:g,reload:b,setValue:w}=e,[y,v]=h.useState("workspace"),[x,k]=h.useState(""),[_,T]=h.useState(null),[S,C]=h.useState(null),[N,E]=h.useState(!1),O=p&&!f,B=h.useMemo(()=>{const $=m.filter(W=>!eNt.has(W.key)),K=rNt($).map(W=>({id:W.category,label:WY(W.category,u),items:W.items.map(M=>({type:"setting",setting:M}))})),R={type:"local",localKey:"chatWidth"},Y=K.find(W=>W.items.some(M=>M.type==="setting"&&M.setting.key===vg));if(Y){const W=Y.items.findIndex(M=>M.type==="setting"&&M.setting.key===vg);Y.items.splice(W+1,0,R)}else K.push({id:"UI",label:WY("UI",u),items:[R]});return K},[m,u]);h.useEffect(()=>{B.length!==0&&(B.some($=>$.id===x)||k(B[0].id))},[x,B]),h.useEffect(()=>{var $;g?C(g.message):($=f==null?void 0:f.warnings)!=null&&$.length?C(f.warnings.map(K=>u("settings.corrupted",{recovered:K.recovered?"true":"false"})).join("; ")):m.length>0&&C(null)},[g,m,f,u]);const D=h.useCallback(($,K)=>{N||C(null),T($),w(y,$,K).then(async R=>{try{await b()}catch{}R!=null&&R.requiresRestart&&$!==kT&&E(!0)}).catch(R=>{C(R instanceof Error?R.message:String(R))}).finally(()=>T(null))},[b,N,y,w]),j=B.find($=>$.id===x)??B[0],L=j==null?void 0:j.items.some($=>$.type==="setting"&&$.setting.category==="Model"),z=($,K,R,Y,W=!1)=>a.jsxs(vl,{value:$,disabled:W,onValueChange:K,children:[a.jsx(xl,{size:"sm","aria-label":Y,className:"w-[min(160px,50vw)] bg-background max-md:w-full",children:a.jsx(wl,{})}),a.jsx(kl,{position:"popper",align:"end",children:a.jsx(ile,{children:R.map(M=>a.jsx(Ai,{value:M.value,children:M.label},M.value))})})]}),I=$=>{var W;const K=Pme($,y),Y=_===$.key;if($.key===vg)return z(gD(K)??d,M=>{const F=M;s(F),D(vg,Wee(F))},Hee.map(M=>({value:M,label:u(`theme.${M}`)})),db($,u),Y);if($.key===kT)return z(uD(K)??c,M=>t(M,y),LSe.map(M=>({value:M,label:dD(M)})),db($,u),Y);if(Zjt.has($.key))return a.jsx(Kt,{type:"button",variant:"outline",size:"sm",disabled:Y,className:"max-w-[260px] truncate",onClick:()=>n($.key,y),children:nNt($,y,u)||u("settings.action.select")});if($.type==="boolean"){const M=K===!0;return a.jsx(oE,{checked:M,disabled:Y,onCheckedChange:F=>D($.key,F),"aria-label":db($,u)})}if($.type==="enum"&&((W=$.options)!=null&&W.length)){const M=$.options.findIndex(F=>F.value===K);return z(M>=0?String(M):"",F=>{var V;const J=(V=$.options)==null?void 0:V[Number(F)];J&&D($.key,J.value)},$.options.map((F,J)=>({value:String(J),label:Dme($,F.value,F.label,u)})),db($,u),Y)}return a.jsx(iNt,{name:$.key,label:db($,u),type:$.type==="number"?"number":"text",value:K,disabled:Y,onCommit:M=>D($.key,M),onInvalid:()=>C(u("settings.invalidNumber"))})};return a.jsxs("div",{className:l?"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:[!l&&a.jsx("div",{className:"flex items-center justify-between border-b border-border px-5 py-4",children:a.jsxs("div",{children:[a.jsx("h2",{className:"text-base font-semibold text-balance",children:u("settings.title")}),a.jsx("div",{className:"mt-0.5 text-xs text-muted-foreground",children:u("settings.scope.workspace")})]})}),(S||O)&&a.jsxs(lo,{className:"mx-4 mt-3 w-auto",children:[O&&a.jsx(Ws,{}),a.jsx(co,{children:S||u("settings.loading")})]}),a.jsxs(_1,{value:y,className:"flex min-h-0 flex-1 flex-col gap-0",onValueChange:$=>{v($)},children:[a.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-border px-3 py-2",children:[a.jsxs(S1,{className:"p-0",children:[a.jsx(ci,{value:"workspace",children:u("settings.scope.workspace")}),a.jsx(ci,{value:"user",children:u("settings.scope.user")})]}),N&&a.jsx(Ni,{variant:"secondary",children:u("settings.requiresRestart")})]}),a.jsxs(qi,{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:[a.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:B.map($=>a.jsxs(Kt,{type:"button",variant:$.id===x?"secondary":"ghost",size:"sm","aria-current":$.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($.id),children:[a.jsx(VY,{category:$.id}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:$.label}),a.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:$.items.length})]},$.id))}),a.jsxs("section",{className:"min-h-0 min-w-0 overflow-y-auto bg-background p-5 max-md:p-3",children:[!p&&!j&&a.jsx(md,{className:"min-h-60",children:a.jsxs(pd,{children:[a.jsx(gd,{variant:"icon",children:a.jsx(Mee,{})}),a.jsx(bd,{children:u("settings.empty")}),a.jsx($v,{children:u("settings.empty")})]})}),j&&a.jsxs("div",{className:"mx-auto w-full max-w-5xl",children:[a.jsxs(Wo,{children:[a.jsx(Hl,{children:a.jsxs(Ul,{className:"flex items-center gap-2",children:[a.jsx(VY,{category:j.id}),j.label]})}),a.jsx(dc,{className:"-mb-(--card-spacing) p-0",children:a.jsx(by,{className:"gap-0",children:j.items.map(($,K)=>{const R=K>0&&a.jsx(dO,{className:"mx-5 w-auto max-md:mx-4"});if($.type==="local")return a.jsxs("div",{children:[R,a.jsx(GY,{title:u("settings.label.ui.chatWidth"),description:u("settings.description.ui.chatWidth"),control:z(r,V=>i(V),[{value:"1000",label:u("settings.option.ui.chatWidth.1000")},{value:"wide",label:u("settings.option.ui.chatWidth.wide")}],u("settings.label.ui.chatWidth"),!1)})]},$.localKey);const Y=$.setting,W=tNt(Y,u),M=sNt(Y,y),F=Lme(Y,y),J=M?u(M,{scope:u(y==="workspace"?"settings.scope.user":"settings.scope.workspace")}):void 0;return a.jsxs("div",{children:[R,a.jsx(GY,{title:db(Y,u),description:[W,J].filter(Boolean).join(" · ")||void 0,metadata:F?a.jsx(Ni,{variant:"secondary",children:u(y==="workspace"?"settings.scope.workspace":"settings.scope.user")}):void 0,control:_===Y.key?a.jsx(Ws,{}):I(Y)})]},Y.key)})})})]}),L&&o&&a.jsx("div",{className:"mt-4",children:a.jsx(Jjt,{...o})})]})]})]})]}),!l&&a.jsx("div",{className:"border-t border-border px-5 py-3 text-xs text-muted-foreground",children:u("settings.footer")})]})}const aNt="_dialog_1ymqd_1",lNt="_toolbar_1ymqd_12",cNt="_tabs_1ymqd_21",uNt="_tab_1ymqd_21",dNt="_tabActive_1ymqd_39",hNt="_search_1ymqd_48",fNt="_general_1ymqd_60",mNt="_shortcuts_1ymqd_67",pNt="_shortcut_1ymqd_67",gNt="_shortcutKey_1ymqd_87",bNt="_shortcutDesc_1ymqd_95",yNt="_commandList_1ymqd_101",vNt="_commandCard_1ymqd_108",wNt="_commandCardExpanded_1ymqd_115",xNt="_commandRow_1ymqd_119",kNt="_commandName_1ymqd_135",_Nt="_commandTag_1ymqd_142",SNt="_chevron_1ymqd_152",CNt="_chevronExpanded_1ymqd_160",TNt="_commandDetail_1ymqd_164",ENt="_commandDescription_1ymqd_174",ANt="_commandSubcommands_1ymqd_175",jNt="_empty_1ymqd_182",ro={dialog:aNt,toolbar:lNt,tabs:cNt,tab:uNt,tabActive:dNt,search:hNt,general:fNt,shortcuts:mNt,shortcut:pNt,shortcutKey:gNt,shortcutDesc:bNt,commandList:yNt,commandCard:vNt,commandCardExpanded:wNt,commandRow:xNt,commandName:kNt,commandTag:_Nt,chevron:SNt,chevronExpanded:CNt,commandDetail:TNt,commandDescription:ENt,commandSubcommands:ANt,empty:jNt},NNt=[{id:"general",labelKey:"help.tab.general"},{id:"commands",labelKey:"help.tab.commands"},{id:"custom-commands",labelKey:"help.tab.custom"}],INt=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"]),MNt=[["@","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 RNt(e){return[`/${e.name}`,e.argumentHint].filter(Boolean).join(" ")}function DR(e){return!INt.has(e.name)}function DNt(e,t){return DR(e)?t("help.commandMeta.custom"):t("help.commandMeta.builtIn")}function LNt(e,t,n){const s=n.trim().toLowerCase();return e.filter(r=>r.name&&r.description!==void 0).filter(r=>t==="commands"?!DR(r):t==="custom-commands"?DR(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 PNt(){const{t:e}=nt();return a.jsx("div",{className:ro.general,children:a.jsx("div",{className:ro.shortcuts,children:MNt.map(([t,n])=>a.jsxs("div",{className:ro.shortcut,children:[a.jsx("span",{className:ro.shortcutDesc,children:e(n)}),a.jsx("span",{className:ro.shortcutKey,children:t})]},t))})})}function ONt({commands:e,tab:t,query:n}){const{t:s}=nt(),[r,i]=h.useState(null),o=h.useMemo(()=>LNt(e,t,n),[e,n,t]);return o.length===0?a.jsx("div",{className:ro.empty,children:s(t==="custom-commands"?"help.emptyCustom":"help.empty")}):a.jsx("div",{className:ro.commandList,children:o.map(l=>{var u;const c=r===l.name;return a.jsxs("article",{className:`${ro.commandCard} ${c?ro.commandCardExpanded:""}`,children:[a.jsxs("button",{type:"button",className:ro.commandRow,onClick:()=>i(c?null:l.name),"aria-expanded":c,children:[a.jsx("span",{className:ro.commandName,children:RNt(l)}),a.jsx("span",{className:ro.commandTag,children:DNt(l,s)}),a.jsx("svg",{className:`${ro.chevron} ${c?ro.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]}),c&&a.jsxs("div",{className:ro.commandDetail,children:[l.description&&a.jsx("div",{className:ro.commandDescription,children:l.description}),!!((u=l.subcommands)!=null&&u.length)&&a.jsxs("div",{className:ro.commandSubcommands,children:[s("help.subcommands"),": ",l.subcommands.join(", ")]})]})]},l.name)})})}function $Nt({commands:e}){const{t}=nt(),[n,s]=h.useState("general"),{filterValue:r,inputProps:i}=eE(),o=n!=="general";return a.jsxs("div",{className:ro.dialog,children:[a.jsxs("div",{className:ro.toolbar,children:[a.jsx("div",{className:ro.tabs,children:NNt.map(l=>a.jsx("button",{type:"button",className:`${ro.tab} ${l.id===n?ro.tabActive:""}`,onClick:()=>s(l.id),children:t(l.labelKey)},l.id))}),o&&a.jsx("input",{className:ro.search,...i,placeholder:t("help.search")})]}),n==="general"?a.jsx(PNt,{}):a.jsx(ONt,{commands:e,tab:n,query:r})]})}function BNt({currentTheme:e,onSelect:t,onClose:n}){const{t:s}=nt(),r=Hee.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}),l=h.useRef(null),c=d=>{const f=r[d];f&&(t(f.id),n())},{keyboardMode:u}=k0({itemCount:r.length,activeIndex:i,onActiveIndexChange:o,onConfirm:c});return h.useEffect(()=>{var f;const d=(f=l.current)==null?void 0:f.children[i];d==null||d.scrollIntoView({block:"nearest"})},[i]),a.jsx("div",{className:Sn("picker-list","picker-list-compact",u?"picker-keyboard-only":void 0),ref:l,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 a.jsxs("div",{id:`theme-opt-${f}`,role:"option","aria-selected":m,className:Sn("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:[a.jsx("div",{className:Sn("picker-item-row"),children:a.jsx("span",{className:Sn("picker-item-title"),children:d.label})}),a.jsx("div",{className:Sn("picker-item-meta"),children:d.description})]},d.id)})})}const LR="delete-session-list",KY=e=>`${LR}-opt-${e}`;function zNt({onDeleted:e,onError:t,onClose:n,workspaceCwd:s}){const{t:r}=nt(),i=za(),{sessions:o,loading:l,error:c,deleteSession:u,deleteSessions:d}=tS(s,{autoLoad:!0}),f=i.sessionId,[m,p]=h.useState(!1),[g,b]=h.useState(-1),[w,y]=h.useState(new Set),{filterValue:v,inputProps:x}=eE(()=>{b(-1),y(new Set)}),[k,_]=h.useState(null),T=h.useRef(null),S=h.useRef(null);h.useEffect(()=>{c&&_(c.message)},[c]);const C=h.useMemo(()=>v?o.filter(j=>{const L=v.toLowerCase();return(j.displayName||"").toLowerCase().includes(L)||j.sessionId.toLowerCase().includes(L)}):o,[o,v]),N=h.useCallback(j=>{j!==f&&y(L=>{const z=new Set(L);return z.has(j)?z.delete(j):z.add(j),z})},[f]);h.useEffect(()=>{if(w.size===0)return;const j=new Set(C.map(L=>L.sessionId));y(L=>{const z=new Set([...L].filter(I=>j.has(I)));return z.size===L.size?L:z})},[C,w.size]),h.useEffect(()=>{g>=C.length&&C.length>0&&b(C.length-1)},[C.length,g]),h.useEffect(()=>{var L;const j=(L=T.current)==null?void 0:L.children[g];j==null||j.scrollIntoView({block:"nearest"})},[g]),h.useEffect(()=>{var j;(j=S.current)==null||j.focus()},[]);const{keyboardMode:E}=k0({itemCount:C.length,activeIndex:g,onActiveIndexChange:b,onConfirm:j=>{const L=C[j];L&&N(L.sessionId)}}),O=h.useCallback(()=>{if(m)return;if(w.size>0){const L=new Set(C.map(I=>I.sessionId)),z=Array.from(w).filter(I=>L.has(I));if(z.length===0)return;p(!0),d(z).then(I=>{const $=I.removed.length+I.notFound.length,K=I.errors.length;if(K>0&&$>0){t(new Error(r("delete.partialFail",{removed:$,failed:K,detail:I.errors[0].error}))),n();return}if(K>0){_(r("delete.allFailed",{count:K,reason:I.errors[0].error})),p(!1),y(new Set);return}if($===0){_(r("delete.nonRemoved")),p(!1),y(new Set);return}e([...I.removed,...I.notFound]),n()}).catch(I=>{t(I),p(!1)});return}const j=C[g];if(j){if(j.sessionId===f){_(r("delete.cannotCurrent"));return}p(!0),u(j.sessionId).then(L=>{if(!L){_(r("delete.notFound")),p(!1);return}e([j.sessionId]),n()}).catch(L=>{t(L),p(!1)})}},[f,u,d,m,C,n,e,t,g,w,r]),B=w.size>0,D=!m&&!l&&B;return a.jsxs("div",{className:Sn("picker","picker-in-shell"),children:[a.jsxs("div",{className:Sn("picker-search"),children:[a.jsxs("span",{className:Sn("picker-search-label"),children:[r("resume.search"),":"," "]}),a.jsx("input",{ref:S,className:Sn("picker-search-input"),"aria-label":r("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":LR,"aria-activedescendant":g>=0&&g<C.length?KY(g):void 0,...x,placeholder:""}),a.jsx("span",{className:Sn("picker-search-hint"),children:k||(m?r("delete.deleting"):l?r("common.loading"):B?r("delete.selected",{count:w.size}):v?r("delete.matches",{count:C.length}):"")})]}),a.jsx("div",{className:Sn("picker-sep")}),a.jsxs("div",{id:LR,role:"listbox","aria-multiselectable":"true",className:Sn("picker-list",E?"picker-keyboard-only":void 0),ref:T,children:[l&&a.jsx("div",{className:Sn("picker-empty"),children:r("common.loading")}),!l&&c&&a.jsx("div",{className:Sn("picker-empty"),children:c.message}),!l&&!c&&C.length===0&&a.jsx("div",{className:Sn("picker-empty"),children:v?r("delete.noMatch",{query:v}):r("delete.none")}),!l&&C.map((j,L)=>{const z=j.sessionId===f,I=w.has(j.sessionId);return a.jsx(uO,{session:j,optionId:KY(L),active:L===g,ariaSelected:I,current:!1,disabled:z,leading:a.jsx("span",{className:Sn("picker-item-checkbox",I?"picker-item-checkbox-checked":void 0),children:I?"[x] ":"[ ] "}),trailing:z?a.jsx("span",{className:Sn("picker-item-badge"),children:r("resume.current")}):void 0,onClick:()=>{b(L),z||N(j.sessionId)},onActivate:()=>b(L)},j.sessionId)})]}),a.jsx("div",{className:Sn("picker-sep")}),a.jsxs("div",{className:Sn("dialog-footer-actions"),children:[a.jsx("button",{type:"button",className:Sn("dialog-inline-button"),onClick:n,disabled:m,children:r("common.cancel")}),a.jsx("button",{type:"button",className:Sn("dialog-danger-button"),onClick:O,disabled:!D,children:r(m?"delete.deleting":"delete.action")})]})]})}const PR="release-session-list",YY=e=>`${PR}-opt-${e}`;function FNt({onReleased:e,onError:t,onClose:n,workspaceCwd:s}){const{t:r}=nt(),i=za(),{sessions:o,loading:l,error:c,releaseSession:u}=tS(s,{autoLoad:!0}),d=i.sessionId,[f,m]=h.useState(!1),[p,g]=h.useState(-1),[b,w]=h.useState(null),{filterValue:y,inputProps:v}=eE(()=>{g(-1),w(null)}),[x,k]=h.useState(null),_=h.useRef(null),T=h.useRef(null);h.useEffect(()=>{c&&k(c.message)},[c]);const S=y?o.filter(j=>{const L=y.toLowerCase();return(j.displayName||"").toLowerCase().includes(L)||j.sessionId.toLowerCase().includes(L)}):o,C=j=>{const L=S[j];if(!L)return;const z=L.sessionId===d,I=(L.clientCount??0)>0||L.hasActivePrompt===!0;z||!I||(g(j),w(L.sessionId))};h.useEffect(()=>{p>=S.length&&S.length>0&&g(S.length-1)},[S.length,p]),h.useEffect(()=>{var L;const j=(L=_.current)==null?void 0:L.children[p];j==null||j.scrollIntoView({block:"nearest"})},[p]),h.useEffect(()=>{var j;(j=T.current)==null||j.focus()},[]);const{keyboardMode:N}=k0({itemCount:S.length,activeIndex:p,onActiveIndexChange:g,onConfirm:C}),E=h.useCallback(j=>{const L=j??S.find(I=>I.sessionId===b)??void 0;if(!L||f)return;if(!((L.clientCount??0)>0||L.hasActivePrompt===!0)){k(r("release.inactive"));return}if(L.sessionId===d){k(r("release.cannotCurrent"));return}u&&(m(!0),u(L.sessionId).then(()=>{e(L.sessionId),n()}).catch(I=>{t(I),m(!1)}))},[d,f,S,n,t,e,u,b,r]),O=S.find(j=>j.sessionId===b)??void 0,B=O&&((O.clientCount??0)>0||O.hasActivePrompt===!0),D=!f&&!l&&!!O&&O.sessionId!==d&&!!B;return a.jsxs("div",{className:Sn("picker","picker-in-shell"),children:[a.jsxs("div",{className:Sn("picker-search"),children:[a.jsxs("span",{className:Sn("picker-search-label"),children:[r("resume.search"),":"," "]}),a.jsx("input",{ref:T,className:Sn("picker-search-input"),"aria-label":r("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":PR,"aria-activedescendant":p>=0&&p<S.length?YY(p):void 0,...v,placeholder:""}),a.jsx("span",{className:Sn("picker-search-hint"),children:x||(f?r("release.releasing"):l?r("common.loading"):y?r("release.matches",{count:S.length}):"")})]}),a.jsx("div",{className:Sn("picker-sep")}),a.jsxs("div",{id:PR,role:"listbox",className:Sn("picker-list",N?"picker-keyboard-only":void 0),ref:_,children:[l&&a.jsx("div",{className:Sn("picker-empty"),children:r("common.loading")}),!l&&S.length===0&&a.jsx("div",{className:Sn("picker-empty"),children:y?r("release.noMatch",{query:y}):r("release.none")}),!l&&S.map((j,L)=>{const z=j.sessionId===d,I=(j.clientCount??0)>0||j.hasActivePrompt===!0,$=z||!I;return a.jsx(uO,{session:j,optionId:YY(L),active:L===p,confirmed:j.sessionId===b,ariaSelected:j.sessionId===b,current:!1,disabled:$,trailing:z?a.jsx("span",{className:Sn("picker-item-badge"),children:r("resume.current")}):I?void 0:a.jsx("span",{className:Sn("picker-item-badge"),children:r("release.inactiveBadge")}),onClick:()=>C(L),onActivate:()=>g(L)},j.sessionId)})]}),a.jsx("div",{className:Sn("picker-sep")}),a.jsxs("div",{className:Sn("dialog-footer-actions"),children:[a.jsx("button",{type:"button",className:Sn("dialog-inline-button"),onClick:n,disabled:f,children:r("common.cancel")}),a.jsx("button",{type:"button",className:Sn("dialog-danger-button"),onClick:()=>E(),disabled:!D,children:r(f?"release.releasing":"release.action")})]})]})}const qNt="_root_ieg2d_1",HNt="_list_ieg2d_8",UNt="_item_ieg2d_21",WNt="_itemCursor_ieg2d_42",VNt="_itemSelected_ieg2d_49",GNt="_prompt_ieg2d_61",KNt="_keyboardOnly_ieg2d_68",YNt="_itemDisabled_ieg2d_77",XNt="_turn_ieg2d_91",QNt="_time_ieg2d_96",JNt="_footer_ieg2d_102",ZNt="_footerMessage_ieg2d_112",e7t="_dangerButton_ieg2d_118",Ic={root:qNt,list:HNt,item:UNt,itemCursor:WNt,itemSelected:VNt,prompt:GNt,keyboardOnly:KNt,itemDisabled:YNt,turn:XNt,time:QNt,footer:JNt,footerMessage:ZNt,dangerButton:e7t},t7t="rewind-snapshot-list",XY=e=>`${t7t}-opt-${e}`;function n7t(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 s7t(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function r7t({blocks:e,loadSnapshots:t,rewind:n,onError:s,onClose:r}){const{t:i}=nt(),[o,l]=h.useState([]),[c,u]=h.useState(!0),[d,f]=h.useState(null),[m,p]=h.useState(0),[g,b]=h.useState(null),[w,y]=h.useState(null);h.useEffect(()=>{let C=!0;return u(!0),t().then(N=>{C&&l(N.snapshots)}).catch(N=>{C&&s(N)}).finally(()=>{C&&u(!1)}),()=>{C=!1}},[t,s]);const v=h.useMemo(()=>o.map(C=>({snapshot:C,promptText:n7t(e,C.turnIndex)})).sort((C,N)=>C.snapshot.turnIndex-N.snapshot.turnIndex),[e,o]);h.useEffect(()=>{m>=v.length&&v.length>0&&p(v.length-1)},[v.length,m]);const x=h.useRef(null),k=d!==null,_=C=>{!C||d||(f(C),y(null),n(C).then(()=>{r()}).catch(N=>{s(N),y(i("rewind.failed",{reason:N instanceof Error?N.message:String(N)})),f(null)}))},T=C=>{const N=v[C];N&&(p(C),b(N.snapshot.promptId))},{keyboardMode:S}=k0({itemCount:v.length,activeIndex:m,onActiveIndexChange:p,onConfirm:T,enabled:!k});return h.useEffect(()=>{var N;const C=(N=x.current)==null?void 0:N.children[m];C==null||C.scrollIntoView({block:"nearest"})},[m]),h.useEffect(()=>{var N;if(c||v.length===0)return;const C=document.activeElement;(C==null?void 0:C.getAttribute("role"))==="dialog"&&((N=x.current)==null||N.focus())},[c,v.length]),c?a.jsx("div",{className:Sn("picker-empty"),children:i("rewind.loading")}):v.length===0?a.jsx("div",{className:Sn("picker-empty"),children:i("rewind.empty")}):a.jsxs("div",{className:Ic.root,children:[a.jsx("div",{className:`${Ic.list} ${S?Ic.keyboardOnly:""}`,ref:x,role:"listbox","aria-label":i("rewind.title"),tabIndex:0,"aria-activedescendant":v.length>0?XY(m):void 0,children:v.map(({snapshot:C,promptText:N},E)=>{const O=E===m,B=g===C.promptId,D=N||i("rewind.promptFallback",{id:C.promptId.slice(-8)});return a.jsxs("div",{id:XY(E),role:"option","aria-selected":B,"aria-disabled":k||void 0,className:`${Ic.item} ${O?Ic.itemCursor:""} ${B?Ic.itemSelected:""} ${k?Ic.itemDisabled:""}`,onClick:()=>{k||T(E)},onMouseMove:()=>p(E),children:[a.jsxs("div",{className:Ic.prompt,title:D,children:[a.jsxs("span",{className:Ic.turn,children:["#",C.turnIndex+1]})," ",D]}),a.jsx("div",{className:Ic.time,children:s7t(C.timestamp)})]},C.promptId)})}),a.jsxs("div",{className:Ic.footer,children:[w&&a.jsx("span",{className:Ic.footerMessage,role:"alert",children:w}),a.jsx("button",{type:"button",className:Sn("dialog-inline-button"),onClick:r,disabled:d!==null,children:i("common.cancel")}),a.jsx("button",{type:"button",className:`${Sn("dialog-danger-button")} ${Ic.dangerButton}`,onClick:()=>_(g),disabled:!g||d!==null,children:i(d?"rewind.rewinding":"rewind.confirm")})]})]})}const TN="add-workspace-hint",QY="add-workspace-display-name-hint",JY="add-workspace-error",PC="add-workspace-suggestions",i7t=150;function ZY(e){return e.startsWith("/")||/^[A-Za-z]:[\\/]/.test(e)}function o7t({onClose:e,onAdd:t,displayNameEnabled:n=!1,onSuggest:s,onPick:r,persistenceSupported:i=!0}){const{t:o}=nt(),[l,c]=h.useState(""),[u,d]=h.useState(""),[f,m]=h.useState(null),[p,g]=h.useState(!1),[b,w]=h.useState(!0),[y,v]=h.useState([]),[x,k]=h.useState(!1),[_,T]=h.useState(-1),[S,C]=h.useState("/"),[N,E]=h.useState(!1),O=h.useRef(null),B=h.useRef(!1);B.current=x&&y.length>0;const D=h.useRef(0),j=h.useRef(!1);h.useEffect(()=>{var Y;(Y=O.current)==null||Y.focus()},[]);const L=h.useCallback(()=>{k(!1),T(-1)},[]);h.useEffect(()=>{if(!s)return;if(!ZY(l)){v([]),L();return}const Y=++D.current,W=!j.current;j.current=!1;const M=setTimeout(()=>{s(l).then(F=>{Y===D.current&&(v(F.suggestions),C(F.sep||"/"),T(-1),(W||B.current)&&k(F.suggestions.length>0))},()=>{Y===D.current&&(v([]),L())})},i7t);return()=>clearTimeout(M)},[l,s,L]),h.useEffect(()=>{const Y=W=>{W.key!=="Escape"||!B.current||W.isComposing||W.keyCode===229||(W.preventDefault(),L())};return window.addEventListener("keydown",Y,{capture:!0}),()=>window.removeEventListener("keydown",Y,{capture:!0})},[L]);const z=h.useCallback(Y=>{var W;j.current=!1,c(Y.path+S),m(null),L(),(W=O.current)==null||W.focus()},[S,L]),I=h.useCallback(async()=>{if(r){E(!0),m(null);try{const Y=await r();Y&&(++D.current,c(Y),v([]),L())}catch{m(o("sidebar.addWorkspaceBrowseError"))}finally{E(!1)}}},[r,L,o]),$=h.useCallback(Y=>{const W=x&&y.length>0;if(Y.key==="ArrowDown"){if(Y.preventDefault(),!W){y.length>0&&k(!0);return}T(M=>(M+1)%y.length);return}if(Y.key==="ArrowUp"){if(!W)return;Y.preventDefault(),T(M=>(M<=0?y.length:M)-1);return}if(Y.key==="Tab"&&W&&!Y.shiftKey){const M=_>=0?y[_]:y.length===1?y[0]:void 0;M&&(Y.preventDefault(),z(M));return}Y.key==="Enter"&&W&&_>=0&&(Y.preventDefault(),z(y[_]))},[x,y,_,z]),K=h.useCallback(async Y=>{Y.preventDefault();const W=l.trim();if(W){if(!ZY(W)){m(o("sidebar.addWorkspaceAbsError"));return}m(null),g(!0),L();try{const M=i?b:!1,F=n?u.trim():"";F?await t(W,M,F):await t(W,M),e()}catch(M){m(M instanceof Error?M.message:o("sidebar.addWorkspaceError"))}finally{g(!1)}}},[l,u,n,b,i,t,e,L,o]),R=x&&y.length>0;return a.jsx(Fi,{title:o("sidebar.addWorkspaceTitle"),size:"md",onClose:e,children:a.jsxs("form",{className:"flex flex-col gap-6",onSubmit:K,children:[a.jsxs(by,{children:[a.jsxs(wo,{"data-invalid":f?!0:void 0,children:[a.jsx(oa,{htmlFor:"add-workspace-path",children:o("sidebar.addWorkspacePath")}),a.jsxs("div",{className:"relative",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ur,{ref:O,id:"add-workspace-path",type:"text",placeholder:"/absolute/path/to/project",value:l,onChange:Y=>{c(Y.target.value),f&&m(null)},onKeyDown:$,onBlur:()=>{setTimeout(()=>{j.current=!0,L()},100)},disabled:p||N,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1,role:"combobox","aria-expanded":R,"aria-controls":R?PC:void 0,"aria-activedescendant":R&&_>=0?`${PC}-${_}`:void 0,"aria-describedby":f?`${JY} ${TN}`:TN,"aria-invalid":f?!0:void 0}),r&&a.jsxs(Kt,{type:"button",variant:"outline",onMouseDown:Y=>Y.preventDefault(),onClick:()=>void I(),disabled:p||N,children:[a.jsx(Eee,{"aria-hidden":"true"}),o("sidebar.addWorkspaceBrowse")]})]}),R&&a.jsx("ul",{id:PC,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((Y,W)=>a.jsxs("li",{id:`${PC}-${W}`,role:"option","aria-selected":W===_,className:`cursor-pointer truncate px-3 py-1.5 ${W===_?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onMouseDown:M=>{M.preventDefault(),z(Y)},onMouseEnter:()=>T(W),children:[Y.name,a.jsx("span",{className:"text-muted-foreground",children:S})]},Y.path))})]}),a.jsx(cd,{id:TN,children:o("sidebar.addWorkspaceHint")}),f&&a.jsx(Hgt,{id:JY,children:f})]}),n&&a.jsxs(wo,{children:[a.jsx(oa,{htmlFor:"add-workspace-display-name",children:o("sidebar.addWorkspaceDisplayName")}),a.jsx(Ur,{id:"add-workspace-display-name",type:"text",value:u,onChange:Y=>d(Y.target.value),disabled:p,maxLength:256,autoComplete:"off","aria-describedby":QY}),a.jsx(cd,{id:QY,children:o("sidebar.addWorkspaceDisplayNameHint")})]}),i&&a.jsxs(wo,{orientation:"horizontal",children:[a.jsxs(ufe,{children:[a.jsx(oa,{htmlFor:"add-workspace-persist",children:o("sidebar.addWorkspacePersist")}),a.jsx(cd,{children:o("sidebar.addWorkspacePersistHint")})]}),a.jsx(oE,{id:"add-workspace-persist",checked:b,onCheckedChange:w,disabled:p})]})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(Kt,{type:"button",variant:"outline",onClick:e,disabled:p,children:o("sidebar.addWorkspaceCancel")}),a.jsx(Kt,{type:"submit",disabled:p||!l.trim(),children:o(p?"sidebar.addWorkspaceAdding":"sidebar.addWorkspaceRegister")})]})]})})}const Ome="qwen-code-web-shell-collapsed-session-groups",rS="ws:";function eX(e){return!e.startsWith(rS)}function a7t(e,t){return`${rS}${e}|group:${t}`}function $me(e){return`${rS}${e}|ungrouped`}function l7t(e,t){return t.startsWith(`${rS}${e}|`)}function EO(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(Ome);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 c7t(e){try{window.localStorage.setItem(Ome,JSON.stringify(Array.from(e).sort()))}catch{}}function Bme(e,t){const n=EO(),s=new Set(Array.from(n).filter(r=>!t(r)));for(const r of e)s.add(r);c7t(s)}function u7t(e){const t=EO(),n=new Set,s=`${rS}${e}|group:`,r=$me(e);for(const i of t)i===r?n.add("ungrouped"):i.startsWith(s)&&n.add(i.slice(s.length));return n}function d7t(e,t){const n=new Set;for(const s of t)n.add(s==="ungrouped"?$me(e):a7t(e,s));Bme(n,s=>l7t(e,s))}const h7t="_sidebar_cieuv_1",f7t="_resizing_cieuv_20",m7t="_collapsed_cieuv_24",p7t="_newChatButton_cieuv_30",g7t="_pluginButton_cieuv_31",b7t="_footerButton_cieuv_32",y7t="_collapseButton_cieuv_33",v7t="_projectRow_cieuv_34",w7t="_sessionRow_cieuv_35",x7t="_sessionGroupHeader_cieuv_36",k7t="_sessionGroupActionButton_cieuv_37",_7t="_retry_cieuv_38",S7t="_iconButton_cieuv_39",C7t="_projectIconButton_cieuv_40",T7t="_sessionActionButton_cieuv_41",E7t="_groupMenuItem_cieuv_42",A7t="_secondaryButton_cieuv_43",j7t="_dangerButton_cieuv_44",N7t="_primaryNav_cieuv_80",I7t="_navIcon_cieuv_129",M7t="_topRow_cieuv_155",R7t="_brandLogo_cieuv_170",D7t="_brandName_cieuv_186",L7t="_workspacePicker_cieuv_206",P7t="_workspacePickerLabel_cieuv_213",O7t="_workspacePickerHeader_cieuv_220",$7t="_workspaceAddIconButton_cieuv_227",B7t="_workspaceList_cieuv_247",z7t="_workspaceSessionBody_cieuv_253",F7t="_projectsHeader_cieuv_257",q7t="_pinnedSessionList_cieuv_267",H7t="_projectsHeaderToggle_cieuv_275",U7t="_projectsHeaderAction_cieuv_276",W7t="_projectsHeaderActions_cieuv_284",V7t="_projectSearch_cieuv_335",G7t="_addWorkspaceButton_cieuv_357",K7t="_body_cieuv_377",Y7t="_sectionTitle_cieuv_387",X7t="_projectRowExpanded_cieuv_402",Q7t="_workspaceHeaderActions_cieuv_428",J7t="_workspaceHeaderAction_cieuv_428",Z7t="_projectName_cieuv_471",eIt="_sessionText_cieuv_472",tIt="_sessionBadgeIcon_cieuv_479",nIt="_projectHoverAction_cieuv_495",sIt="_sessionList_cieuv_504",rIt="_sessionGroupSection_cieuv_519",iIt="_sessionGroupHeaderRow_cieuv_525",oIt="_sessionGroupDot_cieuv_561",aIt="_sessionGroupDotMuted_cieuv_568",lIt="_sessionGroupTitle_cieuv_572",cIt="_sessionGroupCount_cieuv_579",uIt="_sessionGroupChevron_cieuv_584",dIt="_sessionGroupHeaderActions_cieuv_605",hIt="_sessionGroupList_cieuv_635",fIt="_currentSession_cieuv_653",mIt="_busySession_cieuv_658",pIt="_floatingTooltip_cieuv_663",gIt="_tooltipContent_cieuv_693",bIt="_tooltipTitle_cieuv_699",yIt="_tooltipTags_cieuv_712",vIt="_tooltipTag_cieuv_712",wIt="_tooltipTagRunning_cieuv_732",xIt="_tooltipTagNew_cieuv_737",kIt="_sessionDetailsContent_cieuv_742",_It="_sessionDetailsIdRow_cieuv_749",SIt="_sessionDetailsId_cieuv_749",CIt="_sessionDetailsCopyButton_cieuv_767",TIt="_sessionDetailsCopied_cieuv_792",EIt="_sessionStatusSlot_cieuv_806",AIt="_sessionStatusDot_cieuv_818",jIt="_sidebarPulse_cieuv_1",NIt="_sessionTitlePin_cieuv_828",IIt="_sessionMetaSlot_cieuv_860",MIt="_sessionAttention_cieuv_870",RIt="_sessionAttentionUserInput_cieuv_884",DIt="_sessionLoading_cieuv_889",LIt="_sessionTime_cieuv_899",PIt="_sidebarSpin_cieuv_1",OIt="_runningSession_cieuv_918",$It="_sessionActions_cieuv_934",BIt="_activeSessionActionButton_cieuv_1000",zIt="_searchInput_cieuv_1019",FIt="_renameInput_cieuv_1033",qIt="_dialogSelect_cieuv_1039",HIt="_dialogInput_cieuv_1049",UIt="_groupMenu_cieuv_42",WIt="_groupMenuItemActive_cieuv_1091",VIt="_groupMenuName_cieuv_1097",GIt="_groupMenuDot_cieuv_1105",KIt="_groupMenuEmptyDot_cieuv_1106",YIt="_groupMenuIcon_cieuv_1107",XIt="_groupMenuCheck_cieuv_1135",QIt="_groupMenuSeparator_cieuv_1142",JIt="_groupColorRed_cieuv_1148",ZIt="_groupColorOrange_cieuv_1152",eMt="_groupColorYellow_cieuv_1156",tMt="_groupColorGreen_cieuv_1160",nMt="_groupColorBlue_cieuv_1164",sMt="_groupColorPurple_cieuv_1168",rMt="_groupColorCustom_cieuv_1172",iMt="_renameForm_cieuv_1182",oMt="_notice_cieuv_1198",aMt="_confirmContent_cieuv_1213",lMt="_confirmDescription_cieuv_1219",cMt="_workspaceRemovalActivityList_cieuv_1226",uMt="_confirmActions_cieuv_1234",dMt="_groupForm_cieuv_1240",hMt="_fieldStack_cieuv_1247",fMt="_groupCustomColorRow_cieuv_1275",mMt="_groupColorPicker_cieuv_1282",pMt="_groupHexField_cieuv_1292",gMt="_groupColorError_cieuv_1302",bMt="_footer_cieuv_32",yMt="_footerPrimary_cieuv_1363",vMt="_footerActions_cieuv_1364",wMt="_footerButtonLabel_cieuv_1380",xMt="_footerCompact_cieuv_1387",kMt="_footerTight_cieuv_1388",_Mt="_version_cieuv_1423",SMt="_resizeHandle_cieuv_1466",CMt="_sessionActionButtonActive_cieuv_1494",TMt="_menuActive_cieuv_1500",EMt="_actionMenu_cieuv_1504",AMt="_actionMenuItem_cieuv_1521",jMt="_actionMenuItemDanger_cieuv_1552",NMt="_actionMenuIcon_cieuv_1562",IMt="_actionMenuLabel_cieuv_1581",MMt="_archivedSection_cieuv_1589",RMt="_archivedHeader_cieuv_1596",DMt="_archivedChevron_cieuv_1622",LMt="_archivedTitle_cieuv_1641",PMt="_archivedCount_cieuv_1650",OMt="_archivedList_cieuv_1665",$Mt="_archivedRow_cieuv_1672",BMt="_mobileOpen_cieuv_1681",Oe={sidebar:h7t,resizing:f7t,collapsed:m7t,newChatButton:p7t,pluginButton:g7t,footerButton:b7t,collapseButton:y7t,projectRow:v7t,sessionRow:w7t,sessionGroupHeader:x7t,sessionGroupActionButton:k7t,retry:_7t,iconButton:S7t,projectIconButton:C7t,sessionActionButton:T7t,groupMenuItem:E7t,secondaryButton:A7t,dangerButton:j7t,primaryNav:N7t,navIcon:I7t,topRow:M7t,brandLogo:R7t,brandName:D7t,workspacePicker:L7t,workspacePickerLabel:P7t,workspacePickerHeader:O7t,workspaceAddIconButton:$7t,workspaceList:B7t,workspaceSessionBody:z7t,projectsHeader:F7t,pinnedSessionList:q7t,projectsHeaderToggle:H7t,projectsHeaderAction:U7t,projectsHeaderActions:W7t,projectSearch:V7t,addWorkspaceButton:G7t,body:K7t,sectionTitle:Y7t,projectRowExpanded:X7t,workspaceHeaderActions:Q7t,workspaceHeaderAction:J7t,projectName:Z7t,sessionText:eIt,sessionBadgeIcon:tIt,projectHoverAction:nIt,sessionList:sIt,sessionGroupSection:rIt,sessionGroupHeaderRow:iIt,sessionGroupDot:oIt,sessionGroupDotMuted:aIt,sessionGroupTitle:lIt,sessionGroupCount:cIt,sessionGroupChevron:uIt,sessionGroupHeaderActions:dIt,sessionGroupList:hIt,currentSession:fIt,busySession:mIt,floatingTooltip:pIt,tooltipContent:gIt,tooltipTitle:bIt,tooltipTags:yIt,tooltipTag:vIt,tooltipTagRunning:wIt,tooltipTagNew:xIt,sessionDetailsContent:kIt,sessionDetailsIdRow:_It,sessionDetailsId:SIt,sessionDetailsCopyButton:CIt,sessionDetailsCopied:TIt,sessionStatusSlot:EIt,sessionStatusDot:AIt,sidebarPulse:jIt,sessionTitlePin:NIt,sessionMetaSlot:IIt,sessionAttention:MIt,sessionAttentionUserInput:RIt,sessionLoading:DIt,sessionTime:LIt,sidebarSpin:PIt,runningSession:OIt,sessionActions:$It,activeSessionActionButton:BIt,searchInput:zIt,renameInput:FIt,dialogSelect:qIt,dialogInput:HIt,groupMenu:UIt,groupMenuItemActive:WIt,groupMenuName:VIt,groupMenuDot:GIt,groupMenuEmptyDot:KIt,groupMenuIcon:YIt,groupMenuCheck:XIt,groupMenuSeparator:QIt,groupColorRed:JIt,groupColorOrange:ZIt,groupColorYellow:eMt,groupColorGreen:tMt,groupColorBlue:nMt,groupColorPurple:sMt,groupColorCustom:rMt,renameForm:iMt,notice:oMt,confirmContent:aMt,confirmDescription:lMt,workspaceRemovalActivityList:cMt,confirmActions:uMt,groupForm:dMt,fieldStack:hMt,groupCustomColorRow:fMt,groupColorPicker:mMt,groupHexField:pMt,groupColorError:gMt,footer:bMt,footerPrimary:yMt,footerActions:vMt,footerButtonLabel:wMt,footerCompact:xMt,footerTight:kMt,version:_Mt,resizeHandle:SMt,sessionActionButtonActive:CMt,menuActive:TMt,actionMenu:EMt,actionMenuItem:AMt,actionMenuItemDanger:jMt,actionMenuIcon:NMt,actionMenuLabel:IMt,archivedSection:MMt,archivedHeader:RMt,archivedChevron:DMt,archivedTitle:LMt,archivedCount:PMt,archivedList:OMt,archivedRow:$Mt,mobileOpen:BMt};function OR({label:e,count:t,expanded:n,color:s,children:r,onToggle:i,onRename:o,onDelete:l,renameLabel:c,deleteLabel:u,actionsDisabled:d}){const f=s!=null&&s.startsWith("#")?Oe.groupColorCustom:s?Oe[`groupColor${s[0].toUpperCase()}${s.slice(1)}`]:Oe.sessionGroupDotMuted,m=s!=null&&s.startsWith("#")?{"--session-group-custom-color":s}:void 0;return a.jsxs("section",{className:Oe.sessionGroupSection,"aria-label":e,children:[a.jsxs("div",{className:Oe.sessionGroupHeaderRow,children:[a.jsxs("button",{type:"button",className:Oe.sessionGroupHeader,"aria-expanded":n,onClick:i,children:[a.jsx("span",{className:`${Oe.sessionGroupDot} ${f}`,style:m,"aria-hidden":"true"}),a.jsx("span",{className:Oe.sessionGroupTitle,children:e}),a.jsxs("span",{className:Oe.sessionGroupCount,children:["· ",t]}),a.jsx("span",{className:Oe.sessionGroupChevron,"aria-hidden":"true",children:n?a.jsx(Pc,{}):a.jsx(Eu,{})})]}),(o||l)&&a.jsxs("div",{className:Oe.sessionGroupHeaderActions,children:[o&&a.jsx("button",{className:Oe.sessionGroupActionButton,type:"button",title:c,"aria-label":c,disabled:d,onClick:o,children:a.jsx(Ny,{})}),l&&a.jsx("button",{className:Oe.sessionGroupActionButton,type:"button",title:u,"aria-label":u,disabled:d,onClick:l,children:a.jsx(kf,{})})]})]}),n&&a.jsx("div",{className:Oe.sessionGroupList,children:r})]})}const zMt="_section_kbnw6_1",FMt="_headerRow_kbnw6_6",qMt="_header_kbnw6_6",HMt="_headerDisabled_kbnw6_34",UMt="_headerContent_kbnw6_42",WMt="_chevron_kbnw6_50",VMt="_folderIcon_kbnw6_55",GMt="_chevronOpen_kbnw6_59",KMt="_name_kbnw6_63",YMt="_badge_kbnw6_71",XMt="_gitPill_kbnw6_85",QMt="_sessions_kbnw6_107",JMt="_empty_kbnw6_114",ZMt="_error_kbnw6_120",eRt="_sessionItemReadOnly_kbnw6_126",tRt="_sessionName_kbnw6_137",nRt="_sessionTime_kbnw6_144",ja={section:zMt,headerRow:FMt,header:qMt,headerDisabled:HMt,headerContent:UMt,chevron:WMt,folderIcon:VMt,chevronOpen:GMt,name:KMt,badge:YMt,gitPill:XMt,sessions:QMt,empty:JMt,error:ZMt,sessionItemReadOnly:eRt,sessionName:tRt,sessionTime:nRt};function tX(...e){return e.filter(Boolean).join(" ")}function sRt(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-zA-Z]:[\\/]/.test(e)}function rRt(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function iRt({open:e}){const t=e?Eee:Ck;return a.jsx(t,{className:ja.folderIcon,size:16,strokeWidth:1.2,"aria-hidden":"true"})}function oRt({workspace:e,renderHeader:t,client:n,reloadToken:s,untrustedLabel:r,readOnlyLabel:i,trustToOpenLabel:o,noSessionsLabel:l,loadErrorLabel:c,organizationEnabled:u,sourceMetadataEnabled:d=!1,ungroupedLabel:f,formatTime:m,searchQuery:p="",expanded:g,autoExpandKey:b,onExpandedChange:w,renderSessions:y=!0,renderSession:v,headerActions:x,onRenameGroup:k,onDeleteGroup:_,renameGroupLabel:T,deleteGroupLabel:S,groupActionsDisabled:C,excludePinned:N=!1,onOpenGitDiff:E,onOpenCommit:O}){const[B,D]=h.useState([]),[j,L]=h.useState([]),[z,I]=h.useState(!1),[$,K]=h.useState(!1),[R,Y]=h.useState(()=>u7t(e.id)),[W,M]=h.useState(!1),[F,J]=h.useState(),[V,U]=h.useState(!1),{t:le}=nt(),pe=g??$,fe=!e.primary&&!e.trusted,Q=e.primary&&!e.trusted;h.useEffect(()=>{g===void 0&&K(!1)},[g,e.id]),h.useEffect(()=>{d7t(e.id,R)},[R,e.id]),h.useEffect(()=>{g===void 0&&b&&K(!0)},[b,g]);const ne=h.useCallback(async()=>{if(!Q)try{const se=await n.workspaceByCwd(e.cwd).listWorkspaceSessions({pageSize:nh,archiveState:"active",...d?{sourceType:sh}:{},...u?{view:"organized",group:"all"}:{}});D(se),I(!1)}catch(se){console.warn("[WorkspaceSection] session poll failed:",se),I(!0)}},[n,Q,u,d,e.cwd]);h.useEffect(()=>{if(!y||Q||!u){L([]);return}let se=!1;return n.workspaceByCwd(e.cwd).listSessionGroups().then(ve=>{se||L(ve.groups)}).catch(ve=>{console.warn("[WorkspaceSection] group catalog load failed:",ve)}),()=>{se=!0}},[n,Q,u,s,y,e.cwd]),h.useEffect(()=>{if(!y||!pe&&!p.trim()||(ne(),fe))return;const se=setInterval(()=>void ne(),1e4);return()=>clearInterval(se)},[pe,ne,fe,s,y,p]);const de=sRt(e.cwd)?e.cwd:void 0,ue=!!E,me=h.useRef(!1),te=h.useCallback(async()=>{if(!(!ue||!e.trusted||!de))try{const se=await n.workspaceByCwd(de).workspaceGit({wait:!0});me.current=!1,J(se)}catch(se){me.current||(console.warn("[WorkspaceSection] git status poll failed:",se),me.current=!0)}},[n,de,ue,e.trusted]);h.useEffect(()=>{if(!ue||!e.trusted||!de){J(void 0);return}te();const se=()=>void te();window.addEventListener("focus",se);const ve=window.setInterval(()=>{document.visibilityState==="visible"&&te()},6e4);return()=>{window.removeEventListener("focus",se),window.clearInterval(ve)}},[de,ue,te,s,e.trusted]);const ae=h.useMemo(()=>{const se=p.trim().toLowerCase();return B.filter(ve=>N&&ve.isPinned?!1:se?(ve.displayName||"").toLowerCase().includes(se)||ve.sessionId.toLowerCase().includes(se):!0)},[N,p,B]),be=h.useMemo(()=>{if(!u||j.length===0)return null;const se=new Set;return{sections:j.map(ze=>{const Pe=ae.filter(_t=>_t.groupId===ze.id);return Pe.forEach(_t=>se.add(_t.sessionId)),{group:ze,sessions:Pe}}),ungrouped:ae.filter(ze=>!se.has(ze.sessionId))}},[j,u,ae]);return a.jsxs("div",{className:ja.section,children:[a.jsxs("div",{className:tX(ja.headerRow,Q&&ja.headerDisabled),onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),onFocus:()=>M(!0),onBlur:se=>{se.currentTarget.contains(se.relatedTarget)||M(!1)},children:[a.jsx("button",{className:ja.header,type:"button",disabled:Q,"aria-expanded":pe,onClick:()=>{const se=!pe;K(se),w==null||w(se)},children:t?t(pe):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:tX(ja.chevron,pe&&ja.chevronOpen),children:a.jsx(iRt,{open:pe})}),a.jsx("span",{className:ja.headerContent,children:a.jsx("span",{className:ja.name,children:nE(e)})}),!e.trusted&&a.jsx("span",{className:ja.badge,children:r}),fe&&a.jsx("span",{className:ja.badge,children:i})]})}),E&&e.trusted&&(F==null?void 0:F.branch)&&a.jsx(lO,{open:V,onOpenChange:U,workspaceCwd:e.cwd,onOpenDiff:()=>E(e.cwd),onOpenCommit:O?()=>O(e.cwd):void 0,children:a.jsx("button",{type:"button",className:ja.gitPill,"aria-label":`${le("branchPicker.label")} — ${F.branch}`,children:a.jsx(nfe,{branch:F.branch,status:F,compact:!0})})}),x==null?void 0:x(W)]}),y&&(pe||!!p.trim())&&!Q&&a.jsx("div",{className:ja.sessions,children:z?a.jsx("div",{className:ja.error,role:"status",children:c}):ae.length===0?a.jsx("div",{className:ja.empty,children:l}):be?a.jsxs(a.Fragment,{children:[be.sections.map(({group:se,sessions:ve})=>a.jsx(OR,{id:`group:${se.id}`,label:se.name,count:ve.length,color:se.color,expanded:!R.has(se.id),onToggle:()=>{Y(ze=>{const Pe=new Set(ze);return Pe.has(se.id)?Pe.delete(se.id):Pe.add(se.id),Pe})},onRename:k?()=>k(se,e.cwd):void 0,onDelete:_?()=>_(se,e.cwd):void 0,renameLabel:T,deleteLabel:S,actionsDisabled:C,children:ve.map(ze=>v(ze))},se.id)),be.ungrouped.length>0&&a.jsx(OR,{id:"ungrouped",label:f,count:be.ungrouped.length,expanded:!R.has("ungrouped"),onToggle:()=>{Y(se=>{const ve=new Set(se);return ve.has("ungrouped")?ve.delete("ungrouped"):ve.add("ungrouped"),ve})},children:be.ungrouped.map(se=>v(se))})]}):ae.map(se=>{if(!fe)return v(se);const ve=rRt(se),ze=se.createdAt?m(se.createdAt):"";return a.jsxs("div",{className:ja.sessionItemReadOnly,role:"note","aria-label":`${ve}${ze?`, ${ze}`:""}. ${o}`,children:[a.jsx("span",{className:ja.sessionName,title:ve,children:ve}),ze&&a.jsx("span",{className:ja.sessionTime,children:ze})]},se.sessionId)})})]})}const aRt=8;function nX({session:e,label:t,completedUnread:n,onError:s,getCollisionBoundary:r}){const{t:i}=nt(),[o,l]=h.useState(!1),[c,u]=h.useState(!1),d=h.useRef(0),f=h.useRef(e.sessionId);f.current=e.sessionId;const m=o?r():null;h.useEffect(()=>{u(!1)},[e.sessionId]),h.useEffect(()=>()=>{d.current+=1},[]);const p=h.useCallback(b=>{b||(d.current+=1),u(!1),l(b)},[]),g=h.useCallback(async()=>{var y;const b=e.sessionId,w=++d.current;try{if(typeof navigator>"u"||!((y=navigator.clipboard)!=null&&y.writeText))throw new Error("Clipboard API is unavailable");if(await navigator.clipboard.writeText(b),d.current!==w||f.current!==b)return;u(!0)}catch(v){if(d.current!==w||f.current!==b)return;u(!1),s(v,i("sidebar.copySessionIdFailed"))}},[s,e.sessionId,i]);return a.jsxs(sfe,{open:o,onOpenChange:p,children:[a.jsxs(rfe,{children:[a.jsx(b5,{}),i("sidebar.details")]}),a.jsx(ife,{avoidCollisions:!0,collisionBoundary:m??void 0,collisionPadding:aRt,updatePositionStrategy:"always",className:on(Oe.sessionDetailsContent,"min-w-0 p-3"),children:a.jsxs("div",{className:Oe.tooltipContent,children:[a.jsx("div",{className:Oe.tooltipTitle,title:t,children:t}),a.jsxs("div",{className:Oe.tooltipTags,children:[e.hasActivePrompt&&a.jsx("span",{className:`${Oe.tooltipTag} ${Oe.tooltipTagRunning}`,children:i("sidebar.running")}),n&&a.jsx("span",{className:`${Oe.tooltipTag} ${Oe.tooltipTagNew}`,children:i("sidebar.completedUnread")}),a.jsx("span",{className:Oe.tooltipTag,children:i("sidebar.clients",{count:e.clientCount??0})})]}),a.jsxs("div",{className:Oe.sessionDetailsIdRow,children:[a.jsx("span",{className:Oe.sessionDetailsId,title:e.sessionId,children:e.sessionId}),a.jsx(bi,{className:on(Oe.sessionDetailsCopyButton,"cursor-pointer"),"aria-label":i("sidebar.copySessionId"),title:i("sidebar.copySessionId"),onSelect:b=>{b.preventDefault(),g()},children:c?a.jsx(kh,{"aria-hidden":"true"}):a.jsx(iD,{"aria-hidden":"true"})})]}),a.jsx("span",{className:Oe.sessionDetailsCopied,role:"status","aria-live":"polite",children:c?i("sidebar.sessionIdCopied"):""})]})})]})}function lRt(e){return(e==null?void 0:e.closest("[data-web-shell-root]"))??e}const zme="qwen-code-web-shell-sidebar-width",OC=260,cRt=220,sX=420,uRt=.5,dRt=344,hRt=250,Fme=200,fRt=56,rX=Fme-fRt,mRt=2e3,pRt=3e4,iX=96,gRt="recent",EN=240,hb=8,AN="__custom__",fb="#416ef5";function mb(e,t){return`${t??""}\0${e}`}const bRt=["settings","version","theme","sessionsOverview","splitView","daemonStatus","collapse"],yRt=["newTask","plugins","channels","scheduledTasks","goals"],vRt=["details","rename","group","export","delete","pin","archive"],wRt=["pin","archive"],pb=["red","orange","yellow","green","blue","purple"];function id(...e){return e.filter(Boolean).join(" ")}function oX(e){return e instanceof DOMException&&e.name==="AbortError"}function xRt(e){return e?e.split(/[\\/]+/).filter(Boolean).at(-1)??e:""}function $4(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function kRt(e){const t=$4(e).replace(/\s+/g," ").trim();return t.length<=iX?t:`${t.slice(0,iX-3).trimEnd()}...`}function _Rt(e){if(!e.createdAt)return 0;const t=Date.parse(e.createdAt);return Number.isFinite(t)?t:0}function $C(e){return e[0]??"blue"}function $R(e){const t=e.trim();if(/^#[0-9a-f]{6}$/i.test(t))return t.toLowerCase()}function aX(e,t){const n=e.trim();return t.includes(n)?n:$R(n)}function lX(e){if(e.startsWith("#"))return Oe.groupColorCustom;switch(e){case"red":return Oe.groupColorRed;case"orange":return Oe.groupColorOrange;case"yellow":return Oe.groupColorYellow;case"green":return Oe.groupColorGreen;case"blue":return Oe.groupColorBlue;case"purple":return Oe.groupColorPurple}}function SRt(e){return e.startsWith("#")?{backgroundColor:e}:void 0}function qme(){return typeof window>"u"?sX:Math.max(sX,Math.floor(window.innerWidth*uRt))}function ak(e){return Math.min(qme(),Math.max(cRt,e))}function CRt(e){return Math.min(qme(),Math.max(Fme,e))}function TRt(){if(typeof window>"u")return OC;try{const e=window.localStorage.getItem(zme),t=e?Number(e):OC;return Number.isFinite(t)?ak(t):OC}catch{return OC}}function cX(e){try{window.localStorage.setItem(zme,String(ak(e)))}catch{}}function ERt(){return a.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{d:"M12 5v14M5 12h14"})})}function ARt(){return a.jsx("svg",{viewBox:"0 0 141.38 140","aria-hidden":"true",children:a.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 uX({expanded:e}){return a.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?a.jsx("path",{d:"m6 9 6 6 6-6"}):a.jsx("path",{d:"m9 6 6 6-6 6"})})}function jRt({collapsed:e,onCollapsedChange:t,onOpenSettings:n,onOpenPlugins:s,onOpenChannels:r,onOpenDaemonStatus:i,onOpenScheduledTasks:o,onOpenGoals:l,onOpenSessions:c,canOpenSessionsOverview:u,onOpenSplitView:d,canOpenSplitView:f,onNewSession:m,onLoadSession:p,onSelectCurrentSession:g,onError:b,theme:w,onThemeChange:y,mobileOpen:v,sessionListReloadToken:x,selectedWorkspaceCwd:k,onSelectWorkspace:_,onOpenGitDiff:T,onOpenCommit:S,onOpenAddWorkspace:C,workspaces:N,lockedWorkspaceCwd:E,lockedWorkspace:O,branding:B,primaryNav:D,hideProjectHeader:j,sessionActions:L,footer:z}){var Ha,j0,N0,gm,I1,wa,Hv,I0,cS,Uv,uS,Wv,dS,M0,hS,fS,mS,M1,bm,Vv,R0,ym,Gv,lu;const{t:I}=nt(),$=za(),K=rm(),R=Qo(),Y=Co(),W=h.useMemo(()=>new Set(z===!1?[]:(z==null?void 0:z.items)??bRt),[z]),M=h.useMemo(()=>new Set((D==null?void 0:D.items)??yRt),[D==null?void 0:D.items]),F=h.useMemo(()=>new Set((L==null?void 0:L.items)??vRt),[L==null?void 0:L.items]),J=h.useMemo(()=>new Set((L==null?void 0:L.inlineItems)??wRt),[L==null?void 0:L.inlineItems]),V=B!==!1&&!(v&&((B==null?void 0:B.hideWhenCompact)??!0)),U=!!((j0=(Ha=$.capabilities)==null?void 0:Ha.features)!=null&&j0.includes(oD)),le=!!((gm=(N0=$.capabilities)==null?void 0:N0.features)!=null&&gm.includes("session_source_metadata")),pe=!!((wa=(I1=$.capabilities)==null?void 0:I1.features)!=null&&wa.includes("session_archive")),fe=!!((I0=(Hv=$.capabilities)==null?void 0:Hv.features)!=null&&I0.includes("workspace_qualified_rest_core")),Q=h.useMemo(()=>{var Z;return N??((Z=Y.capabilities)==null?void 0:Z.workspaces)??[]},[N,(cS=Y.capabilities)==null?void 0:cS.workspaces]),ne=Q.length>0||((Uv=Y.capabilities)==null?void 0:Uv.workspaces)!==void 0||((uS=$.capabilities)==null?void 0:uS.workspaces)!==void 0,de=((Wv=Q.find(Z=>Z.primary))==null?void 0:Wv.cwd)??((dS=Y.capabilities)==null?void 0:dS.workspaceCwd)??$.workspaceCwd,ue=E?Q.find(Z=>Z.cwd===E):void 0,me=!E||(ue==null?void 0:ue.primary)===!0,{sessions:te,loading:ae,error:be,data:se,reload:ve,deleteSession:ze,exportSession:Pe,archiveSession:_t}=i4({autoLoad:!0,enabled:me,pageSize:nh,archiveState:"active",...le?{sourceType:sh}:{},...U?{view:"organized",group:"all"}:{}}),Pt=!U||!me||se!==void 0,{sessions:St,reload:he}=i4({autoLoad:U,enabled:U&&me,pageSize:nh,archiveState:"active",...le?{sourceType:sh}:{},view:"organized",group:"pinned"}),[Ae,rt]=h.useState(!1),[dt,jt]=h.useState(!0),[et,Mt]=h.useState([]),{sessions:sn,loading:Ye,error:$n,reload:Te,deleteSession:ie,unarchiveSession:it}=i4({autoLoad:!0,enabled:pe&&Ae&&me,pageSize:nh,archiveState:"archived",...le?{sourceType:sh}:{},...U?{view:"organized",group:"all"}:{}}),[we,We]=h.useState([]),[ce,De]=h.useState(!1),[ct,qe]=h.useState(!1),[Ve,Qt]=h.useState(0),[Un,Ie]=h.useState([]),[wt,Wt]=h.useState([]),[Me,Je]=h.useState([]),[pt,ln]=h.useState(!1),[Bn,ns]=h.useState(null),[lt,Xe]=h.useState(""),[ot,Tt]=h.useState(()=>new Set),fn=h.useRef(new Set),[Qn,Os]=h.useState(()=>new Set),rr=h.useRef(new Set),[Es,cs]=h.useState(!1),$t=h.useRef(!1),[xs,Ce]=h.useState(null),[mn,gt]=h.useState(null),[wn,Wn]=h.useState(null),[di,$s]=h.useState(""),[Gr,Gs]=h.useState("blue"),[Ks,Qr]=h.useState(fb),[Rt,Ii]=h.useState(null),[uo,Or]=h.useState(()=>new Set(Array.from(EO()).filter(eX))),hi=h.useRef(new Set),us=h.useRef(!0),[Jt,Ys]=h.useState(!U),[Bs,ho]=h.useState(U);Bs!==U&&(ho(U),Ys(!U));const[Si,si]=h.useState(TRt),[pr,xe]=h.useState(!1),[Ge,tt]=h.useState(!0),[Zt,Tn]=h.useState(!1),[Gn,Jr]=h.useState(null),[zs,vs]=h.useState(null),[$r,Xs]=h.useState(!1),fs=h.useRef(!1),ks=h.useRef(!1),[gr,Vt]=h.useState(!1),[Sr,ir]=h.useState(0),[Ot,Ns]=h.useState(null),Qs=h.useCallback(()=>{ir(Z=>Z+1)},[]);h.useEffect(()=>(fs.current=!0,()=>{fs.current=!1,ks.current=!0}),[]);const[Cr,$e]=h.useState(""),[ut,Ht]=h.useState(!1),[pn,an]=h.useState(()=>new Set),Be=h.useRef(null),cn=h.useRef(null),Jn=h.useRef(!1),Us=h.useRef(null),dn=h.useRef(null),hn=h.useRef(!1),Tr=h.useRef(null),br=$.sessionId,Lo=!!((hS=(M0=$.capabilities)==null?void 0:M0.features)!=null&&hS.includes("workspace_runtime_removal")),Js=((mS=(fS=$.capabilities)==null?void 0:fS.features)==null?void 0:mS.includes("session_export"))??!1,Er=((bm=(M1=$.capabilities)==null?void 0:M1.features)==null?void 0:bm.includes("workspace_session_export"))??!1,To=((R0=(Vv=$.capabilities)==null?void 0:Vv.features)==null?void 0:R0.includes("workspace_archived_session_export"))??!1,Kr=br?mb(br,$.workspaceCwd||de):null,ga=xRt($.workspaceCwd)||I("sidebar.projectFallback"),ri=h.useMemo(()=>{const Z=Q.length>0?Q:[{id:"primary",cwd:$.workspaceCwd||ga,primary:!0,trusted:!0}];return E?Z.filter(Re=>Re.cwd===E):Z},[$.workspaceCwd,E,ga,Q]),Zr=h.useMemo(()=>{const Z=new Map;for(const Re of[...me?St:[],...et])Z.set(mb(Re.sessionId,Re.workspaceCwd||de),Re);return[...Z.values()]},[me,de,St,et]),_s=h.useCallback(Z=>{const Re=Z.workspaceCwd,Ue=Re||de||"",Qe=Q.find(Ct=>Ct.cwd===Ue);return Re&&!Qe?!ne&&Ue===de?{kind:"primary",cwd:Ue}:{kind:"unknown",cwd:Ue}:Qe&&!Qe.trusted?{kind:"untrusted",cwd:Ue,workspace:Qe}:Qe!=null&&Qe.primary||!Re&&Ue===de?{kind:"primary",cwd:Ue}:Qe?E===Ue?{kind:"locked",cwd:Ue,workspace:Qe}:{kind:"restricted",cwd:Ue,workspace:Qe}:{kind:"unknown",cwd:Ue}},[E,de,ne,Q]),Po=h.useCallback(Z=>_s(Z).cwd,[_s]),Mi=h.useCallback(Z=>Z.kind==="primary"||Z.kind==="locked",[]),Ri=h.useCallback(Z=>Z.kind==="primary"||Z.kind==="locked"&&fe,[fe]),Ql=h.useCallback(Z=>Z.kind==="unknown"||Z.kind==="untrusted"?!1:Z.kind==="primary"||fe,[fe]),kc=h.useCallback(Z=>!Mi(_s(Z)),[Mi,_s]),Fa=h.useCallback(Z=>{const Re=_s(Z);if(Re.kind==="primary")return R;if(Re.kind==="locked"||Re.kind==="restricted")return Y.client.workspaceByCwd(Re.cwd)},[_s,Y.client,R]),Rr=h.useCallback(Z=>mb(Z.sessionId,Po(Z)),[Po]),fo=h.useCallback(Z=>Kr===Rr(Z),[Kr,Rr]),Zo=h.useCallback(Z=>F.has("rename")&&fo(Z)&&Mi(_s(Z)),[fo,Mi,_s,F]),Jl=h.useCallback(Z=>F.has("delete")&&Ri(_s(Z)),[Ri,_s,F]),cl=h.useCallback(Z=>!fo(Z)&&Jl(Z),[Jl,fo]),X=h.useCallback((Z,Re)=>U&&F.has(Re)&&Ql(_s(Z)),[Ql,U,_s,F]),ge=h.useCallback(Z=>_s({sessionId:"",workspaceCwd:Z}),[_s]),Le=h.useCallback(Z=>U&&F.has("group")&&Ql(ge(Z)),[Ql,U,ge,F]),Ze=h.useRef(null);Ze.current={canOrganizeSession:X,getSessionWorkspaceActions:Fa,resolveWorkspaceScope:ge};const Bt=h.useCallback(Z=>{const Re=_s(Z);return Re.kind==="unknown"||Re.kind==="untrusted"?!1:pe&&(Re.kind==="primary"||fe)},[_s,pe,fe]),Et=h.useCallback(Z=>{const Re=_s(Z);if(Re.kind==="primary"&&Js||Re.kind==="locked"&&Er)return Re},[Js,Er,_s]),In=h.useCallback(Z=>{const Re=_s(Z);return To&&Re.kind!=="unknown"&&Re.kind!=="untrusted"?Re.cwd:void 0},[To,_s]),ms=h.useCallback(Z=>F.has("archive")&&!fo(Z)&&Bt(Z),[Bt,fo,F]),as=h.useCallback(Z=>F.has("archive")&&Bt(Z),[Bt,F]);h.useEffect(()=>{if(!U){Mt([]);return}const Z=ri.filter(Ue=>!Ue.primary&&Ue.trusted);let Re=!1;return Promise.allSettled(Z.map(async Ue=>(await Y.client.workspaceByCwd(Ue.cwd).listWorkspaceSessions({pageSize:nh,archiveState:"active",...le?{sourceType:sh}:{},view:"organized",group:"pinned"})).map(Ct=>({...Ct,workspaceCwd:Ue.cwd})))).then(Ue=>{Re||Mt(Ue.flatMap(Qe=>Qe.status==="fulfilled"?Qe.value:[]))}),()=>{Re=!0}},[ri,U,le,Y.client,Sr]);const ps=h.useMemo(()=>{const Z=new Map;for(const Re of[...me?sn:[],...we])Z.set(Rr(Re),Re);return[...Z.values()]},[sn,Rr,me,we]),En=me&&Ye||ce,Ln=me&&!!$n||ct;h.useEffect(()=>{if(!Ae)return;if(!pe||!fe){We([]),De(!1),qe(!1);return}const Z=ri.filter(Ue=>!Ue.primary&&Ue.trusted);if(Z.length===0){We([]),De(!1),qe(!1);return}let Re=!1;return De(!0),Promise.allSettled(Z.map(async Ue=>(await Y.client.workspaceByCwd(Ue.cwd).listWorkspaceSessions({pageSize:nh,archiveState:"archived",...le?{sourceType:sh}:{},...U?{view:"organized",group:"all"}:{}})).map(Ct=>({...Ct,workspaceCwd:Ue.cwd})))).then(Ue=>{if(Re)return;const Qe=Ue.filter(Ct=>Ct.status==="rejected");We(Ue.flatMap(Ct=>Ct.status==="fulfilled"?Ct.value:[])),qe(Qe.length>0);for(const Ct of Qe)console.warn("[WebShellSidebar] archived session load failed:",Ct.reason)}).finally(()=>{Re||De(!1)}),()=>{Re=!0}},[Ae,ri,U,Ve,pe,le,Y.client,fe,Sr]);const gs=((ym=$.capabilities)==null?void 0:ym.qwenCodeVersion)||"",jl=gs?/^\d/.test(gs)?`v${gs}`:gs:"",Zs=!e&&Si<dRt,mo=!e&&Si<hRt,ba={"--web-shell-sidebar-width":`${Si}px`},po=Es;h.useEffect(()=>{var Ue;if(!br)return;const Z=ri.find(Qe=>Qe.cwd===$.workspaceCwd)??(ri.length===1&&((Ue=ri[0])!=null&&Ue.primary)?ri[0]:void 0);if(!Z)return;const Re=`session:${br}:${Z.id}`;dn.current!==Re&&(dn.current=Re,tt(!0),Z.primary?xe(!0):Ns({id:Z.id,key:Re}))},[$.workspaceCwd,br,ri]),h.useEffect(()=>{if(br||k!==void 0||!Y.capabilities)return;const Z=Q.find(Ue=>Ue.cwd===$.workspaceCwd),Re=`new:${(Z==null?void 0:Z.id)??"primary"}`;if(dn.current!==Re){if(dn.current=Re,tt(!0),Z&&!Z.primary){xe(!1),Ns({id:Z.id,key:Re}),_==null||_(Z.cwd);return}xe(!0)}},[$.workspaceCwd,br,_,k,Y.capabilities,Q]);const er=h.useCallback((Z,Re,Ue)=>{const Qe=mb(Z,Ue||de),Ct=new Set(fn.current);Re?Ct.add(Qe):Ct.delete(Qe),fn.current=Ct,Tt(Ct)},[de]),Gi=h.useCallback(async()=>{if(!U){Ie([]),Je([]),Ys(!0);return}try{const Z=await R.listSessionGroups();Ie(Z.groups),Wt(Z.groups),Je(Z.colorOptions),Ys(!0)}catch(Z){b(Z,I("sidebar.groupsLoadFailed"))}},[b,U,I,R]);h.useEffect(()=>{if(!U){Ie([]),Je([]),Ys(!0);return}Ys(!1),Gi()},[U,Gi]),h.useEffect(()=>{if(!mn)return;const Z=Ue=>{var Qe;(Qe=cn.current)!=null&&Qe.contains(Ue.target)||gt(null)},Re=Ue=>{Ue.key==="Escape"&&gt(null)};return document.addEventListener("mousedown",Z),document.addEventListener("keydown",Re),()=>{document.removeEventListener("mousedown",Z),document.removeEventListener("keydown",Re)}},[mn]),h.useEffect(()=>{if(!mn)return;const Z=window.requestAnimationFrame(()=>{var Qe;const Re=Array.from(((Qe=cn.current)==null?void 0:Qe.querySelectorAll("button:not(:disabled)"))??[]),Ue=Re.find(Ct=>Ct.getAttribute("aria-checked")==="true")??Re[0];Ue==null||Ue.focus()});return()=>window.cancelAnimationFrame(Z)},[mn]);const Ar=h.useCallback(Z=>{var zn,qn;const Re=Array.from(((zn=cn.current)==null?void 0:zn.querySelectorAll("button:not(:disabled)"))??[]);if(Re.length===0)return;const Ue=Re.indexOf(document.activeElement),Qe=Ue>=0?Ue:-1;let Ct;if(Z.key==="ArrowDown")Ct=(Qe+1)%Re.length;else if(Z.key==="ArrowUp")Ct=(Qe-1+Re.length)%Re.length;else if(Z.key==="Home")Ct=0;else if(Z.key==="End")Ct=Re.length-1;else if(Z.key==="Escape"){Z.preventDefault(),gt(null);return}Ct!==void 0&&(Z.preventDefault(),(qn=Re[Ct])==null||qn.focus())},[]);h.useEffect(()=>()=>{var Z;(Z=Tr.current)==null||Z.call(Tr,!1)},[]),h.useEffect(()=>{function Z(){si(Re=>ak(Re))}return window.addEventListener("resize",Z),()=>window.removeEventListener("resize",Z)},[]),h.useEffect(()=>{e&&(xe(!1),Tn(!1),$e(""))},[e]);const fi=h.useMemo(()=>te.some(Z=>Z.hasActivePrompt),[te]);h.useEffect(()=>{if(!pr&&!fi)return;const Z=fi&&!be?mRt:pRt,Re=window.setInterval(()=>{document.hidden||hn.current||(hn.current=!0,ve().finally(()=>{hn.current=!1}))},Z);return()=>window.clearInterval(Re)},[be,fi,pr,ve]);const ou=h.useRef(x);h.useEffect(()=>{x!==void 0&&x!==ou.current&&!document.hidden&&!hn.current&&(ou.current=x,hn.current=!0,ve().finally(()=>{hn.current=!1}))},[x,ve]),h.useEffect(()=>{const Z=new Map(te.map(Ue=>[Rr(Ue),!!Ue.hasActivePrompt])),Re=Us.current;Us.current=Z,Re!==null&&an(Ue=>{const Qe=new Set(Ue);let Ct=!1;for(const[zn,qn]of Re){const As=Z.get(zn);qn&&As===!1&&zn!==Kr&&!Qe.has(zn)&&(Qe.add(zn),Ct=!0)}for(const zn of Qe)(zn===Kr||!Z.has(zn)||Z.get(zn))&&(Qe.delete(zn),Ct=!0);return Ct?Qe:Ue})},[Kr,Rr,te]);const Ci=h.useCallback(async Z=>{var Re;if(fs.current){k===Z.cwd&&(_==null||_(void 0)),ir(Ue=>Ue+1);try{await((Re=Y.refreshCapabilities)==null?void 0:Re.call(Y))}catch{}fs.current&&(Jr(null),vs(null),Vt(!1),ve().catch(()=>{}),Te().catch(()=>{}))}},[_,ve,Te,k,Y]),xt=h.useCallback(Z=>{$r||(ks.current=!1,vs(null),Vt(!1),Jr(Z))},[$r]),vn=h.useCallback(async()=>{const Z=Gn;if(!Z||$r)return;const Re=zs!==null;if(!(Re&&$.sessionId&&$.workspaceCwd===Z.cwd)){Xs(!0);try{await R.removeWorkspace(Z.id,{force:Re}),await Ci(Z)}catch(Ue){if(!fs.current)return;if(Ue instanceof Jc){const Qe=Ue.body;if(Ue.status===409&&(Qe==null?void 0:Qe.code)==="workspace_busy"&&Qe.activity){vs(Qe.activity);return}if(Ue.status===400&&(Qe==null?void 0:Qe.code)==="workspace_mismatch"){await Ci(Z);return}if(Ue.status===409&&((Qe==null?void 0:Qe.code)==="workspace_removal_in_progress"||(Qe==null?void 0:Qe.code)==="workspace_registration_in_progress")){Vt(!0);let Ct=Ue,zn=!0;for(let qn=0;qn<20;qn++){if(!fs.current||ks.current||(await new Promise(As=>window.setTimeout(As,250)),!fs.current||ks.current))return;try{await R.removeWorkspace(Z.id,{force:Re}),await Ci(Z);return}catch(As){if(!fs.current)return;if(Ct=As,As instanceof Jc){const ys=As.body;if(As.status===400&&(ys==null?void 0:ys.code)==="workspace_mismatch"){await Ci(Z);return}if(As.status===409&&(ys==null?void 0:ys.code)==="workspace_busy"&&ys.activity){Vt(!1),vs(ys.activity);return}if(As.status===409&&((ys==null?void 0:ys.code)==="workspace_removal_in_progress"||(ys==null?void 0:ys.code)==="workspace_registration_in_progress"))continue}zn=!1;break}}if(!fs.current||ks.current)return;Vt(!1),b(zn?new Error("Workspace removal remained in progress after retries."):Ct,I("sidebar.removeWorkspaceError"));return}}b(Ue,I("sidebar.removeWorkspaceError"))}finally{fs.current&&Xs(!1)}}},[$.sessionId,$.workspaceCwd,b,Ci,I,R,zs,Gn,$r]),Xn=h.useCallback(Z=>{$t.current||($t.current=!0,cs(!0),(async()=>{try{await m(Z)&&(ve().catch(()=>{}),Qs())}catch(Re){oX(Re)||b(Re,I("sidebar.newSessionFailed"))}finally{$t.current=!1,cs(!1)}})())},[Qs,b,m,ve,I]),xn=h.useCallback((Z,Re)=>{const Ue=mb(Z,Re||de);if(Ue===Kr){g==null||g();return}fn.current.has(Ue)||(an(Qe=>{if(!Qe.has(Ue))return Qe;const Ct=new Set(Qe);return Ct.delete(Ue),Ct}),er(Z,!0,Re),(async()=>{try{await p(Z,Re)}catch(Qe){oX(Qe)||b(Qe,I("sidebar.switchFailed"))}finally{er(Z,!1,Re)}})())},[Kr,b,p,g,de,er,I]),Zn=h.useCallback(Z=>{Zo(Z)&&(ns(Rr(Z)),Xe($4(Z)))},[Zo,Rr]),bs=h.useCallback(()=>{ns(null),Xe("")},[]);h.useEffect(()=>{const Z=br?{sessionId:br,workspaceCwd:$.workspaceCwd}:void 0;Bn!==null&&(!Z||Bn!==Kr||!Zo(Z))&&bs()},[Zo,bs,$.workspaceCwd,br,Kr,Bn]);const Is=h.useCallback(()=>{const Z=lt.trim();if(!Z||!br||Bn!==Kr||!Zo({sessionId:br,workspaceCwd:$.workspaceCwd})){bs();return}const Re=br,Ue=Kr;!Ue||fn.current.has(Ue)||(er(Re,!0,$.workspaceCwd),K.renameSession(Z).then(()=>{bs(),ve(),Qs()}).catch(Qe=>{b(Qe,I("sidebar.renameFailed")),bs()}).finally(()=>{er(Re,!1,$.workspaceCwd)}))},[K,Qs,Zo,bs,$.workspaceCwd,Kr,br,lt,Bn,b,ve,er,I]),go=h.useCallback(Z=>{cl(Z)&&Ce(Z)},[cl]),Nl=h.useCallback((Z,Re,Ue)=>{const Qe=mb(Z,Ue||de),Ct=new Set(rr.current);Re?Ct.add(Qe):Ct.delete(Qe),rr.current=Ct,Os(Ct)},[de]),ya=h.useCallback(Z=>{const Re=Z.sessionId,Ue=Rr(Z),Qe=Z.isArchived===!0,Ct=Et(Z);!F.has("export")||(Qe?!In(Z):!Ct)||rr.current.has(Ue)||(Nl(Re,!0,Z.workspaceCwd),(async()=>{try{let zn;if(Qe){const ys=In(Z);if(!ys)return;zn=await Y.client.workspaceByCwd(ys).exportArchivedSession(Re,{format:"html"})}else if((Ct==null?void 0:Ct.kind)==="primary")zn=await Pe(Re,"html");else if((Ct==null?void 0:Ct.kind)==="locked")zn=await Y.client.workspaceByCwd(Ct.cwd).exportSession(Re,{format:"html"});else return;const qn=new Blob([zn.content],{type:zn.mimeType||"text/html"}),As=URL.createObjectURL(qn);try{const ys=document.createElement("a");ys.href=As,ys.download=zn.filename,document.body.appendChild(ys),ys.click(),ys.remove()}finally{URL.revokeObjectURL(As)}}catch(zn){b(zn,I("sidebar.exportFailed"))}finally{Nl(Re,!1,Z.workspaceCwd)}})())},[Pe,Et,In,Rr,b,Nl,F,I,Y.client]),qa=h.useCallback(()=>{if(!xs)return;const Z=xs.sessionId,Re=Rr(xs);if(!cl(xs)){Ce(null);return}const Ue=_s(xs),Qe=!!xs.isArchived,Ct=Ue.kind==="locked"?async zn=>{const As=(await Y.client.workspaceByCwd(Ue.cwd).deleteSessionsData([zn])).errors.find(ys=>ys.sessionId===zn);if(As)throw new Error(As.error)}:Ue.kind==="primary"?Qe?ie:ze:void 0;Ce(null),Ct&&(fn.current.has(Re)||(er(Z,!0,xs.workspaceCwd),Ct(Z).then(()=>{ve(),Te(),Qs()}).catch(zn=>b(zn,I("sidebar.deleteFailed"))).finally(()=>{er(Z,!1,xs.workspaceCwd)})))},[Qs,cl,ie,xs,ze,Rr,b,ve,Te,_s,er,I,Y.client]),au=h.useCallback(Z=>{fo(Z)&&Zn(Z)},[fo,Zn]),iS=h.useCallback(()=>{Le()&&(gt(null),$s(""),Gs($C(Me)),Qr(fb),Wn({mode:"create"}))},[Le,Me]),mm=h.useCallback(Z=>{Le(Z)&&(async()=>{try{const Re=await Y.client.workspaceByCwd(Z).listSessionGroups();gt(null),$s(""),Gs($C(Re.colorOptions)),Qr(fb),Wn({mode:"create",workspaceCwd:Z})}catch(Re){b(Re,I("sidebar.groupsLoadFailed"))}})()},[Le,b,I,Y.client]),oS=h.useCallback(Z=>{X(Z,"group")&&(gt(null),$s(""),Gs($C(Me)),Qr(fb),Wn({mode:"create",targetSession:Z,workspaceCwd:Z.workspaceCwd}))},[X,Me]),Zl=h.useCallback((Z,Re)=>{Le(Re)&&($s(Z.name),Gs(Z.color),Qr($R(Z.color)??fb),Wn({mode:"edit",group:Z,workspaceCwd:Re}))},[Le]),Ph=h.useCallback(()=>{pt||(Wn(null),$s(""),Gs($C(Me)),Qr(fb))},[Me,pt]),Oh=h.useCallback(()=>{if(!wn)return;if(!Le(wn.workspaceCwd)||wn.targetSession&&!X(wn.targetSession,"group")){Ph();return}const Z=di.trim(),Re=aX(Gr,Me.length>0?Me:pb);!Z||!Re||(async()=>{ln(!0);const Ue=Qe=>{Wn(null),$s(""),wn.workspaceCwd?Qs():Gi().catch(()=>{}),b(Qe,I("sidebar.groupAssignFailedAfterCreate"))};try{const Qe=ge(wn.workspaceCwd),Ct=Qe.kind==="primary"?R:Qe.kind==="locked"||Qe.kind==="restricted"?Y.client.workspaceByCwd(Qe.cwd):void 0;if(!Ct)return;const zn=wn.mode==="create"?await Ct.createSessionGroup({name:Z,color:Re}):await Ct.updateSessionGroup(wn.group.id,{name:Z,color:Re});if(wn.mode==="create"&&wn.targetSession)try{const qn=Ze.current,As=qn==null?void 0:qn.resolveWorkspaceScope(wn.targetSession.workspaceCwd);if(!qn||!As||!qn.canOrganizeSession(wn.targetSession,"group")||As.kind!==Qe.kind||As.cwd!==Qe.cwd){Ue(new Error(I("sidebar.groupAssignFailedAfterCreate")));return}const ys=qn.getSessionWorkspaceActions(wn.targetSession);if(!ys){Ue(new Error(I("sidebar.groupAssignFailedAfterCreate")));return}await ys.updateSessionOrganization(wn.targetSession.sessionId,{groupId:zn.id,color:null}),wn.workspaceCwd||ve().catch(()=>{}),Qs()}catch(qn){Ue(qn);return}Wn(null),$s(""),wn.workspaceCwd?Qs():Gi().catch(()=>{})}catch(Qe){b(Qe,wn.mode==="create"?I("sidebar.groupCreateFailed"):I("sidebar.groupUpdateFailed"))}finally{ln(!1)}})()},[Qs,Me,Gr,wn,di,X,Le,Ph,b,ve,Gi,ge,I,R,Y.client]),_0=h.useCallback((Z,Re)=>{Le(Re)&&Ii({group:Z,workspaceCwd:Re})},[Le]),Bv=h.useCallback(()=>{if(!Rt)return;if(!Le(Rt.workspaceCwd)){Ii(null);return}ln(!0);const Z=ge(Rt.workspaceCwd),Re=Z.kind==="primary"?R:Z.kind==="locked"||Z.kind==="restricted"?Y.client.workspaceByCwd(Z.cwd):void 0;if(!Re){ln(!1);return}Re.deleteSessionGroup(Rt.group.id).then(()=>{Ii(null),Rt.workspaceCwd?Qs():ve().catch(()=>{})}).catch(Ue=>b(Ue,I("sidebar.groupDeleteFailed"))).then(()=>Rt.workspaceCwd?void 0:Gi().catch(()=>{})).finally(()=>ln(!1))},[Rt,Le,b,ve,Gi,I,Qs,ge,Y.client,R]);h.useEffect(()=>{xs&&!cl(xs)&&Ce(null)},[cl,xs]),h.useEffect(()=>{mn&&!X(mn.session,"group")&&gt(null)},[X,mn]),h.useEffect(()=>{wn&&(!Le(wn.workspaceCwd)||wn.targetSession&&!X(wn.targetSession,"group"))&&(Wn(null),$s(""))},[X,Le,wn]),h.useEffect(()=>{Rt&&!Le(Rt.workspaceCwd)&&Ii(null)},[Le,Rt]);const C1=h.useCallback(Z=>{const Re=Z.sessionId,Ue=Rr(Z);if(!X(Z,"pin")||fn.current.has(Ue))return;er(Re,!0,Z.workspaceCwd);const Qe=Fa(Z);if(!Qe){er(Re,!1,Z.workspaceCwd);return}Qe.updateSessionOrganization(Re,{isPinned:!Z.isPinned}).then(()=>{ve().catch(()=>{}),he().catch(()=>{}),Qs()}).catch(Ct=>b(Ct,I("sidebar.organizationFailed"))).finally(()=>{er(Re,!1,Z.workspaceCwd)})},[Qs,Rr,Fa,b,X,ve,he,er,I]),S0=h.useCallback(Z=>{const Re=Z.sessionId,Ue=Rr(Z);ms(Z)&&(fn.current.has(Ue)||(er(Re,!0,Z.workspaceCwd),(async()=>{try{const Qe=_s(Z);if(Qe.kind==="locked"||Qe.kind==="restricted"){const zn=(await Y.client.workspaceByCwd(Qe.cwd).archiveSessionsData([Re])).errors.find(qn=>qn.sessionId===Re);zn&&b(new Error(zn.error),I("sidebar.archiveFailed"))}else if(Qe.kind==="primary")await _t(Re);else return}catch(Qe){b(Qe,I("sidebar.archiveFailed"))}finally{ve().catch(()=>{}),Te().catch(()=>{}),Qs(),er(Re,!1,Z.workspaceCwd)}})()))},[_t,Qs,ms,Rr,b,ve,Te,er,I,_s,Y.client]),$h=h.useCallback(Z=>{const Re=Z.sessionId,Ue=Rr(Z);as(Z)&&(fn.current.has(Ue)||(er(Re,!0,Z.workspaceCwd),(async()=>{try{const Qe=_s(Z);if(Qe.kind==="locked"||Qe.kind==="restricted"){const zn=(await Y.client.workspaceByCwd(Qe.cwd).unarchiveSessionsData([Re])).errors.find(qn=>qn.sessionId===Re);zn&&b(new Error(zn.error),I("sidebar.unarchiveFailed"))}else if(Qe.kind==="primary")await it(Re);else return}catch(Qe){b(Qe,I("sidebar.unarchiveFailed"))}finally{ve().catch(()=>{}),Te().catch(()=>{}),Qs(),er(Re,!1,Z.workspaceCwd)}})()))},[Qs,as,Rr,b,ve,Te,er,I,it,_s,Y.client]),zv=h.useCallback(async(Z,Re)=>{if(!X(Re,"group"))return;let Ue=0;try{const _c=Fa(Re);if(!_c)return;const ul=await _c.listSessionGroups();if(!X(Re,"group"))return;Wt(ul.groups),Je(ul.colorOptions),Ue=ul.groups.length}catch(_c){b(_c,I("sidebar.groupsLoadFailed"));return}if(!Z.isConnected)return;const Qe=Z.getBoundingClientRect(),Ct=typeof window>"u"?Qe.right+EN:window.innerWidth,zn=typeof window>"u"?Qe.top+320:window.innerHeight,qn=Math.min(320,34*(Ue+pb.length+2)+25),As=Qe.right+hb+EN<=Ct?Qe.right+hb:Math.max(hb,Qe.left-EN-hb),ys=Math.max(hb,Math.min(Qe.top,zn-qn-hb));gt({session:Re,top:ys,left:As})},[X,Fa,b,I]),Fv=h.useCallback((Z,Re)=>{const Ue=Z.sessionId,Qe=Rr(Z);if(!X(Z,"group")||fn.current.has(Qe))return;gt(null),er(Ue,!0,Z.workspaceCwd);const Ct=Fa(Z);if(!Ct){er(Ue,!1,Z.workspaceCwd);return}Ct.updateSessionOrganization(Ue,{groupId:Re,color:null}).then(()=>{ve().catch(()=>{}),Qs()}).catch(zn=>b(zn,I("sidebar.organizationFailed"))).finally(()=>{er(Ue,!1,Z.workspaceCwd)})},[Qs,Rr,Fa,b,X,ve,er,I]),aS=h.useCallback((Z,Re)=>{const Ue=Z.sessionId,Qe=Rr(Z);if(!X(Z,"group")||fn.current.has(Qe))return;gt(null),er(Ue,!0,Z.workspaceCwd);const Ct=Fa(Z);if(!Ct){er(Ue,!1,Z.workspaceCwd);return}Ct.updateSessionOrganization(Ue,{color:Re,groupId:null}).then(()=>{ve().catch(()=>{}),Qs()}).catch(zn=>b(zn,I("sidebar.organizationFailed"))).finally(()=>{er(Ue,!1,Z.workspaceCwd)})},[Qs,Rr,Fa,b,X,ve,er,I]),Bh=h.useMemo(()=>{const Z=Cr.trim().toLowerCase(),Re=te.filter(Ct=>!Ct.isPinned),Ue=Z?Re.filter(Ct=>$4(Ct).toLowerCase().includes(Z)||Ct.sessionId.toLowerCase().includes(Z)):Re.slice();if(U)return Ue;const Qe=new Map(Ue.map(Ct=>[Ct.sessionId,_Rt(Ct)]));return Ue.sort((Ct,zn)=>(Qe.get(zn.sessionId)??0)-(Qe.get(Ct.sessionId)??0))},[U,Cr,te]),zh=h.useMemo(()=>{if(!U)return[];const Z=Cr.trim().length>0,Re=new Set(Un.map(qn=>qn.id)),Ue=new Map,Qe=new Map;for(const qn of Un)Qe.set(qn.id,[]);const Ct=[];for(const qn of Bh){if(qn.color&&pb.includes(qn.color)){const ys=Ue.get(qn.color)??[];ys.push(qn),Ue.set(qn.color,ys);continue}const As=qn.groupId&&Re.has(qn.groupId)?Qe.get(qn.groupId):void 0;As?As.push(qn):Ct.push(qn)}const zn=[];for(const qn of pb){const As=Ue.get(qn);!As||As.length===0||zn.push({id:`color:${qn}`,kind:"color",label:I(`sidebar.groupColor.${qn}`),countLabel:String(As.length),color:qn,sessions:As})}for(const qn of Un){const As=Qe.get(qn.id)??[];Z&&As.length===0||zn.push({id:`group:${qn.id}`,kind:"group",label:qn.name,countLabel:String(As.length),color:qn.color,group:qn,sessions:As})}return Ct.length>0&&zn.length>0&&zn.push({id:gRt,kind:"recent",label:I("sidebar.groupUngrouped"),countLabel:String(Ct.length),sessions:Ct}),zn},[Bh,Un,U,Cr,I]);h.useEffect(()=>{if(!U||!Jt||!Pt)return;const Z=zh.map(Ue=>Ue.id).filter(Ue=>!hi.current.has(Ue));if(us.current){us.current=!1;for(const Ue of Z)hi.current.add(Ue);return}if(Z.length!==0){for(const Ue of Z)hi.current.add(Ue);Or(Ue=>{const Qe=new Set(Ue);for(const Ct of Z)Qe.add(Ct);return Qe})}},[Jt,U,zh,Pt]),h.useEffect(()=>{Bme(uo,eX)},[uo]);const T1=h.useCallback(Z=>{Or(Re=>{const Ue=new Set(Re);return Ue.has(Z)?Ue.delete(Z):Ue.add(Z),Ue})},[]),va=h.useCallback(()=>lRt(Be.current),[]),lE=h.useCallback(Z=>{var Sc;if(e)return;Z.preventDefault(),(Sc=Tr.current)==null||Sc.call(Tr,!0),Ht(!0);const Re=Z.clientX,Ue=Si,Qe=document.body.style.cursor,Ct=document.body.style.userSelect;let zn=!1,qn=()=>{};document.body.style.cursor="col-resize",document.body.style.userSelect="none";try{Z.currentTarget.setPointerCapture(Z.pointerId)}catch{}function As(xa){return Ue+xa-Re}function ys(){const xa=ak(Ue);si(xa),cX(xa)}function _c(){zn||(zn=!0,ys(),qn(!0),t(!0))}function ul(xa){const Xu=As(xa.clientX);if(Xu<=rX){_c();return}si(CRt(Xu))}qn=function(Xu){document.body.style.cursor=Qe,document.body.style.userSelect=Ct,window.removeEventListener("pointermove",ul),window.removeEventListener("pointerup",ii),window.removeEventListener("pointercancel",R1),Tr.current=null,Xu&&Ht(!1)};function ii(xa){const Xu=As(xa.clientX);if(Xu<=rX){_c();return}const Nd=ak(Xu);si(Nd),cX(Nd),qn(!0)}function R1(){qn(!0)}Tr.current=qn,window.addEventListener("pointermove",ul),window.addEventListener("pointerup",ii,{once:!0}),window.addEventListener("pointercancel",R1,{once:!0})},[e,t,Si]),C0=xs?kRt(xs):"",E1=mn!=null&&mn.session.color&&pb.includes(mn.session.color)?mn.session.color:null,A1=!E1&&(mn!=null&&mn.session.groupId)&&wt.some(Z=>Z.id===mn.session.groupId)?mn.session.groupId:null,T0=Me.length>0?Me:pb,j1=A1===null&&E1===null,pm=(Rt==null?void 0:Rt.group.name)??"",N1=Me.length>0?Me:["blue"],qv=aX(Gr,N1),E0=!N1.includes(Gr),lS=di.trim().length>0&&qv!==void 0&&!pt,A0=(wn==null?void 0:wn.mode)==="create"?I("sidebar.groupCreate"):I("sidebar.groupRename"),Yu=h.useCallback((Z,Re={})=>{const{isArchived:Ue=!1}=Re,Qe=Re.readOnly??kc(Z),Ct=Rr(Z),zn=$4(Z),qn=Z.updatedAt||Z.createdAt,As=qn?Zy(qn,I):"",ys=ot.has(Ct),_c=Qn.has(Ct),ul=!fo(Z)&&pn.has(Ct);if(Ue){const ei=In(Z),ea=F.has("details"),Yv=F.has("export")&&!!ei,cu=as(Z),pS=cl(Z),L1=ea||Yv||cu||pS;return a.jsxs("div",{className:id(Oe.sessionRow,Oe.archivedRow,ys&&Oe.busySession),children:[a.jsx("span",{className:Oe.sessionText,title:zn,children:zn}),a.jsxs("div",{className:Oe.sessionMetaSlot,children:[a.jsx("span",{className:Oe.sessionTime,children:As}),L1&&a.jsx("div",{className:Oe.sessionActions,onClick:uu=>uu.stopPropagation(),onKeyDown:uu=>uu.stopPropagation(),children:a.jsxs(Mu,{children:[a.jsx(Ru,{asChild:!0,children:a.jsx("button",{className:Oe.sessionActionButton,type:"button","aria-label":I("sidebar.moreActions"),title:I("sidebar.moreActions"),children:a.jsx(sp,{})})}),a.jsx(Du,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{Jn.current=!0},onCloseAutoFocus:uu=>{Jn.current&&(Jn.current=!1,uu.preventDefault())},children:a.jsxs(Tp,{children:[ea&&a.jsx(nX,{session:Z,label:zn,completedUnread:ul,onError:b,getCollisionBoundary:va}),Yv&&a.jsxs(bi,{disabled:_c,onSelect:()=>ya(Z),children:[a.jsx(Hx,{}),I("sidebar.export")]}),cu&&a.jsxs(bi,{onSelect:()=>$h(Z),children:[a.jsx(gxe,{}),I("sidebar.unarchive")]}),pS&&a.jsxs(bi,{variant:"destructive",onSelect:()=>go(Z),children:[a.jsx(kf,{}),I("sidebar.delete")]})]})})]})})]})]},Ct)}const ii=fo(Z),R1=ii&&Bn===Ct,Sc=!Z.isWaitingForPermission&&Z.isWaitingForUserQuestion,xa=Z.isWaitingForPermission?I("sidebar.waitingForApproval"):Sc?I("sidebar.userInputNeeded"):null,Xu=!kc(Z),Nd=X(Z,"pin"),D0=F.has("archive")&&Bt(Z),L0=F.has("rename")&&Xu,mi=Et(Z),D1=F.has("export")&&!!mi,Kv=Jl(Z);return a.jsx("div",{className:id(Oe.sessionRow,ii&&Oe.currentSession,Z.isPinned&&Oe.pinnedSession,Z.hasActivePrompt&&Oe.runningSession,ys&&Oe.busySession),role:"button",tabIndex:0,"aria-current":ii?"page":void 0,onClick:()=>xn(Z.sessionId,Z.workspaceCwd),onDoubleClick:()=>{!e&&Zo(Z)&&Zn(Z)},onKeyDown:ei=>{ei.key==="Enter"&&xn(Z.sessionId,Z.workspaceCwd)},children:!e&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Oe.sessionStatusSlot,children:ul?a.jsx("span",{className:Oe.sessionStatusDot,"aria-hidden":"true"}):null}),R1&&Zo(Z)?a.jsx("form",{className:Oe.renameForm,onClick:ei=>ei.stopPropagation(),onSubmit:ei=>{ei.preventDefault(),Is()},children:a.jsx("input",{autoFocus:!0,className:Oe.renameInput,value:lt,onChange:ei=>Xe(ei.target.value),onBlur:bs,onKeyDown:ei=>{ei.key==="Escape"&&(ei.preventDefault(),bs())}})}):a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:Oe.sessionText,title:zn,children:[Z.worktree&&a.jsx(wT,{size:11,strokeWidth:1.5,className:Oe.sessionBadgeIcon,"aria-label":I("sidebar.newWorktreeTask")}),Z.branch&&a.jsx(jy,{size:11,strokeWidth:1.5,className:Oe.sessionBadgeIcon,"aria-label":Z.branch.name}),zn]}),a.jsxs("div",{className:Oe.sessionMetaSlot,children:[xa&&a.jsx("span",{className:id(Oe.sessionAttention,Sc&&Oe.sessionAttentionUserInput),"aria-label":xa,children:xa}),Z.hasActivePrompt?a.jsx("span",{className:Oe.sessionLoading,"aria-label":I("sidebar.running")}):xa?null:a.jsx("span",{className:Oe.sessionTime,children:As}),Qe&&D0&&a.jsx("div",{className:Oe.sessionActions,onClick:ei=>ei.stopPropagation(),onKeyDown:ei=>ei.stopPropagation(),children:J.has("archive")?a.jsx("button",{className:Oe.sessionActionButton,type:"button",disabled:ys||ii,"aria-label":I("sidebar.archive"),title:I(ii?"sidebar.archiveCurrentDisabled":"sidebar.archive"),onClick:()=>S0(Z),children:a.jsx(v2,{})}):a.jsxs(Mu,{children:[a.jsx(Ru,{asChild:!0,children:a.jsx("button",{className:Oe.sessionActionButton,type:"button","aria-label":I("sidebar.moreActions"),title:I("sidebar.moreActions"),children:a.jsx(sp,{})})}),a.jsx(Du,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{Jn.current=!0},onCloseAutoFocus:ei=>{Jn.current&&(Jn.current=!1,ei.preventDefault())},children:a.jsx(Tp,{children:a.jsxs(bi,{disabled:ys||ii,title:ii?I("sidebar.archiveCurrentDisabled"):void 0,onSelect:()=>S0(Z),children:[a.jsx(v2,{}),I("sidebar.archive")]})})})]})}),(!Qe||Nd)&&a.jsxs("div",{className:Oe.sessionActions,onClick:ei=>ei.stopPropagation(),onKeyDown:ei=>ei.stopPropagation(),children:[[{key:"pin",icon:a.jsx(eq,{size:16,strokeWidth:1.2}),label:Z.isPinned?I("sidebar.unpin"):I("sidebar.pin"),disabled:ys,active:Z.isPinned,visible:Nd&&J.has("pin"),onClick:()=>C1(Z)},{key:"archive",icon:a.jsx(v2,{size:16,strokeWidth:1.2}),label:I("sidebar.archive"),disabled:ys||ii,title:I(ii?"sidebar.archiveCurrentDisabled":"sidebar.archive"),visible:D0&&J.has("archive"),onClick:()=>S0(Z)},{key:"rename",icon:a.jsx(Ny,{size:16,strokeWidth:1.2}),label:I("sidebar.rename"),disabled:!ii,title:ii?void 0:I("sidebar.renameCurrentOnly"),visible:L0&&J.has("rename"),onClick:()=>au(Z)},{key:"export",icon:a.jsx(Hx,{size:16,strokeWidth:1.2}),label:I("sidebar.export"),disabled:_c,visible:D1&&J.has("export"),onClick:()=>ya(Z)},{key:"delete",icon:a.jsx(kf,{size:16,strokeWidth:1.2}),label:I("sidebar.delete"),disabled:ii,destructive:!0,title:ii?I("sidebar.currentDeleteDisabled"):void 0,visible:Kv&&J.has("delete"),onClick:()=>go(Z)}].filter(ea=>ea.visible).map(ea=>a.jsx("button",{className:id(Oe.sessionActionButton,ea.active&&Oe.activeSessionActionButton),type:"button",disabled:ea.disabled,"aria-label":ea.label,title:ea.title??ea.label,onClick:ea.onClick,style:ea.destructive&&!ea.disabled?{color:"var(--destructive, #dc2626)"}:void 0,children:ea.icon??a.jsx("span",{style:{fontSize:12},children:ea.label})},ea.key)),Nd&&!J.has("pin")||D0&&!J.has("archive")||F.has("details")||L0&&!J.has("rename")||X(Z,"group")||D1&&!J.has("export")||Kv&&!J.has("delete")?a.jsxs(Mu,{children:[a.jsx(Ru,{asChild:!0,children:a.jsx("button",{className:Oe.sessionActionButton,type:"button","aria-label":I("sidebar.moreActions"),title:I("sidebar.moreActions"),children:a.jsx(sp,{})})}),a.jsx(Du,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{Jn.current=!0},onCloseAutoFocus:ei=>{Jn.current&&(Jn.current=!1,ei.preventDefault())},children:a.jsxs(Tp,{children:[Nd&&!J.has("pin")&&a.jsxs(bi,{disabled:ys,onSelect:()=>C1(Z),children:[a.jsx(eq,{}),Z.isPinned?I("sidebar.unpin"):I("sidebar.pin")]}),D0&&!J.has("archive")&&a.jsxs(bi,{disabled:ys||ii,title:ii?I("sidebar.archiveCurrentDisabled"):void 0,onSelect:()=>S0(Z),children:[a.jsx(v2,{}),I("sidebar.archive")]}),F.has("details")&&a.jsx(nX,{session:Z,label:zn,completedUnread:ul,onError:b,getCollisionBoundary:va}),L0&&!J.has("rename")&&a.jsxs(bi,{disabled:!ii,title:ii?void 0:I("sidebar.renameCurrentOnly"),onSelect:()=>au(Z),children:[a.jsx(Ny,{}),I("sidebar.rename")]}),X(Z,"group")&&a.jsxs(bi,{disabled:ys,onSelect:ei=>zv(ei.currentTarget,Z),children:[a.jsx(jke,{}),I("sidebar.sessionGroup")]}),D1&&!J.has("export")&&a.jsxs(bi,{disabled:_c,onSelect:()=>ya(Z),children:[a.jsx(Hx,{}),I("sidebar.export")]}),Kv&&!J.has("delete")&&a.jsxs(bi,{variant:"destructive",disabled:ii,title:ii?I("sidebar.currentDeleteDisabled"):void 0,onSelect:()=>go(Z),children:[a.jsx(kf,{}),I("sidebar.delete")]})]})})]}):null]})]})]})]})},Ct)},[ot,cl,Jl,X,Zo,as,Bt,bs,e,pn,lt,Bn,Qn,In,Et,Rr,va,b,S0,go,ya,xn,au,C1,$h,fo,zv,Is,F,J,kc,Zn,I]),cE=h.useMemo(()=>ae&&te.length===0?a.jsx("div",{className:Oe.notice,children:I("sidebar.loadingSessions")}):be&&te.length===0?a.jsx("button",{className:Oe.retry,type:"button",onClick:ve,children:I("sidebar.loadFailed")}):Bh.length===0&&(Cr.trim()||!U||zh.length===0)?a.jsx("div",{className:Oe.notice,children:I("sidebar.searchEmpty")}):U?zh.length===0?Bh.map(Z=>Yu(Z)):zh.map(Z=>{const Re=!uo.has(Z.id),Ue=Z.group;return a.jsx(OR,{id:Z.id,label:Z.label,count:Z.sessions.length,color:Z.color,expanded:Re,onToggle:()=>T1(Z.id),onRename:Z.kind==="group"&&Ue&&Le()?()=>Zl(Ue):void 0,onDelete:Z.kind==="group"&&Ue&&Le()?()=>_0(Ue):void 0,renameLabel:I("sidebar.groupRename"),deleteLabel:I("sidebar.groupDelete"),actionsDisabled:pt,children:Z.sessions.map(Qe=>Yu(Qe))},Z.id)}):Bh.map(Z=>Yu(Z)),[uo,Le,be,Bh,pt,_0,Zl,ae,U,ve,Yu,Cr,zh,te.length,I,T1]),uE=h.useMemo(()=>{if(!pe||e||Cr.trim())return null;const Z=a.jsxs("button",{type:"button",className:Oe.archivedHeader,"aria-expanded":Ae,onClick:()=>rt(Qe=>!Qe),children:[a.jsx("span",{className:Oe.archivedTitle,style:{flex:"0 1 auto"},children:I("sidebar.archivedTitle")}),a.jsx("span",{className:Oe.archivedChevron,"aria-hidden":"true",children:Ae?a.jsx(Pc,{}):a.jsx(Eu,{})}),Ae&&ps.length>0&&a.jsx("span",{className:Oe.archivedCount,children:ps.length})]});if(!Ae)return a.jsx("div",{className:Oe.archivedSection,children:Z});const Re=a.jsx("button",{className:Oe.retry,type:"button",onClick:()=>{Te(),Qt(Qe=>Qe+1)},children:I("sidebar.loadFailed")});let Ue;return En&&ps.length===0?Ue=a.jsx("div",{className:Oe.notice,children:I("sidebar.loadingSessions")}):Ln&&ps.length===0?Ue=Re:ps.length===0?Ue=a.jsx("div",{className:Oe.notice,children:I("sidebar.archivedEmpty")}):Ue=a.jsxs(a.Fragment,{children:[ps.map(Qe=>Yu(Qe,{isArchived:!0})),Ln&&Re]}),a.jsxs("div",{className:Oe.archivedSection,children:[Z,a.jsx("div",{className:Oe.archivedList,children:Ue})]})},[Ae,ps,e,Ln,En,Te,Yu,Cr,pe,Qt,I]);return a.jsx(a.Fragment,{children:a.jsxs("aside",{ref:Be,className:id(Oe.sidebar,e&&Oe.collapsed,ut&&Oe.resizing,v&&Oe.mobileOpen),"aria-label":I("sidebar.label"),style:ba,children:[mn&&a.jsxs("div",{ref:cn,className:Oe.groupMenu,role:"menu","aria-label":I("sidebar.sessionGroup"),style:{top:mn.top,left:mn.left},onClick:Z=>Z.stopPropagation(),onKeyDown:Ar,onMouseDown:Z=>Z.stopPropagation(),children:[a.jsxs("button",{className:id(Oe.groupMenuItem,j1&&Oe.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":j1,onClick:()=>Fv(mn.session,null),children:[a.jsx("span",{className:Oe.groupMenuEmptyDot}),a.jsx("span",{className:Oe.groupMenuName,children:I("sidebar.groupUngrouped")}),j1&&a.jsx("span",{className:Oe.groupMenuCheck,children:"✓"})]}),T0.map(Z=>{const Re=E1===Z;return a.jsxs("button",{className:id(Oe.groupMenuItem,Re&&Oe.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":Re,onClick:()=>aS(mn.session,Z),children:[a.jsx("span",{className:id(Oe.groupMenuDot,lX(Z))}),a.jsx("span",{className:Oe.groupMenuName,children:I(`sidebar.groupColor.${Z}`)}),Re&&a.jsx("span",{className:Oe.groupMenuCheck,children:"✓"})]},`color:${Z}`)}),wt.map(Z=>{const Re=A1===Z.id;return a.jsxs("button",{className:id(Oe.groupMenuItem,Re&&Oe.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":Re,onClick:()=>Fv(mn.session,Z.id),children:[a.jsx("span",{className:id(Oe.groupMenuDot,lX(Z.color)),style:SRt(Z.color)}),a.jsx("span",{className:Oe.groupMenuName,children:Z.name}),Re&&a.jsx("span",{className:Oe.groupMenuCheck,children:"✓"})]},Z.id)}),a.jsx("div",{className:Oe.groupMenuSeparator}),a.jsxs("button",{className:Oe.groupMenuItem,type:"button",role:"menuitem",onClick:()=>oS(mn.session),children:[a.jsx("span",{className:Oe.groupMenuIcon,children:a.jsx(ERt,{})}),a.jsx("span",{className:Oe.groupMenuName,children:I("sidebar.groupCreate")})]})]}),xs&&a.jsx(Fi,{title:I("delete.title"),size:"sm",onClose:()=>Ce(null),children:a.jsxs("div",{className:Oe.confirmContent,children:[a.jsx("p",{className:Oe.confirmDescription,children:I("sidebar.deleteConfirmDescription",{name:C0})}),a.jsxs("div",{className:Oe.confirmActions,children:[a.jsx("button",{className:Oe.secondaryButton,type:"button",onClick:()=>Ce(null),children:I("common.cancel")}),a.jsx("button",{className:Oe.dangerButton,type:"button",onClick:qa,children:I("sidebar.delete")})]})]})}),Gn&&a.jsx(Fi,{title:I("sidebar.removeWorkspaceTitle"),size:"sm",onClose:()=>{(!$r||gr)&&(ks.current=!0,Jr(null),vs(null),Vt(!1))},children:a.jsxs("div",{className:Oe.confirmContent,children:[a.jsx("p",{className:Oe.confirmDescription,children:zs?I("sidebar.removeWorkspaceBusy",{name:Gn.cwd}):I("sidebar.removeWorkspaceConfirm",{name:Gn.cwd})}),zs&&a.jsxs("ul",{className:Oe.workspaceRemovalActivityList,children:[a.jsx("li",{children:I("sidebar.removeWorkspaceSessions",{count:zs.sessions})}),a.jsx("li",{children:I("sidebar.removeWorkspacePrompts",{count:zs.activePrompts})}),a.jsx("li",{children:I("sidebar.removeWorkspaceStarts",{count:zs.pendingSessionStarts})}),a.jsx("li",{children:I("sidebar.removeWorkspaceConnections",{count:zs.acpConnections})}),a.jsx("li",{children:I("sidebar.removeWorkspaceMemoryTasks",{count:zs.memoryTasks})}),a.jsx("li",{children:I("sidebar.removeWorkspaceWorkers",{count:zs.channelWorkers})}),a.jsx("li",{children:I("sidebar.removeWorkspaceVoiceSessions",{count:zs.voiceSessions??0})})]}),zs&&$.sessionId&&$.workspaceCwd===Gn.cwd&&a.jsx("p",{className:Oe.confirmDescription,children:I("sidebar.removeWorkspaceCurrentSession")}),gr&&a.jsx("p",{className:Oe.confirmDescription,children:I("sidebar.removeWorkspaceInProgress")}),a.jsxs("div",{className:Oe.confirmActions,children:[a.jsx("button",{className:Oe.secondaryButton,type:"button",disabled:$r&&!gr,onClick:()=>{ks.current=!0,Jr(null),vs(null),Vt(!1)},children:I("common.cancel")}),a.jsx("button",{className:Oe.dangerButton,type:"button",disabled:$r||gr||zs!==null&&!!$.sessionId&&$.workspaceCwd===Gn.cwd,onClick:()=>void vn(),children:I(zs?"sidebar.forceRemoveWorkspace":"sidebar.removeWorkspace")})]})]})}),wn&&a.jsx(Fi,{title:A0,size:"sm",onClose:Ph,children:a.jsxs("form",{className:"flex flex-col gap-6",onSubmit:Z=>{Z.preventDefault(),Oh()},children:[a.jsxs(by,{children:[a.jsxs(wo,{children:[a.jsx(oa,{htmlFor:"session-group-name",children:I("sidebar.groupNamePrompt")}),a.jsx(Ur,{id:"session-group-name",value:di,autoFocus:!0,maxLength:64,onChange:Z=>$s(Z.target.value)})]}),a.jsxs(wo,{children:[a.jsx(oa,{htmlFor:"session-group-color",children:I("sidebar.groupColor")}),a.jsxs(vl,{value:E0?AN:Gr,onValueChange:Z=>{Gs(Z===AN?Ks:Z)},children:[a.jsx(xl,{id:"session-group-color",className:"w-full",children:a.jsx(wl,{})}),a.jsx(kl,{children:a.jsxs(ile,{children:[N1.map(Z=>a.jsx(Ai,{value:Z,children:I(`sidebar.groupColor.${Z}`)},Z)),a.jsx(Ai,{value:AN,children:I("sidebar.groupColor.custom")})]})})]})]}),E0&&a.jsxs(wo,{children:[a.jsx(oa,{htmlFor:"session-group-hex-color",children:I("sidebar.groupColor.hex")}),a.jsxs("div",{className:Oe.groupCustomColorRow,children:[a.jsx(Ur,{className:Oe.groupColorPicker,type:"color",value:Ks,"aria-label":I("sidebar.groupColor.picker"),onChange:Z=>{const Re=Z.target.value.toLowerCase();Qr(Re),Gs(Re)}}),a.jsx(Ur,{id:"session-group-hex-color",value:Gr,maxLength:7,spellCheck:!1,"aria-invalid":qv===void 0,onChange:Z=>{const Re=Z.target.value,Ue=Re.trim(),Qe=Ue&&!Ue.startsWith("#")?`#${Ue}`:Re;Gs(Qe);const Ct=$R(Qe);Ct&&Qr(Ct)}})]}),qv===void 0&&a.jsx("span",{className:Oe.groupColorError,role:"alert",children:I("sidebar.groupColor.invalid")})]})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(Kt,{type:"button",variant:"outline",disabled:pt,onClick:Ph,children:I("common.cancel")}),a.jsx(Kt,{type:"submit",disabled:!lS,children:I("common.save")})]})]})}),Rt&&a.jsx(Fi,{title:I("sidebar.groupDelete"),size:"sm",onClose:()=>{pt||Ii(null)},children:a.jsxs("div",{className:Oe.confirmContent,children:[a.jsx("p",{className:Oe.confirmDescription,children:I("sidebar.groupDeleteConfirm",{name:pm})}),a.jsxs("div",{className:Oe.confirmActions,children:[a.jsx("button",{className:Oe.secondaryButton,type:"button",disabled:pt,onClick:()=>Ii(null),children:I("common.cancel")}),a.jsx("button",{className:Oe.dangerButton,type:"button",disabled:pt,onClick:Bv,children:I("sidebar.groupDelete")})]})]})}),V&&a.jsx("div",{className:Oe.topRow,children:B!=null&&B.render?B.render():a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Oe.brandLogo,"aria-hidden":"true",children:a.jsx(ARt,{})}),!e&&a.jsx("span",{className:Oe.brandName,children:"Qwen Code"})]})}),a.jsxs("div",{className:Oe.primaryNav,children:[M.has("newTask")&&a.jsxs("button",{className:Oe.newChatButton,type:"button",title:I("sidebar.newTask"),"aria-label":I("sidebar.newTask"),disabled:po,onClick:()=>Xn(),children:[a.jsx("span",{className:Oe.navIcon,children:a.jsx(nq,{size:16,strokeWidth:1.2})}),!e&&a.jsx("span",{children:I("sidebar.newTask")})]}),M.has("plugins")&&a.jsxs("button",{className:Oe.pluginButton,type:"button",title:I("sidebar.plugins"),"aria-label":I("sidebar.plugins"),onClick:s,children:[a.jsx("span",{className:Oe.navIcon,children:a.jsx(Nxe,{size:16,strokeWidth:1.2})}),!e&&a.jsx("span",{children:I("sidebar.plugins")})]}),M.has("channels")&&a.jsxs("button",{className:Oe.pluginButton,type:"button",title:I("sidebar.channels"),"aria-label":I("sidebar.channels"),onClick:r,children:[a.jsx("span",{className:Oe.navIcon,children:a.jsx(Iee,{size:16,strokeWidth:1.2})}),!e&&a.jsx("span",{children:I("sidebar.channels")})]}),M.has("scheduledTasks")&&a.jsxs("button",{className:Oe.pluginButton,type:"button",title:I("sidebar.scheduledTasks"),"aria-label":I("sidebar.scheduledTasks"),onClick:o,children:[a.jsx("span",{className:Oe.navIcon,children:a.jsx(Oxe,{size:16,strokeWidth:1.2})}),!e&&a.jsx("span",{children:I("sidebar.scheduledTasks")})]}),M.has("goals")&&a.jsxs("button",{className:Oe.pluginButton,type:"button",title:I("sidebar.goals"),"aria-label":I("sidebar.goals"),onClick:l,children:[a.jsx("span",{className:Oe.navIcon,children:a.jsx(eSe,{size:16,strokeWidth:1.2})}),!e&&a.jsx("span",{children:I("sidebar.goals")})]}),(Gv=D==null?void 0:D.render)==null?void 0:Gv.call(D)]}),a.jsx("div",{className:Oe.body,children:a.jsxs("div",{className:Oe.sessionList,children:[!e&&Zr.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Oe.projectsHeader,children:a.jsxs("button",{className:Oe.projectsHeaderToggle,type:"button","aria-expanded":dt,onClick:()=>jt(Z=>!Z),children:[a.jsx("span",{children:I("sidebar.pinnedSessions")}),a.jsx(uX,{expanded:dt})]})}),dt&&a.jsx("div",{className:Oe.pinnedSessionList,children:Zr.map(Z=>Yu(Z,{readOnly:kc(Z)}))})]}),!e&&!j&&a.jsxs("div",{className:Oe.projectsHeader,children:[a.jsxs("button",{className:Oe.projectsHeaderToggle,type:"button","aria-expanded":Ge,onClick:()=>tt(Z=>!Z),children:[a.jsx("span",{children:I("sidebar.project")}),a.jsx(uX,{expanded:Ge})]}),a.jsxs("div",{className:Oe.projectsHeaderActions,children:[a.jsx("button",{className:Oe.projectsHeaderAction,type:"button",title:I("sidebar.search"),"aria-label":I("sidebar.search"),onClick:()=>{Tn(Z=>(Z&&$e(""),!Z)),tt(!0)},children:a.jsx(eu,{})}),!E&&C&&a.jsx("button",{className:Oe.projectsHeaderAction,type:"button",title:I("sidebar.addWorkspace"),"aria-label":I("sidebar.addWorkspace"),onClick:C,children:a.jsx(Vf,{})})]})]}),Zt&&!e&&!j&&a.jsxs("div",{className:Oe.projectSearch,children:[a.jsx(eu,{"aria-hidden":"true"}),a.jsx(Ur,{value:Cr,placeholder:I("sidebar.searchPlaceholder"),"aria-label":I("sidebar.search"),autoFocus:!0,onChange:Z=>$e(Z.target.value),onKeyDown:Z=>{Z.key==="Escape"&&($e(""),Tn(!1))}})]}),(e||Ge)&&a.jsx(a.Fragment,{children:!e&&a.jsx("div",{className:Oe.workspacePicker,children:a.jsx("div",{className:Oe.workspaceList,children:ri.map(Z=>a.jsxs(h.Fragment,{children:[a.jsx(oRt,{workspace:Z,renderHeader:E&&(O!=null&&O.render)?Re=>{var Ue;return(Ue=O.render)==null?void 0:Ue.call(O,Z,{expanded:Re})}:void 0,client:Y.client,reloadToken:Sr,untrustedLabel:I("sidebar.workspaceUntrusted"),readOnlyLabel:I("sidebar.workspaceReadOnly"),trustToOpenLabel:I("sidebar.workspaceTrustToOpen"),noSessionsLabel:I("sidebar.noSessions"),loadErrorLabel:I("sidebar.loadFailed"),organizationEnabled:U,sourceMetadataEnabled:le,ungroupedLabel:I("sidebar.groupUngrouped"),onRenameGroup:Le(Z.cwd)?Zl:void 0,onDeleteGroup:Le(Z.cwd)?_0:void 0,renameGroupLabel:I("sidebar.groupRename"),deleteGroupLabel:I("sidebar.groupDelete"),groupActionsDisabled:pt,excludePinned:!0,onOpenGitDiff:T,onOpenCommit:S,formatTime:Re=>Zy(Re,I),searchQuery:Cr,expanded:Z.primary?pr:void 0,autoExpandKey:(Ot==null?void 0:Ot.id)===Z.id?Ot==null?void 0:Ot.key:void 0,onExpandedChange:Z.primary?xe:void 0,renderSessions:!Z.primary,renderSession:Re=>Yu({...Re,workspaceCwd:Z.cwd},{readOnly:kc({...Re,workspaceCwd:Z.cwd})}),headerActions:Re=>{if(E&&(O!=null&&O.render))return null;const Ue=!E&&Lo&&!Z.primary&&Z.removable===!0;if(!Z.trusted&&!Ue)return null;const Qe=Z.primary?void 0:Z.cwd;return a.jsxs("div",{className:Oe.workspaceHeaderActions,style:{visibility:Re?"visible":"hidden"},children:[Z.trusted&&a.jsxs(a.Fragment,{children:[Le(Z.cwd)&&a.jsx("button",{className:Oe.workspaceHeaderAction,type:"button","aria-label":I("sidebar.groupCreate"),onClick:Ct=>{Ct.preventDefault(),Ct.stopPropagation(),Z.primary?iS():mm(Z.cwd)},children:a.jsx(Vf,{size:16,strokeWidth:1.2})}),a.jsx("button",{className:Oe.workspaceHeaderAction,type:"button",title:I("sidebar.newTask"),"aria-label":I("sidebar.newTask"),onClick:Ct=>{Ct.preventDefault(),Ct.stopPropagation(),Xn(Qe)},children:a.jsx(nq,{size:16,strokeWidth:1.2})})]}),Ue&&a.jsxs(Mu,{children:[a.jsx(Ru,{asChild:!0,children:a.jsx("button",{className:Oe.workspaceHeaderAction,type:"button","aria-label":I("sidebar.workspaceActions"),disabled:$r&&(Gn==null?void 0:Gn.id)===Z.id,children:a.jsx(sp,{size:16,strokeWidth:1.2})})}),a.jsx(Du,{align:"end",className:"w-auto min-w-40",children:a.jsxs(bi,{variant:"destructive","aria-label":`${I("sidebar.removeWorkspace")}: ${Z.cwd}`,onSelect:()=>xt(Z),children:[a.jsx(kf,{}),I("sidebar.removeWorkspace")]})})]})]})}}),Z.primary&&(pr||Cr.trim())?a.jsx("div",{className:Oe.workspaceSessionBody,children:cE}):null]},Z.id))})})}),uE]})}),z!==!1&&a.jsxs("div",{className:id(Oe.footer,Zs&&Oe.footerCompact,mo&&Oe.footerTight),children:[a.jsxs("div",{className:Oe.footerPrimary,children:[z&&typeof z=="object"&&((lu=z.render)==null?void 0:lu.call(z)),W.has("settings")&&a.jsxs("button",{className:Oe.footerButton,type:"button",title:I("sidebar.settings"),"aria-label":I("sidebar.settings"),onClick:n,children:[a.jsx("span",{className:`${Oe.navIcon} ${Oe.settingsIcon}`,children:a.jsx($_e,{size:16,strokeWidth:1.2})}),!e&&!Zs&&a.jsx("span",{className:Oe.footerButtonLabel,children:I("sidebar.settings")})]}),!e&&!mo&&jl&&W.has("version")&&a.jsx("span",{className:Oe.version,title:`Qwen Code ${jl}`,children:jl})]}),a.jsxs("div",{className:Oe.footerActions,children:[W.has("theme")&&a.jsx("button",{className:Oe.collapseButton,type:"button",title:w===Fr.Dark?I("sidebar.themeLight"):I("sidebar.themeDark"),"aria-label":w===Fr.Dark?I("sidebar.themeLight"):I("sidebar.themeDark"),onClick:()=>y(w===Fr.Dark?Fr.Light:Fr.Dark),children:w===Fr.Dark?a.jsx(Q_e,{size:16,strokeWidth:1.2}):a.jsx(h_e,{size:16,strokeWidth:1.2})}),u&&W.has("sessionsOverview")&&a.jsx("button",{className:Oe.collapseButton,type:"button",title:I("sidebar.sessionsOverview"),"aria-label":I("sidebar.sessionsOverview"),onClick:c,children:a.jsx(Jke,{size:16,strokeWidth:1.2})}),f&&W.has("splitView")&&a.jsx("button",{className:Oe.collapseButton,type:"button",title:I("sidebar.splitView"),"aria-label":I("sidebar.splitView"),onClick:d,children:a.jsx(nke,{size:16,strokeWidth:1.2})}),W.has("daemonStatus")&&a.jsx("button",{className:Oe.collapseButton,type:"button",title:I("sidebar.daemonStatus"),"aria-label":I("sidebar.daemonStatus"),onClick:i,children:a.jsx(mxe,{size:16,strokeWidth:1.2})}),!v&&W.has("collapse")&&a.jsx("button",{className:Oe.collapseButton,type:"button",title:I(e?"sidebar.expand":"sidebar.collapse"),"aria-label":I(e?"sidebar.expand":"sidebar.collapse"),onClick:()=>t(!e),children:e?a.jsx(x_e,{size:16,strokeWidth:1.2}):a.jsx(v_e,{size:16,strokeWidth:1.2})})]})]}),a.jsx("div",{className:Oe.resizeHandle,role:"separator","aria-orientation":"vertical",onPointerDown:lE})]})})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function NRt(e){return e.key!=="b"&&e.key!=="B"||e.altKey||e.shiftKey?!1:e.metaKey!==e.ctrlKey}const IRt=3e3,MRt=2;function dX(e){return e.some(t=>t.status==="running"||t.status==="paused")}function RRt(e,t,n,s=0){const r=rm(),[i,o]=h.useState([]),[l,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||!l)return;let g=!1;const b=()=>{var v;if(((v=m.current)==null?void 0:v.sessionId)===e)return;const y={};m.current={sessionId:e,request:y},r.getTasks({silent:!0}).then(x=>{if(!(g||x.sessionId!==e)){if(o(x.tasks),x.tasks.length===0){f.current+=1,f.current>=MRt&&c(!1);return}f.current=0,dX(x.tasks)||c(!1)}}).catch(x=>{if(!g){if(GP(x)){c(!1);return}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 w=setInterval(b,IRt);return()=>{g=!0,clearInterval(w)}},[r,n,l,e,u]);const p=h.useRef(i);return p.current=i,h.useEffect(()=>{const g=b=>{const w=b.detail,y=(w==null?void 0:w.active)===!0;d(y),!y&&dX(p.current)&&c(!0)};return window.addEventListener(l_,g),()=>window.removeEventListener(l_,g)},[]),i}function DRt(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],l=s[i];return o===l?!0:Array.isArray(o)&&Array.isArray(l)?o.length===l.length&&o.every((c,u)=>c===l[u]):!1})}function LRt(e){const t=h.useRef(e);return DRt(t.current,e)||(t.current=e),t.current}function PRt(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 la={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"},hX=1024,ORt=new RegExp(String.raw`(?<![\w$])\$(?![\s\d$])(?=[^$\n]{1,${hX}}\S\$)([^$\n]{1,${hX}})\$(?![\w$])`,"g");function $Rt(e){var u,d,f;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=new Map;let i=null,o=null,l=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),l=g}else l=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:l}),i=null,o=null,l=null,c=[];continue}c.push(m)}return t}function BRt(e){var c;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=/^ *\$\$ *$/;let i=null,o=!1,l=[];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,l=[]);continue}if(r.test(u)){t.push({content:l.join(`
`),index:t.length+1}),o=!1,l=[];continue}l.push(u)}return t}function zRt(e){var l;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&&((l=u[1])!=null&&l.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(ORt)){const f=d[1];f&&t.push({content:f,index:t.length+1})}}return t}function fX(e,t){return t&&e.langIndex!==null?`${t} code block ${e.langIndex}`:`Code block ${e.index}`}function FRt(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=$Rt(e);if(r.length===0)return null;let i=null,o=null;const l=s==="code"?n.slice(1):n;for(const f of l)/^\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:fX(f,i)}:null}const u=c[c.length-1];return u?{content:u.content,label:fX(u,i)}:null}function mX(e,t){const n=zRt(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 qRt(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 mX(e,n.slice(1));const r=n.slice(1),i=r.findIndex(d=>d.toLowerCase()==="inline");if(i!==-1)return mX(e,r.filter((d,f)=>f!==i));const o=BRt(e);if(o.length===0)return null;let l=null;for(const d of r)/^\d+$/.test(d)&&(l=Number(d));const c=l!==null?o.find(d=>d.index===l):o[o.length-1];return c?{content:c.content,label:`LaTeX block ${c.index}`}:null}function HRt(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 URt(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 WRt(e,t,n=URt){const s=HRt(e);if(s===null)return{status:"info",message:la.NO_OUTPUT};if(!s)return{status:"info",message:la.NO_TEXT};try{const r=qRt(s,t);if(r===null)return{status:"info",message:t.trim().split(/\s+/).some(c=>c==="inline")||t.trim().toLowerCase().startsWith("inline-latex")?la.INLINE_LATEX_MISSING:la.LATEX_MISSING};if(r!==void 0)return await n(r.content),{status:"info",message:`${r.label}${la.COPIED_SUFFIX}`};const i=FRt(s,t);if(i===null)return{status:"info",message:la.CODE_MISSING};const o=(i==null?void 0:i.content)??s;return await n(o),{status:"info",message:i?`${i.label}${la.COPIED_SUFFIX}`:la.OUTPUT_COPIED}}catch(r){const i=r instanceof Error?r.message:String(r);return{status:"error",message:`${la.CLIPBOARD_PREFIX}${i}`}}}function VRt(e){return typeof e=="object"&&e!==null}function Hme(e){const t="Model switched: ";return e.startsWith(t)?e.slice(t.length).trim().replace(/\([^()]+\)$/,""):null}function AO(e){return e.role==="system"&&e.variant==="info"&&e.source==="model_switch_summary"}function GRt(e){if(!AO(e)||!VRt(e.data))return null;const t=e.data.modelId;return typeof t=="string"&&t?t:null}function KRt(e){const t=new Set;for(const n of e){if(!AO(n))continue;const s=GRt(n);s&&t.add(s)}return t.size===0?[...e]:e.filter(n=>{if(n.role!=="system"||n.variant!=="info")return!0;const s=Hme(n.content);return!s||!t.has(s)})}function YRt(e){return e.role!=="system"||e.variant!=="info"?!1:Hme(e.content)!==null||AO(e)}function XRt(e){const t=e.findIndex(n=>!YRt(n));return t<0?[]:e.slice(t)}function pX(e){return XRt(KRt(e))}function QRt(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 gX(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 JRt(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?`${t[2]}:${t[1]}`:e}function bX(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?t[1]:e}function ZRt(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 e9t=12,t9t=2,n9t=8,s9t=.35,r9t=2,i9t=.1,o9t=700,a9t=10*60*1e3,l9t=.75,c9t=280,u9t=[/^继续[吧呢]?$/,/^行[吧吗]?$/,/^好的?$/,/^再[看试说解释改跑补].*/,/^顺手.*/,/^上面.*/,/^刚才.*/,/^这个报错.*/,/^那你.*/,/^帮我修.*/,/^帮我看下.*/,/^跑(一下)?(测试|看看).*/,/^这个实现.*/,/^这个 PR.*/i,/^继续当前.*/,/^continue$/i,/^ok(?:ay)?$/i,/^retry$/i,/^fix (?:that|this|it)/i,/^run (?:the )?tests?/i],d9t=[/新的?(功能|任务|方向|话题)/,/写(一篇)?(设计文档|文档|spec|方案)/i,/产品方案/,/脑爆/,/另一个(功能|方向|任务|主题)/,/不继续当前/,/切到(一个)?新的?(任务|方向|话题)/,/start (a )?new/i,/new (feature|task|design|spec|doc|workflow)/i,/product (design|plan|spec)/i,/brainstorm/i];function h9t(e){const t=e.trim();return u9t.some(n=>n.test(t))}function f9t(e){const t=e.trim();return d9t.some(n=>n.test(t))}function m9t(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,c9t)}))}function p9t(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 yX(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 g9t(e){const t=yX(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:yX(r)}function b9t({enabled:e,messages:t,sessionId:n,contextUsageRatio:s,isRunning:r,dialogOpen:i,hasAttachments:o,generateContent:l}){const[c,u]=h.useState(null),d=h.useRef(null),f=h.useRef(null),m=h.useRef(0),p=h.useRef(""),g=h.useRef(null),b=h.useRef(n),w=h.useMemo(()=>m9t(t),[t]),y=h.useRef({enabled:e,recentMessages:w,sessionId:n,contextUsageRatio:s,isRunning:r,dialogOpen:i,hasAttachments:o,generateContent:l});y.current={enabled:e,recentMessages:w,sessionId:n,contextUsageRatio:s,isRunning:r,dialogOpen:i,hasAttachments:o,generateContent:l};const v=h.useCallback(()=>{var C;d.current&&(clearTimeout(d.current),d.current=null),(C=f.current)==null||C.abort(),f.current=null},[]),x=h.useCallback(()=>{g.current!==null&&(g.current=null,u(null))},[]),k=h.useCallback(()=>{x(),v()},[v,x]),_=h.useCallback(()=>{m.current=Date.now()+a9t,x(),v()},[v,x]),T=h.useCallback(C=>{v();const{enabled:N,recentMessages:E,sessionId:O,contextUsageRatio:B,isRunning:D,dialogOpen:j,hasAttachments:L,generateContent:z}=y.current;if(!N||!z||!O){x();return}const I=C.trim();if(I.length<e9t){x();return}const $=f9t(I);if(D||j){x();return}const K=L===!1&&E.length>=t9t,R=!h9t(I)&&($?E.length>=r9t||B>=i9t:E.length>=n9t||B>=s9t);if(!K&&!R){x();return}if(Date.now()<m.current){x();return}x(),d.current=setTimeout(()=>{const Y=new AbortController;f.current=Y;const W=p9t({recentMessages:E,currentInput:I,contextUsageRatio:B,messageCount:E.length,allowBtw:K,allowNewSession:R});(async()=>{let M="";try{for await(const J of z(W,{signal:Y.signal})){if(f.current!==Y)return;if(J.type==="delta")M+=J.text;else if(J.type==="error"){f.current===Y&&x();return}}if(f.current!==Y)return;const F=g9t(M.trim());if(F&&F.suggestion!=="none"&&(F.suggestion==="btw"&&K||F.suggestion==="new_session"&&R)&&F.confidence>=l9t){const J={suggestion:F.suggestion,classifiedInput:I,sourceSessionId:O};g.current=J,u(J);return}x()}catch{Y.signal.aborted||x()}finally{f.current===Y&&(f.current=null)}})()},o9t)},[v,x]),S=h.useCallback(C=>{p.current=C,T(C)},[T]);return h.useEffect(()=>{b.current!==n&&(b.current=n,v(),x()),T(p.current)},[v,x,s,i,e,l,o,r,w,T,n]),h.useEffect(()=>()=>{v()},[v]),{suggestion:c,updateInput:S,dismiss:k,suppress:_}}const i1=h.createContext(!1),jO=h.createContext(new Map),Ume=h.createContext(new Map);function y9t({timeline:e,details:t,children:n}){return a.jsx(jO.Provider,{value:e,children:a.jsx(Ume.Provider,{value:t,children:n})})}const nx=pv,jN=500,gb=320,BC=500,v9t=800,w9t=332,Wme=["approvalMode","model","widthMode","voice","workspace"],x9t=[...Wme,"gitBranch"],k9t=20,_9t=3e4;function S9t(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 C9t="ui.compactMode",T9t="ui.hideTips",E9t={main:"model.select",fast:"model.setFast",voice:"model.setVoice",vision:"model.setVision"};function NN(e){return e.trim().replace(/^\/+/,"").toLowerCase()}function IN(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t];if((n==null?void 0:n.kind)==="user")return n.id}}function A9t(e){const t=e;return t.source!=="goal"?null:L3(t.data)??L3(t.text)}function j9t(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind!=="status")continue;const s=A9t(n);if(s)return s.kind==="set"||s.kind==="checking"?{condition:s.condition,setAt:s.setAt??n.serverTimestamp??n.createdAt}:null}return null}const vX={insertText:()=>{},setText:()=>{},addTags:()=>{},removeTag:()=>{},clear:()=>{},submit:()=>{}},N9t=[],Vme=1e3,I9t=["title","environment","rightPanel"],M9t=["review","sideTask"],R9t=["environment","subagents","backgroundTasks"],wX=6,xX=40,Gme="qwen-code-web-shell-chat-width",D9t=40,Kme="qwen-code-web-shell-sidebar-collapsed";function L9t(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 P9t(e){if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Kme);if(t==="true")return!0;if(t==="false")return!1}catch{}return e}function kX(e){try{window.localStorage.setItem(Kme,String(e))}catch{}}function B4(){return`${Vme}`}function O9t(){if(typeof window>"u")return B4();try{return window.localStorage.getItem(Gme)==="wide"?"wide":B4()}catch{return B4()}}function $9t(e){try{window.localStorage.setItem(Gme,e)}catch{}}function Yme(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:Vme}function B9t(e,t){const n=`${Yme(t)}px`,s=`calc(${n} + ${D9t}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 _X(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function SX(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function z9t(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}function F9t(){if(typeof window>"u")return"en";const e=new URLSearchParams(window.location.search);return jf(e.get("language")??e.get("lang")??navigator.language)}function q9t(e,t){return e instanceof Error?e.message:t}function MN(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function bb(e){return typeof e=="object"&&e!==null&&e._alreadyDispatched===!0}function H9t(e){return e.category==="validation"||e.category==="user_action"||e.category==="system"}function U9t(e){return e.severity==="warning"?"warning":e.severity==="info"?"info":"error"}function Ap(e){return typeof e=="object"&&e!==null}function W9t(e){if(!Ap(e))return null;const t=e._meta;if(!Ap(t))return null;const n=t.qwenModelSwitch;if(!Ap(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 V9t(e,t){return t("model.usingModel",{isRuntime:e.isRuntime?1:0,modelId:e.modelId})}function G9t(e){return e.toolKind==="edit"}function K9t(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 Y9t(e){var n;const t=e.toolName.toLowerCase();return t==="monitor"?!0:((n=e.args)==null?void 0:n.is_background)!==!0?!1:t==="shell"||t==="bash"||t==="run_shell_command"||t==="exec"}function X9t(e){const t=[],n=s=>{for(const r of s)(Y9t(r)||yd(r))&&t.push(`${r.callId}:${r.status}`),r.subTools&&n(r.subTools)};for(const s of e)s.role==="tool_group"&&n(s.tools);return t.join("|")}function CX(e,t){return e.status!=="running"&&t.status==="running"?e:t}function TX(e,t){return e.status!=="running"&&t.status==="running"?e:t}function Q9t(e,t,n,s){if(e.parentSessionId!==t)return{parentSessionId:t,items:n,loaded:!0};const r=new Set(n.map(i=>i.sessionId));return{parentSessionId:t,loaded:!0,items:[...n,...e.items.filter(i=>!r.has(i.sessionId)&&s.has(i.sessionId))]}}function J9t(e){if(e.status==="pending"||e.status==="in_progress")return"running";if(e.status==="failed")return"failed";const t=Ap(e.rawOutput)?e.rawOutput:void 0;return(t==null?void 0:t.status)==="cancelled"?"cancelled":(t==null?void 0:t.status)==="failed"?"failed":"completed"}function Z9t(e){const t=e.status==="running"||e.status==="paused"?"in_progress":e.status==="failed"?"failed":"completed";return{callId:e.id,toolName:"agent",title:`Agent: ${e.label}`,status:t,args:{description:e.description,...e.prompt?{prompt:e.prompt}:{},...e.subagentType?{subagent_type:e.subagentType}:{},run_in_background:e.isBackgrounded},rawOutput:{type:"task_execution",subagentName:e.subagentType,status:e.status},startTime:e.startTime,...e.endTime!==void 0?{endTime:e.endTime}:{}}}function EX(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||typeof((n=e.args)==null?void 0:n.subagent_type)=="string"?!0:Ap(e.rawOutput)&&e.rawOutput.type==="task_execution"}function AX(e){var r;const t=Ap(e.rawOutput)?e.rawOutput:void 0,n=typeof(t==null?void 0:t.subagentName)=="string"?t.subagentName:void 0,s=typeof((r=e.args)==null?void 0:r.subagent_type)=="string"?e.args.subagent_type:void 0;return n?`${n}-${e.callId}`:s?`${s}-${e.callId}`:void 0}function eDt(e,t){const n=t.filter(m=>m.kind==="agent"),s=new Map;for(const m of e){if(m.role!=="system"||!Ap(m.data))continue;const p=m.data.taskId,g=m.data.toolUseId;typeof p=="string"&&typeof g=="string"&&s.set(g,p)}const r=new Set,i=new Set(s.values()),o=m=>{for(const p of m){if(EX(p)&&!r.has(p.callId)){r.add(p.callId);const g=AX(p);g&&i.add(g)}p.subTools&&o(p.subTools)}};for(const m of e)m.role==="tool_group"&&o(m.tools);const l=m=>m.toolUseId!=null&&r.has(m.toolUseId)||i.has(m.id),c=[],u=new Set,d=new Set,f=m=>{var p,g,b,w;for(const y of m){if(EX(y)&&!d.has(y.callId)){d.add(y.callId);const v=Ap(y.rawOutput)?y.rawOutput:void 0,x=typeof(v==null?void 0:v.subagentColor)=="string"?v.subagentColor:void 0,k=typeof((p=y.args)==null?void 0:p.description)=="string"?y.args.description:void 0,_=typeof((g=y.args)==null?void 0:g.prompt)=="string"?y.args.prompt:void 0,T=typeof((b=y.args)==null?void 0:b.subagent_type)=="string"?y.args.subagent_type:void 0,S=typeof(v==null?void 0:v.subagentName)=="string"?v.subagentName:void 0,C=s.get(y.callId),N=AX(y),E=I=>_&&I.prompt===_||k&&I.description===k&&T&&I.subagentType===T?!0:!!k&&I.description===k,O=n.find(I=>I.toolUseId===y.callId||I.id===C||I.id===N||!u.has(I.id)&&!l(I)&&E(I)),B=(w=y.title)==null?void 0:w.replace(/^Agent:\s*/i,"").trim(),j=(B&&B.toLowerCase()!=="agent"?B:void 0)??k??_??S??T??"",L=k??_??S??T??"",z=y.startTime??0;c.push(O?{...O,label:j,description:L||O.description,...T?{subagentType:T}:{},...x?{color:x}:{}}:{kind:"agent",id:C??N??y.callId,label:j,description:L,status:J9t(y),startTime:z,...y.endTime!==void 0?{endTime:y.endTime}:{},runtimeMs:Math.max(0,(y.endTime??y.startTime??z)-z),...T?{subagentType:T}:{},...x?{color:x}:{},isBackgrounded:yd(y),toolUseId:y.callId}),O&&u.add(O.id)}y.subTools&&f(y.subTools)}};for(const m of e)m.role==="tool_group"&&f(m.tools);for(const m of n)u.has(m.id)||m.toolUseId&&d.has(m.toolUseId)||c.some(g=>g.toolUseId!=null&&g.toolUseId===m.toolUseId||g.description!==""&&g.description===m.description)||c.push(m);return c}function tDt(e,t){const n=s=>{for(const r of s){if(r.callId===t)return r;const i=r.subTools?n(r.subTools):void 0;if(i)return i}};for(const s of e){if(s.role!=="tool_group")continue;const r=n(s.tools);if(r)return r}}function nDt(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 sDt(e,t){return e===la.NO_OUTPUT?t("copy.noOutput"):e===la.NO_TEXT?t("copy.noText"):e===la.CODE_MISSING?t("copy.codeMissing"):e===la.LATEX_MISSING?t("copy.latexMissing"):e===la.INLINE_LATEX_MISSING?t("copy.inlineLatexMissing"):e===la.OUTPUT_COPIED?t("copy.outputCopied"):e.startsWith(la.CLIPBOARD_PREFIX)?`${t("copy.failedFallback")}. ${e.slice(la.CLIPBOARD_PREFIX.length)}`:e.endsWith(la.COPIED_SUFFIX)?t("copy.toClipboard",{label:e.slice(0,-la.COPIED_SUFFIX.length)}):e}function jX(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 zC(e,t,n){const s=e.find(r=>r.key===n);if(s)return t==="user"?s.values.user:s.values.workspace}function rDt({onSessionIdChange:e,onSessionCreated:t,theme:n,onThemeChange:s,language:r,onLanguageChange:i,className:o,style:l,shadowDom:c,onConnectionChange:u,onStreamingStateChange:d,onError:f,onBugReport:m,hiddenSlashCommands:p,slashCommandCategoryOrder:g,onSlashCommand:b,builtinAtProviders:w,atProviders:y,composerTagIcons:v,renderToolHeaderExtra:x,renderWelcomeHeader:k,renderWelcomeFooter:_,mobileWelcomeFooterMiddle:T=!1,parseUserMessageContent:S,renderUserMessageContent:C,renderComposerTag:N,renderComposerTagTooltip:E,onComposerTagClick:O,renderAssistantTurnFooter:B,renderComposerToolbarStart:D,renderComposerToolbarEnd:j,renderComposerToolbarRight:L,renderComposerHeader:z,renderComposerFooter:I,renderChatHeader:$,renderFooter:K,bottomStatusItems:R,chatMaxWidth:Y,sidebar:W,header:M,rightPanel:F,environmentPanel:J,splitSessionIds:V,onSplitSessionIdsChange:U,renderPaneHeaderActions:le,onRightPanelOpen:pe,messageTurnOutputs:fe,shellRef:Q,composerToolbarActions:ne,composerPlaceholders:de,compactThinking:ue=!1,collapseCompletedTurns:me=!0,markdownTableMode:te="basic",virtualScrollThreshold:ae,markdown:be,loadingPhrases:se,onTranscriptChange:ve,onToast:ze,composerRef:Pe,onComposerReady:_t,composerInput:Pt,composerInputVersion:St,onSessionChange:he,onSubmitBefore:Ae,restartSseOnPrompt:rt,historyPageSize:dt,initialSelectedWorkspaceCwd:jt,lockedWorkspaceCwd:et,lockedWorkspaceCapability:Mt}={}){var oB,aB,lB,cB,uB,dB,hB,fB,mB,pB,gB,bB,yB,vB,wB,xB,kB,_B,SB,CB,TB,EB,AB,jB,NB,IB;const[sn,Ye]=h.useState(O9t),[$n,Te]=h.useState(()=>r===void 0?F9t():jf(r)),ie=h.useMemo(()=>hD($n),[$n]),it=h.useMemo(()=>jjt(c),[c]),we=h.useMemo(()=>L9t(W),[W]),We=(M==null?void 0:M.items)??I9t,ce=We.length>0&&!!(M||$),De=We.includes("title"),ct=We.includes("environment"),qe=We.includes("rightPanel"),Ve=(F==null?void 0:F.items)??M9t,Qt=(J==null?void 0:J.items)??R9t,Un=ce&&ct&&(!$||!!M),Ie=Un&&Qt.includes("environment"),wt=Un&&Qt.includes("backgroundTasks"),[Wt,Me]=h.useState(()=>P9t(we.defaultCollapsed)),[Je,pt]=h.useState(null),[ln,Bn]=h.useState(!1),[ns,lt]=h.useState(!1),Xe=h.useCallback(()=>{Bn(!1),lt(!1)},[]),ot=yN(),Tt=yN("(min-width: 1001px)"),fn=yN("(min-width: 1200px)");h.useEffect(()=>{we.enabled||Xe()},[Xe,we.enabled]),h.useEffect(()=>{const A=window.matchMedia("(max-width: 760px)"),q=G=>{G.matches||Xe()};return A.addEventListener("change",q),()=>A.removeEventListener("change",q)},[Xe]),h.useEffect(()=>{if(!ln)return;const A=re=>{if(re.key!=="Escape"||I1.current)return;const ke=re.target;s1(ke)&&!(ke!=null&&ke.closest("[data-sidebar-shell]"))||(re.stopPropagation(),re.preventDefault(),Xe())},q=document.body.style.overflow;document.body.style.overflow="hidden";const G=re=>{const ke=re.target;ke!=null&&ke.closest("[data-sidebar-shell]")&&!ke.closest(`.${Lt.mobileBackdrop}`)||re.preventDefault()};return document.addEventListener("touchmove",G,{passive:!1}),window.addEventListener("keydown",A,!0),()=>{document.body.style.overflow=q,document.removeEventListener("touchmove",G),window.removeEventListener("keydown",A,!0)}},[ln,Xe]);const Qn=h.useCallback(A=>{Me(A),kX(A)},[]);h.useEffect(()=>{if(!we.enabled)return;const A=q=>{if(!NRt(q))return;const G=q.target;if(s1(G)&&!(G!=null&&G.closest("[data-web-shell-composer-editor]")))return;if(q.preventDefault(),ns||window.matchMedia("(max-width: 760px)").matches){ln?(Bn(!1),lt(!1)):Bn(!0);return}const re=!Wt;Me(re),kX(re)};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[we.enabled,ln,ns,Wt]);const Os=h.useMemo(()=>({composerTagIcons:v,renderToolHeaderExtra:x,renderWelcomeHeader:k,renderWelcomeFooter:_,parseUserMessageContent:S,renderUserMessageContent:C,renderComposerTag:N,renderComposerTagTooltip:E,onComposerTagClick:O,renderAssistantTurnFooter:B,renderComposerToolbarStart:D,renderComposerToolbarEnd:j,renderComposerToolbarRight:L,renderComposerHeader:z,renderComposerFooter:I,renderFooter:K,compactThinking:ue,collapseCompletedTurns:me,markdownTableMode:te,markdown:be,loadingPhrases:se}),[v,x,k,_,S,C,N,E,O,B,D,j,L,z,I,K,ue,me,te,be,se]),rr=K,Es=z,cs=I,$t=gv(),xs=Efe(),Ce=za(),mn=tD(),gt=Co(),wn=gt.refreshCapabilities,Wn=h.useMemo(()=>{var q;const A=((q=gt.capabilities)==null?void 0:q.workspaces)??[];return Mt&&!A.some(G=>G.cwd===Mt.cwd)?[...A,Mt]:A},[Mt,(oB=gt.capabilities)==null?void 0:oB.workspaces]),di=h.useRef(void 0),$s=et?void 0:Wn.map(A=>({id:A.id,cwd:A.cwd,label:nE(A),primary:A.primary,trusted:A.trusted})),Gr=di.current;((Gr==null?void 0:Gr.length)!==($s==null?void 0:$s.length)||Gr!=null&&Gr.some((A,q)=>{const G=$s==null?void 0:$s[q];return!G||A.id!==G.id||A.cwd!==G.cwd||A.label!==G.label||A.primary!==G.primary||A.trusted!==G.trusted}))&&(di.current=$s);const Gs=di.current,Ks=h.useRef(Wn);Ks.current=Wn;const Qr=h.useMemo(()=>et?Wn.filter(A=>A.cwd===et):Wn,[et,Wn]),Rt=rm(),Ii=h.useCallback(async A=>{Ce.sessionId&&await Rt.reloadSession(A)},[Ce.sessionId,Rt]),uo=((aB=Ce.capabilities)==null?void 0:aB.features.includes(Lee))===!0,Or=((lB=Ce.capabilities)==null?void 0:lB.features.includes(Pee))===!0,{notices:hi,dismissNotice:us}=zwe(),Jt=Qo(),Ys=((uB=(cB=gt.capabilities)==null?void 0:cB.features)==null?void 0:uB.includes("dynamic_workspace_registration"))===!0,Bs=((hB=(dB=gt.capabilities)==null?void 0:dB.features)==null?void 0:hB.includes("persistent_workspace_registration"))===!0,ho=((mB=(fB=gt.capabilities)==null?void 0:fB.features)==null?void 0:mB.includes("scratch_workspace_registration"))===!0,Si=((gB=(pB=gt.capabilities)==null?void 0:pB.features)==null?void 0:gB.includes("workspace_display_name"))===!0,si=((yB=(bB=gt.capabilities)==null?void 0:bB.features)==null?void 0:yB.includes("workspace_github_prs"))===!0,[pr,xe]=h.useState(!1),[Ge,tt]=h.useState(!1),Zt=h.useRef(null),Tn=h.useRef(null),Gn=h.useRef(0),Jr=h.useRef("clear"),zs=h.useRef(void 0),[vs,$r]=h.useState("clear"),Xs=h.useCallback(A=>{Jr.current=A,$r(A)},[]),[fs,ks]=h.useState(jt),gr=h.useRef(fs);gr.current=fs;const[Vt,Sr]=h.useState(void 0);h.useEffect(()=>{if(!gt.capabilities||!fs)return;const A=Wn.find(q=>q.cwd===fs);A!=null&&A.trusted||(Gn.current+=1,gr.current=void 0,ks(void 0))},[fs,gt.capabilities,Wn]);const ir=h.useRef(void 0),[Ot,Ns]=h.useState(void 0),[Qs,Cr]=h.useState(void 0),[$e,ut]=h.useState(void 0),Ht=h.useRef(void 0);h.useEffect(()=>{const A=Ce.sessionId,q=Ht.current;if(Ht.current=A,!A){Ns(void 0),Cr(void 0),ut(void 0);return}q!==A&&(Ns(void 0),Cr(void 0),ut(void 0)),!(Ce.status!=="connected"||Ce.loadingTranscript||Ce.catchingUp)&&gt.client.sessionStatus(A).then(G=>(Ht.current===A&&(Ns(G.worktree),Cr(G.branch),ut(G.displayName)),gt.client.listWorkspaceSessions(G.workspaceCwd,{pageSize:200}).then(re=>{if(Ht.current!==A)return;const ke=re.find(Ne=>Ne.sessionId===A);ut((ke==null?void 0:ke.displayName)??G.displayName)}).catch(()=>{}))).catch(()=>{Ht.current===A&&(Ns(void 0),Cr(void 0),ut(void 0))})},[Ce.catchingUp,Ce.loadingTranscript,Ce.sessionId,Ce.status,gt.client]);const pn=h.useMemo(()=>{var A;return Ce.sessionId?Ce.workspaceCwd:et??fs??((A=Wn.find(q=>q.primary))==null?void 0:A.cwd)},[Ce.sessionId,Ce.workspaceCwd,et,fs,Wn]);h.useEffect(()=>{if(!pn){ir.current=void 0,Sr(void 0);return}const A=(Ot==null?void 0:Ot.path)??pn;ir.current!==A&&(ir.current=A,Sr(void 0));let q=!1;const G=()=>{const Ne=gt.client.workspaceByCwd(pn);Ne.workspaceGit({cwd:Ot==null?void 0:Ot.path}).then(at=>{q||Sr(At=>jX(At,at)?At:at)}).catch(()=>{q||Sr(void 0)}),Ot||Ne.workspaceGit({wait:!0}).then(at=>{q||Sr(At=>jX(At,at)?At:at)}).catch(at=>{console.warn("[web-shell] git status fresh path failed:",at)})};G();const re=()=>G();window.addEventListener("focus",re);const ke=window.setInterval(()=>{document.visibilityState==="visible"&&G()},3e4);return()=>{q=!0,window.removeEventListener("focus",re),window.clearInterval(ke)}},[pn,Ce.gitBranch,gt.client,Ot]),h.useEffect(()=>{const A=Ce.gitStatus;!A||Ot||A.workspaceCwd===pn&&Sr(A)},[Ce.gitStatus,pn,Ot]);const an=h.useRef(ze);an.current=ze;const Be=h.useRef(0),[cn,Jn]=h.useState([]),Us=h.useCallback(A=>{Jn(q=>q.filter(G=>G.id!==A))},[]),dn=h.useCallback((A,q)=>{if(an.current){an.current(A,q);return}const G={id:`web-shell-toast-${Date.now()}-${++Be.current}`,tone:A,message:q};Jn(re=>[...re.filter(Ne=>Ne.tone!==A||Ne.message!==q),G].slice(-4))},[]),hn=bO(ie,xs),Tr=h.useRef(hn);Tr.current=hn;const[br,Lo]=h.useState(null),Js=h.useRef(br),[Er,To]=h.useState(null),Kr=h.useCallback(A=>{Js.current=A,Lo(A)},[]),[ga,ri]=h.useState(null),[Zr,_s]=h.useState(null),Po=h.useRef(1),Mi=h.useRef(1),Ri=h.useRef(null),Ql=h.useRef(null),kc=h.useRef(null),[Fa,Rr]=h.useState(null),fo=h.useRef(Ce.sessionId),Zo=h.useRef(void 0),Jl=h.useRef(void 0),cl=h.useRef(void 0),X=h.useRef(Ce.sessionId),ge=h.useMemo(()=>{const A=[ga].filter(G=>G!==null);if(A.length===0)return pX(hn);const q=[...hn];for(const G of A.sort((re,ke)=>re.anchorIndex-ke.anchorIndex)){const re=G.anchorAfterId?q.findIndex(Ne=>Ne.id===G.anchorAfterId):-1,ke=re>=0?re+1:Math.min(G.anchorIndex,q.length);q.splice(ke,0,G.message)}return pX(q)},[hn,ga]);h.useEffect(()=>{const A=Js.current;if(!A)return;const q=ge.findIndex(G=>G.id===A.messageId);(A.sessionId!==Ce.sessionId||q<0||ge.slice(q+1).some(G=>G.role==="user"))&&Kr(null)},[Ce.sessionId,ge,br,Kr]);const{artifacts:Le,loading:Ze,error:Bt}=yO(),[Et,In]=h.useState([]),[ms,as]=h.useState(()=>new Map),[ps,En]=h.useState([]),Ln=h.useRef(ps);Ln.current=ps,h.useEffect(()=>{if(Et.length===0||Le.length===0)return;const A=new Set(Le.map(G=>G.id)),q=new Set(ps.filter(G=>G.kind==="artifact"&&G.workspaceActions).map(G=>G.kind==="artifact"?G.artifactId:""));In(G=>{const re=G.filter(ke=>!A.has(ke.id)||q.has(ke.id));return re.length===G.length?G:re})},[Le,Et.length,ps]);const gs=h.useMemo(()=>Array.from(ms.values()).flatMap(A=>[...A.artifacts]),[ms]),jl=h.useMemo(()=>{if(Et.length===0&&gs.length===0)return Le;const A=[...Le];for(const q of[...Et,...gs])A.findIndex(re=>re.id===q.id)<0&&A.push(q);return A},[Le,Et,gs]),Zs=h.useCallback((A,q,G)=>{as(ke=>{const Ne=ke.get(A);if((Ne==null?void 0:Ne.workspaceActions)===G&&Ne.artifacts.length===q.length&&Ne.artifacts.every((Gt,bt)=>{const kt=q[bt];return(kt==null?void 0:kt.id)===Gt.id&&kt.updatedAt===Gt.updatedAt&&kt.sizeBytes===Gt.sizeBytes}))return ke;const At=new Map(ke);return q.length===0?At.delete(A):At.set(A,{artifacts:[...q],workspaceActions:G}),At});const re=new Set(q.map(ke=>ke.id));En(ke=>{let Ne=!1;const at=ke.map(At=>{if(At.kind!=="artifact"||!re.has(At.artifactId))return At;const Gt={id:At.id,kind:"artifact",title:At.title,artifactId:At.artifactId,workspaceActions:At.workspaceActions??G};return At.previewContent!==void 0&&(Ne=!0),At.workspaceActions||(Ne=!0),Gt});return Ne?at:ke})},[]),mo=h.useMemo(()=>vO(ge,Le,Ce.workspaceCwd||""),[ge,Le,Ce.workspaceCwd]),ba=h.useMemo(()=>wO(ge,mo,Ce.workspaceCwd||""),[ge,mo,Ce.workspaceCwd]),po=h.useMemo(()=>{let A=[];for(const q of ba.values())q.length>0&&(A=q);return A},[ba]),er=h.useMemo(()=>Gfe(ge),[ge]),Gi=h.useMemo(()=>new Set(fe??Bhe),[fe]),[Ar,fi]=h.useState(!1),[ou,Ci]=h.useState(!1),xt=h.useRef(!1);h.useLayoutEffect(()=>{xt.current=!1,Ci(!1)},[Ce.sessionId]);const vn=h.useRef(Ar);vn.current=Ar;const[Xn,xn]=h.useState(null),Zn=h.useRef(Xn);Zn.current=Xn;const[bs,Is]=h.useState([]),[go,Nl]=h.useState(null),[ya,qa]=h.useState(jN),au=h.useRef(null),iS=h.useRef(null),mm=h.useRef(new Map),oS=h.useRef(Ce.sessionId);iS.current={open:Ar,tabs:ps,activeTabId:Xn,reviewChanges:bs,selectedReviewPath:go,extraArtifacts:Et,width:ya},h.useEffect(()=>{const A=oS.current;if(A){const re=iS.current;if(re&&(mm.current.set(A,re),mm.current.size>k9t)){const ke=mm.current.keys().next().value;ke&&mm.current.delete(ke)}}const q=Ce.sessionId;oS.current=q;const G=q?mm.current.get(q):void 0;if(!G){fi(!1),En([]),xn(null),Is([]),Nl(null),In([]),as(new Map),qa(jN);return}fi(G.open),En(G.tabs),xn(G.activeTabId),Is(G.reviewChanges),Nl(G.selectedReviewPath),In(G.extraArtifacts),as(new Map),qa(G.width)},[Ce.sessionId]);const Zl=!!(Ce.sessionId&&Ce.workspaceCwd)&&((vB=Ce.capabilities)==null?void 0:vB.features.includes(dSe))===!0,[Ph,Oh]=h.useState({items:[],loaded:!1}),_0=h.useRef(new Set),Bv=Ph.parentSessionId===Ce.sessionId?Ph.items:[],C1=Bv.length===0&&(Ph.parentSessionId!==Ce.sessionId||!Ph.loaded),S0=h.useRef(0),$h=h.useCallback(A=>{const q=Ce.sessionId;if(!q||!Zl)return!1;const G={id:`side-task:draft:${Date.now()}:${++S0.current}`,kind:"side_task",title:ie("sideTask.title"),parentSessionId:q,workspaceCwd:Ce.workspaceCwd,nameFromFirstPrompt:!0,...A!=null&&A.trim()?{initialPrompt:A.trim()}:{}};return En(re=>[...re,G]),xn(G.id),fi(!0),!0},[Ce.sessionId,Ce.workspaceCwd,Zl,ie]),zv=h.useCallback(()=>{$h()||dn("error",ie("sideTask.createFailed"))},[$h,dn,ie]),Fv=h.useCallback(async(A,q,G)=>{const re=Ce.sessionId===q?Ce.clientId:void 0,ke=await gt.client.createSideTaskSession(q,{name:G},re);return await gt.client.detachSession(ke.sessionId,ke.clientId).catch(()=>{}),{sessionId:ke.sessionId,displayName:ke.displayName}},[Ce.clientId,Ce.sessionId,gt.client]),aS=h.useCallback((A,q)=>{let G=Ln.current.find(ke=>ke.id===A);if(En(ke=>ke.map(Ne=>Ne.id===A&&Ne.kind==="side_task"?{...Ne,sessionId:q}:Ne)),!G)for(const ke of mm.current.values()){const Ne=ke.tabs.find(at=>at.id===A);if(Ne){G=Ne,ke.tabs=ke.tabs.map(at=>at.id===A&&at.kind==="side_task"?{...at,sessionId:q}:at);break}}const re=(G==null?void 0:G.kind)==="side_task"?G:void 0;re&&(_0.current.add(q),Oh(ke=>ke.parentSessionId!==re.parentSessionId||ke.items.some(Ne=>Ne.sessionId===q)?ke:{...ke,items:[...ke.items,{sessionId:q,title:re.title,workspaceCwd:re.workspaceCwd,updatedAt:new Date().toISOString()}]}))},[]),Bh=h.useCallback((A,q,G=!1)=>{const re=Ln.current.find(Ne=>Ne.id===A&&Ne.kind==="side_task"),ke=(re==null?void 0:re.kind)==="side_task"?re.sessionId:void 0;En(Ne=>Ne.map(at=>at.id!==A||at.kind!=="side_task"||!G&&at.title===q?at:{...at,title:q,...G?{nameFromFirstPrompt:!1,initialPrompt:void 0}:{}})),ke&&Oh(Ne=>({...Ne,items:Ne.items.map(at=>at.sessionId===ke?{...at,title:q}:at)}))},[]),zh=h.useCallback(A=>{const q=Ce.sessionId;if(!q)return;const G={id:`side-task:${A.sessionId}`,kind:"side_task",title:A.title,sessionId:A.sessionId,parentSessionId:q,workspaceCwd:A.workspaceCwd??Ce.workspaceCwd};En(ke=>ke.some(Ne=>Ne.kind==="side_task"&&Ne.sessionId===A.sessionId)?ke:[...ke,G]);const re=Ln.current.find(ke=>ke.kind==="side_task"&&ke.sessionId===A.sessionId);xn((re==null?void 0:re.id)??G.id),fi(!0)},[Ce.sessionId,Ce.workspaceCwd]);h.useEffect(()=>{const A=Ce.sessionId,q=Ce.workspaceCwd;if(!Zl||!A||!q){Oh({items:[],loaded:!1});return}if(!Ar)return;Oh(re=>re.parentSessionId===A?{...re,loaded:!1}:{parentSessionId:A,items:[],loaded:!1});let G=!1;return gt.client.listWorkspaceSessions(q,{pageSize:nh,archiveState:"active",sourceType:hSe,sourceId:A}).then(re=>{if(G)return;const ke=re.map(Ne=>{var at;return{sessionId:Ne.sessionId,title:((at=Ne.displayName)==null?void 0:at.trim())||`${ie("sideTask.title")} ${Ne.sessionId.slice(0,8)}`,workspaceCwd:Ne.workspaceCwd||q,updatedAt:Ne.updatedAt||Ne.createdAt}});for(const Ne of ke)_0.current.delete(Ne.sessionId);Oh(Ne=>Q9t(Ne,A,ke,_0.current))}).catch(()=>{G||Oh(re=>re.parentSessionId===A?{...re,loaded:!0}:re)}),()=>{G=!0}},[Ce.sessionId,Ce.workspaceCwd,Ar,Zl,ie,gt.client]);const T1=h.useCallback(()=>{var q;const A=(q=Ql.current)==null?void 0:q.getBoundingClientRect().width;return A?Math.max(gb,ya+A-BC):Math.max(gb,window.innerWidth-BC)},[ya]),va=h.useCallback(()=>{var G;const A=((G=Ql.current)==null?void 0:G.getBoundingClientRect().width)??window.innerWidth,q=Math.max(gb,A-BC);return Math.min(q,Math.max(jN,Math.round(A*.56)))},[]),lE=h.useCallback((A,q)=>{if(!A)return;const G=jl.find(ke=>ke.id===A),re={id:`artifact:${A}`,kind:"artifact",artifactId:A,title:(G==null?void 0:G.title)??"Artifact",...q!==void 0?{previewContent:q}:{}};En(ke=>ke.some(Ne=>Ne.id===re.id)?ke.map(Ne=>Ne.id===re.id?{...Ne,...re}:Ne):[...ke,re]),xn(re.id),qa(ke=>vn.current?ke:va()),fi(!0)},[jl,va]),C0=h.useCallback((A,q,G,re,ke="review")=>{const Ne={id:ke,kind:"review",title:ie("turnOutputs.review"),changes:A,...q?{selectedPath:q}:{},...G?{workspaceActions:G}:{},...re?{workspaceCwd:re}:{}};En(at=>at.some(At=>At.id===Ne.id)?at.map(At=>At.id===Ne.id?Ne:At):[Ne,...at]),xn(Ne.id),Is(A),Nl(q??null),qa(at=>vn.current?at:va()),fi(!0)},[va,ie]),E1=h.useCallback(()=>{po.length!==0&&C0(po)},[po,C0]),A1=h.useCallback((A,q,G)=>{const re={id:G?`scheduled-task:${G}:${A.toolCallId}`:`scheduled-task:${A.toolCallId}`,kind:"scheduled_task",title:ie("scheduledTasks.title"),task:A,...q?{workspaceActions:q}:{}};En(ke=>ke.some(Ne=>Ne.id===re.id)?ke.map(Ne=>Ne.id===re.id?re:Ne):[...ke,re]),xn(re.id),qa(ke=>vn.current?ke:va()),fi(!0)},[va,ie]),T0=h.useCallback((A,q,G)=>{const re={id:q?`monitor:${q}:${A.id}`:`monitor:${A.id}`,kind:"monitor",title:A.description,task:A,...q?{sessionId:q}:{},...G?{sessionActions:G}:{}};En(ke=>ke.some(Ne=>Ne.id===re.id)?ke.map(Ne=>{if(Ne.id!==re.id||Ne.kind!=="monitor")return Ne;const at=CX(Ne.task,A);return{...re,title:at.description,task:at}}):[...ke,re]),xn(re.id),qa(ke=>vn.current?ke:va()),fi(!0)},[va]),j1=h.useCallback((A,q,G)=>{const re={id:q?`shell:${q}:${A.id}`:`shell:${A.id}`,kind:"shell",title:A.command,task:A,...q?{sessionId:q}:{},...G?{sessionActions:G}:{}};En(ke=>ke.some(Ne=>Ne.id===re.id)?ke.map(Ne=>{if(Ne.id!==re.id||Ne.kind!=="shell")return Ne;const at=TX(Ne.task,A);return{...re,title:at.command,task:at}}):[...ke,re]),xn(re.id),qa(ke=>vn.current?ke:va()),fi(!0)},[va]),pm=h.useCallback((A,q,G)=>{var at;const re=A.rawOutput&&typeof A.rawOutput=="object"?A.rawOutput:void 0,ke=(typeof((at=A.args)==null?void 0:at.subagent_type)=="string"?A.args.subagent_type:void 0)??(typeof(re==null?void 0:re.subagentName)=="string"?re.subagentName:void 0),Ne={id:`subagent:${q}:${A.callId}`,kind:"subagent",title:A.title||ke||ie("agent.label"),sessionId:q,rootToolCallId:A.callId,rootTool:A,...G?{workspaceCwd:G}:{}};En(At=>At.some(Gt=>Gt.id===Ne.id)?At.map(Gt=>Gt.id===Ne.id?Ne:Gt):[...At,Ne]),xn(Ne.id),qa(At=>vn.current?At:va()),fi(!0)},[va,ie]),N1=h.useCallback(A=>{Ce.sessionId&&pm(A,Ce.sessionId,Ce.workspaceCwd)},[Ce.sessionId,Ce.workspaceCwd,pm]),qv=h.useCallback(A=>{if(!Ce.sessionId)return;vn.current||(xt.current=!0);const q=A.toolUseId?tDt(hn,A.toolUseId):void 0;pm(q??Z9t(A),Ce.sessionId,Ce.workspaceCwd)},[Ce.sessionId,Ce.workspaceCwd,hn,pm]),E0=h.useCallback(A=>{if(pe){pe(A);return}if(A.kind==="review"){C0(A.changes,A.selectedPath,A.workspaceActions,A.workspaceCwd,A.sourceSessionId?`review:${A.sourceSessionId}:${A.turnId}`:void 0);return}if(A.kind==="scheduled_task"){A1(A.task,A.workspaceActions,A.sourceSessionId);return}if(A.kind==="subagent"){pm(A.tool,A.sessionId,A.workspaceCwd);return}(!A.workspaceActions||A.sourceSessionId)&&In(G=>{const re=G.findIndex(Ne=>Ne.id===A.artifact.id);if(re<0)return[...G,A.artifact];const ke=[...G];return ke[re]=A.artifact,ke});const q={id:A.sourceSessionId?`${A.sourceSessionId}:${A.id}`:A.id,kind:"artifact",title:A.title,artifactId:A.artifactId,...A.workspaceActions?{workspaceActions:A.workspaceActions}:{},...A.previewContent!==void 0?{previewContent:A.previewContent}:{}};En(G=>G.some(re=>re.id===q.id)?G.map(re=>re.id===q.id?{...re,...q}:re):[...G,q]),xn(q.id),qa(G=>vn.current?G:va()),fi(!0)},[va,pe,C0,A1,pm]),lS=h.useCallback((A,q,G)=>{const re=zhe(A),ke={id:`file:${G??""}:${A.path}`,kind:"file",title:J6(A.path,G),workspacePath:A.path,workspaceActions:q,...re!==void 0?{previewContent:re}:{}};En(Ne=>Ne.some(at=>at.id===ke.id)?Ne.map(at=>at.id===ke.id?ke:at):[...Ne,ke]),xn(ke.id)},[]),A0=h.useCallback(()=>{fi(!1),Oh(A=>A.items.length===0?{...A,loaded:!1}:A)},[]);h.useLayoutEffect(()=>{if(!Ar)return;const A=()=>{qa(re=>{var at;const ke=((at=Ql.current)==null?void 0:at.getBoundingClientRect().width)??window.innerWidth-re,Ne=Math.max(gb,re+ke-BC);return Math.min(re,Ne)})};A(),window.addEventListener("resize",A);const q=Ql.current,G=new ResizeObserver(A);return q&&G.observe(q),()=>{window.removeEventListener("resize",A),G.disconnect()}},[Ar]);const Yu=h.useCallback(A=>{En(q=>{const G=q.filter(re=>re.id!==A);if(G.length===0)return fi(!1),xn(null),Is([]),Nl(null),In([]),as(new Map),G;if(Zn.current===A){const re=q.findIndex(Ne=>Ne.id===A),ke=G[Math.min(re,G.length-1)]??G[0];xn(ke.id)}return G})},[]),cE=h.useCallback(A=>{A.preventDefault();const q=A.currentTarget;q.setPointerCapture(A.pointerId);const G=A.clientX,re=ya,ke=T1(),Ne=document.body.style.cursor,at=document.body.style.userSelect;let At=re,Gt=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const bt=()=>{Gt=null,qa(At)},kt=Br=>{At=Math.min(ke,Math.max(gb,re-(Br.clientX-G))),Gt===null&&(Gt=window.requestAnimationFrame(bt))};let Mn=()=>{};const rs=Br=>{au.current=null,Gt!==null&&(window.cancelAnimationFrame(Gt),Gt=null),Br&&qa(At),q.hasPointerCapture(A.pointerId)&&q.releasePointerCapture(A.pointerId),document.body.style.cursor=Ne,document.body.style.userSelect=at,window.removeEventListener("pointermove",kt),window.removeEventListener("pointerup",Mn),window.removeEventListener("pointercancel",Mn)};Mn=()=>rs(!0),au.current=()=>rs(!1),window.addEventListener("pointermove",kt),window.addEventListener("pointerup",Mn),window.addEventListener("pointercancel",Mn)},[ya,T1]);h.useEffect(()=>()=>{var A;return(A=au.current)==null?void 0:A.call(au)},[]);const uE=h.useMemo(()=>K7(xs),[xs]),Ha=LRt(uE),j0=!(Ce.catchingUp&&Je!==null),N0=AR(Ha)&&j0?Ha:null,gm=Ha&&!AR(Ha)&&j0?Ha:null,I1=h.useRef(Ha);I1.current=j0?Ha:null;const wa=gm!==null||N0!==null,Hv=h.useRef(wa);Hv.current=wa||j0&&K7(xs)!==null;const I0=h.useMemo(()=>$st(hn),[hn]),cS=h.useMemo(()=>fhe(hn),[hn]),Uv=h.useRef(null),uS=h.useMemo(()=>{const A=Fst(hn),q=Uv.current;if(q&&q.signature===A)return q.timeline;const G=zst(hn);return Uv.current={signature:A,timeline:G},G},[hn]),Wv=h.useRef(null),dS=h.useMemo(()=>{const A=qst(hn),q=Wv.current;if(q&&q.signature===A)return q.details;const G=Kst(hn);return Wv.current={signature:A,details:G},G},[hn]),M0=PRt(I0.todos,A=>JSON.stringify([A.id,A.status,A.content,A.blockedBy??[]])),hS=I0.allCompleted,[fS,mS]=h.useState("hidden"),M1=Ce.catchingUp||M0.length===0||hS?"hidden":"active";M1!==fS&&mS(M1);const bm=M1!=="hidden",Vv=R??N9t,R0=bm||Vv.length>0,ym=h.useRef(null),Gv=h.useRef(null),[lu,Z]=h.useState(null),Re=h.useRef(new Set),Ue=h.useRef(null),[Qe,Ct]=h.useState(0),[zn,qn]=h.useState(0);h.useLayoutEffect(()=>{if(!R0){Ct(0),qn(0);return}const A=Ue.current;if(!A){Ct(xX),qn(0);return}const q=()=>{const re=ym.current,ke=A.getBoundingClientRect(),Ne=re==null?void 0:re.getBoundingClientRect(),at=Math.ceil(ke.height),At=Ne?Math.max(0,Ne.top-ke.top):at+wX;qn(at),Ct(Math.max(xX,Math.ceil(At)))};if(q(),typeof ResizeObserver>"u")return;const G=new ResizeObserver(q);return G.observe(A),ym.current&&G.observe(ym.current),()=>G.disconnect()},[R0]);const As=h.useMemo(()=>({"--web-shell-bottom-panel-inset":`${Qe}px`,"--web-shell-bottom-panel-height":`${zn}px`,"--web-shell-bottom-panel-gap":`${wX}px`}),[zn,Qe]),ys=h.useMemo(()=>X9t(hn),[hn]),[_c,ul]=h.useState(0),ii=RRt(Ce.sessionId,ys,Ce.status==="connected",_c),R1=h.useMemo(()=>eDt(hn,ii),[hn,ii]),Sc=h.useMemo(()=>ii.filter(A=>A.kind!=="agent"),[ii]),xa=h.useRef(Ce.sessionId);xa.current=Ce.sessionId;const Xu=h.useCallback(async A=>{const q=xa.current;if(!q)return!1;try{const G=await Rt.getTasks();if(xa.current!==q||G.sessionId!==q)return!1;const re=Ghe(G.tasks,A);return re?(ul(ke=>ke+1),T0(re),!0):!1}catch{return!1}},[T0,Rt]);h.useEffect(()=>{const A=new Map(Sc.filter(q=>q.kind==="monitor").map(q=>[q.id,q]));A.size!==0&&En(q=>{let G=!1;const re=q.map(ke=>{if(ke.kind!=="monitor"||ke.sessionId&&ke.sessionId!==Ce.sessionId)return ke;const Ne=A.get(ke.task.id);if(!Ne||Ne===ke.task)return ke;const at=CX(ke.task,Ne);return at===ke.task?ke:(G=!0,{...ke,title:at.description,task:at})});return G?re:q})},[Sc,Ce.sessionId]),h.useEffect(()=>{const A=new Map(Sc.filter(q=>q.kind==="shell").map(q=>[q.id,q]));A.size!==0&&En(q=>{let G=!1;const re=q.map(ke=>{if(ke.kind!=="shell"||ke.sessionId&&ke.sessionId!==Ce.sessionId)return ke;const Ne=A.get(ke.task.id);if(!Ne||Ne===ke.task)return ke;const at=TX(ke.task,Ne);return at===ke.task?ke:(G=!0,{...ke,title:at.command,task:at})});return G?re:q})},[Sc,Ce.sessionId]);const Nd=h.useMemo(()=>K?Sc.map(nDt):[],[Sc,K]),D0=h.useRef(null),L0=h.useRef(null),mi=h.useRef(null),D1=h.useRef(null),[Kv,ei]=h.useState(!1),ea=h.useRef(null),Yv=h.useRef(!1),cu=h.useCallback((A="smooth")=>{requestAnimationFrame(()=>{var q;(q=L0.current)==null||q.scrollToBottom(A),requestAnimationFrame(()=>{var G;(G=L0.current)==null||G.scrollToBottom(A)})})},[]),pS=h.useCallback(A=>{mi.current=A,_X(Pe,A??vX),A&&D1.current!==A&&(D1.current=A,_t==null||_t(A))},[Pe,_t]);h.useEffect(()=>{_X(Pe,mi.current??vX)},[Pe]);const[L1,uu]=h.useState(null),[Zme,NO]=h.useState(!1),dE=h.useRef(!1),IO=h.useRef(null);IO.current=L1;const{followupState:epe,onAcceptFollowup:tpe,onDismissFollowup:npe,clear:MO}=xee({onAccept:A=>{var q;(q=mi.current)==null||q.insertText(A)}}),hE=h.useRef(""),[spe,rpe]=h.useState(null),[gS,Xv]=h.useState(!1),or=p5();h.useEffect(()=>{Er&&(Er.sessionId!==Ce.sessionId||or==="idle"&&Er.settled)&&To(null)},[Ce.sessionId,Er,or]);const fE=!!(Er&&Er.sessionId===Ce.sessionId&&(!Er.admitted||Er.settled)),P0=h.useRef(or),Qu=h.useRef([]),O0=h.useRef(0),bS=h.useRef(!1),Qv=h.useRef(!1),mE=h.useRef(Date.now()),RO=h.useRef(or);RO.current==="idle"&&or!=="idle"&&(mE.current=Date.now()),RO.current=or;const DO=h.useMemo(()=>{if(or!=="idle"){for(let A=ge.length-1;A>=0;A--){const q=ge[A];if((q==null?void 0:q.role)==="user")return q.timestamp??mE.current}return mE.current}},[ge,or]),P1=h.useRef(""),yS=h.useRef(void 0),Jv=h.useRef(null),Zv=h.useRef(null),[pE,vS]=h.useState(!1),gE=h.useRef(pE);gE.current=pE;const Fh=Ce.status==="connected",ka=Nh(),[ew,ipe]=h.useState([]),[bE,ope]=h.useState(!1),LO=h.useRef(0),wS=h.useCallback(async A=>{const q=++LO.current;try{const G=A&&gt.client?await gt.client.workspaceByCwd(A).workspaceSkills():await Jt.loadSkillsStatus();if(q!==LO.current)return;ipe(S9t(G)),ope(!0)}catch{return}},[gt.client,Jt]);h.useEffect(()=>{Fh&&wS(Ce.workspaceCwd)},[Fh,Ce.workspaceCwd,wS]);const[Ki,Ju]=h.useState(null),PO=h.useRef(Ki),[Cc,tw]=h.useState("workspace"),[vm,xS]=h.useState(!1),OO=h.useRef(vm),[ape,lpe]=h.useState([]),[O1,$1]=h.useState(!1),[$O,yE]=h.useState(!1),[BO,vE]=h.useState(!1),[zO,wE]=h.useState(!1),[FO,xE]=h.useState(!1),[qO,kE]=h.useState(!1),[HO,_E]=h.useState(!1),[UO,WO]=h.useState(!1),[wm,xm]=h.useState(void 0),[Fs,Eo]=h.useState("chat"),VO=h.useRef(Fs),GO=!Tt||Fs==="split",[qh,SE]=h.useState([]),CE=h.useRef(qh);CE.current=qh;const[kS,TE]=h.useState(null),[Vn,Hh]=h.useState(null),EE=h.useRef(Vn),Ao=h.useCallback(()=>Hh(null),[]),KO=h.useCallback(A=>{Ao(),window.setTimeout(()=>{var q,G;(q=mi.current)==null||q.setText(`/${A} `),(G=mi.current)==null||G.focus()},0)},[Ao]),dl=h.useCallback(A=>{Eo("chat"),Hh(A)},[]),cpe=h.useCallback(async()=>{const A=await Jt.loadMcpStatus();TE({status:A,toolsByServer:{},resourcesByServer:{},showDescriptions:!1,showSchema:!1,showTips:!1})},[Jt]),AE=h.useCallback(()=>{Hh(null),Eo("scheduledTasks")},[]),B1=h.useCallback(()=>{Hh(null),Eo("goals")},[]),YO=h.useCallback(()=>{we.enabled&&(Hh(null),Eo("chat"),lt(!0),Bn(!0))},[we.enabled]),$0=h.useCallback(A=>{Hh(null),SE(q=>{const G=Array.from(new Set((A??[]).filter(Boolean))).slice(0,Ep);return G.length>0?G:q.length>0?q:Ce.sessionId?[Ce.sessionId]:[]}),Eo("split")},[Ce.sessionId]),jE=h.useMemo(()=>Array.from(new Set((V??[]).filter(Boolean))).slice(0,Ep).join("\0"),[V]),hl=V!==void 0,Id=h.useRef(U);Id.current=U;const XO=h.useCallback(()=>{var q;if(!hl){$0();return}const A=qh.length>0?qh:Ce.sessionId?[Ce.sessionId]:[];(q=Id.current)==null||q.call(Id,A)},[Ce.sessionId,hl,$0,qh]);h.useEffect(()=>{if(!hl)return;const A=jE?jE.split("\0"):[];SE(q=>z9t(q,A)?q:A),A.length>0?(Hh(q=>q===null?q:null),Eo(q=>q==="split"?q:"split")):Eo(q=>q==="split"?"chat":q)},[hl,jE]);const upe=h.useCallback(A=>{var q;hl||SE(A),(q=Id.current)==null||q.call(Id,A)},[hl]),_S=h.useCallback(()=>{var A;hl&&((A=Id.current)==null||A.call(Id,[]))},[hl]),dpe=h.useCallback(()=>{_S(),Ckt(),dl("sessions")},[_S,dl]);h.useEffect(()=>{const A=kkt(window.location.search);if(A.length>0){const G=new URL(window.location.href);G.searchParams.delete("split"),window.history.replaceState(null,"",G),hl||$0(A);return}if(hl)return;const q=Skt();q.length>0&&$0(q)},[hl,$0]),h.useEffect(()=>{hl||Fs==="split"&&qh.length>0&&_kt(qh)},[Fs,qh,hl]);const NE=h.useRef(!1),IE=h.useRef(!1);h.useEffect(()=>{if(ot){IE.current&&(IE.current=!1,!hl&&CE.current.length>0&&Eo(A=>A==="chat"?"split":A));return}if(Vn==="sessions"&&Hh(null),Fs==="split"&&(_S(),Eo("chat"),NE.current=!0,!hl)){IE.current=!0;const A=CE.current[0];A&&!fo.current&&Rt.loadSession(A).catch(()=>{})}},[ot,Vn,Fs,_S,hl,Rt]),h.useEffect(()=>{var A;Fs!=="chat"||!NE.current||(NE.current=!1,!Vn&&!wa&&((A=mi.current)==null||A.focus()))},[Fs,Vn,wa]);const QO=h.useRef(null),SS=h.useRef(null),ME=h.useRef(null),JO=h.useRef(Vn),ZO=h.useRef(wa);h.useEffect(()=>{var G,re,ke,Ne,at;const A=JO.current,q=ZO.current;if(JO.current=Vn,ZO.current=wa,Vn){if(Vn==="extensions"||Vn==="channels"){(G=SS.current)==null||G.focus();return}if(Vn==="plugins"){(re=ME.current)==null||re.focus();return}(ke=QO.current)==null||ke.focus()}else A?wa||(Ne=mi.current)==null||Ne.focus():q&&!wa&&((at=mi.current)==null||at.focus())},[Vn,wa]),h.useEffect(()=>{wa&&(Vn&&Hh(null),Ki&&Ju(null),O1&&$1(!1),(Fs==="scheduledTasks"||Fs==="goals")&&Eo("chat"))},[wa,Vn,Ki,O1,Fs]);const hpe=gm!==null&&!Vn&&Ki===null&&!O1&&Fs==="chat",fpe=N0!==null&&!Vn&&Ki===null&&!O1&&Fs==="chat",[e$,t$]=h.useState(!1),[Uh,RE]=h.useState(!1),n$=h.useRef(Uh),[mpe,ppe]=h.useState(0),[gpe,bpe]=h.useState(0),[ype,s$]=h.useState(0),vpe=h.useCallback(()=>{let A=!1;return s$(q=>q+1),()=>{A||(A=!0,s$(q=>Math.max(0,q-1)))}},[]),r$=h.useRef((ka==null?void 0:ka.extensionsVersion)??0);h.useEffect(()=>{const A=(ka==null?void 0:ka.extensionsVersion)??0;if(A!==r$.current){r$.current=A;const q=ka==null?void 0:ka.lastExtensionChange;if((q==null?void 0:q.status)==="failed"){$t.dispatch([{type:"error",text:ie("extensions.action.failed",{name:q.name??"",source:q.source??"",error:q.error??ie("error.unknown")})}]);return}if((q==null?void 0:q.status)==="installed"){const G=q.name??q.source??ie("extensions.label");$t.dispatch([{type:"status",text:q.version?ie("extensions.install.installedWithVersion",{name:G,version:q.version}):ie("extensions.install.installed",{name:G})}])}else if(q!=null&&q.status){const G=q.name??q.source??ie("extensions.label"),re=q.status==="updated"&&q.version?"extensions.manage.updatedWithVersion":`extensions.manage.${q.status}`;$t.dispatch([{type:"status",text:ie(re,{name:G,version:q.version??""})}])}Rt.refreshCommands().catch(()=>{$t.dispatch([{type:"error",text:ie("extensions.commands.refreshFailed")}])})}},[ka==null?void 0:ka.extensionsVersion,ka==null?void 0:ka.lastExtensionChange,Rt,$t,ie]);const[wpe,xpe]=h.useState("workspace"),[kpe,nw]=h.useState(null),[_pe,i$]=h.useState(!1),[Spe,o$]=h.useState(!1),CS=h.useRef(null),z1=h.useRef(null),[sw,B0]=h.useState(null),Cpe=h.useMemo(()=>sw?Bst(hn,I0):[],[I0,hn,sw]),DE=h.useCallback(A=>{B0(null),ul(q=>q+1),T0(A)},[T0]),a$=h.useCallback(A=>{B0(null),ul(q=>q+1),j1(A)},[j1]),[Wh,LE]=h.useState(n??Fr.Dark),[Vh,l$]=h.useState(""),TS=h.useRef(Vh);TS.current=Vh;const F1=h.useCallback(A=>{TS.current=A,l$(A)},[]),es=h.useRef(Ce);es.current=Ce;const c$=h.useCallback(async()=>{var q;const A=es.current;if(!(!A.sessionId||!A.workspaceCwd))try{const G=await gt.client.listWorkspaceSessions(A.workspaceCwd,{pageSize:200});if(es.current.sessionId!==A.sessionId||es.current.displayName)return;const re=(q=G.find(ke=>ke.sessionId===A.sessionId))==null?void 0:q.displayName;re!=null&&re.trim()&&ut(re)}catch{}},[gt.client]),u$=h.useRef(c$);u$.current=c$;const ta=h.useCallback(()=>es.current.sessionId?!0:(dn("info",ie("localCommand.noSession")),!1),[dn,ie]),rw=Ce.displayName??$e,[Tc,PE]=h.useState("default"),OE=h.useRef(Tc);OE.current=Tc;const iw=h.useCallback(A=>{OE.current=A,PE(A)},[]),[$E,Gh]=h.useState(!1),ow=h.useRef(null),ES=h.useRef(null),[AS,aw]=h.useState({mode:"current"}),lw=h.useRef(AS);h.useEffect(()=>{lw.current=AS},[AS]);const d$=h.useRef(0),Md=h.useRef(null),h$=h.useRef(t);h$.current=t;const jS=h.useRef(void 0);h.useEffect(()=>{Fs!=="goals"&&(jS.current=void 0)},[Fs]);const NS=h.useCallback(()=>{const A=es.current.sessionId;if(ow.current)return!A||A===ES.current?ow.current:Promise.resolve(void 0);if(A)return Promise.resolve(void 0);const q=(async()=>{var bt,kt;let re;const ke=TS.current||es.current.currentModel,Ne=OE.current||es.current.currentMode,at=(bt=Wn.find(Mn=>Mn.primary))==null?void 0:bt.cwd,At=gr.current,Gt=At?(kt=Wn.find(Mn=>Mn.cwd===At&&Mn.trusted===!0))==null?void 0:kt.cwd:void 0;return await sSt({sessionActions:Rt,modelId:ke,modeId:Ne,workspaceCwd:et??Gt??at,worktree:lw.current.mode==="worktree"?{slug:lw.current.slug}:void 0,branch:lw.current.mode==="branch"?{name:lw.current.name}:void 0,onSessionCreated:h$.current,onSessionAllocated:Mn=>{ES.current=Mn,re=Mn},getCurrentSessionId:()=>es.current.sessionId}).then(Mn=>{Mn.worktree&&Ns(Mn.worktree),Mn.branch&&Cr(Mn.branch),aw({mode:"current"})}),ks(void 0),re})();ow.current=q;const G=()=>{ow.current===q&&(ow.current=null,ES.current=null)};return q.then(G,G),q},[et,Rt,Wn]),Kh=h.useRef(Ae);Kh.current=Ae;const f$=h.useRef(b);f$.current=b;const q1=h.useCallback(()=>{var A;return es.current.sessionId?es.current.workspaceCwd:et??gr.current??((A=Ks.current.find(q=>q.primary))==null?void 0:A.cwd)},[et]),[m$,p$]=h.useState(0),cw=h.useRef(null);h.useEffect(()=>()=>{cw.current!==null&&clearTimeout(cw.current)},[]);const H1=h.useCallback(()=>{cw.current!==null&&clearTimeout(cw.current),cw.current=setTimeout(()=>{p$(A=>A+1),u$.current()},2e3)},[]),g$=h.useCallback(A=>{he==null||he(A),p$(q=>q+1),A.type==="turn_complete"&&H1()},[he,H1]),na=h.useRef(g$);na.current=g$;const Ua=h.useCallback(async(A,q,G)=>{var Ca,Wa;const re=!A.trimStart().startsWith("/"),ke=P1.current,Ne=yS.current,at=Zv.current,At=gE.current,Gt=()=>{Gh(!1),P1.current=ke,yS.current=Ne,Zv.current=at,vS(At)};!(G!=null&&G.retry)&&re&&(P1.current=A,yS.current=q,Zv.current=null),vS(!1);const bt=!es.current.sessionId;if(Kh.current){const Yi=es.current.sessionId,Va=q1(),Ga=Gn.current;Gh(!0);try{await Kh.current({sessionId:Yi,prompt:A})}catch(Ka){console.warn("[web-shell] onSubmitBefore rejected, prompt cancelled",Ka),Gt();return}if(es.current.sessionId!==Yi||q1()!==Va||Gn.current!==Ga){Gt();return}bt||Gh(!1)}!Kh.current&&bt&&Gh(!0),MO();let kt;try{kt=await NS()}finally{bt&&Gh(!1)}const Mn={images:q,inputAnnotations:G==null?void 0:G.inputAnnotations,optimisticUserMessage:G==null?void 0:G.optimisticUserMessage,retry:G==null?void 0:G.retry,...G!=null&&G.onAdmitted?{onAdmitted:G.onAdmitted}:{}};G!=null&&G.commitComposerAccepted?G.commitComposerAccepted():G!=null&&G.clearComposerOnPromptStart&&((Ca=mi.current)==null||Ca.clear());const rs=es.current.sessionId??kt;rs&&A.trim()&&((Wa=na.current)==null||Wa.call(na,{type:"submit",sessionId:rs,prompt:A,queued:!1}),H1());const Br=G!=null&&G.onOptimisticUserMessage?IN($t.getSnapshot().blocks):void 0,Ti=Rt.sendPrompt(A,Mn);if(rs&&(G==null?void 0:G.optimisticUserMessage)!==!1&&(G!=null&&G.onOptimisticUserMessage)){const Yi=IN($t.getSnapshot().blocks);Yi&&Yi!==Br&&G.onOptimisticUserMessage({sessionId:rs,messageId:Yi})}return await Ti},[MO,NS,q1,H1,Rt,$t]),Tpe=h.useCallback(async(A,q)=>{try{if(!q){const re=(Ot==null?void 0:Ot.path)??pn;if(Ce.sessionId&&re===A)return Ce.sessionId;const ke=await gt.client.workspaceByCwd(A).listWorkspaceSessions({pageSize:1,archiveState:"active"});if(ke.length>0)return ke[0].sessionId}return(await Rt.createSession({workspaceCwd:A})).sessionId}catch{return}},[Ce.sessionId,pn,gt.client,Rt,Ot]),Epe=h.useMemo(()=>(Ce.models??[]).filter(Sx).map(A=>({id:A.id,label:up(A.label||A.id)})),[Ce.models]),_a=pn,IS=!!(!Ce.sessionId&&((wB=Wn.find(A=>A.cwd===pn))!=null&&wB.trusted)&&(Vt!=null&&Vt.branch));h.useEffect(()=>{IS||aw({mode:"current"})},[IS]);const b$=h.useCallback(()=>{_a&&xm({workspaceCwd:_a,gitCwd:Ot==null?void 0:Ot.path,view:"diff"})},[_a,Ot==null?void 0:Ot.path]),y$=h.useCallback(()=>{_a&&xm({workspaceCwd:_a,gitCwd:Ot==null?void 0:Ot.path,view:"commit"})},[_a,Ot==null?void 0:Ot.path]),Zu=$O||BO||zO||FO||qO||HO||UO||wm!==void 0||Ki!==null||O1||sw!==null||kS!==null||e$||Uh||pr||vs!=="clear"||ype>0||Vn!==null||Fs!=="chat",Ms=h.useMemo(()=>{var A;return Xhe({capabilities:gt.capabilities,intendedCwd:pn,sessionId:Ce.sessionId,workspaces:(A=gt.capabilities)!=null&&A.workspaces||Mt?Wn:void 0})},[pn,Ce.sessionId,Mt,gt.capabilities,Wn]),[MS,Ape]=h.useState(0),[BE,jpe]=h.useState({}),v$=h.useMemo(()=>({user:MS,workspace:Ms?BE[Ms.workspaceKey]??0:0}),[Ms,MS,BE]),z0=wC(Ms,((xB=gt.capabilities)==null?void 0:xB.features)??[]),Npe=(Ms==null?void 0:Ms.sessionId)===Ce.sessionId&&(!(Ms!=null&&Ms.cwd)||Ms.cwd===Ce.workspaceCwd)?ka==null?void 0:ka.settingsVersion:void 0,{descriptor:RS,reload:uw}=dct(gt.client,Ms,z0&&Fs!=="split",JSON.stringify([MS,v$.workspace,Npe??null])),en=h.useCallback((A,q)=>{if(MN(A)||$Z(A)||bb(A))return;const G=q9t(A,q);console.error("[web-shell]",G,A),dn("error",G)},[dn]),Ipe=h.useCallback(()=>{const A=Js.current;if(!A||A.sessionId!==es.current.sessionId){Kr(null);return}Kr(null);const q=Date.now();To({sessionId:A.sessionId,messageId:A.messageId,startedAt:q,admitted:!1,settled:!1});let G=!1;Ua(A.text,A.images,{optimisticUserMessage:!1,inputAnnotations:A.inputAnnotations,onAdmitted:()=>{G=!0,To(re=>(re==null?void 0:re.sessionId)===A.sessionId&&re.messageId===A.messageId?{...re,admitted:!0}:re)}}).catch(re=>{!G&&es.current.sessionId===A.sessionId&&IN($t.getSnapshot().blocks)===A.messageId&&Kr(A),en(re,"Failed to resend message")}).finally(()=>{To(re=>(re==null?void 0:re.sessionId)===A.sessionId&&re.messageId===A.messageId?{...re,settled:!0}:re)})},[en,Ua,$t,Kr]),w$=((kB=Ce.capabilities)==null?void 0:kB.features.includes("session_mid_turn_message_mutation"))===!0,{queuedPrompts:Mpe,queuedTexts:Rpe,enqueuePrompt:zE,removeQueuedPrompt:Dpe,editQueuedPrompt:Lpe,editLastQueuedPrompt:Ppe,clearQueuedPrompts:Ope}=Rfe({connected:Fh,sessionId:Ce.sessionId,clientId:Ce.clientId,canMutateMidTurn:w$,streamingState:or,sessionActions:Rt,store:$t,editorRef:mi,reportError:en,t:ie}),F0=h.useCallback((A,q,G,re,ke)=>{var At;if(Kh.current){const Gt=es.current.sessionId,bt=q1(),kt=Gn.current;return Kh.current({sessionId:Gt,prompt:A}).then(()=>{var rs,Br;if(es.current.sessionId!==Gt||q1()!==bt||Gn.current!==kt)return;zE(A,q,G,ke)!==!1&&(re?re():(rs=mi.current)==null||rs.clear()),Gt&&A.trim()&&((Br=na.current)==null||Br.call(na,{type:"submit",sessionId:Gt,prompt:A,queued:!0}))}).catch(Mn=>{console.warn("[web-shell] onSubmitBefore rejected queued prompt, cancelled",Mn)}),!1}const Ne=zE(A,q,G,ke),at=es.current.sessionId;return at&&A.trim()&&((At=na.current)==null||At.call(na,{type:"submit",sessionId:at,prompt:A,queued:!0})),Ne},[q1,zE]);h.useEffect(()=>{for(const A of hi)H9t(A)?dn(U9t(A),A.message):A.category!=="lifecycle"&&console.warn("[web-shell] daemon notice",A),us(A.id)},[us,hi,dn]);const FE=h.useRef(m);FE.current=m,h.useEffect(()=>{var A;fo.current=Ce.sessionId,(A=Ri.current)==null||A.abort(),Ri.current=null,ri(null),_s(null),B0(null),fw.current=0},[Ce.sessionId]);const x$=h.useCallback(()=>{var ke;if(!ta())return;const A=`local-recap-${Po.current++}`,q=hn.length,G=(ke=hn.at(-1))==null?void 0:ke.id,re=Ce.sessionId;ri({anchorAfterId:G,anchorIndex:q,message:{id:A,role:"system",content:`※ ${ie("recap.label")}: ${ie("recap.loading")}`,variant:"info",source:"recap"}}),Rt.recapSession().then(Ne=>{fo.current===re&&ri({anchorAfterId:G,anchorIndex:q,message:{id:A,role:"system",content:Ne.recap?`※ ${ie("recap.label")}: ${Ne.recap}`:ie("recap.empty"),variant:"info",source:"recap"}})},Ne=>{fo.current===re&&(ri(null),!MN(Ne)&&!bb(Ne)&&console.warn("[web-shell] unhandled recap failure",Ne))})},[Ce.sessionId,hn,ta,Rt,ie]),k$=h.useCallback(A=>{var Ne;const q=A.trim();if(!q){dn("error",ie("btw.empty"));return}if(!ta())return;const G=`local-btw-${Mi.current++}`,re=Ce.sessionId;(Ne=Ri.current)==null||Ne.abort();const ke=new AbortController;Ri.current=ke,_s({id:G,role:"btw",question:q,answer:"",isPending:!0}),Rt.btwSession(q,{signal:ke.signal}).then(at=>{fo.current===re&&Ri.current===ke&&(Ri.current=null,_s({id:G,role:"btw",question:q,answer:at.answer||ie("btw.emptyAnswer"),isPending:!1}))},at=>{fo.current===re&&Ri.current===ke&&(Ri.current=null,_s(null),!MN(at)&&!bb(at)&&console.warn("[web-shell] unhandled btw failure",at))})},[Ce.sessionId,dn,ta,Rt,ie]),_$=h.useCallback(()=>{var A;(A=Ri.current)==null||A.abort(),Ri.current=null,_s(null)},[]);h.useEffect(()=>{const A=q=>{var at;if(Zu||Ha)return;const G=Zr;if(!G||G.role!=="btw")return;const re=q.key.toLowerCase(),ke=q.key==="Escape"&&!q.ctrlKey&&!q.metaKey&&!q.altKey&&!q.shiftKey,Ne=q.ctrlKey&&!q.metaKey&&!q.altKey&&!q.shiftKey&&(re==="c"||re==="d");if(G.isPending){if(!ke&&!Ne)return}else{const At=((at=mi.current)==null?void 0:at.hasInput())??!1;if(!(!q.ctrlKey&&!q.metaKey&&!q.altKey&&!q.shiftKey&&(q.key==="Escape"||!At&&(q.key==="Enter"||q.key===" "))))return}q.preventDefault(),q.stopPropagation(),_$()};return window.addEventListener("keydown",A,!0),()=>window.removeEventListener("keydown",A,!0)},[Zu,Zr,_$,Ha]);const Yh=h.useCallback((A,q)=>J_t(P0.current!=="idle",A,q,{append:G=>$t.appendLocalUserMessage(G)}),[$t]),Rd=h.useCallback(()=>(dn("error",ie("queue.commandBlocked")),!1),[dn,ie]),dw=h.useCallback(A=>{LE(A),s==null||s(A)},[s]),U1=h.useCallback(A=>{Te(A),i==null||i(A)},[i]),S$=h.useCallback(()=>{kE(!0)},[]),C$=rD({autoLoad:!0}),DS=Xwe({autoLoad:!0}),LS=DS.reload,[$pe,PS]=h.useState(!1),{settings:du,setValue:ed,reload:Ec}=C$,Bpe=h.useCallback(async()=>{const A=await Ec();return(Ms==null?void 0:Ms.route)==="workspace-qualified"&&await uw(),A},[Ms==null?void 0:Ms.route,uw,Ec]),T$=h.useMemo(()=>{const A=du.filter(G=>G.key!=="voiceModel");return Fs==="split"?A:(Ms==null?void 0:Ms.route)==="legacy-primary"?du:!z0||!RS?A:du.findIndex(G=>G.key==="voiceModel")<0?[...A,RS]:du.map(G=>G.key==="voiceModel"?RS:G)},[Fs,Ms==null?void 0:Ms.route,RS,z0,du]),zpe={...C$,settings:T$,reload:Bpe},W1=du.find(A=>A.key===vg),V1=du.find(A=>A.key===T9t),G1=du.find(A=>A.key===kT),Fpe=(()=>{const A=zC(T$,Cc,"voiceModel");return typeof A=="string"&&A.trim()?A.trim():void 0})(),qpe=(()=>{const A=zC(du,Cc,"visionModel");if(!(typeof A!="string"||!A.trim()))return ZRt(A.trim())})(),Hpe=(()=>{const A=zC(du,Cc,"fastModel");return typeof A=="string"&&A.trim()?A.trim():void 0})(),Upe=h.useMemo(()=>{const A=zC(du,Cc,"modelFallbacks");return typeof A=="string"?A.split(",").map(q=>q.trim()).filter(Boolean):[]},[du,Cc]),qE=h.useCallback((A,q)=>{if(A){if(q==="user"){Ape(G=>G+1);return}jpe(G=>({...G,[A.workspaceKey]:(G[A.workspaceKey]??0)+1}))}},[]),OS=h.useCallback(async(A,q,G=Ms)=>{var re;if(!G||!wC(G,((re=gt.capabilities)==null?void 0:re.features)??[]))throw new Error("Voice model settings are unavailable for this workspace.");try{G.route==="legacy-primary"||q==="user"?await ed(q,"voiceModel",A):await uct(gt.client,G,q,A)}catch(ke){throw qE(G,q),G.route==="legacy-primary"?await Ec().catch(()=>{}):await uw().catch(()=>{}),ke}qE(G,q),G.route==="legacy-primary"?await Ec().catch(()=>{}):await uw().catch(()=>{})},[qE,Ms,uw,Ec,ed,(_B=gt.capabilities)==null?void 0:_B.features,gt.client]),hw=h.useRef(Ms),E$=h.useRef(((SB=gt.capabilities)==null?void 0:SB.features)??[]);h.useLayoutEffect(()=>{var A;PO.current=Ki,OO.current=vm,VO.current=Fs,EE.current=Vn,n$.current=Uh,hw.current=Ms,E$.current=((A=gt.capabilities)==null?void 0:A.features)??[]},[Vn,Fs,Ms,Ki,Uh,vm,(CB=gt.capabilities)==null?void 0:CB.features]);const km=h.useRef(0),hu=h.useRef(void 0),A$=h.useRef(void 0),HE=h.useRef(Ms);h.useEffect(()=>()=>{km.current++,hu.current=void 0},[]);const UE=h.useCallback(async(A,q)=>{var Ne;const G=hw.current;if(!G||!wC(G,((Ne=gt.capabilities)==null?void 0:Ne.features)??[])){en(new Error("Voice model settings are unavailable for this workspace."),ie("model.setVoice"));return}const re=++km.current;hu.current=q,A$.current=G.ownerKey;const ke=()=>{var at;return re===km.current&&((at=hw.current)==null?void 0:at.ownerKey)===G.ownerKey&&wC(hw.current,E$.current)&&(q==="settings"?EE.current==="settings":EE.current===null)&&VO.current==="chat"&&PO.current===null&&!OO.current&&!n$.current};try{const at=await lct(gt.client,G);if(!ke()){re===km.current&&(hu.current=void 0);return}hu.current=void 0,HE.current=G,lpe(ect(at)),tw(A),Ju("voice")}catch(at){if(!ke()){re===km.current&&(hu.current=void 0);return}hu.current=void 0,en(at,ie("model.setVoice"))}},[en,ie,(TB=gt.capabilities)==null?void 0:TB.features,gt.client]);h.useEffect(()=>{hu.current&&(A$.current!==(Ms==null?void 0:Ms.ownerKey)||!z0)&&(km.current++,hu.current=void 0)},[Ms==null?void 0:Ms.ownerKey,z0]),h.useEffect(()=>{const A=hu.current;A&&!(A==="settings"?Vn==="settings":Vn===null)&&(km.current++,hu.current=void 0)},[Vn]),h.useEffect(()=>{hu.current&&(Fs!=="chat"||Ki!==null||vm||Uh)&&(km.current++,hu.current=void 0)},[Fs,Ki,Uh,vm]),h.useEffect(()=>{const A=HE.current;Ki==="voice"&&((A==null?void 0:A.ownerKey)!==(Ms==null?void 0:Ms.ownerKey)||!z0||Fs!=="chat")&&Ju(null)},[Fs,Ms==null?void 0:Ms.ownerKey,Ki,z0]);const Wpe=h.useMemo(()=>{const A=new Set,q=[];for(const G of(Ce.models??[]).filter(Sx).filter(re=>!re.isRuntime)){const re=G.baseModelId??bX(G.id);A.has(re)||(A.add(re),q.push({baseId:re,label:up(G.label||G.baseModelId||G.id)}))}return q},[Ce.models]),[$S,j$]=h.useState(!1),WE=h.useRef($S);WE.current=$S,h.useEffect(()=>{if(n){LE(n);return}const A=gD(W1==null?void 0:W1.values.effective);A&&LE(A)},[n,W1==null?void 0:W1.values.effective]),h.useEffect(()=>{if(r!==void 0){Te(jf(r));return}const A=uD(G1==null?void 0:G1.values.effective);A&&Te(A)},[r,G1==null?void 0:G1.values.effective]);const Vpe=h.useCallback((A,q="user")=>{const G=$n,ke=`/language ui ${A}${q==="workspace"?" --project":" --global"}`;U1(A);const Ne=()=>Promise.all([Rt.refreshCommands(),Ec()]);if(P0.current!=="idle"){U1(G),Rd();return}Ua(ke,void 0).then(Ne).catch(at=>{U1(G),en(at,"Failed to sync /language command")})},[Rd,U1,Ec,en,Ua,$n,Rt]),N$=h.useCallback(()=>{if(P0.current!=="idle"){$t.dispatch([{type:"status",text:ie("clear.blocked")}]);return}Xh.current+=1,fw.current=0,$t.reset()},[$t,ie]),I$=h.useCallback(()=>{const A=WE.current,q=!WE.current;j$(q),ed("workspace",C9t,q).catch(G=>{j$(A),en(G,ie("compact.saveFailed"))})},[en,ed,ie]),_m=h.useCallback(A=>{if(!H3(A)){en(new Error(`Unsupported approval mode: ${A}`),ie("local.approvalMode"));return}if(!es.current.sessionId){iw(A);return}Rt.setApprovalMode(A).then(q=>{const G=q.mode||A;PE(G);const re=I1.current;if(!re)return;if(A==="yolo"||A==="auto-edit"&&G9t(re)){const Ne=re.options.find(at=>at.kind==="allow_once");if(Ne){const at=re.title||"";$t.dispatch([{type:"status",text:ie("mode.autoApproved",{tool:at})}]),Rt.submitPermission(re.id,Ne.id).catch(At=>{en(At,"Failed to auto-approve tool call")})}}}).catch(q=>{en(q,ie("local.approvalMode"))})},[Rt,en,$t,ie,iw]);h.useEffect(()=>{P0.current=or},[or]);const M$=h.useRef(Ce.sessionId);h.useEffect(()=>{if(M$.current===Ce.sessionId)return;M$.current=Ce.sessionId;const A=Qu.current.length;Qu.current=[],Ce.sessionId!==ES.current&&(O0.current++,Qv.current=!1),A>0&&dn("warning",ie("queue.shellDropped",{count:A}))},[Ce.sessionId,dn,ie]);const R$=h.useRef(or);h.useEffect(()=>{const A=R$.current;if(R$.current=or,A==="idle"||or!=="idle"||Qv.current)return;const q=Qu.current;if(q.length===0)return;Qu.current=[],Qv.current=!0;const G=++O0.current,re=es.current.sessionId;(async()=>{try{let ke=q;for(;ke.length>0;){for(let Ne=0;Ne<ke.length;Ne++){const at=O0.current!==G;if(at||es.current.sessionId!==re||es.current.status!=="connected"){let At=ke.length-Ne;at||(At+=Qu.current.length,Qu.current=[]),console.warn("[web-shell] dropping %d queued shell command(s)",At),dn("warning",ie("queue.shellDropped",{count:At}));return}try{await Rt.sendShellCommand(ke[Ne])}catch(At){en(At,`Failed to execute shell command: !${ke[Ne]}`)}}ke=Qu.current,Qu.current=[]}}finally{O0.current===G&&(Qv.current=!1)}})()},[or,Rt,en,dn,ie]),h.useEffect(()=>{let A=null;for(let G=xs.length-1;G>=0;G--){const re=xs[G];if((re==null?void 0:re.kind)==="user")break;if((re==null?void 0:re.kind)==="error"&&re.source==="turn_error"){A=re.id;break}if((re==null?void 0:re.kind)!=="debug")break}const q=Fh&&A!==null&&A!==Zv.current&&P1.current.length>0;Jv.current=q?A:null,vS(q)},[xs,Fh]),h.useEffect(()=>{d==null||d(or)},[or,d]);const D$=h.useRef(or),L$=h.useRef(void 0);h.useEffect(()=>{var q;const A=D$.current;if(D$.current=or,or!=="idle"&&(L$.current=es.current.sessionId),A!=="idle"&&or==="idle"){const G=es.current.sessionId;if(!G||G!==L$.current)return;const re=Jv.current!=null?new Error(`Turn error (block ${Jv.current})`):void 0;(q=na.current)==null||q.call(na,{type:"turn_complete",sessionId:G,error:re})}},[or]),h.useEffect(()=>{u==null||u(Ce.status)},[Ce.status,u]),h.useEffect(()=>{ve==null||ve(xs)},[xs,ve]),h.useEffect(()=>{if(Ce.error){const A=new Error(Ce.error);f==null||f(A)}},[Ce.error,f]),h.useEffect(()=>{l$(Ce.currentModel??"")},[Ce.currentModel,Ce.sessionId]),h.useEffect(()=>{PE(Ce.currentMode??"default")},[Ce.currentMode,Ce.sessionId]),h.useEffect(()=>{const A=X.current;if(Ce.sessionId&&Ce.sessionId!==A&&uu(null),X.current=Ce.sessionId,!Ce.sessionId&&Ce.missingSession){Zo.current=Ce.sessionId,Jl.current=void 0,cl.current=void 0;return}const q=pn??Ce.workspaceCwd,G=Wn.find(ke=>ke.cwd===q);if(Ce.sessionId&&!gt.capabilities)return;const re=G&&!G.primary?G.id:void 0;Zo.current===Ce.sessionId&&Jl.current===re&&cl.current===q||(Zo.current=Ce.sessionId,Jl.current=re,cl.current=q,e==null||e(Ce.sessionId,re,q))},[Ce.missingSession,Ce.sessionId,Ce.workspaceCwd,e,pn,gt.capabilities,Wn]);const P$=h.useRef(void 0),VE=h.useRef(void 0);h.useEffect(()=>{var G;const A=Ce.sessionId,q=Ce.displayName;if(!(!A||!q)){if(A!==P$.current){P$.current=A,VE.current=q;return}q!==VE.current&&(VE.current=q,(G=na.current)==null||G.call(na,{type:"rename",sessionId:A,newName:q}))}},[Ce.sessionId,Ce.displayName]),h.useEffect(()=>{const A=j9t(xs);uu(q=>A?(q==null?void 0:q.condition)===A.condition&&q.setAt===A.setAt?q:A:q&&null)},[xs]),h.useEffect(()=>{const A=q=>{const G=q.detail;if(!(G!=null&&G.active)){uu(null);return}G.condition&&uu({condition:G.condition,setAt:G.setAt??Date.now()})};return window.addEventListener(dR,A),()=>window.removeEventListener(dR,A)},[]);const BS=h.useRef(null),fw=h.useRef(0),Xh=h.useRef(0);h.useEffect(()=>{fw.current=0,Xh.current+=1},[Ce.sessionId]),h.useEffect(()=>{function G(){if(document.hidden){BS.current===null&&(BS.current=Date.now());return}const re=BS.current;if(BS.current=null,re===null||Date.now()-re<18e4||P0.current!=="idle"||!Ce.sessionId)return;const ke=$t.getSnapshot().blocks.length;if(ke-fw.current<4)return;fw.current=ke;const Ne=Ce.sessionId,at=Xh.current;Rt.recapSession().then(At=>{if(Xh.current!==at||es.current.sessionId!==Ne||At.sessionId!==Ne){console.warn("[auto-recap] discarding stale recap",{captured:{sessionId:Ne,version:at},current:{sessionId:es.current.sessionId,version:Xh.current},result:At.sessionId});return}At.recap&&$t.dispatch([{type:"status",text:`※ ${ie("recap.label")}: ${At.recap}`,source:"recap"}])},At=>{console.error("[auto-recap] failed:",At)})}return document.addEventListener("visibilitychange",G),()=>document.removeEventListener("visibilitychange",G)},[Ce.sessionId,Rt,$t,ie]);const GE=h.useCallback(()=>{const A=H3(Tc)?nx.indexOf(Tc):-1,q=nx[(A+1)%nx.length];_m(q)},[Tc,_m]),mw=h.useCallback((A,q)=>{ta()&&(Yh(A)||Rt.getContextUsage({detail:q}).then(G=>{$t.dispatch([{type:"status",text:pQe(G)}]),cu("smooth")}).catch(G=>{en(G,"Failed to load context usage")}))},[Yh,$t,ta,Rt,en,cu]),Gpe=h.useCallback(()=>{mw("/context detail",!0)},[mw]),zS=h.useCallback(A=>{ta()&&Rt.branchSession(A||void 0).then(q=>{$t.dispatch([{type:"status",text:ie("branch.success",{name:q.displayName})}])}).catch(q=>{en(q,ie("branch.failed"))})},[en,ta,Rt,$t,ie]),Kpe=h.useCallback(()=>{zS()},[zS]),pw=h.useRef(0),FS=h.useCallback(A=>{const q=++pw.current;return window.setTimeout(()=>{var G;q!==pw.current||Hv.current||A!==void 0&&es.current.sessionId!==A||(G=mi.current)==null||G.focus()},0),q},[]),ec=h.useCallback(async(A,q)=>{const G=et??A;Gn.current+=1,gr.current=G,ks(G),aw({mode:"current"}),Xe(),Ao(),q!=null&&q.keepView||Eo("chat");let re;try{Xh.current+=1;const ke=Rt.clearSession();return re=FS(),await Promise.all([ke,wS(G)]),Ns(void 0),Cr(void 0),!0}catch(ke){return pw.current===re&&(pw.current+=1),en(ke,"Failed to start a new chat"),!1}},[Xe,Ao,et,en,wS,FS,Rt]),K1=h.useCallback(async(A,q=Ks.current)=>{var re;if(Tn.current)return;const G=Symbol("workspace-switch");Tn.current=G;try{const ke=(re=q.find(at=>at.primary))==null?void 0:re.cwd,Ne=A??ke;if(A){const at=q.find(At=>At.cwd===A);if(!(at!=null&&at.trusted))return}if(es.current.sessionId){if(es.current.workspaceCwd===Ne)return;await ec(A);return}Gn.current+=1,gr.current=A,ks(A)}finally{Tn.current===G&&(Tn.current=null)}},[ec]),qS=h.useCallback(async A=>{try{const q=await(wn==null?void 0:wn()),G=(q==null?void 0:q.workspaces)??[],re=G.find(ke=>ke.cwd===A);return re!=null&&re.trusted&&await K1(re.primary?void 0:re.cwd,G),q!==void 0}catch(q){return en(q,"Failed to refresh the workspace list"),!1}},[wn,en,K1]),Ype=h.useCallback(async(A,q,G)=>{if(Zt.current)throw new Error(ie("sidebar.addWorkspaceBusyError"));const re=Symbol("workspace-mutation");Zt.current=re,tt(!0);try{const ke=Bs===!0&&q,Ne=Si?G:void 0,at=await Jt.addWorkspace(A,{persist:ke,...Ne?{displayName:Ne}:{}});if(ke&&at.persisted!==!0)throw new Error(ie("sidebar.addWorkspacePersistenceError"));if(!await qS(at.cwd))throw new Error(ie("sidebar.addWorkspaceRefreshError"))}finally{Zt.current===re&&(Zt.current=null,tt(!1))}},[Bs,qS,ie,Si,Jt]),KE=h.useCallback(async()=>{Xs("refreshing");try{const A=await(wn==null?void 0:wn());if(!A)return;const q=A.workspaces??[],G=zs.current;if(G){const re=q.find(ke=>ke.cwd===G);re!=null&&re.trusted&&await K1(re.primary?void 0:re.cwd,q),zs.current=void 0,Xs("clear")}else Xs("awaiting-ack")}catch(A){en(A,"Failed to refresh the workspace list")}},[en,Xs,K1,wn]),O$=h.useCallback(async()=>{if(Jr.current!=="clear"||Zt.current)return;const A=Symbol("workspace-mutation");Zt.current=A,tt(!0);try{const q=await Jt.addScratchWorkspace();await qS(q.cwd)||(zs.current=q.cwd,Xs("refreshing"))}catch(q){q instanceof Jc&&(q.status<500||q.status===501)?en(q,ie("sidebar.addWorkspaceError")):(zs.current=void 0,Xs("refreshing"),await KE())}finally{Zt.current===A&&(Zt.current=null,tt(!1))}},[qS,KE,en,Xs,ie,Jt]),Xpe=h.useCallback(A=>{K1(A)},[K1]),Qpe=h.useCallback(()=>{O$()},[O$]),Jpe=h.useCallback(()=>{xe(!0)},[]),Zpe=h.useCallback(A=>{rpe(A)},[]),{suggestion:Sa,updateInput:$$,dismiss:gw,suppress:B$}=b9t({enabled:((EB=Ce.capabilities)==null?void 0:EB.features.includes("session_generation"))===!0,messages:hn,sessionId:Ce.sessionId,contextUsageRatio:(Ce.contextWindow??0)>0?(Ce.tokenCount??0)/(Ce.contextWindow??0):0,isRunning:or!=="idle",dialogOpen:Zu||wa,hasAttachments:spe,generateContent:Rt.generateSessionContent}),e0e=h.useCallback(A=>{hE.current=A,$$(A)},[$$]),HS=h.useCallback(A=>{const q=Md.current;if(!q||A!==void 0&&q.token!==A)return;const G=es.current.sessionId;if(q.sourceSessionId!==void 0&&G!==void 0&&G!==q.sourceSessionId){Md.current=null,Xv(!1);return}q.sessionClearCompleted&&G===void 0&&(q.submitScheduled||(Md.current={...q,submitScheduled:!0},window.setTimeout(()=>{var ke,Ne;const re=Md.current;if(!(!re||re.token!==q.token)){if(es.current.sessionId!==void 0){Md.current=null,Xv(!1);return}Md.current=null,(ke=mi.current)==null||ke.submit(),(Ne=mi.current)==null||Ne.focus(),Xv(!1)}},0)))},[]);h.useEffect(()=>{HS()},[Ce.sessionId,HS]);const t0e=h.useCallback(()=>{const A=hE.current.trim();if(!A||gS)return;if((Sa==null?void 0:Sa.suggestion)!=="new_session"||Sa.classifiedInput!==A||Sa.sourceSessionId!==es.current.sessionId){gw();return}B$(),Xv(!0);const q=d$.current+1;d$.current=q,Md.current={token:q,sourceSessionId:es.current.sessionId,sessionClearCompleted:!1,submitScheduled:!1},ec().then(G=>{const re=Md.current;if(!G||(re==null?void 0:re.token)!==q){(re==null?void 0:re.token)===q&&(Md.current=null),Xv(!1);return}Md.current={...re,sessionClearCompleted:!0},e==null||e(void 0),HS(q)})},[ec,gw,HS,gS,Sa,e,B$]),n0e=h.useCallback(()=>{var q,G,re;const A=hE.current.trim();if(!A||(Sa==null?void 0:Sa.suggestion)!=="btw"||Sa.classifiedInput!==A||Sa.sourceSessionId!==es.current.sessionId||((q=mi.current)==null?void 0:q.hasAttachments())!==!1){gw();return}gw(),(G=mi.current)==null||G.submit({text:`/btw ${A}`}),(re=mi.current)==null||re.focus()},[gw,Sa]),z$=h.useMemo(()=>({openSplitView:()=>{Xe(),XO()},openSessionOverview:()=>{Xe(),dl("sessions")},openSessionDrawer:YO,createNewSession:()=>ec(),createSideTask:$h}),[Xe,ec,$h,dl,YO,XO]);h.useEffect(()=>{SX(Q,z$)},[z$,Q]),h.useEffect(()=>()=>{SX(Q,null)},[Q]);const s0e=h.useCallback(async()=>{if(!dE.current){dE.current=!0,NO(!0);try{await ec()&&(e==null||e(void 0))}finally{dE.current=!1,NO(!1)}}},[ec,e]),q0=h.useCallback(async(A,q)=>{pw.current+=1,pt(A),aw({mode:"current"}),Ns(void 0),Cr(void 0),Xe(),Ao();try{Xh.current+=1,await Rt.loadSession(A,{workspaceCwd:q})}catch(G){throw pt(re=>re===A?null:re),G}},[Xe,Ao,Rt]),YE=h.useCallback(A=>{Eo("chat"),q0(A).catch(q=>{en(q,"Failed to open session")})},[q0,en]);h.useEffect(()=>{const A=q=>{const G=q.detail;typeof G=="string"&&G&&YE(G)};return window.addEventListener("qwen:open-session",A),()=>window.removeEventListener("qwen:open-session",A)},[YE]),h.useEffect(()=>{Je!==null&&Ce.sessionId===Je&&!Ce.loadingTranscript&&!Ce.catchingUp&&(pt(null),FS(Je))},[Ce.catchingUp,Ce.loadingTranscript,Ce.sessionId,FS,Je]);const H0=h.useRef(null),XE=h.useCallback(A=>{const q=H0.current;q&&q.sessionId===A&&(clearTimeout(q.timer),H0.current=null)},[]),US=h.useCallback(A=>new Promise((q,G)=>{let re=!1;Ua(A,void 0,{onAdmitted:()=>{re||(re=!0,q())}}).then(()=>{re||G(new Error("Run was cancelled before it started"))},Ne=>{re||G(Ne)})}),[Ua]),WS=h.useCallback(()=>{const A=H0.current,q=es.current;!A||q.sessionId!==A.sessionId||q.loadingTranscript||q.catchingUp||(clearTimeout(A.timer),H0.current=null,US(A.prompt).then(()=>A.resolve(),G=>A.reject(G)))},[US]),r0e=h.useCallback((A,q)=>{if(Eo("chat"),!q)return US(A);const G=H0.current;return G&&(clearTimeout(G.timer),H0.current=null,G.reject(new Error("superseded by another run"))),new Promise((re,ke)=>{const Ne=setTimeout(()=>{XE(q),ke(new Error("Timed out switching to the task session"))},_9t);H0.current={sessionId:q,prompt:A,resolve:re,reject:ke,timer:Ne},q0(q).then(()=>WS()).catch(at=>{XE(q),ke(at)})})},[US,q0,XE,WS]);h.useEffect(()=>{WS()},[Ce.sessionId,Ce.loadingTranscript,Ce.catchingUp,WS]);const VS=h.useCallback(()=>{ta()&&Rt.getTasks().then(A=>{B0({snapshot:A})}).catch(A=>{GP(A)||en(A,"Failed to load tasks")})},[en,ta,Rt]),F$=h.useCallback(()=>{ta()&&(Ci(!0),ul(A=>A+1))},[ta]),i0e=h.useCallback(A=>{if(A.kind==="monitor"||A.kind==="shell"){vn.current||(xt.current=!0),A.kind==="monitor"?DE(A):a$(A);return}VS()},[DE,a$,VS]),q$=h.useCallback((A,q)=>{uu({condition:A,setAt:q}),$t.dispatch([{type:"status",text:VG({kind:"set",condition:A,setAt:q})}])},[$t]),H$=h.useCallback(A=>{A&&($t.dispatch([{type:"status",text:VG({kind:"cleared",condition:A.condition,durationMs:Date.now()-A.setAt})}]),uu(null))},[$t]),GS=h.useCallback(A=>ta()?($t.appendLocalUserMessage(A),Rt.clearGoal().catch(q=>{en(q,"Failed to clear /goal")}),!0):!1,[en,ta,Rt,$t]),o0e=h.useCallback(()=>Rt.getRewindSnapshots(),[Rt]),a0e=h.useCallback(A=>Rt.rewindSession(A,{rewindFiles:!1}).then(()=>{}),[Rt]),l0e=h.useCallback(A=>{if(bb(A))return;const q=A instanceof Error?A.message:String(A);dn("error",ie("rewind.failed",{reason:q}))},[dn,ie]),U$=h.useCallback((A,q,G)=>{const re=MR(A),ke=(G==null?void 0:G.sendToDaemon)??!0,Ne=()=>{const at=!!Kh.current,At=!es.current.sessionId||at;return Ua(A,q,{clearComposerOnPromptStart:At,commitComposerAccepted:At?G==null?void 0:G.commitComposerAccepted:void 0}).catch(Gt=>{en(Gt,"Failed to send /goal command")}),!At};return re&&TO(re)?ke?GS(A):($t.appendLocalUserMessage(A),H$(IO.current),!0):re?ke?Ne():($t.appendLocalUserMessage(A),q$(re,Date.now()),!0):(B1(),!0)},[H$,q$,GS,B1,en,Ua,$t,es]),bw=h.useMemo(()=>new Set((p??[]).map(NN).filter(Boolean)),[p]),c0e=bw.has("settings"),W$=h.useCallback((A,q,G,re)=>{var at;if(Ofe(A,f$.current,en))return!0;if(es.current.loadingTranscript)return dn("warning",ie("editor.sessionLoading")),!1;if(Lfe({connectionStatus:es.current.status,hasSession:!!es.current.sessionId,restartSseOnPrompt:!!rt}))return dn("warning",ie("editor.connectionDisconnected")),!1;const ke=P0.current!=="idle",Ne=(At,Gt,bt,kt)=>{const{trackSendFailure:Mn=!1,...rs}=kt??{},Br=!!Kh.current,Ti=!es.current.sessionId||Br;let Ca,Wa=!1;return Ua(At,Gt,{...rs,clearComposerOnPromptStart:Ti,commitComposerAccepted:Ti?G:void 0,onAdmitted:()=>{Wa=!0},...Mn?{onOptimisticUserMessage:Yi=>{Ca=Yi}}:{}}).catch(Yi=>{const Va=Ca;Mn&&!Wa&&Va&&Va.sessionId===es.current.sessionId&&$t.getSnapshot().blocks.some(Ga=>Ga.kind==="user"&&Ga.id===Va.messageId)&&Kr({...Va,text:At,images:Gt,inputAnnotations:rs.inputAnnotations}),en(Yi,bt)}),!Ti};if(A.startsWith("/")){const At=A.match(Pfe);if(At){const Gt=At[1];if(bw.has(NN(Gt)))return ke?F0(A,q,void 0,G,re==null?void 0:re.inputAnnotations):Ne(A,q,"Failed to send hidden slash command",{inputAnnotations:re==null?void 0:re.inputAnnotations});if(Gt==="help")return kE(!0),!0;if(Gt==="diff")return _a?(xm({workspaceCwd:_a,gitCwd:Ot==null?void 0:Ot.path,view:"diff"}),!0):(dn("info",ie("localCommand.diffNoWorkspace")),!0);if(Gt==="log")return _a?(xm({workspaceCwd:_a,gitCwd:Ot==null?void 0:Ot.path,view:"log"}),!0):(dn("info",ie("localCommand.logNoWorkspace")),!0);if(Gt==="prs")return _a?si?(xm({workspaceCwd:_a,view:"prs"}),!0):(dn("info",ie("localCommand.prsUnsupported")),!0):(dn("info",ie("localCommand.prsNoWorkspace")),!0);if(Gt==="tasks")return F$(),!0;if(Gt==="goal")return MR(A)?ke?c8t(A)?GS(A):Rd():U$(A,q,{commitComposerAccepted:G}):(B1(),!0);if(Gt==="theme"){const bt=A.slice(At[0].length).trim().toLowerCase();return bt==="dark"||bt==="light"?dw(bt):bt?dn("error",ie("error.unsupportedTheme")):_E(!0),!0}if(Gt==="language"){const bt=A.slice(At[0].length).trim(),[kt,Mn]=bt.split(/\s+/);if(!bt)return $t.dispatch([{type:"status",text:[ie("language.current",{language:dD($n)}),ie("language.usage"),ie("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;if((kt==null?void 0:kt.toLowerCase())==="ui"){if(!Mn)return $t.dispatch([{type:"status",text:[ie("language.set"),"",ie("language.usage"),"",ie("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;const rs=Mn.toLowerCase();if(!["en","zh","zh-cn","zh_cn"].includes(rs))return dn("error",ie("language.invalid")),!0;const Ti=jf(Mn);if(U1(Ti),!ke){const Ca=!!Kh.current,Wa=!es.current.sessionId||Ca;return Ua(`/language ui ${Ti}`,void 0,{clearComposerOnPromptStart:Wa,commitComposerAccepted:Wa?G:void 0}).then(()=>Rt.refreshCommands()).catch(Yi=>{en(Yi,"Failed to sync /language command")}),!Wa}return!0}}if(Gt==="copy"){const bt=A.slice(At[0].length).trim();return WRt(Tr.current,bt).then(kt=>{$t.dispatch([{type:kt.status==="error"?"error":"status",text:sDt(kt.message,ie)}])}).catch(kt=>{en(kt,ie("copy.failedFallback"))}),!0}if(Gt==="delete")return vE(!0),!0;if(Gt==="release")return wE(!0),!0;if(Gt==="rewind")return ta()?(xE(!0),!0):!1;if(Gt==="branch"){if(ke)return Rd();const bt=A.slice(At[0].length).trim();return zS(bt||void 0),!0}if(Gt==="fork"){if(ke)return Rd();if(!ta())return!1;const bt=A.slice(At[0].length).trim();return bt?(Rt.forkSession(bt).then(kt=>{if(!kt.launched){dn("warning",ie("fork.notStarted"));return}ul(Mn=>Mn+1),dn("success",ie("fork.started",{name:kt.description}))}).catch(kt=>{const Mn=kt instanceof Error?kt.message:String(kt);en(kt,ie("fork.failed",{reason:Mn}))}),!0):(dn("error",ie("fork.empty")),!0)}if(Gt==="auth")return RE(!0),!0;if(Gt==="model"){const bt=A.slice(At[0].length).trim();if(bt==="--fast")return Ju("fast"),!0;if(bt.startsWith("--fast "))return ke?F0(A,q,void 0,G,re==null?void 0:re.inputAnnotations):Ne(A,q,"Failed to send /model --fast",{inputAnnotations:re==null?void 0:re.inputAnnotations});if(bt==="--voice")return Yh(A,q)||UE("workspace","command"),!0;if(bt.startsWith("--voice ")){const kt=bt.replace(/^--voice\s+/,"");return OS(kt,"workspace").catch(Mn=>en(Mn,ie("model.setVoice"))),!0}if(bt==="--vision")return Ju("vision"),!0;if(bt.startsWith("--vision ")){const kt=bt.replace(/^--vision\s+/,"");return ed("workspace","visionModel",kt).catch(Mn=>en(Mn,ie("model.setVision"))),!0}if(bt){if(!es.current.sessionId)return F1(bt),!0;Rt.setModel(bt).then(()=>{F1(bt)}).catch(kt=>{en(kt,ie("model.switch"))})}else Ju("main");return!0}if(Gt==="plan"){if(ke)return Rd();const bt=A.slice(At[0].length).trim();return es.current.sessionId?(bt&&Gh(!0),Rt.setApprovalMode("plan").then(()=>{if(iw("plan"),bt)return Ua(bt,q,{clearComposerOnPromptStart:!0,inputAnnotations:re==null?void 0:re.inputAnnotations}).catch(kt=>en(kt,"Failed to send plan prompt"))}).catch(kt=>{en(kt,ie("mode.plan"))}).finally(()=>{bt&&Gh(!1)}),!bt):(iw("plan"),bt?Ne(bt,q,"Failed to send plan prompt",{inputAnnotations:re==null?void 0:re.inputAnnotations}):!0)}if(Gt==="approval-mode"){const bt=A.slice(At[0].length).trim();return bt?_m(bt):$1(!0),!0}if(Gt==="mcp"){const bt=A.slice(At[0].length).trim().toLowerCase();return Jt.loadMcpStatus().then(kt=>{TE({status:kt,toolsByServer:{},resourcesByServer:{},showDescriptions:bt==="desc",showSchema:bt==="schema",showTips:!bt}),dl("mcp")}).catch(kt=>{en(kt,"Failed to load MCP status")}),!0}if(Gt==="skills"){const bt=A.slice(At[0].length).trim();if(!bt||bt==="detail"||bt==="details")dl("skills");else{const kt=`/${bt}`;return ke?F0(kt,q,void 0,G,re==null?void 0:re.inputAnnotations):Ne(kt,q,"Failed to send /skills command",{inputAnnotations:re==null?void 0:re.inputAnnotations})}return!0}if(Gt==="tools"){const bt=A.slice(At[0].length).trim().toLowerCase();if(bt==="desc"||bt==="descriptions")WO(!0);else{if(Yh(A,q))return!0;Jt.loadToolsStatus().then(kt=>{const Mn=(kt==null?void 0:kt.tools)??[];if(Mn.length===0)$t.dispatch([{type:"status",text:ie("tools.none")}]);else{const rs=Mn.map(Br=>`- ${Br.displayName||Br.name}`).join(`
`);$t.dispatch([{type:"status",text:`${ie("tools.available")}

${rs}`}])}cu("smooth")}).catch(kt=>{en(kt,"Failed to load tools")})}return!0}if(Gt==="settings")return dl("settings"),!0;if(Gt==="schedule")return AE(),!0;if(Gt==="context"){const bt=A.slice(At[0].length).trim().toLowerCase();if(bt===""||bt==="detail"||bt==="-d")return mw(A,bt==="detail"||bt==="-d"),!0}if(Gt==="memory"){const bt=A.slice(At[0].length).trim().toLowerCase();if(bt==="refresh")ppe(kt=>kt+1);else if(bt==="add"||bt.startsWith("add ")){const kt=bt.slice(3).trim();xpe(kt==="user"||kt==="global"?"global":"workspace"),bpe(Mn=>Mn+1)}return t$(!0),!0}if(Gt==="agents"){const bt=A.slice(At[0].length).trim().toLowerCase();return nw(bt==="create"||bt==="create user"||bt==="create global"?"global":bt==="create project"||bt==="create workspace"?"workspace":null),dl("agents"),!0}if(Gt==="extensions"){const bt=A.slice(At[0].length).trim(),kt=(at=bt.split(/\s+/)[0])==null?void 0:at.toLowerCase();if(!kt||kt==="manage")return dl("extensions"),!0;if(kt==="install"){if(ke)return Rd();const Mn=bt.slice(7).trim().split(/\s+/);let rs="",Br,Ti,Ca,Wa,Yi=null;for(let Ga=0;Ga<Mn.length;Ga++){const Ka=Mn[Ga];if(Ka)if(Ka==="--auto-update")Ca=!0;else if(Ka==="--pre-release"||Ka==="--allow-pre-release")Wa=!0;else if(Ka==="--ref"||Ka==="--registry"){const U0=Mn[Ga+1];if(!U0||U0.startsWith("--")){Yi=ie("extensions.install.missingOptionValue",{option:Ka});break}Ka==="--ref"?Br=U0:Ti=U0,Ga+=1}else if(Ka.startsWith("--")){Yi=ie("extensions.install.unknownOption",{option:Ka});break}else if(!rs)rs=Ka;else{Yi=ie("extensions.install.usage");break}}if(Yi)return $t.appendLocalUserMessage(A),$t.dispatch([{type:"error",text:Yi}]),!0;if(!rs)return $t.appendLocalUserMessage(A),$t.dispatch([{type:"error",text:ie("extensions.install.usage")}]),!0;const Va=es.current.clientId;return Va?($t.appendLocalUserMessage(A),$t.dispatch([{type:"status",text:ie("extensions.install.started",{source:rs})}]),Jt.installExtension({source:rs,...Br?{ref:Br}:{},...Ti?{registry:Ti}:{},...Ca!==void 0?{autoUpdate:Ca}:{},...Wa!==void 0?{allowPreRelease:Wa}:{},consent:!0},Va).then(()=>{}).catch(Ga=>{en(Ga,ie("extensions.install.requestFailed"))}),!0):(dn("warning",ie("extensions.install.waitForSession")),!0)}return Yh(A,q)||$t.dispatch([{type:"error",text:ie("extensions.install.usage")}]),!0}if(Gt==="clear"||Gt==="new"||Gt==="reset")return ec(),!0;if(Gt==="rename"){const bt=K9t(A.slice(At[0].length));if(bt.type==="auto"||bt.type==="delegate")return ke?F0(A,q,void 0,G,re==null?void 0:re.inputAnnotations):Ne(A,q,"Failed to send /rename command",{inputAnnotations:re==null?void 0:re.inputAnnotations});const kt=bt.displayName;return kt?ta()?(Rt.renameSession(kt).then(()=>{$t.dispatch([{type:"status",text:ie("rename.success",{name:kt})}])}).catch(Mn=>{en(Mn,"Failed to rename session")}),!0):!1:(dn("error",ie("rename.empty")),!0)}if(Gt==="resume"){const bt=A.slice(At[0].length).trim();return bt?(Xe(),Ao(),Xh.current+=1,Rt.loadSession(bt).catch(kt=>{en(kt,"Failed to load session")})):(Xe(),yE(!0)),!0}if(Gt==="recap")return x$(),!0;if(Gt==="btw"){const bt=A.slice(At[0].length).trim(),kt=/^side(?:\s+|$)/i.exec(bt);if(Zl&&kt){const Mn=bt.slice(kt[0].length).trim();return Mn?($h(Mn),!0):(dn("error",ie("btw.side.empty")),!0)}return k$(bt),!0}if(Gt==="stats"){const bt=A.slice(At[0].length).trim().toLowerCase();let kt="overview";return bt==="model"?kt="model":bt==="tools"&&(kt="tools"),ta()?(Yh(A,q)||Rt.getStats().then(Mn=>{$t.dispatch([{type:"status",text:sJe(Mn,kt)}]),cu("smooth")}).catch(()=>{}),!0):!1}if(Gt==="status"||Gt==="about")return Yh(A,q)||Promise.all([Jt.loadPreflight().catch(()=>null),Jt.loadProviders().catch(()=>null),Jt.loadEnv().catch(()=>null)]).then(([bt,kt,Mn])=>{var U0,MB,RB,DB,LB,PB;const rs=gX(bt,Mn);let Br=rs.authSource;!Br&&((U0=kt==null?void 0:kt.current)!=null&&U0.authType)&&(Br=kt.current.authType);const Ti=[];rs.nodeVersion&&Ti.push(`Node.js v${rs.nodeVersion}`),rs.npmVersion&&Ti.push(`npm ${rs.npmVersion}`);let Ca="";Br&&(Br.startsWith("oauth")||Br==="qwen-oauth"?Ca="Qwen OAuth":Ca=`API Key - ${Br}`);const Wa=`${rs.platform} ${rs.arch}`.trim(),Yi=TS.current,Va=es.current,Ka={cliVersion:((MB=Va.capabilities)==null?void 0:MB.qwenCodeVersion)||"",runtime:Ti.join(" / "),platform:Wa,auth:Ca,baseUrl:((RB=kt==null?void 0:kt.current)==null?void 0:RB.baseUrl)||"",model:Yi||Va.currentModel||((DB=kt==null?void 0:kt.current)==null?void 0:DB.modelId)||"",fastModel:((LB=kt==null?void 0:kt.current)==null?void 0:LB.fastModelId)||Yi||Va.currentModel||((PB=kt==null?void 0:kt.current)==null?void 0:PB.modelId)||"",sessionId:Va.sessionId||"",sandbox:rs.sandbox,proxy:rs.proxy,memoryUsage:rs.memoryUsage};$t.dispatch([{type:"status",text:wJe(Ka)}]),cu("smooth")}),!0;if(Gt==="bug"){const bt=A.slice(At[0].length).trim();return Yh(A,q)||Promise.all([Jt.loadPreflight().catch(()=>null),Jt.loadEnv().catch(()=>null)]).then(([kt,Mn])=>{var Ca;const rs=gX(kt,Mn),Br=((Ca=es.current.capabilities)==null?void 0:Ca.qwenCodeVersion)||"",Ti={};if(Br&&(Ti.cliVersion=Br),rs.nodeVersion&&(Ti.nodeVersion=rs.nodeVersion),rs.npmVersion&&(Ti.npmVersion=rs.npmVersion),rs.platform&&(Ti.platform=rs.platform),rs.arch&&(Ti.arch=rs.arch),rs.sandbox&&(Ti.sandbox=rs.sandbox),rs.memoryUsage&&(Ti.memoryUsage=rs.memoryUsage),FE.current)FE.current({title:bt,systemInfo:Ti}),$t.dispatch([{type:"status",text:ie("bug.submitted")}]);else{const Wa=Object.entries(Ti).filter(([,Ga])=>Ga).map(([Ga,Ka])=>`${Ga}: ${Ka}`).join(`
`),Yi=`https://github.com/QwenLM/qwen-code/issues/new?template=bug_report.yml&title=${encodeURIComponent(bt)}&info=${encodeURIComponent(`
`+Wa+`
`)}`,Va=window.open(Yi,"_blank");Va?(Va.opener=null,$t.dispatch([{type:"status",text:ie("bug.submitted")}])):dn("error",ie("bug.popupBlocked"))}}).catch(kt=>{en(kt,ie("bug.failed"))}),!0}}return ke?F0(A,q,void 0,G,re==null?void 0:re.inputAnnotations):Ne(A,q,"Failed to send command",{inputAnnotations:re==null?void 0:re.inputAnnotations})}else if(A.startsWith("!")){const At=A.slice(1).trim();if(!At)return!1;if(ke)return Qu.current.push(At),dn("info",ie("queue.shellQueued")),!0;const Gt=!es.current.sessionId;if(Gt){if(bS.current)return!1;bS.current=!0,Gh(!0)}let bt=!1;const kt=O0.current;return NS().finally(()=>{Gt&&(Gh(!1),bS.current=!1)}).then(Mn=>{var rs,Br;if(O0.current===kt)return Gt&&Mn&&(bt=!0,G?G():(rs=mi.current)==null||rs.clear(),(Br=na.current)==null||Br.call(na,{type:"submit",sessionId:Mn,prompt:`!${At}`,queued:!1}),H1()),Rt.sendShellCommand(At)}).catch(Mn=>{en(Mn,Gt&&!bt?"Failed to create session for shell command":"Failed to execute shell command")}),!Gt}else return ke?F0(A,q,void 0,G,re==null?void 0:re.inputAnnotations):Ne(A,q,"Failed to send message",{inputAnnotations:re==null?void 0:re.inputAnnotations,trackSendFailure:!0})},[Ua,Rt,$t,F0,Yh,zS,Xe,Ao,dl,AE,B1,ec,NS,H1,_a,Ot,si,GS,U$,dw,_m,U1,Rd,$h,Zl,F$,bw,dn,en,x$,k$,ta,rt,cu,$n,F1,iw,ed,UE,OS,mw,ie,Jt,Kr]),V$=h.useRef(W$);V$.current=W$;const u0e=h.useCallback((A,q,G,re)=>{const ke=V$.current(A,q,G,re);return ke!==!1&&cu("smooth"),ke},[cu]),d0e=h.useCallback((A,q,G)=>{Rt.submitPermission(A,q,G).catch(re=>{en(re,"Failed to submit permission choice")})},[Rt,en]),h0e=h.useCallback((A,q,G)=>Rt.submitPermission(A,q,G),[Rt]),QE=h.useCallback(()=>{const A=Qu.current.length;Qu.current=[],O0.current++,Qv.current=!1,bS.current=!1,A>0&&dn("warning",ie("queue.shellDropped",{count:A})),Rt.cancel().catch(q=>{en(q,"Failed to cancel request")})},[Rt,en,dn,ie]),f0e=h.useCallback(()=>{var A;return Zu?!1:((A=D0.current)==null?void 0:A.focusTaskPill())??!1},[Zu]),m0e=h.useCallback(A=>{var q,G;if(A){(q=mi.current)==null||q.insertText(A);return}(G=mi.current)==null||G.focus()},[]),p0e=h.useCallback(A=>{ei(A)},[]),JE=h.useCallback(()=>{if(gE.current&&Fh&&P0.current==="idle"&&Jv.current&&es.current.sessionId&&P1.current){const A=Jv.current,q=es.current.sessionId;Zv.current=A,vS(!1),To({sessionId:q,messageId:A,startedAt:Date.now(),admitted:!1,settled:!1}),Ua(P1.current,yS.current,{optimisticUserMessage:!1,retry:!0,onAdmitted:()=>{To(G=>(G==null?void 0:G.sessionId)===q&&G.messageId===A?{...G,admitted:!0}:G)}}).catch(G=>en(G,"Failed to retry prompt")).finally(()=>{To(G=>(G==null?void 0:G.sessionId)===q&&G.messageId===A?{...G,settled:!0}:G)})}else $t.dispatch([{type:"status",text:ie("retry.none")}])},[Fh,Ua,en,$t,ie]);h.useEffect(()=>{const A=q=>{if(!Zu&&q.ctrlKey&&!q.metaKey&&!q.altKey&&!q.shiftKey){if(q.key==="l"){q.preventDefault(),N$();return}if(q.key==="o"){q.preventDefault(),I$();return}if(q.key==="y"){q.preventDefault(),JE();return}}};return window.addEventListener("keydown",A,!0),()=>window.removeEventListener("keydown",A,!0)},[Zu,N$,I$,JE,$t,ie]);const Sm=h.useCallback(()=>{CS.current=null,i$(!1),o$(!1),z1.current&&(clearTimeout(z1.current),z1.current=null)},[]),G$=h.useRef({streamingState:or,pendingApproval:Ha,interactionBlocked:Zu,activePanel:Vn,closePanel:Ao,handleCancel:QE,handleCycleMode:GE});G$.current={streamingState:or,pendingApproval:Ha,interactionBlocked:Zu,activePanel:Vn,closePanel:Ao,handleCancel:QE,handleCycleMode:GE};const g0e=or!=="idle";h.useEffect(()=>{Sm()},[g0e,Sm]),h.useEffect(()=>{const G=(ke,Ne)=>{CS.current=ke,ke==="cancel"?o$(!0):i$(!0),z1.current&&clearTimeout(z1.current),z1.current=setTimeout(Sm,Ne)},re=ke=>{var At,Gt;if(ke.defaultPrevented||ke.isComposing)return;const Ne=G$.current;if(ke.key==="Escape"&&Ne.activePanel){const bt=ke.target;bt!=null&&bt.closest("[data-sidebar-shell]")||(ke.preventDefault(),Ne.closePanel());return}if(ke.key!=="Escape"){CS.current!==null&&Sm(),ke.key==="Tab"&&ke.shiftKey&&!Ne.interactionBlocked&&(ke.preventDefault(),Ne.handleCycleMode());return}const at=QRt({blocked:!!Ne.pendingApproval||Ne.interactionBlocked,streaming:Ne.streamingState!=="idle",hasInput:!!((At=mi.current)!=null&&At.hasInput()),armed:CS.current});if(at.kind!=="ignore")switch(ke.preventDefault(),at.kind){case"cancel":Ne.handleCancel(),Sm();break;case"clear":(Gt=mi.current)==null||Gt.clear(),Sm();break;case"arm":G(at.action,at.action==="cancel"?2e3:500);break}};return window.addEventListener("keydown",re),()=>{window.removeEventListener("keydown",re),Sm()}},[Sm]);const ZE=iSt({catchingUp:!!Ce.catchingUp,pendingApproval:Ha!==null,isPreparingPrompt:$E}),K$={catchingUp:!!Ce.catchingUp,isPreparingPrompt:$E,isStreaming:or!=="idle"},b0e=Dfe(K$),KS=de==null?void 0:de[b0e],y0e=KS!=null&&KS.trim()?KS:ie(oSt(K$)),yw=h.useCallback(A=>{if(!es.current.sessionId){F1(A);return}PS(!0),Rt.setModel(A).then(q=>{const G=W9t(q);F1((G==null?void 0:G.modelId)??A),G&&$t.dispatch({type:"debug",text:V9t(G,ie),source:"model_switch_summary",data:G})}).catch(q=>{en(q,ie("model.switch"))}).finally(()=>PS(!1))},[Rt,$t,en,ie,F1]),v0e=h.useCallback(A=>{PS(!0),Jt.deleteModel(A).then(q=>{q!=null&&q.requiresRestart&&$t.dispatch([{type:"status",text:ie("settings.requiresRestart")}]),LS().catch(G=>{console.warn("[web-shell] failed to reload providers after delete",G)}),Ec().catch(G=>{console.warn("[web-shell] failed to reload settings after delete",G)})}).catch(q=>{en(q,ie("settings.models.deleteFailed"))}).finally(()=>PS(!1))},[Jt,LS,Ec,en,$t,ie]),Y$=h.useCallback(()=>{RE(!1),LS().catch(A=>{console.warn("[web-shell] failed to reload providers after auth dialog close",A)})},[LS]),w0e=h.useCallback(A=>{xS(!1),ed(Cc,"modelFallbacks",A.join(",")).then(q=>{q!=null&&q.requiresRestart&&$t.dispatch([{type:"status",text:ie("settings.requiresRestart")}]),Ec().catch(G=>{console.warn("[web-shell] failed to reload settings after fallbacks save",G)})}).catch(q=>en(q,ie("settings.models.fallbacks.saveFailed")))},[Cc,ed,Ec,en,$t,ie]),x0e=h.useCallback(A=>{if(or!=="idle"){Rd();return}Ao(),Ua(`/model --fast ${A}${Cc==="user"?" --global":" --project"}`).then(()=>{Ec().catch(G=>{console.warn("[web-shell] failed to reload workspace settings after fast-model switch",G)})}).catch(G=>{en(G,"Failed to switch fast model")})},[Rd,Ao,Ua,or,en,Ec,Cc]),k0e=h.useCallback(A=>{var re;const q=bX(A),G=HE.current;if(!G||G.ownerKey!==((re=hw.current)==null?void 0:re.ownerKey)){en(new Error("The Voice workspace changed before the selection applied."),ie("model.setVoice"));return}OS(q,Cc,G).catch(ke=>en(ke,ie("model.setVoice")))},[Cc,en,ie,OS]),_0e=h.useCallback(A=>{const q=JRt(A);ed(Cc,"visionModel",q).catch(G=>en(G,ie("model.setVision")))},[Cc,en,ed,ie]),S0e={main:yw,fast:x0e,voice:k0e,vision:_0e};h.useEffect(()=>{!Ki&&!vm&&!Uh&&tw("workspace")},[Ki,vm,Uh]);const X$=h.useMemo(()=>{const A=new Set((Ce.skills??[]).map(re=>re.toLowerCase())),q=bE?(Ce.commands??[]).filter(re=>re.source!=="skill"&&!A.has(re.name.toLowerCase())):Ce.commands??[],G=bE?ew.map(re=>({name:re.name,description:re.description,...re.argumentHint?{argumentHint:re.argumentHint}:{},source:"skill",displayCategory:"skill"})):[];return zfe(Ffe(q,G,$fe(ie,{sideTaskAvailable:Zl})),ie).filter(re=>!bw.has(NN(re.name))).map(re=>{const ke=Bfe(re.name);return ke?{...re,displayCategory:"skill",description:ie(ke)}:re})},[Ce.commands,Ce.skills,bw,ew,bE,Zl,ie]),vw=h.useMemo(()=>{var A;return{version:((A=Ce.capabilities)==null?void 0:A.qwenCodeVersion)||"",cwd:Ce.workspaceCwd||"",currentModel:Vh,currentMode:Tc,hideTips:(V1==null?void 0:V1.values.effective)===!0}},[(AB=Ce.capabilities)==null?void 0:AB.qwenCodeVersion,Ce.workspaceCwd,Vh,Tc,V1==null?void 0:V1.values.effective]),C0e=h.useMemo(()=>a.jsx(a.Fragment,{children:k?k(vw):a.jsx(D0t,{...vw})}),[k,vw]),YS=h.useMemo(()=>_==null?void 0:_(vw),[_,vw]),Oo=!Ce.sessionId&&ge.length===0&&!bm&&!Ha&&!Zr,Q$=Oo&&T,ww=Q$&&!!YS,T0e=Oo&&ww,e8=Oo&&Q$,t8=Ce.status!=="connecting"&&!Ce.sessionId&&Ce.missingSession===!0&&!Vn&&Fs==="chat",n8=Oo?B4():sn,J$=Ot?(Vt==null?void 0:Vt.branch)??Ot.branch:Qs?(Vt==null?void 0:Vt.branch)??Qs.name:Ce.sessionId?Ce.gitBranch:(Vt==null?void 0:Vt.branch)??void 0,xw=Fa===null||Fa>=v9t+w9t,XS=sn!=="wide"&&xw,kw=ou&&!Oo&&!Vn&&Fs==="chat",Z$=h.useCallback(A=>{if(!A){xt.current=!1,Ci(!1);return}Ci(!0)},[]),E0e=h.useCallback(()=>{xt.current=!1,Ci(!1)},[]),eB=h.useCallback(A=>{A?fi(!0):A0()},[A0]);h.useLayoutEffect(()=>{const A=kc.current;if(!A)return;const q=()=>{const ke=A.getBoundingClientRect().width;ke<=0||Rr(Ne=>Ne===ke?Ne:ke)},G=()=>{xt.current=!1,q()};q(),window.addEventListener("resize",G);const re=new ResizeObserver(q);return re.observe(A),()=>{window.removeEventListener("resize",G),re.disconnect()}},[]);const tB=h.useRef(xw);h.useLayoutEffect(()=>{const A=tB.current&&!xw;tB.current=xw,A&&!xt.current&&Ci(!1)},[xw]);const nB=h.useRef(Ar);h.useLayoutEffect(()=>{const A=!nB.current&&Ar;if(nB.current=Ar,!Ar){xt.current=!1;return}if(!A)return;!xt.current&&!XS&&Ci(!1)},[Ar,XS]);const A0e=!Oo&&!Vn&&Fs==="chat",j0e=Yme(Y),sB=[Lt.app,Lt.appChat,Oo?Lt.appChatEmpty:void 0,we.enabled?Lt.appWithSidebar:void 0,Wh===Fr.Light?Lt.themeLight:Lt.themeDark,Wh===Fr.Dark?"dark":void 0,o].filter(Boolean).join(" "),rB=h.useMemo(()=>({...l,...B9t(n8,Y)}),[Y,n8,l]),iB=h.useCallback(A=>{Ye(A),$9t(A)},[]);return h.useLayoutEffect(()=>{const A=ym.current;if(!A)return;const q=ea.current,G=Yv.current,re=A.getBoundingClientRect();if(G&&!Oo&&q){const ke=q.top-re.top;Math.abs(ke)>1&&(A.style.transition="width 320ms ease",A.style.transform=`translateY(${ke}px)`,requestAnimationFrame(()=>{A.style.transition="width 320ms ease, transform 280ms ease",A.style.transform=""}),window.setTimeout(()=>{A.style.transition=""},320))}ea.current=re,Yv.current=Oo},[Oo]),h.useLayoutEffect(()=>{const A=it.portals?document.createElement("div"):null,q=(A==null?void 0:A.attachShadow({mode:"open"}))??null,G=document.createElement("div");if(G.dataset.webShellPortalRoot="",G.dataset.webShellShadcn="",A&&q){A.dataset.webShellShadowHost="portals",A.style.setProperty("all","initial","important"),A.style.setProperty("position","fixed","important"),A.style.setProperty("inset","0","important"),A.style.setProperty("width","0","important"),A.style.setProperty("height","0","important"),A.style.setProperty("z-index","var(--web-shell-portal-root-z-index, 1000)","important");const re=Rme(q,it.styles);return q.appendChild(G),document.body.appendChild(A),Z(G),()=>{A.remove(),re(),Z(null)}}else return document.body.appendChild(G),Z(G),()=>{G.remove(),Z(null)}},[it.portals,it.styles]),h.useLayoutEffect(()=>{const A=Gv.current;if(!A||!lu)return;const q=lu.getRootNode(),G=q instanceof ShadowRoot?q.host:null;let re=null;const ke=()=>{re=null;const Gt=getComputedStyle(A),bt=new Set;lu.dataset.webShellShadcn="",lu.classList.toggle("dark",Wh===Fr.Dark),lu.lang=$n;for(let kt=0;kt<Gt.length;kt+=1){const Mn=Gt[kt];if(!Mn.startsWith("--"))continue;bt.add(Mn);const rs=Gt.getPropertyValue(Mn);lu.style.setProperty(Mn,rs),G==null||G.style.setProperty(Mn,rs)}for(const kt of Re.current)bt.has(kt)||(lu.style.removeProperty(kt),G==null||G.style.removeProperty(kt));Re.current=bt},Ne=()=>{re===null&&(re=requestAnimationFrame(ke))};ke();const at=new MutationObserver(Ne);let At=A;for(;At;)at.observe(At,{attributes:!0,attributeFilter:["class","style","data-theme","lang"]}),At=At.parentElement;return window.addEventListener("resize",Ne),()=>{at.disconnect(),window.removeEventListener("resize",Ne),re!==null&&cancelAnimationFrame(re)}},[sB,rB,lu,$n,Wh]),a.jsx(i2e,{value:Wh,children:a.jsx(BSe,{language:$n,children:a.jsx(Fee.Provider,{value:lu,children:a.jsxs("div",{ref:Gv,className:sB,style:rB,"data-web-shell-root":!0,"data-web-shell-shadcn":!0,lang:$n,children:[!ze&&a.jsx(Npt,{toasts:cn,onDismiss:Us}),$O&&a.jsx(Fi,{title:ie("resume.title"),size:"lg",onClose:()=>yE(!1),children:a.jsx(sgt,{workspaceCwd:et,onSelect:A=>{Xe(),Ao(),Xh.current+=1,Rt.loadSession(A).catch(q=>{en(q,"Failed to load session")})},onClose:()=>yE(!1)})}),Ki&&a.jsx(Fi,{title:ie(E9t[Ki]),size:"lg",onClose:()=>Ju(null),children:a.jsx(Sgt,{mode:Ki,models:Ki==="voice"?ape:void 0,currentModelId:Ki==="voice"?Fpe:Ki==="vision"?qpe:Ki==="fast"?Hpe:void 0,onSelect:A=>{Ki&&S0e[Ki](A),Ju(null)}})}),O1&&a.jsx(Fi,{title:ie("mode.select"),size:"sm",onClose:()=>$1(!1),children:a.jsx(ngt,{currentMode:Tc,onSelect:A=>{_m(A),$1(!1)}})}),UO&&a.jsx(Fi,{title:ie("tools.title"),size:"lg",onClose:()=>WO(!1),children:a.jsx(rbt,{})}),wm&&a.jsx(gvt,{workspaceCwd:wm.workspaceCwd,gitCwd:wm.gitCwd,initialView:wm.view,sessionId:Ce.sessionId,resolveSessionForWorkspace:Tpe,onClose:()=>xm(void 0)},`${wm.workspaceCwd}:${wm.gitCwd??""}:${wm.view}`),sw&&a.jsx(Fi,{title:M0.length>0?ie("planExecution.dialogTitle"):ie("tasks.title"),size:"lg",onClose:()=>B0(null),children:a.jsx(che,{message:sw,embedded:!0,manageActiveEvent:!1,onClose:()=>B0(null),planTodos:M0,agentTools:Cpe,onOpenSubagent:A=>{B0(null),N1(A)},onOpenMonitor:DE})}),e$&&a.jsx(Fi,{title:ie("memory.menu"),size:"lg",onClose:()=>t$(!1),children:a.jsx(j1t,{refreshSignal:mpe,addSignal:gpe,addScope:wpe,onMessage:(A,q="status")=>{$t.dispatch([{type:q,text:A}])}})}),qO&&a.jsx(Fi,{title:ie("help.title"),size:"md",onClose:()=>kE(!1),children:a.jsx($Nt,{commands:X$})}),HO&&a.jsx(Fi,{title:ie("theme.title"),size:"sm",onClose:()=>_E(!1),children:a.jsx(BNt,{currentTheme:Wh,onSelect:dw,onClose:()=>_E(!1)})}),Uh&&a.jsx(Fi,{title:ie("auth.title"),size:"lg",onClose:Y$,children:a.jsx(nbt,{onMessage:(A,q="status")=>{$t.dispatch([q==="error"?{type:"error",text:A}:{type:"status",text:A}])},onClose:Y$})}),vm&&a.jsx(Fi,{title:ie("settings.models.fallbacks.title"),size:"md",onClose:()=>xS(!1),children:a.jsx($gt,{models:Wpe,current:Upe,max:3,onConfirm:w0e,onClose:()=>xS(!1)})}),BO&&a.jsx(Fi,{title:ie("delete.title"),size:"lg",onClose:()=>vE(!1),children:a.jsx(zNt,{workspaceCwd:et,onDeleted:A=>{$t.dispatch([{type:"status",text:A.length===1?`${ie("delete.deleted")} (${A[0].slice(0,8)})`:ie("delete.deletedCount",{count:A.length})}])},onError:A=>{if(bb(A))return;const q=A instanceof Error?A.message:String(A);dn("error",ie("delete.failed",{reason:q}))},onClose:()=>vE(!1)})}),zO&&a.jsx(Fi,{title:ie("release.title"),size:"lg",onClose:()=>wE(!1),children:a.jsx(FNt,{workspaceCwd:et,onReleased:A=>{$t.dispatch([{type:"status",text:`${ie("release.released")} (${A.slice(0,8)})`}])},onError:A=>{if(bb(A))return;const q=A instanceof Error?A.message:String(A);dn("error",ie("release.failed",{reason:q}))},onClose:()=>wE(!1)})}),FO&&a.jsx(Fi,{title:ie("rewind.title"),subtitle:ie("rewind.subtitle"),size:"lg",onClose:()=>xE(!1),children:a.jsx(r7t,{blocks:xs,loadSnapshots:o0e,rewind:a0e,onError:l0e,onClose:()=>xE(!1)})}),!et&&pr&&a.jsx(o7t,{onClose:()=>xe(!1),onAdd:Ype,onSuggest:A=>Jt.suggestWorkspacePaths(A),onPick:async()=>{const A=await Jt.pickWorkspaceDirectory();return A.selected?A.path:void 0},persistenceSupported:Bs,displayNameEnabled:Si}),vs!=="clear"&&a.jsx(Fi,{title:ie("sidebar.scratchOutcomeUnknownTitle"),size:"md",dismissible:!1,onClose:()=>{},children:a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsx("p",{children:ie("sidebar.scratchOutcomeUnknown")}),a.jsx("ul",{className:"max-h-48 overflow-y-auto text-sm text-muted-foreground",children:Wn.map(A=>a.jsx("li",{children:A.cwd},A.id))}),a.jsx("div",{className:"flex justify-end",children:vs==="refreshing"?a.jsx(Kt,{type:"button",onClick:()=>void KE(),children:ie("sidebar.scratchOutcomeRefresh")}):a.jsx(Kt,{type:"button",onClick:()=>Xs("clear"),children:ie("sidebar.scratchOutcomeAcknowledge")})})]})}),a.jsxs("div",{className:Lt.appShell,children:[we.enabled&&a.jsxs("div",{"data-sidebar-shell":"",...ln?{role:"dialog","aria-modal":"true"}:{},"aria-label":ie("sidebar.label"),className:[Lt.mobileDrawer,ln?Lt.mobileDrawerOpen:void 0,ns?Lt.mobileDrawerForced:void 0].filter(Boolean).join(" "),children:[a.jsx("div",{className:Lt.mobileBackdrop,onClick:Xe,"aria-hidden":"true"}),a.jsx(jRt,{collapsed:(Wt||Fs==="split"&&!fn)&&!ln,onCollapsedChange:Qn,onOpenSettings:()=>{Xe(),dl("settings")},onOpenPlugins:()=>{Xe(),dl("plugins")},onOpenChannels:()=>{Xe(),dl("channels")},onOpenDaemonStatus:()=>{Xe(),dl("status")},onOpenScheduledTasks:()=>{Xe(),AE()},onOpenGoals:()=>{Xe(),B1()},onOpenSessions:()=>{Xe(),dl("sessions")},canOpenSessionsOverview:ot,onOpenSplitView:()=>{Xe(),$0()},canOpenSplitView:ot,theme:Wh,onThemeChange:A=>{dw(A),ed("workspace",vg,Wee(A))},onNewSession:A=>ec(A),onLoadSession:(A,q)=>(Eo("chat"),q0(A,q)),onSelectCurrentSession:()=>{Xe(),Eo("chat"),Ao()},onError:en,mobileOpen:ln,sessionListReloadToken:m$,selectedWorkspaceCwd:fs,onSelectWorkspace:ks,onOpenGitDiff:A=>xm({workspaceCwd:A,gitCwd:A===pn?Ot==null?void 0:Ot.path:void 0,view:"diff"}),onOpenCommit:A=>xm({workspaceCwd:A,gitCwd:A===pn?Ot==null?void 0:Ot.path:void 0,view:"commit"}),onOpenAddWorkspace:Ys?()=>xe(!0):void 0,workspaces:Wn,lockedWorkspaceCwd:et,lockedWorkspace:we.lockedWorkspace,branding:we.branding,primaryNav:we.primaryNav,hideProjectHeader:we.hideProjectHeader,sessionActions:we.sessionActions,footer:we.footer})]}),a.jsxs("div",{className:Lt.contextShell,children:[ce&&!Oo&&!Vn&&Fs==="chat"&&a.jsxs("div",{className:Lt.chatHeaderRow,children:[we.enabled&&we.showCompactToggle&&a.jsx("button",{type:"button",className:Lt.hamburgerButton,onClick:()=>{lt(!1),Bn(A=>!A)},"aria-label":ie("sidebar.toggleMenu"),"aria-expanded":ln,children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),a.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),a.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),$?a.jsx("div",{className:Lt.customChatHeader,children:$({sessionId:Ce.sessionId,sessionName:rw,workspaceCwd:Ce.workspaceCwd,items:We,environmentPanelOpen:kw,rightPanelOpen:Ar,onEnvironmentPanelOpenChange:Z$,onRightPanelOpenChange:eB})}):a.jsx(j0t,{content:De?rw??ie("session.new"):null,environmentOpen:kw,environmentAvailable:ct,rightPanelOpen:Ar,rightPanelAvailable:qe&&!Ar,onToggleEnvironment:()=>Z$(!kw),onToggleRightPanel:()=>eB(!Ar)})]}),a.jsxs("div",{ref:kc,"data-testid":"context-body",className:[Lt.contextBody,kw&&XS?Lt.contextBodyWithEnvironmentPanel:void 0].filter(Boolean).join(" "),children:[a.jsxs("div",{ref:Ql,"data-testid":"chat-pane-container",className:[Lt.chatPane,Fs!=="chat"?Lt.chatPaneShowingPage:void 0,e8?Lt.chatPaneWithMobileComposerBottom:void 0].filter(Boolean).join(" "),children:[Oo&&!t8&&!Vn&&Fs==="chat"&&a.jsx(O0t,{}),we.enabled&&we.showCompactToggle&&(!ce||Oo)&&!Vn&&Fs==="chat"&&a.jsx("button",{type:"button",className:[Lt.hamburgerButton,!ce||Oo?Lt.hamburgerButtonFloating:void 0].filter(Boolean).join(" "),onClick:()=>{lt(!1),Bn(A=>!A)},"aria-label":ie("sidebar.toggleMenu"),"aria-expanded":ln,children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),a.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),a.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),Vn&&a.jsxs("section",{className:Lt.panelHost,role:"region","data-testid":"inline-panel","aria-label":ie(Vn==="settings"?"settings.title":Vn==="status"?"daemon.title":Vn==="extensions"?"extensions.manage.title":Vn==="mcp"?"mcp.title":Vn==="skills"?"skills.title":Vn==="agents"?"agents.title":Vn==="plugins"?"plugins.title":Vn==="channels"?"channels.title":"sessionsOverview.title"),children:[Vn!=="extensions"&&Vn!=="mcp"&&Vn!=="skills"&&Vn!=="agents"&&Vn!=="plugins"&&Vn!=="channels"&&a.jsxs("div",{className:Lt.panelHeader,children:[a.jsx("button",{ref:QO,type:"button",className:Lt.panelBack,"data-testid":"panel-back",onClick:Ao,"aria-label":ie("common.back"),title:ie("common.back"),children:a.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{d:"M15 5l-7 7 7 7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),a.jsx("div",{className:Lt.panelTitle,children:ie(Vn==="settings"?"settings.title":Vn==="status"?"daemon.title":"sessionsOverview.title")})]}),a.jsx("div",{className:Lt.panelBody,children:a.jsx(Mjt,{enabled:it.plugins&&Ajt(Vn),language:$n,themeClassName:[Wh===Fr.Light?Lt.themeLight:Lt.themeDark,Wh===Fr.Dark?"dark":void 0].filter(Boolean).join(" "),styles:it.styles,initialFocusRef:Vn==="plugins"?ME:Vn==="extensions"||Vn==="channels"?SS:void 0,children:Vn==="settings"?a.jsx(oNt,{settingsState:zpe,embedded:!0,onLanguageChange:Vpe,onThemeChange:dw,chatWidthMode:sn,onChatWidthModeChange:iB,modelManagement:{providers:DS.providers,currentModelId:Ce.currentModel??void 0,loading:DS.loading,error:DS.error,busy:$pe,onSelectModel:yw,onDeleteModel:v0e,onAddModel:()=>RE(!0)},onSubDialog:(A,q)=>{A==="fastModel"?(tw(q),Ju("fast")):A==="visionModel"?(tw(q),Ju("vision")):A==="voiceModel"?UE(q,"settings"):A==="modelFallbacks"?(tw(q),xS(!0)):A==="tools.approvalMode"&&$1(!0)}}):Vn==="status"?a.jsx(vkt,{}):Vn==="extensions"?a.jsx(Ame,{onClose:Ao,initialFocusRef:SS}):Vn==="mcp"&&kS?a.jsx(Nme,{message:kS,onClose:()=>{TE(null),Ao()}}):Vn==="skills"?a.jsx(gfe,{onClose:Ao,onUseSkill:KO}):Vn==="agents"?a.jsx(ffe,{onClose:()=>{nw(null),Ao()},initialCreateScope:kpe}):Vn==="plugins"?a.jsx(rAt,{mcpMessage:kS,loadMcpMessage:async()=>{try{await cpe()}catch(A){throw en(A,"Failed to load MCP status"),A}},onClose:Ao,onUseSkill:KO,initialFocusRef:ME}):Vn==="channels"?a.jsx(Tjt,{onClose:Ao,initialFocusRef:SS}):a.jsx(g_t,{onOpenSession:YE,onOpenSplit:$0,includeOtherWorkspaces:!et,workspaceCwd:et})})},Vn)]}),Fs==="scheduledTasks"&&a.jsxs("div",{className:Lt.fullPage,"data-testid":"scheduled-tasks-page",children:[a.jsxs("div",{className:Lt.fullPageHeader,children:[a.jsx("button",{type:"button",className:Lt.fullPageBack,onClick:()=>Eo("chat"),"aria-label":ie("common.back"),title:ie("common.back"),children:a.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:a.jsx("path",{d:"M15 18l-6-6 6-6"})})}),a.jsx("div",{className:Lt.fullPageTitle,children:ie("scheduledTasks.title")})]}),a.jsx("div",{className:Lt.fullPageBody,children:a.jsx(a8t,{onRunPrompt:r0e,workspaces:et?Qr:Wn,lockedWorkspace:Mt,onCreateViaChat:()=>{ec().then(A=>{A&&(e==null||e(void 0),window.setTimeout(()=>{var q,G;(q=mi.current)==null||q.insertText(ie("scheduledTasks.chatStarter"),{mode:"replace"}),(G=mi.current)==null||G.focus()},0))})},onOpenSession:A=>{Eo("chat"),q0(A).catch(q=>{en(q,"Failed to open session")})},onError:en})})]}),Fs==="goals"&&a.jsxs("div",{className:Lt.fullPage,"data-testid":"goals-page",children:[a.jsxs("div",{className:Lt.fullPageHeader,children:[a.jsx("button",{type:"button",className:Lt.fullPageBack,onClick:()=>Eo("chat"),"aria-label":ie("common.back"),title:ie("common.back"),children:a.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:a.jsx("path",{d:"M15 18l-6-6 6-6"})})}),a.jsx("div",{className:Lt.fullPageTitle,children:ie("goals.title")})]}),a.jsx("div",{className:Lt.fullPageBody,children:a.jsx(U8t,{onCreateGoal:async A=>{const q=jS.current;if(!(q!==void 0&&es.current.sessionId===q)){if(!await ec(void 0,{keepView:!0}))return!1;e==null||e(void 0)}try{await Ua(`/goal ${A}`,void 0,{clearComposerOnPromptStart:!0})}catch(re){throw jS.current=es.current.sessionId,re}jS.current=void 0,Eo("chat")},onOpenSession:A=>{Eo("chat"),q0(A).catch(q=>{en(q,"Failed to open session")})},onError:en})})]}),Fs==="split"&&a.jsxs("div",{className:Lt.fullPage,"data-testid":"split-view-page",children:[wa&&a.jsxs("div",{className:Lt.splitApprovalNotice,role:"status","data-testid":"split-approval-notice",children:[a.jsx("span",{children:ie("splitView.outerApprovalPending")}),a.jsx("button",{type:"button",onClick:()=>Eo("chat"),children:ie("splitView.goToApproval")})]}),a.jsx(aq,{value:Os,children:a.jsx(i1.Provider,{value:$S,children:a.jsx(dTt,{sessionIds:qh,onPanesChange:upe,sessionListReloadToken:m$,includeOtherWorkspaces:!et,workspaceCwd:et,onExit:dpe,onError:en,onSlashCommand:b,onRightPanelOpen:E0,onOpenMonitor:T0,onPaneArtifactsChange:Zs,messageTurnOutputs:fe,restartSseOnPrompt:rt,historyPageSize:dt,renderPaneHeaderActions:le,voiceUserRevision:MS,voiceWorkspaceRevisions:BE,voiceWorkspaces:(jB=gt.capabilities)!=null&&jB.workspaces||Mt?Wn:void 0})})})]}),a.jsxs("div",{className:[Lt.chatViewWrap,e8?Lt.chatViewWithMobileComposerBottom:void 0,T0e?Lt.chatViewWithWelcomeMiddle:void 0,Vn||Fs!=="chat"?Lt.chatViewHidden:void 0].filter(Boolean).join(" "),"aria-hidden":Vn||Fs!=="chat"?!0:void 0,children:[t8&&a.jsxs("div",{className:Lt.missingSessionState,children:[a.jsx("div",{className:Lt.missingSessionMessage,children:ie("session.missing")}),a.jsx("button",{type:"button",className:Lt.missingSessionButton,disabled:Zme,onClick:s0e,children:ie("session.new")})]}),a.jsx("div",{className:t8?Lt.chatSubtreeHidden:Lt.chatSubtree,children:a.jsxs(aq,{value:Os,children:[a.jsx(i1.Provider,{value:$S,children:a.jsx(y9t,{timeline:uS,details:dS,children:a.jsx(Zse.Provider,{value:vpe,children:(()=>{var Ne;const A=[Lt.content,bm||ge.length>0||Ha?Lt.contentHasMessages:void 0].filter(Boolean).join(" "),q=a.jsx(rO,{ref:L0,messages:ge,pendingApproval:gm,onShowContextDetail:Gpe,loadingTranscript:Ce.loadingTranscript,catchingUp:Ce.catchingUp,hasOlderHistory:mn.hasMore,loadingOlderHistory:mn.loading,historyCapacityReached:mn.capacityReached,historyPaginationError:mn.paginationError,onLoadOlderHistory:mn.loadMore,transcriptBlockCount:xs.length,transcriptActivity:$t,onReloadTranscript:uo?Ii:void 0,isResponding:or!=="idle"&&!fE,activeTurnStartedAt:fE?void 0:(Er==null?void 0:Er.startedAt)??DO,workspaceCwd:Ce.workspaceCwd||"",hideSessionTimeline:n8==="wide",showRetryHint:pE,onRetryClick:JE,failedPromptMessageId:br==null?void 0:br.messageId,onRetryFailedPrompt:Ipe,onBranchSession:Kpe,bottomOverlayInset:Qe,welcomeHeader:Oo?C0e:void 0,centerWelcomeHeader:ww||void 0,tailContent:void 0,tailKey:void 0,onCanScrollToBottomChange:p0e,virtualScrollThreshold:ae,turnFileChanges:Gi.has("file")?ba:void 0,turnArtifacts:Gi.has("artifact")?mo:void 0,turnScheduledTasks:Gi.has("scheduled_task")?er:void 0,onTurnOutputOpen:E0,onReviewChanges:C0,onOpenArtifact:lE,onOpenScheduledTask:A1,onError:en,generateContent:(Ne=Ce.capabilities)!=null&&Ne.features.includes("session_generation")?Rt.generateSessionContent:void 0}),G=a.jsx(ghe,{onOpen:N1,children:q}),re=Or?a.jsx(yhe,{onOpen:Xu,children:G}):G,ke=!ww&&(Zr==null?void 0:Zr.role)==="btw"?a.jsx("div",{className:Lt.btwPanel,children:a.jsx(Nhe,{question:Zr.question,answer:Zr.answer,isPending:Zr.isPending})}):null;return ww?a.jsxs("div",{className:Lt.mobileWelcomeGroup,children:[a.jsxs("div",{style:As,className:A,children:[re,ke]}),a.jsx("div",{className:Lt.mobileWelcomeFooterMiddle,children:YS})]}):a.jsxs("div",{style:As,className:A,children:[re,ke]})})()})})}),a.jsxs("div",{ref:ym,style:As,className:rr?`${Lt.footer} ${Lt.footerWithCustomFooter}`:Lt.footer,children:[Kv&&a.jsx("div",{className:R0?`${Lt.scrollToBottomLayer} ${Lt.scrollToBottomLayerWithTodos}`:Lt.scrollToBottomLayer,children:a.jsx("button",{type:"button",className:Lt.scrollToBottomButton,"aria-label":ie("chat.scrollToBottom"),onClick:()=>cu("smooth"),children:a.jsx("svg",{className:Lt.scrollToBottomIcon,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{d:"M12 5v13M6.5 12.5 12 18l5.5-5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})})}),R0&&a.jsx("div",{ref:Ue,className:Lt.bottomPanels,children:a.jsx(Jpt,{todos:bm?M0:[],statusItems:Vv,onOpen:bm?VS:void 0})}),gm&&Fs==="chat"&&a.jsx("div",{"data-testid":"approval-overlay",className:Lt.approvalOverlay,children:a.jsx(Hfe,{request:gm,onConfirm:d0e,variant:"floating",keyboardActive:hpe,planTodos:cS})}),N0&&Fs==="chat"&&a.jsx("div",{"data-testid":"approval-overlay",className:Lt.approvalOverlay,children:a.jsx(Ufe,{request:N0,onConfirm:h0e,onError:en,variant:"floating",keyboardActive:fpe})}),a.jsxs("div",{className:Lt.composer,children:[or!=="idle"?fE?null:a.jsx(lfe,{startedAt:(Er==null?void 0:Er.startedAt)??DO}):Sa?a.jsxs("div",{className:Lt.composerActionTip,role:"status","data-testid":Sa.suggestion==="btw"?"btw-suggestion":"new-session-suggestion",children:[a.jsx("span",{className:Lt.composerActionTipIcon,"aria-hidden":"true",children:"✦"}),a.jsx("span",{className:Lt.composerActionTipText,children:Sa.suggestion==="btw"?ie("editor.btwSuggestionTitle"):ie("editor.newSessionSuggestionTitle")}),a.jsx("div",{className:Lt.composerActionTipActions,children:a.jsx("button",{type:"button",className:`${Lt.composerActionTipButton} ${Lt.composerActionTipButtonPrimary}`,"data-testid":Sa.suggestion==="btw"?"btw-suggestion-send":"new-session-suggestion-start",onMouseDown:A=>A.preventDefault(),onClick:Sa.suggestion==="btw"?n0e:t0e,children:Sa.suggestion==="btw"?ie("editor.btwSuggestionSend"):ie("editor.newSessionSuggestionStart")})})]}):_pe&&or==="idle"?a.jsx("div",{className:Lt.escClearStatus,role:"status",children:ie("editor.escClearHint")}):null,a.jsx(qfe,{prompts:Mpe,t:ie,canMutateMidTurn:w$,onDelete:Dpe,onEdit:Lpe}),Es&&a.jsx("div",{className:Lt.composerHeader,children:a.jsx(Es,{disabled:ZE,isRunning:or!=="idle",currentMode:Tc,currentModel:Vh,sessionName:rw})}),a.jsx(afe,{ref:pS,onSubmit:u0e,onInputTextChange:e0e,onAttachmentsChange:Zpe,onCycleMode:GE,onToggleShortcuts:S$,onCancel:QE,isRunning:or!=="idle",isPreparing:$E||gS,cancelArmed:Spe,disabled:ZE||gS||Zu||wa,commands:X$,skills:ew,slashCommandCategoryOrder:g,builtinAtProviders:w,atProviders:y,composerTagIcons:v,voiceTarget:Vn!==null||Fs!=="chat"?void 0:Ms,voiceStatusRevision:v$,queuedMessages:Rpe,onFocusFooter:f0e,onPopQueuedMessages:Ppe,onClearQueuedMessages:Ope,currentMode:Tc,currentModel:Vh,gitBranch:J$,gitWorktree:!!Ot,gitCwd:Ot==null?void 0:Ot.path,gitModeIntent:IS?AS:void 0,onGitModeIntentChange:IS?aw:void 0,gitStatus:Vt,onOpenGitDiff:_a?b$:void 0,onOpenCommit:_a?y$:void 0,chatWidthMode:sn,showChatWidthToggle:!Oo,chatWidthToggleMin:j0e,visibleToolbarActions:ne??(Oo||!Ie?x9t:Wme),availableModels:Epe,onSelectMode:_m,onSelectModel:yw,workspaces:Gs,selectedWorkspaceCwd:Ce.sessionId?(NB=Wn.find(A=>A.cwd===Ce.workspaceCwd))!=null&&NB.primary?void 0:Ce.workspaceCwd:fs,workspaceSelectionDisabled:!1,atWorkspaceCwd:et??(Ce.sessionId?Ce.workspaceCwd:fs??((IB=Wn.find(A=>A.primary))==null?void 0:IB.cwd)),onSelectWorkspace:Xpe,scratchWorkspaceSupported:ho,existingFolderWorkspaceSupported:Ys,workspaceMutationBusy:Ge,onCreateScratchWorkspace:Qpe,onOpenExistingWorkspace:Jpe,onChatWidthModeChange:iB,sessionId:Ce.sessionId,sessionName:rw,dialogOpen:Zu||wa,followupState:epe,onAcceptFollowup:tpe,onDismissFollowup:npe,composerInput:Pt,composerInputVersion:St,placeholderText:y0e,animatePlaceholder:Oo}),cs&&a.jsx(cs,{disabled:ZE,isRunning:or!=="idle",currentMode:Tc,currentModel:Vh,sessionName:rw})]}),rr?e8?a.jsx("div",{className:Lt.customFooter,children:a.jsx(rr,{connected:Fh,mode:Tc,model:Vh,streamingState:or,contextUsageRatio:(Ce.contextWindow??0)>0?(Ce.tokenCount??0)/(Ce.contextWindow??0):0,activeGoal:L1,tasks:Nd,availableModes:nx,availableModels:(Ce.models??[]).filter(Sx).map(A=>({id:A.id,label:up(A.label||A.id),contextWindow:A.contextWindow})),skills:ew,onSelectMode:_m,onSelectModel:yw})}):a.jsx(rr,{connected:Fh,mode:Tc,model:Vh,streamingState:or,contextUsageRatio:(Ce.contextWindow??0)>0?(Ce.tokenCount??0)/(Ce.contextWindow??0):0,activeGoal:L1,tasks:Nd,availableModes:nx,availableModels:(Ce.models??[]).filter(Sx).map(A=>({id:A.id,label:up(A.label||A.id),contextWindow:A.contextWindow})),skills:ew,onSelectMode:_m,onSelectModel:yw}):a.jsx(upt,{onSelectMode:()=>$1(A=>!A),onSelectModel:()=>Ju(A=>A?null:"main"),onShowContext:()=>mw("/context",!1),onOpenSettings:()=>dl("settings"),ref:D0,onOpenTasks:()=>VS(),onReturnToInput:m0e,tasks:Oo||!wt?Sc:[],activeGoal:L1,onOpenGoals:B1,hideSettings:c0e,onToggleShortcuts:S$,compact:!0}),Oo&&YS&&a.jsx("div",{className:[Lt.emptyWelcomeFooter,ww?Lt.desktopWelcomeFooter:void 0].filter(Boolean).join(" "),children:YS})]})]})})]})]}),A0e&&a.jsx(S0t,{floating:!XS,hidden:!kw,workspaceCwd:(Ot==null?void 0:Ot.path)??pn,gitWorkspaceCwd:Ce.sessionId?_a:void 0,gitCwd:Ot==null?void 0:Ot.path,branch:J$,gitStatus:Vt,tasks:ii,agentTasks:R1,items:Qt,onOpenGitDiff:_a?b$:void 0,onOpenGitCommit:_a?y$:void 0,onOpenAgent:qv,onOpenTask:i0e,onDismiss:E0e}),Ar&&GO?a.jsx(OEt,{open:!0,direction:"right",shouldScaleBackground:!1,onOpenChange:A=>{A||A0()},children:a.jsxs(zEt,{className:"data-[vaul-drawer-direction=right]:w-[min(520px,calc(100vw-16px))] data-[vaul-drawer-direction=right]:sm:max-w-[520px]",children:[a.jsx(FEt,{className:"sr-only",children:"Right panel"}),a.jsx(SY,{artifacts:jl,tabs:ps,activeTabId:Xn,reviewChanges:bs,selectedReviewPath:go,workspaceCwd:Ce.workspaceCwd||"",loading:Ze,error:Bt,onSelectTab:xn,onCloseTab:Yu,onOpenFilePreview:lS,latestReviewAvailable:po.length>0,onOpenLatestReview:E1,items:Ve,sideTaskAvailable:Zl,sideTasks:Bv,sideTasksLoading:C1,onCreateSideTask:zv,onOpenSideTask:zh,onCreateSideTaskSession:Fv,onSideTaskCreated:aS,onSideTaskTitleChange:Bh,onNestedRightPanelOpen:E0,onNestedArtifactsChange:Zs,onError:en,onClose:A0,variant:"drawer"})]})}):null]})]}),Ar&&!GO&&a.jsxs("div",{className:Lt.artifactPanelDock,style:{"--artifact-panel-dock-width":`${ya+4}px`},children:[a.jsx("div",{className:Lt.artifactResizeHandle,role:"separator","aria-orientation":"vertical","aria-valuemin":gb,"aria-valuemax":T1(),"aria-valuenow":ya,onPointerDown:cE}),a.jsx("div",{className:Lt.artifactPanelClip,children:a.jsx(SY,{artifacts:jl,tabs:ps,activeTabId:Xn,reviewChanges:bs,selectedReviewPath:go,panelWidth:ya,workspaceCwd:Ce.workspaceCwd||"",loading:Ze,error:Bt,onSelectTab:xn,onCloseTab:Yu,onOpenFilePreview:lS,latestReviewAvailable:po.length>0,onOpenLatestReview:E1,items:Ve,sideTaskAvailable:Zl,sideTasks:Bv,sideTasksLoading:C1,onCreateSideTask:zv,onOpenSideTask:zh,onCreateSideTaskSession:Fv,onSideTaskCreated:aS,onSideTaskTitleChange:Bh,onNestedRightPanelOpen:E0,onNestedArtifactsChange:Zs,onError:en,onClose:A0})})]})]})]})})})})}function RN({title:e,description:t,actionLabel:n,onAction:s,theme:r,icon:i}){return a.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:a.jsxs(md,{className:"border",children:[a.jsxs(pd,{children:[a.jsx(gd,{variant:"icon",children:i??a.jsx(Dke,{})}),a.jsx(bd,{children:e}),a.jsx($v,{children:t})]}),a.jsx(o1t,{children:a.jsx(Kt,{onClick:s,children:n})})]})})}function iDt({sessionId:e,workspaceId:t,workspaceCwd:n,lockWorkspaceCwd:s,clientId:r,restartSseOnPrompt:i,historyPageSize:o=aD,webShellProps:l}){var C,N,E,O;const c=Co(),u=Qo(),[d,f]=h.useState(!1),[m,p]=h.useState(),[g,b]=h.useState(),w=h.useRef(void 0);h.useEffect(()=>f(!1),[e,s,n,t]);const y=d?void 0:e,v=d?void 0:s??n,x=v?void 0:t,k=h.useMemo(()=>{var D,j,L;const B=(j=(D=c.capabilities)==null?void 0:D.workspaces)==null?void 0:j.find(z=>z.cwd===v);if(B)return B;if(v&&v===((L=c.capabilities)==null?void 0:L.workspaceCwd))return{id:"primary",cwd:v,primary:!0,trusted:!0}},[v,(C=c.capabilities)==null?void 0:C.workspaceCwd,(N=c.capabilities)==null?void 0:N.workspaces]),_=s&&(m==null?void 0:m.requestedCwd)===s?m.workspace:void 0,T=v?k??_:(O=(E=c.capabilities)==null?void 0:E.workspaces)==null?void 0:O.find(B=>B.id===x),S=h.useMemo(()=>hD(jf(l.language)),[l.language]);return h.useEffect(()=>{var D;if(!s||!c.capabilities||k||(m==null?void 0:m.requestedCwd)===s||g===s)return;((D=w.current)==null?void 0:D.cwd)!==s&&(w.current={cwd:s,promise:u.addWorkspace(s,{persist:!0}).then(j=>{if(j.persisted!==!0)throw new Error("Workspace registration was not persisted");return j})});let B=!1;return w.current.promise.then(async j=>{var L;if(!B){p({requestedCwd:s,workspace:j}),b(void 0);try{await((L=c.refreshCapabilities)==null?void 0:L.call(c))}catch{}}}).catch(()=>{B||b(s)}),()=>{B=!0}},[k,m,g,c,c.capabilities,c.refreshCapabilities,u,s]),(v||x)&&c.status==="error"?a.jsx(RN,{title:S("workspace.loadFailed"),description:S("workspace.loadFailedDescription"),actionLabel:S("common.retry"),theme:l.theme,icon:a.jsx(rq,{}),onAction:()=>{var B;(B=c.refreshCapabilities)==null||B.call(c).catch(()=>{})}}):(v||x)&&!c.capabilities?a.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 ${l.theme==="dark"?"dark":""}`,role:"status","aria-live":"polite",children:[a.jsx(Ws,{}),a.jsx("span",{children:S("common.loading")})]}):s&&g===s?a.jsx(RN,{title:S("workspace.loadFailed"),description:S("workspace.loadFailedDescription"),actionLabel:S("common.retry"),theme:l.theme,icon:a.jsx(rq,{}),onAction:()=>{w.current=void 0,b(void 0)}}):s&&!T?a.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 ${l.theme==="dark"?"dark":""}`,role:"status","aria-live":"polite",children:[a.jsx(Ws,{}),a.jsx("span",{children:S("common.loading")})]}):(v||x)&&!T?a.jsx(RN,{title:S("workspace.notFound"),description:S("workspace.notFoundDescription"),actionLabel:S("session.new"),theme:l.theme,onAction:()=>{var B;f(!0),(B=l.onSessionIdChange)==null||B.call(l,void 0,void 0)}}):a.jsx(m5,{sessionId:y,workspaceCwd:T==null?void 0:T.cwd,clientId:r,historyPageSize:o,subagentTranscriptMode:"summary",maxBlocks:lD,suppressOwnUserEcho:!0,restartEventStreamOnPrompt:i,children:a.jsx(rDt,{...l,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 oDt=Ekt(),Xme="qwen-code-web-shell-language",Qme="qwen-code-web-shell-theme";function Jme(e){if(e===Fr.Dark||e===Fr.Light)return e}function aDt(){const e=new URLSearchParams(window.location.search).get("theme");return Jme(e)}function lDt(){try{return Jme(window.localStorage.getItem(Qme))}catch{return}}function cDt(e){try{window.localStorage.setItem(Qme,e)}catch{}}function uDt(){return aDt()??lDt()??Fr.Dark}function dDt(){try{const e=window.localStorage.getItem(Xme);return e?jf(e):void 0}catch{return}}function hDt(e){try{window.localStorage.setItem(Xme,e)}catch{}}function fDt(){const e=new URLSearchParams(window.location.search),t=e.get("language")??e.get("lang");return jf(t||(dDt()??navigator.language))}function mDt(){return wkt(window.location.pathname)}function pDt(){return new URLSearchParams(window.location.search).get("workspace")||void 0}function gDt(e,t){const n=new URL(window.location.href);n.pathname=wfe(n.pathname,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 bDt({daemonToken:e}){const[t,n]=h.useState(()=>uDt()),[s,r]=h.useState(()=>fDt()),[i]=h.useState(()=>mDt()),[o]=h.useState(()=>pDt()),l=oDt||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===Fr.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),cDt(f)},[]),u=h.useCallback(f=>{r(f),hDt(f)},[]),d=h.useCallback((f,m)=>{gDt(f,m)},[]);return a.jsx(Wf,{label:"web-shell-root",fallback:(f,m)=>a.jsx(oxe,{error:f,onRetry:m,language:s}),children:a.jsx(lwe,{baseUrl:l,token:e,children:a.jsx(iDt,{sessionId:i,workspaceId:o,webShellProps:{theme:t,onThemeChange:c,language:s,onLanguageChange:u,onSessionIdChange:d,sidebar:!0,header:{items:["title","environment","rightPanel"]},rightPanel:{items:["review","sideTask"]},environmentPanel:{items:["environment","subagents","backgroundTasks"]},compactThinking:!0,markdownTableMode:"advanced"}})})})}async function yDt(){const e=Tfe()??await Mkt();Rkt(),Abe.createRoot(document.getElementById("root")).render(a.jsx(Rn.StrictMode,{children:a.jsx(bDt,{daemonToken:e})}))}yDt();export{w1 as C,Hn as D,Yt as E,jn as F,em as G,w0 as P,ur as R,ll as S,Ir as T,Wi as V,iu as W,ye as _,Ts as a,wr as b,ua as c,Yp as d,Ch as e,VDt as f,XHe as g,kUe as h,lk as i,h_ as j,jDt as k,e0 as l};
